@hienlh/ppm 0.23.0 → 0.23.2

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 (382) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/CLAUDE.md +1 -0
  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-Cs7BC5O1.js +1 -0
  6. package/dist/web/assets/accounts-settings-section-Cs7BC5O1.js.br +0 -0
  7. package/dist/web/assets/accounts-settings-section-Cs7BC5O1.js.gz +0 -0
  8. package/dist/web/assets/{ai-resource-editor-DoCiQDKY.js → ai-resource-editor-TCREp5Ml.js} +1 -1
  9. package/dist/web/assets/ai-resource-editor-TCREp5Ml.js.br +0 -0
  10. package/dist/web/assets/ai-resource-editor-TCREp5Ml.js.gz +0 -0
  11. package/dist/web/assets/{ai-settings-section-0x6GFJ56.js → ai-settings-section-B7Un4KiW.js} +1 -1
  12. package/dist/web/assets/ai-settings-section-B7Un4KiW.js.br +0 -0
  13. package/dist/web/assets/ai-settings-section-B7Un4KiW.js.gz +0 -0
  14. package/dist/web/assets/{ai-settings-section-Cp6jcnTn.js → ai-settings-section-BlKlcihJ.js} +1 -1
  15. package/dist/web/assets/{appearance-settings-section-mRiGj3_g.js → appearance-settings-section-DACtiDor.js} +1 -1
  16. package/dist/web/assets/appearance-settings-section-DACtiDor.js.br +0 -0
  17. package/dist/web/assets/appearance-settings-section-DACtiDor.js.gz +0 -0
  18. package/dist/web/assets/{audio-preview-CO7Ia2N5.js → audio-preview-DXtE1Lpz.js} +1 -1
  19. package/dist/web/assets/audio-preview-DXtE1Lpz.js.br +0 -0
  20. package/dist/web/assets/audio-preview-DXtE1Lpz.js.gz +0 -0
  21. package/dist/web/assets/{branch-review-tab-F3CALiEa.js → branch-review-tab-vHJuFXtB.js} +1 -1
  22. package/dist/web/assets/branch-review-tab-vHJuFXtB.js.br +0 -0
  23. package/dist/web/assets/branch-review-tab-vHJuFXtB.js.gz +0 -0
  24. package/dist/web/assets/chat-tab-Ba3NvUgt.js +1 -0
  25. package/dist/web/assets/chat-tab-Ba3NvUgt.js.br +0 -0
  26. package/dist/web/assets/chat-tab-Ba3NvUgt.js.gz +0 -0
  27. package/dist/web/assets/chat-tab-DeISufm0.js +15 -0
  28. package/dist/web/assets/chat-tab-DeISufm0.js.br +0 -0
  29. package/dist/web/assets/chat-tab-DeISufm0.js.gz +0 -0
  30. package/dist/web/assets/{code-editor-FsR6KpZa.js → code-editor-BCwiLVyc.js} +3 -3
  31. package/dist/web/assets/code-editor-BCwiLVyc.js.br +0 -0
  32. package/dist/web/assets/code-editor-BCwiLVyc.js.gz +0 -0
  33. package/dist/web/assets/codex-sign-in-again-dialog-DcIOYhAe.js +1 -0
  34. package/dist/web/assets/codex-sign-in-again-dialog-DcIOYhAe.js.br +0 -0
  35. package/dist/web/assets/codex-sign-in-again-dialog-DcIOYhAe.js.gz +0 -0
  36. package/dist/web/assets/{conflict-editor-GGqIz6tt.js → conflict-editor-0YEDQ--c.js} +1 -1
  37. package/dist/web/assets/conflict-editor-0YEDQ--c.js.br +0 -0
  38. package/dist/web/assets/conflict-editor-0YEDQ--c.js.gz +0 -0
  39. package/dist/web/assets/{context-menu-CVO3HtIt.js → context-menu-CjYTq8DI.js} +1 -1
  40. package/dist/web/assets/context-menu-CjYTq8DI.js.br +0 -0
  41. package/dist/web/assets/context-menu-CjYTq8DI.js.gz +0 -0
  42. package/dist/web/assets/{csv-preview-ycnxJ_6J.js → csv-preview-CYxznB1I.js} +1 -1
  43. package/dist/web/assets/csv-preview-CYxznB1I.js.br +0 -0
  44. package/dist/web/assets/csv-preview-CYxznB1I.js.gz +0 -0
  45. package/dist/web/assets/{database-viewer-y6URJv8N.js → database-viewer-eP3gCxGb.js} +1 -1
  46. package/dist/web/assets/database-viewer-eP3gCxGb.js.br +0 -0
  47. package/dist/web/assets/database-viewer-eP3gCxGb.js.gz +0 -0
  48. package/dist/web/assets/{design-responsive-dialog-D0QYfX7v.js → design-responsive-dialog-CcJETHO2.js} +1 -1
  49. package/dist/web/assets/design-responsive-dialog-CcJETHO2.js.br +0 -0
  50. package/dist/web/assets/design-responsive-dialog-CcJETHO2.js.gz +0 -0
  51. package/dist/web/assets/{design-tab-DgCTcwot.js → design-tab-B7aVMMfj.js} +1 -1
  52. package/dist/web/assets/design-tab-B7aVMMfj.js.br +0 -0
  53. package/dist/web/assets/design-tab-B7aVMMfj.js.gz +0 -0
  54. package/dist/web/assets/{designs-sidebar-panel-Dtuph5jh.js → designs-sidebar-panel-8KI79o1u.js} +1 -1
  55. package/dist/web/assets/designs-sidebar-panel-8KI79o1u.js.br +0 -0
  56. package/dist/web/assets/designs-sidebar-panel-8KI79o1u.js.gz +0 -0
  57. package/dist/web/assets/{dialog-CaShS4f5.js → dialog-tzBRkGeW.js} +1 -1
  58. package/dist/web/assets/dialog-tzBRkGeW.js.br +0 -0
  59. package/dist/web/assets/dialog-tzBRkGeW.js.gz +0 -0
  60. package/dist/web/assets/{diff-viewer-ciBkExM7.js → diff-viewer-B_K7VQup.js} +1 -1
  61. package/dist/web/assets/diff-viewer-B_K7VQup.js.br +0 -0
  62. package/dist/web/assets/diff-viewer-B_K7VQup.js.gz +0 -0
  63. package/dist/web/assets/{docx-preview-C8K6QzOW.js → docx-preview-C-UKGMXR.js} +1 -1
  64. package/dist/web/assets/docx-preview-C-UKGMXR.js.br +0 -0
  65. package/dist/web/assets/docx-preview-C-UKGMXR.js.gz +0 -0
  66. package/dist/web/assets/{editor-language-service-CkoaAHjF.js → editor-language-service-DYBxZX66.js} +1 -1
  67. package/dist/web/assets/editor-language-service-DYBxZX66.js.br +0 -0
  68. package/dist/web/assets/editor-language-service-DYBxZX66.js.gz +0 -0
  69. package/dist/web/assets/{explorer-body-C5gXPGOl.js → explorer-body-C0syNltJ.js} +1 -1
  70. package/dist/web/assets/explorer-body-C0syNltJ.js.br +0 -0
  71. package/dist/web/assets/explorer-body-C0syNltJ.js.gz +0 -0
  72. package/dist/web/assets/{explorer-window-content-8EBl9Vkx.js → explorer-window-content-CfIomwTq.js} +1 -1
  73. package/dist/web/assets/explorer-window-content-CfIomwTq.js.br +0 -0
  74. package/dist/web/assets/explorer-window-content-CfIomwTq.js.gz +0 -0
  75. package/dist/web/assets/{extension-manager-section-DOwZYx8O.js → extension-manager-section-CL7pl3re.js} +1 -1
  76. package/dist/web/assets/extension-manager-section-CL7pl3re.js.br +0 -0
  77. package/dist/web/assets/extension-manager-section-CL7pl3re.js.gz +0 -0
  78. package/dist/web/assets/{extension-webview-CdEva8pD.js → extension-webview-FHTB0jh1.js} +1 -1
  79. package/dist/web/assets/extension-webview-FHTB0jh1.js.br +0 -0
  80. package/dist/web/assets/extension-webview-FHTB0jh1.js.gz +0 -0
  81. package/dist/web/assets/{files-settings-section-DVemQIZ2.js → files-settings-section-C574RfCl.js} +1 -1
  82. package/dist/web/assets/files-settings-section-C574RfCl.js.br +0 -0
  83. package/dist/web/assets/files-settings-section-C574RfCl.js.gz +0 -0
  84. package/dist/web/assets/{general-settings-section-DiY_5C93.js → general-settings-section--DSUTrEP.js} +1 -1
  85. package/dist/web/assets/general-settings-section--DSUTrEP.js.br +0 -0
  86. package/dist/web/assets/general-settings-section--DSUTrEP.js.gz +0 -0
  87. package/dist/web/assets/{git-log-panel-Cq0WohOO.js → git-log-panel-BzwEbRwN.js} +1 -1
  88. package/dist/web/assets/git-log-panel-BzwEbRwN.js.br +0 -0
  89. package/dist/web/assets/git-log-panel-BzwEbRwN.js.gz +0 -0
  90. package/dist/web/assets/{glide-data-grid-DG9AnCmP.js → glide-data-grid-CUNWBFfN.js} +1 -1
  91. package/dist/web/assets/glide-data-grid-CUNWBFfN.js.br +0 -0
  92. package/dist/web/assets/glide-data-grid-CUNWBFfN.js.gz +0 -0
  93. package/dist/web/assets/{group-chat-tab-DxbDrFJl.js → group-chat-tab-Dp1p4Jdu.js} +1 -1
  94. package/dist/web/assets/group-chat-tab-Dp1p4Jdu.js.br +0 -0
  95. package/dist/web/assets/group-chat-tab-Dp1p4Jdu.js.gz +0 -0
  96. package/dist/web/assets/icons-CO_II6D-.js +1 -0
  97. package/dist/web/assets/icons-CO_II6D-.js.br +0 -0
  98. package/dist/web/assets/icons-CO_II6D-.js.gz +0 -0
  99. package/dist/web/assets/{image-preview-eAv91-an.js → image-preview-78Fguk1f.js} +1 -1
  100. package/dist/web/assets/{index-BVKT5UCu.js → index-CvUGUp7d.js} +6 -6
  101. package/dist/web/assets/index-CvUGUp7d.js.br +0 -0
  102. package/dist/web/assets/index-CvUGUp7d.js.gz +0 -0
  103. package/dist/web/assets/index-DMA-So69.css +1 -0
  104. package/dist/web/assets/index-DMA-So69.css.br +0 -0
  105. package/dist/web/assets/index-DMA-So69.css.gz +0 -0
  106. package/dist/web/assets/{jira-watcher-section-Cr8gSVGY.js → jira-watcher-section-DoXl0GAq.js} +1 -1
  107. package/dist/web/assets/jira-watcher-section-DoXl0GAq.js.br +0 -0
  108. package/dist/web/assets/jira-watcher-section-DoXl0GAq.js.gz +0 -0
  109. package/dist/web/assets/{keybindings-store-Ch1mWz0q.js → keybindings-store-BqGm9AgI.js} +1 -1
  110. package/dist/web/assets/{keyboard-shortcuts-section-BvC6m_C2.js → keyboard-shortcuts-section-BogwnAdr.js} +1 -1
  111. package/dist/web/assets/keyboard-shortcuts-section-BogwnAdr.js.br +0 -0
  112. package/dist/web/assets/keyboard-shortcuts-section-BogwnAdr.js.gz +0 -0
  113. package/dist/web/assets/{markdown-renderer-56wMzGkr.js → markdown-renderer-C33dsNJ_.js} +1 -1
  114. package/dist/web/assets/{markdown-renderer-8JlfrfnD.js → markdown-renderer-CZiECUJp.js} +1 -1
  115. package/dist/web/assets/markdown-renderer-CZiECUJp.js.br +0 -0
  116. package/dist/web/assets/markdown-renderer-CZiECUJp.js.gz +0 -0
  117. package/dist/web/assets/{mobile-explorer-sheet-cJfocgE7.js → mobile-explorer-sheet-BOgo9tbK.js} +1 -1
  118. package/dist/web/assets/mobile-explorer-sheet-BOgo9tbK.js.br +0 -0
  119. package/dist/web/assets/mobile-explorer-sheet-BOgo9tbK.js.gz +0 -0
  120. package/dist/web/assets/{new-design-dialog-BO_D3nex.js → new-design-dialog-DcoejI1s.js} +1 -1
  121. package/dist/web/assets/new-design-dialog-DcoejI1s.js.br +0 -0
  122. package/dist/web/assets/new-design-dialog-DcoejI1s.js.gz +0 -0
  123. package/dist/web/assets/{notification-store-DNWazI7j.js → notification-store-D88Y9kF_.js} +1 -1
  124. package/dist/web/assets/{notifications-settings-section-DaMh3khs.js → notifications-settings-section-Bfxqz65i.js} +1 -1
  125. package/dist/web/assets/notifications-settings-section-Bfxqz65i.js.br +0 -0
  126. package/dist/web/assets/notifications-settings-section-Bfxqz65i.js.gz +0 -0
  127. package/dist/web/assets/{onboarding-entry-CwkNJ69U.js → onboarding-entry-CcvySZ_l.js} +1 -1
  128. package/dist/web/assets/onboarding-entry-CcvySZ_l.js.br +0 -0
  129. package/dist/web/assets/onboarding-entry-CcvySZ_l.js.gz +0 -0
  130. package/dist/web/assets/{onboarding-quick-orientation-u7yM68d3.js → onboarding-quick-orientation-CT4PylG0.js} +1 -1
  131. package/dist/web/assets/onboarding-quick-orientation-CT4PylG0.js.br +0 -0
  132. package/dist/web/assets/onboarding-quick-orientation-CT4PylG0.js.gz +0 -0
  133. package/dist/web/assets/{pdf-preview-CaxTidh0.js → pdf-preview-BWim6mu1.js} +1 -1
  134. package/dist/web/assets/pdf-preview-BWim6mu1.js.br +0 -0
  135. package/dist/web/assets/pdf-preview-BWim6mu1.js.gz +0 -0
  136. package/dist/web/assets/{postgres-viewer-CJOOLdgO.js → postgres-viewer-HwlL1UTJ.js} +1 -1
  137. package/dist/web/assets/postgres-viewer-HwlL1UTJ.js.br +0 -0
  138. package/dist/web/assets/postgres-viewer-HwlL1UTJ.js.gz +0 -0
  139. package/dist/web/assets/{ppmbot-settings-section-rNBdWG7F.js → ppmbot-settings-section-DF0kqdyO.js} +1 -1
  140. package/dist/web/assets/ppmbot-settings-section-DF0kqdyO.js.br +0 -0
  141. package/dist/web/assets/ppmbot-settings-section-DF0kqdyO.js.gz +0 -0
  142. package/dist/web/assets/{problems-panel-BTmOGMcL.js → problems-panel-DRcq5ChN.js} +1 -1
  143. package/dist/web/assets/problems-panel-DRcq5ChN.js.br +0 -0
  144. package/dist/web/assets/problems-panel-DRcq5ChN.js.gz +0 -0
  145. package/dist/web/assets/{process-table-Bc9WEBsS.js → process-table-Ds0S_YK-.js} +1 -1
  146. package/dist/web/assets/process-table-Ds0S_YK-.js.br +0 -0
  147. package/dist/web/assets/process-table-Ds0S_YK-.js.gz +0 -0
  148. package/dist/web/assets/{proxy-settings-section-Bo-FPk6Y.js → proxy-settings-section-Q-ttqVOa.js} +1 -1
  149. package/dist/web/assets/proxy-settings-section-Q-ttqVOa.js.br +0 -0
  150. package/dist/web/assets/proxy-settings-section-Q-ttqVOa.js.gz +0 -0
  151. package/dist/web/assets/{query-audit-section-CQfzKAf9.js → query-audit-section-Cn11xqgz.js} +1 -1
  152. package/dist/web/assets/query-audit-section-Cn11xqgz.js.br +0 -0
  153. package/dist/web/assets/query-audit-section-Cn11xqgz.js.gz +0 -0
  154. package/dist/web/assets/{remote-desktop-clipboard-notice-DgeuoZ4n.js → remote-desktop-clipboard-notice-CvPPtrRq.js} +1 -1
  155. package/dist/web/assets/remote-desktop-clipboard-notice-CvPPtrRq.js.br +0 -0
  156. package/dist/web/assets/remote-desktop-clipboard-notice-CvPPtrRq.js.gz +0 -0
  157. package/dist/web/assets/{remote-desktop-mobile-sheet-BpP7jI0p.js → remote-desktop-mobile-sheet-B-TT9Fdt.js} +2 -2
  158. package/dist/web/assets/remote-desktop-mobile-sheet-B-TT9Fdt.js.br +0 -0
  159. package/dist/web/assets/remote-desktop-mobile-sheet-B-TT9Fdt.js.gz +0 -0
  160. package/dist/web/assets/{remote-desktop-mobile-view-Byn0lFCF.js → remote-desktop-mobile-view-hUnYxXDk.js} +1 -1
  161. package/dist/web/assets/remote-desktop-mobile-view-hUnYxXDk.js.br +0 -0
  162. package/dist/web/assets/remote-desktop-mobile-view-hUnYxXDk.js.gz +0 -0
  163. package/dist/web/assets/{remote-desktop-readiness-gate-B2mXZ9vo.js → remote-desktop-readiness-gate-CUmaeiX9.js} +1 -1
  164. package/dist/web/assets/remote-desktop-readiness-gate-CUmaeiX9.js.br +0 -0
  165. package/dist/web/assets/remote-desktop-readiness-gate-CUmaeiX9.js.gz +0 -0
  166. package/dist/web/assets/{remote-desktop-window-content-CWt3VVjm.js → remote-desktop-window-content-DEPUOOGw.js} +1 -1
  167. package/dist/web/assets/remote-desktop-window-content-DEPUOOGw.js.br +0 -0
  168. package/dist/web/assets/remote-desktop-window-content-DEPUOOGw.js.gz +0 -0
  169. package/dist/web/assets/{schedules-settings-section-Bx9Rm-NB.js → schedules-settings-section-Bv_wrzDp.js} +1 -1
  170. package/dist/web/assets/schedules-settings-section-Bv_wrzDp.js.br +0 -0
  171. package/dist/web/assets/schedules-settings-section-Bv_wrzDp.js.gz +0 -0
  172. package/dist/web/assets/{settings-body-DU3LZkOy.js → settings-body-C5_chEpq.js} +2 -2
  173. package/dist/web/assets/settings-body-C5_chEpq.js.br +0 -0
  174. package/dist/web/assets/settings-body-C5_chEpq.js.gz +0 -0
  175. package/dist/web/assets/{settings-tab-Q5Ai_XB7.js → settings-tab-CogpEbq5.js} +1 -1
  176. package/dist/web/assets/{settings-window-content-DNg-jjm4.js → settings-window-content-BNRirQDZ.js} +1 -1
  177. package/dist/web/assets/{sql-query-editor-BMNsmnfi.js → sql-query-editor-Bg3lOrmt.js} +1 -1
  178. package/dist/web/assets/sql-query-editor-Bg3lOrmt.js.br +0 -0
  179. package/dist/web/assets/sql-query-editor-Bg3lOrmt.js.gz +0 -0
  180. package/dist/web/assets/{sqlite-viewer-DBdxQgCD.js → sqlite-viewer-DMKtDkI6.js} +1 -1
  181. package/dist/web/assets/sqlite-viewer-DMKtDkI6.js.br +0 -0
  182. package/dist/web/assets/sqlite-viewer-DMKtDkI6.js.gz +0 -0
  183. package/dist/web/assets/{system-monitor-body-BEuqhoiF.js → system-monitor-body-Dst39LA7.js} +2 -2
  184. package/dist/web/assets/system-monitor-body-Dst39LA7.js.br +0 -0
  185. package/dist/web/assets/system-monitor-body-Dst39LA7.js.gz +0 -0
  186. package/dist/web/assets/system-monitor-tab-CEwME1_C.js +1 -0
  187. package/dist/web/assets/{system-monitor-window-content-Dr6EgqpJ.js → system-monitor-window-content-DQRBjn9z.js} +1 -1
  188. package/dist/web/assets/{tab-host-window-content-BhS39QWy.js → tab-host-window-content-Dlunzrfh.js} +1 -1
  189. package/dist/web/assets/tab-host-window-content-Dlunzrfh.js.br +0 -0
  190. package/dist/web/assets/tab-host-window-content-Dlunzrfh.js.gz +0 -0
  191. package/dist/web/assets/{team-member-sheet-C5-PeHDb.js → team-member-sheet-CPZGU9j5.js} +2 -2
  192. package/dist/web/assets/team-member-sheet-CPZGU9j5.js.br +0 -0
  193. package/dist/web/assets/team-member-sheet-CPZGU9j5.js.gz +0 -0
  194. package/dist/web/assets/{team-member-window-content-CZjHuvdw.js → team-member-window-content-CwI9JD_H.js} +1 -1
  195. package/dist/web/assets/{team-member-window-content-CZjHuvdw.js.br → team-member-window-content-CwI9JD_H.js.br} +0 -0
  196. package/dist/web/assets/team-member-window-content-CwI9JD_H.js.gz +0 -0
  197. package/dist/web/assets/{terminal-tab-B0w7Jsbs.js → terminal-tab-BcQXleSa.js} +1 -1
  198. package/dist/web/assets/terminal-tab-BcQXleSa.js.br +0 -0
  199. package/dist/web/assets/terminal-tab-BcQXleSa.js.gz +0 -0
  200. package/dist/web/assets/{tool-cards-CmdjXi2c.js → tool-cards-DsQdMorI.js} +2 -2
  201. package/dist/web/assets/tool-cards-DsQdMorI.js.br +0 -0
  202. package/dist/web/assets/tool-cards-DsQdMorI.js.gz +0 -0
  203. package/dist/web/assets/{use-inline-blame-BSb807l9.js → use-inline-blame--fS-pzzX.js} +1 -1
  204. package/dist/web/assets/use-inline-blame--fS-pzzX.js.br +0 -0
  205. package/dist/web/assets/use-inline-blame--fS-pzzX.js.gz +0 -0
  206. package/dist/web/assets/{use-lsp-DhBjkGWr.js → use-lsp-DK26Eter.js} +1 -1
  207. package/dist/web/assets/use-lsp-DK26Eter.js.br +0 -0
  208. package/dist/web/assets/use-lsp-DK26Eter.js.gz +0 -0
  209. package/dist/web/assets/{use-monaco-theme-CNEk66US.js → use-monaco-theme-BVatH9yZ.js} +1 -1
  210. package/dist/web/assets/{use-websocket-Bki-B4fj.js → use-websocket-C1mloX0R.js} +1 -1
  211. package/dist/web/assets/{video-preview-T1SMFp03.js → video-preview-C48Go7JZ.js} +1 -1
  212. package/dist/web/assets/video-preview-C48Go7JZ.js.br +0 -0
  213. package/dist/web/assets/video-preview-C48Go7JZ.js.gz +0 -0
  214. package/dist/web/index.html +6 -6
  215. package/dist/web/index.html.br +0 -0
  216. package/dist/web/index.html.gz +0 -0
  217. package/dist/web/sw.js +1 -1
  218. package/dist/web/sw.js.br +0 -0
  219. package/dist/web/sw.js.gz +0 -0
  220. package/package.json +1 -1
  221. package/src/providers/codex-app-server/codex-auth-failure.ts +51 -0
  222. package/src/providers/codex-app-server/codex-event-mapper.ts +8 -0
  223. package/src/providers/codex-app-server/codex-provider.ts +97 -19
  224. package/src/providers/codex-app-server/codex-usage-source.ts +14 -1
  225. package/src/server/routes/codex-accounts.ts +18 -6
  226. package/src/services/codex-account-auth-state.ts +58 -0
  227. package/src/services/codex-account-login.ts +42 -9
  228. package/src/services/codex-account.service.ts +42 -7
  229. package/src/services/proxy-agent-anthropic-bridge.ts +2 -2
  230. package/src/services/proxy-agent-bridge.ts +2 -2
  231. package/src/services/proxy-agent-turn.ts +80 -20
  232. package/src/services/proxy-image-bridge.ts +3 -3
  233. package/src/services/proxy.service.ts +1 -1
  234. package/src/web/components/chat/codex-usage-panel.tsx +13 -1
  235. package/src/web/components/chat/usage-badge.tsx +14 -0
  236. package/src/web/components/settings/accounts/account-add-dialog.tsx +10 -3
  237. package/src/web/components/settings/accounts/account-card.tsx +15 -4
  238. package/src/web/components/settings/accounts/account-hint.tsx +19 -2
  239. package/src/web/components/settings/accounts/claude-accounts-section.tsx +10 -2
  240. package/src/web/components/settings/accounts/codex-accounts-section.tsx +18 -2
  241. package/src/web/components/settings/accounts/codex-add-account-dialog.tsx +50 -33
  242. package/src/web/components/settings/accounts/codex-sign-in-again-dialog.tsx +47 -0
  243. package/src/web/components/settings/accounts/use-codex-accounts.ts +18 -4
  244. package/src/web/lib/fluent-icon.tsx +38 -2
  245. package/dist/web/assets/accounts-settings-section-CVJ7hQom.js +0 -1
  246. package/dist/web/assets/accounts-settings-section-CVJ7hQom.js.br +0 -0
  247. package/dist/web/assets/accounts-settings-section-CVJ7hQom.js.gz +0 -0
  248. package/dist/web/assets/ai-resource-editor-DoCiQDKY.js.br +0 -0
  249. package/dist/web/assets/ai-resource-editor-DoCiQDKY.js.gz +0 -0
  250. package/dist/web/assets/ai-settings-section-0x6GFJ56.js.br +0 -0
  251. package/dist/web/assets/ai-settings-section-0x6GFJ56.js.gz +0 -0
  252. package/dist/web/assets/appearance-settings-section-mRiGj3_g.js.br +0 -0
  253. package/dist/web/assets/appearance-settings-section-mRiGj3_g.js.gz +0 -0
  254. package/dist/web/assets/audio-preview-CO7Ia2N5.js.br +0 -0
  255. package/dist/web/assets/audio-preview-CO7Ia2N5.js.gz +0 -0
  256. package/dist/web/assets/branch-review-tab-F3CALiEa.js.br +0 -0
  257. package/dist/web/assets/branch-review-tab-F3CALiEa.js.gz +0 -0
  258. package/dist/web/assets/chat-tab-D6BFnkCj.js +0 -1
  259. package/dist/web/assets/chat-tab-D6BFnkCj.js.br +0 -0
  260. package/dist/web/assets/chat-tab-D6BFnkCj.js.gz +0 -0
  261. package/dist/web/assets/chat-tab-IXHMUKMW.js +0 -15
  262. package/dist/web/assets/chat-tab-IXHMUKMW.js.br +0 -0
  263. package/dist/web/assets/chat-tab-IXHMUKMW.js.gz +0 -0
  264. package/dist/web/assets/code-editor-FsR6KpZa.js.br +0 -0
  265. package/dist/web/assets/code-editor-FsR6KpZa.js.gz +0 -0
  266. package/dist/web/assets/codex-daily-guard-Bn8jfcei.js +0 -1
  267. package/dist/web/assets/codex-daily-guard-Bn8jfcei.js.br +0 -0
  268. package/dist/web/assets/codex-daily-guard-Bn8jfcei.js.gz +0 -0
  269. package/dist/web/assets/conflict-editor-GGqIz6tt.js.br +0 -0
  270. package/dist/web/assets/conflict-editor-GGqIz6tt.js.gz +0 -0
  271. package/dist/web/assets/context-menu-CVO3HtIt.js.br +0 -0
  272. package/dist/web/assets/context-menu-CVO3HtIt.js.gz +0 -0
  273. package/dist/web/assets/csv-preview-ycnxJ_6J.js.br +0 -0
  274. package/dist/web/assets/csv-preview-ycnxJ_6J.js.gz +0 -0
  275. package/dist/web/assets/database-viewer-y6URJv8N.js.br +0 -0
  276. package/dist/web/assets/database-viewer-y6URJv8N.js.gz +0 -0
  277. package/dist/web/assets/design-responsive-dialog-D0QYfX7v.js.br +0 -0
  278. package/dist/web/assets/design-responsive-dialog-D0QYfX7v.js.gz +0 -0
  279. package/dist/web/assets/design-tab-DgCTcwot.js.br +0 -0
  280. package/dist/web/assets/design-tab-DgCTcwot.js.gz +0 -0
  281. package/dist/web/assets/designs-sidebar-panel-Dtuph5jh.js.br +0 -0
  282. package/dist/web/assets/designs-sidebar-panel-Dtuph5jh.js.gz +0 -0
  283. package/dist/web/assets/dialog-CaShS4f5.js.br +0 -0
  284. package/dist/web/assets/dialog-CaShS4f5.js.gz +0 -0
  285. package/dist/web/assets/diff-viewer-ciBkExM7.js.br +0 -0
  286. package/dist/web/assets/diff-viewer-ciBkExM7.js.gz +0 -0
  287. package/dist/web/assets/docx-preview-C8K6QzOW.js.br +0 -0
  288. package/dist/web/assets/docx-preview-C8K6QzOW.js.gz +0 -0
  289. package/dist/web/assets/editor-language-service-CkoaAHjF.js.br +0 -0
  290. package/dist/web/assets/editor-language-service-CkoaAHjF.js.gz +0 -0
  291. package/dist/web/assets/explorer-body-C5gXPGOl.js.br +0 -0
  292. package/dist/web/assets/explorer-body-C5gXPGOl.js.gz +0 -0
  293. package/dist/web/assets/explorer-window-content-8EBl9Vkx.js.br +0 -0
  294. package/dist/web/assets/explorer-window-content-8EBl9Vkx.js.gz +0 -0
  295. package/dist/web/assets/extension-manager-section-DOwZYx8O.js.br +0 -0
  296. package/dist/web/assets/extension-manager-section-DOwZYx8O.js.gz +0 -0
  297. package/dist/web/assets/extension-webview-CdEva8pD.js.br +0 -0
  298. package/dist/web/assets/extension-webview-CdEva8pD.js.gz +0 -0
  299. package/dist/web/assets/files-settings-section-DVemQIZ2.js.br +0 -0
  300. package/dist/web/assets/files-settings-section-DVemQIZ2.js.gz +0 -0
  301. package/dist/web/assets/general-settings-section-DiY_5C93.js.br +0 -0
  302. package/dist/web/assets/general-settings-section-DiY_5C93.js.gz +0 -0
  303. package/dist/web/assets/git-log-panel-Cq0WohOO.js.br +0 -0
  304. package/dist/web/assets/git-log-panel-Cq0WohOO.js.gz +0 -0
  305. package/dist/web/assets/glide-data-grid-DG9AnCmP.js.br +0 -0
  306. package/dist/web/assets/glide-data-grid-DG9AnCmP.js.gz +0 -0
  307. package/dist/web/assets/group-chat-tab-DxbDrFJl.js.br +0 -0
  308. package/dist/web/assets/group-chat-tab-DxbDrFJl.js.gz +0 -0
  309. package/dist/web/assets/icons-C9ZwXgel.js +0 -1
  310. package/dist/web/assets/icons-C9ZwXgel.js.br +0 -0
  311. package/dist/web/assets/icons-C9ZwXgel.js.gz +0 -0
  312. package/dist/web/assets/index-BVKT5UCu.js.br +0 -0
  313. package/dist/web/assets/index-BVKT5UCu.js.gz +0 -0
  314. package/dist/web/assets/index-CzYrKDUF.css +0 -1
  315. package/dist/web/assets/index-CzYrKDUF.css.br +0 -0
  316. package/dist/web/assets/index-CzYrKDUF.css.gz +0 -0
  317. package/dist/web/assets/jira-watcher-section-Cr8gSVGY.js.br +0 -0
  318. package/dist/web/assets/jira-watcher-section-Cr8gSVGY.js.gz +0 -0
  319. package/dist/web/assets/keyboard-shortcuts-section-BvC6m_C2.js.br +0 -0
  320. package/dist/web/assets/keyboard-shortcuts-section-BvC6m_C2.js.gz +0 -0
  321. package/dist/web/assets/markdown-renderer-8JlfrfnD.js.br +0 -0
  322. package/dist/web/assets/markdown-renderer-8JlfrfnD.js.gz +0 -0
  323. package/dist/web/assets/mobile-explorer-sheet-cJfocgE7.js.br +0 -0
  324. package/dist/web/assets/mobile-explorer-sheet-cJfocgE7.js.gz +0 -0
  325. package/dist/web/assets/new-design-dialog-BO_D3nex.js.br +0 -0
  326. package/dist/web/assets/new-design-dialog-BO_D3nex.js.gz +0 -0
  327. package/dist/web/assets/notifications-settings-section-DaMh3khs.js.br +0 -0
  328. package/dist/web/assets/notifications-settings-section-DaMh3khs.js.gz +0 -0
  329. package/dist/web/assets/onboarding-entry-CwkNJ69U.js.br +0 -0
  330. package/dist/web/assets/onboarding-entry-CwkNJ69U.js.gz +0 -0
  331. package/dist/web/assets/onboarding-quick-orientation-u7yM68d3.js.br +0 -0
  332. package/dist/web/assets/onboarding-quick-orientation-u7yM68d3.js.gz +0 -0
  333. package/dist/web/assets/pdf-preview-CaxTidh0.js.br +0 -0
  334. package/dist/web/assets/pdf-preview-CaxTidh0.js.gz +0 -0
  335. package/dist/web/assets/postgres-viewer-CJOOLdgO.js.br +0 -0
  336. package/dist/web/assets/postgres-viewer-CJOOLdgO.js.gz +0 -0
  337. package/dist/web/assets/ppmbot-settings-section-rNBdWG7F.js.br +0 -0
  338. package/dist/web/assets/ppmbot-settings-section-rNBdWG7F.js.gz +0 -0
  339. package/dist/web/assets/problems-panel-BTmOGMcL.js.br +0 -0
  340. package/dist/web/assets/problems-panel-BTmOGMcL.js.gz +0 -0
  341. package/dist/web/assets/process-table-Bc9WEBsS.js.br +0 -0
  342. package/dist/web/assets/process-table-Bc9WEBsS.js.gz +0 -0
  343. package/dist/web/assets/proxy-settings-section-Bo-FPk6Y.js.br +0 -0
  344. package/dist/web/assets/proxy-settings-section-Bo-FPk6Y.js.gz +0 -0
  345. package/dist/web/assets/query-audit-section-CQfzKAf9.js.br +0 -0
  346. package/dist/web/assets/query-audit-section-CQfzKAf9.js.gz +0 -0
  347. package/dist/web/assets/remote-desktop-clipboard-notice-DgeuoZ4n.js.br +0 -0
  348. package/dist/web/assets/remote-desktop-clipboard-notice-DgeuoZ4n.js.gz +0 -0
  349. package/dist/web/assets/remote-desktop-mobile-sheet-BpP7jI0p.js.br +0 -0
  350. package/dist/web/assets/remote-desktop-mobile-sheet-BpP7jI0p.js.gz +0 -0
  351. package/dist/web/assets/remote-desktop-mobile-view-Byn0lFCF.js.br +0 -0
  352. package/dist/web/assets/remote-desktop-mobile-view-Byn0lFCF.js.gz +0 -0
  353. package/dist/web/assets/remote-desktop-readiness-gate-B2mXZ9vo.js.br +0 -0
  354. package/dist/web/assets/remote-desktop-readiness-gate-B2mXZ9vo.js.gz +0 -0
  355. package/dist/web/assets/remote-desktop-window-content-CWt3VVjm.js.br +0 -0
  356. package/dist/web/assets/remote-desktop-window-content-CWt3VVjm.js.gz +0 -0
  357. package/dist/web/assets/schedules-settings-section-Bx9Rm-NB.js.br +0 -0
  358. package/dist/web/assets/schedules-settings-section-Bx9Rm-NB.js.gz +0 -0
  359. package/dist/web/assets/settings-body-DU3LZkOy.js.br +0 -0
  360. package/dist/web/assets/settings-body-DU3LZkOy.js.gz +0 -0
  361. package/dist/web/assets/sql-query-editor-BMNsmnfi.js.br +0 -0
  362. package/dist/web/assets/sql-query-editor-BMNsmnfi.js.gz +0 -0
  363. package/dist/web/assets/sqlite-viewer-DBdxQgCD.js.br +0 -0
  364. package/dist/web/assets/sqlite-viewer-DBdxQgCD.js.gz +0 -0
  365. package/dist/web/assets/system-monitor-body-BEuqhoiF.js.br +0 -0
  366. package/dist/web/assets/system-monitor-body-BEuqhoiF.js.gz +0 -0
  367. package/dist/web/assets/system-monitor-tab-BAU1kzbY.js +0 -1
  368. package/dist/web/assets/tab-host-window-content-BhS39QWy.js.br +0 -0
  369. package/dist/web/assets/tab-host-window-content-BhS39QWy.js.gz +0 -0
  370. package/dist/web/assets/team-member-sheet-C5-PeHDb.js.br +0 -0
  371. package/dist/web/assets/team-member-sheet-C5-PeHDb.js.gz +0 -0
  372. package/dist/web/assets/team-member-window-content-CZjHuvdw.js.gz +0 -0
  373. package/dist/web/assets/terminal-tab-B0w7Jsbs.js.br +0 -0
  374. package/dist/web/assets/terminal-tab-B0w7Jsbs.js.gz +0 -0
  375. package/dist/web/assets/tool-cards-CmdjXi2c.js.br +0 -0
  376. package/dist/web/assets/tool-cards-CmdjXi2c.js.gz +0 -0
  377. package/dist/web/assets/use-inline-blame-BSb807l9.js.br +0 -0
  378. package/dist/web/assets/use-inline-blame-BSb807l9.js.gz +0 -0
  379. package/dist/web/assets/use-lsp-DhBjkGWr.js.br +0 -0
  380. package/dist/web/assets/use-lsp-DhBjkGWr.js.gz +0 -0
  381. package/dist/web/assets/video-preview-T1SMFp03.js.br +0 -0
  382. package/dist/web/assets/video-preview-T1SMFp03.js.gz +0 -0
@@ -1 +1 @@
1
- import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import{at as r,ct as i,dt as a,it as o,lt as s,ot as c,st as l,ut as u}from"./vendor-ui-BHh12_0v.js";import{Xr as d}from"./icons-C9ZwXgel.js";import{n as f}from"./utils-btZ8C8-R.js";import{n as p}from"./portal-container-context-NFSuymMu.js";import{t as m}from"./button-CBehaXpV.js";e(t(),1);var h=n();function g({...e}){return(0,h.jsx)(s,{"data-slot":`dialog`,...e})}function _({...e}){return(0,h.jsx)(a,{"data-slot":`dialog-trigger`,...e})}function v({container:e,...t}){let n=p();return(0,h.jsx)(i,{"data-slot":`dialog-portal`,container:e??n,...t})}function y({className:e,...t}){return(0,h.jsx)(l,{"data-slot":`dialog-overlay`,className:f(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function b({className:e,children:t,showCloseButton:n=!0,...i}){return(0,h.jsxs)(v,{"data-slot":`dialog-portal`,children:[(0,h.jsx)(y,{}),(0,h.jsxs)(r,{"data-slot":`dialog-content`,className:f(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background text-foreground p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg`,e),...i,children:[t,n&&(0,h.jsxs)(o,{"data-slot":`dialog-close`,className:`absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,h.jsx)(d,{}),(0,h.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function x({className:e,...t}){return(0,h.jsx)(`div`,{"data-slot":`dialog-header`,className:f(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function S({className:e,showCloseButton:t=!1,children:n,...r}){return(0,h.jsxs)(`div`,{"data-slot":`dialog-footer`,className:f(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,h.jsx)(o,{asChild:!0,children:(0,h.jsx)(m,{variant:`outline`,children:`Close`})})]})}function C({className:e,...t}){return(0,h.jsx)(u,{"data-slot":`dialog-title`,className:f(`text-lg leading-none font-semibold`,e),...t})}function w({className:e,...t}){return(0,h.jsx)(c,{"data-slot":`dialog-description`,className:f(`text-sm text-muted-foreground`,e),...t})}export{x as a,S as i,b as n,C as o,w as r,_ as s,g as t};
1
+ import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import{at as r,ct as i,dt as a,it as o,lt as s,ot as c,st as l,ut as u}from"./vendor-ui-BHh12_0v.js";import{Xr as d}from"./icons-CO_II6D-.js";import{n as f}from"./utils-btZ8C8-R.js";import{n as p}from"./portal-container-context-NFSuymMu.js";import{t as m}from"./button-CBehaXpV.js";e(t(),1);var h=n();function g({...e}){return(0,h.jsx)(s,{"data-slot":`dialog`,...e})}function _({...e}){return(0,h.jsx)(a,{"data-slot":`dialog-trigger`,...e})}function v({container:e,...t}){let n=p();return(0,h.jsx)(i,{"data-slot":`dialog-portal`,container:e??n,...t})}function y({className:e,...t}){return(0,h.jsx)(l,{"data-slot":`dialog-overlay`,className:f(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function b({className:e,children:t,showCloseButton:n=!0,...i}){return(0,h.jsxs)(v,{"data-slot":`dialog-portal`,children:[(0,h.jsx)(y,{}),(0,h.jsxs)(r,{"data-slot":`dialog-content`,className:f(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background text-foreground p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg`,e),...i,children:[t,n&&(0,h.jsxs)(o,{"data-slot":`dialog-close`,className:`absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,h.jsx)(d,{}),(0,h.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function x({className:e,...t}){return(0,h.jsx)(`div`,{"data-slot":`dialog-header`,className:f(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function S({className:e,showCloseButton:t=!1,children:n,...r}){return(0,h.jsxs)(`div`,{"data-slot":`dialog-footer`,className:f(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,h.jsx)(o,{asChild:!0,children:(0,h.jsx)(m,{variant:`outline`,children:`Close`})})]})}function C({className:e,...t}){return(0,h.jsx)(u,{"data-slot":`dialog-title`,className:f(`text-lg leading-none font-semibold`,e),...t})}function w({className:e,...t}){return(0,h.jsx)(c,{"data-slot":`dialog-description`,className:f(`text-sm text-muted-foreground`,e),...t})}export{x as a,S as i,b as n,C as o,w as r,_ as s,g as t};
@@ -1,4 +1,4 @@
1
- import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import{Br as r,bt as i,pt as a,qr as ee,r as o,un as s}from"./icons-C9ZwXgel.js";import{i as c,n as l,r as u}from"./api-client-c8YOpTlT.js";import{t as d}from"./settings-store-DXmQug0m.js";import"./vendor-mermaid-eg2XWIjK.js";import"./project-store-C5gJXkvb.js";import"./project-framework-store-XxFXcUpb.js";import"./git-repo-store-DFTJ5ngK.js";import{t as f}from"./button-CBehaXpV.js";import{C as te,Wt as ne,nn as re,wn as ie}from"./index-BVKT5UCu.js";import{t as ae}from"./use-monaco-theme-CNEk66US.js";import{n as oe,t as se}from"./editor-font-BOjGgYeg.js";import{t as p}from"./use-inline-blame-BSb807l9.js";import{n as m,r as ce}from"./monaco-dotenv-language-COsgiuQg.js";import{n as h,o as g}from"./can-open-in-ppm-D8T6Xca-.js";import{r as _}from"./image-preview-geometry-B-SdD7_D.js";var v=e(t(),1),y=n();function b(e){return h.has(g(e))}function x(e){return/^[0-9a-f]{40}$/i.test(e)?e.slice(0,7):e}function S({mode:e,onChange:t}){return(0,y.jsxs)(`select`,{value:e,onChange:e=>t(e.target.value),title:`Show this file as an image or as text`,"aria-label":`Reopen editor with`,className:`h-11 rounded border border-border bg-transparent px-1 text-xs text-foreground outline-none md:h-6`,children:[(0,y.jsx)(`option`,{value:`preview`,children:`Image Preview`}),(0,y.jsx)(`option`,{value:`text`,children:`Text Editor`})]})}function le({filePath:e,mode:t,original:n,modified:r,onOpenAnyway:i}){if(t===`text`||!b(e))return(0,y.jsx)(C,{onOpenAnyway:i});let a=[n,r].filter(e=>e.url!==null);if(a.length<2){let e=a[0];return e?(0,y.jsx)(w,{side:e}):(0,y.jsx)(C,{onOpenAnyway:i})}return(0,y.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col md:flex-row`,children:[(0,y.jsx)(w,{side:a[0]}),(0,y.jsx)(`div`,{className:`shrink-0 border-b border-border md:border-b-0 md:border-r`}),(0,y.jsx)(w,{side:a[1]})]})}function C({onOpenAnyway:e}){return(0,y.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 p-6 text-center`,children:[(0,y.jsx)(o,{className:`size-10 text-warning`}),(0,y.jsx)(`p`,{className:`max-w-md text-sm leading-relaxed text-text-secondary`,children:`The file is not displayed in the text editor because it is either binary or uses an unsupported text encoding.`}),(0,y.jsx)(f,{onClick:e,className:`mt-auto h-11 w-full max-w-xs md:mt-0 md:w-auto md:px-5`,children:`Open Anyway`})]})}function w({side:e}){return(0,y.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-1.5`,children:[(0,y.jsx)(`span`,{className:`truncate text-xs font-medium text-text-secondary`,children:e.label}),e.size!==null&&(0,y.jsx)(`span`,{className:`shrink-0 text-xs text-text-subtle`,children:_(e.size)})]}),(0,y.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto bg-surface p-4`,children:(0,y.jsx)(T,{url:e.url})})]})}function T({url:e}){let{blobUrl:t,failed:n}=E(e);return n?(0,y.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-text-subtle`,children:[(0,y.jsx)(i,{className:`size-8`}),(0,y.jsx)(`p`,{className:`text-xs`,children:`Failed to load.`})]}):t?(0,y.jsx)(`img`,{src:t,alt:``,className:`max-h-full max-w-full object-contain`}):(0,y.jsx)(s,{className:`size-5 animate-spin text-text-subtle`})}function E(e){let[t,n]=(0,v.useState)(null),[r,i]=(0,v.useState)(!1),a=(0,v.useRef)(null);return(0,v.useEffect)(()=>{let t=!1;i(!1);let r=u();return fetch(e,{headers:r?{Authorization:`Bearer ${r}`}:{}}).then(e=>{if(!e.ok)throw Error(String(e.status));return e.blob()}).then(e=>{if(t)return;let r=URL.createObjectURL(e);a.current&&URL.revokeObjectURL(a.current),a.current=r,n(r)}).catch(()=>{t||i(!0)}),()=>{t=!0}},[e]),(0,v.useEffect)(()=>()=>{a.current&&URL.revokeObjectURL(a.current)},[]),{blobUrl:t,failed:r}}function ue(e){return{js:`javascript`,jsx:`javascript`,ts:`typescript`,tsx:`typescript`,py:`python`,html:`html`,css:`css`,scss:`scss`,json:`json`,md:`markdown`,mdx:`markdown`,yaml:`yaml`,yml:`yaml`,sh:`shell`,bash:`shell`}[e.split(`.`).pop()?.toLowerCase()??``]??(m(e)?`dotenv`:`plaintext`)}function D({metadata:e}){let t=e?.filePath,n=e?.projectName,i=e?.ref1,o=e?.ref2,u=e?.file1,f=e?.file2,m=e?.original,h=e?.modified,g=m!=null||h!=null,_=!!(u&&f),[C,w]=(0,v.useState)(null),[T,E]=(0,v.useState)(null),[D,O]=(0,v.useState)(null),[k,A]=(0,v.useState)(`preview`),[j,M]=(0,v.useState)(!1),N=e=>{A(e),e===`preview`&&M(!1)},[P,F]=(0,v.useState)(!g),[I,L]=(0,v.useState)(null),{wordWrap:fe,toggleWordWrap:pe,mobileWordWrap:R,toggleMobileWordWrap:z}=d(re(e=>({wordWrap:e.wordWrap,toggleWordWrap:e.toggleWordWrap,mobileWordWrap:e.mobileWordWrap,toggleMobileWordWrap:e.toggleMobileWordWrap}))),me=ae(),B=ne(n),V=(0,v.useRef)(null),H=(0,v.useRef)(null),[he,ge]=(0,v.useState)(!1),[U,_e]=(0,v.useState)(null),[W,G]=(0,v.useState)(`modified`),[K,q]=(0,v.useState)();(0,v.useEffect)(()=>{let e=V.current;if(!e)return;let t=new ResizeObserver(([e])=>{e&&q(Math.floor(e.contentRect.height))});return t.observe(e),()=>t.disconnect()},[P,I]),(0,v.useEffect)(()=>ie(V.current,()=>H.current?.layout()),[P,I]),(0,v.useEffect)(()=>{if(g||!n)return;if(F(!0),L(null),O(null),E(null),w(null),u&&f){let e=new URLSearchParams({file1:u,file2:f});l.get(`${c(n)}/files/compare?${e}`).then(e=>{E(e),F(!1)}).catch(e=>{L(e instanceof Error?e.message:`Failed to compare files`),F(!1)});return}if(t){let e=B.repoPath(t);if(e==null){F(!1);return}let n=new URLSearchParams({file:e});i&&n.set(`ref`,i),o&&n.set(`ref2`,o),j&&n.set(`text`,`1`),l.get(B.gitUrl(`/file-full-diff?${n}`)).then(e=>{O(e),F(!1)}).catch(e=>{L(e instanceof Error?e.message:`Failed to load diff`),F(!1)});return}let e;if(i||o){let t=new URLSearchParams;i&&t.set(`ref1`,i),o&&t.set(`ref2`,o),e=B.gitUrl(`/diff?${t}`)}else e=B.gitUrl(`/diff`);l.get(e).then(e=>{w(e.diff),F(!1)}).catch(e=>{L(e instanceof Error?e.message:`Failed to load diff`),F(!1)})},[t,n,i,o,u,f,g,B,j]),(0,v.useEffect)(()=>{M(!1),A(`preview`)},[t,i,o]);let{original:J,modified:Y}=(0,v.useMemo)(()=>g?{original:m??``,modified:h??``}:_&&T?T:D||(C?de(C):{original:``,modified:``}),[C,g,m,h,_,T,D]),ve=(0,v.useMemo)(()=>{let e=t??f??u;return e?ue(e):`plaintext`},[t,u,f]),X=d(e=>e.inlineBlame),ye=d(e=>e.toggleInlineBlame),Z=typeof window<`u`&&window.innerWidth<768,Q=Z?R:fe,be=Z?z:pe,$=!!(n&&t&&D)&&!Z;p({editor:U?.original??null,monaco:U?.monaco??null,projectName:n,filePath:$?t:void 0,rev:i||`HEAD`,enabled:X&&$&&W===`original`,readOnly:!0}),p({editor:U?.modified??null,monaco:U?.monaco??null,projectName:n,filePath:$?t:void 0,rev:o,enabled:X&&$&&W===`modified`,readOnly:!0});let xe=!Z;if((0,v.useEffect)(()=>{let e=H.current;if(!e)return;let t=Q?`on`:`off`;e.updateOptions({diffWordWrap:t}),e.getOriginalEditor().updateOptions({wordWrapOverride2:t}),e.getModifiedEditor().updateOptions({wordWrapOverride2:t})},[Q,he]),!n&&!g)return(0,y.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground text-sm`,children:`No project selected.`});if(P)return(0,y.jsxs)(`div`,{className:`flex items-center justify-center h-full gap-2 text-muted-foreground`,children:[(0,y.jsx)(s,{className:`size-5 animate-spin`}),(0,y.jsx)(`span`,{className:`text-sm`,children:`Loading diff...`})]});if(I)return(0,y.jsx)(`div`,{className:`flex items-center justify-center h-full text-destructive text-sm`,children:I});if(D?.binary&&!j&&t&&n){let e=B.repoPath(t),r=t=>e==null?null:B.gitUrl(`/file-blob?file=${encodeURIComponent(e)}&ref=${encodeURIComponent(t)}`);return(0,y.jsxs)(`div`,{className:`flex flex-col h-full`,children:[b(t)&&(0,y.jsx)(`div`,{className:`flex items-center justify-end gap-0.5 px-2 py-0.5 border-b border-border shrink-0`,children:(0,y.jsx)(S,{mode:k,onChange:N})}),(0,y.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,y.jsx)(le,{filePath:t,mode:k,original:{url:D.originalSize===null?null:r(i||`HEAD`),label:x(i||`HEAD`),size:D.originalSize},modified:{url:D.modifiedSize===null?null:o?r(o):`${c(n)}/files/raw?path=${encodeURIComponent(t)}`,label:o?x(o):`Working Tree`,size:D.modifiedSize},onOpenAnyway:()=>M(!0)})})]})}return!g&&!_&&!D&&!J&&!Y?(0,y.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-2 text-muted-foreground`,children:[(0,y.jsx)(a,{className:`size-8`}),(0,y.jsx)(`p`,{className:`text-sm`,children:`No content changes`}),t&&(0,y.jsx)(`p`,{className:`text-xs font-mono`,children:t})]}):(0,y.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-end gap-0.5 px-2 py-0.5 border-b border-border shrink-0`,children:[D?.binary&&t&&b(t)&&(0,y.jsx)(S,{mode:`text`,onChange:N}),$&&(0,y.jsx)(`button`,{type:`button`,onClick:ye,title:`Inline blame (Alt+B) — who last touched the cursor's line. Click a pane to annotate that side.`,className:`flex items-center justify-center rounded hover:bg-muted active:scale-95 transition-colors p-1 ${X?`bg-muted text-foreground`:``}`,children:(0,y.jsx)(r,{className:`size-3.5`})}),(0,y.jsx)(`button`,{type:`button`,onClick:be,title:Q?`Wrapping long lines — tap to scroll sideways instead`:`Toggle word wrap`,className:`flex items-center justify-center rounded hover:bg-muted active:scale-95 transition-colors ${Z?`size-11`:`p-1`} ${Q?`bg-muted text-foreground`:``}`,children:(0,y.jsx)(ee,{className:`size-3.5`})})]}),(0,y.jsx)(`div`,{ref:V,className:`flex-1 overflow-hidden`,children:K&&K>0?(0,y.jsx)(te,{height:K,language:ve,beforeMount:ce,original:J,modified:Y,theme:me,onMount:(e,t)=>{H.current=e,ge(!0);let n=e.getOriginalEditor(),r=e.getModifiedEditor();_e({monaco:t,original:n,modified:r}),n.onDidFocusEditorText(()=>G(`original`)),r.onDidFocusEditorText(()=>G(`modified`)),e.addCommand(t.KeyMod.Alt|t.KeyCode.KeyB,()=>d.getState().toggleInlineBlame())},options:{fontSize:Z?11:14,fontFamily:se,fontLigatures:oe,diffWordWrap:Q?`on`:`off`,renderSideBySide:xe,useInlineViewWhenSpaceIsLimited:!1,readOnly:!0,automaticLayout:!0,scrollBeyondLastLine:!1},loading:(0,y.jsx)(s,{className:`size-5 animate-spin text-muted-foreground`})}):(0,y.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,y.jsx)(s,{className:`size-5 animate-spin text-muted-foreground`})})})]})}function de(e){let t=e.split(`
1
+ import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import{Br as r,bt as i,pt as a,qr as ee,r as o,un as s}from"./icons-CO_II6D-.js";import{i as c,n as l,r as u}from"./api-client-c8YOpTlT.js";import{t as d}from"./settings-store-DXmQug0m.js";import"./vendor-mermaid-eg2XWIjK.js";import"./project-store-C5gJXkvb.js";import"./project-framework-store-XxFXcUpb.js";import"./git-repo-store-DFTJ5ngK.js";import{t as f}from"./button-CBehaXpV.js";import{C as te,Wt as ne,nn as re,wn as ie}from"./index-CvUGUp7d.js";import{t as ae}from"./use-monaco-theme-BVatH9yZ.js";import{n as oe,t as se}from"./editor-font-BOjGgYeg.js";import{t as p}from"./use-inline-blame--fS-pzzX.js";import{n as m,r as ce}from"./monaco-dotenv-language-COsgiuQg.js";import{n as h,o as g}from"./can-open-in-ppm-D8T6Xca-.js";import{r as _}from"./image-preview-geometry-B-SdD7_D.js";var v=e(t(),1),y=n();function b(e){return h.has(g(e))}function x(e){return/^[0-9a-f]{40}$/i.test(e)?e.slice(0,7):e}function S({mode:e,onChange:t}){return(0,y.jsxs)(`select`,{value:e,onChange:e=>t(e.target.value),title:`Show this file as an image or as text`,"aria-label":`Reopen editor with`,className:`h-11 rounded border border-border bg-transparent px-1 text-xs text-foreground outline-none md:h-6`,children:[(0,y.jsx)(`option`,{value:`preview`,children:`Image Preview`}),(0,y.jsx)(`option`,{value:`text`,children:`Text Editor`})]})}function le({filePath:e,mode:t,original:n,modified:r,onOpenAnyway:i}){if(t===`text`||!b(e))return(0,y.jsx)(C,{onOpenAnyway:i});let a=[n,r].filter(e=>e.url!==null);if(a.length<2){let e=a[0];return e?(0,y.jsx)(w,{side:e}):(0,y.jsx)(C,{onOpenAnyway:i})}return(0,y.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col md:flex-row`,children:[(0,y.jsx)(w,{side:a[0]}),(0,y.jsx)(`div`,{className:`shrink-0 border-b border-border md:border-b-0 md:border-r`}),(0,y.jsx)(w,{side:a[1]})]})}function C({onOpenAnyway:e}){return(0,y.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 p-6 text-center`,children:[(0,y.jsx)(o,{className:`size-10 text-warning`}),(0,y.jsx)(`p`,{className:`max-w-md text-sm leading-relaxed text-text-secondary`,children:`The file is not displayed in the text editor because it is either binary or uses an unsupported text encoding.`}),(0,y.jsx)(f,{onClick:e,className:`mt-auto h-11 w-full max-w-xs md:mt-0 md:w-auto md:px-5`,children:`Open Anyway`})]})}function w({side:e}){return(0,y.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-1.5`,children:[(0,y.jsx)(`span`,{className:`truncate text-xs font-medium text-text-secondary`,children:e.label}),e.size!==null&&(0,y.jsx)(`span`,{className:`shrink-0 text-xs text-text-subtle`,children:_(e.size)})]}),(0,y.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto bg-surface p-4`,children:(0,y.jsx)(T,{url:e.url})})]})}function T({url:e}){let{blobUrl:t,failed:n}=E(e);return n?(0,y.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-text-subtle`,children:[(0,y.jsx)(i,{className:`size-8`}),(0,y.jsx)(`p`,{className:`text-xs`,children:`Failed to load.`})]}):t?(0,y.jsx)(`img`,{src:t,alt:``,className:`max-h-full max-w-full object-contain`}):(0,y.jsx)(s,{className:`size-5 animate-spin text-text-subtle`})}function E(e){let[t,n]=(0,v.useState)(null),[r,i]=(0,v.useState)(!1),a=(0,v.useRef)(null);return(0,v.useEffect)(()=>{let t=!1;i(!1);let r=u();return fetch(e,{headers:r?{Authorization:`Bearer ${r}`}:{}}).then(e=>{if(!e.ok)throw Error(String(e.status));return e.blob()}).then(e=>{if(t)return;let r=URL.createObjectURL(e);a.current&&URL.revokeObjectURL(a.current),a.current=r,n(r)}).catch(()=>{t||i(!0)}),()=>{t=!0}},[e]),(0,v.useEffect)(()=>()=>{a.current&&URL.revokeObjectURL(a.current)},[]),{blobUrl:t,failed:r}}function ue(e){return{js:`javascript`,jsx:`javascript`,ts:`typescript`,tsx:`typescript`,py:`python`,html:`html`,css:`css`,scss:`scss`,json:`json`,md:`markdown`,mdx:`markdown`,yaml:`yaml`,yml:`yaml`,sh:`shell`,bash:`shell`}[e.split(`.`).pop()?.toLowerCase()??``]??(m(e)?`dotenv`:`plaintext`)}function D({metadata:e}){let t=e?.filePath,n=e?.projectName,i=e?.ref1,o=e?.ref2,u=e?.file1,f=e?.file2,m=e?.original,h=e?.modified,g=m!=null||h!=null,_=!!(u&&f),[C,w]=(0,v.useState)(null),[T,E]=(0,v.useState)(null),[D,O]=(0,v.useState)(null),[k,A]=(0,v.useState)(`preview`),[j,M]=(0,v.useState)(!1),N=e=>{A(e),e===`preview`&&M(!1)},[P,F]=(0,v.useState)(!g),[I,L]=(0,v.useState)(null),{wordWrap:fe,toggleWordWrap:pe,mobileWordWrap:R,toggleMobileWordWrap:z}=d(re(e=>({wordWrap:e.wordWrap,toggleWordWrap:e.toggleWordWrap,mobileWordWrap:e.mobileWordWrap,toggleMobileWordWrap:e.toggleMobileWordWrap}))),me=ae(),B=ne(n),V=(0,v.useRef)(null),H=(0,v.useRef)(null),[he,ge]=(0,v.useState)(!1),[U,_e]=(0,v.useState)(null),[W,G]=(0,v.useState)(`modified`),[K,q]=(0,v.useState)();(0,v.useEffect)(()=>{let e=V.current;if(!e)return;let t=new ResizeObserver(([e])=>{e&&q(Math.floor(e.contentRect.height))});return t.observe(e),()=>t.disconnect()},[P,I]),(0,v.useEffect)(()=>ie(V.current,()=>H.current?.layout()),[P,I]),(0,v.useEffect)(()=>{if(g||!n)return;if(F(!0),L(null),O(null),E(null),w(null),u&&f){let e=new URLSearchParams({file1:u,file2:f});l.get(`${c(n)}/files/compare?${e}`).then(e=>{E(e),F(!1)}).catch(e=>{L(e instanceof Error?e.message:`Failed to compare files`),F(!1)});return}if(t){let e=B.repoPath(t);if(e==null){F(!1);return}let n=new URLSearchParams({file:e});i&&n.set(`ref`,i),o&&n.set(`ref2`,o),j&&n.set(`text`,`1`),l.get(B.gitUrl(`/file-full-diff?${n}`)).then(e=>{O(e),F(!1)}).catch(e=>{L(e instanceof Error?e.message:`Failed to load diff`),F(!1)});return}let e;if(i||o){let t=new URLSearchParams;i&&t.set(`ref1`,i),o&&t.set(`ref2`,o),e=B.gitUrl(`/diff?${t}`)}else e=B.gitUrl(`/diff`);l.get(e).then(e=>{w(e.diff),F(!1)}).catch(e=>{L(e instanceof Error?e.message:`Failed to load diff`),F(!1)})},[t,n,i,o,u,f,g,B,j]),(0,v.useEffect)(()=>{M(!1),A(`preview`)},[t,i,o]);let{original:J,modified:Y}=(0,v.useMemo)(()=>g?{original:m??``,modified:h??``}:_&&T?T:D||(C?de(C):{original:``,modified:``}),[C,g,m,h,_,T,D]),ve=(0,v.useMemo)(()=>{let e=t??f??u;return e?ue(e):`plaintext`},[t,u,f]),X=d(e=>e.inlineBlame),ye=d(e=>e.toggleInlineBlame),Z=typeof window<`u`&&window.innerWidth<768,Q=Z?R:fe,be=Z?z:pe,$=!!(n&&t&&D)&&!Z;p({editor:U?.original??null,monaco:U?.monaco??null,projectName:n,filePath:$?t:void 0,rev:i||`HEAD`,enabled:X&&$&&W===`original`,readOnly:!0}),p({editor:U?.modified??null,monaco:U?.monaco??null,projectName:n,filePath:$?t:void 0,rev:o,enabled:X&&$&&W===`modified`,readOnly:!0});let xe=!Z;if((0,v.useEffect)(()=>{let e=H.current;if(!e)return;let t=Q?`on`:`off`;e.updateOptions({diffWordWrap:t}),e.getOriginalEditor().updateOptions({wordWrapOverride2:t}),e.getModifiedEditor().updateOptions({wordWrapOverride2:t})},[Q,he]),!n&&!g)return(0,y.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground text-sm`,children:`No project selected.`});if(P)return(0,y.jsxs)(`div`,{className:`flex items-center justify-center h-full gap-2 text-muted-foreground`,children:[(0,y.jsx)(s,{className:`size-5 animate-spin`}),(0,y.jsx)(`span`,{className:`text-sm`,children:`Loading diff...`})]});if(I)return(0,y.jsx)(`div`,{className:`flex items-center justify-center h-full text-destructive text-sm`,children:I});if(D?.binary&&!j&&t&&n){let e=B.repoPath(t),r=t=>e==null?null:B.gitUrl(`/file-blob?file=${encodeURIComponent(e)}&ref=${encodeURIComponent(t)}`);return(0,y.jsxs)(`div`,{className:`flex flex-col h-full`,children:[b(t)&&(0,y.jsx)(`div`,{className:`flex items-center justify-end gap-0.5 px-2 py-0.5 border-b border-border shrink-0`,children:(0,y.jsx)(S,{mode:k,onChange:N})}),(0,y.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,y.jsx)(le,{filePath:t,mode:k,original:{url:D.originalSize===null?null:r(i||`HEAD`),label:x(i||`HEAD`),size:D.originalSize},modified:{url:D.modifiedSize===null?null:o?r(o):`${c(n)}/files/raw?path=${encodeURIComponent(t)}`,label:o?x(o):`Working Tree`,size:D.modifiedSize},onOpenAnyway:()=>M(!0)})})]})}return!g&&!_&&!D&&!J&&!Y?(0,y.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-2 text-muted-foreground`,children:[(0,y.jsx)(a,{className:`size-8`}),(0,y.jsx)(`p`,{className:`text-sm`,children:`No content changes`}),t&&(0,y.jsx)(`p`,{className:`text-xs font-mono`,children:t})]}):(0,y.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-end gap-0.5 px-2 py-0.5 border-b border-border shrink-0`,children:[D?.binary&&t&&b(t)&&(0,y.jsx)(S,{mode:`text`,onChange:N}),$&&(0,y.jsx)(`button`,{type:`button`,onClick:ye,title:`Inline blame (Alt+B) — who last touched the cursor's line. Click a pane to annotate that side.`,className:`flex items-center justify-center rounded hover:bg-muted active:scale-95 transition-colors p-1 ${X?`bg-muted text-foreground`:``}`,children:(0,y.jsx)(r,{className:`size-3.5`})}),(0,y.jsx)(`button`,{type:`button`,onClick:be,title:Q?`Wrapping long lines — tap to scroll sideways instead`:`Toggle word wrap`,className:`flex items-center justify-center rounded hover:bg-muted active:scale-95 transition-colors ${Z?`size-11`:`p-1`} ${Q?`bg-muted text-foreground`:``}`,children:(0,y.jsx)(ee,{className:`size-3.5`})})]}),(0,y.jsx)(`div`,{ref:V,className:`flex-1 overflow-hidden`,children:K&&K>0?(0,y.jsx)(te,{height:K,language:ve,beforeMount:ce,original:J,modified:Y,theme:me,onMount:(e,t)=>{H.current=e,ge(!0);let n=e.getOriginalEditor(),r=e.getModifiedEditor();_e({monaco:t,original:n,modified:r}),n.onDidFocusEditorText(()=>G(`original`)),r.onDidFocusEditorText(()=>G(`modified`)),e.addCommand(t.KeyMod.Alt|t.KeyCode.KeyB,()=>d.getState().toggleInlineBlame())},options:{fontSize:Z?11:14,fontFamily:se,fontLigatures:oe,diffWordWrap:Q?`on`:`off`,renderSideBySide:xe,useInlineViewWhenSpaceIsLimited:!1,readOnly:!0,automaticLayout:!0,scrollBeyondLastLine:!1},loading:(0,y.jsx)(s,{className:`size-5 animate-spin text-muted-foreground`})}):(0,y.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,y.jsx)(s,{className:`size-5 animate-spin text-muted-foreground`})})})]})}function de(e){let t=e.split(`
2
2
  `),n=[],r=[],i=!1;for(let e of t)if(!(e.startsWith(`diff --git`)||e.startsWith(`diff --no-index`)||e.startsWith(`index `)||e.startsWith(`new file`)||e.startsWith(`deleted file`)||e.startsWith(`old mode`)||e.startsWith(`new mode`)||e.startsWith(`---`)||e.startsWith(`+++`)||e.startsWith(`Binary files`)||e.startsWith(`\\ No newline`))){if(e.startsWith(`@@`)){i=!0;continue}if(i)if(e.startsWith(`-`))n.push(e.slice(1));else if(e.startsWith(`+`))r.push(e.slice(1));else{let t=e.startsWith(` `)?e.slice(1):e;n.push(t),r.push(t)}}return{original:n.join(`
3
3
  `),modified:r.join(`
4
4
  `)}}export{D as DiffViewer};
@@ -1,4 +1,4 @@
1
- import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import{bt as r,un as i}from"./icons-C9ZwXgel.js";import{i as a,n as o}from"./api-client-c8YOpTlT.js";var s=e(t(),1),c=n();function l({filePath:e,projectName:t}){let[n,l]=(0,s.useState)(null),[u,d]=(0,s.useState)(!0),[f,p]=(0,s.useState)(null);return(0,s.useEffect)(()=>{d(!0),p(null);let n=/^(\/|[A-Za-z]:[/\\])/.test(e)?`/api/fs/docx-html?path=${encodeURIComponent(e)}`:`${a(t)}/files/docx-html?path=${encodeURIComponent(e)}`;o.get(n).then(e=>{l(e.html),d(!1)}).catch(e=>{p(e instanceof Error?e.message:`Failed to convert docx`),d(!1)})},[e,t]),(0,s.useEffect)(()=>{let n=n=>{let r=n.detail;if(r.projectName!==t||r.path!==e)return;let i=/^(\/|[A-Za-z]:[/\\])/.test(e)?`/api/fs/docx-html?path=${encodeURIComponent(e)}`:`${a(t)}/files/docx-html?path=${encodeURIComponent(e)}`;o.get(i).then(e=>l(e.html)).catch(()=>{})};return window.addEventListener(`file:changed`,n),()=>window.removeEventListener(`file:changed`,n)},[e,t]),u?(0,c.jsxs)(`div`,{className:`flex items-center justify-center h-full gap-2 text-text-secondary`,children:[(0,c.jsx)(i,{className:`size-5 animate-spin`}),(0,c.jsx)(`span`,{className:`text-sm`,children:`Converting document...`})]}):f?(0,c.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-text-secondary`,children:[(0,c.jsx)(r,{className:`size-10 text-text-subtle`}),(0,c.jsx)(`p`,{className:`text-sm`,children:`Failed to load document.`}),(0,c.jsx)(`p`,{className:`text-xs text-text-subtle`,children:f})]}):(0,c.jsx)(`div`,{className:`h-full overflow-auto bg-white dark:bg-bg`,children:(0,c.jsx)(`div`,{className:`docx-preview max-w-3xl mx-auto px-6 py-8 text-sm text-foreground leading-relaxed
1
+ import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import{bt as r,un as i}from"./icons-CO_II6D-.js";import{i as a,n as o}from"./api-client-c8YOpTlT.js";var s=e(t(),1),c=n();function l({filePath:e,projectName:t}){let[n,l]=(0,s.useState)(null),[u,d]=(0,s.useState)(!0),[f,p]=(0,s.useState)(null);return(0,s.useEffect)(()=>{d(!0),p(null);let n=/^(\/|[A-Za-z]:[/\\])/.test(e)?`/api/fs/docx-html?path=${encodeURIComponent(e)}`:`${a(t)}/files/docx-html?path=${encodeURIComponent(e)}`;o.get(n).then(e=>{l(e.html),d(!1)}).catch(e=>{p(e instanceof Error?e.message:`Failed to convert docx`),d(!1)})},[e,t]),(0,s.useEffect)(()=>{let n=n=>{let r=n.detail;if(r.projectName!==t||r.path!==e)return;let i=/^(\/|[A-Za-z]:[/\\])/.test(e)?`/api/fs/docx-html?path=${encodeURIComponent(e)}`:`${a(t)}/files/docx-html?path=${encodeURIComponent(e)}`;o.get(i).then(e=>l(e.html)).catch(()=>{})};return window.addEventListener(`file:changed`,n),()=>window.removeEventListener(`file:changed`,n)},[e,t]),u?(0,c.jsxs)(`div`,{className:`flex items-center justify-center h-full gap-2 text-text-secondary`,children:[(0,c.jsx)(i,{className:`size-5 animate-spin`}),(0,c.jsx)(`span`,{className:`text-sm`,children:`Converting document...`})]}):f?(0,c.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-text-secondary`,children:[(0,c.jsx)(r,{className:`size-10 text-text-subtle`}),(0,c.jsx)(`p`,{className:`text-sm`,children:`Failed to load document.`}),(0,c.jsx)(`p`,{className:`text-xs text-text-subtle`,children:f})]}):(0,c.jsx)(`div`,{className:`h-full overflow-auto bg-white dark:bg-bg`,children:(0,c.jsx)(`div`,{className:`docx-preview max-w-3xl mx-auto px-6 py-8 text-sm text-foreground leading-relaxed
2
2
  [&_table]:border-collapse [&_table]:w-full [&_table]:my-3
3
3
  [&_td]:border [&_td]:border-border [&_td]:px-2 [&_td]:py-1
4
4
  [&_th]:border [&_th]:border-border [&_th]:px-2 [&_th]:py-1 [&_th]:font-semibold [&_th]:bg-muted/50
@@ -1 +1 @@
1
- import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import"./api-client-c8YOpTlT.js";import"./panel-store-BUQ-CPsd.js";import"./window-store-B4cbZ5rr.js";import{t as n}from"./tab-store-DqeaGhhE.js";import"./ws-auth-B_y5rMfZ.js";import{i as r,n as i,r as a,t as o,useLsp as s}from"./use-lsp-DhBjkGWr.js";var c=e(t(),1);function l(e,t,n){return t.addAction({id:`ppm.lsp.goToDefinition`,label:`Go to Definition`,keybindings:[e.KeyCode.F12],contextMenuGroupId:`navigation`,contextMenuOrder:1.1,run:async t=>{let s=t.getModel(),c=t.getPosition();if(!s||!c)return;let l=r(s);if(!l)return;let d=null;try{d=await l.connection.request(l.path,`textDocument/definition`,{textDocument:{uri:s.uri.toString()},position:i(c)})}catch{return}let f=(Array.isArray(d)?d[0]:d)??null;if(!f)return;let p=`targetUri`in f?f.targetUri:f.uri,m=`targetUri`in f?f.targetSelectionRange??f.targetRange:f.range;if(!p||!m)return;let h=o(m.start);if(p===s.uri.toString()){t.setPosition(h),t.revealPositionInCenterIfOutsideViewport(h,e.editor.ScrollType.Smooth),t.setSelection({startLineNumber:h.lineNumber,startColumn:h.column,endLineNumber:m.end.line+1,endColumn:m.end.character+1});return}let g=l.connection.statusOf(l.path);if(g?.state!==`ready`||!g.projectPath)return;let _=a(p);if(!_)return;let v=u(g.projectPath,_);v&&n.openFileTab(v,l.connection.projectName,h.lineNumber)}})}function u(e,t){let n=e.replace(/\\/g,`/`).replace(/\/+$/,``),r=t.replace(/\\/g,`/`);return r.startsWith(n+`/`)?r.slice(n.length+1):null}var d={status:null,diagnostics:[]};function f({editor:e,monaco:t,projectName:r,filePath:i,onState:a}){let{status:o,diagnostics:u}=s({editor:e,monaco:t,projectName:r,filePath:i,enabled:!0});(0,c.useEffect)(()=>{let r=l(t,e,{openFileTab:(e,t,r)=>n.getState().openTab({type:`editor`,title:e.split(`/`).pop()||e,projectId:t,metadata:{filePath:e,projectName:t,lineNumber:r},closable:!0})});return()=>r.dispose()},[t,e]);let f=(0,c.useRef)(a);return f.current=a,(0,c.useEffect)(()=>{f.current({status:o,diagnostics:u})},[o,u]),(0,c.useEffect)(()=>()=>f.current(d),[]),null}export{f as EditorLanguageService,f as default};
1
+ import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import"./api-client-c8YOpTlT.js";import"./panel-store-BUQ-CPsd.js";import"./window-store-B4cbZ5rr.js";import{t as n}from"./tab-store-DqeaGhhE.js";import"./ws-auth-B_y5rMfZ.js";import{i as r,n as i,r as a,t as o,useLsp as s}from"./use-lsp-DK26Eter.js";var c=e(t(),1);function l(e,t,n){return t.addAction({id:`ppm.lsp.goToDefinition`,label:`Go to Definition`,keybindings:[e.KeyCode.F12],contextMenuGroupId:`navigation`,contextMenuOrder:1.1,run:async t=>{let s=t.getModel(),c=t.getPosition();if(!s||!c)return;let l=r(s);if(!l)return;let d=null;try{d=await l.connection.request(l.path,`textDocument/definition`,{textDocument:{uri:s.uri.toString()},position:i(c)})}catch{return}let f=(Array.isArray(d)?d[0]:d)??null;if(!f)return;let p=`targetUri`in f?f.targetUri:f.uri,m=`targetUri`in f?f.targetSelectionRange??f.targetRange:f.range;if(!p||!m)return;let h=o(m.start);if(p===s.uri.toString()){t.setPosition(h),t.revealPositionInCenterIfOutsideViewport(h,e.editor.ScrollType.Smooth),t.setSelection({startLineNumber:h.lineNumber,startColumn:h.column,endLineNumber:m.end.line+1,endColumn:m.end.character+1});return}let g=l.connection.statusOf(l.path);if(g?.state!==`ready`||!g.projectPath)return;let _=a(p);if(!_)return;let v=u(g.projectPath,_);v&&n.openFileTab(v,l.connection.projectName,h.lineNumber)}})}function u(e,t){let n=e.replace(/\\/g,`/`).replace(/\/+$/,``),r=t.replace(/\\/g,`/`);return r.startsWith(n+`/`)?r.slice(n.length+1):null}var d={status:null,diagnostics:[]};function f({editor:e,monaco:t,projectName:r,filePath:i,onState:a}){let{status:o,diagnostics:u}=s({editor:e,monaco:t,projectName:r,filePath:i,enabled:!0});(0,c.useEffect)(()=>{let r=l(t,e,{openFileTab:(e,t,r)=>n.getState().openTab({type:`editor`,title:e.split(`/`).pop()||e,projectId:t,metadata:{filePath:e,projectName:t,lineNumber:r},closable:!0})});return()=>r.dispose()},[t,e]);let f=(0,c.useRef)(a);return f.current=a,(0,c.useEffect)(()=>{f.current({status:o,diagnostics:u})},[o,u]),(0,c.useEffect)(()=>()=>f.current(d),[]),null}export{f as EditorLanguageService,f as default};
@@ -1,2 +1,2 @@
1
- import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import{An as r,Bt as i,Gn as a,Ht as o,Jr as s,Jt as c,Lr as l,Mr as u,N as d,O as f,Rr as p,Wt as m,Zn as h,an as g,cr as _,d as v,en as y,ht as b,ir as x,j as S,jt as C,kt as ee,l as te,lt as ne,nt as re,p as ie,q as ae,qn as oe,r as se,st as ce,tt as le,u as ue,ur as de,ut as fe,w as pe}from"./icons-C9ZwXgel.js";import{t as me}from"./createLucideIcon-DBXq3G0e.js";import{r as he,s as w}from"./api-client-c8YOpTlT.js";import{t as ge}from"./react-CzUPVyyG.js";import{n as T}from"./utils-btZ8C8-R.js";import{t as _e}from"./window-store-B4cbZ5rr.js";import{t as ve}from"./tab-store-DqeaGhhE.js";import{o as ye}from"./file-store-CTlJqj2m.js";import{n as E}from"./use-is-mobile-CkO33jqU.js";import{t as be}from"./file-icons-BlOxPo3P.js";import{i as xe,n as Se,o as Ce,r as D,t as we}from"./mobile-bottom-sheet-Cf4kV1hS.js";import{n as O,t as Te}from"./fs-api-RVc5RtTA.js";import{a as Ee,n as De,o as Oe,r as ke,s as Ae,t as je}from"./format-file-meta-DLaHgkdx.js";import{$t as Me,A as Ne,Bt as Pe,Cn as Fe,Ct as Ie,Dt as k,Et as Le,Ft as A,Gt as j,Ht as M,It as Re,Jt as ze,Kt as Be,Lt as Ve,Nt as He,Ot as Ue,Pt as We,Qt as Ge,Rt as Ke,St as qe,Tt as Je,Vt as Ye,Xt as N,Yt as Xe,Zt as Ze,an as Qe,cn as $e,en as P,jt as F,ln as et,mn as tt,on as nt,qt as I,rn as rt,sn as it,tn as at,un as ot,wt as st,xn as ct,xt as L,zt as lt}from"./index-BVKT5UCu.js";import{a as R,o as z,s as ut}from"./can-open-in-ppm-D8T6Xca-.js";var dt=me(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),ft=`ppm-explorer-pins`,pt=50;function mt(){try{let e=localStorage.getItem(ft),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(e=>!!e&&typeof e.path==`string`&&typeof e.name==`string`).slice(0,pt):[]}catch{return[]}}function ht(e){try{localStorage.setItem(ft,JSON.stringify(e))}catch{}}var B=ge((e,t)=>({pins:mt(),isPinned:e=>t().pins.some(t=>t.path===e),pin:n=>{if(t().isPinned(n.path))return;let r=[...t().pins,n].slice(0,pt);ht(r),e({pins:r})},unpin:n=>{let r=t().pins.filter(e=>e.path!==n);ht(r),e({pins:r})}}));function gt(e){return R(e.name)?(ve.getState().openTab({type:ut(e.name)===`sqlite`?`sqlite`:`editor`,title:e.name,projectId:null,metadata:{filePath:e.path},closable:!0}),!0):!1}function _t(e){return _e.getState().open(`explorer`,{path:e})}async function vt(e){let t=e.filter(e=>e.type===`file`),n=e.length-t.length;n>0&&w.warning(n===1?`Folders cannot be downloaded`:`${n} folders skipped`);for(let e of t)try{Fe(await O.downloadUrl(e.path),e.name)}catch(t){w.error(`Download failed: ${e.name}`,{description:t instanceof Error?t.message:void 0})}}async function yt(e,t){e.length!==0&&(await ct(e.join(`
1
+ import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import{An as r,Bt as i,Gn as a,Ht as o,Jr as s,Jt as c,Lr as l,Mr as u,N as d,O as f,Rr as p,Wt as m,Zn as h,an as g,cr as _,d as v,en as y,ht as b,ir as x,j as S,jt as C,kt as ee,l as te,lt as ne,nt as re,p as ie,q as ae,qn as oe,r as se,st as ce,tt as le,u as ue,ur as de,ut as fe,w as pe}from"./icons-CO_II6D-.js";import{t as me}from"./createLucideIcon-DBXq3G0e.js";import{r as he,s as w}from"./api-client-c8YOpTlT.js";import{t as ge}from"./react-CzUPVyyG.js";import{n as T}from"./utils-btZ8C8-R.js";import{t as _e}from"./window-store-B4cbZ5rr.js";import{t as ve}from"./tab-store-DqeaGhhE.js";import{o as ye}from"./file-store-CTlJqj2m.js";import{n as E}from"./use-is-mobile-CkO33jqU.js";import{t as be}from"./file-icons-BlOxPo3P.js";import{i as xe,n as Se,o as Ce,r as D,t as we}from"./mobile-bottom-sheet-Cf4kV1hS.js";import{n as O,t as Te}from"./fs-api-RVc5RtTA.js";import{a as Ee,n as De,o as Oe,r as ke,s as Ae,t as je}from"./format-file-meta-DLaHgkdx.js";import{$t as Me,A as Ne,Bt as Pe,Cn as Fe,Ct as Ie,Dt as k,Et as Le,Ft as A,Gt as j,Ht as M,It as Re,Jt as ze,Kt as Be,Lt as Ve,Nt as He,Ot as Ue,Pt as We,Qt as Ge,Rt as Ke,St as qe,Tt as Je,Vt as Ye,Xt as N,Yt as Xe,Zt as Ze,an as Qe,cn as $e,en as P,jt as F,ln as et,mn as tt,on as nt,qt as I,rn as rt,sn as it,tn as at,un as ot,wt as st,xn as ct,xt as L,zt as lt}from"./index-CvUGUp7d.js";import{a as R,o as z,s as ut}from"./can-open-in-ppm-D8T6Xca-.js";var dt=me(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),ft=`ppm-explorer-pins`,pt=50;function mt(){try{let e=localStorage.getItem(ft),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(e=>!!e&&typeof e.path==`string`&&typeof e.name==`string`).slice(0,pt):[]}catch{return[]}}function ht(e){try{localStorage.setItem(ft,JSON.stringify(e))}catch{}}var B=ge((e,t)=>({pins:mt(),isPinned:e=>t().pins.some(t=>t.path===e),pin:n=>{if(t().isPinned(n.path))return;let r=[...t().pins,n].slice(0,pt);ht(r),e({pins:r})},unpin:n=>{let r=t().pins.filter(e=>e.path!==n);ht(r),e({pins:r})}}));function gt(e){return R(e.name)?(ve.getState().openTab({type:ut(e.name)===`sqlite`?`sqlite`:`editor`,title:e.name,projectId:null,metadata:{filePath:e.path},closable:!0}),!0):!1}function _t(e){return _e.getState().open(`explorer`,{path:e})}async function vt(e){let t=e.filter(e=>e.type===`file`),n=e.length-t.length;n>0&&w.warning(n===1?`Folders cannot be downloaded`:`${n} folders skipped`);for(let e of t)try{Fe(await O.downloadUrl(e.path),e.name)}catch(t){w.error(`Download failed: ${e.name}`,{description:t instanceof Error?t.message:void 0})}}async function yt(e,t){e.length!==0&&(await ct(e.join(`
2
2
  `)),w.success(e.length===1?`${t} copied`:`${e.length} ${t.toLowerCase()}s copied`))}var bt=/[<>:"|?*]/,xt=/[\u0000-\u001f]/,St=/^(con|prn|aux|nul|com[1-9]|lpt[1-9])(\..*)?$/i;function Ct(e,t){if(!e)return`Name cannot be empty`;if(e===`.`||e===`..`)return`Reserved name`;if(e.includes(`/`)||e.includes(`\\`))return`Name cannot contain path separators`;if(xt.test(e))return`Invalid character in name`;if(t===`win32`){if(bt.test(e))return`Cannot contain < > : " | ? *`;if(St.test(e))return`"${e}" is a reserved Windows name`;if(e.endsWith(`.`)||e.endsWith(` `))return`Cannot end with a dot or space`}return null}async function wt(e,t,n,r){let i=Ae(e,t,r);try{return n===`folder`?await O.mkdir(i,!1):await O.touch(i),Pe(e),!0}catch(e){return w.error(n===`folder`?`Could not create folder`:`Could not create file`,{description:De(e)}),!1}}async function Tt(e,t,n){try{return await O.rename(e,t),Pe(je(e,n)),!0}catch(e){return w.error(`Rename failed`,{description:De(e)}),!1}}async function Et(e,t,n){let r={removed:0,needsPermanent:[]},i=new Set;for(let a of e){i.add(je(a,n));try{await O.remove(a,t),r.removed++}catch(e){if(e instanceof Te&&e.code===`NO_TRASH`){r.needsPermanent.push(a);continue}w.error(`Delete failed`,{description:De(e)})}}if(Pe(...i),r.removed>0){let e=`${r.removed} item${r.removed===1?``:`s`}`;w.success(t?`Deleted ${e}`:`Moved ${e} to Trash`)}return r}function Dt(e,t){let n=e?Array.from({length:e.length},(t,n)=>e.item(n)).filter(e=>e!=null):[];return t(),n}var V=e(t(),1),H=n();function Ot(e){let t=(0,V.useRef)(null),n=(0,V.useRef)(null),r=typeof document<`u`&&`webkitdirectory`in document.createElement(`input`),i=t=>{let n=Dt(t.target.files,()=>{t.target.value=``});n.length!==0&&e(n.map(e=>({file:e,relativePath:e.webkitRelativePath||e.name})))};return{supportsFolderPicker:r,openFilePicker:()=>t.current?.click(),openFolderPicker:()=>n.current?.click(),inputs:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`input`,{ref:t,type:`file`,multiple:!0,hidden:!0,onChange:i,"data-testid":`explorer-upload-file-input`}),r&&(0,H.jsx)(`input`,{ref:n,webkitdirectory:``,type:`file`,multiple:!0,hidden:!0,onChange:i,"data-testid":`explorer-upload-folder-input`})]})}}function kt(e,t){let n=(0,V.useCallback)((t,n)=>Le(t,n,e.sep,e),[e]),r=Ot(e=>void n(e,t()));return{uploadInto:n,openUploadPicker:r.openFilePicker,openUploadFolderPicker:r.openFolderPicker,supportsFolderUpload:r.supportsFolderPicker,uploadInputs:r.inputs}}function At(e,t,n,r){let i=M(e=>e.patch),a=Je(),o=st(),[s,c]=(0,V.useState)(null),[l,u]=(0,V.useState)(null),[d,f]=(0,V.useState)(null),p=(0,V.useRef)(t);p.current=t;let m=(0,V.useRef)(a);m.current=a;let h=(0,V.useRef)(o);h.current=o;let g=(0,V.useMemo)(()=>({get sep(){return p.current?.sep??`/`},resolve:e=>m.current.resolve(e),startBatch:()=>m.current.startBatch(),endBatch:()=>m.current.endBatch(),confirmPermanentOverwrite:e=>h.current.confirm(e)}),[]),_=()=>p.current?.path??``,v=kt(g,_),y=(0,V.useMemo)(()=>({openEntry:e=>{e.type===`directory`?n.go(e.path):gt(e)},openInNewWindow:e=>{_t(e.type===`directory`?e.path:p.current?.path??e.path)},openInTerminal:e=>{Ue(e?.type===`directory`?e.path:_())},cut:e=>Ke(e.map(e=>e.path),`cut`),copy:e=>Ke(e.map(e=>e.path),`copy`),paste:e=>void Ve(e??_(),g),transferInto:async(e,t,n)=>{let r=await lt(e,t,n,g);if(r.succeeded>0){let e=n===`copy`?`Copied`:`Moved`;w.success(`${e} ${r.succeeded} item${r.succeeded===1?``:`s`}`)}},uploadInto:v.uploadInto,openUploadPicker:v.openUploadPicker,openUploadFolderPicker:v.openUploadFolderPicker,supportsFolderUpload:v.supportsFolderUpload,startRename:t=>{f(null),i(e,{inlineEdit:{kind:`rename`,path:t.path,initial:t.name}})},startCreate:t=>{f(null),i(e,{inlineEdit:{kind:t,initial:``}})},cancelInline:()=>{f(null),i(e,{inlineEdit:null})},commitInline:async t=>{let n=p.current,a=n?.inlineEdit;if(!n||!a)return;let o=t.trim();if(a.kind===`rename`&&o===a.initial){i(e,{inlineEdit:null});return}let s=Ct(o,r);if(s){f(s);return}f(null),(a.kind===`rename`?await Tt(a.path,o,n.sep):await wt(n.path,o,a.kind===`new-folder`?`folder`:`file`,n.sep))&&i(e,{inlineEdit:null})},trash:e=>{Et(e.map(e=>e.path),!1,p.current?.sep??`/`).then(e=>{e.needsPermanent.length>0&&c({paths:e.needsPermanent,names:e.needsPermanent.map(e=>e.split(/[/\\]/).pop()??e)})})},confirmPermanentDelete:e=>{e.length!==0&&c({paths:e.map(e=>e.path),names:e.map(e=>e.name)})},download:e=>void vt(e),copyPath:e=>void yt(e,`Path`),copyName:e=>void yt(e,`Name`),togglePin:(e,t)=>{let n=B.getState();n.isPinned(e)?n.unpin(e):n.pin({path:e,name:t})},showProperties:e=>u(e)}),[e,i,n,g,r,v]),b=(0,V.useCallback)(()=>{let e=s;c(null),e&&Et(e.paths,!0,p.current?.sep??`/`)},[s]);return{actions:y,dialogs:{collision:a.state,pendingDelete:s,permanentOverwrite:o.state,properties:l,inlineError:d,closeDelete:()=>c(null),runPermanentDelete:b,closeProperties:()=>u(null),uploadInputs:v.uploadInputs}}}var jt=e=>(0,H.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,...e,children:(0,H.jsx)(`path`,{stroke:`#64748B`,strokeWidth:`2`,d:`M7.784 5H5a2 2 0 00-2 2v10a2 2 0 002 2h14a2 2 0 002-2V9.875a2 2 0 00-2-2h-6.284a2 2 0 01-1.27-.455L9.054 5.455A2 2 0 007.783 5z`})}),Mt=e=>(0,H.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,...e,children:(0,H.jsx)(`path`,{fill:`#64748B`,stroke:`#64748B`,strokeWidth:`2`,d:`M7.784 5H5a2 2 0 00-2 2v10a2 2 0 002 2h14a2 2 0 002-2V9.875a2 2 0 00-2-2h-6.284a2 2 0 01-1.27-.455L9.054 5.455A2 2 0 007.783 5z`})}),Nt=jt,Pt=Mt,Ft=(0,V.createContext)({closed:Nt,open:Pt}),It=Ft.Provider;function U({name:e,kind:t,open:n,className:r}){let i=(0,V.useContext)(Ft),a=T(`shrink-0`,r);return t===`directory`?(0,H.jsx)(n?i.open:i.closed,{className:a}):t===`symlink`?(0,H.jsx)(C,{className:T(a,`text-text-2`)}):t===`unknown`?(0,H.jsx)(o,{className:T(a,`text-text-subtle`)}):(0,H.jsx)(be,{name:e,className:a})}function Lt({className:e}){return(0,H.jsx)(U,{name:``,kind:`directory`,className:T(`size-4 shrink-0`,e)})}var Rt={fixed:i,removable:p,network:dt,unknown:i};function W({label:e,path:t,active:n,icon:r,onNavigate:i,onUnpin:a,run:o,uploadRun:s}){let c=Re(),l=L({targetDir:t,run:o,onFiles:s});return(0,H.jsxs)(`div`,{className:`group/place relative flex items-center`,children:[(0,H.jsxs)(`button`,{type:`button`,title:t,onClick:()=>i(t),className:T(`flex w-full items-center gap-2 rounded px-2 py-1 text-left text-[13px]`,c?`min-h-[44px]`:`min-h-0`,`can-hover:hover:bg-surface-elevated`,n?`bg-accent-wash text-text`:`text-text-2`,l.isOver&&`ring-1 ring-dashed ring-primary bg-primary/10`),...l.handlers,children:[(0,H.jsx)(r,{className:`size-4 shrink-0 text-text-subtle`}),(0,H.jsx)(`span`,{className:`truncate`,children:e})]}),a&&(0,H.jsx)(`button`,{type:`button`,"aria-label":`Unpin ${e}`,title:`Unpin`,onClick:a,className:`absolute right-1 rounded p-1 text-text-subtle can-hover:opacity-0 can-hover:group-hover/place:opacity-100 can-hover:hover:text-text`,children:(0,H.jsx)(oe,{className:`size-3.5`})})]})}function G({title:e,children:t}){return(0,H.jsxs)(`div`,{className:`pb-2`,children:[(0,H.jsx)(`p`,{className:`px-2 pb-0.5 pt-2 text-[10px] font-semibold uppercase tracking-wide text-text-subtle`,children:e}),t]})}var zt={home:`Home`,pinned:`Quick access`,known:`Folders`,drives:`Drives`};function Bt({host:e,currentPath:t,onNavigate:n,vocab:r=zt}){let i=B(e=>e.pins),a=B(e=>e.unpin),o=e=>e===t,{run:s,uploadRun:c,prompts:l}=qe(e?.sep??`/`,e?.platform);return(0,H.jsxs)(`aside`,{"aria-label":`Places`,"data-testid":`explorer-sidebar`,className:`hidden w-44 shrink-0 overflow-y-auto border-r border-border bg-[var(--x-sidebar-bg,var(--panel-2))] px-1 py-1 sm:block`,children:[i.length>0&&(0,H.jsx)(G,{title:`Pinned`,children:i.map(e=>(0,H.jsx)(W,{label:e.name,path:e.path,icon:oe,active:o(e.path),onNavigate:n,onUnpin:()=>a(e.path),run:s,uploadRun:c},e.path))}),e&&e.pinned.length>0&&(0,H.jsx)(G,{title:r.pinned,children:e.pinned.map(e=>(0,H.jsx)(W,{label:e.name,path:e.path,icon:Lt,active:o(e.path),onNavigate:n,run:s,uploadRun:c},e.path))}),e&&(0,H.jsxs)(G,{title:r.known,children:[(0,H.jsx)(W,{label:r.home,path:e.homedir,icon:Lt,active:o(e.homedir),onNavigate:n,run:s,uploadRun:c}),e.knownFolders.map(e=>(0,H.jsx)(W,{label:e.name,path:e.path,icon:Lt,active:o(e.path),onNavigate:n,run:s,uploadRun:c},e.path))]}),e&&e.drives.length>0&&(0,H.jsx)(G,{title:r.drives,children:e.drives.map(e=>(0,H.jsx)(W,{label:e.label?`${e.label} (${e.name})`:e.name,path:e.path,icon:Rt[e.kind],active:o(e.path),onNavigate:n,run:s,uploadRun:c},e.path))}),e?.warnings.map(e=>(0,H.jsxs)(`p`,{className:`flex gap-1.5 px-2 py-1 text-[11px] leading-snug text-text-subtle`,children:[(0,H.jsx)(se,{className:`mt-0.5 size-3 shrink-0`}),(0,H.jsx)(`span`,{children:e})]},e)),l]})}var K=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`});function Vt(e,t,n){switch(e){case`size`:return(t.size??0)-(n.size??0);case`modified`:return new Date(t.modified).getTime()-new Date(n.modified).getTime();case`kind`:{let e=K.compare(z(t.name),z(n.name));return e===0?K.compare(t.name,n.name):e}case`name`:return K.compare(t.name,n.name)}}function Ht(e,t,n){let r=t.trim().toLowerCase(),i=r?e.filter(e=>e.name.toLowerCase().includes(r)):e,a=n.dir===`asc`?1:-1;return[...i].sort((e,t)=>{let r=e.type===`directory`;if(r!==(t.type===`directory`))return r?-1:1;let i=Vt(n.key,e,t);return(i===0?K.compare(e.name,t.name):i)*a})}function Ut(e){return e.reduce((e,t)=>e+(t.type===`file`?t.size??0:0),0)}function Wt({entries:e,selection:t,truncated:n}){let r=e.filter(e=>t.has(e.path)),i=[`${e.length}${n?`+`:``} item${e.length===1?``:`s`}`];if(r.length>0){i.push(`${r.length} selected`);let e=Ut(r);e>0&&i.push(Oe(e))}return(0,H.jsxs)(`div`,{"data-testid":`explorer-status`,className:`flex shrink-0 items-center gap-2 border-t border-border bg-panel-2 px-2 py-1 text-[11px] text-text-subtle`,children:[i.join(` · `),n&&(0,H.jsx)(`span`,{className:`ml-auto`,children:`Listing capped — narrow the filter to see the rest.`})]})}var Gt=3;function Kt({crumbs:e,onNavigate:t,className:n,sep:i}){let{run:a,prompts:o}=qe(i);if(e.length===0)return(0,H.jsx)(`div`,{className:n});let s=e.length>Gt+2,c=s?e.slice(0,1):e,l=s?e.slice(1,e.length-Gt):[],u=s?e.slice(e.length-Gt):[];return(0,H.jsxs)(`nav`,{"aria-label":`Path`,className:T(`flex min-w-0 items-center gap-0.5 text-xs`,n),children:[c.map(n=>(0,H.jsxs)(`span`,{className:`flex shrink-0 items-center gap-0.5`,children:[(0,H.jsx)(qt,{crumb:n,last:!s&&n===e[e.length-1],onNavigate:t,run:a}),(0,H.jsx)(S,{className:`size-3 shrink-0 text-text-subtle`})]},n.path)),s&&(0,H.jsxs)(rt,{children:[(0,H.jsx)(tt,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,"aria-label":`Show hidden path segments`,className:`rounded px-1 py-0.5 text-text-2 can-hover:hover:bg-surface-elevated`,children:(0,H.jsx)(r,{className:`size-3.5`})})}),(0,H.jsx)(Qe,{align:`start`,className:`max-h-72 overflow-y-auto`,children:l.map(e=>(0,H.jsx)(nt,{onClick:()=>t(e.path),children:e.name},e.path))})]}),s&&(0,H.jsx)(S,{className:`size-3 shrink-0 text-text-subtle`}),u.map((e,n)=>(0,H.jsxs)(`span`,{className:`flex min-w-0 items-center gap-0.5`,children:[(0,H.jsx)(qt,{crumb:e,last:n===u.length-1,onNavigate:t,run:a}),n<u.length-1&&(0,H.jsx)(S,{className:`size-3 shrink-0 text-text-subtle`})]},e.path)),o]})}function qt({crumb:e,last:t,onNavigate:n,run:r}){let i=L({targetDir:e.path,run:r});return(0,H.jsx)(`button`,{type:`button`,onClick:()=>n(e.path),className:T(`max-w-[12rem] truncate rounded px-1 py-0.5 can-hover:hover:bg-surface-elevated`,t?`font-medium text-text`:`text-text-2`,i.isOver&&`ring-1 ring-dashed ring-primary bg-primary/10`),...i.handlers,children:e.name})}var q=[{key:`name`,label:`Name`},{key:`size`,label:`Size`},{key:`modified`,label:`Modified`},{key:`kind`,label:`Kind`}],Jt=[{dir:`asc`,label:`Ascending`},{dir:`desc`,label:`Descending`}];function Yt(e){return q.find(t=>t.key===e)?.label??e}function Xt(e){return Jt.find(t=>t.dir===e)?.label??e}function J(e){return T(`relative flex size-7 shrink-0 items-center justify-center rounded text-text-subtle can-hover:hover:bg-surface-elevated can-hover:hover:text-text disabled:opacity-30`,e&&`before:absolute before:-inset-2 before:content-['']`)}function Zt({coarse:e}){let t=M(e=>e.sort),n=M(e=>e.setPrefs),r=`Sort`,i=`${r}: ${Yt(t.key)}, ${Xt(t.dir)}`;return(0,H.jsxs)(rt,{children:[(0,H.jsx)(tt,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,"aria-label":r,title:i,className:J(e),children:(0,H.jsx)(ie,{className:`size-4`})})}),(0,H.jsxs)(Qe,{align:`end`,children:[(0,H.jsx)(it,{children:`Sort by`}),(0,H.jsx)($e,{value:t.key,onValueChange:e=>n({sort:{key:e,dir:t.dir}}),children:q.map(({key:e,label:t})=>(0,H.jsx)(et,{value:e,children:t},e))}),(0,H.jsx)(ot,{}),(0,H.jsx)(it,{children:`Order`}),(0,H.jsx)($e,{value:t.dir,onValueChange:e=>n({sort:{key:t.key,dir:e}}),children:Jt.map(({dir:e,label:t})=>(0,H.jsx)(et,{value:e,children:t},e))})]})]})}function Y({targets:e,currentDir:t,hasClipboard:n,isPinned:r,actions:i}){let a=E(),o=e.length===1?e[0]:null,s=e.length>0&&e.every(e=>e.type===`directory`),c=e.length,l=c>1?` ${c} items`:``,u=M(e=>e.sort),d=M(e=>e.setPrefs);return c===0?(0,H.jsxs)(Be,{children:[(0,H.jsx)(I,{onClick:()=>i.startCreate(`new-file`),children:`New File`}),(0,H.jsx)(I,{onClick:()=>i.startCreate(`new-folder`),children:`New Folder`}),(0,H.jsx)(N,{}),(0,H.jsx)(I,{disabled:!n,onClick:()=>i.paste(),children:`Paste`}),(0,H.jsx)(N,{}),(0,H.jsx)(I,{onClick:()=>i.openUploadPicker(),children:`Upload Files…`}),i.supportsFolderUpload&&(0,H.jsx)(I,{onClick:()=>i.openUploadFolderPicker(),children:`Upload Folder…`}),(0,H.jsx)(N,{}),(0,H.jsx)(I,{onClick:()=>i.openInTerminal(),children:`Open in Terminal`}),(0,H.jsx)(N,{}),(0,H.jsxs)(Ze,{children:[(0,H.jsx)(Me,{children:`Sort by`}),(0,H.jsxs)(Ge,{children:[(0,H.jsx)(ze,{value:u.key,onValueChange:e=>d({sort:{key:e,dir:u.dir}}),children:q.map(({key:e,label:t})=>(0,H.jsx)(Xe,{value:e,children:t},e))}),(0,H.jsx)(N,{}),(0,H.jsx)(ze,{value:u.dir,onValueChange:e=>d({sort:{key:u.key,dir:e}}),children:Jt.map(({dir:e,label:t})=>(0,H.jsx)(Xe,{value:e,children:t},e))})]})]}),(0,H.jsx)(N,{}),(0,H.jsx)(I,{onClick:()=>i.copyPath([t]),children:`Copy Path`})]}):(0,H.jsxs)(Be,{children:[o&&(o.type===`directory`||R(o.name))&&(0,H.jsx)(I,{onClick:()=>i.openEntry(o),children:`Open`}),s&&o&&!a&&(0,H.jsx)(I,{onClick:()=>i.openInNewWindow(o),children:`Open in New Window`}),s&&o&&(0,H.jsx)(I,{onClick:()=>i.openInTerminal(o),children:`Open in Terminal`}),(0,H.jsx)(N,{}),(0,H.jsxs)(I,{onClick:()=>i.cut(e),children:[`Cut`,l]}),(0,H.jsxs)(I,{onClick:()=>i.copy(e),children:[`Copy`,l]}),s&&o&&(0,H.jsx)(I,{disabled:!n,onClick:()=>i.paste(o.path),children:`Paste`}),(0,H.jsx)(N,{}),o&&(0,H.jsx)(I,{onClick:()=>i.startRename(o),children:`Rename`}),(0,H.jsxs)(I,{onClick:()=>i.trash(e),children:[`Move to Trash`,l]}),(0,H.jsx)(I,{variant:`destructive`,onClick:()=>i.confirmPermanentDelete(e),children:`Delete permanently`}),(0,H.jsx)(N,{}),(0,H.jsx)(I,{onClick:()=>i.copyPath(e.map(e=>e.path)),children:`Copy Path`}),(0,H.jsx)(I,{onClick:()=>i.copyName(e.map(e=>e.name)),children:`Copy Name`}),e.some(e=>e.type===`file`)&&(0,H.jsx)(I,{onClick:()=>i.download(e),children:`Download`}),s&&o&&(0,H.jsx)(I,{onClick:()=>i.togglePin(o.path,o.name),children:r(o.path)?`Unpin from Sidebar`:`Pin to Sidebar`}),o&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(N,{}),(0,H.jsx)(I,{onClick:()=>i.showProperties(o),children:`Properties`})]})]})}function Qt(e){let{entry:t,dragPaths:n,run:r,springLoad:i,origin:a=`explorer`,projectName:o,extraData:s,onDragStarted:c,onFiles:l}=e,u=We({paths:n,origin:a,projectName:o,extraData:s,onDragStarted:c}),d=L({targetDir:t.type===`directory`?t.path:null,run:r,springLoad:t.type===`directory`?i:void 0,onFiles:l});return{props:(0,V.useMemo)(()=>({...u,...d.handlers}),[u,d.handlers]),isDropTarget:d.isOver}}function $t(e){return e.type===`directory`||R(e.name)?`open`:`sheet`}function en(e){return e.startsWith(`on`)&&e.length>2&&e[2]===e[2]?.toUpperCase()}function tn(e,t){return n=>{e?.(n),t?.(n)}}function nn(e,t){if(!e)return t;let n={...e};for(let[e,r]of Object.entries(t)){let t=n[e];if(en(e)&&typeof t==`function`&&typeof r==`function`){n[e]=tn(t,r);continue}if(e===`style`&&t&&r){n[e]={...t,...r};continue}if(e===`className`){n[e]=T(t,r);continue}r!==void 0&&(n[e]=r)}return n}function rn({entry:e,selected:t,currentDir:n,hasClipboard:r,isPinned:i,actions:a,rowHeight:o,onSelect:s,onOpen:c}){let l=Qt({entry:e,dragPaths:[e.path],run:a.transferInto,springLoad:s,onFiles:a.uploadInto});return(0,H.jsxs)(j,{children:[(0,H.jsx)(P,{asChild:!0,children:(0,H.jsx)(an,{entry:e,selected:t,rowHeight:o,onSelect:s,onOpen:c,dnd:l.props,dropActive:l.isDropTarget})}),(0,H.jsx)(Y,{targets:[e],currentDir:n,hasClipboard:r,isPinned:i,actions:a})]})}var an=(0,V.forwardRef)(function({entry:e,selected:t,rowHeight:n,onSelect:r,onOpen:i,dnd:a,dropActive:o,...s},c){let l=A(r),u=E(),{setOpen:d}=(0,V.useContext)(Se),f=()=>{r(),!(!u||e.type===`directory`)&&($t(e)===`open`?i():d(!0))};return(0,H.jsxs)(`div`,{ref:c,...nn({...s,...l,...a},{role:`option`,"aria-selected":t,"data-testid":`explorer-column-row`,"data-path":e.path,title:e.name,style:{height:n},onContextMenu:e=>{r(),e.stopPropagation()},onClick:f,onDoubleClick:i,className:T(`flex w-full items-center gap-1.5 px-2 text-[13px] select-none`,`can-hover:hover:bg-surface-elevated`,t&&`bg-accent-wash text-text`,o&&`ring-1 ring-dashed ring-primary bg-primary/10`)}),children:[(0,H.jsx)(U,{name:e.name,kind:e.kind,className:`size-4 shrink-0`}),(0,H.jsx)(`span`,{className:T(`flex-1 truncate`,t?`text-text`:`text-text-2`),children:e.name}),e.type===`directory`&&(0,H.jsx)(`span`,{className:`text-text-subtle`,children:`›`})]})});function on({path:e,entries:t,loading:n,error:r,selectedPath:i,isFocused:a,currentDir:o,hasClipboard:s,isPinned:c,actions:l,rowHeight:u,onSelect:d,onOpen:f,onFocus:p,fullWidth:m}){let h=(0,V.useRef)(null);k(h);let g=m?48:u,_=at({count:t.length,getScrollElement:()=>h.current,estimateSize:()=>g,overscan:8}),v=L({targetDir:e,run:l.transferInto,onFiles:l.uploadInto,disabled:m});return(0,H.jsx)(`div`,{className:T(`flex h-full shrink-0 flex-col`,!m&&`border-r border-border`,a&&`bg-panel-2/40`),style:m?void 0:{width:220},children:(0,H.jsxs)(`div`,{ref:h,role:`listbox`,"aria-label":e,className:T(`flex-1 overflow-y-auto outline-none`,v.isOver&&`ring-1 ring-dashed ring-primary bg-primary/10`),...v.handlers,children:[n&&t.length===0&&(0,H.jsx)(`p`,{className:`p-2 text-xs text-text-subtle`,children:`Loading…`}),r&&(0,H.jsx)(`p`,{className:`p-2 text-xs text-error`,children:r}),!n&&!r&&t.length===0&&(0,H.jsx)(`p`,{className:`p-2 text-xs text-text-subtle`,children:`Empty`}),(0,H.jsx)(`div`,{className:`relative w-full`,style:{height:_.getTotalSize()},children:_.getVirtualItems().map(e=>{let n=t[e.index],r=n.path===i;return(0,H.jsx)(`div`,{className:`absolute left-0 top-0 w-full`,style:{transform:`translateY(${e.start}px)`},children:(0,H.jsx)(rn,{entry:n,selected:r,currentDir:o,hasClipboard:s,isPinned:c,actions:l,rowHeight:g,onSelect:()=>{p(),d(n)},onOpen:()=>f(n)})},n.path)})})]})})}function sn({containerRef:e,onKeyDown:t,backgroundLongPress:n,columns:r,focusedIndex:i,setFocusedIndex:a,selectedPathFor:o,slice:s,hasClipboard:c,isPinned:l,actions:u,onSelect:d,onOpen:f}){let p=r[i];return(0,H.jsxs)(j,{children:[(0,H.jsx)(P,{asChild:!0,children:(0,H.jsxs)(`div`,{ref:e,tabIndex:0,"data-testid":`explorer-columns`,"aria-label":`Column view`,onKeyDown:t,className:`flex h-full min-h-0 w-full flex-col outline-none`,...n,children:[i>0&&(0,H.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>e-1),"aria-label":`Back`,className:`flex h-11 shrink-0 items-center gap-1.5 border-b border-border px-3 text-sm text-text-2 active:bg-surface-elevated`,children:[(0,H.jsx)(te,{className:`size-4`}),` Back`]}),p&&(0,H.jsx)(`div`,{className:`min-h-0 flex-1 motion-safe:animate-in motion-safe:slide-in-from-right-4 motion-safe:duration-150`,children:(0,H.jsx)(on,{path:p.path,entries:p.entries,loading:p.loading,error:p.error,selectedPath:o(i),isFocused:!0,fullWidth:!0,rowHeight:48,currentDir:s.path,hasClipboard:c,isPinned:l,actions:u,onSelect:e=>d(i,e),onOpen:f,onFocus:()=>{}})},p.path)]})}),(0,H.jsx)(Y,{targets:[],currentDir:s.path,hasClipboard:c,isPinned:l,actions:u})]})}var cn=0,ln=[];function un(){return new Promise(e=>{let t=!1,n=()=>{cn++,e(()=>{if(t)return;t=!0,cn--;let e=ln.shift();e&&e()})};cn<24?n():ln.push(n)})}function dn({entry:e,size:t,className:n}){let[r,i]=(0,V.useState)(null),[a,o]=(0,V.useState)(!1),s=(0,V.useRef)(null),c=(0,V.useRef)(null);return(0,V.useEffect)(()=>{i(null),o(!1)},[e.path]),(0,V.useEffect)(()=>{let t=s.current;if(!t||r||a)return;let n=new AbortController,l=null,u=new IntersectionObserver(t=>{t[0]?.isIntersecting&&(u.disconnect(),(async()=>{if(l=await un(),n.signal.aborted){l();return}try{let t=he(),r=await fetch(`/api/fs/raw?path=${encodeURIComponent(e.path)}`,{headers:t?{Authorization:`Bearer ${t}`}:{},signal:n.signal});if(!r.ok)throw Error(String(r.status));let a=await r.blob();if(n.signal.aborted)return;let o=URL.createObjectURL(a);c.current=o,i(o)}catch{n.signal.aborted||o(!0)}finally{l?.()}})())},{rootMargin:`200px`});return u.observe(t),()=>{n.abort(),u.disconnect(),l?.()}},[e.path,r,a]),(0,V.useEffect)(()=>()=>{c.current&&URL.revokeObjectURL(c.current)},[]),a||!r?(0,H.jsx)(`div`,{ref:s,className:T(`flex items-center justify-center`,n),style:{width:t,height:t},children:(0,H.jsx)(U,{name:e.name,kind:e.kind,className:`size-1/2`})}):(0,H.jsx)(`div`,{ref:s,className:T(`flex items-center justify-center overflow-hidden`,n),style:{width:t,height:t},children:(0,H.jsx)(`img`,{src:r,alt:``,loading:`lazy`,className:`max-h-full max-w-full rounded object-contain`,onError:()=>o(!0)})})}function fn({entry:e,onOpen:t}){return e?(0,H.jsxs)(`div`,{className:`flex h-full min-w-0 flex-col items-center gap-3 overflow-y-auto p-4 text-center`,children:[(0,H.jsx)(`div`,{className:`flex h-24 w-24 shrink-0 items-center justify-center`,children:e.type!==`directory`&&ut(e.name)===`image`?(0,H.jsx)(dn,{entry:e,size:96}):(0,H.jsx)(U,{name:e.name,kind:e.kind,className:`size-16`})}),(0,H.jsx)(`p`,{className:`w-full truncate text-sm font-medium text-text`,title:e.name,children:e.name}),(0,H.jsxs)(`dl`,{className:`w-full space-y-1 text-left text-xs text-text-2`,children:[(0,H.jsxs)(`div`,{className:`flex justify-between gap-2`,children:[(0,H.jsx)(`dt`,{className:`text-text-subtle`,children:`Kind`}),(0,H.jsx)(`dd`,{className:`truncate`,children:e.type===`directory`?`Folder`:z(e.name)||`File`})]}),e.type!==`directory`&&(0,H.jsxs)(`div`,{className:`flex justify-between gap-2`,children:[(0,H.jsx)(`dt`,{className:`text-text-subtle`,children:`Size`}),(0,H.jsx)(`dd`,{children:Oe(e.size)})]}),(0,H.jsxs)(`div`,{className:`flex justify-between gap-2`,children:[(0,H.jsx)(`dt`,{className:`text-text-subtle`,children:`Modified`}),(0,H.jsx)(`dd`,{className:`truncate`,children:ke(e.modified)})]})]}),R(e.name)&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>t(e),className:`mt-2 w-full rounded border border-border bg-panel-2 py-1.5 text-xs font-medium text-text can-hover:hover:bg-surface-elevated`,children:`Open`})]},e.path):(0,H.jsx)(`div`,{className:`flex h-full items-center justify-center p-4 text-center text-xs text-text-subtle`,children:`Select a file to preview`})}function pn(e,t){switch(t.type){case`sync`:{let{paths:n,lastEntries:r,lastLoading:i,makeAbort:a}=t,o=n.length-1,s=n.map((t,n)=>{let s=e.columns[n],c=n===o;return s&&s.path===t?c?{...s,entries:r,loading:i,error:null}:s:c?{path:t,entries:r,loading:i,error:null,abort:a()}:{path:t,entries:[],loading:!0,error:null,abort:a()}}),c=[];for(let t=0;t<e.columns.length;t++){let n=e.columns[t],r=s[t];(!r||r.path!==n.path)&&c.push(n.abort)}return{columns:s,staleControllers:c}}case`loaded`:return{columns:e.columns.map(e=>e.path===t.path?{...e,entries:t.entries,loading:!1,error:null}:e),staleControllers:[]};case`error`:return{columns:e.columns.map(e=>e.path===t.path?{...e,loading:!1,error:t.message}:e),staleControllers:[]}}}function mn(e,t,n){let[r,i]=(0,V.useReducer)(pn,{columns:[],staleControllers:[]}),a=(0,V.useRef)(new Set);(0,V.useEffect)(()=>{i({type:`sync`,paths:e,lastEntries:t,lastLoading:n,makeAbort:()=>new AbortController})},[e.join(`\0`),t,n]),(0,V.useEffect)(()=>{for(let e of r.staleControllers)e.abort()},[r.staleControllers]);let o=(0,V.useRef)(r.columns);return o.current=r.columns,(0,V.useEffect)(()=>()=>{for(let e of o.current)e.abort.abort()},[]),(0,V.useEffect)(()=>{let e=r.columns.length-1;r.columns.forEach((t,n)=>{n!==e&&(!t.loading||a.current.has(t.abort)||(a.current.add(t.abort),O.browse(t.path,{signal:t.abort.signal}).then(e=>{a.current.delete(t.abort),!t.abort.signal.aborted&&i({type:`loaded`,path:t.path,entries:e.entries})}).catch(e=>{a.current.delete(t.abort),!(t.abort.signal.aborted||e instanceof DOMException&&e.name===`AbortError`)&&i({type:`error`,path:t.path,message:e instanceof Error?e.message:`Failed to read directory`})})))})},[r.columns]),{columns:r.columns}}var hn=720;function gn({slice:e,entries:t,actions:n,selection:r,hasClipboard:i,isPinned:a,nav:o,backgroundLongPress:s,rowHeight:c}){let{columns:l}=mn((0,V.useMemo)(()=>e.breadcrumbs.length>0?e.breadcrumbs.map(e=>e.path):[e.path],[e.breadcrumbs,e.path]),t,e.loading),u=E(),d=(0,V.useRef)(null);k(d);let[f,p]=(0,V.useState)(l.length-1),[m,h]=(0,V.useState)(0),g=(0,V.useRef)(l.length);(0,V.useEffect)(()=>{let e=d.current;if(!e)return;let t=()=>h(e.clientWidth);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,V.useEffect)(()=>{if(l.length===g.current)return;g.current=l.length,p(l.length-1);let e=d.current;if(!e)return;let t=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches===!0;e.scrollTo({left:e.scrollWidth,behavior:t?`auto`:`smooth`})},[l.length]);let _=(0,V.useMemo)(()=>{if(!e.anchor)return null;for(let t of l){let n=t.entries.find(t=>t.path===e.anchor);if(n)return n}return null},[l,e.anchor]),v=t=>t===l.length-1?e.anchor:l[t+1]?.path??null,y=e=>{let t=l[e];if(!t)return null;let n=v(e);return t.entries.find(e=>e.path===n)??null},b=(e,t)=>{p(e),t.type===`directory`?o.go(t.path):r.selectOnly(t.path)},x=e=>n.openEntry(e),S=e=>{if(!(e.altKey||e.ctrlKey||e.metaKey)){if(e.key===`ArrowRight`&&f<l.length-1){e.preventDefault(),e.stopPropagation(),p(f+1);return}if(e.key===`ArrowLeft`&&f>0){e.preventDefault(),e.stopPropagation(),p(f-1);return}if(e.key===`ArrowUp`||e.key===`ArrowDown`){let t=l[f];if(!t)return;e.preventDefault(),e.stopPropagation();let n=y(f),r=n?t.entries.findIndex(e=>e.path===n.path):-1,i=e.key===`ArrowDown`?1:-1,a=Math.min(t.entries.length-1,Math.max(0,r<0?0:r+i)),o=t.entries[a];o&&b(f,o);return}if(e.key===`Enter`){let t=y(f);t&&(e.preventDefault(),e.stopPropagation(),x(t))}}},C=m>=hn;return u?(0,H.jsx)(sn,{containerRef:d,onKeyDown:S,backgroundLongPress:s,columns:l,focusedIndex:f,setFocusedIndex:p,selectedPathFor:v,slice:e,hasClipboard:i,isPinned:a,actions:n,onSelect:b,onOpen:x}):(0,H.jsxs)(j,{children:[(0,H.jsx)(P,{asChild:!0,children:(0,H.jsxs)(`div`,{ref:d,tabIndex:0,"data-testid":`explorer-columns`,"aria-label":`Column view`,onKeyDown:S,className:`flex h-full min-h-0 w-full overflow-x-auto outline-none`,...s,children:[l.map((t,r)=>(0,H.jsx)(on,{path:t.path,entries:t.entries,loading:t.loading,error:t.error,selectedPath:v(r),isFocused:r===f,currentDir:e.path,hasClipboard:i,isPinned:a,actions:n,rowHeight:c,onSelect:e=>b(r,e),onOpen:x,onFocus:()=>p(r)},t.path)),C&&(0,H.jsx)(`div`,{className:`min-w-[240px] flex-1 border-l border-border bg-panel-2/30`,children:(0,H.jsx)(fn,{entry:_,onOpen:x})})]})}),(0,H.jsx)(Y,{targets:[],currentDir:e.path,hasClipboard:i,isPinned:a,actions:n})]})}function X(e,t){if(e.selection.size>0)return t.filter(t=>e.selection.has(t.path));let n=t.find(t=>t.path===e.anchor);return n?[n]:[]}function _n({slice:e,entries:t,actions:n,selection:r,nav:i}){return(0,V.useCallback)(a=>{if(!e)return;let o=a.target;if(o.tagName===`INPUT`||o.tagName===`TEXTAREA`||o.isContentEditable)return;let s=a.ctrlKey||a.metaKey,c=X(e,t);if(s)switch(a.key.toLowerCase()){case`a`:a.preventDefault(),r.selectAll();return;case`c`:a.preventDefault(),n.copy(c);return;case`x`:a.preventDefault(),n.cut(c);return;case`v`:a.preventDefault(),n.paste();return;default:return}switch(a.key){case`ArrowDown`:a.preventDefault(),r.moveTo(1,a.shiftKey);return;case`ArrowUp`:a.preventDefault(),r.moveTo(-1,a.shiftKey);return;case`Home`:a.preventDefault(),t[0]&&r.selectOnly(t[0].path);return;case`End`:a.preventDefault(),t.length>0&&r.selectOnly(t[t.length-1].path);return;case`ArrowLeft`:a.altKey&&(a.preventDefault(),i.back());return;case`ArrowRight`:a.altKey&&(a.preventDefault(),i.forward());return;case`Backspace`:a.preventDefault(),i.back();return;case`Enter`:a.preventDefault(),c.length===1&&n.openEntry(c[0]);return;case`F2`:a.preventDefault(),c.length===1&&n.startRename(c[0]);return;case`Delete`:if(a.preventDefault(),c.length===0)return;a.shiftKey?n.confirmPermanentDelete(c):n.trash(c);return;case`Escape`:r.clear();return}a.key.length===1&&!a.altKey&&(a.preventDefault(),r.typeAhead(a.key))},[e,t,n,r,i])}function vn(e,t){let n=E(),r=F(e=>e.selectMode),{setOpen:i}=(0,V.useContext)(Se);return{isMobile:n,selectMode:r,handleTap:(a,o)=>n?r?(t.onRowClick(a.path,{shiftKey:!1,ctrlKey:!0,metaKey:!1}),!0):(o||t.selectOnly(a.path),$t(a)===`open`?e.openEntry(a):i(!0),!0):!1}}function Z({initial:e,error:t,onCommit:n,onCancel:r,className:i}){let[a,o]=(0,V.useState)(e),s=(0,V.useRef)(null);return(0,V.useEffect)(()=>{let t=s.current;if(!t)return;t.focus();let n=e.lastIndexOf(`.`);n>0?t.setSelectionRange(0,n):t.select()},[e]),(0,H.jsxs)(`div`,{className:`relative flex-1 min-w-0`,children:[(0,H.jsx)(`input`,{ref:s,value:a,"aria-label":`Name`,"aria-invalid":!!t,onChange:e=>o(e.target.value),onBlur:()=>n(a),onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`?n(a):e.key===`Escape`&&r()},className:T(`w-full rounded-[var(--rad-sm)] border bg-panel px-1.5 py-0.5 text-[13px] text-text outline-none`,t?`border-error`:`border-primary`,i)}),t&&(0,H.jsx)(`span`,{className:`absolute left-0 top-full z-10 mt-0.5 rounded border border-border bg-panel-2 px-1.5 py-0.5 text-[11px] text-error shadow-sm`,children:t})]})}var yn=(0,V.memo)(function(e){let{entry:t,currentDir:n,hasClipboard:r,isPinned:i,actions:a,menuTargets:o}=e,s=Qt({entry:t,dragPaths:(0,V.useMemo)(()=>o.map(e=>e.path),[o]),run:a.transferInto,onFiles:a.uploadInto});return(0,H.jsxs)(j,{children:[(0,H.jsx)(P,{asChild:!0,children:(0,H.jsx)(bn,{...e,dnd:s.props,dropActive:s.isDropTarget})}),(0,H.jsx)(Y,{targets:o,currentDir:n,hasClipboard:r,isPinned:i,actions:a})]})}),bn=(0,V.forwardRef)(function({entry:e,selected:t,focused:n,cut:r,renaming:i,tileWidth:a,actions:o,selection:s,inlineError:c,currentDir:l,hasClipboard:u,isPinned:d,menuTargets:f,dnd:p,dropActive:m,...h},g){let _=A(()=>{t||s.selectOnly(e.path)}),{isMobile:v,selectMode:y,handleTap:b}=vn(o,s),x=e.type!==`directory`&&ut(e.name)===`image`;return(0,H.jsxs)(`div`,{ref:g,...nn({...h,..._,...p},{role:`gridcell`,"aria-selected":t,"data-testid":`explorer-tile`,"data-path":e.path,title:e.name,style:a?{width:a}:void 0,onContextMenu:n=>{t||s.selectOnly(e.path),n.stopPropagation()},onClick:n=>{b(e,t)||s.onRowClick(e.path,n)},onDoubleClick:()=>o.openEntry(e),className:T(`relative flex flex-col items-center gap-1 rounded p-2 text-center select-none`,!a&&`w-full`,`can-hover:hover:bg-surface-elevated`,n&&!t&&`bg-surface-elevated`,t&&`bg-accent-wash`,r&&`opacity-40`,m&&`ring-1 ring-dashed ring-primary bg-primary/10`)}),children:[v&&y&&(0,H.jsx)(`span`,{"aria-hidden":!0,className:T(`absolute left-1.5 top-1.5 flex size-5 items-center justify-center rounded border`,t?`border-primary bg-primary text-primary-foreground`:`border-border bg-panel`),children:t&&(0,H.jsx)(pe,{className:`size-3.5`})}),(0,H.jsx)(`div`,{className:`flex h-12 w-12 shrink-0 items-center justify-center`,children:x?(0,H.jsx)(dn,{entry:e,size:48}):(0,H.jsx)(U,{name:e.name,kind:e.kind,className:`size-12`})}),i?(0,H.jsx)(Z,{initial:e.name,error:c,onCommit:e=>void o.commitInline(e),onCancel:o.cancelInline}):(0,H.jsx)(`span`,{className:T(`line-clamp-2 w-full break-words text-[12px] leading-tight`,t?`text-text`:`text-text-2`),children:e.name})]})}),xn=96,Sn=88,Cn=4,wn=16,Tn=3;function En({slice:e,entries:t,actions:n,selection:r,inlineError:i,hasClipboard:a,isPinned:o,backgroundLongPress:s}){let c=ye(e=>e.clipboard?.operation===`cut`?e.clipboard.paths:null),l=(0,V.useRef)(null);k(l);let u=E(),[d,f]=(0,V.useState)(u?Tn:1);(0,V.useEffect)(()=>{if(u){f(Tn);return}let e=l.current;if(!e)return;let t=()=>{let t=e.clientWidth-wn+Cn;f(Math.max(1,Math.floor(t/(xn+Cn))))};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[u]);let p=at({count:Math.ceil(t.length/d),getScrollElement:()=>l.current,estimateSize:()=>Sn,overscan:4}),m=e.anchor?t.findIndex(t=>t.path===e.anchor):-1,h=m>=0?Math.floor(m/d):-1;(0,V.useEffect)(()=>{h>=0&&p.scrollToIndex(h,{align:`auto`})},[h]);let g=(0,V.useMemo)(()=>X(e,t),[e,t]),_=e.inlineEdit?.kind===`new-file`||e.inlineEdit?.kind===`new-folder`,v=L({targetDir:e.path,run:n.transferInto,onFiles:n.uploadInto}),y=e=>{if(!(e.altKey||e.ctrlKey||e.metaKey))switch(e.key){case`ArrowDown`:e.preventDefault(),e.stopPropagation(),r.moveTo(d,e.shiftKey);return;case`ArrowUp`:e.preventDefault(),e.stopPropagation(),r.moveTo(-d,e.shiftKey);return;case`ArrowLeft`:e.preventDefault(),e.stopPropagation(),r.moveTo(-1,e.shiftKey);return;case`ArrowRight`:e.preventDefault(),e.stopPropagation(),r.moveTo(1,e.shiftKey);return}};return(0,H.jsxs)(j,{children:[(0,H.jsx)(P,{asChild:!0,children:(0,H.jsxs)(`div`,{ref:l,role:`grid`,tabIndex:0,"data-testid":`explorer-icons`,"aria-label":`File icons`,onKeyDown:y,onMouseDown:e=>{e.target===e.currentTarget&&r.clear()},className:T(`h-full flex-1 overflow-auto p-2 outline-none`,v.isOver&&`ring-1 ring-dashed ring-primary bg-primary/10`),...s,...v.handlers,children:[_&&(0,H.jsx)(`div`,{className:`mb-2 flex flex-col items-center gap-1 p-2`,style:u?void 0:{width:xn},children:(0,H.jsx)(Z,{initial:``,error:i,onCommit:e=>void n.commitInline(e),onCancel:n.cancelInline})}),(0,H.jsx)(`div`,{className:`relative w-full`,style:{height:p.getTotalSize()},children:p.getVirtualItems().map(s=>{let l=s.index*d,f=t.slice(l,l+d);return(0,H.jsx)(`div`,{role:`row`,className:T(`absolute left-0 top-0 w-full gap-1`,u?`grid grid-cols-3`:`flex`),style:{transform:`translateY(${s.start}px)`},children:f.map(t=>(0,H.jsx)(yn,{entry:t,currentDir:e.path,selected:e.selection.has(t.path),focused:e.anchor===t.path,cut:c?.includes(t.path)===!0,renaming:e.inlineEdit?.kind===`rename`&&e.inlineEdit.path===t.path,tileWidth:u?void 0:xn,menuTargets:e.selection.has(t.path)?g:[t],actions:n,selection:r,hasClipboard:a,isPinned:o,inlineError:i},t.path))},s.index)})}),t.length===0&&!e.loading&&!_&&(0,H.jsx)(`p`,{className:`p-3 text-xs text-text-subtle`,children:e.filter?`No entries match the filter.`:`This folder is empty.`})]})}),(0,H.jsx)(Y,{targets:[],currentDir:e.path,hasClipboard:a,isPinned:o,actions:n})]})}var Dn=(0,V.memo)(function(e){let{entry:t,currentDir:n,hasClipboard:r,isPinned:i,actions:a,menuTargets:o}=e,s=Qt({entry:t,dragPaths:(0,V.useMemo)(()=>o.map(e=>e.path),[o]),run:a.transferInto,onFiles:a.uploadInto});return(0,H.jsxs)(j,{children:[(0,H.jsx)(P,{asChild:!0,children:(0,H.jsx)(On,{...e,dnd:s.props,dropActive:s.isDropTarget})}),(0,H.jsx)(Y,{targets:o,currentDir:n,hasClipboard:r,isPinned:i,actions:a})]})}),On=(0,V.forwardRef)(function({entry:e,selected:t,focused:n,cut:r,renaming:i,height:a,actions:o,selection:s,inlineError:c,currentDir:l,hasClipboard:u,isPinned:d,menuTargets:f,dnd:p,dropActive:m,...h},g){let _=A(()=>{t||s.selectOnly(e.path)}),{isMobile:v,selectMode:y,handleTap:b}=vn(o,s);return(0,H.jsxs)(`div`,{ref:g,...nn({...h,..._,...p},{role:`row`,"aria-selected":t,"data-testid":`explorer-row`,"data-path":e.path,title:e.name,style:{height:a},onContextMenu:n=>{t||s.selectOnly(e.path),n.stopPropagation()},onClick:n=>{b(e,t)||s.onRowClick(e.path,n)},onDoubleClick:()=>o.openEntry(e),className:T(`flex w-full items-center gap-2 px-2 text-[13px] select-none`,`can-hover:hover:bg-surface-elevated`,n&&!t&&`bg-surface-elevated`,t&&`bg-accent-wash`,r&&`opacity-40`,m&&`ring-1 ring-dashed ring-primary bg-primary/10`)}),children:[v&&y&&(0,H.jsx)(`span`,{"aria-hidden":!0,className:T(`flex size-5 shrink-0 items-center justify-center rounded border`,t?`border-primary bg-primary text-primary-foreground`:`border-border`),children:t&&(0,H.jsx)(pe,{className:`size-3.5`})}),(0,H.jsx)(U,{name:e.name,kind:e.kind,className:`size-4`}),i?(0,H.jsx)(Z,{initial:e.name,error:c,onCommit:e=>void o.commitInline(e),onCancel:o.cancelInline}):(0,H.jsx)(`span`,{className:T(`flex-1 truncate`,t?`text-text`:`text-text-2`),children:e.name}),(0,H.jsx)(`span`,{className:`w-20 shrink-0 text-right tabular-nums text-text-subtle`,children:e.type===`directory`?``:Oe(e.size)}),(0,H.jsx)(`span`,{className:`hidden w-24 shrink-0 text-right text-text-subtle sm:inline`,children:Ee(e.modified)}),(0,H.jsx)(`span`,{className:`hidden w-16 shrink-0 truncate text-right text-text-subtle md:inline`,children:e.type===`directory`?`Folder`:z(e.name)||`File`})]})}),kn={name:`flex-1 text-left`,size:`w-20 text-right`,modified:`hidden w-24 text-right sm:block`,kind:`hidden w-16 text-right md:block`},An=q.map(e=>({...e,className:kn[e.key]}));function jn({slice:e,entries:t,actions:n,selection:r,inlineError:i,hasClipboard:a,isPinned:o,rowHeight:s,backgroundLongPress:c}){let l=M(e=>e.sort),u=M(e=>e.setPrefs),p=ye(e=>e.clipboard?.operation===`cut`?e.clipboard.paths:null),m=(0,V.useRef)(null);k(m);let h=Ne(),g=Re(),_=at({count:t.length,getScrollElement:()=>m.current,estimateSize:()=>s,overscan:12}),v=e.anchor?t.findIndex(t=>t.path===e.anchor):-1;(0,V.useEffect)(()=>{v>=0&&_.scrollToIndex(v,{align:`auto`})},[v]);let y=(0,V.useMemo)(()=>X(e,t),[e,t]),b=e.inlineEdit?.kind===`new-file`||e.inlineEdit?.kind===`new-folder`,x=L({targetDir:e.path,run:n.transferInto,onFiles:n.uploadInto}),S=e=>u({sort:{key:e,dir:l.key===e&&l.dir===`asc`?`desc`:`asc`}});return(0,H.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,H.jsx)(`div`,{role:`row`,className:T(`flex shrink-0 items-center gap-2 border-b border-border bg-[var(--x-toolbar-bg,var(--panel-2))] px-2 py-1 text-[11px] font-medium text-text-subtle`,h.id===`windows`&&`divide-x divide-border`),children:An.map(e=>(0,H.jsxs)(`button`,{type:`button`,"aria-label":`Sort by ${e.label}`,onClick:()=>S(e.key),className:T(`relative flex items-center gap-0.5 can-hover:hover:text-text`,h.id===`windows`&&e.key!==`name`&&`pl-2`,e.className,e.key!==`name`&&`justify-end`,g&&`before:absolute before:-inset-x-2 before:-inset-y-3 before:content-['']`),children:[e.label,l.key===e.key&&(l.dir===`asc`?(0,H.jsx)(d,{className:`size-3`}):(0,H.jsx)(f,{className:`size-3`}))]},e.key))}),(0,H.jsxs)(j,{children:[(0,H.jsx)(P,{asChild:!0,children:(0,H.jsxs)(`div`,{ref:m,role:`grid`,tabIndex:0,"data-testid":`explorer-list`,"aria-label":`File list`,onMouseDown:e=>{e.target===e.currentTarget&&r.clear()},className:T(`flex-1 overflow-auto outline-none`,x.isOver&&`ring-1 ring-dashed ring-primary bg-primary/10`),...c,...x.handlers,children:[b&&(0,H.jsxs)(`div`,{className:`flex items-center gap-2 px-2`,style:{height:s},children:[(0,H.jsx)(`span`,{className:`size-4 shrink-0`}),(0,H.jsx)(Z,{initial:``,error:i,onCommit:e=>void n.commitInline(e),onCancel:n.cancelInline})]}),(0,H.jsx)(`div`,{className:`relative w-full`,style:{height:_.getTotalSize()},children:_.getVirtualItems().map(c=>{let l=t[c.index];return(0,H.jsx)(`div`,{className:T(`absolute left-0 top-0 w-full`,h.id===`macos`&&c.index%2==1&&`bg-panel-2/40`),style:{transform:`translateY(${c.start}px)`},children:(0,H.jsx)(Dn,{entry:l,currentDir:e.path,selected:e.selection.has(l.path),focused:e.anchor===l.path,cut:p?.includes(l.path)===!0,renaming:e.inlineEdit?.kind===`rename`&&e.inlineEdit.path===l.path,height:s,menuTargets:e.selection.has(l.path)?y:[l],actions:n,selection:r,hasClipboard:a,isPinned:o,inlineError:i})},l.path)})}),t.length===0&&!e.loading&&!b&&(0,H.jsx)(`p`,{className:`p-3 text-xs text-text-subtle`,children:e.filter?`No entries match the filter.`:`This folder is empty.`})]})}),(0,H.jsx)(Y,{targets:[],currentDir:e.path,hasClipboard:a,isPinned:o,actions:n})]})]})}var Mn={list:jn,icons:En,columns:gn},Nn=Object.keys(Mn);function Pn(e){return Mn[e]??jn}var Fn={list:g,icons:y,columns:le},In={list:`List view`,icons:`Icons view`,columns:`Column view`};function Ln({windowId:e,slice:t,nav:n,actions:r}){let i=M(e=>e.patch),o=M(e=>e.showHidden),c=M(e=>e.viewMode),u=M(e=>e.setPrefs),[d,f]=(0,V.useState)(!1),[p,m]=(0,V.useState)(t.path);(0,V.useEffect)(()=>m(t.path),[t.path]);let h=Re();return(0,H.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1 border-b border-border bg-[var(--x-toolbar-bg,var(--panel-2))] px-1.5 py-1`,children:[(0,H.jsx)(`button`,{type:`button`,"aria-label":`Back`,title:`Back`,disabled:!n.canGoBack,onClick:n.back,className:J(h),children:(0,H.jsx)(te,{className:`size-4`})}),(0,H.jsx)(`button`,{type:`button`,"aria-label":`Forward`,title:`Forward`,disabled:!n.canGoForward,onClick:n.forward,className:J(h),children:(0,H.jsx)(ue,{className:`size-4`})}),(0,H.jsx)(`button`,{type:`button`,"aria-label":`Up one level`,title:`Up`,disabled:!t.parent,onClick:n.up,className:J(h),children:(0,H.jsx)(v,{className:`size-4`})}),(0,H.jsx)(`button`,{type:`button`,"aria-label":`Refresh`,title:`Refresh`,onClick:n.refresh,className:J(h),children:(0,H.jsx)(x,{className:T(`size-4`,t.loading&&`animate-spin`)})}),(0,H.jsxs)(`div`,{className:`flex min-w-[8rem] flex-1 items-center gap-1 rounded border border-border bg-panel px-1`,children:[d?(0,H.jsx)(`input`,{autoFocus:!0,"aria-label":`Path`,value:p,onChange:e=>m(e.target.value),onBlur:()=>f(!1),onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`?(n.go(p.trim()),f(!1)):e.key===`Escape`&&(m(t.path),f(!1))},className:`min-w-0 flex-1 bg-transparent py-1 font-mono text-xs text-text outline-none`}):(0,H.jsx)(Kt,{crumbs:t.breadcrumbs,onNavigate:n.go,sep:t.sep,className:`flex-1 overflow-hidden py-0.5`}),(0,H.jsx)(`button`,{type:`button`,"aria-label":d?`Show breadcrumb`:`Edit path`,title:d?`Show breadcrumb`:`Edit path`,onClick:()=>f(e=>!e),className:J(h),children:(0,H.jsx)(a,{className:`size-3.5`})})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1 rounded border border-border bg-panel px-1`,children:[(0,H.jsx)(de,{className:`size-3.5 shrink-0 text-text-subtle`}),(0,H.jsx)(`input`,{"aria-label":`Filter entries`,placeholder:`Filter`,value:t.filter,onChange:t=>i(e,{filter:t.target.value}),onKeyDown:t=>{t.stopPropagation(),t.key===`Escape`&&i(e,{filter:``})},className:`w-24 min-w-0 bg-transparent py-1 text-xs text-text outline-none placeholder:text-text-subtle`}),t.filter&&(0,H.jsx)(`button`,{type:`button`,"aria-label":`Clear filter`,onClick:()=>i(e,{filter:``}),className:J(h),children:(0,H.jsx)(s,{className:`size-3.5`})})]}),Nn.length>1&&Nn.map(e=>{let t=Fn[e];return(0,H.jsx)(`button`,{type:`button`,"aria-label":In[e],title:In[e],"aria-pressed":c===e,onClick:()=>u({viewMode:e}),className:T(J(h),c===e&&`bg-accent-wash text-primary`),children:(0,H.jsx)(t,{className:`size-4`})},e)}),(0,H.jsx)(Zt,{coarse:h}),r.supportsFolderUpload?(0,H.jsxs)(rt,{children:[(0,H.jsx)(tt,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,"aria-label":`Upload`,title:`Upload`,className:J(h),children:(0,H.jsx)(l,{className:`size-4`})})}),(0,H.jsxs)(Qe,{align:`end`,children:[(0,H.jsx)(nt,{onClick:()=>r.openUploadPicker(),children:`Upload Files…`}),(0,H.jsx)(nt,{onClick:()=>r.openUploadFolderPicker(),children:`Upload Folder…`})]})]}):(0,H.jsx)(`button`,{type:`button`,"aria-label":`Upload`,title:`Upload`,onClick:()=>r.openUploadPicker(),className:J(h),children:(0,H.jsx)(l,{className:`size-4`})}),(0,H.jsx)(`button`,{type:`button`,"aria-label":o?`Hide hidden files`:`Show hidden files`,title:o?`Hide hidden files`:`Show hidden files`,"aria-pressed":o,onClick:()=>u({showHidden:!o}),className:T(J(h),o&&`bg-accent-wash text-primary`),children:o?(0,H.jsx)(ne,{className:`size-4`}):(0,H.jsx)(fe,{className:`size-4`})})]})}var Rn={list:g,icons:y,columns:le},zn={list:`List`,icons:`Icons`,columns:`Columns`};function Bn(e){return{name:e.breadcrumbs[e.breadcrumbs.length-1]?.name??e.path,path:e.path,type:`directory`,kind:`directory`,modified:``}}function Vn({open:e,onClose:t,slice:n,actions:r,entries:i}){let a=M(e=>e.viewMode),o=M(e=>e.sort),s=M(e=>e.showHidden),l=M(e=>e.setPrefs),d=X(n,i);return(0,H.jsxs)(we,{open:e,onClose:t,className:`p-2`,children:[(0,H.jsx)(Ce,{children:`View`}),(0,H.jsx)(`div`,{className:`flex gap-1 px-2 pb-2`,children:Nn.map(e=>{let n=Rn[e];return(0,H.jsxs)(`button`,{type:`button`,"aria-pressed":a===e,onClick:()=>{l({viewMode:e}),t()},className:T(`flex flex-1 flex-col items-center gap-1 rounded-lg py-2 text-xs active:bg-surface-elevated`,a===e?`bg-accent-wash text-primary`:`text-text-2`),children:[(0,H.jsx)(n,{className:`size-4`}),zn[e]]},e)})}),(0,H.jsx)(xe,{}),(0,H.jsx)(Ce,{children:`Sort by`}),(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1 px-2 pb-2`,children:q.map(({key:e,label:n})=>(0,H.jsxs)(`button`,{type:`button`,"aria-pressed":o.key===e,onClick:()=>{l({sort:{key:e,dir:o.key===e&&o.dir===`asc`?`desc`:`asc`}}),t()},className:T(`inline-flex min-h-11 items-center justify-center rounded-full border px-3 py-1.5 text-xs active:bg-surface-elevated`,o.key===e?`border-primary bg-accent-wash text-text`:`border-border text-text-2`),children:[n,o.key===e?o.dir===`asc`?` ↑`:` ↓`:``]},e))}),(0,H.jsx)(xe,{}),(0,H.jsxs)(D,{onClick:()=>l({showHidden:!s}),children:[s?(0,H.jsx)(ne,{className:`size-4`}):(0,H.jsx)(fe,{className:`size-4`}),s?`Hide hidden files`:`Show hidden files`]}),(0,H.jsx)(xe,{}),(0,H.jsxs)(D,{variant:`destructive`,disabled:d.length===0,onClick:()=>r.confirmPermanentDelete(d),children:[(0,H.jsx)(u,{className:`size-4`}),`Delete permanently`,d.length>1?` (${d.length})`:``]}),(0,H.jsxs)(D,{onClick:()=>r.showProperties(Bn(n)),children:[(0,H.jsx)(c,{className:`size-4`}),`Properties of this folder`]})]})}function Q({icon:e,label:t,onClick:n,disabled:r,destructive:i}){return(0,H.jsxs)(`button`,{type:`button`,"aria-label":t,title:t,disabled:r,onClick:n,className:`flex min-w-[44px] flex-1 flex-col items-center gap-0.5 rounded-lg py-1.5 text-[10px] active:bg-surface-elevated disabled:opacity-30 ${i?`text-error`:`text-text-2`}`,children:[(0,H.jsx)(e,{className:`size-5`}),(0,H.jsx)(`span`,{className:`truncate`,children:t})]})}function Hn({slice:e,nav:t,actions:n,entries:i,hasClipboard:a}){let o=F(e=>e.selectMode),d=F(e=>e.setSelectMode),[f,p]=(0,V.useState)(!1),[m,g]=(0,V.useState)(!1),v=i.filter(t=>e.selection.has(t.path));return o?(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 border-t border-border px-1 py-1`,children:[(0,H.jsx)(Q,{icon:s,label:`Cancel`,onClick:()=>{d(!1)}}),(0,H.jsxs)(`span`,{className:`px-1 text-xs text-text-subtle`,children:[v.length,` selected`]}),(0,H.jsx)(`div`,{className:`flex-1`}),(0,H.jsx)(Q,{icon:_,label:`Cut`,disabled:v.length===0,onClick:()=>n.cut(v)}),(0,H.jsx)(Q,{icon:re,label:`Copy`,disabled:v.length===0,onClick:()=>n.copy(v)}),(0,H.jsx)(Q,{icon:u,label:`Trash`,disabled:v.length===0,destructive:!0,onClick:()=>n.trash(v)}),(0,H.jsx)(Q,{icon:ce,label:`Download`,disabled:!v.some(e=>e.type===`file`),onClick:()=>n.download(v)}),v.length===1&&(0,H.jsx)(Q,{icon:c,label:`Info`,onClick:()=>n.showProperties(v[0])})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 border-t border-border px-1 py-1`,children:[(0,H.jsx)(Q,{icon:te,label:`Back`,disabled:!t.canGoBack,onClick:t.back}),(0,H.jsx)(Q,{icon:h,label:`New`,onClick:()=>p(!0)}),(0,H.jsx)(Q,{icon:ae,label:`Paste`,disabled:!a,onClick:()=>n.paste()}),(0,H.jsx)(Q,{icon:pe,label:`Select`,onClick:()=>d(!0)}),(0,H.jsx)(Q,{icon:r,label:`More`,onClick:()=>g(!0)})]}),(0,H.jsxs)(we,{open:f,onClose:()=>p(!1),className:`p-2`,children:[(0,H.jsxs)(D,{onClick:()=>n.startCreate(`new-file`),children:[(0,H.jsx)(b,{className:`size-4`}),` New File`]}),(0,H.jsxs)(D,{onClick:()=>n.startCreate(`new-folder`),children:[(0,H.jsx)(ee,{className:`size-4`}),` New Folder`]}),(0,H.jsxs)(D,{onClick:()=>{p(!1),n.openUploadPicker()},children:[(0,H.jsx)(l,{className:`size-4`}),` Upload Files…`]})]}),(0,H.jsx)(Vn,{open:m,onClose:()=>g(!1),slice:e,actions:n,entries:i})]})}function Un(e){return e.breadcrumbs[e.breadcrumbs.length-1]?.name??e.path}function Wn({slice:e,onClose:t}){return(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-border px-3 py-2.5`,children:[(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[15px] font-semibold text-text`,children:Un(e)}),(0,H.jsx)(`button`,{type:`button`,"aria-label":`Close file explorer`,title:`Close`,onClick:t,className:`flex size-11 shrink-0 items-center justify-center rounded-full text-text-2 active:bg-surface-elevated`,children:(0,H.jsx)(s,{className:`size-5`})})]})}var Gn=`size-4 shrink-0 text-text-subtle`,Kn={fixed:i,removable:p,network:dt,unknown:i};function qn(){return(0,H.jsx)(U,{name:``,kind:`directory`,className:Gn})}function $({label:e,path:t,active:n,icon:r,onNavigate:i}){return(0,H.jsxs)(`button`,{type:`button`,title:t,onClick:()=>i(t),className:T(`flex min-h-[44px] w-full items-center gap-2.5 rounded-lg px-3 text-left text-sm active:bg-surface-elevated`,n?`bg-accent-wash text-text`:`text-text-2`),children:[r,(0,H.jsx)(`span`,{className:`truncate`,children:e})]})}function Jn({title:e,children:t}){return(0,H.jsxs)(`div`,{className:`pb-2`,children:[(0,H.jsx)(`p`,{className:`px-3 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-text-subtle`,children:e}),t]})}function Yn({open:e,onClose:t,host:n,currentPath:r,vocab:i,onNavigate:a}){let o=B(e=>e.pins),s=e=>e===r;return(0,H.jsx)(we,{open:e,onClose:t,zIndex:65,className:`p-1`,children:(0,H.jsxs)(`div`,{className:`max-h-[70vh] overflow-y-auto px-1 pb-2`,children:[o.length>0&&(0,H.jsx)(Jn,{title:`Pinned`,children:o.map(e=>(0,H.jsx)($,{label:e.name,path:e.path,icon:(0,H.jsx)(oe,{className:Gn}),active:s(e.path),onNavigate:a},e.path))}),n&&n.pinned.length>0&&(0,H.jsx)(Jn,{title:i.pinned,children:n.pinned.map(e=>(0,H.jsx)($,{label:e.name,path:e.path,icon:qn(),active:s(e.path),onNavigate:a},e.path))}),n&&(0,H.jsxs)(Jn,{title:i.known,children:[(0,H.jsx)($,{label:i.home,path:n.homedir,icon:qn(),active:s(n.homedir),onNavigate:a}),n.knownFolders.map(e=>(0,H.jsx)($,{label:e.name,path:e.path,icon:qn(),active:s(e.path),onNavigate:a},e.path))]}),n&&n.drives.length>0&&(0,H.jsx)(Jn,{title:i.drives,children:n.drives.map(e=>{let t=Kn[e.kind];return(0,H.jsx)($,{label:e.label?`${e.label} (${e.name})`:e.name,path:e.path,icon:(0,H.jsx)(t,{className:Gn}),active:s(e.path),onNavigate:a},e.path)})})]})})}function Xn({className:e}){return(0,H.jsx)(U,{name:``,kind:`directory`,className:e})}var Zn={fixed:i,removable:p,network:dt,unknown:i};function Qn({chip:e,active:t,onNavigate:n}){let r=e.icon;return(0,H.jsxs)(`button`,{type:`button`,onClick:()=>n(e.path),title:e.path,className:T(`flex h-11 shrink-0 items-center gap-1.5 rounded-full border px-3 text-[13px] active:bg-surface-elevated`,t?`border-primary bg-accent-wash text-text`:`border-border text-text-2`),children:[(0,H.jsx)(r,{className:`size-4 shrink-0 text-text-subtle`}),(0,H.jsx)(`span`,{className:`max-w-[9rem] truncate`,children:e.label})]})}function $n({host:e,currentPath:t,onNavigate:n,vocab:i}){let a=B(e=>e.pins),[o,s]=(0,V.useState)(!1);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 overflow-x-auto touch-pan-x border-b border-border px-2 py-1.5`,children:[[...a.map(e=>({key:`pin:${e.path}`,label:e.name,path:e.path,icon:oe})),...e?[{key:`home`,label:i.home,path:e.homedir,icon:Xn}]:[],...e?.pinned.map(e=>({key:`os:${e.path}`,label:e.name,path:e.path,icon:Xn}))??[],...e?.drives.map(e=>({key:`drive:${e.path}`,label:e.label?`${e.label} (${e.name})`:e.name,path:e.path,icon:Zn[e.kind]}))??[]].map(e=>(0,H.jsx)(Qn,{chip:e,active:e.path===t,onNavigate:n},e.key)),(0,H.jsx)(`button`,{type:`button`,"aria-label":`All places`,title:`All places`,onClick:()=>s(!0),className:`flex h-11 shrink-0 items-center gap-1 rounded-full border border-border px-3 text-[13px] text-text-2 active:bg-surface-elevated`,children:(0,H.jsx)(r,{className:`size-4`})})]}),(0,H.jsx)(Yn,{open:o,onClose:()=>s(!1),host:e,currentPath:t,vocab:i,onNavigate:e=>{s(!1),n(e)}})]})}function er(e,t,n){let r=(0,V.useRef)(null),i=M(e=>e.patch),a=(0,V.useRef)(t?.path??``);a.current=t?.path??``;let o=(0,V.useRef)(n);o.current=n;let s=(0,V.useCallback)(async t=>{r.current?.abort();let n=new AbortController;r.current=n,i(e,{loading:!0,error:null});try{let r=await O.browse(t,{showHidden:o.current,signal:n.signal});if(n.signal.aborted)return;i(e,{entries:r.entries,breadcrumbs:r.breadcrumbs,parent:r.parent,sep:r.sep,truncated:r.truncated===!0,loading:!1,error:null})}catch(t){if(n.signal.aborted||t instanceof DOMException&&t.name===`AbortError`)return;i(e,{loading:!1,entries:[],error:t instanceof Te?{message:t.message,code:t.code,hint:t.hint}:{message:t instanceof Error?t.message:`Failed to read directory`,code:`EUNKNOWN`}})}},[e,i]),c=t?.path;(0,V.useEffect)(()=>{if(c)return s(c),()=>r.current?.abort()},[c,n,s]),(0,V.useEffect)(()=>Ye(e=>{e===a.current&&s(e)}),[s]);let l=(0,V.useCallback)((t,n)=>{let r=M.getState().slices[e];if(!r||t===r.path)return;let a=n?.replace?[...r.history.slice(0,r.historyIndex),t]:[...r.history.slice(0,r.historyIndex+1),t];i(e,{path:t,history:a.slice(-100),historyIndex:Math.min(a.length,100)-1,selection:new Set,anchor:null,filter:``,inlineEdit:null}),_e.getState().setPayload(e,{path:t})},[e,i]),u=(0,V.useCallback)(t=>{let n=M.getState().slices[e];if(!n)return;let r=n.historyIndex+t,a=n.history[r];a!=null&&(i(e,{path:a,historyIndex:r,selection:new Set,anchor:null,filter:``,inlineEdit:null}),_e.getState().setPayload(e,{path:a}))},[e,i]),d=(0,V.useCallback)(()=>u(-1),[u]),f=(0,V.useCallback)(()=>u(1),[u]),p=(0,V.useCallback)(()=>{let t=M.getState().slices[e];t?.parent&&l(t.parent)},[e,l]),m=(0,V.useCallback)(()=>{a.current&&s(a.current)},[s]),h=(t?.historyIndex??0)>0,g=t?t.historyIndex<t.history.length-1:!1;return(0,V.useMemo)(()=>({go:l,back:d,forward:f,up:p,refresh:m,canGoBack:h,canGoForward:g}),[l,d,f,p,m,h,g])}function tr(e,t,n){let r=t==null?-1:e.indexOf(t),i=e.indexOf(n);if(i<0)return[];if(r<0)return[n];let[a,o]=r<=i?[r,i]:[i,r];return e.slice(a,o+1)}function nr(e,t,n){switch(n.type){case`clear`:return{selection:new Set,anchor:null};case`select-all`:return{selection:new Set(t),anchor:e.anchor??t[0]??null};case`set`:return{selection:new Set(n.paths),anchor:n.anchor===void 0?n.paths[n.paths.length-1]??null:n.anchor};case`click`:if(n.ctrl){let t=new Set(e.selection);return t.has(n.path)?t.delete(n.path):t.add(n.path),{selection:t,anchor:n.path}}if(n.shift){let r=tr(t,e.anchor,n.path);return{selection:new Set(r),anchor:e.anchor??n.path}}return{selection:new Set([n.path]),anchor:n.path}}}function rr(e,t,n){if(e.length===0)return null;let r=t==null?-1:e.indexOf(t);return r<0?n>0?e[0]:e[e.length-1]:e[Math.min(e.length-1,Math.max(0,r+n))]}function ir(e,t,n){if(!t)return-1;let r=t.toLowerCase(),i=n<0?0:n+1;for(let t=0;t<e.length;t++){let n=(i+t)%e.length;if(e[n].toLowerCase().startsWith(r))return n}return-1}function ar(e,t){let n=M(e=>e.patch),r=(0,V.useRef)(t);r.current=t;let i=(0,V.useRef)({text:``,at:0}),a=(0,V.useCallback)(t=>{let i=M.getState().slices[e];i&&n(e,nr(i,r.current,t))},[e,n]),o=(0,V.useCallback)((t,n)=>{let i=M.getState().slices[e];if(!i)return;let o=rr(r.current,i.anchor,t);o!=null&&a({type:`click`,path:o,shift:n})},[e,a]),s=(0,V.useCallback)(t=>{let n=M.getState().slices[e];if(!n)return null;let o=Date.now(),s=o-i.current.at>800?t:i.current.text+t;i.current={text:s,at:o};let c=r.current,l=ir(c.map(e=>e.split(/[/\\]/).pop()??e),s,s.length===1&&n.anchor?c.indexOf(n.anchor):-1);return l<0?null:(a({type:`click`,path:c[l]}),c[l])},[e,a]),c=(0,V.useCallback)((e,t)=>a({type:`click`,path:e,shift:t.shiftKey,ctrl:t.ctrlKey||t.metaKey}),[a]),l=(0,V.useCallback)(e=>a({type:`click`,path:e}),[a]),u=(0,V.useCallback)(()=>a({type:`select-all`}),[a]),d=(0,V.useCallback)(()=>a({type:`clear`}),[a]),f=(0,V.useCallback)((e,t)=>a({type:`set`,paths:e,anchor:t}),[a]);return(0,V.useMemo)(()=>({onRowClick:c,selectOnly:l,selectAll:u,clear:d,setSelection:f,moveTo:o,typeAhead:s}),[c,l,u,d,f,o,s])}var or=28,sr=36,cr=48;function lr({windowId:e,initialPath:t,variant:n=`window`}){let r=M(e=>e.ensure);(0,V.useEffect)(()=>r(e,t),[r,e,t]);let i=M(t=>t.slices[e]),a=M(e=>e.showHidden),o=M(e=>e.viewMode),s=M(e=>e.sort),{host:c}=He(),l=ye(e=>(e.clipboard?.paths.length??0)>0),u=B(e=>e.isPinned),d=Re(),f=Ne(),p=er(e,i,a),{actions:h,dialogs:g}=At(e,i,p,c?.platform),_=(0,V.useMemo)(()=>i?Ht(i.entries,i.filter,s):[],[i?.entries,i?.filter,s]),v=ar(e,(0,V.useMemo)(()=>_.map(e=>e.path),[_])),y=_n({slice:i,entries:_,actions:h,selection:v,nav:p}),b=A(),x=F(e=>e.close);if(!i)return null;let S=Pn(o),C=n===`sheet`,ee=C?cr:d?sr:or;return(0,H.jsxs)(`div`,{"data-skin":f.id,style:{fontFamily:`var(--x-font)`},className:`flex h-full min-h-0 w-full flex-col bg-panel text-text`,children:[C?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Wn,{slice:i,onClose:x}),(0,H.jsx)($n,{host:c,currentPath:i.path,onNavigate:p.go,vocab:f.vocab})]}):(0,H.jsx)(Ln,{windowId:e,slice:i,nav:p,actions:h}),i.error&&(0,H.jsxs)(`div`,{className:`flex items-start gap-2 border-b border-border bg-error/10 px-2 py-1.5 text-xs text-error`,children:[(0,H.jsx)(se,{className:`mt-0.5 size-3.5 shrink-0`}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`p`,{className:`break-words`,children:i.error.message}),i.error.hint&&(0,H.jsx)(`p`,{className:`mt-0.5 text-text-2`,children:i.error.hint})]}),c&&(0,H.jsxs)(`button`,{type:`button`,onClick:()=>p.go(c.homedir),className:`flex shrink-0 items-center gap-1 rounded border border-border px-1.5 py-0.5 text-text-2 can-hover:hover:bg-surface-elevated`,children:[(0,H.jsx)(m,{className:`size-3`}),` Go home`]})]}),(0,H.jsx)(It,{value:{closed:f.FolderIcon,open:f.FolderOpenIcon},children:(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[!C&&(0,H.jsx)(Bt,{host:c,currentPath:i.path,onNavigate:p.go,vocab:f.vocab}),(0,H.jsx)(`div`,{className:`min-w-0 flex-1`,onKeyDown:y,children:(0,H.jsx)(S,{windowId:e,slice:i,entries:_,actions:h,selection:v,inlineError:g.inlineError,hasClipboard:l,isPinned:u,rowHeight:ee,nav:p,backgroundLongPress:b})})]})}),C?(0,H.jsx)(Hn,{slice:i,nav:p,actions:h,entries:_,hasClipboard:l}):(0,H.jsx)(Wt,{entries:_,selection:i.selection,truncated:i.truncated}),(0,H.jsx)(Ie,{dialogs:g,platform:c?.platform,sep:i.sep})]})}export{lr as t};
@@ -1 +1 @@
1
- import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import"./icons-C9ZwXgel.js";import{t as r}from"./explorer-body-C5gXPGOl.js";import"./api-client-c8YOpTlT.js";import"./settings-store-DXmQug0m.js";import"./vendor-mermaid-eg2XWIjK.js";import"./portal-container-context-NFSuymMu.js";import"./panel-store-BUQ-CPsd.js";import"./window-store-B4cbZ5rr.js";import"./project-framework-store-XxFXcUpb.js";import"./tab-store-DqeaGhhE.js";import"./context-menu-CVO3HtIt.js";import"./file-store-CTlJqj2m.js";import"./use-is-mobile-CkO33jqU.js";import"./window-pip-registry-DH07f_8k.js";import"./button-CBehaXpV.js";import"./dialog-CaShS4f5.js";import"./file-icons-BlOxPo3P.js";import"./mobile-bottom-sheet-Cf4kV1hS.js";import"./use-visual-viewport-C307OVeV.js";import"./fs-api-RVc5RtTA.js";import"./format-file-meta-DLaHgkdx.js";import{Ht as i,Mt as a,Nt as o}from"./index-BVKT5UCu.js";var s=e(t(),1),c=n();function l({id:e,payload:t}){let{host:n,error:l}=o(),u=i(e=>e.discard);(0,s.useEffect)(()=>()=>u(e),[e,u]);let d=(typeof t?.path==`string`?t.path:``)||a()||n?.homedir||``;return d?(0,c.jsx)(r,{windowId:e,initialPath:d}):(0,c.jsx)(`div`,{className:`flex h-full items-center justify-center p-4 text-xs text-text-2`,children:l?`Could not reach the host: ${l}`:`Loading…`})}export{l as default};
1
+ import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import"./icons-CO_II6D-.js";import{t as r}from"./explorer-body-C0syNltJ.js";import"./api-client-c8YOpTlT.js";import"./settings-store-DXmQug0m.js";import"./vendor-mermaid-eg2XWIjK.js";import"./portal-container-context-NFSuymMu.js";import"./panel-store-BUQ-CPsd.js";import"./window-store-B4cbZ5rr.js";import"./project-framework-store-XxFXcUpb.js";import"./tab-store-DqeaGhhE.js";import"./context-menu-CjYTq8DI.js";import"./file-store-CTlJqj2m.js";import"./use-is-mobile-CkO33jqU.js";import"./window-pip-registry-DH07f_8k.js";import"./button-CBehaXpV.js";import"./dialog-tzBRkGeW.js";import"./file-icons-BlOxPo3P.js";import"./mobile-bottom-sheet-Cf4kV1hS.js";import"./use-visual-viewport-C307OVeV.js";import"./fs-api-RVc5RtTA.js";import"./format-file-meta-DLaHgkdx.js";import{Ht as i,Mt as a,Nt as o}from"./index-CvUGUp7d.js";var s=e(t(),1),c=n();function l({id:e,payload:t}){let{host:n,error:l}=o(),u=i(e=>e.discard);(0,s.useEffect)(()=>()=>u(e),[e,u]);let d=(typeof t?.path==`string`?t.path:``)||a()||n?.homedir||``;return d?(0,c.jsx)(r,{windowId:e,initialPath:d}):(0,c.jsx)(`div`,{className:`flex h-full items-center justify-center p-4 text-xs text-text-2`,children:l?`Could not reach the host: ${l}`:`Loading…`})}export{l as default};
@@ -1 +1 @@
1
- import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import{Mr as r,Qn as i,Zn as a,jt as o,tr as s,un as c}from"./icons-C9ZwXgel.js";import{t as l}from"./createLucideIcon-DBXq3G0e.js";import{n as u,s as d}from"./api-client-c8YOpTlT.js";import{t as f}from"./button-CBehaXpV.js";import{t as p}from"./input-CP31LZnN.js";import{bn as m}from"./index-BVKT5UCu.js";var h=l(`power-off`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),g=e(t(),1),_=n();function v(){let[e,t]=(0,g.useState)([]),[n,l]=(0,g.useState)(!0),[v,y]=(0,g.useState)(``),[b,x]=(0,g.useState)(!1),[S,C]=(0,g.useState)(``),[w,T]=(0,g.useState)(!1),[E,D]=(0,g.useState)(null),[O,k]=(0,g.useState)(null),A=(0,g.useCallback)(async()=>{try{t(await u.get(`/api/extensions`))}catch(e){console.error(`Failed to load extensions:`,e)}finally{l(!1)}},[]);(0,g.useEffect)(()=>{A()},[A]);let j=async()=>{let e=v.trim();if(e){x(!0);try{await u.post(`/api/extensions/install`,{name:e}),d.success(`Installed ${e}`),y(``),A()}catch(e){d.error(e.message||`Install failed`)}finally{x(!1)}}},M=async e=>{D(e.id);try{await u.patch(`/api/extensions/${e.id}`,{enabled:!e.enabled}),A()}catch(e){d.error(e.message||`Toggle failed`)}finally{D(null)}},N=async e=>{k(e);try{await u.del(`/api/extensions/${e}`),d.success(`Removed ${e}`),A()}catch(e){d.error(e.message||`Remove failed`)}finally{k(null)}};return n?(0,_.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,_.jsx)(c,{className:`size-4 animate-spin text-muted-foreground`})}):(0,_.jsxs)(`div`,{className:`space-y-4`,children:[(0,_.jsxs)(`section`,{className:`space-y-2`,children:[(0,_.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:`Install Extension`}),(0,_.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,_.jsx)(p,{value:v,onChange:e=>y(e.target.value),onKeyDown:e=>{e.key===`Enter`&&j()},placeholder:`npm package name (e.g. @ppm/ext-myext)`,className:`h-8 text-xs flex-1`}),(0,_.jsxs)(f,{variant:`outline`,size:`sm`,className:`h-8 text-xs px-3 gap-1 cursor-pointer`,disabled:!v.trim()||b,onClick:j,children:[b?(0,_.jsx)(c,{className:`size-3 animate-spin`}):(0,_.jsx)(a,{className:`size-3`}),`Install`]})]}),(0,_.jsx)(`button`,{onClick:()=>T(!w),className:`text-[11px] text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,children:w?`Hide`:`Dev link local extension...`}),w&&(0,_.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,_.jsx)(p,{value:S,onChange:e=>C(e.target.value),placeholder:`Local path (e.g. ./packages/ext-myext)`,className:`h-8 text-xs flex-1`}),(0,_.jsxs)(f,{variant:`outline`,size:`sm`,className:`h-8 text-xs px-3 gap-1 cursor-pointer`,disabled:!S.trim(),onClick:async()=>{try{await u.post(`/api/extensions/dev-link`,{path:S.trim()}),d.success(`Dev-linked successfully`),C(``),A()}catch(e){d.error(e.message||`Dev link failed`)}},children:[(0,_.jsx)(o,{className:`size-3`}),`Link`]})]})]}),(0,_.jsxs)(`section`,{className:`space-y-2`,children:[(0,_.jsxs)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:[`Installed (`,e.length,`)`]}),e.length===0?(0,_.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-4 text-center`,children:`No extensions installed`}):(0,_.jsx)(`div`,{className:`space-y-1`,children:e.map(e=>(0,_.jsxs)(`div`,{className:`flex items-center gap-2 px-2.5 py-2 rounded-lg bg-muted/50 hover:bg-muted transition-colors`,children:[(0,_.jsx)(`div`,{className:`size-8 rounded-md bg-background flex items-center justify-center shrink-0`,children:(0,_.jsx)(m(e.icon)??s,{className:`size-4 text-muted-foreground`})}),(0,_.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,_.jsx)(`p`,{className:`text-xs font-medium truncate`,children:e.displayName||e.id}),(0,_.jsxs)(`p`,{className:`text-[11px] text-muted-foreground truncate`,children:[e.id,` v`,e.version,e.activated&&(0,_.jsx)(`span`,{className:`ml-1 text-success`,children:`active`})]})]}),(0,_.jsx)(f,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0 cursor-pointer`,title:e.enabled?`Disable`:`Enable`,disabled:E===e.id,onClick:()=>M(e),children:E===e.id?(0,_.jsx)(c,{className:`size-3.5 animate-spin`}):e.enabled?(0,_.jsx)(i,{className:`size-3.5 text-success`}):(0,_.jsx)(h,{className:`size-3.5 text-muted-foreground`})}),(0,_.jsx)(f,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0 cursor-pointer text-destructive hover:text-destructive`,title:`Remove`,disabled:O===e.id,onClick:()=>N(e.id),children:O===e.id?(0,_.jsx)(c,{className:`size-3.5 animate-spin`}):(0,_.jsx)(r,{className:`size-3.5`})})]},e.id))})]})]})}export{v as ExtensionManagerSection};
1
+ import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import{Mr as r,Qn as i,Zn as a,jt as o,tr as s,un as c}from"./icons-CO_II6D-.js";import{t as l}from"./createLucideIcon-DBXq3G0e.js";import{n as u,s as d}from"./api-client-c8YOpTlT.js";import{t as f}from"./button-CBehaXpV.js";import{t as p}from"./input-CP31LZnN.js";import{bn as m}from"./index-CvUGUp7d.js";var h=l(`power-off`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),g=e(t(),1),_=n();function v(){let[e,t]=(0,g.useState)([]),[n,l]=(0,g.useState)(!0),[v,y]=(0,g.useState)(``),[b,x]=(0,g.useState)(!1),[S,C]=(0,g.useState)(``),[w,T]=(0,g.useState)(!1),[E,D]=(0,g.useState)(null),[O,k]=(0,g.useState)(null),A=(0,g.useCallback)(async()=>{try{t(await u.get(`/api/extensions`))}catch(e){console.error(`Failed to load extensions:`,e)}finally{l(!1)}},[]);(0,g.useEffect)(()=>{A()},[A]);let j=async()=>{let e=v.trim();if(e){x(!0);try{await u.post(`/api/extensions/install`,{name:e}),d.success(`Installed ${e}`),y(``),A()}catch(e){d.error(e.message||`Install failed`)}finally{x(!1)}}},M=async e=>{D(e.id);try{await u.patch(`/api/extensions/${e.id}`,{enabled:!e.enabled}),A()}catch(e){d.error(e.message||`Toggle failed`)}finally{D(null)}},N=async e=>{k(e);try{await u.del(`/api/extensions/${e}`),d.success(`Removed ${e}`),A()}catch(e){d.error(e.message||`Remove failed`)}finally{k(null)}};return n?(0,_.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,_.jsx)(c,{className:`size-4 animate-spin text-muted-foreground`})}):(0,_.jsxs)(`div`,{className:`space-y-4`,children:[(0,_.jsxs)(`section`,{className:`space-y-2`,children:[(0,_.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:`Install Extension`}),(0,_.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,_.jsx)(p,{value:v,onChange:e=>y(e.target.value),onKeyDown:e=>{e.key===`Enter`&&j()},placeholder:`npm package name (e.g. @ppm/ext-myext)`,className:`h-8 text-xs flex-1`}),(0,_.jsxs)(f,{variant:`outline`,size:`sm`,className:`h-8 text-xs px-3 gap-1 cursor-pointer`,disabled:!v.trim()||b,onClick:j,children:[b?(0,_.jsx)(c,{className:`size-3 animate-spin`}):(0,_.jsx)(a,{className:`size-3`}),`Install`]})]}),(0,_.jsx)(`button`,{onClick:()=>T(!w),className:`text-[11px] text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,children:w?`Hide`:`Dev link local extension...`}),w&&(0,_.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,_.jsx)(p,{value:S,onChange:e=>C(e.target.value),placeholder:`Local path (e.g. ./packages/ext-myext)`,className:`h-8 text-xs flex-1`}),(0,_.jsxs)(f,{variant:`outline`,size:`sm`,className:`h-8 text-xs px-3 gap-1 cursor-pointer`,disabled:!S.trim(),onClick:async()=>{try{await u.post(`/api/extensions/dev-link`,{path:S.trim()}),d.success(`Dev-linked successfully`),C(``),A()}catch(e){d.error(e.message||`Dev link failed`)}},children:[(0,_.jsx)(o,{className:`size-3`}),`Link`]})]})]}),(0,_.jsxs)(`section`,{className:`space-y-2`,children:[(0,_.jsxs)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:[`Installed (`,e.length,`)`]}),e.length===0?(0,_.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-4 text-center`,children:`No extensions installed`}):(0,_.jsx)(`div`,{className:`space-y-1`,children:e.map(e=>(0,_.jsxs)(`div`,{className:`flex items-center gap-2 px-2.5 py-2 rounded-lg bg-muted/50 hover:bg-muted transition-colors`,children:[(0,_.jsx)(`div`,{className:`size-8 rounded-md bg-background flex items-center justify-center shrink-0`,children:(0,_.jsx)(m(e.icon)??s,{className:`size-4 text-muted-foreground`})}),(0,_.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,_.jsx)(`p`,{className:`text-xs font-medium truncate`,children:e.displayName||e.id}),(0,_.jsxs)(`p`,{className:`text-[11px] text-muted-foreground truncate`,children:[e.id,` v`,e.version,e.activated&&(0,_.jsx)(`span`,{className:`ml-1 text-success`,children:`active`})]})]}),(0,_.jsx)(f,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0 cursor-pointer`,title:e.enabled?`Disable`:`Enable`,disabled:E===e.id,onClick:()=>M(e),children:E===e.id?(0,_.jsx)(c,{className:`size-3.5 animate-spin`}):e.enabled?(0,_.jsx)(i,{className:`size-3.5 text-success`}):(0,_.jsx)(h,{className:`size-3.5 text-muted-foreground`})}),(0,_.jsx)(f,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0 cursor-pointer text-destructive hover:text-destructive`,title:`Remove`,disabled:O===e.id,onClick:()=>N(e.id),children:O===e.id?(0,_.jsx)(c,{className:`size-3.5 animate-spin`}):(0,_.jsx)(r,{className:`size-3.5`})})]},e.id))})]})]})}export{v as ExtensionManagerSection};
@@ -1,4 +1,4 @@
1
- import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import{un as r}from"./icons-C9ZwXgel.js";import{r as i}from"./api-client-c8YOpTlT.js";import{r as a,t as o}from"./git-repo-store-DFTJ5ngK.js";import{t as s}from"./apply-theme-aVoqSG0I.js";import{On as c}from"./index-BVKT5UCu.js";var l=e(t(),1),u=[[`--bg`,`--bg-solid`],[`--surface`,`--panel`],[`--selected`,`--accent-wash`],[`--text`,`--text`],[`--subtext`,`--text-2`],[`--subtle`,`--text-3`],[`--border`,`--border-soft`],[`--border2`,`--border`],[`--blue`,`--accent`],[`--green`,`--success`],[`--yellow`,`--warning`],[`--red`,`--error`]];function d(e){let t=[];for(let[n,r]of u){let i=e(r).replace(/[<>]/g,``).trim();i&&t.push(`${n}: ${i};`)}return t.length?`:root[data-ppm-theme] { ${t.join(` `)} }`:``}function f(e){let t=getComputedStyle(e);return{mode:e.classList.contains(`dark`)?`dark`:`light`,css:d(e=>t.getPropertyValue(e))}}var p=`ppm:theme`,m=`<script>
1
+ import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import{un as r}from"./icons-CO_II6D-.js";import{r as i}from"./api-client-c8YOpTlT.js";import{r as a,t as o}from"./git-repo-store-DFTJ5ngK.js";import{t as s}from"./apply-theme-aVoqSG0I.js";import{On as c}from"./index-CvUGUp7d.js";var l=e(t(),1),u=[[`--bg`,`--bg-solid`],[`--surface`,`--panel`],[`--selected`,`--accent-wash`],[`--text`,`--text`],[`--subtext`,`--text-2`],[`--subtle`,`--text-3`],[`--border`,`--border-soft`],[`--border2`,`--border`],[`--blue`,`--accent`],[`--green`,`--success`],[`--yellow`,`--warning`],[`--red`,`--error`]];function d(e){let t=[];for(let[n,r]of u){let i=e(r).replace(/[<>]/g,``).trim();i&&t.push(`${n}: ${i};`)}return t.length?`:root[data-ppm-theme] { ${t.join(` `)} }`:``}function f(e){let t=getComputedStyle(e);return{mode:e.classList.contains(`dark`)?`dark`:`light`,css:d(e=>t.getPropertyValue(e))}}var p=`ppm:theme`,m=`<script>
2
2
  window.addEventListener("message",function(e){
3
3
  if(e.source!==window.parent)return;
4
4
  var m=e.data;
@@ -1 +1 @@
1
- import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import{Jr as r,Zn as i}from"./icons-C9ZwXgel.js";import{n as a}from"./api-client-c8YOpTlT.js";import{i as o}from"./project-store-C5gJXkvb.js";import"./project-framework-store-XxFXcUpb.js";import{o as s}from"./file-store-CTlJqj2m.js";import{t as c}from"./button-CBehaXpV.js";import{t as l}from"./input-CP31LZnN.js";import{dt as u,yt as d}from"./index-BVKT5UCu.js";import{t as f}from"./separator-D8SNZI6E.js";var p=e(t(),1);function m(){return a.get(`/api/settings/files`)}function h(e){return a.patch(`/api/settings/files`,e)}function g(e){return a.get(`/api/projects/${encodeURIComponent(e)}/settings`)}function _(e,t){return a.patch(`/api/projects/${encodeURIComponent(e)}/settings`,t)}var v=n();function y({value:e,onChange:t,placeholder:n=`e.g. **/*.log`,disabled:a=!1}){let o=(0,p.useRef)([]);function s(n,r){let i=[...e];i[n]=r,t(i)}function u(n){t(e.filter((e,t)=>t!==n)),setTimeout(()=>{let e=Math.max(n-1,0);o.current[e]?.focus()},0)}function d(){t([...e,``]),setTimeout(()=>{o.current[e.length]?.focus()},0)}function f(t,n){n.key===`Enter`?(n.preventDefault(),e[t]?.trim()&&d()):n.key===`Backspace`&&e[t]===``&&(n.preventDefault(),u(t))}return(0,v.jsxs)(`div`,{className:`space-y-1.5`,children:[e.length===0&&(0,v.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-1`,children:`No patterns. Click "Add pattern" to start.`}),e.map((e,t)=>(0,v.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,v.jsx)(l,{ref:e=>{o.current[t]=e},value:e,onChange:e=>s(t,e.target.value),onKeyDown:e=>f(t,e),placeholder:n,disabled:a,className:`h-8 text-xs flex-1 font-mono`,"aria-label":`Pattern ${t+1}`}),(0,v.jsx)(`button`,{type:`button`,onClick:()=>u(t),disabled:a,"aria-label":`Remove pattern ${t+1}`,className:`shrink-0 flex items-center justify-center p-2.5 rounded-md text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors disabled:opacity-40 disabled:pointer-events-none`,children:(0,v.jsx)(r,{className:`size-3.5`})})]},t)),(0,v.jsxs)(c,{type:`button`,variant:`outline`,size:`sm`,onClick:d,disabled:a,className:`h-8 text-xs gap-1.5 w-full cursor-pointer`,children:[(0,v.jsx)(i,{className:`size-3.5`}),`Add pattern`]})]})}var b={filesExclude:[],searchExclude:[],useIgnoreFiles:!0};function x(){let e=o(e=>e.activeProject),[t,n]=(0,p.useState)(`global`),[r,i]=(0,p.useState)([]),[a,l]=(0,p.useState)([]),[x,S]=(0,p.useState)(!0),[C,w]=(0,p.useState)(!1),[T,E]=(0,p.useState)(!1),[D,O]=(0,p.useState)(null),[k,A]=(0,p.useState)(!1),j=(0,p.useRef)(null);(0,p.useEffect)(()=>{j.current?.abort();let n=new AbortController;return j.current=n,A(!0),O(null),(async()=>{try{if(t===`global`){let e=await m();if(n.signal.aborted)return;i(e.filesExclude),l(e.searchExclude),S(e.useIgnoreFiles)}else{if(!e)return;let t=await g(e.name);if(n.signal.aborted)return;let r=t.files??{};i(r.filesExclude??b.filesExclude),l(r.searchExclude??b.searchExclude),S(r.useIgnoreFiles??b.useIgnoreFiles)}}catch(e){if(n.signal.aborted)return;O(e.message)}finally{n.signal.aborted||A(!1)}})(),()=>n.abort()},[t,e?.name]);let M=async()=>{w(!0),E(!1),O(null);try{let n={filesExclude:r.filter(e=>e.trim()!==``),searchExclude:a.filter(e=>e.trim()!==``),useIgnoreFiles:x};if(t===`global`)await h(n);else{if(!e)throw Error(`No active project`);await _(e.name,{files:n})}let i=s.getState();i.invalidateIndex(),e&&i.loadIndex(e.name),E(!0),setTimeout(()=>E(!1),2e3)}catch(e){O(e.message)}finally{w(!1)}},N=!!e;return(0,v.jsxs)(`div`,{className:`space-y-4`,children:[(0,v.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:`File Filters`}),(0,v.jsxs)(`div`,{className:`flex gap-1`,children:[(0,v.jsx)(`button`,{type:`button`,onClick:()=>n(`global`),className:`flex-1 py-1.5 rounded-md text-xs font-medium transition-colors cursor-pointer ${t===`global`?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground hover:bg-accent`}`,children:`Global`}),(0,v.jsx)(`button`,{type:`button`,onClick:()=>N&&n(`project`),disabled:!N,title:N?void 0:`Open a project to edit per-project overrides`,className:`flex-1 py-1.5 rounded-md text-xs font-medium transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed ${t===`project`?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground hover:bg-accent`}`,children:e?e.name:`Per-project`})]}),t===`project`&&e&&(0,v.jsxs)(`p`,{className:`text-[11px] text-muted-foreground -mt-2`,children:[`Overrides for `,(0,v.jsx)(`span`,{className:`font-medium`,children:e.name}),`. Leave empty to use global settings.`]}),k?(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading...`}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,v.jsx)(d,{className:`text-xs`,children:`Files to Exclude`}),(0,v.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Glob patterns hidden from the file tree and palette.`}),(0,v.jsx)(y,{value:r,onChange:i,placeholder:`e.g. **/*.log or node_modules/**`,disabled:C})]}),(0,v.jsx)(f,{}),(0,v.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,v.jsx)(d,{className:`text-xs`,children:`Search to Exclude`}),(0,v.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Glob patterns excluded from file index / palette search.`}),(0,v.jsx)(y,{value:a,onChange:l,placeholder:`e.g. dist/** or **/*.min.js`,disabled:C})]}),(0,v.jsx)(f,{}),(0,v.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,v.jsxs)(`div`,{children:[(0,v.jsx)(d,{className:`text-xs`,children:`Use .gitignore rules`}),(0,v.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Respect .gitignore when filtering the file tree and index.`})]}),(0,v.jsx)(u,{checked:x,onCheckedChange:S,disabled:C})]}),D&&(0,v.jsx)(`p`,{className:`text-[11px] text-destructive`,children:D}),(0,v.jsx)(c,{onClick:M,disabled:C||k,size:`sm`,className:`h-8 text-xs w-full cursor-pointer`,children:C?`Saving...`:T?`Saved`:`Save`})]})]})}export{x as FilesSettingsSection};
1
+ import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import{Jr as r,Zn as i}from"./icons-CO_II6D-.js";import{n as a}from"./api-client-c8YOpTlT.js";import{i as o}from"./project-store-C5gJXkvb.js";import"./project-framework-store-XxFXcUpb.js";import{o as s}from"./file-store-CTlJqj2m.js";import{t as c}from"./button-CBehaXpV.js";import{t as l}from"./input-CP31LZnN.js";import{dt as u,yt as d}from"./index-CvUGUp7d.js";import{t as f}from"./separator-D8SNZI6E.js";var p=e(t(),1);function m(){return a.get(`/api/settings/files`)}function h(e){return a.patch(`/api/settings/files`,e)}function g(e){return a.get(`/api/projects/${encodeURIComponent(e)}/settings`)}function _(e,t){return a.patch(`/api/projects/${encodeURIComponent(e)}/settings`,t)}var v=n();function y({value:e,onChange:t,placeholder:n=`e.g. **/*.log`,disabled:a=!1}){let o=(0,p.useRef)([]);function s(n,r){let i=[...e];i[n]=r,t(i)}function u(n){t(e.filter((e,t)=>t!==n)),setTimeout(()=>{let e=Math.max(n-1,0);o.current[e]?.focus()},0)}function d(){t([...e,``]),setTimeout(()=>{o.current[e.length]?.focus()},0)}function f(t,n){n.key===`Enter`?(n.preventDefault(),e[t]?.trim()&&d()):n.key===`Backspace`&&e[t]===``&&(n.preventDefault(),u(t))}return(0,v.jsxs)(`div`,{className:`space-y-1.5`,children:[e.length===0&&(0,v.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-1`,children:`No patterns. Click "Add pattern" to start.`}),e.map((e,t)=>(0,v.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,v.jsx)(l,{ref:e=>{o.current[t]=e},value:e,onChange:e=>s(t,e.target.value),onKeyDown:e=>f(t,e),placeholder:n,disabled:a,className:`h-8 text-xs flex-1 font-mono`,"aria-label":`Pattern ${t+1}`}),(0,v.jsx)(`button`,{type:`button`,onClick:()=>u(t),disabled:a,"aria-label":`Remove pattern ${t+1}`,className:`shrink-0 flex items-center justify-center p-2.5 rounded-md text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors disabled:opacity-40 disabled:pointer-events-none`,children:(0,v.jsx)(r,{className:`size-3.5`})})]},t)),(0,v.jsxs)(c,{type:`button`,variant:`outline`,size:`sm`,onClick:d,disabled:a,className:`h-8 text-xs gap-1.5 w-full cursor-pointer`,children:[(0,v.jsx)(i,{className:`size-3.5`}),`Add pattern`]})]})}var b={filesExclude:[],searchExclude:[],useIgnoreFiles:!0};function x(){let e=o(e=>e.activeProject),[t,n]=(0,p.useState)(`global`),[r,i]=(0,p.useState)([]),[a,l]=(0,p.useState)([]),[x,S]=(0,p.useState)(!0),[C,w]=(0,p.useState)(!1),[T,E]=(0,p.useState)(!1),[D,O]=(0,p.useState)(null),[k,A]=(0,p.useState)(!1),j=(0,p.useRef)(null);(0,p.useEffect)(()=>{j.current?.abort();let n=new AbortController;return j.current=n,A(!0),O(null),(async()=>{try{if(t===`global`){let e=await m();if(n.signal.aborted)return;i(e.filesExclude),l(e.searchExclude),S(e.useIgnoreFiles)}else{if(!e)return;let t=await g(e.name);if(n.signal.aborted)return;let r=t.files??{};i(r.filesExclude??b.filesExclude),l(r.searchExclude??b.searchExclude),S(r.useIgnoreFiles??b.useIgnoreFiles)}}catch(e){if(n.signal.aborted)return;O(e.message)}finally{n.signal.aborted||A(!1)}})(),()=>n.abort()},[t,e?.name]);let M=async()=>{w(!0),E(!1),O(null);try{let n={filesExclude:r.filter(e=>e.trim()!==``),searchExclude:a.filter(e=>e.trim()!==``),useIgnoreFiles:x};if(t===`global`)await h(n);else{if(!e)throw Error(`No active project`);await _(e.name,{files:n})}let i=s.getState();i.invalidateIndex(),e&&i.loadIndex(e.name),E(!0),setTimeout(()=>E(!1),2e3)}catch(e){O(e.message)}finally{w(!1)}},N=!!e;return(0,v.jsxs)(`div`,{className:`space-y-4`,children:[(0,v.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:`File Filters`}),(0,v.jsxs)(`div`,{className:`flex gap-1`,children:[(0,v.jsx)(`button`,{type:`button`,onClick:()=>n(`global`),className:`flex-1 py-1.5 rounded-md text-xs font-medium transition-colors cursor-pointer ${t===`global`?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground hover:bg-accent`}`,children:`Global`}),(0,v.jsx)(`button`,{type:`button`,onClick:()=>N&&n(`project`),disabled:!N,title:N?void 0:`Open a project to edit per-project overrides`,className:`flex-1 py-1.5 rounded-md text-xs font-medium transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed ${t===`project`?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground hover:bg-accent`}`,children:e?e.name:`Per-project`})]}),t===`project`&&e&&(0,v.jsxs)(`p`,{className:`text-[11px] text-muted-foreground -mt-2`,children:[`Overrides for `,(0,v.jsx)(`span`,{className:`font-medium`,children:e.name}),`. Leave empty to use global settings.`]}),k?(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading...`}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,v.jsx)(d,{className:`text-xs`,children:`Files to Exclude`}),(0,v.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Glob patterns hidden from the file tree and palette.`}),(0,v.jsx)(y,{value:r,onChange:i,placeholder:`e.g. **/*.log or node_modules/**`,disabled:C})]}),(0,v.jsx)(f,{}),(0,v.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,v.jsx)(d,{className:`text-xs`,children:`Search to Exclude`}),(0,v.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Glob patterns excluded from file index / palette search.`}),(0,v.jsx)(y,{value:a,onChange:l,placeholder:`e.g. dist/** or **/*.min.js`,disabled:C})]}),(0,v.jsx)(f,{}),(0,v.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,v.jsxs)(`div`,{children:[(0,v.jsx)(d,{className:`text-xs`,children:`Use .gitignore rules`}),(0,v.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Respect .gitignore when filtering the file tree and index.`})]}),(0,v.jsx)(u,{checked:x,onCheckedChange:S,disabled:C})]}),D&&(0,v.jsx)(`p`,{className:`text-[11px] text-destructive`,children:D}),(0,v.jsx)(c,{onClick:M,disabled:C||k,size:`sm`,className:`h-8 text-xs w-full cursor-pointer`,children:C?`Saving...`:T?`Saved`:`Save`})]})]})}export{x as FilesSettingsSection};
@@ -1 +1 @@
1
- import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import{Zt as r,lt as i,ut as a,w as o,wr as s}from"./icons-C9ZwXgel.js";import{a as c,n as l}from"./api-client-c8YOpTlT.js";import{t as u}from"./settings-store-DXmQug0m.js";import"./vendor-mermaid-eg2XWIjK.js";import"./portal-container-context-NFSuymMu.js";import"./project-store-C5gJXkvb.js";import"./project-framework-store-XxFXcUpb.js";import"./use-is-mobile-CkO33jqU.js";import"./onboarding-quick-orientation-u7yM68d3.js";import{t as d}from"./button-CBehaXpV.js";import"./dialog-CaShS4f5.js";import{t as f}from"./input-CP31LZnN.js";import{b as p,dt as m,nn as h,yt as g}from"./index-BVKT5UCu.js";import{t as _}from"./onboarding-entry-CwkNJ69U.js";import{t as v}from"./separator-D8SNZI6E.js";var y=e(t(),1),b=n();function x(){let[e,t]=(0,y.useState)(!1),[n,s]=(0,y.useState)(``),[u,p]=(0,y.useState)(``),[m,h]=(0,y.useState)(!1),[g,_]=(0,y.useState)(!1),[v,x]=(0,y.useState)(!1),[S,C]=(0,y.useState)(null),w=u.length>0&&n!==u,T=n.trim().length>=4&&n===u&&!g,E=(0,y.useCallback)(async()=>{if(T){_(!0),C(null);try{let{token:e}=await l.put(`/api/settings/auth/password`,{password:n.trim(),confirm:u.trim()});c(e),x(!0),s(``),p(``),setTimeout(()=>{x(!1),t(!1)},1500)}catch(e){C(e instanceof Error?e.message:`Failed to change password`)}finally{_(!1)}}},[T,n,u]);return e?(0,b.jsxs)(`section`,{className:`space-y-2`,children:[(0,b.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:`Change Password`}),(0,b.jsxs)(`div`,{className:`space-y-2`,children:[(0,b.jsxs)(`div`,{className:`relative`,children:[(0,b.jsx)(f,{type:m?`text`:`password`,placeholder:`New password`,value:n,onChange:e=>s(e.target.value),className:`h-8 text-xs pr-8`,autoFocus:!0}),(0,b.jsx)(`button`,{type:`button`,className:`absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground cursor-pointer`,onClick:()=>h(!m),tabIndex:-1,children:m?(0,b.jsx)(a,{className:`size-3.5`}):(0,b.jsx)(i,{className:`size-3.5`})})]}),(0,b.jsx)(f,{type:m?`text`:`password`,placeholder:`Confirm password`,value:u,onChange:e=>p(e.target.value),onKeyDown:e=>{e.key===`Enter`&&E()},className:`h-8 text-xs`}),w&&(0,b.jsx)(`p`,{className:`text-[11px] text-destructive`,children:`Passwords do not match`}),S&&(0,b.jsx)(`p`,{className:`text-[11px] text-destructive`,children:S}),(0,b.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,b.jsx)(d,{variant:`outline`,size:`sm`,className:`h-8 text-xs flex-1 cursor-pointer`,onClick:()=>{t(!1),s(``),p(``),C(null)},children:`Cancel`}),(0,b.jsx)(d,{variant:v?`default`:`outline`,size:`sm`,className:`h-8 text-xs flex-1 cursor-pointer`,disabled:!T,onClick:E,children:g?`...`:v?(0,b.jsx)(o,{className:`size-3.5`}):`Save`})]}),(0,b.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Min 4 characters. You'll stay logged in on this device.`})]})]}):(0,b.jsxs)(`section`,{className:`space-y-2`,children:[(0,b.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:`Security`}),(0,b.jsxs)(d,{variant:`outline`,size:`sm`,className:`h-8 text-xs gap-1.5 cursor-pointer`,onClick:()=>t(!0),children:[(0,b.jsx)(r,{className:`size-3.5`}),`Change Password`]})]})}function S(){let{deviceName:e,setDeviceName:t,version:n,keepScreenAwake:r,setKeepScreenAwake:i}=u(h(e=>({deviceName:e.deviceName,setDeviceName:e.setDeviceName,version:e.version,keepScreenAwake:e.keepScreenAwake,setKeepScreenAwake:e.setKeepScreenAwake}))),[a]=(0,y.useState)(p),[c,l]=(0,y.useState)(e??``),[S,C]=(0,y.useState)(!1),[w,T]=(0,y.useState)(!1),E=(0,y.useRef)(void 0),D=c.trim()!==(e??``),O=(0,y.useCallback)(async()=>{if(D){C(!0);try{await t(c),T(!0),clearTimeout(E.current),E.current=setTimeout(()=>T(!1),2e3)}finally{C(!1)}}},[c,D,t]);return(0,b.jsxs)(`div`,{className:`space-y-6`,children:[(0,b.jsxs)(`section`,{className:`space-y-2`,children:[(0,b.jsx)(`h3`,{className:`text-sm font-medium`,children:`Learn PPM`}),(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Choose your experience and a task. Guidance is saved in this browser.`}),(0,b.jsx)(_,{compact:!0})]}),(0,b.jsx)(v,{}),(0,b.jsxs)(`section`,{className:`space-y-2`,children:[(0,b.jsx)(g,{htmlFor:`device-name`,children:`Device Name`}),(0,b.jsxs)(`div`,{className:`flex gap-2`,children:[(0,b.jsx)(f,{id:`device-name`,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&O()},placeholder:`My Device`,className:`flex-1`,maxLength:100}),(0,b.jsx)(d,{variant:w?`default`:`outline`,className:`cursor-pointer shrink-0`,disabled:!D||S,onClick:O,children:S?`...`:w?(0,b.jsx)(o,{className:`size-4`}):`Save`})]}),(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Shown in page title and synced to PPM Cloud.`})]}),(0,b.jsx)(v,{}),(0,b.jsxs)(`section`,{className:`flex items-center justify-between gap-4`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,b.jsx)(s,{className:`size-4 text-muted-foreground shrink-0`}),(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium`,children:`Keep Screen Awake`}),(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:a===`insecure`?`Unavailable over plain HTTP — reach PPM through its HTTPS tunnel address to use this.`:a===`unsupported`?`This browser does not support screen wake locks.`:`Stop this device dimming while a chat turn is running.`})]})]}),(0,b.jsx)(m,{checked:r&&a===`ok`,disabled:a!==`ok`,onCheckedChange:i})]}),(0,b.jsx)(v,{}),(0,b.jsx)(x,{}),(0,b.jsx)(v,{}),(0,b.jsxs)(`section`,{className:`space-y-1`,children:[(0,b.jsx)(`h3`,{className:`text-sm font-medium`,children:`About`}),(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`PPM — Personal Project Manager`}),(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`A mobile-first web IDE for managing your projects.`}),n&&(0,b.jsxs)(`p`,{className:`text-xs text-muted-foreground tabular-nums`,children:[`Version `,n]})]})]})}export{S as GeneralSettingsSection};
1
+ import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import{Zt as r,lt as i,ut as a,w as o,wr as s}from"./icons-CO_II6D-.js";import{a as c,n as l}from"./api-client-c8YOpTlT.js";import{t as u}from"./settings-store-DXmQug0m.js";import"./vendor-mermaid-eg2XWIjK.js";import"./portal-container-context-NFSuymMu.js";import"./project-store-C5gJXkvb.js";import"./project-framework-store-XxFXcUpb.js";import"./use-is-mobile-CkO33jqU.js";import"./onboarding-quick-orientation-CT4PylG0.js";import{t as d}from"./button-CBehaXpV.js";import"./dialog-tzBRkGeW.js";import{t as f}from"./input-CP31LZnN.js";import{b as p,dt as m,nn as h,yt as g}from"./index-CvUGUp7d.js";import{t as _}from"./onboarding-entry-CcvySZ_l.js";import{t as v}from"./separator-D8SNZI6E.js";var y=e(t(),1),b=n();function x(){let[e,t]=(0,y.useState)(!1),[n,s]=(0,y.useState)(``),[u,p]=(0,y.useState)(``),[m,h]=(0,y.useState)(!1),[g,_]=(0,y.useState)(!1),[v,x]=(0,y.useState)(!1),[S,C]=(0,y.useState)(null),w=u.length>0&&n!==u,T=n.trim().length>=4&&n===u&&!g,E=(0,y.useCallback)(async()=>{if(T){_(!0),C(null);try{let{token:e}=await l.put(`/api/settings/auth/password`,{password:n.trim(),confirm:u.trim()});c(e),x(!0),s(``),p(``),setTimeout(()=>{x(!1),t(!1)},1500)}catch(e){C(e instanceof Error?e.message:`Failed to change password`)}finally{_(!1)}}},[T,n,u]);return e?(0,b.jsxs)(`section`,{className:`space-y-2`,children:[(0,b.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:`Change Password`}),(0,b.jsxs)(`div`,{className:`space-y-2`,children:[(0,b.jsxs)(`div`,{className:`relative`,children:[(0,b.jsx)(f,{type:m?`text`:`password`,placeholder:`New password`,value:n,onChange:e=>s(e.target.value),className:`h-8 text-xs pr-8`,autoFocus:!0}),(0,b.jsx)(`button`,{type:`button`,className:`absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground cursor-pointer`,onClick:()=>h(!m),tabIndex:-1,children:m?(0,b.jsx)(a,{className:`size-3.5`}):(0,b.jsx)(i,{className:`size-3.5`})})]}),(0,b.jsx)(f,{type:m?`text`:`password`,placeholder:`Confirm password`,value:u,onChange:e=>p(e.target.value),onKeyDown:e=>{e.key===`Enter`&&E()},className:`h-8 text-xs`}),w&&(0,b.jsx)(`p`,{className:`text-[11px] text-destructive`,children:`Passwords do not match`}),S&&(0,b.jsx)(`p`,{className:`text-[11px] text-destructive`,children:S}),(0,b.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,b.jsx)(d,{variant:`outline`,size:`sm`,className:`h-8 text-xs flex-1 cursor-pointer`,onClick:()=>{t(!1),s(``),p(``),C(null)},children:`Cancel`}),(0,b.jsx)(d,{variant:v?`default`:`outline`,size:`sm`,className:`h-8 text-xs flex-1 cursor-pointer`,disabled:!T,onClick:E,children:g?`...`:v?(0,b.jsx)(o,{className:`size-3.5`}):`Save`})]}),(0,b.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Min 4 characters. You'll stay logged in on this device.`})]})]}):(0,b.jsxs)(`section`,{className:`space-y-2`,children:[(0,b.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:`Security`}),(0,b.jsxs)(d,{variant:`outline`,size:`sm`,className:`h-8 text-xs gap-1.5 cursor-pointer`,onClick:()=>t(!0),children:[(0,b.jsx)(r,{className:`size-3.5`}),`Change Password`]})]})}function S(){let{deviceName:e,setDeviceName:t,version:n,keepScreenAwake:r,setKeepScreenAwake:i}=u(h(e=>({deviceName:e.deviceName,setDeviceName:e.setDeviceName,version:e.version,keepScreenAwake:e.keepScreenAwake,setKeepScreenAwake:e.setKeepScreenAwake}))),[a]=(0,y.useState)(p),[c,l]=(0,y.useState)(e??``),[S,C]=(0,y.useState)(!1),[w,T]=(0,y.useState)(!1),E=(0,y.useRef)(void 0),D=c.trim()!==(e??``),O=(0,y.useCallback)(async()=>{if(D){C(!0);try{await t(c),T(!0),clearTimeout(E.current),E.current=setTimeout(()=>T(!1),2e3)}finally{C(!1)}}},[c,D,t]);return(0,b.jsxs)(`div`,{className:`space-y-6`,children:[(0,b.jsxs)(`section`,{className:`space-y-2`,children:[(0,b.jsx)(`h3`,{className:`text-sm font-medium`,children:`Learn PPM`}),(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Choose your experience and a task. Guidance is saved in this browser.`}),(0,b.jsx)(_,{compact:!0})]}),(0,b.jsx)(v,{}),(0,b.jsxs)(`section`,{className:`space-y-2`,children:[(0,b.jsx)(g,{htmlFor:`device-name`,children:`Device Name`}),(0,b.jsxs)(`div`,{className:`flex gap-2`,children:[(0,b.jsx)(f,{id:`device-name`,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&O()},placeholder:`My Device`,className:`flex-1`,maxLength:100}),(0,b.jsx)(d,{variant:w?`default`:`outline`,className:`cursor-pointer shrink-0`,disabled:!D||S,onClick:O,children:S?`...`:w?(0,b.jsx)(o,{className:`size-4`}):`Save`})]}),(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Shown in page title and synced to PPM Cloud.`})]}),(0,b.jsx)(v,{}),(0,b.jsxs)(`section`,{className:`flex items-center justify-between gap-4`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,b.jsx)(s,{className:`size-4 text-muted-foreground shrink-0`}),(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium`,children:`Keep Screen Awake`}),(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:a===`insecure`?`Unavailable over plain HTTP — reach PPM through its HTTPS tunnel address to use this.`:a===`unsupported`?`This browser does not support screen wake locks.`:`Stop this device dimming while a chat turn is running.`})]})]}),(0,b.jsx)(m,{checked:r&&a===`ok`,disabled:a!==`ok`,onCheckedChange:i})]}),(0,b.jsx)(v,{}),(0,b.jsx)(x,{}),(0,b.jsx)(v,{}),(0,b.jsxs)(`section`,{className:`space-y-1`,children:[(0,b.jsx)(`h3`,{className:`text-sm font-medium`,children:`About`}),(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`PPM — Personal Project Manager`}),(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`A mobile-first web IDE for managing your projects.`}),n&&(0,b.jsxs)(`p`,{className:`text-xs text-muted-foreground tabular-nums`,children:[`Version `,n]})]})]})}export{S as GeneralSettingsSection};
@@ -1 +1 @@
1
- import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import{Dr as r,X as i,Y as a,a as o,d as s,ir as c,un as l}from"./icons-C9ZwXgel.js";import{n as u}from"./api-client-c8YOpTlT.js";import{n as d}from"./utils-btZ8C8-R.js";import{i as f}from"./project-store-C5gJXkvb.js";import"./project-framework-store-XxFXcUpb.js";import"./git-repo-store-DFTJ5ngK.js";import"./scroll-area-xAtds1T-.js";import{$n as p,Wt as m,nn as h}from"./index-BVKT5UCu.js";var g=e(t(),1),_=n(),v=[`#2563eb`,`#16a34a`,`#d97706`,`#9333ea`,`#dc2626`,`#0891b2`,`#c026d3`,`#ea580c`];function y(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return v[Math.abs(t)%v.length]}function b({name:e,syncState:t,isHead:n,isTag:c,className:l}){let u=c?`#d97706`:y(e),f=c?r:t===`synced`?a:t===`ahead`?s:t===`behind`?o:t===`remote-only`?a:i,p=c?`Tag: ${e}`:t===`synced`?`${e} — synced with remote`:t===`ahead`?`${e} — ahead of remote`:t===`behind`?`${e} — behind remote`:t===`remote-only`?`${e} — remote only`:`${e} — local only`;return(0,_.jsxs)(`span`,{className:d(`inline-flex items-center gap-1 rounded-md border px-1.5 py-0.5 text-[11px] font-medium leading-tight max-w-[220px]`,n&&`ring-1 ring-offset-1 ring-offset-background`,t===`remote-only`&&`opacity-70`,l),style:{borderColor:u,backgroundColor:u+`1A`,color:`var(--text)`,...n?{"--tw-ring-color":u}:{}},title:p,children:[(0,_.jsx)(f,{className:`size-3 shrink-0`,style:{color:u}}),(0,_.jsx)(`span`,{className:`truncate`,children:e})]})}function x(e,t,n,r){let i=[],a=e===r;for(let e of t)e.startsWith(`tag: `)&&i.push({name:e.slice(5),syncState:`synced`,isTag:!0});let o=n.filter(t=>t.commitHash===e),s=o.filter(e=>!e.remote),c=o.filter(e=>e.remote);new Set(s.map(e=>e.name));let l=new Set;for(let e of s){let t=`local-only`;e.remotes.length>0&&(t=e.ahead>0&&e.behind===0?`ahead`:e.behind>0&&e.ahead===0?`behind`:`synced`),i.push({name:e.name,syncState:t,isHead:a&&e.current});for(let t of c){let n=t.name.replace(/^remotes\//,``),r=n.indexOf(`/`);r<0||n.slice(r+1)===e.name&&l.add(t.name)}}for(let e of c){if(l.has(e.name))continue;let t=e.name.replace(/^remotes\//,``);i.push({name:t,syncState:`remote-only`})}return i}var S=100;function C({metadata:e}){let t=e?.projectName??f(h(e=>e.activeProject))?.name,{gitUrl:n}=m(t),[r,i]=(0,g.useState)(null),[a,o]=(0,g.useState)(!1),[s,d]=(0,g.useState)(!0),v=(0,g.useRef)(null),y=(0,g.useCallback)(async(e=0,r=!1)=>{if(t){o(!0);try{let t=await u.get(n(`/graph?max=${S}&skip=${e}`));i(e=>r&&e?{...t,commits:[...e.commits,...t.commits]}:t),d(t.commits.length===S)}catch{}o(!1)}},[t]);(0,g.useEffect)(()=>{y()},[y]);let b=(0,g.useCallback)(()=>{a||!s||!r||y(r.commits.length,!0)},[a,s,r,y]),x=(0,g.useCallback)(e=>{let t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<200&&b()},[b]);return t?(0,_.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 border-b border-border shrink-0`,children:[(0,_.jsx)(p,{className:`size-4 text-text-secondary`}),(0,_.jsx)(`span`,{className:`text-xs font-medium text-text-primary`,children:`Git Log`}),(0,_.jsx)(`span`,{className:`text-[10px] text-text-subtle`,children:r?`${r.commits.length} commits`:``}),(0,_.jsx)(`div`,{className:`flex-1`}),(0,_.jsx)(`button`,{onClick:()=>y(),disabled:a,className:`p-1 rounded text-text-subtle hover:text-text-secondary transition-colors`,title:`Refresh`,children:(0,_.jsx)(c,{className:`size-3.5 ${a?`animate-spin`:``}`})})]}),!r&&a?(0,_.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,_.jsx)(l,{className:`size-5 animate-spin text-primary`})}):r&&r.commits.length===0?(0,_.jsx)(`div`,{className:`flex items-center justify-center h-full text-text-secondary text-sm`,children:`No commits yet`}):r?(0,_.jsxs)(`div`,{ref:v,className:`flex-1 overflow-y-auto min-h-0`,onScroll:x,children:[r.commits.map(e=>(0,_.jsx)(w,{commit:e,branches:r.branches,head:r.head},e.hash)),a&&(0,_.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,_.jsx)(l,{className:`size-4 animate-spin text-text-subtle`})}),!s&&r.commits.length>0&&(0,_.jsx)(`div`,{className:`text-center text-[10px] text-text-subtle py-3`,children:`End of history`})]}):null]}):(0,_.jsx)(`div`,{className:`flex items-center justify-center h-full text-text-secondary text-sm`,children:`Select a project to view git log`})}function w({commit:e,branches:t,head:n}){let r=e.hash===n,i=x(e.hash,e.refs,t,n);return(0,_.jsxs)(`div`,{className:`flex items-start gap-2 px-3 py-1.5 border-b border-border/50 hover:bg-surface-elevated transition-colors ${r?`bg-primary/5`:``}`,children:[(0,_.jsx)(`div`,{className:`flex items-center pt-1 shrink-0`,children:(0,_.jsx)(`span`,{className:`size-2.5 rounded-full border-2 ${r?`border-primary bg-primary`:`border-text-subtle bg-transparent`}`})}),(0,_.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[i.length>0&&(0,_.jsx)(`div`,{className:`flex flex-wrap items-center gap-1 mb-0.5`,children:i.map(e=>(0,_.jsx)(b,{...e},`${e.name}-${e.syncState}`))}),(0,_.jsx)(`p`,{className:`text-xs text-text-primary truncate leading-snug`,children:e.subject}),(0,_.jsxs)(`div`,{className:`flex items-center gap-2 mt-0.5`,children:[(0,_.jsx)(`span`,{className:`text-[10px] font-mono text-text-subtle`,children:e.abbreviatedHash}),(0,_.jsx)(`span`,{className:`text-[10px] text-text-subtle truncate`,children:e.authorName}),(0,_.jsx)(`span`,{className:`text-[10px] text-text-subtle shrink-0`,children:T(e.authorDate)})]})]})]})}function T(e){let t=new Date(e),n=Date.now()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return`now`;if(r<60)return`${r}m`;let i=Math.floor(r/60);if(i<24)return`${i}h`;let a=Math.floor(i/24);return a<30?`${a}d`:t.toLocaleDateString(`en`,{month:`short`,day:`numeric`})}export{C as GitLogPanel};
1
+ import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import{Dr as r,X as i,Y as a,a as o,d as s,ir as c,un as l}from"./icons-CO_II6D-.js";import{n as u}from"./api-client-c8YOpTlT.js";import{n as d}from"./utils-btZ8C8-R.js";import{i as f}from"./project-store-C5gJXkvb.js";import"./project-framework-store-XxFXcUpb.js";import"./git-repo-store-DFTJ5ngK.js";import"./scroll-area-xAtds1T-.js";import{$n as p,Wt as m,nn as h}from"./index-CvUGUp7d.js";var g=e(t(),1),_=n(),v=[`#2563eb`,`#16a34a`,`#d97706`,`#9333ea`,`#dc2626`,`#0891b2`,`#c026d3`,`#ea580c`];function y(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return v[Math.abs(t)%v.length]}function b({name:e,syncState:t,isHead:n,isTag:c,className:l}){let u=c?`#d97706`:y(e),f=c?r:t===`synced`?a:t===`ahead`?s:t===`behind`?o:t===`remote-only`?a:i,p=c?`Tag: ${e}`:t===`synced`?`${e} — synced with remote`:t===`ahead`?`${e} — ahead of remote`:t===`behind`?`${e} — behind remote`:t===`remote-only`?`${e} — remote only`:`${e} — local only`;return(0,_.jsxs)(`span`,{className:d(`inline-flex items-center gap-1 rounded-md border px-1.5 py-0.5 text-[11px] font-medium leading-tight max-w-[220px]`,n&&`ring-1 ring-offset-1 ring-offset-background`,t===`remote-only`&&`opacity-70`,l),style:{borderColor:u,backgroundColor:u+`1A`,color:`var(--text)`,...n?{"--tw-ring-color":u}:{}},title:p,children:[(0,_.jsx)(f,{className:`size-3 shrink-0`,style:{color:u}}),(0,_.jsx)(`span`,{className:`truncate`,children:e})]})}function x(e,t,n,r){let i=[],a=e===r;for(let e of t)e.startsWith(`tag: `)&&i.push({name:e.slice(5),syncState:`synced`,isTag:!0});let o=n.filter(t=>t.commitHash===e),s=o.filter(e=>!e.remote),c=o.filter(e=>e.remote);new Set(s.map(e=>e.name));let l=new Set;for(let e of s){let t=`local-only`;e.remotes.length>0&&(t=e.ahead>0&&e.behind===0?`ahead`:e.behind>0&&e.ahead===0?`behind`:`synced`),i.push({name:e.name,syncState:t,isHead:a&&e.current});for(let t of c){let n=t.name.replace(/^remotes\//,``),r=n.indexOf(`/`);r<0||n.slice(r+1)===e.name&&l.add(t.name)}}for(let e of c){if(l.has(e.name))continue;let t=e.name.replace(/^remotes\//,``);i.push({name:t,syncState:`remote-only`})}return i}var S=100;function C({metadata:e}){let t=e?.projectName??f(h(e=>e.activeProject))?.name,{gitUrl:n}=m(t),[r,i]=(0,g.useState)(null),[a,o]=(0,g.useState)(!1),[s,d]=(0,g.useState)(!0),v=(0,g.useRef)(null),y=(0,g.useCallback)(async(e=0,r=!1)=>{if(t){o(!0);try{let t=await u.get(n(`/graph?max=${S}&skip=${e}`));i(e=>r&&e?{...t,commits:[...e.commits,...t.commits]}:t),d(t.commits.length===S)}catch{}o(!1)}},[t]);(0,g.useEffect)(()=>{y()},[y]);let b=(0,g.useCallback)(()=>{a||!s||!r||y(r.commits.length,!0)},[a,s,r,y]),x=(0,g.useCallback)(e=>{let t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<200&&b()},[b]);return t?(0,_.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 border-b border-border shrink-0`,children:[(0,_.jsx)(p,{className:`size-4 text-text-secondary`}),(0,_.jsx)(`span`,{className:`text-xs font-medium text-text-primary`,children:`Git Log`}),(0,_.jsx)(`span`,{className:`text-[10px] text-text-subtle`,children:r?`${r.commits.length} commits`:``}),(0,_.jsx)(`div`,{className:`flex-1`}),(0,_.jsx)(`button`,{onClick:()=>y(),disabled:a,className:`p-1 rounded text-text-subtle hover:text-text-secondary transition-colors`,title:`Refresh`,children:(0,_.jsx)(c,{className:`size-3.5 ${a?`animate-spin`:``}`})})]}),!r&&a?(0,_.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,_.jsx)(l,{className:`size-5 animate-spin text-primary`})}):r&&r.commits.length===0?(0,_.jsx)(`div`,{className:`flex items-center justify-center h-full text-text-secondary text-sm`,children:`No commits yet`}):r?(0,_.jsxs)(`div`,{ref:v,className:`flex-1 overflow-y-auto min-h-0`,onScroll:x,children:[r.commits.map(e=>(0,_.jsx)(w,{commit:e,branches:r.branches,head:r.head},e.hash)),a&&(0,_.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,_.jsx)(l,{className:`size-4 animate-spin text-text-subtle`})}),!s&&r.commits.length>0&&(0,_.jsx)(`div`,{className:`text-center text-[10px] text-text-subtle py-3`,children:`End of history`})]}):null]}):(0,_.jsx)(`div`,{className:`flex items-center justify-center h-full text-text-secondary text-sm`,children:`Select a project to view git log`})}function w({commit:e,branches:t,head:n}){let r=e.hash===n,i=x(e.hash,e.refs,t,n);return(0,_.jsxs)(`div`,{className:`flex items-start gap-2 px-3 py-1.5 border-b border-border/50 hover:bg-surface-elevated transition-colors ${r?`bg-primary/5`:``}`,children:[(0,_.jsx)(`div`,{className:`flex items-center pt-1 shrink-0`,children:(0,_.jsx)(`span`,{className:`size-2.5 rounded-full border-2 ${r?`border-primary bg-primary`:`border-text-subtle bg-transparent`}`})}),(0,_.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[i.length>0&&(0,_.jsx)(`div`,{className:`flex flex-wrap items-center gap-1 mb-0.5`,children:i.map(e=>(0,_.jsx)(b,{...e},`${e.name}-${e.syncState}`))}),(0,_.jsx)(`p`,{className:`text-xs text-text-primary truncate leading-snug`,children:e.subject}),(0,_.jsxs)(`div`,{className:`flex items-center gap-2 mt-0.5`,children:[(0,_.jsx)(`span`,{className:`text-[10px] font-mono text-text-subtle`,children:e.abbreviatedHash}),(0,_.jsx)(`span`,{className:`text-[10px] text-text-subtle truncate`,children:e.authorName}),(0,_.jsx)(`span`,{className:`text-[10px] text-text-subtle shrink-0`,children:T(e.authorDate)})]})]})]})}function T(e){let t=new Date(e),n=Date.now()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return`now`;if(r<60)return`${r}m`;let i=Math.floor(r/60);if(i<24)return`${i}h`;let a=Math.floor(i/24);return a<30?`${a}d`:t.toLocaleDateString(`en`,{month:`short`,day:`numeric`})}export{C as GitLogPanel};
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/data-grid-overlay-editor-2ERlh7_N.js","assets/rolldown-runtime-C5c2KzVm.js","assets/dist-wmDsBD_Z.js","assets/vendor-markdown-QKPNiWEd.js","assets/vendor-ui-BHh12_0v.js","assets/data-grid-types-DatI2Wee.js","assets/number-overlay-editor-xzM7GhYV.js"])))=>i.map(i=>d[i]);
2
- import{s as e,t}from"./rolldown-runtime-C5c2KzVm.js";import{C as n,S as r}from"./vendor-markdown-QKPNiWEd.js";import{pt as i}from"./vendor-ui-BHh12_0v.js";import{$ as a,A as o,Fr as s,Jn as c,Jr as l,Lt as u,Mr as d,Zn as f,a as p,br as m,ct as h,d as g,j as _,lt as v,qn as y,qr as b,sr as x,st as S,un as C,ur as w,xt as T}from"./icons-C9ZwXgel.js";import{M as E,q as D}from"./vendor-mermaid-eg2XWIjK.js";import{t as O}from"./tab-store-DqeaGhhE.js";import{S as k,Tn as A,nn as ee,xn as te}from"./index-BVKT5UCu.js";import{A as j,B as ne,C as M,D as re,E as N,F as ie,G as P,H as ae,I as F,L as oe,M as se,N as ce,O as I,P as L,R,S as le,T as ue,U as de,V as fe,W as pe,_ as me,a as he,b as ge,c as z,d as _e,f as ve,g as ye,h as B,i as be,j as V,k as H,l as U,m as xe,n as W,o as G,p as Se,r as Ce,s as we,t as K,u as Te,v as Ee,w as De,x as Oe,y as ke,z as Ae}from"./data-grid-types-DatI2Wee.js";import{t as je}from"./dist-wmDsBD_Z.js";import{t as Me}from"./use-monaco-theme-CNEk66US.js";import{n as Ne}from"./csv-parser-BXeH-yzY.js";var Pe=/[A-Za-z0-9_]/,Fe=/^\$([A-Za-z_][A-Za-z0-9_]*)?\$/;function Ie(e){let t=[],n=1,r=-1,i=1,a=0,o=(n,a)=>{if(r===-1)return;let o=e.slice(r,n).trim();o&&t.push({sql:o,startLine:i,endLine:a}),r=-1};for(;a<e.length;){let t=e[a];if(t===`
2
+ import{s as e,t}from"./rolldown-runtime-C5c2KzVm.js";import{C as n,S as r}from"./vendor-markdown-QKPNiWEd.js";import{pt as i}from"./vendor-ui-BHh12_0v.js";import{$ as a,A as o,Fr as s,Jn as c,Jr as l,Lt as u,Mr as d,Zn as f,a as p,br as m,ct as h,d as g,j as _,lt as v,qn as y,qr as b,sr as x,st as S,un as C,ur as w,xt as T}from"./icons-CO_II6D-.js";import{M as E,q as D}from"./vendor-mermaid-eg2XWIjK.js";import{t as O}from"./tab-store-DqeaGhhE.js";import{S as k,Tn as A,nn as ee,xn as te}from"./index-CvUGUp7d.js";import{A as j,B as ne,C as M,D as re,E as N,F as ie,G as P,H as ae,I as F,L as oe,M as se,N as ce,O as I,P as L,R,S as le,T as ue,U as de,V as fe,W as pe,_ as me,a as he,b as ge,c as z,d as _e,f as ve,g as ye,h as B,i as be,j as V,k as H,l as U,m as xe,n as W,o as G,p as Se,r as Ce,s as we,t as K,u as Te,v as Ee,w as De,x as Oe,y as ke,z as Ae}from"./data-grid-types-DatI2Wee.js";import{t as je}from"./dist-wmDsBD_Z.js";import{t as Me}from"./use-monaco-theme-BVatH9yZ.js";import{n as Ne}from"./csv-parser-BXeH-yzY.js";var Pe=/[A-Za-z0-9_]/,Fe=/^\$([A-Za-z_][A-Za-z0-9_]*)?\$/;function Ie(e){let t=[],n=1,r=-1,i=1,a=0,o=(n,a)=>{if(r===-1)return;let o=e.slice(r,n).trim();o&&t.push({sql:o,startLine:i,endLine:a}),r=-1};for(;a<e.length;){let t=e[a];if(t===`
3
3
  `){n++,a++;continue}if(t===` `||t===` `||t===`\r`){a++;continue}if(t===`-`&&e[a+1]===`-`){for(;a<e.length&&e[a]!==`
4
4
  `;)a++;continue}if(t===`/`&&e[a+1]===`*`){let t=1;for(a+=2;a<e.length&&t>0;){if(e[a]===`/`&&e[a+1]===`*`){t++,a+=2;continue}if(e[a]===`*`&&e[a+1]===`/`){t--,a+=2;continue}e[a]===`
5
5
  `&&n++,a++}continue}if(r===-1&&(r=a,i=n),t===`;`){o(a+1,n),a++;continue}if(t===`'`||t===`"`){let r=e[a-1],i=e[a-2],o=t===`'`&&(r===`e`||r===`E`)&&!(i!==void 0&&Pe.test(i));for(a++;a<e.length;){let r=e[a];if(r===`