@openchamber/web 2.7.1 → 2.7.2-canary.20261112.18
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-Byc63m0u.js → AboutDialog-CD63uz39.js} +1 -1
- package/dist/assets/{AboutLogo-BwwjES_b.js → AboutLogo-2kHLExbm.js} +1 -1
- package/dist/assets/{ArchiveView-DIg8Bq5r.js → ArchiveView-D9AL3G55.js} +1 -1
- package/dist/assets/{ChangeRequestDiffUnavailable-DtCWp1bf.js → ChangeRequestDiffUnavailable-BFaXu17a.js} +1 -1
- package/dist/assets/{CommandPalette-D1G7W43z.js → CommandPalette-wJg29t3M.js} +1 -1
- package/dist/assets/{DataFileArtifact-BPwh4rIZ.js → DataFileArtifact-B8OGvXN-.js} +1 -1
- package/dist/assets/{DiffView-B9-zXR21.js → DiffView-CAhUZy1p.js} +1 -1
- package/dist/assets/{FilesView-CTKhKCjC.js → FilesView-Bad_K4vM.js} +3 -3
- package/dist/assets/{GitView-2p131yFW.js → GitView-ESiTCDSw.js} +1 -1
- package/dist/assets/{GuestPanelContent-BY7I-Y-o.js → GuestPanelContent-BHcsCOcI.js} +1 -1
- package/dist/assets/{HelpDialog-BfDxlsKj.js → HelpDialog-CLkDLRCv.js} +1 -1
- package/dist/assets/{IntegrationsCatalogView-DX9AlNKS.js → IntegrationsCatalogView-CreW2QU2.js} +1 -1
- package/dist/assets/{JsonTreeView-Ghbn2jaO.js → JsonTreeView-CuPCB2B8.js} +1 -1
- package/dist/assets/{MarkdownDiffPreview-CcER_eYB.js → MarkdownDiffPreview-rDAnCu-X.js} +1 -1
- package/dist/assets/{MarkdownRendererImpl-DjBAwXof.js → MarkdownRendererImpl-BQO-q7Gs.js} +4 -4
- package/dist/assets/{MemoryDebugPanel-MrH6vI6i.js → MemoryDebugPanel-BA6eNPT5.js} +1 -1
- package/dist/assets/{NoteEditor-DnaXw3v6.js → NoteEditor-H5Z5TEv5.js} +1 -1
- package/dist/assets/{OfficeArtifact-av3so80I.js → OfficeArtifact-Dp7UZZNN.js} +2 -2
- package/dist/assets/{OfficeDocumentDiff-C-XvqPYx.js → OfficeDocumentDiff-Cm9lGPXQ.js} +1 -1
- package/dist/assets/{OnboardingScreen-Dlbi5e0G.js → OnboardingScreen-IeS_KnCh.js} +1 -1
- package/dist/assets/{OpenCodeStatusDialog-BZzdMaVU.js → OpenCodeStatusDialog-CGFzdIrc.js} +1 -1
- package/dist/assets/{OverviewView-CQ82APO2.js → OverviewView-C6HXytWH.js} +1 -1
- package/dist/assets/{PatchDiff-EZ_WbikC.js → PatchDiff-DxkfAF18.js} +1 -1
- package/dist/assets/{PlanView-jUry4bXu.js → PlanView-D8IoHTf_.js} +1 -1
- package/dist/assets/{ProjectActionsDialog-Bt6OXdLD.js → ProjectActionsDialog-BWduOyXA.js} +1 -1
- package/dist/assets/{ReplyCommand-CLNJlG5f.js → ReplyCommand-BjRiG3jU.js} +1 -1
- package/dist/assets/{ReplyUiBlock-DthlzVWC.js → ReplyUiBlock-B_mKHYbN.js} +1 -1
- package/dist/assets/{ReviewCards-qePUMD-z.js → ReviewCards-BnpUajD4.js} +1 -1
- package/dist/assets/{RunOverview-CvD2Q7KM.js → RunOverview-BQY-GREp.js} +1 -1
- package/dist/assets/{ScheduledTasksDialog-Dtdb6owf.js → ScheduledTasksDialog-CtlWd_VV.js} +1 -1
- package/dist/assets/{SettingsView-JBCXhydZ.js → SettingsView-CgbOYmvV.js} +1 -1
- package/dist/assets/{SettingsWindow-RJIA1rl5.js → SettingsWindow-ByKOH90R.js} +1 -1
- package/dist/assets/{SidebarSectionsManager-4i4NcHs0.js → SidebarSectionsManager-DqrV_u__.js} +1 -1
- package/dist/assets/{SourceBoardView-BuYJw-Sp.js → SourceBoardView-B0aGQnwC.js} +1 -1
- package/dist/assets/{SpaceAccessDialog-B4-bPo9e.js → SpaceAccessDialog-DMsJ-sxh.js} +1 -1
- package/dist/assets/{SpaceApplyDialog-DjTQ5PZT.js → SpaceApplyDialog-3UONCZIV.js} +1 -1
- package/dist/assets/{SpaceRow-CYk17vzn.js → SpaceRow-BJuduShI.js} +1 -1
- package/dist/assets/{SpaceSetupOutput-DRDEgMzx.js → SpaceSetupOutput-ro_nF8gr.js} +1 -1
- package/dist/assets/{SpacesView-BSt0xE6N.js → SpacesView-BqoY_SpZ.js} +1 -1
- package/dist/assets/{SubmoduleDiffSummary-CTwpN0TO.js → SubmoduleDiffSummary-NjPxpgMr.js} +1 -1
- package/dist/assets/{TableArtifact-BGTFUrHC.js → TableArtifact-oqOE37_Y.js} +1 -1
- package/dist/assets/{ToolOutputDialog-DcQ4eDvb.js → ToolOutputDialog-Bqv2rByf.js} +1 -1
- package/dist/assets/{ToolPartDiffPreview-idv0MY3G.js → ToolPartDiffPreview-SklZNjf9.js} +1 -1
- package/dist/assets/{UiBlock-CVYWc3Px.js → UiBlock-D3PdhNSP.js} +2 -2
- package/dist/assets/{UsageStatsView-Cgo61IDa.js → UsageStatsView-DM3iZLEy.js} +1 -1
- package/dist/assets/{WalkthroughView-CYr8y2pi.js → WalkthroughView-2TaZc0MB.js} +1 -1
- package/dist/assets/{WorktreesView-Duwvqggr.js → WorktreesView-aba8lY_x.js} +1 -1
- package/dist/assets/{appThemeRegistry-DgyhfFpu.js → appThemeRegistry-BrFExrgv.js} +1 -1
- package/dist/assets/{ar-zwtOisVI.js → ar-DuOBHgr_.js} +1 -1
- package/dist/assets/{codeHighlight-DQ8KOMKI.js → codeHighlight-mEwmnZVN.js} +1 -1
- package/dist/assets/{columnWidthMemory-Ol4D51DU.js → columnWidthMemory-NVG-9uFM.js} +1 -1
- package/dist/assets/{computeVirtualFileMetrics-P_6wH9ys.js → computeVirtualFileMetrics-DkXi0qX-.js} +2 -2
- package/dist/assets/{contextFileOpenGuard-9zXH1DLm.js → contextFileOpenGuard-DFp3E2Gd.js} +1 -1
- package/dist/assets/{date-time-CRucRasX.js → date-time-DRGzhBlp.js} +1 -1
- package/dist/assets/{de-5cm4El6N.js → de-DpOf_BMg.js} +1 -1
- package/dist/assets/{documentClient-BbTBnbCU.js → documentClient-UXIlVIAK.js} +2 -2
- package/dist/assets/{documentHost-Dxv6OV6h.js → documentHost-BWtn8iCI.js} +1 -1
- package/dist/assets/{editorCodeMetrics-BzYZ4PzQ.js → editorCodeMetrics-BaoTimWj.js} +1 -1
- package/dist/assets/{es-CYh9u5rf.js → es-BextOZlH.js} +1 -1
- package/dist/assets/{fileContentPoller-p6RiDNz7.js → fileContentPoller-BV7Knoib.js} +1 -1
- package/dist/assets/{flexokiTheme-BNUmLj3l.js → flexokiTheme-tyakPldH.js} +1 -1
- package/dist/assets/{fr-gZGCwYzk.js → fr-BJEccZsE.js} +1 -1
- package/dist/assets/{he-DWb3dvEl.js → he-9oI-aOhB.js} +1 -1
- package/dist/assets/{highlights-DWR6MS75.js → highlights-8Aapk9tv.js} +1 -1
- package/dist/assets/{index-BcEWRtz8.js → index-D0ue7E3H.js} +1 -1
- package/dist/assets/{initializeSharedPreferences-u4U22OVN.js → initializeSharedPreferences-DNUHFeIw.js} +1 -1
- package/dist/assets/{install-request-C0o_6GEa.js → install-request-DI6T7dQX.js} +1 -1
- package/dist/assets/{install-CkKsKExH.js → install-s_PIiJvM.js} +1 -1
- package/dist/assets/{isDiffPlainText-B70cjgtm.js → isDiffPlainText-BcgZ-0g8.js} +1 -1
- package/dist/assets/{isFilePlainText-DNNat5m3.js → isFilePlainText-DCv6hsjs.js} +1 -1
- package/dist/assets/{ja-CAeb9wyo.js → ja-Bf_2zWyq.js} +1 -1
- package/dist/assets/{katex.min-2cmqKX7p.js → katex.min-CAwHaRYk.js} +4 -4
- package/dist/assets/{ko-DuYqVIuP.js → ko-BAGf67hm.js} +1 -1
- package/dist/assets/{main-kUMMbMdC.js → main-CZBlb0Vm.js} +4 -4
- package/dist/assets/{main-D9Ri_lHo.js → main-g_cZWPOo.js} +2 -2
- package/dist/assets/{miniChat-HoE2mQuK.js → miniChat-jzqDFSB-.js} +2 -2
- package/dist/assets/{mobile-BFQ0eaJT.js → mobile-4zqwQ7Sj.js} +2 -2
- package/dist/assets/{moveWorkspacePath-BkzUq9fV.js → moveWorkspacePath-D4BOjl1P.js} +1 -1
- package/dist/assets/{nl-BPlUOQoY.js → nl-MVCsXAqA.js} +1 -1
- package/dist/assets/{officeDocument-C74tIqpD.js → officeDocument-CnopQpfD.js} +1 -1
- package/dist/assets/{parseDiffFromFile-COnIA377.js → parseDiffFromFile-CdzPmTcc.js} +1 -1
- package/dist/assets/{pierreDiffTint-9AmpxGGB.js → pierreDiffTint-CVXkDTiH.js} +1 -1
- package/dist/assets/{pl-DZRSuGdV.js → pl-zi2r4I2L.js} +1 -1
- package/dist/assets/{pt-BR-fU-ttTba.js → pt-BR-D-thkXCk.js} +1 -1
- package/dist/assets/{relocateRestoredSession-DawfZWX6.js → relocateRestoredSession-CL5sou6T.js} +2 -2
- package/dist/assets/{renderElectronMiniChatApp-q30Gq6wf.js → renderElectronMiniChatApp-ByeC9_X9.js} +2 -2
- package/dist/assets/{renderMarkdownForExport-0rL6OK8T.js → renderMarkdownForExport-B2BahH3V.js} +1 -1
- package/dist/assets/{renderMobileApp-B_PjVgBu.js → renderMobileApp-BHQf77yR.js} +3 -3
- package/dist/assets/{resolveLanguages-dF0QdGAX.js → resolveLanguages-D-TyRYRT.js} +1 -1
- package/dist/assets/{runtimeEndpointReset-BsAAA4Nf.js → runtimeEndpointReset-DKWDEJh9.js} +5 -5
- package/dist/assets/{scheduledTasksApi-CB-Xtp2P.js → scheduledTasksApi-DIaiATcl.js} +1 -1
- package/dist/assets/{shiki-CVNu2J2E.js → shiki-CTynytaK.js} +1 -1
- package/dist/assets/{space-apply-BmOleF8W.js → space-apply-CYC8IOgP.js} +1 -1
- package/dist/assets/{space-close-DqG3RGoP.js → space-close-CDpywx5q.js} +1 -1
- package/dist/assets/{spaceNetwork-DUGLrihG.js → spaceNetwork-DYE6zemZ.js} +1 -1
- package/dist/assets/{stream-tokenizer-Bzos6Fhy.js → stream-tokenizer-DHz3vo2_.js} +1 -1
- package/dist/assets/{textMateThemeFromAppTheme-BRUbLAuj.js → textMateThemeFromAppTheme-ZHLiHrUo.js} +1 -1
- package/dist/assets/{tr-CD93vntx.js → tr-BeLCIXLh.js} +1 -1
- package/dist/assets/{uk-DTqcJvdn.js → uk-CWz0kaNm.js} +1 -1
- package/dist/assets/{useAppFontEffects-xaAfmUwn.js → useAppFontEffects-DEX5CMOn.js} +15 -15
- package/dist/assets/{useBranchPullRequestRequest-CIftwmmA.js → useBranchPullRequestRequest-CulIXVeT.js} +1 -1
- package/dist/assets/{useCallableModelProviders-DYpBJMqj.js → useCallableModelProviders-CV8ihNIz.js} +1 -1
- package/dist/assets/{useDiffFindSurface-CqxU53Ed.js → useDiffFindSurface-DcsqijBv.js} +1 -1
- package/dist/assets/{useGitCleanLine-CmVX9s9E.js → useGitCleanLine-DvEtGCIy.js} +1 -1
- package/dist/assets/{useInlineCommentController-C-V8vqSj.js → useInlineCommentController-BL4NrAAM.js} +1 -1
- package/dist/assets/{useMarkdownLocalAssets-BfOLz9Xm.js → useMarkdownLocalAssets-6zcqySrf.js} +1 -1
- package/dist/assets/{useRootScrollLock-Ciuj2iZ_.js → useRootScrollLock-BHTza82m.js} +1 -1
- package/dist/assets/{useWalkthroughReview-BdjnKO7o.js → useWalkthroughReview-C_afIgqu.js} +1 -1
- package/dist/assets/{useWholeFileComment-DkYtu1tm.js → useWholeFileComment-WwfwT0jq.js} +1 -1
- package/dist/assets/{useWorktreeArchiveActions-DGzuZU_x.js → useWorktreeArchiveActions-CORhov5Z.js} +1 -1
- package/dist/assets/{vendor-codemirror-language-data-CSQf665k.js → vendor-codemirror-language-data--j1xV4at.js} +2 -2
- package/dist/assets/{zh-CN-BJ4oeBCY.js → zh-CN-D2e-OTjQ.js} +1 -1
- package/dist/assets/{zh-TW-BMW1G3F_.js → zh-TW-DCj_Doyh.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/mini-chat.html +2 -2
- package/dist/mobile.html +2 -2
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as K,j as t,R as d,f as J}from"./vendor-react--VO_rL_p.js";import{u as oe,B as L,y as Q,gX as fe,b8 as xe,n as de,bj as Se,a3 as ee,I as F,ay as Re}from"./useAppFontEffects-xaAfmUwn.js";import{b_ as G,b$ as Le,c0 as ue,c1 as Z,bG as Y,c2 as X,c3 as Ue,c4 as ge,c5 as be,j as te,c6 as ye,J as ve,c7 as ce,c8 as Ie,c9 as _e,ca as Te}from"./katex.min-2cmqKX7p.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-base-ui-CHqK1aDI.js";import"./vendor-floating-ui-utils-BzXdqYpP.js";import"./vendor-floating-ui-dom-WyXykhNi.js";import"./vendor-floating-ui-core-CXmKXOXc.js";import"./vendor-floating-ui-react-dom-Cy8dRGoy.js";import"./vendor-use-sync-external-store-CfLJGVyr.js";import"./vendor-zod-B_hXR7jf.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-zustand-C9tWdk0j.js";import"./vendor-dnd-kit-core-Br1Cs7RV.js";import"./vendor-dnd-kit-utilities-DZ9KbT5S.js";import"./vendor-dnd-kit-accessibility-CYclfhtC.js";import"./vendor-dnd-kit-sortable-DpfLEOLv.js";import"./vendor-tanstack-react-virtual-Bw3q1rnq.js";import"./vendor-tanstack-virtual-core-B4TJYmIq.js";import"./vendor-framer-motion-C_wK4GIM.js";import"./vendor-motion-dom-HXPOMxb7.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-capacitor-core-B4EWRrHz.js";import"./vendor-codemirror-commands-CjjsURR-.js";import"./vendor-codemirror-state-Cd8udR5z.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-view-Ciie9ey-.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-codemirror-language-8HZTPOnt.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CZEcqU6G.js";import"./vendor-codemirror-streamparser-CmlTsbN2.js";import"./vendor-codemirror-lang-javascript-DmqaSK_j.js";import"./vendor-lezer-javascript-CWSwshuO.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-BGedy2gC.js";import"./vendor-codemirror-lang-json-DVAYKmoO.js";import"./vendor-lezer-json-Cn1mncjr.js";import"./vendor-codemirror-lang-css-BLpgXfL2.js";import"./vendor-lezer-css-B2Hx_Nps.js";import"./vendor-codemirror-lang-html-S3jxr3Mo.js";import"./vendor-lezer-html-Cr8K5DGw.js";import"./vendor-codemirror-lang-markdown-D1jveRI5.js";import"./vendor-lezer-markdown-TQKzBB8i.js";import"./vendor-codemirror-language-data-CSQf665k.js";import"./vendor-codemirror-lang-python-B-5UC9Ui.js";import"./vendor-lezer-python-BUoImtUb.js";import"./vendor-sonner-Dw26OnzC.js";import"./vendor-cmdk-BtSpU-Io.js";import"./vendor-radix-ui-react-dialog-OIW6VLWw.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-D4RvEbuR.js";import"./vendor-radix-ui-react-context-BbFoxCHu.js";import"./vendor-radix-ui-react-id-aGag8i_5.js";import"./vendor-radix-ui-react-use-layout-effect-B1oLzD-j.js";import"./vendor-radix-ui-react-use-controllable-state-BjnNPGHq.js";import"./vendor-radix-ui-react-dismissable-layer-DpT6mMbO.js";import"./vendor-radix-ui-react-primitive-CrN9dRDb.js";import"./vendor-radix-ui-react-slot-BjbalUfz.js";import"./vendor-radix-ui-react-use-callback-ref-CcC_buIU.js";import"./vendor-radix-ui-react-use-escape-keydown-Cp1WWKTC.js";import"./vendor-radix-ui-react-focus-scope-D1noLHmd.js";import"./vendor-radix-ui-react-portal-BlUEzfrF.js";import"./vendor-radix-ui-react-presence-BGqFfiW4.js";import"./vendor-radix-ui-react-focus-guards-CSS2IbZC.js";import"./vendor-react-remove-scroll-Der_cv-1.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-Clwl9llp.js";import"./vendor-react-style-singleton-D_xJlTqU.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-BdLl6ZIw.js";import"./vendor-use-callback-ref-CXJF1lEr.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-legendapp-list-iLtL-MFj.js";import"./vendor-streamdown-BbSYZ3NF.js";import"./vendor-markdown-BTUqNk6W.js";import"./vendor-mdast-util-from-markdown-CZHjOE75.js";import"./vendor-micromark-util-decode-numeric-character-reference-CNs1qBpV.js";import"./vendor-micromark-util-decode-string-fHsnqYdj.js";import"./vendor-decode-named-character-reference-C3-224fz.js";import"./vendor-micromark-util-normalize-identifier-C9ANKk3v.js";import"./vendor-micromark-AWM-NZXP.js";import"./vendor-micromark-util-combine-extensions-d8XJZrgA.js";import"./vendor-micromark-util-chunked-DrRIdSP-.js";import"./vendor-micromark-factory-space-PzSHLgmq.js";import"./vendor-micromark-util-character-CW3Cu1MS.js";import"./vendor-micromark-core-commonmark-kzTLNXAm.js";import"./vendor-micromark-util-classify-character-tcLuZZwM.js";import"./vendor-micromark-util-resolve-all-PQCKh0dx.js";import"./vendor-micromark-util-subtokenize-BF1Jf29a.js";import"./vendor-micromark-factory-destination-Sj0xfi0V.js";import"./vendor-micromark-factory-label-amyP0HdC.js";import"./vendor-micromark-factory-title-khnLkZK6.js";import"./vendor-micromark-factory-whitespace-eIB00uTl.js";import"./vendor-micromark-util-html-tag-name-DbKNfynz.js";import"./vendor-unist-util-stringify-position-Ch_qCilz.js";import"./vendor-mdast-util-to-string-C_aolqmU.js";import"./vendor-unist-util-visit-DhPeCsfG.js";import"./vendor-unist-util-visit-parents-DlviEg7Z.js";import"./vendor-unist-util-is-BPZGFiMU.js";import"./vendor-hast-util-raw-DvvLJg15.js";import"./vendor-ungap-structured-clone--gfxRhYI.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-parse5-DwmzEj2o.js";import"./vendor-entities-wUUgTZDW.js";import"./vendor-web-namespaces-bsVAaBS1.js";import"./vendor-zwitch-C2o2j-tx.js";import"./vendor-unist-util-position-60F3QETU.js";import"./vendor-hast-util-from-parse5-Ba3T6RJI.js";import"./vendor-devlop-0Dp3JUBc.js";import"./vendor-property-information-Boo8Xpef.js";import"./vendor-hastscript-BrPNioaz.js";import"./vendor-comma-separated-tokens-CRUGqg4f.js";import"./vendor-space-separated-tokens-D7QSIrTI.js";import"./vendor-hast-util-parse-selector-TXfch5wI.js";import"./vendor-vfile-location-LfEFwJ2h.js";import"./vendor-hast-util-to-parse5-BoysVIPW.js";import"./vendor-hast-util-sanitize-2aGO5ay8.js";import"./vendor-micromark-extension-gfm-CsfPlnlB.js";import"./vendor-micromark-extension-gfm-autolink-literal-BYug7onl.js";import"./vendor-micromark-extension-gfm-footnote-OFl1FCH2.js";import"./vendor-micromark-extension-gfm-strikethrough-CyFiuwBf.js";import"./vendor-micromark-extension-gfm-table-dgw4LfUw.js";import"./vendor-micromark-extension-gfm-task-list-item-Dnadzr9U.js";import"./vendor-mdast-util-gfm-CroMDYLM.js";import"./vendor-mdast-util-gfm-autolink-literal-CTruMtvI.js";import"./vendor-ccount-c2V3InAJ.js";import"./vendor-mdast-util-find-and-replace-DB9iC-bx.js";import"./vendor-escape-string-regexp-BaJN9MlJ.js";import"./vendor-mdast-util-gfm-footnote-C-csI7OF.js";import"./vendor-mdast-util-gfm-strikethrough-BcskTdio.js";import"./vendor-mdast-util-gfm-table-DhPwQIyj.js";import"./vendor-markdown-table-DvhhVmnL.js";import"./vendor-mdast-util-to-markdown-Cl3qaiyc.js";import"./vendor-longest-streak-CtXnX3Xp.js";import"./vendor-mdast-util-phrasing-4oVbNLC3.js";import"./vendor-mdast-util-gfm-task-list-item-DMU5mK_M.js";import"./vendor-mdast-util-to-hast-CWnLaQSO.js";import"./vendor-micromark-util-sanitize-uri-BbwQ7CLk.js";import"./vendor-trim-lines-D8znQY54.js";import"./vendor-micromark-extension-cjk-friendly-BzZDGrF5.js";import"./vendor-micromark-extension-cjk-friendly-util-D5lVNoxW.js";import"./vendor-get-east-asian-width-CPhS2cOv.js";import"./vendor-micromark-util-symbol-JJPacVTp.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-BZ3pe_qd.js";import"./vendor-micromark-extension-cjk-friendly-gfm-strikethrough-CqW-Ep4M.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-gfm-strikethrough-BdPDQFO7.js";import"./vendor-hast-util-from-html-isomorphic-B0Kn01s9.js";import"./vendor-hast-util-from-dom-DeNf9aYW.js";import"./vendor-katex-DBqql0K7.js";import"./vendor-hast-util-to-text-0GXLnBvt.js";import"./vendor-hast-util-is-element-CuOmiqQi.js";import"./vendor-unist-util-find-after-CMaZmLxc.js";import"./vendor-micromark-extension-math-BRFoDziv.js";import"./vendor-mdast-util-math-wB-IJCL0.js";import"./vendor-remend-r8cP_t-e.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-marked-DN3zOnEe.js";import"./vendor-hast-util-to-jsx-runtime-Bq6JeJCx.js";import"./vendor-style-to-js-CI2G4dgu.js";import"./vendor-style-to-object-BAv4SQXc.js";import"./vendor-inline-style-parser-BlqBsVO4.js";import"./vendor-hast-util-whitespace-D4Wp6AEg.js";import"./vendor-estree-util-is-identifier-name-BgBfM8ME.js";import"./vendor-vfile-message-DqhD22jI.js";import"./vendor-unified-1CQKw2_w.js";import"./vendor-bail-FqpXQuLt.js";import"./vendor-extend-B94qxKr5.js";import"./vendor-is-plain-obj-C1gvLhAf.js";import"./vendor-trough-B_b8ryxu.js";import"./vendor-vfile-BCWrK60u.js";import"./vendor-html-url-attributes-D46m5wfe.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./vendor-opencode-client-NJGkA1Ku.js";import"./vendor-fuse.js-Dw8P0qyA.js";function De(r){switch(r){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(r){return r==="wrong-service"||r==="unreachable"||r==="incompatible"}function we({onBack:r,showBackButton:e=!0,initialUrl:o="",initialLabel:a="",isRecoveryMode:n=!1,onConnect:l,onSwitchToLocal:m,showInstancePicker:i=!1}){const{t:s}=oe(),[h,x]=K.useState(o),[u,U]=K.useState(a),[R,y]=K.useState("idle"),[b,g]=K.useState(null),[S,C]=K.useState(""),[_,I]=K.useState([]),[D,w]=K.useState(()=>i?"instances":"add"),[v,j]=K.useState("");K.useEffect(()=>{i&&G().then(p=>I(p.hosts)).catch(p=>{C(p instanceof Error?p.message:String(p))})},[i]);const k=Le(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 G(),Ce=u.trim()||p,re=ne.hosts.find(se=>se.url===p),ae=re?re.id:`host-${Date.now().toString(16)}`,me={id:ae,label:Ce,url:p,apiUrl:p},Ne=re?ne.hosts.map(se=>se.id===ae?me:se):[...ne.hosts,me];if(await Z({hosts:Ne,defaultHostId:ae,initialHostChoiceCompleted:!0}),l?.(),k.redeemUrl){window.location.assign(k.redeemUrl);return}Y()&&await X()}catch(V){C(V instanceof Error?V.message:s("onboarding.remoteConnection.errors.failedToSaveConnection")),y("error")}},[k,u,l,s]),E=K.useCallback(async p=>{const V=await G();await Z({hosts:V.hosts,defaultHostId:p,initialHostChoiceCompleted:!0}),await X()},[]),z=K.useCallback(async()=>{y("testing"),C("");try{const p=await G(),V=await Ue(v,p.hosts);await Z({hosts:V.hosts,defaultHostId:V.hostId,initialHostChoiceCompleted:!0}),await X()}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]),c=R==="testing",N=A!==null&&!c,H=A!==null&&!c&&!ie(b?.status??null),T=De(b?.status??null),O=b?.status==="ok",M=b?.status==="update-recommended",q=b?.status==="auth",B=ie(b?.status??null);return i&&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:_.length===0?t.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:s("settings.remoteInstances.direct.state.empty")}):_.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")})]})]})}):i&&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(Q,{value:v,onChange:p=>j(p.target.value),placeholder:s("settings.remoteInstances.direct.import.placeholder"),disabled:c,autoFocus:!0}),S?t.jsx("div",{className:"text-sm text-[var(--status-error)]",children:S}):null,t.jsx(L,{onClick:()=>{z()},disabled:c||!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||i)&&t.jsx("div",{className:"flex items-center",children:t.jsx(L,{variant:"ghost",onClick:i?()=>w("instances"):r,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(Q,{id:"remote-url",type:"url",value:h,onChange:P,placeholder:s("onboarding.remoteConnection.field.serverAddressPlaceholder"),disabled:c})]}),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(Q,{id:"remote-label",type:"text",value:u,onChange:$,placeholder:s("onboarding.remoteConnection.field.namePlaceholder"),disabled:c})]})]}),b&&O&&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&&q&&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&&M&&t.jsx("div",{className:"rounded-lg border p-3 text-sm",style:{borderColor:"var(--status-warning)",color:"var(--status-warning)"},children:T?s(T):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:T?s(T):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(c?"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:r,className:"flex-1",children:s("onboarding.remoteConnection.actions.chooseDifferentServer")}),!n&&m&&t.jsx(L,{variant:"outline",size:"sm",onClick:m,className:"flex-1",children:s("onboarding.remoteConnection.actions.useLocalInstead")})]})]})]})})}const Ae="curl -fsSL https://opencode.ai/v2/install | bash",je="npm install -g @opencode/cli",Ke="https://opencode.ai/download",pe=2500;function Ee(r){const e=J.c(9),{windows:o,onCopy:a,copyTitle:n}=r;let l;e[0]!==o?(l=t.jsx(de,{as:"code",outerClassName:"overlay-scrollbar-wrapper--no-gutter flex-1 min-w-0",fillContainer:!1,className:"text-start 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]=l):l=e[1];let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(F,{name:"file-copy",className:"h-4 w-4"}),e[2]=m):m=e[2];let i;e[3]!==n||e[4]!==a?(i=t.jsx("button",{onClick:a,className:"inline-flex items-center text-muted-foreground hover:text-foreground transition-colors shrink-0",title:n,"aria-label":n,children:m}),e[3]=n,e[4]=a,e[5]=i):i=e[5];let s;return e[6]!==l||e[7]!==i?(s=t.jsxs("div",{className:"flex items-center justify-between gap-3 w-full",children:[l,i]}),e[6]=l,e[7]=i,e[8]=s):s=e[8],s}function Fe(){const r=J.c(5),e=Re(!0);let o;r[0]!==e?(o=ee("absolute inset-0 rounded-full",e),r[0]=e,r[1]=o):o=r[1];let a;r[2]===Symbol.for("react.memo_cache_sentinel")?(a={backgroundColor:"var(--primary-base)"},r[2]=a):a=r[2];let n;return r[3]!==o?(n=t.jsx("span",{className:o,style:a}),r[3]=o,r[4]=n):n=r[4],n}function He({onCliAvailable:r,localAvailable:e=!0}){const{t:o}=oe(),[a,n]=d.useState(!1),[l,m]=d.useState(!1),[i,s]=d.useState(!1),[h,x]=d.useState(!1),[u,U]=d.useState(""),R=fe(c=>c.opencodeBinary),[y,b]=d.useState("unknown"),[g,S]=d.useState(()=>e?"local":"remote"),[C,_]=d.useState(!1),[I,D]=d.useState(!1);d.useEffect(()=>{m(Y())},[]),d.useEffect(()=>{if(typeof navigator>"u"){b("unknown");return}const c=navigator.userAgent||"";/Windows/i.test(c)?b("windows"):/Macintosh|Mac OS X/i.test(c)?b("macos"):/Linux/i.test(c)?b("linux"):b("unknown")},[]),d.useEffect(()=>{let c=!1;return(async()=>{try{const N=await ge();if(!N||c)return;const H=N.opencodeBinary??"";H&&U(H)}catch{}})(),()=>{c=!0}},[]);const w=d.useCallback(async c=>{const N=c.target;N.closest(".app-region-no-drag")||N.closest("button, a, input, select, textarea, code, summary, details")||c.button===0&&l&&await be()},[l]),v=d.useCallback(async()=>{try{const c=await te("/health");if(!c.ok)return!1;const N=await c.json();return N.openCodeRunning===!0||N.isOpenCodeReady===!0}catch{return!1}},[]),j=d.useCallback(async c=>{if(!l)return;const N=await G();await Z({...N,...c==="local"?{defaultHostId:"local"}:{},initialHostChoiceCompleted:!0})},[l]),k=d.useCallback(async()=>{l&&await j("local"),r?.()},[l,r,j]);d.useEffect(()=>{if(!e||g!=="local")return;let c=!1,N=null;const H=async()=>{if(!c){try{const T=await v();if(c)return;if(T){await k();return}}catch{}c||(N=setTimeout(H,pe))}};return N=setTimeout(H,pe),()=>{c=!0,N&&clearTimeout(N)}},[g,v,k,e]);const A=d.useCallback(async()=>{x(!0);try{await v()&&await k()}finally{x(!1)}},[v,k]),P=d.useCallback(async()=>{if(!(typeof window>"u")&&l)try{const c=await ye();c.success&&c.path&&c.path.trim().length>0&&U(c.path.trim())}catch{}},[l]),$=d.useCallback(async()=>{s(!0);try{if(await ve({opencodeBinary:u.trim()}),l){await j("local"),await X();return}await te("/api/config/reload",{method:"POST"})}finally{setTimeout(()=>s(!1),1e3)}},[l,u,j]),W=d.useCallback(async()=>{const c=await xe(y==="windows"?je:Ae);c.ok?(n(!0),setTimeout(()=>n(!1),2e3)):console.error("Failed to copy:",c.error)},[y]),f=Ke,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&&(!l||g==="local");return t.jsx(de,{outerClassName:"h-full bg-transparent",className:"app-region-drag flex items-center justify-center p-8 cursor-default select-none",onMouseDown:w,disableHorizontal:!0,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(Se,{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")})]}),l&&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:ee("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:ee("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")})]}),l&&g==="remote"?t.jsx("div",{className:"app-region-no-drag mt-6",children:t.jsx(we,{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:a?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(Ee,{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(Fe,{})}),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-edge border-y border-edge",children:[t.jsxs("details",{className:"app-region-no-drag group",open:C,onToggle:c=>_(c.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(Q,{value:R??u,onChange:c=>U(c.target.value),placeholder:E,disabled:i||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:i||!l,children:o("onboarding.localSetup.actions.browse")}),t.jsx(L,{type:"button",size:"sm",onClick:$,disabled:i||!u.trim(),children:o("onboarding.localSetup.actions.apply")})]})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:o(R===null?"onboarding.localSetup.helper.saveAndReload":"onboarding.localSetup.helper.pinnedByAdministrator")})]})]}),t.jsxs("details",{className:"app-region-no-drag group",open:I,onToggle:c=>D(c.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 Oe="curl -fsSL https://opencode.ai/v2/install | bash",ke="npm install -g @opencode/cli",Me="https://opencode.ai/download";function Be(r){const e=J.c(9),{windows:o,onCopy:a,copyTitle:n}=r;let l;e[0]!==o?(l=t.jsx(de,{as:"code",outerClassName:"overlay-scrollbar-wrapper--no-gutter flex-1 min-w-0",fillContainer:!1,className:"text-start whitespace-nowrap",children:o?t.jsx("span",{style:{color:"var(--syntax-keyword)"},children:ke}):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]=l):l=e[1];let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(F,{name:"file-copy",className:"h-4 w-4"}),e[2]=m):m=e[2];let i;e[3]!==n||e[4]!==a?(i=t.jsx("button",{onClick:a,className:"inline-flex items-center text-muted-foreground hover:text-foreground transition-colors",title:n,"aria-label":n,children:m}),e[3]=n,e[4]=a,e[5]=i):i=e[5];let s;return e[6]!==l||e[7]!==i?(s=t.jsxs("div",{className:"flex items-center justify-center gap-3",children:[l,i]}),e[6]=l,e[7]=i,e[8]=s):s=e[8],s}const Pe=3e4;function $e({onBack:r,onCliAvailable:e,isFromRecovery:o=!1,onSwitchToRemote:a}){const{t:n}=oe(),[l,m]=d.useState(!1),[i,s]=d.useState(!1),[h,x]=d.useState(!1),[u,U]=d.useState(!1),[R,y]=d.useState(!1),[b,g]=d.useState(null),[S,C]=d.useState(""),_=fe(f=>f.opencodeBinary),[I,D]=d.useState("unknown");d.useEffect(()=>{const f=setTimeout(()=>s(!0),Pe);return()=>clearTimeout(f)},[]),d.useEffect(()=>{x(Y())},[]),d.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")},[]),d.useEffect(()=>{let f=!1;return(async()=>{try{const E=await ge();if(!E||f)return;const z=E.opencodeBinary??"";z&&C(z)}catch{}})(),()=>{f=!0}},[]);const w=d.useCallback(async f=>{f.target.closest("button, a, input, select, textarea, code")||f.button===0&&h&&await be()},[h]),v=d.useCallback(async()=>{try{const f=await te("/health");if(!f.ok)return!1;const E=await f.json();return E.openCodeRunning===!0||E.isOpenCodeReady===!0}catch{return!1}},[]),j=d.useCallback(async()=>{if(!(typeof window>"u")&&h)try{const f=await ye();f.success&&f.path&&f.path.trim().length>0&&C(f.path.trim())}catch{}},[h]),k=d.useCallback(async()=>{U(!0);try{if(await ve({opencodeBinary:S.trim()}),h){await X();return}await te("/api/config/reload",{method:"POST"})}finally{setTimeout(()=>U(!1),1e3)}},[h,S]),A=d.useCallback(async()=>{const f=await xe(I==="windows"?ke:Oe);f.ok?(m(!0),setTimeout(()=>m(!1),2e3)):console.error("Failed to copy:",f.error)},[I]),P=d.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]),$=Me,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:r,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:l?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(Be,{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(Q,{value:_??S,onChange:f=>C(f.target.value),placeholder:W,disabled:u||_!==null,className:"flex-1 font-mono text-xs"}),_===null&&t.jsxs(t.Fragment,{children:[t.jsx(L,{type:"button",variant:"secondary",onClick:j,disabled:u||!h,children:n("onboarding.localSetup.actions.browse")}),t.jsx(L,{type:"button",onClick:k,disabled:u,children:n("onboarding.localSetup.actions.apply")})]})]}),t.jsx("div",{className:"text-xs text-muted-foreground",children:n(_===null?"onboarding.localSetup.helper.saveAndReload":"onboarding.localSetup.helper.pinnedByAdministrator")})]})}),o&&a&&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:a,children:n("onboarding.localSetup.actions.connectRemoteServer")})]})]}),i&&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",children:n("onboarding.localSetup.windows.hintDetectionFailed")})}):t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-sm text-muted-foreground",children:n("onboarding.localSetup.hint.ensurePath")}),t.jsx("p",{className:"text-sm text-muted-foreground",children:n("onboarding.localSetup.hint.setEnv")}),t.jsx("p",{className:"text-sm text-muted-foreground",children:n("onboarding.localSetup.hint.missingRuntime")})]})})]})}function le(r,e){if(r?.trim())return ce(r.trim());if(e)return ce(e)}function We(r,e,o){switch(r){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 a=le(e,o);return{title:"Remote Server Unreachable",description:`Could not connect to "${a||"the remote server"}". Check your network connection and verify the server address.`,titleKey:"onboarding.desktopRecovery.remoteUnreachable.title",descriptionKey:"onboarding.desktopRecovery.remoteUnreachable.description",descriptionParams:a?{host:a}: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 a=le(e,o);return{title:"Incompatible Server",description:`The server at "${a||"unknown"}" is not running OpenChamber. Verify the address points to an OpenChamber server.`,titleKey:"onboarding.desktopRecovery.incompatibleServer.title",descriptionKey:"onboarding.desktopRecovery.incompatibleServer.description",descriptionParams:a?{host:a}: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 a=le(e,o);return{title:"Server Update Required",description:`The OpenChamber server at "${a||"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:a?{host:a}: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 a=r;throw new Error(`Unknown recovery variant: ${a}`)}}}const ze="openchamber update";function Ve(r){const e=J.c(17),{state:o}=r,{t:a}=oe();if(o.kind==="idle"||o.kind==="updating")return null;let n;e[0]!==o.kind||e[1]!==a?(n=o.kind==="refused"?a("onboarding.desktopRecovery.remoteIncompatible.updateRefused"):o.kind==="auth"?a("onboarding.desktopRecovery.remoteIncompatible.updateAuth"):a("onboarding.desktopRecovery.remoteIncompatible.updateTimeout"),e[0]=o.kind,e[1]=a,e[2]=n):n=e[2];const l=n;let m;e[3]!==l?(m=t.jsx("p",{className:"typography-meta text-[var(--status-error)]",children:l}),e[3]=l,e[4]=m):m=e[4];let i;e[5]!==o.error||e[6]!==o.kind?(i=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]=i):i=e[7];let s;e[8]!==a?(s=a("onboarding.desktopRecovery.remoteIncompatible.manualUpdate"),e[8]=a,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:ze}),e[12]=x):x=e[12];let u;return e[13]!==m||e[14]!==i||e[15]!==h?(u=t.jsxs("div",{className:"space-y-2",children:[m,i,h,x]}),e[13]=m,e[14]=i,e[15]=h,e[16]=u):u=e[16],u}function Xe(r){switch(r){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 Ye({variant:r,hostLabel:e,hostUrl:o,onRetry:a,onUseLocal:n,onUseRemote:l,isRetrying:m=!1,onUpdateServer:i,serverUpdate:s={kind:"idle"}}){const h=s.kind==="updating",{t:x}=oe(),u=We(r,e,o),U=u.retryLabelKey??"onboarding.desktopRecovery.actions.retryConnection",R=d.useMemo(()=>{if(u.descriptionParams?.host)return u.descriptionParams;if(r==="remote-unreachable")return{host:x("onboarding.desktopRecovery.placeholders.remoteServer")};if(r==="remote-wrong-service"||r==="remote-incompatible")return{host:x("onboarding.desktopRecovery.placeholders.unknownServer")}},[u.descriptionParams,x,r]);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:Xe(u.iconKey)})}),t.jsx("h1",{className:"typography-ui-header text-xl font-semibold text-foreground",children:x(u.titleKey)}),t.jsx("p",{className:"text-muted-foreground text-sm max-w-sm",children:x(u.descriptionKey,R)})]}),o&&(r==="remote-unreachable"||r==="remote-wrong-service"||r==="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:[i&&t.jsxs(t.Fragment,{children:[t.jsxs(L,{onClick:i,disabled:h||m,className:"w-full",children:[t.jsx(F,{name:h?"loader":"download",className:ee("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(Ve,{state:s})]}),u.showRetry&&a&&t.jsxs(L,{onClick:a,disabled:m||h,variant:i?"outline":"default",className:"w-full",children:[t.jsx(F,{name:"refresh",className:ee("h-4 w-4",m&&"animate-spin")}),x(m?"onboarding.desktopRecovery.actions.retrying":U)]}),t.jsxs("div",{className:"flex gap-2",children:[u.showUseLocal&&n&&t.jsxs(L,{variant:"outline",onClick:n,disabled:m||h,className:"flex-1",children:[t.jsx(F,{name:"macbook",className:"h-4 w-4"}),x(u.useLocalLabelKey)]}),u.showUseRemote&&l&&t.jsxs(L,{variant:"outline",onClick:l,disabled:m||h,className:"flex-1",children:[t.jsx(F,{name:"server",className:"h-4 w-4"}),x(u.useRemoteLabelKey)]})]})]})]})})}function he(r,e){if(e==="use-remote")return{kind:"remote-form"};switch(r){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=r;throw new Error(`Unhandled RecoveryVariant: ${o}`)}}}function qe(r){const e=J.c(39),{variant:o,hostUrl:a,hostLabel:n,hostId:l,onRetry:m,onChooseRemote:i,showRemoteForm:s,onCloseRemoteForm:h,onSwitchToLocalFromRemote:x,onEnterLocalSetup:u,isRetrying:U,localAvailable:R}=r,y=s===void 0?!1:s,b=U===void 0?!1:U,g=R===void 0?!0:R,S=Je;let C;e[0]!==m?(C=async()=>{if(Y()){await X();return}await te("/api/config/reload",{method:"POST"}),m?.()},e[0]=m,e[1]=C):C=e[1];const _=C;let I;e[2]!==u||e[3]!==o?(I=async()=>{if(he(o,"use-local").kind==="local-setup"){u?.();return}if(await S("local"),Y()){await X();return}window.location.reload()},e[2]=u,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]=d.useState(w),[k,A]=d.useState(null);let P,$;e[6]!==l||e[7]!==o?(P=()=>{if(A(null),o!=="remote-incompatible"||!l||!Y())return;let T=!1;return G().then(O=>{const M=O.hosts.find(B=>B.id===l),q=Ie(M?.apiUrl||M?.url||"");!T&&q&&A(l)}).catch(Ge),()=>{T=!0}},$=[o,l],e[6]=l,e[7]=o,e[8]=P,e[9]=$):(P=e[8],$=e[9]),d.useEffect(P,$);let W;e[10]===Symbol.for("react.memo_cache_sentinel")?(W=async T=>{j({kind:"updating"});try{const O=await _e(T);if(O.status==="auth"){j({kind:"auth"});return}if(O.status==="failed"){j({kind:"refused",error:O.error});return}if(await Te(T)==="timeout"){j({kind:"timeout"});return}await X()||j({kind:"idle"})}catch{j({kind:"timeout"})}},e[10]=W):W=e[10];const f=W;let E;e[11]!==i||e[12]!==o?(E=()=>{he(o,"use-remote").kind==="remote-form"&&i?.()},e[11]=i,e[12]=o,e[13]=E):E=e[13];const z=E;if(y){const T=o==="remote-wrong-service"?"":a||"",O=o==="remote-wrong-service"?"":n||"";let M;e[14]!==i||e[15]!==h?(M=h||(()=>i?.()),e[14]=i,e[15]=h,e[16]=M):M=e[16];const q=!g;let B;e[17]!==g||e[18]!==u||e[19]!==x?(B=g?x||(()=>{S("local").then(()=>{Y()?X():u?.()})}):void 0,e[17]=g,e[18]=u,e[19]=x,e[20]=B):B=e[20];let p;return e[21]!==O||e[22]!==T||e[23]!==M||e[24]!==q||e[25]!==B?(p=t.jsx(we,{onBack:M,initialUrl:T,initialLabel:O,isRecoveryMode:!0,showInstancePicker:q,onSwitchToLocal:B}),e[21]=O,e[22]=T,e[23]=M,e[24]=q,e[25]=B,e[26]=p):p=e[26],p}const c=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]!==_||e[30]!==z||e[31]!==n||e[32]!==a||e[33]!==b||e[34]!==v||e[35]!==c||e[36]!==N||e[37]!==o?(H=t.jsx(Ye,{variant:o,hostLabel:n,hostUrl:a,onRetry:_,onUseLocal:c,onUseRemote:z,isRetrying:b,onUpdateServer:N,serverUpdate:v}),e[29]=_,e[30]=z,e[31]=n,e[32]=a,e[33]=b,e[34]=v,e[35]=c,e[36]=N,e[37]=o,e[38]=H):H=e[38],H}function Ge(){}async function Je(r){if(!Y())return;const e=await G();await Z({...e,...r==="local"?{defaultHostId:"local"}:{},initialHostChoiceCompleted:!0})}function gn(r){const e=J.c(30),{onBack:o,onCliAvailable:a,mode:n,recoveryVariant:l,recoveryHostUrl:m,recoveryHostLabel:i,recoveryHostId:s,onEnterLocalSetup:h,localAvailable:x}=r,u=n===void 0?"first-launch":n,U=l===void 0?"missing-default-host":l,R=x===void 0?!0:x,[y,b]=d.useState(!1),[g,S]=d.useState(!1);let C;e[0]===Symbol.for("react.memo_cache_sentinel")?(C=()=>{S(!1),b(!1)},e[0]=C):C=e[0];let _;e[1]!==u||e[2]!==i||e[3]!==m||e[4]!==U?(_=[u,U,m,i],e[1]=u,e[2]=i,e[3]=m,e[4]=U,e[5]=_):_=e[5],d.useEffect(C,_);const I=g?"local-setup":u;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]!==i||e[14]!==m||e[15]!==U||e[16]!==y||e[17]!==k?(A=t.jsx(qe,{variant:U,hostUrl:m,hostLabel:i,hostId:s,onChooseRemote:w,showRemoteForm:y,onCloseRemoteForm:v,onSwitchToLocalFromRemote:j,onEnterLocalSetup:k,localAvailable:R}),e[11]=R,e[12]=s,e[13]=i,e[14]=m,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]!==a||e[24]!==g||e[25]!==w?(j=t.jsx($e,{onBack:w,onCliAvailable:a,isFromRecovery:g,onSwitchToRemote:v}),e[23]=a,e[24]=g,e[25]=w,e[26]=j):j=e[26],j}let D;return e[27]!==R||e[28]!==a?(D=t.jsx(He,{onCliAvailable:a,localAvailable:R}),e[27]=R,e[28]=a,e[29]=D):D=e[29],D}export{gn as OnboardingScreen};
|
|
1
|
+
import{r as K,j as t,R as d,f as J}from"./vendor-react--VO_rL_p.js";import{u as oe,B as L,y as Q,gX as fe,b8 as xe,n as de,bj as Se,a3 as ee,I as F,ay as Re}from"./useAppFontEffects-DEX5CMOn.js";import{b_ as G,b$ as Le,c0 as ue,c1 as Z,bG as Y,c2 as X,c3 as Ue,c4 as ge,c5 as be,j as te,c6 as ye,J as ve,c7 as ce,c8 as Ie,c9 as _e,ca as Te}from"./katex.min-CAwHaRYk.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-base-ui-CHqK1aDI.js";import"./vendor-floating-ui-utils-BzXdqYpP.js";import"./vendor-floating-ui-dom-WyXykhNi.js";import"./vendor-floating-ui-core-CXmKXOXc.js";import"./vendor-floating-ui-react-dom-Cy8dRGoy.js";import"./vendor-use-sync-external-store-CfLJGVyr.js";import"./vendor-zod-B_hXR7jf.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-zustand-C9tWdk0j.js";import"./vendor-dnd-kit-core-Br1Cs7RV.js";import"./vendor-dnd-kit-utilities-DZ9KbT5S.js";import"./vendor-dnd-kit-accessibility-CYclfhtC.js";import"./vendor-dnd-kit-sortable-DpfLEOLv.js";import"./vendor-tanstack-react-virtual-Bw3q1rnq.js";import"./vendor-tanstack-virtual-core-B4TJYmIq.js";import"./vendor-framer-motion-C_wK4GIM.js";import"./vendor-motion-dom-HXPOMxb7.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-capacitor-core-B4EWRrHz.js";import"./vendor-codemirror-commands-CjjsURR-.js";import"./vendor-codemirror-state-Cd8udR5z.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-view-Ciie9ey-.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-codemirror-language-8HZTPOnt.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CZEcqU6G.js";import"./vendor-codemirror-streamparser-CmlTsbN2.js";import"./vendor-codemirror-lang-javascript-DmqaSK_j.js";import"./vendor-lezer-javascript-CWSwshuO.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-BGedy2gC.js";import"./vendor-codemirror-lang-json-DVAYKmoO.js";import"./vendor-lezer-json-Cn1mncjr.js";import"./vendor-codemirror-lang-css-BLpgXfL2.js";import"./vendor-lezer-css-B2Hx_Nps.js";import"./vendor-codemirror-lang-html-S3jxr3Mo.js";import"./vendor-lezer-html-Cr8K5DGw.js";import"./vendor-codemirror-lang-markdown-D1jveRI5.js";import"./vendor-lezer-markdown-TQKzBB8i.js";import"./vendor-codemirror-language-data--j1xV4at.js";import"./vendor-codemirror-lang-python-B-5UC9Ui.js";import"./vendor-lezer-python-BUoImtUb.js";import"./vendor-sonner-Dw26OnzC.js";import"./vendor-cmdk-BtSpU-Io.js";import"./vendor-radix-ui-react-dialog-OIW6VLWw.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-D4RvEbuR.js";import"./vendor-radix-ui-react-context-BbFoxCHu.js";import"./vendor-radix-ui-react-id-aGag8i_5.js";import"./vendor-radix-ui-react-use-layout-effect-B1oLzD-j.js";import"./vendor-radix-ui-react-use-controllable-state-BjnNPGHq.js";import"./vendor-radix-ui-react-dismissable-layer-DpT6mMbO.js";import"./vendor-radix-ui-react-primitive-CrN9dRDb.js";import"./vendor-radix-ui-react-slot-BjbalUfz.js";import"./vendor-radix-ui-react-use-callback-ref-CcC_buIU.js";import"./vendor-radix-ui-react-use-escape-keydown-Cp1WWKTC.js";import"./vendor-radix-ui-react-focus-scope-D1noLHmd.js";import"./vendor-radix-ui-react-portal-BlUEzfrF.js";import"./vendor-radix-ui-react-presence-BGqFfiW4.js";import"./vendor-radix-ui-react-focus-guards-CSS2IbZC.js";import"./vendor-react-remove-scroll-Der_cv-1.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-Clwl9llp.js";import"./vendor-react-style-singleton-D_xJlTqU.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-BdLl6ZIw.js";import"./vendor-use-callback-ref-CXJF1lEr.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-legendapp-list-iLtL-MFj.js";import"./vendor-streamdown-BbSYZ3NF.js";import"./vendor-markdown-BTUqNk6W.js";import"./vendor-mdast-util-from-markdown-CZHjOE75.js";import"./vendor-micromark-util-decode-numeric-character-reference-CNs1qBpV.js";import"./vendor-micromark-util-decode-string-fHsnqYdj.js";import"./vendor-decode-named-character-reference-C3-224fz.js";import"./vendor-micromark-util-normalize-identifier-C9ANKk3v.js";import"./vendor-micromark-AWM-NZXP.js";import"./vendor-micromark-util-combine-extensions-d8XJZrgA.js";import"./vendor-micromark-util-chunked-DrRIdSP-.js";import"./vendor-micromark-factory-space-PzSHLgmq.js";import"./vendor-micromark-util-character-CW3Cu1MS.js";import"./vendor-micromark-core-commonmark-kzTLNXAm.js";import"./vendor-micromark-util-classify-character-tcLuZZwM.js";import"./vendor-micromark-util-resolve-all-PQCKh0dx.js";import"./vendor-micromark-util-subtokenize-BF1Jf29a.js";import"./vendor-micromark-factory-destination-Sj0xfi0V.js";import"./vendor-micromark-factory-label-amyP0HdC.js";import"./vendor-micromark-factory-title-khnLkZK6.js";import"./vendor-micromark-factory-whitespace-eIB00uTl.js";import"./vendor-micromark-util-html-tag-name-DbKNfynz.js";import"./vendor-unist-util-stringify-position-Ch_qCilz.js";import"./vendor-mdast-util-to-string-C_aolqmU.js";import"./vendor-unist-util-visit-DhPeCsfG.js";import"./vendor-unist-util-visit-parents-DlviEg7Z.js";import"./vendor-unist-util-is-BPZGFiMU.js";import"./vendor-hast-util-raw-DvvLJg15.js";import"./vendor-ungap-structured-clone--gfxRhYI.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-parse5-DwmzEj2o.js";import"./vendor-entities-wUUgTZDW.js";import"./vendor-web-namespaces-bsVAaBS1.js";import"./vendor-zwitch-C2o2j-tx.js";import"./vendor-unist-util-position-60F3QETU.js";import"./vendor-hast-util-from-parse5-Ba3T6RJI.js";import"./vendor-devlop-0Dp3JUBc.js";import"./vendor-property-information-Boo8Xpef.js";import"./vendor-hastscript-BrPNioaz.js";import"./vendor-comma-separated-tokens-CRUGqg4f.js";import"./vendor-space-separated-tokens-D7QSIrTI.js";import"./vendor-hast-util-parse-selector-TXfch5wI.js";import"./vendor-vfile-location-LfEFwJ2h.js";import"./vendor-hast-util-to-parse5-BoysVIPW.js";import"./vendor-hast-util-sanitize-2aGO5ay8.js";import"./vendor-micromark-extension-gfm-CsfPlnlB.js";import"./vendor-micromark-extension-gfm-autolink-literal-BYug7onl.js";import"./vendor-micromark-extension-gfm-footnote-OFl1FCH2.js";import"./vendor-micromark-extension-gfm-strikethrough-CyFiuwBf.js";import"./vendor-micromark-extension-gfm-table-dgw4LfUw.js";import"./vendor-micromark-extension-gfm-task-list-item-Dnadzr9U.js";import"./vendor-mdast-util-gfm-CroMDYLM.js";import"./vendor-mdast-util-gfm-autolink-literal-CTruMtvI.js";import"./vendor-ccount-c2V3InAJ.js";import"./vendor-mdast-util-find-and-replace-DB9iC-bx.js";import"./vendor-escape-string-regexp-BaJN9MlJ.js";import"./vendor-mdast-util-gfm-footnote-C-csI7OF.js";import"./vendor-mdast-util-gfm-strikethrough-BcskTdio.js";import"./vendor-mdast-util-gfm-table-DhPwQIyj.js";import"./vendor-markdown-table-DvhhVmnL.js";import"./vendor-mdast-util-to-markdown-Cl3qaiyc.js";import"./vendor-longest-streak-CtXnX3Xp.js";import"./vendor-mdast-util-phrasing-4oVbNLC3.js";import"./vendor-mdast-util-gfm-task-list-item-DMU5mK_M.js";import"./vendor-mdast-util-to-hast-CWnLaQSO.js";import"./vendor-micromark-util-sanitize-uri-BbwQ7CLk.js";import"./vendor-trim-lines-D8znQY54.js";import"./vendor-micromark-extension-cjk-friendly-BzZDGrF5.js";import"./vendor-micromark-extension-cjk-friendly-util-D5lVNoxW.js";import"./vendor-get-east-asian-width-CPhS2cOv.js";import"./vendor-micromark-util-symbol-JJPacVTp.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-BZ3pe_qd.js";import"./vendor-micromark-extension-cjk-friendly-gfm-strikethrough-CqW-Ep4M.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-gfm-strikethrough-BdPDQFO7.js";import"./vendor-hast-util-from-html-isomorphic-B0Kn01s9.js";import"./vendor-hast-util-from-dom-DeNf9aYW.js";import"./vendor-katex-DBqql0K7.js";import"./vendor-hast-util-to-text-0GXLnBvt.js";import"./vendor-hast-util-is-element-CuOmiqQi.js";import"./vendor-unist-util-find-after-CMaZmLxc.js";import"./vendor-micromark-extension-math-BRFoDziv.js";import"./vendor-mdast-util-math-wB-IJCL0.js";import"./vendor-remend-r8cP_t-e.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-marked-DN3zOnEe.js";import"./vendor-hast-util-to-jsx-runtime-Bq6JeJCx.js";import"./vendor-style-to-js-CI2G4dgu.js";import"./vendor-style-to-object-BAv4SQXc.js";import"./vendor-inline-style-parser-BlqBsVO4.js";import"./vendor-hast-util-whitespace-D4Wp6AEg.js";import"./vendor-estree-util-is-identifier-name-BgBfM8ME.js";import"./vendor-vfile-message-DqhD22jI.js";import"./vendor-unified-1CQKw2_w.js";import"./vendor-bail-FqpXQuLt.js";import"./vendor-extend-B94qxKr5.js";import"./vendor-is-plain-obj-C1gvLhAf.js";import"./vendor-trough-B_b8ryxu.js";import"./vendor-vfile-BCWrK60u.js";import"./vendor-html-url-attributes-D46m5wfe.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./vendor-opencode-client-NJGkA1Ku.js";import"./vendor-fuse.js-Dw8P0qyA.js";function De(r){switch(r){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(r){return r==="wrong-service"||r==="unreachable"||r==="incompatible"}function we({onBack:r,showBackButton:e=!0,initialUrl:o="",initialLabel:a="",isRecoveryMode:n=!1,onConnect:l,onSwitchToLocal:m,showInstancePicker:i=!1}){const{t:s}=oe(),[h,x]=K.useState(o),[u,U]=K.useState(a),[R,y]=K.useState("idle"),[b,g]=K.useState(null),[S,C]=K.useState(""),[_,I]=K.useState([]),[D,w]=K.useState(()=>i?"instances":"add"),[v,j]=K.useState("");K.useEffect(()=>{i&&G().then(p=>I(p.hosts)).catch(p=>{C(p instanceof Error?p.message:String(p))})},[i]);const k=Le(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 G(),Ce=u.trim()||p,re=ne.hosts.find(se=>se.url===p),ae=re?re.id:`host-${Date.now().toString(16)}`,me={id:ae,label:Ce,url:p,apiUrl:p},Ne=re?ne.hosts.map(se=>se.id===ae?me:se):[...ne.hosts,me];if(await Z({hosts:Ne,defaultHostId:ae,initialHostChoiceCompleted:!0}),l?.(),k.redeemUrl){window.location.assign(k.redeemUrl);return}Y()&&await X()}catch(V){C(V instanceof Error?V.message:s("onboarding.remoteConnection.errors.failedToSaveConnection")),y("error")}},[k,u,l,s]),E=K.useCallback(async p=>{const V=await G();await Z({hosts:V.hosts,defaultHostId:p,initialHostChoiceCompleted:!0}),await X()},[]),z=K.useCallback(async()=>{y("testing"),C("");try{const p=await G(),V=await Ue(v,p.hosts);await Z({hosts:V.hosts,defaultHostId:V.hostId,initialHostChoiceCompleted:!0}),await X()}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]),c=R==="testing",N=A!==null&&!c,H=A!==null&&!c&&!ie(b?.status??null),T=De(b?.status??null),O=b?.status==="ok",M=b?.status==="update-recommended",q=b?.status==="auth",B=ie(b?.status??null);return i&&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:_.length===0?t.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:s("settings.remoteInstances.direct.state.empty")}):_.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")})]})]})}):i&&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(Q,{value:v,onChange:p=>j(p.target.value),placeholder:s("settings.remoteInstances.direct.import.placeholder"),disabled:c,autoFocus:!0}),S?t.jsx("div",{className:"text-sm text-[var(--status-error)]",children:S}):null,t.jsx(L,{onClick:()=>{z()},disabled:c||!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||i)&&t.jsx("div",{className:"flex items-center",children:t.jsx(L,{variant:"ghost",onClick:i?()=>w("instances"):r,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(Q,{id:"remote-url",type:"url",value:h,onChange:P,placeholder:s("onboarding.remoteConnection.field.serverAddressPlaceholder"),disabled:c})]}),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(Q,{id:"remote-label",type:"text",value:u,onChange:$,placeholder:s("onboarding.remoteConnection.field.namePlaceholder"),disabled:c})]})]}),b&&O&&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&&q&&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&&M&&t.jsx("div",{className:"rounded-lg border p-3 text-sm",style:{borderColor:"var(--status-warning)",color:"var(--status-warning)"},children:T?s(T):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:T?s(T):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(c?"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:r,className:"flex-1",children:s("onboarding.remoteConnection.actions.chooseDifferentServer")}),!n&&m&&t.jsx(L,{variant:"outline",size:"sm",onClick:m,className:"flex-1",children:s("onboarding.remoteConnection.actions.useLocalInstead")})]})]})]})})}const Ae="curl -fsSL https://opencode.ai/v2/install | bash",je="npm install -g @opencode/cli",Ke="https://opencode.ai/download",pe=2500;function Ee(r){const e=J.c(9),{windows:o,onCopy:a,copyTitle:n}=r;let l;e[0]!==o?(l=t.jsx(de,{as:"code",outerClassName:"overlay-scrollbar-wrapper--no-gutter flex-1 min-w-0",fillContainer:!1,className:"text-start 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]=l):l=e[1];let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(F,{name:"file-copy",className:"h-4 w-4"}),e[2]=m):m=e[2];let i;e[3]!==n||e[4]!==a?(i=t.jsx("button",{onClick:a,className:"inline-flex items-center text-muted-foreground hover:text-foreground transition-colors shrink-0",title:n,"aria-label":n,children:m}),e[3]=n,e[4]=a,e[5]=i):i=e[5];let s;return e[6]!==l||e[7]!==i?(s=t.jsxs("div",{className:"flex items-center justify-between gap-3 w-full",children:[l,i]}),e[6]=l,e[7]=i,e[8]=s):s=e[8],s}function Fe(){const r=J.c(5),e=Re(!0);let o;r[0]!==e?(o=ee("absolute inset-0 rounded-full",e),r[0]=e,r[1]=o):o=r[1];let a;r[2]===Symbol.for("react.memo_cache_sentinel")?(a={backgroundColor:"var(--primary-base)"},r[2]=a):a=r[2];let n;return r[3]!==o?(n=t.jsx("span",{className:o,style:a}),r[3]=o,r[4]=n):n=r[4],n}function He({onCliAvailable:r,localAvailable:e=!0}){const{t:o}=oe(),[a,n]=d.useState(!1),[l,m]=d.useState(!1),[i,s]=d.useState(!1),[h,x]=d.useState(!1),[u,U]=d.useState(""),R=fe(c=>c.opencodeBinary),[y,b]=d.useState("unknown"),[g,S]=d.useState(()=>e?"local":"remote"),[C,_]=d.useState(!1),[I,D]=d.useState(!1);d.useEffect(()=>{m(Y())},[]),d.useEffect(()=>{if(typeof navigator>"u"){b("unknown");return}const c=navigator.userAgent||"";/Windows/i.test(c)?b("windows"):/Macintosh|Mac OS X/i.test(c)?b("macos"):/Linux/i.test(c)?b("linux"):b("unknown")},[]),d.useEffect(()=>{let c=!1;return(async()=>{try{const N=await ge();if(!N||c)return;const H=N.opencodeBinary??"";H&&U(H)}catch{}})(),()=>{c=!0}},[]);const w=d.useCallback(async c=>{const N=c.target;N.closest(".app-region-no-drag")||N.closest("button, a, input, select, textarea, code, summary, details")||c.button===0&&l&&await be()},[l]),v=d.useCallback(async()=>{try{const c=await te("/health");if(!c.ok)return!1;const N=await c.json();return N.openCodeRunning===!0||N.isOpenCodeReady===!0}catch{return!1}},[]),j=d.useCallback(async c=>{if(!l)return;const N=await G();await Z({...N,...c==="local"?{defaultHostId:"local"}:{},initialHostChoiceCompleted:!0})},[l]),k=d.useCallback(async()=>{l&&await j("local"),r?.()},[l,r,j]);d.useEffect(()=>{if(!e||g!=="local")return;let c=!1,N=null;const H=async()=>{if(!c){try{const T=await v();if(c)return;if(T){await k();return}}catch{}c||(N=setTimeout(H,pe))}};return N=setTimeout(H,pe),()=>{c=!0,N&&clearTimeout(N)}},[g,v,k,e]);const A=d.useCallback(async()=>{x(!0);try{await v()&&await k()}finally{x(!1)}},[v,k]),P=d.useCallback(async()=>{if(!(typeof window>"u")&&l)try{const c=await ye();c.success&&c.path&&c.path.trim().length>0&&U(c.path.trim())}catch{}},[l]),$=d.useCallback(async()=>{s(!0);try{if(await ve({opencodeBinary:u.trim()}),l){await j("local"),await X();return}await te("/api/config/reload",{method:"POST"})}finally{setTimeout(()=>s(!1),1e3)}},[l,u,j]),W=d.useCallback(async()=>{const c=await xe(y==="windows"?je:Ae);c.ok?(n(!0),setTimeout(()=>n(!1),2e3)):console.error("Failed to copy:",c.error)},[y]),f=Ke,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&&(!l||g==="local");return t.jsx(de,{outerClassName:"h-full bg-transparent",className:"app-region-drag flex items-center justify-center p-8 cursor-default select-none",onMouseDown:w,disableHorizontal:!0,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(Se,{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")})]}),l&&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:ee("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:ee("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")})]}),l&&g==="remote"?t.jsx("div",{className:"app-region-no-drag mt-6",children:t.jsx(we,{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:a?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(Ee,{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(Fe,{})}),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-edge border-y border-edge",children:[t.jsxs("details",{className:"app-region-no-drag group",open:C,onToggle:c=>_(c.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(Q,{value:R??u,onChange:c=>U(c.target.value),placeholder:E,disabled:i||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:i||!l,children:o("onboarding.localSetup.actions.browse")}),t.jsx(L,{type:"button",size:"sm",onClick:$,disabled:i||!u.trim(),children:o("onboarding.localSetup.actions.apply")})]})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:o(R===null?"onboarding.localSetup.helper.saveAndReload":"onboarding.localSetup.helper.pinnedByAdministrator")})]})]}),t.jsxs("details",{className:"app-region-no-drag group",open:I,onToggle:c=>D(c.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 Oe="curl -fsSL https://opencode.ai/v2/install | bash",ke="npm install -g @opencode/cli",Me="https://opencode.ai/download";function Be(r){const e=J.c(9),{windows:o,onCopy:a,copyTitle:n}=r;let l;e[0]!==o?(l=t.jsx(de,{as:"code",outerClassName:"overlay-scrollbar-wrapper--no-gutter flex-1 min-w-0",fillContainer:!1,className:"text-start whitespace-nowrap",children:o?t.jsx("span",{style:{color:"var(--syntax-keyword)"},children:ke}):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]=l):l=e[1];let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(F,{name:"file-copy",className:"h-4 w-4"}),e[2]=m):m=e[2];let i;e[3]!==n||e[4]!==a?(i=t.jsx("button",{onClick:a,className:"inline-flex items-center text-muted-foreground hover:text-foreground transition-colors",title:n,"aria-label":n,children:m}),e[3]=n,e[4]=a,e[5]=i):i=e[5];let s;return e[6]!==l||e[7]!==i?(s=t.jsxs("div",{className:"flex items-center justify-center gap-3",children:[l,i]}),e[6]=l,e[7]=i,e[8]=s):s=e[8],s}const Pe=3e4;function $e({onBack:r,onCliAvailable:e,isFromRecovery:o=!1,onSwitchToRemote:a}){const{t:n}=oe(),[l,m]=d.useState(!1),[i,s]=d.useState(!1),[h,x]=d.useState(!1),[u,U]=d.useState(!1),[R,y]=d.useState(!1),[b,g]=d.useState(null),[S,C]=d.useState(""),_=fe(f=>f.opencodeBinary),[I,D]=d.useState("unknown");d.useEffect(()=>{const f=setTimeout(()=>s(!0),Pe);return()=>clearTimeout(f)},[]),d.useEffect(()=>{x(Y())},[]),d.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")},[]),d.useEffect(()=>{let f=!1;return(async()=>{try{const E=await ge();if(!E||f)return;const z=E.opencodeBinary??"";z&&C(z)}catch{}})(),()=>{f=!0}},[]);const w=d.useCallback(async f=>{f.target.closest("button, a, input, select, textarea, code")||f.button===0&&h&&await be()},[h]),v=d.useCallback(async()=>{try{const f=await te("/health");if(!f.ok)return!1;const E=await f.json();return E.openCodeRunning===!0||E.isOpenCodeReady===!0}catch{return!1}},[]),j=d.useCallback(async()=>{if(!(typeof window>"u")&&h)try{const f=await ye();f.success&&f.path&&f.path.trim().length>0&&C(f.path.trim())}catch{}},[h]),k=d.useCallback(async()=>{U(!0);try{if(await ve({opencodeBinary:S.trim()}),h){await X();return}await te("/api/config/reload",{method:"POST"})}finally{setTimeout(()=>U(!1),1e3)}},[h,S]),A=d.useCallback(async()=>{const f=await xe(I==="windows"?ke:Oe);f.ok?(m(!0),setTimeout(()=>m(!1),2e3)):console.error("Failed to copy:",f.error)},[I]),P=d.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]),$=Me,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:r,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:l?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(Be,{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(Q,{value:_??S,onChange:f=>C(f.target.value),placeholder:W,disabled:u||_!==null,className:"flex-1 font-mono text-xs"}),_===null&&t.jsxs(t.Fragment,{children:[t.jsx(L,{type:"button",variant:"secondary",onClick:j,disabled:u||!h,children:n("onboarding.localSetup.actions.browse")}),t.jsx(L,{type:"button",onClick:k,disabled:u,children:n("onboarding.localSetup.actions.apply")})]})]}),t.jsx("div",{className:"text-xs text-muted-foreground",children:n(_===null?"onboarding.localSetup.helper.saveAndReload":"onboarding.localSetup.helper.pinnedByAdministrator")})]})}),o&&a&&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:a,children:n("onboarding.localSetup.actions.connectRemoteServer")})]})]}),i&&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",children:n("onboarding.localSetup.windows.hintDetectionFailed")})}):t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-sm text-muted-foreground",children:n("onboarding.localSetup.hint.ensurePath")}),t.jsx("p",{className:"text-sm text-muted-foreground",children:n("onboarding.localSetup.hint.setEnv")}),t.jsx("p",{className:"text-sm text-muted-foreground",children:n("onboarding.localSetup.hint.missingRuntime")})]})})]})}function le(r,e){if(r?.trim())return ce(r.trim());if(e)return ce(e)}function We(r,e,o){switch(r){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 a=le(e,o);return{title:"Remote Server Unreachable",description:`Could not connect to "${a||"the remote server"}". Check your network connection and verify the server address.`,titleKey:"onboarding.desktopRecovery.remoteUnreachable.title",descriptionKey:"onboarding.desktopRecovery.remoteUnreachable.description",descriptionParams:a?{host:a}: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 a=le(e,o);return{title:"Incompatible Server",description:`The server at "${a||"unknown"}" is not running OpenChamber. Verify the address points to an OpenChamber server.`,titleKey:"onboarding.desktopRecovery.incompatibleServer.title",descriptionKey:"onboarding.desktopRecovery.incompatibleServer.description",descriptionParams:a?{host:a}: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 a=le(e,o);return{title:"Server Update Required",description:`The OpenChamber server at "${a||"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:a?{host:a}: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 a=r;throw new Error(`Unknown recovery variant: ${a}`)}}}const ze="openchamber update";function Ve(r){const e=J.c(17),{state:o}=r,{t:a}=oe();if(o.kind==="idle"||o.kind==="updating")return null;let n;e[0]!==o.kind||e[1]!==a?(n=o.kind==="refused"?a("onboarding.desktopRecovery.remoteIncompatible.updateRefused"):o.kind==="auth"?a("onboarding.desktopRecovery.remoteIncompatible.updateAuth"):a("onboarding.desktopRecovery.remoteIncompatible.updateTimeout"),e[0]=o.kind,e[1]=a,e[2]=n):n=e[2];const l=n;let m;e[3]!==l?(m=t.jsx("p",{className:"typography-meta text-[var(--status-error)]",children:l}),e[3]=l,e[4]=m):m=e[4];let i;e[5]!==o.error||e[6]!==o.kind?(i=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]=i):i=e[7];let s;e[8]!==a?(s=a("onboarding.desktopRecovery.remoteIncompatible.manualUpdate"),e[8]=a,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:ze}),e[12]=x):x=e[12];let u;return e[13]!==m||e[14]!==i||e[15]!==h?(u=t.jsxs("div",{className:"space-y-2",children:[m,i,h,x]}),e[13]=m,e[14]=i,e[15]=h,e[16]=u):u=e[16],u}function Xe(r){switch(r){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 Ye({variant:r,hostLabel:e,hostUrl:o,onRetry:a,onUseLocal:n,onUseRemote:l,isRetrying:m=!1,onUpdateServer:i,serverUpdate:s={kind:"idle"}}){const h=s.kind==="updating",{t:x}=oe(),u=We(r,e,o),U=u.retryLabelKey??"onboarding.desktopRecovery.actions.retryConnection",R=d.useMemo(()=>{if(u.descriptionParams?.host)return u.descriptionParams;if(r==="remote-unreachable")return{host:x("onboarding.desktopRecovery.placeholders.remoteServer")};if(r==="remote-wrong-service"||r==="remote-incompatible")return{host:x("onboarding.desktopRecovery.placeholders.unknownServer")}},[u.descriptionParams,x,r]);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:Xe(u.iconKey)})}),t.jsx("h1",{className:"typography-ui-header text-xl font-semibold text-foreground",children:x(u.titleKey)}),t.jsx("p",{className:"text-muted-foreground text-sm max-w-sm",children:x(u.descriptionKey,R)})]}),o&&(r==="remote-unreachable"||r==="remote-wrong-service"||r==="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:[i&&t.jsxs(t.Fragment,{children:[t.jsxs(L,{onClick:i,disabled:h||m,className:"w-full",children:[t.jsx(F,{name:h?"loader":"download",className:ee("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(Ve,{state:s})]}),u.showRetry&&a&&t.jsxs(L,{onClick:a,disabled:m||h,variant:i?"outline":"default",className:"w-full",children:[t.jsx(F,{name:"refresh",className:ee("h-4 w-4",m&&"animate-spin")}),x(m?"onboarding.desktopRecovery.actions.retrying":U)]}),t.jsxs("div",{className:"flex gap-2",children:[u.showUseLocal&&n&&t.jsxs(L,{variant:"outline",onClick:n,disabled:m||h,className:"flex-1",children:[t.jsx(F,{name:"macbook",className:"h-4 w-4"}),x(u.useLocalLabelKey)]}),u.showUseRemote&&l&&t.jsxs(L,{variant:"outline",onClick:l,disabled:m||h,className:"flex-1",children:[t.jsx(F,{name:"server",className:"h-4 w-4"}),x(u.useRemoteLabelKey)]})]})]})]})})}function he(r,e){if(e==="use-remote")return{kind:"remote-form"};switch(r){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=r;throw new Error(`Unhandled RecoveryVariant: ${o}`)}}}function qe(r){const e=J.c(39),{variant:o,hostUrl:a,hostLabel:n,hostId:l,onRetry:m,onChooseRemote:i,showRemoteForm:s,onCloseRemoteForm:h,onSwitchToLocalFromRemote:x,onEnterLocalSetup:u,isRetrying:U,localAvailable:R}=r,y=s===void 0?!1:s,b=U===void 0?!1:U,g=R===void 0?!0:R,S=Je;let C;e[0]!==m?(C=async()=>{if(Y()){await X();return}await te("/api/config/reload",{method:"POST"}),m?.()},e[0]=m,e[1]=C):C=e[1];const _=C;let I;e[2]!==u||e[3]!==o?(I=async()=>{if(he(o,"use-local").kind==="local-setup"){u?.();return}if(await S("local"),Y()){await X();return}window.location.reload()},e[2]=u,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]=d.useState(w),[k,A]=d.useState(null);let P,$;e[6]!==l||e[7]!==o?(P=()=>{if(A(null),o!=="remote-incompatible"||!l||!Y())return;let T=!1;return G().then(O=>{const M=O.hosts.find(B=>B.id===l),q=Ie(M?.apiUrl||M?.url||"");!T&&q&&A(l)}).catch(Ge),()=>{T=!0}},$=[o,l],e[6]=l,e[7]=o,e[8]=P,e[9]=$):(P=e[8],$=e[9]),d.useEffect(P,$);let W;e[10]===Symbol.for("react.memo_cache_sentinel")?(W=async T=>{j({kind:"updating"});try{const O=await _e(T);if(O.status==="auth"){j({kind:"auth"});return}if(O.status==="failed"){j({kind:"refused",error:O.error});return}if(await Te(T)==="timeout"){j({kind:"timeout"});return}await X()||j({kind:"idle"})}catch{j({kind:"timeout"})}},e[10]=W):W=e[10];const f=W;let E;e[11]!==i||e[12]!==o?(E=()=>{he(o,"use-remote").kind==="remote-form"&&i?.()},e[11]=i,e[12]=o,e[13]=E):E=e[13];const z=E;if(y){const T=o==="remote-wrong-service"?"":a||"",O=o==="remote-wrong-service"?"":n||"";let M;e[14]!==i||e[15]!==h?(M=h||(()=>i?.()),e[14]=i,e[15]=h,e[16]=M):M=e[16];const q=!g;let B;e[17]!==g||e[18]!==u||e[19]!==x?(B=g?x||(()=>{S("local").then(()=>{Y()?X():u?.()})}):void 0,e[17]=g,e[18]=u,e[19]=x,e[20]=B):B=e[20];let p;return e[21]!==O||e[22]!==T||e[23]!==M||e[24]!==q||e[25]!==B?(p=t.jsx(we,{onBack:M,initialUrl:T,initialLabel:O,isRecoveryMode:!0,showInstancePicker:q,onSwitchToLocal:B}),e[21]=O,e[22]=T,e[23]=M,e[24]=q,e[25]=B,e[26]=p):p=e[26],p}const c=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]!==_||e[30]!==z||e[31]!==n||e[32]!==a||e[33]!==b||e[34]!==v||e[35]!==c||e[36]!==N||e[37]!==o?(H=t.jsx(Ye,{variant:o,hostLabel:n,hostUrl:a,onRetry:_,onUseLocal:c,onUseRemote:z,isRetrying:b,onUpdateServer:N,serverUpdate:v}),e[29]=_,e[30]=z,e[31]=n,e[32]=a,e[33]=b,e[34]=v,e[35]=c,e[36]=N,e[37]=o,e[38]=H):H=e[38],H}function Ge(){}async function Je(r){if(!Y())return;const e=await G();await Z({...e,...r==="local"?{defaultHostId:"local"}:{},initialHostChoiceCompleted:!0})}function gn(r){const e=J.c(30),{onBack:o,onCliAvailable:a,mode:n,recoveryVariant:l,recoveryHostUrl:m,recoveryHostLabel:i,recoveryHostId:s,onEnterLocalSetup:h,localAvailable:x}=r,u=n===void 0?"first-launch":n,U=l===void 0?"missing-default-host":l,R=x===void 0?!0:x,[y,b]=d.useState(!1),[g,S]=d.useState(!1);let C;e[0]===Symbol.for("react.memo_cache_sentinel")?(C=()=>{S(!1),b(!1)},e[0]=C):C=e[0];let _;e[1]!==u||e[2]!==i||e[3]!==m||e[4]!==U?(_=[u,U,m,i],e[1]=u,e[2]=i,e[3]=m,e[4]=U,e[5]=_):_=e[5],d.useEffect(C,_);const I=g?"local-setup":u;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]!==i||e[14]!==m||e[15]!==U||e[16]!==y||e[17]!==k?(A=t.jsx(qe,{variant:U,hostUrl:m,hostLabel:i,hostId:s,onChooseRemote:w,showRemoteForm:y,onCloseRemoteForm:v,onSwitchToLocalFromRemote:j,onEnterLocalSetup:k,localAvailable:R}),e[11]=R,e[12]=s,e[13]=i,e[14]=m,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]!==a||e[24]!==g||e[25]!==w?(j=t.jsx($e,{onBack:w,onCliAvailable:a,isFromRecovery:g,onSwitchToRemote:v}),e[23]=a,e[24]=g,e[25]=w,e[26]=j):j=e[26],j}let D;return e[27]!==R||e[28]!==a?(D=t.jsx(He,{onCliAvailable:a,localAvailable:R}),e[27]=R,e[28]=a,e[29]=D):D=e[29],D}export{gn as OnboardingScreen};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as z,R as F,j as p}from"./vendor-react--VO_rL_p.js";import{u as L,z as H,B as O,A as _,b8 as U,l as B,F as E,D as I,n as P,q as $,t as A}from"./useAppFontEffects-xaAfmUwn.js";import{b7 as q,v as W,b8 as G,u as T}from"./katex.min-2cmqKX7p.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-base-ui-CHqK1aDI.js";import"./vendor-floating-ui-utils-BzXdqYpP.js";import"./vendor-floating-ui-dom-WyXykhNi.js";import"./vendor-floating-ui-core-CXmKXOXc.js";import"./vendor-floating-ui-react-dom-Cy8dRGoy.js";import"./vendor-use-sync-external-store-CfLJGVyr.js";import"./vendor-zod-B_hXR7jf.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-zustand-C9tWdk0j.js";import"./vendor-dnd-kit-core-Br1Cs7RV.js";import"./vendor-dnd-kit-utilities-DZ9KbT5S.js";import"./vendor-dnd-kit-accessibility-CYclfhtC.js";import"./vendor-dnd-kit-sortable-DpfLEOLv.js";import"./vendor-tanstack-react-virtual-Bw3q1rnq.js";import"./vendor-tanstack-virtual-core-B4TJYmIq.js";import"./vendor-framer-motion-C_wK4GIM.js";import"./vendor-motion-dom-HXPOMxb7.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-capacitor-core-B4EWRrHz.js";import"./vendor-codemirror-commands-CjjsURR-.js";import"./vendor-codemirror-state-Cd8udR5z.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-view-Ciie9ey-.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-codemirror-language-8HZTPOnt.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CZEcqU6G.js";import"./vendor-codemirror-streamparser-CmlTsbN2.js";import"./vendor-codemirror-lang-javascript-DmqaSK_j.js";import"./vendor-lezer-javascript-CWSwshuO.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-BGedy2gC.js";import"./vendor-codemirror-lang-json-DVAYKmoO.js";import"./vendor-lezer-json-Cn1mncjr.js";import"./vendor-codemirror-lang-css-BLpgXfL2.js";import"./vendor-lezer-css-B2Hx_Nps.js";import"./vendor-codemirror-lang-html-S3jxr3Mo.js";import"./vendor-lezer-html-Cr8K5DGw.js";import"./vendor-codemirror-lang-markdown-D1jveRI5.js";import"./vendor-lezer-markdown-TQKzBB8i.js";import"./vendor-codemirror-language-data-CSQf665k.js";import"./vendor-codemirror-lang-python-B-5UC9Ui.js";import"./vendor-lezer-python-BUoImtUb.js";import"./vendor-sonner-Dw26OnzC.js";import"./vendor-cmdk-BtSpU-Io.js";import"./vendor-radix-ui-react-dialog-OIW6VLWw.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-D4RvEbuR.js";import"./vendor-radix-ui-react-context-BbFoxCHu.js";import"./vendor-radix-ui-react-id-aGag8i_5.js";import"./vendor-radix-ui-react-use-layout-effect-B1oLzD-j.js";import"./vendor-radix-ui-react-use-controllable-state-BjnNPGHq.js";import"./vendor-radix-ui-react-dismissable-layer-DpT6mMbO.js";import"./vendor-radix-ui-react-primitive-CrN9dRDb.js";import"./vendor-radix-ui-react-slot-BjbalUfz.js";import"./vendor-radix-ui-react-use-callback-ref-CcC_buIU.js";import"./vendor-radix-ui-react-use-escape-keydown-Cp1WWKTC.js";import"./vendor-radix-ui-react-focus-scope-D1noLHmd.js";import"./vendor-radix-ui-react-portal-BlUEzfrF.js";import"./vendor-radix-ui-react-presence-BGqFfiW4.js";import"./vendor-radix-ui-react-focus-guards-CSS2IbZC.js";import"./vendor-react-remove-scroll-Der_cv-1.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-Clwl9llp.js";import"./vendor-react-style-singleton-D_xJlTqU.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-BdLl6ZIw.js";import"./vendor-use-callback-ref-CXJF1lEr.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-legendapp-list-iLtL-MFj.js";import"./vendor-streamdown-BbSYZ3NF.js";import"./vendor-markdown-BTUqNk6W.js";import"./vendor-mdast-util-from-markdown-CZHjOE75.js";import"./vendor-micromark-util-decode-numeric-character-reference-CNs1qBpV.js";import"./vendor-micromark-util-decode-string-fHsnqYdj.js";import"./vendor-decode-named-character-reference-C3-224fz.js";import"./vendor-micromark-util-normalize-identifier-C9ANKk3v.js";import"./vendor-micromark-AWM-NZXP.js";import"./vendor-micromark-util-combine-extensions-d8XJZrgA.js";import"./vendor-micromark-util-chunked-DrRIdSP-.js";import"./vendor-micromark-factory-space-PzSHLgmq.js";import"./vendor-micromark-util-character-CW3Cu1MS.js";import"./vendor-micromark-core-commonmark-kzTLNXAm.js";import"./vendor-micromark-util-classify-character-tcLuZZwM.js";import"./vendor-micromark-util-resolve-all-PQCKh0dx.js";import"./vendor-micromark-util-subtokenize-BF1Jf29a.js";import"./vendor-micromark-factory-destination-Sj0xfi0V.js";import"./vendor-micromark-factory-label-amyP0HdC.js";import"./vendor-micromark-factory-title-khnLkZK6.js";import"./vendor-micromark-factory-whitespace-eIB00uTl.js";import"./vendor-micromark-util-html-tag-name-DbKNfynz.js";import"./vendor-unist-util-stringify-position-Ch_qCilz.js";import"./vendor-mdast-util-to-string-C_aolqmU.js";import"./vendor-unist-util-visit-DhPeCsfG.js";import"./vendor-unist-util-visit-parents-DlviEg7Z.js";import"./vendor-unist-util-is-BPZGFiMU.js";import"./vendor-hast-util-raw-DvvLJg15.js";import"./vendor-ungap-structured-clone--gfxRhYI.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-parse5-DwmzEj2o.js";import"./vendor-entities-wUUgTZDW.js";import"./vendor-web-namespaces-bsVAaBS1.js";import"./vendor-zwitch-C2o2j-tx.js";import"./vendor-unist-util-position-60F3QETU.js";import"./vendor-hast-util-from-parse5-Ba3T6RJI.js";import"./vendor-devlop-0Dp3JUBc.js";import"./vendor-property-information-Boo8Xpef.js";import"./vendor-hastscript-BrPNioaz.js";import"./vendor-comma-separated-tokens-CRUGqg4f.js";import"./vendor-space-separated-tokens-D7QSIrTI.js";import"./vendor-hast-util-parse-selector-TXfch5wI.js";import"./vendor-vfile-location-LfEFwJ2h.js";import"./vendor-hast-util-to-parse5-BoysVIPW.js";import"./vendor-hast-util-sanitize-2aGO5ay8.js";import"./vendor-micromark-extension-gfm-CsfPlnlB.js";import"./vendor-micromark-extension-gfm-autolink-literal-BYug7onl.js";import"./vendor-micromark-extension-gfm-footnote-OFl1FCH2.js";import"./vendor-micromark-extension-gfm-strikethrough-CyFiuwBf.js";import"./vendor-micromark-extension-gfm-table-dgw4LfUw.js";import"./vendor-micromark-extension-gfm-task-list-item-Dnadzr9U.js";import"./vendor-mdast-util-gfm-CroMDYLM.js";import"./vendor-mdast-util-gfm-autolink-literal-CTruMtvI.js";import"./vendor-ccount-c2V3InAJ.js";import"./vendor-mdast-util-find-and-replace-DB9iC-bx.js";import"./vendor-escape-string-regexp-BaJN9MlJ.js";import"./vendor-mdast-util-gfm-footnote-C-csI7OF.js";import"./vendor-mdast-util-gfm-strikethrough-BcskTdio.js";import"./vendor-mdast-util-gfm-table-DhPwQIyj.js";import"./vendor-markdown-table-DvhhVmnL.js";import"./vendor-mdast-util-to-markdown-Cl3qaiyc.js";import"./vendor-longest-streak-CtXnX3Xp.js";import"./vendor-mdast-util-phrasing-4oVbNLC3.js";import"./vendor-mdast-util-gfm-task-list-item-DMU5mK_M.js";import"./vendor-mdast-util-to-hast-CWnLaQSO.js";import"./vendor-micromark-util-sanitize-uri-BbwQ7CLk.js";import"./vendor-trim-lines-D8znQY54.js";import"./vendor-micromark-extension-cjk-friendly-BzZDGrF5.js";import"./vendor-micromark-extension-cjk-friendly-util-D5lVNoxW.js";import"./vendor-get-east-asian-width-CPhS2cOv.js";import"./vendor-micromark-util-symbol-JJPacVTp.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-BZ3pe_qd.js";import"./vendor-micromark-extension-cjk-friendly-gfm-strikethrough-CqW-Ep4M.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-gfm-strikethrough-BdPDQFO7.js";import"./vendor-hast-util-from-html-isomorphic-B0Kn01s9.js";import"./vendor-hast-util-from-dom-DeNf9aYW.js";import"./vendor-katex-DBqql0K7.js";import"./vendor-hast-util-to-text-0GXLnBvt.js";import"./vendor-hast-util-is-element-CuOmiqQi.js";import"./vendor-unist-util-find-after-CMaZmLxc.js";import"./vendor-micromark-extension-math-BRFoDziv.js";import"./vendor-mdast-util-math-wB-IJCL0.js";import"./vendor-remend-r8cP_t-e.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-marked-DN3zOnEe.js";import"./vendor-hast-util-to-jsx-runtime-Bq6JeJCx.js";import"./vendor-style-to-js-CI2G4dgu.js";import"./vendor-style-to-object-BAv4SQXc.js";import"./vendor-inline-style-parser-BlqBsVO4.js";import"./vendor-hast-util-whitespace-D4Wp6AEg.js";import"./vendor-estree-util-is-identifier-name-BgBfM8ME.js";import"./vendor-vfile-message-DqhD22jI.js";import"./vendor-unified-1CQKw2_w.js";import"./vendor-bail-FqpXQuLt.js";import"./vendor-extend-B94qxKr5.js";import"./vendor-is-plain-obj-C1gvLhAf.js";import"./vendor-trough-B_b8ryxu.js";import"./vendor-vfile-BCWrK60u.js";import"./vendor-html-url-attributes-D46m5wfe.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./vendor-opencode-client-NJGkA1Ku.js";import"./vendor-fuse.js-Dw8P0qyA.js";const J=()=>{const t=z.c(37),{t:o}=L();let D;t[0]===Symbol.for("react.memo_cache_sentinel")?(D={kind:"idle"},t[0]=D):D=t[0];const[i,r]=F.useState(D);let S;t[1]===Symbol.for("react.memo_cache_sentinel")?(S=async()=>{r({kind:"writing"});try{const{path:e}=await W.writeHeapSnapshot();r({kind:"written",path:e})}catch{r({kind:"failed"})}},t[1]=S):S=t[1];const w=S;let C;t[2]!==o?(C=async e=>{await G(e)||_.error(o("openCodeStatusDialog.heapSnapshot.revealFailed"))},t[2]=o,t[3]=C):C=t[3];const y=C;let d;t[4]!==o?(d=async e=>{(await U(e)).ok?_.success(o("openCodeStatusDialog.heapSnapshot.pathCopied")):_.error(o("openCodeStatusDialog.heapSnapshot.copyFailed"))},t[4]=o,t[5]=d):d=t[5];const f=d;let a;t:{switch(i.kind){case"idle":{let e;t[6]!==o?(e=o("openCodeStatusDialog.heapSnapshot.hint"),t[6]=o,t[7]=e):e=t[7],a=e;break t}case"writing":{let e;t[8]!==o?(e=o("openCodeStatusDialog.heapSnapshot.writing"),t[8]=o,t[9]=e):e=t[9],a=e;break t}case"written":{let e;t[10]!==i.path||t[11]!==o?(e=o("openCodeStatusDialog.heapSnapshot.written",{path:i.path}),t[10]=i.path,t[11]=o,t[12]=e):e=t[12],a=e;break t}case"failed":{let e;t[13]!==o?(e=o("openCodeStatusDialog.heapSnapshot.failed"),t[13]=o,t[14]=e):e=t[14],a=e;break t}}a=void 0}const u=a;let m;t[15]!==i.kind?(m=i.kind==="writing"&&p.jsx(H,{className:"text-muted-foreground","aria-hidden":!0}),t[15]=i.kind,t[16]=m):m=t[16];const k=i.kind==="failed"?"min-w-0 flex-1 truncate typography-meta text-destructive":"min-w-0 flex-1 truncate typography-meta text-muted-foreground";let s;t[17]!==u||t[18]!==k?(s=p.jsx("p",{className:k,title:u,children:u}),t[17]=u,t[18]=k,t[19]=s):s=t[19];let n;t[20]!==f||t[21]!==y||t[22]!==i.kind||t[23]!==i.path||t[24]!==o?(n=i.kind==="written"&&(q()?p.jsx(O,{type:"button",variant:"ghost",size:"sm",onClick:()=>{y(i.path)},children:o("openCodeStatusDialog.heapSnapshot.reveal")}):p.jsx(O,{type:"button",variant:"ghost",size:"sm",onClick:()=>{f(i.path)},children:o("openCodeStatusDialog.heapSnapshot.copyPath")})),t[20]=f,t[21]=y,t[22]=i.kind,t[23]=i.path,t[24]=o,t[25]=n):n=t[25];let x;t[26]===Symbol.for("react.memo_cache_sentinel")?(x=()=>{w()},t[26]=x):x=t[26];const g=i.kind==="writing";let l;t[27]!==o?(l=o("openCodeStatusDialog.heapSnapshot.action"),t[27]=o,t[28]=l):l=t[28];let c;t[29]!==g||t[30]!==l?(c=p.jsx(O,{type:"button",variant:"outline",size:"sm",onClick:x,disabled:g,children:l}),t[29]=g,t[30]=l,t[31]=c):c=t[31];let h;return t[32]!==c||t[33]!==m||t[34]!==s||t[35]!==n?(h=p.jsxs("div",{className:"flex items-center gap-2",children:[m,s,n,c]}),t[32]=c,t[33]=m,t[34]=s,t[35]=n,t[36]=h):h=t[36],h},hi=()=>{const t=z.c(45),{t:o}=L(),D=T(K),i=T(M),r=T(Q);let S;t[0]!==r||t[1]!==o?(S=async()=>{if(!r)return;if((await U(r)).ok){_.success(o("openCodeStatusDialog.toast.copiedTitle"),{description:o("openCodeStatusDialog.toast.copiedDescription")});return}_.error(o("openCodeStatusDialog.toast.copyFailed"))},t[0]=r,t[1]=o,t[2]=S):S=t[2];const w=S;let C;t[3]!==r?(C=()=>{if(!r)return;const N=URL.createObjectURL(new Blob([r],{type:"text/plain;charset=utf-8"})),v=document.createElement("a");v.href=N,v.download=`openchamber-diagnostics-${new Date().toISOString().replace(/[:.]/g,"-")}.log`,document.body.appendChild(v),v.click(),v.remove(),setTimeout(()=>URL.revokeObjectURL(N),1e3)},t[3]=r,t[4]=C):C=t[4];const y=C;let d;t[5]!==o?(d=o("openCodeStatusDialog.title"),t[5]=o,t[6]=d):d=t[6];let f;t[7]!==d?(f=p.jsx(B,{children:d}),t[7]=d,t[8]=f):f=t[8];let a;t[9]!==o?(a=o("openCodeStatusDialog.description"),t[9]=o,t[10]=a):a=t[10];let u;t[11]!==a?(u=p.jsx(E,{children:a}),t[11]=a,t[12]=u):u=t[12];let m;t[13]!==f||t[14]!==u?(m=p.jsxs(I,{children:[f,u]}),t[13]=f,t[14]=u,t[15]=m):m=t[15];const k=!r;let s;t[16]!==o?(s=o("openCodeStatusDialog.actions.copy"),t[16]=o,t[17]=s):s=t[17];let n;t[18]!==w||t[19]!==k||t[20]!==s?(n=p.jsx(O,{type:"button",variant:"outline",onClick:w,disabled:k,children:s}),t[18]=w,t[19]=k,t[20]=s,t[21]=n):n=t[21];const x=!r;let g;t[22]!==o?(g=o("openCodeStatusDialog.actions.download"),t[22]=o,t[23]=g):g=t[23];let l;t[24]!==y||t[25]!==x||t[26]!==g?(l=p.jsx(O,{type:"button",onClick:y,disabled:x,children:g}),t[24]=y,t[25]=x,t[26]=g,t[27]=l):l=t[27];let c;t[28]!==l||t[29]!==n?(c=p.jsxs("div",{className:"flex items-center justify-end gap-2",children:[n,l]}),t[28]=l,t[29]=n,t[30]=c):c=t[30];let h;t[31]!==r||t[32]!==o?(h=r||o("openCodeStatusDialog.empty.noData"),t[31]=r,t[32]=o,t[33]=h):h=t[33];let e;t[34]!==h?(e=p.jsx(P,{as:"pre",dir:"ltr",outerClassName:"max-h-[60vh] rounded-lg bg-surface-muted",className:"p-4 typography-code text-foreground whitespace-pre-wrap",disableHorizontal:!0,children:h}),t[34]=h,t[35]=e):e=t[35];let j;t[36]===Symbol.for("react.memo_cache_sentinel")?(j=p.jsx(J,{}),t[36]=j):j=t[36];let b;t[37]!==c||t[38]!==e||t[39]!==m?(b=p.jsxs($,{className:"max-w-2xl",children:[m,c,e,j]}),t[37]=c,t[38]=e,t[39]=m,t[40]=b):b=t[40];let R;return t[41]!==D||t[42]!==i||t[43]!==b?(R=p.jsx(A,{open:D,onOpenChange:i,children:b}),t[41]=D,t[42]=i,t[43]=b,t[44]=R):R=t[44],R};function K(t){return t.isOpenCodeStatusDialogOpen}function M(t){return t.setOpenCodeStatusDialogOpen}function Q(t){return t.openCodeStatusText}export{hi as OpenCodeStatusDialog};
|
|
1
|
+
import{f as z,R as F,j as p}from"./vendor-react--VO_rL_p.js";import{u as L,z as H,B as O,A as _,b8 as U,l as B,F as E,D as I,n as P,q as $,t as A}from"./useAppFontEffects-DEX5CMOn.js";import{b7 as q,v as W,b8 as G,u as T}from"./katex.min-CAwHaRYk.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-base-ui-CHqK1aDI.js";import"./vendor-floating-ui-utils-BzXdqYpP.js";import"./vendor-floating-ui-dom-WyXykhNi.js";import"./vendor-floating-ui-core-CXmKXOXc.js";import"./vendor-floating-ui-react-dom-Cy8dRGoy.js";import"./vendor-use-sync-external-store-CfLJGVyr.js";import"./vendor-zod-B_hXR7jf.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-zustand-C9tWdk0j.js";import"./vendor-dnd-kit-core-Br1Cs7RV.js";import"./vendor-dnd-kit-utilities-DZ9KbT5S.js";import"./vendor-dnd-kit-accessibility-CYclfhtC.js";import"./vendor-dnd-kit-sortable-DpfLEOLv.js";import"./vendor-tanstack-react-virtual-Bw3q1rnq.js";import"./vendor-tanstack-virtual-core-B4TJYmIq.js";import"./vendor-framer-motion-C_wK4GIM.js";import"./vendor-motion-dom-HXPOMxb7.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-capacitor-core-B4EWRrHz.js";import"./vendor-codemirror-commands-CjjsURR-.js";import"./vendor-codemirror-state-Cd8udR5z.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-view-Ciie9ey-.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-codemirror-language-8HZTPOnt.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CZEcqU6G.js";import"./vendor-codemirror-streamparser-CmlTsbN2.js";import"./vendor-codemirror-lang-javascript-DmqaSK_j.js";import"./vendor-lezer-javascript-CWSwshuO.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-BGedy2gC.js";import"./vendor-codemirror-lang-json-DVAYKmoO.js";import"./vendor-lezer-json-Cn1mncjr.js";import"./vendor-codemirror-lang-css-BLpgXfL2.js";import"./vendor-lezer-css-B2Hx_Nps.js";import"./vendor-codemirror-lang-html-S3jxr3Mo.js";import"./vendor-lezer-html-Cr8K5DGw.js";import"./vendor-codemirror-lang-markdown-D1jveRI5.js";import"./vendor-lezer-markdown-TQKzBB8i.js";import"./vendor-codemirror-language-data--j1xV4at.js";import"./vendor-codemirror-lang-python-B-5UC9Ui.js";import"./vendor-lezer-python-BUoImtUb.js";import"./vendor-sonner-Dw26OnzC.js";import"./vendor-cmdk-BtSpU-Io.js";import"./vendor-radix-ui-react-dialog-OIW6VLWw.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-D4RvEbuR.js";import"./vendor-radix-ui-react-context-BbFoxCHu.js";import"./vendor-radix-ui-react-id-aGag8i_5.js";import"./vendor-radix-ui-react-use-layout-effect-B1oLzD-j.js";import"./vendor-radix-ui-react-use-controllable-state-BjnNPGHq.js";import"./vendor-radix-ui-react-dismissable-layer-DpT6mMbO.js";import"./vendor-radix-ui-react-primitive-CrN9dRDb.js";import"./vendor-radix-ui-react-slot-BjbalUfz.js";import"./vendor-radix-ui-react-use-callback-ref-CcC_buIU.js";import"./vendor-radix-ui-react-use-escape-keydown-Cp1WWKTC.js";import"./vendor-radix-ui-react-focus-scope-D1noLHmd.js";import"./vendor-radix-ui-react-portal-BlUEzfrF.js";import"./vendor-radix-ui-react-presence-BGqFfiW4.js";import"./vendor-radix-ui-react-focus-guards-CSS2IbZC.js";import"./vendor-react-remove-scroll-Der_cv-1.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-Clwl9llp.js";import"./vendor-react-style-singleton-D_xJlTqU.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-BdLl6ZIw.js";import"./vendor-use-callback-ref-CXJF1lEr.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-legendapp-list-iLtL-MFj.js";import"./vendor-streamdown-BbSYZ3NF.js";import"./vendor-markdown-BTUqNk6W.js";import"./vendor-mdast-util-from-markdown-CZHjOE75.js";import"./vendor-micromark-util-decode-numeric-character-reference-CNs1qBpV.js";import"./vendor-micromark-util-decode-string-fHsnqYdj.js";import"./vendor-decode-named-character-reference-C3-224fz.js";import"./vendor-micromark-util-normalize-identifier-C9ANKk3v.js";import"./vendor-micromark-AWM-NZXP.js";import"./vendor-micromark-util-combine-extensions-d8XJZrgA.js";import"./vendor-micromark-util-chunked-DrRIdSP-.js";import"./vendor-micromark-factory-space-PzSHLgmq.js";import"./vendor-micromark-util-character-CW3Cu1MS.js";import"./vendor-micromark-core-commonmark-kzTLNXAm.js";import"./vendor-micromark-util-classify-character-tcLuZZwM.js";import"./vendor-micromark-util-resolve-all-PQCKh0dx.js";import"./vendor-micromark-util-subtokenize-BF1Jf29a.js";import"./vendor-micromark-factory-destination-Sj0xfi0V.js";import"./vendor-micromark-factory-label-amyP0HdC.js";import"./vendor-micromark-factory-title-khnLkZK6.js";import"./vendor-micromark-factory-whitespace-eIB00uTl.js";import"./vendor-micromark-util-html-tag-name-DbKNfynz.js";import"./vendor-unist-util-stringify-position-Ch_qCilz.js";import"./vendor-mdast-util-to-string-C_aolqmU.js";import"./vendor-unist-util-visit-DhPeCsfG.js";import"./vendor-unist-util-visit-parents-DlviEg7Z.js";import"./vendor-unist-util-is-BPZGFiMU.js";import"./vendor-hast-util-raw-DvvLJg15.js";import"./vendor-ungap-structured-clone--gfxRhYI.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-parse5-DwmzEj2o.js";import"./vendor-entities-wUUgTZDW.js";import"./vendor-web-namespaces-bsVAaBS1.js";import"./vendor-zwitch-C2o2j-tx.js";import"./vendor-unist-util-position-60F3QETU.js";import"./vendor-hast-util-from-parse5-Ba3T6RJI.js";import"./vendor-devlop-0Dp3JUBc.js";import"./vendor-property-information-Boo8Xpef.js";import"./vendor-hastscript-BrPNioaz.js";import"./vendor-comma-separated-tokens-CRUGqg4f.js";import"./vendor-space-separated-tokens-D7QSIrTI.js";import"./vendor-hast-util-parse-selector-TXfch5wI.js";import"./vendor-vfile-location-LfEFwJ2h.js";import"./vendor-hast-util-to-parse5-BoysVIPW.js";import"./vendor-hast-util-sanitize-2aGO5ay8.js";import"./vendor-micromark-extension-gfm-CsfPlnlB.js";import"./vendor-micromark-extension-gfm-autolink-literal-BYug7onl.js";import"./vendor-micromark-extension-gfm-footnote-OFl1FCH2.js";import"./vendor-micromark-extension-gfm-strikethrough-CyFiuwBf.js";import"./vendor-micromark-extension-gfm-table-dgw4LfUw.js";import"./vendor-micromark-extension-gfm-task-list-item-Dnadzr9U.js";import"./vendor-mdast-util-gfm-CroMDYLM.js";import"./vendor-mdast-util-gfm-autolink-literal-CTruMtvI.js";import"./vendor-ccount-c2V3InAJ.js";import"./vendor-mdast-util-find-and-replace-DB9iC-bx.js";import"./vendor-escape-string-regexp-BaJN9MlJ.js";import"./vendor-mdast-util-gfm-footnote-C-csI7OF.js";import"./vendor-mdast-util-gfm-strikethrough-BcskTdio.js";import"./vendor-mdast-util-gfm-table-DhPwQIyj.js";import"./vendor-markdown-table-DvhhVmnL.js";import"./vendor-mdast-util-to-markdown-Cl3qaiyc.js";import"./vendor-longest-streak-CtXnX3Xp.js";import"./vendor-mdast-util-phrasing-4oVbNLC3.js";import"./vendor-mdast-util-gfm-task-list-item-DMU5mK_M.js";import"./vendor-mdast-util-to-hast-CWnLaQSO.js";import"./vendor-micromark-util-sanitize-uri-BbwQ7CLk.js";import"./vendor-trim-lines-D8znQY54.js";import"./vendor-micromark-extension-cjk-friendly-BzZDGrF5.js";import"./vendor-micromark-extension-cjk-friendly-util-D5lVNoxW.js";import"./vendor-get-east-asian-width-CPhS2cOv.js";import"./vendor-micromark-util-symbol-JJPacVTp.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-BZ3pe_qd.js";import"./vendor-micromark-extension-cjk-friendly-gfm-strikethrough-CqW-Ep4M.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-gfm-strikethrough-BdPDQFO7.js";import"./vendor-hast-util-from-html-isomorphic-B0Kn01s9.js";import"./vendor-hast-util-from-dom-DeNf9aYW.js";import"./vendor-katex-DBqql0K7.js";import"./vendor-hast-util-to-text-0GXLnBvt.js";import"./vendor-hast-util-is-element-CuOmiqQi.js";import"./vendor-unist-util-find-after-CMaZmLxc.js";import"./vendor-micromark-extension-math-BRFoDziv.js";import"./vendor-mdast-util-math-wB-IJCL0.js";import"./vendor-remend-r8cP_t-e.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-marked-DN3zOnEe.js";import"./vendor-hast-util-to-jsx-runtime-Bq6JeJCx.js";import"./vendor-style-to-js-CI2G4dgu.js";import"./vendor-style-to-object-BAv4SQXc.js";import"./vendor-inline-style-parser-BlqBsVO4.js";import"./vendor-hast-util-whitespace-D4Wp6AEg.js";import"./vendor-estree-util-is-identifier-name-BgBfM8ME.js";import"./vendor-vfile-message-DqhD22jI.js";import"./vendor-unified-1CQKw2_w.js";import"./vendor-bail-FqpXQuLt.js";import"./vendor-extend-B94qxKr5.js";import"./vendor-is-plain-obj-C1gvLhAf.js";import"./vendor-trough-B_b8ryxu.js";import"./vendor-vfile-BCWrK60u.js";import"./vendor-html-url-attributes-D46m5wfe.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./vendor-opencode-client-NJGkA1Ku.js";import"./vendor-fuse.js-Dw8P0qyA.js";const J=()=>{const t=z.c(37),{t:o}=L();let D;t[0]===Symbol.for("react.memo_cache_sentinel")?(D={kind:"idle"},t[0]=D):D=t[0];const[i,r]=F.useState(D);let S;t[1]===Symbol.for("react.memo_cache_sentinel")?(S=async()=>{r({kind:"writing"});try{const{path:e}=await W.writeHeapSnapshot();r({kind:"written",path:e})}catch{r({kind:"failed"})}},t[1]=S):S=t[1];const w=S;let C;t[2]!==o?(C=async e=>{await G(e)||_.error(o("openCodeStatusDialog.heapSnapshot.revealFailed"))},t[2]=o,t[3]=C):C=t[3];const y=C;let d;t[4]!==o?(d=async e=>{(await U(e)).ok?_.success(o("openCodeStatusDialog.heapSnapshot.pathCopied")):_.error(o("openCodeStatusDialog.heapSnapshot.copyFailed"))},t[4]=o,t[5]=d):d=t[5];const f=d;let a;t:{switch(i.kind){case"idle":{let e;t[6]!==o?(e=o("openCodeStatusDialog.heapSnapshot.hint"),t[6]=o,t[7]=e):e=t[7],a=e;break t}case"writing":{let e;t[8]!==o?(e=o("openCodeStatusDialog.heapSnapshot.writing"),t[8]=o,t[9]=e):e=t[9],a=e;break t}case"written":{let e;t[10]!==i.path||t[11]!==o?(e=o("openCodeStatusDialog.heapSnapshot.written",{path:i.path}),t[10]=i.path,t[11]=o,t[12]=e):e=t[12],a=e;break t}case"failed":{let e;t[13]!==o?(e=o("openCodeStatusDialog.heapSnapshot.failed"),t[13]=o,t[14]=e):e=t[14],a=e;break t}}a=void 0}const u=a;let m;t[15]!==i.kind?(m=i.kind==="writing"&&p.jsx(H,{className:"text-muted-foreground","aria-hidden":!0}),t[15]=i.kind,t[16]=m):m=t[16];const k=i.kind==="failed"?"min-w-0 flex-1 truncate typography-meta text-destructive":"min-w-0 flex-1 truncate typography-meta text-muted-foreground";let s;t[17]!==u||t[18]!==k?(s=p.jsx("p",{className:k,title:u,children:u}),t[17]=u,t[18]=k,t[19]=s):s=t[19];let n;t[20]!==f||t[21]!==y||t[22]!==i.kind||t[23]!==i.path||t[24]!==o?(n=i.kind==="written"&&(q()?p.jsx(O,{type:"button",variant:"ghost",size:"sm",onClick:()=>{y(i.path)},children:o("openCodeStatusDialog.heapSnapshot.reveal")}):p.jsx(O,{type:"button",variant:"ghost",size:"sm",onClick:()=>{f(i.path)},children:o("openCodeStatusDialog.heapSnapshot.copyPath")})),t[20]=f,t[21]=y,t[22]=i.kind,t[23]=i.path,t[24]=o,t[25]=n):n=t[25];let x;t[26]===Symbol.for("react.memo_cache_sentinel")?(x=()=>{w()},t[26]=x):x=t[26];const g=i.kind==="writing";let l;t[27]!==o?(l=o("openCodeStatusDialog.heapSnapshot.action"),t[27]=o,t[28]=l):l=t[28];let c;t[29]!==g||t[30]!==l?(c=p.jsx(O,{type:"button",variant:"outline",size:"sm",onClick:x,disabled:g,children:l}),t[29]=g,t[30]=l,t[31]=c):c=t[31];let h;return t[32]!==c||t[33]!==m||t[34]!==s||t[35]!==n?(h=p.jsxs("div",{className:"flex items-center gap-2",children:[m,s,n,c]}),t[32]=c,t[33]=m,t[34]=s,t[35]=n,t[36]=h):h=t[36],h},hi=()=>{const t=z.c(45),{t:o}=L(),D=T(K),i=T(M),r=T(Q);let S;t[0]!==r||t[1]!==o?(S=async()=>{if(!r)return;if((await U(r)).ok){_.success(o("openCodeStatusDialog.toast.copiedTitle"),{description:o("openCodeStatusDialog.toast.copiedDescription")});return}_.error(o("openCodeStatusDialog.toast.copyFailed"))},t[0]=r,t[1]=o,t[2]=S):S=t[2];const w=S;let C;t[3]!==r?(C=()=>{if(!r)return;const N=URL.createObjectURL(new Blob([r],{type:"text/plain;charset=utf-8"})),v=document.createElement("a");v.href=N,v.download=`openchamber-diagnostics-${new Date().toISOString().replace(/[:.]/g,"-")}.log`,document.body.appendChild(v),v.click(),v.remove(),setTimeout(()=>URL.revokeObjectURL(N),1e3)},t[3]=r,t[4]=C):C=t[4];const y=C;let d;t[5]!==o?(d=o("openCodeStatusDialog.title"),t[5]=o,t[6]=d):d=t[6];let f;t[7]!==d?(f=p.jsx(B,{children:d}),t[7]=d,t[8]=f):f=t[8];let a;t[9]!==o?(a=o("openCodeStatusDialog.description"),t[9]=o,t[10]=a):a=t[10];let u;t[11]!==a?(u=p.jsx(E,{children:a}),t[11]=a,t[12]=u):u=t[12];let m;t[13]!==f||t[14]!==u?(m=p.jsxs(I,{children:[f,u]}),t[13]=f,t[14]=u,t[15]=m):m=t[15];const k=!r;let s;t[16]!==o?(s=o("openCodeStatusDialog.actions.copy"),t[16]=o,t[17]=s):s=t[17];let n;t[18]!==w||t[19]!==k||t[20]!==s?(n=p.jsx(O,{type:"button",variant:"outline",onClick:w,disabled:k,children:s}),t[18]=w,t[19]=k,t[20]=s,t[21]=n):n=t[21];const x=!r;let g;t[22]!==o?(g=o("openCodeStatusDialog.actions.download"),t[22]=o,t[23]=g):g=t[23];let l;t[24]!==y||t[25]!==x||t[26]!==g?(l=p.jsx(O,{type:"button",onClick:y,disabled:x,children:g}),t[24]=y,t[25]=x,t[26]=g,t[27]=l):l=t[27];let c;t[28]!==l||t[29]!==n?(c=p.jsxs("div",{className:"flex items-center justify-end gap-2",children:[n,l]}),t[28]=l,t[29]=n,t[30]=c):c=t[30];let h;t[31]!==r||t[32]!==o?(h=r||o("openCodeStatusDialog.empty.noData"),t[31]=r,t[32]=o,t[33]=h):h=t[33];let e;t[34]!==h?(e=p.jsx(P,{as:"pre",dir:"ltr",outerClassName:"max-h-[60vh] rounded-lg bg-surface-muted",className:"p-4 typography-code text-foreground whitespace-pre-wrap",disableHorizontal:!0,children:h}),t[34]=h,t[35]=e):e=t[35];let j;t[36]===Symbol.for("react.memo_cache_sentinel")?(j=p.jsx(J,{}),t[36]=j):j=t[36];let b;t[37]!==c||t[38]!==e||t[39]!==m?(b=p.jsxs($,{className:"max-w-2xl",children:[m,c,e,j]}),t[37]=c,t[38]=e,t[39]=m,t[40]=b):b=t[40];let R;return t[41]!==D||t[42]!==i||t[43]!==b?(R=p.jsx(A,{open:D,onOpenChange:i,children:b}),t[41]=D,t[42]=i,t[43]=b,t[44]=R):R=t[44],R};function K(t){return t.isOpenCodeStatusDialogOpen}function M(t){return t.setOpenCodeStatusDialogOpen}function Q(t){return t.openCodeStatusText}export{hi as OpenCodeStatusDialog};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{R as N,f as te,j as r}from"./vendor-react--VO_rL_p.js";import{bP as ot,co as Ae,cp as rt,cq as it,cr as at,cs as lt,au as We,ct,Z as Ne,G as ut,cu as pt,cv as mt,cw as dt,cx as ft,cy as Xe,a1 as Te,_ as _e,cz as ht,cA as vt,cB as gt,cC as kt,cD as ze,cE as Ie,cF as Fe,cG as Ge,cH as yt,cI as xt,cJ as et,cK as wt,cL as bt,b1 as Ce,cM as jt,cN as St,cO as Ot,cP as Nt,cQ as It,cR as Rt,cS as Ct,a3 as J,u as tt,cT as Dt,K as Pt,x as Mt,n as Be,B as ie,cU as He,I as xe,cV as Wt,cW as Et,cX as Tt,cY as Bt,cZ as Lt,af as $t,ag as qt,ah as At,A as Re,c_ as zt,l as Ft,F as Gt,D as Ht,o as Kt,q as Ut,t as Yt}from"./useAppFontEffects-
|
|
1
|
+
import{R as N,f as te,j as r}from"./vendor-react--VO_rL_p.js";import{bP as ot,co as Ae,cp as rt,cq as it,cr as at,cs as lt,au as We,ct,Z as Ne,G as ut,cu as pt,cv as mt,cw as dt,cx as ft,cy as Xe,a1 as Te,_ as _e,cz as ht,cA as vt,cB as gt,cC as kt,cD as ze,cE as Ie,cF as Fe,cG as Ge,cH as yt,cI as xt,cJ as et,cK as wt,cL as bt,b1 as Ce,cM as jt,cN as St,cO as Ot,cP as Nt,cQ as It,cR as Rt,cS as Ct,a3 as J,u as tt,cT as Dt,K as Pt,x as Mt,n as Be,B as ie,cU as He,I as xe,cV as Wt,cW as Et,cX as Tt,cY as Bt,cZ as Lt,af as $t,ag as qt,ah as At,A as Re,c_ as zt,l as Ft,F as Gt,D as Ht,o as Kt,q as Ut,t as Yt}from"./useAppFontEffects-DEX5CMOn.js";import{Y as Vt,Z as Zt,_ as Jt,$ as Qt,a0 as Xt,a1 as je,a2 as _t,a3 as es,a4 as ts}from"./runtimeEndpointReset-DKWDEJh9.js";import{k as ss,bg as ns,l as os,u as Le,n as Z,b as Ke,b3 as De,bh as rs}from"./katex.min-CAwHaRYk.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-base-ui-CHqK1aDI.js";import"./vendor-floating-ui-utils-BzXdqYpP.js";import"./vendor-floating-ui-dom-WyXykhNi.js";import"./vendor-floating-ui-core-CXmKXOXc.js";import"./vendor-floating-ui-react-dom-Cy8dRGoy.js";import"./vendor-use-sync-external-store-CfLJGVyr.js";import"./vendor-zod-B_hXR7jf.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-zustand-C9tWdk0j.js";import"./vendor-dnd-kit-core-Br1Cs7RV.js";import"./vendor-dnd-kit-utilities-DZ9KbT5S.js";import"./vendor-dnd-kit-accessibility-CYclfhtC.js";import"./vendor-dnd-kit-sortable-DpfLEOLv.js";import"./vendor-tanstack-react-virtual-Bw3q1rnq.js";import"./vendor-tanstack-virtual-core-B4TJYmIq.js";import"./vendor-framer-motion-C_wK4GIM.js";import"./vendor-motion-dom-HXPOMxb7.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-capacitor-core-B4EWRrHz.js";import"./vendor-codemirror-commands-CjjsURR-.js";import"./vendor-codemirror-state-Cd8udR5z.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-view-Ciie9ey-.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-codemirror-language-8HZTPOnt.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CZEcqU6G.js";import"./vendor-codemirror-streamparser-CmlTsbN2.js";import"./vendor-codemirror-lang-javascript-DmqaSK_j.js";import"./vendor-lezer-javascript-CWSwshuO.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-BGedy2gC.js";import"./vendor-codemirror-lang-json-DVAYKmoO.js";import"./vendor-lezer-json-Cn1mncjr.js";import"./vendor-codemirror-lang-css-BLpgXfL2.js";import"./vendor-lezer-css-B2Hx_Nps.js";import"./vendor-codemirror-lang-html-S3jxr3Mo.js";import"./vendor-lezer-html-Cr8K5DGw.js";import"./vendor-codemirror-lang-markdown-D1jveRI5.js";import"./vendor-lezer-markdown-TQKzBB8i.js";import"./vendor-codemirror-language-data--j1xV4at.js";import"./vendor-codemirror-lang-python-B-5UC9Ui.js";import"./vendor-lezer-python-BUoImtUb.js";import"./vendor-sonner-Dw26OnzC.js";import"./vendor-cmdk-BtSpU-Io.js";import"./vendor-radix-ui-react-dialog-OIW6VLWw.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-D4RvEbuR.js";import"./vendor-radix-ui-react-context-BbFoxCHu.js";import"./vendor-radix-ui-react-id-aGag8i_5.js";import"./vendor-radix-ui-react-use-layout-effect-B1oLzD-j.js";import"./vendor-radix-ui-react-use-controllable-state-BjnNPGHq.js";import"./vendor-radix-ui-react-dismissable-layer-DpT6mMbO.js";import"./vendor-radix-ui-react-primitive-CrN9dRDb.js";import"./vendor-radix-ui-react-slot-BjbalUfz.js";import"./vendor-radix-ui-react-use-callback-ref-CcC_buIU.js";import"./vendor-radix-ui-react-use-escape-keydown-Cp1WWKTC.js";import"./vendor-radix-ui-react-focus-scope-D1noLHmd.js";import"./vendor-radix-ui-react-portal-BlUEzfrF.js";import"./vendor-radix-ui-react-presence-BGqFfiW4.js";import"./vendor-radix-ui-react-focus-guards-CSS2IbZC.js";import"./vendor-react-remove-scroll-Der_cv-1.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-Clwl9llp.js";import"./vendor-react-style-singleton-D_xJlTqU.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-BdLl6ZIw.js";import"./vendor-use-callback-ref-CXJF1lEr.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-legendapp-list-iLtL-MFj.js";import"./vendor-streamdown-BbSYZ3NF.js";import"./vendor-markdown-BTUqNk6W.js";import"./vendor-mdast-util-from-markdown-CZHjOE75.js";import"./vendor-micromark-util-decode-numeric-character-reference-CNs1qBpV.js";import"./vendor-micromark-util-decode-string-fHsnqYdj.js";import"./vendor-decode-named-character-reference-C3-224fz.js";import"./vendor-micromark-util-normalize-identifier-C9ANKk3v.js";import"./vendor-micromark-AWM-NZXP.js";import"./vendor-micromark-util-combine-extensions-d8XJZrgA.js";import"./vendor-micromark-util-chunked-DrRIdSP-.js";import"./vendor-micromark-factory-space-PzSHLgmq.js";import"./vendor-micromark-util-character-CW3Cu1MS.js";import"./vendor-micromark-core-commonmark-kzTLNXAm.js";import"./vendor-micromark-util-classify-character-tcLuZZwM.js";import"./vendor-micromark-util-resolve-all-PQCKh0dx.js";import"./vendor-micromark-util-subtokenize-BF1Jf29a.js";import"./vendor-micromark-factory-destination-Sj0xfi0V.js";import"./vendor-micromark-factory-label-amyP0HdC.js";import"./vendor-micromark-factory-title-khnLkZK6.js";import"./vendor-micromark-factory-whitespace-eIB00uTl.js";import"./vendor-micromark-util-html-tag-name-DbKNfynz.js";import"./vendor-unist-util-stringify-position-Ch_qCilz.js";import"./vendor-mdast-util-to-string-C_aolqmU.js";import"./vendor-unist-util-visit-DhPeCsfG.js";import"./vendor-unist-util-visit-parents-DlviEg7Z.js";import"./vendor-unist-util-is-BPZGFiMU.js";import"./vendor-hast-util-raw-DvvLJg15.js";import"./vendor-ungap-structured-clone--gfxRhYI.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-parse5-DwmzEj2o.js";import"./vendor-entities-wUUgTZDW.js";import"./vendor-web-namespaces-bsVAaBS1.js";import"./vendor-zwitch-C2o2j-tx.js";import"./vendor-unist-util-position-60F3QETU.js";import"./vendor-hast-util-from-parse5-Ba3T6RJI.js";import"./vendor-devlop-0Dp3JUBc.js";import"./vendor-property-information-Boo8Xpef.js";import"./vendor-hastscript-BrPNioaz.js";import"./vendor-comma-separated-tokens-CRUGqg4f.js";import"./vendor-space-separated-tokens-D7QSIrTI.js";import"./vendor-hast-util-parse-selector-TXfch5wI.js";import"./vendor-vfile-location-LfEFwJ2h.js";import"./vendor-hast-util-to-parse5-BoysVIPW.js";import"./vendor-hast-util-sanitize-2aGO5ay8.js";import"./vendor-micromark-extension-gfm-CsfPlnlB.js";import"./vendor-micromark-extension-gfm-autolink-literal-BYug7onl.js";import"./vendor-micromark-extension-gfm-footnote-OFl1FCH2.js";import"./vendor-micromark-extension-gfm-strikethrough-CyFiuwBf.js";import"./vendor-micromark-extension-gfm-table-dgw4LfUw.js";import"./vendor-micromark-extension-gfm-task-list-item-Dnadzr9U.js";import"./vendor-mdast-util-gfm-CroMDYLM.js";import"./vendor-mdast-util-gfm-autolink-literal-CTruMtvI.js";import"./vendor-ccount-c2V3InAJ.js";import"./vendor-mdast-util-find-and-replace-DB9iC-bx.js";import"./vendor-escape-string-regexp-BaJN9MlJ.js";import"./vendor-mdast-util-gfm-footnote-C-csI7OF.js";import"./vendor-mdast-util-gfm-strikethrough-BcskTdio.js";import"./vendor-mdast-util-gfm-table-DhPwQIyj.js";import"./vendor-markdown-table-DvhhVmnL.js";import"./vendor-mdast-util-to-markdown-Cl3qaiyc.js";import"./vendor-longest-streak-CtXnX3Xp.js";import"./vendor-mdast-util-phrasing-4oVbNLC3.js";import"./vendor-mdast-util-gfm-task-list-item-DMU5mK_M.js";import"./vendor-mdast-util-to-hast-CWnLaQSO.js";import"./vendor-micromark-util-sanitize-uri-BbwQ7CLk.js";import"./vendor-trim-lines-D8znQY54.js";import"./vendor-micromark-extension-cjk-friendly-BzZDGrF5.js";import"./vendor-micromark-extension-cjk-friendly-util-D5lVNoxW.js";import"./vendor-get-east-asian-width-CPhS2cOv.js";import"./vendor-micromark-util-symbol-JJPacVTp.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-BZ3pe_qd.js";import"./vendor-micromark-extension-cjk-friendly-gfm-strikethrough-CqW-Ep4M.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-gfm-strikethrough-BdPDQFO7.js";import"./vendor-hast-util-from-html-isomorphic-B0Kn01s9.js";import"./vendor-hast-util-from-dom-DeNf9aYW.js";import"./vendor-katex-DBqql0K7.js";import"./vendor-hast-util-to-text-0GXLnBvt.js";import"./vendor-hast-util-is-element-CuOmiqQi.js";import"./vendor-unist-util-find-after-CMaZmLxc.js";import"./vendor-micromark-extension-math-BRFoDziv.js";import"./vendor-mdast-util-math-wB-IJCL0.js";import"./vendor-remend-r8cP_t-e.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-marked-DN3zOnEe.js";import"./vendor-hast-util-to-jsx-runtime-Bq6JeJCx.js";import"./vendor-style-to-js-CI2G4dgu.js";import"./vendor-style-to-object-BAv4SQXc.js";import"./vendor-inline-style-parser-BlqBsVO4.js";import"./vendor-hast-util-whitespace-D4Wp6AEg.js";import"./vendor-estree-util-is-identifier-name-BgBfM8ME.js";import"./vendor-vfile-message-DqhD22jI.js";import"./vendor-unified-1CQKw2_w.js";import"./vendor-bail-FqpXQuLt.js";import"./vendor-extend-B94qxKr5.js";import"./vendor-is-plain-obj-C1gvLhAf.js";import"./vendor-trough-B_b8ryxu.js";import"./vendor-vfile-BCWrK60u.js";import"./vendor-html-url-attributes-D46m5wfe.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./space-apply-CYC8IOgP.js";import"./vendor-opencode-client-NJGkA1Ku.js";import"./vendor-fuse.js-Dw8P0qyA.js";const is={pr:"unknown",mergedHeadSha:null};function as(e){const{sourceControl:t}=ot(),[s,i]=N.useState(new Map),a=e.map(c=>`${c.path}
|
|
2
2
|
${c.branch}`).sort().join(`
|
|
3
3
|
|
|
4
4
|
`),l=N.useRef(e);l.current=e,N.useEffect(()=>{if(!a)return;let c=!1;const k=ss();return(async()=>{const x=await Promise.all(l.current.map(async f=>{try{const w=await ns(()=>Ae.read(Ae.scope(f.path),t));if(!w)return null;const S=w.contexts[0];if(!S)return null;const g=rt.getState().entries[it(S)];return at(g,S).connected?{path:f.path,branch:f.branch,context:S,key:lt(S,f.branch)}:null}catch{return null}}));if(c||!k())return;const b=We.getState(),j=[],O=new Map;for(const f of x)f&&(O.set(f.path,f.key),b.ensureEntry(f.key),b.setParams(f.key,{directory:f.context.directory,branch:f.branch,remoteName:f.context.primaryRemote,canShow:!0,identity:f.context,readContext:f.context,sourceControl:t,authChecked:!0,connected:!0}),We.getState().entries[f.key]?.isInitialStatusResolved||j.push({context:f.context,branch:f.branch}));i(O),j.length>0&&await b.refreshTargets(j,{silent:!0,markInitialResolved:!0})})(),()=>{c=!0}},[a,t]);const h=We(c=>c.entries),v=N.useCallback(c=>{const k=s.get(c),x=k?h[k]:void 0;if(!x?.isInitialStatusResolved||x.error)return is;const b=x.status?.changeRequest??x.status?.pr??null;return b?{pr:b.state,mergedHeadSha:b.state==="merged"?b.headSha??null:null}:{pr:"none",mergedHeadSha:null}},[h,s]),u=N.useCallback(c=>{const k=s.get(c);return k?ct(h,k):null},[h,s]),y=N.useMemo(()=>[...s.values()],[s]);return N.useMemo(()=>({changeRequestOf:v,summaryOf:u,keys:y}),[v,y,u])}const ls=8,st=3,Ue=e=>{const t=e.replace(/\/+$/,"");return t.slice(t.lastIndexOf("/")+1)||t},cs=(e,t)=>e?e.label?.trim()||Ue(e.path):Ue(t);function us(e){const[t,s]=N.useState(new Map),[i,a]=N.useState(0),l=e.map(u=>`${u.worktree.path}@${u.mergedHeadSha??""}`).sort().join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{gE as tn,gF as rn,gG as ln,gH as on}from"./useAppFontEffects-
|
|
1
|
+
import{gE as tn,gF as rn,gG as ln,gH as on}from"./useAppFontEffects-DEX5CMOn.js";import{g as W,a as sn,p as un}from"./parseDiffFromFile-CdzPmTcc.js";import{M as cn,G as fn,u as an,W as dn,a as hn,b as _,c as mn,d as pn,n as z,e as G,t as xn}from"./useNextRenderData-CVFf78p9.js";import{j as c,r as f}from"./vendor-react--VO_rL_p.js";import{a as Y}from"./isDiffPlainText-BcgZ-0g8.js";import{V as gn,F as En}from"./pierreDiffTint-CVXkDTiH.js";function Dn({hunkIndex:n,lineIndex:t,conflictIndex:e}){return`merge-conflict-action-${n}-${t}-${e}`}function Fn(n,t){const e=t.hunks[n.hunkIndex];if(e!=null)return{hunkIndex:n.hunkIndex,lineIndex:An(e,n.startContentIndex)}}function An(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 wn(n){const t=tn(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 vn({fileDiff:n,actions:t,renderCustomHeader:e,renderHeaderPrefix:r,renderHeaderFilenameSuffix:i,renderHeaderMetadata:a,renderAnnotation:o,renderGutterUtility:p,renderMergeConflictUtility:w,lineAnnotations:v,getHoveredLine:g,getInstance:h,getAnnotationSlotName:S=W}){const E=e?.(n),D=r?.(n),x=i?.(n),F=a?.(n);return c.jsxs(c.Fragment,{children:[E!=null?c.jsx("div",{slot:rn,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})]}),o!=null&&v?.map((s,m)=>c.jsx("div",{slot:S(s),children:o(s,n)},m)),t!=null&&w!=null&&h!=null&&t.map(s=>{if(s==null)return;const m=Sn(s,n);return c.jsx("div",{slot:m,style:cn,children:w(s,h)},m)}),p!=null&&c.jsx("div",{slot:"gutter-utility-slot",style:fn,children:p(g)})]})}function Sn(n,t){const e=Fn(n,t);return e!=null?Dn({hunkIndex:e.hunkIndex,lineIndex:e.lineIndex,conflictIndex:n.conflictIndex}):void 0}const In=typeof window>"u"?f.useEffect:f.useLayoutEffect;function Cn({fileDiff:n,oldFile:t,newFile:e,options:r,editorOptions:i,editStateKey:a,lineAnnotations:o,selectedLines:p,prerenderedHTML:w,metrics:v,hasGutterRenderUtility:g,hasCustomHeader:h,disableWorkerPool:S,edit:E,onEditChange:D,onEditComplete:x}){const F=an(),s=p!==void 0,m=f.useContext(dn),C=hn(),[N,k]=f.useState(),L=_(l=>D?.(l)),y=D!=null?L:void 0,I=f.useRef(null),M=_(l=>{const j=x?.(l)??"reject";return j==="accept"&&(I.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}}),j}),P=x!=null?M:void 0,R=yn({acceptedCache:I,fileDiff:n,newFile:e,oldFile:t,parseDiffOptions:r?.parseDiffOptions}),u=f.useRef(null),T=mn(),J=Pn(I,R,o),K=pn(u,J)??{fileDiff:R,lineAnnotations:o??ln},A=f.useRef(null),d=f.useRef(null),Q=_(()=>{if(C==null)throw new Error("FileDiff: EditContext is not attached");return C("file-diff",i??{},a)}),X=_(l=>{if(l!=null){if(u.current!=null)throw new Error("useFileDiffInstance: An instance should not already exist when a node is created");F!=null?u.current=new gn(U({controlledSelection:s,hasCustomHeader:h,hasGutterRenderUtility:g,onEditChange:y,onEditComplete:P,options:r}),F,v,S?void 0:m,T):u.current=new En(U({controlledSelection:s,hasCustomHeader:h,hasGutterRenderUtility:g,onEditChange:y,onEditComplete:P,options:r}),S?void 0:m,T),u.current.hydrate({fileDiff:R,fileContainer:l,lineAnnotations:o,prerenderedHTML:w})}else{if(u.current==null)throw new Error("useFileDiffInstance: A FileDiff instance should exist when unmounting");d.current=null,u.current.cleanUp(),u.current=null,A.current=null}});In(()=>{const{current:l}=u;if(l==null)return;const j=U({controlledSelection:s,hasCustomHeader:h,hasGutterRenderUtility:g,onEditChange:y,onEditComplete:P,options:r}),en=!sn(l.options,j);if(l.setOptions(j),!E&&(d.current=null,A.current!=null)){const{current:H}=A;A.current=null,H()}const b=jn(R,o,I);if(l.render({forceRender:en,fileDiff:b.fileDiff,lineAnnotations:b.lineAnnotations}),p!==void 0&&l.setSelectedLines(p),!E||A.current!=null)return;if(C==null)throw new Error("FileDiff: EditContext is not attached");const q=()=>{u.current!==l||A.current!=null||!l.__canAttachEditor()||(A.current=Nn(l,Q),T())};if(l.__canAttachEditor()){d.current=null,q();return}const O=l.__prepareForEditing();if(O==null){d.current=null;return}if(d.current?.promise===O)return;const V={promise:O};d.current=V,O.then(()=>{d.current===V&&(q(),d.current=null)}).catch(H=>{d.current===V&&(d.current=null,k(H))})});const Z=f.useCallback(()=>u.current?.getHoveredLine(),[]),nn=f.useCallback(l=>u.current?.getAnnotationSlotName(l)??W(l),[]);if(N!=null)throw N;return{...K,ref:X,getHoveredLine:Z,getAnnotationSlotName:nn}}function yn({acceptedCache:n,fileDiff:t,newFile:e,oldFile:r,parseDiffOptions:i}){return f.useMemo(()=>{if(t!=null)return t;const{current:a}=n,o=a?.filePair;if(a!=null&&o!=null){if($(r,e,o.stale)||$(r,e,o.installed))return o.fileDiff;a.filePair=null}return un(r??null,e??null,i)},[n,t,r,e,i])}function $(n,t,e){return G(n??void 0,e.oldFile??void 0)&&G(t??void 0,e.newFile??void 0)}function Pn(n,t,e){"use no memo";return B(t,e,n.current)}function B(n,t,e){return{fileDiff:e?.fileDiff!=null&&Y(n,e.fileDiff.stale)?e.fileDiff.installed:n,lineAnnotations:e?.annotations!=null&&t===e.annotations.stale?e.annotations.installed:t}}function jn(n,t,e){const{current:r}=e,i=B(n,t,r);return r==null||(r.fileDiff!=null&&!Y(n,r.fileDiff.stale)&&(r.fileDiff=null),t!==r.annotations?.stale&&(r.annotations=null),r.fileDiff==null&&r.annotations==null&&r.filePair==null&&(e.current=null)),i}function U({options:n,controlledSelection:t,hasCustomHeader:e,hasGutterRenderUtility:r,onEditChange:i,onEditComplete:a}){return{...n,controlledSelection:t,renderCustomHeader:e?z:n?.renderCustomHeader,renderGutterUtility:r?z:n?.renderGutterUtility,onEditChange:i,onEditComplete:a}}function Nn(n,t){const e=t();try{return e.edit(n)}catch(r){throw e.cleanUp(),r}}function Vn({patch:n,options:t,editorOptions:e,editStateKey:r,metrics:i,lineAnnotations:a,selectedLines:o,className:p,style:w,prerenderedHTML:v,renderAnnotation:g,renderCustomHeader:h,renderHeaderPrefix:S,renderHeaderFilenameSuffix:E,renderHeaderMetadata:D,renderGutterUtility:x,disableWorkerPool:F=!1,edit:s=!1,onEditChange:m,onEditComplete:C}){const N=Rn(n),{ref:k,getHoveredLine:L,getAnnotationSlotName:y,fileDiff:I,lineAnnotations:M}=Cn({fileDiff:N,options:t,editorOptions:e,editStateKey:r,metrics:i,lineAnnotations:a,selectedLines:o,prerenderedHTML:v,hasGutterRenderUtility:x!=null,hasCustomHeader:h!=null,disableWorkerPool:F,edit:s,onEditChange:m,onEditComplete:C}),P=vn({fileDiff:I,renderCustomHeader:h,renderHeaderPrefix:S,renderHeaderFilenameSuffix:E,renderHeaderMetadata:D,renderAnnotation:g,lineAnnotations:M,renderGutterUtility:x,getHoveredLine:L,getAnnotationSlotName:y});return c.jsx(on,{ref:k,className:p,style:w,children:xn(P,v)})}function Rn(n){return f.useMemo(()=>wn(n),[n])}export{Vn as P};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f as Ft,R as o,j as n}from"./vendor-react--VO_rL_p.js";import{c as Lt,C as Vt}from"./flexokiTheme-BNUmLj3l.js";import{u as pt,c7 as ve,c8 as ie,a3 as Me,C as At,I as De,A as ge,bH as Ot,a1 as re,as as Wt,_ as it,bN as Kt,bL as zt,P as Ht,bi as _t,c9 as $t,W as st,ca as at,cb as Bt,cc as Gt,cd as Jt,ce as Ut,cf as Qt,cg as Yt,ch as Xt,ci as qt,bY as Zt,cj as en,a6 as tn,a7 as nn,B as on,a8 as rn,n as sn,ck as an,cl as ln,cm as cn,cn as lt,a9 as ct,b8 as pn}from"./useAppFontEffects-xaAfmUwn.js";import{O as dn,P as mn,Q as un,T as fn,U as hn,V as vn,W as gn,X as wn}from"./runtimeEndpointReset-BsAAA4Nf.js";import{u as Te,b3 as Ie,be as xn,bf as Sn}from"./katex.min-2cmqKX7p.js";import{u as yn,n as bn}from"./useInlineCommentController-C-V8vqSj.js";import{u as jn,b as Cn,F as Pn,c as Rn}from"./fileContentPoller-p6RiDNz7.js";import{E as Nn}from"./vendor-codemirror-view-Ciie9ey-.js";import{u as kn}from"./useMarkdownLocalAssets-BfOLz9Xm.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-codemirror-state-Cd8udR5z.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-commands-CjjsURR-.js";import"./vendor-codemirror-language-8HZTPOnt.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CZEcqU6G.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-codemirror-streamparser-CmlTsbN2.js";import"./vendor-codemirror-search-CWqbGraJ.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-replit-codemirror-vim-DTiXsOdM.js";import"./vendor-replit-codemirror-vim-core-FHzKdNUS.js";import"./editorCodeMetrics-BzYZ4PzQ.js";import"./vendor-base-ui-CHqK1aDI.js";import"./vendor-floating-ui-utils-BzXdqYpP.js";import"./vendor-floating-ui-dom-WyXykhNi.js";import"./vendor-floating-ui-core-CXmKXOXc.js";import"./vendor-floating-ui-react-dom-Cy8dRGoy.js";import"./vendor-use-sync-external-store-CfLJGVyr.js";import"./vendor-zod-B_hXR7jf.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-zustand-C9tWdk0j.js";import"./vendor-dnd-kit-core-Br1Cs7RV.js";import"./vendor-dnd-kit-utilities-DZ9KbT5S.js";import"./vendor-dnd-kit-accessibility-CYclfhtC.js";import"./vendor-dnd-kit-sortable-DpfLEOLv.js";import"./vendor-tanstack-react-virtual-Bw3q1rnq.js";import"./vendor-tanstack-virtual-core-B4TJYmIq.js";import"./vendor-framer-motion-C_wK4GIM.js";import"./vendor-motion-dom-HXPOMxb7.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-capacitor-core-B4EWRrHz.js";import"./vendor-codemirror-lang-javascript-DmqaSK_j.js";import"./vendor-lezer-javascript-CWSwshuO.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-BGedy2gC.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-codemirror-lang-json-DVAYKmoO.js";import"./vendor-lezer-json-Cn1mncjr.js";import"./vendor-codemirror-lang-css-BLpgXfL2.js";import"./vendor-lezer-css-B2Hx_Nps.js";import"./vendor-codemirror-lang-html-S3jxr3Mo.js";import"./vendor-lezer-html-Cr8K5DGw.js";import"./vendor-codemirror-lang-markdown-D1jveRI5.js";import"./vendor-lezer-markdown-TQKzBB8i.js";import"./vendor-codemirror-language-data-CSQf665k.js";import"./vendor-codemirror-lang-python-B-5UC9Ui.js";import"./vendor-lezer-python-BUoImtUb.js";import"./vendor-sonner-Dw26OnzC.js";import"./vendor-cmdk-BtSpU-Io.js";import"./vendor-radix-ui-react-dialog-OIW6VLWw.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-D4RvEbuR.js";import"./vendor-radix-ui-react-context-BbFoxCHu.js";import"./vendor-radix-ui-react-id-aGag8i_5.js";import"./vendor-radix-ui-react-use-layout-effect-B1oLzD-j.js";import"./vendor-radix-ui-react-use-controllable-state-BjnNPGHq.js";import"./vendor-radix-ui-react-dismissable-layer-DpT6mMbO.js";import"./vendor-radix-ui-react-primitive-CrN9dRDb.js";import"./vendor-radix-ui-react-slot-BjbalUfz.js";import"./vendor-radix-ui-react-use-callback-ref-CcC_buIU.js";import"./vendor-radix-ui-react-use-escape-keydown-Cp1WWKTC.js";import"./vendor-radix-ui-react-focus-scope-D1noLHmd.js";import"./vendor-radix-ui-react-portal-BlUEzfrF.js";import"./vendor-radix-ui-react-presence-BGqFfiW4.js";import"./vendor-radix-ui-react-focus-guards-CSS2IbZC.js";import"./vendor-react-remove-scroll-Der_cv-1.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-Clwl9llp.js";import"./vendor-react-style-singleton-D_xJlTqU.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-BdLl6ZIw.js";import"./vendor-use-callback-ref-CXJF1lEr.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-legendapp-list-iLtL-MFj.js";import"./vendor-streamdown-BbSYZ3NF.js";import"./vendor-markdown-BTUqNk6W.js";import"./vendor-mdast-util-from-markdown-CZHjOE75.js";import"./vendor-micromark-util-decode-numeric-character-reference-CNs1qBpV.js";import"./vendor-micromark-util-decode-string-fHsnqYdj.js";import"./vendor-decode-named-character-reference-C3-224fz.js";import"./vendor-micromark-util-normalize-identifier-C9ANKk3v.js";import"./vendor-micromark-AWM-NZXP.js";import"./vendor-micromark-util-combine-extensions-d8XJZrgA.js";import"./vendor-micromark-util-chunked-DrRIdSP-.js";import"./vendor-micromark-factory-space-PzSHLgmq.js";import"./vendor-micromark-util-character-CW3Cu1MS.js";import"./vendor-micromark-core-commonmark-kzTLNXAm.js";import"./vendor-micromark-util-classify-character-tcLuZZwM.js";import"./vendor-micromark-util-resolve-all-PQCKh0dx.js";import"./vendor-micromark-util-subtokenize-BF1Jf29a.js";import"./vendor-micromark-factory-destination-Sj0xfi0V.js";import"./vendor-micromark-factory-label-amyP0HdC.js";import"./vendor-micromark-factory-title-khnLkZK6.js";import"./vendor-micromark-factory-whitespace-eIB00uTl.js";import"./vendor-micromark-util-html-tag-name-DbKNfynz.js";import"./vendor-unist-util-stringify-position-Ch_qCilz.js";import"./vendor-mdast-util-to-string-C_aolqmU.js";import"./vendor-unist-util-visit-DhPeCsfG.js";import"./vendor-unist-util-visit-parents-DlviEg7Z.js";import"./vendor-unist-util-is-BPZGFiMU.js";import"./vendor-hast-util-raw-DvvLJg15.js";import"./vendor-ungap-structured-clone--gfxRhYI.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-parse5-DwmzEj2o.js";import"./vendor-entities-wUUgTZDW.js";import"./vendor-web-namespaces-bsVAaBS1.js";import"./vendor-zwitch-C2o2j-tx.js";import"./vendor-unist-util-position-60F3QETU.js";import"./vendor-hast-util-from-parse5-Ba3T6RJI.js";import"./vendor-devlop-0Dp3JUBc.js";import"./vendor-property-information-Boo8Xpef.js";import"./vendor-hastscript-BrPNioaz.js";import"./vendor-comma-separated-tokens-CRUGqg4f.js";import"./vendor-space-separated-tokens-D7QSIrTI.js";import"./vendor-hast-util-parse-selector-TXfch5wI.js";import"./vendor-vfile-location-LfEFwJ2h.js";import"./vendor-hast-util-to-parse5-BoysVIPW.js";import"./vendor-hast-util-sanitize-2aGO5ay8.js";import"./vendor-micromark-extension-gfm-CsfPlnlB.js";import"./vendor-micromark-extension-gfm-autolink-literal-BYug7onl.js";import"./vendor-micromark-extension-gfm-footnote-OFl1FCH2.js";import"./vendor-micromark-extension-gfm-strikethrough-CyFiuwBf.js";import"./vendor-micromark-extension-gfm-table-dgw4LfUw.js";import"./vendor-micromark-extension-gfm-task-list-item-Dnadzr9U.js";import"./vendor-mdast-util-gfm-CroMDYLM.js";import"./vendor-mdast-util-gfm-autolink-literal-CTruMtvI.js";import"./vendor-ccount-c2V3InAJ.js";import"./vendor-mdast-util-find-and-replace-DB9iC-bx.js";import"./vendor-escape-string-regexp-BaJN9MlJ.js";import"./vendor-mdast-util-gfm-footnote-C-csI7OF.js";import"./vendor-mdast-util-gfm-strikethrough-BcskTdio.js";import"./vendor-mdast-util-gfm-table-DhPwQIyj.js";import"./vendor-markdown-table-DvhhVmnL.js";import"./vendor-mdast-util-to-markdown-Cl3qaiyc.js";import"./vendor-longest-streak-CtXnX3Xp.js";import"./vendor-mdast-util-phrasing-4oVbNLC3.js";import"./vendor-mdast-util-gfm-task-list-item-DMU5mK_M.js";import"./vendor-mdast-util-to-hast-CWnLaQSO.js";import"./vendor-micromark-util-sanitize-uri-BbwQ7CLk.js";import"./vendor-trim-lines-D8znQY54.js";import"./vendor-micromark-extension-cjk-friendly-BzZDGrF5.js";import"./vendor-micromark-extension-cjk-friendly-util-D5lVNoxW.js";import"./vendor-get-east-asian-width-CPhS2cOv.js";import"./vendor-micromark-util-symbol-JJPacVTp.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-BZ3pe_qd.js";import"./vendor-micromark-extension-cjk-friendly-gfm-strikethrough-CqW-Ep4M.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-gfm-strikethrough-BdPDQFO7.js";import"./vendor-hast-util-from-html-isomorphic-B0Kn01s9.js";import"./vendor-hast-util-from-dom-DeNf9aYW.js";import"./vendor-katex-DBqql0K7.js";import"./vendor-hast-util-to-text-0GXLnBvt.js";import"./vendor-hast-util-is-element-CuOmiqQi.js";import"./vendor-unist-util-find-after-CMaZmLxc.js";import"./vendor-micromark-extension-math-BRFoDziv.js";import"./vendor-mdast-util-math-wB-IJCL0.js";import"./vendor-remend-r8cP_t-e.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-marked-DN3zOnEe.js";import"./vendor-hast-util-to-jsx-runtime-Bq6JeJCx.js";import"./vendor-style-to-js-CI2G4dgu.js";import"./vendor-style-to-object-BAv4SQXc.js";import"./vendor-inline-style-parser-BlqBsVO4.js";import"./vendor-hast-util-whitespace-D4Wp6AEg.js";import"./vendor-estree-util-is-identifier-name-BgBfM8ME.js";import"./vendor-vfile-message-DqhD22jI.js";import"./vendor-unified-1CQKw2_w.js";import"./vendor-bail-FqpXQuLt.js";import"./vendor-extend-B94qxKr5.js";import"./vendor-is-plain-obj-C1gvLhAf.js";import"./vendor-trough-B_b8ryxu.js";import"./vendor-vfile-BCWrK60u.js";import"./vendor-html-url-attributes-D46m5wfe.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./space-apply-BmOleF8W.js";import"./vendor-opencode-client-NJGkA1Ku.js";import"./vendor-fuse.js-Dw8P0qyA.js";const Tn=[],In=l=>{const t=Ft.c(44),{projectRef:p,planId:v}=l,{t:u}=pt();let i;t[0]!==p?(i=ve(p),t[0]=p,t[1]=i):i=t[1];const g=i;let y;t[2]!==g?(y=d=>d.entries[g]?.todos??Tn,t[2]=g,t[3]=y):y=t[3];const b=ie(y),X=ie(Mn),[N,se]=o.useState(!0);let _;if(t[4]!==v||t[5]!==b){let d;t[7]!==v?(d=F=>F.planId===v,t[7]=v,t[8]=d):d=t[8],_=b.filter(d),t[4]=v,t[5]=b,t[6]=_}else _=t[6];const k=_;let $;t[9]!==b?($=new Map(b.map(Dn)),t[9]=b,t[10]=$):$=t[10];const q=$;if(k.length===0)return null;let B;t[11]!==k?(B=k.filter(En),t[11]=k,t[12]=B):B=t[12];const ae=B.length;let O;t[13]!==p||t[14]!==X||t[15]!==u||t[16]!==b?(O=(d,F)=>{const f=mn(b,d,F);f&&X(p,f,{kind:"complete",id:d,completed:F}).then(H=>{H||ge.error(u("rightSidebar.contextNotesTodo.toast.saveNotesFailed"))})},t[13]=p,t[14]=X,t[15]=u,t[16]=b,t[17]=O):O=t[17];const Z=O;let W;t[18]===Symbol.for("react.memo_cache_sentinel")?(W=()=>se(Fn),t[18]=W):W=t[18];const G=N?"arrow-down-s":"arrow-right-s",ee=!N&&"rtl:rotate-180";let E;t[19]!==ee?(E=Me("size-3.5",ee),t[19]=ee,t[20]=E):E=t[20];let j;t[21]!==E||t[22]!==G?(j=n.jsx(De,{name:G,className:E}),t[21]=E,t[22]=G,t[23]=j):j=t[23];let I;t[24]!==u?(I=u("planView.todos.title"),t[24]=u,t[25]=I):I=t[25];let M;t[26]!==I?(M=n.jsx("span",{children:I}),t[26]=I,t[27]=M):M=t[27];const s=`${ae}/${k.length}`;let c;t[28]!==s?(c=n.jsx("span",{className:"tabular-nums",children:s}),t[28]=s,t[29]=c):c=t[29];let x;t[30]!==N||t[31]!==j||t[32]!==M||t[33]!==c?(x=n.jsxs("button",{type:"button",onClick:W,"aria-expanded":N,className:"flex items-center gap-1 typography-meta text-muted-foreground hover:text-foreground focus-visible:outline-none",children:[j,M,c]}),t[30]=N,t[31]=j,t[32]=M,t[33]=c,t[34]=x):x=t[34];let K;t[35]!==q||t[36]!==k||t[37]!==N||t[38]!==u||t[39]!==Z?(K=N?n.jsx("ul",{className:"mt-1 max-h-48 overflow-y-auto",children:k.map(d=>{const F=d.completed?[]:dn(d,q),f=F.length>0?u("rightSidebar.contextNotesTodo.todo.waitingFor",{todos:F.map(Ln).join(", ")}):null;return n.jsxs("li",{className:"flex items-start gap-2 py-0.5",children:[n.jsx("div",{className:"flex h-6 items-center",children:n.jsx(At,{checked:d.completed,onChange:H=>Z(d.id,H),ariaLabel:u(d.completed?"contextTooltips.workspace.todo.reopenAria":"rightSidebar.contextNotesTodo.todo.actions.markComplete",{text:d.text})})}),n.jsx("span",{className:Me("min-w-0 flex-1 py-0.5 typography-ui-label leading-normal break-words",d.completed?"text-muted-foreground line-through":"text-foreground"),dir:"auto",children:d.text}),f?n.jsxs("span",{className:"flex h-6 flex-shrink-0 items-center text-muted-foreground",title:f,children:[n.jsx(De,{name:"lock",className:"size-3"}),n.jsx("span",{className:"sr-only",children:f})]}):null]},d.id)})}):null,t[35]=q,t[36]=k,t[37]=N,t[38]=u,t[39]=Z,t[40]=K):K=t[40];let z;return t[41]!==x||t[42]!==K?(z=n.jsxs("section",{className:"flex-shrink-0 border-t border-edge-muted px-3 py-2",children:[x,K]}),t[41]=x,t[42]=K,t[43]=z):z=t[43],z};function Mn(l){return l.saveTodos}function Dn(l){return[l.id,l]}function En(l){return l.completed}function Fn(l){return!l}function Ln(l){return l.text}const Vn=()=>{const l=new Map,t=new Map;return{schedule:(p,v,u)=>{if(v<=(t.get(p)??Number.NEGATIVE_INFINITY))return l.get(p)??Promise.resolve();t.set(p,v);const g=(l.get(p)??Promise.resolve()).then(u,u);return l.set(p,g.catch(()=>{t.get(p)===v&&t.delete(p)})),g},pendingFor:async p=>{await l.get(p)},reset:p=>{t.delete(p)}}},An=3e4,On={id:"",path:""},Wn=/^\s*#\s+.+?(?:\n+|$)/,Y=l=>{if(!l)return"";const t=l.replace(/\\/g,"/");return t==="/"?"/":t.replace(/\/+$/,"")},Kn=(l,t,p)=>{const v=Y(l.trim());if(!v)return null;const u=p?t.find(g=>g.id===p)??null:null;if(u?.path){const g=Y(u.path);if(v===g||v.startsWith(`${g}/`))return{id:u.id,path:u.path}}const i=t.filter(g=>{const y=Y(g.path);return v===y||v.startsWith(`${y}/`)}).sort((g,y)=>Y(y.path).length-Y(g.path).length)[0];return i?{id:i.id,path:i.path}:null},zn=async(l,t)=>{if(!await ie.getState().savePlan(l.projectRef,l.planId,t))throw new Error("Plan save rejected: the plan no longer exists")},Hn=l=>Sn(()=>l()),gs=({visible:l=!0,savedProjectPlan:t=null,onNavigatedToChat:p,leading:v,onClose:u})=>{const{t:i}=pt(),g=Ot(),y=re(e=>e.currentSessionId),b=re(e=>e.createSession),X=re(e=>e.initializeNewOpenChamberSession),N=re(e=>e.sendMessage),se=re(e=>e.setCurrentSession),_=Wt(),k=it(e=>e.projects),$=it(e=>e.activeProjectId),q=Kt(e=>e.directories),B=zt()??"",ae=Te(e=>e.setSessionSwitcherOpen),O=o.useSyncExternalStore(Hn,Ie,Ie),{isMobile:Z}=Ht(),{currentTheme:W}=_t(),G=o.useMemo(()=>y?_.find(e=>e.id===y)??null:null,[y,_]),ee=o.useMemo(()=>{const e=typeof G?.directory=="string"?G.directory:"";return Y(e||"")},[G?.directory]),E=o.useMemo(()=>Y(B||ee),[B,ee]),j=o.useMemo(()=>Kn(E,k,$),[$,E,k]),I=t?.projectRef.id??null,M=t?.projectRef.path??null,s=o.useMemo(()=>I&&M?{id:I,path:M}:null,[I,M]),c=t?.planId??null,x=ie(e=>!s||!c?null:e.entries[ve(s)]?.plans.find(r=>r.id===c)??null),K=un(s??On),{pinnedPlanIds:z,togglePin:d}=fn(),F=o.useCallback(async(e,r)=>{await d("plan",e,r)||ge.error(i("rightSidebar.contextNotesTodo.toast.updatePlanFailed"))},[i,d]),f=s&&c?JSON.stringify(["saved-plan",O,ve(s),c]):null,H=s?.id===xn,we=o.useMemo(()=>{const e=s??j;return e?q.get(e.path)?.isGitRepo===!0:!1},[j,q,s]),[L,le]=o.useState(null),[Ee,Fe]=o.useState(!1),[J,xe]=o.useState(null),[U,Se]=o.useState(null),te=!!J,[h,ne]=o.useState(""),{isPlaying:ye,play:dt,stop:mt}=$t(),ut=st(e=>e.showMessageTTSButtons),[Le,be]=o.useState(null),[Ve,je]=o.useState(null),Ce=i("planView.file.defaultName"),Ae=U??Ce,Pe=o.useMemo(()=>h.trim()?at(h,i("planView.title.default")).title:i("planView.title.default"),[h,i]),Oe=o.useMemo(()=>{const e=Wn.exec(h);return e?h.slice(e[0].length):h},[h]),ce=o.useMemo(()=>Pe.trim()||i("planView.title.default"),[Pe,i]),[ft,Re]=o.useState(!1),[ht,We]=o.useState("preview"),[vt,Ke]=o.useState(!1),pe=vt?"edit":ht,[S,Q]=o.useState(null),ze=o.useRef(null),gt=o.useRef(null),Ne=o.useRef(null),wt=o.useCallback(e=>{Ne.current=e},[]),xt=o.useCallback(e=>{s?.path&&Te.getState().openContextFile(s.path,e)},[s]),St=kn({filePath:U,workspaceRoot:s?.path??null,onOpenFile:xt,enabled:pe==="preview"&&te,colorScheme:W.metadata.variant==="light"?"light":"dark"}),He="openchamber:plan:md-viewer-mode";o.useEffect(()=>{try{const e=localStorage.getItem(He);if(!e)return;const r=JSON.parse(e);(r==="preview"||r==="edit")&&We(r)}catch{}},[]);const yt=o.useCallback(e=>{Ke(!1),We(e);try{localStorage.setItem(He,JSON.stringify(e))}catch{}},[]),bt=o.useCallback((e,r)=>{const a=e.split(`
|
|
1
|
+
import{f as Ft,R as o,j as n}from"./vendor-react--VO_rL_p.js";import{c as Lt,C as Vt}from"./flexokiTheme-tyakPldH.js";import{u as pt,c7 as ve,c8 as ie,a3 as Me,C as At,I as De,A as ge,bH as Ot,a1 as re,as as Wt,_ as it,bN as Kt,bL as zt,P as Ht,bi as _t,c9 as $t,W as st,ca as at,cb as Bt,cc as Gt,cd as Jt,ce as Ut,cf as Qt,cg as Yt,ch as Xt,ci as qt,bY as Zt,cj as en,a6 as tn,a7 as nn,B as on,a8 as rn,n as sn,ck as an,cl as ln,cm as cn,cn as lt,a9 as ct,b8 as pn}from"./useAppFontEffects-DEX5CMOn.js";import{O as dn,P as mn,Q as un,T as fn,U as hn,V as vn,W as gn,X as wn}from"./runtimeEndpointReset-DKWDEJh9.js";import{u as Te,b3 as Ie,be as xn,bf as Sn}from"./katex.min-CAwHaRYk.js";import{u as yn,n as bn}from"./useInlineCommentController-BL4NrAAM.js";import{u as jn,b as Cn,F as Pn,c as Rn}from"./fileContentPoller-BV7Knoib.js";import{E as Nn}from"./vendor-codemirror-view-Ciie9ey-.js";import{u as kn}from"./useMarkdownLocalAssets-6zcqySrf.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-codemirror-state-Cd8udR5z.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-commands-CjjsURR-.js";import"./vendor-codemirror-language-8HZTPOnt.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CZEcqU6G.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-codemirror-streamparser-CmlTsbN2.js";import"./vendor-codemirror-search-CWqbGraJ.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-replit-codemirror-vim-DTiXsOdM.js";import"./vendor-replit-codemirror-vim-core-FHzKdNUS.js";import"./editorCodeMetrics-BaoTimWj.js";import"./vendor-base-ui-CHqK1aDI.js";import"./vendor-floating-ui-utils-BzXdqYpP.js";import"./vendor-floating-ui-dom-WyXykhNi.js";import"./vendor-floating-ui-core-CXmKXOXc.js";import"./vendor-floating-ui-react-dom-Cy8dRGoy.js";import"./vendor-use-sync-external-store-CfLJGVyr.js";import"./vendor-zod-B_hXR7jf.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-zustand-C9tWdk0j.js";import"./vendor-dnd-kit-core-Br1Cs7RV.js";import"./vendor-dnd-kit-utilities-DZ9KbT5S.js";import"./vendor-dnd-kit-accessibility-CYclfhtC.js";import"./vendor-dnd-kit-sortable-DpfLEOLv.js";import"./vendor-tanstack-react-virtual-Bw3q1rnq.js";import"./vendor-tanstack-virtual-core-B4TJYmIq.js";import"./vendor-framer-motion-C_wK4GIM.js";import"./vendor-motion-dom-HXPOMxb7.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-capacitor-core-B4EWRrHz.js";import"./vendor-codemirror-lang-javascript-DmqaSK_j.js";import"./vendor-lezer-javascript-CWSwshuO.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-BGedy2gC.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-codemirror-lang-json-DVAYKmoO.js";import"./vendor-lezer-json-Cn1mncjr.js";import"./vendor-codemirror-lang-css-BLpgXfL2.js";import"./vendor-lezer-css-B2Hx_Nps.js";import"./vendor-codemirror-lang-html-S3jxr3Mo.js";import"./vendor-lezer-html-Cr8K5DGw.js";import"./vendor-codemirror-lang-markdown-D1jveRI5.js";import"./vendor-lezer-markdown-TQKzBB8i.js";import"./vendor-codemirror-language-data--j1xV4at.js";import"./vendor-codemirror-lang-python-B-5UC9Ui.js";import"./vendor-lezer-python-BUoImtUb.js";import"./vendor-sonner-Dw26OnzC.js";import"./vendor-cmdk-BtSpU-Io.js";import"./vendor-radix-ui-react-dialog-OIW6VLWw.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-D4RvEbuR.js";import"./vendor-radix-ui-react-context-BbFoxCHu.js";import"./vendor-radix-ui-react-id-aGag8i_5.js";import"./vendor-radix-ui-react-use-layout-effect-B1oLzD-j.js";import"./vendor-radix-ui-react-use-controllable-state-BjnNPGHq.js";import"./vendor-radix-ui-react-dismissable-layer-DpT6mMbO.js";import"./vendor-radix-ui-react-primitive-CrN9dRDb.js";import"./vendor-radix-ui-react-slot-BjbalUfz.js";import"./vendor-radix-ui-react-use-callback-ref-CcC_buIU.js";import"./vendor-radix-ui-react-use-escape-keydown-Cp1WWKTC.js";import"./vendor-radix-ui-react-focus-scope-D1noLHmd.js";import"./vendor-radix-ui-react-portal-BlUEzfrF.js";import"./vendor-radix-ui-react-presence-BGqFfiW4.js";import"./vendor-radix-ui-react-focus-guards-CSS2IbZC.js";import"./vendor-react-remove-scroll-Der_cv-1.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-Clwl9llp.js";import"./vendor-react-style-singleton-D_xJlTqU.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-BdLl6ZIw.js";import"./vendor-use-callback-ref-CXJF1lEr.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-legendapp-list-iLtL-MFj.js";import"./vendor-streamdown-BbSYZ3NF.js";import"./vendor-markdown-BTUqNk6W.js";import"./vendor-mdast-util-from-markdown-CZHjOE75.js";import"./vendor-micromark-util-decode-numeric-character-reference-CNs1qBpV.js";import"./vendor-micromark-util-decode-string-fHsnqYdj.js";import"./vendor-decode-named-character-reference-C3-224fz.js";import"./vendor-micromark-util-normalize-identifier-C9ANKk3v.js";import"./vendor-micromark-AWM-NZXP.js";import"./vendor-micromark-util-combine-extensions-d8XJZrgA.js";import"./vendor-micromark-util-chunked-DrRIdSP-.js";import"./vendor-micromark-factory-space-PzSHLgmq.js";import"./vendor-micromark-util-character-CW3Cu1MS.js";import"./vendor-micromark-core-commonmark-kzTLNXAm.js";import"./vendor-micromark-util-classify-character-tcLuZZwM.js";import"./vendor-micromark-util-resolve-all-PQCKh0dx.js";import"./vendor-micromark-util-subtokenize-BF1Jf29a.js";import"./vendor-micromark-factory-destination-Sj0xfi0V.js";import"./vendor-micromark-factory-label-amyP0HdC.js";import"./vendor-micromark-factory-title-khnLkZK6.js";import"./vendor-micromark-factory-whitespace-eIB00uTl.js";import"./vendor-micromark-util-html-tag-name-DbKNfynz.js";import"./vendor-unist-util-stringify-position-Ch_qCilz.js";import"./vendor-mdast-util-to-string-C_aolqmU.js";import"./vendor-unist-util-visit-DhPeCsfG.js";import"./vendor-unist-util-visit-parents-DlviEg7Z.js";import"./vendor-unist-util-is-BPZGFiMU.js";import"./vendor-hast-util-raw-DvvLJg15.js";import"./vendor-ungap-structured-clone--gfxRhYI.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-parse5-DwmzEj2o.js";import"./vendor-entities-wUUgTZDW.js";import"./vendor-web-namespaces-bsVAaBS1.js";import"./vendor-zwitch-C2o2j-tx.js";import"./vendor-unist-util-position-60F3QETU.js";import"./vendor-hast-util-from-parse5-Ba3T6RJI.js";import"./vendor-devlop-0Dp3JUBc.js";import"./vendor-property-information-Boo8Xpef.js";import"./vendor-hastscript-BrPNioaz.js";import"./vendor-comma-separated-tokens-CRUGqg4f.js";import"./vendor-space-separated-tokens-D7QSIrTI.js";import"./vendor-hast-util-parse-selector-TXfch5wI.js";import"./vendor-vfile-location-LfEFwJ2h.js";import"./vendor-hast-util-to-parse5-BoysVIPW.js";import"./vendor-hast-util-sanitize-2aGO5ay8.js";import"./vendor-micromark-extension-gfm-CsfPlnlB.js";import"./vendor-micromark-extension-gfm-autolink-literal-BYug7onl.js";import"./vendor-micromark-extension-gfm-footnote-OFl1FCH2.js";import"./vendor-micromark-extension-gfm-strikethrough-CyFiuwBf.js";import"./vendor-micromark-extension-gfm-table-dgw4LfUw.js";import"./vendor-micromark-extension-gfm-task-list-item-Dnadzr9U.js";import"./vendor-mdast-util-gfm-CroMDYLM.js";import"./vendor-mdast-util-gfm-autolink-literal-CTruMtvI.js";import"./vendor-ccount-c2V3InAJ.js";import"./vendor-mdast-util-find-and-replace-DB9iC-bx.js";import"./vendor-escape-string-regexp-BaJN9MlJ.js";import"./vendor-mdast-util-gfm-footnote-C-csI7OF.js";import"./vendor-mdast-util-gfm-strikethrough-BcskTdio.js";import"./vendor-mdast-util-gfm-table-DhPwQIyj.js";import"./vendor-markdown-table-DvhhVmnL.js";import"./vendor-mdast-util-to-markdown-Cl3qaiyc.js";import"./vendor-longest-streak-CtXnX3Xp.js";import"./vendor-mdast-util-phrasing-4oVbNLC3.js";import"./vendor-mdast-util-gfm-task-list-item-DMU5mK_M.js";import"./vendor-mdast-util-to-hast-CWnLaQSO.js";import"./vendor-micromark-util-sanitize-uri-BbwQ7CLk.js";import"./vendor-trim-lines-D8znQY54.js";import"./vendor-micromark-extension-cjk-friendly-BzZDGrF5.js";import"./vendor-micromark-extension-cjk-friendly-util-D5lVNoxW.js";import"./vendor-get-east-asian-width-CPhS2cOv.js";import"./vendor-micromark-util-symbol-JJPacVTp.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-BZ3pe_qd.js";import"./vendor-micromark-extension-cjk-friendly-gfm-strikethrough-CqW-Ep4M.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-gfm-strikethrough-BdPDQFO7.js";import"./vendor-hast-util-from-html-isomorphic-B0Kn01s9.js";import"./vendor-hast-util-from-dom-DeNf9aYW.js";import"./vendor-katex-DBqql0K7.js";import"./vendor-hast-util-to-text-0GXLnBvt.js";import"./vendor-hast-util-is-element-CuOmiqQi.js";import"./vendor-unist-util-find-after-CMaZmLxc.js";import"./vendor-micromark-extension-math-BRFoDziv.js";import"./vendor-mdast-util-math-wB-IJCL0.js";import"./vendor-remend-r8cP_t-e.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-marked-DN3zOnEe.js";import"./vendor-hast-util-to-jsx-runtime-Bq6JeJCx.js";import"./vendor-style-to-js-CI2G4dgu.js";import"./vendor-style-to-object-BAv4SQXc.js";import"./vendor-inline-style-parser-BlqBsVO4.js";import"./vendor-hast-util-whitespace-D4Wp6AEg.js";import"./vendor-estree-util-is-identifier-name-BgBfM8ME.js";import"./vendor-vfile-message-DqhD22jI.js";import"./vendor-unified-1CQKw2_w.js";import"./vendor-bail-FqpXQuLt.js";import"./vendor-extend-B94qxKr5.js";import"./vendor-is-plain-obj-C1gvLhAf.js";import"./vendor-trough-B_b8ryxu.js";import"./vendor-vfile-BCWrK60u.js";import"./vendor-html-url-attributes-D46m5wfe.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./space-apply-CYC8IOgP.js";import"./vendor-opencode-client-NJGkA1Ku.js";import"./vendor-fuse.js-Dw8P0qyA.js";const Tn=[],In=l=>{const t=Ft.c(44),{projectRef:p,planId:v}=l,{t:u}=pt();let i;t[0]!==p?(i=ve(p),t[0]=p,t[1]=i):i=t[1];const g=i;let y;t[2]!==g?(y=d=>d.entries[g]?.todos??Tn,t[2]=g,t[3]=y):y=t[3];const b=ie(y),X=ie(Mn),[N,se]=o.useState(!0);let _;if(t[4]!==v||t[5]!==b){let d;t[7]!==v?(d=F=>F.planId===v,t[7]=v,t[8]=d):d=t[8],_=b.filter(d),t[4]=v,t[5]=b,t[6]=_}else _=t[6];const k=_;let $;t[9]!==b?($=new Map(b.map(Dn)),t[9]=b,t[10]=$):$=t[10];const q=$;if(k.length===0)return null;let B;t[11]!==k?(B=k.filter(En),t[11]=k,t[12]=B):B=t[12];const ae=B.length;let O;t[13]!==p||t[14]!==X||t[15]!==u||t[16]!==b?(O=(d,F)=>{const f=mn(b,d,F);f&&X(p,f,{kind:"complete",id:d,completed:F}).then(H=>{H||ge.error(u("rightSidebar.contextNotesTodo.toast.saveNotesFailed"))})},t[13]=p,t[14]=X,t[15]=u,t[16]=b,t[17]=O):O=t[17];const Z=O;let W;t[18]===Symbol.for("react.memo_cache_sentinel")?(W=()=>se(Fn),t[18]=W):W=t[18];const G=N?"arrow-down-s":"arrow-right-s",ee=!N&&"rtl:rotate-180";let E;t[19]!==ee?(E=Me("size-3.5",ee),t[19]=ee,t[20]=E):E=t[20];let j;t[21]!==E||t[22]!==G?(j=n.jsx(De,{name:G,className:E}),t[21]=E,t[22]=G,t[23]=j):j=t[23];let I;t[24]!==u?(I=u("planView.todos.title"),t[24]=u,t[25]=I):I=t[25];let M;t[26]!==I?(M=n.jsx("span",{children:I}),t[26]=I,t[27]=M):M=t[27];const s=`${ae}/${k.length}`;let c;t[28]!==s?(c=n.jsx("span",{className:"tabular-nums",children:s}),t[28]=s,t[29]=c):c=t[29];let x;t[30]!==N||t[31]!==j||t[32]!==M||t[33]!==c?(x=n.jsxs("button",{type:"button",onClick:W,"aria-expanded":N,className:"flex items-center gap-1 typography-meta text-muted-foreground hover:text-foreground focus-visible:outline-none",children:[j,M,c]}),t[30]=N,t[31]=j,t[32]=M,t[33]=c,t[34]=x):x=t[34];let K;t[35]!==q||t[36]!==k||t[37]!==N||t[38]!==u||t[39]!==Z?(K=N?n.jsx("ul",{className:"mt-1 max-h-48 overflow-y-auto",children:k.map(d=>{const F=d.completed?[]:dn(d,q),f=F.length>0?u("rightSidebar.contextNotesTodo.todo.waitingFor",{todos:F.map(Ln).join(", ")}):null;return n.jsxs("li",{className:"flex items-start gap-2 py-0.5",children:[n.jsx("div",{className:"flex h-6 items-center",children:n.jsx(At,{checked:d.completed,onChange:H=>Z(d.id,H),ariaLabel:u(d.completed?"contextTooltips.workspace.todo.reopenAria":"rightSidebar.contextNotesTodo.todo.actions.markComplete",{text:d.text})})}),n.jsx("span",{className:Me("min-w-0 flex-1 py-0.5 typography-ui-label leading-normal break-words",d.completed?"text-muted-foreground line-through":"text-foreground"),dir:"auto",children:d.text}),f?n.jsxs("span",{className:"flex h-6 flex-shrink-0 items-center text-muted-foreground",title:f,children:[n.jsx(De,{name:"lock",className:"size-3"}),n.jsx("span",{className:"sr-only",children:f})]}):null]},d.id)})}):null,t[35]=q,t[36]=k,t[37]=N,t[38]=u,t[39]=Z,t[40]=K):K=t[40];let z;return t[41]!==x||t[42]!==K?(z=n.jsxs("section",{className:"flex-shrink-0 border-t border-edge-muted px-3 py-2",children:[x,K]}),t[41]=x,t[42]=K,t[43]=z):z=t[43],z};function Mn(l){return l.saveTodos}function Dn(l){return[l.id,l]}function En(l){return l.completed}function Fn(l){return!l}function Ln(l){return l.text}const Vn=()=>{const l=new Map,t=new Map;return{schedule:(p,v,u)=>{if(v<=(t.get(p)??Number.NEGATIVE_INFINITY))return l.get(p)??Promise.resolve();t.set(p,v);const g=(l.get(p)??Promise.resolve()).then(u,u);return l.set(p,g.catch(()=>{t.get(p)===v&&t.delete(p)})),g},pendingFor:async p=>{await l.get(p)},reset:p=>{t.delete(p)}}},An=3e4,On={id:"",path:""},Wn=/^\s*#\s+.+?(?:\n+|$)/,Y=l=>{if(!l)return"";const t=l.replace(/\\/g,"/");return t==="/"?"/":t.replace(/\/+$/,"")},Kn=(l,t,p)=>{const v=Y(l.trim());if(!v)return null;const u=p?t.find(g=>g.id===p)??null:null;if(u?.path){const g=Y(u.path);if(v===g||v.startsWith(`${g}/`))return{id:u.id,path:u.path}}const i=t.filter(g=>{const y=Y(g.path);return v===y||v.startsWith(`${y}/`)}).sort((g,y)=>Y(y.path).length-Y(g.path).length)[0];return i?{id:i.id,path:i.path}:null},zn=async(l,t)=>{if(!await ie.getState().savePlan(l.projectRef,l.planId,t))throw new Error("Plan save rejected: the plan no longer exists")},Hn=l=>Sn(()=>l()),gs=({visible:l=!0,savedProjectPlan:t=null,onNavigatedToChat:p,leading:v,onClose:u})=>{const{t:i}=pt(),g=Ot(),y=re(e=>e.currentSessionId),b=re(e=>e.createSession),X=re(e=>e.initializeNewOpenChamberSession),N=re(e=>e.sendMessage),se=re(e=>e.setCurrentSession),_=Wt(),k=it(e=>e.projects),$=it(e=>e.activeProjectId),q=Kt(e=>e.directories),B=zt()??"",ae=Te(e=>e.setSessionSwitcherOpen),O=o.useSyncExternalStore(Hn,Ie,Ie),{isMobile:Z}=Ht(),{currentTheme:W}=_t(),G=o.useMemo(()=>y?_.find(e=>e.id===y)??null:null,[y,_]),ee=o.useMemo(()=>{const e=typeof G?.directory=="string"?G.directory:"";return Y(e||"")},[G?.directory]),E=o.useMemo(()=>Y(B||ee),[B,ee]),j=o.useMemo(()=>Kn(E,k,$),[$,E,k]),I=t?.projectRef.id??null,M=t?.projectRef.path??null,s=o.useMemo(()=>I&&M?{id:I,path:M}:null,[I,M]),c=t?.planId??null,x=ie(e=>!s||!c?null:e.entries[ve(s)]?.plans.find(r=>r.id===c)??null),K=un(s??On),{pinnedPlanIds:z,togglePin:d}=fn(),F=o.useCallback(async(e,r)=>{await d("plan",e,r)||ge.error(i("rightSidebar.contextNotesTodo.toast.updatePlanFailed"))},[i,d]),f=s&&c?JSON.stringify(["saved-plan",O,ve(s),c]):null,H=s?.id===xn,we=o.useMemo(()=>{const e=s??j;return e?q.get(e.path)?.isGitRepo===!0:!1},[j,q,s]),[L,le]=o.useState(null),[Ee,Fe]=o.useState(!1),[J,xe]=o.useState(null),[U,Se]=o.useState(null),te=!!J,[h,ne]=o.useState(""),{isPlaying:ye,play:dt,stop:mt}=$t(),ut=st(e=>e.showMessageTTSButtons),[Le,be]=o.useState(null),[Ve,je]=o.useState(null),Ce=i("planView.file.defaultName"),Ae=U??Ce,Pe=o.useMemo(()=>h.trim()?at(h,i("planView.title.default")).title:i("planView.title.default"),[h,i]),Oe=o.useMemo(()=>{const e=Wn.exec(h);return e?h.slice(e[0].length):h},[h]),ce=o.useMemo(()=>Pe.trim()||i("planView.title.default"),[Pe,i]),[ft,Re]=o.useState(!1),[ht,We]=o.useState("preview"),[vt,Ke]=o.useState(!1),pe=vt?"edit":ht,[S,Q]=o.useState(null),ze=o.useRef(null),gt=o.useRef(null),Ne=o.useRef(null),wt=o.useCallback(e=>{Ne.current=e},[]),xt=o.useCallback(e=>{s?.path&&Te.getState().openContextFile(s.path,e)},[s]),St=kn({filePath:U,workspaceRoot:s?.path??null,onOpenFile:xt,enabled:pe==="preview"&&te,colorScheme:W.metadata.variant==="light"?"light":"dark"}),He="openchamber:plan:md-viewer-mode";o.useEffect(()=>{try{const e=localStorage.getItem(He);if(!e)return;const r=JSON.parse(e);(r==="preview"||r==="edit")&&We(r)}catch{}},[]);const yt=o.useCallback(e=>{Ke(!1),We(e);try{localStorage.setItem(He,JSON.stringify(e))}catch{}},[]),bt=o.useCallback((e,r)=>{const a=e.split(`
|
|
2
2
|
`),w=Math.max(1,r.start),D=Math.min(a.length,r.end);return w>D?"":a.slice(w-1,D).join(`
|
|
3
3
|
`)},[]),jt=yn({source:"plan",fileLabel:Ae,language:"markdown",getCodeForRange:e=>bt(h,bn(e)),toStoreRange:e=>({startLine:e.start,endLine:e.end}),fromDraftRange:e=>({start:e.startLine,end:e.endLine})}),{drafts:_e,commentText:de,setCommentText:$e,editingDraftId:ke,setSelection:Be,saveComment:Ge,cancel:oe,reset:Je,startEdit:Ue,deleteDraft:Qe}=jt,{isDragging:Ye,lineNumbersConfig:Ct,isDragReleaseClick:Xe}=jn({lineSelection:S,setLineSelection:Q,onClear:oe,isMobile:Z});o.useEffect(()=>{Q(null),Je()},[h,Je]),o.useEffect(()=>{Be(S)},[S,Be]);const qe=o.useCallback(()=>{Q(null),oe()},[oe]),Ze=o.useCallback((e,r)=>{r&&Q(r);const a=Ge(e,r??S??void 0);return a&&Q(null),a},[S,Ge]);o.useEffect(()=>{if(!S)return;const e=a=>{if(Xe())return;const w=a.target;w.closest('[data-comment-card="true"]')||w.closest('[data-comment-input="true"]')||w.closest(".oc-block-widget")||w.closest(".cm-gutterElement")||w.closest("[data-sonner-toast]")||w.closest("[data-sonner-toaster]")||de.trim()||(Q(null),oe())},r=window.setTimeout(()=>{document.addEventListener("click",e)},100);return()=>{window.clearTimeout(r),document.removeEventListener("click",e)}},[oe,de,ke,Xe,Z,S]);const et=Te(e=>e.editorFontSize),Pt=o.useMemo(()=>{const e=[Lt(W,{fontSize:et})],r=Bt("plan.md");return r&&e.push(r),e.push(Nn.lineWrapping),e},[W,et]),C=o.useRef({key:null,target:null,content:"",editRevision:0,savedRevision:0,runtimeKey:""}),V=o.useState(Vn)[0],A=o.useCallback(()=>{const e=C.current;if(!e.key||!e.target||e.editRevision<=e.savedRevision)return;const r={key:e.key,target:e.target,content:e.content,revision:e.editRevision,runtimeKey:e.runtimeKey};V.schedule(r.key,r.revision,async()=>{if(Ie()!==r.runtimeKey)return;await zn(r.target,r.content);const a=C.current;a.key===r.key&&(a.savedRevision=Math.max(a.savedRevision,r.revision),be(null))}).catch(a=>{C.current.key===r.key&&be(a instanceof Error?a.message:"Plan save failed")})},[V]);o.useEffect(()=>{if(!c){A(),C.current={key:null,target:null,content:"",editRevision:0,savedRevision:0,runtimeKey:""},xe(null),Se(null),ne(""),Re(!1);return}let e=!1;return(async()=>{if(A(),C.current={key:null,target:null,content:"",editRevision:0,savedRevision:0,runtimeKey:""},xe(null),Se(null),ne(""),be(null),je(null),!(!s||!f)&&(await V.pendingFor(f),!e)){V.reset(f),Re(!0);try{const a=await lt(s,c);if(e)return;if(!a){je("Plan not found");return}C.current={key:f,target:{projectRef:s,planId:c},content:a.raw,editRevision:0,savedRevision:0,runtimeKey:O},ne(a.raw),Ke(!at(a.raw,"").body.trim()),xe(c),Se(a.path??null)}catch(a){if(e)return;je(a instanceof Error?a.message:"Plan load failed")}finally{e||Re(!1)}}})(),()=>{e=!0}},[O,c,f,s,V,A]);const[Rt,Nt]=o.useState(!1);o.useEffect(()=>{if(!(!s||!c||!f||J!==c))return hn(ve(s),c,{setHeld:Nt,flush:async()=>{A(),await V.pendingFor(f);const e=C.current;return e.key===f&&e.savedRevision>=e.editRevision}})},[J,c,f,s,V,A]),o.useEffect(()=>{if(!l||!s||!c||!f||J!==c)return;const e=C.current;if(e.key!==f)return;const r=Rn({readContent:async()=>{await V.pendingFor(f);const T=await lt(s,c);if(!T)throw new Error("Plan not found");return T.raw},getLoadedContent:()=>e.content,getLoadedRevision:()=>e.editRevision,isDirty:()=>C.current!==e||e.editRevision>e.savedRevision,applyContent:T=>{e.content=T,ne(T)}});let a=!1,w=!1;const D=async()=>{if(document.visibilityState!=="hidden"){if(a){w=!0;return}a=!0;try{await r.poll()}finally{a=!1,w&&(w=!1,D())}}},me=Gt(s,D);let ue=window.setInterval(()=>{D()},2e3);const fe=U?Jt(s.path,U,()=>{D()}):null;let P=!1;return fe?.watching.then(T=>{!T||P||(window.clearInterval(ue),ue=window.setInterval(()=>{D()},An))}),()=>{P=!0,window.clearInterval(ue),fe?.stop(),me(),r.dispose()}},[J,U,c,f,s,V,l]);const kt=o.useCallback(e=>{e!==C.current.content&&(C.current.content=e,C.current.editRevision+=1,ne(e))},[]);o.useEffect(()=>{if(!J)return;const e=window.setTimeout(()=>{A()},350);return()=>{window.clearTimeout(e)}},[h,J,A]),o.useEffect(()=>()=>{A()},[A]);const tt=o.useCallback(()=>{ae(!1),p?.()},[p,ae]),Tt=o.useCallback(async e=>{const r=s??j;if(!r||!L||H)return;const a=U;Fe(!0);try{let w;try{w=await Ut(r.path)}catch(R){ge.error(i("magicPrompts.toast.loadFailed"),{description:R instanceof Error?R.message:void 0});return}const D=w.render(L.action==="improve"?"plan.improve.visible":"plan.implement.visible",{plan_title:ce}),me=w.render(L.action==="improve"?"plan.improve.instructions":"plan.implement.instructions",{plan_title:ce,plan_path:a??""}),fe=[{synthetic:!0,text:a?me:[me,"","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.","",h].join(`
|
|
4
4
|
`)}];tt();let P=null,T=r.path,m=e;if(L.target==="worktree"){if(!we)return;const R=await Qt(r.path,Yt());if(!R?.id)return;P=R.id,T=R.directory,m=await vn(R.directory,e)}else{const R=await b(void 0,r.path,void 0,{model:{providerID:m.providerID,id:m.modelID,variant:m.variant||void 0},agent:m.agent.trim()||void 0});if(!R?.id)return;P=R.id,T=R.directory??r.path,X(R.id,st.getState().agents??[])}if(!P)return;const he=Xt.getState();he.saveSessionModelSelection(P,m.providerID,m.modelID),m.agent.trim()&&(he.saveSessionAgentSelection(P,m.agent),he.saveAgentModelForSession(P,m.agent,m.providerID,m.modelID),he.saveAgentModelVariantForSession(P,m.agent,m.providerID,m.modelID,m.variant||void 0)),se(P,T),s&&c&&ie.getState().linkPlanSession(s,c,P);const rt=L.action==="implement"&&m.runAsGoal===!0,Et=rt?[`Implement the plan "${ce}" end-to-end${a?` (plan file: ${a})`:" (the full plan follows)"}.`,a?"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.","",h].join(`
|