@openchamber/web 2.7.0 → 2.7.1-canary.20261108.12

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 (115) hide show
  1. package/dist/assets/{AboutDialog-Bbu8cDW8.js → AboutDialog-uNKjHvzl.js} +1 -1
  2. package/dist/assets/{AboutLogo-sAyRFbrm.js → AboutLogo-BhyG0ENm.js} +1 -1
  3. package/dist/assets/{ArchiveView-DvLmQllR.js → ArchiveView-Jt6Qj8Ry.js} +1 -1
  4. package/dist/assets/{ChangeRequestDiffUnavailable-Ctc-P6zi.js → ChangeRequestDiffUnavailable-CNIWdYRx.js} +1 -1
  5. package/dist/assets/{ChangedPathLabel-CQOXgkIF.js → ChangedPathLabel-CCsE-8p4.js} +1 -1
  6. package/dist/assets/{CommandPalette-DHk0MqYi.js → CommandPalette-DrsFSbmk.js} +1 -1
  7. package/dist/assets/{DiffView-DPpu52DA.js → DiffView-DwaJOPUe.js} +1 -1
  8. package/dist/assets/{FilesView-CPrroDyU.js → FilesView-Hvxe_KqA.js} +4 -4
  9. package/dist/assets/{GitView-wWoZ95Yt.js → GitView-ZI_EafL9.js} +1 -1
  10. package/dist/assets/{GuestSurfacePane-BsMH8QjU.js → GuestSurfacePane-Ds8luSO0.js} +1 -1
  11. package/dist/assets/{HelpDialog-BZtzVj6Z.js → HelpDialog-DtZKoPZE.js} +1 -1
  12. package/dist/assets/{IntegrationsCatalogView-DJAOTlcc.js → IntegrationsCatalogView-DgdYlI3Z.js} +1 -1
  13. package/dist/assets/{JsonTreeView-BXv2HzlC.js → JsonTreeView-zAv-pn0X.js} +1 -1
  14. package/dist/assets/{MarkdownDiffPreview-CseaChSt.js → MarkdownDiffPreview-Bf9-WPy9.js} +1 -1
  15. package/dist/assets/{MarkdownRendererImpl-CyXOMsMS.js → MarkdownRendererImpl-w7LnAwp_.js} +4 -4
  16. package/dist/assets/{MemoryDebugPanel-xYvjTjLG.js → MemoryDebugPanel-ylQytlyw.js} +1 -1
  17. package/dist/assets/{NoteEditor-Bbrtl8rq.js → NoteEditor-0HEW8KrY.js} +1 -1
  18. package/dist/assets/{OfficeDocumentDiff-DXsfJnFq.js → OfficeDocumentDiff-BFr4rAHy.js} +1 -1
  19. package/dist/assets/{OnboardingScreen-DuWvo16v.js → OnboardingScreen-Bpj6hpDe.js} +1 -1
  20. package/dist/assets/{OpenCodeStatusDialog-9WRgjgWL.js → OpenCodeStatusDialog-CX3oxFSb.js} +1 -1
  21. package/dist/assets/{OverviewView-BzA9rGEs.js → OverviewView-UfIFJ3mf.js} +1 -1
  22. package/dist/assets/{PatchDiff-DVcyjZVm.js → PatchDiff-DC4ydsOW.js} +1 -1
  23. package/dist/assets/{PlanView-BGdba90K.js → PlanView-CgoTn3HJ.js} +1 -1
  24. package/dist/assets/{ProjectActionsDialog-ByPMdwFG.js → ProjectActionsDialog-B16N4lqs.js} +1 -1
  25. package/dist/assets/{ReplyCommand-pviKPDT8.js → ReplyCommand-CnDNvFmd.js} +1 -1
  26. package/dist/assets/{ReplyUiBlock-D7HPBgmq.js → ReplyUiBlock-BsOTgv8M.js} +1 -1
  27. package/dist/assets/{ReviewCards-CU1YHZkQ.js → ReviewCards-BkpTYy_a.js} +1 -1
  28. package/dist/assets/{RunOverview-uFEfusCK.js → RunOverview-DsffX3fI.js} +1 -1
  29. package/dist/assets/{ScheduledTasksDialog-J8i_b433.js → ScheduledTasksDialog-DgrAfpeX.js} +1 -1
  30. package/dist/assets/{SettingsView-CaUgulkI.js → SettingsView-B804XZvl.js} +1 -1
  31. package/dist/assets/{SettingsWindow-BVEVntuV.js → SettingsWindow-k5FSMAzV.js} +1 -1
  32. package/dist/assets/{SidebarSectionsManager-CIXOcE0-.js → SidebarSectionsManager-DH61-mRe.js} +1 -1
  33. package/dist/assets/{SourceBoardView-BW1OSOo1.js → SourceBoardView-BvGoSNer.js} +1 -1
  34. package/dist/assets/{SpaceAccessDialog-6GhzlMD8.js → SpaceAccessDialog-DHNqUzKD.js} +1 -1
  35. package/dist/assets/{SpaceApplyDialog-zB4jAExK.js → SpaceApplyDialog-DEOTeEjy.js} +1 -1
  36. package/dist/assets/{SpaceRow-C6QD41XF.js → SpaceRow-CBva6ofM.js} +1 -1
  37. package/dist/assets/{SpaceSetupOutput-6GuKiRed.js → SpaceSetupOutput-C4NhRkjl.js} +1 -1
  38. package/dist/assets/{SpacesView-BgncMV45.js → SpacesView-BGevrpQp.js} +1 -1
  39. package/dist/assets/{SubmoduleDiffSummary-BwVdGw0c.js → SubmoduleDiffSummary-Bebhaz7n.js} +1 -1
  40. package/dist/assets/{ToolOutputDialog-CC9hcX2C.js → ToolOutputDialog-B1gU22Tz.js} +1 -1
  41. package/dist/assets/{ToolPartDiffPreview-D15Ja459.js → ToolPartDiffPreview-CVy_zn_m.js} +1 -1
  42. package/dist/assets/{UiBlock-pyLxOJr6.js → UiBlock-C11qZK5T.js} +2 -2
  43. package/dist/assets/{UsageStatsView-CMf29PeL.js → UsageStatsView-CNm8WPSk.js} +1 -1
  44. package/dist/assets/{WalkthroughView-DeuNxpZ7.js → WalkthroughView-Bbwyk6rg.js} +1 -1
  45. package/dist/assets/{WorktreesView-jHcQwWBH.js → WorktreesView-BGIfERNs.js} +1 -1
  46. package/dist/assets/{appThemeRegistry-BwyM6n38.js → appThemeRegistry-DYzVI9tX.js} +1 -1
  47. package/dist/assets/{ar-DnPStsLU.js → ar-CT3AuXVj.js} +1 -1
  48. package/dist/assets/{codeHighlight-C7ZRQ5-2.js → codeHighlight-BcDjh6yS.js} +1 -1
  49. package/dist/assets/{columnWidthMemory-Cbfh5HD5.js → columnWidthMemory-BA6h4J11.js} +1 -1
  50. package/dist/assets/{computeVirtualFileMetrics-DVynfSBh.js → computeVirtualFileMetrics-DVfKKHny.js} +2 -2
  51. package/dist/assets/{contextFileOpenGuard-CKnYjgFC.js → contextFileOpenGuard-BC79wuu1.js} +1 -1
  52. package/dist/assets/{date-time-qS8d5iiz.js → date-time-DhfjtTnp.js} +1 -1
  53. package/dist/assets/{de-SUU4F7Nt.js → de-BdVTH897.js} +1 -1
  54. package/dist/assets/{documentClient-B0iRikhq.js → documentClient-JcxJ7vyh.js} +2 -2
  55. package/dist/assets/{documentExport-Cf0gMwM0.js → documentExport-C830mU4N.js} +1 -1
  56. package/dist/assets/{documentHost-cOykm7qf.js → documentHost-DKm0U_q_.js} +1 -1
  57. package/dist/assets/{es-BWlkhnKy.js → es-BFk4dosu.js} +1 -1
  58. package/dist/assets/{fileContentPoller-CKcqqhzG.js → fileContentPoller-BmcApnk-.js} +1 -1
  59. package/dist/assets/{flexokiTheme-deI9tWCZ.js → flexokiTheme-BMYGLHbL.js} +1 -1
  60. package/dist/assets/{fr-DN3Tx1EV.js → fr-CeExWqT9.js} +1 -1
  61. package/dist/assets/{he-B-7jIB_R.js → he-C_O5IfNH.js} +1 -1
  62. package/dist/assets/{highlights-B2Re-VTM.js → highlights-CIuWBj_n.js} +1 -1
  63. package/dist/assets/{index-D5Ed7hon.js → index-bD6u6GDm.js} +1 -1
  64. package/dist/assets/{initializeSharedPreferences-D5FLPdpI.js → initializeSharedPreferences-BcnhlF3e.js} +1 -1
  65. package/dist/assets/{install-sOrZWWGd.js → install-CSoRI5iX.js} +1 -1
  66. package/dist/assets/{install-request-C-zhz88k.js → install-request-EHX4ORhb.js} +1 -1
  67. package/dist/assets/{isDiffPlainText-DpcjRlB-.js → isDiffPlainText-saKoOWJx.js} +1 -1
  68. package/dist/assets/{isFilePlainText-DJ_bXU7C.js → isFilePlainText-DOjSDWo3.js} +1 -1
  69. package/dist/assets/{ja-DE4Yf-rX.js → ja-BlUqUBMY.js} +1 -1
  70. package/dist/assets/{katex.min-g52ii4Gs.js → katex.min-Bs5OLoA1.js} +4 -4
  71. package/dist/assets/{ko-CETaCyB8.js → ko-CGv47dWq.js} +1 -1
  72. package/dist/assets/{main-QRYvDkRZ.js → main-064y5MQB.js} +4 -4
  73. package/dist/assets/{main-89VT8Kff.js → main-D8yzv2tL.js} +2 -2
  74. package/dist/assets/{miniChat-CgHPqY7Z.js → miniChat-X7g2IHQj.js} +2 -2
  75. package/dist/assets/{mobile-BQrjPA_e.js → mobile-B5efB3tI.js} +2 -2
  76. package/dist/assets/{moveWorkspacePath-C4_JgpNC.js → moveWorkspacePath-BaEfuU4S.js} +1 -1
  77. package/dist/assets/{nl-CL94_9kf.js → nl-CavtTtNf.js} +1 -1
  78. package/dist/assets/{officeDocument-COfYG-XF.js → officeDocument-CQScRmC1.js} +1 -1
  79. package/dist/assets/{parseDiffFromFile-CD1h9Yf5.js → parseDiffFromFile-By5H8w4y.js} +1 -1
  80. package/dist/assets/{pierreDiffTint-Cg024Eeg.js → pierreDiffTint-CVm_qZm-.js} +1 -1
  81. package/dist/assets/{pl-Bk1GuZBm.js → pl-BQZVI44N.js} +1 -1
  82. package/dist/assets/{pt-BR-Bfrsw-GS.js → pt-BR-iqkU-MRA.js} +1 -1
  83. package/dist/assets/{relocateRestoredSession-C79EVzC-.js → relocateRestoredSession-CsK2RUM_.js} +2 -2
  84. package/dist/assets/{renderElectronMiniChatApp-lMVP5gEt.js → renderElectronMiniChatApp-DzVezwky.js} +2 -2
  85. package/dist/assets/{renderMarkdownForExport-DTutihQz.js → renderMarkdownForExport-BM19JOji.js} +1 -1
  86. package/dist/assets/{renderMobileApp-CmYW0oos.js → renderMobileApp-CiTrtu6R.js} +3 -3
  87. package/dist/assets/{resolveLanguages-lTTkQHer.js → resolveLanguages-DQXSOQcc.js} +1 -1
  88. package/dist/assets/{runtimeEndpointReset-BJm_77m2.js → runtimeEndpointReset-DiTyBUwe.js} +5 -5
  89. package/dist/assets/{scheduledTasksApi-CKPLiwD-.js → scheduledTasksApi-Z7dc8sXS.js} +1 -1
  90. package/dist/assets/{shiki-CQYsk6Az.js → shiki-DW-V1SDr.js} +1 -1
  91. package/dist/assets/{space-apply-BT-PjBF5.js → space-apply-8YUOtYvk.js} +1 -1
  92. package/dist/assets/{space-close-C1Qs6EK6.js → space-close-D7zK_obq.js} +1 -1
  93. package/dist/assets/{spaceNetwork-C14OnxrT.js → spaceNetwork-XStNVwJo.js} +1 -1
  94. package/dist/assets/{stream-tokenizer-xdyY_PEd.js → stream-tokenizer-BfPOSMyw.js} +1 -1
  95. package/dist/assets/{textMateThemeFromAppTheme-CRhUx8P-.js → textMateThemeFromAppTheme-CVOJt2hL.js} +1 -1
  96. package/dist/assets/{tr-Cgg3eQb7.js → tr-CYfLfxAg.js} +1 -1
  97. package/dist/assets/{uk-zPAKOL1d.js → uk-Bm__l5YX.js} +1 -1
  98. package/dist/assets/{useAppFontEffects-D9nf8G19.js → useAppFontEffects-3RimJo4B.js} +15 -15
  99. package/dist/assets/{useBranchPullRequestRequest-CaGsp4wW.js → useBranchPullRequestRequest-CMvepZei.js} +1 -1
  100. package/dist/assets/{useCallableModelProviders-B1YBs2FN.js → useCallableModelProviders-DpMos2Hl.js} +1 -1
  101. package/dist/assets/{useDiffFindSurface-DiINVOLu.js → useDiffFindSurface-Dy5ZvPrH.js} +1 -1
  102. package/dist/assets/{useGitCleanLine-BK-o3SG6.js → useGitCleanLine-COG7MPwc.js} +1 -1
  103. package/dist/assets/{useInlineCommentController-CzeMiLCm.js → useInlineCommentController-_L6_JHZ6.js} +1 -1
  104. package/dist/assets/{useMarkdownLocalAssets-wPn7MXUN.js → useMarkdownLocalAssets-CH5Ekvbl.js} +1 -1
  105. package/dist/assets/{useRootScrollLock-BvsNFl90.js → useRootScrollLock-DdknBCBa.js} +2 -2
  106. package/dist/assets/{useWalkthroughReview-CEo_4ZLc.js → useWalkthroughReview-Bi8eB9_G.js} +1 -1
  107. package/dist/assets/{useWholeFileComment-BexRzYws.js → useWholeFileComment-CqHAJ2YU.js} +1 -1
  108. package/dist/assets/{useWorktreeArchiveActions-DaRx6tMV.js → useWorktreeArchiveActions-D1kaQEP9.js} +1 -1
  109. package/dist/assets/{vendor-codemirror-language-data-z3n6zAAT.js → vendor-codemirror-language-data-DRsX0PKK.js} +2 -2
  110. package/dist/assets/{zh-CN-BPcuR4-K.js → zh-CN-Db0Y0Ij-.js} +1 -1
  111. package/dist/assets/{zh-TW-CmPAjna9.js → zh-TW-CuzqmROB.js} +1 -1
  112. package/dist/index.html +2 -2
  113. package/dist/mini-chat.html +2 -2
  114. package/dist/mobile.html +2 -2
  115. package/package.json +3 -3
@@ -1,4 +1,4 @@
1
- import{R as l,r as fe,j as t,f as Kt}from"./vendor-react--VO_rL_p.js";import{u as lt,a0 as ot,hG as Bi,aW as Mi,he as Ur,A as x,I as H,a4 as rr,ha as ye,a5 as nr,br as xn,a6 as ir,aH as ar,aG as or,aC as lr,aD as cr,aE as ms,aF as hs,B as U,hH as Ti,hI as Ei,t as ft,q as gt,D as pt,l as xt,F as kt,y as Kr,n as qt,ac as gs,ad as ps,ae as xs,hJ as Ai,Q as pe,hK as Li,hL as Gi,hM as zi,g9 as Hi,gE as Ys,a7 as _i,dp as $i,hN as Wi,d8 as Ui,hO as Ki,hP as qi,hQ as Ji,hR as Yi,hS as Qi,hT as Xi,bt as Zi,bu as ea,bv as ta,bw as sa,bx as ra,C as na,o as sr,hU as ia,z as fs,hV as Se,hj as aa,hr as oa,hW as la,bR as ca,aO as ua,hX as da,hY as ma,cy as qr,hg as ha,bM as fa,bU as ga,bP as pa,hp as xa,fz as wa,hZ as ya,bQ as ba,h_ as va,hq as ja,gD as Ca,h$ as Sa,aN as Na,bS as ka,i0 as Va,cd as Qs,hi as Ra,ho as Ia,hl as Pa,as as cs,cf as Jr,ce as Yr,h5 as Fa,i1 as Da,V as Oa,i2 as Ba,b6 as Ma,bg as Ta,i3 as Qr,hh as Ea,cw as Aa,i4 as Xr,i5 as Xs,i6 as La,hx as Ga,hb as za,i7 as Ha,i8 as _a,i9 as $a,ia as Wa,ib as Zs,ic as Ua,hA as Ht,id as Zr}from"./useAppFontEffects-D9nf8G19.js";import{j as Ka,a_ as Ut,u as $t,c4 as qa,n as Ze,aX as mt}from"./katex.min-g52ii4Gs.js";import{u as en}from"./vendor-zustand-C9tWdk0j.js";import{L as Ja,P as Ya,O as Qa,as as Xa,at as Za,au as eo,av as to,aw as so,G as ro,N as no,ax as io,ay as ao,az as tn}from"./runtimeEndpointReset-BJm_77m2.js";import{n as oo}from"./main-QRYvDkRZ.js";import{u as lo,a as co,R as uo,I as mo,C as ho,b as fo,c as go,D as po}from"./useGitCleanLine-BK-o3SG6.js";import{P as xo,u as wo}from"./useBranchPullRequestRequest-CaGsp4wW.js";import{i as yo,O as bo}from"./OfficeDocumentDiff-DXsfJnFq.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-base-ui-CqKCZJyd.js";import"./vendor-floating-ui-utils-BzXdqYpP.js";import"./vendor-floating-ui-dom-WyXykhNi.js";import"./vendor-floating-ui-core-CXmKXOXc.js";import"./vendor-floating-ui-react-dom-Cy8dRGoy.js";import"./vendor-use-sync-external-store-CfLJGVyr.js";import"./vendor-zod--raI7LhK.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-dnd-kit-core-Br1Cs7RV.js";import"./vendor-dnd-kit-utilities-DZ9KbT5S.js";import"./vendor-dnd-kit-accessibility-CYclfhtC.js";import"./vendor-dnd-kit-sortable-DpfLEOLv.js";import"./vendor-tanstack-react-virtual-CqfECoM0.js";import"./vendor-tanstack-virtual-core-BdFnkr_2.js";import"./vendor-framer-motion-C_wK4GIM.js";import"./vendor-motion-dom-HXPOMxb7.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-capacitor-core-B4EWRrHz.js";import"./vendor-codemirror-commands-CjjsURR-.js";import"./vendor-codemirror-state-Cd8udR5z.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-view-Ciie9ey-.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-codemirror-language-8HZTPOnt.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CZEcqU6G.js";import"./vendor-codemirror-streamparser-CmlTsbN2.js";import"./vendor-codemirror-lang-javascript-DmqaSK_j.js";import"./vendor-lezer-javascript-CWSwshuO.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-BGedy2gC.js";import"./vendor-codemirror-lang-json-DVAYKmoO.js";import"./vendor-lezer-json-Cn1mncjr.js";import"./vendor-codemirror-lang-css-BLpgXfL2.js";import"./vendor-lezer-css-B2Hx_Nps.js";import"./vendor-codemirror-lang-html-S3jxr3Mo.js";import"./vendor-lezer-html-Cr8K5DGw.js";import"./vendor-codemirror-lang-markdown-D1jveRI5.js";import"./vendor-lezer-markdown-TQKzBB8i.js";import"./vendor-codemirror-language-data-z3n6zAAT.js";import"./vendor-codemirror-lang-python-B-5UC9Ui.js";import"./vendor-lezer-python-BUoImtUb.js";import"./vendor-sonner-Dw26OnzC.js";import"./vendor-cmdk-BtSpU-Io.js";import"./vendor-radix-ui-react-dialog-OIW6VLWw.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-D4RvEbuR.js";import"./vendor-radix-ui-react-context-BbFoxCHu.js";import"./vendor-radix-ui-react-id-aGag8i_5.js";import"./vendor-radix-ui-react-use-layout-effect-B1oLzD-j.js";import"./vendor-radix-ui-react-use-controllable-state-BjnNPGHq.js";import"./vendor-radix-ui-react-dismissable-layer-DpT6mMbO.js";import"./vendor-radix-ui-react-primitive-CrN9dRDb.js";import"./vendor-radix-ui-react-slot-BjbalUfz.js";import"./vendor-radix-ui-react-use-callback-ref-CcC_buIU.js";import"./vendor-radix-ui-react-use-escape-keydown-Cp1WWKTC.js";import"./vendor-radix-ui-react-focus-scope-D1noLHmd.js";import"./vendor-radix-ui-react-portal-BlUEzfrF.js";import"./vendor-radix-ui-react-presence-BGqFfiW4.js";import"./vendor-radix-ui-react-focus-guards-CSS2IbZC.js";import"./vendor-react-remove-scroll-Der_cv-1.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-Clwl9llp.js";import"./vendor-react-style-singleton-D_xJlTqU.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-BdLl6ZIw.js";import"./vendor-use-callback-ref-CXJF1lEr.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-legendapp-list-CEhBoV5L.js";import"./vendor-streamdown-BbSYZ3NF.js";import"./vendor-markdown-BTUqNk6W.js";import"./vendor-mdast-util-from-markdown-CZHjOE75.js";import"./vendor-micromark-util-decode-numeric-character-reference-CNs1qBpV.js";import"./vendor-micromark-util-decode-string-fHsnqYdj.js";import"./vendor-decode-named-character-reference-C3-224fz.js";import"./vendor-micromark-util-normalize-identifier-C9ANKk3v.js";import"./vendor-micromark-AWM-NZXP.js";import"./vendor-micromark-util-combine-extensions-d8XJZrgA.js";import"./vendor-micromark-util-chunked-DrRIdSP-.js";import"./vendor-micromark-factory-space-PzSHLgmq.js";import"./vendor-micromark-util-character-CW3Cu1MS.js";import"./vendor-micromark-core-commonmark-kzTLNXAm.js";import"./vendor-micromark-util-classify-character-tcLuZZwM.js";import"./vendor-micromark-util-resolve-all-PQCKh0dx.js";import"./vendor-micromark-util-subtokenize-BF1Jf29a.js";import"./vendor-micromark-factory-destination-Sj0xfi0V.js";import"./vendor-micromark-factory-label-amyP0HdC.js";import"./vendor-micromark-factory-title-khnLkZK6.js";import"./vendor-micromark-factory-whitespace-eIB00uTl.js";import"./vendor-micromark-util-html-tag-name-DbKNfynz.js";import"./vendor-unist-util-stringify-position-Ch_qCilz.js";import"./vendor-mdast-util-to-string-C_aolqmU.js";import"./vendor-unist-util-visit-DhPeCsfG.js";import"./vendor-unist-util-visit-parents-DlviEg7Z.js";import"./vendor-unist-util-is-BPZGFiMU.js";import"./vendor-hast-util-raw-DvvLJg15.js";import"./vendor-ungap-structured-clone--gfxRhYI.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-parse5-DwmzEj2o.js";import"./vendor-entities-wUUgTZDW.js";import"./vendor-web-namespaces-bsVAaBS1.js";import"./vendor-zwitch-C2o2j-tx.js";import"./vendor-unist-util-position-60F3QETU.js";import"./vendor-hast-util-from-parse5-Ba3T6RJI.js";import"./vendor-devlop-0Dp3JUBc.js";import"./vendor-property-information-Boo8Xpef.js";import"./vendor-hastscript-BrPNioaz.js";import"./vendor-comma-separated-tokens-CRUGqg4f.js";import"./vendor-space-separated-tokens-D7QSIrTI.js";import"./vendor-hast-util-parse-selector-TXfch5wI.js";import"./vendor-vfile-location-LfEFwJ2h.js";import"./vendor-hast-util-to-parse5-BoysVIPW.js";import"./vendor-hast-util-sanitize-2aGO5ay8.js";import"./vendor-micromark-extension-gfm-CsfPlnlB.js";import"./vendor-micromark-extension-gfm-autolink-literal-BYug7onl.js";import"./vendor-micromark-extension-gfm-footnote-OFl1FCH2.js";import"./vendor-micromark-extension-gfm-strikethrough-CyFiuwBf.js";import"./vendor-micromark-extension-gfm-table-dgw4LfUw.js";import"./vendor-micromark-extension-gfm-task-list-item-Dnadzr9U.js";import"./vendor-mdast-util-gfm-CroMDYLM.js";import"./vendor-mdast-util-gfm-autolink-literal-CTruMtvI.js";import"./vendor-ccount-c2V3InAJ.js";import"./vendor-mdast-util-find-and-replace-DB9iC-bx.js";import"./vendor-escape-string-regexp-BaJN9MlJ.js";import"./vendor-mdast-util-gfm-footnote-C-csI7OF.js";import"./vendor-mdast-util-gfm-strikethrough-BcskTdio.js";import"./vendor-mdast-util-gfm-table-DhPwQIyj.js";import"./vendor-markdown-table-DvhhVmnL.js";import"./vendor-mdast-util-to-markdown-Cl3qaiyc.js";import"./vendor-longest-streak-CtXnX3Xp.js";import"./vendor-mdast-util-phrasing-4oVbNLC3.js";import"./vendor-mdast-util-gfm-task-list-item-DMU5mK_M.js";import"./vendor-mdast-util-to-hast-CWnLaQSO.js";import"./vendor-micromark-util-sanitize-uri-BbwQ7CLk.js";import"./vendor-trim-lines-D8znQY54.js";import"./vendor-micromark-extension-cjk-friendly-BzZDGrF5.js";import"./vendor-micromark-extension-cjk-friendly-util-D5lVNoxW.js";import"./vendor-get-east-asian-width-CPhS2cOv.js";import"./vendor-micromark-util-symbol-JJPacVTp.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-BZ3pe_qd.js";import"./vendor-micromark-extension-cjk-friendly-gfm-strikethrough-CqW-Ep4M.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-gfm-strikethrough-BdPDQFO7.js";import"./vendor-hast-util-from-html-isomorphic-B0Kn01s9.js";import"./vendor-hast-util-from-dom-DeNf9aYW.js";import"./vendor-katex-DBqql0K7.js";import"./vendor-hast-util-to-text-0GXLnBvt.js";import"./vendor-hast-util-is-element-CuOmiqQi.js";import"./vendor-unist-util-find-after-CMaZmLxc.js";import"./vendor-micromark-extension-math-BRFoDziv.js";import"./vendor-mdast-util-math-wB-IJCL0.js";import"./vendor-remend-r8cP_t-e.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-marked-DN3zOnEe.js";import"./vendor-hast-util-to-jsx-runtime-Bq6JeJCx.js";import"./vendor-style-to-js-CI2G4dgu.js";import"./vendor-style-to-object-BAv4SQXc.js";import"./vendor-inline-style-parser-BlqBsVO4.js";import"./vendor-hast-util-whitespace-D4Wp6AEg.js";import"./vendor-estree-util-is-identifier-name-BgBfM8ME.js";import"./vendor-vfile-message-DqhD22jI.js";import"./vendor-unified-1CQKw2_w.js";import"./vendor-bail-FqpXQuLt.js";import"./vendor-extend-B94qxKr5.js";import"./vendor-is-plain-obj-C1gvLhAf.js";import"./vendor-trough-B_b8ryxu.js";import"./vendor-vfile-BCWrK60u.js";import"./vendor-html-url-attributes-D46m5wfe.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./vendor-opencode-client-CeybcDBQ.js";import"./vendor-fuse.js-Dw8P0qyA.js";import"./space-apply-BT-PjBF5.js";import"./useRootScrollLock-BvsNFl90.js";import"./moveWorkspacePath-C4_JgpNC.js";import"./contextFileOpenGuard-CKnYjgFC.js";import"./install-request-C-zhz88k.js";import"./ChangedPathLabel-CQOXgkIF.js";import"./parseDiffFromFile-CD1h9Yf5.js";import"./computeVirtualFileMetrics-DVynfSBh.js";import"./themeResolver-DXizngAV.js";import"./vendor-pierre-theming-D_TRfu0q.js";import"./hastToHtml-BHV14OWE.js";import"./vendor-hast-util-to-html-Jw3IXh58.js";import"./vendor-stringify-entities-CsH1VEn9.js";import"./vendor-character-entities-legacy-BpoLgcEt.js";import"./vendor-character-entities-html4-D7taRCQ7.js";import"./vendor-diff-C3JhlQdm.js";import"./isDiffPlainText-DpcjRlB-.js";import"./getFiletypeFromFileName-BgI9McTw.js";import"./pierreDiffTint-Cg024Eeg.js";import"./ReviewCards-CU1YHZkQ.js";import"./useInlineCommentController-CzeMiLCm.js";import"./appThemeRegistry-BwyM6n38.js";import"./textMateThemeFromAppTheme-CRhUx8P-.js";import"./diffsHighlighter-BsxkaI3Q.js";import"./document-attachments-CIZjaOGe.js";import"./vendor-fflate-DB4_FQr-.js";import"./documentClient-B0iRikhq.js";const wn="gitmojiCache",vo=1e3*60*60*24*7,yn="1",jo="https://raw.githubusercontent.com/carloscuesta/gitmoji/master/packages/gitmojis/src/gitmojis.json",bn=o=>{if(!o||typeof o!="object")return!1;const e=o;return typeof e.emoji=="string"&&typeof e.code=="string"&&typeof e.description=="string"},er=()=>{if(typeof window>"u")return null;try{const o=window.localStorage.getItem(wn);if(!o)return null;const e=JSON.parse(o);return!e||e.version!==yn||typeof e.fetchedAt!="number"||!Array.isArray(e.gitmojis)?null:{gitmojis:e.gitmojis.filter(bn),fetchedAt:e.fetchedAt,version:e.version}}catch{return null}},Co=o=>{if(!(typeof window>"u"))try{const e={gitmojis:o,fetchedAt:Date.now(),version:yn};window.localStorage.setItem(wn,JSON.stringify(e))}catch{return}},sn=o=>Date.now()-o.fetchedAt<vo;let us=null;const Wt=new Set,rn=async()=>{if(us)return us;const o=(async()=>{try{const e=await fetch(jo);if(!e.ok)throw new Error(`Failed to load gitmojis: ${e.statusText}`);const h=await e.json(),r=Array.isArray(h.gitmojis)?h.gitmojis.filter(bn):[];return Co(r),Wt.forEach(a=>a(r)),r}catch(e){console.warn("Failed to load gitmoji list:",e);const h=[];return Wt.forEach(r=>r(h)),h}finally{us=null}})();return us=o,o},So=o=>{const[e,h]=l.useState(()=>o?er()?.gitmojis??[]:[]),[r,a]=l.useState(!1),p=l.useRef(o);p.current=o,l.useEffect(()=>{if(!o){Wt.delete(h),h([]),a(!1);return}const y=er();if(y&&(h(y.gitmojis),sn(y)))return;Wt.add(h),a(!0);let f=!1;return rn().finally(()=>{!f&&p.current&&a(!1)}),()=>{f=!0,Wt.delete(h)}},[o]);const w=l.useCallback(async()=>{if(!p.current)return[];if(e.length>0)return e;const y=er();return y&&sn(y)?y.gitmojis:rn()},[e]);return{gitmojis:e,isLoading:r,ensureLoaded:w}},Vt=async(o,e)=>{const h=await Ka(`/api/git/integrate/${o}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!h.ok){const r=await h.json().catch(()=>null);throw new Error(r?.error||`Git integrate request failed: ${h.statusText}`)}return h.json()};async function _t(o){return Vt("plan",o)}async function No(o){return Vt("conflict-details",{tempWorktreePath:o})}async function ko(o){return(await Vt("cherry-pick-status",{tempWorktreePath:o})).inProgress}async function Vo(o){return Vt("run",{plan:o})}async function Ro(o){await Vt("abort",{state:o})}async function Io(o){return Vt("continue",{state:o})}const Po=({repoRoot:o,sourceBranch:e,worktreeMetadata:h,localBranches:r,defaultTargetBranch:a,refreshKey:p,onRefresh:w,showHeader:y=!0})=>{const{t:f}=lt(),g=ot(m=>m.currentSessionId),[M,T]=fe.useState(!1),[b,G]=fe.useState(""),j=fe.useRef(null),E=fe.useMemo(()=>Ut(r,b,m=>[m]),[r,b]),[P,v]=fe.useState(a);fe.useEffect(()=>{v(a)},[a]),fe.useEffect(()=>{if(M){const m=setTimeout(()=>{j.current?.focus()},0);return()=>clearTimeout(m)}},[M]);const W=!!(o&&e&&P&&P!=="HEAD"&&e!==P),[N,D]=fe.useState({kind:"idle"}),[k,F]=fe.useState(!1),[_,q]=fe.useState([]),A=fe.useMemo(()=>g?`openchamber.integrate.conflict:${g}`:null,[g]);fe.useEffect(()=>{if(!A||typeof window>"u")return;const m=window.localStorage.getItem(A);if(!m)return;let u=!1;try{const I=JSON.parse(m);if(!I?.tempWorktreePath||I.repoRoot!==o){window.localStorage.removeItem(A);return}(async()=>{const O=await ko(I.tempWorktreePath).catch(()=>!1);if(u)return;if(!O){window.localStorage.removeItem(A);return}const J=await No(I.tempWorktreePath).catch(()=>null);u||J&&D({kind:"conflict",state:I,details:J})})()}catch{window.localStorage.removeItem(A)}return()=>{u=!0}},[A,o]),fe.useEffect(()=>{if(!W){D({kind:"idle"});return}let m=!1;return D({kind:"loading"}),(async()=>{try{const u=await _t({repoRoot:o,sourceBranch:e,targetBranch:P});if(m)return;if(D({kind:"ready",plan:u}),u.commits.length>0){const O=u.commits.slice(-50).reverse(),J=await Bi(o,O);m||(q(J),F(!1))}else m||(q([]),F(!1))}catch{m||D({kind:"idle"})}})(),()=>{m=!0}},[W,o,e,P,p]);const V=fe.useCallback(m=>{g&&ot.getState().setWorktreeMetadata(g,{...h,createdFromBranch:m})},[g,h]),L=ot(m=>m.openNewSessionDraft),te=fe.useCallback(async m=>{const u=await Mi(m.state.repoRoot),I=u.render("git.integrate.cherrypick.resolve.visible",{current_commit:m.state.currentCommit,target_branch:m.state.targetBranch}),O=u.render("git.integrate.cherrypick.resolve.instructions",{repo_root:m.state.repoRoot,temp_worktree_path:m.state.tempWorktreePath,source_branch:m.state.sourceBranch,target_branch:m.state.targetBranch,current_commit:m.state.currentCommit}),J=`Cherry-pick conflict context (JSON)
1
+ import{R as l,r as fe,j as t,f as Kt}from"./vendor-react--VO_rL_p.js";import{u as lt,a0 as ot,hG as Bi,aW as Mi,he as Ur,A as x,I as H,a4 as rr,ha as ye,a5 as nr,br as xn,a6 as ir,aH as ar,aG as or,aC as lr,aD as cr,aE as ms,aF as hs,B as U,hH as Ti,hI as Ei,t as ft,q as gt,D as pt,l as xt,F as kt,y as Kr,n as qt,ac as gs,ad as ps,ae as xs,hJ as Ai,Q as pe,hK as Li,hL as Gi,hM as zi,g9 as Hi,gE as Ys,a7 as _i,dp as $i,hN as Wi,d8 as Ui,hO as Ki,hP as qi,hQ as Ji,hR as Yi,hS as Qi,hT as Xi,bt as Zi,bu as ea,bv as ta,bw as sa,bx as ra,C as na,o as sr,hU as ia,z as fs,hV as Se,hj as aa,hr as oa,hW as la,bR as ca,aO as ua,hX as da,hY as ma,cy as qr,hg as ha,bM as fa,bU as ga,bP as pa,hp as xa,fz as wa,hZ as ya,bQ as ba,h_ as va,hq as ja,gD as Ca,h$ as Sa,aN as Na,bS as ka,i0 as Va,cd as Qs,hi as Ra,ho as Ia,hl as Pa,as as cs,cf as Jr,ce as Yr,h5 as Fa,i1 as Da,V as Oa,i2 as Ba,b6 as Ma,bg as Ta,i3 as Qr,hh as Ea,cw as Aa,i4 as Xr,i5 as Xs,i6 as La,hx as Ga,hb as za,i7 as Ha,i8 as _a,i9 as $a,ia as Wa,ib as Zs,ic as Ua,hA as Ht,id as Zr}from"./useAppFontEffects-3RimJo4B.js";import{j as Ka,a_ as Ut,u as $t,c4 as qa,n as Ze,aX as mt}from"./katex.min-Bs5OLoA1.js";import{u as en}from"./vendor-zustand-C9tWdk0j.js";import{L as Ja,P as Ya,O as Qa,as as Xa,at as Za,au as eo,av as to,aw as so,G as ro,N as no,ax as io,ay as ao,az as tn}from"./runtimeEndpointReset-DiTyBUwe.js";import{n as oo}from"./main-064y5MQB.js";import{u as lo,a as co,R as uo,I as mo,C as ho,b as fo,c as go,D as po}from"./useGitCleanLine-COG7MPwc.js";import{P as xo,u as wo}from"./useBranchPullRequestRequest-CMvepZei.js";import{i as yo,O as bo}from"./OfficeDocumentDiff-BFr4rAHy.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-base-ui-CqKCZJyd.js";import"./vendor-floating-ui-utils-BzXdqYpP.js";import"./vendor-floating-ui-dom-WyXykhNi.js";import"./vendor-floating-ui-core-CXmKXOXc.js";import"./vendor-floating-ui-react-dom-Cy8dRGoy.js";import"./vendor-use-sync-external-store-CfLJGVyr.js";import"./vendor-zod--raI7LhK.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-dnd-kit-core-Br1Cs7RV.js";import"./vendor-dnd-kit-utilities-DZ9KbT5S.js";import"./vendor-dnd-kit-accessibility-CYclfhtC.js";import"./vendor-dnd-kit-sortable-DpfLEOLv.js";import"./vendor-tanstack-react-virtual-CqfECoM0.js";import"./vendor-tanstack-virtual-core-BdFnkr_2.js";import"./vendor-framer-motion-C_wK4GIM.js";import"./vendor-motion-dom-HXPOMxb7.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-capacitor-core-B4EWRrHz.js";import"./vendor-codemirror-commands-CjjsURR-.js";import"./vendor-codemirror-state-Cd8udR5z.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-view-Ciie9ey-.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-codemirror-language-8HZTPOnt.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CZEcqU6G.js";import"./vendor-codemirror-streamparser-CmlTsbN2.js";import"./vendor-codemirror-lang-javascript-DmqaSK_j.js";import"./vendor-lezer-javascript-CWSwshuO.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-BGedy2gC.js";import"./vendor-codemirror-lang-json-DVAYKmoO.js";import"./vendor-lezer-json-Cn1mncjr.js";import"./vendor-codemirror-lang-css-BLpgXfL2.js";import"./vendor-lezer-css-B2Hx_Nps.js";import"./vendor-codemirror-lang-html-S3jxr3Mo.js";import"./vendor-lezer-html-Cr8K5DGw.js";import"./vendor-codemirror-lang-markdown-D1jveRI5.js";import"./vendor-lezer-markdown-TQKzBB8i.js";import"./vendor-codemirror-language-data-DRsX0PKK.js";import"./vendor-codemirror-lang-python-B-5UC9Ui.js";import"./vendor-lezer-python-BUoImtUb.js";import"./vendor-sonner-Dw26OnzC.js";import"./vendor-cmdk-BtSpU-Io.js";import"./vendor-radix-ui-react-dialog-OIW6VLWw.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-D4RvEbuR.js";import"./vendor-radix-ui-react-context-BbFoxCHu.js";import"./vendor-radix-ui-react-id-aGag8i_5.js";import"./vendor-radix-ui-react-use-layout-effect-B1oLzD-j.js";import"./vendor-radix-ui-react-use-controllable-state-BjnNPGHq.js";import"./vendor-radix-ui-react-dismissable-layer-DpT6mMbO.js";import"./vendor-radix-ui-react-primitive-CrN9dRDb.js";import"./vendor-radix-ui-react-slot-BjbalUfz.js";import"./vendor-radix-ui-react-use-callback-ref-CcC_buIU.js";import"./vendor-radix-ui-react-use-escape-keydown-Cp1WWKTC.js";import"./vendor-radix-ui-react-focus-scope-D1noLHmd.js";import"./vendor-radix-ui-react-portal-BlUEzfrF.js";import"./vendor-radix-ui-react-presence-BGqFfiW4.js";import"./vendor-radix-ui-react-focus-guards-CSS2IbZC.js";import"./vendor-react-remove-scroll-Der_cv-1.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-Clwl9llp.js";import"./vendor-react-style-singleton-D_xJlTqU.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-BdLl6ZIw.js";import"./vendor-use-callback-ref-CXJF1lEr.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-legendapp-list-CEhBoV5L.js";import"./vendor-streamdown-BbSYZ3NF.js";import"./vendor-markdown-BTUqNk6W.js";import"./vendor-mdast-util-from-markdown-CZHjOE75.js";import"./vendor-micromark-util-decode-numeric-character-reference-CNs1qBpV.js";import"./vendor-micromark-util-decode-string-fHsnqYdj.js";import"./vendor-decode-named-character-reference-C3-224fz.js";import"./vendor-micromark-util-normalize-identifier-C9ANKk3v.js";import"./vendor-micromark-AWM-NZXP.js";import"./vendor-micromark-util-combine-extensions-d8XJZrgA.js";import"./vendor-micromark-util-chunked-DrRIdSP-.js";import"./vendor-micromark-factory-space-PzSHLgmq.js";import"./vendor-micromark-util-character-CW3Cu1MS.js";import"./vendor-micromark-core-commonmark-kzTLNXAm.js";import"./vendor-micromark-util-classify-character-tcLuZZwM.js";import"./vendor-micromark-util-resolve-all-PQCKh0dx.js";import"./vendor-micromark-util-subtokenize-BF1Jf29a.js";import"./vendor-micromark-factory-destination-Sj0xfi0V.js";import"./vendor-micromark-factory-label-amyP0HdC.js";import"./vendor-micromark-factory-title-khnLkZK6.js";import"./vendor-micromark-factory-whitespace-eIB00uTl.js";import"./vendor-micromark-util-html-tag-name-DbKNfynz.js";import"./vendor-unist-util-stringify-position-Ch_qCilz.js";import"./vendor-mdast-util-to-string-C_aolqmU.js";import"./vendor-unist-util-visit-DhPeCsfG.js";import"./vendor-unist-util-visit-parents-DlviEg7Z.js";import"./vendor-unist-util-is-BPZGFiMU.js";import"./vendor-hast-util-raw-DvvLJg15.js";import"./vendor-ungap-structured-clone--gfxRhYI.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-parse5-DwmzEj2o.js";import"./vendor-entities-wUUgTZDW.js";import"./vendor-web-namespaces-bsVAaBS1.js";import"./vendor-zwitch-C2o2j-tx.js";import"./vendor-unist-util-position-60F3QETU.js";import"./vendor-hast-util-from-parse5-Ba3T6RJI.js";import"./vendor-devlop-0Dp3JUBc.js";import"./vendor-property-information-Boo8Xpef.js";import"./vendor-hastscript-BrPNioaz.js";import"./vendor-comma-separated-tokens-CRUGqg4f.js";import"./vendor-space-separated-tokens-D7QSIrTI.js";import"./vendor-hast-util-parse-selector-TXfch5wI.js";import"./vendor-vfile-location-LfEFwJ2h.js";import"./vendor-hast-util-to-parse5-BoysVIPW.js";import"./vendor-hast-util-sanitize-2aGO5ay8.js";import"./vendor-micromark-extension-gfm-CsfPlnlB.js";import"./vendor-micromark-extension-gfm-autolink-literal-BYug7onl.js";import"./vendor-micromark-extension-gfm-footnote-OFl1FCH2.js";import"./vendor-micromark-extension-gfm-strikethrough-CyFiuwBf.js";import"./vendor-micromark-extension-gfm-table-dgw4LfUw.js";import"./vendor-micromark-extension-gfm-task-list-item-Dnadzr9U.js";import"./vendor-mdast-util-gfm-CroMDYLM.js";import"./vendor-mdast-util-gfm-autolink-literal-CTruMtvI.js";import"./vendor-ccount-c2V3InAJ.js";import"./vendor-mdast-util-find-and-replace-DB9iC-bx.js";import"./vendor-escape-string-regexp-BaJN9MlJ.js";import"./vendor-mdast-util-gfm-footnote-C-csI7OF.js";import"./vendor-mdast-util-gfm-strikethrough-BcskTdio.js";import"./vendor-mdast-util-gfm-table-DhPwQIyj.js";import"./vendor-markdown-table-DvhhVmnL.js";import"./vendor-mdast-util-to-markdown-Cl3qaiyc.js";import"./vendor-longest-streak-CtXnX3Xp.js";import"./vendor-mdast-util-phrasing-4oVbNLC3.js";import"./vendor-mdast-util-gfm-task-list-item-DMU5mK_M.js";import"./vendor-mdast-util-to-hast-CWnLaQSO.js";import"./vendor-micromark-util-sanitize-uri-BbwQ7CLk.js";import"./vendor-trim-lines-D8znQY54.js";import"./vendor-micromark-extension-cjk-friendly-BzZDGrF5.js";import"./vendor-micromark-extension-cjk-friendly-util-D5lVNoxW.js";import"./vendor-get-east-asian-width-CPhS2cOv.js";import"./vendor-micromark-util-symbol-JJPacVTp.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-BZ3pe_qd.js";import"./vendor-micromark-extension-cjk-friendly-gfm-strikethrough-CqW-Ep4M.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-gfm-strikethrough-BdPDQFO7.js";import"./vendor-hast-util-from-html-isomorphic-B0Kn01s9.js";import"./vendor-hast-util-from-dom-DeNf9aYW.js";import"./vendor-katex-DBqql0K7.js";import"./vendor-hast-util-to-text-0GXLnBvt.js";import"./vendor-hast-util-is-element-CuOmiqQi.js";import"./vendor-unist-util-find-after-CMaZmLxc.js";import"./vendor-micromark-extension-math-BRFoDziv.js";import"./vendor-mdast-util-math-wB-IJCL0.js";import"./vendor-remend-r8cP_t-e.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-marked-DN3zOnEe.js";import"./vendor-hast-util-to-jsx-runtime-Bq6JeJCx.js";import"./vendor-style-to-js-CI2G4dgu.js";import"./vendor-style-to-object-BAv4SQXc.js";import"./vendor-inline-style-parser-BlqBsVO4.js";import"./vendor-hast-util-whitespace-D4Wp6AEg.js";import"./vendor-estree-util-is-identifier-name-BgBfM8ME.js";import"./vendor-vfile-message-DqhD22jI.js";import"./vendor-unified-1CQKw2_w.js";import"./vendor-bail-FqpXQuLt.js";import"./vendor-extend-B94qxKr5.js";import"./vendor-is-plain-obj-C1gvLhAf.js";import"./vendor-trough-B_b8ryxu.js";import"./vendor-vfile-BCWrK60u.js";import"./vendor-html-url-attributes-D46m5wfe.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./vendor-opencode-client-CeybcDBQ.js";import"./vendor-fuse.js-Dw8P0qyA.js";import"./space-apply-8YUOtYvk.js";import"./useRootScrollLock-DdknBCBa.js";import"./moveWorkspacePath-BaEfuU4S.js";import"./contextFileOpenGuard-BC79wuu1.js";import"./install-request-EHX4ORhb.js";import"./ChangedPathLabel-CCsE-8p4.js";import"./parseDiffFromFile-By5H8w4y.js";import"./computeVirtualFileMetrics-DVfKKHny.js";import"./themeResolver-DXizngAV.js";import"./vendor-pierre-theming-D_TRfu0q.js";import"./hastToHtml-BHV14OWE.js";import"./vendor-hast-util-to-html-Jw3IXh58.js";import"./vendor-stringify-entities-CsH1VEn9.js";import"./vendor-character-entities-legacy-BpoLgcEt.js";import"./vendor-character-entities-html4-D7taRCQ7.js";import"./vendor-diff-C3JhlQdm.js";import"./isDiffPlainText-saKoOWJx.js";import"./getFiletypeFromFileName-BgI9McTw.js";import"./pierreDiffTint-CVm_qZm-.js";import"./ReviewCards-BkpTYy_a.js";import"./useInlineCommentController-_L6_JHZ6.js";import"./appThemeRegistry-DYzVI9tX.js";import"./textMateThemeFromAppTheme-CVOJt2hL.js";import"./diffsHighlighter-BsxkaI3Q.js";import"./document-attachments-CIZjaOGe.js";import"./vendor-fflate-DB4_FQr-.js";import"./documentClient-JcxJ7vyh.js";const wn="gitmojiCache",vo=1e3*60*60*24*7,yn="1",jo="https://raw.githubusercontent.com/carloscuesta/gitmoji/master/packages/gitmojis/src/gitmojis.json",bn=o=>{if(!o||typeof o!="object")return!1;const e=o;return typeof e.emoji=="string"&&typeof e.code=="string"&&typeof e.description=="string"},er=()=>{if(typeof window>"u")return null;try{const o=window.localStorage.getItem(wn);if(!o)return null;const e=JSON.parse(o);return!e||e.version!==yn||typeof e.fetchedAt!="number"||!Array.isArray(e.gitmojis)?null:{gitmojis:e.gitmojis.filter(bn),fetchedAt:e.fetchedAt,version:e.version}}catch{return null}},Co=o=>{if(!(typeof window>"u"))try{const e={gitmojis:o,fetchedAt:Date.now(),version:yn};window.localStorage.setItem(wn,JSON.stringify(e))}catch{return}},sn=o=>Date.now()-o.fetchedAt<vo;let us=null;const Wt=new Set,rn=async()=>{if(us)return us;const o=(async()=>{try{const e=await fetch(jo);if(!e.ok)throw new Error(`Failed to load gitmojis: ${e.statusText}`);const h=await e.json(),r=Array.isArray(h.gitmojis)?h.gitmojis.filter(bn):[];return Co(r),Wt.forEach(a=>a(r)),r}catch(e){console.warn("Failed to load gitmoji list:",e);const h=[];return Wt.forEach(r=>r(h)),h}finally{us=null}})();return us=o,o},So=o=>{const[e,h]=l.useState(()=>o?er()?.gitmojis??[]:[]),[r,a]=l.useState(!1),p=l.useRef(o);p.current=o,l.useEffect(()=>{if(!o){Wt.delete(h),h([]),a(!1);return}const y=er();if(y&&(h(y.gitmojis),sn(y)))return;Wt.add(h),a(!0);let f=!1;return rn().finally(()=>{!f&&p.current&&a(!1)}),()=>{f=!0,Wt.delete(h)}},[o]);const w=l.useCallback(async()=>{if(!p.current)return[];if(e.length>0)return e;const y=er();return y&&sn(y)?y.gitmojis:rn()},[e]);return{gitmojis:e,isLoading:r,ensureLoaded:w}},Vt=async(o,e)=>{const h=await Ka(`/api/git/integrate/${o}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!h.ok){const r=await h.json().catch(()=>null);throw new Error(r?.error||`Git integrate request failed: ${h.statusText}`)}return h.json()};async function _t(o){return Vt("plan",o)}async function No(o){return Vt("conflict-details",{tempWorktreePath:o})}async function ko(o){return(await Vt("cherry-pick-status",{tempWorktreePath:o})).inProgress}async function Vo(o){return Vt("run",{plan:o})}async function Ro(o){await Vt("abort",{state:o})}async function Io(o){return Vt("continue",{state:o})}const Po=({repoRoot:o,sourceBranch:e,worktreeMetadata:h,localBranches:r,defaultTargetBranch:a,refreshKey:p,onRefresh:w,showHeader:y=!0})=>{const{t:f}=lt(),g=ot(m=>m.currentSessionId),[M,T]=fe.useState(!1),[b,G]=fe.useState(""),j=fe.useRef(null),E=fe.useMemo(()=>Ut(r,b,m=>[m]),[r,b]),[P,v]=fe.useState(a);fe.useEffect(()=>{v(a)},[a]),fe.useEffect(()=>{if(M){const m=setTimeout(()=>{j.current?.focus()},0);return()=>clearTimeout(m)}},[M]);const W=!!(o&&e&&P&&P!=="HEAD"&&e!==P),[N,D]=fe.useState({kind:"idle"}),[k,F]=fe.useState(!1),[_,q]=fe.useState([]),A=fe.useMemo(()=>g?`openchamber.integrate.conflict:${g}`:null,[g]);fe.useEffect(()=>{if(!A||typeof window>"u")return;const m=window.localStorage.getItem(A);if(!m)return;let u=!1;try{const I=JSON.parse(m);if(!I?.tempWorktreePath||I.repoRoot!==o){window.localStorage.removeItem(A);return}(async()=>{const O=await ko(I.tempWorktreePath).catch(()=>!1);if(u)return;if(!O){window.localStorage.removeItem(A);return}const J=await No(I.tempWorktreePath).catch(()=>null);u||J&&D({kind:"conflict",state:I,details:J})})()}catch{window.localStorage.removeItem(A)}return()=>{u=!0}},[A,o]),fe.useEffect(()=>{if(!W){D({kind:"idle"});return}let m=!1;return D({kind:"loading"}),(async()=>{try{const u=await _t({repoRoot:o,sourceBranch:e,targetBranch:P});if(m)return;if(D({kind:"ready",plan:u}),u.commits.length>0){const O=u.commits.slice(-50).reverse(),J=await Bi(o,O);m||(q(J),F(!1))}else m||(q([]),F(!1))}catch{m||D({kind:"idle"})}})(),()=>{m=!0}},[W,o,e,P,p]);const V=fe.useCallback(m=>{g&&ot.getState().setWorktreeMetadata(g,{...h,createdFromBranch:m})},[g,h]),L=ot(m=>m.openNewSessionDraft),te=fe.useCallback(async m=>{const u=await Mi(m.state.repoRoot),I=u.render("git.integrate.cherrypick.resolve.visible",{current_commit:m.state.currentCommit,target_branch:m.state.targetBranch}),O=u.render("git.integrate.cherrypick.resolve.instructions",{repo_root:m.state.repoRoot,temp_worktree_path:m.state.tempWorktreePath,source_branch:m.state.sourceBranch,target_branch:m.state.targetBranch,current_commit:m.state.currentCommit}),J=`Cherry-pick conflict context (JSON)
2
2
  ${JSON.stringify({repoRoot:m.state.repoRoot,tempWorktreePath:m.state.tempWorktreePath,sourceBranch:m.state.sourceBranch,targetBranch:m.state.targetBranch,currentCommit:m.state.currentCommit,remainingCommits:m.state.remainingCommits,statusPorcelain:m.details.statusPorcelain,unmergedFiles:m.details.unmergedFiles,currentPatchMeta:m.details.currentPatchMeta,currentPatch:m.details.currentPatch,diff:m.details.diff},null,2)}`;return{visibleText:I,instructionsText:O,payloadText:J}},[]),K=Ur(m=>m.setPendingInputText),n=Ur(m=>m.setPendingSyntheticParts),se=fe.useCallback(async(m,u)=>{let I;try{I=await te(m)}catch(O){x.error(f("magicPrompts.toast.loadFailed"),{description:O instanceof Error?O.message:void 0});return}if(u){L({directoryOverride:m.state.tempWorktreePath,initialPrompt:I.visibleText,syntheticParts:[{text:I.instructionsText,synthetic:!0},{text:I.payloadText,synthetic:!0}]});return}if(!g){x.error(f("gitView.integrate.noActiveSession"),{description:f("gitView.integrate.noActiveSessionDescription")});return}K(I.visibleText,"replace"),n([{text:I.instructionsText,synthetic:!0},{text:I.payloadText,synthetic:!0}])},[g,te,L,K,n,f]),le=fe.useCallback(async()=>{if(N.kind==="ready"){if(N.plan.commits.length===0){x.message(f("gitView.integrate.noCommitsToMoveToast"));return}D({kind:"running",plan:N.plan});try{const m=await Vo(N.plan);if(m.kind==="success"){x.success(f("gitView.integrate.commitsMovedToast"),{description:m.moved===1?f("gitView.integrate.commitsMovedDescriptionSingle",{count:m.moved,branch:N.plan.targetBranch}):f("gitView.integrate.commitsMovedDescriptionPlural",{count:m.moved,branch:N.plan.targetBranch})});const u=await _t(N.plan);D({kind:"ready",plan:u}),w?.();return}m.kind==="conflict"&&(x.error(f("gitView.integrate.cherryPickConflictToast"),{description:f("gitView.integrate.cherryPickConflictDescription")}),D({kind:"conflict",state:m.state,details:m.details}),A&&typeof window<"u"&&window.localStorage.setItem(A,JSON.stringify(m.state)))}catch(m){const u=m instanceof Error?m.message:String(m);x.error(f("gitView.integrate.failedToMoveToast"),{description:u});const I=await _t({repoRoot:o,sourceBranch:e,targetBranch:P}).catch(()=>null);D(I?{kind:"ready",plan:I}:{kind:"idle"})}}},[N,w,o,e,P,A,f]),X=fe.useCallback(async()=>{if(N.kind==="conflict")try{await Ro(N.state),x.message(f("gitView.integrate.cherryPickAbortedToast")),A&&typeof window<"u"&&window.localStorage.removeItem(A)}finally{const m=await _t({repoRoot:o,sourceBranch:e,targetBranch:P}).catch(()=>null);D(m?{kind:"ready",plan:m}:{kind:"idle"})}},[N,o,e,P,A,f]),re=fe.useCallback(async()=>{if(N.kind==="conflict")try{const m=await Io(N.state);if(m.kind==="success"){x.success(f("gitView.integrate.cherryPickFinishedToast"));const u=await _t({repoRoot:o,sourceBranch:e,targetBranch:P}).catch(()=>null);D(u?{kind:"ready",plan:u}:{kind:"idle"}),A&&typeof window<"u"&&window.localStorage.removeItem(A),w?.();return}m.kind==="conflict"&&(D({kind:"conflict",state:m.state,details:m.details}),A&&typeof window<"u"&&window.localStorage.setItem(A,JSON.stringify(m.state)))}catch(m){const u=m instanceof Error?m.message:String(m);x.error(f("gitView.integrate.cherryPickContinueFailedToast"),{description:u})}},[N,o,e,P,w,A,f]);return!o||!e?null:t.jsxs("section",{className:"border-0 bg-transparent rounded-none",children:[y?t.jsxs("div",{className:"px-0 py-3 border-b border-edge-muted flex items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx(H,{name:"split-cells-horizontal",className:"size-4 text-muted-foreground"}),t.jsx("h3",{className:"typography-ui-header font-semibold text-foreground truncate",children:f("gitView.integrate.title")}),N.kind==="ready"&&N.plan.commits.length>0?t.jsx("span",{className:"typography-meta text-muted-foreground truncate",children:f("gitView.integrate.toMoveCount",{count:N.plan.commits.length})}):null]}),t.jsx("div",{className:"flex items-center gap-2",children:N.kind==="loading"||N.kind==="running"?t.jsx(H,{name:"loader-4",className:"size-4 animate-spin text-muted-foreground"}):null})]}):null,t.jsxs("div",{className:"flex flex-col gap-3 py-3",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"typography-ui-label text-foreground",children:f("gitView.integrate.moveCommits")}),t.jsxs("div",{className:"typography-micro text-muted-foreground truncate",children:[e," → ",P]})]}),t.jsx("div",{className:"flex-1"}),t.jsxs(rr,{open:M,onOpenChange:T,children:[t.jsx(ye,{sideOffset:8,label:f("contextTooltips.git.integrateTarget"),children:t.jsx(nr,{asChild:!0,children:t.jsxs("button",{type:"button",className:xn({size:"default"}),children:[f("gitView.integrate.target"),t.jsx("span",{className:"max-w-[160px] truncate font-mono text-xs text-muted-foreground",children:P}),t.jsx(H,{name:"arrow-down-s",className:"size-4 opacity-60"})]})})}),t.jsx(ir,{align:"end",className:"w-72 p-0 max-h-[var(--available-height)] flex flex-col overflow-hidden",children:t.jsxs(ar,{className:"h-full min-h-0",shouldFilter:!1,children:[t.jsx(or,{ref:j,placeholder:f("gitView.branch.searchPlaceholder"),value:b,onValueChange:G,onKeyDown:m=>m.stopPropagation()}),t.jsxs(lr,{className:"h-full min-h-0",scrollbarClassName:"overlay-scrollbar--flush overlay-scrollbar--dense overlay-scrollbar--zero",disableHorizontal:!0,children:[t.jsx(cr,{children:f("gitView.branch.empty")}),t.jsx(ms,{heading:f("gitView.branch.localBranches"),children:E.map(m=>t.jsx(hs,{value:m,onSelect:()=>{v(m),V(m),T(!1),G("")},children:m},m))})]})]})})]}),N.kind==="ready"?t.jsx(ye,{sideOffset:8,label:f("contextTooltips.git.integrateMove"),children:t.jsx(U,{size:"sm",onClick:()=>{le()},disabled:!W||N.plan.commits.length===0,children:f("gitView.integrate.move")})}):N.kind==="loading"?t.jsx(U,{size:"sm",variant:"outline",disabled:!0,children:f("gitView.integrate.checking")}):N.kind==="running"?t.jsx(U,{size:"sm",variant:"outline",disabled:!0,children:f("gitView.integrate.moving")}):null]}),N.kind==="ready"&&N.plan.commits.length===0&&t.jsx("div",{className:"typography-meta text-muted-foreground",children:f("gitView.integrate.noCommitsToMove")}),N.kind==="ready"&&N.plan.commits.length>0&&t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("div",{className:"typography-meta text-foreground",children:[f("gitView.integrate.commitsToMove"),t.jsxs("span",{className:"text-muted-foreground",children:[" (",N.plan.commits.length,")"]})]}),_.length>0&&N.plan.commits.length>5&&t.jsx("button",{type:"button",onClick:()=>F(m=>!m),className:"typography-micro text-muted-foreground hover:text-foreground",children:f(k?"gitView.integrate.showLess":"gitView.integrate.showAll")})]}),t.jsxs("div",{className:"space-y-1",children:[(k?_:_.slice(0,5)).map(m=>t.jsxs("div",{className:"flex items-baseline gap-2 min-w-0",children:[t.jsx("span",{className:"font-mono text-xs text-muted-foreground flex-shrink-0",children:m.short}),t.jsx("span",{className:"typography-meta text-muted-foreground truncate",children:m.subject||m.sha})]},m.sha)),_.length===0&&t.jsx("div",{className:"typography-meta text-muted-foreground",children:f("gitView.integrate.previewUnavailable")}),N.plan.commits.length>_.length&&t.jsx("div",{className:"typography-micro text-muted-foreground",children:f("gitView.integrate.showingFirstCommits",{count:_.length})})]})]}),N.kind==="conflict"&&t.jsxs("div",{className:"rounded-md oc-tile p-3 space-y-2",children:[t.jsx("div",{className:"typography-meta text-foreground",children:f("gitView.integrate.conflictsInFiles",{count:N.details.unmergedFiles.length})}),t.jsxs("div",{className:"typography-micro text-muted-foreground",children:[f("gitView.integrate.currentCommit"),": ",t.jsx("span",{className:"font-mono",children:N.state.currentCommit.slice(0,7)})]}),t.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[N.details.unmergedFiles.slice(0,6).map(m=>t.jsx("span",{className:"font-mono text-xs px-2 py-0.5 rounded oc-tile-inset text-muted-foreground",children:m},m)),N.details.unmergedFiles.length>6&&t.jsx("span",{className:"text-xs text-muted-foreground",children:f("gitView.integrate.moreFiles",{count:N.details.unmergedFiles.length-6})})]}),t.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[t.jsx(ye,{sideOffset:8,label:f("contextTooltips.git.abortOperation"),children:t.jsx(U,{size:"sm",variant:"ghost",className:"typography-meta",onClick:()=>{X()},children:f("gitView.operation.abort")})}),t.jsx(ye,{sideOffset:8,label:f("contextTooltips.git.resolveInCurrentSession"),children:t.jsxs(U,{size:"sm",variant:"secondary",className:"typography-meta gap-1",disabled:!g,onClick:()=>{se({state:N.state,details:N.details},!1)},children:[t.jsx(H,{name:"sparkling",className:"size-3.5"}),f("gitView.integrate.currentSession")]})}),t.jsx(ye,{sideOffset:8,label:f("contextTooltips.git.resolveInNewSession"),children:t.jsxs(U,{size:"sm",variant:"secondary",className:"typography-meta gap-1",onClick:()=>{se({state:N.state,details:N.details},!0)},children:[t.jsx(H,{name:"sparkling",className:"size-3.5"}),f("gitView.integrate.newSession")]})}),t.jsx(ye,{sideOffset:8,label:f("contextTooltips.git.continueOperation"),children:t.jsx(U,{size:"sm",className:"typography-meta",onClick:()=>{re()},children:f("gitView.operation.continue")})})]})]})]})]})},Fo=({open:o,onOpenChange:e,directory:h,hasUncommittedChanges:r,hasStagedChanges:a=!1,uncommittedFileCount:p,onChanged:w})=>{const{t:y}=lt(),[f,g]=l.useState([]),[M,T]=l.useState(!1),[b,G]=l.useState(""),[j,E]=l.useState(""),[P,v]=l.useState(null),[W,N]=l.useState({}),D=l.useCallback(async()=>{if(h){T(!0);try{const V=await Ti(h);g(V.stashes),N({})}catch(V){x.error(V instanceof Error?V.message:y("gitView.stashes.toast.loadFailed"))}finally{T(!1)}}},[h,y]);l.useEffect(()=>{o&&D()},[D,o]),l.useEffect(()=>{if(!o||!h||f.length===0)return;let V=!1;const L=f.map(te=>te.ref);return Ei(h,L).then(te=>{V||N(te.counts)}).catch(()=>{}),()=>{V=!0}},[h,o,f]);const k=l.useMemo(()=>Ut(f,b,V=>[V.message,V.ref,V.relativeTime]),[b,f]),F=l.useCallback(async V=>{await D(),await w?.(V)},[D,w]),_=async()=>{if(!(!h||P)){v("create");try{const V=await Ai(h,{message:j.trim()||void 0});V.created?(x.success(y("gitView.stashes.toast.created")),E("")):x.info(y("gitView.stashes.toast.noChanges")),await F({affectsIndex:!!(V.created&&a)})}catch(V){x.error(V instanceof Error?V.message:y("gitView.stashes.toast.createFailed"))}finally{v(null)}}},q=async(V,L)=>{if(!(!h||P)&&!(L==="drop"&&!window.confirm(y("gitView.stashes.confirm.drop",{ref:V.ref})))){v(`${L}:${V.ref}`);try{L==="apply"&&await Li(h,{ref:V.ref}),L==="pop"&&await Gi(h,{ref:V.ref}),L==="drop"&&await zi(h,{ref:V.ref});const te=L==="apply"?"gitView.stashes.toast.applySuccess":L==="pop"?"gitView.stashes.toast.popSuccess":"gitView.stashes.toast.dropSuccess";x.success(y(te)),await F({affectsIndex:L!=="drop"})}catch(te){const K=L==="apply"?"gitView.stashes.toast.applyFailed":L==="pop"?"gitView.stashes.toast.popFailed":"gitView.stashes.toast.dropFailed";x.error(te instanceof Error?te.message:y(K)),await F({affectsIndex:L!=="drop"})}finally{v(null)}}},A=P!==null;return t.jsx(ft,{open:o,onOpenChange:e,children:t.jsxs(gt,{className:"max-w-2xl max-h-[70vh] flex flex-col",children:[t.jsxs(pt,{children:[t.jsxs(xt,{className:"flex items-center gap-2",children:[t.jsx(H,{name:"archive-stack",className:"size-4 text-muted-foreground"}),y("gitView.stashes.title")]}),t.jsx(kt,{children:y("gitView.stashes.description")})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[t.jsx(Kr,{value:j,onChange:V=>E(V.target.value),placeholder:y("gitView.stashes.messagePlaceholder"),disabled:A||!r,className:"flex-1"}),t.jsxs(U,{onClick:_,disabled:!r||A||!h,children:[P==="create"?t.jsx(H,{name:"loader-4",className:"size-4 animate-spin"}):t.jsx(H,{name:"inbox-archive",className:"size-4"}),y("gitView.stashes.actions.stashCurrentWithCount",{count:p})]})]}),t.jsx("p",{className:"typography-micro text-muted-foreground",children:y("gitView.stashes.includeUntrackedHint")})]}),t.jsx("div",{className:"-mx-5 border-t border-edge"}),t.jsxs("div",{className:"relative",children:[t.jsx(H,{name:"search",className:"absolute inset-s-2.5 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground"}),t.jsx(Kr,{value:b,onChange:V=>G(V.target.value),placeholder:y("gitView.stashes.searchPlaceholder"),className:"ps-8"})]}),t.jsx(qt,{outerClassName:"flex-1 min-h-0",disableHorizontal:!0,children:M?t.jsx("div",{className:"flex items-center justify-center py-10 text-muted-foreground",children:t.jsx(H,{name:"loader-4",className:"size-5 animate-spin"})}):k.length===0?t.jsx("div",{className:"py-8 text-center text-muted-foreground",children:y(b?"gitView.stashes.empty.search":"gitView.stashes.empty.list")}):k.map((V,L)=>t.jsxs("div",{className:"group -mx-2 flex items-center gap-2 rounded-md px-2 py-1.5 transition-colors hover:bg-interactive-hover",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"typography-ui-label truncate text-foreground",children:V.message||y("gitView.stashes.untitled")}),t.jsxs("p",{className:"typography-micro truncate text-muted-foreground",children:[t.jsxs(gs,{children:[t.jsx(ps,{asChild:!0,children:t.jsx("span",{children:L===0&&!b.trim()?y("gitView.stashes.latestLabel"):y("gitView.stashes.itemNumber",{number:L+1})})}),t.jsx(xs,{sideOffset:6,children:V.ref})]})," · ",V.relativeTime," · ",typeof W[V.ref]=="number"?y("gitView.stashes.fileCount",{count:W[V.ref]}):y("gitView.stashes.fileCountLoading")]})]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-0.5 opacity-100 sm:opacity-0 sm:group-hover:opacity-100",children:[t.jsx(tr,{label:y("gitView.stashes.actions.apply"),loading:P===`apply:${V.ref}`,onClick:()=>q(V,"apply"),disabled:A,children:t.jsx(H,{name:"inbox-unarchive",className:"size-3.5"})}),t.jsx(tr,{label:y("gitView.stashes.actions.pop"),loading:P===`pop:${V.ref}`,onClick:()=>q(V,"pop"),disabled:A,children:t.jsx(H,{name:"inbox-unarchive-fill",className:"size-3.5"})}),t.jsx(tr,{label:y("gitView.stashes.actions.drop"),loading:P===`drop:${V.ref}`,onClick:()=>q(V,"drop"),disabled:A,destructive:!0,children:t.jsx(H,{name:"delete-bin",className:"size-3.5"})})]})]},V.ref))})]})})},tr=o=>{const e=Kt.c(17),{label:h,loading:r,disabled:a,destructive:p,onClick:w,children:y}=o,f=r||void 0,g=p?"text-[var(--status-error)] hover:text-[var(--status-error)]":"text-muted-foreground hover:text-foreground";let M;e[0]!==g?(M=pe("flex size-6 items-center justify-center rounded-md transition-colors hover:bg-interactive-hover disabled:opacity-50",g),e[0]=g,e[1]=M):M=e[1];let T;e[2]!==y||e[3]!==r?(T=r?t.jsx(H,{name:"loader-4",className:"size-3.5 animate-spin"}):y,e[2]=y,e[3]=r,e[4]=T):T=e[4];let b;e[5]!==a||e[6]!==h||e[7]!==w||e[8]!==f||e[9]!==M||e[10]!==T?(b=t.jsx(ps,{asChild:!0,children:t.jsx("button",{type:"button","aria-label":h,"aria-busy":f,className:M,onClick:w,disabled:a,children:T})}),e[5]=a,e[6]=h,e[7]=w,e[8]=f,e[9]=M,e[10]=T,e[11]=b):b=e[11];let G;e[12]!==h?(G=t.jsx(xs,{sideOffset:6,children:h}),e[12]=h,e[13]=G):G=e[13];let j;return e[14]!==b||e[15]!==G?(j=t.jsxs(gs,{children:[b,G]}),e[14]=b,e[15]=G,e[16]=j):j=e[16],j},Do=o=>{const e=Kt.c(16),{onOpenStashes:h}=o,{t:r}=lt();let a;e[0]!==r?(a=r("gitView.empty.cleanDescription"),e[0]=r,e[1]=a):a=e[1];const p=lo(a);let w;e[2]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx(H,{name:"git-commit",className:"size-10 text-muted-foreground/70 mb-4"}),e[2]=w):w=e[2];let y;e[3]!==r?(y=r("gitView.empty.cleanTitle"),e[3]=r,e[4]=y):y=e[4];let f;e[5]!==y?(f=t.jsx("p",{className:"typography-ui-label font-semibold text-foreground mb-1",children:y}),e[5]=y,e[6]=f):f=e[6];let g;e[7]!==p?(g=t.jsx("p",{className:"typography-meta text-muted-foreground mb-4",children:p}),e[7]=p,e[8]=g):g=e[8];let M;e[9]!==h||e[10]!==r?(M=h?t.jsxs(U,{type:"button",variant:"outline",size:"sm",onClick:h,className:"gap-1.5",children:[t.jsx(H,{name:"archive-stack",className:"size-4"}),r("gitView.stashes.title")]}):null,e[9]=h,e[10]=r,e[11]=M):M=e[11];let T;return e[12]!==f||e[13]!==g||e[14]!==M?(T=t.jsxs("div",{className:"flex flex-col items-center justify-center py-10 px-4 text-center",children:[w,f,g,M]}),e[12]=f,e[13]=g,e[14]=M,e[15]=T):T=e[15],T},at=8,Oo=o=>{const e=Kt.c(18),{laned:h,totalLanes:r,isExpanded:a}=o,{lane:p,color:w,connectors:y}=h,g=Math.max(r,p+1)*at+at/2,M=l.useRef(null),T=l.useRef(null);let b;e[0]!==w||e[1]!==y||e[2]!==p||e[3]!==g?(b=()=>{const v=M.current,W=T.current;if(!v||!W)return;const N=v.offsetHeight;if(N===0)return;const D=window.devicePixelRatio||1;W.width=g*D,W.height=N*D;const k=W.getContext("2d");if(!k)return;k.scale(D,D),k.clearRect(0,0,g,N);const F=N/2,_=p*at+at/2,q=getComputedStyle(W),A=q.getPropertyValue("--surface-muted-foreground").trim()||q.color,V=K=>{if(!K.startsWith("var("))return K;const n=K.slice(4,-1).trim();return q.getPropertyValue(n).trim()||A},L=[...y].sort(Mo);for(const K of L){const n=K.fromLane*at+at/2,se=K.toLane*at+at/2,le=K.type==="passing"?.72:K.type==="branch-out"||K.type==="merge-in"?.95:1;k.beginPath(),k.strokeStyle=V(K.color),k.globalAlpha=le,k.lineWidth=1.25,k.lineCap="round";e:switch(K.type){case"passing":case"commit-lane":{k.moveTo(n,0),k.lineTo(n,N);break e}case"top-stub":{k.moveTo(n,0),k.lineTo(n,F);break e}case"bottom-stub":{k.moveTo(n,F),k.lineTo(n,N);break e}case"branch-out":{const X=(F+N)/2;k.moveTo(_,F),k.bezierCurveTo(_,X,se,X,se,N);break e}case"merge-in":{const X=F/2;k.moveTo(n,0),k.bezierCurveTo(n,X,_,X,_,F);break e}default:continue}k.stroke(),k.globalAlpha=1}const te=q.getPropertyValue("--background").trim()||q.getPropertyValue("--surface-background").trim();k.beginPath(),k.arc(_,F,4,0,Math.PI*2),k.fillStyle=V(w),k.fill(),k.beginPath(),k.arc(_,F,5,0,Math.PI*2),k.strokeStyle=te||A,k.lineWidth=2,k.stroke()},e[0]=w,e[1]=y,e[2]=p,e[3]=g,e[4]=b):b=e[4];let G;e[5]!==w||e[6]!==y||e[7]!==a||e[8]!==p||e[9]!==h||e[10]!==r||e[11]!==g?(G=[h,p,w,y,r,a,g],e[5]=w,e[6]=y,e[7]=a,e[8]=p,e[9]=h,e[10]=r,e[11]=g,e[12]=G):G=e[12],l.useLayoutEffect(b,G);let j;e[13]!==g?(j={width:g,height:"100%",position:"relative",flexShrink:0,overflow:"hidden"},e[13]=g,e[14]=j):j=e[14];let E;e[15]===Symbol.for("react.memo_cache_sentinel")?(E=t.jsx("canvas",{ref:T,style:{position:"absolute",inset:0,width:"100%",height:"100%",display:"block"}}),e[15]=E):E=e[15];let P;return e[16]!==j?(P=t.jsx("div",{ref:M,style:j,children:E}),e[16]=j,e[17]=P):P=e[17],P};function Bo(o){return o==="branch-out"||o==="merge-in"}function Mo(o,e){const h=Bo;return(h(o.type)?1:0)-(h(e.type)?1:0)}const nn=15e3,an=500,on=12,ln=8*1024*1024,Nt="h-6 text-foreground/80 hover:bg-transparent hover:text-foreground",cn=o=>typeof o=="string"?0:(o.original?.length??0)+(o.modified?.length??0),un=o=>{if(o.size<=on){let a=0;for(const p of o.values())a+=cn(p);if(a<=ln)return o}const e=Array.from(o.entries()).reverse(),h=new Map;let r=0;for(const[a,p]of e){if(h.size>=on)continue;const w=cn(p);r+w>ln&&h.size>0||(h.set(a,p),r+=w)}return new Map(Array.from(h.entries()).reverse())};function dn(o,e){const h=new Date(o);return Number.isNaN(h.getTime())?o:$i(h,e,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function To(o){switch(o){case"A":return"text-[var(--status-success)]";case"D":return"text-[var(--status-error)]";case"M":return"text-[var(--status-warning)]";case"R":return"text-[var(--status-info)]";default:return"text-muted-foreground"}}function Eo(o){return o?o.split(",").map(e=>e.trim()).filter(Boolean).map(e=>{const h=e.startsWith("HEAD ->");return{label:h?e.replace("HEAD -> ",""):e.replace("tag: ",""),isHead:h,isTag:e.startsWith("tag: ")}}):[]}const Ao=l.memo(({entry:o,mode:e="history",laned:h,totalLanes:r,isExpanded:a,onToggle:p,files:w,isLoadingFiles:y,onCopyHash:f,directory:g,onConflict:M,onActionSuccess:T})=>{const{t:b}=lt(),G=$t(u=>u.timeFormatPreference),j=e==="graph",[E,P]=l.useState(null),[v,W]=l.useState(!1),[N,D]=l.useState(""),[k,F]=l.useState(null),[_,q]=l.useState(new Set),[A,V]=l.useState(new Map),[L,te]=l.useState(new Set),K=async()=>{if(g){P("checkout");try{await Xi(g,o.hash),x.success(b("gitView.history.actions.detachedHead")),T?.()}catch(u){x.error(String(u.message))}finally{P(null)}}},n=async()=>{if(!(!g||!N.trim())){P("createBranch");try{await Wi(g,N.trim(),o.hash),W(!1),D(""),T?.()}catch(u){x.error(String(u.message))}finally{P(null)}}},se=async()=>{if(g){P("cherryPick");try{const u=await Qi(g,o.hash);u.conflict?M?.({conflict:!0,conflictFiles:u.conflictFiles,operation:"cherry-pick"}):T?.()}catch(u){x.error(String(u.message))}finally{P(null)}}},le=async()=>{if(g){P("revert");try{const u=await Yi(g,o.hash);u.conflict?M?.({conflict:!0,conflictFiles:u.conflictFiles,operation:"revert"}):T?.()}catch(u){x.error(String(u.message))}finally{P(null)}}},X=async(u,I=!1)=>{if(!(!g||E!==null)){P("reset");try{await Ki(g,o.hash,u,I),T?.()}catch(O){x.error(String(O.message))}finally{P(null)}}},re=async()=>{if(!k)return;const u=k;switch(F(null),u){case"checkout":return K();case"cherryPick":return se();case"revert":return le();case"merge":return R();case"rebase":return ce();case"resetSoft":return X("soft");case"resetMixed":return X("mixed");case"resetHard":return X("hard",!0)}},R=async()=>{if(g){P("merge");try{const u=await Ji(g,{branch:o.hash});u.conflict?M?.({conflict:!0,conflictFiles:u.conflictFiles,operation:"merge"}):T?.()}catch(u){x.error(String(u.message))}finally{P(null)}}},ce=async()=>{if(g){P("rebase");try{const u=await qi(g,{onto:o.hash});u.conflict?M?.({conflict:!0,conflictFiles:u.conflictFiles,operation:"rebase"}):T?.()}catch(u){x.error(String(u.message))}finally{P(null)}}},ee=l.useCallback(async u=>{const I=u.path;if(!g){V(O=>new Map(O).set(I,"error"));return}V(O=>un(new Map(O).set(I,"loading")));try{const O=Hi(g,o.hash,u.path,!1,u.previousPath),J=new Promise((xe,Z)=>{setTimeout(()=>Z(new Error(`Timed out after ${nn}ms`)),nn)}),ae=await Promise.race([O,J]);V(xe=>un(new Map(xe).set(I,ae)))}catch{V(O=>new Map(O).set(I,"error"))}},[g,o.hash]),m=l.useCallback(async u=>{const I=u.path;if(u.changeType==="R"||u.isBinary&&!Ys(u.path)){q(xe=>{const Z=new Set(xe);return Z.has(I)?Z.delete(I):Z.add(I),Z});return}const O=A.get(I);if(_.has(I)&&O&&O!=="error"){q(xe=>{const Z=new Set(xe);return Z.delete(I),Z});return}q(xe=>{const Z=new Set(xe);return Z.add(I),Z}),!(O&&O!=="error"||u.insertions+u.deletions>an&&!L.has(I))&&await ee(u)},[A,L,ee,_]);return t.jsxs("li",{children:[t.jsxs("button",{type:"button",onClick:p,className:pe("w-full flex items-start gap-3 px-3 py-2 text-start transition-colors",j?"hover:bg-[var(--interactive-hover)]/40":a?"oc-tile-inset":"oc-tile-hover"),children:[j&&h&&r!==void 0?t.jsx("div",{className:"-my-2 shrink-0 self-stretch",children:t.jsx(Oo,{laned:h,totalLanes:r,isExpanded:a})}):t.jsx("div",{className:"h-2 w-2 translate-y-2 rounded-full shrink-0",style:{backgroundColor:"var(--status-success)"},"aria-hidden":!0}),t.jsxs("div",{className:"min-w-0 flex-1",children:[j?(()=>{const u=Eo(o.refs);return u.length>0?t.jsx("div",{className:"flex flex-wrap gap-1 mb-0.5",children:u.map(I=>t.jsx("span",{className:pe("inline-flex items-center px-1.5 py-0 typography-micro rounded font-medium",I.isHead?"bg-[var(--chart-1)] text-[var(--primary-foreground)]":I.isTag?"bg-[var(--chart-5)] text-[var(--primary-foreground)]":"bg-[var(--interactive-hover)] text-[var(--foreground)]"),children:I.label},I.label))}):null})():null,t.jsx("p",{className:"typography-ui-label font-medium text-foreground line-clamp-1",children:o.message}),t.jsxs("div",{className:"flex items-center gap-1 typography-meta text-muted-foreground",children:[t.jsxs("div",{className:"flex items-center gap-1 min-w-0 truncate",children:[t.jsx("span",{className:"truncate min-w-[3ch]",title:o.author_name,children:o.author_name}),t.jsx("span",{className:"shrink-0",children:"·"}),t.jsx("span",{className:"truncate min-w-0",title:dn(o.date,G),children:dn(o.date,G)})]}),t.jsx("span",{className:"shrink-0",children:"·"}),t.jsx("code",{className:"shrink-0 font-mono",children:o.hash.slice(0,8)}),t.jsxs(gs,{children:[t.jsx(ps,{asChild:!0,children:t.jsx(U,{variant:"ghost",size:"sm",className:"h-5 px-1 shrink-0",onClick:u=>{u.stopPropagation(),f(o.hash)},children:t.jsx(H,{name:"file-copy",className:"size-3"})})}),t.jsx(xs,{sideOffset:8,children:b("gitView.history.copySha")})]})]})]})]}),a&&t.jsxs("div",{className:"oc-tile-inset px-3 pb-2 ps-8",children:[j&&k?t.jsxs("div",{className:"flex items-center gap-2 py-2 border-b border-edge-muted mb-2",children:[t.jsx("span",{className:"typography-micro text-muted-foreground flex-1 min-w-0",children:b(`gitView.history.actions.${k}Confirm`)}),t.jsxs(U,{variant:"destructive",size:"xs",className:"h-6 shrink-0",disabled:E!==null,onClick:u=>{u.stopPropagation(),re()},children:[E!==null?t.jsx(H,{name:"loader-4",className:"size-3 animate-spin me-1"}):null,b("gitView.history.actions.confirmButton")]}),t.jsx(U,{variant:"ghost",size:"xs",className:"h-6 shrink-0",disabled:E!==null,onClick:u=>{u.stopPropagation(),F(null)},children:b("gitView.history.actions.cancelButton")})]}):j?t.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 py-2 border-b border-edge-muted mb-2",children:[t.jsx(ye,{sideOffset:8,label:b("contextTooltips.git.checkoutCommit"),children:t.jsx(U,{variant:"outline",size:"xs",className:"h-6",disabled:E!==null,onClick:u=>{u.stopPropagation(),F("checkout")},children:b("gitView.history.actions.checkout")})}),v?t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("input",{autoFocus:!0,value:N,onChange:u=>D(u.target.value),onKeyDown:u=>{u.key==="Enter"&&n(),u.key==="Escape"&&(W(!1),D(""))},placeholder:b("gitView.history.actions.createBranchPlaceholder"),className:"oc-raised oc-field h-6 text-xs px-2 rounded bg-surface-elevated outline-none min-w-0 w-32"}),t.jsxs(U,{variant:"outline",size:"xs",className:"h-6",disabled:!N.trim()||E!==null,onClick:u=>{u.stopPropagation(),n()},children:[E==="createBranch"?t.jsx(H,{name:"loader-4",className:"size-3 animate-spin me-1"}):null,b("gitView.history.actions.createBranchConfirm")]})]}):t.jsx(ye,{sideOffset:8,label:b("contextTooltips.git.branchFromCommit"),children:t.jsx(U,{variant:"ghost",size:"xs",className:Nt,onClick:u=>{u.stopPropagation(),W(!0)},children:b("gitView.history.actions.createBranch")})}),t.jsx(ye,{sideOffset:8,label:b("contextTooltips.git.cherryPickCommit"),children:t.jsx(U,{variant:"ghost",size:"xs",className:Nt,disabled:E!==null,onClick:u=>{u.stopPropagation(),F("cherryPick")},children:b("gitView.history.actions.cherryPick")})}),t.jsx(ye,{sideOffset:8,label:b("contextTooltips.git.revertCommit"),children:t.jsx(U,{variant:"ghost",size:"xs",className:Nt,disabled:E!==null,onClick:u=>{u.stopPropagation(),F("revert")},children:b("gitView.history.actions.revert")})}),t.jsxs(rr,{children:[t.jsx(ye,{sideOffset:8,label:b("contextTooltips.git.resetToCommit"),children:t.jsx(nr,{asChild:!0,children:t.jsxs(U,{variant:"ghost",size:"xs",className:Nt,disabled:E!==null,onClick:u=>u.stopPropagation(),children:[E==="reset"?t.jsx(H,{name:"loader-4",className:"size-3 animate-spin me-1"}):null,b("gitView.history.actions.reset")]})})}),t.jsx(ir,{align:"start",className:"min-w-max",children:["soft","mixed","hard"].map(u=>t.jsx(_i,{disabled:E!==null,onSelect:I=>{I.stopPropagation(),F(`reset${u.charAt(0).toUpperCase()+u.slice(1)}`)},children:b(`gitView.history.actions.reset${u.charAt(0).toUpperCase()+u.slice(1)}`)},u))})]}),t.jsx(ye,{sideOffset:8,label:b("contextTooltips.git.mergeCommit"),children:t.jsx(U,{variant:"ghost",size:"xs",className:Nt,disabled:E!==null,onClick:u=>{u.stopPropagation(),F("merge")},children:b("gitView.history.actions.merge")})}),t.jsx(ye,{sideOffset:8,label:b("contextTooltips.git.rebaseOnCommit"),children:t.jsx(U,{variant:"ghost",size:"xs",className:Nt,disabled:E!==null,onClick:u=>{u.stopPropagation(),F("rebase")},children:b("gitView.history.actions.rebase")})})]}):null,y?t.jsxs("div",{className:"flex items-center gap-2 py-2",children:[t.jsx(H,{name:"loader-4",className:"size-4 animate-spin text-muted-foreground"}),t.jsx("span",{className:"typography-micro text-muted-foreground",children:b("gitView.history.loadingFiles")})]}):w.length===0?t.jsx("p",{className:"typography-micro text-muted-foreground py-2",children:b("gitView.history.noFiles")}):t.jsx("ul",{className:"space-y-0.5 py-2",children:w.map(u=>t.jsxs("li",{children:[t.jsxs("button",{type:"button",onClick:()=>m(u),className:"oc-tile-hover w-full flex items-center gap-2 typography-micro text-start cursor-pointer rounded px-1",children:[t.jsx("span",{className:pe("font-semibold w-3 text-center shrink-0",To(u.changeType)),children:u.changeType}),t.jsx("span",{className:"truncate text-foreground min-w-0",title:u.path,children:u.path}),!u.isBinary&&t.jsxs("span",{className:"shrink-0",children:[t.jsxs("span",{style:{color:"var(--status-success)"},children:["+",u.insertions]}),t.jsx("span",{className:"text-muted-foreground mx-0.5",children:"/"}),t.jsxs("span",{style:{color:"var(--status-error)"},children:["-",u.deletions]})]}),u.isBinary&&t.jsx("span",{className:"typography-micro text-muted-foreground shrink-0",children:b("gitView.history.binary")}),t.jsx(H,{name:_.has(u.path)?"arrow-down-s":"arrow-right-s",className:"size-3 shrink-0 text-muted-foreground"})]}),_.has(u.path)&&t.jsx(qt,{outerClassName:"max-h-[400px] w-auto rounded border border-edge-muted mx-2 mb-1","data-diff-virtual-root":!0,"data-diff-virtual-content":!0,children:u.changeType==="R"?t.jsx("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:b("gitView.history.renamedNoDiff")}):u.isBinary&&!Ys(u.path)?t.jsx("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:b("gitView.history.binaryNoDiff")}):(()=>{const I=u.insertions+u.deletions;if(!L.has(u.path)&&I>an)return t.jsxs("div",{className:"flex flex-col items-start gap-1 px-3 py-2 text-sm text-muted-foreground",children:[t.jsx("div",{className:"typography-ui-label font-semibold text-foreground",children:b("gitView.history.largeDiffTitle",{count:I})}),t.jsx("div",{className:"typography-meta text-muted-foreground",children:b("gitView.history.largeDiffDescription")}),t.jsx(U,{type:"button",variant:"ghost",size:"xs",className:"h-6 px-0 text-primary hover:bg-transparent hover:underline",onClick:()=>{te(ae=>new Set(ae).add(u.path)),ee(u)},children:b("gitView.history.renderDiffAnyway")})]});const O=A.get(u.path);if(O==="loading"||O===void 0)return t.jsx("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:b("gitView.history.loadingDiff")});if(O==="error")return t.jsx("button",{type:"button",onClick:()=>m(u),className:"w-full text-start px-3 py-2 text-sm text-muted-foreground hover:bg-[var(--interactive-hover)] transition-colors",children:b("gitView.history.diffError")});const J=ae=>t.jsx(xo,{original:ae.original,modified:ae.modified,language:Ui(u.path)||"",fileName:u.path,renderSideBySide:!1,layout:"inline",enableComments:!1});return Ys(u.path)&&yo(O.original,O.modified)?t.jsx(bo,{filePath:u.path,original:O.original,modified:O.modified,renderText:J}):J(O)})()})]},u.path))})]})]})}),mn=["var(--chart-1)","var(--chart-2)","var(--chart-3)","var(--chart-4)","var(--chart-5)","var(--syntax-keyword)","var(--syntax-string)","var(--status-info)"];function ds(o){return mn[o%mn.length]}function Lo(o){if(o.length===0)return[];const e=[],h=[];for(let r=0;r<o.length;r++){const a=o[r],p=[];for(let j=0;j<e.length;j++)e[j]===a.hash&&p.push(j);let w=p.length>0?p[0]:-1;if(w===-1){const j=e.indexOf(null);j!==-1?w=j:(w=e.length,e.push(null))}const y=p.slice(1),f=ds(w),g=e[w]===a.hash,M=a.parents.length>0;M?e[w]=a.parents[0]:e[w]=null;const T=[],b=new Set;for(let j=1;j<a.parents.length;j++){const E=a.parents[j],P=e.indexOf(E);if(P!==-1)T.push(P);else{const v=e.indexOf(null);if(v!==-1)e[v]=E,T.push(v),b.add(v);else{const W=e.length;e.push(E),T.push(W),b.add(W)}}}const G=[];g&&M?G.push({fromLane:w,toLane:w,color:f,type:"commit-lane"}):g&&!M?G.push({fromLane:w,toLane:w,color:f,type:"top-stub"}):!g&&M&&G.push({fromLane:w,toLane:w,color:f,type:"bottom-stub"});for(const j of y)G.push({fromLane:j,toLane:w,color:ds(j),type:"merge-in"}),e[j]=null;for(const j of T)G.push({fromLane:w,toLane:j,color:ds(j),type:"branch-out"});for(let j=0;j<e.length;j++)e[j]!==null&&j!==w&&(b.has(j)||G.push({fromLane:j,toLane:j,color:ds(j),type:"passing"}));h.push({commit:a,lane:w,color:f,connectors:G})}return h}const hn=[{labelKey:"gitView.history.logSize25",value:25},{labelKey:"gitView.history.logSize50",value:50},{labelKey:"gitView.history.logSize100",value:100}],Go=o=>{const e=Kt.c(83),{mode:h,log:r,isLogLoading:a,logMaxCount:p,onLogMaxCountChange:w,expandedCommitHashes:y,onToggleCommit:f,commitFilesMap:g,loadingCommitHashes:M,onCopyHash:T,directory:b,showHeader:G,contentMaxHeightClassName:j,branchDivider:E,onConflict:P,onActionSuccess:v}=o,W=h===void 0?"history":h,N=G===void 0?!0:G,D=j===void 0?"max-h-[50vh]":j,k=E===void 0?null:E,{t:F}=lt();let _;e[0]!==p?(_=he=>he.value===p,e[0]=p,e[1]=_):_=e[1];const q=hn.find(_),[A,V]=l.useState(!0),L=W==="graph";let te;e[2]!==L||e[3]!==r?(te=L&&r?Lo(r.all):[],e[2]=L,e[3]=r,e[4]=te):te=e[4];const K=te;let n;e[5]!==K?(n=Math.max(1,...K.map(zo)),e[5]=K,e[6]=n):n=e[6];const se=n;let le;e[7]!==K?(le=new Map(K.map(Ho)),e[7]=K,e[8]=le):le=e[8];const X=le;if(!r)return null;const re=k!==null&&k.insertBeforeIndex>0&&k.insertBeforeIndex<r.all.length,R=k!==null&&k.insertBeforeIndex===r.all.length,ce=re||R;let ee;e[9]!==k||e[10]!==re||e[11]!==R||e[12]!==r.all?(ee=re?r.all.slice(0,k.insertBeforeIndex):R?r.all:[],e[9]=k,e[10]=re,e[11]=R,e[12]=r.all,e[13]=ee):ee=e[13];const m=ee;let u;if(e[14]!==k||e[15]!==g||e[16]!==D||e[17]!==b||e[18]!==y||e[19]!==re||e[20]!==ce||e[21]!==L||e[22]!==a||e[23]!==X||e[24]!==M||e[25]!==r.all||e[26]!==p||e[27]!==se||e[28]!==W||e[29]!==v||e[30]!==P||e[31]!==T||e[32]!==w||e[33]!==f||e[34]!==F||e[35]!==m){const he=re?r.all.slice(k.insertBeforeIndex):[];let Ne;e[37]!==k?.direction?(Ne=k?.direction==="down"?t.jsx(H,{name:"arrow-down-s",className:"size-3.5"}):t.jsx(H,{name:"arrow-up",className:"size-3.5"}),e[37]=k?.direction,e[38]=Ne):Ne=e[38];const Ie=Ne;let je;e[39]!==g||e[40]!==b||e[41]!==y||e[42]!==L||e[43]!==X||e[44]!==M||e[45]!==se||e[46]!==W||e[47]!==v||e[48]!==P||e[49]!==T||e[50]!==f?(je=De=>t.jsx("ul",{className:"divide-y divide-edge",children:De.map(ge=>t.jsx(Ao,{entry:ge,mode:W,laned:L?X.get(ge.hash):void 0,totalLanes:L?se:void 0,isExpanded:y.has(ge.hash),onToggle:()=>f(ge.hash),files:g.get(ge.hash)??[],isLoadingFiles:M.has(ge.hash),onCopyHash:T,directory:b,onConflict:P,onActionSuccess:v},ge.hash))}),e[39]=g,e[40]=b,e[41]=y,e[42]=L,e[43]=X,e[44]=M,e[45]=se,e[46]=W,e[47]=v,e[48]=P,e[49]=T,e[50]=f,e[51]=je):je=e[51];const ne=je;let ke;e[52]!==a||e[53]!==r.all.length||e[54]!==p||e[55]!==w||e[56]!==F?(ke=r.all.length>=p?t.jsx("div",{className:"flex justify-center py-2 border-t border-edge-muted",children:t.jsx(ye,{sideOffset:8,label:F("contextTooltips.git.showOlderCommits"),children:t.jsx(U,{type:"button",variant:"ghost",size:"xs",onClick:()=>w(p+25),disabled:a,className:"px-3 text-muted-foreground hover:text-foreground",children:a?t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(H,{name:"loader-4",className:"size-3 animate-spin"}),F("gitView.history.loadingMore")]}):F("gitView.history.loadMore")})})}):null,e[52]=a,e[53]=r.all.length,e[54]=p,e[55]=w,e[56]=F,e[57]=ke):ke=e[57];const Fe=ke;u=t.jsx(qt,{outerClassName:`min-h-0 ${D}`,className:"h-full w-full",children:r.all.length===0?t.jsx("div",{className:"flex h-full items-center justify-center p-4",children:t.jsx("p",{className:"typography-ui-label text-muted-foreground",children:F("gitView.history.noCommits")})}):ce&&k?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex flex-col gap-0",children:[m.length>0?t.jsx("div",{className:"rounded-xl oc-tile overflow-hidden",children:ne(m)}):null,t.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5","aria-hidden":!0,children:[t.jsx("span",{className:"h-px flex-1 bg-edge"}),t.jsxs("span",{className:"inline-flex max-w-[80%] items-center gap-1 typography-micro text-muted-foreground",children:[t.jsx("span",{className:"truncate",title:k.branchName,children:k.branchName}),Ie]}),t.jsx("span",{className:"h-px flex-1 bg-edge"})]}),he.length>0?t.jsx("div",{className:"rounded-xl oc-tile overflow-hidden",children:ne(he)}):null]}),Fe]}):t.jsxs(t.Fragment,{children:[ne(r.all),Fe]})}),e[14]=k,e[15]=g,e[16]=D,e[17]=b,e[18]=y,e[19]=re,e[20]=ce,e[21]=L,e[22]=a,e[23]=X,e[24]=M,e[25]=r.all,e[26]=p,e[27]=se,e[28]=W,e[29]=v,e[30]=P,e[31]=T,e[32]=w,e[33]=f,e[34]=F,e[35]=m,e[36]=u}else u=e[36];const I=u;if(!N){if(ce){let Ne;return e[58]!==I?(Ne=t.jsx("section",{className:"h-full min-h-0",children:I}),e[58]=I,e[59]=Ne):Ne=e[59],Ne}let he;return e[60]!==I?(he=t.jsx("section",{className:"h-full min-h-0 rounded-xl oc-tile overflow-hidden",children:I}),e[60]=I,e[61]=he):he=e[61],he}const O=Ya,J="rounded-xl oc-tile overflow-hidden",ae=Ja,xe="flex w-full items-center justify-between px-3 h-10 hover:bg-transparent";let Z;e[62]!==F?(Z=F("gitView.history.title"),e[62]=F,e[63]=Z):Z=e[63];let be;e[64]!==Z?(be=t.jsx("h3",{className:"typography-ui-header font-semibold text-foreground",children:Z}),e[64]=Z,e[65]=be):be=e[65];const $e="flex items-center gap-2",We=A&&t.jsx("div",{onClick:_o,onPointerDown:$o,children:t.jsxs(Zi,{value:String(p),onValueChange:he=>w(Number(he)),disabled:a,children:[t.jsx(ye,{sideOffset:8,label:F("contextTooltips.git.commitCount"),children:t.jsx(ea,{className:"w-auto",disabled:a,children:t.jsx(ta,{placeholder:F("gitView.history.commitsPlaceholder"),children:q?F(q.labelKey):void 0})})}),t.jsx(sa,{children:hn.map(he=>t.jsx(ra,{value:String(he.value),children:F(he.labelKey)},he.value))})]})});let Q;e[66]!==A?(Q=A?t.jsx(H,{name:"arrow-up-s",className:"size-4 text-muted-foreground"}):t.jsx(H,{name:"arrow-down-s",className:"size-4 text-muted-foreground"}),e[66]=A,e[67]=Q):Q=e[67];let de;e[68]!==We||e[69]!==Q?(de=t.jsxs("div",{className:$e,children:[We,Q]}),e[68]=We,e[69]=Q,e[70]=de):de=e[70];let ue;e[71]!==ae||e[72]!==be||e[73]!==de?(ue=t.jsxs(ae,{className:xe,children:[be,de]}),e[71]=ae,e[72]=be,e[73]=de,e[74]=ue):ue=e[74];let ve;e[75]!==I?(ve=t.jsx(Qa,{children:I}),e[75]=I,e[76]=ve):ve=e[76];let Re;return e[77]!==O||e[78]!==A||e[79]!==V||e[80]!==ue||e[81]!==ve?(Re=t.jsxs(O,{open:A,onOpenChange:V,className:J,children:[ue,ve]}),e[77]=O,e[78]=A,e[79]=V,e[80]=ue,e[81]=ve,e[82]=Re):Re=e[82],Re};function zo(o){return o.lane+1}function Ho(o){return[o.commit.hash,o]}function _o(o){return o.stopPropagation()}function $o(o){return o.stopPropagation()}const Wo=({open:o,onOpenChange:e,operation:h,targetBranch:r,onConfirm:a})=>{const{t:p}=lt(),[w,y]=l.useState(!0),[f,g]=l.useState(!1),M=p(h==="merge"?"gitView.operation.merge":"gitView.operation.rebase"),T=async()=>{g(!0);try{await a(w),e(!1)}catch(G){const j=G instanceof Error?G.message:`Failed to ${h}`;x.error(j)}finally{g(!1)}},b=()=>{f||e(!1)};return t.jsx(ft,{open:o,onOpenChange:f?void 0:e,children:t.jsxs(gt,{className:"max-w-md",children:[t.jsxs(pt,{children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(H,{name:"alert",className:"size-5 text-[var(--status-warning)]"}),t.jsx(xt,{children:p("gitView.stash.title")})]}),t.jsx(kt,{children:p("gitView.stash.description",{operation:h})})]}),t.jsxs("div",{className:"py-2",children:[t.jsx("p",{className:"typography-meta text-muted-foreground mb-3",children:p("gitView.stash.thisWill")}),t.jsxs("ol",{className:"list-decimal list-inside space-y-1 typography-meta text-foreground",children:[t.jsx("li",{children:p("gitView.stash.stepStash")}),t.jsxs("li",{children:[p(h==="merge"?"gitView.operation.merge":"gitView.operation.rebase")," ",p(h==="merge"?"gitView.stash.mergeWith":"gitView.stash.rebaseOnto")," ",t.jsx("span",{className:"font-mono text-primary",children:r})]}),w&&t.jsx("li",{children:p("gitView.stash.stepRestore")})]})]}),t.jsxs("div",{className:"flex items-center gap-2 py-2",children:[t.jsx(na,{checked:w,onChange:y,disabled:f,ariaLabel:p("gitView.stash.restoreAria")}),t.jsx("span",{className:"typography-ui-label text-foreground cursor-pointer select-none",onClick:()=>!f&&y(!w),children:p("gitView.stash.restoreAfterOperation",{operation:h})})]}),t.jsxs(sr,{className:"gap-2",children:[t.jsx(U,{variant:"ghost",size:"sm",onClick:b,disabled:f,children:p("gitView.common.cancel")}),t.jsx(U,{variant:"default",size:"sm",onClick:T,disabled:f,className:"gap-1.5",children:f?t.jsxs(t.Fragment,{children:[t.jsx(H,{name:"loader-4",className:"size-4 animate-spin"}),p("gitView.common.processing")]}):p("gitView.stash.confirmButton",{operation:M})})]})]})})},Uo=o=>{const e=Kt.c(100),{currentBranch:h,localBranches:r,remoteBranches:a,onMerge:p,onRebase:w,disabled:y,isOperating:f,operationLogs:g,onOperationComplete:M,mode:T,defaultTargetBranch:b}=o,G=y===void 0?!1:y,j=f===void 0?!1:f,E=g===void 0?[]:g,P=T===void 0?"dialog":T,{t:v}=lt(),[W,N]=l.useState(!1),[D,k]=l.useState("merge"),[F,_]=l.useState(null),[q,A]=l.useState(!1),[V,L]=l.useState(""),te=l.useRef(null),K=l.useRef(null),n=G||j,se=h||v("gitView.branch.currentBranchFallback"),le=E.length>0&&E.every(Ko),X=E.some(qo);let re;e[0]===Symbol.for("react.memo_cache_sentinel")?(re=()=>{K.current&&(K.current.scrollTop=K.current.scrollHeight)},e[0]=re):re=e[0],l.useEffect(re,[E]);let R;if(e[1]!==V||e[2]!==h||e[3]!==r){let Y;e[5]!==h?(Y=Ge=>Ge!==h,e[5]=h,e[6]=Y):Y=e[6];const Ce=r.filter(Y);R=Ut(Ce,V,Jo),e[1]=V,e[2]=h,e[3]=r,e[4]=R}else R=e[4];const ce=R;let ee;e[7]!==V||e[8]!==a?(ee=Ut(a,V,Yo),e[7]=V,e[8]=a,e[9]=ee):ee=e[9];const m=ee;let u;e[10]!==b||e[11]!==r||e[12]!==a?(u=()=>{if(!b)return null;const Y=a.find(Ce=>Ce.label===b);return Y||(r.includes(b)?{kind:"local",branch:b,label:b}:null)},e[10]=b,e[11]=r,e[12]=a,e[13]=u):u=e[13];const I=u;let O;e[14]!==I||e[15]!==N?(O=()=>{N(!0),_(I()),k("merge"),L("")},e[14]=I,e[15]=N,e[16]=O):O=e[16];const J=O;let ae;e[17]===Symbol.for("react.memo_cache_sentinel")?(ae=Y=>{_(Y),A(!1),L("")},e[17]=ae):ae=e[17];const xe=ae;let Z;e[18]!==p||e[19]!==w||e[20]!==D||e[21]!==F?(Z=()=>{F&&(D==="merge"?p(F):w(F))},e[18]=p,e[19]=w,e[20]=D,e[21]=F,e[22]=Z):Z=e[22];const be=Z;let $e;e[23]!==j||e[24]!==N?($e=()=>{j||(_(null),k("merge"),L(""),N(!1))},e[23]=j,e[24]=N,e[25]=$e):$e=e[25];const We=$e,Q=()=>{j&&!le||(le&&M?.(),_(null),k("merge"),L(""),N(!1))};let de,ue;e[26]!==q?(de=()=>{q||L("")},ue=[q],e[26]=q,e[27]=de,e[28]=ue):(de=e[27],ue=e[28]),l.useEffect(de,ue);let ve,Re;e[29]!==P||e[30]!==I||e[31]!==F?(ve=()=>{P==="dialog"||F||_(I())},Re=[P,I,F],e[29]=P,e[30]=I,e[31]=F,e[32]=ve,e[33]=Re):(ve=e[32],Re=e[33]),l.useEffect(ve,Re);const Ie=j?t.jsxs("div",{className:"space-y-3",children:[t.jsx(qt,{ref:K,outerClassName:"max-h-48 rounded-lg oc-tile",className:"p-3",disableHorizontal:!0,children:t.jsx("div",{className:"space-y-2",children:E.map(Qo)})}),le?P==="dialog"?t.jsx(sr,{children:t.jsx(U,{variant:"default",size:"sm",onClick:Q,children:v(X?"gitView.common.close":"gitView.common.done")})}):t.jsx("div",{className:"flex justify-end",children:t.jsx(U,{variant:"default",size:"sm",onClick:Q,children:v(X?"gitView.common.close":"gitView.common.done")})}):null]}):t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-3",children:[t.jsx("p",{className:"typography-meta text-muted-foreground",children:v("gitView.branch.operation")}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("button",{type:"button",onClick:()=>k("merge"),className:pe("flex flex-col items-start gap-1 rounded-lg p-3 text-start",D==="merge"?"bg-interactive-selection text-interactive-selection-foreground":"oc-tile oc-tile-hover"),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(H,{name:"git-merge",className:pe("size-4",D==="merge"?"text-inherit":"text-muted-foreground")}),t.jsx("span",{className:pe("typography-ui-label",D==="merge"?"text-foreground":"text-muted-foreground"),children:v("gitView.operation.merge")})]}),t.jsx("p",{className:"typography-micro text-muted-foreground",children:v("gitView.branch.mergeDescription")})]}),t.jsxs("button",{type:"button",onClick:()=>k("rebase"),className:pe("flex flex-col items-start gap-1 rounded-lg p-3 text-start",D==="rebase"?"bg-interactive-selection text-interactive-selection-foreground":"oc-tile oc-tile-hover"),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(H,{name:"git-branch",className:pe("size-4",D==="rebase"?"text-inherit":"text-muted-foreground")}),t.jsx("span",{className:pe("typography-ui-label",D==="rebase"?"text-foreground":"text-muted-foreground"),children:v("gitView.operation.rebase")})]}),t.jsx("p",{className:"typography-micro text-muted-foreground",children:v("gitView.branch.rebaseDescription")})]})]})]}),t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx("p",{className:"typography-meta text-muted-foreground",children:D==="merge"?v("gitView.branch.branchToMergeInto",{branch:se}):v("gitView.branch.branchToRebaseOnto")}),t.jsxs(rr,{open:q,onOpenChange:A,modal:!1,children:[t.jsx(nr,{asChild:!0,children:t.jsxs("button",{type:"button",className:pe(xn({size:"default"}),"w-full"),children:[t.jsx("span",{className:pe("truncate",!F&&"text-muted-foreground"),children:F?.label||v("gitView.branch.selectBranch")}),t.jsx(H,{name:"arrow-down-s",className:"size-4 opacity-60 shrink-0"})]})}),t.jsx(ir,{align:"start",sideOffset:6,className:"w-[var(--anchor-width)] p-0 max-h-[min(var(--available-height),24rem)] flex flex-col overflow-hidden",children:t.jsxs(ar,{className:"h-full min-h-0",shouldFilter:!1,children:[t.jsx(or,{ref:te,placeholder:v("gitView.branch.searchPlaceholder"),value:V,onValueChange:L,onKeyDown:Xo}),t.jsxs(lr,{className:"h-full min-h-0",disableHorizontal:!0,children:[t.jsx(cr,{children:v("gitView.branch.empty")}),ce.length>0&&t.jsx(ms,{heading:v("gitView.branch.localBranches"),children:ce.map(Y=>t.jsx(hs,{onSelect:()=>xe({kind:"local",branch:Y,label:Y}),children:t.jsx("span",{className:"typography-ui-label text-foreground truncate",children:Y})},`local-${Y}`))}),ce.length>0&&m.length>0?t.jsx(ia,{}):null,m.length>0&&t.jsx(ms,{heading:v("gitView.branch.remoteBranches"),children:m.map(Y=>t.jsx(hs,{onSelect:()=>xe(Y),children:t.jsx("span",{className:"typography-ui-label text-foreground truncate",children:Y.label})},`remote-${Y.label}`))})]})]})})]})]}),F?t.jsx("div",{className:"rounded-lg oc-tile p-3",children:t.jsx("p",{className:"typography-meta text-muted-foreground",children:D==="merge"?t.jsxs(t.Fragment,{children:[v("gitView.branch.summaryMergePrefix")," ",t.jsx("span",{className:"font-mono text-foreground",children:F.label})," ",v("gitView.branch.summaryMergeInfix")," ",t.jsx("span",{className:"font-mono text-foreground",children:se})]}):t.jsxs(t.Fragment,{children:[v("gitView.branch.summaryRebasePrefix")," ",t.jsx("span",{className:"font-mono text-foreground",children:se})," ",v("gitView.branch.summaryRebaseInfix")," ",t.jsx("span",{className:"font-mono text-foreground",children:F.label})]})})}):null,P==="dialog"?t.jsxs(sr,{className:"gap-2 pt-1",children:[t.jsx(U,{variant:"ghost",size:"sm",onClick:We,children:v("gitView.common.cancel")}),t.jsx(U,{variant:"default",size:"sm",onClick:be,disabled:!F,className:"gap-1.5",children:D==="merge"?t.jsxs(t.Fragment,{children:[t.jsx(H,{name:"git-merge",className:"size-4"}),v("gitView.operation.merge")]}):t.jsxs(t.Fragment,{children:[t.jsx(H,{name:"git-branch",className:"size-4"}),v("gitView.operation.rebase")]})})]}):t.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[t.jsx(U,{variant:"destructive",size:"sm",onClick:We,disabled:n,children:v("gitView.common.reset")}),t.jsx("div",{className:"flex-1"}),t.jsx(U,{variant:"default",size:"sm",onClick:be,disabled:n||!F,children:v(D==="merge"?"gitView.operation.merge":"gitView.operation.rebase")})]})]});if(P==="bare")return Ie;if(P==="inline"){let Y;e[34]!==v?(Y=v("gitView.branch.updateTitle"),e[34]=v,e[35]=Y):Y=e[35];let Ce;e[36]!==Y?(Ce=t.jsx("div",{className:"typography-ui-header font-semibold text-foreground",children:Y}),e[36]=Y,e[37]=Ce):Ce=e[37];let Ge;e[38]!==v?(Ge=v("gitView.branch.updateDescriptionPrefix"),e[38]=v,e[39]=Ge):Ge=e[39];let qe;e[40]!==se?(qe=t.jsx("span",{className:"font-mono text-foreground",children:se}),e[40]=se,e[41]=qe):qe=e[41];let Je;e[42]!==Ge||e[43]!==qe?(Je=t.jsxs("div",{className:"typography-micro text-muted-foreground",children:[Ge," ",qe,"."]}),e[42]=Ge,e[43]=qe,e[44]=Je):Je=e[44];let Ye;e[45]!==Ce||e[46]!==Je?(Ye=t.jsx("header",{className:"border-b border-edge-muted px-0 py-3",children:t.jsxs("div",{className:"space-y-1",children:[Ce,Je]})}),e[45]=Ce,e[46]=Je,e[47]=Ye):Ye=e[47];let Be;e[48]!==Ie?(Be=t.jsx("div",{className:"pt-3",children:Ie}),e[48]=Ie,e[49]=Be):Be=e[49];let Qe;return e[50]!==Ye||e[51]!==Be?(Qe=t.jsxs("section",{className:"border-0 bg-transparent rounded-none",children:[Ye,Be]}),e[50]=Ye,e[51]=Be,e[52]=Qe):Qe=e[52],Qe}let je;e[53]!==j?(je=j?t.jsx(fs,{className:"size-4"}):t.jsx(H,{name:"git-merge",className:"size-4"}),e[53]=j,e[54]=je):je=e[54];let ne;e[55]!==v?(ne=v("gitView.branch.mergeRebase"),e[55]=v,e[56]=ne):ne=e[56];let ke;e[57]!==ne?(ke=t.jsx("span",{children:ne}),e[57]=ne,e[58]=ke):ke=e[58];let Fe;e[59]!==J||e[60]!==n||e[61]!==je||e[62]!==ke?(Fe=t.jsx(ps,{asChild:!0,children:t.jsxs(U,{variant:"outline",size:"sm",className:"gap-1.5",onClick:J,disabled:n,children:[je,ke]})}),e[59]=J,e[60]=n,e[61]=je,e[62]=ke,e[63]=Fe):Fe=e[63];let De;e[64]!==v?(De=v("gitView.branch.mergeRebaseTooltip"),e[64]=v,e[65]=De):De=e[65];let ge;e[66]!==De?(ge=t.jsx(xs,{sideOffset:8,children:De}),e[66]=De,e[67]=ge):ge=e[67];let et;e[68]!==Fe||e[69]!==ge?(et=t.jsxs(gs,{children:[Fe,ge]}),e[68]=Fe,e[69]=ge,e[70]=et):et=e[70];let Oe;e[71]!==Q||e[72]!==N?(Oe=Y=>{Y?N(!0):Q()},e[71]=Q,e[72]=N,e[73]=Oe):Oe=e[73];let Ae;e[74]!==v?(Ae=v("gitView.branch.updateTitle"),e[74]=v,e[75]=Ae):Ae=e[75];let $;e[76]!==Ae?($=t.jsx(xt,{children:Ae}),e[76]=Ae,e[77]=$):$=e[77];let tt;e[78]!==X||e[79]!==j||e[80]!==D||e[81]!==le||e[82]!==v||e[83]!==se?(tt=j?v(le?X?"gitView.branch.operationFailed":"gitView.branch.operationCompleted":D==="merge"?"gitView.branch.mergingInProgress":"gitView.branch.rebasingInProgress"):t.jsxs(t.Fragment,{children:[v("gitView.branch.dialogDescriptionPrefix")," ",t.jsx("span",{className:"font-mono text-foreground",children:se}),"."]}),e[78]=X,e[79]=j,e[80]=D,e[81]=le,e[82]=v,e[83]=se,e[84]=tt):tt=e[84];let Ue;e[85]!==tt?(Ue=t.jsx(kt,{children:tt}),e[85]=tt,e[86]=Ue):Ue=e[86];let st;e[87]!==$||e[88]!==Ue?(st=t.jsxs(pt,{children:[$,Ue]}),e[87]=$,e[88]=Ue,e[89]=st):st=e[89];let Le;e[90]!==Ie||e[91]!==st?(Le=t.jsxs(gt,{className:"max-w-md",children:[st,Ie]}),e[90]=Ie,e[91]=st,e[92]=Le):Le=e[92];let Ke;e[93]!==W||e[94]!==Oe||e[95]!==Le?(Ke=t.jsx(ft,{open:W,onOpenChange:Oe,children:Le}),e[93]=W,e[94]=Oe,e[95]=Le,e[96]=Ke):Ke=e[96];let ct;return e[97]!==et||e[98]!==Ke?(ct=t.jsxs(t.Fragment,{children:[et,Ke]}),e[97]=et,e[98]=Ke,e[99]=ct):ct=e[99],ct};function Ko(o){return o.status==="done"||o.status==="error"}function qo(o){return o.status==="error"}function Jo(o){return[o]}function Yo(o){return[o.label,o.branch,o.remote]}function Qo(o,e){return t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsxs("div",{className:"mt-0.5 shrink-0",children:[o.status==="running"&&t.jsx(fs,{className:"size-3.5 text-primary"}),o.status==="done"&&t.jsx(H,{name:"check",className:"size-3.5 text-success"}),o.status==="error"&&t.jsx(H,{name:"close",className:"size-3.5 text-destructive"}),o.status==="pending"&&t.jsx("div",{className:"size-3.5 rounded-full border border-muted-foreground/30"})]}),t.jsx("span",{className:pe("typography-micro",o.status==="error"&&"text-destructive",o.status==="done"&&"text-muted-foreground",o.status==="running"&&"text-foreground",o.status==="pending"&&"text-muted-foreground/60"),children:o.message})]},e)}function Xo(o){return o.stopPropagation()}const Zo=/^[0-9a-f]{40}(?:[0-9a-f]{24})?$/i,el=(o,e)=>{const h=[...o].sort((r,a)=>a.length-r.length);return e.flatMap(r=>{const a=h.find(w=>r.startsWith(`${w}/`));if(!a)return[];const p=r.slice(a.length+1);return p?[{kind:"remote",branch:p,destinationRef:`refs/remotes/${a}/${p}`,label:r,remote:a,sourceRef:`refs/heads/${p}`}]:[]})},tl=async({directory:o,git:e,runPlannedFetch:h,target:r})=>{if(r.kind==="local")return r.branch;if(await h(r),!e.getGitLog)throw new Se("invalid-terminal-state");const p=(await e.getGitLog(o,{to:r.destinationRef,maxCount:1})).latest?.hash.trim();if(!p||!Zo.test(p))throw new Se("invalid-terminal-state");return p},sl=({runMutation:o,onMutationComplete:e,onMutationError:h,onPathsComplete:r,scheduleFlush:a})=>{const p=[];let w=!1;return{enqueue:f=>{const g=p[p.length-1];if(g?.directory===f.directory&&g.direction===f.direction){f.paths.forEach(M=>g.paths.add(M));return}p.push(f)},flush:()=>{if(w)return;const f=p.shift();if(!f)return;w=!0;const g={directory:f.directory,direction:f.direction,paths:Array.from(f.paths),rollback:f.rollback};(async()=>{try{await o(g),e(g)}catch(M){h(g,M)}finally{r(g.paths),w=!1,p.length>0&&a()}})()},clear:()=>{p.length=0},size:()=>p.length,isRunning:()=>w}},rl=(o,e,h)=>aa(o,e,r=>qa(r)&&oa(r,h)),nl=(o,e,h,r)=>la(o,e,h,a=>({id:"local-config",name:a.userName,...a,color:"info",icon:"user"}),r),il=(o,e,h,r)=>{if(e){const a=h.filter(p=>e.startsWith(`${p}/`)&&e.length>p.length+1).sort((p,w)=>w.length-p.length)[0];return a?{remoteName:a,destinationRef:`refs/heads/${e.slice(a.length+1)}`}:null}return r?{remoteName:r,destinationRef:`refs/heads/${o}`}:null},al=15e3,ol=40,ll=20,cl=2,fn={feat:":sparkles:",feature:":sparkles:",fix:":bug:",bug:":bug:",hotfix:":ambulance:",docs:":memo:",documentation:":memo:",style:":lipstick:",refactor:":recycle:",perf:":zap:",performance:":zap:",test:":white_check_mark:",tests:":white_check_mark:",build:":construction_worker:",ci:":green_heart:",chore:":wrench:",revert:":rewind:",wip:":construction:",security:":lock:",release:":bookmark:",merge:":twisted_rightwards_arrows:",mv:":truck:",move:":truck:",rename:":truck:",remove:":fire:",delete:":fire:",add:":sparkles:",create:":sparkles:",implement:":sparkles:",update:":recycle:",improve:":zap:",optimize:":zap:",upgrade:":arrow_up:",downgrade:":arrow_down:",deploy:":rocket:",init:":tada:",initial:":tada:"},gn=(o,e)=>{const h=o.toLowerCase(),r=/^([a-z]+)(?:\(.*\))?!?:/,a=h.match(r);if(a){const y=a[1],f=fn[y];if(f)return e.find(g=>g.code===f)||null}const p=h.split(" ")[0],w=fn[p];return w&&e.find(y=>y.code===w)||null},ul=20,ht=new Map,dl=(o,e)=>{if(ht.delete(o),ht.set(o,e),ht.size>ul){const h=ht.keys().next().value;h!==void 0&&ht.delete(h)}},pn=o=>{const e=o.index?.trim();return!!(e&&e!=="?")},ml=o=>{const e=o.working_dir?.trim(),h=o.index?.trim();return!!(e||h==="?")},lm=({isActive:o})=>{const[e,h]=l.useState({active:o,count:0});e.active!==o&&h({active:o,count:e.count+(o?1:0)});const{t:r}=lt(),{git:a,sourceControl:p,runtime:w}=ca(),y=ua(),f=da(),g=ma(f,y)??void 0,M=Xa(),[T,b]=l.useState(null),[G,j]=l.useState(null),E=ot(s=>s.currentSessionId),P=ot(s=>s.newSessionDraft),v=ot(s=>s.setDraftBootstrapPendingDirectory),W=ot(s=>s.worktreeMetadata),N=ot(s=>s.availableWorktrees),D=Ze(g),k=l.useMemo(()=>{if(D)return qr(N,D)??qr(W.values(),D)},[N,D,W]),F=l.useMemo(()=>{if(E)return W.get(E)??k;if(P?.open)return k},[E,k,P?.open,W]),{profiles:_,globalIdentity:q,defaultGitIdentityId:A,loadProfiles:V,loadGlobalIdentity:L,loadDefaultGitIdentityId:te}=ha(en(s=>({profiles:s.profiles,globalIdentity:s.globalIdentity,defaultGitIdentityId:s.defaultGitIdentityId,loadProfiles:s.loadProfiles,loadGlobalIdentity:s.loadGlobalIdentity,loadDefaultGitIdentityId:s.loadDefaultGitIdentityId}))),{rootIsGitRepo:K,gitDirectory:n,nestedRepos:se,repositoryOptions:le,unreadable:X}=fa(g??null,{enabled:o,recheckOnOpen:!0}),re=ga(n??null),R=pa(n??null),ce=Za({directory:n,branch:R?.current,chooseContributor:M.choose}),ee=xa(n,a,p),m=wa(s=>E?s.getAttachment(E):void 0),u=m?ya(m):[],I=m&&!m.degraded&&!m.legacy?m.worktreeRoot??void 0:void 0,O=oo(g,F,R?.current??void 0),J=ba(n??null),ae=va(n??null),xe=ja(n??null),Z=Ca(n??null),be=Sa(n??null),{setActiveDirectory:$e,ensureAll:We,fetchStatus:Q,fetchBranches:de,fetchLog:ue,setLogMaxCount:ve,fetchIdentity:Re,prefetchDiffs:he,clearDiffCache:Ne,moveStatusPathsOptimistically:Ie,restoreStatus:je,bumpIndexRevision:ne,ensureNestedRepos:ke,selectNestedRepo:Fe}=Na(en(s=>({setActiveDirectory:s.setActiveDirectory,ensureAll:s.ensureAll,fetchStatus:s.fetchStatus,fetchBranches:s.fetchBranches,fetchLog:s.fetchLog,setLogMaxCount:s.setLogMaxCount,fetchIdentity:s.fetchIdentity,prefetchDiffs:s.prefetchDiffs,clearDiffCache:s.clearDiffCache,moveStatusPathsOptimistically:s.moveStatusPathsOptimistically,restoreStatus:s.restoreStatus,bumpIndexRevision:s.bumpIndexRevision,ensureNestedRepos:s.ensureNestedRepos,selectNestedRepo:s.selectNestedRepo}))),De=$t(s=>s.isMobile),ge=$t(s=>s.openContextDiff),et=$t(s=>s.openContextPanelTab),[Oe,Ae]=l.useState([]),$=ka(n,p,o),[tt,Ue]=l.useState(!1),st=l.useMemo(()=>{const s=$.read;return!s?.binding||$.status!=="ready"||s.binding.state==="bound"?null:Va(s.binding)?r("gitView.identity.configChanged"):r("gitView.context.needsAttention")},[$.read,$.status,r]),Le=$.read?.binding?.remotes[0]?.name??$.read?.repository.remotes.find(s=>s.name==="origin")?.name??$.read?.repository.remotes[0]?.name??"",Ke=Qs(s=>s.identities),ct=l.useMemo(()=>Ra(Ke),[Ke]),Y=l.useCallback(s=>{const i=$.read?.repository.remotes.find(c=>c.name===Le);return i?Ia(s,Pa(i.fetch.displayUrl),ct):{applicable:!0}},[$.read,Le,ct]),Ce=Qs(s=>s.entries),Ge=Qs(s=>s.refreshIdentityAccounts),qe=cs(s=>s.beginActiveContextsLoad),Je=cs(s=>s.commitActiveContexts),Ye=cs(s=>s.releaseActiveContexts),Be=l.useId();l.useEffect(()=>{if(!o||!g)return;const s=$.scope.runtimeKey,i=qe(s,g,Be);return Je(s,g,Be,i,$.contexts.filter(c=>Jr(Ce[Yr(c)],c).connected)),()=>{Ye(s,g,Be)}},[qe,$.contexts,$.scope.runtimeKey,Je,g,o,Ye,Ce,Be]);const Qe=$.contexts[0]??null,ur=R?.current??null,wt=cs(s=>!ur||!Qe||!Jr(Ce[Yr(Qe)],Qe).connected?null:Fa(s.entries,Qe,ur)),dr=$t(s=>s.navigateToDiff),Rt=l.useRef(null),yt=l.useRef(null),ws=l.useRef(null),It=l.useRef(!0);l.useEffect(()=>()=>{It.current=!1},[]);const Jt=l.useCallback(()=>{Rt.current!==null&&(window.clearTimeout(Rt.current),Rt.current=null)},[]),ys=l.useCallback(s=>{Jt(),Rt.current=window.setTimeout(()=>{Rt.current=null,Ze(s)===Ze(n)&&Q(s,a,{silent:!0})},al)},[Jt,n,Q,a]);l.useEffect(()=>Jt,[Jt]);const mr=l.useCallback(()=>{yt.current!==null&&(window.clearTimeout(yt.current),yt.current=null)},[]),Yt=l.useCallback(()=>{yt.current===null&&(yt.current=window.setTimeout(()=>{yt.current=null,ws.current?.()},0))},[]),hr=l.useCallback(async(s,i,c)=>{if(i==="stage"){if(a.stageGitFiles){await a.stageGitFiles(s,c);return}await Promise.all(c.map(d=>a.stageGitFile(s,d)));return}if(a.unstageGitFiles){await a.unstageGitFiles(s,c);return}await Promise.all(c.map(d=>a.unstageGitFile(s,d)))},[a]),rt=l.useMemo(()=>sl({runMutation:({directory:s,direction:i,paths:c})=>hr(s,i,c),onMutationComplete:({directory:s})=>{ne(s),ys(s)},onMutationError:({directory:s,direction:i,rollback:c},d)=>{c?.(),ne(s),ys(s);const C=r(i==="stage"?"gitView.toast.stageFileFailed":"gitView.toast.unstageFileFailed");x.error(d instanceof Error?d.message:C)},onPathsComplete:s=>{Nr(i=>{const c=new Set(i);return s.forEach(d=>c.delete(d)),c})},scheduleFlush:Yt}),[ne,hr,Yt,ys,r]);l.useEffect(()=>(ws.current=rt.flush,()=>{ws.current=null}),[rt]),l.useEffect(()=>()=>rt.clear(),[rt]),l.useEffect(()=>mr,[mr]),l.useEffect(()=>{if(!o)return;if(!g){b(null);return}const s=Ze(g)??g;b({directory:s,status:null});let i=!1,c=null;const d=async()=>{try{const C=await _a(g);if(i)return;b({directory:s,status:C.status}),C.status==="pending"&&(c=window.setTimeout(()=>{d()},500))}catch{i||b({directory:s,status:null})}};return d(),()=>{i=!0,c!==null&&window.clearTimeout(c)}},[o,g]);const fr=Ze(P?.bootstrapPendingDirectory??null),vn=!!(g&&fr&&fr===Ze(g)),jn=Da(g??null),Ve=Ze(g),bs=T?.directory===Ve?T.status:null,vs=!!(g&&(jn||bs==="pending"||vn&&P?.pendingWorktreeRequestId)),gr=!!(Ve&&G?.directory===Ve);l.useEffect(()=>{if(!Ve)return;if(bs==="failed"){v(null),j(i=>i?.directory===Ve?null:i);return}if(vs){j(i=>i?.directory===Ve&&i.status==="refreshing"?i:{directory:Ve,status:"refreshing"});return}if(G?.directory!==Ve||G.status!=="refreshing"||!n||!a)return;let s=!1;return Q(n,a,{force:!0,silent:!0,throwOnError:!0}).then(()=>{s||j(i=>i?.directory===Ve?null:i)}).catch(()=>{s||j(i=>i?.directory===Ve?{...i,status:"failed"}:i)}),()=>{s=!0}},[Q,a,n,vs,Ve,bs,G,v]);const Cn=vs||gr,js=gr&&G?.status==="failed",pr=l.useMemo(()=>n?ht.get(n)??null:null,[n]),Pt=Oa(s=>s.settingsGitmojiEnabled),[Ft,Cs]=l.useState(null),{gitmojis:bt}=So(Pt);l.useEffect(()=>{const s=I||O?.projectDirectory;if(!s){Cs(null);return}let i=!1;return Ba(s).then(c=>{if(i)return;const d=c.trim();Cs(d&&d!=="HEAD"?d:null)}).catch(()=>{i||Cs(null)}),()=>{i=!0}},[I,O?.projectDirectory]);const[Dt,vt]=l.useState(pr?.commitMessage??""),[xr,Sn]=l.useState([]),[Nn,Ss]=l.useState(!1),wr=l.useRef(null),[yr,Qt]=l.useState(null),[kn,Ns]=l.useState(!1),[br,vr]=l.useState(null),[Me,Vn]=l.useState(25),[Rn,jr]=l.useState(!1),Cr=co(),Sr=l.useRef(new Map),Xt=l.useRef(0),ks=l.useCallback(()=>{Xt.current+=1,It.current&&jr(!0)},[]),Vs=l.useCallback(()=>{Xt.current=Math.max(0,Xt.current-1),It.current&&Xt.current===0&&jr(!1)},[]),[Rs,Zt]=l.useState(new Set),[In,Nr]=l.useState(new Set),[Is,kr]=l.useState(!1),[Pn,Fn]=l.useState(0),[Dn,Vr]=l.useState(!1),[Ps,Fs]=l.useState(pr?.generatedHighlights??[]),On=In.size>0||rt.size()>0||rt.isRunning(),Rr=l.useCallback(()=>{const s=wr.current;s&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{s.scrollTo({top:s.scrollHeight,behavior:"smooth"})})})},[]),Ds=I||O?.projectDirectory||null,Os=R?.current||null,Bn=l.useMemo(()=>{const s=R?.tracking;return s?s.startsWith("origin/"):!0},[R?.tracking]),Ir=l.useMemo(()=>{const s=O?.createdFromBranch,i=typeof s=="string"?s.trim():"",c=typeof R?.current=="string"?R.current.trim():"",d=typeof Ft=="string"?Ft.trim():"";return i?i===c&&i.startsWith("opencode/")&&d.length>0&&d!==i?d:i:d||c||"HEAD"},[O?.createdFromBranch,R,Ft]),es=l.useCallback(()=>{Fs([])},[]),[Bs,Mn]=l.useState(new Set),[ts,Tn]=l.useState(new Map),[ss,Ms]=l.useState(new Set),Ts=l.useRef(ts),Ot=l.useRef(ss),[En,jt]=l.useState(null),[Pr,Fr]=l.useState(""),[we,rs]=l.useState(null),[An,Dr]=l.useState(!1),[Ln,Or]=l.useState(!1),[Gn,Br]=l.useState(null),[Mr,Tr]=l.useState(null),[zn,ns]=l.useState([]),[Hn,Ct]=l.useState(!1),[_n,Bt]=l.useState([]),[is,Mt]=l.useState("merge"),[$n,Es]=l.useState(null),[As,Ls]=l.useState(!1),[Gs,Wn]=l.useState(100),[Un,Kn]=l.useState(0),Te=l.useMemo(()=>E?`openchamber.conflict:${E}`:null,[E]),Er=l.useCallback((s,i,c)=>{if(!Te||typeof window>"u")return;const d={directory:s,conflictFiles:i,operation:c};window.localStorage.setItem(Te,JSON.stringify(d))},[Te]),Ee=l.useCallback(()=>{!Te||typeof window>"u"||window.localStorage.removeItem(Te)},[Te]),Xe=l.useCallback((s,i)=>{Bt(s),Mt(i),Ct(!0),n&&Er(n,s,i)},[n,Er]);l.useEffect(()=>{if(!Te||typeof window>"u"||!n)return;const s=window.localStorage.getItem(Te);if(s)try{const i=JSON.parse(s);if(i.directory!==n){window.localStorage.removeItem(Te);return}Bt(i.conflictFiles??[]),Mt(i.operation??"merge"),Ct(!0)}catch{window.localStorage.removeItem(Te)}},[Te,n]);const[qn,Ar]=l.useState(!1),[as,Tt]=l.useState(null),[zs,Jn]=l.useState("merge"),[Hs,Yn]=l.useState(""),[_s,Qn]=l.useState(""),Xn=l.useCallback(s=>{Ma(s).then(i=>{if(i.ok){x.success(r("gitView.toast.commitHashCopied"));return}x.error(r("gitView.toast.copyFailed"))})},[r]),Zn=l.useCallback(s=>{Mn(i=>{const c=new Set(i);return c.has(s)?c.delete(s):c.add(s),c})},[]);l.useEffect(()=>{Ts.current=ts},[ts]),l.useEffect(()=>{Ot.current=ss},[ss]),l.useEffect(()=>{if(!n||!a)return;const s=Array.from(Bs).filter(c=>!Ts.current.has(c)&&!Ot.current.has(c));if(s.length===0)return;let i=!1;return Ms(c=>{const d=new Set(c);for(const C of s)d.add(C);return Ot.current=d,d}),Promise.all(s.map(c=>(a.getCommitFiles?a.getCommitFiles(n,c):Promise.resolve({files:[]})).then(d=>({hash:c,files:d.files})).catch(d=>(console.error("Failed to fetch commit files:",d),{hash:c,files:[]})))).then(c=>{i||(Tn(d=>{const C=new Map(d);for(const{hash:S,files:B}of c)C.set(S,B);return Ts.current=C,C}),Ms(d=>{const C=new Set(d);for(const{hash:S}of c)C.delete(S);return Ot.current=C,C}))}),()=>{i=!0,Ms(c=>{let d=!1;const C=new Set(c);for(const S of s)C.delete(S)&&(d=!0);return d?(Ot.current=C,C):c})}},[Bs,n,a]),l.useEffect(()=>{if(!n)return;const s=ht.get(n)??null;vt(s?.commitMessage??""),Fs(s?.generatedHighlights??[])},[n]),l.useEffect(()=>{n&&dl(n,{directory:n,commitMessage:Dt,generatedHighlights:Ps})},[Dt,n,Ps]),l.useEffect(()=>{o&&(V(),L(),te())},[o,V,L,te]);const os=l.useCallback(async()=>{if(!n||!a?.getRemotes||re!==!0){Ae([]);return}try{const s=await a.getRemotes(n);It.current&&Ae(s)}catch{It.current&&Ae([])}},[n,a,re]);l.useEffect(()=>{o&&os()},[o,os]),l.useEffect(()=>{o&&g&&n&&($e(g),We(n,a))},[o,g,n,$e,We,a]),l.useEffect(()=>{if(o&&n)return Ta.onGitRefreshHint(s=>{Ze(s.directory)===Ze(n)&&(s.paths?.length&&Ne(n,s.paths),Q(n,a,{silent:!0}))})},[o,Ne,n,Q,a]);const ie=l.useCallback(async(s=!0)=>{if(n)try{await Promise.all([Q(n,a),de(n,a)])}catch(i){if(s){const c=i instanceof Error?i.message:r("gitView.toast.refreshRepositoryFailed");x.error(c)}}},[n,a,Q,de,r]),me=l.useCallback(async()=>{n&&await ue(n,a,Me)},[n,a,ue,Me]),ut=l.useCallback(async s=>{if(!n)return;const i=Promise.allSettled([de(n,a),me()]);s&&i.then(s),await Q(n,a).catch(()=>{})},[n,a,de,Q,me]),$s=l.useCallback(async()=>{n&&await Re(n,a)},[n,a,Re]);l.useEffect(()=>{if(!o||!n||!a?.hasLocalIdentity||re!==!0)return;const s=typeof A=="string"?A.trim():"";if(!s||s==="global")return;const i=mt(),c=JSON.stringify([i,n]);if(Sr.current.get(c)===s)return;let C=!1,S=!1;return(async()=>{try{const z=await a.hasLocalIdentity?.(n);if(C||mt()!==i||z===!0)return;if(a.setGitIdentity){if(ks(),S=!0,await a.setGitIdentity(n,s),C||mt()!==i)return;Sr.current.set(c,s)}await $s()}catch(z){!C&&mt()===i&&console.warn("Failed to auto-apply default git identity:",z)}finally{S&&Vs()}})(),()=>{C=!0}},[o,ks,n,A,Vs,a,re,$s]);const nt=l.useMemo(()=>R?[...R.files??[]].sort((i,c)=>i.path.localeCompare(c.path)):[],[R]),Pe=l.useMemo(()=>nt.filter(pn),[nt]),Ws=l.useMemo(()=>nt.filter(ml),[nt]);l.useEffect(()=>{if(!o||!n||nt.length===0)return;const s=[],i=new Set,c=C=>{!C||i.has(C)||(i.add(C),s.push(C))};if(Pe.forEach(C=>c(C.path)),xr.forEach(c),nt.slice(0,ll).forEach(C=>c(C.path)),s.length===0)return;const d=window.setTimeout(()=>{he(n,a,s,{maxFiles:ol})},120);return()=>{window.clearTimeout(d)}},[o,nt,n,a,he,Pe,xr]);const Et=async(s,i,c=!1)=>{if(!n)return;const d=ee.start();if(!d)return;Qt(s);const C=r(s==="fetch"?"gitView.sync.fetch":s==="pull"?"gitView.sync.pull":s==="publish"?"gitView.publish.title":"gitView.sync.syncChanges");let S=null;try{if(s==="sync"||s==="publish"){const B=await ce.prepare(s==="publish"?"push":"sync",{forceChoose:c,onOperation:d.onOperation});S=Ua(await B())}else if(i&&R)await Xr({action:s,directory:n,remoteName:i.name,status:R,sourceControl:p,git:a,onOperation:d.onOperation});else throw new Se("tracking-required");if(!d.isCurrent())return;s==="fetch"&&i?x.success(r("gitView.toast.fetchedFromRemote",{name:i.name})):s==="pull"&&i?x.success(r("gitView.toast.pulledFromRemote",{name:i.name})):s==="sync"?x.success(S?.kind==="up-to-date"?r("gitView.toast.alreadyUpToDate"):S?.kind==="pulled"?r("gitView.toast.pulledFromRemote",{name:S.remoteName}):S?.kind==="pushed"?r("gitView.toast.pushedToUpstream",{name:S.remoteName}):r("gitView.toast.syncedChanges")):s==="publish"&&x.success(r("gitView.publish.succeeded")),await ut()}catch(B){if(B instanceof Ht||B instanceof Zr){if(B instanceof Ht&&B.read.availability==="available"&&x.error(r("gitView.toast.syncActionFailed",{action:C}),{description:B.message||void 0}),d.isCurrent()&&await ut(),d.isCurrent()&&B instanceof Ht&&B.read.availability==="available"&&B.read.operation.state==="conflicted"&&B.read.operation.error.code==="CONFLICT"){const _e=((await a.getGitStatus(n).catch(()=>null))?.files??[]).filter(Xs).map(Oi=>Oi.path);_e.length>0&&Xe(_e,"merge")}return}if(B instanceof Se&&B.code==="stale-runtime")return;if(B instanceof Se&&ce.errorMessage(B)){x.info(ce.errorMessage(B));return}await ut();const z=B instanceof Se?B.code==="contributor-publish-cancelled-after-update"?r("gitView.toast.contributorPublishCancelledAfterUpdate"):B.code==="contributor-publish-cancelled"?r("gitView.toast.contributorPublishCancelled"):r("gitView.toast.syncActionFailed",{action:C}):B instanceof Error?tn(B,r):r("gitView.toast.syncActionFailed",{action:C});x.error(z)}finally{d.finish(),d.isCurrent()&&Qt(null)}},ei=l.useCallback(async s=>{if(!n)return;const i=s.name.trim();if(!i){x.error(r("gitView.toast.remoteNameRequired"));return}if(i==="origin"){x.error(r("gitView.toast.cannotRemoveOriginRemote"));return}Br(i);try{await a.removeRemote(n,{remote:i}),x.success(r("gitView.toast.removedRemote",{name:i})),await Promise.all([ie(!1),os()])}catch(c){const d=c instanceof Error?c.message:`Failed to remove ${i}`;x.error(d)}finally{Br(null)}},[n,a,os,ie,r]),Lr=async(s={})=>{if(!n)return;if(!Dt.trim()){x.error(r("gitView.toast.enterCommitMessage"));return}const i=Pe.map(S=>S.path).sort();if(i.length===0){x.error(r("gitView.toast.stageFileToCommit"));return}const c=s.pushAfter?"commitAndPush":"commit";vr(c);let d=null,C="pending";try{if(!a.createGitCommit)throw new Error("Git commit is unavailable on this runtime");const S=await a.createGitCommit(n,Dt.trim(),{files:i,stageFiles:[]});C="local",ne(n),ne(n);const B=Cr.committed(S.summary,s);if(vt(""),es(),s.pushAfter){if(d=ee.start(),!d){x.warning(r("gitView.publish.commitKept")),await ut();return}const z=await ce.prepare("push",{onOperation:d.onOperation});Qt("publish"),await z(),C="published",Cr.pushed({deletion:B,origin:s.origin})}await ut(()=>Fn(z=>z+1))}catch(S){if(s.pushAfter&&C==="local"&&x.warning(r("gitView.publish.commitKept")),S instanceof Ht||S instanceof Zr){S instanceof Ht&&S.read.availability==="available"&&x.error(r("gitView.toast.pushFailed"),{description:S.message||void 0}),await ut();return}if(S instanceof Se&&S.code==="stale-runtime")return;if(S instanceof Se&&ce.errorMessage(S)){x.info(ce.errorMessage(S));return}s.pushAfter&&await ut();const B=S instanceof Se?S.code==="contributor-publish-cancelled-after-update"?r("gitView.toast.contributorPublishCancelledAfterUpdate"):S.code==="contributor-publish-cancelled"?r("gitView.toast.contributorPublishCancelled"):r("gitView.toast.syncActionFailed",{action:r("gitView.sync.syncChanges")}):S instanceof Error?tn(S,r):r("gitView.toast.createCommitFailed");x.error(B)}finally{d?.finish(),vr(null),s.pushAfter&&Qt(null)}},ti=l.useCallback(async()=>{if(!n)return;const s=Pe.map(i=>i.path).sort();if(s.length===0){x.error(r("gitView.toast.stageFileToDescribe"));return}console.error("[git-generation][browser] generate button clicked",{directory:n,selectedFiles:s.length}),Vr(!0);try{const{message:i}=await Qr(n,s),c=i.subject?.trim()??"",d=Array.isArray(i.highlights)?i.highlights:[];if(c){let C=c;if(Pt&&bt.length>0){const S=gn(c,bt);if(S){const{code:B,emoji:z}=S;!c.startsWith(B)&&!c.startsWith(z)&&(C=`${B} ${c}`)}}vt(C)}Fs(d),Rr()}catch(i){console.error("[git-generation][browser] GitView generate handler failed",{message:i instanceof Error?i.message:String(i),error:i});const c=i instanceof Error?i.message:r("gitView.toast.generateCommitMessageFailed");x.error(c)}finally{Vr(!1)}},[n,Pe,Pt,bt,Rr,r]),Us=s=>s.reason==="attention"?`${s.attentionReason} in progress`:s.reason==="missing"?"worktree is missing":"worktree is invalid",si=async s=>{if(!n||!R)return;const i=Zs(m);if(i.length>0){x.error(r("gitView.toast.cannotCreateBranch",{reason:Us(i[0])}));return}const c=R.current??null;try{if(await a.createBranch(n,s,c??"HEAD"),x.success(r("gitView.toast.createdBranch",{name:s})),!a.checkoutBranch)throw new Error("Branch checkout is unavailable on this runtime");await a.checkoutBranch(n,s),await ie(),await me()}catch(d){if(d instanceof Se&&d.code==="stale-runtime")return;const C=d instanceof Error?d.message:r("gitView.toast.createBranchFailed");throw x.error(C),d}},ri=async(s,i)=>{if(!n)return;const c=Zs(m);if(c.length>0){x.error(r("gitView.toast.cannotRenameBranch",{reason:Us(c[0])}));return}try{await a.renameBranch(n,s,i),x.success(r("gitView.toast.renamedBranch",{oldName:s,newName:i})),await ie(),await me()}catch(d){const C=d instanceof Error?d.message:r("gitView.toast.renameBranchFailed",{oldName:s,newName:i});x.error(C)}},ni=async s=>{if(!n)return;const i=Zs(m);if(i.length>0){x.error(r("gitView.toast.cannotCheckout",{reason:Us(i[0])}));return}const c=s.replace(/^remotes\//,"");if(R?.current!==c){if((R?.files?.length??0)>0){Tt(c);return}await Ks(c)}},Ks=async s=>{if(!n)return;const i=s;try{if(!a.checkoutBranch)throw new Error("Branch checkout is unavailable on this runtime");const c=await a.checkoutBranch(n,i);x.success(r("gitView.toast.checkedOut",{name:c?.branch||i})),await ie(),await me()}catch(c){const d=c instanceof Error?c.message:r("gitView.toast.checkoutFailed",{name:i});x.error(d)}},ii=async s=>{if(!n)return;const i=mt();ks();try{const c=await $a({directory:n,identity:s,remoteName:Le||null},{git:a,sourceControl:p});if(mt()!==i)return;c.status==="failed"?x.error(r("gitView.toast.applyIdentityFailed")):x.success(r("gitView.toast.appliedIdentity",{name:Wa(s,r)})),await $s()}catch(c){if(mt()!==i)return;const d=c instanceof Error?c.message:r("gitView.toast.applyIdentityFailed");x.error(d)}finally{Vs()}},At=l.useMemo(()=>J?.all?J.all.filter(s=>!s.startsWith("remotes/")).sort():[],[J]),Lt=l.useMemo(()=>J?.all?J.all.filter(s=>s.startsWith("remotes/")).map(s=>s.replace(/^remotes\//,"")).sort():[],[J]),ai=l.useMemo(()=>el(Oe.map(s=>s.name),Lt),[Oe,Lt]),ze=R?.current??null,Gr=l.useMemo(()=>{const s=$.contexts[0]?.primaryRemote;return s?J?.defaultBranches?.[s]:void 0},[$.contexts,J]),oi=l.useMemo(()=>eo({remoteNames:new Set($.contexts[0]?.primaryRemote?[$.contexts[0].primaryRemote]:[]),knownRemoteNames:new Set($.read?.repository.remotes.map(s=>s.name)??[]),localBranches:At,worktreeCreatedFromBranch:O?.createdFromBranch,rootBranchHint:Ft,defaultBranch:Gr,headBranch:ze,fallbackToConventional:!1}),[ze,Gr,$.contexts,At,$.read,Ft,O?.createdFromBranch]),dt=to(n??null,ze,o,$,J,oi);wo(o?n??null:null,o?ze:null,$);const li=l.useMemo(()=>{const s=$.contexts[0]?.primaryRemote,i=s?`${s}/${dt}`:null;return i&&Lt.includes(i)?i:dt},[dt,$.contexts,Lt]),zr=Ea(),ci=l.useMemo(()=>rl(_,q,zr),[_,q,zr]),Hr=$.read?$.read.binding?.providers.find(s=>s.readiness==="ready")?.accountId??null:void 0,ui=l.useMemo(()=>nl(_,q,xe,Hr),[Hr,xe,_,q]),di=Pe.length,mi=Z||yr!==null||br!==null,hi=!!(O&&Ds&&Os&&Bn),_r=!!ze,it=hi&&Ds&&Os&&O?{repoRoot:Ds,sourceBranch:Os,worktreeMetadata:O}:null;l.useEffect(()=>{if(!n||!a||!ae?.all?.length||!ze||!dt||ze===dt){jt(null);return}let s=!1;return(async()=>{try{if(!a.getGitLog)return;const c=await a.getGitLog(n,{from:dt,to:"HEAD",maxCount:Me});if(s)return;const d=new Set((c?.all??[]).map(S=>S.hash).filter(S=>typeof S=="string"&&S.length>0));if(d.size===0){jt(null);return}const C=ae.all.findIndex(S=>!d.has(S.hash));if(C===0){jt(null);return}if(C===-1){jt({insertBeforeIndex:ae.all.length,branchName:ze,direction:"up"});return}jt({insertBeforeIndex:C,branchName:ze,direction:"up"})}catch{s||jt(null)}})(),()=>{s=!0}},[dt,ze,n,a,ae,Me]),l.useEffect(()=>{Es(null)},[n]),l.useEffect(()=>{if(we!=="graph"||!n){we!=="graph"&&Es(null);return}let s=!1;if(Ls(!0),!a.getGitLog){Ls(!1);return}return a.getGitLog(n,{maxCount:Gs,all:!0}).then(i=>{s||Es(i)}).catch(i=>{console.error("Failed to fetch graph log:",i)}).finally(()=>{s||Ls(!1)}),()=>{s=!0}},[we,n,Gs,Un,a]);const Gt=l.useCallback((s,i)=>{if(!n||s.length===0)return;const c=Array.from(new Set(s));Nr(C=>{const S=new Set(C);return c.forEach(B=>S.add(B)),S});const d=Ie(n,c,i);rt.enqueue({directory:n,direction:i,paths:new Set(c),rollback:()=>je(n,d)}),Yt()},[n,rt,Ie,je,Yt]),qs=l.useCallback(async s=>{if(n){Zt(i=>{const c=new Set(i);return c.add(s),c});try{await a.revertGitFile(n,s,{scope:"working"}),x.success(r("gitView.toast.revertedFile",{path:s})),await ie(!1)}catch(i){const c=i instanceof Error?i.message:r("gitView.toast.revertFailed");x.error(c)}finally{Zt(i=>{const c=new Set(i);return c.delete(s),c})}}},[n,ie,a,r]),zt=l.useCallback(async(s,i,c="all")=>{if(!n||s.length===0)return;const d=Array.from(new Set(s));if(Is||d.some(z=>Rs.has(z)))return;const C=new Set(Pe.map(z=>z.path)),S=c==="all"&&d.some(z=>C.has(z));i&&kr(!0),Zt(z=>{const oe=new Set(z);return d.forEach(_e=>oe.add(_e)),oe});const B=[];try{if(await Aa(d,cl,async z=>{try{await a.revertGitFile(n,z,{scope:c})}catch(oe){B.push({path:z,message:oe instanceof Error?oe.message:r("gitView.toast.revertFailed")})}}),S&&B.length<d.length&&ne(n),await ie(!1),B.length===0)x.success(d.length===1?r("gitView.toast.revertedFilesSingle",{count:d.length}):r("gitView.toast.revertedFilesPlural",{count:d.length}));else if(B.length===d.length)x.error(B[0]?.message||r("gitView.toast.revertFailed"));else{const z=d.length-B.length;x.warning(z===1?r("gitView.toast.revertedSomeSingle",{success:z,failed:B.length}):r("gitView.toast.revertedSomePlural",{success:z,failed:B.length}))}}finally{Zt(z=>{const oe=new Set(z);return d.forEach(_e=>oe.delete(_e)),oe}),i&&kr(!1)}},[ne,n,a,Is,ie,Rs,Pe,r]),fi=l.useCallback(async s=>{await zt(s,!0)},[zt]),gi=l.useCallback(async s=>{await zt(s,!1,"working")},[zt]),Js=l.useCallback((s,i)=>{if(y&&!De){ge(y,s,i);return}dr(s,i)},[y,De,dr,ge]),pi=l.useCallback(()=>Ns(!0),[]),xi=l.useMemo(()=>{const s=[];return Pe.length>0&&s.push({id:"staged",title:r("gitView.changes.stagedTitle"),entries:Pe,statsScope:"staged",actionSymbol:"-",actionAllLabel:r("gitView.changes.unstageAllAria"),getActionLabel:i=>r("gitView.changes.unstageFileAria",{path:i}),onActionFile:i=>{Gt([i],"unstage")},onActionAll:i=>{Gt(i,"unstage")},onViewDiff:i=>Js(i,!0),onRevertFile:qs,showRevertActions:!1,accent:!0}),Ws.length>0&&s.push({id:"unstaged",title:r("gitView.changes.title"),entries:Ws,statsScope:"working",actionSymbol:"+",actionAllLabel:r("gitView.changes.stageAllAria"),getActionLabel:i=>r("gitView.changes.stageFileAria",{path:i}),onActionFile:i=>{Gt([i],"stage")},onActionAll:i=>{Gt(i,"stage")},onViewDiff:i=>Js(i,!1),onRevertFile:qs}),s},[qs,Js,Gt,Pe,r,Ws]),wi=l.useCallback(s=>{if(s.length===0)return;const i=s.map(c=>c.trim()).filter(Boolean);if(i.length===0){es();return}vt(c=>{const d=c.trim(),C=d.length>0?`
3
3
 
4
4
  `:"";return`${d}${C}${i.join(`
@@ -1 +1 @@
1
- import{R as o,j as a}from"./vendor-react--VO_rL_p.js";import{bZ as re,u as ne,b_ as ie,b$ as oe,Q as S,ac as q,ad as L,B as U,ae as $,b6 as se,c0 as ce,c1 as W}from"./useAppFontEffects-D9nf8G19.js";import{b9 as ae,ba as ue,bb as le,bc as pe,bd as me}from"./katex.min-g52ii4Gs.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-base-ui-CqKCZJyd.js";import"./vendor-floating-ui-utils-BzXdqYpP.js";import"./vendor-floating-ui-dom-WyXykhNi.js";import"./vendor-floating-ui-core-CXmKXOXc.js";import"./vendor-floating-ui-react-dom-Cy8dRGoy.js";import"./vendor-use-sync-external-store-CfLJGVyr.js";import"./vendor-zod--raI7LhK.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-zustand-C9tWdk0j.js";import"./vendor-dnd-kit-core-Br1Cs7RV.js";import"./vendor-dnd-kit-utilities-DZ9KbT5S.js";import"./vendor-dnd-kit-accessibility-CYclfhtC.js";import"./vendor-dnd-kit-sortable-DpfLEOLv.js";import"./vendor-tanstack-react-virtual-CqfECoM0.js";import"./vendor-tanstack-virtual-core-BdFnkr_2.js";import"./vendor-framer-motion-C_wK4GIM.js";import"./vendor-motion-dom-HXPOMxb7.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-capacitor-core-B4EWRrHz.js";import"./vendor-codemirror-commands-CjjsURR-.js";import"./vendor-codemirror-state-Cd8udR5z.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-view-Ciie9ey-.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-codemirror-language-8HZTPOnt.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CZEcqU6G.js";import"./vendor-codemirror-streamparser-CmlTsbN2.js";import"./vendor-codemirror-lang-javascript-DmqaSK_j.js";import"./vendor-lezer-javascript-CWSwshuO.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-BGedy2gC.js";import"./vendor-codemirror-lang-json-DVAYKmoO.js";import"./vendor-lezer-json-Cn1mncjr.js";import"./vendor-codemirror-lang-css-BLpgXfL2.js";import"./vendor-lezer-css-B2Hx_Nps.js";import"./vendor-codemirror-lang-html-S3jxr3Mo.js";import"./vendor-lezer-html-Cr8K5DGw.js";import"./vendor-codemirror-lang-markdown-D1jveRI5.js";import"./vendor-lezer-markdown-TQKzBB8i.js";import"./vendor-codemirror-language-data-z3n6zAAT.js";import"./vendor-codemirror-lang-python-B-5UC9Ui.js";import"./vendor-lezer-python-BUoImtUb.js";import"./vendor-sonner-Dw26OnzC.js";import"./vendor-cmdk-BtSpU-Io.js";import"./vendor-radix-ui-react-dialog-OIW6VLWw.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-D4RvEbuR.js";import"./vendor-radix-ui-react-context-BbFoxCHu.js";import"./vendor-radix-ui-react-id-aGag8i_5.js";import"./vendor-radix-ui-react-use-layout-effect-B1oLzD-j.js";import"./vendor-radix-ui-react-use-controllable-state-BjnNPGHq.js";import"./vendor-radix-ui-react-dismissable-layer-DpT6mMbO.js";import"./vendor-radix-ui-react-primitive-CrN9dRDb.js";import"./vendor-radix-ui-react-slot-BjbalUfz.js";import"./vendor-radix-ui-react-use-callback-ref-CcC_buIU.js";import"./vendor-radix-ui-react-use-escape-keydown-Cp1WWKTC.js";import"./vendor-radix-ui-react-focus-scope-D1noLHmd.js";import"./vendor-radix-ui-react-portal-BlUEzfrF.js";import"./vendor-radix-ui-react-presence-BGqFfiW4.js";import"./vendor-radix-ui-react-focus-guards-CSS2IbZC.js";import"./vendor-react-remove-scroll-Der_cv-1.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-Clwl9llp.js";import"./vendor-react-style-singleton-D_xJlTqU.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-BdLl6ZIw.js";import"./vendor-use-callback-ref-CXJF1lEr.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-legendapp-list-CEhBoV5L.js";import"./vendor-streamdown-BbSYZ3NF.js";import"./vendor-markdown-BTUqNk6W.js";import"./vendor-mdast-util-from-markdown-CZHjOE75.js";import"./vendor-micromark-util-decode-numeric-character-reference-CNs1qBpV.js";import"./vendor-micromark-util-decode-string-fHsnqYdj.js";import"./vendor-decode-named-character-reference-C3-224fz.js";import"./vendor-micromark-util-normalize-identifier-C9ANKk3v.js";import"./vendor-micromark-AWM-NZXP.js";import"./vendor-micromark-util-combine-extensions-d8XJZrgA.js";import"./vendor-micromark-util-chunked-DrRIdSP-.js";import"./vendor-micromark-factory-space-PzSHLgmq.js";import"./vendor-micromark-util-character-CW3Cu1MS.js";import"./vendor-micromark-core-commonmark-kzTLNXAm.js";import"./vendor-micromark-util-classify-character-tcLuZZwM.js";import"./vendor-micromark-util-resolve-all-PQCKh0dx.js";import"./vendor-micromark-util-subtokenize-BF1Jf29a.js";import"./vendor-micromark-factory-destination-Sj0xfi0V.js";import"./vendor-micromark-factory-label-amyP0HdC.js";import"./vendor-micromark-factory-title-khnLkZK6.js";import"./vendor-micromark-factory-whitespace-eIB00uTl.js";import"./vendor-micromark-util-html-tag-name-DbKNfynz.js";import"./vendor-unist-util-stringify-position-Ch_qCilz.js";import"./vendor-mdast-util-to-string-C_aolqmU.js";import"./vendor-unist-util-visit-DhPeCsfG.js";import"./vendor-unist-util-visit-parents-DlviEg7Z.js";import"./vendor-unist-util-is-BPZGFiMU.js";import"./vendor-hast-util-raw-DvvLJg15.js";import"./vendor-ungap-structured-clone--gfxRhYI.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-parse5-DwmzEj2o.js";import"./vendor-entities-wUUgTZDW.js";import"./vendor-web-namespaces-bsVAaBS1.js";import"./vendor-zwitch-C2o2j-tx.js";import"./vendor-unist-util-position-60F3QETU.js";import"./vendor-hast-util-from-parse5-Ba3T6RJI.js";import"./vendor-devlop-0Dp3JUBc.js";import"./vendor-property-information-Boo8Xpef.js";import"./vendor-hastscript-BrPNioaz.js";import"./vendor-comma-separated-tokens-CRUGqg4f.js";import"./vendor-space-separated-tokens-D7QSIrTI.js";import"./vendor-hast-util-parse-selector-TXfch5wI.js";import"./vendor-vfile-location-LfEFwJ2h.js";import"./vendor-hast-util-to-parse5-BoysVIPW.js";import"./vendor-hast-util-sanitize-2aGO5ay8.js";import"./vendor-micromark-extension-gfm-CsfPlnlB.js";import"./vendor-micromark-extension-gfm-autolink-literal-BYug7onl.js";import"./vendor-micromark-extension-gfm-footnote-OFl1FCH2.js";import"./vendor-micromark-extension-gfm-strikethrough-CyFiuwBf.js";import"./vendor-micromark-extension-gfm-table-dgw4LfUw.js";import"./vendor-micromark-extension-gfm-task-list-item-Dnadzr9U.js";import"./vendor-mdast-util-gfm-CroMDYLM.js";import"./vendor-mdast-util-gfm-autolink-literal-CTruMtvI.js";import"./vendor-ccount-c2V3InAJ.js";import"./vendor-mdast-util-find-and-replace-DB9iC-bx.js";import"./vendor-escape-string-regexp-BaJN9MlJ.js";import"./vendor-mdast-util-gfm-footnote-C-csI7OF.js";import"./vendor-mdast-util-gfm-strikethrough-BcskTdio.js";import"./vendor-mdast-util-gfm-table-DhPwQIyj.js";import"./vendor-markdown-table-DvhhVmnL.js";import"./vendor-mdast-util-to-markdown-Cl3qaiyc.js";import"./vendor-longest-streak-CtXnX3Xp.js";import"./vendor-mdast-util-phrasing-4oVbNLC3.js";import"./vendor-mdast-util-gfm-task-list-item-DMU5mK_M.js";import"./vendor-mdast-util-to-hast-CWnLaQSO.js";import"./vendor-micromark-util-sanitize-uri-BbwQ7CLk.js";import"./vendor-trim-lines-D8znQY54.js";import"./vendor-micromark-extension-cjk-friendly-BzZDGrF5.js";import"./vendor-micromark-extension-cjk-friendly-util-D5lVNoxW.js";import"./vendor-get-east-asian-width-CPhS2cOv.js";import"./vendor-micromark-util-symbol-JJPacVTp.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-BZ3pe_qd.js";import"./vendor-micromark-extension-cjk-friendly-gfm-strikethrough-CqW-Ep4M.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-gfm-strikethrough-BdPDQFO7.js";import"./vendor-hast-util-from-html-isomorphic-B0Kn01s9.js";import"./vendor-hast-util-from-dom-DeNf9aYW.js";import"./vendor-katex-DBqql0K7.js";import"./vendor-hast-util-to-text-0GXLnBvt.js";import"./vendor-hast-util-is-element-CuOmiqQi.js";import"./vendor-unist-util-find-after-CMaZmLxc.js";import"./vendor-micromark-extension-math-BRFoDziv.js";import"./vendor-mdast-util-math-wB-IJCL0.js";import"./vendor-remend-r8cP_t-e.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-marked-DN3zOnEe.js";import"./vendor-hast-util-to-jsx-runtime-Bq6JeJCx.js";import"./vendor-style-to-js-CI2G4dgu.js";import"./vendor-style-to-object-BAv4SQXc.js";import"./vendor-inline-style-parser-BlqBsVO4.js";import"./vendor-hast-util-whitespace-D4Wp6AEg.js";import"./vendor-estree-util-is-identifier-name-BgBfM8ME.js";import"./vendor-vfile-message-DqhD22jI.js";import"./vendor-unified-1CQKw2_w.js";import"./vendor-bail-FqpXQuLt.js";import"./vendor-extend-B94qxKr5.js";import"./vendor-is-plain-obj-C1gvLhAf.js";import"./vendor-trough-B_b8ryxu.js";import"./vendor-vfile-BCWrK60u.js";import"./vendor-html-url-attributes-D46m5wfe.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./vendor-opencode-client-CeybcDBQ.js";import"./vendor-fuse.js-Dw8P0qyA.js";const de=1,he=8e3,fe=6e4,ge={refreshAuth:ue,clearUrlAuthToken:ae,openSocket:i=>le(pe().websocket(`/api/guests/${i}/surface/ws`)),isPaused:()=>document.visibilityState==="hidden"||!navigator.onLine,onWake:i=>(window.addEventListener("online",i),document.addEventListener("visibilitychange",i),()=>{window.removeEventListener("online",i),document.removeEventListener("visibilitychange",i)})};class ye{constructor(n,r,s=ge){this.guestId=n,this.handlers=r,this.dependencies=s}guestId;handlers;dependencies;socket=null;pendingFrame=null;reconnectTimer=null;wakeCleanup=null;failures=0;generation=0;disposed=!1;ended=!1;start(){this.handlers.onConnection({status:"connecting"}),this.connect()}dispose(){this.disposed=!0,this.generation+=1,this.cancelReconnect();const n=this.socket;if(this.socket=null,n)try{n.close()}catch{}}ack(n){this.send({type:"ack",seq:n})}sendInput(n){return n.length===0?!1:this.send({type:"input",events:n})}release(){this.send({type:"release"})}resize(n,r){this.send({type:"resize",width:n,height:r})}requestClipboard(n){this.send({type:"clipboard-read",id:n})}send(n){const r=this.socket;if(!r||r.readyState!==de)return!1;try{return r.send(JSON.stringify(n)),!0}catch{return!1}}async connect(){if(this.disposed||this.ended)return;const n=this.generation;try{await this.dependencies.refreshAuth()}catch{this.scheduleReconnect();return}if(n!==this.generation||this.disposed)return;let r;try{r=this.dependencies.openSocket(this.guestId)}catch{this.scheduleReconnect();return}r.binaryType="arraybuffer",this.socket=r;let s=!1;r.onopen=()=>{this.socket===r&&(s=!0,this.failures=0,this.pendingFrame=null,this.handlers.onConnection({status:"open"}))},r.onmessage=d=>{this.socket===r&&this.handleMessage(d.data)},r.onerror=()=>{},r.onclose=()=>{this.socket===r&&(this.socket=null,this.pendingFrame=null,!(this.disposed||this.ended)&&(s||this.dependencies.clearUrlAuthToken(),this.scheduleReconnect()))}}handleMessage(n){if(n instanceof ArrayBuffer){const s=this.pendingFrame;if(this.pendingFrame=null,!s)return;this.handlers.onFrame({...s,bytes:n});return}let r;try{const s=re.safeParse(JSON.parse(n));if(!s.success)return;r=s.data}catch{return}switch(r.type){case"hello":this.handlers.onViewer?.(r.viewerId);return;case"frame":this.pendingFrame={seq:r.seq,width:r.width,height:r.height,mime:r.mime,agentActive:r.agentActive},r.title&&(this.pendingFrame.title=r.title);return;case"control":this.handlers.onControl({controller:r.controller,mine:r.mine});return;case"resized":this.handlers.onResized?.({width:r.width,height:r.height});return;case"clipboard":this.handlers.onClipboard?.(r.id,r.text);return;case"error":this.handlers.onError?.(r.code,r.message);return;case"ended":this.ended=!0,this.cancelReconnect(),this.handlers.onConnection({status:"ended",reason:r.reason});return}}retry(){this.disposed||(this.ended=!1,this.failures=0,this.handlers.onConnection({status:"connecting"}),this.connect())}scheduleReconnect(){if(this.reconnectTimer||this.disposed||this.ended)return;this.failures+=1;const n=this.dependencies.isPaused()?fe:Math.min(500*2**Math.min(this.failures-1,10),he);this.handlers.onConnection({status:"reconnecting",attempt:this.failures});const r=()=>{this.dependencies.isPaused()||(this.cancelReconnect(),this.connect())};this.wakeCleanup=this.dependencies.onWake(r),this.reconnectTimer=setTimeout(r,n)}cancelReconnect(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.wakeCleanup?.(),this.wakeCleanup=null}}const xe=250,T=i=>({alt:i.altKey,ctrl:i.ctrlKey,meta:i.metaKey,shift:i.shiftKey}),be=i=>(i.metaKey||i.ctrlKey)&&!i.altKey&&i.key.toLowerCase()==="c",we=i=>(i.metaKey||i.ctrlKey)&&!i.altKey&&i.key.toLowerCase()==="v",zn=({mode:i})=>{const{t:n}=ne(),r=me(i),s=ie(t=>t.guests.find(e=>e.id===r)??null),d=s!==null&&oe(s)&&s.service?.surface===!0,V=`${s?.version??""}:${s?.revision??0}`,b=o.useRef(null),w=o.useRef(null),l=o.useRef(null),C=o.useRef(null),y=o.useRef([]),h=o.useRef(null),F=o.useRef(0),k=o.useRef(!1),R=o.useRef({controller:"none",mine:!1}),[p,X]=o.useState({status:"connecting"}),[m,G]=o.useState({controller:"none",mine:!1}),j=o.useCallback(t=>{R.current=t,G(t)},[]),[A,Y]=o.useState(""),[H,J]=o.useState(!1),[f,I]=o.useState(!1),[K,M]=o.useState(!1),E=o.useCallback(async t=>{const e=w.current,c=l.current;if(!(!e||!c))try{const u=await createImageBitmap(new Blob([t.bytes],{type:t.mime}));(e.width!==t.width||e.height!==t.height)&&(e.width=t.width,e.height=t.height),e.getContext("2d")?.drawImage(u,0,0,t.width,t.height),u.close(),C.current={width:t.width,height:t.height},I(!0),Y(t.title??""),J(t.agentActive)}catch{}finally{c.ack(t.seq)}},[]);o.useEffect(()=>{if(!d)return;let t=null;const e=new ye(r,{onViewer:c=>{t&&W(r,t),t=c,ce(r,c)},onFrame:c=>{E(c)},onControl:j,onConnection:X,onClipboard:(c,u)=>{se(u)}});return l.current=e,e.start(),()=>{t&&W(r,t),e.dispose(),l.current===e&&(l.current=null),h.current!==null&&cancelAnimationFrame(h.current),h.current=null,y.current=[],C.current=null,I(!1)}},[d,E,r,V,j]),o.useEffect(()=>{const t=b.current;if(!t||!d)return;let e=null;const c=new ResizeObserver(u=>{const g=u[0];if(!g)return;const{width:v,height:te}=g.contentRect;e&&clearTimeout(e),e=setTimeout(()=>{e=null;const B=window.devicePixelRatio||1,D=Math.round(v*B),z=Math.round(te*B);D>0&&z>0&&l.current?.resize(D,z)},xe)});return c.observe(t),()=>{c.disconnect(),e&&clearTimeout(e)}},[d]);const x=o.useCallback(t=>{y.current.push(t),h.current===null&&(h.current=requestAnimationFrame(()=>{h.current=null;const e=y.current;y.current=[],l.current?.sendInput(e),k.current&&(k.current=!1,F.current+=1,l.current?.requestClipboard(`copy-${F.current}`))}))},[]),N=o.useCallback(t=>{const e=w.current,c=C.current;if(!e||!c)return null;const u=e.getBoundingClientRect();if(u.width===0||u.height===0)return null;const g=(t.clientX-u.left)/u.width*c.width,v=(t.clientY-u.top)/u.height*c.height;return{x:Math.round(g),y:Math.round(v)}},[]),P=t=>e=>{if(!f||t==="move"&&e.buttons===0&&!(R.current.controller==="user"&&R.current.mine))return;const c=N(e);c&&(t==="down"?(b.current?.focus(),e.currentTarget.setPointerCapture(e.pointerId)):t==="up"&&e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),e.preventDefault(),x({type:"pointer",action:t,x:c.x,y:c.y,button:t==="move"?-1:e.button,buttons:e.buttons,modifiers:T(e)}))},Z=t=>{if(!f)return;const e=N(t);e&&(t.preventDefault(),x({type:"wheel",x:e.x,y:e.y,deltaX:t.deltaX,deltaY:t.deltaY,modifiers:T(t)}))},O=t=>e=>{f&&(we(e)||(e.preventDefault(),e.stopPropagation(),t==="down"&&be(e)&&(k.current=!0),x({type:"key",action:t,key:e.key,code:e.code,keyCode:e.keyCode,modifiers:T(e)})))},Q=t=>{if(!f)return;const e=t.clipboardData.getData("text/plain");t.preventDefault(),e&&x({type:"text",text:e})},_=()=>{l.current?.release()};if(!s)return null;if(!d)return a.jsx("div",{className:"flex h-full items-center justify-center px-6 text-sm text-muted-foreground",children:n("contextPanel.surface.unavailable")});const ee=p.status==="connecting"?"contextPanel.surface.status.connecting":p.status==="reconnecting"?"contextPanel.surface.status.reconnecting":p.status==="ended"?`contextPanel.surface.ended.${p.reason}`:m.controller==="user"?m.mine?"contextPanel.surface.status.youControl":"contextPanel.surface.status.otherControls":m.controller==="agent"||H?"contextPanel.surface.status.agentWorking":K?"contextPanel.surface.status.readyFocused":"contextPanel.surface.status.ready";return a.jsxs("div",{className:"flex h-full flex-col bg-[var(--surface-background)]",children:[a.jsxs("div",{className:"flex h-8 shrink-0 items-center gap-2 border-b border-border px-3",children:[a.jsx("span",{className:"typography-meta min-w-0 flex-1 truncate text-foreground",title:A||s.name,children:A||s.name}),a.jsx("span",{className:S("typography-meta shrink-0 truncate",m.controller==="user"&&m.mine?"text-foreground":"text-muted-foreground"),"aria-live":"polite",children:n(ee)}),m.controller==="user"&&m.mine?a.jsxs(q,{children:[a.jsx(L,{asChild:!0,children:a.jsx(U,{size:"xs",variant:"outline",onClick:_,children:n("contextPanel.surface.handBack")})}),a.jsx($,{side:"bottom",sideOffset:6,children:n("contextTooltips.panel.releaseSurface")})]}):null,p.status==="ended"?a.jsxs(q,{children:[a.jsx(L,{asChild:!0,children:a.jsx(U,{size:"xs",variant:"outline",onClick:()=>l.current?.retry(),children:n("contextPanel.surface.retry")})}),a.jsx($,{side:"bottom",sideOffset:6,children:n("contextTooltips.panel.reconnectSurface")})]}):null]}),a.jsxs("div",{ref:b,tabIndex:0,role:"application","aria-label":n("contextPanel.surface.canvasAria",{name:s.name}),"data-terminal-owner":`surface:${r}`,className:S("relative flex min-h-0 flex-1 items-center justify-center overflow-hidden outline-none",K?"ring-1 ring-inset ring-[var(--interactive-selection-border)]":""),onFocus:()=>M(!0),onBlur:()=>M(!1),onKeyDown:O("down"),onKeyUp:O("up"),onPaste:Q,children:[a.jsx("canvas",{ref:w,className:S("max-h-full max-w-full",f?"block":"hidden",m.controller==="user"&&!m.mine?"cursor-not-allowed":"cursor-default"),onPointerDown:P("down"),onPointerMove:P("move"),onPointerUp:P("up"),onWheel:Z,onContextMenu:t=>t.preventDefault()}),!f||p.status!=="open"?a.jsx("div",{className:"absolute inset-0 flex items-center justify-center px-6 text-center text-sm text-muted-foreground",children:n(p.status==="ended"?`contextPanel.surface.ended.${p.reason}`:p.status==="reconnecting"?"contextPanel.surface.status.reconnecting":"contextPanel.surface.status.connecting")}):null]})]})};export{zn as GuestSurfacePane};
1
+ import{R as o,j as a}from"./vendor-react--VO_rL_p.js";import{bZ as re,u as ne,b_ as ie,b$ as oe,Q as S,ac as q,ad as L,B as U,ae as $,b6 as se,c0 as ce,c1 as W}from"./useAppFontEffects-3RimJo4B.js";import{b9 as ae,ba as ue,bb as le,bc as pe,bd as me}from"./katex.min-Bs5OLoA1.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-base-ui-CqKCZJyd.js";import"./vendor-floating-ui-utils-BzXdqYpP.js";import"./vendor-floating-ui-dom-WyXykhNi.js";import"./vendor-floating-ui-core-CXmKXOXc.js";import"./vendor-floating-ui-react-dom-Cy8dRGoy.js";import"./vendor-use-sync-external-store-CfLJGVyr.js";import"./vendor-zod--raI7LhK.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-zustand-C9tWdk0j.js";import"./vendor-dnd-kit-core-Br1Cs7RV.js";import"./vendor-dnd-kit-utilities-DZ9KbT5S.js";import"./vendor-dnd-kit-accessibility-CYclfhtC.js";import"./vendor-dnd-kit-sortable-DpfLEOLv.js";import"./vendor-tanstack-react-virtual-CqfECoM0.js";import"./vendor-tanstack-virtual-core-BdFnkr_2.js";import"./vendor-framer-motion-C_wK4GIM.js";import"./vendor-motion-dom-HXPOMxb7.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-capacitor-core-B4EWRrHz.js";import"./vendor-codemirror-commands-CjjsURR-.js";import"./vendor-codemirror-state-Cd8udR5z.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-view-Ciie9ey-.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-codemirror-language-8HZTPOnt.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CZEcqU6G.js";import"./vendor-codemirror-streamparser-CmlTsbN2.js";import"./vendor-codemirror-lang-javascript-DmqaSK_j.js";import"./vendor-lezer-javascript-CWSwshuO.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-BGedy2gC.js";import"./vendor-codemirror-lang-json-DVAYKmoO.js";import"./vendor-lezer-json-Cn1mncjr.js";import"./vendor-codemirror-lang-css-BLpgXfL2.js";import"./vendor-lezer-css-B2Hx_Nps.js";import"./vendor-codemirror-lang-html-S3jxr3Mo.js";import"./vendor-lezer-html-Cr8K5DGw.js";import"./vendor-codemirror-lang-markdown-D1jveRI5.js";import"./vendor-lezer-markdown-TQKzBB8i.js";import"./vendor-codemirror-language-data-DRsX0PKK.js";import"./vendor-codemirror-lang-python-B-5UC9Ui.js";import"./vendor-lezer-python-BUoImtUb.js";import"./vendor-sonner-Dw26OnzC.js";import"./vendor-cmdk-BtSpU-Io.js";import"./vendor-radix-ui-react-dialog-OIW6VLWw.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-D4RvEbuR.js";import"./vendor-radix-ui-react-context-BbFoxCHu.js";import"./vendor-radix-ui-react-id-aGag8i_5.js";import"./vendor-radix-ui-react-use-layout-effect-B1oLzD-j.js";import"./vendor-radix-ui-react-use-controllable-state-BjnNPGHq.js";import"./vendor-radix-ui-react-dismissable-layer-DpT6mMbO.js";import"./vendor-radix-ui-react-primitive-CrN9dRDb.js";import"./vendor-radix-ui-react-slot-BjbalUfz.js";import"./vendor-radix-ui-react-use-callback-ref-CcC_buIU.js";import"./vendor-radix-ui-react-use-escape-keydown-Cp1WWKTC.js";import"./vendor-radix-ui-react-focus-scope-D1noLHmd.js";import"./vendor-radix-ui-react-portal-BlUEzfrF.js";import"./vendor-radix-ui-react-presence-BGqFfiW4.js";import"./vendor-radix-ui-react-focus-guards-CSS2IbZC.js";import"./vendor-react-remove-scroll-Der_cv-1.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-Clwl9llp.js";import"./vendor-react-style-singleton-D_xJlTqU.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-BdLl6ZIw.js";import"./vendor-use-callback-ref-CXJF1lEr.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-legendapp-list-CEhBoV5L.js";import"./vendor-streamdown-BbSYZ3NF.js";import"./vendor-markdown-BTUqNk6W.js";import"./vendor-mdast-util-from-markdown-CZHjOE75.js";import"./vendor-micromark-util-decode-numeric-character-reference-CNs1qBpV.js";import"./vendor-micromark-util-decode-string-fHsnqYdj.js";import"./vendor-decode-named-character-reference-C3-224fz.js";import"./vendor-micromark-util-normalize-identifier-C9ANKk3v.js";import"./vendor-micromark-AWM-NZXP.js";import"./vendor-micromark-util-combine-extensions-d8XJZrgA.js";import"./vendor-micromark-util-chunked-DrRIdSP-.js";import"./vendor-micromark-factory-space-PzSHLgmq.js";import"./vendor-micromark-util-character-CW3Cu1MS.js";import"./vendor-micromark-core-commonmark-kzTLNXAm.js";import"./vendor-micromark-util-classify-character-tcLuZZwM.js";import"./vendor-micromark-util-resolve-all-PQCKh0dx.js";import"./vendor-micromark-util-subtokenize-BF1Jf29a.js";import"./vendor-micromark-factory-destination-Sj0xfi0V.js";import"./vendor-micromark-factory-label-amyP0HdC.js";import"./vendor-micromark-factory-title-khnLkZK6.js";import"./vendor-micromark-factory-whitespace-eIB00uTl.js";import"./vendor-micromark-util-html-tag-name-DbKNfynz.js";import"./vendor-unist-util-stringify-position-Ch_qCilz.js";import"./vendor-mdast-util-to-string-C_aolqmU.js";import"./vendor-unist-util-visit-DhPeCsfG.js";import"./vendor-unist-util-visit-parents-DlviEg7Z.js";import"./vendor-unist-util-is-BPZGFiMU.js";import"./vendor-hast-util-raw-DvvLJg15.js";import"./vendor-ungap-structured-clone--gfxRhYI.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-parse5-DwmzEj2o.js";import"./vendor-entities-wUUgTZDW.js";import"./vendor-web-namespaces-bsVAaBS1.js";import"./vendor-zwitch-C2o2j-tx.js";import"./vendor-unist-util-position-60F3QETU.js";import"./vendor-hast-util-from-parse5-Ba3T6RJI.js";import"./vendor-devlop-0Dp3JUBc.js";import"./vendor-property-information-Boo8Xpef.js";import"./vendor-hastscript-BrPNioaz.js";import"./vendor-comma-separated-tokens-CRUGqg4f.js";import"./vendor-space-separated-tokens-D7QSIrTI.js";import"./vendor-hast-util-parse-selector-TXfch5wI.js";import"./vendor-vfile-location-LfEFwJ2h.js";import"./vendor-hast-util-to-parse5-BoysVIPW.js";import"./vendor-hast-util-sanitize-2aGO5ay8.js";import"./vendor-micromark-extension-gfm-CsfPlnlB.js";import"./vendor-micromark-extension-gfm-autolink-literal-BYug7onl.js";import"./vendor-micromark-extension-gfm-footnote-OFl1FCH2.js";import"./vendor-micromark-extension-gfm-strikethrough-CyFiuwBf.js";import"./vendor-micromark-extension-gfm-table-dgw4LfUw.js";import"./vendor-micromark-extension-gfm-task-list-item-Dnadzr9U.js";import"./vendor-mdast-util-gfm-CroMDYLM.js";import"./vendor-mdast-util-gfm-autolink-literal-CTruMtvI.js";import"./vendor-ccount-c2V3InAJ.js";import"./vendor-mdast-util-find-and-replace-DB9iC-bx.js";import"./vendor-escape-string-regexp-BaJN9MlJ.js";import"./vendor-mdast-util-gfm-footnote-C-csI7OF.js";import"./vendor-mdast-util-gfm-strikethrough-BcskTdio.js";import"./vendor-mdast-util-gfm-table-DhPwQIyj.js";import"./vendor-markdown-table-DvhhVmnL.js";import"./vendor-mdast-util-to-markdown-Cl3qaiyc.js";import"./vendor-longest-streak-CtXnX3Xp.js";import"./vendor-mdast-util-phrasing-4oVbNLC3.js";import"./vendor-mdast-util-gfm-task-list-item-DMU5mK_M.js";import"./vendor-mdast-util-to-hast-CWnLaQSO.js";import"./vendor-micromark-util-sanitize-uri-BbwQ7CLk.js";import"./vendor-trim-lines-D8znQY54.js";import"./vendor-micromark-extension-cjk-friendly-BzZDGrF5.js";import"./vendor-micromark-extension-cjk-friendly-util-D5lVNoxW.js";import"./vendor-get-east-asian-width-CPhS2cOv.js";import"./vendor-micromark-util-symbol-JJPacVTp.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-BZ3pe_qd.js";import"./vendor-micromark-extension-cjk-friendly-gfm-strikethrough-CqW-Ep4M.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-gfm-strikethrough-BdPDQFO7.js";import"./vendor-hast-util-from-html-isomorphic-B0Kn01s9.js";import"./vendor-hast-util-from-dom-DeNf9aYW.js";import"./vendor-katex-DBqql0K7.js";import"./vendor-hast-util-to-text-0GXLnBvt.js";import"./vendor-hast-util-is-element-CuOmiqQi.js";import"./vendor-unist-util-find-after-CMaZmLxc.js";import"./vendor-micromark-extension-math-BRFoDziv.js";import"./vendor-mdast-util-math-wB-IJCL0.js";import"./vendor-remend-r8cP_t-e.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-marked-DN3zOnEe.js";import"./vendor-hast-util-to-jsx-runtime-Bq6JeJCx.js";import"./vendor-style-to-js-CI2G4dgu.js";import"./vendor-style-to-object-BAv4SQXc.js";import"./vendor-inline-style-parser-BlqBsVO4.js";import"./vendor-hast-util-whitespace-D4Wp6AEg.js";import"./vendor-estree-util-is-identifier-name-BgBfM8ME.js";import"./vendor-vfile-message-DqhD22jI.js";import"./vendor-unified-1CQKw2_w.js";import"./vendor-bail-FqpXQuLt.js";import"./vendor-extend-B94qxKr5.js";import"./vendor-is-plain-obj-C1gvLhAf.js";import"./vendor-trough-B_b8ryxu.js";import"./vendor-vfile-BCWrK60u.js";import"./vendor-html-url-attributes-D46m5wfe.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./vendor-opencode-client-CeybcDBQ.js";import"./vendor-fuse.js-Dw8P0qyA.js";const de=1,he=8e3,fe=6e4,ge={refreshAuth:ue,clearUrlAuthToken:ae,openSocket:i=>le(pe().websocket(`/api/guests/${i}/surface/ws`)),isPaused:()=>document.visibilityState==="hidden"||!navigator.onLine,onWake:i=>(window.addEventListener("online",i),document.addEventListener("visibilitychange",i),()=>{window.removeEventListener("online",i),document.removeEventListener("visibilitychange",i)})};class ye{constructor(n,r,s=ge){this.guestId=n,this.handlers=r,this.dependencies=s}guestId;handlers;dependencies;socket=null;pendingFrame=null;reconnectTimer=null;wakeCleanup=null;failures=0;generation=0;disposed=!1;ended=!1;start(){this.handlers.onConnection({status:"connecting"}),this.connect()}dispose(){this.disposed=!0,this.generation+=1,this.cancelReconnect();const n=this.socket;if(this.socket=null,n)try{n.close()}catch{}}ack(n){this.send({type:"ack",seq:n})}sendInput(n){return n.length===0?!1:this.send({type:"input",events:n})}release(){this.send({type:"release"})}resize(n,r){this.send({type:"resize",width:n,height:r})}requestClipboard(n){this.send({type:"clipboard-read",id:n})}send(n){const r=this.socket;if(!r||r.readyState!==de)return!1;try{return r.send(JSON.stringify(n)),!0}catch{return!1}}async connect(){if(this.disposed||this.ended)return;const n=this.generation;try{await this.dependencies.refreshAuth()}catch{this.scheduleReconnect();return}if(n!==this.generation||this.disposed)return;let r;try{r=this.dependencies.openSocket(this.guestId)}catch{this.scheduleReconnect();return}r.binaryType="arraybuffer",this.socket=r;let s=!1;r.onopen=()=>{this.socket===r&&(s=!0,this.failures=0,this.pendingFrame=null,this.handlers.onConnection({status:"open"}))},r.onmessage=d=>{this.socket===r&&this.handleMessage(d.data)},r.onerror=()=>{},r.onclose=()=>{this.socket===r&&(this.socket=null,this.pendingFrame=null,!(this.disposed||this.ended)&&(s||this.dependencies.clearUrlAuthToken(),this.scheduleReconnect()))}}handleMessage(n){if(n instanceof ArrayBuffer){const s=this.pendingFrame;if(this.pendingFrame=null,!s)return;this.handlers.onFrame({...s,bytes:n});return}let r;try{const s=re.safeParse(JSON.parse(n));if(!s.success)return;r=s.data}catch{return}switch(r.type){case"hello":this.handlers.onViewer?.(r.viewerId);return;case"frame":this.pendingFrame={seq:r.seq,width:r.width,height:r.height,mime:r.mime,agentActive:r.agentActive},r.title&&(this.pendingFrame.title=r.title);return;case"control":this.handlers.onControl({controller:r.controller,mine:r.mine});return;case"resized":this.handlers.onResized?.({width:r.width,height:r.height});return;case"clipboard":this.handlers.onClipboard?.(r.id,r.text);return;case"error":this.handlers.onError?.(r.code,r.message);return;case"ended":this.ended=!0,this.cancelReconnect(),this.handlers.onConnection({status:"ended",reason:r.reason});return}}retry(){this.disposed||(this.ended=!1,this.failures=0,this.handlers.onConnection({status:"connecting"}),this.connect())}scheduleReconnect(){if(this.reconnectTimer||this.disposed||this.ended)return;this.failures+=1;const n=this.dependencies.isPaused()?fe:Math.min(500*2**Math.min(this.failures-1,10),he);this.handlers.onConnection({status:"reconnecting",attempt:this.failures});const r=()=>{this.dependencies.isPaused()||(this.cancelReconnect(),this.connect())};this.wakeCleanup=this.dependencies.onWake(r),this.reconnectTimer=setTimeout(r,n)}cancelReconnect(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.wakeCleanup?.(),this.wakeCleanup=null}}const xe=250,T=i=>({alt:i.altKey,ctrl:i.ctrlKey,meta:i.metaKey,shift:i.shiftKey}),be=i=>(i.metaKey||i.ctrlKey)&&!i.altKey&&i.key.toLowerCase()==="c",we=i=>(i.metaKey||i.ctrlKey)&&!i.altKey&&i.key.toLowerCase()==="v",zn=({mode:i})=>{const{t:n}=ne(),r=me(i),s=ie(t=>t.guests.find(e=>e.id===r)??null),d=s!==null&&oe(s)&&s.service?.surface===!0,V=`${s?.version??""}:${s?.revision??0}`,b=o.useRef(null),w=o.useRef(null),l=o.useRef(null),C=o.useRef(null),y=o.useRef([]),h=o.useRef(null),F=o.useRef(0),k=o.useRef(!1),R=o.useRef({controller:"none",mine:!1}),[p,X]=o.useState({status:"connecting"}),[m,G]=o.useState({controller:"none",mine:!1}),j=o.useCallback(t=>{R.current=t,G(t)},[]),[A,Y]=o.useState(""),[H,J]=o.useState(!1),[f,I]=o.useState(!1),[K,M]=o.useState(!1),E=o.useCallback(async t=>{const e=w.current,c=l.current;if(!(!e||!c))try{const u=await createImageBitmap(new Blob([t.bytes],{type:t.mime}));(e.width!==t.width||e.height!==t.height)&&(e.width=t.width,e.height=t.height),e.getContext("2d")?.drawImage(u,0,0,t.width,t.height),u.close(),C.current={width:t.width,height:t.height},I(!0),Y(t.title??""),J(t.agentActive)}catch{}finally{c.ack(t.seq)}},[]);o.useEffect(()=>{if(!d)return;let t=null;const e=new ye(r,{onViewer:c=>{t&&W(r,t),t=c,ce(r,c)},onFrame:c=>{E(c)},onControl:j,onConnection:X,onClipboard:(c,u)=>{se(u)}});return l.current=e,e.start(),()=>{t&&W(r,t),e.dispose(),l.current===e&&(l.current=null),h.current!==null&&cancelAnimationFrame(h.current),h.current=null,y.current=[],C.current=null,I(!1)}},[d,E,r,V,j]),o.useEffect(()=>{const t=b.current;if(!t||!d)return;let e=null;const c=new ResizeObserver(u=>{const g=u[0];if(!g)return;const{width:v,height:te}=g.contentRect;e&&clearTimeout(e),e=setTimeout(()=>{e=null;const B=window.devicePixelRatio||1,D=Math.round(v*B),z=Math.round(te*B);D>0&&z>0&&l.current?.resize(D,z)},xe)});return c.observe(t),()=>{c.disconnect(),e&&clearTimeout(e)}},[d]);const x=o.useCallback(t=>{y.current.push(t),h.current===null&&(h.current=requestAnimationFrame(()=>{h.current=null;const e=y.current;y.current=[],l.current?.sendInput(e),k.current&&(k.current=!1,F.current+=1,l.current?.requestClipboard(`copy-${F.current}`))}))},[]),N=o.useCallback(t=>{const e=w.current,c=C.current;if(!e||!c)return null;const u=e.getBoundingClientRect();if(u.width===0||u.height===0)return null;const g=(t.clientX-u.left)/u.width*c.width,v=(t.clientY-u.top)/u.height*c.height;return{x:Math.round(g),y:Math.round(v)}},[]),P=t=>e=>{if(!f||t==="move"&&e.buttons===0&&!(R.current.controller==="user"&&R.current.mine))return;const c=N(e);c&&(t==="down"?(b.current?.focus(),e.currentTarget.setPointerCapture(e.pointerId)):t==="up"&&e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),e.preventDefault(),x({type:"pointer",action:t,x:c.x,y:c.y,button:t==="move"?-1:e.button,buttons:e.buttons,modifiers:T(e)}))},Z=t=>{if(!f)return;const e=N(t);e&&(t.preventDefault(),x({type:"wheel",x:e.x,y:e.y,deltaX:t.deltaX,deltaY:t.deltaY,modifiers:T(t)}))},O=t=>e=>{f&&(we(e)||(e.preventDefault(),e.stopPropagation(),t==="down"&&be(e)&&(k.current=!0),x({type:"key",action:t,key:e.key,code:e.code,keyCode:e.keyCode,modifiers:T(e)})))},Q=t=>{if(!f)return;const e=t.clipboardData.getData("text/plain");t.preventDefault(),e&&x({type:"text",text:e})},_=()=>{l.current?.release()};if(!s)return null;if(!d)return a.jsx("div",{className:"flex h-full items-center justify-center px-6 text-sm text-muted-foreground",children:n("contextPanel.surface.unavailable")});const ee=p.status==="connecting"?"contextPanel.surface.status.connecting":p.status==="reconnecting"?"contextPanel.surface.status.reconnecting":p.status==="ended"?`contextPanel.surface.ended.${p.reason}`:m.controller==="user"?m.mine?"contextPanel.surface.status.youControl":"contextPanel.surface.status.otherControls":m.controller==="agent"||H?"contextPanel.surface.status.agentWorking":K?"contextPanel.surface.status.readyFocused":"contextPanel.surface.status.ready";return a.jsxs("div",{className:"flex h-full flex-col bg-[var(--surface-background)]",children:[a.jsxs("div",{className:"flex h-8 shrink-0 items-center gap-2 border-b border-border px-3",children:[a.jsx("span",{className:"typography-meta min-w-0 flex-1 truncate text-foreground",title:A||s.name,children:A||s.name}),a.jsx("span",{className:S("typography-meta shrink-0 truncate",m.controller==="user"&&m.mine?"text-foreground":"text-muted-foreground"),"aria-live":"polite",children:n(ee)}),m.controller==="user"&&m.mine?a.jsxs(q,{children:[a.jsx(L,{asChild:!0,children:a.jsx(U,{size:"xs",variant:"outline",onClick:_,children:n("contextPanel.surface.handBack")})}),a.jsx($,{side:"bottom",sideOffset:6,children:n("contextTooltips.panel.releaseSurface")})]}):null,p.status==="ended"?a.jsxs(q,{children:[a.jsx(L,{asChild:!0,children:a.jsx(U,{size:"xs",variant:"outline",onClick:()=>l.current?.retry(),children:n("contextPanel.surface.retry")})}),a.jsx($,{side:"bottom",sideOffset:6,children:n("contextTooltips.panel.reconnectSurface")})]}):null]}),a.jsxs("div",{ref:b,tabIndex:0,role:"application","aria-label":n("contextPanel.surface.canvasAria",{name:s.name}),"data-terminal-owner":`surface:${r}`,className:S("relative flex min-h-0 flex-1 items-center justify-center overflow-hidden outline-none",K?"ring-1 ring-inset ring-[var(--interactive-selection-border)]":""),onFocus:()=>M(!0),onBlur:()=>M(!1),onKeyDown:O("down"),onKeyUp:O("up"),onPaste:Q,children:[a.jsx("canvas",{ref:w,className:S("max-h-full max-w-full",f?"block":"hidden",m.controller==="user"&&!m.mine?"cursor-not-allowed":"cursor-default"),onPointerDown:P("down"),onPointerMove:P("move"),onPointerUp:P("up"),onWheel:Z,onContextMenu:t=>t.preventDefault()}),!f||p.status!=="open"?a.jsx("div",{className:"absolute inset-0 flex items-center justify-center px-6 text-center text-sm text-muted-foreground",children:n(p.status==="ended"?`contextPanel.surface.ended.${p.reason}`:p.status==="reconnecting"?"contextPanel.surface.status.reconnecting":"contextPanel.surface.status.connecting")}):null]})]})};export{zn as GuestSurfacePane};
@@ -1 +1 @@
1
- import{f as F,j as i,R as B}from"./vendor-react--VO_rL_p.js";import{u as W,ax as O,ay as I,az as L,aA as U,aB as $,I as M,t as V,q as G,l as J,F as Q,D as X,n as Y}from"./useAppFontEffects-D9nf8G19.js";import{u as H}from"./katex.min-g52ii4Gs.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-base-ui-CqKCZJyd.js";import"./vendor-floating-ui-utils-BzXdqYpP.js";import"./vendor-floating-ui-dom-WyXykhNi.js";import"./vendor-floating-ui-core-CXmKXOXc.js";import"./vendor-floating-ui-react-dom-Cy8dRGoy.js";import"./vendor-use-sync-external-store-CfLJGVyr.js";import"./vendor-zod--raI7LhK.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-zustand-C9tWdk0j.js";import"./vendor-dnd-kit-core-Br1Cs7RV.js";import"./vendor-dnd-kit-utilities-DZ9KbT5S.js";import"./vendor-dnd-kit-accessibility-CYclfhtC.js";import"./vendor-dnd-kit-sortable-DpfLEOLv.js";import"./vendor-tanstack-react-virtual-CqfECoM0.js";import"./vendor-tanstack-virtual-core-BdFnkr_2.js";import"./vendor-framer-motion-C_wK4GIM.js";import"./vendor-motion-dom-HXPOMxb7.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-capacitor-core-B4EWRrHz.js";import"./vendor-codemirror-commands-CjjsURR-.js";import"./vendor-codemirror-state-Cd8udR5z.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-view-Ciie9ey-.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-codemirror-language-8HZTPOnt.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CZEcqU6G.js";import"./vendor-codemirror-streamparser-CmlTsbN2.js";import"./vendor-codemirror-lang-javascript-DmqaSK_j.js";import"./vendor-lezer-javascript-CWSwshuO.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-BGedy2gC.js";import"./vendor-codemirror-lang-json-DVAYKmoO.js";import"./vendor-lezer-json-Cn1mncjr.js";import"./vendor-codemirror-lang-css-BLpgXfL2.js";import"./vendor-lezer-css-B2Hx_Nps.js";import"./vendor-codemirror-lang-html-S3jxr3Mo.js";import"./vendor-lezer-html-Cr8K5DGw.js";import"./vendor-codemirror-lang-markdown-D1jveRI5.js";import"./vendor-lezer-markdown-TQKzBB8i.js";import"./vendor-codemirror-language-data-z3n6zAAT.js";import"./vendor-codemirror-lang-python-B-5UC9Ui.js";import"./vendor-lezer-python-BUoImtUb.js";import"./vendor-sonner-Dw26OnzC.js";import"./vendor-cmdk-BtSpU-Io.js";import"./vendor-radix-ui-react-dialog-OIW6VLWw.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-D4RvEbuR.js";import"./vendor-radix-ui-react-context-BbFoxCHu.js";import"./vendor-radix-ui-react-id-aGag8i_5.js";import"./vendor-radix-ui-react-use-layout-effect-B1oLzD-j.js";import"./vendor-radix-ui-react-use-controllable-state-BjnNPGHq.js";import"./vendor-radix-ui-react-dismissable-layer-DpT6mMbO.js";import"./vendor-radix-ui-react-primitive-CrN9dRDb.js";import"./vendor-radix-ui-react-slot-BjbalUfz.js";import"./vendor-radix-ui-react-use-callback-ref-CcC_buIU.js";import"./vendor-radix-ui-react-use-escape-keydown-Cp1WWKTC.js";import"./vendor-radix-ui-react-focus-scope-D1noLHmd.js";import"./vendor-radix-ui-react-portal-BlUEzfrF.js";import"./vendor-radix-ui-react-presence-BGqFfiW4.js";import"./vendor-radix-ui-react-focus-guards-CSS2IbZC.js";import"./vendor-react-remove-scroll-Der_cv-1.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-Clwl9llp.js";import"./vendor-react-style-singleton-D_xJlTqU.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-BdLl6ZIw.js";import"./vendor-use-callback-ref-CXJF1lEr.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-legendapp-list-CEhBoV5L.js";import"./vendor-streamdown-BbSYZ3NF.js";import"./vendor-markdown-BTUqNk6W.js";import"./vendor-mdast-util-from-markdown-CZHjOE75.js";import"./vendor-micromark-util-decode-numeric-character-reference-CNs1qBpV.js";import"./vendor-micromark-util-decode-string-fHsnqYdj.js";import"./vendor-decode-named-character-reference-C3-224fz.js";import"./vendor-micromark-util-normalize-identifier-C9ANKk3v.js";import"./vendor-micromark-AWM-NZXP.js";import"./vendor-micromark-util-combine-extensions-d8XJZrgA.js";import"./vendor-micromark-util-chunked-DrRIdSP-.js";import"./vendor-micromark-factory-space-PzSHLgmq.js";import"./vendor-micromark-util-character-CW3Cu1MS.js";import"./vendor-micromark-core-commonmark-kzTLNXAm.js";import"./vendor-micromark-util-classify-character-tcLuZZwM.js";import"./vendor-micromark-util-resolve-all-PQCKh0dx.js";import"./vendor-micromark-util-subtokenize-BF1Jf29a.js";import"./vendor-micromark-factory-destination-Sj0xfi0V.js";import"./vendor-micromark-factory-label-amyP0HdC.js";import"./vendor-micromark-factory-title-khnLkZK6.js";import"./vendor-micromark-factory-whitespace-eIB00uTl.js";import"./vendor-micromark-util-html-tag-name-DbKNfynz.js";import"./vendor-unist-util-stringify-position-Ch_qCilz.js";import"./vendor-mdast-util-to-string-C_aolqmU.js";import"./vendor-unist-util-visit-DhPeCsfG.js";import"./vendor-unist-util-visit-parents-DlviEg7Z.js";import"./vendor-unist-util-is-BPZGFiMU.js";import"./vendor-hast-util-raw-DvvLJg15.js";import"./vendor-ungap-structured-clone--gfxRhYI.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-parse5-DwmzEj2o.js";import"./vendor-entities-wUUgTZDW.js";import"./vendor-web-namespaces-bsVAaBS1.js";import"./vendor-zwitch-C2o2j-tx.js";import"./vendor-unist-util-position-60F3QETU.js";import"./vendor-hast-util-from-parse5-Ba3T6RJI.js";import"./vendor-devlop-0Dp3JUBc.js";import"./vendor-property-information-Boo8Xpef.js";import"./vendor-hastscript-BrPNioaz.js";import"./vendor-comma-separated-tokens-CRUGqg4f.js";import"./vendor-space-separated-tokens-D7QSIrTI.js";import"./vendor-hast-util-parse-selector-TXfch5wI.js";import"./vendor-vfile-location-LfEFwJ2h.js";import"./vendor-hast-util-to-parse5-BoysVIPW.js";import"./vendor-hast-util-sanitize-2aGO5ay8.js";import"./vendor-micromark-extension-gfm-CsfPlnlB.js";import"./vendor-micromark-extension-gfm-autolink-literal-BYug7onl.js";import"./vendor-micromark-extension-gfm-footnote-OFl1FCH2.js";import"./vendor-micromark-extension-gfm-strikethrough-CyFiuwBf.js";import"./vendor-micromark-extension-gfm-table-dgw4LfUw.js";import"./vendor-micromark-extension-gfm-task-list-item-Dnadzr9U.js";import"./vendor-mdast-util-gfm-CroMDYLM.js";import"./vendor-mdast-util-gfm-autolink-literal-CTruMtvI.js";import"./vendor-ccount-c2V3InAJ.js";import"./vendor-mdast-util-find-and-replace-DB9iC-bx.js";import"./vendor-escape-string-regexp-BaJN9MlJ.js";import"./vendor-mdast-util-gfm-footnote-C-csI7OF.js";import"./vendor-mdast-util-gfm-strikethrough-BcskTdio.js";import"./vendor-mdast-util-gfm-table-DhPwQIyj.js";import"./vendor-markdown-table-DvhhVmnL.js";import"./vendor-mdast-util-to-markdown-Cl3qaiyc.js";import"./vendor-longest-streak-CtXnX3Xp.js";import"./vendor-mdast-util-phrasing-4oVbNLC3.js";import"./vendor-mdast-util-gfm-task-list-item-DMU5mK_M.js";import"./vendor-mdast-util-to-hast-CWnLaQSO.js";import"./vendor-micromark-util-sanitize-uri-BbwQ7CLk.js";import"./vendor-trim-lines-D8znQY54.js";import"./vendor-micromark-extension-cjk-friendly-BzZDGrF5.js";import"./vendor-micromark-extension-cjk-friendly-util-D5lVNoxW.js";import"./vendor-get-east-asian-width-CPhS2cOv.js";import"./vendor-micromark-util-symbol-JJPacVTp.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-BZ3pe_qd.js";import"./vendor-micromark-extension-cjk-friendly-gfm-strikethrough-CqW-Ep4M.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-gfm-strikethrough-BdPDQFO7.js";import"./vendor-hast-util-from-html-isomorphic-B0Kn01s9.js";import"./vendor-hast-util-from-dom-DeNf9aYW.js";import"./vendor-katex-DBqql0K7.js";import"./vendor-hast-util-to-text-0GXLnBvt.js";import"./vendor-hast-util-is-element-CuOmiqQi.js";import"./vendor-unist-util-find-after-CMaZmLxc.js";import"./vendor-micromark-extension-math-BRFoDziv.js";import"./vendor-mdast-util-math-wB-IJCL0.js";import"./vendor-remend-r8cP_t-e.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-marked-DN3zOnEe.js";import"./vendor-hast-util-to-jsx-runtime-Bq6JeJCx.js";import"./vendor-style-to-js-CI2G4dgu.js";import"./vendor-style-to-object-BAv4SQXc.js";import"./vendor-inline-style-parser-BlqBsVO4.js";import"./vendor-hast-util-whitespace-D4Wp6AEg.js";import"./vendor-estree-util-is-identifier-name-BgBfM8ME.js";import"./vendor-vfile-message-DqhD22jI.js";import"./vendor-unified-1CQKw2_w.js";import"./vendor-bail-FqpXQuLt.js";import"./vendor-extend-B94qxKr5.js";import"./vendor-is-plain-obj-C1gvLhAf.js";import"./vendor-trough-B_b8ryxu.js";import"./vendor-vfile-BCWrK60u.js";import"./vendor-html-url-attributes-D46m5wfe.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./vendor-opencode-client-CeybcDBQ.js";import"./vendor-fuse.js-Dw8P0qyA.js";const R=(e,o,j)=>O($(e,o),j),ft=()=>{const e=F.c(47),{t:o}=W(),j=H(Z),T=H(ee),p=H(ie);let n,m,l,a,c,d,g,y,h,r,_,u;if(e[0]!==j||e[1]!==T||e[2]!==p||e[3]!==o){const q=[{categoryKey:"helpDialog.section.navigationCommands",column:"left",items:[{id:"open_command_palette",descriptionKey:"helpDialog.item.openCommandPalette",icon:"command",keys:""},{id:"open_help",descriptionKey:"helpDialog.item.showKeyboardShortcuts",icon:"question",keys:""},{id:"toggle_sidebar",descriptionKey:"helpDialog.item.toggleSessionSidebar",icon:"layout-left",keys:""},{id:"add_selection_to_chat",descriptionKey:"helpDialog.item.addSelectionToChat",icon:"add",keys:""},{id:"cycle_agent",keys:"",descriptionKey:"helpDialog.item.cycleAgent",icon:"ai-agent"},{id:"search_prompt_history",keys:"",descriptionKey:"helpDialog.item.searchPromptHistory",icon:"history"},{id:"open_model_selector",descriptionKey:"helpDialog.item.openModelSelector",icon:"ai-generate-2",keys:""},{keys:["↑↓"],descriptionKey:"helpDialog.item.navigateModels",icon:"ai-generate-2"},{keys:["←→"],descriptionKey:"helpDialog.item.adjustThinkingMode",icon:"brain-ai-3"},{id:"cycle_thinking_variant",descriptionKey:"helpDialog.item.cycleThinkingVariant",icon:"brain-ai-3",keys:""},{id:"new_window",descriptionKey:"helpDialog.item.newWindow",icon:"window",keys:""}]},{categoryKey:"helpDialog.section.sessionManagement",column:"right",items:[{id:"new_chat",descriptionKey:"helpDialog.item.createNewSession",icon:"add",keys:""},{id:"new_chat_worktree",descriptionKey:"helpDialog.item.createNewWorktreeDraft",icon:"git-branch",keys:""},{id:"open_draft_project_picker",icon:"folder",keys:""},{id:"open_draft_worktree_picker",icon:"git-branch",keys:""},{id:"open_session_list",icon:"list-unordered",keys:""},{id:"open_new_worktree_dialog",icon:"git-branch",keys:""},{id:"add_project",icon:"folder-add",keys:""},{id:"focus_input",descriptionKey:"helpDialog.item.focusChatInput",icon:"text",keys:""},{id:"toggle_prompt_navigator",descriptionKey:"helpDialog.item.togglePromptNavigator",icon:"list-unordered",keys:""},{id:"abort_run",descriptionKey:"helpDialog.item.abortActiveRun",icon:"close-circle",keys:""},{id:"background_session_work",icon:"arrow-up-double",keys:""},{id:"toggle_selection_mode",icon:"checkbox-multiple",keys:""},{id:"toggle_chats_section",icon:"text",keys:""},{id:"toggle_pinned_section",icon:"pushpin",keys:""},{id:"toggle_work_section",icon:"eye",keys:""},{id:"toggle_detailed_rows",icon:"list-unordered",keys:""},{id:"pin_current_session",icon:"pushpin",keys:""},{id:"copy_current_session_id",icon:"file-copy",keys:""},{id:"toggle_work_current_session",icon:"checkbox-circle",keys:""},{id:"open_multi_run",icon:"git-merge",keys:""}]},{categoryKey:"helpDialog.section.panels",column:"right",items:[{id:"toggle_terminal",descriptionKey:"helpDialog.item.toggleTerminalDock",icon:"window",keys:""},{id:"toggle_context_panel_expanded",descriptionKey:"helpDialog.item.toggleContextPanelExpanded",icon:"layout-right",keys:""},{id:"collapse_sessions_all",icon:"contract-up-down",keys:""},{id:"expand_sessions_all",icon:"expand-up-down",keys:""},{id:"open_notes",icon:"sticky-note",keys:""},{id:"open_todos",icon:"checkbox-circle",keys:""},{id:"show_context_usage",icon:"pie-chart",keys:""},{keys:[`${O(I("switch_context_surface",p))} + 1...0`],descriptionKey:"helpDialog.item.switchContextSurface",icon:"layout-right"},{keys:[`${O(I("switch_session_tab",p))} + 1...9`],descriptionKey:"helpDialog.item.switchSessionTab",icon:"layout-right"}]},{categoryKey:"helpDialog.section.interface",column:"left",items:[{id:"cycle_theme",descriptionKey:"helpDialog.item.cycleTheme",icon:"palette",keys:""},{id:"toggle_services_menu",descriptionKey:"helpDialog.item.toggleServicesMenu",icon:"stack",keys:""},{id:"toggle_source_board",descriptionKey:"helpDialog.item.toggleSourceBoard",icon:"git-pull-request",keys:""},{id:"open_project_actions",descriptionKey:"helpDialog.item.openProjectActions",icon:"play",keys:""},{id:"open_settings",descriptionKey:"helpDialog.item.openSettings",icon:"settings-3",keys:""},{id:"open_archive",icon:"archive",keys:""},{id:"open_overview",icon:"compass-3",keys:""},{id:"show_opencode_status",icon:"pulse",keys:""},{id:"reload_ui",icon:"refresh",keys:""},{id:"restart_opencode",icon:"restart",keys:""},{id:"toggle_list_grouping",icon:"layout-right",keys:""},{id:"toggle_project_display",icon:"folder",keys:""},{id:"cycle_project_sort",icon:"list-unordered",keys:""}]}],z=s=>i.jsxs("div",{children:[i.jsx("h3",{className:"typography-meta font-semibold text-muted-foreground uppercase tracking-wider mb-2",children:o(s.categoryKey)}),i.jsx("div",{className:"space-y-1",children:s.items.map(t=>{const N=t.id?L(t.id):void 0,A=t.descriptionKey??(N?.customizable?N.settingsLabelKey:void 0);if(!A||N&&!U(N)||t.id&&!$(t.id,p))return null;const C=t.id?R(t.id,p,o("settings.openchamber.keyboardShortcuts.unassigned")):Array.isArray(t.keys)?t.keys:t.keys.split(" / ");return i.jsxs("div",{className:"flex items-center gap-3 py-1 px-2",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[t.icon&&i.jsx(M,{name:t.icon,className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),i.jsx("span",{className:"typography-meta",children:o(A)})]}),i.jsx("div",{"aria-hidden":!0,className:"min-w-4 flex-1 border-b border-dotted border-border"}),i.jsx("div",{className:"flex shrink-0 items-center gap-1",children:(Array.isArray(C)?C:[C]).map((P,E)=>i.jsxs(B.Fragment,{children:[E>0&&i.jsx("span",{className:"typography-meta text-muted-foreground mx-1",children:o("helpDialog.keyCombiner.or")}),i.jsx("kbd",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 typography-meta bg-muted rounded border border-edge-muted",children:P})]},`${P}-${E}`))})]},t.id||A)})})]},s.categoryKey);l=V,_=j,u=T,m=G,h="max-w-6xl w-[min(72rem,calc(100vw-1.5rem))] max-h-[calc(100dvh-2rem)] flex flex-col overflow-hidden";let S;e[16]===Symbol.for("react.memo_cache_sentinel")?(S=i.jsx(M,{name:"command",className:"h-5 w-5"}),e[16]=S):S=e[16];let D;e[17]!==o?(D=o("helpDialog.title"),e[17]=o,e[18]=D):D=e[18];let w;e[19]!==D?(w=i.jsxs(J,{className:"flex items-center gap-2",children:[S,D]}),e[19]=D,e[20]=w):w=e[20];let b;e[21]!==o?(b=o("helpDialog.description"),e[21]=o,e[22]=b):b=e[22];let K;e[23]!==b?(K=i.jsx(Q,{children:b}),e[23]=b,e[24]=K):K=e[24],e[25]!==w||e[26]!==K?(r=i.jsxs(X,{children:[w,K]}),e[25]=w,e[26]=K,e[27]=r):r=e[27],n=Y,d="flex-1 min-h-0 mt-3",g="pe-1",y=!0,a="grid grid-cols-1 gap-x-12 gap-y-4 lg:grid-cols-2",c=["left","right"].map(s=>i.jsxs("div",{className:"space-y-4",children:[q.filter(t=>t.column===s).map(z),s==="right"&&i.jsxs("ul",{className:"space-y-0.5 px-2 typography-meta text-muted-foreground",children:[i.jsxs("li",{children:["• ",o("helpDialog.proTips.commandPalette",{shortcut:R("open_command_palette",p,o("settings.openchamber.keyboardShortcuts.unassigned"))})]}),i.jsxs("li",{children:["• ",o("helpDialog.proTips.recentSessions")]}),i.jsxs("li",{children:["• ",o("helpDialog.proTips.leaderSequences")]})]})]},s)),e[0]=j,e[1]=T,e[2]=p,e[3]=o,e[4]=n,e[5]=m,e[6]=l,e[7]=a,e[8]=c,e[9]=d,e[10]=g,e[11]=y,e[12]=h,e[13]=r,e[14]=_,e[15]=u}else n=e[4],m=e[5],l=e[6],a=e[7],c=e[8],d=e[9],g=e[10],y=e[11],h=e[12],r=e[13],_=e[14],u=e[15];let k;e[28]!==a||e[29]!==c?(k=i.jsx("div",{className:a,children:c}),e[28]=a,e[29]=c,e[30]=k):k=e[30];let x;e[31]!==n||e[32]!==d||e[33]!==g||e[34]!==y||e[35]!==k?(x=i.jsx(n,{outerClassName:d,className:g,disableHorizontal:y,children:k}),e[31]=n,e[32]=d,e[33]=g,e[34]=y,e[35]=k,e[36]=x):x=e[36];let f;e[37]!==m||e[38]!==x||e[39]!==h||e[40]!==r?(f=i.jsxs(m,{className:h,children:[r,x]}),e[37]=m,e[38]=x,e[39]=h,e[40]=r,e[41]=f):f=e[41];let v;return e[42]!==l||e[43]!==f||e[44]!==_||e[45]!==u?(v=i.jsx(l,{open:_,onOpenChange:u,children:f}),e[42]=l,e[43]=f,e[44]=_,e[45]=u,e[46]=v):v=e[46],v};function Z(e){return e.isHelpDialogOpen}function ee(e){return e.setHelpDialogOpen}function ie(e){return e.shortcutOverrides}export{ft as HelpDialog};
1
+ import{f as F,j as i,R as B}from"./vendor-react--VO_rL_p.js";import{u as W,ax as O,ay as I,az as L,aA as U,aB as $,I as M,t as V,q as G,l as J,F as Q,D as X,n as Y}from"./useAppFontEffects-3RimJo4B.js";import{u as H}from"./katex.min-Bs5OLoA1.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-base-ui-CqKCZJyd.js";import"./vendor-floating-ui-utils-BzXdqYpP.js";import"./vendor-floating-ui-dom-WyXykhNi.js";import"./vendor-floating-ui-core-CXmKXOXc.js";import"./vendor-floating-ui-react-dom-Cy8dRGoy.js";import"./vendor-use-sync-external-store-CfLJGVyr.js";import"./vendor-zod--raI7LhK.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-zustand-C9tWdk0j.js";import"./vendor-dnd-kit-core-Br1Cs7RV.js";import"./vendor-dnd-kit-utilities-DZ9KbT5S.js";import"./vendor-dnd-kit-accessibility-CYclfhtC.js";import"./vendor-dnd-kit-sortable-DpfLEOLv.js";import"./vendor-tanstack-react-virtual-CqfECoM0.js";import"./vendor-tanstack-virtual-core-BdFnkr_2.js";import"./vendor-framer-motion-C_wK4GIM.js";import"./vendor-motion-dom-HXPOMxb7.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-capacitor-core-B4EWRrHz.js";import"./vendor-codemirror-commands-CjjsURR-.js";import"./vendor-codemirror-state-Cd8udR5z.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-view-Ciie9ey-.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-codemirror-language-8HZTPOnt.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CZEcqU6G.js";import"./vendor-codemirror-streamparser-CmlTsbN2.js";import"./vendor-codemirror-lang-javascript-DmqaSK_j.js";import"./vendor-lezer-javascript-CWSwshuO.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-BGedy2gC.js";import"./vendor-codemirror-lang-json-DVAYKmoO.js";import"./vendor-lezer-json-Cn1mncjr.js";import"./vendor-codemirror-lang-css-BLpgXfL2.js";import"./vendor-lezer-css-B2Hx_Nps.js";import"./vendor-codemirror-lang-html-S3jxr3Mo.js";import"./vendor-lezer-html-Cr8K5DGw.js";import"./vendor-codemirror-lang-markdown-D1jveRI5.js";import"./vendor-lezer-markdown-TQKzBB8i.js";import"./vendor-codemirror-language-data-DRsX0PKK.js";import"./vendor-codemirror-lang-python-B-5UC9Ui.js";import"./vendor-lezer-python-BUoImtUb.js";import"./vendor-sonner-Dw26OnzC.js";import"./vendor-cmdk-BtSpU-Io.js";import"./vendor-radix-ui-react-dialog-OIW6VLWw.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-D4RvEbuR.js";import"./vendor-radix-ui-react-context-BbFoxCHu.js";import"./vendor-radix-ui-react-id-aGag8i_5.js";import"./vendor-radix-ui-react-use-layout-effect-B1oLzD-j.js";import"./vendor-radix-ui-react-use-controllable-state-BjnNPGHq.js";import"./vendor-radix-ui-react-dismissable-layer-DpT6mMbO.js";import"./vendor-radix-ui-react-primitive-CrN9dRDb.js";import"./vendor-radix-ui-react-slot-BjbalUfz.js";import"./vendor-radix-ui-react-use-callback-ref-CcC_buIU.js";import"./vendor-radix-ui-react-use-escape-keydown-Cp1WWKTC.js";import"./vendor-radix-ui-react-focus-scope-D1noLHmd.js";import"./vendor-radix-ui-react-portal-BlUEzfrF.js";import"./vendor-radix-ui-react-presence-BGqFfiW4.js";import"./vendor-radix-ui-react-focus-guards-CSS2IbZC.js";import"./vendor-react-remove-scroll-Der_cv-1.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-Clwl9llp.js";import"./vendor-react-style-singleton-D_xJlTqU.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-BdLl6ZIw.js";import"./vendor-use-callback-ref-CXJF1lEr.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-legendapp-list-CEhBoV5L.js";import"./vendor-streamdown-BbSYZ3NF.js";import"./vendor-markdown-BTUqNk6W.js";import"./vendor-mdast-util-from-markdown-CZHjOE75.js";import"./vendor-micromark-util-decode-numeric-character-reference-CNs1qBpV.js";import"./vendor-micromark-util-decode-string-fHsnqYdj.js";import"./vendor-decode-named-character-reference-C3-224fz.js";import"./vendor-micromark-util-normalize-identifier-C9ANKk3v.js";import"./vendor-micromark-AWM-NZXP.js";import"./vendor-micromark-util-combine-extensions-d8XJZrgA.js";import"./vendor-micromark-util-chunked-DrRIdSP-.js";import"./vendor-micromark-factory-space-PzSHLgmq.js";import"./vendor-micromark-util-character-CW3Cu1MS.js";import"./vendor-micromark-core-commonmark-kzTLNXAm.js";import"./vendor-micromark-util-classify-character-tcLuZZwM.js";import"./vendor-micromark-util-resolve-all-PQCKh0dx.js";import"./vendor-micromark-util-subtokenize-BF1Jf29a.js";import"./vendor-micromark-factory-destination-Sj0xfi0V.js";import"./vendor-micromark-factory-label-amyP0HdC.js";import"./vendor-micromark-factory-title-khnLkZK6.js";import"./vendor-micromark-factory-whitespace-eIB00uTl.js";import"./vendor-micromark-util-html-tag-name-DbKNfynz.js";import"./vendor-unist-util-stringify-position-Ch_qCilz.js";import"./vendor-mdast-util-to-string-C_aolqmU.js";import"./vendor-unist-util-visit-DhPeCsfG.js";import"./vendor-unist-util-visit-parents-DlviEg7Z.js";import"./vendor-unist-util-is-BPZGFiMU.js";import"./vendor-hast-util-raw-DvvLJg15.js";import"./vendor-ungap-structured-clone--gfxRhYI.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-parse5-DwmzEj2o.js";import"./vendor-entities-wUUgTZDW.js";import"./vendor-web-namespaces-bsVAaBS1.js";import"./vendor-zwitch-C2o2j-tx.js";import"./vendor-unist-util-position-60F3QETU.js";import"./vendor-hast-util-from-parse5-Ba3T6RJI.js";import"./vendor-devlop-0Dp3JUBc.js";import"./vendor-property-information-Boo8Xpef.js";import"./vendor-hastscript-BrPNioaz.js";import"./vendor-comma-separated-tokens-CRUGqg4f.js";import"./vendor-space-separated-tokens-D7QSIrTI.js";import"./vendor-hast-util-parse-selector-TXfch5wI.js";import"./vendor-vfile-location-LfEFwJ2h.js";import"./vendor-hast-util-to-parse5-BoysVIPW.js";import"./vendor-hast-util-sanitize-2aGO5ay8.js";import"./vendor-micromark-extension-gfm-CsfPlnlB.js";import"./vendor-micromark-extension-gfm-autolink-literal-BYug7onl.js";import"./vendor-micromark-extension-gfm-footnote-OFl1FCH2.js";import"./vendor-micromark-extension-gfm-strikethrough-CyFiuwBf.js";import"./vendor-micromark-extension-gfm-table-dgw4LfUw.js";import"./vendor-micromark-extension-gfm-task-list-item-Dnadzr9U.js";import"./vendor-mdast-util-gfm-CroMDYLM.js";import"./vendor-mdast-util-gfm-autolink-literal-CTruMtvI.js";import"./vendor-ccount-c2V3InAJ.js";import"./vendor-mdast-util-find-and-replace-DB9iC-bx.js";import"./vendor-escape-string-regexp-BaJN9MlJ.js";import"./vendor-mdast-util-gfm-footnote-C-csI7OF.js";import"./vendor-mdast-util-gfm-strikethrough-BcskTdio.js";import"./vendor-mdast-util-gfm-table-DhPwQIyj.js";import"./vendor-markdown-table-DvhhVmnL.js";import"./vendor-mdast-util-to-markdown-Cl3qaiyc.js";import"./vendor-longest-streak-CtXnX3Xp.js";import"./vendor-mdast-util-phrasing-4oVbNLC3.js";import"./vendor-mdast-util-gfm-task-list-item-DMU5mK_M.js";import"./vendor-mdast-util-to-hast-CWnLaQSO.js";import"./vendor-micromark-util-sanitize-uri-BbwQ7CLk.js";import"./vendor-trim-lines-D8znQY54.js";import"./vendor-micromark-extension-cjk-friendly-BzZDGrF5.js";import"./vendor-micromark-extension-cjk-friendly-util-D5lVNoxW.js";import"./vendor-get-east-asian-width-CPhS2cOv.js";import"./vendor-micromark-util-symbol-JJPacVTp.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-BZ3pe_qd.js";import"./vendor-micromark-extension-cjk-friendly-gfm-strikethrough-CqW-Ep4M.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-gfm-strikethrough-BdPDQFO7.js";import"./vendor-hast-util-from-html-isomorphic-B0Kn01s9.js";import"./vendor-hast-util-from-dom-DeNf9aYW.js";import"./vendor-katex-DBqql0K7.js";import"./vendor-hast-util-to-text-0GXLnBvt.js";import"./vendor-hast-util-is-element-CuOmiqQi.js";import"./vendor-unist-util-find-after-CMaZmLxc.js";import"./vendor-micromark-extension-math-BRFoDziv.js";import"./vendor-mdast-util-math-wB-IJCL0.js";import"./vendor-remend-r8cP_t-e.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-marked-DN3zOnEe.js";import"./vendor-hast-util-to-jsx-runtime-Bq6JeJCx.js";import"./vendor-style-to-js-CI2G4dgu.js";import"./vendor-style-to-object-BAv4SQXc.js";import"./vendor-inline-style-parser-BlqBsVO4.js";import"./vendor-hast-util-whitespace-D4Wp6AEg.js";import"./vendor-estree-util-is-identifier-name-BgBfM8ME.js";import"./vendor-vfile-message-DqhD22jI.js";import"./vendor-unified-1CQKw2_w.js";import"./vendor-bail-FqpXQuLt.js";import"./vendor-extend-B94qxKr5.js";import"./vendor-is-plain-obj-C1gvLhAf.js";import"./vendor-trough-B_b8ryxu.js";import"./vendor-vfile-BCWrK60u.js";import"./vendor-html-url-attributes-D46m5wfe.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./vendor-opencode-client-CeybcDBQ.js";import"./vendor-fuse.js-Dw8P0qyA.js";const R=(e,o,j)=>O($(e,o),j),ft=()=>{const e=F.c(47),{t:o}=W(),j=H(Z),T=H(ee),p=H(ie);let n,m,l,a,c,d,g,y,h,r,_,u;if(e[0]!==j||e[1]!==T||e[2]!==p||e[3]!==o){const q=[{categoryKey:"helpDialog.section.navigationCommands",column:"left",items:[{id:"open_command_palette",descriptionKey:"helpDialog.item.openCommandPalette",icon:"command",keys:""},{id:"open_help",descriptionKey:"helpDialog.item.showKeyboardShortcuts",icon:"question",keys:""},{id:"toggle_sidebar",descriptionKey:"helpDialog.item.toggleSessionSidebar",icon:"layout-left",keys:""},{id:"add_selection_to_chat",descriptionKey:"helpDialog.item.addSelectionToChat",icon:"add",keys:""},{id:"cycle_agent",keys:"",descriptionKey:"helpDialog.item.cycleAgent",icon:"ai-agent"},{id:"search_prompt_history",keys:"",descriptionKey:"helpDialog.item.searchPromptHistory",icon:"history"},{id:"open_model_selector",descriptionKey:"helpDialog.item.openModelSelector",icon:"ai-generate-2",keys:""},{keys:["↑↓"],descriptionKey:"helpDialog.item.navigateModels",icon:"ai-generate-2"},{keys:["←→"],descriptionKey:"helpDialog.item.adjustThinkingMode",icon:"brain-ai-3"},{id:"cycle_thinking_variant",descriptionKey:"helpDialog.item.cycleThinkingVariant",icon:"brain-ai-3",keys:""},{id:"new_window",descriptionKey:"helpDialog.item.newWindow",icon:"window",keys:""}]},{categoryKey:"helpDialog.section.sessionManagement",column:"right",items:[{id:"new_chat",descriptionKey:"helpDialog.item.createNewSession",icon:"add",keys:""},{id:"new_chat_worktree",descriptionKey:"helpDialog.item.createNewWorktreeDraft",icon:"git-branch",keys:""},{id:"open_draft_project_picker",icon:"folder",keys:""},{id:"open_draft_worktree_picker",icon:"git-branch",keys:""},{id:"open_session_list",icon:"list-unordered",keys:""},{id:"open_new_worktree_dialog",icon:"git-branch",keys:""},{id:"add_project",icon:"folder-add",keys:""},{id:"focus_input",descriptionKey:"helpDialog.item.focusChatInput",icon:"text",keys:""},{id:"toggle_prompt_navigator",descriptionKey:"helpDialog.item.togglePromptNavigator",icon:"list-unordered",keys:""},{id:"abort_run",descriptionKey:"helpDialog.item.abortActiveRun",icon:"close-circle",keys:""},{id:"background_session_work",icon:"arrow-up-double",keys:""},{id:"toggle_selection_mode",icon:"checkbox-multiple",keys:""},{id:"toggle_chats_section",icon:"text",keys:""},{id:"toggle_pinned_section",icon:"pushpin",keys:""},{id:"toggle_work_section",icon:"eye",keys:""},{id:"toggle_detailed_rows",icon:"list-unordered",keys:""},{id:"pin_current_session",icon:"pushpin",keys:""},{id:"copy_current_session_id",icon:"file-copy",keys:""},{id:"toggle_work_current_session",icon:"checkbox-circle",keys:""},{id:"open_multi_run",icon:"git-merge",keys:""}]},{categoryKey:"helpDialog.section.panels",column:"right",items:[{id:"toggle_terminal",descriptionKey:"helpDialog.item.toggleTerminalDock",icon:"window",keys:""},{id:"toggle_context_panel_expanded",descriptionKey:"helpDialog.item.toggleContextPanelExpanded",icon:"layout-right",keys:""},{id:"collapse_sessions_all",icon:"contract-up-down",keys:""},{id:"expand_sessions_all",icon:"expand-up-down",keys:""},{id:"open_notes",icon:"sticky-note",keys:""},{id:"open_todos",icon:"checkbox-circle",keys:""},{id:"show_context_usage",icon:"pie-chart",keys:""},{keys:[`${O(I("switch_context_surface",p))} + 1...0`],descriptionKey:"helpDialog.item.switchContextSurface",icon:"layout-right"},{keys:[`${O(I("switch_session_tab",p))} + 1...9`],descriptionKey:"helpDialog.item.switchSessionTab",icon:"layout-right"}]},{categoryKey:"helpDialog.section.interface",column:"left",items:[{id:"cycle_theme",descriptionKey:"helpDialog.item.cycleTheme",icon:"palette",keys:""},{id:"toggle_services_menu",descriptionKey:"helpDialog.item.toggleServicesMenu",icon:"stack",keys:""},{id:"toggle_source_board",descriptionKey:"helpDialog.item.toggleSourceBoard",icon:"git-pull-request",keys:""},{id:"open_project_actions",descriptionKey:"helpDialog.item.openProjectActions",icon:"play",keys:""},{id:"open_settings",descriptionKey:"helpDialog.item.openSettings",icon:"settings-3",keys:""},{id:"open_archive",icon:"archive",keys:""},{id:"open_overview",icon:"compass-3",keys:""},{id:"show_opencode_status",icon:"pulse",keys:""},{id:"reload_ui",icon:"refresh",keys:""},{id:"restart_opencode",icon:"restart",keys:""},{id:"toggle_list_grouping",icon:"layout-right",keys:""},{id:"toggle_project_display",icon:"folder",keys:""},{id:"cycle_project_sort",icon:"list-unordered",keys:""}]}],z=s=>i.jsxs("div",{children:[i.jsx("h3",{className:"typography-meta font-semibold text-muted-foreground uppercase tracking-wider mb-2",children:o(s.categoryKey)}),i.jsx("div",{className:"space-y-1",children:s.items.map(t=>{const N=t.id?L(t.id):void 0,A=t.descriptionKey??(N?.customizable?N.settingsLabelKey:void 0);if(!A||N&&!U(N)||t.id&&!$(t.id,p))return null;const C=t.id?R(t.id,p,o("settings.openchamber.keyboardShortcuts.unassigned")):Array.isArray(t.keys)?t.keys:t.keys.split(" / ");return i.jsxs("div",{className:"flex items-center gap-3 py-1 px-2",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[t.icon&&i.jsx(M,{name:t.icon,className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),i.jsx("span",{className:"typography-meta",children:o(A)})]}),i.jsx("div",{"aria-hidden":!0,className:"min-w-4 flex-1 border-b border-dotted border-border"}),i.jsx("div",{className:"flex shrink-0 items-center gap-1",children:(Array.isArray(C)?C:[C]).map((P,E)=>i.jsxs(B.Fragment,{children:[E>0&&i.jsx("span",{className:"typography-meta text-muted-foreground mx-1",children:o("helpDialog.keyCombiner.or")}),i.jsx("kbd",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 typography-meta bg-muted rounded border border-edge-muted",children:P})]},`${P}-${E}`))})]},t.id||A)})})]},s.categoryKey);l=V,_=j,u=T,m=G,h="max-w-6xl w-[min(72rem,calc(100vw-1.5rem))] max-h-[calc(100dvh-2rem)] flex flex-col overflow-hidden";let S;e[16]===Symbol.for("react.memo_cache_sentinel")?(S=i.jsx(M,{name:"command",className:"h-5 w-5"}),e[16]=S):S=e[16];let D;e[17]!==o?(D=o("helpDialog.title"),e[17]=o,e[18]=D):D=e[18];let w;e[19]!==D?(w=i.jsxs(J,{className:"flex items-center gap-2",children:[S,D]}),e[19]=D,e[20]=w):w=e[20];let b;e[21]!==o?(b=o("helpDialog.description"),e[21]=o,e[22]=b):b=e[22];let K;e[23]!==b?(K=i.jsx(Q,{children:b}),e[23]=b,e[24]=K):K=e[24],e[25]!==w||e[26]!==K?(r=i.jsxs(X,{children:[w,K]}),e[25]=w,e[26]=K,e[27]=r):r=e[27],n=Y,d="flex-1 min-h-0 mt-3",g="pe-1",y=!0,a="grid grid-cols-1 gap-x-12 gap-y-4 lg:grid-cols-2",c=["left","right"].map(s=>i.jsxs("div",{className:"space-y-4",children:[q.filter(t=>t.column===s).map(z),s==="right"&&i.jsxs("ul",{className:"space-y-0.5 px-2 typography-meta text-muted-foreground",children:[i.jsxs("li",{children:["• ",o("helpDialog.proTips.commandPalette",{shortcut:R("open_command_palette",p,o("settings.openchamber.keyboardShortcuts.unassigned"))})]}),i.jsxs("li",{children:["• ",o("helpDialog.proTips.recentSessions")]}),i.jsxs("li",{children:["• ",o("helpDialog.proTips.leaderSequences")]})]})]},s)),e[0]=j,e[1]=T,e[2]=p,e[3]=o,e[4]=n,e[5]=m,e[6]=l,e[7]=a,e[8]=c,e[9]=d,e[10]=g,e[11]=y,e[12]=h,e[13]=r,e[14]=_,e[15]=u}else n=e[4],m=e[5],l=e[6],a=e[7],c=e[8],d=e[9],g=e[10],y=e[11],h=e[12],r=e[13],_=e[14],u=e[15];let k;e[28]!==a||e[29]!==c?(k=i.jsx("div",{className:a,children:c}),e[28]=a,e[29]=c,e[30]=k):k=e[30];let x;e[31]!==n||e[32]!==d||e[33]!==g||e[34]!==y||e[35]!==k?(x=i.jsx(n,{outerClassName:d,className:g,disableHorizontal:y,children:k}),e[31]=n,e[32]=d,e[33]=g,e[34]=y,e[35]=k,e[36]=x):x=e[36];let f;e[37]!==m||e[38]!==x||e[39]!==h||e[40]!==r?(f=i.jsxs(m,{className:h,children:[r,x]}),e[37]=m,e[38]=x,e[39]=h,e[40]=r,e[41]=f):f=e[41];let v;return e[42]!==l||e[43]!==f||e[44]!==_||e[45]!==u?(v=i.jsx(l,{open:_,onOpenChange:u,children:f}),e[42]=l,e[43]=f,e[44]=_,e[45]=u,e[46]=v):v=e[46],v};function Z(e){return e.isHelpDialogOpen}function ee(e){return e.setHelpDialogOpen}function ie(e){return e.shortcutOverrides}export{ft as HelpDialog};