@openchamber/web 1.20.0 → 1.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/dist/assets/{CodeMirrorCommentWidgets-C36E738Y.js → CodeMirrorCommentWidgets-C2BopIs3.js} +1 -1
  2. package/dist/assets/CommitSection-HJeMUAWb.js +1 -0
  3. package/dist/assets/DiffView-D5cvbEPb.js +4 -0
  4. package/dist/assets/FilesView-DPU8aNPL.js +17 -0
  5. package/dist/assets/GitView-Ct6xWrVH.js +6 -0
  6. package/dist/assets/{JsonTreeView-KnXFN2A-.js → JsonTreeView-osju7J70.js} +1 -1
  7. package/dist/assets/MarkdownImageGallery-EujHSZ2M.js +1 -0
  8. package/dist/assets/MarkdownRendererImpl-CPzu4kIr.js +12 -0
  9. package/dist/assets/OnboardingScreen-w2VG4fWY.js +1 -0
  10. package/dist/assets/{PatchDiff-BzVOVog8.js → PatchDiff-Dan3mADn.js} +1 -1
  11. package/dist/assets/PierreDiffViewer-CGoI2v0q.js +157 -0
  12. package/dist/assets/PlanView-Dgg-WTEc.js +4 -0
  13. package/dist/assets/SessionSwitcherDropdown-CJTrc8K7.js +1 -0
  14. package/dist/assets/SettingsView-D9yRuFZw.js +28 -0
  15. package/dist/assets/SettingsWindow-DXF-MTHG.js +1 -0
  16. package/dist/assets/{ToolOutputDialog-BB1c--Zr.js → ToolOutputDialog-DrCa1JRk.js} +6 -6
  17. package/dist/assets/{ToolPartDiffPreview-DaOIDISD.js → ToolPartDiffPreview-B_tfvlNF.js} +2 -2
  18. package/dist/assets/{VirtualizedFileDiff-lESMT-2b.js → VirtualizedFileDiff-CN_BctrR.js} +4 -4
  19. package/dist/assets/{Virtualizer-X_7XPoTH.js → Virtualizer-CZlLSacm.js} +1 -1
  20. package/dist/assets/Virtualizer-D_a8gKmg.js +1 -0
  21. package/dist/assets/{WalkthroughView-CaSYE0lw.js → WalkthroughView-D9Q4lr5x.js} +2 -2
  22. package/dist/assets/{computeVirtualFileMetrics-DkRR5b75.js → computeVirtualFileMetrics-Gi1d5eU1.js} +2 -2
  23. package/dist/assets/contextPanelEmbeddedChat-CpzVNWAv.js +1 -0
  24. package/dist/assets/de-B_LdJwEM.js +9 -0
  25. package/dist/assets/es-CubfsAYV.js +15 -0
  26. package/dist/assets/fr-5qJM0nFS.js +13 -0
  27. package/dist/assets/index-BW82eK5v.css +1 -0
  28. package/dist/assets/index-Brm3X9rs.js +1 -0
  29. package/dist/assets/index-rlLjZUM5.js +7 -0
  30. package/dist/assets/{isDiffPlainText-BG53Ixxy.js → isDiffPlainText-pH9kAJQH.js} +1 -1
  31. package/dist/assets/{isFilePlainText-BbV-39jl.js → isFilePlainText-CVKy_dgB.js} +1 -1
  32. package/dist/assets/ja-DJYIBUlH.js +15 -0
  33. package/dist/assets/ko-DcUBkB7y.js +15 -0
  34. package/dist/assets/main-DLBxKIoX.js +926 -0
  35. package/dist/assets/main-vUCh0VB0.js +2 -0
  36. package/dist/assets/markdownCore-DG6GHLF4.js +3 -0
  37. package/dist/assets/{miniChat-ldEghBLB.js → miniChat-BlzGEYgE.js} +2 -2
  38. package/dist/assets/mobile-CkX6H-IT.js +2 -0
  39. package/dist/assets/{patchFileDiff-BcFaMtMu.js → patchFileDiff-BCTsE43U.js} +3 -3
  40. package/dist/assets/pl-rB6BLcio.js +15 -0
  41. package/dist/assets/pt-BR-DcwtlO-o.js +15 -0
  42. package/dist/assets/renderElectronMiniChatApp-CJYe_KOL.js +2 -0
  43. package/dist/assets/renderMobileApp-hQJTnr8B.js +25 -0
  44. package/dist/assets/runtimeEndpointReset-BDh7r8BL.js +15 -0
  45. package/dist/assets/scheduledTasksApi-CAGPh_gZ.js +1 -0
  46. package/dist/assets/{shikiHighlight-DCT2Sq_z.js → shikiHighlight-BgTPSITe.js} +1 -1
  47. package/dist/assets/uk-INZlFD9A.js +15 -0
  48. package/dist/assets/{useAppFontEffects-B53Rb6m7.js → useAppFontEffects-Cll4gnsh.js} +170 -180
  49. package/dist/assets/useInlineCommentController-DFFv0hae.js +2 -0
  50. package/dist/assets/{vendor-base-ui-DsHmyMwp.js → vendor-base-ui-_6j2xOWl.js} +1 -1
  51. package/dist/assets/{vendor-codemirror-language-data-vch3tJ4c.js → vendor-codemirror-language-data-DkQX2EBa.js} +2 -2
  52. package/dist/assets/{vendor-framer-motion-CRSgBxjL.js → vendor-framer-motion-livSKyyV.js} +1 -1
  53. package/dist/assets/vendor-legendapp-list-gg7YLRW7.js +1 -0
  54. package/dist/assets/{vendor-motion-dom-DJLgZh4Q.js → vendor-motion-dom-D_o3BTI3.js} +1 -1
  55. package/dist/assets/vendor-zod-BLfBSgBh.js +39 -0
  56. package/dist/assets/{web-components-pcwCTWjC.js → web-components-DLnGY4fs.js} +4 -4
  57. package/dist/assets/zh-CN-Dzda8xa1.js +15 -0
  58. package/dist/assets/zh-TW-Cwn3rNYZ.js +15 -0
  59. package/dist/index.html +6 -6
  60. package/dist/mini-chat.html +5 -5
  61. package/dist/mobile.html +5 -5
  62. package/package.json +4 -4
  63. package/server/index.js +8 -0
  64. package/server/lib/client-auth/pairing.js +8 -7
  65. package/server/lib/client-auth/pairing.test.js +5 -1
  66. package/server/lib/client-auth/remote-clients.js +9 -1
  67. package/server/lib/client-auth/remote-clients.test.js +17 -0
  68. package/server/lib/github/pr-status.js +10 -1
  69. package/server/lib/quota/providers/index.js +4 -18
  70. package/server/lib/relay/DOCUMENTATION.md +1 -1
  71. package/server/lib/relay/service.js +34 -2
  72. package/server/lib/relay/service.test.js +69 -0
  73. package/server/lib/session-goal/runtime.js +2 -1
  74. package/server/lib/session-goal/runtime.test.js +4 -2
  75. package/server/lib/terminal/DOCUMENTATION.md +2 -0
  76. package/server/lib/terminal/runtime.js +29 -1
  77. package/server/lib/terminal/runtime.test.js +26 -0
  78. package/server/lib/ui-auth/ui-auth.js +2 -2
  79. package/server/lib/ui-auth/ui-auth.test.js +2 -2
  80. package/dist/assets/CommitSection-C-F3AX6D.js +0 -1
  81. package/dist/assets/DiagramEditor-BPECg1jS.js +0 -1
  82. package/dist/assets/DiagramView-D0YNMix8.js +0 -1
  83. package/dist/assets/DiffView-BHWaMYCC.js +0 -4
  84. package/dist/assets/FilesView-NMBCW2Tm.js +0 -14
  85. package/dist/assets/GitView-Rp8P1KEI.js +0 -6
  86. package/dist/assets/MarkdownImageGallery-BMn3mtor.js +0 -1
  87. package/dist/assets/MarkdownRendererImpl-kD6N03pH.js +0 -12
  88. package/dist/assets/OnboardingScreen-CenIeD4v.js +0 -1
  89. package/dist/assets/PierreDiffViewer-Dlby4XqT.js +0 -136
  90. package/dist/assets/PlanView-Czu1KMJa.js +0 -4
  91. package/dist/assets/SessionSwitcherDropdown-IETz58DB.js +0 -1
  92. package/dist/assets/SettingsView-B6vmuf-c.js +0 -28
  93. package/dist/assets/SettingsWindow-CauZpdD3.js +0 -1
  94. package/dist/assets/contextPanelEmbeddedChat-BEARQjgn.js +0 -1
  95. package/dist/assets/de-DFdX3ABv.js +0 -9
  96. package/dist/assets/es-iC-FKvV9.js +0 -15
  97. package/dist/assets/fr-BBbi_1AL.js +0 -13
  98. package/dist/assets/index-BiEgzzkg.js +0 -1
  99. package/dist/assets/index-Cwmuwk3V.js +0 -7
  100. package/dist/assets/index-GNm1wgUH.css +0 -1
  101. package/dist/assets/ja-DQLQJL2J.js +0 -15
  102. package/dist/assets/ko-BeElEB4Y.js +0 -15
  103. package/dist/assets/main-Dpzo18z7.js +0 -2
  104. package/dist/assets/main-WMjtYzJs.js +0 -921
  105. package/dist/assets/markdownCore--tDmyI_v.js +0 -2
  106. package/dist/assets/mobile-Dk-VGreF.js +0 -2
  107. package/dist/assets/pl-CLHt2_vV.js +0 -15
  108. package/dist/assets/pt-BR-C_MPUq7e.js +0 -15
  109. package/dist/assets/renderElectronMiniChatApp-DIgCOmXY.js +0 -2
  110. package/dist/assets/renderMobileApp-CDfHS5rr.js +0 -25
  111. package/dist/assets/runtimeEndpointReset-ovNbaZ-x.js +0 -15
  112. package/dist/assets/scheduledTasksApi-BFSlqgnG.js +0 -1
  113. package/dist/assets/uk-PhsC-c4-.js +0 -15
  114. package/dist/assets/useInlineCommentController-DSfrIBKT.js +0 -2
  115. package/dist/assets/vendor-zod-C9ioTTSo.js +0 -39
  116. package/dist/assets/zh-CN-wF-NOFHM.js +0 -15
  117. package/dist/assets/zh-TW-4m4-A7rT.js +0 -15
  118. package/server/lib/quota/providers/command-code.js +0 -90
  119. package/server/lib/quota/providers/command-code.test.js +0 -85
@@ -1 +0,0 @@
1
- import{r as _,j as e,R as i,f as J}from"./vendor-react-BUCujlKS.js";import{J as V,c3 as we,c2 as le,c0 as G,y as $,ai as M,cX as je,r as W,P as ue,ar as me,L as pe,K as ne}from"./index-Cwmuwk3V.js";import{f as Q,B as L,S as X,g as he,h as re,I as A}from"./useAppFontEffects-B53Rb6m7.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-zod-C9ioTTSo.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-opencode-sdk-BJ73u-bH.js";import"./vendor-zustand-BAGL70zf.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-base-ui-DsHmyMwp.js";import"./vendor-floating-ui-utils-BzXdqYpP.js";import"./vendor-floating-ui-react-dom-DKpLs02S.js";import"./vendor-floating-ui-dom-WyXykhNi.js";import"./vendor-floating-ui-core-CXmKXOXc.js";import"./vendor-use-sync-external-store-D6wYuSt-.js";import"./contextPanelEmbeddedChat-BEARQjgn.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-dnd-kit-core-BZknOX2w.js";import"./vendor-dnd-kit-utilities-B_MdXhJC.js";import"./vendor-dnd-kit-accessibility-BHxJPORy.js";import"./vendor-dnd-kit-sortable-CsEagZ81.js";import"./vendor-framer-motion-CRSgBxjL.js";import"./vendor-motion-dom-DJLgZh4Q.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-tanstack-react-virtual-g05Cx3z9.js";import"./vendor-tanstack-virtual-core-Dubg10g5.js";import"./vendor-sonner-DFyL3AvE.js";import"./vendor-cmdk-DgLInKvT.js";import"./vendor-radix-ui-react-dialog-B94Bt2qq.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-DcAh5WdT.js";import"./vendor-radix-ui-react-context-Czxm7Z62.js";import"./vendor-radix-ui-react-id-f5BLKEVw.js";import"./vendor-radix-ui-react-use-layout-effect-D_3IhJdJ.js";import"./vendor-radix-ui-react-use-controllable-state-BFT5YmkA.js";import"./vendor-radix-ui-react-dismissable-layer-D7kXcwgJ.js";import"./vendor-radix-ui-react-primitive-DhVoX9SD.js";import"./vendor-radix-ui-react-slot-BQgQOasS.js";import"./vendor-radix-ui-react-use-callback-ref-BZPnuXAC.js";import"./vendor-radix-ui-react-use-escape-keydown-oph88g-F.js";import"./vendor-radix-ui-react-focus-scope-CiaxW4dD.js";import"./vendor-radix-ui-react-portal-BMJYHWck.js";import"./vendor-radix-ui-react-presence-CNxf-uq4.js";import"./vendor-radix-ui-react-focus-guards-B6qJXYua.js";import"./vendor-react-remove-scroll-DO7dCTnK.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-BcFYyj3E.js";import"./vendor-react-style-singleton-q6EMHnwf.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-zDC0RhA3.js";import"./vendor-use-callback-ref-D3RC8gqK.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-codemirror-language-BgPj_McA.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-codemirror-state-C9awkmn-.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-view-CiLROUVV.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-lezer-highlight-CDMHUZ74.js";import"./vendor-codemirror-lang-javascript-Cc2ZYbgX.js";import"./vendor-lezer-javascript-D7Tj24ot.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-DzPz9Wgq.js";import"./vendor-codemirror-lang-json-CMBS2tG9.js";import"./vendor-lezer-json-Iaex0UN-.js";import"./vendor-codemirror-lang-css-O0cZX78y.js";import"./vendor-lezer-css-C5xB6jxd.js";import"./vendor-codemirror-lang-html-CfgK872x.js";import"./vendor-lezer-html-C0I1p52t.js";import"./vendor-codemirror-lang-markdown-BPGOH9ye.js";import"./vendor-lezer-markdown-C6g-d6P3.js";import"./vendor-codemirror-language-data-vch3tJ4c.js";import"./vendor-codemirror-lang-python-HahnQaAS.js";import"./vendor-lezer-python-CvuFxeZl.js";import"./vendor-codemirror-commands-B7H_j0iU.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";function ke(a){switch(a){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 oe(a){return a==="wrong-service"||a==="unreachable"||a==="incompatible"}function xe({onBack:a,showBackButton:t=!0,initialUrl:s="",initialLabel:r="",isRecoveryMode:n=!1,onConnect:l,onSwitchToLocal:u,showInstancePicker:h=!1}){const{t:o}=Q(),[w,S]=_.useState(s),[j,U]=_.useState(r),[K,x]=_.useState("idle"),[m,k]=_.useState(null),[C,g]=_.useState(""),[T,I]=_.useState([]),[y,f]=_.useState(()=>h?"instances":"add"),[b,R]=_.useState("");_.useEffect(()=>{h&&V().then(p=>I(p.hosts)).catch(p=>{g(p instanceof Error?p.message:String(p))})},[h]);const N=we(w),E=N?.persistedUrl??null,F=_.useCallback(p=>{S(p.target.value),x("idle"),k(null),g("")},[]),O=_.useCallback(p=>{U(p.target.value)},[]),c=_.useCallback(async()=>{if(E){x("testing"),k(null),g("");try{const p=await le(E);k(p),x(p.status==="ok"||p.status==="update-recommended"?"success":"error")}catch(p){g(p instanceof Error?p.message:o("onboarding.remoteConnection.errors.connectionTestFailed")),x("error")}}},[E,o]),D=_.useCallback(async()=>{if(!N)return;const p=N.persistedUrl;x("testing"),k(null),g("");try{const H=await le(p);if(k(H),oe(H.status)){x("error");return}const Z=await V(),ye=j.trim()||p,ee=Z.hosts.find(q=>q.url===p),te=ee?ee.id:`host-${Date.now().toString(16)}`,ie={id:te,label:ye,url:p,apiUrl:p},ve=ee?Z.hosts.map(q=>q.id===te?ie:q):[...Z.hosts,ie];if(await G({hosts:ve,defaultHostId:te,initialHostChoiceCompleted:!0}),l?.(),N.redeemUrl){window.location.assign(N.redeemUrl);return}$()&&await M()}catch(H){g(H instanceof Error?H.message:o("onboarding.remoteConnection.errors.failedToSaveConnection")),x("error")}},[N,j,l,o]),B=_.useCallback(async p=>{const H=await V();await G({hosts:H.hosts,defaultHostId:p,initialHostChoiceCompleted:!0}),await M()},[]),d=_.useCallback(async()=>{x("testing"),g("");try{const p=await V(),H=await je(b,p.hosts);await G({hosts:H.hosts,defaultHostId:H.hostId,initialHostChoiceCompleted:!0}),await M()}catch(p){g(p instanceof Error&&p.message==="invalid-connect-link"?o("settings.remoteInstances.direct.error.invalidConnectLink"):o("onboarding.remoteConnection.errors.failedToSaveConnection")),x("error")}},[b,o]),v=K==="testing",P=E!==null&&!v,z=E!==null&&!v&&!oe(m?.status??null),Y=ke(m?.status??null),fe=m?.status==="ok",be=m?.status==="update-recommended",ge=m?.status==="auth",ae=oe(m?.status??null);return h&&y==="instances"?e.jsx("div",{className:"flex flex-col items-center justify-center h-full p-8",children:e.jsxs("div",{className:"w-full max-w-md space-y-6",children:[e.jsxs("div",{className:"space-y-2 text-center",children:[e.jsx("h1",{className:"typography-ui-header text-xl font-semibold text-foreground",children:o("desktopHostSwitcher.actions.switchInstance")}),e.jsx("p",{className:"text-muted-foreground text-sm",children:o("settings.remoteInstances.direct.description")})]}),C?e.jsx("div",{className:"text-sm text-[var(--status-error)]",children:C}):null,e.jsx("div",{className:"space-y-2",children:T.length===0?e.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:o("settings.remoteInstances.direct.state.empty")}):T.map(p=>e.jsx(L,{variant:"outline",className:"w-full justify-start",onClick:()=>{B(p.id)},children:e.jsx("span",{className:"min-w-0 truncate",children:p.label})},p.id))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(L,{variant:"outline",className:"flex-1",onClick:()=>f("import"),children:o("settings.remoteInstances.direct.import.action")}),e.jsx(L,{className:"flex-1",onClick:()=>f("add"),children:o("settings.remoteInstances.direct.actions.add")})]})]})}):h&&y==="import"?e.jsx("div",{className:"flex flex-col items-center justify-center h-full p-8",children:e.jsxs("div",{className:"w-full max-w-md space-y-6",children:[e.jsx(L,{variant:"ghost",onClick:()=>f("instances"),className:"p-0 text-muted-foreground",children:o("onboarding.common.actions.back")}),e.jsxs("div",{className:"space-y-2 text-center",children:[e.jsx("h1",{className:"typography-ui-header text-xl font-semibold text-foreground",children:o("settings.remoteInstances.direct.import.action")}),e.jsx("p",{className:"text-muted-foreground text-sm",children:o("settings.remoteInstances.direct.import.description")})]}),e.jsx(X,{value:b,onChange:p=>R(p.target.value),placeholder:o("settings.remoteInstances.direct.import.placeholder"),disabled:v,autoFocus:!0}),C?e.jsx("div",{className:"text-sm text-[var(--status-error)]",children:C}):null,e.jsx(L,{onClick:()=>{d()},disabled:v||!b.trim(),children:o("settings.remoteInstances.direct.import.action")})]})}):e.jsx("div",{className:"flex flex-col items-center justify-center h-full p-8",children:e.jsxs("div",{className:"w-full max-w-md space-y-6",children:[(t||h)&&e.jsx("div",{className:"flex items-center",children:e.jsx(L,{variant:"ghost",onClick:h?()=>f("instances"):a,className:"p-0 text-muted-foreground hover:text-foreground",children:o("onboarding.common.actions.back")})}),e.jsxs("div",{className:"space-y-2 text-center",children:[e.jsx("h1",{className:"typography-ui-header text-xl font-semibold text-foreground",children:o(n?"onboarding.remoteConnection.titleRecovery":"onboarding.remoteConnection.title")}),e.jsx("p",{className:"text-muted-foreground text-sm",children:o("onboarding.remoteConnection.description")})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"remote-url",className:"text-sm text-foreground",children:o("onboarding.remoteConnection.field.serverAddress")}),e.jsx(X,{id:"remote-url",type:"url",value:w,onChange:F,placeholder:o("onboarding.remoteConnection.field.serverAddressPlaceholder"),disabled:v})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"remote-label",className:"text-sm text-foreground",children:o("onboarding.remoteConnection.field.nameOptional")}),e.jsx(X,{id:"remote-label",type:"text",value:j,onChange:O,placeholder:o("onboarding.remoteConnection.field.namePlaceholder"),disabled:v})]})]}),m&&fe&&e.jsx("div",{className:"rounded-lg border p-3 text-sm",style:{borderColor:"var(--status-success)",color:"var(--status-success)"},children:o("onboarding.remoteConnection.status.connectedSuccessfully",{latencyMs:m.latencyMs})}),m&&ge&&e.jsx("div",{className:"rounded-lg border p-3 text-sm",style:{borderColor:"var(--status-warning)",color:"var(--status-warning)"},children:o("onboarding.remoteConnection.status.authWarning")}),m&&be&&e.jsx("div",{className:"rounded-lg border p-3 text-sm",style:{borderColor:"var(--status-warning)",color:"var(--status-warning)"},children:Y?o(Y):null}),m&&ae&&e.jsxs("div",{className:"rounded-lg border p-3 text-sm space-y-3",style:{borderColor:"var(--status-error)",color:"var(--status-error)"},children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold mb-1",children:o("onboarding.remoteConnection.status.connectionFailed")}),e.jsx("div",{className:"opacity-90",children:Y?o(Y):null})]}),e.jsx("div",{className:"text-xs opacity-80",children:m.status==="unreachable"?o("onboarding.remoteConnection.status.suggestionsUnreachable"):o("onboarding.remoteConnection.status.suggestionsWrongService")})]}),C&&e.jsx("div",{className:"rounded-lg border p-3 text-sm",style:{borderColor:"var(--status-error)",color:"var(--status-error)"},children:C}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(L,{variant:"outline",onClick:c,disabled:!P,children:o(v?"onboarding.remoteConnection.actions.testing":"onboarding.remoteConnection.actions.testConnection")}),e.jsx(L,{onClick:D,disabled:!z,children:o("onboarding.remoteConnection.actions.connectAndRestart")})]}),ae&&e.jsxs("div",{className:"flex flex-col gap-2 pt-2 border-t border-border",children:[e.jsx("div",{className:"text-xs text-muted-foreground text-center",children:o("onboarding.remoteConnection.actions.whatToDo")}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(L,{variant:"outline",size:"sm",onClick:a,className:"flex-1",children:o("onboarding.remoteConnection.actions.chooseDifferentServer")}),!n&&u&&e.jsx(L,{variant:"outline",size:"sm",onClick:u,className:"flex-1",children:o("onboarding.remoteConnection.actions.useLocalInstead")})]})]})]})})}const Ce="curl -fsSL https://opencode.ai/install | bash",Ne="https://opencode.ai/docs",ce=2500;function Se(a){const t=J.c(5),{onCopy:s,copyTitle:r}=a;let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=e.jsxs("code",{className:"flex-1 text-left overflow-x-auto whitespace-nowrap",children:[e.jsx("span",{style:{color:"var(--syntax-keyword)"},children:"curl"}),e.jsx("span",{className:"text-muted-foreground",children:" -fsSL "}),e.jsx("span",{style:{color:"var(--syntax-string)"},children:"https://opencode.ai/install"}),e.jsx("span",{className:"text-muted-foreground",children:" | "}),e.jsx("span",{style:{color:"var(--syntax-keyword)"},children:"bash"})]}),t[0]=n):n=t[0];let l;t[1]===Symbol.for("react.memo_cache_sentinel")?(l=e.jsx(A,{name:"file-copy",className:"h-4 w-4"}),t[1]=l):l=t[1];let u;return t[2]!==r||t[3]!==s?(u=e.jsxs("div",{className:"flex items-center justify-between gap-3 w-full",children:[n,e.jsx("button",{onClick:s,className:"inline-flex items-center text-muted-foreground hover:text-foreground transition-colors shrink-0",title:r,"aria-label":r,children:l})]}),t[2]=r,t[3]=s,t[4]=u):u=t[4],u}function Re({onCliAvailable:a,localAvailable:t=!0}){const{t:s}=Q(),[r,n]=i.useState(!1),[l,u]=i.useState(!1),[h,o]=i.useState(!1),[w,S]=i.useState(!1),[j,U]=i.useState(""),[K,x]=i.useState("unknown"),[m,k]=i.useState(()=>t?"local":"remote"),[C,g]=i.useState(!1),[T,I]=i.useState(!1);i.useEffect(()=>{u($())},[]),i.useEffect(()=>{if(typeof navigator>"u"){x("unknown");return}const d=navigator.userAgent||"";/Windows/i.test(d)?x("windows"):/Macintosh|Mac OS X/i.test(d)?x("macos"):/Linux/i.test(d)?x("linux"):x("unknown")},[]),i.useEffect(()=>{let d=!1;return(async()=>{try{const v=await W("/api/config/settings",{method:"GET",headers:{Accept:"application/json"}});if(!v.ok)return;const P=await v.json().catch(()=>null);if(!P||d)return;const z=typeof P.opencodeBinary=="string"?P.opencodeBinary.trim():"";z&&U(z)}catch{}})(),()=>{d=!0}},[]);const y=i.useCallback(async d=>{const v=d.target;v.closest(".app-region-no-drag")||v.closest("button, a, input, select, textarea, code, summary, details")||d.button===0&&l&&await ue()},[l]),f=i.useCallback(async()=>{try{const d=await W("/health");if(!d.ok)return!1;const v=await d.json();return v.openCodeRunning===!0||v.isOpenCodeReady===!0}catch{return!1}},[]),b=i.useCallback(async d=>{if(!l)return;const v=await V();await G({...v,...d==="local"?{defaultHostId:"local"}:{},initialHostChoiceCompleted:!0})},[l]),R=i.useCallback(async()=>{l&&await b("local"),a?.()},[l,a,b]);i.useEffect(()=>{if(!t||m!=="local")return;let d=!1,v=null;const P=async()=>{if(!d){try{const z=await f();if(d)return;if(z){await R();return}}catch{}d||(v=setTimeout(P,ce))}};return v=setTimeout(P,ce),()=>{d=!0,v&&clearTimeout(v)}},[m,f,R,t]);const N=i.useCallback(async()=>{S(!0);try{await f()&&await R()}finally{S(!1)}},[f,R]),E=i.useCallback(async()=>{if(!(typeof window>"u")&&l)try{const d=await me();d.success&&d.path&&d.path.trim().length>0&&U(d.path.trim())}catch{}},[l]),F=i.useCallback(async()=>{o(!0);try{if(await pe({opencodeBinary:j.trim()}),l){await b("local"),await M();return}await W("/api/config/reload",{method:"POST"})}finally{setTimeout(()=>o(!1),1e3)}},[l,j,b]),O=i.useCallback(async()=>{const d=await he(Ce);d.ok?(n(!0),setTimeout(()=>n(!1),2e3)):console.error("Failed to copy:",d.error)},[]),c=Ne,D=K==="windows"?"C:\\Users\\you\\AppData\\Roaming\\npm\\opencode.cmd":K==="linux"?"/home/you/.bun/bin/opencode":"/Users/you/.bun/bin/opencode",B=t&&(!l||m==="local");return e.jsx("div",{className:"app-region-drag h-full flex items-center justify-center bg-transparent p-8 cursor-default select-none overflow-y-auto",onMouseDown:y,children:e.jsxs("div",{className:"w-full max-w-md space-y-7",children:[e.jsxs("header",{className:"text-center space-y-1.5",children:[e.jsx("h1",{className:"text-2xl font-semibold tracking-tight text-foreground",children:s("onboarding.chooser.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("onboarding.chooser.description")})]}),l&&t&&e.jsxs("div",{className:"app-region-no-drag flex gap-1.5",children:[e.jsx("button",{type:"button",className:re("flex-1 px-4 py-2 rounded-lg border transition-colors text-sm",m==="local"?"border-[var(--interactive-selection)] text-foreground bg-[var(--interactive-selection)]/10":"border-border text-muted-foreground hover:text-foreground hover:border-muted-foreground"),onClick:()=>k("local"),children:s("onboarding.chooser.tabs.localInstall")}),e.jsx("button",{type:"button",className:re("flex-1 px-4 py-2 rounded-lg border transition-colors text-sm",m==="remote"?"border-[var(--interactive-selection)] text-foreground bg-[var(--interactive-selection)]/10":"border-border text-muted-foreground hover:text-foreground hover:border-muted-foreground"),onClick:()=>k("remote"),children:s("onboarding.chooser.tabs.connectRemote")})]}),l&&m==="remote"?e.jsx("div",{className:"app-region-no-drag",children:e.jsx(xe,{onBack:()=>t&&k("local"),showBackButton:!1,showInstancePicker:!t,onSwitchToLocal:t?()=>k("local"):void 0})}):null,B&&e.jsxs("div",{className:"space-y-4",children:[K==="windows"&&e.jsxs("div",{className:"rounded-lg border border-border bg-background/50 p-4",children:[e.jsx("div",{className:"text-sm text-foreground",children:s("onboarding.localSetup.windows.title")}),e.jsxs("ol",{className:"mt-2 list-decimal space-y-1 pl-5 text-sm text-muted-foreground",children:[e.jsx("li",{children:s("onboarding.localSetup.windows.stepRunInstallInWsl")}),e.jsx("li",{children:s("onboarding.localSetup.windows.stepSetBinaryPath")})]})]}),e.jsx("p",{className:"text-sm text-muted-foreground text-center leading-relaxed",children:s("onboarding.localSetup.intro")}),e.jsx("div",{className:"app-region-no-drag rounded-lg border border-border bg-background/60 backdrop-blur-sm px-4 py-3 font-mono text-sm",children:r?e.jsxs("div",{className:"flex items-center gap-2",style:{color:"var(--status-success)"},children:[e.jsx(A,{name:"check",className:"h-4 w-4"}),s("onboarding.common.status.copiedToClipboard")]}):e.jsx(Se,{onCopy:O,copyTitle:s("onboarding.common.copyToClipboard")})}),e.jsxs("div",{className:"app-region-no-drag flex items-center justify-between",children:[e.jsxs("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:text-foreground transition-colors inline-flex items-center gap-1",children:[s(K==="windows"?"onboarding.localSetup.docs.windows":"onboarding.localSetup.docs.default"),e.jsx(A,{name:"external-link",className:"h-3 w-3"})]}),e.jsx("button",{type:"button",onClick:N,disabled:w,className:"text-xs text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50",children:s(w?"onboarding.localSetup.actions.checking":"onboarding.localSetup.actions.checkNow")})]}),e.jsxs("div",{className:"rounded-lg border px-4 py-3 flex items-center gap-3",style:{borderColor:"color-mix(in srgb, var(--primary-base) 20%, transparent)",backgroundColor:"color-mix(in srgb, var(--primary-base) 6%, transparent)"},role:"status","aria-live":"polite",children:[e.jsxs("span",{className:"relative inline-flex h-2.5 w-2.5 shrink-0","aria-hidden":!0,children:[e.jsx("span",{className:"absolute inset-0 rounded-full",style:{backgroundColor:"var(--primary-base)",animation:"pulse-opacity 1.6s ease-in-out infinite"}}),e.jsx("span",{className:"absolute inset-[-4px] rounded-full",style:{backgroundColor:"var(--primary-base)",animation:"pulse-opacity-dim 1.6s ease-in-out infinite",opacity:0}})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-foreground leading-tight",children:s("onboarding.localSetup.status.watching")}),e.jsx("div",{className:"text-xs text-muted-foreground leading-tight mt-0.5",children:s("onboarding.localSetup.status.autoContinue")})]})]}),e.jsxs("details",{className:"app-region-no-drag group rounded-lg border border-border/60 px-4 open:bg-background/40 transition-colors",open:C,onToggle:d=>g(d.currentTarget.open),children:[e.jsxs("summary",{className:"flex items-center justify-between cursor-pointer py-2.5 text-sm text-muted-foreground hover:text-foreground transition-colors list-none [&::-webkit-details-marker]:hidden",children:[e.jsx("span",{children:s("onboarding.localSetup.advanced.title")}),e.jsx(A,{name:"arrow-down-s",className:"h-4 w-4 transition-transform group-open:rotate-180"})]}),e.jsxs("div",{className:"pb-4 space-y-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(X,{value:j,onChange:d=>U(d.target.value),placeholder:D,disabled:h,className:"flex-1 font-mono text-xs"}),e.jsx(L,{type:"button",variant:"secondary",size:"sm",onClick:E,disabled:h||!l,children:s("onboarding.localSetup.actions.browse")}),e.jsx(L,{type:"button",size:"sm",onClick:F,disabled:h||!j.trim(),children:s("onboarding.localSetup.actions.apply")})]}),e.jsx("p",{className:"text-xs text-muted-foreground/70",children:s("onboarding.localSetup.helper.saveAndReload")})]})]}),e.jsxs("details",{className:"app-region-no-drag group rounded-lg border border-border/60 px-4 open:bg-background/40 transition-colors",open:T,onToggle:d=>I(d.currentTarget.open),children:[e.jsxs("summary",{className:"flex items-center justify-between cursor-pointer py-2.5 text-sm text-muted-foreground hover:text-foreground transition-colors list-none [&::-webkit-details-marker]:hidden",children:[e.jsx("span",{children:s("onboarding.localSetup.troubleshoot.title")}),e.jsx(A,{name:"arrow-down-s",className:"h-4 w-4 transition-transform group-open:rotate-180"})]}),e.jsx("ul",{className:"pb-4 space-y-1.5 text-xs text-muted-foreground list-disc pl-4",children:K==="windows"?e.jsx(e.Fragment,{children:e.jsx("li",{children:s("onboarding.localSetup.windows.hintDetectionFailed")})}):e.jsxs(e.Fragment,{children:[e.jsx("li",{children:s("onboarding.localSetup.hint.ensurePath")}),e.jsx("li",{children:s("onboarding.localSetup.hint.setEnv")}),e.jsx("li",{children:s("onboarding.localSetup.hint.missingRuntime")})]})})]})]})]})})}const Le="curl -fsSL https://opencode.ai/install | bash",Ue="https://opencode.ai/docs";function Te(a){const t=J.c(5),{onCopy:s,copyTitle:r}=a;let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=e.jsxs("code",{children:[e.jsx("span",{style:{color:"var(--syntax-keyword)"},children:"curl"}),e.jsx("span",{className:"text-muted-foreground",children:" -fsSL "}),e.jsx("span",{style:{color:"var(--syntax-string)"},children:"https://opencode.ai/install"}),e.jsx("span",{className:"text-muted-foreground",children:" | "}),e.jsx("span",{style:{color:"var(--syntax-keyword)"},children:"bash"})]}),t[0]=n):n=t[0];let l;t[1]===Symbol.for("react.memo_cache_sentinel")?(l=e.jsx(A,{name:"file-copy",className:"h-4 w-4"}),t[1]=l):l=t[1];let u;return t[2]!==r||t[3]!==s?(u=e.jsxs("div",{className:"flex items-center justify-center gap-3",children:[n,e.jsx("button",{onClick:s,className:"inline-flex items-center text-muted-foreground hover:text-foreground transition-colors",title:r,children:l})]}),t[2]=r,t[3]=s,t[4]=u):u=t[4],u}const Ke=3e4;function Ie({onBack:a,onCliAvailable:t,isFromRecovery:s=!1,onSwitchToRemote:r}){const{t:n}=Q(),[l,u]=i.useState(!1),[h,o]=i.useState(!1),[w,S]=i.useState(!1),[j,U]=i.useState(!1),[K,x]=i.useState(!1),[m,k]=i.useState(null),[C,g]=i.useState(""),[T,I]=i.useState("unknown");i.useEffect(()=>{const c=setTimeout(()=>o(!0),Ke);return()=>clearTimeout(c)},[]),i.useEffect(()=>{S($())},[]),i.useEffect(()=>{if(typeof navigator>"u"){I("unknown");return}const c=navigator.userAgent||"";if(/Windows/i.test(c)){I("windows");return}if(/Macintosh|Mac OS X/i.test(c)){I("macos");return}if(/Linux/i.test(c)){I("linux");return}I("unknown")},[]),i.useEffect(()=>{let c=!1;return(async()=>{try{const D=await W("/api/config/settings",{method:"GET",headers:{Accept:"application/json"}});if(!D.ok)return;const B=await D.json().catch(()=>null);if(!B||c)return;const d=typeof B.opencodeBinary=="string"?B.opencodeBinary.trim():"";d&&g(d)}catch{}})(),()=>{c=!0}},[]);const y=i.useCallback(async c=>{c.target.closest("button, a, input, select, textarea, code")||c.button===0&&w&&await ue()},[w]),f=i.useCallback(async()=>{try{const c=await W("/health");if(!c.ok)return!1;const D=await c.json();return D.openCodeRunning===!0||D.isOpenCodeReady===!0}catch{return!1}},[]),b=i.useCallback(async()=>{if(!(typeof window>"u")&&w)try{const c=await me();c.success&&c.path&&c.path.trim().length>0&&g(c.path.trim())}catch{}},[w]),R=i.useCallback(async()=>{U(!0);try{if(await pe({opencodeBinary:C.trim()}),w){await M();return}await W("/api/config/reload",{method:"POST"})}finally{setTimeout(()=>U(!1),1e3)}},[w,C]),N=i.useCallback(async()=>{const c=await he(Le);c.ok?(u(!0),setTimeout(()=>u(!1),2e3)):console.error("Failed to copy:",c.error)},[]),E=i.useCallback(async()=>{x(!0),k(null);try{await f()?t?.():k(n("onboarding.localSetup.errors.cliNotReady"))}catch(c){k(c instanceof Error?c.message:n("onboarding.localSetup.errors.detectionFailed"))}finally{x(!1)}},[f,t,n]),F=Ue,O=T==="windows"?"C:\\Users\\you\\AppData\\Roaming\\npm\\opencode.cmd":T==="linux"?"/home/you/.bun/bin/opencode":"/Users/you/.bun/bin/opencode";return e.jsxs("div",{className:"h-full flex items-center justify-center bg-transparent p-8 relative cursor-default select-none",onMouseDown:y,children:[e.jsxs("div",{className:"w-full max-w-lg space-y-4 text-center",children:[e.jsx("div",{className:"flex items-center",children:e.jsx(L,{variant:"ghost",onClick:a,className:"p-0 text-muted-foreground hover:text-foreground",children:n("onboarding.common.actions.back")})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-foreground",children:n("onboarding.localSetup.title")}),e.jsx("p",{className:"text-muted-foreground",children:n("onboarding.localSetup.description")})]}),T==="windows"&&e.jsxs("div",{className:"mx-auto max-w-2xl rounded-lg border border-border bg-background/50 p-4 text-left",children:[e.jsx("div",{className:"text-sm text-foreground",children:n("onboarding.localSetup.windows.title")}),e.jsxs("ol",{className:"mt-2 list-decimal space-y-1 pl-5 text-sm text-muted-foreground",children:[e.jsx("li",{children:n("onboarding.localSetup.windows.stepRunInstallInWsl")}),e.jsx("li",{children:n("onboarding.localSetup.windows.stepSetBinaryPath")})]})]}),e.jsx("div",{className:"flex justify-center",children:e.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?e.jsxs("div",{className:"flex items-center justify-center gap-2",style:{color:"var(--status-success)"},children:[e.jsx(A,{name:"check",className:"h-4 w-4"}),n("onboarding.common.status.copiedToClipboard")]}):e.jsx(Te,{onCopy:N,copyTitle:n("onboarding.common.copyToClipboard")})})}),e.jsxs("a",{href:F,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(T==="windows"?"onboarding.localSetup.docs.windows":"onboarding.localSetup.docs.default"),e.jsx(A,{name:"external-link",className:"h-3 w-3"})]}),m&&e.jsx("div",{className:"mx-auto max-w-md rounded-lg border border-destructive/50 bg-destructive/10 p-3 text-sm text-destructive",children:m}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(L,{type:"button",onClick:E,disabled:K,className:"w-full max-w-xs",size:"lg",children:n(K?"onboarding.localSetup.actions.checking":"onboarding.localSetup.actions.checkAndContinue")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n("onboarding.localSetup.helper.checkAndContinue")})]}),e.jsx("div",{className:"mx-auto w-full max-w-xl pt-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:n("onboarding.localSetup.field.alreadyInstalled")}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(X,{value:C,onChange:c=>g(c.target.value),placeholder:O,disabled:j,className:"flex-1 font-mono text-xs"}),e.jsx(L,{type:"button",variant:"secondary",onClick:b,disabled:j||!w,children:n("onboarding.localSetup.actions.browse")}),e.jsx(L,{type:"button",onClick:R,disabled:j,children:n("onboarding.localSetup.actions.apply")})]}),e.jsx("div",{className:"text-xs text-muted-foreground/70",children:n("onboarding.localSetup.helper.saveAndReload")})]})}),s&&r&&e.jsxs("div",{className:"text-center pt-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:n("onboarding.localSetup.remotePreference")}),e.jsx(L,{variant:"link",onClick:r,children:n("onboarding.localSetup.actions.connectRemoteServer")})]})]}),h&&e.jsx("div",{className:"absolute bottom-8 left-0 right-0 text-center space-y-1",children:T==="windows"?e.jsx(e.Fragment,{children:e.jsx("p",{className:"text-sm text-muted-foreground/70",children:n("onboarding.localSetup.windows.hintDetectionFailed")})}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm text-muted-foreground/70",children:n("onboarding.localSetup.hint.ensurePath")}),e.jsx("p",{className:"text-sm text-muted-foreground/70",children:n("onboarding.localSetup.hint.setEnv")}),e.jsx("p",{className:"text-sm text-muted-foreground/70",children:n("onboarding.localSetup.hint.missingRuntime")})]})})]})}function se(a,t){if(a?.trim())return ne(a.trim());if(t)return ne(t)}function _e(a,t,s){switch(a){case"local-unavailable":return{title:"Local OpenCode Unavailable",description:"OpenCode CLI could not be started or is not installed. Install OpenCode or connect to a remote server instead.",titleKey:"onboarding.desktopRecovery.localUnavailable.title",descriptionKey:"onboarding.desktopRecovery.localUnavailable.description",iconKey:"local",showRetry:!0,retryLabel:"Retry Local",retryLabelKey:"onboarding.desktopRecovery.localUnavailable.retry",showUseLocal:!0,showUseRemote:!0,useLocalLabel:"Set Up Local",useLocalLabelKey:"onboarding.desktopRecovery.localUnavailable.useLocal",useRemoteLabel:"Use Remote",useRemoteLabelKey:"onboarding.desktopRecovery.common.useRemote"};case"remote-missing":return{title:"No Default Connection",description:"Your saved default connection could not be found. Choose how you want to connect.",titleKey:"onboarding.desktopRecovery.noDefaultConnection.title",descriptionKey:"onboarding.desktopRecovery.noDefaultConnection.description",iconKey:"local",showRetry:!1,showUseLocal:!0,showUseRemote:!0,useLocalLabel:"Use Local",useLocalLabelKey:"onboarding.desktopRecovery.common.useLocal",useRemoteLabel:"Use Remote",useRemoteLabelKey:"onboarding.desktopRecovery.common.useRemote"};case"remote-unreachable":{const r=se(t,s);return{title:"Remote Server Unreachable",description:`Could not connect to "${r||"the remote server"}". Check your network connection and verify the server address.`,titleKey:"onboarding.desktopRecovery.remoteUnreachable.title",descriptionKey:"onboarding.desktopRecovery.remoteUnreachable.description",descriptionParams:r?{host:r}:void 0,iconKey:"remote",showRetry:!0,retryLabel:"Retry Connection",retryLabelKey:"onboarding.desktopRecovery.remoteUnreachable.retry",showUseLocal:!0,showUseRemote:!0,useLocalLabel:"Use Local",useLocalLabelKey:"onboarding.desktopRecovery.common.useLocal",useRemoteLabel:"Use Remote",useRemoteLabelKey:"onboarding.desktopRecovery.common.useRemote"}}case"remote-wrong-service":{const r=se(t,s);return{title:"Incompatible Server",description:`The server at "${r||"unknown"}" is not running OpenChamber. Verify the address points to an OpenChamber server.`,titleKey:"onboarding.desktopRecovery.incompatibleServer.title",descriptionKey:"onboarding.desktopRecovery.incompatibleServer.description",descriptionParams:r?{host:r}:void 0,iconKey:"remote",showRetry:!1,showUseLocal:!0,showUseRemote:!0,useLocalLabel:"Use Local",useLocalLabelKey:"onboarding.desktopRecovery.common.useLocal",useRemoteLabel:"Use Remote",useRemoteLabelKey:"onboarding.desktopRecovery.common.useRemote"}}case"remote-incompatible":{const r=se(t,s);return{title:"Server Update Required",description:`The OpenChamber server at "${r||"unknown"}" is not compatible with this app version. Update OpenChamber on the server, then try again.`,titleKey:"onboarding.desktopRecovery.remoteIncompatible.title",descriptionKey:"onboarding.desktopRecovery.remoteIncompatible.description",descriptionParams:r?{host:r}:void 0,iconKey:"remote",showRetry:!0,retryLabel:"Retry Connection",retryLabelKey:"onboarding.desktopRecovery.remoteUnreachable.retry",showUseLocal:!0,showUseRemote:!0,useLocalLabel:"Use Local",useLocalLabelKey:"onboarding.desktopRecovery.common.useLocal",useRemoteLabel:"Use Remote",useRemoteLabelKey:"onboarding.desktopRecovery.common.useRemote"}}case"missing-default-host":return{title:"No Default Connection",description:"Your saved default connection could not be found. Choose how you want to connect.",titleKey:"onboarding.desktopRecovery.noDefaultConnection.title",descriptionKey:"onboarding.desktopRecovery.noDefaultConnection.description",iconKey:"local",showRetry:!1,showUseLocal:!0,showUseRemote:!0,useLocalLabel:"Use Local",useLocalLabelKey:"onboarding.desktopRecovery.common.useLocal",useRemoteLabel:"Use Remote",useRemoteLabelKey:"onboarding.desktopRecovery.common.useRemote"};default:{const r=a;throw new Error(`Unknown recovery variant: ${r}`)}}}function De(a){switch(a){case"local":return e.jsx(A,{name:"macbook",className:"h-8 w-8"});case"remote":return e.jsx(A,{name:"server",className:"h-8 w-8"})}}function Ee({variant:a,hostLabel:t,hostUrl:s,onRetry:r,onUseLocal:n,onUseRemote:l,isRetrying:u=!1}){const{t:h}=Q(),o=_e(a,t,s),w=o.retryLabelKey??"onboarding.desktopRecovery.actions.retryConnection",S=i.useMemo(()=>{if(o.descriptionParams?.host)return o.descriptionParams;if(a==="remote-unreachable")return{host:h("onboarding.desktopRecovery.placeholders.remoteServer")};if(a==="remote-wrong-service"||a==="remote-incompatible")return{host:h("onboarding.desktopRecovery.placeholders.unknownServer")}},[o.descriptionParams,h,a]);return e.jsx("div",{className:"flex flex-col items-center justify-center h-full p-8",children:e.jsxs("div",{className:"w-full max-w-md space-y-6",children:[e.jsxs("div",{className:"flex flex-col items-center space-y-3 text-center",children:[e.jsx("div",{className:"p-3 rounded-full",style:{backgroundColor:"var(--status-warning)",opacity:.15},children:e.jsx("div",{style:{color:"var(--status-warning)"},children:De(o.iconKey)})}),e.jsx("h1",{className:"typography-ui-header text-xl font-semibold text-foreground",children:h(o.titleKey)}),e.jsx("p",{className:"text-muted-foreground text-sm max-w-sm",children:h(o.descriptionKey,S)})]}),s&&(a==="remote-unreachable"||a==="remote-wrong-service"||a==="remote-incompatible")&&e.jsxs("div",{className:"rounded-lg border border-border bg-background/50 p-3",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:h("onboarding.remoteConnection.field.serverAddress")}),e.jsx("div",{className:"font-mono text-sm text-foreground truncate",children:ne(s)})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[o.showRetry&&r&&e.jsxs(L,{onClick:r,disabled:u,className:"w-full",children:[e.jsx(A,{name:"refresh",className:re("h-4 w-4",u&&"animate-spin")}),h(u?"onboarding.desktopRecovery.actions.retrying":w)]}),e.jsxs("div",{className:"flex gap-2",children:[o.showUseLocal&&n&&e.jsxs(L,{variant:"outline",onClick:n,disabled:u,className:"flex-1",children:[e.jsx(A,{name:"macbook",className:"h-4 w-4"}),h(o.useLocalLabelKey)]}),o.showUseRemote&&l&&e.jsxs(L,{variant:"outline",onClick:l,disabled:u,className:"flex-1",children:[e.jsx(A,{name:"server",className:"h-4 w-4"}),h(o.useRemoteLabelKey)]})]})]})]})})}function de(a,t){if(t==="use-remote")return{kind:"remote-form"};switch(a){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 s=a;throw new Error(`Unhandled RecoveryVariant: ${s}`)}}}function Ae(a){const t=J.c(29),{variant:s,hostUrl:r,hostLabel:n,onRetry:l,onChooseRemote:u,showRemoteForm:h,onCloseRemoteForm:o,onSwitchToLocalFromRemote:w,onEnterLocalSetup:S,isRetrying:j,localAvailable:U}=a,K=h===void 0?!1:h,x=j===void 0?!1:j,m=U===void 0?!0:U,k=Fe;let C;t[0]!==l?(C=async()=>{if($()){await M();return}await W("/api/config/reload",{method:"POST"}),l?.()},t[0]=l,t[1]=C):C=t[1];const g=C;let T;t[2]!==S||t[3]!==s?(T=async()=>{if(de(s,"use-local").kind==="local-setup"){S?.();return}if(await k("local"),$()){await M();return}window.location.reload()},t[2]=S,t[3]=s,t[4]=T):T=t[4];const I=T;let y;t[5]!==u||t[6]!==s?(y=()=>{de(s,"use-remote").kind==="remote-form"&&u?.()},t[5]=u,t[6]=s,t[7]=y):y=t[7];const f=y;if(K){const N=s==="remote-wrong-service"?"":r||"",E=s==="remote-wrong-service"?"":n||"";let F;t[8]!==u||t[9]!==o?(F=o||(()=>u?.()),t[8]=u,t[9]=o,t[10]=F):F=t[10];const O=!m;let c;t[11]!==m||t[12]!==S||t[13]!==w?(c=m?w||(()=>{k("local").then(()=>{$()?M():S?.()})}):void 0,t[11]=m,t[12]=S,t[13]=w,t[14]=c):c=t[14];let D;return t[15]!==E||t[16]!==N||t[17]!==F||t[18]!==O||t[19]!==c?(D=e.jsx(xe,{onBack:F,initialUrl:N,initialLabel:E,isRecoveryMode:!0,showInstancePicker:O,onSwitchToLocal:c}),t[15]=E,t[16]=N,t[17]=F,t[18]=O,t[19]=c,t[20]=D):D=t[20],D}const b=m?I:void 0;let R;return t[21]!==g||t[22]!==f||t[23]!==n||t[24]!==r||t[25]!==x||t[26]!==b||t[27]!==s?(R=e.jsx(Ee,{variant:s,hostLabel:n,hostUrl:r,onRetry:g,onUseLocal:b,onUseRemote:f,isRetrying:x}),t[21]=g,t[22]=f,t[23]=n,t[24]=r,t[25]=x,t[26]=b,t[27]=s,t[28]=R):R=t[28],R}async function Fe(a){if(!$())return;const t=await V();await G({...t,...a==="local"?{defaultHostId:"local"}:{},initialHostChoiceCompleted:!0})}function uo(a){const t=J.c(29),{onBack:s,onCliAvailable:r,mode:n,recoveryVariant:l,recoveryHostUrl:u,recoveryHostLabel:h,onEnterLocalSetup:o,localAvailable:w}=a,S=n===void 0?"first-launch":n,j=l===void 0?"missing-default-host":l,U=w===void 0?!0:w,[K,x]=i.useState(!1),[m,k]=i.useState(!1);let C;t[0]===Symbol.for("react.memo_cache_sentinel")?(C=()=>{k(!1),x(!1)},t[0]=C):C=t[0];let g;t[1]!==S||t[2]!==h||t[3]!==u||t[4]!==j?(g=[S,j,u,h],t[1]=S,t[2]=h,t[3]=u,t[4]=j,t[5]=g):g=t[5],i.useEffect(C,g);const T=m?"local-setup":S;if(T==="recovery"){let y;t[6]===Symbol.for("react.memo_cache_sentinel")?(y=()=>x(!0),t[6]=y):y=t[6];let f,b;t[7]===Symbol.for("react.memo_cache_sentinel")?(f=()=>x(!1),b=()=>{x(!1),k(!0)},t[7]=f,t[8]=b):(f=t[7],b=t[8]);let R;t[9]!==o?(R=()=>{k(!0),o?.()},t[9]=o,t[10]=R):R=t[10];let N;return t[11]!==U||t[12]!==h||t[13]!==u||t[14]!==j||t[15]!==K||t[16]!==R?(N=e.jsx(Ae,{variant:j,hostUrl:u,hostLabel:h,onChooseRemote:y,showRemoteForm:K,onCloseRemoteForm:f,onSwitchToLocalFromRemote:b,onEnterLocalSetup:R,localAvailable:U}),t[11]=U,t[12]=h,t[13]=u,t[14]=j,t[15]=K,t[16]=R,t[17]=N):N=t[17],N}if(T==="local-setup"){let y;t[18]!==s||t[19]!==m?(y=()=>{m?k(!1):s?.()},t[18]=s,t[19]=m,t[20]=y):y=t[20];let f;t[21]===Symbol.for("react.memo_cache_sentinel")?(f=()=>x(!0),t[21]=f):f=t[21];let b;return t[22]!==r||t[23]!==m||t[24]!==y?(b=e.jsx(Ie,{onBack:y,onCliAvailable:r,isFromRecovery:m,onSwitchToRemote:f}),t[22]=r,t[23]=m,t[24]=y,t[25]=b):b=t[25],b}let I;return t[26]!==U||t[27]!==r?(I=e.jsx(Re,{onCliAvailable:r,localAvailable:U}),t[26]=U,t[27]=r,t[28]=I):I=t[28],I}export{uo as OnboardingScreen};
@@ -1,136 +0,0 @@
1
- import{R as F,j as O,c as we,r as d}from"./vendor-react-BUCujlKS.js";import{a as $e}from"./web-components-pcwCTWjC.js";import{f as Te}from"./computeVirtualFileMetrics-DkRR5b75.js";import{V as Ne,F as Be}from"./VirtualizedFileDiff-lESMT-2b.js";import{e4 as je,aW as Ue,bW as Ge,h as ke}from"./useAppFontEffects-B53Rb6m7.js";import{I as Ce,a as Qe,u as Ke}from"./useInlineCommentController-DSfrIBKT.js";import{V as Ye}from"./runtimeEndpointReset-ovNbaZ-x.js";import{ensurePierreThemeRegistered as Me,getResolvedShikiTheme as Oe}from"./appThemeRegistry-BK0dHKa6.js";import{aj as Le}from"./index-Cwmuwk3V.js";const he=new Set;let Re=null;function I(s){he.add(s),Re??=requestAnimationFrame(Pe)}function Pe(s){const e=new Set(he);he.clear();for(const t of e)try{t(s)}catch(n){console.error(n)}he.size>0?Re=requestAnimationFrame(Pe):Re=null}function De({scrollTop:s,scrollHeight:e,height:t,fitPerfectly:n=!1,fitPerfectlyOverscroll:r=0,overscrollSize:l}){const u=t+l*2,h=n?t+r*2:u;if(e=Math.max(e,h),u>=e||n){const m=Math.max(s-r,0),S=Math.min(s+h,e);return{top:m,bottom:Math.max(S,m)}}let a=s+t/2-u/2,g=a+u;return a<0&&(a=0),g>e&&(g=e),a=Math.floor(Math.max(a,0)),{top:a,bottom:Math.ceil(Math.max(Math.min(g,e),a))}}function Ze(s,e){return s==null||e==null?s===e:s.top===e.top&&s.bottom===e.bottom}const He=1e3,Xe=He*4,Je=[0,1e-6,.99999,1],et={overscrollSize:He,intersectionObserverMargin:Xe,resizeDebugging:!1};let ue=0,tt=-1;var nt=class H{static __STOP=!1;static __lastScrollPosition=0;__id=`virtualizer-${++tt}`;config;type="simple";intersectionObserver;scrollTop=0;height=0;scrollHeight=0;windowSpecs={top:0,bottom:0};root;contentContainer;resizeObserver;observers=new Map;visibleInstances=new Map;visibleInstancesDirty=!1;instancesChanged=new Set;scrollDirty=!0;heightDirty=!0;scrollHeightDirty=!0;renderedObservers=0;connectQueue=new Map;constructor(e){this.config={...et,...e}}setup(e,t){if(this.root==null){this.root=e,this.resizeObserver=new ResizeObserver(this.handleContainerResize),this.intersectionObserver=new IntersectionObserver(this.handleIntersectionChange,{root:this.root,threshold:Je,rootMargin:`${this.config.intersectionObserverMargin}px 0px ${this.config.intersectionObserverMargin}px 0px`}),e instanceof Document?this.setupWindow():this.setupElement(t),window.__INSTANCE=this,window.__TOGGLE=()=>{H.__STOP?(H.__STOP=!1,(this.getScrollContainerElement()??window).scrollTo({top:H.__lastScrollPosition}),I(this.computeRenderRangeAndEmit)):(H.__lastScrollPosition=this.getScrollTop(),H.__STOP=!0)};for(const[n,r]of this.connectQueue.entries())this.connect(n,r);this.connectQueue.clear(),this.markDOMDirty(),I(this.computeRenderRangeAndEmit)}}instanceChanged(e,t){this.instancesChanged.add(e),t&&this.markDOMDirty(),I(this.computeRenderRangeAndEmit)}getWindowSpecs(){return this.windowSpecs.top===0&&this.windowSpecs.bottom===0&&(this.windowSpecs=De({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize})),this.windowSpecs}isInstanceVisible(e,t){const n=this.getScrollTop(),r=this.getHeight(),l=this.config.intersectionObserverMargin,u=n-l,h=n+r+l;return!(e<u-t||e>h)}handleContainerResize=e=>{if(this.root==null)return;let t=!1;for(const n of e){const r=n.borderBoxSize[0].blockSize;this.root instanceof Document?r!==this.scrollHeight&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log("Virtualizer: content size change",this.__id,{sizeChange:r-ue,newSize:r}),ue=r)):n.target===this.root?r!==this.height&&(this.heightDirty=!0,t=!0):n.target===this.contentContainer&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log("Virtualizer: scroller size change",this.__id,{sizeChange:r-ue,newSize:r}),ue=r))}t&&I(this.computeRenderRangeAndEmit)};setupWindow(){if(this.root==null||!(this.root instanceof Document))throw new Error("Virtualizer.setupWindow: Invalid setup method");window.addEventListener("scroll",this.handleWindowScroll,{passive:!0}),window.addEventListener("resize",this.handleWindowResize,{passive:!0}),this.resizeObserver?.observe(this.root.documentElement)}setupElement(e){if(this.root==null||this.root instanceof Document)throw new Error("Virtualizer.setupElement: Invalid setup method");this.root.addEventListener("scroll",this.handleElementScroll,{passive:!0}),this.resizeObserver?.observe(this.root),e??=this.root.firstElementChild??void 0,e instanceof HTMLElement&&(this.contentContainer=e,this.resizeObserver?.observe(e))}cleanUp(){this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,this.root?.removeEventListener("scroll",this.handleElementScroll),window.removeEventListener("scroll",this.handleWindowScroll),window.removeEventListener("resize",this.handleWindowResize),this.root=void 0,this.contentContainer=void 0,this.observers.clear(),this.visibleInstances.clear(),this.instancesChanged.clear(),this.connectQueue.clear(),this.visibleInstancesDirty=!1,this.windowSpecs={top:0,bottom:0},this.scrollTop=0,this.height=0,this.scrollHeight=0}getOffsetInScrollContainer(e){return this.getScrollTop()+se(e,this.getScrollContainerElement())}connect(e,t){if(this.observers.has(e))throw new Error("Virtualizer.connect: instance is already connected...");return this.intersectionObserver==null?this.connectQueue.set(e,t):(this.intersectionObserver.observe(e),this.observers.set(e,t),this.instancesChanged.add(t),this.markDOMDirty(),I(this.computeRenderRangeAndEmit)),()=>this.disconnect(e)}disconnect(e){const t=this.observers.get(e);this.connectQueue.delete(e),t!=null&&(this.intersectionObserver?.unobserve(e),this.observers.delete(e),this.visibleInstances.delete(e)&&(this.visibleInstancesDirty=!0),this.markDOMDirty(),I(this.computeRenderRangeAndEmit))}handleWindowResize=()=>{H.__STOP||window.innerHeight===this.height||(this.heightDirty=!0,I(this.computeRenderRangeAndEmit))};handleWindowScroll=()=>{H.__STOP||this.root==null||!(this.root instanceof Document)||(this.scrollDirty=!0,I(this.computeRenderRangeAndEmit))};handleElementScroll=()=>{H.__STOP||this.root==null||this.root instanceof Document||(this.scrollDirty=!0,I(this.computeRenderRangeAndEmit))};computeRenderRangeAndEmit=()=>{if(H.__STOP)return;const e=this.heightDirty||this.scrollHeightDirty;if(!this.scrollDirty&&!this.scrollHeightDirty&&!this.heightDirty&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty&&this.instancesChanged.size===0)return;let t=this.instancesChanged.size>0;if(this.instancesChanged.size===0){const l=De({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize});if(!e&&Ze(this.windowSpecs,l)&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty)return;this.windowSpecs=l}this.visibleInstancesDirty=!1,this.renderedObservers=this.observers.size;const n=this.getScrollAnchor(this.height),r=new Set;for(const l of e?this.observers.values():this.visibleInstances.values())l.onRender(e)&&r.add(l);for(const l of this.instancesChanged)r.has(l)||l.onRender(e)&&r.add(l);this.scrollFix(n);for(const l of r)l.reconcileHeights();t||=this.instancesChanged.size>0,t&&this.markDOMDirty(),(t||e)&&I(this.computeRenderRangeAndEmit),r.clear(),this.instancesChanged.clear()};scrollFix(e){if(e==null)return;const t=this.getScrollContainerElement(),{lineIndex:n,lineOffset:r,fileElement:l,fileOffset:u,fileTypeOffset:h}=e;if(n!=null&&r!=null){const g=l.shadowRoot?.querySelector(`[data-line][data-line-index="${n}"]`);if(g instanceof HTMLElement){const m=se(g,t);if(m!==r){const S=m-r;this.applyScrollFix(S)}return}}const a=se(l,t);if(h==="top")a!==u&&this.applyScrollFix(a-u);else{const g=a+l.getBoundingClientRect().height;g!==u&&this.applyScrollFix(g-u)}}applyScrollFix(e){this.root==null||this.root instanceof Document?window.scrollTo({top:window.scrollY+e,behavior:"instant"}):this.root.scrollTo({top:this.root.scrollTop+e,behavior:"instant"}),this.markDOMDirty()}getScrollAnchor(e){const t=this.getScrollContainerElement();let n;for(const[r]of this.visibleInstances.entries()){const l=se(r,t),u=l+r.offsetHeight;let h,a;u<=0?(h=u,a="bottom"):(h=l,a="top");let g,m;if(u>0&&l<e)for(const L of r.shadowRoot?.querySelectorAll("[data-line][data-line-index]")??[]){if(!(L instanceof HTMLElement))continue;const B=L.dataset.lineIndex;if(B==null)continue;const j=se(L,t);if(!(j<0)){g=B,m=j;break}}if(n?.lineOffset!=null&&m==null)continue;let S=!1;(n==null||m!=null&&(n.lineOffset==null||m<n.lineOffset)||m==null&&n.lineOffset==null&&(h>=0&&(n.fileOffset<0||h<n.fileOffset)||h<0&&n.fileOffset<0&&h>n.fileOffset))&&(S=!0),S&&(n={fileElement:r,fileTypeOffset:a,fileOffset:h,lineIndex:g,lineOffset:m})}return n}handleIntersectionChange=e=>{this.scrollDirty=!0;for(const{target:t,isIntersecting:n}of e){if(!(t instanceof HTMLElement))throw new Error("Virtualizer.handleIntersectionChange: target not an HTMLElement");const r=this.observers.get(t);r!=null&&(n&&!this.visibleInstances.has(t)?(r.setVisibility(!0),this.visibleInstances.set(t,r),this.visibleInstancesDirty=!0):!n&&this.visibleInstances.has(t)&&(r.setVisibility(!1),this.visibleInstances.delete(t),this.visibleInstancesDirty=!0))}this.visibleInstancesDirty&&I(this.computeRenderRangeAndEmit)};getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root==null?0:this.root instanceof Document?window.scrollY:this.root.scrollTop;return e=Math.max(0,Math.min(e,this.getScrollHeight()-this.getHeight())),this.scrollTop=e,e}getScrollHeight(){return this.scrollHeightDirty?(this.scrollHeightDirty=!1,this.scrollHeight=this.root==null?0:this.root instanceof Document?this.root.documentElement.scrollHeight:this.root.scrollHeight,this.scrollHeight):this.scrollHeight}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root==null?0:this.root instanceof Document?globalThis.innerHeight:this.root.getBoundingClientRect().height,this.height):this.height}markDOMDirty(){this.scrollDirty=!0,this.scrollHeightDirty=!0,this.heightDirty=!0}getScrollContainerElement(){return this.root==null||this.root instanceof Document?void 0:this.root}};function se(s,e){const t=s.getBoundingClientRect(),n=e?.getBoundingClientRect().top??0;return t.top-n}const pe=s=>{if(s.type==="new"){const e=Math.min(s.selection.start,s.selection.end),t=Math.max(s.selection.start,s.selection.end);return`new-comment-${s.selection.side??"additions"}-${e}-${t}`}return`draft-${s.draft.id}`},it=s=>{const{drafts:e,editingDraftId:t,selection:n}=s,r=[];for(const l of e){if(!Number.isFinite(l.endLine))continue;const u=Math.max(1,Math.floor(l.endLine)),h=l.side==="original"?"deletions":"additions";r.push({lineNumber:u,side:h,metadata:{type:l.id===t?"edit":"saved",draft:l}})}return n&&!t&&r.push({lineNumber:Math.max(n.start,n.end),side:n.side??"additions",metadata:{type:"new",selection:n}}),r};function rt(s){const e=s.trim();if(!e)return null;if(/^-?\d+(\.\d+)?$/.test(e)){const t=Number.parseFloat(e);return Number.isFinite(t)?t:null}if(e.endsWith("px")){const t=Number.parseFloat(e.slice(0,-2));return Number.isFinite(t)?t:null}return null}function ze(s){if(!(!s||s<=0))return Math.max(200,Math.floor(s))}function st(s){const{diffRootRef:e,drafts:t,selection:n,editingDraftId:r,commentText:l,onTextChange:u,fileLabel:h,onSave:a,onCancel:g,onEdit:m,onDelete:S}=s,[L,B]=F.useState(0),[j,X]=F.useState(null),b=F.useMemo(()=>!n||r?null:pe({type:"new",selection:n}),[r,n]),W=F.useMemo(()=>{const c=t.map(y=>pe({type:y.id===r?"edit":"saved",draft:y}));return b&&c.push(b),c},[t,r,b]),$=F.useCallback(c=>{const y=e.current;if(!y)return null;const w=y.querySelector("diffs-container");if(!(w instanceof HTMLElement))return null;const k=w.querySelector(`[data-annotation-id="${c}"]`);if(k instanceof HTMLElement)return k;const A=w.shadowRoot;return A?A.querySelector(`[data-annotation-id="${c}"]`):null},[e]);F.useEffect(()=>{if(W.length===0)return;let c=!1,y=0;const w=12,k=()=>{c||W.every(D=>!!$(D))||y>=w||(y+=1,requestAnimationFrame(()=>{c||(B(D=>D+1),k())}))};return k(),()=>{c=!0}},[W,$]),F.useEffect(()=>{const c=e.current;if(!c)return;const y=()=>{const k=getComputedStyle(c),A=rt(k.getPropertyValue("--oc-context-panel-width")),D=c.getBoundingClientRect(),N=A??D.width;X(N>0?N:null)};y();const w=new ResizeObserver(()=>{y()});return w.observe(c),window.addEventListener("resize",y),()=>{w.disconnect(),window.removeEventListener("resize",y)}},[e]);const G=F.useCallback(c=>{const w=e.current?.getBoundingClientRect(),k=c.closest("[data-annotation-content]"),A=k instanceof HTMLElement?k.getBoundingClientRect():c.getBoundingClientRect(),D=[A.width];w&&D.push(w.right-A.left);const N=D.filter(J=>Number.isFinite(J)&&J>0);return N.length>0?ze(Math.min(...N)):ze(j)},[e,j]);return O.jsxs(O.Fragment,{children:[t.map(c=>{const y=pe({type:c.id===r?"edit":"saved",draft:c}),w=$(y);if(!w)return null;const k=G(w);return c.id===r?we.createPortal(O.jsx(Ce,{initialText:l,onTextChange:u,fileLabel:h,lineRange:{start:c.startLine,end:c.endLine,side:c.side==="original"?"deletions":"additions"},isEditing:!0,onSave:a,onCancel:g,maxWidth:k}),w,`draft-edit-${c.id}`):we.createPortal(O.jsx(Qe,{draft:c,onEdit:()=>m(c),onDelete:()=>S(c),maxWidth:k}),w,`draft-card-${c.id}`)}),n&&!r&&b&&(()=>{const c=$(b);if(!c)return null;const y=G(c);return we.createPortal(O.jsx(Ce,{initialText:l,onTextChange:u,fileLabel:h,lineRange:n,isEditing:!1,onSave:a,onCancel:g,maxWidth:y}),c,b)})()]})}const Ie=5e5,ot=`
2
- :host {
3
- font-family: var(--font-mono);
4
- font-size: var(--text-code);
5
- }
6
-
7
- pre, [data-code] {
8
- font-family: var(--font-mono);
9
- font-size: var(--text-code);
10
- }
11
-
12
- /* Mobile touch selection support */
13
- [data-line-number] {
14
- touch-action: manipulation;
15
- -webkit-tap-highlight-color: transparent;
16
- cursor: pointer;
17
- }
18
-
19
- /* Ensure interactive line numbers work on touch */
20
- pre[data-interactive-line-numbers] [data-line-number] {
21
- touch-action: manipulation;
22
- }
23
- `,lt=`
24
- ${ot}
25
-
26
- :host {
27
- --diffs-bg-separator-override: var(--surface-elevated);
28
- }
29
-
30
- [data-diff-header],
31
- [data-diff] {
32
- [data-separator] {
33
- height: 24px !important;
34
- }
35
- }
36
-
37
- [data-separator="line-info-basic"] {
38
- height: 24px !important;
39
- background: var(--diffs-bg) !important;
40
- position: relative;
41
- }
42
-
43
- [data-diff-type="single"] [data-gutter],
44
- [data-diff-type="split"] [data-deletions] [data-gutter] {
45
- [data-separator-wrapper] {
46
- position: absolute;
47
- left: 100%;
48
- display: flex;
49
- align-items: center;
50
- gap: unset;
51
- width: max-content;
52
- background: transparent;
53
- color: var(--diffs-fg-number);
54
- font-family: var(--diffs-header-font-family, var(--font-sans));
55
- font-size: 0.75rem;
56
- line-height: 1;
57
- margin-left: calc(-2ch - 2px);
58
- }
59
-
60
- [data-separator-wrapper][data-separator-multi-button] {
61
- margin-left: calc(-3ch - 2px);
62
- }
63
-
64
- [data-expand-button],
65
- [data-separator-content] {
66
- display: block;
67
- align-self: unset;
68
- min-width: unset;
69
- min-height: unset;
70
- padding: 0;
71
- flex-shrink: 0;
72
- grid-column: unset;
73
- border: none;
74
- width: auto;
75
- height: auto;
76
- background-color: transparent;
77
- color: inherit;
78
- font: inherit;
79
- }
80
-
81
- [data-expand-button]:not([data-expand-all-button]) {
82
- &[data-expand-down]::before {
83
- content: '\\2191';
84
- }
85
-
86
- &[data-expand-up]::before {
87
- content: '\\2193';
88
- }
89
-
90
- &[data-expand-both]::before {
91
- content: '\\2195';
92
- }
93
-
94
- svg {
95
- display: none;
96
- }
97
- }
98
-
99
- [data-separator-content] {
100
- background: transparent;
101
- margin-left: calc(2px + 1ch);
102
- }
103
-
104
- [data-expand-all-button] {
105
- position: relative;
106
- margin-left: 14px;
107
- text-transform: lowercase;
108
- }
109
-
110
- [data-expand-all-button]::before {
111
- content: '';
112
- display: block;
113
- position: absolute;
114
- top: 50%;
115
- left: -8px;
116
- margin-top: -1px;
117
- width: 3px;
118
- height: 3px;
119
- border-radius: 2px;
120
- background-color: var(--diffs-fg-number);
121
- pointer-events: none;
122
- }
123
-
124
- [data-separator-content]:hover,
125
- [data-expand-button]:hover,
126
- [data-expand-all-button]:hover {
127
- color: var(--diffs-fg);
128
- }
129
-
130
- [data-expand-all-button]:hover {
131
- text-decoration: underline;
132
- }
133
- }
134
- `;function at(s){let e=2166136261;for(let t=0;t<s.length;t+=1)e^=s.charCodeAt(t),e=e+((e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24))>>>0;return e.toString(16)}function Ae(s){const e=s.length>400?`${s.slice(0,200)}${s.slice(-200)}`:s;return`${s.length}:${at(e)}`}const ct=(s,e,t,n)=>{const r=n.side==="deletions",u=(t?(r?t.deletionLines:t.additionLines).join(""):r?s:e).split(`
135
- `),h=Math.min(n.start,n.end),a=Math.max(n.start,n.end),g=Math.max(1,h),m=Math.min(u.length,a);return g>m?"":u.slice(g-1,m).join(`
136
- `)},dt=(s,e)=>s===e?!0:!s||!e?!1:s.start===e.start&&s.end===e.end&&s.side===e.side,ut=s=>s==="auto"||s==="scroll"||s==="overlay",ft=s=>{let e=s?.parentElement??null;for(;e;){const t=window.getComputedStyle(e);if(ut(t.overflowY))return e;e=e.parentElement}return null},ht=(s,e)=>{if(!s||!e||typeof window>"u")return()=>{};const t=ft(s);if(!t)return()=>{};const n=e.getBoundingClientRect().height;if(!n)return()=>{};const r=s.getBoundingClientRect().top-t.getBoundingClientRect().top,l=e.style.minHeight;e.style.minHeight=`${Math.ceil(n)}px`;let u=!1;return()=>{if(u)return;u=!0,e.style.minHeight=l;const a=s.getBoundingClientRect().top-t.getBoundingClientRect().top-r;a&&(t.scrollTop+=a)}},pt=(s,e)=>{if(typeof window>"u")return()=>{};let t=null,n=null,r=!1;const l=()=>{r||(n?.disconnect(),n=null,t=window.requestAnimationFrame(()=>{t=window.requestAnimationFrame(()=>{r||e()})}))},u=()=>s.querySelector("diffs-container")?.shadowRoot??void 0,h=(a=u())=>!!a?.querySelector("[data-line]");return h()?l():typeof MutationObserver<"u"?(n=new MutationObserver(()=>{const a=u();if(a){if(h(a)){l();return}n?.disconnect(),n=new MutationObserver(()=>{h(a)&&l()}),n.observe(a,{childList:!0,subtree:!0})}}),n.observe(s,{childList:!0,subtree:!0})):t=window.requestAnimationFrame(l),()=>{r=!0,n?.disconnect(),t!==null&&window.cancelAnimationFrame(t)}},fe=new WeakMap,mt={lineHeight:24,hunkSeparatorHeight:24,spacing:0};function gt(s){const e=s.closest("[data-diff-virtual-root]");if(e instanceof HTMLElement){const t=e.querySelector("[data-diff-virtual-content]");return{key:e,root:e,content:t instanceof HTMLElement?t:void 0}}return{key:document,root:document,content:void 0}}function vt(s){if(typeof document>"u")return null;const e=gt(s);let t=fe.get(e.key);if(!t){const r=new nt;r.setup(e.root,e.content),t={virtualizer:r,refs:0},fe.set(e.key,t)}t.refs+=1;let n=!1;return{virtualizer:t.virtualizer,root:e.root,release:()=>{if(n)return;n=!0;const r=fe.get(e.key);r&&(r.refs-=1,!(r.refs>0)&&(r.virtualizer.cleanUp(),fe.delete(e.key)))}}}const yt=(s,e,t)=>{if(typeof window>"u")return()=>{};const n=[],r=()=>{try{s.rerender()}catch{}const l=e?.root;l instanceof HTMLElement?l.dispatchEvent(new Event("scroll",{bubbles:!1})):document.dispatchEvent(new Event("scroll",{bubbles:!1})),window.dispatchEvent(new Event("resize")),t()};return n.push(window.requestAnimationFrame(r)),n.push(window.requestAnimationFrame(()=>{n.push(window.requestAnimationFrame(r))})),()=>{for(const l of n)window.cancelAnimationFrame(l)}},Ot=({original:s,modified:e,fileDiff:t,language:n,fileName:r,renderSideBySide:l,wrapLines:u,layout:h="fill",enableComments:a=!0})=>{const g=je(),m=g?.currentTheme.metadata.variant==="dark",S=g?.availableThemes.find(i=>i.metadata.id===g.lightThemeId)??Le(!1),L=g?.availableThemes.find(i=>i.metadata.id===g.darkThemeId)??Le(!0),{isMobile:B}=Ue(),j=Ke({source:"diff",fileLabel:r||"unknown",language:n,getCodeForRange:i=>ct(s,e,t,i),toStoreRange:i=>({startLine:i.start,endLine:i.end,side:i.side==="deletions"?"original":"modified"}),fromDraftRange:i=>({start:i.startLine,end:i.endLine,side:i.side==="original"?"deletions":"additions"})}),{drafts:X,selection:b,setSelection:W,commentText:$,setCommentText:G,editingDraftId:c,saveComment:y,cancel:w,startEdit:k,deleteDraft:A}=j,D=d.useRef(null),N=d.useRef(null),J=d.useRef(""),ee=d.useRef(!1),oe=d.useRef(null);d.useEffect(()=>{D.current=b},[b]),d.useEffect(()=>{N.current=c},[c]),d.useEffect(()=>{J.current=$},[$]);const le=d.useCallback(i=>{if(!a||ee.current)return;const o=D.current;if(!(!i&&o&&J.current.trim())){if(B&&o&&i&&i.side===o.side){const f=Math.min(o.start,i.start),p=Math.max(o.end,i.end);W({...i,start:f,end:p})}else W(i);i&&(N.current||G(""))}},[a,B,G,W]),Fe=d.useCallback(()=>{w()},[w]),Se=d.useCallback(i=>{const o=document.createElement("div");o.style.position="relative";const f=pe(i.metadata);return o.dataset.annotationId=f,o.dataset.annotationSide=i.side,o.dataset.annotationLine=String(i.lineNumber),o},[]),We=d.useCallback((i,o)=>{y(i,o??b??void 0)},[y,b]),_e=d.useCallback(i=>{W(i);const o=P.current;if(o)try{ee.current=!0,o.setSelectedLines(i),oe.current=i}catch{}finally{ee.current=!1}},[W]),Ee=d.useCallback(i=>{const o=i.closest("[data-line-type]")?.getAttribute("data-line-type")??i.getAttribute("data-line-type");if(o==="change-deletion")return"deletions";if(o==="change-addition")return"additions";const f=i.getAttribute("data-column-side")??i.getAttribute("data-side")??i.closest("[data-column-side]")?.getAttribute("data-column-side");if(f==="deletions"||f==="left"||f==="original")return"deletions";if(f==="additions"||f==="right"||f==="modified")return"additions";const p=i.closest("[data-line-type]");if(p instanceof HTMLElement){const E=p.getBoundingClientRect(),v=i.getBoundingClientRect(),R=E.left+E.width/2;return v.left+v.width/2<R?"deletions":"additions"}return"additions"},[]);Me(S),Me(L);const Q=`${S.metadata.id}:${L.metadata.id}:${m?"dark":"light"}`,te=d.useMemo(()=>{if(t){const i=t.deletionLines.reduce((f,p)=>f+p.length,0),o=t.additionLines.reduce((f,p)=>f+p.length,0);return Math.max(i,o)>Ie}return Math.max(s.length,e.length)>Ie},[t,e.length,s.length]),ne=d.useRef(null),K=d.useRef(null),P=d.useRef(null),ie=d.useRef(null),me=d.useRef(null),ge=d.useRef(null),ve=d.useRef(void 0),ae=d.useRef(void 0),ce=d.useRef(void 0),de=d.useRef(void 0),[,ye]=F.useReducer(i=>i+1,0),Y=Ye(te?"unified":l?"split":"unified"),_=d.useMemo(()=>Oe(S),[S]),q=d.useMemo(()=>Oe(L),[L]);F.useLayoutEffect(()=>{const i=ne.current;if(!i)return;const o=i.querySelector("diffs-container");if(!o)return;const f=m?q:_,p=(qe,Ve)=>qe.colors?.[Ve],E=p(_,"terminal.ansiGreen"),v=p(_,"terminal.ansiRed"),R=p(_,"terminal.ansiBlue"),C=p(q,"terminal.ansiGreen"),M=p(q,"terminal.ansiRed"),z=p(q,"terminal.ansiBlue");o.style.setProperty("--shiki-light",_.fg),o.style.setProperty("--shiki-light-bg",_.bg),E&&o.style.setProperty("--shiki-light-addition-color",E),v&&o.style.setProperty("--shiki-light-deletion-color",v),R&&o.style.setProperty("--shiki-light-modified-color",R),o.style.setProperty("--shiki-dark",q.fg),o.style.setProperty("--shiki-dark-bg",q.bg),C&&o.style.setProperty("--shiki-dark-addition-color",C),M&&o.style.setProperty("--shiki-dark-deletion-color",M),z&&o.style.setProperty("--shiki-dark-modified-color",z),o.style.setProperty("--diffs-bg",f.bg),o.style.setProperty("--diffs-fg",f.fg);const x=m?C:E,V=m?M:v,Z=m?z:R;x&&o.style.setProperty("--diffs-addition-color-override",x),V&&o.style.setProperty("--diffs-deletion-color-override",V),Z&&o.style.setProperty("--diffs-modified-color-override",Z);const T=o.shadowRoot?.querySelector("pre");T&&(T.style.setProperty("--shiki-light",_.fg),T.style.setProperty("--shiki-light-bg",_.bg),E&&T.style.setProperty("--shiki-light-addition-color",E),v&&T.style.setProperty("--shiki-light-deletion-color",v),R&&T.style.setProperty("--shiki-light-modified-color",R),T.style.setProperty("--shiki-dark",q.fg),T.style.setProperty("--shiki-dark-bg",q.bg),C&&T.style.setProperty("--shiki-dark-addition-color",C),M&&T.style.setProperty("--shiki-dark-deletion-color",M),z&&T.style.setProperty("--shiki-dark-modified-color",z),T.style.setProperty("--diffs-bg",f.bg),T.style.setProperty("--diffs-fg",f.fg),x&&T.style.setProperty("--diffs-addition-color-override",x),V&&T.style.setProperty("--diffs-deletion-color-override",V),Z&&T.style.setProperty("--diffs-modified-color-override",Z))},[q,Q,m,_]);const U=d.useMemo(()=>({theme:{dark:L.metadata.id,light:S.metadata.id},themeType:m?"dark":"light",diffStyle:l?"split":"unified",diffIndicators:"none",hunkSeparators:"line-info-basic",lineDiffType:"none",maxLineDiffLength:te?0:1e3,maxLineLengthForHighlighting:te?1:1e3,tokenizeMaxLineLength:te?1:1e3,collapsedContextThreshold:0,expansionLineCount:20,overflow:u?"wrap":"scroll",disableFileHeader:!0,enableLineSelection:a,enableHoverUtility:!1,onLineSelected:a?le:void 0,unsafeCSS:lt,renderAnnotation:a?Se:void 0}),[L.metadata.id,a,m,te,S.metadata.id,l,u,le,Se]),re=d.useMemo(()=>a?it({drafts:X,editingDraftId:c,selection:b}):[],[c,a,X,b]),be=d.useRef(re);if(d.useEffect(()=>{be.current=re},[re]),d.useEffect(()=>{const i=K.current;return()=>{P.current?.cleanUp(),P.current=null,ie.current?.release(),ie.current=null,me.current=null,ge.current=null,ve.current=void 0,ae.current=void 0,ce.current=void 0,de.current=void 0,i&&(i.innerHTML="")}},[]),d.useEffect(()=>{if(typeof window>"u")return;const i=K.current,o=ne.current;if(!i||!Y)return;const f=ht(o,i);let p=ie.current;p||(p=vt(i),ie.current=p),ie.current=p;const E=p?.virtualizer??null,v=t?void 0:{name:r||"",contents:s,lang:n,cacheKey:`old:${Q}:${r}:${Ae(s)}`},R=t?void 0:{name:r||"",contents:e,lang:n,cacheKey:`new:${Q}:${r}:${Ae(e)}`},C=t?ae.current!==t:ae.current!==void 0||!v||!R||!ce.current||!de.current||!Te(ce.current,v)||!Te(de.current,R),M=P.current,z=!!(M&&(me.current!==E||ge.current!==Y||E&&(ve.current!==U.hunkSeparators||C)));z&&(M?.cleanUp(),P.current=null,i.innerHTML="");let x=P.current;const V=!z&&M?!$e(M.options,U):!1;if(x?x.setOptions(U):(x=p?new Ne(U,p.virtualizer,mt,Y):new Be(U,Y),P.current=x,oe.current=null),me.current=E,ge.current=Y,ve.current=E?U.hunkSeparators:void 0,ae.current=t,ce.current=v,de.current=R,t)x.render({fileDiff:t,forceRender:V,lineAnnotations:be.current,containerWrapper:i});else{if(!v||!R)return;x.render({oldFile:v,newFile:R,forceRender:V,lineAnnotations:be.current,containerWrapper:i})}const Z=pt(i,()=>{f(),yt(x,p,ye)});return()=>{Z(),f()}},[Q,t,r,n,e,U,s,Y]),d.useEffect(()=>{const i=P.current;if(i){try{i.setLineAnnotations(re)}catch(o){console.error("Failed to apply diff line annotations",o);try{i.setLineAnnotations([])}catch{}}requestAnimationFrame(()=>{if(P.current===i){try{i.rerender()}catch{}ye()}})}},[re]),d.useEffect(()=>{const i=P.current;if(!i||b!==null)return;const o=oe.current;if(!dt(b,o))try{ee.current=!0,i.setSelectedLines(b),oe.current=b}catch{}finally{ee.current=!1}},[b]),d.useEffect(()=>{if(!a)return;const i=K.current;if(!i)return;let o=null,f=()=>{};const p=()=>{const v=i.querySelector("diffs-container")?.shadowRoot;if(!v){o=requestAnimationFrame(p);return}const R=C=>{if(!(C instanceof MouseEvent)||C.button!==0||!(C.target instanceof Element))return;const M=C.target.closest("[data-column-number]");if(!(M instanceof HTMLElement))return;const z=M.getAttribute("data-column-number"),x=z?parseInt(z,10):NaN;if(Number.isNaN(x))return;const V=Ee(M);le({start:x,end:x,side:V}),C.preventDefault(),C.stopPropagation()};v.addEventListener("click",R,!0),f=()=>{v.removeEventListener("click",R,!0)}};return p(),()=>{o!==null&&cancelAnimationFrame(o),f()}},[Q,a,r,le,Ee]),d.useEffect(()=>{const i=K.current;if(!i)return;let o=null,f=null;const E=setTimeout(()=>{const v=i.querySelector("diffs-container");if(!(v instanceof HTMLElement))return;const R=v.shadowRoot;o=new MutationObserver(()=>{f&&cancelAnimationFrame(f),f=requestAnimationFrame(()=>{ye(),f=null})}),o.observe(v,{childList:!0,subtree:!0}),R&&o.observe(R,{childList:!0,subtree:!0})},100);return()=>{clearTimeout(E),f&&cancelAnimationFrame(f),o?.disconnect()}},[Q,r]),typeof window>"u")return null;const xe=a?O.jsx(st,{diffRootRef:ne,drafts:X,selection:b,editingDraftId:c,commentText:$,onTextChange:G,fileLabel:r?.split("/").pop()??"",onSave:We,onCancel:Fe,onEdit:i=>{_e({start:i.startLine,end:i.endLine,side:i.side==="original"?"deletions":"additions"}),k(i)},onDelete:A}):null;return h==="fill"?O.jsx("div",{className:ke("flex flex-col relative","size-full"),"data-diff-virtual-root":!0,children:O.jsxs("div",{className:"flex-1 relative min-h-0",children:[O.jsx(Ge,{outerClassName:"pierre-diff-wrapper size-full",disableHorizontal:!1,fillContainer:!0,"data-diff-virtual-content":!0,children:O.jsx("div",{ref:ne,className:"size-full relative",children:O.jsx("div",{ref:K,className:"size-full"})})}),xe]})}):O.jsxs("div",{className:ke("relative","w-full"),children:[O.jsx("div",{ref:ne,className:"pierre-diff-wrapper w-full overflow-x-auto overflow-y-visible relative",children:O.jsx("div",{ref:K,className:"w-full"})}),xe]})};export{Ot as P};
@@ -1,4 +0,0 @@
1
- import{R as s,j as r}from"./vendor-react-BUCujlKS.js";import{m as it,u as re,r as We,o as ot}from"./index-Cwmuwk3V.js";import{c as at,s as lt,P as ct,C as ut}from"./shikiHighlight-DCT2Sq_z.js";import{f as mt,y as _,c2 as dt,ak as pt,b as Ae,a4 as ft,a0 as ht,V as wt,aW as gt,L as vt,eU as St,gG as xt,l as $e,eW as yt,aa as ze,fZ as bt,cU as _e,eY as jt,eZ as Ct,m as Mt,gH as Tt,aV as Oe,aY as ne,aZ as se,aS as Be,B as J,I,a_ as ie,aU as Ge,aR as Y,g as kt,bW as Nt,ac as Et,bS as Pt,gI as Vt}from"./useAppFontEffects-B53Rb6m7.js";import{u as Dt,n as Rt}from"./useInlineCommentController-DSfrIBKT.js";import{b as Ft}from"./CodeMirrorCommentWidgets-C36E738Y.js";import{getResolvedShikiTheme as It}from"./appThemeRegistry-BK0dHKa6.js";import{E as Lt}from"./vendor-codemirror-view-CiLROUVV.js";import{R as Wt}from"./runtimeEndpointReset-ovNbaZ-x.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-zod-C9ioTTSo.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-opencode-sdk-BJ73u-bH.js";import"./vendor-zustand-BAGL70zf.js";import"./vendor-codemirror-state-C9awkmn-.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-commands-B7H_j0iU.js";import"./vendor-codemirror-language-BgPj_McA.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CDMHUZ74.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-codemirror-search-BmS-GmcX.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-replit-codemirror-vim-B2DJlAhT.js";import"./vendor-replit-codemirror-vim-core-FHzKdNUS.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-base-ui-DsHmyMwp.js";import"./vendor-floating-ui-utils-BzXdqYpP.js";import"./vendor-floating-ui-react-dom-DKpLs02S.js";import"./vendor-floating-ui-dom-WyXykhNi.js";import"./vendor-floating-ui-core-CXmKXOXc.js";import"./vendor-use-sync-external-store-D6wYuSt-.js";import"./contextPanelEmbeddedChat-BEARQjgn.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-dnd-kit-core-BZknOX2w.js";import"./vendor-dnd-kit-utilities-B_MdXhJC.js";import"./vendor-dnd-kit-accessibility-BHxJPORy.js";import"./vendor-dnd-kit-sortable-CsEagZ81.js";import"./vendor-framer-motion-CRSgBxjL.js";import"./vendor-motion-dom-DJLgZh4Q.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-tanstack-react-virtual-g05Cx3z9.js";import"./vendor-tanstack-virtual-core-Dubg10g5.js";import"./vendor-sonner-DFyL3AvE.js";import"./vendor-cmdk-DgLInKvT.js";import"./vendor-radix-ui-react-dialog-B94Bt2qq.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-DcAh5WdT.js";import"./vendor-radix-ui-react-context-Czxm7Z62.js";import"./vendor-radix-ui-react-id-f5BLKEVw.js";import"./vendor-radix-ui-react-use-layout-effect-D_3IhJdJ.js";import"./vendor-radix-ui-react-use-controllable-state-BFT5YmkA.js";import"./vendor-radix-ui-react-dismissable-layer-D7kXcwgJ.js";import"./vendor-radix-ui-react-primitive-DhVoX9SD.js";import"./vendor-radix-ui-react-slot-BQgQOasS.js";import"./vendor-radix-ui-react-use-callback-ref-BZPnuXAC.js";import"./vendor-radix-ui-react-use-escape-keydown-oph88g-F.js";import"./vendor-radix-ui-react-focus-scope-CiaxW4dD.js";import"./vendor-radix-ui-react-portal-BMJYHWck.js";import"./vendor-radix-ui-react-presence-CNxf-uq4.js";import"./vendor-radix-ui-react-focus-guards-B6qJXYua.js";import"./vendor-react-remove-scroll-DO7dCTnK.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-BcFYyj3E.js";import"./vendor-react-style-singleton-q6EMHnwf.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-zDC0RhA3.js";import"./vendor-use-callback-ref-D3RC8gqK.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-codemirror-lang-javascript-Cc2ZYbgX.js";import"./vendor-lezer-javascript-D7Tj24ot.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-DzPz9Wgq.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-codemirror-lang-json-CMBS2tG9.js";import"./vendor-lezer-json-Iaex0UN-.js";import"./vendor-codemirror-lang-css-O0cZX78y.js";import"./vendor-lezer-css-C5xB6jxd.js";import"./vendor-codemirror-lang-html-CfgK872x.js";import"./vendor-lezer-html-C0I1p52t.js";import"./vendor-codemirror-lang-markdown-BPGOH9ye.js";import"./vendor-lezer-markdown-C6g-d6P3.js";import"./vendor-codemirror-language-data-vch3tJ4c.js";import"./vendor-codemirror-lang-python-HahnQaAS.js";import"./vendor-lezer-python-CvuFxeZl.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";import"./registerCustomTheme-BBXUCRnG.js";import"./themeResolver-BmJyTmjJ.js";import"./vendor-pierre-theming-C6Z4M5_u.js";import"./vendor-shikijs-core-CGM_jqPK.js";import"./vendor-shikijs-types-CPSbSeK6.js";import"./vendor-shikijs-vscode-textmate-BgLrS_2D.js";import"./vendor-hast-util-to-html-BKBhbTDb.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-property-information-rJCbAzvX.js";import"./vendor-zwitch-C2o2j-tx.js";import"./vendor-stringify-entities-CsH1VEn9.js";import"./vendor-character-entities-legacy-BpoLgcEt.js";import"./vendor-character-entities-html4-D7taRCQ7.js";import"./vendor-ccount-c2V3InAJ.js";import"./vendor-comma-separated-tokens-D8TqSuIK.js";import"./vendor-space-separated-tokens-DD3iYX1K.js";import"./vendor-hast-util-whitespace-D4Wp6AEg.js";const y=m=>{if(!m)return"";const l=m.replace(/\\/g,"/");return l==="/"?"/":l.replace(/\/+$/,"")},oe=(m,l)=>{const a=y(m),t=l.replace(/\\/g,"/").replace(/^\/+/,"").replace(/\/+$/,"");return!a||a==="/"?`/${t}`:`${a}/${t}`},At=(m,l,a)=>oe(oe(oe(m,".opencode"),"plans"),`${l}-${a}.md`),$t=(m,l)=>`~/.opencode/plans/${m}-${l}.md`,zt=(m,l)=>{const a=m.trim();return a.startsWith("~")?a==="~"?l||a:(a.startsWith("~/")||a.startsWith("~\\"))&&l?`${l}${a.slice(1)}`:a:a},_t=(m,l)=>{const a=y(l.currentDirectory),t=y(l.homeDirectory),w=y(m);return a&&w.startsWith(a+"/")?w.slice(a.length+1):t&&w===t?"~":t&&w.startsWith(t+"/")?`~${w.slice(t.length)}`:w},Ot=(m,l,a)=>{const t=y(m.trim());if(!t)return null;const w=a?l.find(g=>g.id===a)??null:null;if(w?.path){const g=y(w.path);if(t===g||t.startsWith(`${g}/`))return{id:w.id,path:w.path}}const P=l.filter(g=>{const k=y(g.path);return t===k||t.startsWith(`${k}/`)}).sort((g,k)=>y(k.path).length-y(g.path).length)[0];return P?{id:P.id,path:P.path}:null},_n=({targetPath:m=null,projectPlanId:l=null,onNavigatedToChat:a})=>{const{t}=mt(),w=_(e=>e.currentSessionId),P=_(e=>e.createSession),g=_(e=>e.initializeNewOpenChamberSession),k=_(e=>e.sendMessage),ae=_(e=>e.setCurrentSession),le=dt(),L=it(e=>e.homeDirectory),ce=pt(e=>e.planModeEnabled),ue=Ae(e=>e.projects),me=Ae(e=>e.activeProjectId),de=ft(e=>e.directories),pe=ht()??"",fe=re(e=>e.setActiveMainTab),he=re(e=>e.setSessionSwitcherOpen),V=wt(),{isMobile:we}=gt(),{currentTheme:O}=vt(),v=s.useMemo(()=>w?le.find(e=>e.id===w)??null:null,[w,le]),j=s.useMemo(()=>{const e=typeof v?.directory=="string"?v.directory:"";return y(e||"")},[v?.directory]),ge=s.useMemo(()=>y(pe||j),[pe,j]),h=s.useMemo(()=>Ot(ge,ue,me),[me,ge,ue]),B=s.useMemo(()=>h?de.get(h.path)?.isGitRepo===!0:!1,[h,de]),[N,D]=s.useState(null),[ve,Se]=s.useState(!1),[d,C]=s.useState(null),[W,Z]=s.useState(null),xe=St(e=>e.savePlan),Ue=!!d||!!W,q=s.useMemo(()=>!d||!j||!L?d:_t(d,{currentDirectory:j,homeDirectory:L}),[d,j,L]),[f,b]=s.useState(""),{isPlaying:G,play:He,stop:Ke}=xt(),Je=$e(e=>e.showMessageTTSButtons),[ye,A]=s.useState(null),Q=s.useMemo(()=>q&&q.split("/").pop()||t("planView.file.defaultName"),[q,t]),X=s.useMemo(()=>f.trim()?yt(f,t("planView.title.default")).title:t("planView.title.default"),[f,t]),U=s.useMemo(()=>X.trim()||t("planView.title.default"),[X,t]),[Ye,E]=s.useState(!1),[Ze,be]=s.useState(!1),[H,je]=s.useState("edit"),$=s.useRef(null),[o,S]=s.useState(null),Ce=s.useRef(null),qe=s.useRef(null),Me="openchamber:plan:md-viewer-mode";s.useEffect(()=>{try{const e=localStorage.getItem(Me);if(!e)return;const i=JSON.parse(e);(i==="preview"||i==="edit")&&je(i)}catch{}},[]);const Qe=s.useCallback(e=>{je(e);try{localStorage.setItem(Me,JSON.stringify(e))}catch{}},[]),R=s.useRef(!1),M=s.useRef(null),[Te,F]=s.useState(!1);s.useEffect(()=>{const e=()=>{R.current=!1,M.current=null,F(!1)};return document.addEventListener("mouseup",e),()=>document.removeEventListener("mouseup",e)},[]);const Xe=s.useCallback((e,i)=>{const u=e.split(`
2
- `),n=Math.max(1,i.start),c=Math.min(u.length,i.end);return n>c?"":u.slice(n-1,c).join(`
3
- `)},[]),et=Dt({source:"plan",fileLabel:Q,language:d&&ze(d)||"markdown",getCodeForRange:e=>Xe(f,Rt(e)),toStoreRange:e=>({startLine:e.start,endLine:e.end}),fromDraftRange:e=>({start:e.startLine,end:e.endLine})}),{drafts:ke,commentText:K,setCommentText:Ne,editingDraftId:ee,setSelection:Ee,saveComment:Pe,cancel:z,reset:Ve,startEdit:De,deleteDraft:Re}=et;s.useEffect(()=>{S(null),Ve()},[f,Ve]),s.useEffect(()=>{Ee(o)},[o,Ee]);const Fe=s.useCallback(()=>{S(null),z()},[z]),Ie=s.useCallback((e,i)=>{i&&S(i),Pe(e,i??o??void 0),S(null)},[o,Pe]);s.useEffect(()=>{if(!o)return;const e=u=>{const n=u.target;n.closest('[data-comment-card="true"]')||n.closest('[data-comment-input="true"]')||n.closest(".oc-block-widget")||n.closest(".cm-gutterElement")||n.closest("[data-sonner-toast]")||n.closest("[data-sonner-toaster]")||K.trim()||(S(null),z())},i=window.setTimeout(()=>{document.addEventListener("click",e)},100);return()=>{window.clearTimeout(i),document.removeEventListener("click",e)}},[z,K,ee,we,o]);const te=re(e=>e.editorFontSize),tt=s.useMemo(()=>{const e=d?ze(d):null,i=!!e&&e!=="markdown",u=[at(O,i?{syntaxColors:!1,fontSize:te}:{fontSize:te})],n=bt(d||"plan.md");return n&&u.push(n),i&&e&&u.push(lt({language:e,themeName:O.metadata.id,theme:It(O)})),u.push(Lt.lineWrapping),u},[O,d,te]);s.useEffect(()=>{if(!ce&&!m&&!l){C(null),Z(null),b(""),E(!1);return}let e=!1;const i=async n=>{if(V.files?.readFile)return(await V.files.readFile(n))?.content??"";const c=ot()?.files;if(c?.readFile)return(await c.readFile(n,{optional:!0}))?.content??"";const p=await We(`/api/fs/read?path=${encodeURIComponent(n)}&optional=true`,{cache:"no-store"});if(!p.ok)throw new Error(`Failed to read plan file (${p.status})`);return p.text()};return(async()=>{if(C(null),Z(null),b(""),A(null),l){if(!h)return;E(!0);try{const n=await Vt(h,l);if(e)return;if(!n){A(t("planView.error.loadFailed"));return}b(n.raw),Z(l)}catch(n){if(e)return;A(n instanceof Error?n.message:t("planView.error.loadFailed"))}finally{e||E(!1)}return}if(m){E(!0);try{const n=await i(m);if(e)return;C(m),b(n)}catch{if(e)return;C(null),b("")}finally{e||E(!1)}return}if(!v?.slug||!v?.time?.created||!j){C(null),b("");return}E(!0);try{const n=At(j,v.time.created,v.slug),c=zt($t(v.time.created,v.slug),L||null);let p=null,x=null;try{x=await i(n),p=n}catch{}if(!p)try{x=await i(c),p=c}catch{}if(e)return;if(!p||x===null){C(null),b("");return}C(p),b(x)}catch{if(e)return;C(null),b("")}finally{e||E(!1)}})(),()=>{e=!0}},[h,L,ce,l,V.files,j,v?.slug,v?.time?.created,t,m]),s.useEffect(()=>{if(!d&&!W)return;const e=window.setTimeout(async()=>{A(null);try{if(W){if(!h)throw new Error(t("planView.error.writeFailed"));if(!await xe(h,W,f))throw new Error(t("planView.error.writeFailed"));return}if(!d)return;if(V.files?.writeFile){if(!(await V.files.writeFile(d,f))?.success)throw new Error(t("planView.error.writeFailed"))}else{const i=await We("/api/fs/write",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:d,content:f})});if(!i.ok)throw new Error(t("planView.error.writePlanFileFailed",{status:i.status}))}}catch(i){A(i instanceof Error?i.message:t("planView.error.saveFailed"))}},350);return()=>{window.clearTimeout(e)}},[f,h,W,d,V.files,xe,t]),s.useEffect(()=>()=>{$.current!==null&&window.clearTimeout($.current)},[]);const Le=s.useCallback(()=>{fe("chat"),he(!1),a?.()},[a,fe,he]),rt=s.useCallback(async e=>{if(!h||!N)return;const i=await _e(N.action==="improve"?"plan.improve.visible":"plan.implement.visible",{plan_title:U}),n=[{synthetic:!0,text:await _e(N.action==="improve"?"plan.improve.instructions":"plan.implement.instructions",{plan_title:U,plan_path:d??""})}];Se(!0);try{Le();let c=null,p=h.path;if(N.target==="worktree"){if(!B)return;const T=await jt(h.path,Ct());if(!T?.id)return;c=T.id,p=T.path}else{const T=await P(void 0,h.path,null);if(!T?.id)return;c=T.id,p=T.directory??h.path,g(T.id,$e.getState().agents??[])}if(!c)return;const x=Mt.getState();x.saveSessionModelSelection(c,e.providerID,e.modelID),e.agent.trim()&&(x.saveSessionAgentSelection(c,e.agent),x.saveAgentModelForSession(c,e.agent,e.providerID,e.modelID),x.saveAgentModelVariantForSession(c,e.agent,e.providerID,e.modelID,e.variant||void 0)),ae(c,p);const st=e.runAsGoal===!0?[`Implement the plan "${U}" end-to-end${d?` (plan file: ${d})`:""}.`,"Re-read that file for full details — it is the source of truth.","",f].join(`
4
- `):null;Tt.getState().setArmed(e.runAsGoal===!0,st),await k(i,e.providerID,e.modelID,e.agent.trim()||void 0,void 0,void 0,n,e.variant||void 0),D(null)}finally{Se(!1)}},[B,f,P,h,g,N,d,Le,k,U,ae]),nt=s.useMemo(()=>Ft({drafts:ke,editingDraftId:ee,commentText:K,onTextChange:Ne,selection:o,isDragging:Te,fileLabel:Q,newWidgetId:"plan-new-comment-input",mapDraftToRange:e=>({start:e.startLine,end:e.endLine}),onSave:Ie,onCancel:Fe,onEdit:e=>{De(e),S({start:e.startLine,end:e.endLine})},onDelete:Re}),[K,Re,ee,Fe,Ie,Te,o,ke,Q,Ne,De]);return r.jsxs("div",{className:"relative flex h-full min-h-0 min-w-0 w-full flex-col overflow-hidden bg-background",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2 border-b border-border/40 px-3 py-1.5 flex-shrink-0",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"typography-ui-label font-medium truncate",children:X}),ye?r.jsx("div",{className:"typography-micro text-[color:var(--status-error)] truncate",title:ye,children:t("planView.error.saveFailed")}):null]}),Ue?r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsxs(Oe,{children:[r.jsxs(ne,{children:[r.jsx(se,{asChild:!0,children:r.jsx(Be,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0","aria-label":t("planView.actions.improvePlanAria"),disabled:!f.trim(),children:r.jsx(I,{name:"loop-right-ai",className:"size-4"})})})}),r.jsx(ie,{sideOffset:8,children:t("planView.actions.improve")})]}),r.jsxs(Ge,{align:"end",children:[r.jsx(Y,{onClick:()=>D({action:"improve",target:"session"}),children:t("planView.actions.sendToNewSession")}),r.jsx(Y,{onClick:()=>D({action:"improve",target:"worktree"}),disabled:!B,children:t("planView.actions.sendToNewWorktreeSession")})]})]}),r.jsxs(Oe,{children:[r.jsxs(ne,{children:[r.jsx(se,{asChild:!0,children:r.jsx(Be,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0","aria-label":t("planView.actions.implementPlanAria"),disabled:!f.trim(),children:r.jsx(I,{name:"code-ai",className:"size-4"})})})}),r.jsx(ie,{sideOffset:8,children:t("planView.actions.implement")})]}),r.jsxs(Ge,{align:"end",children:[r.jsx(Y,{onClick:()=>D({action:"implement",target:"session"}),children:t("planView.actions.sendToNewSession")}),r.jsx(Y,{onClick:()=>D({action:"implement",target:"worktree"}),disabled:!B,children:t("planView.actions.sendToNewWorktreeSession")})]})]}),r.jsx(ct,{currentMode:H,onToggle:()=>Qe(H==="preview"?"edit":"preview")}),H==="preview"&&Je&&r.jsxs(ne,{children:[r.jsx(se,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0","aria-label":t(G?"planView.tts.stopSpeaking":"planView.tts.readAloud"),onClick:()=>{G?Ke():f.trim()&&He(f)},children:G?r.jsx(I,{name:"stop",className:"h-4 w-4 text-[color:var(--status-success)]"}):r.jsx(I,{name:"volume-up",className:"h-4 w-4"})})}),r.jsx(ie,{sideOffset:8,children:t(G?"planView.tts.stopSpeaking":"planView.tts.readAloud")})]}),r.jsx(J,{variant:"ghost",size:"sm",onClick:async()=>{(await kt(f)).ok&&(be(!0),$.current!==null&&window.clearTimeout($.current),$.current=window.setTimeout(()=>{be(!1)},1200))},className:"h-5 w-5 p-0",title:t("planView.actions.copyPlanContents"),"aria-label":t("planView.actions.copyPlanContents"),children:Ze?r.jsx(I,{name:"check",className:"h-4 w-4 text-[color:var(--status-success)]"}):r.jsx(I,{name:"clipboard",className:"h-4 w-4"})})]}):null]}),r.jsx(Wt,{open:N!==null,onOpenChange:e=>{!e&&!ve&&D(null)},target:N?.target??"session",projectDirectory:h?.path??null,submitting:ve,allowRunAsGoal:!0,onConfirm:rt}),r.jsx("div",{className:"flex-1 min-h-0 min-w-0 relative",children:r.jsx(Nt,{outerClassName:"h-full min-w-0",className:"h-full min-w-0",children:Ye?r.jsx("div",{className:"p-3 typography-ui text-muted-foreground",children:t("planView.state.loading")}):r.jsx("div",{className:"relative h-full",children:r.jsx("div",{className:"h-full",children:H==="preview"?r.jsx("div",{className:"h-full overflow-auto p-3",children:r.jsx(Et,{fallback:r.jsxs("div",{className:"rounded-md border border-destructive/20 bg-destructive/10 px-3 py-2",children:[r.jsx("div",{className:"mb-1 font-medium text-destructive",children:t("planView.error.previewUnavailable")}),r.jsx("div",{className:"text-sm text-muted-foreground",children:t("planView.error.switchToEditMode")})]}),children:r.jsx(Pt,{content:f,className:"typography-markdown-body",enableFileReferences:!1})})}):r.jsx("div",{className:"relative h-full",ref:qe,children:r.jsx(ut,{value:f,onChange:b,readOnly:!1,className:"h-full",extensions:tt,onViewReady:e=>{Ce.current=e},onViewDestroy:()=>{Ce.current=null},blockWidgets:nt,highlightLines:o?{start:Math.min(o.start,o.end),end:Math.max(o.start,o.end)}:void 0,lineNumbersConfig:{domEventHandlers:{mousedown:(e,i,u)=>{if(!(u instanceof MouseEvent)||u.button!==0)return!1;u.preventDefault();const n=e.state.doc.lineAt(i.from).number;if(o&&!u.shiftKey&&Math.min(o.start,o.end)===n&&Math.max(o.start,o.end)===n)return S(null),z(),R.current=!1,M.current=null,F(!1),!0;if(we&&o&&!u.shiftKey){const c=Math.min(o.start,o.end,n),p=Math.max(o.start,o.end,n);return S({start:c,end:p}),R.current=!1,M.current=null,F(!1),!0}if(R.current=!0,M.current=n,F(!0),o&&u.shiftKey){const c=Math.min(o.start,n),p=Math.max(o.end,n);S({start:c,end:p})}else S({start:n,end:n});return!0},mouseover:(e,i,u)=>{if(!(u instanceof MouseEvent)||u.buttons!==1||!R.current||M.current===null)return!1;const n=e.state.doc.lineAt(i.from).number,c=Math.min(M.current,n),p=Math.max(M.current,n);return S({start:c,end:p}),F(!0),!1},mouseup:()=>(R.current=!1,M.current=null,F(!1),!1)}}})})})})})})]})};export{_n as PlanView};
@@ -1 +0,0 @@
1
- import{f as oe,R as ze,j as s,r as Pe}from"./vendor-react-BUCujlKS.js";import{u as Ce,av as $e,aw as Ue,ax as Ee,M as ce}from"./index-Cwmuwk3V.js";import{b0 as Le,f as Se,h as H,a_ as Oe,w as We,x as Ae,I as G,M as Be,aZ as Re,aY as Ge,aS as He,aU as Ye,aV as Ke,z as Ve,y as Ie,A as Ze,C as qe,E as Je,r as Qe}from"./useAppFontEffects-B53Rb6m7.js";import{d as Me}from"./vendor-base-ui-DsHmyMwp.js";function St(){const n=oe.c(5),e=Ce(Xe);let t;n[0]===Symbol.for("react.memo_cache_sentinel")?(t=$e(),n[0]=t):t=n[0];const c=t;let a;n[1]!==e?(a=Ue(e),n[1]=e,n[2]=a):a=n[2];const l=a;let i;return n[3]!==l?(i={usesFramelessChrome:c,side:l},n[3]=l,n[4]=i):i=n[4],i}function Xe(n){return n.desktopWindowControlsPosition}const Fe=n=>!Number.isFinite(n)||n<=0?new Intl.NumberFormat(Le(),{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(0):new Intl.NumberFormat(Le(),{style:"currency",currency:"USD",minimumFractionDigits:n<.01?4:2,maximumFractionDigits:n<.01?4:2}).format(n),kt=n=>{const e=oe.c(144),{totalTokens:t,percentage:c,colorPercentage:a,contextLimit:l,outputLimit:i,cost:d,size:x,isMobile:m,hideIcon:o,showPercentIcon:u,className:p,valueClassName:f,percentIconClassName:g,onClick:h,pressed:b}=n,v=d===void 0?null:d,C=x===void 0?"default":x,w=m===void 0?!1:m,_=o===void 0?!1:o,S=u===void 0?!1:u,k=b===void 0?!1:b,{t:r}=Se(),[y,D]=ze.useState(!1),N=typeof a=="number"?a:c;let j,L,M,T,I,P,$,ee,F,Y;if(e[0]!==N||e[1]!==l||e[2]!==v||e[3]!==_||e[4]!==w||e[5]!==h||e[6]!==i||e[7]!==g||e[8]!==c||e[9]!==S||e[10]!==r||e[11]!==t||e[12]!==f){const z=We(c)??0,ne=Ae(N),re=ne==="critical"?"var(--status-error)":ne==="warn"?"var(--status-warning)":"var(--status-success)";j=et,L=tt;const ie=2*Math.PI*8.5,le=ie*(1-z/100);P=typeof i=="number"?Math.max(i,0):0,I=v??0;let Q;e[23]!==I?(Q=I>0&&Number.isFinite(I),e[23]=I,e[24]=Q):Q=e[24],M=Q;let W;e[25]!==r||e[26]!==t?(W=r("contextUsage.tooltip.usedTokens",{tokens:j(t)}),e[25]=r,e[26]=t,e[27]=W):W=e[27];let A;e[28]!==l||e[29]!==r?(A=r("contextUsage.tooltip.contextLimit",{tokens:j(l)}),e[28]=l,e[29]=r,e[30]=A):A=e[30];let B;e[31]!==P||e[32]!==r?(B=r("contextUsage.tooltip.outputLimit",{tokens:j(P)}),e[31]=P,e[32]=r,e[33]=B):B=e[33];let R;e[34]!==M||e[35]!==I||e[36]!==r?(R=M?[r("contextUsage.tooltip.cost",{cost:Fe(I)})]:[],e[34]=M,e[35]=I,e[36]=r,e[37]=R):R=e[37];let X;e[38]!==W||e[39]!==A||e[40]!==B||e[41]!==R?(X=[W,A,B,...R],e[38]=W,e[39]=A,e[40]=B,e[41]=R,e[42]=X):X=e[42],Y=X,T=!w&&typeof h=="function",e[43]!==_||e[44]!==w?(F=!w&&!_&&s.jsx(G,{name:"donut-chart",className:"h-4 w-4 flex-shrink-0"}),e[43]=_,e[44]=w,e[45]=F):F=e[45],e[46]!==f?($=H("font-medium inline-flex items-center gap-1.5",f),e[46]=f,e[47]=$):$=e[47],ee=S?s.jsxs(s.Fragment,{children:[s.jsxs("svg",{viewBox:"0 0 20 20",className:H("h-3.5 w-3.5 -rotate-90",g),role:"progressbar","aria-valuenow":Math.round(z),"aria-valuemin":0,"aria-valuemax":100,children:[s.jsx("circle",{cx:10,cy:10,r:8.5,fill:"none",stroke:"var(--interactive-border)",strokeWidth:3}),s.jsx("circle",{cx:10,cy:10,r:8.5,fill:"none",stroke:re,strokeWidth:3,strokeLinecap:"round",strokeDasharray:ie,strokeDashoffset:le,className:"transition-[stroke-dashoffset,stroke] duration-300"})]}),s.jsxs("span",{className:"text-foreground",children:[Math.min(c,999).toFixed(1),"%"]})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:L(N),children:Math.min(c,999).toFixed(1)}),"%"]}),e[0]=N,e[1]=l,e[2]=v,e[3]=_,e[4]=w,e[5]=h,e[6]=i,e[7]=g,e[8]=c,e[9]=S,e[10]=r,e[11]=t,e[12]=f,e[13]=j,e[14]=L,e[15]=M,e[16]=T,e[17]=I,e[18]=P,e[19]=$,e[20]=ee,e[21]=F,e[22]=Y}else j=e[13],L=e[14],M=e[15],T=e[16],I=e[17],P=e[18],$=e[19],ee=e[20],F=e[21],Y=e[22];let te;e[48]!==$||e[49]!==ee?(te=s.jsx("span",{className:$,children:ee}),e[48]=$,e[49]=ee,e[50]=te):te=e[50];let K;e[51]!==te||e[52]!==F?(K=s.jsxs(s.Fragment,{children:[F,te]}),e[51]=te,e[52]=F,e[53]=K):K=e[53];const V=K,ae=C==="compact"?"typography-micro":"typography-meta";let Z;e[54]!==p||e[55]!==T||e[56]!==ae?(Z=H("app-region-no-drag flex items-center gap-1.5 select-none",ae,T?H("rounded-md px-2 py-1.5 text-foreground transition-colors","hover:bg-interactive-hover","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary"):"text-muted-foreground/60",p),e[54]=p,e[55]=T,e[56]=ae,e[57]=Z):Z=e[57];const q=Z;let J;e[58]!==V||e[59]!==T||e[60]!==w||e[61]!==h||e[62]!==k||e[63]!==q||e[64]!==r?(J=T?s.jsx("button",{type:"button",className:q,"aria-label":r("contextUsage.aria.label"),"aria-pressed":k,onClick:h,children:V}):s.jsx("div",{className:q,"aria-label":r("contextUsage.aria.label"),onClick:w?()=>D(!0):void 0,children:V}),e[58]=V,e[59]=T,e[60]=w,e[61]=h,e[62]=k,e[63]=q,e[64]=r,e[65]=J):J=e[65];const U=J;if(w){let z;e[66]===Symbol.for("react.memo_cache_sentinel")?(z=()=>D(!1),e[66]=z):z=e[66];let ne;e[67]!==r?(ne=r("contextUsage.mobile.title"),e[67]=r,e[68]=ne):ne=e[68];let re;e[69]!==r?(re=r("contextUsage.mobile.usedTokens"),e[69]=r,e[70]=re):re=e[70];let ie;e[71]!==re?(ie=s.jsx("span",{className:"typography-meta text-muted-foreground",children:re}),e[71]=re,e[72]=ie):ie=e[72];let le;e[73]!==j||e[74]!==t?(le=j(t),e[73]=j,e[74]=t,e[75]=le):le=e[75];let Q;e[76]!==le?(Q=s.jsx("span",{className:"typography-meta text-foreground font-medium",children:le}),e[76]=le,e[77]=Q):Q=e[77];let W;e[78]!==ie||e[79]!==Q?(W=s.jsxs("div",{className:"flex justify-between items-center",children:[ie,Q]}),e[78]=ie,e[79]=Q,e[80]=W):W=e[80];let A;e[81]!==r?(A=r("contextUsage.mobile.contextLimit"),e[81]=r,e[82]=A):A=e[82];let B;e[83]!==A?(B=s.jsx("span",{className:"typography-meta text-muted-foreground",children:A}),e[83]=A,e[84]=B):B=e[84];let R;e[85]!==l||e[86]!==j?(R=j(l),e[85]=l,e[86]=j,e[87]=R):R=e[87];let X;e[88]!==R?(X=s.jsx("span",{className:"typography-meta text-foreground font-medium",children:R}),e[88]=R,e[89]=X):X=e[89];let de;e[90]!==B||e[91]!==X?(de=s.jsxs("div",{className:"flex justify-between items-center",children:[B,X]}),e[90]=B,e[91]=X,e[92]=de):de=e[92];let me;e[93]!==r?(me=r("contextUsage.mobile.outputLimit"),e[93]=r,e[94]=me):me=e[94];let ue;e[95]!==me?(ue=s.jsx("span",{className:"typography-meta text-muted-foreground",children:me}),e[95]=me,e[96]=ue):ue=e[96];let fe;e[97]!==j||e[98]!==P?(fe=j(P),e[97]=j,e[98]=P,e[99]=fe):fe=e[99];let pe;e[100]!==fe?(pe=s.jsx("span",{className:"typography-meta text-foreground font-medium",children:fe}),e[100]=fe,e[101]=pe):pe=e[101];let he;e[102]!==ue||e[103]!==pe?(he=s.jsxs("div",{className:"flex justify-between items-center",children:[ue,pe]}),e[102]=ue,e[103]=pe,e[104]=he):he=e[104];let xe;e[105]!==M||e[106]!==I||e[107]!==r?(xe=M?s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"typography-meta text-muted-foreground",children:r("contextUsage.mobile.cost")}),s.jsx("span",{className:"typography-meta text-foreground font-medium",children:Fe(I)})]}):null,e[105]=M,e[106]=I,e[107]=r,e[108]=xe):xe=e[108];let ge;e[109]!==r?(ge=r("contextUsage.mobile.usage"),e[109]=r,e[110]=ge):ge=e[110];let be;e[111]!==ge?(be=s.jsx("span",{className:"typography-meta text-muted-foreground",children:ge}),e[111]=ge,e[112]=be):be=e[112];let we;e[113]!==N||e[114]!==L?(we=H("typography-meta font-semibold",L(N)),e[113]=N,e[114]=L,e[115]=we):we=e[115];const De=Math.min(c,999);let ye;e[116]!==De?(ye=De.toFixed(1),e[116]=De,e[117]=ye):ye=e[117];let je;e[118]!==we||e[119]!==ye?(je=s.jsxs("span",{className:we,children:[ye,"%"]}),e[118]=we,e[119]=ye,e[120]=je):je=e[120];let ve;e[121]!==be||e[122]!==je?(ve=s.jsxs("div",{className:"flex justify-between items-center pt-1 border-t border-border/40",children:[be,je]}),e[121]=be,e[122]=je,e[123]=ve):ve=e[123];let Ne;e[124]!==W||e[125]!==de||e[126]!==he||e[127]!==xe||e[128]!==ve?(Ne=s.jsx("div",{className:"flex flex-col gap-1.5",children:s.jsxs("div",{className:"rounded-xl border border-border/40 bg-sidebar/30 px-3 py-2 space-y-1",children:[W,de,he,xe,ve]})}),e[124]=W,e[125]=de,e[126]=he,e[127]=xe,e[128]=ve,e[129]=Ne):Ne=e[129];let _e;e[130]!==y||e[131]!==ne||e[132]!==Ne?(_e=s.jsx(Be,{open:y,onClose:z,title:ne,children:Ne}),e[130]=y,e[131]=ne,e[132]=Ne,e[133]=_e):_e=e[133];let ke;return e[134]!==U||e[135]!==_e?(ke=s.jsxs(s.Fragment,{children:[U,_e]}),e[134]=U,e[135]=_e,e[136]=ke):ke=e[136],ke}let E;e[137]!==U?(E=s.jsx(Re,{asChild:!0,children:U}),e[137]=U,e[138]=E):E=e[138];let O;e[139]!==Y?(O=s.jsx(Oe,{children:s.jsx("div",{className:"space-y-0.5",children:Y.map(st)})}),e[139]=Y,e[140]=O):O=e[140];let se;return e[141]!==E||e[142]!==O?(se=s.jsxs(Ge,{children:[E,O]}),e[141]=E,e[142]=O,e[143]=se):se=e[143],se};function et(n){return n>=1e6?`${(n/1e6).toFixed(1)}M`:n>=1e3?`${(n/1e3).toFixed(1)}K`:n.toFixed(1).replace(/\.0$/,"")}function tt(n){return n>=90?"text-status-error":n>=75?"text-status-warning":"text-status-success"}function st(n){return s.jsx("p",{className:"typography-micro leading-tight",children:n},n)}const nt={close:"#FF5F57",minimize:"#FEBC2E",maximize:"#28C940"},it="rgba(0, 0, 0, 0.7)",ot=n=>{const e=oe.c(3),{action:t}=n;if(t==="close"){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(G,{name:"close",className:"size-[10px]"}),e[0]=a):a=e[0],a}if(t==="minimize"){let a;return e[1]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(G,{name:"subtract",className:"size-[10px]"}),e[1]=a):a=e[1],a}let c;return e[2]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(G,{name:"add",className:"size-[10px]"}),e[2]=c):c=e[2],c},rt=n=>{const e=oe.c(18),{action:t,isMaximized:c,onActivate:a}=n,{t:l}=Se(),i=nt[t];let d;e[0]!==t||e[1]!==c||e[2]!==l?(d=l(t==="close"?"header.windowControls.close":t==="minimize"?"header.windowControls.minimize":c?"header.windowControls.restore":"header.windowControls.maximize"),e[0]=t,e[1]=c,e[2]=l,e[3]=d):d=e[3];const x=d;let m;e[4]!==t||e[5]!==a?(m=()=>a(t),e[4]=t,e[5]=a,e[6]=m):m=e[6];let o;e[7]!==i?(o={backgroundColor:i,color:it},e[7]=i,e[8]=o):o=e[8];let u;e[9]!==t?(u=s.jsx("span",{className:"flex items-center justify-center opacity-0 transition-opacity duration-75 group-hover/wctl:opacity-100",children:s.jsx(ot,{action:t})}),e[9]=t,e[10]=u):u=e[10];let p;e[11]!==o||e[12]!==u?(p=s.jsx("span",{className:"flex size-3.5 items-center justify-center rounded-full shadow-[inset_0_0_0_0.5px_rgba(0,0,0,0.28)] transition-[filter] duration-75 active:brightness-90",style:o,children:u}),e[11]=o,e[12]=u,e[13]=p):p=e[13];let f;return e[14]!==x||e[15]!==m||e[16]!==p?(f=s.jsx("button",{type:"button",onClick:m,title:x,"aria-label":x,className:"app-region-no-drag flex h-8 w-[24px] items-center justify-center rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",children:p}),e[14]=x,e[15]=m,e[16]=p,e[17]=f):f=e[17],f},zt=ze.memo(function(e){const t=oe.c(25),{visible:c,position:a}=e,l=a===void 0?"right":a,{t:i}=Se(),[d,x]=ze.useState(!1),m=Ce(lt);let o,u;if(t[0]!==c?(o=()=>{if(!c)return;let C=!1;ce("desktop_get_current_window_state").then(_=>{C||x(!!_?.maximized)}).catch(at);const w=_=>{const S=_.detail;x(!!S?.maximized)};return window.addEventListener("openchamber:window-maximized-changed",w),()=>{C=!0,window.removeEventListener("openchamber:window-maximized-changed",w)}},u=[c],t[0]=c,t[1]=o,t[2]=u):(o=t[1],u=t[2]),Pe.useEffect(o,u),!c)return null;const p=l==="left";let f,g,h,b;if(t[3]!==m||t[4]!==p||t[5]!==d||t[6]!==l||t[7]!==i){b=Symbol.for("react.early_return_sentinel");e:{const C=Ee(l);let w;t[12]===Symbol.for("react.memo_cache_sentinel")?(w=y=>{if(y==="close"){ce("desktop_close_current_window");return}if(y==="minimize"){ce("desktop_minimize_current_window");return}ce("desktop_toggle_current_window_maximized").then(D=>x(!!D?.maximized)).catch(ct)},t[12]=w):w=t[12];const _=w;if(m==="traffic-lights"){const y=p?"mr-1":"ml-1";let D;t[13]!==y?(D=H("app-region-no-drag group/wctl flex h-8 shrink-0 items-center",y),t[13]=y,t[14]=D):D=t[14];let N;t[15]!==i?(N=i("header.windowControls.groupAria"),t[15]=i,t[16]=N):N=t[16];let j;t[17]!==d?(j=L=>s.jsx(rt,{action:L,isMaximized:d,onActivate:_},L),t[17]=d,t[18]=j):j=t[18],b=s.jsx("div",{className:D,"aria-label":N,children:C.map(j)});break e}const S=H("app-region-no-drag inline-flex items-center justify-center text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",p?"h-8 w-8 rounded-md":"h-12 w-11"),k=p?"app-region-no-drag mr-1 flex h-8 shrink-0 items-center":"app-region-no-drag ml-1 flex h-12 shrink-0 items-center",r=y=>y==="minimize"?s.jsx("button",{type:"button",className:S,onClick:dt,title:i("header.windowControls.minimize"),"aria-label":i("header.windowControls.minimize"),children:s.jsx(G,{name:"subtract",className:"h-4 w-4"})},"minimize"):y==="maximize"?s.jsx("button",{type:"button",className:S,onClick:()=>{ce("desktop_toggle_current_window_maximized").then(D=>x(!!D?.maximized)).catch(mt)},title:i(d?"header.windowControls.restore":"header.windowControls.maximize"),"aria-label":i(d?"header.windowControls.restore":"header.windowControls.maximize"),children:s.jsx(G,{name:d?"fullscreen-exit":"checkbox-blank",className:"h-3.5 w-3.5"})},"maximize"):s.jsx("button",{type:"button",className:H(S,"hover:bg-[var(--status-error-background)] hover:text-[var(--status-error-foreground)]"),onClick:ut,title:i("header.windowControls.close"),"aria-label":i("header.windowControls.close"),children:s.jsx(G,{name:"close",className:"h-4 w-4"})},"close");f=k,t[19]!==i?(g=i("header.windowControls.groupAria"),t[19]=i,t[20]=g):g=t[20],h=C.map(r)}t[3]=m,t[4]=p,t[5]=d,t[6]=l,t[7]=i,t[8]=f,t[9]=g,t[10]=h,t[11]=b}else f=t[8],g=t[9],h=t[10],b=t[11];if(b!==Symbol.for("react.early_return_sentinel"))return b;let v;return t[21]!==f||t[22]!==g||t[23]!==h?(v=s.jsx("div",{className:f,"aria-label":g,children:h}),t[21]=f,t[22]=g,t[23]=h,t[24]=v):v=t[24],v});function lt(n){return n.desktopWindowControlsStyle}function at(){}function ct(){}function dt(){ce("desktop_minimize_current_window")}function mt(){}function ut(){ce("desktop_close_current_window")}function Dt(n){const e=oe.c(18),{children:t,variant:c,scopeProjectId:a,align:l}=n,i=c===void 0?"default":c,d=a===void 0?null:a,x=l===void 0?"start":l,m=Ce(pt),o=Ce(ft);let u;e[0]!==t?(u=s.jsx(He,{asChild:!0,children:t}),e[0]=t,e[1]=u):u=e[1];const p=i==="compact"?"w-[280px]":"w-[360px]";let f;e[2]!==p?(f=H("overflow-hidden p-1 max-w-[calc(100vw-32px)]",p),e[2]=p,e[3]=f):f=e[3];let g;e[4]!==m||e[5]!==d||e[6]!==o||e[7]!==i?(g=m?s.jsx(ht,{onSelect:()=>o(!1),variant:i,scopeProjectId:d}):null,e[4]=m,e[5]=d,e[6]=o,e[7]=i,e[8]=g):g=e[8];let h;e[9]!==x||e[10]!==f||e[11]!==g?(h=s.jsx(Ye,{align:x,sideOffset:6,className:f,children:g}),e[9]=x,e[10]=f,e[11]=g,e[12]=h):h=e[12];let b;return e[13]!==m||e[14]!==o||e[15]!==u||e[16]!==h?(b=s.jsxs(Ke,{open:m,onOpenChange:o,modal:!1,children:[u,h]}),e[13]=m,e[14]=o,e[15]=u,e[16]=h,e[17]=b):b=e[17],b}function ft(n){return n.setSessionDropdownOpen}function pt(n){return n.isSessionDropdownOpen}function ht(n){const e=oe.c(26),{onSelect:t,variant:c,scopeProjectId:a}=n;let l;e[0]!==a?(l={scopeProjectId:a},e[0]=a,e[1]=l):l=e[1];const i=Ve(!0,l),d=Ie(gt),x=Ce(xt),{t:m}=Se();let o;e[2]!==t||e[3]!==d||e[4]!==x?(o=()=>{x("chat"),t(),d()},e[2]=t,e[3]=d,e[4]=x,e[5]=o):o=e[5];const u=o;let p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p=new Set,e[6]=p):p=e[6];const[f,g]=ze.useState(p);let h;e[7]===Symbol.for("react.memo_cache_sentinel")?(h=y=>{g(D=>{const N=new Set(D);return N.has(y)?N.delete(y):N.add(y),N})},e[7]=h):h=e[7];const b=h;let v,C;e[8]===Symbol.for("react.memo_cache_sentinel")?(v=H("group relative flex w-full cursor-pointer items-center gap-2 rounded-lg px-2 py-1.5 outline-hidden select-none","data-[highlighted]:bg-interactive-hover hover:bg-interactive-hover"),C=s.jsx(G,{name:"chat-new",className:"h-4 w-4 flex-shrink-0 text-muted-foreground"}),e[8]=v,e[9]=C):(v=e[8],C=e[9]);let w;e[10]!==m?(w=m("sessions.sidebar.header.actions.newSession"),e[10]=m,e[11]=w):w=e[11];let _;e[12]!==w?(_=s.jsx("span",{className:"truncate text-[14px] font-normal leading-tight text-foreground",children:w}),e[12]=w,e[13]=_):_=e[13];let S;e[14]!==u||e[15]!==_?(S=s.jsxs(Me,{onClick:u,className:v,children:[C,_]}),e[14]=u,e[15]=_,e[16]=S):S=e[16];let k;e[17]!==f||e[18]!==i||e[19]!==t||e[20]!==m||e[21]!==c?(k=i.length===0?s.jsx("div",{className:"px-3 py-4 text-center typography-meta text-muted-foreground",children:m("sessions.switcher.empty")}):i.map(y=>s.jsx(Te,{item:y,depth:0,variant:c,expandedParents:f,toggleParent:b,closeDropdown:t},y.node.session.id)),e[17]=f,e[18]=i,e[19]=t,e[20]=m,e[21]=c,e[22]=k):k=e[22];let r;return e[23]!==k||e[24]!==S?(r=s.jsx("div",{className:"max-h-[60vh] overflow-y-auto",children:s.jsxs("div",{className:"space-y-0.5",children:[S,k]})}),e[23]=k,e[24]=S,e[25]=r):r=e[25],r}function xt(n){return n.setActiveMainTab}function gt(n){return n.openNewSessionDraft}function Te(n){const e=oe.c(31),{item:t,depth:c,variant:a,expandedParents:l,toggleParent:i,closeDropdown:d}=n,{node:x,secondaryMeta:m}=t,o=x.session,u=x.children.length>0;let p;e[0]!==l||e[1]!==o.id?(p=l.has(o.id),e[0]=l,e[1]=o.id,e[2]=p):p=e[2];const f=p;let g;e[3]!==u||e[4]!==o.id||e[5]!==i?(g=u?()=>i(o.id):void 0,e[3]=u,e[4]=o.id,e[5]=i,e[6]=g):g=e[6];let h;e[7]!==d||e[8]!==c||e[9]!==u||e[10]!==f||e[11]!==m||e[12]!==o||e[13]!==g||e[14]!==a?(h=s.jsx(bt,{session:o,depth:c,variant:a,secondaryMeta:m,hasChildren:u,isExpanded:f,onToggleExpand:g,closeDropdown:d}),e[7]=d,e[8]=c,e[9]=u,e[10]=f,e[11]=m,e[12]=o,e[13]=g,e[14]=a,e[15]=h):h=e[15];let b;e[16]!==d||e[17]!==c||e[18]!==l||e[19]!==u||e[20]!==f||e[21]!==t.groupDirectory||e[22]!==t.projectId||e[23]!==x.children||e[24]!==m||e[25]!==i||e[26]!==a?(b=u&&f?x.children.map(C=>s.jsx(Te,{item:{node:C,projectId:t.projectId,groupDirectory:t.groupDirectory,secondaryMeta:m},depth:c+1,variant:a,expandedParents:l,toggleParent:i,closeDropdown:d},C.session.id)):null,e[16]=d,e[17]=c,e[18]=l,e[19]=u,e[20]=f,e[21]=t.groupDirectory,e[22]=t.projectId,e[23]=x.children,e[24]=m,e[25]=i,e[26]=a,e[27]=b):b=e[27];let v;return e[28]!==h||e[29]!==b?(v=s.jsxs(s.Fragment,{children:[h,b]}),e[28]=h,e[29]=b,e[30]=v):v=e[30],v}function bt(n){const e=oe.c(57),{session:t,depth:c,variant:a,secondaryMeta:l,hasChildren:i,isExpanded:d,onToggleExpand:x,closeDropdown:m}=n,{t:o}=Se(),u=Ie(jt),p=Ie(yt),f=Ce(wt),g=Ze(t.id),h=qe(t.id),b=u===t.id;let v;e[0]!==t.title||e[1]!==o?(v=t.title?.trim()||o("sessions.sidebar.session.untitled"),e[0]=t.title,e[1]=o,e[2]=v):v=e[2];const C=v,w=!!t.parentID,_=h>0&&(!w||f),S=g?.type??"idle",k=S==="busy"||S==="retry",r=!k&&_&&!b;let y;e[3]!==t.time?.created||e[4]!==t.time?.updated?(y=t.time?.updated||t.time?.created||Date.now(),e[3]=t.time?.created,e[4]=t.time?.updated,e[5]=y):y=e[5];const D=y;let N;e[6]!==D?(N=Je(D),e[6]=D,e[7]=N):N=e[7];const j=N;let L;e[8]!==l?.projectLabel?(L=l?.projectLabel?.trim()||null,e[8]=l?.projectLabel,e[9]=L):L=e[9];const M=L;let T;e[10]!==l?.branchLabel?(T=l?.branchLabel?.trim()||null,e[10]=l?.branchLabel,e[11]=T):T=e[11];const I=T,P=I&&I!=="HEAD"?I:null;let $;e[12]!==m||e[13]!==b||e[14]!==t||e[15]!==p?($=()=>{if(b){m();return}const z=Qe(t);p(t.id,z??null),m()},e[12]=m,e[13]=b,e[14]=t,e[15]=p,e[16]=$):$=e[16];const ee=$;let F;e[17]!==ee?(F=z=>{if(z.target?.closest("[data-switcher-expand]")){z.preventDefault();return}ee()},e[17]=ee,e[18]=F):F=e[18];let Y;e[19]===Symbol.for("react.memo_cache_sentinel")?(Y=H("group relative flex w-full cursor-pointer items-start gap-2 rounded-lg px-2 py-1.5 outline-hidden select-none","data-[highlighted]:bg-interactive-hover hover:bg-interactive-hover"),e[19]=Y):Y=e[19];const te=8+c*12;let K;e[20]!==te?(K={paddingLeft:te},e[20]=te,e[21]=K):K=e[21];let V;e[22]!==i||e[23]!==d||e[24]!==x||e[25]!==o||e[26]!==a?(V=a==="compact"&&i?s.jsx("span",{role:"button",tabIndex:-1,"data-switcher-expand":!0,onClick:z=>{z.preventDefault(),z.stopPropagation(),x?.()},className:"inline-flex h-3.5 w-3.5 flex-shrink-0 items-center justify-center rounded text-muted-foreground/70 hover:text-foreground","aria-label":o(d?"sessions.sidebar.session.subsessions.collapse":"sessions.sidebar.session.subsessions.expand"),children:d?s.jsx(G,{name:"arrow-down-s",className:"h-3.5 w-3.5"}):s.jsx(G,{name:"arrow-right-s",className:"h-3.5 w-3.5"})}):null,e[22]=i,e[23]=d,e[24]=x,e[25]=o,e[26]=a,e[27]=V):V=e[27];const ae=b?"text-primary":"text-foreground";let Z;e[28]!==ae?(Z=H("truncate text-[14px] font-normal leading-tight",ae),e[28]=ae,e[29]=Z):Z=e[29];let q;e[30]!==C||e[31]!==Z?(q=s.jsx("span",{className:Z,children:C}),e[30]=C,e[31]=Z,e[32]=q):q=e[32];let J;e[33]!==V||e[34]!==q?(J=s.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[V,q]}),e[33]=V,e[34]=q,e[35]=J):J=e[35];let U;e[36]!==P||e[37]!==i||e[38]!==d||e[39]!==x||e[40]!==M||e[41]!==o||e[42]!==j||e[43]!==a?(U=a==="default"?s.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 truncate text-muted-foreground/70 leading-tight",style:{fontSize:"calc(var(--text-ui-label) * 0.85)"},children:[i?s.jsx("span",{role:"button",tabIndex:-1,"data-switcher-expand":!0,onClick:z=>{z.preventDefault(),z.stopPropagation(),x?.()},className:"inline-flex h-3 w-3 flex-shrink-0 items-center justify-center rounded text-muted-foreground/70 hover:text-foreground","aria-label":o(d?"sessions.sidebar.session.subsessions.collapse":"sessions.sidebar.session.subsessions.expand"),children:d?s.jsx(G,{name:"arrow-down-s",className:"h-3 w-3"}):s.jsx(G,{name:"arrow-right-s",className:"h-3 w-3"})}):null,s.jsx("span",{className:"flex-shrink-0",children:j}),M?s.jsx("span",{className:"truncate",children:M}):null,P?s.jsxs("span",{className:"inline-flex min-w-0 items-center gap-0.5",children:[s.jsx(G,{name:"git-branch",className:"h-3 w-3 flex-shrink-0 text-muted-foreground/70"}),s.jsx("span",{className:"truncate",children:P})]}):null]}):null,e[36]=P,e[37]=i,e[38]=d,e[39]=x,e[40]=M,e[41]=o,e[42]=j,e[43]=a,e[44]=U):U=e[44];let E;e[45]!==J||e[46]!==U?(E=s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[J,U]}),e[45]=J,e[46]=U,e[47]=E):E=e[47];let O;e[48]!==k||e[49]!==r||e[50]!==o?(O=k||r?s.jsx("span",{className:"flex h-3 w-3 flex-shrink-0 items-center justify-center self-center",children:k?s.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-primary animate-busy-pulse","aria-label":o("sessions.sidebar.session.status.active"),title:o("sessions.sidebar.session.status.active")}):s.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-[var(--status-info)]","aria-label":o("sessions.sidebar.session.status.unread"),title:o("sessions.sidebar.session.status.unread")})}):null,e[48]=k,e[49]=r,e[50]=o,e[51]=O):O=e[51];let se;return e[52]!==K||e[53]!==E||e[54]!==O||e[55]!==F?(se=s.jsxs(Me,{onClick:F,"data-slot":"session-switcher-item",className:Y,style:K,children:[E,O]}),e[52]=K,e[53]=E,e[54]=O,e[55]=F,e[56]=se):se=e[56],se}function wt(n){return n.notifyOnSubtasks}function yt(n){return n.setCurrentSession}function jt(n){return n.currentSessionId}export{kt as C,Dt as S,zt as W,Fe as f,St as u};