@openchamber/web 2.3.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/AboutDialog-C1ulAXh5.js +1 -0
- package/dist/assets/ArchiveView-DJo1Bpw_.js +1 -0
- package/dist/assets/{CommandPalette-1VlA7PbL.js → CommandPalette-B6r6DPF9.js} +2 -2
- package/dist/assets/{DiffView-SHdJJ6tl.js → DiffView-mJuVm7Z4.js} +2 -2
- package/dist/assets/{FilePreviewCommentMenu-DlVgwRsr.js → FilePreviewCommentMenu-Ca4ziuof.js} +1 -1
- package/dist/assets/{FilesView-BeMtsSlV.js → FilesView-BBFbfDp9.js} +3 -3
- package/dist/assets/{GitView-npRGKKx8.js → GitView-WL1wkRFF.js} +3 -3
- package/dist/assets/GuestSurfacePane-peVDY5gW.js +1 -0
- package/dist/assets/HelpDialog-Dxc2yneu.js +1 -0
- package/dist/assets/{InProgressOperationBanner-B6iO22_7.js → InProgressOperationBanner-Dy0RiPsD.js} +1 -1
- package/dist/assets/JsonTreeView-BKUmh7Iw.js +1 -0
- package/dist/assets/MarkdownImageGallery-Cd6hLNmi.js +1 -0
- package/dist/assets/MarkdownRendererImpl-C-3B3mBt.js +1 -0
- package/dist/assets/MemoryDebugPanel-b116r1SF.js +1 -0
- package/dist/assets/OnboardingScreen-vBEhpU3q.js +1 -0
- package/dist/assets/OpenCodeStatusDialog-DH7dJ6MH.js +1 -0
- package/dist/assets/{PatchDiff-Du2s7T3U.js → PatchDiff-yM7vgQgi.js} +1 -1
- package/dist/assets/{PierreDiffViewer-B9K0gBvV.js → PierreDiffViewer-DnHKbYGl.js} +1 -1
- package/dist/assets/{PlanView-IkTcPrbw.js → PlanView-j0hLJmto.js} +2 -2
- package/dist/assets/RunOverview-ZuFZvDcu.js +2 -0
- package/dist/assets/ScheduledTasksDialog-UKXFFI91.js +5 -0
- package/dist/assets/{SettingsView-DIy5ZL4-.js → SettingsView-gB_NvyX4.js} +8 -8
- package/dist/assets/SettingsWindow-Dfb_RFpD.js +1 -0
- package/dist/assets/SourceBoardView-BjaL0nKs.js +1 -0
- package/dist/assets/SpaceAccessDialog-XzHRmIdT.js +1 -0
- package/dist/assets/SpaceApplyDialog-CxX9mrzT.js +1 -0
- package/dist/assets/{SpaceRow-YPmKQKeD.js → SpaceRow-vCpOCANO.js} +1 -1
- package/dist/assets/SpaceSetupOutput-CDZvJCf_.js +1 -0
- package/dist/assets/SpacesView-D3a9bCzn.js +1 -0
- package/dist/assets/{SubmoduleDiffSummary-RDY5md3p.js → SubmoduleDiffSummary-CQyRcvDZ.js} +1 -1
- package/dist/assets/{ToolOutputDialog-Dx85XZJs.js → ToolOutputDialog-judR_5mS.js} +2 -2
- package/dist/assets/{ToolPartDiffPreview-Dtv0xF9O.js → ToolPartDiffPreview-Ca9ISxfg.js} +1 -1
- package/dist/assets/UsageStatsView-C63Emjfj.js +1 -0
- package/dist/assets/{Virtualizer-DL535kyR.js → Virtualizer-DNgIEKcx.js} +1 -1
- package/dist/assets/{WalkthroughView-DcxbT5tc.js → WalkthroughView-D74b_7sC.js} +2 -2
- package/dist/assets/WorktreesView-hcm8Eb_C.js +1 -0
- package/dist/assets/appThemeRegistry-COeayQaQ.js +1 -0
- package/dist/assets/{ar-lP51qqz9.js → ar-1_zdYVV5.js} +2 -2
- package/dist/assets/computeVirtualFileMetrics-MZqvCQy0.js +3 -0
- package/dist/assets/{de-CpROAvTV.js → de-Ci7SGEQP.js} +3 -3
- package/dist/assets/{decorate-BNB7jeKg.js → decorate-CZeRRVC7.js} +1 -1
- package/dist/assets/{es-Bb8LKRhE.js → es-ZJii-6Tt.js} +2 -2
- package/dist/assets/{fr-BlNN9FC2.js → fr-C-hK8mvI.js} +2 -2
- package/dist/assets/{he-r546pCuc.js → he-t07CylP8.js} +2 -2
- package/dist/assets/index-D2tPUss-.js +1 -0
- package/dist/assets/{initializeSharedPreferences-dCHO04bl.js → initializeSharedPreferences-FxFkTjgn.js} +1 -1
- package/dist/assets/{isDiffPlainText-BwicHPpI.js → isDiffPlainText-C1F9opE5.js} +1 -1
- package/dist/assets/{isFilePlainText-Dk2R7BJo.js → isFilePlainText-B4SyJ-ni.js} +1 -1
- package/dist/assets/{ja-evNvJAHz.js → ja-iJr8aONy.js} +2 -2
- package/dist/assets/{katex-CMY-1eWf.css → katex-BEX7X_K8.css} +1 -1
- package/dist/assets/{katex.min-Iw9WSgM9.js → katex.min-C-51hS9A.js} +18 -18
- package/dist/assets/{ko-BPQP7lXe.js → ko-D5ow_yz-.js} +2 -2
- package/dist/assets/main-BtGnuno4.js +1048 -0
- package/dist/assets/main-uj5954n5.js +2 -0
- package/dist/assets/markdownCore-rBXCnAJp.js +9 -0
- package/dist/assets/miniChat-yWQmT2OS.js +2 -0
- package/dist/assets/mobile-NDAeGtzL.js +2 -0
- package/dist/assets/{moveWorkspacePath-B31RGdgu.js → moveWorkspacePath-BINgpJ9S.js} +1 -1
- package/dist/assets/{nl-CkQXd1nU.js → nl-CfqYrSVe.js} +2 -2
- package/dist/assets/{parseDiffFromFile-DcsKSY0J.js → parseDiffFromFile--DE4eHIp.js} +2 -2
- package/dist/assets/{patchFileDiff-Cx-HpjyI.js → patchFileDiff-BfFUmWgS.js} +1 -1
- package/dist/assets/pierreDiffTint-D9K6_CVD.js +29 -0
- package/dist/assets/{pl-C4i9Aizi.js → pl-Bn2_jAhL.js} +4 -4
- package/dist/assets/{pt-BR-CoYnG1CH.js → pt-BR-ZSDgn6cI.js} +2 -2
- package/dist/assets/relocateRestoredSession-C85Tk2y9.js +1 -0
- package/dist/assets/renderElectronMiniChatApp-BvAEmWhZ.js +2 -0
- package/dist/assets/{renderMobileApp-gDKxRJQi.js → renderMobileApp-T20l8ise.js} +7 -7
- package/dist/assets/{restartOpenCode-dq-SGun3.js → restartOpenCode-VEmIrLer.js} +1 -1
- package/dist/assets/runtimeEndpointReset-ExJsaWzA.js +55 -0
- package/dist/assets/scheduledTasksApi-NSyxVfHu.js +1 -0
- package/dist/assets/{selectionMarkdown-sDTBbKLh.js → selectionMarkdown-BJ2RhTXc.js} +2 -2
- package/dist/assets/{sessionOwnership-kZAtwMQd.js → sessionOwnership-BAX1xEJC.js} +1 -1
- package/dist/assets/{shikiHighlight-BRNXPlF-.js → shikiHighlight-DOzrE7BE.js} +1 -1
- package/dist/assets/{space-apply-CCOKLfrX.js → space-apply-DB_ZfJBW.js} +1 -1
- package/dist/assets/space-close-1kNlTkW1.js +1 -0
- package/dist/assets/{spaceNetwork-DUxJClu3.js → spaceNetwork-DA16ov_y.js} +1 -1
- package/dist/assets/{textMateThemeFromAppTheme-B6UJwdZz.js → textMateThemeFromAppTheme-BfIrjFAU.js} +1 -1
- package/dist/assets/{tr-D-_lz-lC.js → tr-C89uz1hs.js} +2 -2
- package/dist/assets/{uk-B49PGMYB.js → uk-uTYVPFrO.js} +2 -2
- package/dist/assets/{useAppFontEffects-3EN8Ava3.js → useAppFontEffects-C1ceAD51.js} +185 -185
- package/dist/assets/useCallableModelProviders-BkLsgs6y.js +1 -0
- package/dist/assets/{useInlineCommentController-l9cWyfuR.js → useInlineCommentController-ynkUsoVA.js} +1 -1
- package/dist/assets/{useRootScrollLock-UAQn24Y8.js → useRootScrollLock-DnoKH1HE.js} +2 -2
- package/dist/assets/{vendor-codemirror-autocomplete-C8FBSI9t.js → vendor-codemirror-autocomplete-BRKmCSiY.js} +1 -1
- package/dist/assets/{vendor-codemirror-commands-BhRb6jns.js → vendor-codemirror-commands-MmBpgSOc.js} +1 -1
- package/dist/assets/vendor-codemirror-lang-angular-Bj5Pk8sp.js +1 -0
- package/dist/assets/vendor-codemirror-lang-cpp-tZt-BOgi.js +1 -0
- package/dist/assets/vendor-codemirror-lang-css-DfdrZ848.js +1 -0
- package/dist/assets/{vendor-codemirror-lang-go-BHJEONih.js → vendor-codemirror-lang-go-C9OcoXdP.js} +2 -2
- package/dist/assets/vendor-codemirror-lang-html-C5kFuJzc.js +1 -0
- package/dist/assets/vendor-codemirror-lang-java-Divn2dnj.js +1 -0
- package/dist/assets/{vendor-codemirror-lang-javascript-CUmSxayT.js → vendor-codemirror-lang-javascript-DmPuKUEa.js} +2 -2
- package/dist/assets/vendor-codemirror-lang-jinja-B-8miA-Q.js +1 -0
- package/dist/assets/vendor-codemirror-lang-json-L0wsFFxi.js +1 -0
- package/dist/assets/vendor-codemirror-lang-less-CWlCIxCI.js +1 -0
- package/dist/assets/vendor-codemirror-lang-liquid-Dm8xthAW.js +1 -0
- package/dist/assets/vendor-codemirror-lang-markdown-CPn-qinN.js +1 -0
- package/dist/assets/vendor-codemirror-lang-php-DKIOifjN.js +1 -0
- package/dist/assets/vendor-codemirror-lang-python-BAVa3Hg5.js +3 -0
- package/dist/assets/vendor-codemirror-lang-rust-Dab90hdg.js +1 -0
- package/dist/assets/vendor-codemirror-lang-sass-eezaHFBZ.js +1 -0
- package/dist/assets/{vendor-codemirror-lang-sql-C1Jj9uuJ.js → vendor-codemirror-lang-sql-Vu-PR7cv.js} +2 -2
- package/dist/assets/vendor-codemirror-lang-vue-BthRGZHy.js +1 -0
- package/dist/assets/vendor-codemirror-lang-wast-Db6KSic0.js +1 -0
- package/dist/assets/vendor-codemirror-lang-xml-DQkh4sc1.js +1 -0
- package/dist/assets/vendor-codemirror-lang-yaml-Bt2N__AW.js +1 -0
- package/dist/assets/vendor-codemirror-language-DkBxRck3.js +3 -0
- package/dist/assets/vendor-codemirror-language-data-CTYHXywt.js +2 -0
- package/dist/assets/{vendor-codemirror-search-CvXM_pZg.js → vendor-codemirror-search-BKAwkhkm.js} +1 -1
- package/dist/assets/vendor-codemirror-streamparser-CmlTsbN2.js +1 -0
- package/dist/assets/vendor-codemirror-view-B66jUSmE.js +4 -0
- package/dist/assets/{vendor-replit-codemirror-vim-Ck2X_WZC.js → vendor-replit-codemirror-vim-D0bqFa1D.js} +5 -5
- package/dist/assets/{worker-DdhrXE7g.js → worker-BbEdJ2Oi.js} +18 -18
- package/dist/assets/workerFactory-Bw5qLmrM.js +1 -0
- package/dist/assets/{zh-CN-CS-9Os9n.js → zh-CN-DdTNG52a.js} +2 -2
- package/dist/assets/{zh-TW-D0XYVdcl.js → zh-TW-DPm_33Fi.js} +2 -2
- package/dist/index.html +3 -3
- package/dist/mini-chat.html +3 -3
- package/dist/mobile.html +3 -3
- package/package.json +2 -2
- package/server/index.js +4 -0
- package/server/lib/environment/store.js +3 -4
- package/server/lib/environment/store.test.js +17 -0
- package/server/lib/fs/DOCUMENTATION.md +4 -2
- package/server/lib/fs/routes.js +48 -13
- package/server/lib/fs/routes.test.js +118 -5
- package/server/lib/git/DOCUMENTATION.md +3 -1
- package/server/lib/git/contributor-remote.js +4 -0
- package/server/lib/git/contributor-remote.test.js +21 -0
- package/server/lib/git/service.js +20 -25
- package/server/lib/git/service.test.js +99 -0
- package/server/lib/git/worktree-creation.js +4 -5
- package/server/lib/github/DOCUMENTATION.md +1 -1
- package/server/lib/github/routes.auth.test.js +14 -0
- package/server/lib/github/routes.js +13 -5
- package/server/lib/github/routes.mutations.test.js +18 -2
- package/server/lib/message-queue/DOCUMENTATION.md +8 -2
- package/server/lib/message-queue/runtime.js +3 -2
- package/server/lib/message-queue/runtime.test.js +64 -2
- package/server/lib/openchamber-control/service.js +48 -13
- package/server/lib/openchamber-control/service.test.js +42 -0
- package/server/lib/opencode/DOCUMENTATION.md +3 -1
- package/server/lib/opencode/project-start-command.d.ts +11 -0
- package/server/lib/opencode/project-start-command.js +56 -0
- package/server/lib/opencode/project-start-command.test.js +80 -0
- package/server/lib/opencode/session-activity.js +43 -3
- package/server/lib/opencode/session-activity.test.js +97 -0
- package/server/lib/opencode/settings-runtime.js +19 -1
- package/server/lib/opencode/settings-runtime.test.js +23 -0
- package/server/lib/opencode/skill-routes.js +34 -1
- package/server/lib/opencode/skill-routes.test.js +99 -0
- package/server/lib/quota/DOCUMENTATION.md +13 -1
- package/server/lib/quota/providers/antigravity/api.js +104 -0
- package/server/lib/quota/providers/antigravity/auth.js +45 -0
- package/server/lib/quota/providers/antigravity/index.js +76 -0
- package/server/lib/quota/providers/antigravity/transforms.js +168 -0
- package/server/lib/quota/providers/antigravity/transforms.test.js +162 -0
- package/server/lib/quota/providers/codex.js +28 -4
- package/server/lib/quota/providers/codex.test.js +29 -0
- package/server/lib/quota/providers/google/auth.js +4 -49
- package/server/lib/quota/providers/google/transforms.js +3 -22
- package/server/lib/quota/providers/index.js +8 -0
- package/server/lib/quota/providers/opencode-go.js +3 -1
- package/server/lib/quota/providers/opencode-go.test.js +12 -0
- package/server/lib/routing/DOCUMENTATION.md +3 -1
- package/server/lib/routing/runtime.js +34 -1
- package/server/lib/routing/runtime.test.js +43 -1
- package/server/lib/scheduled-tasks/DOCUMENTATION.md +11 -0
- package/server/lib/scheduled-tasks/existing-session.js +52 -8
- package/server/lib/scheduled-tasks/existing-session.test.js +121 -0
- package/server/lib/scheduled-tasks/routes.js +26 -0
- package/server/lib/scheduled-tasks/runtime.js +1 -0
- package/server/lib/session-assist/runtime.js +3 -0
- package/server/lib/session-assist/runtime.test.js +47 -0
- package/server/lib/skills-catalog/DOCUMENTATION.md +10 -1
- package/server/lib/skills-catalog/install.js +1 -1
- package/server/lib/skills-catalog/installed-sources.d.ts +17 -0
- package/server/lib/skills-catalog/installed-sources.js +112 -0
- package/server/lib/skills-catalog/installed-sources.test.js +94 -0
- package/server/lib/small-model/DOCUMENTATION.md +12 -5
- package/server/lib/small-model/index.js +6 -4
- package/server/lib/small-model/index.test.js +40 -0
- package/server/lib/small-model/routes.js +3 -2
- package/server/lib/source-control/change-request-worktree.js +2 -6
- package/server/lib/source-control/mutation-storage.js +4 -1
- package/server/lib/source-control/mutation-storage.test.js +21 -0
- package/server/lib/spaces/DOCUMENTATION.md +1 -1
- package/server/lib/spaces/journey.js +10 -3
- package/server/lib/spaces/journey.test.js +13 -1
- package/server/lib/terminal/history.js +22 -2
- package/server/lib/terminal/history.test.js +23 -0
- package/server/lib/terminal/theme-response.js +14 -0
- package/server/lib/terminal/theme-response.test.js +10 -0
- package/dist/assets/AboutDialog-e8ek_kPI.js +0 -1
- package/dist/assets/ArchiveView-CjF4_TFg.js +0 -1
- package/dist/assets/GuestSurfacePane-4kmEXPLD.js +0 -1
- package/dist/assets/HelpDialog-CITMqPDK.js +0 -1
- package/dist/assets/JsonTreeView-xGikhCtL.js +0 -1
- package/dist/assets/MarkdownImageGallery-D0FJyr7C.js +0 -1
- package/dist/assets/MarkdownRendererImpl-BIM7Pjwk.js +0 -1
- package/dist/assets/MemoryDebugPanel-CBk8QW-M.js +0 -1
- package/dist/assets/OnboardingScreen-Cy6ARiMS.js +0 -1
- package/dist/assets/OpenCodeStatusDialog-YMHuJzwt.js +0 -1
- package/dist/assets/RunOverview-CHkGSW1x.js +0 -2
- package/dist/assets/ScheduledTasksDialog-77SO8zdJ.js +0 -4
- package/dist/assets/SettingsWindow-X74FIkdo.js +0 -1
- package/dist/assets/SourceBoardView-Cff2ejOW.js +0 -1
- package/dist/assets/SpaceAccessDialog-BXMZNRei.js +0 -1
- package/dist/assets/SpaceApplyDialog-BEJd2ryu.js +0 -1
- package/dist/assets/SpaceSetupOutput-Cb3XcIII.js +0 -1
- package/dist/assets/SpacesView-I3HaRKtW.js +0 -1
- package/dist/assets/UsageStatsView-DwTt9zIz.js +0 -1
- package/dist/assets/WorktreesView-Bh7GLvrR.js +0 -1
- package/dist/assets/appThemeRegistry-Bzb67M9O.js +0 -1
- package/dist/assets/computeVirtualFileMetrics-WAp98Bb7.js +0 -3
- package/dist/assets/index-BsupKM40.js +0 -1
- package/dist/assets/main-C_QGhDBL.js +0 -1048
- package/dist/assets/main-pWZ7F_hy.js +0 -2
- package/dist/assets/markdownCore-6gz4uJDQ.js +0 -9
- package/dist/assets/miniChat-DnaTfdYh.js +0 -2
- package/dist/assets/mobile-C7DIJqP8.js +0 -2
- package/dist/assets/pierreDiffTint-B297eqF0.js +0 -28
- package/dist/assets/relocateRestoredSession-D3lujODj.js +0 -1
- package/dist/assets/renderElectronMiniChatApp-BF4hNe69.js +0 -2
- package/dist/assets/runtimeEndpointReset-D6Lxhk0S.js +0 -55
- package/dist/assets/scheduledTasksApi-DUbAMrjW.js +0 -1
- package/dist/assets/space-close-CWcWwH4_.js +0 -1
- package/dist/assets/useCallableModelProviders-BB9xkUzM.js +0 -1
- package/dist/assets/vendor-codemirror-lang-angular-BpYCRJSk.js +0 -1
- package/dist/assets/vendor-codemirror-lang-cpp-BI3uPyjT.js +0 -1
- package/dist/assets/vendor-codemirror-lang-css-B2_PZTBl.js +0 -1
- package/dist/assets/vendor-codemirror-lang-html-BpvvTxbZ.js +0 -1
- package/dist/assets/vendor-codemirror-lang-java-BM5LQZ4u.js +0 -1
- package/dist/assets/vendor-codemirror-lang-jinja-D8nLZQPK.js +0 -1
- package/dist/assets/vendor-codemirror-lang-json-VDxF27mO.js +0 -1
- package/dist/assets/vendor-codemirror-lang-less-BecU2BJP.js +0 -1
- package/dist/assets/vendor-codemirror-lang-liquid-DCw83Anh.js +0 -1
- package/dist/assets/vendor-codemirror-lang-markdown-CimQAQbQ.js +0 -1
- package/dist/assets/vendor-codemirror-lang-php-C5Kpnpyb.js +0 -1
- package/dist/assets/vendor-codemirror-lang-python-BFE1OJNx.js +0 -3
- package/dist/assets/vendor-codemirror-lang-rust-hqZDyGIJ.js +0 -1
- package/dist/assets/vendor-codemirror-lang-sass-CAZML-Jl.js +0 -1
- package/dist/assets/vendor-codemirror-lang-vue-BHOTXcKp.js +0 -1
- package/dist/assets/vendor-codemirror-lang-wast-DcCHfPUI.js +0 -1
- package/dist/assets/vendor-codemirror-lang-xml-BO_V-1wZ.js +0 -1
- package/dist/assets/vendor-codemirror-lang-yaml-CPimap_N.js +0 -1
- package/dist/assets/vendor-codemirror-language-BBADuAkg.js +0 -3
- package/dist/assets/vendor-codemirror-language-data-Cu5ZbrPm.js +0 -2
- package/dist/assets/vendor-codemirror-view-1e0FQ6Wn.js +0 -4
- package/dist/assets/workerFactory-De9YXIdE.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{f as De,R as A,j as t}from"./vendor-react-BUCujlKS.js";import{u as Ve,F as Ze,a9 as He,aa as We,ab as Ge,ac as Je,ad as Te,ae as Xe,n as Fe,I as te,T as Ye,U as Ke,B as k,V as Qe,af as et}from"./useAppFontEffects-C1ceAD51.js";import{w as Se,x as Ne,y as tt}from"./katex.min-C-51hS9A.js";import{g as Le,r as st}from"./main-BtGnuno4.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-base-ui-CXFyogip.js";import"./vendor-floating-ui-utils-D6FqdtJt.js";import"./vendor-floating-ui-dom-BTvzWks8.js";import"./vendor-floating-ui-core-PuGzNPnN.js";import"./vendor-floating-ui-react-dom-DxYCWdHj.js";import"./vendor-use-sync-external-store-D6wYuSt-.js";import"./vendor-zod-CVhJ1Zpv.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-zustand-BAGL70zf.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-dnd-kit-core-BZknOX2w.js";import"./vendor-dnd-kit-utilities-B_MdXhJC.js";import"./vendor-dnd-kit-accessibility-BHxJPORy.js";import"./vendor-dnd-kit-sortable-CsEagZ81.js";import"./vendor-tanstack-react-virtual-CvuLsk7D.js";import"./vendor-tanstack-virtual-core-DPaNcJcT.js";import"./vendor-framer-motion-DxDVhOLc.js";import"./vendor-motion-dom-HXPOMxb7.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-codemirror-commands-MmBpgSOc.js";import"./vendor-codemirror-state-Dek9sMtw.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-view-B66jUSmE.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-codemirror-language-DkBxRck3.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CDMHUZ74.js";import"./vendor-codemirror-streamparser-CmlTsbN2.js";import"./vendor-codemirror-lang-javascript-DmPuKUEa.js";import"./vendor-lezer-javascript-D7Tj24ot.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-BRKmCSiY.js";import"./vendor-codemirror-lang-json-L0wsFFxi.js";import"./vendor-lezer-json-Iaex0UN-.js";import"./vendor-codemirror-lang-css-DfdrZ848.js";import"./vendor-lezer-css-C5xB6jxd.js";import"./vendor-codemirror-lang-html-C5kFuJzc.js";import"./vendor-lezer-html-C0I1p52t.js";import"./vendor-codemirror-lang-markdown-CPn-qinN.js";import"./vendor-lezer-markdown-C6g-d6P3.js";import"./vendor-codemirror-language-data-CTYHXywt.js";import"./vendor-codemirror-lang-python-BAVa3Hg5.js";import"./vendor-lezer-python-CvuFxeZl.js";import"./vendor-sonner-DFyL3AvE.js";import"./vendor-capacitor-core-B4EWRrHz.js";import"./vendor-cmdk-DgLInKvT.js";import"./vendor-radix-ui-react-dialog-B94Bt2qq.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-DcAh5WdT.js";import"./vendor-radix-ui-react-context-Czxm7Z62.js";import"./vendor-radix-ui-react-id-f5BLKEVw.js";import"./vendor-radix-ui-react-use-layout-effect-D_3IhJdJ.js";import"./vendor-radix-ui-react-use-controllable-state-BFT5YmkA.js";import"./vendor-radix-ui-react-dismissable-layer-D7kXcwgJ.js";import"./vendor-radix-ui-react-primitive-DhVoX9SD.js";import"./vendor-radix-ui-react-slot-BQgQOasS.js";import"./vendor-radix-ui-react-use-callback-ref-BZPnuXAC.js";import"./vendor-radix-ui-react-use-escape-keydown-oph88g-F.js";import"./vendor-radix-ui-react-focus-scope-CiaxW4dD.js";import"./vendor-radix-ui-react-portal-BMJYHWck.js";import"./vendor-radix-ui-react-presence-CNxf-uq4.js";import"./vendor-radix-ui-react-focus-guards-B6qJXYua.js";import"./vendor-react-remove-scroll-DO7dCTnK.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-BcFYyj3E.js";import"./vendor-react-style-singleton-q6EMHnwf.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-zDC0RhA3.js";import"./vendor-use-callback-ref-D3RC8gqK.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-legendapp-list-BCBzRcfK.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";import"./vendor-opencode-client-DgOf1DP0.js";import"./runtimeEndpointReset-ExJsaWzA.js";import"./useRootScrollLock-DnoKH1HE.js";import"./moveWorkspacePath-BINgpJ9S.js";import"./sessionOwnership-BAX1xEJC.js";function rt(r){switch(r){case"memory":return"database-2";case"streaming":return"bar-chart-box";case"requests":return"pulse"}}const ze=r=>{if(r<1e3)return`${Math.round(r)}ms`;const e=r/1e3;if(e<60)return`${e.toFixed(1)}s`;const u=Math.floor(e/60),s=Math.round(e%60);return`${u}m ${s}s`},Ae=r=>`${(r/1e3).toFixed(2)} s`,g=r=>{const e=De.c(8),{label:u,value:s}=r;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={backgroundColor:"color-mix(in srgb, var(--surface-muted) 55%, transparent)"},e[0]=i):i=e[0];let n;e[1]!==u?(n=t.jsx("div",{className:"typography-meta text-[var(--surface-muted-foreground)]",children:u}),e[1]=u,e[2]=n):n=e[2];let c;e[3]!==s?(c=t.jsx("div",{className:"typography-markdown font-semibold text-[var(--surface-foreground)]",children:s}),e[3]=s,e[4]=c):c=e[4];let p;return e[5]!==n||e[6]!==c?(p=t.jsxs("div",{className:"rounded-md p-2",style:i,children:[n,c]}),e[5]=n,e[6]=c,e[7]=p):p=e[7],p},Oe=r=>{const e=De.c(43),{title:u,snapshot:s,emptyLabel:i}=r,{t:n}=Ve();let c;if(e[0]!==i||e[1]!==s.durationMs||e[2]!==s.entries||e[3]!==s.lastUpdatedAt||e[4]!==s.startedAt||e[5]!==n||e[6]!==u){const p=s.entries.slice(0,12);let v;e[8]!==s.entries?(v=s.entries.reduce(nt,0),e[8]=s.entries,e[9]=v):v=e[9];const S=v;let f;e[10]!==u?(f=t.jsx("div",{className:"typography-ui-label font-semibold text-[var(--surface-foreground)]",children:u}),e[10]=u,e[11]=f):f=e[11];let l;e[12]!==s.durationMs||e[13]!==s.startedAt||e[14]!==n?(l=s.startedAt?ze(s.durationMs):n("memoryDebugPanel.common.idle"),e[12]=s.durationMs,e[13]=s.startedAt,e[14]=n,e[15]=l):l=e[15];let D;e[16]!==l?(D=t.jsx("div",{className:"typography-meta text-[var(--surface-muted-foreground)]",children:l}),e[16]=l,e[17]=D):D=e[17];let x;e[18]!==f||e[19]!==D?(x=t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f,D]}),e[18]=f,e[19]=D,e[20]=x):x=e[20];let h;e[21]!==n?(h=n("memoryDebugPanel.metric.metrics"),e[21]=n,e[22]=h):h=e[22];let N;e[23]!==s.entries.length||e[24]!==h?(N=t.jsx(g,{label:h,value:s.entries.length}),e[23]=s.entries.length,e[24]=h,e[25]=N):N=e[25];let b;e[26]!==n?(b=n("memoryDebugPanel.metric.samples"),e[26]=n,e[27]=b):b=e[27];let a;e[28]!==b||e[29]!==S?(a=t.jsx(g,{label:b,value:S}),e[28]=b,e[29]=S,e[30]=a):a=e[30];let y;e[31]!==n?(y=n("memoryDebugPanel.metric.lastUpdate"),e[31]=n,e[32]=y):y=e[32];let j;e[33]!==s.lastUpdatedAt||e[34]!==n?(j=s.lastUpdatedAt?n("memoryDebugPanel.common.live"):n("memoryDebugPanel.common.notAvailable"),e[33]=s.lastUpdatedAt,e[34]=n,e[35]=j):j=e[35];let d;e[36]!==y||e[37]!==j?(d=t.jsx(g,{label:y,value:j}),e[36]=y,e[37]=j,e[38]=d):d=e[38];let P;e[39]!==a||e[40]!==d||e[41]!==N?(P=t.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[N,a,d]}),e[39]=a,e[40]=d,e[41]=N,e[42]=P):P=e[42],c=t.jsxs("div",{className:"space-y-2 border-t border-[var(--interactive-border)] pt-2 first:border-t-0 first:pt-0",children:[x,P,p.length===0?t.jsx("div",{className:"rounded-md p-3 typography-meta text-[var(--surface-muted-foreground)]",style:{backgroundColor:"color-mix(in srgb, var(--surface-muted) 45%, transparent)"},children:i}):t.jsx(Fe,{outerClassName:"max-h-64",className:"pe-1",children:t.jsx("div",{className:"space-y-1",children:p.map(w=>t.jsxs("div",{className:"rounded-md border border-[var(--interactive-border)] p-2",style:{backgroundColor:"color-mix(in srgb, var(--surface-elevated) 88%, transparent)"},children:[t.jsx("div",{className:"typography-meta font-medium text-[var(--surface-foreground)] break-all",children:w.metric}),t.jsxs("div",{className:"mt-1 grid grid-cols-4 gap-2 typography-meta text-[var(--surface-muted-foreground)]",children:[t.jsx("span",{children:n("memoryDebugPanel.metric.countValue",{value:w.count})}),t.jsx("span",{children:n("memoryDebugPanel.metric.avgValue",{value:w.avg})}),t.jsx("span",{children:n("memoryDebugPanel.metric.maxValue",{value:w.max})}),t.jsx("span",{children:n("memoryDebugPanel.metric.totalValue",{value:w.total})})]})]},w.metric))})})]}),e[0]=i,e[1]=s.durationMs,e[2]=s.entries,e[3]=s.lastUpdatedAt,e[4]=s.startedAt,e[5]=n,e[6]=u,e[7]=c}else c=e[7];return c},Ee=r=>{const e=De.c(24),{series:u,peak:s,windowSeconds:i,ariaLabel:n,maxLabel:c}=r,p=i,v=u.reduce(ot,0),S=s>0?52/s:0;let f;e[0]!==v||e[1]!==p?(f=d=>p-v+d,e[0]=v,e[1]=p,e[2]=f):f=e[2];const l=f;let D;e[3]!==S?(D=d=>56-d*S,e[3]=S,e[4]=D):D=e[4];const x=D;let h;e[5]!==c?(h=t.jsx("span",{className:"pointer-events-none absolute inset-s-0 top-0 typography-meta text-[var(--surface-muted-foreground)]",children:c}),e[5]=c,e[6]=h):h=e[6];const N=`0 0 ${p} 56`;let b;e[7]!==p?(b=t.jsx("line",{x1:0,y1:56,x2:p,y2:56,stroke:"var(--interactive-border)",strokeWidth:1,vectorEffect:"non-scaling-stroke"}),e[7]=p,e[8]=b):b=e[8];let a;if(e[9]!==u||e[10]!==l||e[11]!==x){let d;e[13]!==l||e[14]!==x?(d=(P,w)=>{const m=P.samples.length;if(m===0)return null;const C=P.samples.map((R,L)=>`${l(L)},${x(R).toFixed(2)}`),_=`M ${C.join(" L ")}`;return t.jsxs(A.Fragment,{children:[P.filled?t.jsx("path",{d:`M ${l(0)},56 L ${C.join(" L ")} L ${l(m-1)},56 Z`,fill:`color-mix(in srgb, ${P.color} 18%, transparent)`,stroke:"none"}):null,t.jsx("path",{d:_,fill:"none",stroke:P.color,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round",vectorEffect:"non-scaling-stroke"})]},w)},e[13]=l,e[14]=x,e[15]=d):d=e[15],a=u.map(d),e[9]=u,e[10]=l,e[11]=x,e[12]=a}else a=e[12];let y;e[16]!==n||e[17]!==N||e[18]!==b||e[19]!==a?(y=t.jsxs("svg",{viewBox:N,preserveAspectRatio:"none",className:"h-14 w-full",role:"img","aria-label":n,children:[b,a]}),e[16]=n,e[17]=N,e[18]=b,e[19]=a,e[20]=y):y=e[20];let j;return e[21]!==h||e[22]!==y?(j=t.jsxs("div",{className:"relative w-full",children:[h,y]}),e[21]=h,e[22]=y,e[23]=j):j=e[23],j},at=r=>{const e=De.c(100),{onClose:u}=r,{t:s}=Ve(),[i,n]=A.useState("memory"),[c,p]=A.useState("idle"),v=Ze(lt),S=He(it),f=We(),l=Ge(mt),D=Je(ct),[x,h]=A.useState(ut),[N,b]=A.useState(dt),[a,y]=A.useState(pt),j=[{label:"p50",current:a.ageP50,samples:a.p50Samples,color:"var(--status-success)"},{label:"p90",current:a.ageP90,samples:a.p90Samples,color:"var(--status-info)"},{label:"p99",current:a.ageP99,samples:a.p99Samples,color:"var(--status-warning)"},{label:"max",current:a.ageMax,samples:a.maxSamples,color:"var(--status-error)"}];let d;e[0]!==a.samples?(d=a.samples.reduce(gt,0),e[0]=a.samples,e[1]=d):d=e[1];const P=d,w=j.reduce(xt,0);let m;e[2]!==x.entries?(m=new Map,x.entries.forEach(o=>{m.set(o.metric,o.count)}),e[2]=x.entries,e[3]=m):m=e[3];let C;e[4]!==m?(C=m.get("ui.message_list.render")??0,e[4]=m,e[5]=C):C=e[5];let _;e[6]!==m?(_=m.get("ui.message_list.render.streaming")??0,e[6]=m,e[7]=_):_=e[7];let R;e[8]!==m?(R=m.get("ui.chat_message.render")??0,e[8]=m,e[9]=R):R=e[9];let L;e[10]!==m?(L=m.get("ui.chat_message.render.streaming")??0,e[10]=m,e[11]=L):L=e[11];let $;e[12]!==m?($=m.get("ui.chat_message.render.static_during_stream")??0,e[12]=m,e[13]=$):$=e[13];let q;e[14]!==m?(q=m.get("ui.chat_message.render.static_outside_active_turn_during_stream")??0,e[14]=m,e[15]=q):q=e[15];let oe;e[16]!==C||e[17]!==_||e[18]!==R||e[19]!==L||e[20]!==$||e[21]!==q?(oe={messageListRender:C,messageListRenderStreaming:_,chatMessageRender:R,chatMessageRenderStreaming:L,chatMessageRenderStaticDuringStream:$,chatMessageRenderStaticOutsideActiveTurnDuringStream:q},e[16]=C,e[17]=_,e[18]=R,e[19]=L,e[20]=$,e[21]=q,e[22]=oe):oe=e[22];const I=oe;let le,ie;e[23]===Symbol.for("react.memo_cache_sentinel")?(ie=()=>{const o=()=>{h(Se()),b(Ne()),y(Le())};o();const M=window.setInterval(o,500);return()=>window.clearInterval(M)},le=[],e[23]=le,e[24]=ie):(le=e[23],ie=e[24]),A.useEffect(ie,le);let me,ce;e[25]!==c?(me=()=>{if(c==="idle")return;const o=window.setTimeout(()=>{p("idle")},1500);return()=>window.clearTimeout(o)},ce=[c],e[25]=c,e[26]=me,e[27]=ce):(me=e[26],ce=e[27]),A.useEffect(me,ce);let se=0,re=0,ae=0;for(const o of Object.keys(l)){const M=l[o]??[];re=re+M.length;for(const ne of M)ne.role==="user"?ae=ae+1:ne.role==="assistant"&&(se=se+1)}let ue;e[28]!==se||e[29]!==re||e[30]!==ae?(ue={assistant:se,total:re,user:ae},e[28]=se,e[29]=re,e[30]=ae,e[31]=ue):ue=e[31];const de=ue;let pe;if(e[32]!==v||e[33]!==l||e[34]!==S||e[35]!==f||e[36]!==s){let o;e[38]!==v||e[39]!==l||e[40]!==S||e[41]!==s?(o=M=>{const ne=l[M.id]??[];let _e=0,Re=0;for(const Ie of ne)Ie.role==="user"?Re=Re+1:Ie.role==="assistant"&&(_e=_e+1);const je=S.get(M.id);return{id:M.id,title:M.title||s("memoryDebugPanel.common.untitled"),assistantMessageCount:_e,messageCount:ne.length,userMessageCount:Re,isStreaming:je?.isStreaming||!1,isZombie:je?.isZombie||!1,backgroundCount:je?.backgroundMessageCount||0,lastAccessed:je?.lastAccessedAt||0,isCurrent:M.id===v}},e[38]=v,e[39]=l,e[40]=S,e[41]=s,e[42]=o):o=e[42],pe=f.map(o).sort(ht),e[32]=v,e[33]=l,e[34]=S,e[35]=f,e[36]=s,e[37]=pe}else pe=e[37];const $e=pe;let ge;e[43]!==l?(ge=Object.keys(l),e[43]=l,e[44]=ge):ge=e[44];const Ue=ge.length;let fe;e[45]===Symbol.for("react.memo_cache_sentinel")?(fe=async()=>{try{const o={generatedAt:new Date().toISOString(),ui:Se(),vscode:Ne()};await navigator.clipboard.writeText(JSON.stringify(o,null,2)),p("copied")}catch{p("error")}},e[45]=fe):fe=e[45];const qe=fe,Pe=et,Be="fixed bottom-4 inset-e-4 z-50 w-[28rem] p-4 shadow-none bottom-safe-area";let T;e[46]===Symbol.for("react.memo_cache_sentinel")?(T={backgroundColor:"color-mix(in srgb, var(--surface-background) 94%, transparent)"},e[46]=T):T=e[46];let O;e[47]!==i?(O=rt(i),e[47]=i,e[48]=O):O=e[48];let E;e[49]!==O?(E=t.jsx(te,{name:O,className:"h-4 w-4 text-[var(--surface-foreground)]"}),e[49]=O,e[50]=E):E=e[50];let V;e[51]!==s?(V=s("memoryDebugPanel.title"),e[51]=s,e[52]=V):V=e[52];let F;e[53]!==V?(F=t.jsx("h3",{className:"typography-ui-label font-semibold text-[var(--surface-foreground)]",children:V}),e[53]=V,e[54]=F):F=e[54];let z;e[55]!==E||e[56]!==F?(z=t.jsxs("div",{className:"flex items-center gap-2",children:[E,F]}),e[55]=E,e[56]=F,e[57]=z):z=e[57];let U;e[58]!==i?(U=i==="streaming"?t.jsxs(t.Fragment,{children:[t.jsx(k,{size:"xs",variant:"ghost",onClick:qe,children:t.jsx(te,{name:"file-copy",className:"h-3.5 w-3.5"})}),t.jsx(k,{size:"xs",variant:"ghost",onClick:()=>{tt(),h(Se()),b(Ne())},children:t.jsx(te,{name:"refresh",className:"h-3.5 w-3.5"})})]}):null,e[58]=i,e[59]=U):U=e[59];let B;e[60]!==i?(B=i==="requests"?t.jsx(k,{size:"xs",variant:"ghost",onClick:()=>{st(),y(Le())},children:t.jsx(te,{name:"refresh",className:"h-3.5 w-3.5"})}):null,e[60]=i,e[61]=B):B=e[61];let Z;e[62]!==u?(Z=u?t.jsx(k,{size:"icon",variant:"ghost",className:"h-6 w-6",onClick:u,children:t.jsx(te,{name:"close",className:"h-4 w-4"})}):null,e[62]=u,e[63]=Z):Z=e[63];let H;e[64]!==U||e[65]!==B||e[66]!==Z?(H=t.jsxs("div",{className:"flex items-center gap-1",children:[U,B,Z]}),e[64]=U,e[65]=B,e[66]=Z,e[67]=H):H=e[67];let W;e[68]!==z||e[69]!==H?(W=t.jsxs("div",{className:"mb-3 flex items-center justify-between gap-2",children:[z,H]}),e[68]=z,e[69]=H,e[70]=W):W=e[70];let xe;e[71]===Symbol.for("react.memo_cache_sentinel")?(xe={backgroundColor:"color-mix(in srgb, var(--surface-muted) 55%, transparent)"},e[71]=xe):xe=e[71];const we=i==="memory"?"secondary":"ghost";let he;e[72]===Symbol.for("react.memo_cache_sentinel")?(he=()=>n("memory"),e[72]=he):he=e[72];let G;e[73]!==s?(G=s("memoryDebugPanel.tabs.memory"),e[73]=s,e[74]=G):G=e[74];let J;e[75]!==we||e[76]!==G?(J=t.jsx(k,{size:"sm",variant:we,className:"flex-1",onClick:he,children:G}),e[75]=we,e[76]=G,e[77]=J):J=e[77];const Me=i==="streaming"?"secondary":"ghost";let be;e[78]===Symbol.for("react.memo_cache_sentinel")?(be=()=>n("streaming"),e[78]=be):be=e[78];let X;e[79]!==s?(X=s("memoryDebugPanel.tabs.streaming"),e[79]=s,e[80]=X):X=e[80];let Y;e[81]!==Me||e[82]!==X?(Y=t.jsx(k,{size:"sm",variant:Me,className:"flex-1",onClick:be,children:X}),e[81]=Me,e[82]=X,e[83]=Y):Y=e[83];const Ce=i==="requests"?"secondary":"ghost";let ye;e[84]===Symbol.for("react.memo_cache_sentinel")?(ye=()=>n("requests"),e[84]=ye):ye=e[84];let K;e[85]!==s?(K=s("memoryDebugPanel.tabs.requests"),e[85]=s,e[86]=K):K=e[86];let Q;e[87]!==Ce||e[88]!==K?(Q=t.jsx(k,{size:"sm",variant:Ce,className:"flex-1",onClick:ye,children:K}),e[87]=Ce,e[88]=K,e[89]=Q):Q=e[89];let ee;e[90]!==J||e[91]!==Y||e[92]!==Q?(ee=t.jsxs("div",{className:"mb-3 flex gap-1 rounded-md p-1",style:xe,children:[J,Y,Q]}),e[90]=J,e[91]=Y,e[92]=Q,e[93]=ee):ee=e[93];const ke=i==="memory"?t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-2 typography-meta",children:[t.jsx(g,{label:s("memoryDebugPanel.metric.totalMessages"),value:de.total}),t.jsx(g,{label:s("memoryDebugPanel.metric.cachedSessions"),value:`${Ue} / ${Te.MAX_SESSIONS}`}),t.jsx(g,{label:s("memoryDebugPanel.metric.userMessages"),value:de.user}),t.jsx(g,{label:s("memoryDebugPanel.metric.assistantMessages"),value:de.assistant})]}),t.jsxs("div",{className:"typography-meta space-y-1 border-t border-[var(--interactive-border)] pt-2",children:[t.jsxs("div",{className:"flex justify-between gap-2",children:[t.jsx("span",{className:"text-[var(--surface-muted-foreground)]",children:s("memoryDebugPanel.metric.viewportWindow")}),t.jsx("span",{className:"text-[var(--surface-foreground)]",children:s("memoryDebugPanel.metric.messagesValue",{count:Xe()})})]}),t.jsxs("div",{className:"flex justify-between gap-2",children:[t.jsx("span",{className:"text-[var(--surface-muted-foreground)]",children:s("memoryDebugPanel.metric.zombieTimeout")}),t.jsx("span",{className:"text-[var(--surface-foreground)]",children:s("memoryDebugPanel.metric.minutesValue",{count:Te.ZOMBIE_TIMEOUT/1e3/60})})]}),t.jsxs("div",{className:"flex justify-between gap-2",children:[t.jsx("span",{className:"text-[var(--surface-muted-foreground)]",children:s("memoryDebugPanel.metric.githubTotalRequests")}),t.jsx("span",{className:"text-[var(--surface-foreground)]",children:D})]})]}),t.jsxs("div",{className:"border-t border-[var(--interactive-border)] pt-2",children:[t.jsx("div",{className:"mb-1 typography-meta font-semibold text-[var(--surface-foreground)]",children:s("memoryDebugPanel.section.sessionsInMemory")}),t.jsx(Fe,{outerClassName:"max-h-48",className:"space-y-1 pe-1",children:$e.map(o=>t.jsxs("div",{className:"typography-meta flex items-center justify-between rounded p-1.5",style:{backgroundColor:o.isCurrent?"color-mix(in srgb, var(--interactive-selection) 22%, transparent)":"color-mix(in srgb, var(--surface-muted) 35%, transparent)"},children:[t.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[t.jsx("span",{className:"truncate text-[var(--surface-foreground)]",children:o.title}),o.isStreaming?t.jsx(te,{name:"pulse",className:"h-3 w-3 animate-pulse text-[var(--status-info)]"}):null,o.isZombie?t.jsx("span",{className:"text-[var(--status-warning)]",children:"!"}):null]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"font-mono text-[var(--surface-muted-foreground)]",children:s("memoryDebugPanel.metric.roleMsgsValue",{assistant:o.assistantMessageCount,user:o.userMessageCount})}),t.jsx("span",{className:"font-mono text-[var(--surface-foreground)]",children:s("memoryDebugPanel.metric.msgsValue",{count:o.messageCount})}),o.backgroundCount>0?t.jsxs("span",{className:"text-[var(--status-info)]",children:["+",o.backgroundCount]}):null]})]},o.id))})]}),t.jsx("div",{className:"flex gap-2 border-t border-[var(--interactive-border)] pt-2",children:t.jsxs(Ye,{children:[t.jsx(Ke,{asChild:!0,children:t.jsx(k,{size:"sm",variant:"outline",className:"typography-meta",onClick:()=>{console.log("[DebugPanel] Session store state:",{sessions:f.map(bt),currentSessionId:v,cachedSessions:Object.keys(l),messageRoleCounts:de,sessionMessageRoleCounts:$e.map(yt),memoryStates:Object.fromEntries(S)})},children:s("memoryDebugPanel.actions.logState")})}),t.jsx(Qe,{side:"top",children:s("memoryDebugPanel.tooltip.logCurrentState")})]})})]}):i==="streaming"?t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-[var(--interactive-border)] px-3 py-2 typography-meta text-[var(--surface-muted-foreground)]",children:[t.jsx("span",{children:s(c==="copied"?"memoryDebugPanel.streaming.copy.copied":c==="error"?"memoryDebugPanel.streaming.copy.failed":"memoryDebugPanel.streaming.copy.hint")}),t.jsx(k,{size:"xs",variant:"outline",onClick:qe,children:s("memoryDebugPanel.actions.copyJson")})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[t.jsx(g,{label:s("memoryDebugPanel.metric.uiMetrics"),value:x.entries.length}),t.jsx(g,{label:s("memoryDebugPanel.metric.vscodeMetrics"),value:N.entries.length}),t.jsx(g,{label:s("memoryDebugPanel.metric.messageListRenders"),value:I.messageListRender}),t.jsx(g,{label:s("memoryDebugPanel.metric.messageListStreamRenders"),value:I.messageListRenderStreaming}),t.jsx(g,{label:s("memoryDebugPanel.metric.chatMessageRenders"),value:I.chatMessageRender}),t.jsx(g,{label:s("memoryDebugPanel.metric.chatMessageStreamRenders"),value:I.chatMessageRenderStreaming}),t.jsx(g,{label:s("memoryDebugPanel.metric.chatMessageStaticDuringStream"),value:I.chatMessageRenderStaticDuringStream}),t.jsx(g,{label:s("memoryDebugPanel.metric.chatMessageStaticOutsideActiveTurn"),value:I.chatMessageRenderStaticOutsideActiveTurnDuringStream})]}),t.jsx(Oe,{title:s("memoryDebugPanel.section.uiStreamingMetrics"),snapshot:x,emptyLabel:s("memoryDebugPanel.section.noUiSamples")}),N.entries.length>0?t.jsx(Oe,{title:s("memoryDebugPanel.section.vscodeBridgeMetrics"),snapshot:N,emptyLabel:s("memoryDebugPanel.section.noVscodeSamples")}):null]}):t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-2 typography-meta",children:[t.jsx(g,{label:s("memoryDebugPanel.requests.totalRequests"),value:`${a.totalSettled} / ${a.totalStarted}`}),t.jsx(g,{label:s("memoryDebugPanel.requests.tracking"),value:a.startedAt?ze(a.durationMs):s("memoryDebugPanel.common.idle")})]}),a.samples.length===0?t.jsx("div",{className:"rounded-md p-3 typography-meta text-[var(--surface-muted-foreground)]",style:{backgroundColor:"color-mix(in srgb, var(--surface-muted) 45%, transparent)"},children:s("memoryDebugPanel.requests.noSamples")}):t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("div",{className:"flex items-center justify-between typography-meta",children:[t.jsx("span",{className:"text-[var(--surface-muted-foreground)]",children:s("memoryDebugPanel.requests.inFlight")}),t.jsxs("span",{children:[t.jsx("span",{className:"font-medium text-[var(--surface-foreground)]",children:a.inFlight}),t.jsxs("span",{className:"text-[var(--surface-muted-foreground)]",children:[" · ",s("memoryDebugPanel.requests.peak")," "]}),t.jsx("span",{className:"font-medium text-[var(--surface-foreground)]",children:a.peak})]})]}),t.jsx(Ee,{series:[{samples:a.samples,color:"var(--status-info)",filled:!0}],peak:P,windowSeconds:a.windowSeconds,ariaLabel:s("memoryDebugPanel.requests.chartLabel",{peak:a.peak}),maxLabel:`${P}`}),t.jsxs("div",{className:"flex items-center justify-between typography-meta",children:[t.jsx("span",{className:"text-[var(--surface-muted-foreground)]",children:s("memoryDebugPanel.requests.duration")}),t.jsx("span",{className:"font-medium tabular-nums text-[var(--surface-foreground)]",children:Ae(a.peakAgeMs)})]}),t.jsx(Ee,{series:j.map(vt),peak:w,windowSeconds:a.windowSeconds,ariaLabel:s("memoryDebugPanel.requests.percentileChartLabel"),maxLabel:Ae(w)}),t.jsx("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 typography-meta",children:j.map(jt)}),t.jsxs("div",{className:"flex items-center justify-between typography-meta text-[var(--surface-muted-foreground)]",children:[t.jsx("span",{children:s("memoryDebugPanel.requests.windowHint",{seconds:a.windowSeconds})}),t.jsx("span",{children:s("memoryDebugPanel.requests.now")})]})]})]});let ve;return e[94]!==Pe||e[95]!==T||e[96]!==W||e[97]!==ee||e[98]!==ke?(ve=t.jsxs(Pe,{className:Be,style:T,children:[W,ee,ke]}),e[94]=Pe,e[95]=T,e[96]=W,e[97]=ee,e[98]=ke,e[99]=ve):ve=e[99],ve},tr=at;function nt(r,e){return r+e.count}function ot(r,e){return Math.max(r,e.samples.length)}function lt(r){return r.currentSessionId}function it(r){return r.sessionMemoryState}function mt(r){return r.message}function ct(r){return r.totalRequestCount}function ut(){return Se()}function dt(){return Ne()}function pt(){return Le()}function gt(r,e){return Math.max(r,e)}function ft(r,e){return Math.max(r,e)}function xt(r,e){return e.samples.reduce(ft,r)}function ht(r,e){return e.lastAccessed-r.lastAccessed}function bt(r){return{id:r.id,title:r.title}}function yt(r){return{id:r.id,title:r.title,total:r.messageCount,user:r.userMessageCount,assistant:r.assistantMessageCount}}function vt(r){return{samples:r.samples,color:r.color}}function jt(r){return t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"inline-block h-2 w-2 rounded-full",style:{backgroundColor:r.color}}),t.jsx("span",{className:"text-[var(--surface-muted-foreground)]",children:r.label}),t.jsx("span",{className:"font-medium tabular-nums text-[var(--surface-foreground)]",children:Ae(r.current)})]},r.label)}export{tr as MemoryDebugPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as K,j as t,R as c,f as ee}from"./vendor-react-BUCujlKS.js";import{u as te,B as L,y as J,eb as he,ak as fe,a7 as Ne,L as se,I as F}from"./useAppFontEffects-C1ceAD51.js";import{az as X,aA as Se,aB as ue,aC as Q,aq as Y,aD as q,aE as Re,aF as xe,aG as ge,l as Z,aH as be,aI as ye,aJ as ce,aK as Le,aL as Ue,aM as Ie}from"./katex.min-C-51hS9A.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-base-ui-CXFyogip.js";import"./vendor-floating-ui-utils-D6FqdtJt.js";import"./vendor-floating-ui-dom-BTvzWks8.js";import"./vendor-floating-ui-core-PuGzNPnN.js";import"./vendor-floating-ui-react-dom-DxYCWdHj.js";import"./vendor-use-sync-external-store-D6wYuSt-.js";import"./vendor-zod-CVhJ1Zpv.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-zustand-BAGL70zf.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-dnd-kit-core-BZknOX2w.js";import"./vendor-dnd-kit-utilities-B_MdXhJC.js";import"./vendor-dnd-kit-accessibility-BHxJPORy.js";import"./vendor-dnd-kit-sortable-CsEagZ81.js";import"./vendor-tanstack-react-virtual-CvuLsk7D.js";import"./vendor-tanstack-virtual-core-DPaNcJcT.js";import"./vendor-framer-motion-DxDVhOLc.js";import"./vendor-motion-dom-HXPOMxb7.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-codemirror-commands-MmBpgSOc.js";import"./vendor-codemirror-state-Dek9sMtw.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-view-B66jUSmE.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-codemirror-language-DkBxRck3.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CDMHUZ74.js";import"./vendor-codemirror-streamparser-CmlTsbN2.js";import"./vendor-codemirror-lang-javascript-DmPuKUEa.js";import"./vendor-lezer-javascript-D7Tj24ot.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-BRKmCSiY.js";import"./vendor-codemirror-lang-json-L0wsFFxi.js";import"./vendor-lezer-json-Iaex0UN-.js";import"./vendor-codemirror-lang-css-DfdrZ848.js";import"./vendor-lezer-css-C5xB6jxd.js";import"./vendor-codemirror-lang-html-C5kFuJzc.js";import"./vendor-lezer-html-C0I1p52t.js";import"./vendor-codemirror-lang-markdown-CPn-qinN.js";import"./vendor-lezer-markdown-C6g-d6P3.js";import"./vendor-codemirror-language-data-CTYHXywt.js";import"./vendor-codemirror-lang-python-BAVa3Hg5.js";import"./vendor-lezer-python-CvuFxeZl.js";import"./vendor-sonner-DFyL3AvE.js";import"./vendor-capacitor-core-B4EWRrHz.js";import"./vendor-cmdk-DgLInKvT.js";import"./vendor-radix-ui-react-dialog-B94Bt2qq.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-DcAh5WdT.js";import"./vendor-radix-ui-react-context-Czxm7Z62.js";import"./vendor-radix-ui-react-id-f5BLKEVw.js";import"./vendor-radix-ui-react-use-layout-effect-D_3IhJdJ.js";import"./vendor-radix-ui-react-use-controllable-state-BFT5YmkA.js";import"./vendor-radix-ui-react-dismissable-layer-D7kXcwgJ.js";import"./vendor-radix-ui-react-primitive-DhVoX9SD.js";import"./vendor-radix-ui-react-slot-BQgQOasS.js";import"./vendor-radix-ui-react-use-callback-ref-BZPnuXAC.js";import"./vendor-radix-ui-react-use-escape-keydown-oph88g-F.js";import"./vendor-radix-ui-react-focus-scope-CiaxW4dD.js";import"./vendor-radix-ui-react-portal-BMJYHWck.js";import"./vendor-radix-ui-react-presence-CNxf-uq4.js";import"./vendor-radix-ui-react-focus-guards-B6qJXYua.js";import"./vendor-react-remove-scroll-DO7dCTnK.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-BcFYyj3E.js";import"./vendor-react-style-singleton-q6EMHnwf.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-zDC0RhA3.js";import"./vendor-use-callback-ref-D3RC8gqK.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-legendapp-list-BCBzRcfK.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";import"./vendor-opencode-client-DgOf1DP0.js";function Te(d){switch(d){case"ok":return null;case"auth":return"onboarding.remoteConnection.probe.authMessage";case"update-recommended":return"onboarding.remoteConnection.probe.updateRecommendedMessage";case"incompatible":return"onboarding.remoteConnection.probe.incompatibleMessage";case"wrong-service":return"onboarding.remoteConnection.probe.wrongServiceMessage";case"unreachable":return"onboarding.remoteConnection.probe.unreachableMessage";default:return null}}function ie(d){return d==="wrong-service"||d==="unreachable"||d==="incompatible"}function ve({onBack:d,showBackButton:e=!0,initialUrl:o="",initialLabel:r="",isRecoveryMode:n=!1,onConnect:i,onSwitchToLocal:u,showInstancePicker:a=!1}){const{t:s}=te(),[h,x]=K.useState(o),[m,U]=K.useState(r),[R,y]=K.useState("idle"),[b,g]=K.useState(null),[S,C]=K.useState(""),[T,I]=K.useState([]),[D,w]=K.useState(()=>a?"instances":"add"),[v,j]=K.useState("");K.useEffect(()=>{a&&X().then(p=>I(p.hosts)).catch(p=>{C(p instanceof Error?p.message:String(p))})},[a]);const k=Se(h),A=k?.persistedUrl??null,P=K.useCallback(p=>{x(p.target.value),y("idle"),g(null),C("")},[]),$=K.useCallback(p=>{U(p.target.value)},[]),W=K.useCallback(async()=>{if(A){y("testing"),g(null),C("");try{const p=await ue(A);g(p),y(p.status==="ok"||p.status==="update-recommended"?"success":"error")}catch(p){C(p instanceof Error?p.message:s("onboarding.remoteConnection.errors.connectionTestFailed")),y("error")}}},[A,s]),f=K.useCallback(async()=>{if(!k)return;const p=k.persistedUrl;y("testing"),g(null),C("");try{const V=await ue(p);if(g(V),ie(V.status)){y("error");return}const ne=await X(),ke=m.trim()||p,re=ne.hosts.find(oe=>oe.url===p),ae=re?re.id:`host-${Date.now().toString(16)}`,de={id:ae,label:ke,url:p,apiUrl:p},Ce=re?ne.hosts.map(oe=>oe.id===ae?de:oe):[...ne.hosts,de];if(await Q({hosts:Ce,defaultHostId:ae,initialHostChoiceCompleted:!0}),i?.(),k.redeemUrl){window.location.assign(k.redeemUrl);return}Y()&&await q()}catch(V){C(V instanceof Error?V.message:s("onboarding.remoteConnection.errors.failedToSaveConnection")),y("error")}},[k,m,i,s]),E=K.useCallback(async p=>{const V=await X();await Q({hosts:V.hosts,defaultHostId:p,initialHostChoiceCompleted:!0}),await q()},[]),z=K.useCallback(async()=>{y("testing"),C("");try{const p=await X(),V=await Re(v,p.hosts);await Q({hosts:V.hosts,defaultHostId:V.hostId,initialHostChoiceCompleted:!0}),await q()}catch(p){C(p instanceof Error&&p.message==="invalid-connect-link"?s("settings.remoteInstances.direct.error.invalidConnectLink"):s("onboarding.remoteConnection.errors.failedToSaveConnection")),y("error")}},[v,s]),l=R==="testing",N=A!==null&&!l,H=A!==null&&!l&&!ie(b?.status??null),_=Te(b?.status??null),M=b?.status==="ok",O=b?.status==="update-recommended",G=b?.status==="auth",B=ie(b?.status??null);return a&&D==="instances"?t.jsx("div",{className:"flex flex-col items-center justify-center h-full p-8",children:t.jsxs("div",{className:"w-full max-w-md space-y-6",children:[t.jsxs("div",{className:"space-y-2 text-center",children:[t.jsx("h1",{className:"typography-ui-header text-xl font-semibold text-foreground",children:s("desktopHostSwitcher.actions.switchInstance")}),t.jsx("p",{className:"text-muted-foreground text-sm",children:s("settings.remoteInstances.direct.description")})]}),S?t.jsx("div",{className:"text-sm text-[var(--status-error)]",children:S}):null,t.jsx("div",{className:"space-y-2",children:T.length===0?t.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:s("settings.remoteInstances.direct.state.empty")}):T.map(p=>t.jsx(L,{variant:"outline",className:"w-full justify-start",onClick:()=>{E(p.id)},children:t.jsx("span",{className:"min-w-0 truncate",children:p.label})},p.id))}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(L,{variant:"outline",className:"flex-1",onClick:()=>w("import"),children:s("settings.remoteInstances.direct.import.action")}),t.jsx(L,{className:"flex-1",onClick:()=>w("add"),children:s("settings.remoteInstances.direct.actions.add")})]})]})}):a&&D==="import"?t.jsx("div",{className:"flex flex-col items-center justify-center h-full p-8",children:t.jsxs("div",{className:"w-full max-w-md space-y-6",children:[t.jsx(L,{variant:"ghost",onClick:()=>w("instances"),className:"p-0 text-muted-foreground",children:s("onboarding.common.actions.back")}),t.jsxs("div",{className:"space-y-2 text-center",children:[t.jsx("h1",{className:"typography-ui-header text-xl font-semibold text-foreground",children:s("settings.remoteInstances.direct.import.action")}),t.jsx("p",{className:"text-muted-foreground text-sm",children:s("settings.remoteInstances.direct.import.description")})]}),t.jsx(J,{value:v,onChange:p=>j(p.target.value),placeholder:s("settings.remoteInstances.direct.import.placeholder"),disabled:l,autoFocus:!0}),S?t.jsx("div",{className:"text-sm text-[var(--status-error)]",children:S}):null,t.jsx(L,{onClick:()=>{z()},disabled:l||!v.trim(),children:s("settings.remoteInstances.direct.import.action")})]})}):t.jsx("div",{className:"flex flex-col items-center justify-center h-full p-8",children:t.jsxs("div",{className:"w-full max-w-md space-y-6",children:[(e||a)&&t.jsx("div",{className:"flex items-center",children:t.jsx(L,{variant:"ghost",onClick:a?()=>w("instances"):d,className:"p-0 text-muted-foreground hover:text-foreground",children:s("onboarding.common.actions.back")})}),t.jsxs("div",{className:"space-y-2 text-center",children:[t.jsx("h1",{className:"typography-ui-header text-xl font-semibold text-foreground",children:s(n?"onboarding.remoteConnection.titleRecovery":"onboarding.remoteConnection.title")}),t.jsx("p",{className:"text-muted-foreground text-sm",children:s("onboarding.remoteConnection.description")})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{htmlFor:"remote-url",className:"text-sm text-foreground",children:s("onboarding.remoteConnection.field.serverAddress")}),t.jsx(J,{id:"remote-url",type:"url",value:h,onChange:P,placeholder:s("onboarding.remoteConnection.field.serverAddressPlaceholder"),disabled:l})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{htmlFor:"remote-label",className:"text-sm text-foreground",children:s("onboarding.remoteConnection.field.nameOptional")}),t.jsx(J,{id:"remote-label",type:"text",value:m,onChange:$,placeholder:s("onboarding.remoteConnection.field.namePlaceholder"),disabled:l})]})]}),b&&M&&t.jsx("div",{className:"rounded-lg border p-3 text-sm",style:{borderColor:"var(--status-success)",color:"var(--status-success)"},children:s("onboarding.remoteConnection.status.connectedSuccessfully",{latencyMs:b.latencyMs})}),b&&G&&t.jsx("div",{className:"rounded-lg border p-3 text-sm",style:{borderColor:"var(--status-warning)",color:"var(--status-warning)"},children:s("onboarding.remoteConnection.status.authWarning")}),b&&O&&t.jsx("div",{className:"rounded-lg border p-3 text-sm",style:{borderColor:"var(--status-warning)",color:"var(--status-warning)"},children:_?s(_):null}),b&&B&&t.jsxs("div",{className:"rounded-lg border p-3 text-sm space-y-3",style:{borderColor:"var(--status-error)",color:"var(--status-error)"},children:[t.jsxs("div",{children:[t.jsx("div",{className:"font-semibold mb-1",children:s("onboarding.remoteConnection.status.connectionFailed")}),t.jsx("div",{className:"opacity-90",children:_?s(_):null})]}),t.jsx("div",{className:"text-xs opacity-80",children:b.status==="unreachable"?s("onboarding.remoteConnection.status.suggestionsUnreachable"):s("onboarding.remoteConnection.status.suggestionsWrongService")})]}),S&&t.jsx("div",{className:"rounded-lg border p-3 text-sm",style:{borderColor:"var(--status-error)",color:"var(--status-error)"},children:S}),t.jsxs("div",{className:"flex gap-3",children:[t.jsx(L,{variant:"outline",onClick:W,disabled:!N,children:s(l?"onboarding.remoteConnection.actions.testing":"onboarding.remoteConnection.actions.testConnection")}),t.jsx(L,{onClick:f,disabled:!H,children:s("onboarding.remoteConnection.actions.connectAndRestart")})]}),B&&t.jsxs("div",{className:"flex flex-col gap-2 pt-2 border-t border-border",children:[t.jsx("div",{className:"text-xs text-muted-foreground text-center",children:s("onboarding.remoteConnection.actions.whatToDo")}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(L,{variant:"outline",size:"sm",onClick:d,className:"flex-1",children:s("onboarding.remoteConnection.actions.chooseDifferentServer")}),!n&&u&&t.jsx(L,{variant:"outline",size:"sm",onClick:u,className:"flex-1",children:s("onboarding.remoteConnection.actions.useLocalInstead")})]})]})]})})}const _e="curl -fsSL https://opencode.ai/v2/install | bash",we="npm install -g @opencode/cli",De="https://opencode.ai/download",me=2500;function Ae(d){const e=ee.c(9),{windows:o,onCopy:r,copyTitle:n}=d;let i;e[0]!==o?(i=t.jsx("code",{className:"flex-1 min-w-0 text-start overflow-x-auto whitespace-nowrap",children:o?t.jsx("span",{style:{color:"var(--syntax-keyword)"},children:we}):t.jsxs(t.Fragment,{children:[t.jsx("span",{style:{color:"var(--syntax-keyword)"},children:"curl"}),t.jsx("span",{className:"text-muted-foreground",children:" -fsSL "}),t.jsx("span",{style:{color:"var(--syntax-string)"},children:"https://opencode.ai/v2/install"}),t.jsx("span",{className:"text-muted-foreground",children:" | "}),t.jsx("span",{style:{color:"var(--syntax-keyword)"},children:"bash"})]})}),e[0]=o,e[1]=i):i=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(F,{name:"file-copy",className:"h-4 w-4"}),e[2]=u):u=e[2];let a;e[3]!==n||e[4]!==r?(a=t.jsx("button",{onClick:r,className:"inline-flex items-center text-muted-foreground hover:text-foreground transition-colors shrink-0",title:n,"aria-label":n,children:u}),e[3]=n,e[4]=r,e[5]=a):a=e[5];let s;return e[6]!==i||e[7]!==a?(s=t.jsxs("div",{className:"flex items-center justify-between gap-3 w-full",children:[i,a]}),e[6]=i,e[7]=a,e[8]=s):s=e[8],s}function Ke({onCliAvailable:d,localAvailable:e=!0}){const{t:o}=te(),[r,n]=c.useState(!1),[i,u]=c.useState(!1),[a,s]=c.useState(!1),[h,x]=c.useState(!1),[m,U]=c.useState(""),R=he(l=>l.opencodeBinary),[y,b]=c.useState("unknown"),[g,S]=c.useState(()=>e?"local":"remote"),[C,T]=c.useState(!1),[I,D]=c.useState(!1);c.useEffect(()=>{u(Y())},[]),c.useEffect(()=>{if(typeof navigator>"u"){b("unknown");return}const l=navigator.userAgent||"";/Windows/i.test(l)?b("windows"):/Macintosh|Mac OS X/i.test(l)?b("macos"):/Linux/i.test(l)?b("linux"):b("unknown")},[]),c.useEffect(()=>{let l=!1;return(async()=>{try{const N=await xe();if(!N||l)return;const H=N.opencodeBinary??"";H&&U(H)}catch{}})(),()=>{l=!0}},[]);const w=c.useCallback(async l=>{const N=l.target;N.closest(".app-region-no-drag")||N.closest("button, a, input, select, textarea, code, summary, details")||l.button===0&&i&&await ge()},[i]),v=c.useCallback(async()=>{try{const l=await Z("/health");if(!l.ok)return!1;const N=await l.json();return N.openCodeRunning===!0||N.isOpenCodeReady===!0}catch{return!1}},[]),j=c.useCallback(async l=>{if(!i)return;const N=await X();await Q({...N,...l==="local"?{defaultHostId:"local"}:{},initialHostChoiceCompleted:!0})},[i]),k=c.useCallback(async()=>{i&&await j("local"),d?.()},[i,d,j]);c.useEffect(()=>{if(!e||g!=="local")return;let l=!1,N=null;const H=async()=>{if(!l){try{const _=await v();if(l)return;if(_){await k();return}}catch{}l||(N=setTimeout(H,me))}};return N=setTimeout(H,me),()=>{l=!0,N&&clearTimeout(N)}},[g,v,k,e]);const A=c.useCallback(async()=>{x(!0);try{await v()&&await k()}finally{x(!1)}},[v,k]),P=c.useCallback(async()=>{if(!(typeof window>"u")&&i)try{const l=await be();l.success&&l.path&&l.path.trim().length>0&&U(l.path.trim())}catch{}},[i]),$=c.useCallback(async()=>{s(!0);try{if(await ye({opencodeBinary:m.trim()}),i){await j("local"),await q();return}await Z("/api/config/reload",{method:"POST"})}finally{setTimeout(()=>s(!1),1e3)}},[i,m,j]),W=c.useCallback(async()=>{const l=await fe(y==="windows"?we:_e);l.ok?(n(!0),setTimeout(()=>n(!1),2e3)):console.error("Failed to copy:",l.error)},[y]),f=De,E=y==="windows"?"C:\\Users\\you\\AppData\\Roaming\\npm\\opencode.cmd":y==="linux"?"/home/you/.opencode/bin/opencode":"/Users/you/.opencode/bin/opencode",z=e&&(!i||g==="local");return t.jsx("div",{className:"app-region-drag h-full flex items-center justify-center bg-transparent p-8 cursor-default select-none overflow-y-auto",onMouseDown:w,children:t.jsxs("div",{className:"w-full max-w-md",children:[t.jsxs("header",{className:"flex flex-col items-center text-center",children:[t.jsx(Ne,{width:48,height:48}),t.jsx("h1",{className:"mt-6 text-xl font-semibold tracking-tight text-foreground",children:o("onboarding.chooser.title")}),t.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:o("onboarding.chooser.description")})]}),i&&e&&t.jsxs("div",{role:"tablist",className:"app-region-no-drag mt-7 flex gap-1 rounded-lg border border-border p-1",children:[t.jsx("button",{type:"button",role:"tab","aria-selected":g==="local",className:se("flex-1 rounded-md px-3 py-1.5 text-sm transition-colors",g==="local"?"bg-[var(--interactive-selection)] text-[var(--interactive-selection-foreground)]":"text-muted-foreground hover:text-foreground"),onClick:()=>S("local"),children:o("onboarding.chooser.tabs.localInstall")}),t.jsx("button",{type:"button",role:"tab","aria-selected":g==="remote",className:se("flex-1 rounded-md px-3 py-1.5 text-sm transition-colors",g==="remote"?"bg-[var(--interactive-selection)] text-[var(--interactive-selection-foreground)]":"text-muted-foreground hover:text-foreground"),onClick:()=>S("remote"),children:o("onboarding.chooser.tabs.connectRemote")})]}),i&&g==="remote"?t.jsx("div",{className:"app-region-no-drag mt-6",children:t.jsx(ve,{onBack:()=>e&&S("local"),showBackButton:!1,showInstancePicker:!e,onSwitchToLocal:e?()=>S("local"):void 0})}):null,z&&t.jsxs("div",{className:"mt-6",children:[y==="windows"&&t.jsxs("div",{className:"mb-4 rounded-lg border border-border p-4",children:[t.jsx("div",{className:"text-sm text-foreground",children:o("onboarding.localSetup.windows.title")}),t.jsxs("ol",{className:"mt-2 list-decimal space-y-1 ps-5 text-sm text-muted-foreground",children:[t.jsx("li",{children:o("onboarding.localSetup.windows.stepRunInstallInWsl")}),t.jsx("li",{children:o("onboarding.localSetup.windows.stepSetBinaryPath")})]})]}),t.jsx("p",{className:"text-center text-sm leading-relaxed text-muted-foreground text-balance",children:o("onboarding.localSetup.intro")}),t.jsx("div",{className:"app-region-no-drag mt-3 rounded-lg border border-border bg-background/60 px-4 py-3 font-mono text-sm",children:r?t.jsxs("div",{className:"flex items-center gap-2",style:{color:"var(--status-success)"},children:[t.jsx(F,{name:"check",className:"h-4 w-4"}),o("onboarding.common.status.copiedToClipboard")]}):t.jsx(Ae,{windows:y==="windows",onCopy:W,copyTitle:o("onboarding.common.copyToClipboard")})}),t.jsxs("div",{className:"app-region-no-drag mt-3 flex items-center gap-2.5 px-1",role:"status","aria-live":"polite",children:[t.jsx("span",{className:"relative inline-flex h-2 w-2 shrink-0","aria-hidden":!0,children:t.jsx("span",{className:"absolute inset-0 rounded-full",style:{backgroundColor:"var(--primary-base)",animation:"pulse-opacity 1.6s ease-in-out infinite"}})}),t.jsxs("span",{className:"min-w-0 flex-1 text-xs text-muted-foreground",children:[t.jsx("span",{className:"text-foreground",children:o("onboarding.localSetup.status.watching")})," · ",o("onboarding.localSetup.status.autoContinue")]}),t.jsx("button",{type:"button",onClick:A,disabled:h,className:"shrink-0 text-xs text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50",children:o(h?"onboarding.localSetup.actions.checking":"onboarding.localSetup.actions.checkNow")})]}),t.jsxs("div",{className:"mt-6 divide-y divide-border/60 border-y border-border/60",children:[t.jsxs("details",{className:"app-region-no-drag group",open:C,onToggle:l=>T(l.currentTarget.open),children:[t.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between py-3 text-sm text-muted-foreground transition-colors hover:text-foreground [&::-webkit-details-marker]:hidden",children:[t.jsx("span",{children:o("onboarding.localSetup.advanced.title")}),t.jsx(F,{name:"arrow-down-s",className:"h-4 w-4 transition-transform group-open:rotate-180"})]}),t.jsxs("div",{className:"space-y-2 pb-4",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsx(J,{value:R??m,onChange:l=>U(l.target.value),placeholder:E,disabled:a||R!==null,className:"flex-1 font-mono text-xs"}),R===null&&t.jsxs(t.Fragment,{children:[t.jsx(L,{type:"button",variant:"secondary",size:"sm",onClick:P,disabled:a||!i,children:o("onboarding.localSetup.actions.browse")}),t.jsx(L,{type:"button",size:"sm",onClick:$,disabled:a||!m.trim(),children:o("onboarding.localSetup.actions.apply")})]})]}),t.jsx("p",{className:"text-xs text-muted-foreground/70",children:o(R===null?"onboarding.localSetup.helper.saveAndReload":"onboarding.localSetup.helper.pinnedByAdministrator")})]})]}),t.jsxs("details",{className:"app-region-no-drag group",open:I,onToggle:l=>D(l.currentTarget.open),children:[t.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between py-3 text-sm text-muted-foreground transition-colors hover:text-foreground [&::-webkit-details-marker]:hidden",children:[t.jsx("span",{children:o("onboarding.localSetup.troubleshoot.title")}),t.jsx(F,{name:"arrow-down-s",className:"h-4 w-4 transition-transform group-open:rotate-180"})]}),t.jsx("ul",{className:"list-disc space-y-1.5 pb-4 ps-4 text-xs text-muted-foreground",children:y==="windows"?t.jsx("li",{children:o("onboarding.localSetup.windows.hintDetectionFailed")}):t.jsxs(t.Fragment,{children:[t.jsx("li",{children:o("onboarding.localSetup.hint.ensurePath")}),t.jsx("li",{children:o("onboarding.localSetup.hint.setEnv")}),t.jsx("li",{children:o("onboarding.localSetup.hint.missingRuntime")})]})})]})]}),t.jsx("div",{className:"app-region-no-drag mt-5 text-center",children:t.jsxs("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground",children:[o(y==="windows"?"onboarding.localSetup.docs.windows":"onboarding.localSetup.docs.default"),t.jsx(F,{name:"external-link",className:"h-3 w-3"})]})})]})]})})}const Ee="curl -fsSL https://opencode.ai/v2/install | bash",je="npm install -g @opencode/cli",Fe="https://opencode.ai/download";function He(d){const e=ee.c(9),{windows:o,onCopy:r,copyTitle:n}=d;let i;e[0]!==o?(i=t.jsx("code",{className:"flex-1 min-w-0 text-start overflow-x-auto whitespace-nowrap",children:o?t.jsx("span",{style:{color:"var(--syntax-keyword)"},children:je}):t.jsxs(t.Fragment,{children:[t.jsx("span",{style:{color:"var(--syntax-keyword)"},children:"curl"}),t.jsx("span",{className:"text-muted-foreground",children:" -fsSL "}),t.jsx("span",{style:{color:"var(--syntax-string)"},children:"https://opencode.ai/v2/install"}),t.jsx("span",{className:"text-muted-foreground",children:" | "}),t.jsx("span",{style:{color:"var(--syntax-keyword)"},children:"bash"})]})}),e[0]=o,e[1]=i):i=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(F,{name:"file-copy",className:"h-4 w-4"}),e[2]=u):u=e[2];let a;e[3]!==n||e[4]!==r?(a=t.jsx("button",{onClick:r,className:"inline-flex items-center text-muted-foreground hover:text-foreground transition-colors",title:n,"aria-label":n,children:u}),e[3]=n,e[4]=r,e[5]=a):a=e[5];let s;return e[6]!==i||e[7]!==a?(s=t.jsxs("div",{className:"flex items-center justify-center gap-3",children:[i,a]}),e[6]=i,e[7]=a,e[8]=s):s=e[8],s}const Me=3e4;function Oe({onBack:d,onCliAvailable:e,isFromRecovery:o=!1,onSwitchToRemote:r}){const{t:n}=te(),[i,u]=c.useState(!1),[a,s]=c.useState(!1),[h,x]=c.useState(!1),[m,U]=c.useState(!1),[R,y]=c.useState(!1),[b,g]=c.useState(null),[S,C]=c.useState(""),T=he(f=>f.opencodeBinary),[I,D]=c.useState("unknown");c.useEffect(()=>{const f=setTimeout(()=>s(!0),Me);return()=>clearTimeout(f)},[]),c.useEffect(()=>{x(Y())},[]),c.useEffect(()=>{if(typeof navigator>"u"){D("unknown");return}const f=navigator.userAgent||"";if(/Windows/i.test(f)){D("windows");return}if(/Macintosh|Mac OS X/i.test(f)){D("macos");return}if(/Linux/i.test(f)){D("linux");return}D("unknown")},[]),c.useEffect(()=>{let f=!1;return(async()=>{try{const E=await xe();if(!E||f)return;const z=E.opencodeBinary??"";z&&C(z)}catch{}})(),()=>{f=!0}},[]);const w=c.useCallback(async f=>{f.target.closest("button, a, input, select, textarea, code")||f.button===0&&h&&await ge()},[h]),v=c.useCallback(async()=>{try{const f=await Z("/health");if(!f.ok)return!1;const E=await f.json();return E.openCodeRunning===!0||E.isOpenCodeReady===!0}catch{return!1}},[]),j=c.useCallback(async()=>{if(!(typeof window>"u")&&h)try{const f=await be();f.success&&f.path&&f.path.trim().length>0&&C(f.path.trim())}catch{}},[h]),k=c.useCallback(async()=>{U(!0);try{if(await ye({opencodeBinary:S.trim()}),h){await q();return}await Z("/api/config/reload",{method:"POST"})}finally{setTimeout(()=>U(!1),1e3)}},[h,S]),A=c.useCallback(async()=>{const f=await fe(I==="windows"?je:Ee);f.ok?(u(!0),setTimeout(()=>u(!1),2e3)):console.error("Failed to copy:",f.error)},[I]),P=c.useCallback(async()=>{y(!0),g(null);try{await v()?e?.():g(n("onboarding.localSetup.errors.cliNotReady"))}catch(f){g(f instanceof Error?f.message:n("onboarding.localSetup.errors.detectionFailed"))}finally{y(!1)}},[v,e,n]),$=Fe,W=I==="windows"?"C:\\Users\\you\\AppData\\Roaming\\npm\\opencode.cmd":I==="linux"?"/home/you/.opencode/bin/opencode":"/Users/you/.opencode/bin/opencode";return t.jsxs("div",{className:"h-full flex items-center justify-center bg-transparent p-8 relative cursor-default select-none",onMouseDown:w,children:[t.jsxs("div",{className:"w-full max-w-lg space-y-4 text-center",children:[t.jsx("div",{className:"flex items-center",children:t.jsx(L,{variant:"ghost",onClick:d,className:"p-0 text-muted-foreground hover:text-foreground",children:n("onboarding.common.actions.back")})}),t.jsxs("div",{className:"space-y-4",children:[t.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-foreground",children:n("onboarding.localSetup.title")}),t.jsx("p",{className:"text-muted-foreground",children:n("onboarding.localSetup.description")})]}),I==="windows"&&t.jsxs("div",{className:"mx-auto max-w-2xl rounded-lg border border-border bg-background/50 p-4 text-start",children:[t.jsx("div",{className:"text-sm text-foreground",children:n("onboarding.localSetup.windows.title")}),t.jsxs("ol",{className:"mt-2 list-decimal space-y-1 ps-5 text-sm text-muted-foreground",children:[t.jsx("li",{children:n("onboarding.localSetup.windows.stepRunInstallInWsl")}),t.jsx("li",{children:n("onboarding.localSetup.windows.stepSetBinaryPath")})]})]}),t.jsx("div",{className:"flex justify-center",children:t.jsx("div",{className:"bg-background/60 backdrop-blur-sm border border-border rounded-lg px-5 py-3 font-mono text-sm w-fit",children:i?t.jsxs("div",{className:"flex items-center justify-center gap-2",style:{color:"var(--status-success)"},children:[t.jsx(F,{name:"check",className:"h-4 w-4"}),n("onboarding.common.status.copiedToClipboard")]}):t.jsx(He,{windows:I==="windows",onCopy:A,copyTitle:n("onboarding.common.copyToClipboard")})})}),t.jsxs("a",{href:$,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-muted-foreground hover:text-foreground transition-colors inline-flex items-center gap-1 justify-center",children:[n(I==="windows"?"onboarding.localSetup.docs.windows":"onboarding.localSetup.docs.default"),t.jsx(F,{name:"external-link",className:"h-3 w-3"})]}),b&&t.jsx("div",{className:"mx-auto max-w-md rounded-lg border border-destructive/50 bg-destructive/10 p-3 text-sm text-destructive",children:b}),t.jsxs("div",{className:"space-y-3",children:[t.jsx(L,{type:"button",onClick:P,disabled:R,className:"w-full max-w-xs",size:"lg",children:n(R?"onboarding.localSetup.actions.checking":"onboarding.localSetup.actions.checkAndContinue")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:n("onboarding.localSetup.helper.checkAndContinue")})]}),t.jsx("div",{className:"mx-auto w-full max-w-xl pt-4",children:t.jsxs("div",{className:"space-y-2",children:[t.jsx("div",{className:"text-sm text-muted-foreground",children:n("onboarding.localSetup.field.alreadyInstalled")}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(J,{value:T??S,onChange:f=>C(f.target.value),placeholder:W,disabled:m||T!==null,className:"flex-1 font-mono text-xs"}),T===null&&t.jsxs(t.Fragment,{children:[t.jsx(L,{type:"button",variant:"secondary",onClick:j,disabled:m||!h,children:n("onboarding.localSetup.actions.browse")}),t.jsx(L,{type:"button",onClick:k,disabled:m,children:n("onboarding.localSetup.actions.apply")})]})]}),t.jsx("div",{className:"text-xs text-muted-foreground/70",children:n(T===null?"onboarding.localSetup.helper.saveAndReload":"onboarding.localSetup.helper.pinnedByAdministrator")})]})}),o&&r&&t.jsxs("div",{className:"text-center pt-4",children:[t.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:n("onboarding.localSetup.remotePreference")}),t.jsx(L,{variant:"link",onClick:r,children:n("onboarding.localSetup.actions.connectRemoteServer")})]})]}),a&&t.jsx("div",{className:"absolute bottom-8 inset-s-0 inset-e-0 text-center space-y-1",children:I==="windows"?t.jsx(t.Fragment,{children:t.jsx("p",{className:"text-sm text-muted-foreground/70",children:n("onboarding.localSetup.windows.hintDetectionFailed")})}):t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-sm text-muted-foreground/70",children:n("onboarding.localSetup.hint.ensurePath")}),t.jsx("p",{className:"text-sm text-muted-foreground/70",children:n("onboarding.localSetup.hint.setEnv")}),t.jsx("p",{className:"text-sm text-muted-foreground/70",children:n("onboarding.localSetup.hint.missingRuntime")})]})})]})}function le(d,e){if(d?.trim())return ce(d.trim());if(e)return ce(e)}function Be(d,e,o){switch(d){case"local-unavailable":return{title:"Local OpenCode Unavailable",description:"OpenCode CLI could not be started or is not installed. Install OpenCode or connect to a remote server instead.",titleKey:"onboarding.desktopRecovery.localUnavailable.title",descriptionKey:"onboarding.desktopRecovery.localUnavailable.description",iconKey:"local",showRetry:!0,retryLabel:"Retry Local",retryLabelKey:"onboarding.desktopRecovery.localUnavailable.retry",showUseLocal:!0,showUseRemote:!0,useLocalLabel:"Set Up Local",useLocalLabelKey:"onboarding.desktopRecovery.localUnavailable.useLocal",useRemoteLabel:"Use Remote",useRemoteLabelKey:"onboarding.desktopRecovery.common.useRemote"};case"remote-missing":return{title:"No Default Connection",description:"Your saved default connection could not be found. Choose how you want to connect.",titleKey:"onboarding.desktopRecovery.noDefaultConnection.title",descriptionKey:"onboarding.desktopRecovery.noDefaultConnection.description",iconKey:"local",showRetry:!1,showUseLocal:!0,showUseRemote:!0,useLocalLabel:"Use Local",useLocalLabelKey:"onboarding.desktopRecovery.common.useLocal",useRemoteLabel:"Use Remote",useRemoteLabelKey:"onboarding.desktopRecovery.common.useRemote"};case"remote-unreachable":{const r=le(e,o);return{title:"Remote Server Unreachable",description:`Could not connect to "${r||"the remote server"}". Check your network connection and verify the server address.`,titleKey:"onboarding.desktopRecovery.remoteUnreachable.title",descriptionKey:"onboarding.desktopRecovery.remoteUnreachable.description",descriptionParams:r?{host:r}:void 0,iconKey:"remote",showRetry:!0,retryLabel:"Retry Connection",retryLabelKey:"onboarding.desktopRecovery.remoteUnreachable.retry",showUseLocal:!0,showUseRemote:!0,useLocalLabel:"Use Local",useLocalLabelKey:"onboarding.desktopRecovery.common.useLocal",useRemoteLabel:"Use Remote",useRemoteLabelKey:"onboarding.desktopRecovery.common.useRemote"}}case"remote-wrong-service":{const r=le(e,o);return{title:"Incompatible Server",description:`The server at "${r||"unknown"}" is not running OpenChamber. Verify the address points to an OpenChamber server.`,titleKey:"onboarding.desktopRecovery.incompatibleServer.title",descriptionKey:"onboarding.desktopRecovery.incompatibleServer.description",descriptionParams:r?{host:r}:void 0,iconKey:"remote",showRetry:!1,showUseLocal:!0,showUseRemote:!0,useLocalLabel:"Use Local",useLocalLabelKey:"onboarding.desktopRecovery.common.useLocal",useRemoteLabel:"Use Remote",useRemoteLabelKey:"onboarding.desktopRecovery.common.useRemote"}}case"remote-incompatible":{const r=le(e,o);return{title:"Server Update Required",description:`The OpenChamber server at "${r||"unknown"}" is not compatible with this app version. Update OpenChamber on the server, then try again.`,titleKey:"onboarding.desktopRecovery.remoteIncompatible.title",descriptionKey:"onboarding.desktopRecovery.remoteIncompatible.description",descriptionParams:r?{host:r}:void 0,iconKey:"remote",showRetry:!0,retryLabel:"Retry Connection",retryLabelKey:"onboarding.desktopRecovery.remoteUnreachable.retry",showUseLocal:!0,showUseRemote:!0,useLocalLabel:"Use Local",useLocalLabelKey:"onboarding.desktopRecovery.common.useLocal",useRemoteLabel:"Use Remote",useRemoteLabelKey:"onboarding.desktopRecovery.common.useRemote"}}case"missing-default-host":return{title:"No Default Connection",description:"Your saved default connection could not be found. Choose how you want to connect.",titleKey:"onboarding.desktopRecovery.noDefaultConnection.title",descriptionKey:"onboarding.desktopRecovery.noDefaultConnection.description",iconKey:"local",showRetry:!1,showUseLocal:!0,showUseRemote:!0,useLocalLabel:"Use Local",useLocalLabelKey:"onboarding.desktopRecovery.common.useLocal",useRemoteLabel:"Use Remote",useRemoteLabelKey:"onboarding.desktopRecovery.common.useRemote"};default:{const r=d;throw new Error(`Unknown recovery variant: ${r}`)}}}const Pe="openchamber update";function $e(d){const e=ee.c(17),{state:o}=d,{t:r}=te();if(o.kind==="idle"||o.kind==="updating")return null;let n;e[0]!==o.kind||e[1]!==r?(n=o.kind==="refused"?r("onboarding.desktopRecovery.remoteIncompatible.updateRefused"):o.kind==="auth"?r("onboarding.desktopRecovery.remoteIncompatible.updateAuth"):r("onboarding.desktopRecovery.remoteIncompatible.updateTimeout"),e[0]=o.kind,e[1]=r,e[2]=n):n=e[2];const i=n;let u;e[3]!==i?(u=t.jsx("p",{className:"typography-meta text-[var(--status-error)]",children:i}),e[3]=i,e[4]=u):u=e[4];let a;e[5]!==o.error||e[6]!==o.kind?(a=o.kind==="refused"&&o.error&&t.jsx("p",{className:"typography-meta text-muted-foreground",children:o.error}),e[5]=o.error,e[6]=o.kind,e[7]=a):a=e[7];let s;e[8]!==r?(s=r("onboarding.desktopRecovery.remoteIncompatible.manualUpdate"),e[8]=r,e[9]=s):s=e[9];let h;e[10]!==s?(h=t.jsx("p",{className:"typography-meta text-muted-foreground",children:s}),e[10]=s,e[11]=h):h=e[11];let x;e[12]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx("code",{className:"block select-text rounded-md border border-border bg-background/50 px-3 py-2 font-mono text-sm text-foreground",children:Pe}),e[12]=x):x=e[12];let m;return e[13]!==u||e[14]!==a||e[15]!==h?(m=t.jsxs("div",{className:"space-y-2",children:[u,a,h,x]}),e[13]=u,e[14]=a,e[15]=h,e[16]=m):m=e[16],m}function We(d){switch(d){case"local":return t.jsx(F,{name:"macbook",className:"h-8 w-8"});case"remote":return t.jsx(F,{name:"server",className:"h-8 w-8"})}}function ze({variant:d,hostLabel:e,hostUrl:o,onRetry:r,onUseLocal:n,onUseRemote:i,isRetrying:u=!1,onUpdateServer:a,serverUpdate:s={kind:"idle"}}){const h=s.kind==="updating",{t:x}=te(),m=Be(d,e,o),U=m.retryLabelKey??"onboarding.desktopRecovery.actions.retryConnection",R=c.useMemo(()=>{if(m.descriptionParams?.host)return m.descriptionParams;if(d==="remote-unreachable")return{host:x("onboarding.desktopRecovery.placeholders.remoteServer")};if(d==="remote-wrong-service"||d==="remote-incompatible")return{host:x("onboarding.desktopRecovery.placeholders.unknownServer")}},[m.descriptionParams,x,d]);return t.jsx("div",{className:"flex flex-col items-center justify-center h-full p-8",children:t.jsxs("div",{className:"w-full max-w-md space-y-6",children:[t.jsxs("div",{className:"flex flex-col items-center space-y-3 text-center",children:[t.jsx("div",{className:"p-3 rounded-full",style:{backgroundColor:"var(--status-warning)",opacity:.15},children:t.jsx("div",{style:{color:"var(--status-warning)"},children:We(m.iconKey)})}),t.jsx("h1",{className:"typography-ui-header text-xl font-semibold text-foreground",children:x(m.titleKey)}),t.jsx("p",{className:"text-muted-foreground text-sm max-w-sm",children:x(m.descriptionKey,R)})]}),o&&(d==="remote-unreachable"||d==="remote-wrong-service"||d==="remote-incompatible")&&t.jsxs("div",{className:"rounded-lg border border-border bg-background/50 p-3",children:[t.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:x("onboarding.remoteConnection.field.serverAddress")}),t.jsx("div",{className:"font-mono text-sm text-foreground truncate",children:ce(o)})]}),t.jsxs("div",{className:"flex flex-col gap-2",children:[a&&t.jsxs(t.Fragment,{children:[t.jsxs(L,{onClick:a,disabled:h||u,className:"w-full",children:[t.jsx(F,{name:h?"loader":"download",className:se("h-4 w-4",h&&"animate-spin")}),x(h?"onboarding.desktopRecovery.remoteIncompatible.updatingServer":"onboarding.desktopRecovery.remoteIncompatible.updateServer")]}),h&&t.jsx("p",{className:"typography-meta text-center text-muted-foreground",children:x("onboarding.desktopRecovery.remoteIncompatible.updatingHint")}),t.jsx($e,{state:s})]}),m.showRetry&&r&&t.jsxs(L,{onClick:r,disabled:u||h,variant:a?"outline":"default",className:"w-full",children:[t.jsx(F,{name:"refresh",className:se("h-4 w-4",u&&"animate-spin")}),x(u?"onboarding.desktopRecovery.actions.retrying":U)]}),t.jsxs("div",{className:"flex gap-2",children:[m.showUseLocal&&n&&t.jsxs(L,{variant:"outline",onClick:n,disabled:u||h,className:"flex-1",children:[t.jsx(F,{name:"macbook",className:"h-4 w-4"}),x(m.useLocalLabelKey)]}),m.showUseRemote&&i&&t.jsxs(L,{variant:"outline",onClick:i,disabled:u||h,className:"flex-1",children:[t.jsx(F,{name:"server",className:"h-4 w-4"}),x(m.useRemoteLabelKey)]})]})]})]})})}function pe(d,e){if(e==="use-remote")return{kind:"remote-form"};switch(d){case"local-unavailable":return{kind:"local-setup"};case"remote-unreachable":case"remote-incompatible":case"remote-wrong-service":case"remote-missing":case"missing-default-host":return{kind:"switch-default-to-local"};default:{const o=d;throw new Error(`Unhandled RecoveryVariant: ${o}`)}}}function Ve(d){const e=ee.c(39),{variant:o,hostUrl:r,hostLabel:n,hostId:i,onRetry:u,onChooseRemote:a,showRemoteForm:s,onCloseRemoteForm:h,onSwitchToLocalFromRemote:x,onEnterLocalSetup:m,isRetrying:U,localAvailable:R}=d,y=s===void 0?!1:s,b=U===void 0?!1:U,g=R===void 0?!0:R,S=Ye;let C;e[0]!==u?(C=async()=>{if(Y()){await q();return}await Z("/api/config/reload",{method:"POST"}),u?.()},e[0]=u,e[1]=C):C=e[1];const T=C;let I;e[2]!==m||e[3]!==o?(I=async()=>{if(pe(o,"use-local").kind==="local-setup"){m?.();return}if(await S("local"),Y()){await q();return}window.location.reload()},e[2]=m,e[3]=o,e[4]=I):I=e[4];const D=I;let w;e[5]===Symbol.for("react.memo_cache_sentinel")?(w={kind:"idle"},e[5]=w):w=e[5];const[v,j]=c.useState(w),[k,A]=c.useState(null);let P,$;e[6]!==i||e[7]!==o?(P=()=>{if(A(null),o!=="remote-incompatible"||!i||!Y())return;let _=!1;return X().then(M=>{const O=M.hosts.find(B=>B.id===i),G=Le(O?.apiUrl||O?.url||"");!_&&G&&A(i)}).catch(qe),()=>{_=!0}},$=[o,i],e[6]=i,e[7]=o,e[8]=P,e[9]=$):(P=e[8],$=e[9]),c.useEffect(P,$);let W;e[10]===Symbol.for("react.memo_cache_sentinel")?(W=async _=>{j({kind:"updating"});try{const M=await Ue(_);if(M.status==="auth"){j({kind:"auth"});return}if(M.status==="failed"){j({kind:"refused",error:M.error});return}if(await Ie(_)==="timeout"){j({kind:"timeout"});return}await q()||j({kind:"idle"})}catch{j({kind:"timeout"})}},e[10]=W):W=e[10];const f=W;let E;e[11]!==a||e[12]!==o?(E=()=>{pe(o,"use-remote").kind==="remote-form"&&a?.()},e[11]=a,e[12]=o,e[13]=E):E=e[13];const z=E;if(y){const _=o==="remote-wrong-service"?"":r||"",M=o==="remote-wrong-service"?"":n||"";let O;e[14]!==a||e[15]!==h?(O=h||(()=>a?.()),e[14]=a,e[15]=h,e[16]=O):O=e[16];const G=!g;let B;e[17]!==g||e[18]!==m||e[19]!==x?(B=g?x||(()=>{S("local").then(()=>{Y()?q():m?.()})}):void 0,e[17]=g,e[18]=m,e[19]=x,e[20]=B):B=e[20];let p;return e[21]!==M||e[22]!==_||e[23]!==O||e[24]!==G||e[25]!==B?(p=t.jsx(ve,{onBack:O,initialUrl:_,initialLabel:M,isRecoveryMode:!0,showInstancePicker:G,onSwitchToLocal:B}),e[21]=M,e[22]=_,e[23]=O,e[24]=G,e[25]=B,e[26]=p):p=e[26],p}const l=g?D:void 0;let N;e[27]!==k?(N=k?()=>{f(k)}:void 0,e[27]=k,e[28]=N):N=e[28];let H;return e[29]!==T||e[30]!==z||e[31]!==n||e[32]!==r||e[33]!==b||e[34]!==v||e[35]!==l||e[36]!==N||e[37]!==o?(H=t.jsx(ze,{variant:o,hostLabel:n,hostUrl:r,onRetry:T,onUseLocal:l,onUseRemote:z,isRetrying:b,onUpdateServer:N,serverUpdate:v}),e[29]=T,e[30]=z,e[31]=n,e[32]=r,e[33]=b,e[34]=v,e[35]=l,e[36]=N,e[37]=o,e[38]=H):H=e[38],H}function qe(){}async function Ye(d){if(!Y())return;const e=await X();await Q({...e,...d==="local"?{defaultHostId:"local"}:{},initialHostChoiceCompleted:!0})}function Co(d){const e=ee.c(30),{onBack:o,onCliAvailable:r,mode:n,recoveryVariant:i,recoveryHostUrl:u,recoveryHostLabel:a,recoveryHostId:s,onEnterLocalSetup:h,localAvailable:x}=d,m=n===void 0?"first-launch":n,U=i===void 0?"missing-default-host":i,R=x===void 0?!0:x,[y,b]=c.useState(!1),[g,S]=c.useState(!1);let C;e[0]===Symbol.for("react.memo_cache_sentinel")?(C=()=>{S(!1),b(!1)},e[0]=C):C=e[0];let T;e[1]!==m||e[2]!==a||e[3]!==u||e[4]!==U?(T=[m,U,u,a],e[1]=m,e[2]=a,e[3]=u,e[4]=U,e[5]=T):T=e[5],c.useEffect(C,T);const I=g?"local-setup":m;if(I==="recovery"){let w;e[6]===Symbol.for("react.memo_cache_sentinel")?(w=()=>b(!0),e[6]=w):w=e[6];let v,j;e[7]===Symbol.for("react.memo_cache_sentinel")?(v=()=>b(!1),j=()=>{b(!1),S(!0)},e[7]=v,e[8]=j):(v=e[7],j=e[8]);let k;e[9]!==h?(k=()=>{S(!0),h?.()},e[9]=h,e[10]=k):k=e[10];let A;return e[11]!==R||e[12]!==s||e[13]!==a||e[14]!==u||e[15]!==U||e[16]!==y||e[17]!==k?(A=t.jsx(Ve,{variant:U,hostUrl:u,hostLabel:a,hostId:s,onChooseRemote:w,showRemoteForm:y,onCloseRemoteForm:v,onSwitchToLocalFromRemote:j,onEnterLocalSetup:k,localAvailable:R}),e[11]=R,e[12]=s,e[13]=a,e[14]=u,e[15]=U,e[16]=y,e[17]=k,e[18]=A):A=e[18],A}if(I==="local-setup"){let w;e[19]!==o||e[20]!==g?(w=()=>{g?S(!1):o?.()},e[19]=o,e[20]=g,e[21]=w):w=e[21];let v;e[22]===Symbol.for("react.memo_cache_sentinel")?(v=()=>b(!0),e[22]=v):v=e[22];let j;return e[23]!==r||e[24]!==g||e[25]!==w?(j=t.jsx(Oe,{onBack:w,onCliAvailable:r,isFromRecovery:g,onSwitchToRemote:v}),e[23]=r,e[24]=g,e[25]=w,e[26]=j):j=e[26],j}let D;return e[27]!==R||e[28]!==r?(D=t.jsx(Ke,{onCliAvailable:r,localAvailable:R}),e[27]=R,e[28]=r,e[29]=D):D=e[29],D}export{Co as OnboardingScreen};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{f as y,j as i}from"./vendor-react-BUCujlKS.js";import{u as j,ak as v,z as S,l as O,E as b,D as T,q as w,t as N}from"./useAppFontEffects-C1ceAD51.js";import{u as C}from"./katex.min-C-51hS9A.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-base-ui-CXFyogip.js";import"./vendor-floating-ui-utils-D6FqdtJt.js";import"./vendor-floating-ui-dom-BTvzWks8.js";import"./vendor-floating-ui-core-PuGzNPnN.js";import"./vendor-floating-ui-react-dom-DxYCWdHj.js";import"./vendor-use-sync-external-store-D6wYuSt-.js";import"./vendor-zod-CVhJ1Zpv.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-zustand-BAGL70zf.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-dnd-kit-core-BZknOX2w.js";import"./vendor-dnd-kit-utilities-B_MdXhJC.js";import"./vendor-dnd-kit-accessibility-BHxJPORy.js";import"./vendor-dnd-kit-sortable-CsEagZ81.js";import"./vendor-tanstack-react-virtual-CvuLsk7D.js";import"./vendor-tanstack-virtual-core-DPaNcJcT.js";import"./vendor-framer-motion-DxDVhOLc.js";import"./vendor-motion-dom-HXPOMxb7.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-codemirror-commands-MmBpgSOc.js";import"./vendor-codemirror-state-Dek9sMtw.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-view-B66jUSmE.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-codemirror-language-DkBxRck3.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CDMHUZ74.js";import"./vendor-codemirror-streamparser-CmlTsbN2.js";import"./vendor-codemirror-lang-javascript-DmPuKUEa.js";import"./vendor-lezer-javascript-D7Tj24ot.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-BRKmCSiY.js";import"./vendor-codemirror-lang-json-L0wsFFxi.js";import"./vendor-lezer-json-Iaex0UN-.js";import"./vendor-codemirror-lang-css-DfdrZ848.js";import"./vendor-lezer-css-C5xB6jxd.js";import"./vendor-codemirror-lang-html-C5kFuJzc.js";import"./vendor-lezer-html-C0I1p52t.js";import"./vendor-codemirror-lang-markdown-CPn-qinN.js";import"./vendor-lezer-markdown-C6g-d6P3.js";import"./vendor-codemirror-language-data-CTYHXywt.js";import"./vendor-codemirror-lang-python-BAVa3Hg5.js";import"./vendor-lezer-python-CvuFxeZl.js";import"./vendor-sonner-DFyL3AvE.js";import"./vendor-capacitor-core-B4EWRrHz.js";import"./vendor-cmdk-DgLInKvT.js";import"./vendor-radix-ui-react-dialog-B94Bt2qq.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-DcAh5WdT.js";import"./vendor-radix-ui-react-context-Czxm7Z62.js";import"./vendor-radix-ui-react-id-f5BLKEVw.js";import"./vendor-radix-ui-react-use-layout-effect-D_3IhJdJ.js";import"./vendor-radix-ui-react-use-controllable-state-BFT5YmkA.js";import"./vendor-radix-ui-react-dismissable-layer-D7kXcwgJ.js";import"./vendor-radix-ui-react-primitive-DhVoX9SD.js";import"./vendor-radix-ui-react-slot-BQgQOasS.js";import"./vendor-radix-ui-react-use-callback-ref-BZPnuXAC.js";import"./vendor-radix-ui-react-use-escape-keydown-oph88g-F.js";import"./vendor-radix-ui-react-focus-scope-CiaxW4dD.js";import"./vendor-radix-ui-react-portal-BMJYHWck.js";import"./vendor-radix-ui-react-presence-CNxf-uq4.js";import"./vendor-radix-ui-react-focus-guards-B6qJXYua.js";import"./vendor-react-remove-scroll-DO7dCTnK.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-BcFYyj3E.js";import"./vendor-react-style-singleton-q6EMHnwf.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-zDC0RhA3.js";import"./vendor-use-callback-ref-D3RC8gqK.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-legendapp-list-BCBzRcfK.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";import"./vendor-opencode-client-DgOf1DP0.js";const so=()=>{const t=y.c(32),{t:o}=j(),x=C(k),D=C(E),e=C(_);let f;t[0]!==e||t[1]!==o?(f=async()=>{if(!e)return;if((await v(e)).ok){S.success(o("openCodeStatusDialog.toast.copiedTitle"),{description:o("openCodeStatusDialog.toast.copiedDescription")});return}S.error(o("openCodeStatusDialog.toast.copyFailed"))},t[0]=e,t[1]=o,t[2]=f):f=t[2];const h=f;let r;t[3]!==o?(r=o("openCodeStatusDialog.title"),t[3]=o,t[4]=r):r=t[4];let p;t[5]!==r?(p=i.jsx(O,{children:r}),t[5]=r,t[6]=p):p=t[6];let m;t[7]!==o?(m=o("openCodeStatusDialog.description"),t[7]=o,t[8]=m):m=t[8];let s;t[9]!==m?(s=i.jsx(b,{children:m}),t[9]=m,t[10]=s):s=t[10];let n;t[11]!==p||t[12]!==s?(n=i.jsxs(T,{children:[p,s]}),t[11]=p,t[12]=s,t[13]=n):n=t[13];let a;t[14]!==o?(a=o("openCodeStatusDialog.actions.copy"),t[14]=o,t[15]=a):a=t[15];let l;t[16]!==h||t[17]!==a?(l=i.jsx("div",{className:"flex items-center justify-end",children:i.jsx("button",{type:"button",onClick:h,className:"app-region-no-drag inline-flex h-8 items-center justify-center rounded-md px-3 typography-ui-label font-medium text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:a})}),t[16]=h,t[17]=a,t[18]=l):l=t[18];let u;t[19]!==e||t[20]!==o?(u=e||o("openCodeStatusDialog.empty.noData"),t[19]=e,t[20]=o,t[21]=u):u=t[21];let c;t[22]!==u?(c=i.jsx("pre",{className:"max-h-[60vh] overflow-auto rounded-lg bg-surface-muted p-4 typography-code text-foreground whitespace-pre-wrap",children:u}),t[22]=u,t[23]=c):c=t[23];let d;t[24]!==n||t[25]!==l||t[26]!==c?(d=i.jsxs(w,{className:"max-w-2xl",children:[n,l,c]}),t[24]=n,t[25]=l,t[26]=c,t[27]=d):d=t[27];let g;return t[28]!==x||t[29]!==D||t[30]!==d?(g=i.jsx(N,{open:x,onOpenChange:D,children:d}),t[28]=x,t[29]=D,t[30]=d,t[31]=g):g=t[31],g};function k(t){return t.isOpenCodeStatusDialogOpen}function E(t){return t.setOpenCodeStatusDialogOpen}function _(t){return t.openCodeStatusText}export{so as OpenCodeStatusDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dV as Q,dW as Y,dX as Z}from"./useAppFontEffects-
|
|
1
|
+
import{dV as Q,dW as Y,dX as Z}from"./useAppFontEffects-C1ceAD51.js";import{g as U,a as nn,p as en}from"./parseDiffFromFile--DE4eHIp.js";import{M as tn,G as rn,u as ln,W as on,a as un,b as R,n as z,c as H,t as sn}from"./Virtualizer-BP6uuKe_.js";import{j as c,r as f}from"./vendor-react-BUCujlKS.js";import{b as cn}from"./isDiffPlainText-C1F9opE5.js";import{V as fn,F as an}from"./pierreDiffTint-D9K6_CVD.js";function dn({hunkIndex:n,lineIndex:t,conflictIndex:e}){return`merge-conflict-action-${n}-${t}-${e}`}function hn(n,t){const e=t.hunks[n.hunkIndex];if(e!=null)return{hunkIndex:n.hunkIndex,lineIndex:pn(e,n.startContentIndex)}}function pn(n,t){let e=n.unifiedLineStart;for(let r=0;r<t;r++){const i=n.hunkContent[r];e+=i.type==="context"?i.lines:i.deletions+i.additions}return e}function mn(n){const t=Q(n);if(t.length!==1)throw console.error(t),new Error("PatchDiff: Provided patch must include only 1 patch, with 1 diff");const{files:e}=t[0];if(e.length!==1)throw console.error(e),new Error("FileDiff: Provided patch must contain exactly 1 file diff");return e[0]}function xn({fileDiff:n,actions:t,renderCustomHeader:e,renderHeaderPrefix:r,renderHeaderFilenameSuffix:i,renderHeaderMetadata:o,renderAnnotation:u,renderGutterUtility:a,renderMergeConflictUtility:w,lineAnnotations:A,getHoveredLine:g,getInstance:p,getAnnotationSlotName:S=U}){const E=e?.(n),D=r?.(n),x=i?.(n),F=o?.(n);return c.jsxs(c.Fragment,{children:[E!=null?c.jsx("div",{slot:Y,children:E}):c.jsxs(c.Fragment,{children:[D!=null&&c.jsx("div",{slot:"header-prefix",children:D}),x!=null&&c.jsx("div",{slot:"header-filename-suffix",children:x}),F!=null&&c.jsx("div",{slot:"header-metadata",children:F})]}),u!=null&&A?.map((s,m)=>c.jsx("div",{slot:S(s),children:u(s)},m)),t!=null&&w!=null&&p!=null&&t.map(s=>{if(s==null)return;const m=gn(s,n);return c.jsx("div",{slot:m,style:tn,children:w(s,p)},m)}),a!=null&&c.jsx("div",{slot:"gutter-utility-slot",style:rn,children:a(g)})]})}function gn(n,t){const e=hn(n,t);return e!=null?dn({hunkIndex:e.hunkIndex,lineIndex:e.lineIndex,conflictIndex:n.conflictIndex}):void 0}const En=typeof window>"u"?f.useEffect:f.useLayoutEffect;function Dn({fileDiff:n,oldFile:t,newFile:e,options:r,editorOptions:i,editStateKey:o,lineAnnotations:u,selectedLines:a,prerenderedHTML:w,metrics:A,hasGutterRenderUtility:g,hasCustomHeader:p,disableWorkerPool:S,edit:E,onEditChange:D,onEditComplete:x}){const F=ln(),s=a!==void 0,m=f.useContext(on),y=un(),[C,O]=f.useState(),_=R(l=>D?.(l)),P=D!=null?_:void 0,j=f.useRef(null),W=R(l=>{const I=x?.(l)??"reject";return I==="accept"&&(j.current={fileDiff:{installed:l.fileDiff,stale:l.originalFileDiff},filePair:n==null?{fileDiff:l.fileDiff,installed:{oldFile:l.oldFile,newFile:l.newFile},stale:{oldFile:t??null,newFile:e??null}}:null,annotations:{installed:l.lineAnnotations,stale:l.originalLineAnnotations}}),I}),L=x!=null?W:void 0,M=Fn({acceptedCache:j,fileDiff:n,newFile:e,oldFile:t,parseDiffOptions:r?.parseDiffOptions}),d=f.useRef(null),v=f.useRef(null),h=f.useRef(null),G=R(()=>{if(y==null)throw new Error("FileDiff: EditContext is not attached");return y("file-diff",i??{},o)}),X=R(l=>{if(l!=null){if(d.current!=null)throw new Error("useFileDiffInstance: An instance should not already exist when a node is created");F!=null?d.current=new fn(b({controlledSelection:s,hasCustomHeader:p,hasGutterRenderUtility:g,onEditChange:P,onEditComplete:L,options:r}),F,A,S?void 0:m,!0):d.current=new an(b({controlledSelection:s,hasCustomHeader:p,hasGutterRenderUtility:g,onEditChange:P,onEditComplete:L,options:r}),S?void 0:m,!0),d.current.hydrate({fileDiff:M,fileContainer:l,lineAnnotations:u,prerenderedHTML:w})}else{if(d.current==null)throw new Error("useFileDiffInstance: A FileDiff instance should exist when unmounting");h.current=null,d.current.cleanUp(),d.current=null,v.current=null}});En(()=>{const{current:l}=d;if(l==null)return;const I=b({controlledSelection:s,hasCustomHeader:p,hasGutterRenderUtility:g,onEditChange:P,onEditComplete:L,options:r}),K=I!==void 0&&!nn(l.options,I);if(l.setOptions(I),!E&&(h.current=null,v.current!=null)){const{current:V}=v;v.current=null,V()}const T=vn(M,u,j);if(l.render({forceRender:K,fileDiff:T.fileDiff,lineAnnotations:T.lineAnnotations}),a!==void 0&&l.setSelectedLines(a),!E||v.current!=null)return;if(y==null)throw new Error("FileDiff: EditContext is not attached");const q=()=>{d.current!==l||v.current!=null||!l.__canAttachEditor()||(v.current=wn(l,G))};if(l.__canAttachEditor()){h.current=null,q();return}const k=l.__prepareForEditing();if(k==null){h.current=null;return}if(h.current?.promise===k)return;const N={promise:k};h.current=N,k.then(()=>{h.current===N&&(q(),h.current=null)}).catch(V=>{h.current===N&&(h.current=null,O(V))})});const B=f.useCallback(()=>d.current?.getHoveredLine(),[]),J=f.useCallback(l=>d.current?.getAnnotationSlotName(l)??U(l),[]);if(C!=null)throw C;return{fileDiff:M,ref:X,getHoveredLine:B,getAnnotationSlotName:J}}function Fn({acceptedCache:n,fileDiff:t,newFile:e,oldFile:r,parseDiffOptions:i}){return f.useMemo(()=>{if(t!=null)return t;const{current:o}=n,u=o?.filePair;if(o!=null&&u!=null){if($(r,e,u.stale)||$(r,e,u.installed))return u.fileDiff;o.filePair=null}return en(r??null,e??null,i)},[n,t,r,e,i])}function $(n,t,e){return H(n??void 0,e.oldFile??void 0)&&H(t??void 0,e.newFile??void 0)}function vn(n,t,e){const{current:r}=e;if(r==null)return{fileDiff:n,lineAnnotations:t};const{fileDiff:i,annotations:o}=r;let u=n;i!=null&&(cn(n,i.stale)?u=i.installed:r.fileDiff=null);let a=t;return o!=null&&(t===o.stale?a=o.installed:r.annotations=null),r.fileDiff==null&&r.annotations==null&&r.filePair==null&&(e.current=null),{fileDiff:u,lineAnnotations:a}}function b({options:n,controlledSelection:t,hasCustomHeader:e,hasGutterRenderUtility:r,onEditChange:i,onEditComplete:o}){return t||r||e||i!=null||o!=null?{...n,controlledSelection:t,renderCustomHeader:e?z:n?.renderCustomHeader,renderGutterUtility:r?z:n?.renderGutterUtility,onEditChange:i,onEditComplete:o}:n}function wn(n,t){const e=t();try{return e.edit(n)}catch(r){throw e.cleanUp(),r}}function kn({patch:n,options:t,editorOptions:e,editStateKey:r,metrics:i,lineAnnotations:o,selectedLines:u,className:a,style:w,prerenderedHTML:A,renderAnnotation:g,renderCustomHeader:p,renderHeaderPrefix:S,renderHeaderFilenameSuffix:E,renderHeaderMetadata:D,renderGutterUtility:x,disableWorkerPool:F=!1,edit:s=!1,onEditChange:m,onEditComplete:y}){const C=An(n),{ref:O,getHoveredLine:_,getAnnotationSlotName:P}=Dn({fileDiff:C,options:t,editorOptions:e,editStateKey:r,metrics:i,lineAnnotations:o,selectedLines:u,prerenderedHTML:A,hasGutterRenderUtility:x!=null,hasCustomHeader:p!=null,disableWorkerPool:F,edit:s,onEditChange:m,onEditComplete:y}),j=xn({fileDiff:C,renderCustomHeader:p,renderHeaderPrefix:S,renderHeaderFilenameSuffix:E,renderHeaderMetadata:D,renderAnnotation:g,lineAnnotations:o,renderGutterUtility:x,getHoveredLine:_,getAnnotationSlotName:P});return c.jsx(Z,{ref:O,className:a,style:w,children:sn(j,A)})}function An(n){return f.useMemo(()=>mn(n),[n])}export{kn as P};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{R as j,j as z,c as Re,f as pt,r as p}from"./vendor-react-BUCujlKS.js";import{p as mt,a as gt}from"./parseDiffFromFile
|
|
1
|
+
import{R as j,j as z,c as Re,f as pt,r as p}from"./vendor-react-BUCujlKS.js";import{p as mt,a as gt}from"./parseDiffFromFile--DE4eHIp.js";import{a as Ge}from"./isDiffPlainText-C1F9opE5.js";import{P as yt,V as xt,F as vt}from"./pierreDiffTint-D9K6_CVD.js";import{V as Lt}from"./Virtualizer-DNgIEKcx.js";import{u as lt,a4 as wt,a5 as Xe,ar as bt,n as kt,L as Ye}from"./useAppFontEffects-C1ceAD51.js";import"./katex.min-C-51hS9A.js";import{I as Je,a as Rt,u as St}from"./useInlineCommentController-ynkUsoVA.js";import{p as Ct}from"./runtimeEndpointReset-ExJsaWzA.js";import{ensurePierreThemeRegistered as Qe,getResolvedShikiTheme as Ze}from"./appThemeRegistry-COeayQaQ.js";const Se=t=>{if(t.type==="new"){const e=Math.min(t.selection.start,t.selection.end),i=Math.max(t.selection.start,t.selection.end);return`new-comment-${t.selection.side??"additions"}-${e}-${i}`}return`draft-${t.draft.id}`},Et=t=>{const{drafts:e,editingDraftId:i,selection:r}=t,a=[];for(const d of e){if(!Number.isFinite(d.endLine))continue;const o=Math.max(1,Math.floor(d.endLine)),h=d.side==="original"?"deletions":"additions";a.push({lineNumber:o,side:h,metadata:{type:d.id===i?"edit":"saved",draft:d}})}return r&&!i&&a.push({lineNumber:Math.max(r.start,r.end),side:r.side??"additions",metadata:{type:"new",selection:r}}),a};function It(t){const e=t.trim();if(!e)return null;if(/^-?\d+(\.\d+)?$/.test(e)){const i=Number.parseFloat(e);return Number.isFinite(i)?i:null}if(e.endsWith("px")){const i=Number.parseFloat(e.slice(0,-2));return Number.isFinite(i)?i:null}return null}function et(t){if(!(!t||t<=0))return Math.max(200,Math.floor(t))}function Tt(t){const{diffRootRef:e,drafts:i,selection:r,editingDraftId:a,commentText:d,onTextChange:o,fileLabel:h,onSave:l,onCancel:f,onEdit:g,onDelete:v}=t,[M,E]=j.useState(0),[F,N]=j.useState(null),A=j.useMemo(()=>!r||a?null:Se({type:"new",selection:r}),[a,r]),B=j.useMemo(()=>{const m=i.map(S=>Se({type:S.id===a?"edit":"saved",draft:S}));return A&&m.push(A),m},[i,a,A]),_=j.useCallback(m=>{const S=e.current;if(!S)return null;const H=S.querySelector("diffs-container");if(!(H instanceof HTMLElement))return null;const O=H.querySelector(`[data-annotation-id="${m}"]`);if(O instanceof HTMLElement)return O;const W=H.shadowRoot;return W?W.querySelector(`[data-annotation-id="${m}"]`):null},[e]);j.useEffect(()=>{if(B.length===0)return;let m=!1,S=0;const H=12,O=()=>{m||B.every(P=>!!_(P))||S>=H||(S+=1,requestAnimationFrame(()=>{m||(E(P=>P+1),O())}))};return O(),()=>{m=!0}},[B,_]),j.useEffect(()=>{const m=e.current;if(!m)return;const S=()=>{const O=getComputedStyle(m),W=It(O.getPropertyValue("--oc-context-panel-width")),P=m.getBoundingClientRect(),D=W??P.width;N(D>0?D:null)};S();const H=new ResizeObserver(()=>{S()});return H.observe(m),window.addEventListener("resize",S),()=>{H.disconnect(),window.removeEventListener("resize",S)}},[e]);const V=j.useCallback(m=>{const H=e.current?.getBoundingClientRect(),O=m.closest("[data-annotation-content]"),W=O instanceof HTMLElement?O.getBoundingClientRect():m.getBoundingClientRect(),P=[W.width];H&&P.push(H.right-W.left);const D=P.filter(ie=>Number.isFinite(ie)&&ie>0);return D.length>0?et(Math.min(...D)):et(F)},[e,F]),ae=()=>{const m=e.current?.querySelector("diffs-container")?.shadowRoot,S=m?Array.from(m.querySelectorAll("[data-line][data-selected-line]")).at(-1):void 0;if(S)return getComputedStyle(S).getPropertyValue("--diffs-computed-selected-line-bg").trim()||void 0};return z.jsxs(z.Fragment,{children:[i.map(m=>{const S=Se({type:m.id===a?"edit":"saved",draft:m}),H=_(S);if(!H)return null;const O=V(H);return m.id===a?Re.createPortal(z.jsx(Je,{initialText:d,onTextChange:o,fileLabel:h,lineRange:{start:m.startLine,end:m.endLine,side:m.side==="original"?"deletions":"additions"},isEditing:!0,onSave:l,onCancel:f,maxWidth:O,bandColor:ae()}),H,`draft-edit-${m.id}`):Re.createPortal(z.jsx(Rt,{draft:m,onEdit:()=>g(m),onDelete:()=>v(m),maxWidth:O}),H,`draft-card-${m.id}`)}),r&&!a&&A&&(()=>{const m=_(A);if(!m)return null;const S=V(m);return Re.createPortal(z.jsx(Je,{initialText:d,onTextChange:o,fileLabel:h,lineRange:r,isEditing:!1,onSave:l,onCancel:f,maxWidth:S,bandColor:ae()}),m,A)})()]})}const $e=3,Mt=1e6,tt=new WeakMap,At=t=>{const e=tt.get(t);if(e)return e;let i=!1;const r=[];for(const d of t.hunks){const o=[];for(const h of d.hunkContent){if(h.type==="context"){ze(o,{...h});continue}const l=Pt(t,h);(l.length>1||l[0]?.type==="context")&&(i=!0);for(const f of l)ze(o,f)}r.push(...Nt(d,o))}const a=i?$t(t,r):t;return tt.set(t,a),a},nt=t=>t.replace(/\s+/g,""),Pt=(t,e)=>{if(e.deletions===0||e.additions===0)return[{...e}];const i=t.deletionLines.slice(e.deletionLineIndex,e.deletionLineIndex+e.deletions),r=t.additionLines.slice(e.additionLineIndex,e.additionLineIndex+e.additions),a=[];let d=0,o=0;for(const[h,l]of Ft(i,r))(h>d||l>o)&&a.push({type:"change",deletions:h-d,deletionLineIndex:e.deletionLineIndex+d,additions:l-o,additionLineIndex:e.additionLineIndex+o}),ze(a,{type:"context",lines:1,deletionLineIndex:e.deletionLineIndex+h,additionLineIndex:e.additionLineIndex+l}),d=h+1,o=l+1;return(d<e.deletions||o<e.additions)&&a.push({type:"change",deletions:e.deletions-d,deletionLineIndex:e.deletionLineIndex+d,additions:e.additions-o,additionLineIndex:e.additionLineIndex+o}),a},Ft=(t,e)=>{const i=t.map(nt),r=e.map(nt),a=[];let d=0;for(;d<i.length&&d<r.length&&i[d]===r[d];)a.push([d,d]),d+=1;let o=0;for(;o<i.length-d&&o<r.length-d&&i[i.length-1-o]===r[r.length-1-o];)o+=1;const h=i.length-d-o,l=r.length-d-o;if(h>0&&l>0&&(h+1)*(l+1)<=Mt){const f=l+1,g=new Uint32Array((h+1)*f);for(let E=h-1;E>=0;E-=1)for(let F=l-1;F>=0;F-=1)g[E*f+F]=i[d+E]===r[d+F]?g[(E+1)*f+F+1]+1:Math.max(g[(E+1)*f+F],g[E*f+F+1]);let v=0,M=0;for(;v<h&&M<l;)i[d+v]===r[d+M]?(a.push([d+v,d+M]),v+=1,M+=1):g[(v+1)*f+M]>=g[v*f+M+1]?v+=1:M+=1}for(let f=o;f>0;f-=1)a.push([i.length-f,r.length-f]);return a},ze=(t,e)=>{const i=t.at(-1);if(i?.type==="context"&&e.type==="context"){i.lines+=e.lines;return}t.push(e)},it=(t,e,i)=>({type:"context",lines:i,deletionLineIndex:t.deletionLineIndex+e,additionLineIndex:t.additionLineIndex+e}),Nt=(t,e)=>{const i=[];let r=null;for(const[d,o]of e.entries()){if(o.type==="change"){if(!r){r=[];const l=e[d-1];if(l?.type==="context"){const f=Math.min(l.lines,$e);r.push(it(l,l.lines-f,f))}}r.push(o);continue}if(!r)continue;if(d<e.length-1&&o.lines<=$e*2){r.push(o);continue}r.push(it(o,0,Math.min(o.lines,$e))),i.push(r),r=null}r&&i.push(r);const a=e.at(-1);return i.map(d=>{const o=d.at(-1),h=o!==void 0&&a!==void 0&&be(o,"deletion")===be(a,"deletion")&&be(o,"addition")===be(a,"addition");return Ht(t,d,h)})},be=(t,e)=>e==="deletion"?t.deletionLineIndex+(t.type==="context"?t.lines:t.deletions):t.additionLineIndex+(t.type==="context"?t.lines:t.additions),Ht=(t,e,i)=>{let r=0,a=0,d=0,o=0,h=0;for(const N of e)N.type==="context"?(d+=N.lines,o+=N.lines,h+=N.lines):(r+=N.additions,a+=N.deletions,o+=Math.max(N.additions,N.deletions),h+=N.additions+N.deletions);const l=e[0],f=d+r,g=d+a,v=rt(Ce(t.additionStart,t.additionCount)+l.additionLineIndex-t.additionLineIndex,f),M=rt(Ce(t.deletionStart,t.deletionCount)+l.deletionLineIndex-t.deletionLineIndex,g),F=l.additionLineIndex===t.additionLineIndex&&l.deletionLineIndex===t.deletionLineIndex?t.hunkContext:void 0;return{collapsedBefore:0,additionStart:v,additionCount:f,additionLines:r,additionLineIndex:l.additionLineIndex,deletionStart:M,deletionCount:g,deletionLines:a,deletionLineIndex:l.deletionLineIndex,hunkContent:e,hunkContext:F,hunkSpecs:`@@ -${M},${g} +${v},${f} @@${F?` ${F}`:""}
|
|
2
2
|
`,splitLineStart:0,splitLineCount:o,unifiedLineStart:0,unifiedLineCount:h,noEOFCRDeletions:i&&t.noEOFCRDeletions,noEOFCRAdditions:i&&t.noEOFCRAdditions}},Ce=(t,e)=>t-(e===0?0:1),rt=(t,e)=>t+(e===0?0:1),$t=(t,e)=>{let i=0,r=0,a=0;for(const o of e)o.collapsedBefore=Math.max(Ce(o.additionStart,o.additionCount)-a,0),o.splitLineStart=i+o.collapsedBefore,o.unifiedLineStart=r+o.collapsedBefore,i+=o.collapsedBefore+o.splitLineCount,r+=o.collapsedBefore+o.unifiedLineCount,a=Ce(o.additionStart,o.additionCount)+o.additionCount;if(e.at(-1)&&!t.isPartial&&t.additionLines.length>0&&t.deletionLines.length>0){const o=Math.max(t.additionLines.length-a,0);i+=o,r+=o}return{...t,...t.isPartial?Bt(t,e):{hunks:e},splitLineCount:i,unifiedLineCount:r,cacheKey:t.cacheKey===void 0?void 0:`${t.cacheKey}:hide-whitespace`}},Bt=(t,e)=>{const i=[],r=[],a=(o,h,l,f)=>{for(let g=l;g<l+f;g+=1)h.push(o[g])};return{hunks:e.map(o=>{const h=i.length,l=r.length,f=o.hunkContent.map(g=>{const v={...g,deletionLineIndex:i.length,additionLineIndex:r.length};return a(t.deletionLines,i,g.deletionLineIndex,g.type==="context"?g.lines:g.deletions),a(t.additionLines,r,g.additionLineIndex,g.type==="context"?g.lines:g.additions),v});return{...o,deletionLineIndex:h,additionLineIndex:l,hunkContent:f}}),deletionLines:i,additionLines:r}},zt=t=>t.replace(/\r?\n$/,""),Ot=(t,e,i)=>{if(!t.isPartial)return i-1;for(const r of t.hunks){const a=e==="additions"?r.additionStart:r.deletionStart,d=e==="additions"?r.additionCount:r.deletionCount;if(i<a||i>=a+d)continue;return(e==="additions"?r.additionLineIndex:r.deletionLineIndex)+(i-a)}return null},Dt=(t,e,i,r)=>{const a=e==="additions"?t.additionLines:t.deletionLines,d=[];for(let o=Math.max(1,i);o<=r;o+=1){const h=Ot(t,e,o),l=h===null?void 0:a[h];l!==void 0&&d.push(zt(l))}return d.join(`
|
|
3
3
|
`)},ot=[],qt=`
|
|
4
4
|
[data-gutter-buffer="annotation"] { min-height: 0; }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{R as t,j as n}from"./vendor-react-BUCujlKS.js";import{e as Pt,u as et,Y as ve,Z as Mt,_ as tt,l as nt,$ as Tt}from"./katex.min-
|
|
1
|
+
import{R as t,j as n}from"./vendor-react-BUCujlKS.js";import{e as Pt,u as et,Y as ve,Z as Mt,_ as tt,l as nt,$ as Tt}from"./katex.min-C-51hS9A.js";import{c as kt,s as Et,P as It,C as Nt}from"./shikiHighlight-DOzrE7BE.js";import{u as Dt,F as $,aa as Ft,an as Vt,a2 as rt,ao as Lt,ap as At,aq as Ot,ar as Kt,as as zt,at as Wt,au as _t,_ as st,av as Bt,aw as it,ax as $t,ay as Gt,az as ot,aA as Ht,aB as Jt,aC as Ut,aD as Yt,aE as at,T as ge,U as we,aF as lt,B as ee,I as G,V as Se,aG as ct,aH as te,ak as Qt,L as qt,n as Zt,aI as Xt,aJ as en,aK as tn}from"./useAppFontEffects-C1ceAD51.js";import{u as nn,n as rn}from"./useInlineCommentController-ynkUsoVA.js";import{b as sn,F as on}from"./FilePreviewCommentMenu-Ca4ziuof.js";import{getResolvedShikiTheme as an}from"./appThemeRegistry-COeayQaQ.js";import{E as ln}from"./vendor-codemirror-view-B66jUSmE.js";import{u as cn,C as un,T as dn}from"./runtimeEndpointReset-ExJsaWzA.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-zod-CVhJ1Zpv.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-zustand-BAGL70zf.js";import"./vendor-opencode-client-DgOf1DP0.js";import"./vendor-codemirror-state-Dek9sMtw.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-commands-MmBpgSOc.js";import"./vendor-codemirror-language-DkBxRck3.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CDMHUZ74.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-codemirror-streamparser-CmlTsbN2.js";import"./vendor-codemirror-search-BKAwkhkm.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-replit-codemirror-vim-D0bqFa1D.js";import"./vendor-replit-codemirror-vim-core-FHzKdNUS.js";import"./vendor-base-ui-CXFyogip.js";import"./vendor-floating-ui-utils-D6FqdtJt.js";import"./vendor-floating-ui-dom-BTvzWks8.js";import"./vendor-floating-ui-core-PuGzNPnN.js";import"./vendor-floating-ui-react-dom-DxYCWdHj.js";import"./vendor-use-sync-external-store-D6wYuSt-.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-dnd-kit-core-BZknOX2w.js";import"./vendor-dnd-kit-utilities-B_MdXhJC.js";import"./vendor-dnd-kit-accessibility-BHxJPORy.js";import"./vendor-dnd-kit-sortable-CsEagZ81.js";import"./vendor-tanstack-react-virtual-CvuLsk7D.js";import"./vendor-tanstack-virtual-core-DPaNcJcT.js";import"./vendor-framer-motion-DxDVhOLc.js";import"./vendor-motion-dom-HXPOMxb7.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-codemirror-lang-javascript-DmPuKUEa.js";import"./vendor-lezer-javascript-D7Tj24ot.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-BRKmCSiY.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-codemirror-lang-json-L0wsFFxi.js";import"./vendor-lezer-json-Iaex0UN-.js";import"./vendor-codemirror-lang-css-DfdrZ848.js";import"./vendor-lezer-css-C5xB6jxd.js";import"./vendor-codemirror-lang-html-C5kFuJzc.js";import"./vendor-lezer-html-C0I1p52t.js";import"./vendor-codemirror-lang-markdown-CPn-qinN.js";import"./vendor-lezer-markdown-C6g-d6P3.js";import"./vendor-codemirror-language-data-CTYHXywt.js";import"./vendor-codemirror-lang-python-BAVa3Hg5.js";import"./vendor-lezer-python-CvuFxeZl.js";import"./vendor-sonner-DFyL3AvE.js";import"./vendor-capacitor-core-B4EWRrHz.js";import"./vendor-cmdk-DgLInKvT.js";import"./vendor-radix-ui-react-dialog-B94Bt2qq.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-DcAh5WdT.js";import"./vendor-radix-ui-react-context-Czxm7Z62.js";import"./vendor-radix-ui-react-id-f5BLKEVw.js";import"./vendor-radix-ui-react-use-layout-effect-D_3IhJdJ.js";import"./vendor-radix-ui-react-use-controllable-state-BFT5YmkA.js";import"./vendor-radix-ui-react-dismissable-layer-D7kXcwgJ.js";import"./vendor-radix-ui-react-primitive-DhVoX9SD.js";import"./vendor-radix-ui-react-slot-BQgQOasS.js";import"./vendor-radix-ui-react-use-callback-ref-BZPnuXAC.js";import"./vendor-radix-ui-react-use-escape-keydown-oph88g-F.js";import"./vendor-radix-ui-react-focus-scope-CiaxW4dD.js";import"./vendor-radix-ui-react-portal-BMJYHWck.js";import"./vendor-radix-ui-react-presence-CNxf-uq4.js";import"./vendor-radix-ui-react-focus-guards-B6qJXYua.js";import"./vendor-react-remove-scroll-DO7dCTnK.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-BcFYyj3E.js";import"./vendor-react-style-singleton-q6EMHnwf.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-zDC0RhA3.js";import"./vendor-use-callback-ref-D3RC8gqK.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-legendapp-list-BCBzRcfK.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";import"./textMateThemeFromAppTheme-BfIrjFAU.js";import"./themeResolver-yJ9XpNMI.js";import"./vendor-pierre-theming-Dgp7B_O4.js";import"./vendor-shikijs-core-CGM_jqPK.js";import"./vendor-shikijs-types-CPSbSeK6.js";import"./vendor-shikijs-vscode-textmate-BgLrS_2D.js";import"./vendor-hast-util-to-html-BKBhbTDb.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-property-information-rJCbAzvX.js";import"./vendor-zwitch-C2o2j-tx.js";import"./vendor-stringify-entities-CsH1VEn9.js";import"./vendor-character-entities-legacy-BpoLgcEt.js";import"./vendor-character-entities-html4-D7taRCQ7.js";import"./vendor-ccount-c2V3InAJ.js";import"./vendor-comma-separated-tokens-D8TqSuIK.js";import"./vendor-space-separated-tokens-DD3iYX1K.js";import"./vendor-hast-util-whitespace-D4Wp6AEg.js";const mn=()=>{const l=new Map,d=new Map;return{schedule:(c,s,f)=>{if(s<=(d.get(c)??Number.NEGATIVE_INFINITY))return l.get(c)??Promise.resolve();d.set(c,s);const h=(l.get(c)??Promise.resolve()).then(f,f);return l.set(c,h.catch(()=>{d.get(c)===s&&d.delete(c)})),h},pendingFor:async c=>{await l.get(c)},reset:c=>{d.delete(c)}}},y=l=>{if(!l)return"";const d=l.replace(/\\/g,"/");return d==="/"?"/":d.replace(/\/+$/,"")},pn=(l,d)=>{const c=y(d.currentDirectory),s=y(d.homeDirectory),f=y(l);return c&&f.startsWith(c+"/")?f.slice(c.length+1):s&&f===s?"~":s&&f.startsWith(s+"/")?`~${f.slice(s.length)}`:f},fn=(l,d,c)=>{const s=y(l.trim());if(!s)return null;const f=c?d.find(h=>h.id===c)??null:null;if(f?.path){const h=y(f.path);if(s===h||s.startsWith(`${h}/`))return{id:f.id,path:f.path}}const j=d.filter(h=>{const P=y(h.path);return s===P||s.startsWith(`${P}/`)}).sort((h,P)=>y(P.path).length-y(h.path).length)[0];return j?{id:j.id,path:j.path}:null},hn=l=>Tt(()=>l()),hs=({targetPath:l=null,savedProjectPlan:d=null,onNavigatedToChat:c})=>{const{t:s}=Dt(),f=cn(),j=$(e=>e.currentSessionId),h=$(e=>e.createSession),P=$(e=>e.initializeNewOpenChamberSession),ye=$(e=>e.sendMessage),xe=$(e=>e.setCurrentSession),je=Ft(),H=Pt(e=>e.homeDirectory),Ce=Vt(e=>e.planModeEnabled),be=rt(e=>e.projects),Re=rt(e=>e.activeProjectId),Pe=Lt(e=>e.directories),Me=At()??"",Te=et(e=>e.setSessionSwitcherOpen),L=Ot(),A=t.useSyncExternalStore(hn,ve,ve),{isMobile:ke}=Kt(),{currentTheme:J}=zt(),ne=t.useMemo(()=>j?je.find(e=>e.id===j)??null:null,[j,je]),I=t.useMemo(()=>{const e=typeof ne?.directory=="string"?ne.directory:"";return y(e||"")},[ne?.directory]),Ee=t.useMemo(()=>y(Me||I),[Me,I]),O=t.useMemo(()=>fn(Ee,be,Re),[Re,Ee,be]),re=d?.projectRef.id??null,se=d?.projectRef.path??null,v=t.useMemo(()=>re&&se?{id:re,path:se}:null,[re,se]),C=d?.planId??null,K=v&&C?JSON.stringify(["saved-plan",A,Wt(v),C]):null,N=v?.id===Mt,U=t.useMemo(()=>{const e=v??O;return e?Pe.get(e.path)?.isGitRepo===!0:!1},[O,Pe,v]),[M,D]=t.useState(null),[Ie,Ne]=t.useState(!1),[u,z]=t.useState(null),[ie,oe]=t.useState(null),[ut,ae]=t.useState(null),dt=!!u||!!ie,le=t.useMemo(()=>!u||!I||!H?u:pn(u,{currentDirectory:I,homeDirectory:H}),[u,I,H]),[p,T]=t.useState(""),{isPlaying:Y,play:mt,stop:pt}=_t(),ft=st(e=>e.showMessageTTSButtons),[De,ce]=t.useState(null),[Fe,ue]=t.useState(null),de=t.useMemo(()=>le&&le.split("/").pop()||s("planView.file.defaultName"),[le,s]),Ve=u??ut??de,me=t.useMemo(()=>p.trim()?Bt(p,s("planView.title.default")).title:s("planView.title.default"),[p,s]),Q=t.useMemo(()=>me.trim()||s("planView.title.default"),[me,s]),[ht,W]=t.useState(!1),[vt,Le]=t.useState(!1),[q,Ae]=t.useState("edit"),_=t.useRef(null),[a,w]=t.useState(null),Oe=t.useRef(null),gt=t.useRef(null),Ke=t.useRef(null),ze="openchamber:plan:md-viewer-mode";t.useEffect(()=>{try{const e=localStorage.getItem(ze);if(!e)return;const i=JSON.parse(e);(i==="preview"||i==="edit")&&Ae(i)}catch{}},[]);const wt=t.useCallback(e=>{Ae(e);try{localStorage.setItem(ze,JSON.stringify(e))}catch{}},[]),F=t.useRef(!1),b=t.useRef(null),[We,V]=t.useState(!1);t.useEffect(()=>{const e=()=>{F.current=!1,b.current=null,V(!1)};return document.addEventListener("mouseup",e),()=>document.removeEventListener("mouseup",e)},[]);const St=t.useCallback((e,i)=>{const o=e.split(`
|
|
2
2
|
`),r=Math.max(1,i.start),m=Math.min(o.length,i.end);return r>m?"":o.slice(r-1,m).join(`
|
|
3
3
|
`)},[]),yt=nn({source:"plan",fileLabel:Ve,language:u&&it(u)||"markdown",getCodeForRange:e=>St(p,rn(e)),toStoreRange:e=>({startLine:e.start,endLine:e.end}),fromDraftRange:e=>({start:e.startLine,end:e.endLine})}),{drafts:_e,commentText:Z,setCommentText:Be,editingDraftId:pe,setSelection:$e,saveComment:Ge,cancel:B,reset:He,startEdit:Je,deleteDraft:Ue}=yt;t.useEffect(()=>{w(null),He()},[p,He]),t.useEffect(()=>{$e(a)},[a,$e]);const Ye=t.useCallback(()=>{w(null),B()},[B]),Qe=t.useCallback((e,i)=>{i&&w(i),Ge(e,i??a??void 0),w(null)},[a,Ge]);t.useEffect(()=>{if(!a)return;const e=o=>{const r=o.target;r.closest('[data-comment-card="true"]')||r.closest('[data-comment-input="true"]')||r.closest(".oc-block-widget")||r.closest(".cm-gutterElement")||r.closest("[data-sonner-toast]")||r.closest("[data-sonner-toaster]")||Z.trim()||(w(null),B())},i=window.setTimeout(()=>{document.addEventListener("click",e)},100);return()=>{window.clearTimeout(i),document.removeEventListener("click",e)}},[B,Z,pe,ke,a]);const fe=et(e=>e.editorFontSize),xt=t.useMemo(()=>{const e=u?it(u):null,i=!!e&&e!=="markdown",o=[kt(J,i?{syntaxColors:!1,fontSize:fe}:{fontSize:fe})],r=$t(u||"plan.md");return r&&o.push(r),i&&e&&o.push(Et({language:e,themeName:J.metadata.id,theme:an(J)})),o.push(ln.lineWrapping),o},[J,u,fe]),x=t.useRef({key:null,target:null,content:"",editRevision:0,savedRevision:0,runtimeKey:""}),k=t.useState(mn)[0],qe=t.useCallback(async(e,i)=>{if("filePath"in e){const r=L.files??tt()?.files;if(r?.writeFile){if(!(await r.writeFile(e.filePath,i))?.success)throw new Error("Plan file write failed");return}const m=await nt("/api/fs/write",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e.filePath,content:i})});if(!m.ok)throw new Error(`Failed to write plan file (${m.status})`);return}if(!await Gt.getState().savePlan(e.projectRef,e.planId,i))throw new Error("Plan save rejected: the plan no longer exists")},[L.files]),Ze=t.useRef(qe);Ze.current=qe;const E=t.useCallback(()=>{const e=x.current;if(!e.key||!e.target||e.editRevision<=e.savedRevision)return;const i={key:e.key,target:e.target,content:e.content,revision:e.editRevision,runtimeKey:e.runtimeKey,write:Ze.current};k.schedule(i.key,i.revision,async()=>{if(ve()!==i.runtimeKey)return;await i.write(i.target,i.content);const o=x.current;o.key===i.key&&(o.savedRevision=Math.max(o.savedRevision,i.revision),ce(null))}).catch(o=>{x.current.key===i.key&&ce(o instanceof Error?o.message:"Plan save failed")})},[k]);t.useEffect(()=>{if(!Ce&&!l&&!C){E(),x.current={key:null,target:null,content:"",editRevision:0,savedRevision:0,runtimeKey:""},z(null),oe(null),ae(null),T(""),W(!1);return}let e=!1;const i=async r=>{if(L.files?.readFile)return(await L.files.readFile(r))?.content??"";const m=tt()?.files;if(m?.readFile)return(await m.readFile(r,{optional:!0}))?.content??"";const g=await nt(`/api/fs/read?path=${encodeURIComponent(r)}&optional=true`,{cache:"no-store"});if(!g.ok)throw new Error(`Failed to read plan file (${g.status})`);return g.text()};return(async()=>{if(E(),x.current={key:null,target:null,content:"",editRevision:0,savedRevision:0,runtimeKey:""},z(null),oe(null),ae(null),T(""),ce(null),ue(null),C&&v&&K){if(await k.pendingFor(K),e)return;k.reset(K),W(!0);try{const r=await tn(v,C);if(e)return;if(!r){ue("Plan not found");return}x.current={key:K,target:{projectRef:v,planId:C},content:r.raw,editRevision:0,savedRevision:0,runtimeKey:A},T(r.raw),oe(C),ae(r.path??null)}catch(r){if(e)return;ue(r instanceof Error?r.message:"Plan load failed")}finally{e||W(!1)}return}if(l){const r=JSON.stringify(["plan-file",A,l]);if(await k.pendingFor(r),e)return;k.reset(r),W(!0);try{const m=await i(l);if(e)return;x.current={key:r,target:{filePath:l},content:m,editRevision:0,savedRevision:0,runtimeKey:A},z(l),T(m)}catch{if(e)return;z(null),T("")}finally{e||W(!1)}return}z(null),T("")})(),()=>{e=!0}},[A,H,Ce,L.files,C,K,v,k,E,I,l]);const jt=t.useCallback(e=>{x.current.content=e,x.current.editRevision+=1,T(e)},[]);t.useEffect(()=>{if(!u&&!ie)return;const e=window.setTimeout(()=>{E()},350);return()=>{window.clearTimeout(e)}},[p,ie,u,E]),t.useEffect(()=>()=>{E()},[E]),t.useEffect(()=>()=>{_.current!==null&&window.clearTimeout(_.current)},[]);const Xe=t.useCallback(()=>{Te(!1),c?.()},[c,Te]),Ct=t.useCallback(async e=>{const i=v??O;if(!i||!M||N)return;const o=await ot(M.action==="improve"?"plan.improve.visible":"plan.implement.visible",{plan_title:Q}),r=await ot(M.action==="improve"?"plan.improve.instructions":"plan.implement.instructions",{plan_title:Q,plan_path:u??""}),g=[{synthetic:!0,text:u?r:[r,"","The plan is not stored as a file in the repository and has no file path. Its full current contents follow below this note and are the source of truth for the plan. Where the instructions above refer to the plan file, treat the plan as stored in OpenChamber project knowledge (it is edited through the OpenChamber UI): propose plan revisions as plan text in the chat rather than editing a file.","",p].join(`
|
|
4
4
|
`)}];Ne(!0);try{Xe();let S=null,he=i.path;if(M.target==="worktree"){if(!U)return;const R=await Ht(i.path,Jt());if(!R?.id)return;S=R.id,he=R.path}else{const R=await h(void 0,i.path,void 0,{model:{providerID:e.providerID,id:e.modelID,variant:e.variant||void 0},agent:e.agent.trim()||void 0});if(!R?.id)return;S=R.id,he=R.directory??i.path,P(R.id,st.getState().agents??[])}if(!S)return;const X=Ut.getState();X.saveSessionModelSelection(S,e.providerID,e.modelID),e.agent.trim()&&(X.saveSessionAgentSelection(S,e.agent),X.saveAgentModelForSession(S,e.agent,e.providerID,e.modelID),X.saveAgentModelVariantForSession(S,e.agent,e.providerID,e.modelID,e.variant||void 0)),xe(S,he);const Rt=e.runAsGoal===!0?[`Implement the plan "${Q}" end-to-end${u?` (plan file: ${u})`:" (the full plan follows)"}.`,u?"Re-read that file for full details — it is the source of truth.":"The full plan follows in this message and is the source of truth.","",p].join(`
|
|
5
|
-
`):null;Yt.getState().setArmed(e.runAsGoal===!0,Rt),await ye(o,e.providerID,e.modelID,e.agent.trim()||void 0,void 0,void 0,g,e.variant||void 0),D(null)}finally{Ne(!1)}},[U,p,h,O,P,N,M,u,Xe,v,ye,Q,xe]),bt=t.useMemo(()=>sn({drafts:_e,editingDraftId:pe,commentText:Z,onTextChange:Be,selection:a,isDragging:We,fileLabel:de,newWidgetId:"plan-new-comment-input",mapDraftToRange:e=>({start:e.startLine,end:e.endLine}),onSave:Qe,onCancel:Ye,onEdit:e=>{Je(e),w({start:e.startLine,end:e.endLine})},onDelete:Ue}),[Z,Ue,pe,Ye,Qe,We,a,_e,de,Be,Je]);return n.jsxs("div",{className:"relative flex h-full min-h-0 min-w-0 w-full flex-col overflow-hidden bg-background",children:[n.jsx(un,{children:n.jsxs("div",{className:qt("flex min-w-0 items-center gap-2",f?"flex-1 py-1 pe-1":"border-b border-border/40 px-3 py-1.5 flex-shrink-0"),children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"typography-ui-label font-medium truncate",children:me}),Fe?n.jsx("div",{className:"typography-micro text-[color:var(--status-error)] truncate",title:Fe,children:s("planView.error.loadFailed")}):null,De?n.jsx("div",{className:"typography-micro text-[color:var(--status-error)] truncate",title:De,children:s("planView.error.saveFailed")}):null]}),dt?n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsxs(at,{children:[n.jsxs(ge,{children:[n.jsx(we,{asChild:!0,children:n.jsx(lt,{asChild:!0,children:n.jsx(ee,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0","aria-label":s("planView.actions.improvePlanAria"),disabled:!p.trim()||N,children:n.jsx(G,{name:"loop-right-ai",className:"size-4"})})})}),n.jsx(Se,{sideOffset:8,children:s("planView.actions.improve")})]}),n.jsxs(ct,{align:"end",children:[n.jsx(te,{onClick:()=>D({action:"improve",target:"session"}),disabled:N,children:s("planView.actions.sendToNewSession")}),n.jsx(te,{onClick:()=>D({action:"improve",target:"worktree"}),disabled:!U,children:s("planView.actions.sendToNewWorktreeSession")})]})]}),n.jsxs(at,{children:[n.jsxs(ge,{children:[n.jsx(we,{asChild:!0,children:n.jsx(lt,{asChild:!0,children:n.jsx(ee,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0","aria-label":s("planView.actions.implementPlanAria"),disabled:!p.trim()||N,children:n.jsx(G,{name:"code-ai",className:"size-4"})})})}),n.jsx(Se,{sideOffset:8,children:s("planView.actions.implement")})]}),n.jsxs(ct,{align:"end",children:[n.jsx(te,{onClick:()=>D({action:"implement",target:"session"}),disabled:N,children:s("planView.actions.sendToNewSession")}),n.jsx(te,{onClick:()=>D({action:"implement",target:"worktree"}),disabled:!U,children:s("planView.actions.sendToNewWorktreeSession")})]})]}),n.jsx(It,{currentMode:q,onToggle:()=>wt(q==="preview"?"edit":"preview")}),q==="preview"&&ft&&n.jsxs(ge,{children:[n.jsx(we,{asChild:!0,children:n.jsx(ee,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0","aria-label":s(Y?"planView.tts.stopSpeaking":"planView.tts.readAloud"),onClick:()=>{Y?pt():p.trim()&&mt(p)},children:n.jsx(G,{name:"volume-up",className:Y?"h-4 w-4 animate-pulse text-[var(--primary-text)]":"h-4 w-4"})})}),n.jsx(Se,{sideOffset:8,children:s(Y?"planView.tts.stopSpeaking":"planView.tts.readAloud")})]}),n.jsx(ee,{variant:"ghost",size:"sm",onClick:async()=>{(await Qt(p)).ok&&(Le(!0),_.current!==null&&window.clearTimeout(_.current),_.current=window.setTimeout(()=>{Le(!1)},1200))},className:"h-5 w-5 p-0",title:s("planView.actions.copyPlanContents"),"aria-label":s("planView.actions.copyPlanContents"),children:vt?n.jsx(G,{name:"check",className:"h-4 w-4 text-[color:var(--status-success)]"}):n.jsx(G,{name:"clipboard",className:"h-4 w-4"})})]}):null]})}),n.jsx(dn,{open:M!==null,onOpenChange:e=>{!e&&!Ie&&D(null)},target:M?.target??"session",projectDirectory:v?.path??O?.path??null,submitting:Ie,allowRunAsGoal:!0,onConfirm:Ct}),n.jsx("div",{className:"flex-1 min-h-0 min-w-0 relative",children:n.jsx(Zt,{outerClassName:"h-full min-w-0",className:"h-full min-w-0",children:ht?n.jsx("div",{className:"p-3 typography-ui text-muted-foreground",children:s("planView.state.loading")}):n.jsx("div",{className:"relative h-full",children:n.jsx("div",{className:"h-full",children:q==="preview"?n.jsxs("div",{className:"h-full overflow-auto p-3",ref:Ke,children:[n.jsx(on,{containerRef:Ke,filePath:Ve,fileContent:p}),n.jsx(Xt,{fallback:n.jsxs("div",{className:"rounded-md border border-destructive/20 bg-destructive/10 px-3 py-2",children:[n.jsx("div",{className:"mb-1 font-medium text-destructive",children:s("planView.error.previewUnavailable")}),n.jsx("div",{className:"text-sm text-muted-foreground",children:s("planView.error.switchToEditMode")})]}),children:n.jsx(en,{content:p,className:"typography-markdown-body",enableFileReferences:!1})})]}):n.jsx("div",{className:"relative h-full",ref:gt,children:n.jsx(Nt,{value:p,onChange:jt,readOnly:!1,className:"h-full",extensions:xt,onViewReady:e=>{Oe.current=e},onViewDestroy:()=>{Oe.current=null},blockWidgets:bt,highlightLines:a?{start:Math.min(a.start,a.end),end:Math.max(a.start,a.end)}:void 0,lineNumbersConfig:{domEventHandlers:{mousedown:(e,i,o)=>{if(!(o instanceof MouseEvent)||o.button!==0)return!1;o.preventDefault();const r=e.state.doc.lineAt(i.from).number;if(a&&!o.shiftKey&&Math.min(a.start,a.end)===r&&Math.max(a.start,a.end)===r)return w(null),B(),F.current=!1,b.current=null,V(!1),!0;if(ke&&a&&!o.shiftKey){const m=Math.min(a.start,a.end,r),g=Math.max(a.start,a.end,r);return w({start:m,end:g}),F.current=!1,b.current=null,V(!1),!0}if(F.current=!0,b.current=r,V(!0),a&&o.shiftKey){const m=Math.min(a.start,r),g=Math.max(a.end,r);w({start:m,end:g})}else w({start:r,end:r});return!0},mouseover:(e,i,o)=>{if(!(o instanceof MouseEvent)||o.buttons!==1||!F.current||b.current===null)return!1;const r=e.state.doc.lineAt(i.from).number,m=Math.min(b.current,r),g=Math.max(b.current,r);return w({start:m,end:g}),V(!0),!1},mouseup:()=>(F.current=!1,b.current=null,V(!1),!1)}}})})})})})})]})};export{
|
|
5
|
+
`):null;Yt.getState().setArmed(e.runAsGoal===!0,Rt),await ye(o,e.providerID,e.modelID,e.agent.trim()||void 0,void 0,void 0,g,e.variant||void 0),D(null)}finally{Ne(!1)}},[U,p,h,O,P,N,M,u,Xe,v,ye,Q,xe]),bt=t.useMemo(()=>sn({drafts:_e,editingDraftId:pe,commentText:Z,onTextChange:Be,selection:a,isDragging:We,fileLabel:de,newWidgetId:"plan-new-comment-input",mapDraftToRange:e=>({start:e.startLine,end:e.endLine}),onSave:Qe,onCancel:Ye,onEdit:e=>{Je(e),w({start:e.startLine,end:e.endLine})},onDelete:Ue}),[Z,Ue,pe,Ye,Qe,We,a,_e,de,Be,Je]);return n.jsxs("div",{className:"relative flex h-full min-h-0 min-w-0 w-full flex-col overflow-hidden bg-background",children:[n.jsx(un,{children:n.jsxs("div",{className:qt("flex min-w-0 items-center gap-2",f?"flex-1 py-1 pe-1":"border-b border-border/40 px-3 py-1.5 flex-shrink-0"),children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"typography-ui-label font-medium truncate",children:me}),Fe?n.jsx("div",{className:"typography-micro text-[color:var(--status-error)] truncate",title:Fe,children:s("planView.error.loadFailed")}):null,De?n.jsx("div",{className:"typography-micro text-[color:var(--status-error)] truncate",title:De,children:s("planView.error.saveFailed")}):null]}),dt?n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsxs(at,{children:[n.jsxs(ge,{children:[n.jsx(we,{asChild:!0,children:n.jsx(lt,{asChild:!0,children:n.jsx(ee,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0","aria-label":s("planView.actions.improvePlanAria"),disabled:!p.trim()||N,children:n.jsx(G,{name:"loop-right-ai",className:"size-4"})})})}),n.jsx(Se,{sideOffset:8,children:s("planView.actions.improve")})]}),n.jsxs(ct,{align:"end",children:[n.jsx(te,{onClick:()=>D({action:"improve",target:"session"}),disabled:N,children:s("planView.actions.sendToNewSession")}),n.jsx(te,{onClick:()=>D({action:"improve",target:"worktree"}),disabled:!U,children:s("planView.actions.sendToNewWorktreeSession")})]})]}),n.jsxs(at,{children:[n.jsxs(ge,{children:[n.jsx(we,{asChild:!0,children:n.jsx(lt,{asChild:!0,children:n.jsx(ee,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0","aria-label":s("planView.actions.implementPlanAria"),disabled:!p.trim()||N,children:n.jsx(G,{name:"code-ai",className:"size-4"})})})}),n.jsx(Se,{sideOffset:8,children:s("planView.actions.implement")})]}),n.jsxs(ct,{align:"end",children:[n.jsx(te,{onClick:()=>D({action:"implement",target:"session"}),disabled:N,children:s("planView.actions.sendToNewSession")}),n.jsx(te,{onClick:()=>D({action:"implement",target:"worktree"}),disabled:!U,children:s("planView.actions.sendToNewWorktreeSession")})]})]}),n.jsx(It,{currentMode:q,onToggle:()=>wt(q==="preview"?"edit":"preview")}),q==="preview"&&ft&&n.jsxs(ge,{children:[n.jsx(we,{asChild:!0,children:n.jsx(ee,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0","aria-label":s(Y?"planView.tts.stopSpeaking":"planView.tts.readAloud"),onClick:()=>{Y?pt():p.trim()&&mt(p)},children:n.jsx(G,{name:"volume-up",className:Y?"h-4 w-4 animate-pulse text-[var(--primary-text)]":"h-4 w-4"})})}),n.jsx(Se,{sideOffset:8,children:s(Y?"planView.tts.stopSpeaking":"planView.tts.readAloud")})]}),n.jsx(ee,{variant:"ghost",size:"sm",onClick:async()=>{(await Qt(p)).ok&&(Le(!0),_.current!==null&&window.clearTimeout(_.current),_.current=window.setTimeout(()=>{Le(!1)},1200))},className:"h-5 w-5 p-0",title:s("planView.actions.copyPlanContents"),"aria-label":s("planView.actions.copyPlanContents"),children:vt?n.jsx(G,{name:"check",className:"h-4 w-4 text-[color:var(--status-success)]"}):n.jsx(G,{name:"clipboard",className:"h-4 w-4"})})]}):null]})}),n.jsx(dn,{open:M!==null,onOpenChange:e=>{!e&&!Ie&&D(null)},target:M?.target??"session",projectDirectory:v?.path??O?.path??null,submitting:Ie,allowRunAsGoal:!0,onConfirm:Ct}),n.jsx("div",{className:"flex-1 min-h-0 min-w-0 relative",children:n.jsx(Zt,{outerClassName:"h-full min-w-0",className:"h-full min-w-0",children:ht?n.jsx("div",{className:"p-3 typography-ui text-muted-foreground",children:s("planView.state.loading")}):n.jsx("div",{className:"relative h-full",children:n.jsx("div",{className:"h-full",children:q==="preview"?n.jsxs("div",{className:"h-full overflow-auto p-3",ref:Ke,children:[n.jsx(on,{containerRef:Ke,filePath:Ve,fileContent:p}),n.jsx(Xt,{fallback:n.jsxs("div",{className:"rounded-md border border-destructive/20 bg-destructive/10 px-3 py-2",children:[n.jsx("div",{className:"mb-1 font-medium text-destructive",children:s("planView.error.previewUnavailable")}),n.jsx("div",{className:"text-sm text-muted-foreground",children:s("planView.error.switchToEditMode")})]}),children:n.jsx(en,{content:p,className:"typography-markdown-body",enableFileReferences:!1})})]}):n.jsx("div",{className:"relative h-full",ref:gt,children:n.jsx(Nt,{value:p,onChange:jt,readOnly:!1,className:"h-full",extensions:xt,onViewReady:e=>{Oe.current=e},onViewDestroy:()=>{Oe.current=null},blockWidgets:bt,highlightLines:a?{start:Math.min(a.start,a.end),end:Math.max(a.start,a.end)}:void 0,lineNumbersConfig:{domEventHandlers:{mousedown:(e,i,o)=>{if(!(o instanceof MouseEvent)||o.button!==0)return!1;o.preventDefault();const r=e.state.doc.lineAt(i.from).number;if(a&&!o.shiftKey&&Math.min(a.start,a.end)===r&&Math.max(a.start,a.end)===r)return w(null),B(),F.current=!1,b.current=null,V(!1),!0;if(ke&&a&&!o.shiftKey){const m=Math.min(a.start,a.end,r),g=Math.max(a.start,a.end,r);return w({start:m,end:g}),F.current=!1,b.current=null,V(!1),!0}if(F.current=!0,b.current=r,V(!0),a&&o.shiftKey){const m=Math.min(a.start,r),g=Math.max(a.end,r);w({start:m,end:g})}else w({start:r,end:r});return!0},mouseover:(e,i,o)=>{if(!(o instanceof MouseEvent)||o.buttons!==1||!F.current||b.current===null)return!1;const r=e.state.doc.lineAt(i.from).number,m=Math.min(b.current,r),g=Math.max(b.current,r);return w({start:m,end:g}),V(!0),!1},mouseup:()=>(F.current=!1,b.current=null,V(!1),!1)}}})})})})})})]})};export{hs as PlanView};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{f as le,R as I,j as s}from"./vendor-react-BUCujlKS.js";import{du as Ee,dv as Be,dw as Te,u as pe,_ as ae,L as Y,dx as $e,cn as Oe,bB as qe,cA as Ue,bG as Ke,bH as Ge,bI as Ve,bJ as We,I as F,dy as He,B as z,T as Se,U as Ie,V as Ce,bF as be,a2 as Je,W as _e,dz as Ye,dA as Qe,dB as Xe,dC as Ze,n as et,dD as ge,dE as je,dF as De,dG as Me,dH as tt,dI as st,z as V,dJ as nt,dK as rt,dL as it,F as Re,dM as ot}from"./useAppFontEffects-C1ceAD51.js";import{u as oe,n as ze}from"./katex.min-C-51hS9A.js";import{q as at,r as lt,s as Ae,t as ct,N as ut}from"./runtimeEndpointReset-ExJsaWzA.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-base-ui-CXFyogip.js";import"./vendor-floating-ui-utils-D6FqdtJt.js";import"./vendor-floating-ui-dom-BTvzWks8.js";import"./vendor-floating-ui-core-PuGzNPnN.js";import"./vendor-floating-ui-react-dom-DxYCWdHj.js";import"./vendor-use-sync-external-store-D6wYuSt-.js";import"./vendor-zod-CVhJ1Zpv.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-zustand-BAGL70zf.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-dnd-kit-core-BZknOX2w.js";import"./vendor-dnd-kit-utilities-B_MdXhJC.js";import"./vendor-dnd-kit-accessibility-BHxJPORy.js";import"./vendor-dnd-kit-sortable-CsEagZ81.js";import"./vendor-tanstack-react-virtual-CvuLsk7D.js";import"./vendor-tanstack-virtual-core-DPaNcJcT.js";import"./vendor-framer-motion-DxDVhOLc.js";import"./vendor-motion-dom-HXPOMxb7.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-codemirror-commands-MmBpgSOc.js";import"./vendor-codemirror-state-Dek9sMtw.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-view-B66jUSmE.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-codemirror-language-DkBxRck3.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CDMHUZ74.js";import"./vendor-codemirror-streamparser-CmlTsbN2.js";import"./vendor-codemirror-lang-javascript-DmPuKUEa.js";import"./vendor-lezer-javascript-D7Tj24ot.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-BRKmCSiY.js";import"./vendor-codemirror-lang-json-L0wsFFxi.js";import"./vendor-lezer-json-Iaex0UN-.js";import"./vendor-codemirror-lang-css-DfdrZ848.js";import"./vendor-lezer-css-C5xB6jxd.js";import"./vendor-codemirror-lang-html-C5kFuJzc.js";import"./vendor-lezer-html-C0I1p52t.js";import"./vendor-codemirror-lang-markdown-CPn-qinN.js";import"./vendor-lezer-markdown-C6g-d6P3.js";import"./vendor-codemirror-language-data-CTYHXywt.js";import"./vendor-codemirror-lang-python-BAVa3Hg5.js";import"./vendor-lezer-python-CvuFxeZl.js";import"./vendor-sonner-DFyL3AvE.js";import"./vendor-capacitor-core-B4EWRrHz.js";import"./vendor-cmdk-DgLInKvT.js";import"./vendor-radix-ui-react-dialog-B94Bt2qq.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-DcAh5WdT.js";import"./vendor-radix-ui-react-context-Czxm7Z62.js";import"./vendor-radix-ui-react-id-f5BLKEVw.js";import"./vendor-radix-ui-react-use-layout-effect-D_3IhJdJ.js";import"./vendor-radix-ui-react-use-controllable-state-BFT5YmkA.js";import"./vendor-radix-ui-react-dismissable-layer-D7kXcwgJ.js";import"./vendor-radix-ui-react-primitive-DhVoX9SD.js";import"./vendor-radix-ui-react-slot-BQgQOasS.js";import"./vendor-radix-ui-react-use-callback-ref-BZPnuXAC.js";import"./vendor-radix-ui-react-use-escape-keydown-oph88g-F.js";import"./vendor-radix-ui-react-focus-scope-CiaxW4dD.js";import"./vendor-radix-ui-react-portal-BMJYHWck.js";import"./vendor-radix-ui-react-presence-CNxf-uq4.js";import"./vendor-radix-ui-react-focus-guards-B6qJXYua.js";import"./vendor-react-remove-scroll-DO7dCTnK.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-BcFYyj3E.js";import"./vendor-react-style-singleton-q6EMHnwf.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-zDC0RhA3.js";import"./vendor-use-callback-ref-D3RC8gqK.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-legendapp-list-BCBzRcfK.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";import"./vendor-opencode-client-DgOf1DP0.js";const ye=Te(),Fe=Te(),dt={reply:{state:"loading"},diff:{state:"loading"}};function mt(a,e){const n=le.c(8);let o;n[0]===Symbol.for("react.memo_cache_sentinel")?(o=new Map,n[0]=o):o=n[0];const[y,v]=I.useState(o);let b;n[1]===Symbol.for("react.memo_cache_sentinel")?(b=new Map,n[1]=b):b=n[1];const j=I.useRef(b),h=I.useRef(!0);let x,N;n[2]===Symbol.for("react.memo_cache_sentinel")?(x=()=>(h.current=!0,()=>{h.current=!1}),N=[],n[2]=x,n[3]=N):(x=n[2],N=n[3]),I.useEffect(x,N);let l,f;return n[4]!==e||n[5]!==a?(l=()=>{const m=(u,g,p)=>{!h.current||j.current.get(u)!==g||v(w=>new Map(w).set(u,{...w.get(u)??dt,...p}))};for(const u of a){const g=u.session;if(!g||e.has(u.sessionId))continue;const p=ye.tokenFor(u.sessionId,`${g.time.idle??0}:${u.worktreePath??""}`);if(j.current.get(u.sessionId)===p)continue;j.current.set(u.sessionId,p);const w=ye.get(u.sessionId,p);w!==void 0?m(u.sessionId,p,{reply:{state:"ready",...w}}):Ee(u.sessionId,g.directory).then(c=>{ye.set(u.sessionId,p,c),m(u.sessionId,p,{reply:{state:"ready",...c}})},()=>m(u.sessionId,p,{reply:{state:"error"}}));const M=u.worktreePath;if(!M){m(u.sessionId,p,{diff:{state:"none"}});continue}const A=Fe.get(u.sessionId,p);A?m(u.sessionId,p,{diff:{state:"ready",stat:A}}):Be(M).then(c=>{Fe.set(u.sessionId,p,c),m(u.sessionId,p,{diff:{state:"ready",stat:c}})},()=>m(u.sessionId,p,{diff:{state:"error"}}))}},f=[e,a],n[4]=e,n[5]=a,n[6]=l,n[7]=f):(l=n[6],f=n[7]),I.useEffect(l,f),y}const ft=a=>{const e=le.c(36),{value:n,onChange:o,className:y,disabled:v,id:b,portalToBody:j}=a,{t:h}=pe(),x=ae(pt),N=ae(vt),l=ae(ht);let f;e[0]!==x?(f=x(),e[0]=x,e[1]=f):f=e[1];const m=f;let u;e[2]!==m?(u=m.filter(gt),e[2]=m,e[3]=u):u=e[3];const g=u;let p,w;e[4]!==m.length||e[5]!==N?(p=()=>{m.length===0&&N()},w=[m.length,N],e[4]=m.length,e[5]=N,e[6]=p,e[7]=w):(p=e[6],w=e[7]),I.useEffect(p,w);let M,A;e[8]!==l||e[9]!==v||e[10]!==o||e[11]!==g||e[12]!==n?(M=()=>{if(v)return;const U=n.trim();if(U.length>0&&g.some(L=>L.name===U))return;const $=typeof l=="string"&&l.trim().length>0?l.trim():null;if($&&g.some(L=>L.name===$)){o($);return}const O=g[0]?.name;O&&o(O)},A=[l,v,o,g,n],e[8]=l,e[9]=v,e[10]=o,e[11]=g,e[12]=n,e[13]=M,e[14]=A):(M=e[13],A=e[14]),I.useEffect(M,A);const c=n.trim().length>0?n:void 0;let D;e[15]!==y?(D=Y("max-w-full",y),e[15]=y,e[16]=D):D=e[16];let S;e[17]!==h?(S=h("multirun.agentSelector.placeholder"),e[17]=h,e[18]=S):S=e[18];let q;e[19]!==S?(q=s.jsx(Ke,{placeholder:S}),e[19]=S,e[20]=q):q=e[20];let E;e[21]!==b||e[22]!==D||e[23]!==q?(E=s.jsx(Ge,{id:b,className:D,children:q}),e[21]=b,e[22]=D,e[23]=q,e[24]=E):E=e[24];let C;e[25]!==g?(C=g.length>0&&s.jsx($e,{children:g.map(xt)}),e[25]=g,e[26]=C):C=e[26];let R;e[27]!==j||e[28]!==C?(R=s.jsx(Ve,{fitContent:!0,portalToBody:j,children:C}),e[27]=j,e[28]=C,e[29]=R):R=e[29];let B;return e[30]!==v||e[31]!==o||e[32]!==c||e[33]!==E||e[34]!==R?(B=s.jsxs(We,{value:c,onValueChange:o,disabled:v,children:[E,R]}),e[30]=v,e[31]=o,e[32]=c,e[33]=E,e[34]=R,e[35]=B):B=e[35],B};function pt(a){return a.getVisibleAgents}function vt(a){return a.loadAgents}function ht(a){return a.currentAgentName}function gt(a){return Oe(a.mode)}function xt(a){return s.jsx(qe,{value:a.name,className:"w-auto whitespace-nowrap",children:Ue(a)},a.name)}function wt(a){return a.blocking?a.blocking:a.busy?"working":a.session.outcome==="failed"?"failed":a.session.outcome==="interrupted"?"stopped":a.session.time.idle?a.reply?.state==="ready"&&!a.reply.text?"noReply":"finished":"notStarted"}const yt=["permission","question","failed","working","noReply","stopped","notStarted","finished"],bt={permission:"multirun.overview.status.count.permission",question:"multirun.overview.status.count.question",working:"multirun.overview.status.count.working",failed:"multirun.overview.status.count.failed",stopped:"multirun.overview.status.count.stopped",notStarted:"multirun.overview.status.count.notStarted",noReply:"multirun.overview.status.count.noReply",finished:"multirun.overview.status.count.finished"},jt={permission:"multirun.overview.status.permission",question:"multirun.overview.status.question",working:"multirun.overview.status.working",failed:"multirun.overview.status.failed",stopped:"multirun.overview.status.stopped",notStarted:"multirun.overview.status.notStarted",noReply:"multirun.overview.status.noReply",finished:"multirun.overview.status.finished"},Nt={permission:{name:"shield",className:"text-destructive"},question:{name:"question",className:"text-status-info"},working:{name:"loader-4",className:"animate-spin text-[var(--status-warning)]"},failed:{name:"error-warning",className:"text-[var(--status-error)]"},stopped:{name:"stop",className:"text-muted-foreground"},notStarted:{name:"time",className:"text-muted-foreground"},noReply:{name:"alert",className:"text-[var(--status-warning)]"},finished:{name:"checkbox-circle",className:"text-muted-foreground"}};function Pe(a){const e=le.c(13),{status:n,className:o}=a,{t:y}=pe(),v=Nt[n],b=jt[n];let j;e[0]!==y||e[1]!==b?(j=y(b),e[0]=y,e[1]=b,e[2]=j):j=e[2];const h=j,x=v.name;let N;e[3]!==o||e[4]!==v.className?(N=Y("size-3.5",v.className,o),e[3]=o,e[4]=v.className,e[5]=N):N=e[5];let l;e[6]!==v.name||e[7]!==h||e[8]!==N?(l=s.jsx(F,{name:x,className:N,"aria-label":h}),e[6]=v.name,e[7]=h,e[8]=N,e[9]=l):l=e[9];let f;return e[10]!==h||e[11]!==l?(f=s.jsx("span",{className:"inline-flex shrink-0",title:h,children:l}),e[10]=h,e[11]=l,e[12]=f):f=e[12],f}const kt=new Intl.NumberFormat(void 0,{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}),St=a=>{const e=Math.max(0,Math.round(a/1e3)),n=Math.floor(e/60),o=Math.floor(n/60);return o>0?`${o}h ${n%60}m`:n>0?`${n}m ${e%60}s`:`${e}s`};function It(a){const e=le.c(8),{session:n,busy:o}=a,[y,v]=I.useState(Ct);let b,j;e[0]!==o?(b=()=>{if(!o)return;v(Date.now());const m=window.setInterval(()=>v(Date.now()),1e3);return()=>window.clearInterval(m)},j=[o],e[0]=o,e[1]=b,e[2]=j):(b=e[1],j=e[2]),I.useEffect(b,j);const h=o?y:n.time.idle;if(!h)return null;let x;e[3]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(F,{name:"time",className:"size-3"}),e[3]=x):x=e[3];const N=h-n.time.created;let l;e[4]!==N?(l=St(N),e[4]=N,e[5]=l):l=e[5];let f;return e[6]!==l?(f=s.jsxs("span",{className:"inline-flex items-center gap-1",children:[x,l]}),e[6]=l,e[7]=f):f=e[7],f}function Ct(){return Date.now()}function Dt(a){const e=le.c(105),{session:n,providerID:o,modelLabel:y,variantLabel:v,isFusion:b,busy:j,status:h,unread:x,summary:N,fuseSource:l,hasWorktree:f,onToggleFuseSource:m,onKeep:u,onDetach:g,onArchive:p,actionsDisabled:w,onOpenChat:M,onOpenDiff:A}=a,{t:c}=pe(),D=N?.reply,S=N?.diff,q=l!==null&&!l.checked,E=D?.state==="ready"?D.text:"";let C;if(h==="permission"){let r;e[0]!==c?(r=c("multirun.overview.card.body.permission"),e[0]=c,e[1]=r):r=e[1];let d;e[2]!==r?(d=s.jsx("span",{className:"text-foreground",children:r}),e[2]=r,e[3]=d):d=e[3],C=d}else if(h==="question"){let r;e[4]!==c?(r=c("multirun.overview.card.body.question"),e[4]=c,e[5]=r):r=e[5];let d;e[6]!==r?(d=s.jsx("span",{className:"text-foreground",children:r}),e[6]=r,e[7]=d):d=e[7],C=d}else if(j){let r;e[8]!==c?(r=c("multirun.overview.card.working"),e[8]=c,e[9]=r):r=e[9];let d;e[10]!==r?(d=s.jsx("span",{className:"text-muted-foreground italic",children:r}),e[10]=r,e[11]=d):d=e[11],C=d}else if(h==="failed"){const r=D?.state==="ready"?D.error:null;let d;e[12]!==r||e[13]!==c?(d=r??c("multirun.overview.card.body.failed"),e[12]=r,e[13]=c,e[14]=d):d=e[14];let ie;e[15]!==d?(ie=s.jsx("span",{className:"text-[var(--status-error)]",children:d}),e[15]=d,e[16]=ie):ie=e[16],C=ie}else if(h==="notStarted"){let r;e[17]!==c?(r=c("multirun.overview.card.body.notStarted"),e[17]=c,e[18]=r):r=e[18];let d;e[19]!==r?(d=s.jsx("span",{className:"text-muted-foreground",children:r}),e[19]=r,e[20]=d):d=e[20],C=d}else if(!D||D.state==="loading"){let r;e[21]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("span",{className:"text-muted-foreground",children:"…"}),e[21]=r):r=e[21],C=r}else if(D.state==="error"){let r;e[22]!==c?(r=c("multirun.overview.card.replyUnavailable"),e[22]=c,e[23]=r):r=e[23];let d;e[24]!==r?(d=s.jsx("span",{className:"text-muted-foreground",children:r}),e[24]=r,e[25]=d):d=e[25],C=d}else if(E)C=E;else{let r;e[26]!==h||e[27]!==c?(r=c(h==="stopped"?"multirun.overview.card.body.stopped":"multirun.overview.card.noReply"),e[26]=h,e[27]=c,e[28]=r):r=e[28];let d;e[29]!==r?(d=s.jsx("span",{className:"text-muted-foreground",children:r}),e[29]=r,e[30]=d):d=e[30],C=d}let R=null;if(S?.state==="ready"){let r;e[31]!==S.stat.deletions||e[32]!==S.stat.files||e[33]!==S.stat.insertions||e[34]!==c?(r=S.stat.files===0?s.jsx("span",{children:c("multirun.overview.card.noChanges")}):s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsxs("span",{className:"text-[var(--status-success)]",children:["+",S.stat.insertions]}),s.jsxs("span",{className:"text-[var(--status-error)]",children:["−",S.stat.deletions]}),s.jsxs("span",{children:["· ",S.stat.files===1?c("multirun.overview.card.filesSingle",{count:S.stat.files}):c("multirun.overview.card.filesPlural",{count:S.stat.files})]})]}),e[31]=S.stat.deletions,e[32]=S.stat.files,e[33]=S.stat.insertions,e[34]=c,e[35]=r):r=e[35],R=r}else if(S?.state==="error"){let r;e[36]!==c?(r=c("multirun.overview.card.changesUnavailable"),e[36]=c,e[37]=r):r=e[37];let d;e[38]!==r?(d=s.jsx("span",{children:r}),e[38]=r,e[39]=d):d=e[39],R=d}const B=l?"checkbox":void 0,U=l?0:void 0,$=l?l.checked:void 0;let O;e[40]!==l||e[41]!==y||e[42]!==c?(O=l?c("multirun.overview.card.selectAria",{name:y}):void 0,e[40]=l,e[41]=y,e[42]=c,e[43]=O):O=e[43];const L=l?m:void 0;let T;e[44]!==l||e[45]!==m?(T=l?r=>{r.target===r.currentTarget&&(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),m())}:void 0,e[44]=l,e[45]=m,e[46]=T):T=e[46];const W=b&&"col-span-full min-h-0 border-[color-mix(in_srgb,var(--primary-base)_35%,transparent)]",ce=l&&"cursor-pointer",ue=l?.checked&&"border-[var(--primary-base)]",fe=q&&"opacity-50",Q=l&&!l.selectable&&"cursor-not-allowed";let X;e[47]!==fe||e[48]!==Q||e[49]!==W||e[50]!==ce||e[51]!==ue?(X=Y("relative flex min-h-[184px] flex-col gap-2 rounded-xl border p-3 text-start transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","bg-[var(--surface-elevated)] border-border hover:border-[var(--interactive-border-hover)]",W,ce,ue,fe,Q),e[47]=fe,e[48]=Q,e[49]=W,e[50]=ce,e[51]=ue,e[52]=X):X=e[52];let H;e[53]!==o?(H=s.jsx(be,{providerId:o,className:"h-4 w-4 shrink-0"}),e[53]=o,e[54]=H):H=e[54];let P;e[55]!==y?(P=s.jsx("span",{className:"min-w-0 truncate typography-ui-label font-semibold text-foreground",children:y}),e[55]=y,e[56]=P):P=e[56];let K;e[57]!==v?(K=v?s.jsx("span",{className:"shrink-0 rounded border border-border px-1 typography-micro text-muted-foreground",children:v}):null,e[57]=v,e[58]=K):K=e[58];let G;e[59]!==l||e[60]!==h||e[61]!==x?(G=s.jsx("span",{className:"ms-auto inline-flex shrink-0 items-center",children:l?s.jsx("span",{"aria-hidden":"true",className:Y("inline-flex size-4 items-center justify-center rounded border",l.checked?"border-[var(--primary-base)] bg-[var(--primary-base)] text-[var(--primary-foreground)]":"border-[var(--interactive-border-hover)]"),children:l.checked?s.jsx(F,{name:"check",className:"size-3"}):null}):s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[x&&h!=="working"?s.jsx(He,{state:"unread"}):null,s.jsx(Pe,{status:h})]})}),e[59]=l,e[60]=h,e[61]=x,e[62]=G):G=e[62];let Z;e[63]!==H||e[64]!==P||e[65]!==K||e[66]!==G?(Z=s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[H,P,K,G]}),e[63]=H,e[64]=P,e[65]=K,e[66]=G,e[67]=Z):Z=e[67];const J=b?"line-clamp-4":"line-clamp-5 flex-1";let ee;e[68]!==J?(ee=Y("typography-meta text-foreground",J,"whitespace-pre-line break-words"),e[68]=J,e[69]=ee):ee=e[69];let te;e[70]!==C||e[71]!==ee?(te=s.jsx("div",{className:ee,children:C}),e[70]=C,e[71]=ee,e[72]=te):te=e[72];let se;e[73]!==j||e[74]!==n?(se=s.jsx(It,{session:n,busy:j}),e[73]=j,e[74]=n,e[75]=se):se=e[75];let ne;e[76]!==n.cost?(ne=n.cost>0?s.jsx("span",{children:kt.format(n.cost)}):null,e[76]=n.cost,e[77]=ne):ne=e[77];let re;e[78]!==R||e[79]!==se||e[80]!==ne?(re=s.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 typography-micro text-muted-foreground",children:[R,se,ne]}),e[78]=R,e[79]=se,e[80]=ne,e[81]=re):re=e[81];let _;e[82]!==w||e[83]!==S||e[84]!==l||e[85]!==f||e[86]!==p||e[87]!==g||e[88]!==u||e[89]!==M||e[90]!==A||e[91]!==c?(_=l?null:s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsxs(z,{variant:"outline",size:"xs",onClick:r=>{r.stopPropagation(),M()},children:[s.jsx(F,{name:"chat-3",className:"size-3.5"}),c("multirun.overview.card.openChat")]}),u?s.jsxs(z,{variant:"outline",size:"xs",onClick:u,children:[s.jsx(F,{name:"check",className:"size-3.5"}),c("multirun.overview.card.keep")]}):null,f&&S?.state==="ready"&&S.stat.files>0?s.jsxs(z,{variant:"ghost",size:"xs",onClick:r=>{r.stopPropagation(),A()},children:[s.jsx(F,{name:"arrow-left-right",className:"size-3.5"}),c("multirun.overview.card.diff")]}):null,s.jsxs("span",{className:"ms-auto inline-flex items-center gap-0.5",children:[s.jsxs(Se,{children:[s.jsx(Ie,{asChild:!0,children:s.jsx(z,{variant:"ghost",size:"icon",className:"size-6 text-muted-foreground hover:text-foreground",disabled:w,"aria-label":c("multirun.overview.card.detach"),onClick:g,children:s.jsx(F,{name:"external-link",className:"size-3.5"})})}),s.jsx(Ce,{side:"top",children:c("multirun.overview.card.detachHint")})]}),s.jsxs(Se,{children:[s.jsx(Ie,{asChild:!0,children:s.jsx(z,{variant:"ghost",size:"icon",className:"size-6 text-muted-foreground hover:text-foreground",disabled:w,"aria-label":c("multirun.overview.card.archive"),onClick:p,children:s.jsx(F,{name:"inbox-archive",className:"size-3.5"})})}),s.jsx(Ce,{side:"top",children:c("multirun.overview.card.archive")})]})]})]}),e[82]=w,e[83]=S,e[84]=l,e[85]=f,e[86]=p,e[87]=g,e[88]=u,e[89]=M,e[90]=A,e[91]=c,e[92]=_):_=e[92];let de;return e[93]!==B||e[94]!==X||e[95]!==Z||e[96]!==U||e[97]!==te||e[98]!==re||e[99]!==_||e[100]!==$||e[101]!==O||e[102]!==L||e[103]!==T?(de=s.jsxs("div",{role:B,tabIndex:U,"aria-checked":$,"aria-label":O,onClick:L,onKeyDown:T,className:X,children:[Z,te,re,_]}),e[93]=B,e[94]=X,e[95]=Z,e[96]=U,e[97]=te,e[98]=re,e[99]=_,e[100]=$,e[101]=O,e[102]=L,e[103]=T,e[104]=de):de=e[104],de}const Le=(a,e)=>{const o=e.find(y=>y.id===a.identity.providerID)?.models.find(y=>y.id===a.identity.modelID)?.name||a.identity.modelID;return a.identity.index&&a.identity.index>1?`${o} #${a.identity.index}`:o};function Mt(a,e){const[n,o]=I.useState(new Map),y=I.useMemo(()=>{const v=new Map;for(const b of a?.lanes??[]){const j=je(b.identity.runGroup);v.has(j)||v.set(j,b.sessionId)}return v},[a?.lanes]);return I.useEffect(()=>{let v=!1;for(const[b,j]of y){const h=e.get(j);!h||n.has(b)||tt(j,h.directory).then(x=>{v||!x?.text||o(N=>new Map(N).set(b,x.text))},()=>{})}return()=>{v=!0}},[y]),n}function Rt(a){const e=le.c(15),{prompt:n,expanded:o,onToggle:y}=a,{t:v}=pe(),b=I.useRef(null),[j,h]=I.useState(!1);let x,N;e[0]!==o||e[1]!==n?(x=()=>{const g=b.current;if(!g||o)return;const p=()=>h(g.scrollWidth>g.clientWidth+1||n.includes(`
|
|
2
|
+
`));p();const w=new ResizeObserver(p);return w.observe(g),()=>w.disconnect()},N=[o,n],e[0]=o,e[1]=n,e[2]=x,e[3]=N):(x=e[2],N=e[3]),I.useLayoutEffect(x,N);const l=j||o;let f;e[4]!==o||e[5]!==n?(f=o?s.jsx("div",{className:"max-h-64 min-w-0 flex-1 overflow-y-auto whitespace-pre-wrap break-words rounded-md bg-[var(--surface-muted)] px-2 py-1.5 typography-meta text-foreground",children:n}):s.jsx("span",{ref:b,className:"min-w-0 flex-1 truncate typography-meta text-muted-foreground",children:n}),e[4]=o,e[5]=n,e[6]=f):f=e[6];let m;e[7]!==l||e[8]!==o||e[9]!==y||e[10]!==v?(m=l?s.jsxs("button",{type:"button",onClick:y,"aria-expanded":o,className:"inline-flex shrink-0 items-center gap-0.5 rounded px-1 typography-meta text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[v(o?"multirun.overview.prompt.collapse":"multirun.overview.prompt.expand"),s.jsx(F,{name:o?"arrow-up-s":"arrow-down-s",className:"size-3.5"})]}):null,e[7]=l,e[8]=o,e[9]=y,e[10]=v,e[11]=m):m=e[11];let u;return e[12]!==f||e[13]!==m?(u=s.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-1",children:[f,m]}),e[12]=f,e[13]=m,e[14]=u):u=e[14],u}function zt({runKey:a}){const{t:e}=pe(),{run:n,sessionById:o}=at(a),y=ae(t=>t.providers),v=ae(t=>t.currentProviderId),b=ae(t=>t.currentModelId),j=ae(t=>t.currentAgentName),h=Je(t=>t.projects),x=_e(t=>t.activeSessionIds),N=Ye(t=>t.bySession),l=Qe(t=>t.index.session.unseenCount),f=oe(t=>t.isMobile),[m,u]=I.useState({kind:"idle"}),[g,p]=I.useState(null),[w,M]=I.useState([]),[A,c]=I.useState(j??""),[D,S]=I.useState(null),[q,E]=I.useState(()=>new Set),[C,R]=I.useState(null),B=I.useMemo(()=>new Set(h.map(t=>ze(t.path)).filter(t=>!!t)),[h]),U=I.useMemo(()=>(n?.memberIds??[]).map(t=>{const i=o.get(t),k=ze(i?.directory);return{sessionId:t,session:i,worktreePath:k&&!B.has(k)?k:null}}),[B,n?.memberIds,o]),$=mt(U,x),O=Mt(n,o),L=I.useMemo(()=>new Map(U.map(t=>[t.sessionId,t.worktreePath])),[U]);if(I.useEffect(()=>{if(w.length>0)return;const t=n?.autoFusion,i=t?.providerID??v,k=t?.modelID??b;i&&k&&M([{providerID:i,modelID:k,variant:t?.variant,instanceId:Xe()}])},[b,v,w.length,n?.autoFusion]),!n)return s.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 p-8 text-center typography-meta text-muted-foreground",children:[e("multirun.overview.missing"),s.jsx(z,{variant:"outline",size:"sm",onClick:()=>oe.getState().closeMainSurfaces(),children:e("header.mainSurface.backToChat")})]});const T=n.lanes.map(t=>t.sessionId),W=T.filter(t=>!x.has(t)&&o.get(t)?.time.idle),ce=T.filter(t=>x.has(t)).length,ue=n.lanes.some(t=>L.get(t.sessionId)),fe=new Map([...n.lanes,...n.fusions].map(t=>[t.sessionId,t])),Q=t=>{const i=fe.get(t);return i?Le(i,y):""},X=n.autoFusion?.launcherId===Ze&&n.fusions.length===0,H=t=>{const i=o.get(t);if(!i)return null;const k=N.get(t);return wt({session:i,busy:x.has(t),blocking:k?.permissions.length?"permission":k?.forms.length?"question":null,reply:$.get(t)?.reply})},P=new Map;for(const t of T){const i=H(t);i&&P.set(i,(P.get(i)??0)+1)}const K=(P.get("permission")??0)+(P.get("question")??0),G=t=>{const i=o.get(t);oe.getState().closeMainSurfaces(),Re.getState().setCurrentSession(t,i?.directory??null)},Z=t=>{const i=L.get(t);G(t),i&&oe.getState().openContextPanelTab(i,{mode:"diff"})},J=m.kind==="fuse"?W.filter(t=>!m.excluded.has(t)):[],ee=lt(J.map(t=>{const i=$.get(t)?.diff;return{hasWorktree:!!L.get(t),diff:i?.state==="ready"?i.stat:null}})),te=t=>{if(m.kind!=="fuse"||!W.includes(t))return;const i=new Set(m.excluded);i.has(t)?i.delete(t):i.add(t),u({kind:"fuse",excluded:i})},se=async t=>{p("keep");try{const i=Q(t),k=await rt(n,t,o);k.failures.length>0?V.error(k.failures.length===1?e("multirun.overview.keep.partialSingle",{name:i,count:k.failures.length}):e("multirun.overview.keep.partialPlural",{name:i,count:k.failures.length})):V.success(e("multirun.overview.keep.done",{name:i})),G(t)}catch(i){console.error("[MultiRun] Keep failed",i),V.error(e("multirun.overview.keep.failed"))}finally{p(null),u({kind:"idle"})}},ne=async()=>{const t=w[0];if(!(!t||J.length<2)){p("fuse");try{await ct({run:n,sourceIds:J,judge:Ae({providerID:t.providerID,modelID:t.modelID,variant:t.variant,agent:A||void 0}),sessionById:o}),u({kind:"idle"})}catch(i){console.error("[MultiRun] Fusion failed to start",i),V.error(i instanceof ut?e("multirun.fusion.toast.noOutputs"):e("multirun.fusion.toast.failed"))}finally{p(null)}}},re=async(t,i)=>{p("ask");try{await it({run:n,runGroup:i,model:t,sessionById:o})}catch(k){console.error("[MultiRun] Could not add a lane",k),V.error(e("multirun.overview.ask.failed"))}finally{p(null)}},_=async t=>{if(S(null),!t.trim()||t.trim()===n.title)return;(await st(n,t,o)).length>0&&V.error(e("multirun.overview.rename.failed"))},de=async t=>{const i=o.get(t);if(i){p("member");try{await ot(i,n.title),V.success(e("multirun.overview.card.detachDone",{name:Q(t)}))}catch(k){console.error("[MultiRun] Could not detach a session",k),V.error(e("multirun.overview.card.detachFailed"))}finally{p(null)}}},r=async t=>{p("member");try{(await Re.getState().archiveSessions([t])).failedIds.length>0&&V.error(e("multirun.overview.archive.failed"))}finally{p(null)}},d=async()=>{p("archive");try{(await nt(n)).failedIds.length>0?V.error(e("multirun.overview.archive.failed")):oe.getState().closeMainSurfaces()}finally{p(null)}},ie=t=>{const i=o.get(t.sessionId);if(!i)return null;const k=t.identity.role==="fusion",me=W.includes(t.sessionId);return s.jsx(Dt,{session:i,providerID:t.identity.providerID,modelLabel:Le(t,y),variantLabel:!k&&n.variants.length>1?je(t.identity.runGroup):null,isFusion:k,busy:x.has(t.sessionId),status:H(t.sessionId)??"notStarted",unread:(l[t.sessionId]??0)>0,summary:$.get(t.sessionId),fuseSource:m.kind==="fuse"&&!k?{checked:me&&!m.excluded.has(t.sessionId),selectable:me}:null,hasWorktree:!!L.get(t.sessionId),onToggleFuseSource:()=>te(t.sessionId),onKeep:ue&&me&&m.kind==="idle"&&(!k||L.get(t.sessionId))?()=>u({kind:"keep",sessionId:t.sessionId}):void 0,onDetach:()=>{de(t.sessionId)},onArchive:()=>{r(t.sessionId)},actionsDisabled:g!==null||m.kind!=="idle",onOpenChat:()=>G(t.sessionId),onOpenDiff:()=>Z(t.sessionId)},t.sessionId)},Ne=t=>{const i=C&&C.runGroup===t?C.model:null;return i?s.jsxs("span",{className:"inline-flex flex-wrap items-center gap-1.5",children:[s.jsxs("span",{className:"inline-flex h-8 items-center gap-1.5 rounded-[9px] border border-border px-2.5 typography-meta text-foreground",children:[s.jsx(be,{providerId:i.providerID,className:"size-3.5"}),i.displayName||i.modelID]}),s.jsx(Me,{appearance:"trigger",providerID:i.providerID,modelID:i.modelID,variant:i.variant,onChange:k=>R({runGroup:t,model:{...i,variant:k}})}),s.jsx(z,{size:"sm",disabled:g!==null,onClick:()=>{R(null),re(i,t)},children:e("multirun.overview.addModel.confirm")}),s.jsx(z,{variant:"ghost",size:"icon",className:"size-8","aria-label":e("multirun.overview.cancel"),onClick:()=>R(null),children:s.jsx(F,{name:"close",className:"size-3.5"})})]}):s.jsx("span",{title:e("multirun.overview.addModel.hint"),children:s.jsx(De,{selectedModels:[],onAdd:k=>R({runGroup:t,model:k}),onRemove:()=>{},maxModels:1,showChips:!1,dropdownSide:"bottom",portal:!0,addButtonClassName:"h-8 min-h-8 px-2.5 typography-meta",addButtonLabel:e(g==="ask"?"multirun.overview.ask.working":"multirun.overview.addModel.action")})})},ke=f?"grid grid-cols-1 gap-2.5":"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-2.5",ve=m.kind==="keep"?m.sessionId:null,xe=n.memberIds.length-1;return s.jsxs("div",{className:"relative flex h-full flex-col",children:[s.jsx(et,{outerClassName:"flex-1 min-h-0",className:"h-full",children:s.jsxs("div",{className:Y("mx-auto w-full max-w-5xl pt-5",f?"px-4":"px-6",f&&m.kind==="fuse"?"pb-56":"pb-32"),children:[s.jsxs("div",{className:"flex items-start gap-2",children:[f?s.jsx(z,{variant:"ghost",size:"icon",className:"-ms-2 shrink-0","aria-label":e("header.mainSurface.backToChat"),onClick:()=>oe.getState().closeMainSurfaces(),children:s.jsx(F,{name:"arrow-left",className:"size-[18px]"})}):null,s.jsxs("div",{className:"min-w-0 flex-1",children:[D!==null?s.jsx("form",{onSubmit:t=>{t.preventDefault(),_(D)},children:s.jsx("input",{autoFocus:!0,value:D,onChange:t=>S(t.target.value),onBlur:()=>{_(D)},onKeyDown:t=>{t.key==="Escape"&&S(null)},"aria-label":e("multirun.overview.rename.aria"),className:"w-full rounded-md border border-border bg-transparent px-1.5 py-0.5 typography-heading-lg text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring"})}):s.jsx("button",{type:"button",onClick:()=>S(n.title),dir:"auto",className:"max-w-full truncate oc-ui-start-align typography-heading-lg text-foreground hover:underline decoration-dotted underline-offset-4",title:e("multirun.overview.rename.aria"),children:n.title}),s.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 typography-meta text-muted-foreground",children:[s.jsxs("span",{children:[n.lanes.length===1?e("multirun.overview.meta.runsSingle",{count:n.lanes.length}):e("multirun.overview.meta.runsPlural",{count:n.lanes.length}),n.variants.length>1?` · ${e("multirun.overview.meta.variants",{count:n.variants.length})}`:""]}),s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(F,{name:"git-branch",className:"size-3.5"}),e(ue?"multirun.overview.meta.worktrees":"multirun.overview.meta.sharedDirectory")]}),yt.map(t=>{const i=P.get(t)??0;return i===0?null:s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(Pe,{status:t}),e(bt[t],{count:i})]},t)}),X&&n.autoFusion?s.jsxs("span",{className:"inline-flex items-center gap-1 text-foreground",children:[s.jsx(ge,{className:"size-3.5 text-[var(--primary-base)]"}),e("multirun.overview.meta.autoFusion",{model:Ae(n.autoFusion).modelName??n.autoFusion.modelID})]}):null]})]}),!f&&n.variants.length===1?Ne(n.variants[0]):null,s.jsxs(z,{variant:"ghost",size:f?"icon":"sm",className:"shrink-0",disabled:g!==null,"aria-label":e("multirun.overview.archive.action"),onClick:()=>{d()},children:[s.jsx(F,{name:"inbox-archive",className:"size-4"}),f?null:e("multirun.overview.archive.action")]})]}),n.fusions.length>0?s.jsxs("section",{className:"mt-6",children:[s.jsxs("h2",{className:"mb-2 inline-flex items-center gap-1.5 typography-ui-label font-semibold text-foreground",children:[s.jsx(ge,{className:"size-4 text-[var(--primary-base)]"}),e("multirun.overview.fusedResult")]}),s.jsx("div",{className:ke,children:n.fusions.map(ie)})]}):null,n.variants.map(t=>{const i=je(t),k=n.lanes.filter(we=>we.identity.runGroup===t),me=O.get(i);return s.jsxs("section",{className:"mt-6",children:[s.jsxs("div",{className:"mb-2 flex min-w-0 items-start gap-2",children:[n.variants.length>1?s.jsx("span",{className:"shrink-0 rounded border border-border px-1.5 typography-meta font-semibold text-foreground",children:i}):null,me?s.jsx(Rt,{prompt:me,expanded:q.has(i),onToggle:()=>E(we=>{const he=new Set(we);return he.has(i)?he.delete(i):he.add(i),he})}):null,!f&&n.variants.length>1?s.jsx("span",{className:"ms-auto shrink-0",children:Ne(t)}):null]}),s.jsx("div",{className:ke,children:k.map(ie)})]},i)})]})}),s.jsx("div",{className:Y("pointer-events-none absolute inset-x-0 bottom-4 flex justify-center",f?"px-3":"px-6"),children:s.jsx("div",{className:"pointer-events-auto flex w-full max-w-4xl flex-wrap items-center gap-2 rounded-xl border border-[var(--interactive-border-hover)] bg-[var(--surface-elevated)] px-3 py-2 shadow-lg",children:ve?s.jsxs(s.Fragment,{children:[s.jsx(F,{name:"git-branch",className:"size-4 text-muted-foreground"}),s.jsx("span",{className:"min-w-0 flex-1 typography-meta text-foreground",children:xe===1?e("multirun.overview.keep.confirmSingle",{name:Q(ve),count:xe}):e("multirun.overview.keep.confirmPlural",{name:Q(ve),count:xe})}),s.jsx(z,{variant:"ghost",size:"sm",disabled:g!==null,onClick:()=>u({kind:"idle"}),children:e("multirun.overview.cancel")}),s.jsx(z,{size:"sm",disabled:g!==null,onClick:()=>{se(ve)},children:e(g==="keep"?"multirun.overview.keep.working":"multirun.overview.keep.confirm")})]}):m.kind==="fuse"?s.jsxs(s.Fragment,{children:[s.jsx(ge,{className:"size-4 text-[var(--primary-base)]"}),s.jsx("span",{className:"typography-meta text-foreground",children:e("multirun.overview.fuse.with")}),s.jsx(De,{selectedModels:w,onAdd:t=>M([t]),onUpdate:(t,i)=>M([i]),onRemove:()=>M([]),maxModels:1,showChips:!1,dropdownSide:"top",addButtonLabel:w[0]?w[0].displayName||w[0].modelID:e("multirun.fusion.model.placeholder"),triggerIcon:w[0]?s.jsx(be,{providerId:w[0].providerID,className:"me-1 size-3.5"}):void 0}),w[0]?s.jsx(Me,{appearance:"trigger",providerID:w[0].providerID,modelID:w[0].modelID,variant:w[0].variant,onChange:t=>M(i=>i.map(k=>({...k,variant:t})))}):null,s.jsx(ft,{value:A,onChange:c,className:"w-fit"}),s.jsx("span",{className:"typography-micro text-muted-foreground",children:e(ee==="code"?"multirun.overview.fuse.modeCode":"multirun.overview.fuse.modeAnswers")}),s.jsx("span",{className:"flex-1"}),s.jsx("span",{className:"typography-micro text-muted-foreground",children:e("multirun.overview.fuse.selected",{count:J.length,total:W.length})}),s.jsx(z,{variant:"ghost",size:"sm",disabled:g!==null,onClick:()=>u({kind:"idle"}),children:e("multirun.overview.cancel")}),s.jsx(z,{size:"sm",disabled:g!==null||J.length<2||w.length===0,onClick:()=>{ne()},children:e(g==="fuse"?"multirun.fusion.actions.starting":"multirun.fusion.actions.start")})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:Y("min-w-0 flex-1 truncate typography-meta",K>0?"text-foreground":"text-muted-foreground"),children:K>0?e("multirun.overview.bar.waiting",{count:K}):ce>0?e("multirun.overview.meta.progress",{done:T.length-ce,total:T.length}):e("multirun.overview.bar.hint")}),s.jsxs(z,{size:"sm",disabled:W.length<2||g!==null,onClick:()=>u({kind:"fuse",excluded:new Set}),children:[s.jsx(ge,{className:"size-4"}),e("multirun.overview.bar.fuse")]})]})})})]})}function cn(){const a=le.c(3),e=oe(At);if(!e)return null;let n;a[0]===Symbol.for("react.memo_cache_sentinel")?(n=Y("absolute inset-0 z-10 bg-background"),a[0]=n):n=a[0];let o;return a[1]!==e?(o=s.jsx("div",{className:n,children:s.jsx(zt,{runKey:e},e)}),a[1]=e,a[2]=o):o=a[2],o}function At(a){return a.runOverviewKey}export{cn as RunOverview};
|