@p4code/cli 0.8.18 → 0.8.19

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 (352) hide show
  1. package/dist/bin.mjs +1 -1
  2. package/dist/{binCli-usgrWcNe.mjs → binCli-BfqWHczJ.mjs} +573 -448
  3. package/dist/client/.vite/manifest.json +2221 -2169
  4. package/dist/client/assets/AlertDialogRoot-D5I6scXr.js +2 -0
  5. package/dist/client/assets/{AnimatedHeight-CO3_zEQw.js → AnimatedHeight-Bt23tBJu.js} +2 -2
  6. package/dist/client/assets/{AuthSurfaceShell-BBPbK1uA.js → AuthSurfaceShell-CScpeyCZ.js} +2 -2
  7. package/dist/client/assets/{CSPContext-D8znCJtI.js → CSPContext-CCVdxObl.js} +2 -2
  8. package/dist/client/assets/{ChatGptUsageButton-Bda8Ir5S.js → ChatGptUsageButton-yYHsmy4T.js} +2 -2
  9. package/dist/client/assets/{ChatMarkdown-BS1t8pnS.js → ChatMarkdown-B0DVA2sH.js} +13 -13
  10. package/dist/client/assets/{CheckboxIndicator-D-KUEtIm.js → CheckboxIndicator-wz_7NgXC.js} +2 -2
  11. package/dist/client/assets/CodexSetupSection.logic-BtAckihn.js +2 -0
  12. package/dist/client/assets/{CollapsiblePanel-84e9KCIs.js → CollapsiblePanel-lE29H_pe.js} +2 -2
  13. package/dist/client/assets/{ComboboxClear-FsZ2LcVw.js → ComboboxClear-DNFG72Hd.js} +2 -2
  14. package/dist/client/assets/ComboboxGroupLabel-B_bH_C6n.js +2 -0
  15. package/dist/client/assets/CommandBlock-VGf7qjr7.js +2 -0
  16. package/dist/client/assets/{ComposerPromptEditor-BGcYrFoa.js → ComposerPromptEditor-CVko-EBm.js} +13 -13
  17. package/dist/client/assets/{CompositeRoot-fbPbFqqK.js → CompositeRoot-BaL7J4TF.js} +2 -2
  18. package/dist/client/assets/{ConnectionStatusDot-t_vHmaco.js → ConnectionStatusDot-IvAZUpIh.js} +2 -2
  19. package/dist/client/assets/DevicePanel-fh1omTPb.js +2 -0
  20. package/dist/client/assets/DeviceSetup-wfV02sXR.js +2 -0
  21. package/dist/client/assets/{DialogTitle-DnR18OB7.js → DialogTitle-CJosg0_K.js} +2 -2
  22. package/dist/client/assets/{DiffCommentAnnotation-Br9sOo_6.js → DiffCommentAnnotation-C4ODeTG1.js} +2 -2
  23. package/dist/client/assets/DiffFileTree-Cm5AwI-L.js +2 -0
  24. package/dist/client/assets/DiffPanel-DW_sAhx0.js +2 -0
  25. package/dist/client/assets/{DiffWorkerPoolProvider-DydpPFgM.js → DiffWorkerPoolProvider-CXn9pnyS.js} +3 -3
  26. package/dist/client/assets/EmbeddedDesign-QMT8odFI.js +19 -0
  27. package/dist/client/assets/{EmbeddedDesign-BsHZJ1Ch.css → EmbeddedDesign-nRjXWU5Y.css} +1 -1
  28. package/dist/client/assets/{EnvironmentMachineIcon-BMWCDR69.js → EnvironmentMachineIcon-Cs4BoaOB.js} +2 -2
  29. package/dist/client/assets/{ExpandableText-B6Dvgn62.js → ExpandableText-DUYIICsi.js} +2 -2
  30. package/dist/client/assets/{FieldControl-CVOjReHh.js → FieldControl-CSR5qaN6.js} +2 -2
  31. package/dist/client/assets/{FileDiff-Dhyt7ZAJ.js → FileDiff-DfokdNMp.js} +2 -2
  32. package/dist/client/assets/FilePreviewPanel-BiO1c4ia.js +34 -0
  33. package/dist/client/assets/{FoldedSettingsSection-Clo0JgyS.js → FoldedSettingsSection-CqteSm77.js} +2 -2
  34. package/dist/client/assets/{FormContext--axmNCbu.js → FormContext-D3Ve_Lza.js} +2 -2
  35. package/dist/client/assets/{Icons-BYSK3arN.js → Icons-Bfx5fXpN.js} +2 -2
  36. package/dist/client/assets/Input-DyKzFpW0.js +2 -0
  37. package/dist/client/assets/{KeybindingsSettings.logic-30fwcukL.js → KeybindingsSettings.logic-0P2hWpBG.js} +2 -2
  38. package/dist/client/assets/NoProjectsHero-GWvfTakA.js +2 -0
  39. package/dist/client/assets/{PanelLayoutControls-DL7sleZ-.js → PanelLayoutControls-yA-MhIU3.js} +10 -10
  40. package/dist/client/assets/{PierreEntryIcon-DKHnMJOl.js → PierreEntryIcon-x_cG473l.js} +2 -2
  41. package/dist/client/assets/{PopoverHandle-C-e81PS3.js → PopoverHandle-CY2mrZwB.js} +2 -2
  42. package/dist/client/assets/PreviewPanel-Dh9n6Ys-.js +2 -0
  43. package/dist/client/assets/ProjectDefaultsSettings-DS-3kgM0.js +2 -0
  44. package/dist/client/assets/ProjectFavicon-Bdl7Tzds.js +3 -0
  45. package/dist/client/assets/{ProjectIconPickerDialog-Bxa9i4w_.js → ProjectIconPickerDialog-BaajvQh5.js} +2 -2
  46. package/dist/client/assets/{ProjectMonogram-CYD6eMbI.js → ProjectMonogram-TlvVxVmS.js} +2 -2
  47. package/dist/client/assets/{ProviderAuthTerminal-Cm88QElc.js → ProviderAuthTerminal-UECuLZ2G.js} +2 -2
  48. package/dist/client/assets/ProviderModelPicker-De9mZUTr.js +2 -0
  49. package/dist/client/assets/{ProviderSettingsForm-CLYzJJII.js → ProviderSettingsForm-Ck0g4BIu.js} +2 -2
  50. package/dist/client/assets/PullRequestCodeTab-Ba54Mifj.js +6 -0
  51. package/dist/client/assets/{ReadOnlySourcePreview-D2Vkrzyc.js → ReadOnlySourcePreview-CVocraam.js} +2 -2
  52. package/dist/client/assets/RenderErrorBoundary-DKs56Rs9.js +2 -0
  53. package/dist/client/assets/ScheduledTasksSettings-d4dmI9oH.js +4 -0
  54. package/dist/client/assets/{ScopedSwitch-BrJEJr8I.js → ScopedSwitch-Z6zp5sHo.js} +2 -2
  55. package/dist/client/assets/{ScrollAreaCorner-BYUnXNwJ.js → ScrollAreaCorner-B-Z3OJHa.js} +2 -2
  56. package/dist/client/assets/{SecretInput-CIbdWrQZ.js → SecretInput-DeAPhcuN.js} +2 -2
  57. package/dist/client/assets/{SelectScrollUpArrow-Cr4PrE_F.js → SelectScrollUpArrow-DfDNBpqc.js} +2 -2
  58. package/dist/client/assets/{SettingsPanels-B8q4OSW7.js → SettingsPanels-CWgjxAiG.js} +8 -8
  59. package/dist/client/assets/{SettingsPanels.logic-C5FkY28P.js → SettingsPanels.logic-D3iQ5aZy.js} +2 -2
  60. package/dist/client/assets/SettingsScopeNotice-BfjZTvSz.js +2 -0
  61. package/dist/client/assets/{T3ConnectAccountPages-DDSM7QWS.js → T3ConnectAccountPages-CsFviIjD.js} +2 -2
  62. package/dist/client/assets/{T3ConnectSidebarSignIn-GnkVas23.js → T3ConnectSidebarSignIn-3MsegucL.js} +2 -2
  63. package/dist/client/assets/ThemeEditorPanel-Bj9nHohX.js +5 -0
  64. package/dist/client/assets/{ThreadTerminalDrawer-4huAp-uS.js → ThreadTerminalDrawer-Cks3C8wv.js} +4 -4
  65. package/dist/client/assets/TooltipViewport-WRCNCy-2.js +2 -0
  66. package/dist/client/assets/{Virtualizer-DjBOkz4F.js → Virtualizer-D6VpBTPc.js} +2 -2
  67. package/dist/client/assets/{WorkspaceBreadcrumb-ClxInGsT.js → WorkspaceBreadcrumb-CR_Yk7Ph.js} +2 -2
  68. package/dist/client/assets/{WorkspacePageContainer-DwN_ETF0.js → WorkspacePageContainer-D3M3Ncv4.js} +2 -2
  69. package/dist/client/assets/{WorkspacePageHeader-BvKCy7v2.js → WorkspacePageHeader-xuSJTTO0.js} +2 -2
  70. package/dist/client/assets/_chat-DkCa6MKZ.js +45 -0
  71. package/dist/client/assets/_chat.index-B5-xqP_5.js +2 -0
  72. package/dist/client/assets/_chat.new-DxPEFJcT.js +4 -0
  73. package/dist/client/assets/_chat.pull-requests-BBVWbXyN.js +2 -0
  74. package/dist/client/assets/{abnfDiagram-VCTEODGH-Cv0dw1u8.js → abnfDiagram-VCTEODGH-CxxMo560.js} +2 -2
  75. package/dist/client/assets/{alert-DYmkyE3l.js → alert-BXnCHOJp.js} +2 -2
  76. package/dist/client/assets/architecture-7GRP2DOG-CrDVVAg3.js +1 -0
  77. package/dist/client/assets/{architectureDiagram-5GKGNRK7-BvQMjhmC.js → architectureDiagram-5GKGNRK7-DJiRjS82.js} +2 -2
  78. package/dist/client/assets/{assets-COg7jyyX.js → assets-B5H7ruRK.js} +2 -2
  79. package/dist/client/assets/{blockDiagram-I7D4REHJ-DR7f58YJ.js → blockDiagram-I7D4REHJ-kDnwtgKo.js} +2 -2
  80. package/dist/client/assets/browserHistoryStore-o7hGV5zZ.js +2 -0
  81. package/dist/client/assets/{browserLinkTarget-Bp-zUm0R.js → browserLinkTarget-hn6UyJXl.js} +2 -2
  82. package/dist/client/assets/{c4Diagram-7LVT6UL2-zgFjNACn.js → c4Diagram-7LVT6UL2-D1fm-1EX.js} +2 -2
  83. package/dist/client/assets/channel-CzmVRCkd.js +2 -0
  84. package/dist/client/assets/{checkbox-brLYzznm.js → checkbox-tOWU_Z9Y.js} +2 -2
  85. package/dist/client/assets/{chunk-4HAMMTFA-Q6ZY3Aj6.js → chunk-4HAMMTFA-BLYTHhED.js} +2 -2
  86. package/dist/client/assets/{chunk-75Z2AOVW-Dv4NtCmQ.js → chunk-75Z2AOVW-DT7Umtgk.js} +2 -2
  87. package/dist/client/assets/{chunk-DU6HZSFF-D-pyRDMG.js → chunk-DU6HZSFF-D0K-8X_H.js} +2 -2
  88. package/dist/client/assets/{chunk-F27PBJKO-BOXrNdwG.js → chunk-F27PBJKO-5P4LORWK.js} +2 -2
  89. package/dist/client/assets/{chunk-GMAD6QVW-uYd_Q5lX.js → chunk-GMAD6QVW-DO-mb18X.js} +2 -2
  90. package/dist/client/assets/{chunk-GVQU2GXP-C3aAR6o_.js → chunk-GVQU2GXP-CxauyvGQ.js} +2 -2
  91. package/dist/client/assets/{chunk-IMKFNOWR-CbCHd80E.js → chunk-IMKFNOWR-QGonsH_m.js} +2 -2
  92. package/dist/client/assets/{chunk-L3NEJ4N5-B5jDlsms.js → chunk-L3NEJ4N5-DxKhJ2tE.js} +2 -2
  93. package/dist/client/assets/{chunk-OSK3NFVY-DgNZQb8q.js → chunk-OSK3NFVY-BlR0vtv9.js} +2 -2
  94. package/dist/client/assets/{chunk-P2QGCYS3-ptp4LKHi.js → chunk-P2QGCYS3-BIit_gMZ.js} +2 -2
  95. package/dist/client/assets/{chunk-POPQ4Y6H-CRBmOW8B.js → chunk-POPQ4Y6H-Ojuitc4K.js} +2 -2
  96. package/dist/client/assets/{chunk-PWAF6VOD-DHkc8IcS.js → chunk-PWAF6VOD-B6Uc75KF.js} +2 -2
  97. package/dist/client/assets/{chunk-SHT3W25Y-B5XMb9ST.js → chunk-SHT3W25Y-DSzF0_aF.js} +2 -2
  98. package/dist/client/assets/{chunk-SVP7TREG-Lt0ZENIq.js → chunk-SVP7TREG-BbxrRzvm.js} +2 -2
  99. package/dist/client/assets/{chunk-TICWLB2K-BhZt3DVX.js → chunk-TICWLB2K-qxbKtZBK.js} +2 -2
  100. package/dist/client/assets/classDiagram-ZZMXUADV-Ce7tu2gJ.js +2 -0
  101. package/dist/client/assets/classDiagram-v2-VYDZK3BY-Ce7tu2gJ.js +2 -0
  102. package/dist/client/assets/{color-picker-D7d1go0g.js → color-picker-C_20-4RB.js} +2 -2
  103. package/dist/client/assets/{combobox-DSVavlIH.js → combobox-NsYaIiJL.js} +2 -2
  104. package/dist/client/assets/command-DJR9ebnx.js +2 -0
  105. package/dist/client/assets/composer-logic-CkuMSzLW.js +6 -0
  106. package/dist/client/assets/composerDraftUploads-D0K1HfK_.js +2 -0
  107. package/dist/client/assets/{connect-C39BhZ-c.js → connect-BSmdC-l-.js} +2 -2
  108. package/dist/client/assets/{connect-agent-Dj_Cfdx6.js → connect-agent-BNeGfFIv.js} +2 -2
  109. package/dist/client/assets/{cynefin-OW5HDTMX-CNKdS-0M.js → cynefin-OW5HDTMX-BRoWQ1nZ.js} +1 -1
  110. package/dist/client/assets/{cynefinDiagram-5FMLGOSQ-CoFxzJSW.js → cynefinDiagram-5FMLGOSQ-BPoK_fdY.js} +2 -2
  111. package/dist/client/assets/{dagre-GXQ25YYZ-q0omC4bc.js → dagre-GXQ25YYZ-B6n9u2fx.js} +2 -2
  112. package/dist/client/assets/{device-CWgOLpbF.js → device-V5bbUMMx.js} +2 -2
  113. package/dist/client/assets/{diagram-S7CK7UJ4-CdFkGs_B.js → diagram-S7CK7UJ4-B4H5MfDU.js} +2 -2
  114. package/dist/client/assets/{diagram-UQ7AKVKN-B0KtokqT.js → diagram-UQ7AKVKN-BN9pt82T.js} +2 -2
  115. package/dist/client/assets/{diagram-VSXAHHWV-DjtTeImL.js → diagram-VSXAHHWV-C69gO9TK.js} +2 -2
  116. package/dist/client/assets/{diagram-VX7I27RA-DRYLlkkf.js → diagram-VX7I27RA-qliQCn2I.js} +2 -2
  117. package/dist/client/assets/{diagram-Z3DM3KII-C-x2EfL6.js → diagram-Z3DM3KII-JnCXFjMD.js} +2 -2
  118. package/dist/client/assets/{dialog-DYFQxVoN.js → dialog-C4UzQSL1.js} +2 -2
  119. package/dist/client/assets/{diffRendering-6DuM2rGF.js → diffRendering-Cuv7q0nc.js} +2 -2
  120. package/dist/client/assets/{discovery-list-BvblDG7m.js → discovery-list-ppl7-G1K.js} +2 -2
  121. package/dist/client/assets/{dist-CkgAUeqn.js → dist-CnDtgaa3.js} +3 -3
  122. package/dist/client/assets/{draft-input-27erQjx_.js → draft-input-DUB7VaUv.js} +2 -2
  123. package/dist/client/assets/{duoViewer-CBnLVCTt.js → duoViewer-Bi-KrG5F.js} +2 -2
  124. package/dist/client/assets/{dynamic-Cjr9H8t4.js → dynamic-mqe80fw7.js} +3 -3
  125. package/dist/client/assets/{ebnfDiagram-PWID7BFC-UISo4OT-.js → ebnfDiagram-PWID7BFC-jdXVhqCj.js} +2 -2
  126. package/dist/client/assets/{embeddedScripts-Dr-tOtuJ.js → embeddedScripts-Qhl8LxE1.js} +2 -2
  127. package/dist/client/assets/{empty-2jxBvPLn.js → empty-GrsNgo1m.js} +2 -2
  128. package/dist/client/assets/{entities-DCbEYTvn.js → entities-D6pHmUcl.js} +2 -2
  129. package/dist/client/assets/{erDiagram-RLTQ6QDP-CeWlUdOf.js → erDiagram-RLTQ6QDP-DdgQriY9.js} +2 -2
  130. package/dist/client/assets/eventmodeling-NTZA5JFV-C45g87dF.js +1 -0
  131. package/dist/client/assets/{fileLinks-5NSgRKPU.js → fileLinks-DKkO_IJu.js} +2 -2
  132. package/dist/client/assets/{fileTreeExpansion-CA6c4E3-.js → fileTreeExpansion-C1UNNqSC.js} +2 -2
  133. package/dist/client/assets/flowDiagram-HODETNUW-CxTQXeBP.js +1 -0
  134. package/dist/client/assets/{ganttDiagram-EL5Y4UJY-KPPMvqNL.js → ganttDiagram-EL5Y4UJY-DFCwukfW.js} +2 -2
  135. package/dist/client/assets/{getDiffFileInput-CuM1lgsL.js → getDiffFileInput-phPjSTY8.js} +2 -2
  136. package/dist/client/assets/git-compare-DW_c6fci.js +2 -0
  137. package/dist/client/assets/{gitGraph-4MIJSDKK-BGSFaZro.js → gitGraph-4MIJSDKK-B-iBBweB.js} +1 -1
  138. package/dist/client/assets/{gitGraphDiagram-WWUBYQGX-CwYf9r63.js → gitGraphDiagram-WWUBYQGX-w7enwZUZ.js} +2 -2
  139. package/dist/client/assets/{guideRunStore-B3Y6e_nf.js → guideRunStore-C-LauQUS.js} +2 -2
  140. package/dist/client/assets/{htmlRender-BaqdfJ6m.js → htmlRender-DVq1i7PZ.js} +2 -2
  141. package/dist/client/assets/{index-DmPPPGJb.js → index-CW8ApI1G.js} +3 -3
  142. package/dist/client/assets/{info-A6RAGUB7-C831OtOR.js → info-A6RAGUB7-zYd5-_tB.js} +1 -1
  143. package/dist/client/assets/{infoDiagram-27XIBGKW-DVstIW76.js → infoDiagram-27XIBGKW-BlWLgzyt.js} +2 -2
  144. package/dist/client/assets/{input-83N8btBC.js → input-DpZhQSV2.js} +2 -2
  145. package/dist/client/assets/{input-group-Q757vhrD.js → input-group-BjfPTIWt.js} +2 -2
  146. package/dist/client/assets/{ishikawaDiagram-5VMMS53U-CJq0N-AL.js → ishikawaDiagram-5VMMS53U-oNq825oe.js} +2 -2
  147. package/dist/client/assets/{journeyDiagram-3NMN7TZE-D76KCD6f.js → journeyDiagram-3NMN7TZE-BQqGB1_d.js} +2 -2
  148. package/dist/client/assets/{kanban-definition-UXKFOSKX-D1kzRMIP.js → kanban-definition-UXKFOSKX-CDCYjq7t.js} +2 -2
  149. package/dist/client/assets/{kbd-D8UfTN0o.js → kbd-BfsP5lvQ.js} +2 -2
  150. package/dist/client/assets/{keybindings-DLDyoB30.js → keybindings-BD3cM3Jm.js} +2 -2
  151. package/dist/client/assets/{lazyRouteComponent-BCGAjyjO.js → lazyRouteComponent-DebYKx4q.js} +2 -2
  152. package/dist/client/assets/{line-QHGhF6Vm.js → line-Dr_Yg9S8.js} +2 -2
  153. package/dist/client/assets/{link-Bgj44djS.js → link-wJO6kwX4.js} +2 -2
  154. package/dist/client/assets/{linkedPrompt-D1aW6nV5.js → linkedPrompt-Dx_WF0Gk.js} +2 -2
  155. package/dist/client/assets/main-DklPMTd5.css +2 -0
  156. package/dist/client/assets/main-DqlnVz2C.js +26 -0
  157. package/dist/client/assets/{mediaReference-CQtke4j3.js → mediaReference-DEdeypAC.js} +2 -2
  158. package/dist/client/assets/{mediaSource-CI2bKK3n.js → mediaSource-DTry5UU8.js} +2 -2
  159. package/dist/client/assets/{mermaid-parser.core-Brqe55KM.js → mermaid-parser.core-EKu4BBvw.js} +4 -4
  160. package/dist/client/assets/{mermaid.core-Cdl6aiT5.js → mermaid.core-C-FRLnEk.js} +5 -5
  161. package/dist/client/assets/{mindmap-definition-YA3MSWOX-CcdCCRbd.js → mindmap-definition-YA3MSWOX-Bo-8FCl-.js} +2 -2
  162. package/dist/client/assets/{number-field-DQIrEOoj.js → number-field-B0OyTTUs.js} +2 -2
  163. package/dist/client/assets/{observeResize-BaPAtI3Q.js → observeResize-CBAzjAMz.js} +2 -2
  164. package/dist/client/assets/{onboarding-ObMsA9VF.js → onboarding-EecLmYJ0.js} +2 -2
  165. package/dist/client/assets/{openFileInPreview-CdBR5kuZ.js → openFileInPreview-MgwNsNCM.js} +2 -2
  166. package/dist/client/assets/{p4ProjectFile--u7SOSK5.js → p4ProjectFile-DZ6HGjaI.js} +2 -2
  167. package/dist/client/assets/{packet-AYTQ26CC-BSuHbq7S.js → packet-AYTQ26CC-DD_SFe63.js} +1 -1
  168. package/dist/client/assets/{pair-C11lrlzi.js → pair-BzsQ1gz0.js} +2 -2
  169. package/dist/client/assets/{pegDiagram-XKGWAZYB-Iy9neoGN.js → pegDiagram-XKGWAZYB-Bbw22YYs.js} +2 -2
  170. package/dist/client/assets/{phoneViewer-iqsNqM8D.js → phoneViewer-DZyuQ-is.js} +2 -2
  171. package/dist/client/assets/{pie-WAS4IAKB-BlC5Ctcv.js → pie-WAS4IAKB-CNHjs-Ma.js} +1 -1
  172. package/dist/client/assets/{pieDiagram-E7YTZNPT-CtVgATJF.js → pieDiagram-E7YTZNPT-_ZbKy7eA.js} +2 -2
  173. package/dist/client/assets/{pierre-icons-fSsw9aa-.js → pierre-icons-BubjdUjD.js} +2 -2
  174. package/dist/client/assets/{popover-B1MF5i1c.js → popover-BuuvISBT.js} +2 -2
  175. package/dist/client/assets/{preview-DwLWkMZG.js → preview-BlW45a9H.js} +2 -2
  176. package/dist/client/assets/{preview-ITad1JAy.js → preview-CwzKOKVG.js} +2 -2
  177. package/dist/client/assets/{previewMiniPlayerStore-DN-AYBed.js → previewMiniPlayerStore-CGiA2h59.js} +2 -2
  178. package/dist/client/assets/{primary-8A8hvHFL.js → primary-3GB-obcz.js} +2 -2
  179. package/dist/client/assets/primaryCloudLinkState-DYmepSfi.js +2 -0
  180. package/dist/client/assets/{projectFilesQueryState-CGllQp_V.js → projectFilesQueryState-D2rMhOEA.js} +2 -2
  181. package/dist/client/assets/{projectScriptEditor-DwqFzld2.js → projectScriptEditor-BxnriUVv.js} +2 -2
  182. package/dist/client/assets/providerSkills-C_OG7yP0.js +2 -0
  183. package/dist/client/assets/{pullRequestDetail.logic-CkxKh0fV.js → pullRequestDetail.logic-BhGUhCGd.js} +2 -2
  184. package/dist/client/assets/{pullRequestIcons-CSZus-cz.js → pullRequestIcons-DsTinQ4q.js} +2 -2
  185. package/dist/client/assets/{pullRequestReviewStore-78f71w6J.js → pullRequestReviewStore-BKYNixhZ.js} +2 -2
  186. package/dist/client/assets/pullRequests-CQ2Zte1o.js +2 -0
  187. package/dist/client/assets/{quadrantDiagram-AXDQQJYC-kq18RP_F.js → quadrantDiagram-AXDQQJYC-Bnl3w7OY.js} +2 -2
  188. package/dist/client/assets/{queries-DCKH7ltg.js → queries-_Qf89qTX.js} +2 -2
  189. package/dist/client/assets/{query-B1uAr_ii.js → query-CRlRG7rf.js} +2 -2
  190. package/dist/client/assets/{radar-RG4KPBEZ-Cbkq33o2.js → radar-RG4KPBEZ-DweWJU_g.js} +1 -1
  191. package/dist/client/assets/{radio-group-CFJMQH66.js → radio-group-iJUHzvZC.js} +2 -2
  192. package/dist/client/assets/{railroad-74A4TZTK-Ba3TZ4Wg.js → railroad-74A4TZTK-DmxX8fKE.js} +1 -1
  193. package/dist/client/assets/railroad-abnf-HS5TGJTU-CSGCBDLE.js +1 -0
  194. package/dist/client/assets/railroad-ebnf-LZEXJU2U-qkcBzemM.js +1 -0
  195. package/dist/client/assets/railroad-peg-WCYAUIDC-B-rmMXQT.js +1 -0
  196. package/dist/client/assets/{railroadDiagram-O6MQD6OU-BfOnyiaT.js → railroadDiagram-O6MQD6OU-D94VfvdV.js} +2 -2
  197. package/dist/client/assets/{renderScheduler-CcWhS7Yq.js → renderScheduler-DIWSOdLy.js} +2 -2
  198. package/dist/client/assets/{requirementDiagram-BXWQKSXE-DFzAGiJp.js → requirementDiagram-BXWQKSXE-4Sss1rRH.js} +2 -2
  199. package/dist/client/assets/{rightPanelStore-DfMWWfvR.js → rightPanelStore-C3FvIXSq.js} +2 -2
  200. package/dist/client/assets/{runtime-B9IDNXDU.js → runtime-CJNEsw6U.js} +3 -3
  201. package/dist/client/assets/runtime-ets76j-h.js +2 -0
  202. package/dist/client/assets/{runtimeModeConfig-C3TbI2qR.js → runtimeModeConfig-DNgZlBoC.js} +2 -2
  203. package/dist/client/assets/{sankeyDiagram-P5KCCOFB-D9gFGibV.js → sankeyDiagram-P5KCCOFB-CFV5CXMi.js} +2 -2
  204. package/dist/client/assets/{scheduledTasksSettings.logic-DVbZRIYJ.js → scheduledTasksSettings.logic-CGYf8FQi.js} +2 -2
  205. package/dist/client/assets/{scroll-area-DGS0jgnh.js → scroll-area-By1ARHPp.js} +2 -2
  206. package/dist/client/assets/{select-Dsx46akG.js → select-DqGlaY40.js} +2 -2
  207. package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-C9pRaNT5.js → sequenceDiagram-WJ2MYXX4-Cln2JnVw.js} +2 -2
  208. package/dist/client/assets/{server-CoH7V4JL.js → server-DpLkyQ0R.js} +2 -2
  209. package/dist/client/assets/{session-Bo2ZSprC.js → session-Cau_XThy.js} +2 -2
  210. package/dist/client/assets/{session-logic-C4wGF3_E.js → session-logic-CRwcdrNw.js} +2 -2
  211. package/dist/client/assets/settings-B4aWX2xy.js +2 -0
  212. package/dist/client/assets/{settings.appearance-6ktu9wdJ.js → settings.appearance-C__igzME.js} +2 -2
  213. package/dist/client/assets/settings.archived-Bs-jKZBo.js +2 -0
  214. package/dist/client/assets/{settings.computer-use-C24sO93u.js → settings.computer-use-SngXUHmk.js} +2 -2
  215. package/dist/client/assets/settings.connections-Bw61DbEx.js +2 -0
  216. package/dist/client/assets/settings.data-controls-DbqXwsIJ.js +2 -0
  217. package/dist/client/assets/{settings.decisions-kar2kv7T.js → settings.decisions-Bw-dFoGZ.js} +2 -2
  218. package/dist/client/assets/settings.diagnostics-D5dG-CTq.js +2 -0
  219. package/dist/client/assets/{settings.general-C1zsJgwK.js → settings.general-DVafi8E5.js} +2 -2
  220. package/dist/client/assets/settings.integrations-C4t8diIu.js +2 -0
  221. package/dist/client/assets/{settings.keybindings-CYcsJ6DQ.js → settings.keybindings-B1dMCy_G.js} +2 -2
  222. package/dist/client/assets/{settings.open-source-licenses-DnBHlZE2.js → settings.open-source-licenses-kgRl8SYE.js} +2 -2
  223. package/dist/client/assets/settings.plugins-HtKh3bu8.js +5 -0
  224. package/dist/client/assets/settings.projects-CtKhtmR8.js +4 -0
  225. package/dist/client/assets/settings.providers-Bd0702hD.js +3 -0
  226. package/dist/client/assets/{settings.scheduled-tasks-Bf37L1OK.js → settings.scheduled-tasks-Tpcp-BCI.js} +2 -2
  227. package/dist/client/assets/settings.snap-shot-BngynTBI.js +2 -0
  228. package/dist/client/assets/settings.source-control-DmQkMruN.js +2 -0
  229. package/dist/client/assets/{settings.storage-DmbTXujz.js → settings.storage-CUeYkScx.js} +2 -2
  230. package/dist/client/assets/settingsLayout-Du5mjDQU.js +3 -0
  231. package/dist/client/assets/sidebar-Dxq8kloB.js +2 -0
  232. package/dist/client/assets/{sidebarProjectGrouping-DrnsFA8t.js → sidebarProjectGrouping-BfZ705hQ.js} +2 -2
  233. package/dist/client/assets/{skeleton-0mC3wMw1.js → skeleton--M5AJWoC.js} +2 -2
  234. package/dist/client/assets/{sourceControl-D6TEHNpa.js → sourceControl-Cmvk57z0.js} +2 -2
  235. package/dist/client/assets/sourceControlClients-C0IkCWsN.js +2 -0
  236. package/dist/client/assets/{spinner-DHOdl-gn.js → spinner-cHzhZrgb.js} +2 -2
  237. package/dist/client/assets/{standalone-page-Dx8vGwaJ.js → standalone-page-BaVFigS5.js} +2 -2
  238. package/dist/client/assets/{stateDiagram-D77RDMKH-D8n56CID.js → stateDiagram-D77RDMKH-CZ_bsdqp.js} +2 -2
  239. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-93FSJgV8.js +2 -0
  240. package/dist/client/assets/{swimlanes-42K2YHIH-DZZct2ih.js → swimlanes-42K2YHIH-My4j-GD7.js} +2 -2
  241. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-1FS1ow3r.js +9 -0
  242. package/dist/client/assets/{terminal-links-Di9Ijg8X.js → terminal-links-BSEOjQCo.js} +2 -2
  243. package/dist/client/assets/{terminalSessions-B8EDcX8b.js → terminalSessions-BpuHxk1q.js} +2 -2
  244. package/dist/client/assets/{textarea-BvPoR1cI.js → textarea-XR9lgl40.js} +2 -2
  245. package/dist/client/assets/{themePalette-zFOiBKDi.js → themePalette-CONAHv4I.js} +2 -2
  246. package/dist/client/assets/threadSort-Bd2rijEy.js +2 -0
  247. package/dist/client/assets/{timeline-definition-24CTP7MA-BGfuRztb.js → timeline-definition-24CTP7MA-Q9JBFJBF.js} +2 -2
  248. package/dist/client/assets/toast-CwJ-bjHi.js +2 -0
  249. package/dist/client/assets/{toggle-DeCGfzT2.js → toggle-FqX4CVcC.js} +2 -2
  250. package/dist/client/assets/{toggle-group-DekLc0Ax.js → toggle-group-JCVlIQ5i.js} +2 -2
  251. package/dist/client/assets/tooltip-CtZ6PJJw.js +2 -0
  252. package/dist/client/assets/{treeView-Q6P3EWNA-BPM2x-ME.js → treeView-Q6P3EWNA-3qBVWI88.js} +1 -1
  253. package/dist/client/assets/{treemap-WGGIJYW6-sku0fChI.js → treemap-WGGIJYW6-O3_0iynh.js} +1 -1
  254. package/dist/client/assets/uiStateStore-CcTtH1Jz.js +6 -0
  255. package/dist/client/assets/usage-DWATWAhJ.js +2 -0
  256. package/dist/client/assets/{usageAccess-BGb3m0YV.js → usageAccess-Cpk_Aec9.js} +2 -2
  257. package/dist/client/assets/{usageFormat-H-RgZ0fy.js → usageFormat-B23xwSbG.js} +2 -2
  258. package/dist/client/assets/{usageShortcuts-C320W17X.js → usageShortcuts-BMHWlKT1.js} +2 -2
  259. package/dist/client/assets/{use-atom-command-GpCw1tWF.js → use-atom-command-3Z4EZbCj.js} +2 -2
  260. package/dist/client/assets/{useAriaLabelledBy-C8nSWyQ9.js → useAriaLabelledBy-CMSGO3cd.js} +2 -2
  261. package/dist/client/assets/{useHandleNewThread-FJLPEfoH.js → useHandleNewThread-B9RCcbnw.js} +2 -2
  262. package/dist/client/assets/{useLocation-Ccsih1eo.js → useLocation-BTH6wjAt.js} +2 -2
  263. package/dist/client/assets/useNavigate-BS8hIoQr.js +2 -0
  264. package/dist/client/assets/{useNavigateBack-PnWVFtkU.js → useNavigateBack-DskLvJ9n.js} +2 -2
  265. package/dist/client/assets/{useParams-CoeDewwU.js → useParams-DhNu716j.js} +2 -2
  266. package/dist/client/assets/{usePermissionStatus-mBtsOu9K.js → usePermissionStatus-DaOsrYgE.js} +2 -2
  267. package/dist/client/assets/usePullRequestActions-3vXHUgiG.js +3 -0
  268. package/dist/client/assets/{useRegisterFieldControl-9rSmWR2W.js → useRegisterFieldControl-BX1EsUxP.js} +2 -2
  269. package/dist/client/assets/useScopedModelAvailability-BcYNdaQr.js +2 -0
  270. package/dist/client/assets/useSettings-D_OJJgNE.js +3 -0
  271. package/dist/client/assets/{useT3ConnectAuthPrompt-ZyPZIXm7.js → useT3ConnectAuthPrompt-BcMgBGvL.js} +2 -2
  272. package/dist/client/assets/utils-DqIvhFCT.js +37 -0
  273. package/dist/client/assets/{vcsRefInvalidation-DfCz0cGO.js → vcsRefInvalidation-Dj5BpmJA.js} +2 -2
  274. package/dist/client/assets/{vennDiagram-4TSXK5OY-CjhblZp4.js → vennDiagram-4TSXK5OY-CGJ_vzL4.js} +2 -2
  275. package/dist/client/assets/{wardley-WFR3VGLG-Cuf_pn9-.js → wardley-WFR3VGLG-dLKWDrdG.js} +1 -1
  276. package/dist/client/assets/{wardleyDiagram-VM6X3IG4-CMQ-_cYv.js → wardleyDiagram-VM6X3IG4-CZY3cfuL.js} +2 -2
  277. package/dist/client/assets/welcome-BSKechyt.js +2 -0
  278. package/dist/client/assets/{xychartDiagram-S5SC5T6Z-BlCqmJgA.js → xychartDiagram-S5SC5T6Z-H2sll7xl.js} +2 -2
  279. package/dist/client/index.html +1 -1
  280. package/dist/{renderer-7OJ6c0Me.mjs → renderer-CCVomMFP.mjs} +2 -2
  281. package/dist/{runtime-BHqdsO3Y.mjs → runtime-DKclsP_7.mjs} +51 -3
  282. package/package.json +1 -1
  283. package/dist/client/assets/AlertDialogRoot-D6ed6zQR.js +0 -2
  284. package/dist/client/assets/CodexSetupSection.logic-Ed9SDkqP.js +0 -2
  285. package/dist/client/assets/CommandBlock-C7ASE_F_.js +0 -2
  286. package/dist/client/assets/DevicePanel-CS1FTu-C.js +0 -2
  287. package/dist/client/assets/DeviceSetup-DZAK0_tm.js +0 -2
  288. package/dist/client/assets/DiffFileTree-DkLJXYZf.js +0 -2
  289. package/dist/client/assets/DiffPanel-CGV12wM6.js +0 -2
  290. package/dist/client/assets/EmbeddedDesign--Xz14U92.js +0 -19
  291. package/dist/client/assets/FilePreviewPanel-8tUtMikb.js +0 -34
  292. package/dist/client/assets/Input-CVwvVqbx.js +0 -2
  293. package/dist/client/assets/NoProjectsHero-Lsb9cuvO.js +0 -2
  294. package/dist/client/assets/PreviewPanel-DmaoFTEA.js +0 -2
  295. package/dist/client/assets/ProjectDefaultsSettings-CrKY01_P.js +0 -2
  296. package/dist/client/assets/ProjectFavicon-B5C6TpKj.js +0 -3
  297. package/dist/client/assets/ProviderModelPicker-CeB11O3P.js +0 -2
  298. package/dist/client/assets/PullRequestCodeTab-BqH4glgo.js +0 -6
  299. package/dist/client/assets/RenderErrorBoundary-BgOA8qma.js +0 -2
  300. package/dist/client/assets/ScheduledTasksSettings-BMQ-_Rms.js +0 -4
  301. package/dist/client/assets/SettingsScopeNotice-_WSLtOW4.js +0 -2
  302. package/dist/client/assets/ThemeEditorPanel-DB8D5_6u.js +0 -5
  303. package/dist/client/assets/TooltipViewport-kqulS2nz.js +0 -2
  304. package/dist/client/assets/_chat-C2VZmKVT.js +0 -45
  305. package/dist/client/assets/_chat.index-CQSbFMBa.js +0 -2
  306. package/dist/client/assets/_chat.new-BxObe9FX.js +0 -4
  307. package/dist/client/assets/_chat.pull-requests-JS9EZDI7.js +0 -2
  308. package/dist/client/assets/architecture-7GRP2DOG-Dd1d-ckm.js +0 -1
  309. package/dist/client/assets/browserHistoryStore-_SurQa0e.js +0 -2
  310. package/dist/client/assets/channel-Dsne2IjR.js +0 -2
  311. package/dist/client/assets/classDiagram-ZZMXUADV-Dazl0CLN.js +0 -2
  312. package/dist/client/assets/classDiagram-v2-VYDZK3BY-Dazl0CLN.js +0 -2
  313. package/dist/client/assets/command-DsE3Ju6m.js +0 -2
  314. package/dist/client/assets/environments-iW64jjyO.js +0 -2
  315. package/dist/client/assets/eventmodeling-NTZA5JFV-B5z8GPGl.js +0 -1
  316. package/dist/client/assets/flowDiagram-HODETNUW-CEpweBDE.js +0 -1
  317. package/dist/client/assets/git-compare-CCnx9obs.js +0 -2
  318. package/dist/client/assets/main-ChIB1-3M.css +0 -2
  319. package/dist/client/assets/main-lV-t-UZx.js +0 -30
  320. package/dist/client/assets/primaryCloudLinkState-BP-HZzf2.js +0 -2
  321. package/dist/client/assets/providerSkills-O72EMm0V.js +0 -2
  322. package/dist/client/assets/pullRequests-7IQc0VIk.js +0 -2
  323. package/dist/client/assets/railroad-abnf-HS5TGJTU-l3gFfdc2.js +0 -1
  324. package/dist/client/assets/railroad-ebnf-LZEXJU2U-eiWL8AW4.js +0 -1
  325. package/dist/client/assets/railroad-peg-WCYAUIDC-UK0E-Txe.js +0 -1
  326. package/dist/client/assets/runtime-B5cKWtKn.js +0 -2
  327. package/dist/client/assets/settings-mrxLMm57.js +0 -2
  328. package/dist/client/assets/settings.archived-Hl4HyrFx.js +0 -2
  329. package/dist/client/assets/settings.connections-CgaYGg_W.js +0 -2
  330. package/dist/client/assets/settings.data-controls-DNY0fL9E.js +0 -2
  331. package/dist/client/assets/settings.diagnostics-BHSEPjF8.js +0 -2
  332. package/dist/client/assets/settings.integrations-DykwmCf7.js +0 -2
  333. package/dist/client/assets/settings.plugins-B7Nlb85S.js +0 -5
  334. package/dist/client/assets/settings.projects-Ob8jKbIh.js +0 -4
  335. package/dist/client/assets/settings.providers-BIm-8j9C.js +0 -3
  336. package/dist/client/assets/settings.snap-shot-D37zM8an.js +0 -2
  337. package/dist/client/assets/settings.source-control-DmRUgcsk.js +0 -2
  338. package/dist/client/assets/settingsLayout-CqGfrbmD.js +0 -3
  339. package/dist/client/assets/sidebar-C_I_pq_E.js +0 -2
  340. package/dist/client/assets/sortable.esm-DuAaqmgD.js +0 -6
  341. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-DqXgq-FS.js +0 -2
  342. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-DAX63YhZ.js +0 -9
  343. package/dist/client/assets/threadSort-Cn23YHH2.js +0 -2
  344. package/dist/client/assets/toast-CN7Jd-pG.js +0 -2
  345. package/dist/client/assets/tooltip-DaSC-3cL.js +0 -2
  346. package/dist/client/assets/usage-CKRSqJso.js +0 -2
  347. package/dist/client/assets/useNavigate-Dhy_1-Mg.js +0 -2
  348. package/dist/client/assets/usePullRequestActions-_K7fD4Ny.js +0 -3
  349. package/dist/client/assets/useScopedModelAvailability-DE1E_lbg.js +0 -2
  350. package/dist/client/assets/useSettings-CKA-LDDj.js +0 -3
  351. package/dist/client/assets/utils-BAPnqm16.js +0 -37
  352. package/dist/client/assets/welcome-nE6tva7L.js +0 -2
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PullRequestCodeTab-BqH4glgo.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/Icon-l19w4AjM.js","assets/utils-BAPnqm16.js","assets/activity-C1Y3O_v1.js","assets/createLucideIcon-CacG5mZC.js","assets/alarm-clock-Pw90g7hE.js","assets/app-window-D2LBv8RE.js","assets/archive-0Qz6rgBl.js","assets/arrow-down-up-B46gw0xW.js","assets/arrow-down-DvRecXuy.js","assets/arrow-left-BLE461db.js","assets/arrow-right-left-BqjFeAD_.js","assets/arrow-right-CoV5ameY.js","assets/arrow-up-down-ibtVnemT.js","assets/arrow-up-left-BMvgV_8i.js","assets/arrow-up-right-C6IM-WPd.js","assets/arrow-up-3Yp3lsoe.js","assets/battery-Bjbw2yxu.js","assets/bell-CLuvLMth.js","assets/blocks-B-VfW07Q.js","assets/book-open-HEEW8eqT.js","assets/bookmark-HM-xwl47.js","assets/bot-DpQzHyXo.js","assets/box-CKWcQvdq.js","assets/bug-Dtc5BRVF.js","assets/calendar-arrow-down-CAFi0Chs.js","assets/calendar-arrow-up-Cs2MbLyZ.js","assets/calendar-clock-DTUOomkO.js","assets/calendar-c_JH_1V1.js","assets/camera-V1Ufc9sC.js","assets/chart-no-axes-column-DKbSsm0y.js","assets/check-Cmy7pM2Y.js","assets/chevron-down-DHV04o66.js","assets/chevron-left-DrNh6cTh.js","assets/chevron-right-NbahR9_s.js","assets/chevron-up-C-w52bD6.js","assets/chevrons-left-right-ellipsis-D2Qu5H2y.js","assets/chevrons-up-down-BMPucOK_.js","assets/chromium-BusoCgri.js","assets/circle-alert-B83jEPoh.js","assets/circle-arrow-up-kT0Pa2jA.js","assets/circle-check-Y1T60J9X.js","assets/circle-dashed-ChJzoouS.js","assets/circle-dot-DSAuCGJf.js","assets/circle-slash-Ceo-2WKq.js","assets/circle-x-C-GXnJRB.js","assets/circle-4zZlZno3.js","assets/clock-3-SBiWJYHb.js","assets/clock-bc9N_wA2.js","assets/cloud-download-BE7c7r3I.js","assets/cloud-upload-noux3Cbp.js","assets/cloud-DyVMWy7X.js","assets/code-xml-CbuCFrkh.js","assets/code-DuFehkNQ.js","assets/columns-2-D1kdFD9w.js","assets/copy-CoM62e83.js","assets/corner-left-up-BCqW4dF8.js","assets/corner-up-right--t3OPVhh.js","assets/cpu-mffhvvYB.js","assets/database-DipbOz0U.js","assets/download-BAp4p4A-.js","assets/earth-CTY23Bx1.js","assets/ellipsis-vertical-fYTS1grT.js","assets/ellipsis-6x3R4_IB.js","assets/external-link-NWS0I_zo.js","assets/eye-off-BJFC-Vn7.js","assets/eye-Dh5UEUs_.js","assets/file-braces-CcggTVd0.js","assets/file-code-corner-Dt6PpZnb.js","assets/file-diff-BE4sroJp.js","assets/file-search-DotMSEoS.js","assets/file-spreadsheet-Boc78Vjm.js","assets/file-text-xj3y_Xbg.js","assets/file-1cutE11R.js","assets/files-CQwG7JjF.js","assets/film-CYJIuMHb.js","assets/flask-conical-WkWFg73e.js","assets/folder-closed-zBKiY8_q.js","assets/folder-cog-BMK_9DOi.js","assets/folder-git-2-BxqGR5ht.js","assets/folder-git-CoMYGJp_.js","assets/folder-open-BqgCWh1y.js","assets/folder-plus-BHa3aD6W.js","assets/folder-tree-CIpeR87A.js","assets/folder-CMIvEUJv.js","assets/gauge-C_4eEUrj.js","assets/git-branch-plus-BQ_ISFgF.js","assets/git-branch-CAP5iwh8.js","assets/git-commit-horizontal-6IR7R88i.js","assets/git-fork-BEEZa2l_.js","assets/git-merge-C47N_dux.js","assets/git-pull-request-arrow-C9_ZycDh.js","assets/git-pull-request-closed-BkRFT_Rl.js","assets/git-pull-request-draft-BNpXqUsz.js","assets/globe-BygqUCSx.js","assets/grip-vertical-B8ERFH5y.js","assets/hammer-BRTj-Vot.js","assets/hard-drive-CVWUL95f.js","assets/history-B22_6xEN.js","assets/house-D_gjXlRt.js","assets/image-xUrgiZ2i.js","assets/inbox-48iST-IJ.js","assets/info-BHB-83EA.js","assets/keyboard-9HUE6Zs7.js","assets/laptop-05PEAB3d.js","assets/layers-BqgDAlx3.js","assets/lightbulb-CEqRo_1f.js","assets/link-2-B_p2EG7Q.js","assets/link-zAXVcUwk.js","assets/list-checks-CQu2FTgJ.js","assets/list-filter-BOx8tW9q.js","assets/list-ordered-f2n8ZhGo.js","assets/list-todo-D7F9k-PE.js","assets/list-BAEaXVbr.js","assets/loader-circle-B3Ce8JIQ.js","assets/lock-open-Bt3QlIE2.js","assets/lock-Cc3mNdEd.js","assets/log-in-BpPtfyCd.js","assets/mail-J8kfrAC7.js","assets/maximize-2-CHT2IkVy.js","assets/maximize-CoWtPryT.js","assets/memory-stick-C7kBEkBW.js","assets/message-circle-question-mark-Blboafqi.js","assets/message-circle-CwQpPAbq.js","assets/message-square-dashed-DrEYZ6F3.js","assets/message-square-off-BstjdZP9.js","assets/message-square-text-CJTpB0rs.js","assets/message-square-warning-I95tWaoN.js","assets/message-square-DLzUyuIE.js","assets/messages-square-BNeF2306.js","assets/minimize-2-DOhpJbnX.js","assets/minus-C7W28oE7.js","assets/monitor-Ddj8MK6z.js","assets/moon-B9ss2TfK.js","assets/mouse-pointer-2-DbBU41il.js","assets/mouse-pointer-click-DsDE4K7M.js","assets/octagon-alert-BKVCgU--.js","assets/package-plus-Cl7EzKuY.js","assets/package-CeeyHFJU.js","assets/paintbrush-D1BKpWrm.js","assets/palette-Xj4s0pmv.js","assets/panel-bottom-BzpRd9wr.js","assets/panel-left-DzXd97so.js","assets/panel-right-C3EFo10c.js","assets/paperclip-BCpF_jt0.js","assets/panels-top-left-C5lf6BGD.js","assets/pen-line-BeMREvYs.js","assets/pencil-ruler-CU_Sl28D.js","assets/pencil-CnxrJI7X.js","assets/picture-in-picture-2-g5nsWFVw.js","assets/pilcrow-DMiXqMTk.js","assets/pin-DfMqpQHz.js","assets/play-Bvcnzkvl.js","assets/plug-2-DkrvJqyh.js","assets/plus-Cr075-cy.js","assets/plug-Cdxb0djR.js","assets/power-BZu57mPF.js","assets/presentation-DvMc9hxG.js","assets/puzzle-Bv9mngwk.js","assets/qr-code-D3ZNC-wH.js","assets/quote-zNyOHYG3.js","assets/radio-tower-CT5Np78y.js","assets/redo-2-DRHZshO-.js","assets/refresh-cw-PY_ECjtI.js","assets/rotate-ccw-Dr4MwDMq.js","assets/rotate-cw-10CQA0Ej.js","assets/route-CQ6wZzks.js","assets/rows-3-Bhc8vjss.js","assets/scale-V7dmr96y.js","assets/search-Cr9eaeTj.js","assets/send-CMOvB09P.js","assets/server-Le_hLOlf.js","assets/settings-2-XzWAl_8P.js","assets/settings-CTjEqsg3.js","assets/shield-check-k2SY7zjx.js","assets/shield-question-mark-pgYZYoSI.js","assets/shield-veV1FXDO.js","assets/sliders-horizontal-lg5XUMZM.js","assets/smartphone-zkhAIn1Q.js","assets/smile-plus-20kjE9KX.js","assets/sparkles-cStmYKbH.js","assets/square-arrow-out-up-right-DRKYZdVU.js","assets/square-pen-DIW48FdK.js","assets/square-plus-CeFmBUPF.js","assets/square-split-horizontal-Ba4BZbro.js","assets/square-split-vertical-BqJX4cZa.js","assets/square-terminal-CB0QR1vW.js","assets/square-DVrCvZRU.js","assets/star-DJ6Ycqv6.js","assets/sun-C8irSiA-.js","assets/tag-DhRIoqTo.js","assets/target-DziMQLku.js","assets/terminal-6kKaKv-Q.js","assets/text-align-start-C-EHiBr4.js","assets/text-search-BsqmpFYh.js","assets/text-wrap-C8SwAUbc.js","assets/ticket-LnwYlhC1.js","assets/trash-2-CiyAV2xI.js","assets/trending-down-CZZKiTTZ.js","assets/trending-up-CyMfjRD-.js","assets/triangle-alert-BiHUyRl3.js","assets/type-ChjbxAhu.js","assets/undo-2-ZlIXiNdF.js","assets/unlink-2-DKAoaBiV.js","assets/unplug-Dg15iaHA.js","assets/upload-D9-Kv89Z.js","assets/user-check-BtCtF_-l.js","assets/user-lock-BWt0Um72.js","assets/user-plus-DbG1t95t.js","assets/user-round-x-D7izbSMH.js","assets/user-round-GtkOza8y.js","assets/users-LmqvhHnq.js","assets/wifi-off-DtJhRDhE.js","assets/workflow-Za5zYpKH.js","assets/wrench-CSZxFJCP.js","assets/x-CSwbgjBe.js","assets/zap-CrtYfJ8v.js","assets/runtime-B9IDNXDU.js","assets/runtime-B5cKWtKn.js","assets/toast-CN7Jd-pG.js","assets/TooltipViewport-kqulS2nz.js","assets/spinner-DHOdl-gn.js","assets/useParams-CoeDewwU.js","assets/tooltip-DaSC-3cL.js","assets/env-wK1YYxA8.js","assets/DiffFileTree-DkLJXYZf.js","assets/useSettings-CKA-LDDj.js","assets/environments-iW64jjyO.js","assets/server-CoH7V4JL.js","assets/session-Bo2ZSprC.js","assets/use-atom-command-GpCw1tWF.js","assets/themePalette-zFOiBKDi.js","assets/diffRendering-6DuM2rGF.js","assets/index-DmPPPGJb.js","assets/fileTreeExpansion-CA6c4E3-.js","assets/pierre-icons-fSsw9aa-.js","assets/query-B1uAr_ii.js","assets/DiffCommentAnnotation-Br9sOo_6.js","assets/Virtualizer-DjBOkz4F.js","assets/getDiffFileInput-CuM1lgsL.js","assets/main-lV-t-UZx.js","assets/vcsRefInvalidation-DfCz0cGO.js","assets/entities-DCbEYTvn.js","assets/number-field-DQIrEOoj.js","assets/useRegisterFieldControl-9rSmWR2W.js","assets/FormContext--axmNCbu.js","assets/CSPContext-D8znCJtI.js","assets/select-Dsx46akG.js","assets/SelectScrollUpArrow-Cr4PrE_F.js","assets/link-Bgj44djS.js","assets/redirect-D3L17tzd.js","assets/lazyRouteComponent-BCGAjyjO.js","assets/useNavigate-Dhy_1-Mg.js","assets/useLocation-Ccsih1eo.js","assets/rightPanelStore-DfMWWfvR.js","assets/toastHelpers-Dsph6LwL.js","assets/queries-DCKH7ltg.js","assets/session-logic-C4wGF3_E.js","assets/htmlRender-BaqdfJ6m.js","assets/mediaSource-CI2bKK3n.js","assets/fileLinks-5NSgRKPU.js","assets/mediaReference-CQtke4j3.js","assets/usageFormat-H-RgZ0fy.js","assets/timestampFormat-wac2e_Jz.js","assets/skeleton-0mC3wMw1.js","assets/useAriaLabelledBy-C8nSWyQ9.js","assets/toggle-DeCGfzT2.js","assets/toggle-group-DekLc0Ax.js","assets/CompositeRoot-fbPbFqqK.js","assets/command-DsE3Ju6m.js","assets/ComboboxClear-FsZ2LcVw.js","assets/input-83N8btBC.js","assets/Input-CVwvVqbx.js","assets/FieldControl-CVOjReHh.js","assets/scroll-area-DGS0jgnh.js","assets/ScrollAreaCorner-BYUnXNwJ.js","assets/DialogTitle-DnR18OB7.js","assets/dialog-DYFQxVoN.js","assets/dist-CkgAUeqn.js","assets/sidebar-C_I_pq_E.js","assets/useResizeDrag-KJl_F2EN.js","assets/CollapsiblePanel-84e9KCIs.js","assets/observeResize-BaPAtI3Q.js","assets/AnimatedHeight-CO3_zEQw.js","assets/assets-COg7jyyX.js","assets/sourceControl-D6TEHNpa.js","assets/openFileInPreview-CdBR5kuZ.js","assets/browserHistoryStore-_SurQa0e.js","assets/preview-ITad1JAy.js","assets/keybindings-DLDyoB30.js","assets/Icons-BYSK3arN.js","assets/preview-DwLWkMZG.js","assets/PierreEntryIcon-DKHnMJOl.js","assets/RenderErrorBoundary-BgOA8qma.js","assets/threadSort-Cn23YHH2.js","assets/browserLinkTarget-Bp-zUm0R.js","assets/pullRequestIcons-CSZus-cz.js","assets/pullRequests-7IQc0VIk.js","assets/popover-B1MF5i1c.js","assets/PopoverHandle-C-e81PS3.js","assets/ProjectFavicon-B5C6TpKj.js","assets/ProjectMonogram-CYD6eMbI.js","assets/projectFilesQueryState-CGllQp_V.js","assets/checkbox-brLYzznm.js","assets/CheckboxIndicator-D-KUEtIm.js","assets/FieldItemContext-Bn6xBVJg.js","assets/terminalSessions-B8EDcX8b.js","assets/AlertDialogRoot-D6ed6zQR.js","assets/guideRunStore-B3Y6e_nf.js","assets/pullRequestDetail.logic-CkxKh0fV.js","assets/pullRequestReviewStore-78f71w6J.js","assets/sortable.esm-DuAaqmgD.js","assets/p4ProjectFile--u7SOSK5.js","assets/sidebarProjectGrouping-DrnsFA8t.js","assets/useHandleNewThread-FJLPEfoH.js","assets/EnvironmentMachineIcon-BMWCDR69.js","assets/alert-DYmkyE3l.js","assets/semver-CFbvOQKc.js","assets/ChatGptUsageButton-Bda8Ir5S.js","assets/kbd-D8UfTN0o.js","assets/settingsLayout-CqGfrbmD.js","assets/WorkspacePageContainer-DwN_ETF0.js","assets/KeybindingsSettings.logic-30fwcukL.js","assets/usageShortcuts-C320W17X.js","assets/primaryCloudLinkState-BP-HZzf2.js","assets/ConnectionStatusDot-t_vHmaco.js","assets/standalone-page-Dx8vGwaJ.js","assets/primary-8A8hvHFL.js","assets/onboarding-ObMsA9VF.js","assets/scheduledTasksSettings.logic-DVbZRIYJ.js","assets/main-ChIB1-3M.css","assets/DiffWorkerPoolProvider-DydpPFgM.js","assets/textarea-BvPoR1cI.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./index-DmPPPGJb.js";import{r as n}from"./Icon-l19w4AjM.js";import{$f as r,$n as i,$u as a,A as o,Bf as s,Cf as c,Cm as l,Cs as u,D as d,Dd as f,Ef as p,Em as m,Ep as h,Es as g,F as _,Gd as v,Gn as y,Go as b,Gs as x,Gu as S,Hm as C,Hp as w,Jh as T,Jn as E,Js as D,Kd as O,Kn as k,Ks as A,Ku as j,Lm as M,NE as N,Pm as P,Pp as F,Qn as I,Rf as L,Ry as R,Sp as z,Ts as B,Ty as V,Um as H,Up as ee,Wn as te,Xd as ne,Yd as U,Yn as W,Yo as re,Yp as ie,Zd as ae,Zn as oe,__ as se,_d as ce,am as le,bp as ue,cr as de,gd as fe,gf as pe,hd as me,hm as he,im as ge,jp as _e,lE as ve,lm as ye,mf as be,nf as xe,nr as Se,or as Ce,qd as we,qn as Te,qu as Ee,rd as De,rm as Oe,sf as ke,sr as G,t as K,tp as Ae,tr as je,up as Me,va as Ne,vd as Pe,vm as Fe,w_ as Ie,wp as Le,xy as Re,yd as ze,yl as Be,yp as Ve,zd as He}from"./utils-BAPnqm16.js";import{W as Ue}from"./runtime-B9IDNXDU.js";import{C as We,O as Ge,k as Ke,w as qe}from"./entities-DCbEYTvn.js";import{$t as Je,cn as Ye,dn as Xe,in as Ze,ln as Qe,sn as $e}from"./runtime-B5cKWtKn.js";import{$ as et,B as tt,n as nt,z as rt}from"./ChatMarkdown-BS1t8pnS.js";import{a as it,o as at,s as ot,t as st}from"./select-Dsx46akG.js";import{t as ct}from"./spinner-DHOdl-gn.js";import{i as lt,m as ut,p as dt}from"./toast-CN7Jd-pG.js";import{H as ft,M as pt,U as mt,_ as ht,a as q,c as gt,h as _t,j as vt,n as J,r as yt,t as Y}from"./tooltip-DaSC-3cL.js";import{a as bt}from"./environments-iW64jjyO.js";import{s as xt}from"./server-CoH7V4JL.js";import{i as St,n as Ct}from"./session-Bo2ZSprC.js";import{n as wt}from"./query-B1uAr_ii.js";import{t as Tt}from"./use-atom-command-GpCw1tWF.js";import{l as Et,t as Dt}from"./rightPanelStore-DfMWWfvR.js";import{I as Ot,R as kt,f as At}from"./useSettings-CKA-LDDj.js";import{u as jt}from"./queries-DCKH7ltg.js";import{C as Mt,Q as Nt,Z as X,_ as Pt,at as Ft,c as It,d as Lt,ft as Rt,l as zt,lt as Bt,nt as Vt,ot as Ht,s as Ut,t as Wt,tt as Gt,u as Kt,v as qt,w as Jt}from"./diffRendering-6DuM2rGF.js";import{C as Yt,E as Xt,G as Zt,H as Qt,K as $t,U as en,V as tn,W as nn,d as rn,i as an,u as on}from"./Virtualizer-DjBOkz4F.js";import{l as sn,ut as cn}from"./getDiffFileInput-CuM1lgsL.js";import{i as ln,r as un,t as dn}from"./DiffWorkerPoolProvider-DydpPFgM.js";import{t as fn}from"./cloneFileDiffMetadata-zVRGqYgv.js";import{n as pn,r as mn,t as hn}from"./FileDiff-Dhyt7ZAJ.js";import{S as gn,a as _n,b as vn,i as yn,n as bn,r as xn,t as Sn}from"./DiffCommentAnnotation-Br9sOo_6.js";import{r as Cn}from"./mediaSource-CI2bKK3n.js";import{o as wn}from"./timestampFormat-wac2e_Jz.js";import{t as Tn}from"./env-wK1YYxA8.js";import{t as En}from"./skeleton-0mC3wMw1.js";import{t as Dn}from"./textarea-BvPoR1cI.js";import{t as On}from"./toggle-DeCGfzT2.js";import{n as kn,t as An}from"./toggle-group-DekLc0Ax.js";import{i as jn,l as Mn,o as Nn,r as Pn,s as Fn,t as In}from"./combobox-DSVavlIH.js";import{d as Ln,l as Rn,t as zn,u as Bn}from"./command-DsE3Ju6m.js";import{t as Vn}from"./input-83N8btBC.js";import{t as Hn}from"./scroll-area-DGS0jgnh.js";import{a as Un,c as Wn,i as Gn,o as Kn,r as qn,s as Jn,t as Yn}from"./dialog-DYFQxVoN.js";import{t as Xn}from"./useResizeDrag-KJl_F2EN.js";import{a as Zn,i as Qn,o as $n,r as er,t as tr}from"./empty-2jxBvPLn.js";import{i as nr}from"./device-CWgOLpbF.js";import{t as rr}from"./observeResize-BaPAtI3Q.js";import{o as ir,s as ar}from"./openFileInPreview-CdBR5kuZ.js";import{f as or}from"./browserHistoryStore-_SurQa0e.js";import{_ as sr,y as cr}from"./keybindings-DLDyoB30.js";import{i as lr,n as ur}from"./Icons-BYSK3arN.js";import{t as dr}from"./PierreEntryIcon-DKHnMJOl.js";import{F as fr,H as pr,U as mr,_ as hr,a as gr,b as _r,c as vr,d as yr,f as br,g as xr,h as Sr,i as Cr,m as wr,n as Tr,o as Er,p as Dr,r as Or,s as kr,u as Ar,v as jr,x as Mr,y as Nr}from"./RenderErrorBoundary-BgOA8qma.js";import{c as Pr,l as Fr}from"./threadSort-Cn23YHH2.js";import{n as Ir}from"./pullRequestIcons-CSZus-cz.js";import{D as Lr,a as Rr,c as zr,i as Br,k as Vr,n as Hr,r as Ur,u as Wr}from"./pullRequests-7IQc0VIk.js";import{a as Gr,i as Kr,n as qr,o as Jr,t as Yr}from"./popover-B1MF5i1c.js";import{A as Xr,B as Zr,C as Qr,D as $r,E as ei,H as ti,I as ni,K as ri,L as ii,M as ai,N as oi,O as si,P as ci,R as li,S as ui,T as di,U as fi,V as pi,X as mi,Y as hi,_ as gi,a as _i,b as vi,c as yi,d as bi,f as xi,g as Si,i as Ci,j as wi,k as Ti,l as Ei,o as Di,p as Oi,q as ki,r as Ai,s as ji,t as Mi,v as Ni,w as Pi,y as Fi,z as Ii}from"./pullRequestDetail.logic-CkxKh0fV.js";import{i as Li,n as Ri,r as zi,t as Bi}from"./pullRequestReviewStore-78f71w6J.js";import{t as Vi}from"./terminalLabels-BgLOlb2G.js";import{i as Hi,m as Ui,n as Wi,r as Gi,t as Ki}from"./guideRunStore-B3Y6e_nf.js";import{a as qi,b as Ji,h as Yi,l as Xi,m as Zi,p as Qi,r as $i,s as ea,t as ta,u as na}from"./sortable.esm-DuAaqmgD.js";import{n as ra}from"./useHandleNewThread-FJLPEfoH.js";import{n as ia}from"./EnvironmentMachineIcon-BMWCDR69.js";import{i as aa,n as oa,r as sa,t as ca}from"./alert-DYmkyE3l.js";import{t as la}from"./kbd-D8UfTN0o.js";import{Fa as ua,Ia as da,Jr as fa,Pa as pa,Ra as ma,ai as ha,cn as ga,fa as _a,oi as va,qa as ya,qr as ba,ua as xa}from"./main-lV-t-UZx.js";import"./WorkspacePageHeader-BvKCy7v2.js";import{r as Sa,s as Ca,t as wa}from"./usePullRequestActions-_K7fD4Ny.js";function Ta(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function Ea(e,t){return e==null||t==null?e===t:e.header!==t.header||e.footer!==t.footer?!1:Da(e.items,t.items)}function Da(e,t){if(e==null||t==null)return e===t;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r==null||i==null||r.id!==i.id||r.type!==i.type||r.element!==i.element||r.instance!==i.instance||r.version!==i.version)return!1}return!0}function Oa(e,t,n){let r=document.createElement(`div`);return r.style.display=`flow-root`,e===`header`?(r.setAttribute(Nt,``),t.before(r)):(r.setAttribute(X,``),t.after(r)),n?.observe(r),r}function ka(e){let t=window.devicePixelRatio??1;return Math.round(e*t)/t}var Aa=1e5,ja=`\`~!@#$%^&*()-=+[{]}\\|;:'",.<>/?`,Ma=`data-diffs-search`,Na=`:host {
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PullRequestCodeTab-Ba54Mifj.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/Icon-l19w4AjM.js","assets/utils-DqIvhFCT.js","assets/activity-C1Y3O_v1.js","assets/createLucideIcon-CacG5mZC.js","assets/alarm-clock-Pw90g7hE.js","assets/app-window-D2LBv8RE.js","assets/archive-0Qz6rgBl.js","assets/arrow-down-up-B46gw0xW.js","assets/arrow-down-DvRecXuy.js","assets/arrow-left-BLE461db.js","assets/arrow-right-left-BqjFeAD_.js","assets/arrow-right-CoV5ameY.js","assets/arrow-up-down-ibtVnemT.js","assets/arrow-up-left-BMvgV_8i.js","assets/arrow-up-right-C6IM-WPd.js","assets/arrow-up-3Yp3lsoe.js","assets/battery-Bjbw2yxu.js","assets/bell-CLuvLMth.js","assets/blocks-B-VfW07Q.js","assets/book-open-HEEW8eqT.js","assets/bookmark-HM-xwl47.js","assets/bot-DpQzHyXo.js","assets/box-CKWcQvdq.js","assets/bug-Dtc5BRVF.js","assets/calendar-arrow-down-CAFi0Chs.js","assets/calendar-arrow-up-Cs2MbLyZ.js","assets/calendar-clock-DTUOomkO.js","assets/calendar-c_JH_1V1.js","assets/camera-V1Ufc9sC.js","assets/chart-no-axes-column-DKbSsm0y.js","assets/check-Cmy7pM2Y.js","assets/chevron-down-DHV04o66.js","assets/chevron-left-DrNh6cTh.js","assets/chevron-right-NbahR9_s.js","assets/chevron-up-C-w52bD6.js","assets/chevrons-left-right-ellipsis-D2Qu5H2y.js","assets/chevrons-up-down-BMPucOK_.js","assets/chromium-BusoCgri.js","assets/circle-alert-B83jEPoh.js","assets/circle-arrow-up-kT0Pa2jA.js","assets/circle-check-Y1T60J9X.js","assets/circle-dashed-ChJzoouS.js","assets/circle-dot-DSAuCGJf.js","assets/circle-slash-Ceo-2WKq.js","assets/circle-x-C-GXnJRB.js","assets/circle-4zZlZno3.js","assets/clock-3-SBiWJYHb.js","assets/clock-bc9N_wA2.js","assets/cloud-download-BE7c7r3I.js","assets/cloud-upload-noux3Cbp.js","assets/cloud-DyVMWy7X.js","assets/code-xml-CbuCFrkh.js","assets/code-DuFehkNQ.js","assets/columns-2-D1kdFD9w.js","assets/copy-CoM62e83.js","assets/corner-left-up-BCqW4dF8.js","assets/corner-up-right--t3OPVhh.js","assets/cpu-mffhvvYB.js","assets/database-DipbOz0U.js","assets/download-BAp4p4A-.js","assets/earth-CTY23Bx1.js","assets/ellipsis-vertical-fYTS1grT.js","assets/ellipsis-6x3R4_IB.js","assets/external-link-NWS0I_zo.js","assets/eye-off-BJFC-Vn7.js","assets/eye-Dh5UEUs_.js","assets/file-braces-CcggTVd0.js","assets/file-code-corner-Dt6PpZnb.js","assets/file-diff-BE4sroJp.js","assets/file-search-DotMSEoS.js","assets/file-spreadsheet-Boc78Vjm.js","assets/file-text-xj3y_Xbg.js","assets/file-1cutE11R.js","assets/files-CQwG7JjF.js","assets/film-CYJIuMHb.js","assets/flask-conical-WkWFg73e.js","assets/folder-closed-zBKiY8_q.js","assets/folder-cog-BMK_9DOi.js","assets/folder-git-2-BxqGR5ht.js","assets/folder-git-CoMYGJp_.js","assets/folder-open-BqgCWh1y.js","assets/folder-plus-BHa3aD6W.js","assets/folder-tree-CIpeR87A.js","assets/folder-CMIvEUJv.js","assets/gauge-C_4eEUrj.js","assets/git-branch-plus-BQ_ISFgF.js","assets/git-branch-CAP5iwh8.js","assets/git-commit-horizontal-6IR7R88i.js","assets/git-fork-BEEZa2l_.js","assets/git-merge-C47N_dux.js","assets/git-pull-request-arrow-C9_ZycDh.js","assets/git-pull-request-closed-BkRFT_Rl.js","assets/git-pull-request-draft-BNpXqUsz.js","assets/globe-BygqUCSx.js","assets/grip-vertical-B8ERFH5y.js","assets/hammer-BRTj-Vot.js","assets/hard-drive-CVWUL95f.js","assets/history-B22_6xEN.js","assets/house-D_gjXlRt.js","assets/image-xUrgiZ2i.js","assets/inbox-48iST-IJ.js","assets/info-BHB-83EA.js","assets/keyboard-9HUE6Zs7.js","assets/laptop-05PEAB3d.js","assets/layers-BqgDAlx3.js","assets/lightbulb-CEqRo_1f.js","assets/link-2-B_p2EG7Q.js","assets/link-zAXVcUwk.js","assets/list-checks-CQu2FTgJ.js","assets/list-filter-BOx8tW9q.js","assets/list-ordered-f2n8ZhGo.js","assets/list-todo-D7F9k-PE.js","assets/list-BAEaXVbr.js","assets/loader-circle-B3Ce8JIQ.js","assets/lock-open-Bt3QlIE2.js","assets/lock-Cc3mNdEd.js","assets/log-in-BpPtfyCd.js","assets/mail-J8kfrAC7.js","assets/maximize-2-CHT2IkVy.js","assets/maximize-CoWtPryT.js","assets/memory-stick-C7kBEkBW.js","assets/message-circle-question-mark-Blboafqi.js","assets/message-circle-CwQpPAbq.js","assets/message-square-dashed-DrEYZ6F3.js","assets/message-square-off-BstjdZP9.js","assets/message-square-text-CJTpB0rs.js","assets/message-square-warning-I95tWaoN.js","assets/message-square-DLzUyuIE.js","assets/messages-square-BNeF2306.js","assets/minimize-2-DOhpJbnX.js","assets/minus-C7W28oE7.js","assets/monitor-Ddj8MK6z.js","assets/moon-B9ss2TfK.js","assets/mouse-pointer-2-DbBU41il.js","assets/mouse-pointer-click-DsDE4K7M.js","assets/octagon-alert-BKVCgU--.js","assets/package-plus-Cl7EzKuY.js","assets/package-CeeyHFJU.js","assets/paintbrush-D1BKpWrm.js","assets/palette-Xj4s0pmv.js","assets/panel-bottom-BzpRd9wr.js","assets/panel-left-DzXd97so.js","assets/panel-right-C3EFo10c.js","assets/paperclip-BCpF_jt0.js","assets/panels-top-left-C5lf6BGD.js","assets/pen-line-BeMREvYs.js","assets/pencil-ruler-CU_Sl28D.js","assets/pencil-CnxrJI7X.js","assets/picture-in-picture-2-g5nsWFVw.js","assets/pilcrow-DMiXqMTk.js","assets/pin-DfMqpQHz.js","assets/play-Bvcnzkvl.js","assets/plug-2-DkrvJqyh.js","assets/plus-Cr075-cy.js","assets/plug-Cdxb0djR.js","assets/power-BZu57mPF.js","assets/presentation-DvMc9hxG.js","assets/puzzle-Bv9mngwk.js","assets/qr-code-D3ZNC-wH.js","assets/quote-zNyOHYG3.js","assets/radio-tower-CT5Np78y.js","assets/redo-2-DRHZshO-.js","assets/refresh-cw-PY_ECjtI.js","assets/rotate-ccw-Dr4MwDMq.js","assets/rotate-cw-10CQA0Ej.js","assets/route-CQ6wZzks.js","assets/rows-3-Bhc8vjss.js","assets/scale-V7dmr96y.js","assets/search-Cr9eaeTj.js","assets/send-CMOvB09P.js","assets/server-Le_hLOlf.js","assets/settings-2-XzWAl_8P.js","assets/settings-CTjEqsg3.js","assets/shield-check-k2SY7zjx.js","assets/shield-question-mark-pgYZYoSI.js","assets/shield-veV1FXDO.js","assets/sliders-horizontal-lg5XUMZM.js","assets/smartphone-zkhAIn1Q.js","assets/smile-plus-20kjE9KX.js","assets/sparkles-cStmYKbH.js","assets/square-arrow-out-up-right-DRKYZdVU.js","assets/square-pen-DIW48FdK.js","assets/square-plus-CeFmBUPF.js","assets/square-split-horizontal-Ba4BZbro.js","assets/square-split-vertical-BqJX4cZa.js","assets/square-terminal-CB0QR1vW.js","assets/square-DVrCvZRU.js","assets/star-DJ6Ycqv6.js","assets/sun-C8irSiA-.js","assets/tag-DhRIoqTo.js","assets/target-DziMQLku.js","assets/terminal-6kKaKv-Q.js","assets/text-align-start-C-EHiBr4.js","assets/text-search-BsqmpFYh.js","assets/text-wrap-C8SwAUbc.js","assets/ticket-LnwYlhC1.js","assets/trash-2-CiyAV2xI.js","assets/trending-down-CZZKiTTZ.js","assets/trending-up-CyMfjRD-.js","assets/triangle-alert-BiHUyRl3.js","assets/type-ChjbxAhu.js","assets/undo-2-ZlIXiNdF.js","assets/unlink-2-DKAoaBiV.js","assets/unplug-Dg15iaHA.js","assets/upload-D9-Kv89Z.js","assets/user-check-BtCtF_-l.js","assets/user-lock-BWt0Um72.js","assets/user-plus-DbG1t95t.js","assets/user-round-x-D7izbSMH.js","assets/user-round-GtkOza8y.js","assets/users-LmqvhHnq.js","assets/wifi-off-DtJhRDhE.js","assets/workflow-Za5zYpKH.js","assets/wrench-CSZxFJCP.js","assets/x-CSwbgjBe.js","assets/zap-CrtYfJ8v.js","assets/runtime-CJNEsw6U.js","assets/runtime-ets76j-h.js","assets/TooltipViewport-WRCNCy-2.js","assets/toast-CwJ-bjHi.js","assets/spinner-cHzhZrgb.js","assets/useParams-DhNu716j.js","assets/DiffFileTree-Cm5AwI-L.js","assets/useSettings-D_OJJgNE.js","assets/server-DpLkyQ0R.js","assets/session-Cau_XThy.js","assets/use-atom-command-3Z4EZbCj.js","assets/themePalette-CONAHv4I.js","assets/diffRendering-Cuv7q0nc.js","assets/index-CW8ApI1G.js","assets/fileTreeExpansion-C1UNNqSC.js","assets/pierre-icons-BubjdUjD.js","assets/query-CRlRG7rf.js","assets/DiffCommentAnnotation-C4ODeTG1.js","assets/Virtualizer-D6VpBTPc.js","assets/getDiffFileInput-phPjSTY8.js","assets/main-DqlnVz2C.js","assets/vcsRefInvalidation-Dj5BpmJA.js","assets/entities-D6pHmUcl.js","assets/number-field-B0OyTTUs.js","assets/useRegisterFieldControl-BX1EsUxP.js","assets/FormContext-D3Ve_Lza.js","assets/CSPContext-CCVdxObl.js","assets/select-DqGlaY40.js","assets/SelectScrollUpArrow-DfDNBpqc.js","assets/link-wJO6kwX4.js","assets/redirect-D3L17tzd.js","assets/lazyRouteComponent-DebYKx4q.js","assets/useNavigate-BS8hIoQr.js","assets/useLocation-BTH6wjAt.js","assets/rightPanelStore-C3FvIXSq.js","assets/toastHelpers-Dsph6LwL.js","assets/queries-_Qf89qTX.js","assets/session-logic-CRwcdrNw.js","assets/htmlRender-DVq1i7PZ.js","assets/mediaSource-DTry5UU8.js","assets/fileLinks-DKkO_IJu.js","assets/mediaReference-DEdeypAC.js","assets/usageFormat-B23xwSbG.js","assets/timestampFormat-wac2e_Jz.js","assets/env-wK1YYxA8.js","assets/tooltip-CtZ6PJJw.js","assets/skeleton--M5AJWoC.js","assets/useAriaLabelledBy-CMSGO3cd.js","assets/toggle-FqX4CVcC.js","assets/toggle-group-JCVlIQ5i.js","assets/CompositeRoot-BaL7J4TF.js","assets/input-DpZhQSV2.js","assets/Input-DyKzFpW0.js","assets/FieldControl-CSR5qaN6.js","assets/scroll-area-By1ARHPp.js","assets/ScrollAreaCorner-B-Z3OJHa.js","assets/dist-CnDtgaa3.js","assets/DialogTitle-CJosg0_K.js","assets/dialog-C4UzQSL1.js","assets/sidebar-Dxq8kloB.js","assets/useResizeDrag-KJl_F2EN.js","assets/CollapsiblePanel-lE29H_pe.js","assets/observeResize-CBAzjAMz.js","assets/AnimatedHeight-Bt23tBJu.js","assets/assets-B5H7ruRK.js","assets/sourceControl-Cmvk57z0.js","assets/openFileInPreview-MgwNsNCM.js","assets/browserHistoryStore-o7hGV5zZ.js","assets/preview-CwzKOKVG.js","assets/keybindings-BD3cM3Jm.js","assets/Icons-Bfx5fXpN.js","assets/preview-BlW45a9H.js","assets/PierreEntryIcon-x_cG473l.js","assets/RenderErrorBoundary-DKs56Rs9.js","assets/sourceControlClients-C0IkCWsN.js","assets/browserLinkTarget-hn6UyJXl.js","assets/pullRequestIcons-DsTinQ4q.js","assets/pullRequests-CQ2Zte1o.js","assets/threadSort-Bd2rijEy.js","assets/popover-BuuvISBT.js","assets/PopoverHandle-CY2mrZwB.js","assets/ProjectFavicon-Bdl7Tzds.js","assets/ProjectMonogram-TlvVxVmS.js","assets/projectFilesQueryState-D2rMhOEA.js","assets/checkbox-tOWU_Z9Y.js","assets/CheckboxIndicator-wz_7NgXC.js","assets/FieldItemContext-Bn6xBVJg.js","assets/terminalSessions-BpuHxk1q.js","assets/AlertDialogRoot-D5I6scXr.js","assets/uiStateStore-CcTtH1Jz.js","assets/composer-logic-CkuMSzLW.js","assets/useHandleNewThread-B9RCcbnw.js","assets/p4ProjectFile-DZ6HGjaI.js","assets/composerDraftUploads-D0K1HfK_.js","assets/guideRunStore-C-LauQUS.js","assets/pullRequestDetail.logic-BhGUhCGd.js","assets/pullRequestReviewStore-BKYNixhZ.js","assets/sidebarProjectGrouping-BfZ705hQ.js","assets/EnvironmentMachineIcon-Cs4BoaOB.js","assets/alert-BXnCHOJp.js","assets/semver-CFbvOQKc.js","assets/ChatGptUsageButton-yYHsmy4T.js","assets/kbd-BfsP5lvQ.js","assets/settingsLayout-Du5mjDQU.js","assets/WorkspacePageContainer-D3M3Ncv4.js","assets/KeybindingsSettings.logic-0P2hWpBG.js","assets/usageShortcuts-BMHWlKT1.js","assets/primaryCloudLinkState-DYmepSfi.js","assets/command-DJR9ebnx.js","assets/ComboboxClear-DNFG72Hd.js","assets/ComboboxGroupLabel-B_bH_C6n.js","assets/ConnectionStatusDot-IvAZUpIh.js","assets/standalone-page-BaVFigS5.js","assets/primary-3GB-obcz.js","assets/onboarding-EecLmYJ0.js","assets/scheduledTasksSettings.logic-CGYf8FQi.js","assets/main-DklPMTd5.css","assets/DiffWorkerPoolProvider-CXn9pnyS.js","assets/textarea-XR9lgl40.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./index-CW8ApI1G.js";import{r as n}from"./Icon-l19w4AjM.js";import{$f as r,$n as i,$u as a,A as o,Bf as s,Cf as c,Cm as l,Cs as u,D as d,Dd as f,Ef as p,Em as m,Ep as h,Es as g,F as _,Gd as v,Gn as y,Go as b,Gs as x,Gu as S,Hm as C,Hp as w,Jh as T,Jn as E,Js as D,Kd as O,Kn as k,Ks as A,Ku as j,Lm as M,NE as N,Pm as P,Pp as F,Qn as I,Rf as L,Ry as R,Sp as z,Ts as B,Ty as V,Um as H,Up as ee,Wn as te,Xd as ne,Yd as U,Yn as W,Yo as re,Yp as ie,Zd as ae,Zn as oe,__ as se,_d as ce,am as le,bp as ue,cr as de,gd as fe,gf as pe,hd as me,hm as he,im as ge,jp as _e,lE as ve,lm as ye,mf as be,nf as xe,nr as Se,or as Ce,qd as we,qn as Te,qu as Ee,rd as De,rm as Oe,sf as ke,sr as G,t as K,tp as Ae,tr as je,up as Me,va as Ne,vd as Pe,vm as Fe,w_ as Ie,wp as Le,xy as Re,yd as ze,yl as Be,yp as Ve,zd as He}from"./utils-DqIvhFCT.js";import{W as Ue}from"./runtime-CJNEsw6U.js";import{C as We,O as Ge,k as Ke,w as qe}from"./entities-D6pHmUcl.js";import{$t as Je,cn as Ye,dn as Xe,in as Ze,ln as Qe,sn as $e}from"./runtime-ets76j-h.js";import{G as et,N as tt,P as nt,W as rt,_ as it,l as at,y as ot}from"./TooltipViewport-WRCNCy-2.js";import{$ as st,B as ct,n as lt,z as ut}from"./ChatMarkdown-B0DVA2sH.js";import{a as dt,o as ft,s as pt,t as mt}from"./select-DqGlaY40.js";import{t as ht}from"./spinner-cHzhZrgb.js";import{i as gt,m as _t,p as vt}from"./toast-CwJ-bjHi.js";import{E as yt,J as bt,K as xt,f as St}from"./useSettings-D_OJJgNE.js";import{s as Ct}from"./server-DpLkyQ0R.js";import{i as wt,n as Tt}from"./session-Cau_XThy.js";import{n as Et}from"./query-CRlRG7rf.js";import{t as Dt}from"./use-atom-command-3Z4EZbCj.js";import{l as Ot,t as kt}from"./rightPanelStore-C3FvIXSq.js";import{u as At}from"./queries-_Qf89qTX.js";import{C as jt,Q as Mt,Z as q,_ as Nt,at as Pt,c as Ft,d as It,ft as Lt,l as Rt,lt as zt,nt as Bt,ot as Vt,s as Ht,t as Ut,tt as Wt,u as Gt,v as Kt,w as qt}from"./diffRendering-Cuv7q0nc.js";import{C as Jt,E as Yt,G as Xt,H as Zt,K as Qt,U as $t,V as en,W as tn,d as nn,i as rn,u as an}from"./Virtualizer-D6VpBTPc.js";import{l as on,ut as sn}from"./getDiffFileInput-phPjSTY8.js";import{i as cn,r as ln,t as un}from"./DiffWorkerPoolProvider-CXn9pnyS.js";import{t as dn}from"./cloneFileDiffMetadata-zVRGqYgv.js";import{n as fn,r as pn,t as mn}from"./FileDiff-DfokdNMp.js";import{S as hn,a as gn,b as _n,i as vn,n as yn,r as bn,t as xn}from"./DiffCommentAnnotation-C4ODeTG1.js";import{r as Sn}from"./mediaSource-DTry5UU8.js";import{o as Cn}from"./timestampFormat-wac2e_Jz.js";import{t as wn}from"./env-wK1YYxA8.js";import{a as J,n as Y,r as Tn,t as X}from"./tooltip-CtZ6PJJw.js";import{t as En}from"./skeleton--M5AJWoC.js";import{t as Dn}from"./textarea-XR9lgl40.js";import{t as On}from"./toggle-FqX4CVcC.js";import{n as kn,t as An}from"./toggle-group-JCVlIQ5i.js";import{i as jn,l as Mn,o as Nn,r as Pn,s as Fn,t as In}from"./combobox-NsYaIiJL.js";import{t as Ln}from"./input-DpZhQSV2.js";import{t as Rn}from"./scroll-area-By1ARHPp.js";import{a as zn,c as Bn,i as Vn,o as Hn,r as Un,s as Wn,t as Gn}from"./dialog-C4UzQSL1.js";import{t as Kn}from"./useResizeDrag-KJl_F2EN.js";import{a as qn,i as Jn,o as Yn,r as Xn,t as Zn}from"./empty-GrsNgo1m.js";import{i as Qn}from"./device-V5bbUMMx.js";import{t as $n}from"./observeResize-CBAzjAMz.js";import{o as er,s as tr}from"./openFileInPreview-MgwNsNCM.js";import{f as nr}from"./browserHistoryStore-o7hGV5zZ.js";import{_ as rr,y as ir}from"./keybindings-BD3cM3Jm.js";import{i as ar,n as or}from"./Icons-Bfx5fXpN.js";import{t as sr}from"./PierreEntryIcon-x_cG473l.js";import{F as cr,H as lr,U as ur,_ as dr,a as fr,b as pr,c as mr,d as hr,f as gr,g as _r,h as vr,i as yr,m as br,n as xr,o as Sr,p as Cr,r as wr,s as Tr,u as Er,v as Dr,x as Or,y as kr}from"./RenderErrorBoundary-DKs56Rs9.js";import{n as Ar,r as jr}from"./sourceControlClients-C0IkCWsN.js";import{n as Mr}from"./pullRequestIcons-DsTinQ4q.js";import{D as Nr,a as Pr,c as Fr,i as Ir,k as Lr,n as Rr,r as zr,u as Br}from"./pullRequests-CQ2Zte1o.js";import{a as Vr,i as Hr,n as Ur,o as Wr,t as Gr}from"./popover-BuuvISBT.js";import{A as Kr,B as qr,C as Jr,D as Yr,E as Xr,H as Zr,I as Qr,K as $r,L as ei,M as ti,N as ni,O as ri,P as ii,R as ai,S as oi,T as si,U as ci,V as li,X as ui,Y as di,_ as fi,a as pi,b as mi,c as hi,d as gi,f as _i,g as vi,i as yi,j as bi,k as xi,l as Si,o as Ci,p as wi,q as Ti,r as Ei,s as Di,t as Oi,v as ki,w as Ai,y as ji,z as Mi}from"./pullRequestDetail.logic-BhGUhCGd.js";import{i as Ni,n as Pi,r as Fi,t as Ii}from"./pullRequestReviewStore-BKYNixhZ.js";import{t as Li}from"./terminalLabels-BgLOlb2G.js";import{_ as Ri,c as zi,f as Bi,g as Vi,i as Hi,o as Ui,p as Wi,r as Gi,u as Ki,v as qi}from"./uiStateStore-CcTtH1Jz.js";import{n as Ji}from"./useHandleNewThread-B9RCcbnw.js";import{i as Yi,m as Xi,n as Zi,r as Qi,t as $i}from"./guideRunStore-C-LauQUS.js";import{n as ea}from"./EnvironmentMachineIcon-Cs4BoaOB.js";import{i as ta,n as na,r as ra,t as ia}from"./alert-BXnCHOJp.js";import{t as aa}from"./kbd-BfsP5lvQ.js";import{d as oa,l as sa,t as ca,u as la}from"./command-DJR9ebnx.js";import{$i as ua,Gr as da,Jt as fa,Kr as pa,Nr as ma,Pr as ha,ea as ga,fa as _a,ji as va,ki as ya,ra as ba,ta as xa}from"./main-DqlnVz2C.js";import"./WorkspacePageHeader-xuSJTTO0.js";import{r as Sa,s as Ca,t as wa}from"./usePullRequestActions-3vXHUgiG.js";function Ta(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function Ea(e,t){return e==null||t==null?e===t:e.header!==t.header||e.footer!==t.footer?!1:Da(e.items,t.items)}function Da(e,t){if(e==null||t==null)return e===t;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r==null||i==null||r.id!==i.id||r.type!==i.type||r.element!==i.element||r.instance!==i.instance||r.version!==i.version)return!1}return!0}function Oa(e,t,n){let r=document.createElement(`div`);return r.style.display=`flow-root`,e===`header`?(r.setAttribute(Mt,``),t.before(r)):(r.setAttribute(q,``),t.after(r)),n?.observe(r),r}function ka(e){let t=window.devicePixelRatio??1;return Math.round(e*t)/t}var Aa=1e5,ja=`\`~!@#$%^&*()-=+[{]}\\|;:'",.<>/?`,Ma=`data-diffs-search`,Na=`:host {
3
3
  display: block;
4
4
  position: sticky;
5
5
  z-index: 100;
@@ -17,11 +17,11 @@ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./index-DmPPPGJ
17
17
  --diffs-fg: var(--diffs-search-panel-fg, CanvasText);
18
18
  --diffs-modified-base: var(--diffs-search-panel-accent, light-dark(#009fff, #69b1ff));
19
19
  --diffs-header-font-fallback: var(--diffs-search-panel-font, system-ui, sans-serif);
20
- }`,Pa,Fa=class{#e;#t;#n;#r=[];#i=new Map;#a;#o;#s=[];#c=[];constructor(e){this.#e=e}get isOpen(){return this.#t!=null}open(){if(this.#n!=null){this.#n.setMode(`find`);return}let e=this.#e.getContainerElement();if(e==null)return;let t=document.createElement(`div`);t.setAttribute(Ma,``),t.style.top=`${this.#e.getStickyHeaderOffset()}px`;let n=t.attachShadow({mode:`open`}),r=document.createElement(`style`);r.textContent=`${xn}\n${Na}`;let i=document.createElement(`div`);i.innerHTML=_n;let a=document.createElement(`div`);n.append(r,...i.children,a),e.prepend(t),this.#t=t;let o=Ka(),s=()=>this.#n===l,c=o===``,l=new yn({textDocument:{search:e=>s()?this.#u(e):[]},containerElement:a,defaultQuery:o,mode:`find`,allowReplace:!1,initialMatch:o===``?void 0:[0,0],scrollToMatch:([e])=>{s()&&this.#f(e)},applyReplace:()=>{},onUpdate:(e,t)=>{if(!s())return;if(e.length===0){(!c||this.#r.length===0)&&this.#d([]);return}if(t?.syncSelection===!1)return this.#p(),this.#a==null?void 0:e[this.#a];let n=e[this.#a??this.#e.getFirstVisibleSearchMatchIndex(this.#r)];return n!=null&&this.#f(n[0]),n},onClose:()=>this.#l(!0)});this.#n=l,c&&requestAnimationFrame(()=>{c=!1}),l.focus()}close(){this.#n?.close()}refresh(e=!1){if(this.#n!=null){if(!e&&La(this.#c,this.#e.getSearchItems())){this.#p();return}this.#n.updateMatches({syncSelection:!1})}}repaint(){this.#r.length>0&&this.#p()}ownsEvent(e){return e.composedPath().some(e=>e instanceof Element&&e.hasAttribute(Ma))}handleKeyDown=e=>{if(e.isComposing||e.keyCode===229)return;if(this.ownsEvent(e)&&Ga(e)){e.key===`Escape`&&e.stopPropagation();return}if(e.defaultPrevented)return;if(gn(e)&&!e.altKey&&!e.shiftKey&&(e.key.toLowerCase()===`f`||e.code===`KeyF`)){e.preventDefault(),this.open();return}if(this.#n==null)return;let t=vn(e);t==null?e.key===`Escape`&&!Ga(e)&&(e.preventDefault(),e.stopPropagation(),this.close()):(e.preventDefault(),this.#n.navigate(t===`previous`))};cleanUp(){this.#l(!1)}#l(e){this.#t!=null&&(this.#n?.cleanup(),this.#n=void 0,this.#t.remove(),this.#t=void 0,this.#c=[],this.#d([]),e&&this.#e.getContainerElement()?.focus({preventScroll:!0}))}#u(e){let t=this.#a==null?void 0:this.#r[this.#a],n=this.#e.getSearchItems();return this.#c=n.map(e=>[e.id,e.fileDiff]),this.#d(Ia(n,e),t),this.#r.map(e=>e.range)}#d(e,t){this.#r=e,this.#i=Ra(e),this.#a=t==null?void 0:za(e,t),e.length===0&&(this.#e.cancelSearchReveal(),this.#p())}#f(e){let t=this.#r.findIndex(t=>t.range[0]===e);t!==-1&&(this.#a=t,this.#o=this.#r[t],this.#e.revealSearchMatch(this.#r[t]),this.#p())}#p(){let e=qa();if(e==null)return;for(let t of this.#s)e.match.delete(t),e.focus.delete(t);this.#s=[];let t=this.#a==null?void 0:this.#r[this.#a],n;for(let{entry:r,element:i}of this.#e.getMountedSearchMatches(this.#i)){let a=Ba(i,r.start,r.end);a!=null&&((r===t?e.focus:e.match).add(a),this.#s.push(a),r===t&&(n??=i))}t!=null&&n!=null&&this.#o===t&&(this.#o=void 0,this.#e.revealSearchMatchHorizontally(t,n))}};function Ia(e,t){if(t.text===``||t.text.includes(`
21
- `))return[];let n;try{n=new RegExp(t.regex?t.text:Wa(t.text),t.caseSensitive?`g`:`gi`)}catch{return[]}let r=[],i=0;for(let a=0;a<e.length&&r.length<Aa;a++){let o=e[a];if(o.type!==`diff`)continue;let{fileDiff:s}=o;sn({diff:s,diffStyle:`unified`,expandedHunks:!0,callback:({type:e,deletionLine:c,additionLine:l})=>{let u=e===`change`&&c!=null,d=u?c:l,f=Va((u?s.deletionLines:s.additionLines)[d.lineIndex]??``);n.lastIndex=0;let p;for(;(p=n.exec(f))!==null;){let s=p[0].length;if(s===0){n.lastIndex++;continue}if((!t.wholeWord||Ha(f,p.index,s))&&(r.push({id:o.id,itemIndex:a,side:u?`deletions`:`additions`,isContext:e!==`change`,lineNumber:d.lineNumber,unifiedLineIndex:d.unifiedLineIndex,start:p.index,end:p.index+s,range:[i+p.index,i+p.index+s]}),r.length>=Aa))return!0}i+=f.length+1}})}return r}function La(e,t){return e.length===t.length&&t.every((t,n)=>t.id===e[n][0]&&t.fileDiff===e[n][1])}function Ra(e){let t=new Map;for(let n of e){let e=t.get(n.itemIndex);e??t.set(n.itemIndex,e=[]),e.push(n)}return t}function za(e,t){let n=e.findIndex(e=>e.id===t.id&&e.side===t.side&&e.lineNumber===t.lineNumber&&e.start===t.start);return n===-1?void 0:n}function Ba(e,t,n){let r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),i=0,a,o=0,s;for(;(s=r.nextNode())!=null;){let e=s.data.length;if(a==null&&t<i+e&&(a=s,o=t-i),a!=null&&n<=i+e){let e=document.createRange();return e.setStart(a,o),e.setEnd(s,n-i),e}i+=e}}function Va(e){return e.endsWith(`\r
20
+ }`,Pa,Fa=class{#e;#t;#n;#r=[];#i=new Map;#a;#o;#s=[];#c=[];constructor(e){this.#e=e}get isOpen(){return this.#t!=null}open(){if(this.#n!=null){this.#n.setMode(`find`);return}let e=this.#e.getContainerElement();if(e==null)return;let t=document.createElement(`div`);t.setAttribute(Ma,``),t.style.top=`${this.#e.getStickyHeaderOffset()}px`;let n=t.attachShadow({mode:`open`}),r=document.createElement(`style`);r.textContent=`${bn}\n${Na}`;let i=document.createElement(`div`);i.innerHTML=gn;let a=document.createElement(`div`);n.append(r,...i.children,a),e.prepend(t),this.#t=t;let o=Ka(),s=()=>this.#n===l,c=o===``,l=new vn({textDocument:{search:e=>s()?this.#u(e):[]},containerElement:a,defaultQuery:o,mode:`find`,allowReplace:!1,initialMatch:o===``?void 0:[0,0],scrollToMatch:([e])=>{s()&&this.#f(e)},applyReplace:()=>{},onUpdate:(e,t)=>{if(!s())return;if(e.length===0){(!c||this.#r.length===0)&&this.#d([]);return}if(t?.syncSelection===!1)return this.#p(),this.#a==null?void 0:e[this.#a];let n=e[this.#a??this.#e.getFirstVisibleSearchMatchIndex(this.#r)];return n!=null&&this.#f(n[0]),n},onClose:()=>this.#l(!0)});this.#n=l,c&&requestAnimationFrame(()=>{c=!1}),l.focus()}close(){this.#n?.close()}refresh(e=!1){if(this.#n!=null){if(!e&&La(this.#c,this.#e.getSearchItems())){this.#p();return}this.#n.updateMatches({syncSelection:!1})}}repaint(){this.#r.length>0&&this.#p()}ownsEvent(e){return e.composedPath().some(e=>e instanceof Element&&e.hasAttribute(Ma))}handleKeyDown=e=>{if(e.isComposing||e.keyCode===229)return;if(this.ownsEvent(e)&&Ga(e)){e.key===`Escape`&&e.stopPropagation();return}if(e.defaultPrevented)return;if(hn(e)&&!e.altKey&&!e.shiftKey&&(e.key.toLowerCase()===`f`||e.code===`KeyF`)){e.preventDefault(),this.open();return}if(this.#n==null)return;let t=_n(e);t==null?e.key===`Escape`&&!Ga(e)&&(e.preventDefault(),e.stopPropagation(),this.close()):(e.preventDefault(),this.#n.navigate(t===`previous`))};cleanUp(){this.#l(!1)}#l(e){this.#t!=null&&(this.#n?.cleanup(),this.#n=void 0,this.#t.remove(),this.#t=void 0,this.#c=[],this.#d([]),e&&this.#e.getContainerElement()?.focus({preventScroll:!0}))}#u(e){let t=this.#a==null?void 0:this.#r[this.#a],n=this.#e.getSearchItems();return this.#c=n.map(e=>[e.id,e.fileDiff]),this.#d(Ia(n,e),t),this.#r.map(e=>e.range)}#d(e,t){this.#r=e,this.#i=Ra(e),this.#a=t==null?void 0:za(e,t),e.length===0&&(this.#e.cancelSearchReveal(),this.#p())}#f(e){let t=this.#r.findIndex(t=>t.range[0]===e);t!==-1&&(this.#a=t,this.#o=this.#r[t],this.#e.revealSearchMatch(this.#r[t]),this.#p())}#p(){let e=qa();if(e==null)return;for(let t of this.#s)e.match.delete(t),e.focus.delete(t);this.#s=[];let t=this.#a==null?void 0:this.#r[this.#a],n;for(let{entry:r,element:i}of this.#e.getMountedSearchMatches(this.#i)){let a=Ba(i,r.start,r.end);a!=null&&((r===t?e.focus:e.match).add(a),this.#s.push(a),r===t&&(n??=i))}t!=null&&n!=null&&this.#o===t&&(this.#o=void 0,this.#e.revealSearchMatchHorizontally(t,n))}};function Ia(e,t){if(t.text===``||t.text.includes(`
21
+ `))return[];let n;try{n=new RegExp(t.regex?t.text:Wa(t.text),t.caseSensitive?`g`:`gi`)}catch{return[]}let r=[],i=0;for(let a=0;a<e.length&&r.length<Aa;a++){let o=e[a];if(o.type!==`diff`)continue;let{fileDiff:s}=o;on({diff:s,diffStyle:`unified`,expandedHunks:!0,callback:({type:e,deletionLine:c,additionLine:l})=>{let u=e===`change`&&c!=null,d=u?c:l,f=Va((u?s.deletionLines:s.additionLines)[d.lineIndex]??``);n.lastIndex=0;let p;for(;(p=n.exec(f))!==null;){let s=p[0].length;if(s===0){n.lastIndex++;continue}if((!t.wholeWord||Ha(f,p.index,s))&&(r.push({id:o.id,itemIndex:a,side:u?`deletions`:`additions`,isContext:e!==`change`,lineNumber:d.lineNumber,unifiedLineIndex:d.unifiedLineIndex,start:p.index,end:p.index+s,range:[i+p.index,i+p.index+s]}),r.length>=Aa))return!0}i+=f.length+1}})}return r}function La(e,t){return e.length===t.length&&t.every((t,n)=>t.id===e[n][0]&&t.fileDiff===e[n][1])}function Ra(e){let t=new Map;for(let n of e){let e=t.get(n.itemIndex);e??t.set(n.itemIndex,e=[]),e.push(n)}return t}function za(e,t){let n=e.findIndex(e=>e.id===t.id&&e.side===t.side&&e.lineNumber===t.lineNumber&&e.start===t.start);return n===-1?void 0:n}function Ba(e,t,n){let r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),i=0,a,o=0,s;for(;(s=r.nextNode())!=null;){let e=s.data.length;if(a==null&&t<i+e&&(a=s,o=t-i),a!=null&&n<=i+e){let e=document.createRange();return e.setStart(a,o),e.setEnd(s,n-i),e}i+=e}}function Va(e){return e.endsWith(`\r
22
22
  `)?e.slice(0,-2):e.endsWith(`
23
23
  `)||e.endsWith(`\r`)?e.slice(0,-1):e}function Ha(e,t,n){return Ua(e,t-1)&&Ua(e,t+n)}function Ua(e,t){if(t<0||t>=e.length)return!0;let n=e.charCodeAt(t);return n<=32||n===127||ja.includes(e[t])}function Wa(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Ga(e){let t=e.composedPath()[0];return t instanceof HTMLElement&&(t.isContentEditable||t.matches(`input, textarea, select`))}function Ka(){let e=document.getSelection()?.toString()??``;return e.includes(`
24
- `)?``:e}function qa(){if(Pa!=null)return Pa;if(typeof CSS<`u`&&`highlights`in CSS&&typeof Highlight<`u`)return Pa={match:new Highlight,focus:new Highlight},CSS.highlights.set(`diffs-search-match`,Pa.match),CSS.highlights.set(`diffs-search-focus`,Pa.focus),Pa}var Ja=`theme.disableLineNumbers.overflow.themeType.disableFileHeader.disableVirtualizationBuffers.preferredHighlighter.useCSSClasses.useTokenTransformer.tokenizeMaxLineLength.tokenizeMaxLength.unsafeCSS.diffStyle.diffIndicators.disableBackground.expandUnchanged.loadDiffFiles.parseDiffOptions.collapsedContextThreshold.lineDiffType.maxLineDiffLength.expansionLineCount.lineHoverHighlight.enableTokenInteractionsOnWhitespace.enableGutterUtility.__debugPointerEvents.enableLineSelection.controlledSelection.disableErrorHandling`.split(`.`),Ya=[`theme`,`disableLineNumbers`,`overflow`,`themeType`,`disableFileHeader`,`disableVirtualizationBuffers`,`preferredHighlighter`,`useCSSClasses`,`useTokenTransformer`,`tokenizeMaxLineLength`,`tokenizeMaxLength`,`unsafeCSS`,`lineHoverHighlight`,`enableTokenInteractionsOnWhitespace`,`enableGutterUtility`,`__debugPointerEvents`,`enableLineSelection`,`controlledSelection`,`disableErrorHandling`],Xa=[`renderCustomHeader`,`renderHeaderPrefix`,`renderHeaderFilenameSuffix`,`renderHeaderMetadata`,`renderAnnotation`,`renderGutterUtility`,`onPostRender`,`onGutterUtilityClick`,`onLineClick`,`onLineNumberClick`,`onLineEnter`,`onLineLeave`,`onTokenClick`,`onTokenEnter`,`onTokenLeave`],Za=[`onLineSelected`,`onLineSelectionStart`,`onLineSelectionChange`,`onLineSelectionEnd`],Qa=Symbol(`CodeView.itemOptionsState`);function $a(e,t){Object.defineProperty(e,Qa,{configurable:!1,enumerable:!1,value:t})}function eo(e){return e[Qa]}function to(e,t,n){Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get(){return n(this)}})}var no=120,ro=1,io=48,ao=`--diffs-overflow-override`;function oo(e,t,n){return{containerHeight:e,triggerTop:t,targetTop:n,targetBottom:e-n,threshold:e-t}}var so=oo(12e6,1e6,2e6),co=oo(2**22,5e5,1e6);function lo(e){if(e==null)throw Error(`CodeView: createEditor is required for items with edit: true`)}var uo=(()=>{let{navigator:e}=globalThis,t=e.userAgent,n=/iP(?:hone|ad|od)/.test(t),r=e.platform===`MacIntel`&&e.maxTouchPoints>1;return(n||r)&&/AppleWebKit/.test(t)&&/Safari/.test(t)&&!/(CriOS|FxiOS|EdgiOS|OPiOS)/.test(t)})(),fo=class e{static __STOP=!1;static __lastScrollPosition=0;type=`advanced`;config={overscrollSize:200,intersectionObserverMargin:0,resizeDebugging:!1};items=[];idToItem=new Map;selectedLines=null;itemEditors=new Map;attachedEditors=new Set;instanceToItem=new Map;layoutDirtyIndex;pendingLayoutReset;renderOptionsRevision=0;slotCoordinator;slotSnapshot;scrollListeners=new Set;scrollHeight=0;containerHeight=-1;scrollTop=0;scrollPageOffset=0;scrollRebaseConfig=Yt()?co:so;scrollDirty=!0;scrollInteractionFixTimer;pointerEventsDisabled=!1;codeOverflowFix=!1;height=0;heightDirty=!0;windowSpecs={top:0,bottom:0};renderState={scrollTop:-1,firstIndex:-1,lastIndex:-1,stickyHeight:0,stickyTop:-1,stickyBottom:-1};itemMetricsCache=Gt;fileOptionsPrototype;diffOptionsPrototype;pendingScrollTarget;pendingLayoutAnchor;shouldFixContainerFocus=!1;scrollAnimation;root;resizeObserver;container=document.createElement(`div`);stickyContainer=document.createElement(`div`);stickyOffset=document.createElement(`div`);header={element:void 0,render:void 0,height:0};footer={element:void 0,render:void 0,height:0};elementPool=[];elementPoolVersion=0;elementPoolTracker=new WeakMap;pendingElementPool=[];options;workerManager;isReadySubscription;pendingHighlighterTheme;isContainerManaged;search=new Fa(this);pendingSearchReveal;constructor(e={theme:Ht},t,n=!1){this.options=e,this.computeMetricsCache(e.itemMetrics),this.fileOptionsPrototype=this.createFileOptionsPrototype(),this.diffOptionsPrototype=this.createDiffOptionsPrototype(),this.workerManager=t,this.isContainerManaged=n,this.stickyOffset.style.contain=`layout size`,this.stickyContainer.style.position=`sticky`,this.stickyContainer.style.width=`100%`,this.stickyContainer.style.contain=`layout style inline-size`,this.stickyContainer.style.isolation=`isolate`,this.stickyContainer.style.display=`flex`,this.stickyContainer.style.flexDirection=`column`}getLayout(){return this.options.layout??Vt}getItemTopOffset(){return this.getLayout().paddingTop+this.header.height}computeMetricsCache(e){return this.itemMetricsCache={hunkLineCount:e?.hunkLineCount??Gt.hunkLineCount,lineHeight:e?.lineHeight??Gt.lineHeight,diffHeaderHeight:e?.diffHeaderHeight??Gt.diffHeaderHeight,hunkSeparatorHeight:e?.hunkSeparatorHeight,spacing:e?.spacing??Gt.spacing,paddingTop:e?.paddingTop,paddingBottom:e?.paddingBottom},this.itemMetricsCache}getSmoothScrollSettings(){return this.options.smoothScrollSettings??Ft}shouldDisablePointerEvents(){return this.options.pointerEventsOnScroll!==!0}shouldValidateItemHeights(){return Bt&&this.options.__devOnlyValidateItemHeights===!0}validateRenderedItemHeight(e){if(!this.shouldValidateItemHeights()||e.element==null)return;let t=e.instance.getAdvancedStickySpecs();if(t==null)return;let n=t.height,r=e.element.getBoundingClientRect().height;n!==r&&console.error(`CodeView: reconciled item height does not match DOM height`,{id:e.item.id,type:e.type,index:e.index,version:e.version,expectedHeight:n,actualHeight:r,delta:r-n,stickyTopOffset:t.topOffset,virtualizedHeight:e.instance.getVirtualizedHeight(),top:e.top,scrollTop:this.getScrollTop(),windowSpecs:{...this.windowSpecs},element:e.element,instance:e.instance})}validateStickyContainerHeight(){if(!this.shouldValidateItemHeights())return;let{firstIndex:e,lastIndex:t,stickyHeight:n,stickyTop:r,stickyBottom:i}=this.renderState;if(e===-1||t===-1)return;let a=this.stickyContainer.getBoundingClientRect().height;Math.abs(a-n)<ro||console.error(`CodeView: sticky container height does not match computed layout`,{computedStickyHeight:n,actualStickyHeight:a,delta:a-n,stickyTop:r,stickyBottom:i,firstIndex:e,lastIndex:t,firstStickySpecs:this.items[e]?.instance.getAdvancedStickySpecs(),lastStickySpecs:this.items[t]?.instance.getAdvancedStickySpecs(),scrollTop:this.getScrollTop(),scrollPageOffset:this.scrollPageOffset,windowSpecs:{...this.windowSpecs},stickyContainer:this.stickyContainer})}clearScrollInteractionTimer(){this.scrollInteractionFixTimer!=null&&(clearTimeout(this.scrollInteractionFixTimer),this.scrollInteractionFixTimer=void 0)}suspendScrollInteractions(){this.clearScrollInteractionTimer(),this.shouldDisablePointerEvents()&&!this.pointerEventsDisabled&&(this.stickyContainer.style.pointerEvents=`none`,this.pointerEventsDisabled=!0),uo&&!this.codeOverflowFix&&(this.stickyContainer.style.setProperty(ao,`hidden`),this.codeOverflowFix=!0),this.scrollInteractionFixTimer=setTimeout(this.restoreScrollInteractions,no)}restoreScrollInteractions=()=>{this.clearScrollInteractionTimer(),this.pointerEventsDisabled&&=(this.stickyContainer.style.removeProperty(`pointer-events`),!1),this.codeOverflowFix&&=(this.stickyContainer.style.setProperty(ao,`auto`),!1)};syncLayout(){let{gap:e,paddingBottom:t,paddingTop:n}=this.getLayout();this.stickyContainer.style.gap=`${e}px`,this.container?.style.setProperty(`margin-top`,`${n}px`),this.container?.style.setProperty(`margin-bottom`,`${t}px`)}reconcileHeaderFooterHosts(){let e=this.reconcileHost(`header`),t=this.reconcileHost(`footer`);return e||t}reconcileHost(e){let{root:t,container:n}=this;if(t==null||n==null)return!1;let r=e===`header`?this.header:this.footer,i=e===`header`?this.options.renderCodeViewHeader:this.options.renderCodeViewFooter;if(i==null)return r.element!=null&&(this.resizeObserver?.unobserve(r.element),r.element.remove(),r.element=void 0,r.render=void 0,this.setHostHeight(r,0),!1);if(r.element!=null&&i===r.render)return!1;let a=r.element??Oa(e,n,this.resizeObserver);r.element=a;let o=i();return o==null?!this.isContainerManaged&&a.children.length>0&&(a.textContent=``):a.replaceChildren(o),r.render=i,!0}setHostHeight(e,t){e.height!==t&&(e.height=t,this.scrollDirty=!0)}measureMountedHosts(){this.header.element!=null&&this.setHostHeight(this.header,this.header.element.getBoundingClientRect().height),this.footer.element!=null&&this.setHostHeight(this.footer,this.footer.element.getBoundingClientRect().height)}setup(t){if(this.root!=null)throw Error(`CodeView.setup: already setup`);this.workerManager?.subscribeToThemeChanges(this),this.root=t,this.root.style.overflowAnchor=`none`,this.root.hasAttribute(`tabindex`)||(this.root.tabIndex=-1),this.container??=document.createElement(`div`),this.container.style.contain=`layout style`,this.syncLayout(),this.container.appendChild(this.stickyOffset),this.container.appendChild(this.stickyContainer),this.root.appendChild(this.container),this.scrollDirty=!0,this.heightDirty=!0,this.resizeObserver=new ResizeObserver(this.handleResize),this.resizeObserver.observe(this.stickyContainer),this.root.addEventListener(`scroll`,this.handleScroll,{passive:!0}),this.root.addEventListener(`wheel`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`touchstart`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`pointerdown`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`keydown`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`keydown`,this.search.handleKeyDown),this.resizeObserver.observe(this.root),this.render(!0),window.__INSTANCE=this,window.__TOGGLE=()=>{e.__STOP?(e.__STOP=!1,this.scrollTo({type:`position`,position:e.__lastScrollPosition,behavior:`instant`})):(e.__lastScrollPosition=this.getScrollTop(),e.__STOP=!0)}}reset(){Zt(this.computeRenderRangeAndEmit),this.clearReadySubscription(),this.restoreScrollInteractions(),this.cleanAllRenderedItems();let{items:e}=this,t=[...this.itemEditors.values()].map(e=>{let t=this.idToItem.get(e.state.id);return t!=null&&(e.state.removedItem=t.item),e});this.itemEditors.clear(),this.attachedEditors.clear(),this.selectedLines=null,this.items=[],this.idToItem.clear(),this.instanceToItem.clear();let n=!1,r;for(let e of t)try{e.editor.cleanUp(`discard`)}catch(e){n||(n=!0,r=e)}for(let t of e)try{t.instance.cleanUp()}catch(e){n||(n=!0,r=e)}if(this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,this.stickyContainer.textContent=``,this.stickyOffset.style.height=``,this.container?.style.removeProperty(`height`),this.containerHeight=-1,this.windowSpecs={top:0,bottom:0},this.pendingLayoutAnchor=void 0,this.shouldFixContainerFocus=!1,this.height=0,this.scrollTop=0,this.scrollPageOffset=0,this.scrollHeight=0,this.scrollDirty=!0,this.heightDirty=!0,this.resetRenderState(),this.isContainerManaged||this.flushSlotCoordinator(),this.search.refresh(),n)throw r}cleanUp(){let e=!1,t;try{this.reset()}catch(n){e=!0,t=n}if(this.clearElementPool(),this.restoreScrollInteractions(),this.workerManager?.unsubscribeToThemeChanges(this),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.root?.removeEventListener(`scroll`,this.handleScroll),this.root?.removeEventListener(`wheel`,this.clearPendingScroll),this.root?.removeEventListener(`touchstart`,this.clearPendingScroll),this.root?.removeEventListener(`pointerdown`,this.clearPendingScroll),this.root?.removeEventListener(`keydown`,this.clearPendingScroll),this.root?.removeEventListener(`keydown`,this.search.handleKeyDown),this.search.cleanUp(),this.root?.style.removeProperty(`overflow-anchor`),this.container?.remove(),this.stickyOffset.remove(),this.stickyContainer.remove(),this.stickyContainer.textContent=``,this.header.element?.remove(),this.header.element=void 0,this.header.render=void 0,this.header.height=0,this.footer.element?.remove(),this.footer.element=void 0,this.footer.render=void 0,this.footer.height=0,this.root=void 0,this.container=void 0,e)throw t}cleanAllRenderedItems(){if(this.renderState.firstIndex!==-1)for(let e=this.renderState.firstIndex;e<=this.renderState.lastIndex;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.cleanAllRenderedItems: Item does not exist at index: ${e}`);this.releaseRenderedItem(t)}}primeScrollTarget(e){e.type!==`position`&&this.idToItem.get(e.id)?.instance.primeHighlightCache()}getElementPoolLimit(){let e=this.getHeight()+this.config.overscrollSize*2,{diffHeaderHeight:t}=this.itemMetricsCache;return Math.max(8,Math.ceil(e/Math.max(t,10))+1)*(this.isContainerManaged?2:1)}acquireElement(){this.promotePendingPooledElements();let e=this.elementPool.pop();for(;e!=null&&!this.isElementPoolGenerationCurrent(e);)e=this.elementPool.pop();return e??=document.createElement(Rt),this.markElementPoolGenerationCurrent(e),e}releaseRenderedItem(e){let{element:t}=e;t!=null&&this.renderedItemOwnsFocus(t)&&(this.shouldFixContainerFocus=!0),e.instance.cleanUp(!0),this.attachedEditors.delete(e.item.id),e.element=void 0,t!=null&&(t.remove(),this.cleanElement(t),this.queueElementForPool(t))}renderedItemOwnsFocus(e){let{activeElement:t}=document;return t===e||e.contains(t)||e.shadowRoot?.activeElement!=null}fixContainerFocus(){this.shouldFixContainerFocus&&(this.shouldFixContainerFocus=!1,this.root?.focus({preventScroll:!0}))}cleanElement(e){let{shadowRoot:t}=e;if(t!=null)for(let e of Array.from(t.children))vo(e)||e.remove();this.isContainerManaged||e.replaceChildren()}queueElementForPool(e){let t=this.getElementPoolLimit();!this.isElementPoolGenerationCurrent(e)||this.getElementPoolSize()>=t||(this.isElementClean(e)?this.elementPool.push(e):this.pendingElementPool.push(e))}promotePendingPooledElements(){if(this.pendingElementPool.length===0)return;let{pendingElementPool:e}=this;this.pendingElementPool=[];let t=this.getElementPoolLimit();for(let n of e)this.isElementPoolGenerationCurrent(n)&&this.isElementClean(n)&&this.elementPool.length<t?this.elementPool.push(n):this.isElementPoolGenerationCurrent(n)&&this.getElementPoolSize()<t&&this.pendingElementPool.push(n)}isElementClean(e){return e.childNodes.length===0}getElementPoolSize(){return this.elementPool.length+this.pendingElementPool.length}clearElementPool(){this.elementPool.length=0,this.pendingElementPool.length=0}invalidateElementPool(){this.elementPoolVersion++,this.clearElementPool()}markElementPoolGenerationCurrent(e){this.elementPoolTracker.set(e,this.elementPoolVersion)}isElementPoolGenerationCurrent(e){return this.elementPoolTracker.get(e)===this.elementPoolVersion}resolveEffectiveScrollBehavior(e,t){return Ta()?`instant`:e.behavior===`smooth-auto`?Math.abs(t-this.getScrollTop())<=this.getHeight()*10?`smooth`:`instant`:e.behavior??`instant`}scrollTo(e){if(this.root==null)return;let t=this.normalizeScrollTarget(e);if(t==null)return;let n=this.resolveScrollTargetTop(t);n!=null&&(this.primeScrollTarget(t),this.resolveEffectiveScrollBehavior(t,n)===`smooth`?this.scrollAnimation??={position:this.getScrollTop(),velocity:0,lastTimestamp:performance.now()}:this.scrollAnimation=void 0,this.suspendScrollInteractions(),this.pendingLayoutAnchor=void 0,this.pendingScrollTarget=t,this.render())}setSelectedLines(e,t){this.applySelectedLines(e,t)}getSelectedLines(){return this.selectedLines}clearSelectedLines(e){this.applySelectedLines(null,e)}getItem(e){return this.idToItem.get(e)?.item}openSearch(){this.search.open()}closeSearch(){this.search.close()}getSearchItems(){return this.items.map(e=>e.item)}getFirstVisibleSearchMatchIndex(e){if(this.items.length===0)return 0;let t=this.getScrollTop()-this.getItemTopOffset()+this.getStickyHeaderOffset(),n=this.findFirstVisibleIndex(Math.max(this.getScrollTop()-this.getItemTopOffset(),0)),r=this.items[n];for(let i=0;i<e.length;i++){let a=e[i];if(a.itemIndex<n)continue;if(a.itemIndex>n)return i;let o=this.getLineScrollPosition(r,a);if(o==null||r.top+o.top>=t)return i}return 0}revealSearchMatch(e,t=!1){let n=this.idToItem.get(e.id);if(n==null||n.type!==`diff`)return;if(n.item.collapsed===!0){if(this.options.onRevealSearchMatch==null){this.scrollTo({type:`item`,id:e.id,align:`start`});return}this.pendingSearchReveal=e,this.options.onRevealSearchMatch(n.item);return}let r={type:`line`,id:e.id,lineNumber:e.lineNumber,side:e.side,align:`center`,offset:-(this.getStickyHeaderOffset()+io)/2},i=n.instance.getRenderedDiff()!=null;if(this.pendingSearchReveal=i?void 0:e,i&&e.side===`additions`&&!n.instance.isLineRenderable(e.lineNumber))n.instance.revealLine(e.lineNumber);else if(i&&!t&&this.isScrollTargetInView(r))return;this.scrollTo(r)}cancelSearchReveal(){this.pendingSearchReveal=void 0}resumePendingSearchReveal(e){let t=this.pendingSearchReveal;if(t!=null){for(let n of e)if(n.item.id===t.id&&n.item.collapsed!==!0&&n.instance.getRenderedDiff()!=null){queueMicrotask(()=>{this.pendingSearchReveal===t&&this.revealSearchMatch(t,!0)});return}}}revealSearchMatchHorizontally(e,t){let n=this.idToItem.get(e.id),r=t.closest(`[data-code]`);if(n==null||r==null||r.scrollWidth<=r.clientWidth)return;let i=r.getBoundingClientRect(),a=po(t,e.start,e.end);if(a==null)return;let o=r.querySelector(`:scope > [data-gutter]`)?.getBoundingClientRect().right,s=o!=null&&o>i.left?o:i.left,c=r.scrollLeft;if(a.left<s+24)c-=s+24-a.left;else if(a.right>i.right-24)c+=a.right-(i.right-24);else return;n.instance.setCodeScrollLeft(Math.max(0,c))}isScrollTargetInView(e){let t=this.getScrollTargetRect(e);if(t==null)return!1;let n=this.getItemTopOffset()+t.top,r=this.getScrollTop();return n>=r+this.getStickyHeaderOffset()+io&&n+t.height<=r+this.getHeight()}getMountedSearchMatches(e){let t=[],{firstIndex:n,lastIndex:r}=this.renderState;if(n===-1)return t;for(let i=n;i<=r;i++){let n=e.get(i),r=n==null?void 0:this.items[i]?.element?.shadowRoot;if(r==null)continue;let a=new Map;for(let e of r.querySelectorAll(`[data-line][data-line-index]`)){let t=e.getAttribute(`data-line-index`).split(`,`)[0],n=e.closest(`[data-deletions]`)==null?`additions`:`deletions`;a.set(`${n}:${t}`,e)}for(let e of n){let n=a.get(`additions:${e.unifiedLineIndex}`),r=a.get(`deletions:${e.unifiedLineIndex}`),i=e.side===`deletions`?[r??n]:e.isContext?[n,r]:[n];for(let n of i)n!=null&&t.push({entry:e,element:n})}}return t}getEditor(e){return this.itemEditors.get(e)?.editor}updateItem(e){let t=this.idToItem.get(e.id);return t==null?(console.error(`CodeView.updateItem: unknown item id "${e.id}"`),!1):this.syncItemRecord(t,e)?(this.markItemLayoutDirty(t),this.scrollDirty=!0,this.render(),this.syncItemEditors(),this.syncSelection(),this.search.refresh(),!0):!1}updateItemId(e,t){if(e===t)return!0;let n=this.idToItem.get(e);if(n==null)return console.error(`CodeView.updateItemId: unknown item id "${e}"`),!1;if(this.idToItem.has(t))return console.error(`CodeView.updateItemId: duplicate item id "${t}"`),!1;this.idToItem.delete(e),n.item.id=t,this.idToItem.set(t,n),this.updateItemOptionsId(n.instance.options,t),this.selectedLines?.id===e&&(this.selectedLines={...this.selectedLines,id:t},this.options.onSelectedLinesChange?.(this.selectedLines));let r=this.itemEditors.get(e);return r!=null&&(this.itemEditors.delete(e),this.itemEditors.set(t,r),this.attachedEditors.delete(e)&&this.attachedEditors.add(t)),this.renamePendingScrollTarget(e,t),this.renamePendingLayoutAnchor(e,t),this.render(),this.search.refresh(),!0}addItem(e){this.addItems([e])}addItems(e){this.appendItemsInternal(e),this.syncItemEditors(),this.syncSelection(),this.search.refresh()}removeItem(e){let t=this.idToItem.get(e);if(t==null)return console.error(`CodeView.removeItem: unknown item id "${e}"`),!1;let n=[];for(let e of this.items)e!==t&&n.push(e.item);return this.setItems(n),!0}setItems(e){let t;this.items.length===0?this.appendItemsInternal(e):this.tryAppendItems(e)||(t=this.reconcileItems(e));try{this.syncItemEditors(t)}finally{for(let e of t?.values()??[])e.instance.cleanUp()}this.syncSelection(),this.search.refresh()}appendItemsInternal(e,t=!0){if(e.length===0)return;let n=this.getLayout(),r=this.items.length===0?0:this.scrollHeight+n.gap,i=r;for(let t=0;t<e.length;t++){let i=e[t];if(i==null)throw Error(`CodeView.appendItemsInternal: missing input item`);if(this.idToItem.has(i.id))throw Error(`CodeView.addItem: duplicate id "${i.id}"`);let a=this.createItem(i,this.items.length,r);this.items.push(a),this.idToItem.set(a.item.id,a),this.instanceToItem.set(a.instance,a),a.height=mo(a),r+=a.height+n.gap}this.scrollHeight=r-n.gap,this.scrollDirty=!0,t&&(this.canSkipRenderForAppend(i)?this.syncContainerHeight():this.render())}canSkipRenderForAppend(e){return this.container!=null&&this.renderState.firstIndex!==-1&&this.pendingScrollTarget==null&&this.scrollAnimation==null&&this.layoutDirtyIndex==null&&e>this.windowSpecs.bottom}onThemeChange(){this.invalidateElementPool()}setOptions(e){if(e==null)return;this.capturePendingLayoutAnchor();let{options:t}=this,n=this.getLayout(),{itemMetricsCache:r}=this;ho(t,e)&&this.invalidateElementPool(),this.options=e;let i=this.computeMetricsCache(e.itemMetrics),a=!nn(r,i),o=!nn(n,this.getLayout());o&&this.syncLayout();let s=a||go(t,e);if(s){let n=this.pendingLayoutReset;this.pendingLayoutReset={metrics:a?i:n?.metrics,resetFileLayoutCache:!0,resetDiffLayoutCache:!0,includeEstimatedDiffHeights:n?.includeEstimatedDiffHeights===!0||a||_o(t,e)}}(o||s)&&(this.markLayoutDirtyFromIndex(0),this.scrollDirty=!0),en(t,e)||this.renderOptionsRevision++,this.syncItemEditors();let c=t.renderCodeViewHeader!==e.renderCodeViewHeader||t.renderCodeViewFooter!==e.renderCodeViewFooter;!this.isContainerManaged&&(this.items.length>0||c)&&this.render()}capturePendingLayoutAnchor(e=this.idToItem){this.root!=null&&this.items.length!==0&&this.pendingScrollTarget==null&&(this.pendingLayoutAnchor=this.getScrollAnchor(this.getScrollTop(),e))}render(t=!1){e.__STOP||(t?(Zt(this.computeRenderRangeAndEmit),this.computeRenderRangeAndEmit()):$t(this.computeRenderRangeAndEmit))}isReady(){let{workerManager:e}=this;return e==null||e.getStats().workersFailed?this.isSharedHighlighterReady():e.isInitialized()?(this.clearReadySubscription(),!0):(this.isReadySubscription??=e.subscribeToStatChanges(e=>{(e.managerState===`initialized`||e.workersFailed)&&(this.clearReadySubscription(),this.render(!0))}),e.getStats().managerState===`waiting`&&e.initialize().catch(()=>{}),!1)}clearReadySubscription(){this.isReadySubscription!=null&&(this.isReadySubscription(),this.isReadySubscription=void 0,this.pendingHighlighterTheme=void 0)}isSharedHighlighterReady(){let e=this.workerManager?.getFileRenderOptions().theme??this.options.theme??Ht;return Pt()&&Mt(e)?(this.clearReadySubscription(),!0):(cn(this.pendingHighlighterTheme,e)||this.clearReadySubscription(),this.isReadySubscription??=(()=>{this.pendingHighlighterTheme=e;let t=!1;return qt({themes:Jt(e),langs:[],preferredHighlighter:this.options.preferredHighlighter}).then(()=>{t||(this.clearReadySubscription(),this.render(!0))},e=>{t||(this.clearReadySubscription(),console.error(e))}),()=>{t=!0}})(),!1)}instanceChanged(e,t){let n=this.instanceToItem.get(e);if(n==null)throw Error(`CodeView.instanceChanged: An instance has changed that is not registered`);t&&this.markItemLayoutDirty(n),this.render()}getWindowSpecs(){return this.windowSpecs}getContainerElement(){return this.root}getHeaderElement(){return this.header.element}getFooterElement(){return this.footer.element}getRenderedItems(){let{firstIndex:e,lastIndex:t}=this.renderState;if(e===-1||t===-1||t<e)return[];let n=[];for(let r=e;r<=t;r++){let e=this.items[r];e?.element!=null&&(e.type===`diff`?n.push({id:e.item.id,type:`diff`,item:e.item,version:e.version,element:e.element,instance:e.instance}):n.push({id:e.item.id,type:`file`,item:e.item,version:e.version,element:e.element,instance:e.instance}))}return n}setSlotCoordinator(e){return e!==this.slotCoordinator&&(this.slotCoordinator=e,this.slotSnapshot=void 0,!0)}getSlotSnapshot(e){return this.buildSlotSnapshot(e)}buildSlotSnapshot(e){let t=wo(this.getRenderedItems(),e),{element:n}=this.header,{element:r}=this.footer;if(t!=null||n!=null||r!=null)return{items:t,header:n,footer:r}}subscribeToScroll(e){return this.scrollListeners.add(e),()=>{this.scrollListeners.delete(e)}}getLocalTopForInstance(e){let t=this.instanceToItem.get(e);if(t==null)throw Error(`CodeView.getLocalTopForInstance: unknown virtualized instance`);return t.top}getTopForItem(e){let t=this.idToItem.get(e);if(t!=null)return t.top+this.getItemTopOffset()}createItem(e,t,n){let{itemMetricsCache:r}=this;if(e.type===`diff`){let i=new mn(this.createDiffOptions(e.id),this,r,this.workerManager,this.isContainerManaged);return{type:`diff`,item:e,version:e.version,index:t,top:n,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:i}}let i=new ln(this.createFileOptions(e.id),this,r,this.workerManager,this.isContainerManaged);return{type:`file`,item:e,version:e.version,index:t,top:n,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:i}}applySelectedLines(e,t){let{selectedLines:n}=this;e==null&&n==null||e!=null&&n?.id===e.id&&Qt(n.range,e.range)||(n!=null&&n.id!==e?.id&&this.idToItem.get(n.id)?.instance.setSelectedLines(null,{notify:!1}),this.selectedLines=e,this.idToItem.get(e?.id??``)?.instance.setSelectedLines(e?.range??null,t))}syncSelection(){if(this.selectedLines==null)return;let e=this.idToItem.get(this.selectedLines.id);if(e==null){this.selectedLines=null,this.options.onSelectedLinesChange?.(null);return}e.instance.setSelectedLines(this.selectedLines.range,{notify:!1})}isItemInEditMode(e){return e.item.edit===!0&&e.item.collapsed!==!0}attachItemEditor(e){let{id:t}=e.item,{createEditor:n}=this.options;if(e.element==null||this.attachedEditors.has(t)||!this.isItemInEditMode(e))return;let r=this.itemEditors.get(t),i;try{if(r==null&&e.type===`diff`&&!e.instance.__canAttachEditor()){e.instance.__prepareForEditing();return}if(r==null){lo(n);let r=eo(e.instance.options);if(r==null)throw Error(`CodeView.attachItemEditor: instance options are missing their state`);let a=e=>{let t=this.idToItem.get(r.id);t!=null&&this.options.onItemEditChange?.(e,t.item)},o=this.options.getEditStateKey?.(e.item);if(e.type===`diff`){let s=n(`file-diff`,{onChange:a},o);i=s,this.itemEditors.set(t,{editor:s,state:r,dispose:s.edit(e.instance)})}else{let s=n(`file`,{onChange:a},o);i=s,this.itemEditors.set(t,{editor:s,state:r,dispose:s.edit(e.instance)})}}else r.dispose=(e.type,r.editor.edit(e.instance));this.attachedEditors.add(t)}catch(t){throw i?.cleanUp(),this.releaseRenderedItem(e),t}}syncItemEditors(e){if(this.itemEditors.size===0)return;let t=[];for(let[n,r]of this.itemEditors){let i=this.idToItem.get(n),a=e?.get(n);if(a==null&&i!=null){let{edit:e=!1,collapsed:t=!1}=i.item;if(e){t&&this.attachedEditors.delete(n)&&r.editor.cleanUp(`recycle`);continue}}else a!=null&&(r.state.removedItem=a.item);this.itemEditors.delete(n),this.attachedEditors.delete(n),t.push(r)}if(t.length===0)return;let n=!1,r;for(let e of t){try{e.dispose()}catch(e){n||(n=!0,r=e)}let t=this.idToItem.get(e.state.id);t!=null&&this.markItemLayoutDirty(t)}if(this.render(),n)throw r}requireItemFromState(e){let t=this.idToItem.get(e.id)?.item??e.removedItem;if(t==null)throw Error(`CodeView.onItemEditComplete: unknown item "${e.id}"`);return t}completeFileItemEdit(e,t){let n=this.requireItemFromState(e);if(n.type!==`file`)throw Error(`CodeView.onItemEditComplete: item "${e.id}" is not a file item`);let r={...n,file:t.file,annotations:t.lineAnnotations,edit:!1,version:(n.version??0)+1};return(this.options.onItemEditComplete?.(t,n,r)??`reject`)===`reject`?`reject`:(this.idToItem.has(n.id)&&this.updateItem(r),`accept`)}completeDiffItemEdit(e,t){let n=this.requireItemFromState(e);if(n.type!==`diff`)throw Error(`CodeView.onItemEditComplete: item "${e.id}" is not a diff item`);let r={...n,fileDiff:t.fileDiff,annotations:t.lineAnnotations,edit:!1,version:(n.version??0)+1};return(this.options.onItemEditComplete?.(t,n,r)??`reject`)===`reject`?`reject`:(this.idToItem.has(n.id)&&this.updateItem(r),`accept`)}renamePendingScrollTarget(e,t){let{pendingScrollTarget:n}=this;n!=null&&n.type!==`position`&&n.id===e&&(this.pendingScrollTarget={...n,id:t})}renamePendingLayoutAnchor(e,t){this.pendingLayoutAnchor?.id===e&&(this.pendingLayoutAnchor.id=t)}createFileOptionsPrototype(){let e={};for(let t of Ya)to(e,t,()=>this.options[t]);to(e,`stickyHeader`,()=>this.options.stickyHeaders),to(e,`collapsed`,e=>{let t=eo(e);if(t!=null)return this.getItemOptions(t,`file`)?.item.collapsed}),to(e,`onEditComplete`,e=>{if(this.options.onItemEditComplete==null)return;let t=eo(e);if(t!=null)return e=>this.completeFileItemEdit(t,e)});for(let t of Xa)this.defineItemSharedCallback(e,`file`,t);for(let t of Za)this.defineItemSelectionCallback(e,`file`,t);return e}createDiffOptionsPrototype(){let e={};for(let t of Ja)to(e,t,()=>this.options[t]);to(e,`stickyHeader`,()=>this.options.stickyHeaders),to(e,`hunkSeparators`,()=>this.options.hunkSeparators),to(e,`collapsed`,e=>{let t=eo(e);if(t!=null)return this.getItemOptions(t,`diff`)?.item.collapsed}),to(e,`onEditComplete`,e=>{if(this.options.onItemEditComplete==null)return;let t=eo(e);if(t!=null)return e=>this.completeDiffItemEdit(t,e)});for(let t of Xa)this.defineItemSharedCallback(e,`diff`,t);for(let t of Za)this.defineItemSelectionCallback(e,`diff`,t);return e}createFileOptions(e){let t=Object.create(this.fileOptionsPrototype);return $a(t,{id:e}),t}createDiffOptions(e){let t=Object.create(this.diffOptionsPrototype);return $a(t,{id:e}),t}updateItemOptionsId(e,t){let n=eo(e);if(n==null)throw Error(`CodeView.updateItemOptionsId: No valid state`);n.id=t}getItemOptions(e,t){let n=this.idToItem.get(e.id);if(n!=null&&n.type===t)return n}defineItemSharedCallback(e,t,n){to(e,n,e=>{if(this.options[n]==null)return;let r=eo(e);if(r==null)return;let i=r.callbackCache??={},a=i[n];return a??(a=((...e)=>{let i=this.getItemOptions(r,t);if(i==null)return;let a=this.options[n];return a?.(...e,i)}),i[n]=a),a})}defineItemSelectionCallback(e,t,n){to(e,n,e=>{let r=eo(e);if(r==null)return;let i=r.callbackCache??={},a=i[n];return a??(a=e=>{let i=this.getItemOptions(r,t);if(i==null)return;let a=e==null?null:{id:i.item.id,range:e};this.options.controlledSelection!==!0&&(e!=null||this.selectedLines?.id===i.item.id)&&this.applySelectedLines(a,{notify:!1}),this.options.onSelectedLinesChange?.(a);let o=this.options[n];return o?.(e,i)},i[n]=a),a})}markLayoutDirtyFromIndex(e){this.layoutDirtyIndex=Math.min(this.layoutDirtyIndex??e,e)}markItemLayoutDirty(e){if(this.items[e.index]!==e)throw Error(`CodeView.markItemLayoutDirty: unknown item id "${e.item.id}"`);this.markLayoutDirtyFromIndex(e.index)}tryAppendItems(e){if(e.length<=this.items.length)return!1;for(let t=0;t<this.items.length;t++){let n=this.items[t];if(n==null)throw Error(`CodeView.tryAppendItems: missing existing item`);let r=e[t];if(r==null||n.item.id!==r.id||n.type!==r.type)return!1}for(let t=0;t<this.items.length;t++){let n=this.items[t];if(n==null)throw Error(`CodeView.tryAppendItems: missing existing item`);let r=e[t];if(r==null)throw Error(`CodeView.tryAppendItems: append candidate missing prefix item`);this.syncItemRecord(n,r)&&this.markLayoutDirtyFromIndex(t)}return this.appendItemsInternal(e.slice(this.items.length),!1),this.scrollDirty=!0,this.render(),!0}reconcileItems(e){let{items:t,idToItem:n}=this,r=new Set(t),i=[],a=new Map,o=new Map,s=new Map,c;for(let s=0;s<e.length;s++){let l=e[s];if(l==null)throw Error(`CodeView.reconcileItems: missing input item`);if(a.has(l.id))throw Error(`CodeView.setItems: duplicate id "${l.id}"`);let u=n.get(l.id),d=u!=null&&u.type===l.type?u:this.createItem(l,s,0);d.index=s,u!=null&&u.type===l.type?(r.delete(u),this.syncItemRecord(d,l)&&(c=Math.min(c??s,s))):c=Math.min(c??s,s),t[s]!==d&&(c=Math.min(c??s,s)),i.push(d),a.set(l.id,d),o.set(d.instance,d)}if(c==null){if(r.size===0)return;c=Math.max(i.length-1,0)}this.capturePendingLayoutAnchor(a);for(let e=0;e<t.length;e++){let n=t[e];if(n==null||!r.has(n))continue;s.set(n.item.id,n),this.releaseRenderedItem(n);let a=Math.max(i.length-1,0);c=Math.min(c??a,a)}return this.items=i,this.idToItem=a,this.instanceToItem=o,this.renderState.firstIndex>=i.length?this.resetRenderState():this.renderState.lastIndex>=i.length&&(this.renderState.lastIndex=i.length-1),this.markLayoutDirtyFromIndex(c),this.scrollDirty=!0,this.render(),s.size>0?s:void 0}syncItemRecord(e,t){if(e.type!==t.type)throw Error(`CodeView.syncItemRecord: type mismatch for id "${t.id}"`);if(e.version===t.version)return!1;e.item=t,e.version=t.version,e.renderedOptionsRevision=-1;let n=this.pendingSearchReveal;return n!=null&&n.id===t.id&&t.collapsed!==!0&&queueMicrotask(()=>{this.pendingSearchReveal===n&&this.revealSearchMatch(n,!0)}),!0}getMaxScrollTopForHeight(e){let{paddingBottom:t,paddingTop:n}=this.getLayout();return Math.max(n+this.header.height+e+this.footer.height+t-this.getHeight(),0)}getMaxScrollTop(){return this.getMaxScrollTopForHeight(this.getScrollHeight())}shouldRebaseScroll(){return this.getMaxScrollTop()>this.scrollRebaseConfig.threshold}getPagedScrollHeight(){return this.shouldRebaseScroll()?Math.min(this.getScrollHeight(),this.scrollRebaseConfig.containerHeight):this.getScrollHeight()}getMaxPagedScrollTop(){return this.getMaxScrollTopForHeight(this.getPagedScrollHeight())}clampPagedScrollTop(e){let t=this.getMaxPagedScrollTop();return Math.max(0,Math.min(e,t))}clampScrollTop(e){let t=this.getMaxScrollTop();return Math.max(0,Math.min(e,t))}getMaxScrollPageOffset(){return Math.max(this.getMaxScrollTop()-this.getMaxPagedScrollTop(),0)}clampScrollPageOffset(e){let t=this.getMaxScrollPageOffset();return Math.max(0,Math.min(e,t))}resolveScrollPageWindow(e,t){let n=ka(this.clampPagedScrollTop(t)),r=this.clampScrollPageOffset(e-n);return n=ka(this.clampPagedScrollTop(e-r)),r=this.clampScrollPageOffset(e-n),{pagedScrollTop:n,scrollPageOffset:r}}resolvePagedScrollPosition(e){if(!this.shouldRebaseScroll())return{pagedScrollTop:this.clampPagedScrollTop(e),scrollPageOffset:0};let{scrollPageOffset:t,scrollRebaseConfig:n}=this,r=this.clampScrollPageOffset(t),i=e-r,a=this.getMaxPagedScrollTop(),o=this.getMaxScrollPageOffset(),s=i>n.threshold&&r<o,c=i<n.triggerTop&&r>0;return i<0||i>a||s||c?this.resolveScrollPageWindow(e,c?Math.min(n.targetBottom,a):n.targetTop):{pagedScrollTop:ka(this.clampPagedScrollTop(i)),scrollPageOffset:r}}needsScrollPageUpdate(e){let t=ka(this.clampScrollTop(e)),{scrollPageOffset:n}=this.resolvePagedScrollPosition(t);return n!==this.scrollPageOffset}getPagedLayoutTop(e){return this.shouldRebaseScroll()?Math.max(e-this.scrollPageOffset,0):e}getStickyHeaderOffset(){return this.options.stickyHeaders===!0&&this.options.disableFileHeader!==!0?this.itemMetricsCache.diffHeaderHeight:0}getScrollTargetRect(e){let t=this.idToItem.get(e.id);if(t==null){console.warn(`CodeView.scrollTo: unknown item id "${e.id}"`);return}if(e.type===`item`)return{top:t.top,height:t.height};if(e.type===`range`){let n=this.getRangeScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve range ${yo(e.range)} for item "${e.id}"`);return}return{top:t.top+n.top,height:n.height}}let n=this.getLineScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve line ${e.lineNumber} for item "${e.id}"`);return}return{top:t.top+n.top,height:n.height}}normalizeScrollTarget(e){if(e.type===`position`||e.align!==`nearest`)return e;let t=this.getScrollTargetRect(e);if(t==null)return;let n=e.offset??0,r=this.getItemTopOffset()+t.top,i=r+t.height,a=this.getScrollTop(),o=a+(e.type===`line`||e.type===`range`?this.getStickyHeaderOffset():0),s=a+this.getHeight();if(!(r-n<=o&&i+n>=s)){if(r-n<o)return{...e,align:`start`};if(i+n>s)return{...e,align:`end`}}}resolveScrollTargetTop(e){if(e.type===`position`){let t=this.clampScrollTop(e.position);return t===e.position?this.clampScrollTop(e.position-this.getStickyHeaderOffset()):t}let t=this.idToItem.get(e.id);if(t==null){console.warn(`CodeView.scrollTo: unknown item id "${e.id}"`);return}if(e.type===`item`)return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top,t.height,e.align,e.offset));if(e.type===`range`){let n=this.getRangeScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve range ${yo(e.range)} for item "${e.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top+n.top,n.height,e.align,e.offset,this.getStickyHeaderOffset()))}let n=this.getLineScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve line ${e.lineNumber} for item "${e.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top+n.top,n.height,e.align,e.offset,this.getStickyHeaderOffset()))}resolveAlignedScrollPosition(e,t,n,r=0,i=0){e+=this.getItemTopOffset();let a=this.getHeight();return n===`center`&&t+r<a?e-(a-t)/2+r:n===`end`?e-(a-t)+r:e-i-r}getLineScrollPosition(e,t){return e.type===`diff`?e.instance.getLinePosition(t.lineNumber,t.side):e.instance.getLinePosition(t.lineNumber)}getRangeScrollPosition(e,t){let{range:n}=t,r=this.getLineScrollPosition(e,{type:`line`,id:t.id,lineNumber:n.start,side:n.side}),i=this.getLineScrollPosition(e,{type:`line`,id:t.id,lineNumber:n.end,side:n.endSide??n.side});if(r==null||i==null)return;let a=r.top,o=a+r.height,s=i.top,c=s+i.height,l=Math.min(a,s);return{top:l,height:Math.max(o,c)-l}}computeTargetScrollTopForFrame(e,t){if(this.pendingScrollTarget==null)return e;let n=this.resolveScrollTargetTop(this.pendingScrollTarget);if(n==null)return e;let{scrollAnimation:r}=this;return r==null?n:this.computeSpringStep(r,n,t).position}computeSpringStep(e,t,n){let r=Math.max(0,n-e.lastTimestamp),{omega:i}=this.getSmoothScrollSettings(),a=Math.exp(-i*r),o=e.position-t,s=e.velocity+i*o;return{position:t+(o+s*r)*a,velocity:(s*(1-i*r)-i*o)*a}}advanceScrollAnimation(e,t){if(this.pendingScrollTarget==null)return;let n=this.resolveScrollTargetTop(this.pendingScrollTarget);if(n==null){this.pendingScrollTarget=void 0,this.scrollAnimation=void 0;return}let r=this.scrollAnimation;if(r==null)return n;r.position+=t;let{position:i,velocity:a}=this.computeSpringStep(r,n,e);r.lastTimestamp=e,r.position=i,r.velocity=a;let{positionEpsilon:o,velocityEpsilon:s}=this.getSmoothScrollSettings();return Math.abs(n-i)<=o&&Math.abs(a)<=s?(r.position=n,r.velocity=0,this.scrollAnimation=void 0,n):r.position}computeRenderRangeAndEmit=(t=performance.now())=>{if(e.__STOP||this.container==null||!this.isReady())return;let n=this.getHeight(),r=this.getScrollTop(),i=r,a=this.pendingLayoutAnchor!=null,o=this.getScrollAnchor(i);if(this.layoutDirtyIndex!=null&&(this.recomputeLayout(this.layoutDirtyIndex,this.pendingLayoutReset),this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,a=!0),a&&o!=null){let e=this.resolveAnchoredScrollTop(o);if(e!=null){let t=e-i;i=e,this.scrollAnimation!=null&&(this.scrollAnimation.position+=t)}}a&&(i=this.clampScrollTop(i),this.syncContainerHeight());let s=this.computeTargetScrollTopForFrame(i,t),c=!a&&(this.renderState.scrollTop===-1||Math.abs(s-this.renderState.scrollTop)>n+this.config.overscrollSize*2);c&&(o=void 0),this.windowSpecs=tn({scrollTop:s-this.header.height,height:n,scrollHeight:this.getScrollHeight(),fitPerfectly:c,fitPerfectlyOverscroll:this.getFitPerfectlyOverscroll(),overscrollSize:this.config.overscrollSize});let l=r;(this.pendingScrollTarget!=null&&s!==l||this.needsScrollPageUpdate(s))&&(this.applyScrollFix(s,l,this.windowSpecs),l=s);let{top:u,bottom:d}=this.windowSpecs,{firstIndex:f,lastIndex:p}=this.renderState;if(f>=0)for(let e=f;e<=p;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.computeRenderRangeAndEmit: No item at index: ${e}`);t.top>u-t.height&&t.top<=d||this.releaseRenderedItem(t)}let m=this.reconcileHeaderFooterHosts(),h,g=new Set,_=this.findFirstVisibleIndex(u),v=this.findLastVisibleIndex(d);for(let e=_;e<=v;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.computeRenderRangeAndEmit: missing item`);let{instance:n}=t;t.element==null?(t.element=this.acquireElement(),So(this.stickyContainer,t.element,h),n.virtualizedSetup(),xo(t,t.element)&&(t.renderedOptionsRevision=this.renderOptionsRevision,g.add(t)),h=t.element):(So(this.stickyContainer,t.element,h),xo(t,void 0,t.renderedOptionsRevision!==this.renderOptionsRevision)&&(t.renderedOptionsRevision=this.renderOptionsRevision,g.add(t)),h=t.element),t.item.edit===!0&&this.attachItemEditor(t)}this.renderState.firstIndex=_<=v?_:-1,this.renderState.lastIndex=v,this.flushSlotCoordinator(),this.flushManagers(g),m&&this.measureMountedHosts(),this.reconcileRenderedItems(g),this.syncContainerHeight(),this.updateStickyPositioning();let y=o==null?void 0:this.resolveAnchoredScrollTop(o);o===this.pendingLayoutAnchor&&(this.pendingLayoutAnchor=void 0);let b=y==null?0:y-i,x=s,S=!1;if(this.pendingScrollTarget!=null){let e=this.advanceScrollAnimation(t,b);e==null?x=i:(x=e,S=!0)}else x=y??s;x!==l&&(this.applyScrollFix(x,l,this.windowSpecs),l=x),S&&this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),this.renderState.scrollTop=ka(l),this.updateStickyPositioning(),this.validateStickyContainerHeight(),this.fixContainerFocus(),g.size>0&&(this.resumePendingSearchReveal(g),this.search.repaint()),(c||this.scrollAnimation!=null)&&this.render()};flushManagers(e){for(let t of e)t.instance.flushManagers()}syncContainerHeight(){let e=this.getPagedScrollHeight();this.container!=null&&this.containerHeight!==e&&(this.container.style.height=`${e}px`,this.containerHeight=e)}getStickyBounds(e){let{firstIndex:t,lastIndex:n}=e==null?this.renderState:{firstIndex:this.findFirstVisibleIndex(e.top),lastIndex:this.findLastVisibleIndex(e.bottom)};if(t===-1||n===-1||t>n)return;let r=this.items[t]?.instance.getAdvancedStickySpecs(e),i=this.items[n]?.instance.getAdvancedStickySpecs(e);if(r!=null&&i!=null)return{stickyTop:this.getPagedLayoutTop(Math.max(r.topOffset,0)),stickyBottom:this.getPagedLayoutTop(i.topOffset+i.height)}}applyStickyPositioning({stickyTop:e,stickyBottom:t}){let n=this.getHeight(),{itemMetricsCache:r}=this,i=t-e;this.renderState.stickyHeight=i,this.renderState.stickyTop=e,this.renderState.stickyBottom=t,this.stickyOffset.style.height=`${e}px`;let a=(Math.random()*r.lineHeight>>0)*-1,o=-Math.max(i+a,0)+n;this.stickyContainer.style.top=`${o}px`,this.stickyContainer.style.bottom=`${o+r.diffHeaderHeight}px`}syncPagedScrollScaffolding(e){this.syncContainerHeight();let t=this.getStickyBounds(e);if(t==null){this.stickyOffset.style.height=`${this.getPagedLayoutTop(e.top)}px`;return}this.applyStickyPositioning(t)}reconcileRenderedItems(e){let{firstIndex:t,lastIndex:n}=this.renderState;if(t===-1)return;let r=-1,i=!1;for(let a=t;a<this.items.length&&!(!i&&a>n);a++){let t=this.items[a];if(t==null)throw Error(`CodeView.reconcileRenderedItems: Invalid item`);r===-1?r=t.top:t.top!==r&&(t.top=r,t.instance.syncVirtualizedTop(),i=!0),(e==null?a<=n:e.has(t))&&(t.instance.reconcileHeights()&&(i=!0,t.height=t.instance.getVirtualizedHeight()),this.validateRenderedItemHeight(t)),r+=t.instance.getVirtualizedHeight(),a<this.items.length-1&&(r+=this.getLayout().gap)}i&&r!=null&&(this.scrollDirty=!0,this.scrollHeight=r)}updateStickyPositioning(){let e=this.getStickyBounds();if(e==null){this.renderState.firstIndex===-1&&(this.stickyOffset.style.height=``);return}let{stickyTop:t,stickyBottom:n}=e;(n-t!==this.renderState.stickyHeight||t!==this.renderState.stickyTop||n!==this.renderState.stickyBottom)&&this.applyStickyPositioning(e)}handleScroll=()=>{e.__STOP||(this.suspendScrollInteractions(),this.scrollDirty=!0,this.notifyScroll(),this.render())};clearPendingScroll=e=>{e!=null&&this.search.isOpen&&this.search.ownsEvent(e)||(this.pendingScrollTarget=void 0,this.pendingLayoutAnchor=void 0,this.scrollAnimation=void 0)};handleResize=e=>{let t=!1;for(let n of e)if(n.target===this.stickyContainer){let e=n.borderBoxSize[0].blockSize;if(Math.abs(e-this.renderState.stickyHeight)>=ro){let e=this.getScrollTop(),n=this.getScrollAnchor(e);this.reconcileRenderedItems(),this.updateStickyPositioning();let r=n==null?void 0:this.resolveAnchoredScrollTop(n);if(r!=null){let t=r-e;this.applyScrollFix(r,e,this.windowSpecs),this.scrollAnimation!=null&&(this.scrollAnimation.position+=t)}this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),t=!0}}else if(n.target===this.header.element||n.target===this.footer.element){let e=n.target===this.header.element?this.header:this.footer,r=n.borderBoxSize[0].blockSize;if(r!==e.height){let n=this.getScrollTop(),i=this.getScrollAnchor(n);this.setHostHeight(e,r);let a=i==null?void 0:this.resolveAnchoredScrollTop(i);if(a!=null){let e=a-n;this.applyScrollFix(a,n,this.windowSpecs),this.scrollAnimation!=null&&(this.scrollAnimation.position+=e)}this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),t=!0}}else this.scrollDirty=!0,this.heightDirty=!0,t=!0;t&&this.render(!0)};getScrollAnchorViewportTop(e,t){return e<t?t+this.getStickyHeaderOffset():t}getScrollAnchor(e,t=this.idToItem){let n,{pendingLayoutAnchor:r}=this;if(r!=null){let e=this.idToItem.get(r.id);if(e!=null&&t.get(r.id)===e)return r;e!=null&&(n=e)}if(e<=0)return;let{firstIndex:i,lastIndex:a,stickyTop:o,stickyBottom:s}=this.renderState;if(i===-1||a===-1)return;let c=this.getHeight();if(o!==-1&&s!==-1){for(let r=i;r<=a;r++){let i=this.items[r];if(i==null)continue;let a=this.getItemTopOffset()+i.top;if(a+i.height<=e)continue;if(a>=e+c)break;if(t.get(i.item.id)!==i){n??=i;continue}if(a>=e)return{type:`item`,id:i.item.id,viewportOffset:a-e};let o=this.getScrollAnchorViewportTop(a,e)-a,s=i.instance.getNumericScrollAnchor(o);if(s!=null){let t=a+s.top;return{type:`line`,id:i.item.id,lineNumber:s.lineNumber,side:s.side,viewportOffset:t-e}}}if(n!=null)for(let e=n.index+1;e<this.items.length;e++){let n=this.items[e];if(n!=null&&t.get(n.item.id)===n)return{type:`item`,id:n.item.id,viewportOffset:0}}}}resolveAnchoredScrollTop(e){let t=this.idToItem.get(e.id);if(t==null)return;let n=this.getItemTopOffset();if(e.type===`item`){let r=n+t.top;return this.clampScrollTop(r-e.viewportOffset)}let r=t.type===`diff`?t.instance.getLinePosition(e.lineNumber,e.side):t.instance.getLinePosition(e.lineNumber);if(r==null)return;let i=n+t.top+r.top;return this.clampScrollTop(i-e.viewportOffset)}applyScrollFix(e,t,n){if(this.root==null)return;let r=ka(this.clampScrollTop(e)),i=ka(t),{scrollPageOffset:a}=this,o=ka(this.clampPagedScrollTop(i-a)),{pagedScrollTop:s,scrollPageOffset:c}=this.resolvePagedScrollPosition(r),l=s,u=a!==c;(r!==this.renderState.scrollTop||r!==i||l!==o||u)&&(this.suspendScrollInteractions(),(l!==o||u)&&(this.scrollPageOffset=c,this.syncPagedScrollScaffolding(n)),l!==o&&this.root.scrollTo({top:l,behavior:`instant`}),this.renderState.scrollTop=r,this.scrollTop=r,this.scrollDirty=!1)}isPendingTargetSettled(e){let t=this.resolveScrollTargetTop(e);return t==null||ka(this.getScrollTop())===ka(t)}getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root?.scrollTop??0;return this.scrollTop=this.clampScrollTop(e+this.scrollPageOffset),this.scrollTop}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root?.getBoundingClientRect().height??0,this.height):this.height}getScrollHeight(){return this.scrollHeight}flushSlotCoordinator(){if(this.slotCoordinator==null)return;let e=this.buildSlotSnapshot(this.slotCoordinator);Ea(this.slotSnapshot,e)||(this.slotSnapshot=e,this.slotCoordinator.onSnapshotChange(e))}notifyScroll(){if(this.scrollListeners.size===0)return;let e=this.getScrollTop();for(let t of this.scrollListeners)t(e,this)}findFirstVisibleIndex(e){let t=0,n=this.items.length-1,r=this.items.length;for(;t<=n;){let i=t+n>>1,a=this.items[i];if(a==null)throw Error(`CodeView.findFirstVisibleIndex: invalid item index`);a.top+a.height>e?(r=i,n=i-1):t=i+1}return r}findLastVisibleIndex(e){let t=0,n=this.items.length-1,r=-1;for(;t<=n;){let i=t+n>>1,a=this.items[i];if(a==null)throw Error(`CodeView.findLastVisibleIndex: invalid item index`);a.top<=e?(r=i,t=i+1):n=i-1}return r}recomputeLayout(e=0,t){if(this.items.length===0){this.scrollHeight=0;return}let n=this.getLayout(),r=0;if(e>0){let t=this.items[e-1];if(t==null)throw Error(`CodeView.recomputeLayout: invalid dirty index`);r=t.top+t.height+n.gap}for(let i=e;i<this.items.length;i++){let e=this.items[i];if(e==null)throw Error(`CodeView.recomputeLayout: invalid item index`);if(e.top=r,e.type===`diff`){let n=e.item.fileDiff.isPartial;e.height=e.instance.updateCodeViewLayout(e.item.fileDiff,r,t,e.item.annotations??[]),n&&!e.item.fileDiff.isPartial&&this.search.refresh(!0)}else e.height=e.instance.updateCodeViewLayout(e.item.file,r,t,e.item.annotations??[]);r+=e.height,i<this.items.length-1&&(r+=n.gap)}r!==this.scrollHeight&&(this.scrollDirty=!0),this.scrollHeight=r}resetRenderState(){this.renderState.scrollTop=-1,this.renderState.firstIndex=-1,this.renderState.lastIndex=-1,this.renderState.stickyHeight=0,this.renderState.stickyTop=-1,this.renderState.stickyBottom=-1}getFitPerfectlyOverscroll(){return this.getLayout().gap+this.itemMetricsCache.diffHeaderHeight}};function po(e,t,n){let r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),i=0,a,o=0,s;for(;(s=r.nextNode())!=null;){let e=s.data.length;if(a==null&&t<i+e&&(a=s,o=t-i),a!=null&&n<=i+e){let e=document.createRange();return e.setStart(a,o),e.setEnd(s,n-i),e.getBoundingClientRect()}i+=e}}function mo(e){return e.instance.cleanUp(!0),e.type===`diff`?e.instance.updateCodeViewLayout(e.item.fileDiff,e.top,void 0,e.item.annotations??[]):e.instance.updateCodeViewLayout(e.item.file,e.top,void 0,e.item.annotations??[])}function ho(e,t){return!cn(e.theme??Ht,t.theme??Ht)||(e.themeType??`system`)!==(t.themeType??`system`)||e.unsafeCSS!==t.unsafeCSS}function go(e,t){return(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||e.unsafeCSS!==t.unsafeCSS||(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.diffIndicators??`bars`)!==(t.diffIndicators??`bars`)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function _o(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function vo(e){return e instanceof SVGElement||Xt(e)&&(e.hasAttribute(`data-core-css`)||e.hasAttribute(`data-theme-css`)||e.hasAttribute(`data-unsafe-css`))}function yo(e){let t=bo(e.start,e.side),n=bo(e.end,e.endSide??e.side);return t===n?t:`${t}-${n}`}function bo(e,t){return t==null?`${e}`:`${t===`deletions`?`D`:`A`}${e}`}function xo(e,t,n=!1){return e.type===`diff`?e.instance.render({deferManagers:!0,fileContainer:t,fileDiff:e.item.fileDiff,forceRender:n,lineAnnotations:e.item.annotations??[]}):e.instance.render({deferManagers:!0,fileContainer:t,file:e.item.file,forceRender:n,lineAnnotations:e.item.annotations??[]})}function So(e,t,n){if(n==null){e.firstChild!==t&&e.prepend(t);return}n.nextSibling!==t&&n.after(t)}function Co(e){return(e.annotations?.length??0)>0}function wo(e,{hasHeaderRenderers:t,hasAnnotationRenderer:n,hasGutterRenderer:r}){if(e.length===0)return;if(t||r)return e;if(!n)return;let i=[];for(let t of e)Co(t.item)&&i.push(t);return i.length>0?i:void 0}var Z=e(n(),1),To=e(Ne(),1),Q=N(),$=e(ve(),1);function Eo(e){return K(`flex items-center justify-between gap-2`,e===`embedded`?`px-2`:`px-4`,Tn&&e!==`sheet`&&e!==`embedded`?`drag-region h-[var(--workspace-topbar-height)] border-b border-border wco:pr-(--workspace-native-controls-inset)`:`flex h-10 min-h-10 shrink-0 items-center border-b border-border/60 bg-background in-data-[preview-panel-mode=inline]:mb-3 in-data-[preview-panel-mode=inline]:h-7 in-data-[preview-panel-mode=inline]:min-h-7 in-data-[preview-panel-mode=inline]:border-b-transparent`)}function Do(e){let t=(0,Q.c)(10),n=Tn&&e.mode!==`sheet`&&e.mode!==`embedded`,r=e.mode===`inline`?`w-[42vw] min-w-[360px] max-w-[560px] shrink-0 border-l border-border`:`w-full`,i;t[0]===r?i=t[1]:(i=K(`flex h-full min-w-0 flex-col bg-background`,r),t[0]=r,t[1]=i);let a;t[2]!==e.header||t[3]!==e.mode||t[4]!==n?(a=n?(0,$.jsx)(`div`,{className:Eo(e.mode),children:e.header}):(0,$.jsx)(`div`,{className:Eo(e.mode),"data-surface-subheader":!0,children:e.header}),t[2]=e.header,t[3]=e.mode,t[4]=n,t[5]=a):a=t[5];let o;return t[6]!==e.children||t[7]!==i||t[8]!==a?(o=(0,$.jsxs)(`div`,{className:i,children:[a,e.children]}),t[6]=e.children,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function Oo(e){let t=(0,Q.c)(7),{titleWidth:n}=e,r,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(`div`,{className:`flex size-5 shrink-0 items-center justify-center`,children:(0,$.jsx)(En,{className:`size-2.5`})}),i=(0,$.jsx)(En,{className:`size-5 shrink-0`}),t[0]=r,t[1]=i):(r=t[0],i=t[1]);let a=n===`short`?`h-3 w-2/5 max-w-52`:n===`medium`?`h-3 w-1/2 max-w-64`:`h-3 w-3/5 max-w-72`,o;t[2]===a?o=t[3]:(o=(0,$.jsx)(En,{shape:`pill`,className:a}),t[2]=a,t[3]=o);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,$.jsx)(En,{shape:`pill`,className:`h-3 w-5`}),(0,$.jsx)(En,{shape:`pill`,className:`h-3 w-5`})]}),t[4]=s):s=t[4];let c;return t[5]===o?c=t[6]:(c=(0,$.jsxs)(`div`,{className:`flex h-8 items-center gap-2 px-2 pr-3`,children:[r,i,o,s]}),t[5]=o,t[6]=c),c}function ko(e){let t=(0,Q.c)(3),{width:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(En,{shape:`pill`,className:`h-2.5 w-5 shrink-0`}),t[0]=r):r=t[0];let i=n===`short`?`h-2.5 w-3/5`:n===`medium`?`h-2.5 w-2/3`:`h-2.5 w-4/5`,a;return t[1]===i?a=t[2]:(a=(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[r,(0,$.jsx)(En,{shape:`pill`,className:i})]}),t[1]=i,t[2]=a),a}function Ao(e){let t=(0,Q.c)(10),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(Oo,{titleWidth:`medium`}),t[0]=n):n=t[0];let r;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsxs)(`div`,{className:`flex h-6 items-center gap-2 px-2 pr-3`,children:[(0,$.jsx)(`div`,{className:`h-px flex-1 bg-border/40`}),(0,$.jsx)(En,{shape:`pill`,className:`h-2.5 w-24`}),(0,$.jsx)(`div`,{className:`h-px flex-1 bg-border/40`})]}),t[1]=r):r=t[1];let i,a,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsxs)(`div`,{className:`space-y-2 px-3 py-2`,children:[(0,$.jsx)(ko,{width:`medium`}),(0,$.jsx)(ko,{width:`long`}),(0,$.jsx)(ko,{width:`short`})]}),a=(0,$.jsx)(Oo,{titleWidth:`short`}),o=(0,$.jsx)(Oo,{titleWidth:`long`}),t[2]=i,t[3]=a,t[4]=o):(i=t[2],a=t[3],o=t[4]);let s;t[5]===e.label?s=t[6]:(s=(0,$.jsx)(`span`,{className:`sr-only`,children:e.label}),t[5]=e.label,t[6]=s);let c;return t[7]!==e.label||t[8]!==s?(c=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-hidden bg-background`,role:`status`,"aria-live":`polite`,"aria-label":e.label,children:[n,r,i,a,o,s]}),t[7]=e.label,t[8]=s,t[9]=c):c=t[9],c}function jo(e,t){typeof e==`function`?e(t):e!=null&&(e.current=t)}var Mo=typeof window>`u`?Z.useEffect:Z.useLayoutEffect;function No(e){return{instance:void 0,items:void 0,controlled:e,managedOptions:void 0,disableFlushSync:!1,slotCoordinator:void 0}}function Po(e,t){let{className:n,containerRef:r,disableWorkerPool:i=!1,editorOptions:a,getEditStateKey:o,initialItems:s,items:c,onItemEditChange:l,onItemEditComplete:u,onRevealSearchMatch:d,onScroll:f,onSelectedLinesChange:p,options:m,renderAnnotation:h,renderCodeViewFooter:g,renderCodeViewHeader:_,renderCustomHeader:v,renderGutterUtility:y,renderHeaderFilenameSuffix:b,renderHeaderMetadata:x,renderHeaderPrefix:S,selectedLines:C,style:w}=e,T=c!==void 0,E=on(),D=(0,Z.useContext)(an),O=(0,Z.useRef)(No(T)),k=v!=null,A=h!=null,j=y!=null,M=k||S!=null||b!=null||x!=null,N=M||A||j,P=_!=null,F=g!=null,I=rn(e=>{p?.(e)}),L=C!==void 0,R=rn((e,t,n)=>{if(E==null)throw Error(`CodeView: EditContext is not attached`);let r={...a,...t};return E(e,r,n)}),z=rn((e,t)=>{l?.(e,t)}),B=rn((e,t,n)=>u?.(e,t,n)??`reject`),V=rn(e=>{d?.(e)}),H=(0,Z.useMemo)(()=>Bo({options:m,hasCustomHeader:k,hasGutterRenderer:j,hasCodeViewHeader:P,hasCodeViewFooter:F,onSelectedLinesChange:p==null?void 0:I,controlledSelection:L,getEditStateKey:o,createEditor:E==null?void 0:R,onItemEditChange:l==null?void 0:z,onItemEditComplete:u==null?void 0:B,onRevealSearchMatch:d==null?void 0:V}),[E,L,R,z,B,V,I,F,P,k,j,o,l,u,d,p,m]),[ee]=(0,Z.useState)(()=>zo()),[,te]=(0,Z.useState)({}),ne=rn(e=>{O.current.instance!=null&&(e==null||e!==O.current.instance.getContainerElement())&&(O.current.instance.cleanUp(),ee.publish(void 0),O.current=No(T)),e!=null&&e!==O.current.instance?.getContainerElement()&&(O.current.instance=new fo(H,i?void 0:D,!0),O.current.instance.setup(e)),jo(r,e)}),U=rn(e=>{O.current.disableFlushSync?ee.publish(e):(0,To.flushSync)(()=>{ee.publish(e)})}),W=(0,Z.useMemo)(()=>{if(M||A||j||P||F)return{hasHeaderRenderers:M,hasAnnotationRenderer:A,hasGutterRenderer:j,onSnapshotChange:U}},[U,A,j,M,P,F]);return Mo(()=>f==null?void 0:O.current.instance?.subscribeToScroll(f)),Mo(()=>{let{instance:e,controlled:t,items:n,managedOptions:r,slotCoordinator:i}=O.current;if(e!=null)try{O.current.disableFlushSync=!0;let a=!1;if(en(H,r)||(O.current.managedOptions=H,e.setOptions(H),a=!0),t!==T){console.error(`CodeView: cannot switch between controlled and uncontrolled modes. Remount with a new key instead.`);return}if(T)c!==n&&(Lo(n,c)?O.current.items=c:Io(n,c)?(O.current.items=c,e.addItems(c.slice(n.length))):(O.current.items=c,e.setItems(c),a=!0));else if(n==null){let t=s??[];O.current.items=t,t.length>0&&(e.setItems(t),a=!0)}C!==void 0&&e.setSelectedLines(C,{notify:!1});let o=e.setSlotCoordinator(W),l=!1;W!==i&&((W==null||i==null)&&(l=!0),O.current.slotCoordinator=W),(a||o)&&e.render(!0),o&&W==null&&ee.publish(void 0),l&&te({})}finally{O.current.disableFlushSync=!1}}),(0,Z.useImperativeHandle)(t,()=>({addItems(e){let{controlled:t,instance:n}=O.current;Ro(t,`addItems`),n==null?console.error(`CodeView.addItems: no valid instance to append items with`,e):n.addItems(e)},getItem(e){let{instance:t}=O.current;if(t==null){console.error(`CodeView.getItem: no valid instance exists`,e);return}return t.getItem(e)},removeItem(e){let{controlled:t,instance:n}=O.current;return Ro(t,`removeItem`),n==null?(console.error(`CodeView.removeItem: no valid instance to remove item from`,e),!1):n.removeItem(e)},updateItem(e){let{controlled:t,instance:n}=O.current;return Ro(t,`updateItem`),n==null?(console.error(`CodeView.updateItem: no valid instance to update item with`,e),!1):n.updateItem(e)},updateItemId(e,t){let{controlled:n,instance:r}=O.current;return Ro(n,`updateItemId`),r==null?(console.error(`CodeView.updateItemId: no valid instance to update item id with`,e,t),!1):r.updateItemId(e,t)},scrollTo(e){let{instance:t}=O.current;t==null?console.error(`CodeView.scrollTo: no valid instance to scroll with`,e):t.scrollTo(e)},setSelectedLines(e){let{instance:t}=O.current;t==null?console.error(`CodeView.setSelectedLines: no valid instance to update selection with`,e):(t.setSelectedLines(e,{notify:!1}),I(e))},getSelectedLines(){let{instance:e}=O.current;return e==null?(console.error(`CodeView.getSelectedLines: no valid instance exists`),null):e.getSelectedLines()},clearSelectedLines(){let{instance:e}=O.current;e==null?console.error(`CodeView.clearSelectedLines: no valid instance to update selection with`):(e.clearSelectedLines({notify:!1}),I(null))},getEditor(e){let{instance:t}=O.current;if(t==null){console.error(`CodeView.getEditor: no valid instance exists`,e);return}return t.getEditor(e)},getInstance(){return O.current.instance}}),[I]),(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{ref:ne,className:n,style:w}),(N||P||F)&&(0,$.jsx)(Vo,{managedContentStore:ee,renderCustomHeader:v,renderHeaderPrefix:S,renderHeaderFilenameSuffix:b,renderHeaderMetadata:x,renderAnnotation:h,renderGutterUtility:y,renderCodeViewHeader:_,renderCodeViewFooter:g})]})}var Fo=(0,Z.forwardRef)(Po);function Io(e,t){if(e==null||t.length<=e.length)return!1;if(e.length===0)return!0;for(let n=0;n<e.length;n++)if(t[n]!==e[n])return!1;return!0}function Lo(e,t){if(e==null||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Ro(e,t){if(e)throw Error(`CodeView.${t} cannot be used when CodeView is controlled. Use initialItems for imperative item updates.`)}function zo(){let e,t=new Set;return{getSnapshot(){return e},publish(n){if(!Ea(e,n)){e=n;for(let e of t)e()}},subscribe(e){return t.add(e),()=>{t.delete(e)}}}}function Bo({options:e,hasCustomHeader:t,hasGutterRenderer:n,hasCodeViewHeader:r,hasCodeViewFooter:i,onSelectedLinesChange:a,controlledSelection:o,getEditStateKey:s,createEditor:c,onItemEditChange:l,onItemEditComplete:u,onRevealSearchMatch:d}){let f={...e,controlledSelection:o,onSelectedLinesChange:a,createEditor:c};return s!=null&&(f.getEditStateKey=s),l!=null&&(f.onItemEditChange=l),u!=null&&(f.onItemEditComplete=u),d!=null&&(f.onRevealSearchMatch=d),t&&(f.renderCustomHeader=Uo),n&&(f.renderGutterUtility=Uo),r&&(f.renderCodeViewHeader=Uo),i&&(f.renderCodeViewFooter=Uo),f}var Vo=(0,Z.memo)(function({managedContentStore:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,renderGutterUtility:o,renderCodeViewHeader:s,renderCodeViewFooter:c}){"use no memo";let l=rn(t=>e.subscribe(t)),u=rn(()=>e.getSnapshot()),d=(0,Z.useSyncExternalStore)(l,u,u),f=``;for(let e of d?.items??[])f+=`${e.id}:${e.version}:${e.type}`;let p=(0,Z.useMemo)(()=>d?.items?.map(e=>(0,To.createPortal)(Ho({renderedItem:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,renderGutterUtility:o}),e.element,e.id)),[t,n,r,i,a,o,f]),m=(0,Z.useMemo)(()=>s!=null&&d?.header!=null?(0,To.createPortal)(s(),d.header):null,[s,d?.header]),h=(0,Z.useMemo)(()=>c!=null&&d?.footer!=null?(0,To.createPortal)(c(),d.footer):null,[c,d?.footer]);return(0,$.jsxs)($.Fragment,{children:[p,m,h]})});function Ho({renderedItem:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,renderGutterUtility:o}){if(e.type===`diff`){let{item:s,instance:c}=e;return pn({fileDiff:s.fileDiff,renderCustomHeader:t==null?void 0:()=>t(s),renderHeaderPrefix:n==null?void 0:()=>n(s),renderHeaderFilenameSuffix:r==null?void 0:()=>r(s),renderHeaderMetadata:i==null?void 0:()=>i(s),renderAnnotation:a==null?void 0:e=>a(e,s),lineAnnotations:s.annotations,renderGutterUtility:o==null?void 0:e=>o(e,s),getHoveredLine:c.getHoveredLine,getAnnotationSlotName:c.getAnnotationSlotName})}{let{item:s,instance:c}=e;return un({file:s.file,renderCustomHeader:t==null?void 0:()=>t(s),renderHeaderPrefix:n==null?void 0:()=>n(s),renderHeaderFilenameSuffix:r==null?void 0:()=>r(s),renderHeaderMetadata:i==null?void 0:()=>i(s),renderAnnotation:a==null?void 0:e=>a(e,s),lineAnnotations:s.annotations,renderGutterUtility:o==null?void 0:e=>o(e,s),getHoveredLine:c.getHoveredLine,getAnnotationSlotName:c.getAnnotationSlotName})}}function Uo(){}var Wo=`${Wt}
24
+ `)?``:e}function qa(){if(Pa!=null)return Pa;if(typeof CSS<`u`&&`highlights`in CSS&&typeof Highlight<`u`)return Pa={match:new Highlight,focus:new Highlight},CSS.highlights.set(`diffs-search-match`,Pa.match),CSS.highlights.set(`diffs-search-focus`,Pa.focus),Pa}var Ja=`theme.disableLineNumbers.overflow.themeType.disableFileHeader.disableVirtualizationBuffers.preferredHighlighter.useCSSClasses.useTokenTransformer.tokenizeMaxLineLength.tokenizeMaxLength.unsafeCSS.diffStyle.diffIndicators.disableBackground.expandUnchanged.loadDiffFiles.parseDiffOptions.collapsedContextThreshold.lineDiffType.maxLineDiffLength.expansionLineCount.lineHoverHighlight.enableTokenInteractionsOnWhitespace.enableGutterUtility.__debugPointerEvents.enableLineSelection.controlledSelection.disableErrorHandling`.split(`.`),Ya=[`theme`,`disableLineNumbers`,`overflow`,`themeType`,`disableFileHeader`,`disableVirtualizationBuffers`,`preferredHighlighter`,`useCSSClasses`,`useTokenTransformer`,`tokenizeMaxLineLength`,`tokenizeMaxLength`,`unsafeCSS`,`lineHoverHighlight`,`enableTokenInteractionsOnWhitespace`,`enableGutterUtility`,`__debugPointerEvents`,`enableLineSelection`,`controlledSelection`,`disableErrorHandling`],Xa=[`renderCustomHeader`,`renderHeaderPrefix`,`renderHeaderFilenameSuffix`,`renderHeaderMetadata`,`renderAnnotation`,`renderGutterUtility`,`onPostRender`,`onGutterUtilityClick`,`onLineClick`,`onLineNumberClick`,`onLineEnter`,`onLineLeave`,`onTokenClick`,`onTokenEnter`,`onTokenLeave`],Za=[`onLineSelected`,`onLineSelectionStart`,`onLineSelectionChange`,`onLineSelectionEnd`],Qa=Symbol(`CodeView.itemOptionsState`);function $a(e,t){Object.defineProperty(e,Qa,{configurable:!1,enumerable:!1,value:t})}function eo(e){return e[Qa]}function to(e,t,n){Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get(){return n(this)}})}var no=120,ro=1,io=48,ao=`--diffs-overflow-override`;function oo(e,t,n){return{containerHeight:e,triggerTop:t,targetTop:n,targetBottom:e-n,threshold:e-t}}var so=oo(12e6,1e6,2e6),co=oo(2**22,5e5,1e6);function lo(e){if(e==null)throw Error(`CodeView: createEditor is required for items with edit: true`)}var uo=(()=>{let{navigator:e}=globalThis,t=e.userAgent,n=/iP(?:hone|ad|od)/.test(t),r=e.platform===`MacIntel`&&e.maxTouchPoints>1;return(n||r)&&/AppleWebKit/.test(t)&&/Safari/.test(t)&&!/(CriOS|FxiOS|EdgiOS|OPiOS)/.test(t)})(),fo=class e{static __STOP=!1;static __lastScrollPosition=0;type=`advanced`;config={overscrollSize:200,intersectionObserverMargin:0,resizeDebugging:!1};items=[];idToItem=new Map;selectedLines=null;itemEditors=new Map;attachedEditors=new Set;instanceToItem=new Map;layoutDirtyIndex;pendingLayoutReset;renderOptionsRevision=0;slotCoordinator;slotSnapshot;scrollListeners=new Set;scrollHeight=0;containerHeight=-1;scrollTop=0;scrollPageOffset=0;scrollRebaseConfig=Jt()?co:so;scrollDirty=!0;scrollInteractionFixTimer;pointerEventsDisabled=!1;codeOverflowFix=!1;height=0;heightDirty=!0;windowSpecs={top:0,bottom:0};renderState={scrollTop:-1,firstIndex:-1,lastIndex:-1,stickyHeight:0,stickyTop:-1,stickyBottom:-1};itemMetricsCache=Wt;fileOptionsPrototype;diffOptionsPrototype;pendingScrollTarget;pendingLayoutAnchor;shouldFixContainerFocus=!1;scrollAnimation;root;resizeObserver;container=document.createElement(`div`);stickyContainer=document.createElement(`div`);stickyOffset=document.createElement(`div`);header={element:void 0,render:void 0,height:0};footer={element:void 0,render:void 0,height:0};elementPool=[];elementPoolVersion=0;elementPoolTracker=new WeakMap;pendingElementPool=[];options;workerManager;isReadySubscription;pendingHighlighterTheme;isContainerManaged;search=new Fa(this);pendingSearchReveal;constructor(e={theme:Vt},t,n=!1){this.options=e,this.computeMetricsCache(e.itemMetrics),this.fileOptionsPrototype=this.createFileOptionsPrototype(),this.diffOptionsPrototype=this.createDiffOptionsPrototype(),this.workerManager=t,this.isContainerManaged=n,this.stickyOffset.style.contain=`layout size`,this.stickyContainer.style.position=`sticky`,this.stickyContainer.style.width=`100%`,this.stickyContainer.style.contain=`layout style inline-size`,this.stickyContainer.style.isolation=`isolate`,this.stickyContainer.style.display=`flex`,this.stickyContainer.style.flexDirection=`column`}getLayout(){return this.options.layout??Bt}getItemTopOffset(){return this.getLayout().paddingTop+this.header.height}computeMetricsCache(e){return this.itemMetricsCache={hunkLineCount:e?.hunkLineCount??Wt.hunkLineCount,lineHeight:e?.lineHeight??Wt.lineHeight,diffHeaderHeight:e?.diffHeaderHeight??Wt.diffHeaderHeight,hunkSeparatorHeight:e?.hunkSeparatorHeight,spacing:e?.spacing??Wt.spacing,paddingTop:e?.paddingTop,paddingBottom:e?.paddingBottom},this.itemMetricsCache}getSmoothScrollSettings(){return this.options.smoothScrollSettings??Pt}shouldDisablePointerEvents(){return this.options.pointerEventsOnScroll!==!0}shouldValidateItemHeights(){return zt&&this.options.__devOnlyValidateItemHeights===!0}validateRenderedItemHeight(e){if(!this.shouldValidateItemHeights()||e.element==null)return;let t=e.instance.getAdvancedStickySpecs();if(t==null)return;let n=t.height,r=e.element.getBoundingClientRect().height;n!==r&&console.error(`CodeView: reconciled item height does not match DOM height`,{id:e.item.id,type:e.type,index:e.index,version:e.version,expectedHeight:n,actualHeight:r,delta:r-n,stickyTopOffset:t.topOffset,virtualizedHeight:e.instance.getVirtualizedHeight(),top:e.top,scrollTop:this.getScrollTop(),windowSpecs:{...this.windowSpecs},element:e.element,instance:e.instance})}validateStickyContainerHeight(){if(!this.shouldValidateItemHeights())return;let{firstIndex:e,lastIndex:t,stickyHeight:n,stickyTop:r,stickyBottom:i}=this.renderState;if(e===-1||t===-1)return;let a=this.stickyContainer.getBoundingClientRect().height;Math.abs(a-n)<ro||console.error(`CodeView: sticky container height does not match computed layout`,{computedStickyHeight:n,actualStickyHeight:a,delta:a-n,stickyTop:r,stickyBottom:i,firstIndex:e,lastIndex:t,firstStickySpecs:this.items[e]?.instance.getAdvancedStickySpecs(),lastStickySpecs:this.items[t]?.instance.getAdvancedStickySpecs(),scrollTop:this.getScrollTop(),scrollPageOffset:this.scrollPageOffset,windowSpecs:{...this.windowSpecs},stickyContainer:this.stickyContainer})}clearScrollInteractionTimer(){this.scrollInteractionFixTimer!=null&&(clearTimeout(this.scrollInteractionFixTimer),this.scrollInteractionFixTimer=void 0)}suspendScrollInteractions(){this.clearScrollInteractionTimer(),this.shouldDisablePointerEvents()&&!this.pointerEventsDisabled&&(this.stickyContainer.style.pointerEvents=`none`,this.pointerEventsDisabled=!0),uo&&!this.codeOverflowFix&&(this.stickyContainer.style.setProperty(ao,`hidden`),this.codeOverflowFix=!0),this.scrollInteractionFixTimer=setTimeout(this.restoreScrollInteractions,no)}restoreScrollInteractions=()=>{this.clearScrollInteractionTimer(),this.pointerEventsDisabled&&=(this.stickyContainer.style.removeProperty(`pointer-events`),!1),this.codeOverflowFix&&=(this.stickyContainer.style.setProperty(ao,`auto`),!1)};syncLayout(){let{gap:e,paddingBottom:t,paddingTop:n}=this.getLayout();this.stickyContainer.style.gap=`${e}px`,this.container?.style.setProperty(`margin-top`,`${n}px`),this.container?.style.setProperty(`margin-bottom`,`${t}px`)}reconcileHeaderFooterHosts(){let e=this.reconcileHost(`header`),t=this.reconcileHost(`footer`);return e||t}reconcileHost(e){let{root:t,container:n}=this;if(t==null||n==null)return!1;let r=e===`header`?this.header:this.footer,i=e===`header`?this.options.renderCodeViewHeader:this.options.renderCodeViewFooter;if(i==null)return r.element!=null&&(this.resizeObserver?.unobserve(r.element),r.element.remove(),r.element=void 0,r.render=void 0,this.setHostHeight(r,0),!1);if(r.element!=null&&i===r.render)return!1;let a=r.element??Oa(e,n,this.resizeObserver);r.element=a;let o=i();return o==null?!this.isContainerManaged&&a.children.length>0&&(a.textContent=``):a.replaceChildren(o),r.render=i,!0}setHostHeight(e,t){e.height!==t&&(e.height=t,this.scrollDirty=!0)}measureMountedHosts(){this.header.element!=null&&this.setHostHeight(this.header,this.header.element.getBoundingClientRect().height),this.footer.element!=null&&this.setHostHeight(this.footer,this.footer.element.getBoundingClientRect().height)}setup(t){if(this.root!=null)throw Error(`CodeView.setup: already setup`);this.workerManager?.subscribeToThemeChanges(this),this.root=t,this.root.style.overflowAnchor=`none`,this.root.hasAttribute(`tabindex`)||(this.root.tabIndex=-1),this.container??=document.createElement(`div`),this.container.style.contain=`layout style`,this.syncLayout(),this.container.appendChild(this.stickyOffset),this.container.appendChild(this.stickyContainer),this.root.appendChild(this.container),this.scrollDirty=!0,this.heightDirty=!0,this.resizeObserver=new ResizeObserver(this.handleResize),this.resizeObserver.observe(this.stickyContainer),this.root.addEventListener(`scroll`,this.handleScroll,{passive:!0}),this.root.addEventListener(`wheel`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`touchstart`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`pointerdown`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`keydown`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`keydown`,this.search.handleKeyDown),this.resizeObserver.observe(this.root),this.render(!0),window.__INSTANCE=this,window.__TOGGLE=()=>{e.__STOP?(e.__STOP=!1,this.scrollTo({type:`position`,position:e.__lastScrollPosition,behavior:`instant`})):(e.__lastScrollPosition=this.getScrollTop(),e.__STOP=!0)}}reset(){Xt(this.computeRenderRangeAndEmit),this.clearReadySubscription(),this.restoreScrollInteractions(),this.cleanAllRenderedItems();let{items:e}=this,t=[...this.itemEditors.values()].map(e=>{let t=this.idToItem.get(e.state.id);return t!=null&&(e.state.removedItem=t.item),e});this.itemEditors.clear(),this.attachedEditors.clear(),this.selectedLines=null,this.items=[],this.idToItem.clear(),this.instanceToItem.clear();let n=!1,r;for(let e of t)try{e.editor.cleanUp(`discard`)}catch(e){n||(n=!0,r=e)}for(let t of e)try{t.instance.cleanUp()}catch(e){n||(n=!0,r=e)}if(this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,this.stickyContainer.textContent=``,this.stickyOffset.style.height=``,this.container?.style.removeProperty(`height`),this.containerHeight=-1,this.windowSpecs={top:0,bottom:0},this.pendingLayoutAnchor=void 0,this.shouldFixContainerFocus=!1,this.height=0,this.scrollTop=0,this.scrollPageOffset=0,this.scrollHeight=0,this.scrollDirty=!0,this.heightDirty=!0,this.resetRenderState(),this.isContainerManaged||this.flushSlotCoordinator(),this.search.refresh(),n)throw r}cleanUp(){let e=!1,t;try{this.reset()}catch(n){e=!0,t=n}if(this.clearElementPool(),this.restoreScrollInteractions(),this.workerManager?.unsubscribeToThemeChanges(this),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.root?.removeEventListener(`scroll`,this.handleScroll),this.root?.removeEventListener(`wheel`,this.clearPendingScroll),this.root?.removeEventListener(`touchstart`,this.clearPendingScroll),this.root?.removeEventListener(`pointerdown`,this.clearPendingScroll),this.root?.removeEventListener(`keydown`,this.clearPendingScroll),this.root?.removeEventListener(`keydown`,this.search.handleKeyDown),this.search.cleanUp(),this.root?.style.removeProperty(`overflow-anchor`),this.container?.remove(),this.stickyOffset.remove(),this.stickyContainer.remove(),this.stickyContainer.textContent=``,this.header.element?.remove(),this.header.element=void 0,this.header.render=void 0,this.header.height=0,this.footer.element?.remove(),this.footer.element=void 0,this.footer.render=void 0,this.footer.height=0,this.root=void 0,this.container=void 0,e)throw t}cleanAllRenderedItems(){if(this.renderState.firstIndex!==-1)for(let e=this.renderState.firstIndex;e<=this.renderState.lastIndex;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.cleanAllRenderedItems: Item does not exist at index: ${e}`);this.releaseRenderedItem(t)}}primeScrollTarget(e){e.type!==`position`&&this.idToItem.get(e.id)?.instance.primeHighlightCache()}getElementPoolLimit(){let e=this.getHeight()+this.config.overscrollSize*2,{diffHeaderHeight:t}=this.itemMetricsCache;return Math.max(8,Math.ceil(e/Math.max(t,10))+1)*(this.isContainerManaged?2:1)}acquireElement(){this.promotePendingPooledElements();let e=this.elementPool.pop();for(;e!=null&&!this.isElementPoolGenerationCurrent(e);)e=this.elementPool.pop();return e??=document.createElement(Lt),this.markElementPoolGenerationCurrent(e),e}releaseRenderedItem(e){let{element:t}=e;t!=null&&this.renderedItemOwnsFocus(t)&&(this.shouldFixContainerFocus=!0),e.instance.cleanUp(!0),this.attachedEditors.delete(e.item.id),e.element=void 0,t!=null&&(t.remove(),this.cleanElement(t),this.queueElementForPool(t))}renderedItemOwnsFocus(e){let{activeElement:t}=document;return t===e||e.contains(t)||e.shadowRoot?.activeElement!=null}fixContainerFocus(){this.shouldFixContainerFocus&&(this.shouldFixContainerFocus=!1,this.root?.focus({preventScroll:!0}))}cleanElement(e){let{shadowRoot:t}=e;if(t!=null)for(let e of Array.from(t.children))vo(e)||e.remove();this.isContainerManaged||e.replaceChildren()}queueElementForPool(e){let t=this.getElementPoolLimit();!this.isElementPoolGenerationCurrent(e)||this.getElementPoolSize()>=t||(this.isElementClean(e)?this.elementPool.push(e):this.pendingElementPool.push(e))}promotePendingPooledElements(){if(this.pendingElementPool.length===0)return;let{pendingElementPool:e}=this;this.pendingElementPool=[];let t=this.getElementPoolLimit();for(let n of e)this.isElementPoolGenerationCurrent(n)&&this.isElementClean(n)&&this.elementPool.length<t?this.elementPool.push(n):this.isElementPoolGenerationCurrent(n)&&this.getElementPoolSize()<t&&this.pendingElementPool.push(n)}isElementClean(e){return e.childNodes.length===0}getElementPoolSize(){return this.elementPool.length+this.pendingElementPool.length}clearElementPool(){this.elementPool.length=0,this.pendingElementPool.length=0}invalidateElementPool(){this.elementPoolVersion++,this.clearElementPool()}markElementPoolGenerationCurrent(e){this.elementPoolTracker.set(e,this.elementPoolVersion)}isElementPoolGenerationCurrent(e){return this.elementPoolTracker.get(e)===this.elementPoolVersion}resolveEffectiveScrollBehavior(e,t){return Ta()?`instant`:e.behavior===`smooth-auto`?Math.abs(t-this.getScrollTop())<=this.getHeight()*10?`smooth`:`instant`:e.behavior??`instant`}scrollTo(e){if(this.root==null)return;let t=this.normalizeScrollTarget(e);if(t==null)return;let n=this.resolveScrollTargetTop(t);n!=null&&(this.primeScrollTarget(t),this.resolveEffectiveScrollBehavior(t,n)===`smooth`?this.scrollAnimation??={position:this.getScrollTop(),velocity:0,lastTimestamp:performance.now()}:this.scrollAnimation=void 0,this.suspendScrollInteractions(),this.pendingLayoutAnchor=void 0,this.pendingScrollTarget=t,this.render())}setSelectedLines(e,t){this.applySelectedLines(e,t)}getSelectedLines(){return this.selectedLines}clearSelectedLines(e){this.applySelectedLines(null,e)}getItem(e){return this.idToItem.get(e)?.item}openSearch(){this.search.open()}closeSearch(){this.search.close()}getSearchItems(){return this.items.map(e=>e.item)}getFirstVisibleSearchMatchIndex(e){if(this.items.length===0)return 0;let t=this.getScrollTop()-this.getItemTopOffset()+this.getStickyHeaderOffset(),n=this.findFirstVisibleIndex(Math.max(this.getScrollTop()-this.getItemTopOffset(),0)),r=this.items[n];for(let i=0;i<e.length;i++){let a=e[i];if(a.itemIndex<n)continue;if(a.itemIndex>n)return i;let o=this.getLineScrollPosition(r,a);if(o==null||r.top+o.top>=t)return i}return 0}revealSearchMatch(e,t=!1){let n=this.idToItem.get(e.id);if(n==null||n.type!==`diff`)return;if(n.item.collapsed===!0){if(this.options.onRevealSearchMatch==null){this.scrollTo({type:`item`,id:e.id,align:`start`});return}this.pendingSearchReveal=e,this.options.onRevealSearchMatch(n.item);return}let r={type:`line`,id:e.id,lineNumber:e.lineNumber,side:e.side,align:`center`,offset:-(this.getStickyHeaderOffset()+io)/2},i=n.instance.getRenderedDiff()!=null;if(this.pendingSearchReveal=i?void 0:e,i&&e.side===`additions`&&!n.instance.isLineRenderable(e.lineNumber))n.instance.revealLine(e.lineNumber);else if(i&&!t&&this.isScrollTargetInView(r))return;this.scrollTo(r)}cancelSearchReveal(){this.pendingSearchReveal=void 0}resumePendingSearchReveal(e){let t=this.pendingSearchReveal;if(t!=null){for(let n of e)if(n.item.id===t.id&&n.item.collapsed!==!0&&n.instance.getRenderedDiff()!=null){queueMicrotask(()=>{this.pendingSearchReveal===t&&this.revealSearchMatch(t,!0)});return}}}revealSearchMatchHorizontally(e,t){let n=this.idToItem.get(e.id),r=t.closest(`[data-code]`);if(n==null||r==null||r.scrollWidth<=r.clientWidth)return;let i=r.getBoundingClientRect(),a=po(t,e.start,e.end);if(a==null)return;let o=r.querySelector(`:scope > [data-gutter]`)?.getBoundingClientRect().right,s=o!=null&&o>i.left?o:i.left,c=r.scrollLeft;if(a.left<s+24)c-=s+24-a.left;else if(a.right>i.right-24)c+=a.right-(i.right-24);else return;n.instance.setCodeScrollLeft(Math.max(0,c))}isScrollTargetInView(e){let t=this.getScrollTargetRect(e);if(t==null)return!1;let n=this.getItemTopOffset()+t.top,r=this.getScrollTop();return n>=r+this.getStickyHeaderOffset()+io&&n+t.height<=r+this.getHeight()}getMountedSearchMatches(e){let t=[],{firstIndex:n,lastIndex:r}=this.renderState;if(n===-1)return t;for(let i=n;i<=r;i++){let n=e.get(i),r=n==null?void 0:this.items[i]?.element?.shadowRoot;if(r==null)continue;let a=new Map;for(let e of r.querySelectorAll(`[data-line][data-line-index]`)){let t=e.getAttribute(`data-line-index`).split(`,`)[0],n=e.closest(`[data-deletions]`)==null?`additions`:`deletions`;a.set(`${n}:${t}`,e)}for(let e of n){let n=a.get(`additions:${e.unifiedLineIndex}`),r=a.get(`deletions:${e.unifiedLineIndex}`),i=e.side===`deletions`?[r??n]:e.isContext?[n,r]:[n];for(let n of i)n!=null&&t.push({entry:e,element:n})}}return t}getEditor(e){return this.itemEditors.get(e)?.editor}updateItem(e){let t=this.idToItem.get(e.id);return t==null?(console.error(`CodeView.updateItem: unknown item id "${e.id}"`),!1):this.syncItemRecord(t,e)?(this.markItemLayoutDirty(t),this.scrollDirty=!0,this.render(),this.syncItemEditors(),this.syncSelection(),this.search.refresh(),!0):!1}updateItemId(e,t){if(e===t)return!0;let n=this.idToItem.get(e);if(n==null)return console.error(`CodeView.updateItemId: unknown item id "${e}"`),!1;if(this.idToItem.has(t))return console.error(`CodeView.updateItemId: duplicate item id "${t}"`),!1;this.idToItem.delete(e),n.item.id=t,this.idToItem.set(t,n),this.updateItemOptionsId(n.instance.options,t),this.selectedLines?.id===e&&(this.selectedLines={...this.selectedLines,id:t},this.options.onSelectedLinesChange?.(this.selectedLines));let r=this.itemEditors.get(e);return r!=null&&(this.itemEditors.delete(e),this.itemEditors.set(t,r),this.attachedEditors.delete(e)&&this.attachedEditors.add(t)),this.renamePendingScrollTarget(e,t),this.renamePendingLayoutAnchor(e,t),this.render(),this.search.refresh(),!0}addItem(e){this.addItems([e])}addItems(e){this.appendItemsInternal(e),this.syncItemEditors(),this.syncSelection(),this.search.refresh()}removeItem(e){let t=this.idToItem.get(e);if(t==null)return console.error(`CodeView.removeItem: unknown item id "${e}"`),!1;let n=[];for(let e of this.items)e!==t&&n.push(e.item);return this.setItems(n),!0}setItems(e){let t;this.items.length===0?this.appendItemsInternal(e):this.tryAppendItems(e)||(t=this.reconcileItems(e));try{this.syncItemEditors(t)}finally{for(let e of t?.values()??[])e.instance.cleanUp()}this.syncSelection(),this.search.refresh()}appendItemsInternal(e,t=!0){if(e.length===0)return;let n=this.getLayout(),r=this.items.length===0?0:this.scrollHeight+n.gap,i=r;for(let t=0;t<e.length;t++){let i=e[t];if(i==null)throw Error(`CodeView.appendItemsInternal: missing input item`);if(this.idToItem.has(i.id))throw Error(`CodeView.addItem: duplicate id "${i.id}"`);let a=this.createItem(i,this.items.length,r);this.items.push(a),this.idToItem.set(a.item.id,a),this.instanceToItem.set(a.instance,a),a.height=mo(a),r+=a.height+n.gap}this.scrollHeight=r-n.gap,this.scrollDirty=!0,t&&(this.canSkipRenderForAppend(i)?this.syncContainerHeight():this.render())}canSkipRenderForAppend(e){return this.container!=null&&this.renderState.firstIndex!==-1&&this.pendingScrollTarget==null&&this.scrollAnimation==null&&this.layoutDirtyIndex==null&&e>this.windowSpecs.bottom}onThemeChange(){this.invalidateElementPool()}setOptions(e){if(e==null)return;this.capturePendingLayoutAnchor();let{options:t}=this,n=this.getLayout(),{itemMetricsCache:r}=this;ho(t,e)&&this.invalidateElementPool(),this.options=e;let i=this.computeMetricsCache(e.itemMetrics),a=!tn(r,i),o=!tn(n,this.getLayout());o&&this.syncLayout();let s=a||go(t,e);if(s){let n=this.pendingLayoutReset;this.pendingLayoutReset={metrics:a?i:n?.metrics,resetFileLayoutCache:!0,resetDiffLayoutCache:!0,includeEstimatedDiffHeights:n?.includeEstimatedDiffHeights===!0||a||_o(t,e)}}(o||s)&&(this.markLayoutDirtyFromIndex(0),this.scrollDirty=!0),$t(t,e)||this.renderOptionsRevision++,this.syncItemEditors();let c=t.renderCodeViewHeader!==e.renderCodeViewHeader||t.renderCodeViewFooter!==e.renderCodeViewFooter;!this.isContainerManaged&&(this.items.length>0||c)&&this.render()}capturePendingLayoutAnchor(e=this.idToItem){this.root!=null&&this.items.length!==0&&this.pendingScrollTarget==null&&(this.pendingLayoutAnchor=this.getScrollAnchor(this.getScrollTop(),e))}render(t=!1){e.__STOP||(t?(Xt(this.computeRenderRangeAndEmit),this.computeRenderRangeAndEmit()):Qt(this.computeRenderRangeAndEmit))}isReady(){let{workerManager:e}=this;return e==null||e.getStats().workersFailed?this.isSharedHighlighterReady():e.isInitialized()?(this.clearReadySubscription(),!0):(this.isReadySubscription??=e.subscribeToStatChanges(e=>{(e.managerState===`initialized`||e.workersFailed)&&(this.clearReadySubscription(),this.render(!0))}),e.getStats().managerState===`waiting`&&e.initialize().catch(()=>{}),!1)}clearReadySubscription(){this.isReadySubscription!=null&&(this.isReadySubscription(),this.isReadySubscription=void 0,this.pendingHighlighterTheme=void 0)}isSharedHighlighterReady(){let e=this.workerManager?.getFileRenderOptions().theme??this.options.theme??Vt;return Nt()&&jt(e)?(this.clearReadySubscription(),!0):(sn(this.pendingHighlighterTheme,e)||this.clearReadySubscription(),this.isReadySubscription??=(()=>{this.pendingHighlighterTheme=e;let t=!1;return Kt({themes:qt(e),langs:[],preferredHighlighter:this.options.preferredHighlighter}).then(()=>{t||(this.clearReadySubscription(),this.render(!0))},e=>{t||(this.clearReadySubscription(),console.error(e))}),()=>{t=!0}})(),!1)}instanceChanged(e,t){let n=this.instanceToItem.get(e);if(n==null)throw Error(`CodeView.instanceChanged: An instance has changed that is not registered`);t&&this.markItemLayoutDirty(n),this.render()}getWindowSpecs(){return this.windowSpecs}getContainerElement(){return this.root}getHeaderElement(){return this.header.element}getFooterElement(){return this.footer.element}getRenderedItems(){let{firstIndex:e,lastIndex:t}=this.renderState;if(e===-1||t===-1||t<e)return[];let n=[];for(let r=e;r<=t;r++){let e=this.items[r];e?.element!=null&&(e.type===`diff`?n.push({id:e.item.id,type:`diff`,item:e.item,version:e.version,element:e.element,instance:e.instance}):n.push({id:e.item.id,type:`file`,item:e.item,version:e.version,element:e.element,instance:e.instance}))}return n}setSlotCoordinator(e){return e!==this.slotCoordinator&&(this.slotCoordinator=e,this.slotSnapshot=void 0,!0)}getSlotSnapshot(e){return this.buildSlotSnapshot(e)}buildSlotSnapshot(e){let t=wo(this.getRenderedItems(),e),{element:n}=this.header,{element:r}=this.footer;if(t!=null||n!=null||r!=null)return{items:t,header:n,footer:r}}subscribeToScroll(e){return this.scrollListeners.add(e),()=>{this.scrollListeners.delete(e)}}getLocalTopForInstance(e){let t=this.instanceToItem.get(e);if(t==null)throw Error(`CodeView.getLocalTopForInstance: unknown virtualized instance`);return t.top}getTopForItem(e){let t=this.idToItem.get(e);if(t!=null)return t.top+this.getItemTopOffset()}createItem(e,t,n){let{itemMetricsCache:r}=this;if(e.type===`diff`){let i=new pn(this.createDiffOptions(e.id),this,r,this.workerManager,this.isContainerManaged);return{type:`diff`,item:e,version:e.version,index:t,top:n,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:i}}let i=new cn(this.createFileOptions(e.id),this,r,this.workerManager,this.isContainerManaged);return{type:`file`,item:e,version:e.version,index:t,top:n,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:i}}applySelectedLines(e,t){let{selectedLines:n}=this;e==null&&n==null||e!=null&&n?.id===e.id&&Zt(n.range,e.range)||(n!=null&&n.id!==e?.id&&this.idToItem.get(n.id)?.instance.setSelectedLines(null,{notify:!1}),this.selectedLines=e,this.idToItem.get(e?.id??``)?.instance.setSelectedLines(e?.range??null,t))}syncSelection(){if(this.selectedLines==null)return;let e=this.idToItem.get(this.selectedLines.id);if(e==null){this.selectedLines=null,this.options.onSelectedLinesChange?.(null);return}e.instance.setSelectedLines(this.selectedLines.range,{notify:!1})}isItemInEditMode(e){return e.item.edit===!0&&e.item.collapsed!==!0}attachItemEditor(e){let{id:t}=e.item,{createEditor:n}=this.options;if(e.element==null||this.attachedEditors.has(t)||!this.isItemInEditMode(e))return;let r=this.itemEditors.get(t),i;try{if(r==null&&e.type===`diff`&&!e.instance.__canAttachEditor()){e.instance.__prepareForEditing();return}if(r==null){lo(n);let r=eo(e.instance.options);if(r==null)throw Error(`CodeView.attachItemEditor: instance options are missing their state`);let a=e=>{let t=this.idToItem.get(r.id);t!=null&&this.options.onItemEditChange?.(e,t.item)},o=this.options.getEditStateKey?.(e.item);if(e.type===`diff`){let s=n(`file-diff`,{onChange:a},o);i=s,this.itemEditors.set(t,{editor:s,state:r,dispose:s.edit(e.instance)})}else{let s=n(`file`,{onChange:a},o);i=s,this.itemEditors.set(t,{editor:s,state:r,dispose:s.edit(e.instance)})}}else r.dispose=(e.type,r.editor.edit(e.instance));this.attachedEditors.add(t)}catch(t){throw i?.cleanUp(),this.releaseRenderedItem(e),t}}syncItemEditors(e){if(this.itemEditors.size===0)return;let t=[];for(let[n,r]of this.itemEditors){let i=this.idToItem.get(n),a=e?.get(n);if(a==null&&i!=null){let{edit:e=!1,collapsed:t=!1}=i.item;if(e){t&&this.attachedEditors.delete(n)&&r.editor.cleanUp(`recycle`);continue}}else a!=null&&(r.state.removedItem=a.item);this.itemEditors.delete(n),this.attachedEditors.delete(n),t.push(r)}if(t.length===0)return;let n=!1,r;for(let e of t){try{e.dispose()}catch(e){n||(n=!0,r=e)}let t=this.idToItem.get(e.state.id);t!=null&&this.markItemLayoutDirty(t)}if(this.render(),n)throw r}requireItemFromState(e){let t=this.idToItem.get(e.id)?.item??e.removedItem;if(t==null)throw Error(`CodeView.onItemEditComplete: unknown item "${e.id}"`);return t}completeFileItemEdit(e,t){let n=this.requireItemFromState(e);if(n.type!==`file`)throw Error(`CodeView.onItemEditComplete: item "${e.id}" is not a file item`);let r={...n,file:t.file,annotations:t.lineAnnotations,edit:!1,version:(n.version??0)+1};return(this.options.onItemEditComplete?.(t,n,r)??`reject`)===`reject`?`reject`:(this.idToItem.has(n.id)&&this.updateItem(r),`accept`)}completeDiffItemEdit(e,t){let n=this.requireItemFromState(e);if(n.type!==`diff`)throw Error(`CodeView.onItemEditComplete: item "${e.id}" is not a diff item`);let r={...n,fileDiff:t.fileDiff,annotations:t.lineAnnotations,edit:!1,version:(n.version??0)+1};return(this.options.onItemEditComplete?.(t,n,r)??`reject`)===`reject`?`reject`:(this.idToItem.has(n.id)&&this.updateItem(r),`accept`)}renamePendingScrollTarget(e,t){let{pendingScrollTarget:n}=this;n!=null&&n.type!==`position`&&n.id===e&&(this.pendingScrollTarget={...n,id:t})}renamePendingLayoutAnchor(e,t){this.pendingLayoutAnchor?.id===e&&(this.pendingLayoutAnchor.id=t)}createFileOptionsPrototype(){let e={};for(let t of Ya)to(e,t,()=>this.options[t]);to(e,`stickyHeader`,()=>this.options.stickyHeaders),to(e,`collapsed`,e=>{let t=eo(e);if(t!=null)return this.getItemOptions(t,`file`)?.item.collapsed}),to(e,`onEditComplete`,e=>{if(this.options.onItemEditComplete==null)return;let t=eo(e);if(t!=null)return e=>this.completeFileItemEdit(t,e)});for(let t of Xa)this.defineItemSharedCallback(e,`file`,t);for(let t of Za)this.defineItemSelectionCallback(e,`file`,t);return e}createDiffOptionsPrototype(){let e={};for(let t of Ja)to(e,t,()=>this.options[t]);to(e,`stickyHeader`,()=>this.options.stickyHeaders),to(e,`hunkSeparators`,()=>this.options.hunkSeparators),to(e,`collapsed`,e=>{let t=eo(e);if(t!=null)return this.getItemOptions(t,`diff`)?.item.collapsed}),to(e,`onEditComplete`,e=>{if(this.options.onItemEditComplete==null)return;let t=eo(e);if(t!=null)return e=>this.completeDiffItemEdit(t,e)});for(let t of Xa)this.defineItemSharedCallback(e,`diff`,t);for(let t of Za)this.defineItemSelectionCallback(e,`diff`,t);return e}createFileOptions(e){let t=Object.create(this.fileOptionsPrototype);return $a(t,{id:e}),t}createDiffOptions(e){let t=Object.create(this.diffOptionsPrototype);return $a(t,{id:e}),t}updateItemOptionsId(e,t){let n=eo(e);if(n==null)throw Error(`CodeView.updateItemOptionsId: No valid state`);n.id=t}getItemOptions(e,t){let n=this.idToItem.get(e.id);if(n!=null&&n.type===t)return n}defineItemSharedCallback(e,t,n){to(e,n,e=>{if(this.options[n]==null)return;let r=eo(e);if(r==null)return;let i=r.callbackCache??={},a=i[n];return a??(a=((...e)=>{let i=this.getItemOptions(r,t);if(i==null)return;let a=this.options[n];return a?.(...e,i)}),i[n]=a),a})}defineItemSelectionCallback(e,t,n){to(e,n,e=>{let r=eo(e);if(r==null)return;let i=r.callbackCache??={},a=i[n];return a??(a=e=>{let i=this.getItemOptions(r,t);if(i==null)return;let a=e==null?null:{id:i.item.id,range:e};this.options.controlledSelection!==!0&&(e!=null||this.selectedLines?.id===i.item.id)&&this.applySelectedLines(a,{notify:!1}),this.options.onSelectedLinesChange?.(a);let o=this.options[n];return o?.(e,i)},i[n]=a),a})}markLayoutDirtyFromIndex(e){this.layoutDirtyIndex=Math.min(this.layoutDirtyIndex??e,e)}markItemLayoutDirty(e){if(this.items[e.index]!==e)throw Error(`CodeView.markItemLayoutDirty: unknown item id "${e.item.id}"`);this.markLayoutDirtyFromIndex(e.index)}tryAppendItems(e){if(e.length<=this.items.length)return!1;for(let t=0;t<this.items.length;t++){let n=this.items[t];if(n==null)throw Error(`CodeView.tryAppendItems: missing existing item`);let r=e[t];if(r==null||n.item.id!==r.id||n.type!==r.type)return!1}for(let t=0;t<this.items.length;t++){let n=this.items[t];if(n==null)throw Error(`CodeView.tryAppendItems: missing existing item`);let r=e[t];if(r==null)throw Error(`CodeView.tryAppendItems: append candidate missing prefix item`);this.syncItemRecord(n,r)&&this.markLayoutDirtyFromIndex(t)}return this.appendItemsInternal(e.slice(this.items.length),!1),this.scrollDirty=!0,this.render(),!0}reconcileItems(e){let{items:t,idToItem:n}=this,r=new Set(t),i=[],a=new Map,o=new Map,s=new Map,c;for(let s=0;s<e.length;s++){let l=e[s];if(l==null)throw Error(`CodeView.reconcileItems: missing input item`);if(a.has(l.id))throw Error(`CodeView.setItems: duplicate id "${l.id}"`);let u=n.get(l.id),d=u!=null&&u.type===l.type?u:this.createItem(l,s,0);d.index=s,u!=null&&u.type===l.type?(r.delete(u),this.syncItemRecord(d,l)&&(c=Math.min(c??s,s))):c=Math.min(c??s,s),t[s]!==d&&(c=Math.min(c??s,s)),i.push(d),a.set(l.id,d),o.set(d.instance,d)}if(c==null){if(r.size===0)return;c=Math.max(i.length-1,0)}this.capturePendingLayoutAnchor(a);for(let e=0;e<t.length;e++){let n=t[e];if(n==null||!r.has(n))continue;s.set(n.item.id,n),this.releaseRenderedItem(n);let a=Math.max(i.length-1,0);c=Math.min(c??a,a)}return this.items=i,this.idToItem=a,this.instanceToItem=o,this.renderState.firstIndex>=i.length?this.resetRenderState():this.renderState.lastIndex>=i.length&&(this.renderState.lastIndex=i.length-1),this.markLayoutDirtyFromIndex(c),this.scrollDirty=!0,this.render(),s.size>0?s:void 0}syncItemRecord(e,t){if(e.type!==t.type)throw Error(`CodeView.syncItemRecord: type mismatch for id "${t.id}"`);if(e.version===t.version)return!1;e.item=t,e.version=t.version,e.renderedOptionsRevision=-1;let n=this.pendingSearchReveal;return n!=null&&n.id===t.id&&t.collapsed!==!0&&queueMicrotask(()=>{this.pendingSearchReveal===n&&this.revealSearchMatch(n,!0)}),!0}getMaxScrollTopForHeight(e){let{paddingBottom:t,paddingTop:n}=this.getLayout();return Math.max(n+this.header.height+e+this.footer.height+t-this.getHeight(),0)}getMaxScrollTop(){return this.getMaxScrollTopForHeight(this.getScrollHeight())}shouldRebaseScroll(){return this.getMaxScrollTop()>this.scrollRebaseConfig.threshold}getPagedScrollHeight(){return this.shouldRebaseScroll()?Math.min(this.getScrollHeight(),this.scrollRebaseConfig.containerHeight):this.getScrollHeight()}getMaxPagedScrollTop(){return this.getMaxScrollTopForHeight(this.getPagedScrollHeight())}clampPagedScrollTop(e){let t=this.getMaxPagedScrollTop();return Math.max(0,Math.min(e,t))}clampScrollTop(e){let t=this.getMaxScrollTop();return Math.max(0,Math.min(e,t))}getMaxScrollPageOffset(){return Math.max(this.getMaxScrollTop()-this.getMaxPagedScrollTop(),0)}clampScrollPageOffset(e){let t=this.getMaxScrollPageOffset();return Math.max(0,Math.min(e,t))}resolveScrollPageWindow(e,t){let n=ka(this.clampPagedScrollTop(t)),r=this.clampScrollPageOffset(e-n);return n=ka(this.clampPagedScrollTop(e-r)),r=this.clampScrollPageOffset(e-n),{pagedScrollTop:n,scrollPageOffset:r}}resolvePagedScrollPosition(e){if(!this.shouldRebaseScroll())return{pagedScrollTop:this.clampPagedScrollTop(e),scrollPageOffset:0};let{scrollPageOffset:t,scrollRebaseConfig:n}=this,r=this.clampScrollPageOffset(t),i=e-r,a=this.getMaxPagedScrollTop(),o=this.getMaxScrollPageOffset(),s=i>n.threshold&&r<o,c=i<n.triggerTop&&r>0;return i<0||i>a||s||c?this.resolveScrollPageWindow(e,c?Math.min(n.targetBottom,a):n.targetTop):{pagedScrollTop:ka(this.clampPagedScrollTop(i)),scrollPageOffset:r}}needsScrollPageUpdate(e){let t=ka(this.clampScrollTop(e)),{scrollPageOffset:n}=this.resolvePagedScrollPosition(t);return n!==this.scrollPageOffset}getPagedLayoutTop(e){return this.shouldRebaseScroll()?Math.max(e-this.scrollPageOffset,0):e}getStickyHeaderOffset(){return this.options.stickyHeaders===!0&&this.options.disableFileHeader!==!0?this.itemMetricsCache.diffHeaderHeight:0}getScrollTargetRect(e){let t=this.idToItem.get(e.id);if(t==null){console.warn(`CodeView.scrollTo: unknown item id "${e.id}"`);return}if(e.type===`item`)return{top:t.top,height:t.height};if(e.type===`range`){let n=this.getRangeScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve range ${yo(e.range)} for item "${e.id}"`);return}return{top:t.top+n.top,height:n.height}}let n=this.getLineScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve line ${e.lineNumber} for item "${e.id}"`);return}return{top:t.top+n.top,height:n.height}}normalizeScrollTarget(e){if(e.type===`position`||e.align!==`nearest`)return e;let t=this.getScrollTargetRect(e);if(t==null)return;let n=e.offset??0,r=this.getItemTopOffset()+t.top,i=r+t.height,a=this.getScrollTop(),o=a+(e.type===`line`||e.type===`range`?this.getStickyHeaderOffset():0),s=a+this.getHeight();if(!(r-n<=o&&i+n>=s)){if(r-n<o)return{...e,align:`start`};if(i+n>s)return{...e,align:`end`}}}resolveScrollTargetTop(e){if(e.type===`position`){let t=this.clampScrollTop(e.position);return t===e.position?this.clampScrollTop(e.position-this.getStickyHeaderOffset()):t}let t=this.idToItem.get(e.id);if(t==null){console.warn(`CodeView.scrollTo: unknown item id "${e.id}"`);return}if(e.type===`item`)return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top,t.height,e.align,e.offset));if(e.type===`range`){let n=this.getRangeScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve range ${yo(e.range)} for item "${e.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top+n.top,n.height,e.align,e.offset,this.getStickyHeaderOffset()))}let n=this.getLineScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve line ${e.lineNumber} for item "${e.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top+n.top,n.height,e.align,e.offset,this.getStickyHeaderOffset()))}resolveAlignedScrollPosition(e,t,n,r=0,i=0){e+=this.getItemTopOffset();let a=this.getHeight();return n===`center`&&t+r<a?e-(a-t)/2+r:n===`end`?e-(a-t)+r:e-i-r}getLineScrollPosition(e,t){return e.type===`diff`?e.instance.getLinePosition(t.lineNumber,t.side):e.instance.getLinePosition(t.lineNumber)}getRangeScrollPosition(e,t){let{range:n}=t,r=this.getLineScrollPosition(e,{type:`line`,id:t.id,lineNumber:n.start,side:n.side}),i=this.getLineScrollPosition(e,{type:`line`,id:t.id,lineNumber:n.end,side:n.endSide??n.side});if(r==null||i==null)return;let a=r.top,o=a+r.height,s=i.top,c=s+i.height,l=Math.min(a,s);return{top:l,height:Math.max(o,c)-l}}computeTargetScrollTopForFrame(e,t){if(this.pendingScrollTarget==null)return e;let n=this.resolveScrollTargetTop(this.pendingScrollTarget);if(n==null)return e;let{scrollAnimation:r}=this;return r==null?n:this.computeSpringStep(r,n,t).position}computeSpringStep(e,t,n){let r=Math.max(0,n-e.lastTimestamp),{omega:i}=this.getSmoothScrollSettings(),a=Math.exp(-i*r),o=e.position-t,s=e.velocity+i*o;return{position:t+(o+s*r)*a,velocity:(s*(1-i*r)-i*o)*a}}advanceScrollAnimation(e,t){if(this.pendingScrollTarget==null)return;let n=this.resolveScrollTargetTop(this.pendingScrollTarget);if(n==null){this.pendingScrollTarget=void 0,this.scrollAnimation=void 0;return}let r=this.scrollAnimation;if(r==null)return n;r.position+=t;let{position:i,velocity:a}=this.computeSpringStep(r,n,e);r.lastTimestamp=e,r.position=i,r.velocity=a;let{positionEpsilon:o,velocityEpsilon:s}=this.getSmoothScrollSettings();return Math.abs(n-i)<=o&&Math.abs(a)<=s?(r.position=n,r.velocity=0,this.scrollAnimation=void 0,n):r.position}computeRenderRangeAndEmit=(t=performance.now())=>{if(e.__STOP||this.container==null||!this.isReady())return;let n=this.getHeight(),r=this.getScrollTop(),i=r,a=this.pendingLayoutAnchor!=null,o=this.getScrollAnchor(i);if(this.layoutDirtyIndex!=null&&(this.recomputeLayout(this.layoutDirtyIndex,this.pendingLayoutReset),this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,a=!0),a&&o!=null){let e=this.resolveAnchoredScrollTop(o);if(e!=null){let t=e-i;i=e,this.scrollAnimation!=null&&(this.scrollAnimation.position+=t)}}a&&(i=this.clampScrollTop(i),this.syncContainerHeight());let s=this.computeTargetScrollTopForFrame(i,t),c=!a&&(this.renderState.scrollTop===-1||Math.abs(s-this.renderState.scrollTop)>n+this.config.overscrollSize*2);c&&(o=void 0),this.windowSpecs=en({scrollTop:s-this.header.height,height:n,scrollHeight:this.getScrollHeight(),fitPerfectly:c,fitPerfectlyOverscroll:this.getFitPerfectlyOverscroll(),overscrollSize:this.config.overscrollSize});let l=r;(this.pendingScrollTarget!=null&&s!==l||this.needsScrollPageUpdate(s))&&(this.applyScrollFix(s,l,this.windowSpecs),l=s);let{top:u,bottom:d}=this.windowSpecs,{firstIndex:f,lastIndex:p}=this.renderState;if(f>=0)for(let e=f;e<=p;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.computeRenderRangeAndEmit: No item at index: ${e}`);t.top>u-t.height&&t.top<=d||this.releaseRenderedItem(t)}let m=this.reconcileHeaderFooterHosts(),h,g=new Set,_=this.findFirstVisibleIndex(u),v=this.findLastVisibleIndex(d);for(let e=_;e<=v;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.computeRenderRangeAndEmit: missing item`);let{instance:n}=t;t.element==null?(t.element=this.acquireElement(),So(this.stickyContainer,t.element,h),n.virtualizedSetup(),xo(t,t.element)&&(t.renderedOptionsRevision=this.renderOptionsRevision,g.add(t)),h=t.element):(So(this.stickyContainer,t.element,h),xo(t,void 0,t.renderedOptionsRevision!==this.renderOptionsRevision)&&(t.renderedOptionsRevision=this.renderOptionsRevision,g.add(t)),h=t.element),t.item.edit===!0&&this.attachItemEditor(t)}this.renderState.firstIndex=_<=v?_:-1,this.renderState.lastIndex=v,this.flushSlotCoordinator(),this.flushManagers(g),m&&this.measureMountedHosts(),this.reconcileRenderedItems(g),this.syncContainerHeight(),this.updateStickyPositioning();let y=o==null?void 0:this.resolveAnchoredScrollTop(o);o===this.pendingLayoutAnchor&&(this.pendingLayoutAnchor=void 0);let b=y==null?0:y-i,x=s,S=!1;if(this.pendingScrollTarget!=null){let e=this.advanceScrollAnimation(t,b);e==null?x=i:(x=e,S=!0)}else x=y??s;x!==l&&(this.applyScrollFix(x,l,this.windowSpecs),l=x),S&&this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),this.renderState.scrollTop=ka(l),this.updateStickyPositioning(),this.validateStickyContainerHeight(),this.fixContainerFocus(),g.size>0&&(this.resumePendingSearchReveal(g),this.search.repaint()),(c||this.scrollAnimation!=null)&&this.render()};flushManagers(e){for(let t of e)t.instance.flushManagers()}syncContainerHeight(){let e=this.getPagedScrollHeight();this.container!=null&&this.containerHeight!==e&&(this.container.style.height=`${e}px`,this.containerHeight=e)}getStickyBounds(e){let{firstIndex:t,lastIndex:n}=e==null?this.renderState:{firstIndex:this.findFirstVisibleIndex(e.top),lastIndex:this.findLastVisibleIndex(e.bottom)};if(t===-1||n===-1||t>n)return;let r=this.items[t]?.instance.getAdvancedStickySpecs(e),i=this.items[n]?.instance.getAdvancedStickySpecs(e);if(r!=null&&i!=null)return{stickyTop:this.getPagedLayoutTop(Math.max(r.topOffset,0)),stickyBottom:this.getPagedLayoutTop(i.topOffset+i.height)}}applyStickyPositioning({stickyTop:e,stickyBottom:t}){let n=this.getHeight(),{itemMetricsCache:r}=this,i=t-e;this.renderState.stickyHeight=i,this.renderState.stickyTop=e,this.renderState.stickyBottom=t,this.stickyOffset.style.height=`${e}px`;let a=(Math.random()*r.lineHeight>>0)*-1,o=-Math.max(i+a,0)+n;this.stickyContainer.style.top=`${o}px`,this.stickyContainer.style.bottom=`${o+r.diffHeaderHeight}px`}syncPagedScrollScaffolding(e){this.syncContainerHeight();let t=this.getStickyBounds(e);if(t==null){this.stickyOffset.style.height=`${this.getPagedLayoutTop(e.top)}px`;return}this.applyStickyPositioning(t)}reconcileRenderedItems(e){let{firstIndex:t,lastIndex:n}=this.renderState;if(t===-1)return;let r=-1,i=!1;for(let a=t;a<this.items.length&&!(!i&&a>n);a++){let t=this.items[a];if(t==null)throw Error(`CodeView.reconcileRenderedItems: Invalid item`);r===-1?r=t.top:t.top!==r&&(t.top=r,t.instance.syncVirtualizedTop(),i=!0),(e==null?a<=n:e.has(t))&&(t.instance.reconcileHeights()&&(i=!0,t.height=t.instance.getVirtualizedHeight()),this.validateRenderedItemHeight(t)),r+=t.instance.getVirtualizedHeight(),a<this.items.length-1&&(r+=this.getLayout().gap)}i&&r!=null&&(this.scrollDirty=!0,this.scrollHeight=r)}updateStickyPositioning(){let e=this.getStickyBounds();if(e==null){this.renderState.firstIndex===-1&&(this.stickyOffset.style.height=``);return}let{stickyTop:t,stickyBottom:n}=e;(n-t!==this.renderState.stickyHeight||t!==this.renderState.stickyTop||n!==this.renderState.stickyBottom)&&this.applyStickyPositioning(e)}handleScroll=()=>{e.__STOP||(this.suspendScrollInteractions(),this.scrollDirty=!0,this.notifyScroll(),this.render())};clearPendingScroll=e=>{e!=null&&this.search.isOpen&&this.search.ownsEvent(e)||(this.pendingScrollTarget=void 0,this.pendingLayoutAnchor=void 0,this.scrollAnimation=void 0)};handleResize=e=>{let t=!1;for(let n of e)if(n.target===this.stickyContainer){let e=n.borderBoxSize[0].blockSize;if(Math.abs(e-this.renderState.stickyHeight)>=ro){let e=this.getScrollTop(),n=this.getScrollAnchor(e);this.reconcileRenderedItems(),this.updateStickyPositioning();let r=n==null?void 0:this.resolveAnchoredScrollTop(n);if(r!=null){let t=r-e;this.applyScrollFix(r,e,this.windowSpecs),this.scrollAnimation!=null&&(this.scrollAnimation.position+=t)}this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),t=!0}}else if(n.target===this.header.element||n.target===this.footer.element){let e=n.target===this.header.element?this.header:this.footer,r=n.borderBoxSize[0].blockSize;if(r!==e.height){let n=this.getScrollTop(),i=this.getScrollAnchor(n);this.setHostHeight(e,r);let a=i==null?void 0:this.resolveAnchoredScrollTop(i);if(a!=null){let e=a-n;this.applyScrollFix(a,n,this.windowSpecs),this.scrollAnimation!=null&&(this.scrollAnimation.position+=e)}this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),t=!0}}else this.scrollDirty=!0,this.heightDirty=!0,t=!0;t&&this.render(!0)};getScrollAnchorViewportTop(e,t){return e<t?t+this.getStickyHeaderOffset():t}getScrollAnchor(e,t=this.idToItem){let n,{pendingLayoutAnchor:r}=this;if(r!=null){let e=this.idToItem.get(r.id);if(e!=null&&t.get(r.id)===e)return r;e!=null&&(n=e)}if(e<=0)return;let{firstIndex:i,lastIndex:a,stickyTop:o,stickyBottom:s}=this.renderState;if(i===-1||a===-1)return;let c=this.getHeight();if(o!==-1&&s!==-1){for(let r=i;r<=a;r++){let i=this.items[r];if(i==null)continue;let a=this.getItemTopOffset()+i.top;if(a+i.height<=e)continue;if(a>=e+c)break;if(t.get(i.item.id)!==i){n??=i;continue}if(a>=e)return{type:`item`,id:i.item.id,viewportOffset:a-e};let o=this.getScrollAnchorViewportTop(a,e)-a,s=i.instance.getNumericScrollAnchor(o);if(s!=null){let t=a+s.top;return{type:`line`,id:i.item.id,lineNumber:s.lineNumber,side:s.side,viewportOffset:t-e}}}if(n!=null)for(let e=n.index+1;e<this.items.length;e++){let n=this.items[e];if(n!=null&&t.get(n.item.id)===n)return{type:`item`,id:n.item.id,viewportOffset:0}}}}resolveAnchoredScrollTop(e){let t=this.idToItem.get(e.id);if(t==null)return;let n=this.getItemTopOffset();if(e.type===`item`){let r=n+t.top;return this.clampScrollTop(r-e.viewportOffset)}let r=t.type===`diff`?t.instance.getLinePosition(e.lineNumber,e.side):t.instance.getLinePosition(e.lineNumber);if(r==null)return;let i=n+t.top+r.top;return this.clampScrollTop(i-e.viewportOffset)}applyScrollFix(e,t,n){if(this.root==null)return;let r=ka(this.clampScrollTop(e)),i=ka(t),{scrollPageOffset:a}=this,o=ka(this.clampPagedScrollTop(i-a)),{pagedScrollTop:s,scrollPageOffset:c}=this.resolvePagedScrollPosition(r),l=s,u=a!==c;(r!==this.renderState.scrollTop||r!==i||l!==o||u)&&(this.suspendScrollInteractions(),(l!==o||u)&&(this.scrollPageOffset=c,this.syncPagedScrollScaffolding(n)),l!==o&&this.root.scrollTo({top:l,behavior:`instant`}),this.renderState.scrollTop=r,this.scrollTop=r,this.scrollDirty=!1)}isPendingTargetSettled(e){let t=this.resolveScrollTargetTop(e);return t==null||ka(this.getScrollTop())===ka(t)}getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root?.scrollTop??0;return this.scrollTop=this.clampScrollTop(e+this.scrollPageOffset),this.scrollTop}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root?.getBoundingClientRect().height??0,this.height):this.height}getScrollHeight(){return this.scrollHeight}flushSlotCoordinator(){if(this.slotCoordinator==null)return;let e=this.buildSlotSnapshot(this.slotCoordinator);Ea(this.slotSnapshot,e)||(this.slotSnapshot=e,this.slotCoordinator.onSnapshotChange(e))}notifyScroll(){if(this.scrollListeners.size===0)return;let e=this.getScrollTop();for(let t of this.scrollListeners)t(e,this)}findFirstVisibleIndex(e){let t=0,n=this.items.length-1,r=this.items.length;for(;t<=n;){let i=t+n>>1,a=this.items[i];if(a==null)throw Error(`CodeView.findFirstVisibleIndex: invalid item index`);a.top+a.height>e?(r=i,n=i-1):t=i+1}return r}findLastVisibleIndex(e){let t=0,n=this.items.length-1,r=-1;for(;t<=n;){let i=t+n>>1,a=this.items[i];if(a==null)throw Error(`CodeView.findLastVisibleIndex: invalid item index`);a.top<=e?(r=i,t=i+1):n=i-1}return r}recomputeLayout(e=0,t){if(this.items.length===0){this.scrollHeight=0;return}let n=this.getLayout(),r=0;if(e>0){let t=this.items[e-1];if(t==null)throw Error(`CodeView.recomputeLayout: invalid dirty index`);r=t.top+t.height+n.gap}for(let i=e;i<this.items.length;i++){let e=this.items[i];if(e==null)throw Error(`CodeView.recomputeLayout: invalid item index`);if(e.top=r,e.type===`diff`){let n=e.item.fileDiff.isPartial;e.height=e.instance.updateCodeViewLayout(e.item.fileDiff,r,t,e.item.annotations??[]),n&&!e.item.fileDiff.isPartial&&this.search.refresh(!0)}else e.height=e.instance.updateCodeViewLayout(e.item.file,r,t,e.item.annotations??[]);r+=e.height,i<this.items.length-1&&(r+=n.gap)}r!==this.scrollHeight&&(this.scrollDirty=!0),this.scrollHeight=r}resetRenderState(){this.renderState.scrollTop=-1,this.renderState.firstIndex=-1,this.renderState.lastIndex=-1,this.renderState.stickyHeight=0,this.renderState.stickyTop=-1,this.renderState.stickyBottom=-1}getFitPerfectlyOverscroll(){return this.getLayout().gap+this.itemMetricsCache.diffHeaderHeight}};function po(e,t,n){let r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),i=0,a,o=0,s;for(;(s=r.nextNode())!=null;){let e=s.data.length;if(a==null&&t<i+e&&(a=s,o=t-i),a!=null&&n<=i+e){let e=document.createRange();return e.setStart(a,o),e.setEnd(s,n-i),e.getBoundingClientRect()}i+=e}}function mo(e){return e.instance.cleanUp(!0),e.type===`diff`?e.instance.updateCodeViewLayout(e.item.fileDiff,e.top,void 0,e.item.annotations??[]):e.instance.updateCodeViewLayout(e.item.file,e.top,void 0,e.item.annotations??[])}function ho(e,t){return!sn(e.theme??Vt,t.theme??Vt)||(e.themeType??`system`)!==(t.themeType??`system`)||e.unsafeCSS!==t.unsafeCSS}function go(e,t){return(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||e.unsafeCSS!==t.unsafeCSS||(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.diffIndicators??`bars`)!==(t.diffIndicators??`bars`)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function _o(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function vo(e){return e instanceof SVGElement||Yt(e)&&(e.hasAttribute(`data-core-css`)||e.hasAttribute(`data-theme-css`)||e.hasAttribute(`data-unsafe-css`))}function yo(e){let t=bo(e.start,e.side),n=bo(e.end,e.endSide??e.side);return t===n?t:`${t}-${n}`}function bo(e,t){return t==null?`${e}`:`${t===`deletions`?`D`:`A`}${e}`}function xo(e,t,n=!1){return e.type===`diff`?e.instance.render({deferManagers:!0,fileContainer:t,fileDiff:e.item.fileDiff,forceRender:n,lineAnnotations:e.item.annotations??[]}):e.instance.render({deferManagers:!0,fileContainer:t,file:e.item.file,forceRender:n,lineAnnotations:e.item.annotations??[]})}function So(e,t,n){if(n==null){e.firstChild!==t&&e.prepend(t);return}n.nextSibling!==t&&n.after(t)}function Co(e){return(e.annotations?.length??0)>0}function wo(e,{hasHeaderRenderers:t,hasAnnotationRenderer:n,hasGutterRenderer:r}){if(e.length===0)return;if(t||r)return e;if(!n)return;let i=[];for(let t of e)Co(t.item)&&i.push(t);return i.length>0?i:void 0}var Z=e(n(),1),To=e(Ne(),1),Q=N(),$=e(ve(),1);function Eo(e){return K(`flex items-center justify-between gap-2`,e===`embedded`?`px-2`:`px-4`,wn&&e!==`sheet`&&e!==`embedded`?`drag-region h-[var(--workspace-topbar-height)] border-b border-border wco:pr-(--workspace-native-controls-inset)`:`flex h-10 min-h-10 shrink-0 items-center border-b border-border/60 bg-background in-data-[preview-panel-mode=inline]:mb-3 in-data-[preview-panel-mode=inline]:h-7 in-data-[preview-panel-mode=inline]:min-h-7 in-data-[preview-panel-mode=inline]:border-b-transparent`)}function Do(e){let t=(0,Q.c)(10),n=wn&&e.mode!==`sheet`&&e.mode!==`embedded`,r=e.mode===`inline`?`w-[42vw] min-w-[360px] max-w-[560px] shrink-0 border-l border-border`:`w-full`,i;t[0]===r?i=t[1]:(i=K(`flex h-full min-w-0 flex-col bg-background`,r),t[0]=r,t[1]=i);let a;t[2]!==e.header||t[3]!==e.mode||t[4]!==n?(a=n?(0,$.jsx)(`div`,{className:Eo(e.mode),children:e.header}):(0,$.jsx)(`div`,{className:Eo(e.mode),"data-surface-subheader":!0,children:e.header}),t[2]=e.header,t[3]=e.mode,t[4]=n,t[5]=a):a=t[5];let o;return t[6]!==e.children||t[7]!==i||t[8]!==a?(o=(0,$.jsxs)(`div`,{className:i,children:[a,e.children]}),t[6]=e.children,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function Oo(e){let t=(0,Q.c)(7),{titleWidth:n}=e,r,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(`div`,{className:`flex size-5 shrink-0 items-center justify-center`,children:(0,$.jsx)(En,{className:`size-2.5`})}),i=(0,$.jsx)(En,{className:`size-5 shrink-0`}),t[0]=r,t[1]=i):(r=t[0],i=t[1]);let a=n===`short`?`h-3 w-2/5 max-w-52`:n===`medium`?`h-3 w-1/2 max-w-64`:`h-3 w-3/5 max-w-72`,o;t[2]===a?o=t[3]:(o=(0,$.jsx)(En,{shape:`pill`,className:a}),t[2]=a,t[3]=o);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,$.jsx)(En,{shape:`pill`,className:`h-3 w-5`}),(0,$.jsx)(En,{shape:`pill`,className:`h-3 w-5`})]}),t[4]=s):s=t[4];let c;return t[5]===o?c=t[6]:(c=(0,$.jsxs)(`div`,{className:`flex h-8 items-center gap-2 px-2 pr-3`,children:[r,i,o,s]}),t[5]=o,t[6]=c),c}function ko(e){let t=(0,Q.c)(3),{width:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(En,{shape:`pill`,className:`h-2.5 w-5 shrink-0`}),t[0]=r):r=t[0];let i=n===`short`?`h-2.5 w-3/5`:n===`medium`?`h-2.5 w-2/3`:`h-2.5 w-4/5`,a;return t[1]===i?a=t[2]:(a=(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[r,(0,$.jsx)(En,{shape:`pill`,className:i})]}),t[1]=i,t[2]=a),a}function Ao(e){let t=(0,Q.c)(10),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(Oo,{titleWidth:`medium`}),t[0]=n):n=t[0];let r;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsxs)(`div`,{className:`flex h-6 items-center gap-2 px-2 pr-3`,children:[(0,$.jsx)(`div`,{className:`h-px flex-1 bg-border/40`}),(0,$.jsx)(En,{shape:`pill`,className:`h-2.5 w-24`}),(0,$.jsx)(`div`,{className:`h-px flex-1 bg-border/40`})]}),t[1]=r):r=t[1];let i,a,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsxs)(`div`,{className:`space-y-2 px-3 py-2`,children:[(0,$.jsx)(ko,{width:`medium`}),(0,$.jsx)(ko,{width:`long`}),(0,$.jsx)(ko,{width:`short`})]}),a=(0,$.jsx)(Oo,{titleWidth:`short`}),o=(0,$.jsx)(Oo,{titleWidth:`long`}),t[2]=i,t[3]=a,t[4]=o):(i=t[2],a=t[3],o=t[4]);let s;t[5]===e.label?s=t[6]:(s=(0,$.jsx)(`span`,{className:`sr-only`,children:e.label}),t[5]=e.label,t[6]=s);let c;return t[7]!==e.label||t[8]!==s?(c=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-hidden bg-background`,role:`status`,"aria-live":`polite`,"aria-label":e.label,children:[n,r,i,a,o,s]}),t[7]=e.label,t[8]=s,t[9]=c):c=t[9],c}function jo(e,t){typeof e==`function`?e(t):e!=null&&(e.current=t)}var Mo=typeof window>`u`?Z.useEffect:Z.useLayoutEffect;function No(e){return{instance:void 0,items:void 0,controlled:e,managedOptions:void 0,disableFlushSync:!1,slotCoordinator:void 0}}function Po(e,t){let{className:n,containerRef:r,disableWorkerPool:i=!1,editorOptions:a,getEditStateKey:o,initialItems:s,items:c,onItemEditChange:l,onItemEditComplete:u,onRevealSearchMatch:d,onScroll:f,onSelectedLinesChange:p,options:m,renderAnnotation:h,renderCodeViewFooter:g,renderCodeViewHeader:_,renderCustomHeader:v,renderGutterUtility:y,renderHeaderFilenameSuffix:b,renderHeaderMetadata:x,renderHeaderPrefix:S,selectedLines:C,style:w}=e,T=c!==void 0,E=an(),D=(0,Z.useContext)(rn),O=(0,Z.useRef)(No(T)),k=v!=null,A=h!=null,j=y!=null,M=k||S!=null||b!=null||x!=null,N=M||A||j,P=_!=null,F=g!=null,I=nn(e=>{p?.(e)}),L=C!==void 0,R=nn((e,t,n)=>{if(E==null)throw Error(`CodeView: EditContext is not attached`);let r={...a,...t};return E(e,r,n)}),z=nn((e,t)=>{l?.(e,t)}),B=nn((e,t,n)=>u?.(e,t,n)??`reject`),V=nn(e=>{d?.(e)}),H=(0,Z.useMemo)(()=>Bo({options:m,hasCustomHeader:k,hasGutterRenderer:j,hasCodeViewHeader:P,hasCodeViewFooter:F,onSelectedLinesChange:p==null?void 0:I,controlledSelection:L,getEditStateKey:o,createEditor:E==null?void 0:R,onItemEditChange:l==null?void 0:z,onItemEditComplete:u==null?void 0:B,onRevealSearchMatch:d==null?void 0:V}),[E,L,R,z,B,V,I,F,P,k,j,o,l,u,d,p,m]),[ee]=(0,Z.useState)(()=>zo()),[,te]=(0,Z.useState)({}),ne=nn(e=>{O.current.instance!=null&&(e==null||e!==O.current.instance.getContainerElement())&&(O.current.instance.cleanUp(),ee.publish(void 0),O.current=No(T)),e!=null&&e!==O.current.instance?.getContainerElement()&&(O.current.instance=new fo(H,i?void 0:D,!0),O.current.instance.setup(e)),jo(r,e)}),U=nn(e=>{O.current.disableFlushSync?ee.publish(e):(0,To.flushSync)(()=>{ee.publish(e)})}),W=(0,Z.useMemo)(()=>{if(M||A||j||P||F)return{hasHeaderRenderers:M,hasAnnotationRenderer:A,hasGutterRenderer:j,onSnapshotChange:U}},[U,A,j,M,P,F]);return Mo(()=>f==null?void 0:O.current.instance?.subscribeToScroll(f)),Mo(()=>{let{instance:e,controlled:t,items:n,managedOptions:r,slotCoordinator:i}=O.current;if(e!=null)try{O.current.disableFlushSync=!0;let a=!1;if($t(H,r)||(O.current.managedOptions=H,e.setOptions(H),a=!0),t!==T){console.error(`CodeView: cannot switch between controlled and uncontrolled modes. Remount with a new key instead.`);return}if(T)c!==n&&(Lo(n,c)?O.current.items=c:Io(n,c)?(O.current.items=c,e.addItems(c.slice(n.length))):(O.current.items=c,e.setItems(c),a=!0));else if(n==null){let t=s??[];O.current.items=t,t.length>0&&(e.setItems(t),a=!0)}C!==void 0&&e.setSelectedLines(C,{notify:!1});let o=e.setSlotCoordinator(W),l=!1;W!==i&&((W==null||i==null)&&(l=!0),O.current.slotCoordinator=W),(a||o)&&e.render(!0),o&&W==null&&ee.publish(void 0),l&&te({})}finally{O.current.disableFlushSync=!1}}),(0,Z.useImperativeHandle)(t,()=>({addItems(e){let{controlled:t,instance:n}=O.current;Ro(t,`addItems`),n==null?console.error(`CodeView.addItems: no valid instance to append items with`,e):n.addItems(e)},getItem(e){let{instance:t}=O.current;if(t==null){console.error(`CodeView.getItem: no valid instance exists`,e);return}return t.getItem(e)},removeItem(e){let{controlled:t,instance:n}=O.current;return Ro(t,`removeItem`),n==null?(console.error(`CodeView.removeItem: no valid instance to remove item from`,e),!1):n.removeItem(e)},updateItem(e){let{controlled:t,instance:n}=O.current;return Ro(t,`updateItem`),n==null?(console.error(`CodeView.updateItem: no valid instance to update item with`,e),!1):n.updateItem(e)},updateItemId(e,t){let{controlled:n,instance:r}=O.current;return Ro(n,`updateItemId`),r==null?(console.error(`CodeView.updateItemId: no valid instance to update item id with`,e,t),!1):r.updateItemId(e,t)},scrollTo(e){let{instance:t}=O.current;t==null?console.error(`CodeView.scrollTo: no valid instance to scroll with`,e):t.scrollTo(e)},setSelectedLines(e){let{instance:t}=O.current;t==null?console.error(`CodeView.setSelectedLines: no valid instance to update selection with`,e):(t.setSelectedLines(e,{notify:!1}),I(e))},getSelectedLines(){let{instance:e}=O.current;return e==null?(console.error(`CodeView.getSelectedLines: no valid instance exists`),null):e.getSelectedLines()},clearSelectedLines(){let{instance:e}=O.current;e==null?console.error(`CodeView.clearSelectedLines: no valid instance to update selection with`):(e.clearSelectedLines({notify:!1}),I(null))},getEditor(e){let{instance:t}=O.current;if(t==null){console.error(`CodeView.getEditor: no valid instance exists`,e);return}return t.getEditor(e)},getInstance(){return O.current.instance}}),[I]),(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{ref:ne,className:n,style:w}),(N||P||F)&&(0,$.jsx)(Vo,{managedContentStore:ee,renderCustomHeader:v,renderHeaderPrefix:S,renderHeaderFilenameSuffix:b,renderHeaderMetadata:x,renderAnnotation:h,renderGutterUtility:y,renderCodeViewHeader:_,renderCodeViewFooter:g})]})}var Fo=(0,Z.forwardRef)(Po);function Io(e,t){if(e==null||t.length<=e.length)return!1;if(e.length===0)return!0;for(let n=0;n<e.length;n++)if(t[n]!==e[n])return!1;return!0}function Lo(e,t){if(e==null||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Ro(e,t){if(e)throw Error(`CodeView.${t} cannot be used when CodeView is controlled. Use initialItems for imperative item updates.`)}function zo(){let e,t=new Set;return{getSnapshot(){return e},publish(n){if(!Ea(e,n)){e=n;for(let e of t)e()}},subscribe(e){return t.add(e),()=>{t.delete(e)}}}}function Bo({options:e,hasCustomHeader:t,hasGutterRenderer:n,hasCodeViewHeader:r,hasCodeViewFooter:i,onSelectedLinesChange:a,controlledSelection:o,getEditStateKey:s,createEditor:c,onItemEditChange:l,onItemEditComplete:u,onRevealSearchMatch:d}){let f={...e,controlledSelection:o,onSelectedLinesChange:a,createEditor:c};return s!=null&&(f.getEditStateKey=s),l!=null&&(f.onItemEditChange=l),u!=null&&(f.onItemEditComplete=u),d!=null&&(f.onRevealSearchMatch=d),t&&(f.renderCustomHeader=Uo),n&&(f.renderGutterUtility=Uo),r&&(f.renderCodeViewHeader=Uo),i&&(f.renderCodeViewFooter=Uo),f}var Vo=(0,Z.memo)(function({managedContentStore:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,renderGutterUtility:o,renderCodeViewHeader:s,renderCodeViewFooter:c}){"use no memo";let l=nn(t=>e.subscribe(t)),u=nn(()=>e.getSnapshot()),d=(0,Z.useSyncExternalStore)(l,u,u),f=``;for(let e of d?.items??[])f+=`${e.id}:${e.version}:${e.type}`;let p=(0,Z.useMemo)(()=>d?.items?.map(e=>(0,To.createPortal)(Ho({renderedItem:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,renderGutterUtility:o}),e.element,e.id)),[t,n,r,i,a,o,f]),m=(0,Z.useMemo)(()=>s!=null&&d?.header!=null?(0,To.createPortal)(s(),d.header):null,[s,d?.header]),h=(0,Z.useMemo)(()=>c!=null&&d?.footer!=null?(0,To.createPortal)(c(),d.footer):null,[c,d?.footer]);return(0,$.jsxs)($.Fragment,{children:[p,m,h]})});function Ho({renderedItem:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,renderGutterUtility:o}){if(e.type===`diff`){let{item:s,instance:c}=e;return fn({fileDiff:s.fileDiff,renderCustomHeader:t==null?void 0:()=>t(s),renderHeaderPrefix:n==null?void 0:()=>n(s),renderHeaderFilenameSuffix:r==null?void 0:()=>r(s),renderHeaderMetadata:i==null?void 0:()=>i(s),renderAnnotation:a==null?void 0:e=>a(e,s),lineAnnotations:s.annotations,renderGutterUtility:o==null?void 0:e=>o(e,s),getHoveredLine:c.getHoveredLine,getAnnotationSlotName:c.getAnnotationSlotName})}{let{item:s,instance:c}=e;return ln({file:s.file,renderCustomHeader:t==null?void 0:()=>t(s),renderHeaderPrefix:n==null?void 0:()=>n(s),renderHeaderFilenameSuffix:r==null?void 0:()=>r(s),renderHeaderMetadata:i==null?void 0:()=>i(s),renderAnnotation:a==null?void 0:e=>a(e,s),lineAnnotations:s.annotations,renderGutterUtility:o==null?void 0:e=>o(e,s),getHoveredLine:c.getHoveredLine,getAnnotationSlotName:c.getAnnotationSlotName})}}function Uo(){}var Wo=`${Ut}
25
25
  :is(
26
26
  [data-line],
27
27
  [data-line-annotation],
@@ -201,16 +201,16 @@ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./index-DmPPPGJ
201
201
  transition: none;
202
202
  }
203
203
  }
204
- `;function Go(e){let t=(0,Q.c)(18),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({options:r,viewerRef:o,className:n,unsafeCSSExtra:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===o?s=t[7]:(s=o?{ref:o}:{},t[6]=o,t[7]=s);let c=n?`diff-render-surface [--code-background:var(--background)] outline-none ${n}`:`diff-render-surface [--code-background:var(--background)] outline-none`,l=a?`${Wo}\n${a}`:Wo,u,d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u={diffHeaderHeight:32,hunkSeparatorHeight:24,spacing:0,paddingTop:0,paddingBottom:8},d={paddingTop:0,paddingBottom:0,gap:0},t[8]=u,t[9]=d):(u=t[8],d=t[9]);let f;t[10]!==r||t[11]!==l?(f={...r,unsafeCSS:l,itemMetrics:u,layout:d},t[10]=r,t[11]=l,t[12]=f):f=t[12];let p;return t[13]!==i||t[14]!==s||t[15]!==c||t[16]!==f?(p=(0,$.jsx)(dn,{children:(0,$.jsx)(Fo,{...i,...s,className:c,options:f})}),t[13]=i,t[14]=s,t[15]=c,t[16]=f,t[17]=p):p=t[17],p}function Ko(e,t){return async n=>{let r=Kt(n),i=n.prevName?Kt({...n,name:n.prevName}):r,a=await e({changeType:n.type,oldPath:i,newPath:r}),o={name:r,contents:a.newContents,cacheKey:`${t}:new:${r}`};return n.type===`rename-pure`?{oldFile:null,newFile:o}:{oldFile:{name:i,contents:a.oldContents,cacheKey:`${t}:old:${i}`},newFile:o}}}function qo(e,t){return Ko(async({changeType:n,oldPath:r,newPath:i})=>{let a=await e({environmentId:t.environmentId,input:{cwd:t.cwd,sourceKind:t.sourceKind,changeType:n,baseRef:t.baseRef,headRef:t.headRef,oldPath:r,newPath:i}});if(a._tag!==`Success`)throw Ue(a);return a.value},t.cacheKey)}function Jo(e,t){return Ko(async({changeType:n,oldPath:r,newPath:i})=>{let a=await e({environmentId:t.environmentId,input:{...t.reference,...t.commit===null?{}:{commit:t.commit},changeType:n,oldPath:r,newPath:i}});if(a._tag!==`Success`)throw Ue(a);return a.value},t.cacheKey)}var Yo=V,Xo=`--resizable-width`;function Zo(e){let{storageKey:t,defaultWidth:n,minWidth:r,maxWidth:i,edge:a}=e,o=(0,Z.useCallback)(e=>Number.isFinite(e)?Math.max(r,Math.min(i,e)):n,[n,i,r]),s=()=>{if(typeof window>`u`)return n;try{let e=u(t,Yo);return o(e??n)}catch(e){return console.error(`Could not read persisted panel width.`,e),n}},[c,l]=(0,Z.useState)(()=>({storageKey:t,width:s()}));c.storageKey!==t&&l({storageKey:t,width:s()});let d=o(c.width),f=(0,Z.useRef)({clamp:o,storageKey:t,width:d});(0,Z.useLayoutEffect)(()=>{f.current={clamp:o,storageKey:t,width:d}},[o,d,t]);let{refresh:p,...m}=Xn(e=>{let n=e.currentTarget.parentElement;return n?.style.setProperty(`transition-property`,`none`),{width:d,edge:a,resize(e){let t=f.current.clamp(e);return n?.style.setProperty(Xo,`${t}px`),t},finish(e){l({storageKey:t,width:e});try{B(f.current.storageKey,e,Yo)}catch(e){console.error(`Could not persist panel width.`,e)}},cleanup(e){n?.style.removeProperty(`transition-property`),e||n?.style.setProperty(Xo,`${f.current.width}px`)}}},t);return(0,Z.useLayoutEffect)(p,[o,d,p]),{width:d,handlers:m}}var Qo=`t3code:preview-panel-width`,$o=360,es=.7,ts=360,ns=540;function rs(e,t){let n=(0,Q.c)(6),r;n[0]===t?r=n[1]:(r=t===void 0?{}:t,n[0]=t,n[1]=r);let i=r,a=is(e,i.enabled??!0,i.container),o=i.widthStorageKey??Qo,s=i.defaultWidth??ns,c;return n[2]!==a||n[3]!==o||n[4]!==s?(c={storageKey:o,defaultWidth:s,minWidth:$o,maxWidth:a,edge:`left`},n[2]=a,n[3]=o,n[4]=s,n[5]=c):c=n[5],Zo(c)}function is(e,t,n){let r=(0,Q.c)(5),[i,a]=(0,Z.useState)(as),o,s;return r[0]!==n||r[1]!==t||r[2]!==e?(o=()=>{if(typeof window>`u`)return;let r=n??(t?e?.current?.parentElement:null)??null,i=()=>{a(os(window.innerWidth,r?.clientWidth))};i();let o=0,s=()=>{o===0&&(o=window.requestAnimationFrame(()=>{o=0,i()}))};window.addEventListener(`resize`,s);let c=r?rr(r,i):void 0;return()=>{window.removeEventListener(`resize`,s),o!==0&&window.cancelAnimationFrame(o),c?.()}},s=[n,e,t],r[0]=n,r[1]=t,r[2]=e,r[3]=o,r[4]=s):(o=r[3],s=r[4]),(0,Z.useLayoutEffect)(o,s),i}function as(){return os(typeof window>`u`?1280:window.innerWidth)}function os(e,t){let n=Math.floor(e*es),r=t===void 0?1/0:Math.floor(t)-ts;return Math.max($o,Math.min(n,r))}function ss(e){let t=(0,Q.c)(6),{handlers:n,className:r}=e,i;t[0]===r?i=t[1]:(i=K(`group absolute inset-y-0 -left-1 z-20 w-2 cursor-col-resize select-none`,r),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-transparent transition-colors duration-150 group-hover:bg-border group-active:bg-primary/60`}),t[2]=a):a=t[2];let o;return t[3]!==n||t[4]!==i?(o=(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,className:i,...n,children:a}),t[3]=n,t[4]=i,t[5]=o):o=t[5],o}function cs(e){let t=(0,Q.c)(4);if(e.inlineSize){let n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(us,{...e,inlineSize:e.inlineSize}),t[0]=e,t[1]=n),n}let n;return t[2]===e?n=t[3]:(n=(0,$.jsx)(ls,{...e}),t[2]=e,t[3]=n),n}function ls(e){let t=(0,Q.c)(7),n=(0,Z.useRef)(null),r=e.mode===`inline`&&!e.maximized,i;t[0]!==e.defaultWidth||t[1]!==e.widthStorageKey||t[2]!==r?(i={enabled:r,widthStorageKey:e.widthStorageKey,defaultWidth:e.defaultWidth},t[0]=e.defaultWidth,t[1]=e.widthStorageKey,t[2]=r,t[3]=i):i=t[3];let a=rs(n,i),o;return t[4]!==a||t[5]!==e?(o=(0,$.jsx)(us,{...e,inlineSize:a,hostRef:n}),t[4]=a,t[5]=e,t[6]=o):o=t[6],o}function us(e){let t=(0,Q.c)(42);Tn&&e.mode!==`sheet`&&e.mode;let n=e.mode===`inline`,r=n&&e.open!==void 0,i=e.open??!0,a=e.maximized??!1,o=(0,Z.useRef)(null),s=e.hostRef??o,{width:c,handlers:l}=e.inlineSize,u;t[0]!==a||t[1]!==i||t[2]!==c?(u=()=>({open:i,width:c,maximized:a,suppressed:!1}),t[0]=a,t[1]=i,t[2]=c,t[3]=u):u=t[3];let[d,f]=(0,Z.useState)(u);(d.open!==i||d.width!==c||d.maximized!==a)&&f({open:i,width:c,maximized:a,suppressed:r&&d.open===i&&(d.width!==c||d.maximized!==a)});let p=d.suppressed,m,h;t[4]===p?(m=t[5],h=t[6]):(m=()=>{if(!p)return;let e=0,t=window.requestAnimationFrame(()=>{e=window.requestAnimationFrame(()=>{f(ds)})});return()=>{window.cancelAnimationFrame(t),window.cancelAnimationFrame(e)}},h=[p],t[4]=p,t[5]=m,t[6]=h),(0,Z.useLayoutEffect)(m,h);let g=n?a?`flex-1 border-l border-border`:`shrink-0 border-l border-border`:`w-full`,_=r&&`[[data-panel-animations=true]_&]:transition-[width] [[data-panel-animations=true]_&]:duration-(--panel-animation-duration) [[data-panel-animations=true]_&]:ease-out`,v=r&&i&&`[[data-panel-animations=true]_&]:starting:w-0!`,y=r&&!i&&`pointer-events-none`,b;t[7]!==g||t[8]!==_||t[9]!==v||t[10]!==y?(b=K(`relative flex h-full min-h-0 min-w-0 max-w-full flex-col self-stretch bg-background`,g,_,v,y),t[7]=g,t[8]=_,t[9]=v,t[10]=y,t[11]=b):b=t[11];let x;t[12]!==r||t[13]!==n||t[14]!==a||t[15]!==i||t[16]!==p||t[17]!==c?(x=n?{[Xo]:`${c}px`,width:a?`100%`:r&&!i?`0px`:`var(${Xo})`,transitionDuration:p?`0ms`:void 0}:void 0,t[12]=r,t[13]=n,t[14]=a,t[15]=i,t[16]=p,t[17]=c,t[18]=x):x=t[18];let S=e.mode,C=a?`true`:`false`,w;t[19]!==l||t[20]!==n||t[21]!==a?(w=n&&!a?(0,$.jsx)(ss,{handlers:l}):null,t[19]=l,t[20]=n,t[21]=a,t[22]=w):w=t[22];let T=r&&`overflow-clip`,E;t[23]===T?E=t[24]:(E=K(`h-full min-h-0 w-full`,T),t[23]=T,t[24]=E);let D;t[25]!==r||t[26]!==a?(D=r&&!a?{width:`calc(var(${Xo}) - 1px)`}:void 0,t[25]=r,t[26]=a,t[27]=D):D=t[27];let O;t[28]!==e.children||t[29]!==D?(O=(0,$.jsx)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,style:D,children:e.children}),t[28]=e.children,t[29]=D,t[30]=O):O=t[30];let k;t[31]!==E||t[32]!==O?(k=(0,$.jsx)(`div`,{className:E,children:O}),t[31]=E,t[32]=O,t[33]=k):k=t[33];let A;return t[34]!==s||t[35]!==e.mode||t[36]!==C||t[37]!==w||t[38]!==k||t[39]!==b||t[40]!==x?(A=(0,$.jsxs)(`div`,{ref:s,className:b,style:x,"data-preview-panel-mode":S,"data-preview-panel-maximized":C,children:[w,k]}),t[34]=s,t[35]=e.mode,t[36]=C,t[37]=w,t[38]=k,t[39]=b,t[40]=x,t[41]=A):A=t[41],A}function ds(e){return{...e,suppressed:!1}}function fs(e){let t=(0,Q.c)(6),{className:n}=e,r;t[0]===n?r=t[1]:(r=K(`relative flex flex-col gap-0.5 overflow-hidden rounded-sm border border-border/60 bg-card p-1 shadow-xs/5`,n),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsxs)(`div`,{className:`flex gap-0.5`,children:[(0,$.jsx)(`span`,{className:`size-[3px] rounded-full bg-destructive/80`}),(0,$.jsx)(`span`,{className:`size-[3px] rounded-full bg-warning/80`}),(0,$.jsx)(`span`,{className:`size-[3px] rounded-full bg-success/80`})]}),t[2]=i):i=t[2];let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsxs)(`div`,{className:`mt-[1px] flex flex-1 flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{className:`h-[2px] w-full rounded-full bg-muted-foreground/30`}),(0,$.jsx)(`span`,{className:`h-[2px] w-3/5 rounded-full bg-muted-foreground/20`})]}),t[3]=a):a=t[3];let o;return t[4]===r?o=t[5]:(o=(0,$.jsxs)(`div`,{"aria-hidden":!0,className:r,children:[i,a]}),t[4]=r,t[5]=o),o}function ps(e){let t=(0,Q.c)(10),n,r,i;t[0]===e.sources?(n=t[1],r=t[2],i=t[3]):(r=e.sources.filter(ms),n=hs,i=r.join(`\0`),t[0]=e.sources,t[1]=n,t[2]=r,t[3]=i);let a;return t[4]!==n||t[5]!==e.className||t[6]!==e.fallback||t[7]!==r||t[8]!==i?(a=(0,$.jsx)(n,{sources:r,fallback:e.fallback,className:e.className},i),t[4]=n,t[5]=e.className,t[6]=e.fallback,t[7]=r,t[8]=i,t[9]=a):a=t[9],a}function ms(e){return!!e}function hs(e){let t=(0,Q.c)(11),[n,r]=(0,Z.useState)(gs),i;if(t[0]!==n||t[1]!==e.sources){let r;t[3]===n?r=t[4]:(r=e=>!n.has(e),t[3]=n,t[4]=r),i=e.sources.find(r),t[0]=n,t[1]=e.sources,t[2]=i}else i=t[2];let a=i;if(!a)return e.fallback;let o;t[5]===a?o=t[6]:(o=()=>r(e=>new Set(e).add(a)),t[5]=a,t[6]=o);let s;return t[7]!==e.className||t[8]!==a||t[9]!==o?(s=(0,$.jsx)(`img`,{src:a,alt:``,"aria-hidden":`true`,draggable:!1,className:e.className,onError:o}),t[7]=e.className,t[8]=a,t[9]=o,t[10]=s):s=t[10],s}function gs(){return new Set}function _s(e){let t=(0,Q.c)(12),n=xa(e.threadRef,e.url),r;t[0]===e.className?r=t[1]:(r=K(`size-7 shrink-0`,e.className),t[0]=e.className,t[1]=r);let i;t[2]===r?i=t[3]:(i=(0,$.jsx)(fs,{className:r}),t[2]=r,t[3]=i);let a=i,o;t[4]===n?o=t[5]:(o=[n],t[4]=n,t[5]=o);let s;t[6]===e.className?s=t[7]:(s=K(`size-7 shrink-0 rounded object-contain`,e.className),t[6]=e.className,t[7]=s);let c;return t[8]!==a||t[9]!==o||t[10]!==s?(c=(0,$.jsx)(ps,{sources:o,fallback:a,className:s}),t[8]=a,t[9]=o,t[10]=s,t[11]=c):c=t[11],c}function vs(e,t){return e==null||t==null?!1:e.trim().toLowerCase()===t.trim().toLowerCase()}function ys(e){return e.capabilities.edit?.changeRequest===!0?e.viewerPermissions.editChangeRequest===void 0?vs(e.viewer,e.author?.login)||e.viewerPermissions.actions.includes(`merge`):e.viewerPermissions.editChangeRequest:!1}function bs(e,t){return e.capabilities.edit?.comment!==!0||t.kind!==`issue-comment`&&t.kind!==`review-comment`?!1:t.canEdit===void 0?vs(e.viewer,t.author?.login):t.canEdit}function xs(e,t){return e.viewerPermissions.resolve&&t.canResolve!==!1}function Ss(e){let t=(0,Q.c)(11),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=K(`flex shrink-0 opacity-0 transition-opacity pointer-coarse:opacity-100 group-focus-within:opacity-100 group-hover:opacity-100 focus-within:opacity-100 motion-reduce:transition-none`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(h,{"aria-hidden":!0,className:`size-3`}),t[5]=a):a=t[5];let o;t[6]===r?o=t[7]:(o=(0,$.jsx)(G,{...r,size:`icon-xs`,variant:`ghost-muted`,children:a}),t[6]=r,t[7]=o);let s;return t[8]!==i||t[9]!==o?(s=(0,$.jsx)(`span`,{className:i,children:o}),t[8]=i,t[9]=o,t[10]=s):s=t[10],s}function Cs(e,t,n,r){i(e);function i(e){if(e.children!==void 0)for(let a=0;a<e.children.length;a+=1){let o=e.children[a];if(r.has(o.type))continue;if(o.type!==`text`||o.value===void 0){i(o);continue}let s=[],c=0,l=!1;t.lastIndex=0;let u=t.exec(o.value);for(;u!==null;){let e=u.index,r=n(u[0],{index:e,input:u.input});if(r===!1?t.lastIndex=e+1:(c<e&&s.push({type:`text`,value:o.value.slice(c,e)}),s.push(r),c=e+u[0].length,l=!0),!t.global)break;u=t.exec(o.value)}l&&(c<o.value.length&&s.push({type:`text`,value:o.value.slice(c)}),e.children.splice(a,1,...s),a+=s.length-1)}}}var ws=/^\s{0,3}((?:`{3,})|(?:~{3,}))(.*)$/u,Ts=8,Es=/^(?: {4}|\t)/u,Ds=/^<?(https?:\/\/\S+?)>?$/u,Os=/\.(?:png|jpe?g|gif|webp|avif|heic|heif|svg)(?:$|[?#])/iu,ks=/^\[[^\]]*\]\((https?:\/\/[^\s)]+)\)$/u,As=/\.(?:mp4|webm|mov|m4v|ogv)(?:$|[?#])/iu,js=/^https:\/\/github\.com\/user-attachments\/assets\/[\w-]+$/iu,Ms=/<(?:video|source)\b[^>]*\bsrc\s*=\s*["']([^"']+)["']/iu,Ns=/^\s*<video\b/iu,Ps=/<\/video>\s*$/iu;function Fs(e){try{let t=new URL(e);return t.protocol===`https:`||t.protocol===`http:`}catch{return!1}}function Is(e){let t=Ds.exec(e.trim())?.[1]??ks.exec(e.trim())?.[1];return t===void 0||!Fs(t)?null:As.test(t)||js.test(t)?{url:t,media:`video`}:Os.test(t)?{url:t,media:`image`}:null}function Ls(e){let t=[],n=[],r=null,i=()=>{let e=n.join(`
204
+ `;function Go(e){let t=(0,Q.c)(18),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({options:r,viewerRef:o,className:n,unsafeCSSExtra:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===o?s=t[7]:(s=o?{ref:o}:{},t[6]=o,t[7]=s);let c=n?`diff-render-surface [--code-background:var(--background)] outline-none ${n}`:`diff-render-surface [--code-background:var(--background)] outline-none`,l=a?`${Wo}\n${a}`:Wo,u,d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u={diffHeaderHeight:32,hunkSeparatorHeight:24,spacing:0,paddingTop:0,paddingBottom:8},d={paddingTop:0,paddingBottom:0,gap:0},t[8]=u,t[9]=d):(u=t[8],d=t[9]);let f;t[10]!==r||t[11]!==l?(f={...r,unsafeCSS:l,itemMetrics:u,layout:d},t[10]=r,t[11]=l,t[12]=f):f=t[12];let p;return t[13]!==i||t[14]!==s||t[15]!==c||t[16]!==f?(p=(0,$.jsx)(un,{children:(0,$.jsx)(Fo,{...i,...s,className:c,options:f})}),t[13]=i,t[14]=s,t[15]=c,t[16]=f,t[17]=p):p=t[17],p}function Ko(e,t){return async n=>{let r=Gt(n),i=n.prevName?Gt({...n,name:n.prevName}):r,a=await e({changeType:n.type,oldPath:i,newPath:r}),o={name:r,contents:a.newContents,cacheKey:`${t}:new:${r}`};return n.type===`rename-pure`?{oldFile:null,newFile:o}:{oldFile:{name:i,contents:a.oldContents,cacheKey:`${t}:old:${i}`},newFile:o}}}function qo(e,t){return Ko(async({changeType:n,oldPath:r,newPath:i})=>{let a=await e({environmentId:t.environmentId,input:{cwd:t.cwd,sourceKind:t.sourceKind,changeType:n,baseRef:t.baseRef,headRef:t.headRef,oldPath:r,newPath:i}});if(a._tag!==`Success`)throw Ue(a);return a.value},t.cacheKey)}function Jo(e,t){return Ko(async({changeType:n,oldPath:r,newPath:i})=>{let a=await e({environmentId:t.environmentId,input:{...t.reference,...t.commit===null?{}:{commit:t.commit},changeType:n,oldPath:r,newPath:i}});if(a._tag!==`Success`)throw Ue(a);return a.value},t.cacheKey)}var Yo=V,Xo=`--resizable-width`;function Zo(e){let{storageKey:t,defaultWidth:n,minWidth:r,maxWidth:i,edge:a}=e,o=(0,Z.useCallback)(e=>Number.isFinite(e)?Math.max(r,Math.min(i,e)):n,[n,i,r]),s=()=>{if(typeof window>`u`)return n;try{let e=u(t,Yo);return o(e??n)}catch(e){return console.error(`Could not read persisted panel width.`,e),n}},[c,l]=(0,Z.useState)(()=>({storageKey:t,width:s()}));c.storageKey!==t&&l({storageKey:t,width:s()});let d=o(c.width),f=(0,Z.useRef)({clamp:o,storageKey:t,width:d});(0,Z.useLayoutEffect)(()=>{f.current={clamp:o,storageKey:t,width:d}},[o,d,t]);let{refresh:p,...m}=Kn(e=>{let n=e.currentTarget.parentElement;return n?.style.setProperty(`transition-property`,`none`),{width:d,edge:a,resize(e){let t=f.current.clamp(e);return n?.style.setProperty(Xo,`${t}px`),t},finish(e){l({storageKey:t,width:e});try{B(f.current.storageKey,e,Yo)}catch(e){console.error(`Could not persist panel width.`,e)}},cleanup(e){n?.style.removeProperty(`transition-property`),e||n?.style.setProperty(Xo,`${f.current.width}px`)}}},t);return(0,Z.useLayoutEffect)(p,[o,d,p]),{width:d,handlers:m}}var Qo=`t3code:preview-panel-width`,$o=360,es=.7,ts=360,ns=540;function rs(e,t){let n=(0,Q.c)(6),r;n[0]===t?r=n[1]:(r=t===void 0?{}:t,n[0]=t,n[1]=r);let i=r,a=is(e,i.enabled??!0,i.container),o=i.widthStorageKey??Qo,s=i.defaultWidth??ns,c;return n[2]!==a||n[3]!==o||n[4]!==s?(c={storageKey:o,defaultWidth:s,minWidth:$o,maxWidth:a,edge:`left`},n[2]=a,n[3]=o,n[4]=s,n[5]=c):c=n[5],Zo(c)}function is(e,t,n){let r=(0,Q.c)(5),[i,a]=(0,Z.useState)(as),o,s;return r[0]!==n||r[1]!==t||r[2]!==e?(o=()=>{if(typeof window>`u`)return;let r=n??(t?e?.current?.parentElement:null)??null,i=()=>{a(os(window.innerWidth,r?.clientWidth))};i();let o=0,s=()=>{o===0&&(o=window.requestAnimationFrame(()=>{o=0,i()}))};window.addEventListener(`resize`,s);let c=r?$n(r,i):void 0;return()=>{window.removeEventListener(`resize`,s),o!==0&&window.cancelAnimationFrame(o),c?.()}},s=[n,e,t],r[0]=n,r[1]=t,r[2]=e,r[3]=o,r[4]=s):(o=r[3],s=r[4]),(0,Z.useLayoutEffect)(o,s),i}function as(){return os(typeof window>`u`?1280:window.innerWidth)}function os(e,t){let n=Math.floor(e*es),r=t===void 0?1/0:Math.floor(t)-ts;return Math.max($o,Math.min(n,r))}function ss(e){let t=(0,Q.c)(6),{handlers:n,className:r}=e,i;t[0]===r?i=t[1]:(i=K(`group absolute inset-y-0 -left-1 z-20 w-2 cursor-col-resize select-none`,r),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-transparent transition-colors duration-150 group-hover:bg-border group-active:bg-primary/60`}),t[2]=a):a=t[2];let o;return t[3]!==n||t[4]!==i?(o=(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,className:i,...n,children:a}),t[3]=n,t[4]=i,t[5]=o):o=t[5],o}function cs(e){let t=(0,Q.c)(4);if(e.inlineSize){let n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(us,{...e,inlineSize:e.inlineSize}),t[0]=e,t[1]=n),n}let n;return t[2]===e?n=t[3]:(n=(0,$.jsx)(ls,{...e}),t[2]=e,t[3]=n),n}function ls(e){let t=(0,Q.c)(7),n=(0,Z.useRef)(null),r=e.mode===`inline`&&!e.maximized,i;t[0]!==e.defaultWidth||t[1]!==e.widthStorageKey||t[2]!==r?(i={enabled:r,widthStorageKey:e.widthStorageKey,defaultWidth:e.defaultWidth},t[0]=e.defaultWidth,t[1]=e.widthStorageKey,t[2]=r,t[3]=i):i=t[3];let a=rs(n,i),o;return t[4]!==a||t[5]!==e?(o=(0,$.jsx)(us,{...e,inlineSize:a,hostRef:n}),t[4]=a,t[5]=e,t[6]=o):o=t[6],o}function us(e){let t=(0,Q.c)(42);wn&&e.mode!==`sheet`&&e.mode;let n=e.mode===`inline`,r=n&&e.open!==void 0,i=e.open??!0,a=e.maximized??!1,o=(0,Z.useRef)(null),s=e.hostRef??o,{width:c,handlers:l}=e.inlineSize,u;t[0]!==a||t[1]!==i||t[2]!==c?(u=()=>({open:i,width:c,maximized:a,suppressed:!1}),t[0]=a,t[1]=i,t[2]=c,t[3]=u):u=t[3];let[d,f]=(0,Z.useState)(u);(d.open!==i||d.width!==c||d.maximized!==a)&&f({open:i,width:c,maximized:a,suppressed:r&&d.open===i&&(d.width!==c||d.maximized!==a)});let p=d.suppressed,m,h;t[4]===p?(m=t[5],h=t[6]):(m=()=>{if(!p)return;let e=0,t=window.requestAnimationFrame(()=>{e=window.requestAnimationFrame(()=>{f(ds)})});return()=>{window.cancelAnimationFrame(t),window.cancelAnimationFrame(e)}},h=[p],t[4]=p,t[5]=m,t[6]=h),(0,Z.useLayoutEffect)(m,h);let g=n?a?`flex-1 border-l border-border`:`shrink-0 border-l border-border`:`w-full`,_=r&&`[[data-panel-animations=true]_&]:transition-[width] [[data-panel-animations=true]_&]:duration-(--panel-animation-duration) [[data-panel-animations=true]_&]:ease-out`,v=r&&i&&`[[data-panel-animations=true]_&]:starting:w-0!`,y=r&&!i&&`pointer-events-none`,b;t[7]!==g||t[8]!==_||t[9]!==v||t[10]!==y?(b=K(`relative flex h-full min-h-0 min-w-0 max-w-full flex-col self-stretch bg-background`,g,_,v,y),t[7]=g,t[8]=_,t[9]=v,t[10]=y,t[11]=b):b=t[11];let x;t[12]!==r||t[13]!==n||t[14]!==a||t[15]!==i||t[16]!==p||t[17]!==c?(x=n?{[Xo]:`${c}px`,width:a?`100%`:r&&!i?`0px`:`var(${Xo})`,transitionDuration:p?`0ms`:void 0}:void 0,t[12]=r,t[13]=n,t[14]=a,t[15]=i,t[16]=p,t[17]=c,t[18]=x):x=t[18];let S=e.mode,C=a?`true`:`false`,w;t[19]!==l||t[20]!==n||t[21]!==a?(w=n&&!a?(0,$.jsx)(ss,{handlers:l}):null,t[19]=l,t[20]=n,t[21]=a,t[22]=w):w=t[22];let T=r&&`overflow-clip`,E;t[23]===T?E=t[24]:(E=K(`h-full min-h-0 w-full`,T),t[23]=T,t[24]=E);let D;t[25]!==r||t[26]!==a?(D=r&&!a?{width:`calc(var(${Xo}) - 1px)`}:void 0,t[25]=r,t[26]=a,t[27]=D):D=t[27];let O;t[28]!==e.children||t[29]!==D?(O=(0,$.jsx)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,style:D,children:e.children}),t[28]=e.children,t[29]=D,t[30]=O):O=t[30];let k;t[31]!==E||t[32]!==O?(k=(0,$.jsx)(`div`,{className:E,children:O}),t[31]=E,t[32]=O,t[33]=k):k=t[33];let A;return t[34]!==s||t[35]!==e.mode||t[36]!==C||t[37]!==w||t[38]!==k||t[39]!==b||t[40]!==x?(A=(0,$.jsxs)(`div`,{ref:s,className:b,style:x,"data-preview-panel-mode":S,"data-preview-panel-maximized":C,children:[w,k]}),t[34]=s,t[35]=e.mode,t[36]=C,t[37]=w,t[38]=k,t[39]=b,t[40]=x,t[41]=A):A=t[41],A}function ds(e){return{...e,suppressed:!1}}function fs(e){let t=(0,Q.c)(6),{className:n}=e,r;t[0]===n?r=t[1]:(r=K(`relative flex flex-col gap-0.5 overflow-hidden rounded-sm border border-border/60 bg-card p-1 shadow-xs/5`,n),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsxs)(`div`,{className:`flex gap-0.5`,children:[(0,$.jsx)(`span`,{className:`size-[3px] rounded-full bg-destructive/80`}),(0,$.jsx)(`span`,{className:`size-[3px] rounded-full bg-warning/80`}),(0,$.jsx)(`span`,{className:`size-[3px] rounded-full bg-success/80`})]}),t[2]=i):i=t[2];let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsxs)(`div`,{className:`mt-[1px] flex flex-1 flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{className:`h-[2px] w-full rounded-full bg-muted-foreground/30`}),(0,$.jsx)(`span`,{className:`h-[2px] w-3/5 rounded-full bg-muted-foreground/20`})]}),t[3]=a):a=t[3];let o;return t[4]===r?o=t[5]:(o=(0,$.jsxs)(`div`,{"aria-hidden":!0,className:r,children:[i,a]}),t[4]=r,t[5]=o),o}function ps(e){let t=(0,Q.c)(10),n,r,i;t[0]===e.sources?(n=t[1],r=t[2],i=t[3]):(r=e.sources.filter(ms),n=hs,i=r.join(`\0`),t[0]=e.sources,t[1]=n,t[2]=r,t[3]=i);let a;return t[4]!==n||t[5]!==e.className||t[6]!==e.fallback||t[7]!==r||t[8]!==i?(a=(0,$.jsx)(n,{sources:r,fallback:e.fallback,className:e.className},i),t[4]=n,t[5]=e.className,t[6]=e.fallback,t[7]=r,t[8]=i,t[9]=a):a=t[9],a}function ms(e){return!!e}function hs(e){let t=(0,Q.c)(11),[n,r]=(0,Z.useState)(gs),i;if(t[0]!==n||t[1]!==e.sources){let r;t[3]===n?r=t[4]:(r=e=>!n.has(e),t[3]=n,t[4]=r),i=e.sources.find(r),t[0]=n,t[1]=e.sources,t[2]=i}else i=t[2];let a=i;if(!a)return e.fallback;let o;t[5]===a?o=t[6]:(o=()=>r(e=>new Set(e).add(a)),t[5]=a,t[6]=o);let s;return t[7]!==e.className||t[8]!==a||t[9]!==o?(s=(0,$.jsx)(`img`,{src:a,alt:``,"aria-hidden":`true`,draggable:!1,className:e.className,onError:o}),t[7]=e.className,t[8]=a,t[9]=o,t[10]=s):s=t[10],s}function gs(){return new Set}function _s(e){let t=(0,Q.c)(12),n=ya(e.threadRef,e.url),r;t[0]===e.className?r=t[1]:(r=K(`size-7 shrink-0`,e.className),t[0]=e.className,t[1]=r);let i;t[2]===r?i=t[3]:(i=(0,$.jsx)(fs,{className:r}),t[2]=r,t[3]=i);let a=i,o;t[4]===n?o=t[5]:(o=[n],t[4]=n,t[5]=o);let s;t[6]===e.className?s=t[7]:(s=K(`size-7 shrink-0 rounded object-contain`,e.className),t[6]=e.className,t[7]=s);let c;return t[8]!==a||t[9]!==o||t[10]!==s?(c=(0,$.jsx)(ps,{sources:o,fallback:a,className:s}),t[8]=a,t[9]=o,t[10]=s,t[11]=c):c=t[11],c}function vs(e,t){return e==null||t==null?!1:e.trim().toLowerCase()===t.trim().toLowerCase()}function ys(e){return e.capabilities.edit?.changeRequest===!0?e.viewerPermissions.editChangeRequest===void 0?vs(e.viewer,e.author?.login)||e.viewerPermissions.actions.includes(`merge`):e.viewerPermissions.editChangeRequest:!1}function bs(e,t){return e.capabilities.edit?.comment!==!0||t.kind!==`issue-comment`&&t.kind!==`review-comment`?!1:t.canEdit===void 0?vs(e.viewer,t.author?.login):t.canEdit}function xs(e,t){return e.viewerPermissions.resolve&&t.canResolve!==!1}function Ss(e){let t=(0,Q.c)(11),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=K(`flex shrink-0 opacity-0 transition-opacity pointer-coarse:opacity-100 group-focus-within:opacity-100 group-hover:opacity-100 focus-within:opacity-100 motion-reduce:transition-none`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(h,{"aria-hidden":!0,className:`size-3`}),t[5]=a):a=t[5];let o;t[6]===r?o=t[7]:(o=(0,$.jsx)(G,{...r,size:`icon-xs`,variant:`ghost-muted`,children:a}),t[6]=r,t[7]=o);let s;return t[8]!==i||t[9]!==o?(s=(0,$.jsx)(`span`,{className:i,children:o}),t[8]=i,t[9]=o,t[10]=s):s=t[10],s}function Cs(e,t,n,r){i(e);function i(e){if(e.children!==void 0)for(let a=0;a<e.children.length;a+=1){let o=e.children[a];if(r.has(o.type))continue;if(o.type!==`text`||o.value===void 0){i(o);continue}let s=[],c=0,l=!1;t.lastIndex=0;let u=t.exec(o.value);for(;u!==null;){let e=u.index,r=n(u[0],{index:e,input:u.input});if(r===!1?t.lastIndex=e+1:(c<e&&s.push({type:`text`,value:o.value.slice(c,e)}),s.push(r),c=e+u[0].length,l=!0),!t.global)break;u=t.exec(o.value)}l&&(c<o.value.length&&s.push({type:`text`,value:o.value.slice(c)}),e.children.splice(a,1,...s),a+=s.length-1)}}}var ws=/^\s{0,3}((?:`{3,})|(?:~{3,}))(.*)$/u,Ts=8,Es=/^(?: {4}|\t)/u,Ds=/^<?(https?:\/\/\S+?)>?$/u,Os=/\.(?:png|jpe?g|gif|webp|avif|heic|heif|svg)(?:$|[?#])/iu,ks=/^\[[^\]]*\]\((https?:\/\/[^\s)]+)\)$/u,As=/\.(?:mp4|webm|mov|m4v|ogv)(?:$|[?#])/iu,js=/^https:\/\/github\.com\/user-attachments\/assets\/[\w-]+$/iu,Ms=/<(?:video|source)\b[^>]*\bsrc\s*=\s*["']([^"']+)["']/iu,Ns=/^\s*<video\b/iu,Ps=/<\/video>\s*$/iu;function Fs(e){try{let t=new URL(e);return t.protocol===`https:`||t.protocol===`http:`}catch{return!1}}function Is(e){let t=Ds.exec(e.trim())?.[1]??ks.exec(e.trim())?.[1];return t===void 0||!Fs(t)?null:As.test(t)||js.test(t)?{url:t,media:`video`}:Os.test(t)?{url:t,media:`image`}:null}function Ls(e){let t=[],n=[],r=null,i=()=>{let e=n.join(`
205
205
  `).replace(/^\n+/u,``).replace(/\s+$/u,``);n.length=0,e.trim().length>0&&t.push({id:`markdown:${t.length}`,kind:`markdown`,text:e})},a=e.split(`
206
206
  `);for(let e=0;e<a.length;e+=1){let o=a[e],s=ws.exec(o);if(s!==null){let e=s[1],t=r!==null&&e[0]===r[0]&&e.length>=r.length&&s[2].trim().length===0;r===null?r=e:t&&(r=null),n.push(o);continue}if(r!==null||Es.test(o)){n.push(o);continue}let c=Is(o);if(c!==null){i(),t.push({id:`attachment:${t.length}`,kind:`attachment`,...c});continue}if(!Ns.test(o)){n.push(o);continue}let l=Math.min(e+Ts,a.length)-1,u=e;for(;u<l&&!Ps.test(a[u]);)u+=1;let d=Ps.test(a[u])?Ms.exec(a.slice(e,u+1).join(`
207
- `))?.[1]:void 0;d!==void 0&&Fs(d)?(i(),t.push({id:`attachment:${t.length}`,kind:`attachment`,url:d,media:`video`}),e=u):n.push(o)}return i(),t}var Rs=/#[1-9]\d*|[0-9a-f]{40}/giu,zs=/[A-Za-z0-9_]/u,Bs=/[\s([{]/u,Vs=new Set([`link`,`linkReference`]);function Hs(e){let t=e.repositoryUrl.replace(/\/+$/u,``);return e=>{Cs(e,Rs,(e,n)=>{let r=e.startsWith(`#`),i=n.input[n.index-1],a=n.input[n.index+e.length];return i!==void 0&&(r?zs.test(i):!Bs.test(i))||a!==void 0&&zs.test(a)?!1:{type:`link`,url:r?`${t}/issues/${e.slice(1)}`:`${t}/commit/${e}`,data:{hProperties:{dataPullRequestAutolink:r?`reference`:`commit`}},children:[{type:`text`,value:r?e:e.slice(0,7)}]}},Vs)}}var Us=(0,Z.createContext)(null);function Ws(e){let t=(0,Q.c)(7),{environmentId:n,cwd:r,url:i,fetchUrl:a}=e,o;t[0]!==r||t[1]!==a?(o={_tag:`github-media`,cwd:r,url:a},t[0]=r,t[1]=a,t[2]=o):o=t[2];let s=o,c=ar(n,s),l=ir(n,s),u=c._tag===`Success`?c.url:c._tag===`Failure`?a:null,d=u===null?null:u+Cn(i),f;return t[3]!==l||t[4]!==d||t[5]!==i?(f=(0,$.jsx)(et,{src:d,originalUrl:i,label:`Pull request video`,className:`w-full`,videoClassName:`rounded-lg border border-border/60`,onRetry:l}),t[3]=l,t[4]=d,t[5]=i,t[6]=f):f=t[6],f}function Gs(e){let t=(0,Q.c)(12),{text:n,cwd:r,environmentId:i,threadRef:a,className:o}=e,s=Ls(n),c=(0,Z.useContext)(Us),l=c?.repositoryUrl,u=a??c?.threadRef??void 0,d;t[0]===l?d=t[1]:(d=l?[[Hs,{repositoryUrl:l}]]:[],t[0]=l,t[1]=d);let f=d,p;t[2]===o?p=t[3]:(p=K(`space-y-3 [&_[data-markdown-details]]:border-0 [&_[data-markdown-details-summary]]:text-foreground/80 [&_[data-markdown-details-summary]>svg]:text-muted-foreground/60`,o),t[2]=o,t[3]=p);let m;t[4]!==r||t[5]!==i||t[6]!==f||t[7]!==u?(m=e=>{if(e.kind===`markdown`||e.media===`image`)return(0,$.jsx)(nt,{text:e.kind===`markdown`?e.text:`![](<${e.url}>)`,cwd:r,threadRef:u,pullRequestPanelRef:u??Dt,environmentId:i,extraRemarkPlugins:f,githubMedia:!0},e.id);let t=e.media===`video`?rt(e.url):null;return t===null?e.media===`video`?(0,$.jsx)(et,{src:e.url,originalUrl:e.url,label:`Pull request video`,className:`w-full`,videoClassName:`rounded-lg border border-border/60`},`${e.id}:${e.url}`):(0,$.jsxs)(`a`,{href:e.url,rel:`noreferrer noopener`,target:`_blank`,className:`flex items-center gap-2 rounded-lg border border-border/60 bg-muted/30 px-3 py-2 text-sm hover:bg-muted/60`,children:[(0,$.jsx)(Le,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`Open attachment on GitHub`}),(0,$.jsx)(O,{"aria-hidden":!0,className:`size-3 shrink-0 text-muted-foreground`})]},e.id):(0,$.jsx)(Ws,{environmentId:i,cwd:r,url:e.url,fetchUrl:t},`${e.id}:${e.url}`)},t[4]=r,t[5]=i,t[6]=f,t[7]=u,t[8]=m):m=t[8];let h=s.map(m),g;return t[9]!==p||t[10]!==h?(g=(0,$.jsx)(`div`,{className:p,"data-image-gallery":!0,children:h}),t[9]=p,t[10]=h,t[11]=g):g=t[11],g}function Ks(e){let t=(0,Q.c)(52),{value:n,cwd:r,environmentId:i,threadRef:a,placeholder:o,label:s,saving:c,allowEmpty:l,className:u,onSave:d,onCancel:f}=e,p=a===void 0?null:a,m=l!==void 0&&l,h=St(i,Ie),[g,_]=(0,Z.useState)(n),[v,y]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(n);b!==n&&(x(n),_(n));let S;t[0]===g?S=t[1]:(S=g.trim(),t[0]=g,t[1]=S);let C=S.length===0,w=!h||c||C&&!m,T;t[2]===u?T=t[3]:(T=K(`space-y-2`,u),t[2]=u,t[3]=T);let E;t[4]!==g||t[5]!==i||t[6]!==f||t[7]!==d||t[8]!==w||t[9]!==c?(E=e=>{if(!(e.nativeEvent.isComposing||e.keyCode===229)){if(e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&!e.shiftKey&&!e.altKey){e.preventDefault(),e.stopPropagation(),!w&&!e.repeat&&Ct(i,`source-control:write`)&&d(g);return}e.key!==`Escape`||c||(e.preventDefault(),f())}},t[4]=g,t[5]=i,t[6]=f,t[7]=d,t[8]=w,t[9]=c,t[10]=E):E=t[10];let D=v?`preview`:`write`,O;t[11]===D?O=t[12]:(O=[D],t[11]=D,t[12]=O);let k,A,j;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{let t=e[0];(t===`write`||t===`preview`)&&y(t===`preview`)},j=(0,$.jsx)(An,{value:`write`,children:`Write`}),k=(0,$.jsx)(An,{value:`preview`,children:`Preview`}),t[13]=k,t[14]=A,t[15]=j):(k=t[13],A=t[14],j=t[15]);let M;t[16]!==c||t[17]!==O?(M=(0,$.jsxs)(kn,{"aria-label":`Markdown editor mode`,variant:`segmented`,value:O,disabled:c,onValueChange:A,children:[j,k]}),t[16]=c,t[17]=O,t[18]=M):M=t[18];let N;t[19]!==r||t[20]!==g||t[21]!==C||t[22]!==i||t[23]!==s||t[24]!==o||t[25]!==v||t[26]!==c||t[27]!==p?(N=v?(0,$.jsx)(`div`,{className:`rounded-lg border border-border/60 px-3 py-2`,children:C?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Nothing to preview.`}):(0,$.jsx)(Gs,{text:g,cwd:r,environmentId:i,threadRef:p})}):(0,$.jsx)(Dn,{autoFocus:!0,disabled:c,value:g,rows:6,placeholder:o,"aria-label":s,onChange:e=>_(e.target.value)}),t[19]=r,t[20]=g,t[21]=C,t[22]=i,t[23]=s,t[24]=o,t[25]=v,t[26]=c,t[27]=p,t[28]=N):N=t[28];let P;t[29]!==f||t[30]!==c?(P=(0,$.jsx)(G,{size:`xs`,variant:`ghost`,disabled:c,onClick:f,children:`Cancel`}),t[29]=f,t[30]=c,t[31]=P):P=t[31];let F=!h||c||C&&!m,I;t[32]!==m||t[33]!==g||t[34]!==C||t[35]!==i||t[36]!==d||t[37]!==c?(I=()=>{!Ct(i,`source-control:write`)||c||C&&!m||d(g)},t[32]=m,t[33]=g,t[34]=C,t[35]=i,t[36]=d,t[37]=c,t[38]=I):I=t[38];let L=c?`Saving...`:`Save`,R;t[39]!==F||t[40]!==I||t[41]!==L?(R=(0,$.jsx)(G,{size:`xs`,variant:`outline`,disabled:F,onClick:I,children:L}),t[39]=F,t[40]=I,t[41]=L,t[42]=R):R=t[42];let z;t[43]!==P||t[44]!==R?(z=(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[P,R]}),t[43]=P,t[44]=R,t[45]=z):z=t[45];let B;return t[46]!==M||t[47]!==N||t[48]!==z||t[49]!==T||t[50]!==E?(B=(0,$.jsxs)(`div`,{className:T,onKeyDown:E,children:[M,N,z]}),t[46]=M,t[47]=N,t[48]=z,t[49]=T,t[50]=E,t[51]=B):B=t[51],B}var qs=[`thumbs-up`,`thumbs-down`,`laugh`,`hooray`,`confused`,`heart`,`rocket`,`eyes`],Js={"thumbs-up":`👍`,"thumbs-down":`👎`,laugh:`😄`,hooray:`🎉`,confused:`😕`,heart:`❤️`,rocket:`🚀`,eyes:`👀`},Ys={"thumbs-up":`thumbs up`,"thumbs-down":`thumbs down`,laugh:`laugh`,hooray:`hooray`,confused:`confused`,heart:`heart`,rocket:`rocket`,eyes:`eyes`};function Xs(e){return Js[e]}function Zs(e){return Ys[e]}var Qs=3;function $s(e){return e.length<=1?e[0]??``:e.length===2?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(`, `)}, and ${e.at(-1)}`}function ec(e,t){return t?`${e} ${e===1?`other`:`others`}`:`${e} ${e===1?`person`:`people`}`}function tc(e){let t=e.actors.length<e.count,n=(e.viewerHasReacted&&t?[`You`,...e.actors]:[...e.actors]).slice(0,Math.min(Qs,e.count)),r=Math.max(0,e.count-n.length);return`${$s([...n,...r>0?[ec(r,n.length>0)]:[]])} reacted with ${Zs(e.content)} emoji`}function nc(e,t){if(t.size===0)return e;let n=new Map(e.map(e=>[e.content,e]));for(let[e,r]of t){let t=n.get(e);if(t===void 0){r&&n.set(e,{content:e,count:1,actors:[],viewerHasReacted:!0});continue}if(t.viewerHasReacted===r)continue;let i=t.count+(r?1:-1);i<=0?n.delete(e):n.set(e,{...t,count:i,viewerHasReacted:r})}return qs.flatMap(e=>n.get(e)??[])}var rc=`inline-flex h-6 shrink-0 items-center gap-1 rounded-full border px-2 text-xs outline-none transition-colors focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,ic=new Map;function ac(e){return e.map(e=>`${e.content}:${e.count}:${+!!e.viewerHasReacted}`).join(` `)}function oc(e){let t=(0,Q.c)(23),{reactions:n,canReact:r,subjectId:i,environmentId:a,reference:o,onRefresh:s,className:c}=e,[l,u]=(0,Z.useState)(!1),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d={signature:``,values:ic},t[0]=d):d=t[0];let[f,p]=(0,Z.useState)(d),m;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(m={reportFailure:!1},t[1]=m):m=t[1];let h=Tt(Ur.setReaction,m),g,_,v,y;if(t[2]!==r||t[3]!==c||t[4]!==a||t[5]!==s||t[6]!==f.signature||t[7]!==f.values||t[8]!==l||t[9]!==n||t[10]!==o||t[11]!==h||t[12]!==i){y=Symbol.for(`react.early_return_sentinel`);bb0:{let e=ac(n),d=f.signature===e?f.values:ic,m=nc(n,d),b=async(t,n)=>{if(p({signature:e,values:new Map([...d,[t,n]])}),(await h({environmentId:a,input:{...o,...i===void 0?{}:{subjectId:i},content:t,reacted:n}}))._tag===`Failure`){p(e=>{let n=new Map(e.values);return n.delete(t),{signature:e.signature,values:n}}),lt.add({type:`error`,title:`The reaction could not be saved`});return}s()};if(m.length===0&&!r){y=null;break bb0}t[17]===c?g=t[18]:(g=K(`flex min-w-0 max-w-full flex-wrap items-center gap-1`,c),t[17]=c,t[18]=g),_=m.map(e=>(0,$.jsxs)(Y,{children:[(0,$.jsxs)(q,{render:(0,$.jsx)(`button`,{type:`button`,"aria-pressed":e.viewerHasReacted,"aria-label":`${Zs(e.content)}, ${e.count}`,disabled:!r,className:K(rc,e.viewerHasReacted?`border-primary/60 bg-primary/10 text-foreground`:`border-border/70 bg-muted/40 text-muted-foreground`,r?`hover:border-primary/60`:`cursor-default`),onClick:()=>void b(e.content,!e.viewerHasReacted)}),children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:Xs(e.content)}),(0,$.jsx)(`span`,{className:`tabular-nums`,children:e.count})]}),(0,$.jsx)(J,{side:`top`,children:tc(e)})]},e.content)),v=r?(0,$.jsxs)(Yr,{open:l,onOpenChange:u,children:[(0,$.jsx)(Jr,{render:(0,$.jsx)(`button`,{type:`button`,"aria-label":`Add a reaction`,className:K(rc,`border-border/70 px-1.5 text-muted-foreground hover:border-primary/60 hover:text-foreground`)}),children:(0,$.jsx)(ge,{"aria-hidden":!0,className:`size-3.5`})}),(0,$.jsx)(Kr,{align:`start`,side:`top`,padding:`compact`,children:(0,$.jsx)(`div`,{className:`flex items-center gap-0.5`,children:qs.map(e=>{let t=m.find(t=>t.content===e)?.viewerHasReacted??!1;return(0,$.jsx)(`button`,{type:`button`,"aria-pressed":t,"aria-label":Zs(e),className:K(`flex size-7 items-center justify-center rounded-md text-base outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,t&&`bg-primary/10`),onClick:()=>{u(!1),b(e,!t)},children:(0,$.jsx)(`span`,{"aria-hidden":!0,children:Xs(e)})},e)})})})]}):null}t[2]=r,t[3]=c,t[4]=a,t[5]=s,t[6]=f.signature,t[7]=f.values,t[8]=l,t[9]=n,t[10]=o,t[11]=h,t[12]=i,t[13]=g,t[14]=_,t[15]=v,t[16]=y}else g=t[13],_=t[14],v=t[15],y=t[16];if(y!==Symbol.for(`react.early_return_sentinel`))return y;let b;return t[19]!==g||t[20]!==_||t[21]!==v?(b=(0,$.jsxs)(`div`,{className:g,children:[_,v]}),t[19]=g,t[20]=_,t[21]=v,t[22]=b):b=t[22],b}var sc=`mx-3 my-2 rounded-xl border border-border/70 bg-background p-3 text-sm shadow-sm`;function cc(e){return t=>{t.key===`Escape`&&e.onCancel&&(t.preventDefault(),e.onCancel()),bn(t,e.value,e.pending)&&(t.preventDefault(),e.onSubmit())}}function lc(e){return e===`left`?`deletions`:`additions`}function uc(e){switch(e.kind){case`added`:return{line:e.newLine,side:`right`};case`deleted`:return{line:e.oldLine,side:`left`};case`context`:return{line:e.side===`left`?e.oldLine:e.newLine,side:e.side}}}function dc(e){let t=(0,Q.c)(11),{comment:n,onRemove:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=K(sc,`border-dashed`),t[0]=i):i=t[0];let a,o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(Ae,{className:`size-3.5`}),o=(0,$.jsx)(`span`,{children:`Pending — sent when you submit the review`}),t[1]=a,t[2]=o):(a=t[1],o=t[2]);let s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(l,{className:`size-3.5`}),t[3]=s):s=t[3];let c;t[4]===r?c=t[5]:(c=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[a,o,(0,$.jsx)(G,{size:`icon-xs`,variant:`ghost`,className:`ml-auto`,"aria-label":`Discard this comment`,onClick:r,children:s})]}),t[4]=r,t[5]=c);let u;t[6]===n.body?u=t[7]:(u=(0,$.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap leading-relaxed`,children:n.body}),t[6]=n.body,t[7]=u);let d;return t[8]!==c||t[9]!==u?(d=(0,$.jsxs)(`div`,{className:i,contentEditable:!1,onPointerDown:fc,children:[c,u]}),t[8]=c,t[9]=u,t[10]=d):d=t[10],d}function fc(e){return e.stopPropagation()}function pc({thread:e,workspaceRoot:t,canReply:n,canResolve:r,canReact:i,environmentId:a,reference:o,pending:s,fixPending:c,fixLabel:l=`Fix in a thread`,onFix:u,onReply:d,onLoadMore:f,canEditComment:m,onEditComment:h,onToggleResolved:g,onReacted:_}){let[v,y]=(0,Z.useState)(!e.isResolved),[b,x]=(0,Z.useState)(!1),[S,C]=(0,Z.useState)(``),[w,T]=(0,Z.useState)(null),[E,D]=(0,Z.useState)(!1),O=(0,Z.useRef)(!1),[k,A]=(0,Z.useState)(null),[j,M]=(0,Z.useState)(!1),N=k?.threadId===e.id?k:null,P=$r(e.comments,N?.comments??[]),F=N===null?e.nextCommentsCursor??null:N.nextCursor,I=e.commentCount??P.length,L=async(t,n)=>{if(E)return;D(!0);let r=await h(t,n);D(!1),r&&(A(r=>r?.threadId===e.id?{...r,comments:Si(r.comments,t,n)}:r),T(null))},R=async()=>{let t=S.trim();if(!(t.length===0||s||O.current)){O.current=!0;try{await d(t)&&(A(t=>t?.threadId===e.id?{...t,nextCursor:t.nextCursor??e.nextCommentsCursor??null}:t),C(``),x(!1))}finally{O.current=!1}}},z=async()=>{if(!(F===null||j)){M(!0);try{let t=await f(F);if(t===null)return;A(n=>({threadId:e.id,comments:$r(n?.threadId===e.id?n.comments:[],t.comments),nextCursor:t.nextCursor}))}finally{M(!1)}}};return(0,$.jsxs)(`div`,{className:sc,contentEditable:!1,onPointerDown:e=>e.stopPropagation(),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(gt,{className:K(`size-3.5`,e.isResolved&&`text-success-foreground`),icon:e.isResolved?ht:_t}),(0,$.jsxs)(`button`,{type:`button`,className:`hover:text-foreground`,"aria-expanded":v,onClick:()=>y(e=>!e),children:[e.isResolved?`Resolved`:`Open`,` · `,I,` `,I===1?`comment`:`comments`]}),e.isOutdated?(0,$.jsx)(`span`,{children:`outdated`}):null,u?(0,$.jsxs)(G,{size:`xs`,variant:`ghost`,className:`ml-auto`,disabled:s||c,onClick:u,children:[(0,$.jsx)(p,{className:`size-3`}),c?`Preparing...`:l]}):null,r?(0,$.jsx)(G,{size:`xs`,variant:`ghost`,className:u?void 0:`ml-auto`,disabled:s,onClick:g,children:e.isResolved?`Unresolve`:`Resolve`}):null]}),(0,$.jsx)(pa,{open:v,children:(0,$.jsxs)(ua,{children:[(0,$.jsx)(`div`,{className:`mt-2 space-y-3`,children:P.map(e=>(0,$.jsxs)(`article`,{className:`group min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(Or,{actor:e.author}),(0,$.jsx)(`span`,{children:wn(e.createdAt)}),(0,$.jsx)(oc,{className:`ml-auto justify-end`,reactions:e.reactions??[],canReact:i,subjectId:e.id,environmentId:a,reference:o,onRefresh:_})]}),w===e.id?(0,$.jsx)(Ks,{className:`mt-1`,value:e.body,cwd:t,environmentId:a,label:`Edit comment`,saving:E,onSave:t=>void L(e.id,t),onCancel:()=>T(null)}):(0,$.jsxs)(`div`,{className:`mt-1 flex items-start gap-1`,children:[(0,$.jsx)(Gs,{className:`min-w-0 flex-1 text-sm`,text:e.body,cwd:t,environmentId:a}),m(e)?(0,$.jsx)(Ss,{"aria-label":`Edit comment`,onClick:()=>T(e.id)}):null]})]},e.id))}),F===null?null:(0,$.jsx)(`div`,{className:`mt-2`,children:(0,$.jsx)(G,{size:`xs`,variant:`ghost`,disabled:j,onClick:()=>void z(),children:j?`Loading...`:`Load more comments`})}),n?b?(0,$.jsxs)(`div`,{className:`mt-2`,children:[(0,$.jsx)(Dn,{autoFocus:!0,size:`sm`,value:S,placeholder:`Reply`,"aria-label":`Reply to this conversation`,onChange:e=>C(e.target.value),onKeyDown:cc({value:S,pending:s,onSubmit:()=>void R(),onCancel:()=>x(!1)})}),(0,$.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[(0,$.jsx)(G,{size:`xs`,variant:`ghost`,onClick:()=>x(!1),children:`Cancel`}),(0,$.jsx)(G,{size:`xs`,disabled:s||S.trim().length===0,onClick:()=>void R(),children:`Reply`})]})]}):(0,$.jsx)(G,{size:`xs`,variant:`ghost`,className:`mt-2`,onClick:()=>x(!0),children:`Reply`}):null]})})]})}function mc(e){return e.repositoryIdentity?.canonicalKey?.toLowerCase()}function hc(e,t,n){let r=new Map(t.map((e,t)=>[e,t])),i=new Map;for(let t of e){let e=mc(t);if(!e)continue;let a=r.get(t.environmentId);if(a===void 0)continue;let o=i.get(e);if(o===void 0){i.set(e,t.environmentId);continue}o!==n&&(t.environmentId===n||a<(r.get(o)??2**53-1))&&i.set(e,t.environmentId)}let a=new Map;for(let t of e){if(!r.has(t.environmentId))continue;let e=mc(t);if(e&&i.get(e)!==t.environmentId)continue;let n=a.get(t.environmentId);n===void 0?a.set(t.environmentId,[t.id]):n.push(t.id)}return a}function gc(e,t,n){let r=t.find(t=>t.environmentId===e.environmentId&&t.id===e.projectId),i=r===void 0?void 0:mc(r),a=n.find(t=>t.environmentId===e.environmentId);if(r===void 0||!i||a===void 0)return[];let o=n.flatMap(n=>{if(n.environmentId===e.environmentId)return[];let r=t.find(e=>e.environmentId===n.environmentId&&mc(e)===i);return r===void 0?[]:[{environmentId:n.environmentId,projectId:r.id,workspaceRoot:r.workspaceRoot,label:n.label,...n.machine===void 0?{}:{machine:n.machine}}]});return o.length===0?[]:[{environmentId:e.environmentId,projectId:r.id,workspaceRoot:r.workspaceRoot,label:a.label,...a.machine===void 0?{}:{machine:a.machine}},...o]}function _c(e,t){let n=t.host?.toLowerCase();if(!n)return null;let r=e.filter(e=>e.host.toLowerCase()===n&&e.repository.toLowerCase()===t.repository.toLowerCase()),i=r.filter(e=>e.number===t.number),a=(i.length>0?i:r.filter(e=>e.stack?.layers.some(e=>e.number===t.number))).toSorted((e,t)=>Date.parse(t.snapshot?.syncedAt??t.linkedAt)-Date.parse(e.snapshot?.syncedAt??e.linkedAt))[0]?.stack;return!a||!a.layers.some(e=>e.number===t.number)?null:{id:a.id,number:a.number,url:a.url,base:a.base,layers:a.layers.map(e=>{let t=r.filter(t=>t.number===e.number).toSorted((e,t)=>Date.parse(t.snapshot?.syncedAt??t.linkedAt)-Date.parse(e.snapshot?.syncedAt??e.linkedAt))[0]?.snapshot;return{...e,...t?{title:t.title,isDraft:t.isDraft}:{}}})}}function vc(e,t){let n=e.isSuccess?e.data:e.data??t;return{data:n,isFresh:e.isSuccess,notice:n===null?null:e.error?`Stack data may be stale. We couldn’t refresh it.`:!e.isSuccess||e.isPending?`Refreshing stack… Showing saved data.`:null}}function yc(e,t){let n=(0,Q.c)(13),r=Ke(),i;n[0]!==e||n[1]!==t||n[2]!==r?(i=t===null?null:_c(r.filter(t=>t.environmentId===e).flatMap(bc),t),n[0]=e,n[1]=t,n[2]=r,n[3]=i):i=n[3];let a=i,o;n[4]!==e||n[5]!==t?(o=t===null?null:Rr({environmentId:e,input:t}),n[4]=e,n[5]=t,n[6]=o):o=n[6];let s=wt(o),c;n[7]!==s||n[8]!==a?(c=vc(s,a),n[7]=s,n[8]=a,n[9]=c):c=n[9];let l;return n[10]!==s||n[11]!==c?(l={...s,...c},n[10]=s,n[11]=c,n[12]=l):l=n[12],l}function bc(e){return e.pullRequests??[]}function xc(e){let t=(0,Q.c)(12),{children:n,className:r}=e,i=(0,Z.useRef)(null),[a,o]=(0,Z.useState)(null),s,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=i.current;if(e)return rr(e,e=>{let t=Math.ceil(e.at(-1)?.contentRect.width??0);t>0&&o(t)})},c=[],t[0]=s,t[1]=c):(s=t[0],c=t[1]),(0,Z.useLayoutEffect)(s,c);let l;t[2]===r?l=t[3]:(l=K(`inline-block overflow-hidden transition-[width] duration-150 ease-out motion-reduce:transition-none`,r),t[2]=r,t[3]=l);let u;t[4]===a?u=t[5]:(u=a===null?void 0:{width:a},t[4]=a,t[5]=u);let d;t[6]===n?d=t[7]:(d=(0,$.jsx)(`span`,{ref:i,className:`block w-max whitespace-nowrap`,children:n}),t[6]=n,t[7]=d);let f;return t[8]!==l||t[9]!==u||t[10]!==d?(f=(0,$.jsx)(`span`,{"data-slot":`animated-width`,className:l,style:u,children:d}),t[8]=l,t[9]=u,t[10]=d,t[11]=f):f=t[11],f}var Sc=3e5,Cc=36e4;function wc(e){return e.visible&&e.now-e.lastRefreshedAt>=1e4}function Tc(e){return e.lastRefreshedAt!==void 0&&wc({...e,lastRefreshedAt:e.lastRefreshedAt})}function Ec(e){return e.now-e.lastInteractedAt<36e4&&wc(e)}var Dc=new Map,Oc=0,kc=new Set,Ac=[`pointerdown`,`pointermove`,`keydown`,`wheel`],jc=()=>{let e=Date.now(),t=e-Oc>=Cc;if(Oc=e,t)for(let e of kc)e()};function Mc(e){if(kc.size===0){Oc=Date.now();for(let e of Ac)document.addEventListener(e,jc,{passive:!0})}return kc.add(e),()=>{if(kc.delete(e),!(kc.size>0))for(let e of Ac)document.removeEventListener(e,jc)}}function Nc(e,t={}){let{enabled:n=!0,key:r,intervalMs:i=Sc}=t,a=(0,Z.useRef)(e);a.current=e;let o=(0,Z.useId)(),s=r??o;(0,Z.useEffect)(()=>{if(!n)return;let e=e=>{a.current!==null&&(Dc.set(s,e),a.current())},t=()=>document.visibilityState===`visible`,r=()=>{let n=Date.now();if(n-Oc>=36e4)return;let r=Dc.get(s);if(r===void 0){Dc.set(s,n);return}Tc({visible:t(),now:n,lastRefreshedAt:r})&&e(n)},o=()=>{let n=Date.now(),r=Dc.get(s)??n;Ec({visible:t(),now:n,lastRefreshedAt:r,lastInteractedAt:Oc})&&e(n)},c,l=()=>{clearInterval(c),c=t()?setInterval(o,i):void 0},u=()=>{r(),l()},d=Mc(()=>{r(),l()});return r(),l(),window.addEventListener(`focus`,r),document.addEventListener(`visibilitychange`,u),()=>{clearInterval(c),window.removeEventListener(`focus`,r),document.removeEventListener(`visibilitychange`,u),d()}},[n,s,i])}function Pc(e){let t=(0,Q.c)(22),{layer:n,compact:r}=e,i=r!==void 0&&r,a,o,s,c;t[0]!==n.isDraft||t[1]!==n.state?(o=_r({state:n.state,isDraft:n.isDraft??!1}),a=o.Icon,s=!0,c=K(`size-4 shrink-0`,o.toneClassName),t[0]=n.isDraft,t[1]=n.state,t[2]=a,t[3]=o,t[4]=s,t[5]=c):(a=t[2],o=t[3],s=t[4],c=t[5]);let l;t[6]!==a||t[7]!==s||t[8]!==c?(l=(0,$.jsx)(a,{"aria-hidden":s,className:c}),t[6]=a,t[7]=s,t[8]=c,t[9]=l):l=t[9];let u=n.title||n.headBranch,d;t[10]===u?d=t[11]:(d=(0,$.jsx)(`span`,{className:`block truncate`,children:u}),t[10]=u,t[11]=d);let f=i?null:`${n.headBranch} · `,p;t[12]!==n.number||t[13]!==o.label||t[14]!==f?(p=(0,$.jsxs)(`span`,{className:`block truncate text-xs font-normal text-muted-foreground`,children:[`#`,n.number,` · `,f,o.label]}),t[12]=n.number,t[13]=o.label,t[14]=f,t[15]=p):p=t[15];let m;t[16]!==d||t[17]!==p?(m=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[d,p]}),t[16]=d,t[17]=p,t[18]=m):m=t[18];let h;return t[19]!==l||t[20]!==m?(h=(0,$.jsxs)($.Fragment,{children:[l,m]}),t[19]=l,t[20]=m,t[21]=h):h=t[21],h}function Fc(e){let t=(0,Q.c)(14),{stack:n,reference:r,onSelect:i,pending:a}=e,o=a!==void 0&&a,s;if(t[0]!==i||t[1]!==o||t[2]!==r||t[3]!==n.layers){let e;t[5]!==i||t[6]!==o||t[7]!==r?(e=e=>(0,$.jsxs)(W,{onClick:()=>{i?.({...r,number:e.number})},disabled:!i||o,"aria-current":e.number===r.number?`true`:void 0,children:[(0,$.jsx)(Pc,{layer:e}),e.number===r.number?(0,$.jsx)(me,{"aria-hidden":!0,className:`size-3.5`}):null]},e.number),t[5]=i,t[6]=o,t[7]=r,t[8]=e):e=t[8],s=n.layers.toReversed().map(e),t[0]=i,t[1]=o,t[2]=r,t[3]=n.layers,t[4]=s}else s=t[4];let c;t[9]===n.base?c=t[10]:(c=(0,$.jsxs)(E,{children:[`↳ `,n.base]}),t[9]=n.base,t[10]=c);let l;return t[11]!==s||t[12]!==c?(l=(0,$.jsxs)(`div`,{className:`max-h-80 overflow-y-auto`,children:[s,c]}),t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function Ic(e){let t=(0,Q.c)(8),{number:n,notice:r,stale:i}=e,a=i!==void 0&&i,o;t[0]===n?o=t[1]:(o=(0,$.jsxs)(`span`,{children:[`Stack #`,n]}),t[0]=n,t[1]=o);let s;t[2]!==r||t[3]!==a?(s=r?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`span`,{role:`status`,className:`text-xs font-normal`}),children:a?`May be stale`:`Refreshing…`}),(0,$.jsx)(J,{children:r})]}):null,t[2]=r,t[3]=a,t[4]=s):s=t[4];let c;return t[5]!==o||t[6]!==s?(c=(0,$.jsx)(E,{children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[o,s]})}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function Lc(e){let t=(0,Q.c)(107),{hostLabel:n,stack:r,reference:i,environmentId:a,canMerge:o,canRebase:s,mergeMethod:c,onSelect:l,onActed:u,notice:d,onRetry:f}=e,[p,h]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(null),[v,b]=(0,Z.useState)(!1),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x={reportFailure:!1},t[0]=x):x=t[0];let S=Tt(Ur.runAction,x),C,T,E,D,O,k,A,j,M,N,P,F;if(t[1]!==o||t[2]!==s||t[3]!==g||t[4]!==a||t[5]!==n||t[6]!==c||t[7]!==d||t[8]!==u||t[9]!==f||t[10]!==l||t[11]!==p||t[12]!==v||t[13]!==i||t[14]!==S||t[15]!==r){let e=r.layers.at(-1),x=r.layers.filter(qc),I=x.some(Kc),L;t[28]===i?L=t[29]:(L=e=>e.number===i.number,t[28]=i,t[29]=L);let R=r.layers.findIndex(L)+1,z=r.layers.slice(0,R).filter(Gc),B=r.layers[R-1],V=z.some(Wc),H=x.flatMap(Uc).length!==x.length,ee=v||B?.state!==`open`||z.some(Hc)||V||z.length===0||z.some(Vc),te=v||H||I||x.length===0;D=async()=>{if(v||!g||(g===`merge`?!o||ee:!s||te))return;let t=g,l=t===`merge`?B:e;if(!l?.headSha)return;let d=(t===`merge`?z:x).flatMap(Bc);b(!0),_(null);let f=lt.add({type:`loading`,title:t===`merge`?`Merging stack...`:`Rebasing stack...`}),p=await S({environmentId:a,input:{...i,number:l.number,stackNumber:r.number,expectedStackHeads:d,action:t,...t===`merge`?{mergeMethod:c}:{updateMethod:`rebase`}}});b(!1),u(),p._tag===`Failure`?lt.update(f,{type:`error`,title:t===`merge`?`Could not merge the stack`:`Could not rebase the stack`,description:String(Ue(p))}):lt.update(f,{type:`success`,title:t===`merge`?`Stack merge request completed`:`Stack rebased`,description:t===`merge`?`${n} merged the stack or added it to its merge queue.`:void 0})};let ne=g===`merge`?z:x,U=`Stack ${r.number}, layer ${R} of ${r.layers.length}`,re;t[30]===U?re=t[31]:(re=(0,$.jsx)(G,{variant:`ghost`,size:`xs`,"aria-label":U}),t[30]=U,t[31]=re);let ie;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsx)(Ir.stack,{"aria-hidden":!0,className:`size-3.5`}),t[32]=ie):ie=t[32];let ae;t[33]===f?ae=t[34]:(ae=f?(0,$.jsx)(m,{"aria-hidden":!0,className:`size-3 text-warning`}):null,t[33]=f,t[34]=ae);let se;t[35]!==R||t[36]!==r.layers.length||t[37]!==re||t[38]!==ae?(se=(0,$.jsx)(q,{render:(0,$.jsxs)(Ce,{render:re,children:[ie,` `,R,`/`,r.layers.length,ae]})}),t[35]=R,t[36]=r.layers.length,t[37]=re,t[38]=ae,t[39]=se):se=t[39];let ce=d?` · ${d}`:null,le;t[40]!==R||t[41]!==r.layers.length||t[42]!==r.number||t[43]!==ce?(le=(0,$.jsxs)(J,{children:[`View stack #`,r.number,`, layer `,R,` of `,r.layers.length,ce]}),t[40]=R,t[41]=r.layers.length,t[42]=r.number,t[43]=ce,t[44]=le):le=t[44];let ue;t[45]!==se||t[46]!==le?(ue=(0,$.jsxs)(Y,{children:[se,le]}),t[45]=se,t[46]=le,t[47]=ue):ue=t[47];let de=!!f,fe;t[48]!==d||t[49]!==r.number||t[50]!==de?(fe=(0,$.jsx)(Ic,{number:r.number,notice:d,stale:de}),t[48]=d,t[49]=r.number,t[50]=de,t[51]=fe):fe=t[51];let pe;t[52]===f?pe=t[53]:(pe=f?(0,$.jsx)(W,{onClick:f,children:`Retry stack refresh`}):null,t[52]=f,t[53]=pe);let me;t[54]===l?me=t[55]:(me=l?e=>{h(!1),l(e)}:void 0,t[54]=l,t[55]=me);let he;t[56]!==v||t[57]!==i||t[58]!==r||t[59]!==me?(he=(0,$.jsx)(Fc,{stack:r,reference:i,pending:v,onSelect:me}),t[56]=v,t[57]=i,t[58]=r,t[59]=me,t[60]=he):he=t[60];let ge;t[61]!==fe||t[62]!==pe||t[63]!==he?(ge=(0,$.jsxs)(Te,{children:[fe,pe,he]}),t[61]=fe,t[62]=pe,t[63]=he,t[64]=ge):ge=t[64];let _e=o||s?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(je,{}),o?(0,$.jsxs)(W,{disabled:ee,onClick:()=>_(`merge`),children:[(0,$.jsx)(Ir.merged,{"aria-hidden":!0}),`Merge stack (`,z.length,`)`]}):null,s?(0,$.jsxs)(W,{disabled:te,onClick:()=>_(`update-branch`),children:[(0,$.jsx)(w,{"aria-hidden":!0}),`Rebase stack`]}):null,V||z.some(zc)?(0,$.jsx)(`p`,{className:`px-2 py-1 text-xs text-muted-foreground`,children:`Every layer being merged must be open and ready for review.`}):null]}):null,ve;t[65]!==ge||t[66]!==_e?(ve=(0,$.jsxs)(oe,{align:`start`,children:[ge,_e]}),t[65]=ge,t[66]=_e,t[67]=ve):ve=t[67],t[68]!==p||t[69]!==ue||t[70]!==ve?(P=(0,$.jsxs)(y,{open:p,onOpenChange:h,children:[ue,ve]}),t[68]=p,t[69]=ue,t[70]=ve,t[71]=P):P=t[71],F=o&&B?.state===`open`?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`span`,{className:`inline-flex`,children:(0,$.jsxs)(G,{variant:`default`,size:`xs`,disabled:ee,onClick:()=>_(`merge`),children:[(0,$.jsx)(Ir.merged,{"aria-hidden":!0,className:`size-3.5`}),`Merge stack`]})})}),(0,$.jsxs)(J,{children:[`Merge stack through #`,i.number,` into `,r.base,` (`,z.length,` `,z.length===1?`pull request`:`pull requests`,`)`]})]}):null,E=Yn,M=g!==null,t[72]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>{e||_(null)},t[72]=N):N=t[72],T=Jn,A=`max-w-md`;let ye=g===`merge`?`Merge ${z.length} pull requests?`:`Rebase ${x.length} pull requests?`,be;t[73]===ye?be=t[74]:(be=(0,$.jsx)(Wn,{children:ye}),t[73]=ye,t[74]=be);let xe=g===`merge`?`Merge #${i.number} and its unmerged layers below into ${r.base} using ${c}. ${n} checks their rules before merging or queueing them and rebases the remaining stack after merging.`:`Rebase the remote branches from bottom to top onto ${r.base}. This rewrites branch history and may restart checks. If a layer fails, earlier updates remain.`,Se;t[75]===xe?Se=t[76]:(Se=(0,$.jsx)(qn,{children:xe}),t[75]=xe,t[76]=Se),t[77]!==be||t[78]!==Se?(j=(0,$.jsxs)(Un,{children:[be,Se]}),t[77]=be,t[78]=Se,t[79]=j):j=t[79],C=Kn,O=`max-h-48 space-y-1 overflow-y-auto text-sm`,k=ne.map(Rc),t[1]=o,t[2]=s,t[3]=g,t[4]=a,t[5]=n,t[6]=c,t[7]=d,t[8]=u,t[9]=f,t[10]=l,t[11]=p,t[12]=v,t[13]=i,t[14]=S,t[15]=r,t[16]=C,t[17]=T,t[18]=E,t[19]=D,t[20]=O,t[21]=k,t[22]=A,t[23]=j,t[24]=M,t[25]=N,t[26]=P,t[27]=F}else C=t[16],T=t[17],E=t[18],D=t[19],O=t[20],k=t[21],A=t[22],j=t[23],M=t[24],N=t[25],P=t[26],F=t[27];let I;t[80]!==O||t[81]!==k?(I=(0,$.jsx)(`ul`,{className:O,children:k}),t[80]=O,t[81]=k,t[82]=I):I=t[82];let L;t[83]!==C||t[84]!==I?(L=(0,$.jsx)(C,{children:I}),t[83]=C,t[84]=I,t[85]=L):L=t[85];let R;t[86]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(G,{variant:`outline`,onClick:()=>_(null),children:`Cancel`}),t[86]=R):R=t[86];let z;t[87]===D?z=t[88]:(z=()=>void D(),t[87]=D,t[88]=z);let B=g===`merge`?`Merge stack`:`Rebase stack`,V;t[89]!==z||t[90]!==B?(V=(0,$.jsxs)(Gn,{children:[R,(0,$.jsx)(G,{onClick:z,children:B})]}),t[89]=z,t[90]=B,t[91]=V):V=t[91];let H;t[92]!==T||t[93]!==L||t[94]!==V||t[95]!==A||t[96]!==j?(H=(0,$.jsxs)(T,{className:A,children:[j,L,V]}),t[92]=T,t[93]=L,t[94]=V,t[95]=A,t[96]=j,t[97]=H):H=t[97];let ee;t[98]!==E||t[99]!==H||t[100]!==M||t[101]!==N?(ee=(0,$.jsx)(E,{open:M,onOpenChange:N,children:H}),t[98]=E,t[99]=H,t[100]=M,t[101]=N,t[102]=ee):ee=t[102];let te;return t[103]!==ee||t[104]!==P||t[105]!==F?(te=(0,$.jsxs)($.Fragment,{children:[P,F,ee]}),t[103]=ee,t[104]=P,t[105]=F,t[106]=te):te=t[106],te}function Rc(e){return(0,$.jsx)(`li`,{className:`flex items-center gap-2 rounded-md bg-muted/50 px-3 py-2`,children:(0,$.jsx)(Pc,{layer:e,compact:!0})},e.number)}function zc(e){return e.isDraft}function Bc(e){return e.headSha?[{number:e.number,headSha:e.headSha}]:[]}function Vc(e){return e.isDraft}function Hc(e){return!e.headSha}function Uc(e){return e.headSha?[{number:e.number,headSha:e.headSha}]:[]}function Wc(e){return e.state!==`open`}function Gc(e){return e.state!==`merged`}function Kc(e){return e.state!==`open`}function qc(e){return e.state!==`merged`}function Jc(e){let t=(0,Q.c)(3),n=qe();if(mr(n.get(e.environmentId)?.environment.capabilities)===`unsupported`)return null;let r=`${e.environmentId}:${e.url}`,i;return t[0]!==e||t[1]!==r?(i=(0,$.jsx)(Yc,{...e},r),t[0]=e,t[1]=r,t[2]=i):i=t[2],i}function Yc({environmentId:e,reference:t,url:n,threadRef:r,display:i,onPickerOpenChange:a}){let o=Xe(n),s=Ge(r?.environmentId===e?r:null),c=s===null?null:r,l=fr(e),u=l.isLinked(s,n),d=wt(l.mode===`multiple`&&i!==`menu-item`?Ur.linkedThreads({environmentId:e,input:o===null?t:{...t,...Je(o)}}):null),[f,p]=(0,Z.useState)(d.data);d.data!==null&&d.data!==f&&p(d.data);let[m,h]=(0,Z.useState)(!1),g=async(r,i)=>{if(!(o===null||m)){h(!0);try{await l.changeLink(A(e,r),n,!i)}catch(e){lt.add({type:`error`,title:i?`Could not unlink the pull request`:`Could not link the pull request`,description:e instanceof Error?e.message:String(e)});return}finally{h(!1)}l.mode===`multiple`&&b.refresh(Ur.linkedThreads({environmentId:e,input:{...t,...Je(o)}})),a?.(!1)}};if(o===null||!u&&!l.canLink(n))return null;let _=l.mode===`multiple`?(d.data??f)?.threads??[]:[],v=_.length>0?`Linked from ${_.length} ${_.length===1?`thread`:`threads`}`:`Linked threads`;return(0,$.jsxs)($.Fragment,{children:[i===`count`&&(_.length>0||d.error!==null)?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsxs)(G,{size:`xs`,variant:`ghost`,"aria-label":v,onClick:()=>fa({query:n,...(d.data??f)===null?{}:{linkedThreads:{environmentId:e,threads:_}}}),children:[(0,$.jsx)(Ae,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(`span`,{"aria-hidden":!0,children:_.length||`?`})]})}),(0,$.jsxs)(J,{children:[v,`. Search in the command palette.`]})]}):null,i===`menu-item`?(0,$.jsxs)(W,{disabled:m,onClick:()=>{c===null?a?.(!0):g(c.threadId,u)},children:[u?(0,$.jsx)(Ir.unlink,{"aria-hidden":!0,className:`size-3.5`}):(0,$.jsx)(Ir.link,{"aria-hidden":!0,className:`size-3.5`}),u?`Unlink from this thread`:c?`Link to this thread`:`Link to thread`]}):null,i===`picker`?(0,$.jsx)(Yn,{open:!0,onOpenChange:a,children:(0,$.jsxs)(Jn,{className:`max-w-md`,showCloseButton:!1,children:[(0,$.jsx)(Wn,{className:`sr-only`,children:`Link pull request to a thread`}),(0,$.jsx)(Xc,{environmentId:e,url:n,pending:m,onSelect:e=>void g(e,!1)})]})}):null]})}function Xc(e){let t=(0,Q.c)(36),{environmentId:n,url:r,pending:i,onSelect:a}=e,o=Ke(),s=fr(n),c=We(),[l,u]=(0,Z.useState)(``),d;if(t[0]!==n||t[1]!==c){let e;t[3]===n?e=t[4]:(e=e=>e.environmentId===n,t[3]=n,t[4]=e),d=new Map(c.filter(e).map(Qc)),t[0]=n,t[1]=c,t[2]=d}else d=t[2];let f=d,p,m,h,g,_,v,y,b,x;if(t[5]!==n||t[6]!==s||t[7]!==a||t[8]!==i||t[9]!==f||t[10]!==l||t[11]!==o||t[12]!==r){let e=l.trim().toLocaleLowerCase(),c=o.filter(t=>t.environmentId===n&&t.archivedAt===null&&`${t.title} ${f.get(t.projectId)??``}`.toLocaleLowerCase().includes(e)).toSorted(Zc);m=zn,_=`none`,v=l,y=u,b=`Choose a thread`,t[22]===i?x=t[23]:(x=(0,$.jsx)(Rn,{placeholder:`Search threads or projects...`,disabled:i}),t[22]=i,t[23]=x),p=Ln,h=`max-h-80 overflow-y-auto`,g=c.length===0?(0,$.jsx)(`div`,{className:`px-3 py-6 text-center text-sm text-muted-foreground`,children:`No active threads found.`}):c.map(e=>{let t=s.isLinked(e,r);return(0,$.jsxs)(Bn,{value:e.id,disabled:i||t,onClick:()=>a(e.id),children:[(0,$.jsx)(Ae,{"aria-hidden":!0,className:`size-4 shrink-0`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(`span`,{className:`truncate`,children:e.title||`Untitled thread`}),(0,$.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:f.get(e.projectId)})]}),t?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(me,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Linked`})]}):null]},e.id)}),t[5]=n,t[6]=s,t[7]=a,t[8]=i,t[9]=f,t[10]=l,t[11]=o,t[12]=r,t[13]=p,t[14]=m,t[15]=h,t[16]=g,t[17]=_,t[18]=v,t[19]=y,t[20]=b,t[21]=x}else p=t[13],m=t[14],h=t[15],g=t[16],_=t[17],v=t[18],y=t[19],b=t[20],x=t[21];let S;t[24]!==p||t[25]!==h||t[26]!==g?(S=(0,$.jsx)(p,{className:h,children:g}),t[24]=p,t[25]=h,t[26]=g,t[27]=S):S=t[27];let C;return t[28]!==m||t[29]!==_||t[30]!==v||t[31]!==y||t[32]!==b||t[33]!==x||t[34]!==S?(C=(0,$.jsxs)(m,{mode:_,value:v,onValueChange:y,"aria-label":b,children:[x,S]}),t[28]=m,t[29]=_,t[30]=v,t[31]=y,t[32]=b,t[33]=x,t[34]=S,t[35]=C):C=t[35],C}function Zc(e,t){return t.updatedAt.localeCompare(e.updatedAt)}function Qc(e){return[e.id,e.title]}function $c(e){let t=(0,Q.c)(23),{title:n,author:r,updated:i,checkout:a,base:o,head:s,files:c,diffStat:l}=e,u;t[0]!==r||t[1]!==i?(u=(0,$.jsxs)(vr,{className:`min-w-0 whitespace-nowrap`,children:[r,i]}),t[0]=r,t[1]=i,t[2]=u):u=t[2];let d;t[3]!==a||t[4]!==u?(d=(0,$.jsxs)(`div`,{className:`mt-2 flex min-h-5 min-w-0 items-center gap-2 text-xs text-muted-foreground`,children:[u,a]}),t[3]=a,t[4]=u,t[5]=d):d=t[5];let f;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(j,{"aria-label":`receives changes from`,className:`size-3.5 shrink-0 opacity-60`}),t[6]=f):f=t[6];let p;t[7]!==o||t[8]!==s?(p=(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1.5 font-mono text-xs text-muted-foreground/70`,children:[o,f,s]}),t[7]=o,t[8]=s,t[9]=p):p=t[9];let m;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(ne,{"aria-hidden":!0,className:`size-3.5`}),t[10]=m):m=t[10];let h;t[11]===c?h=t[12]:(h=(0,$.jsxs)(`span`,{className:`inline-flex min-w-16 items-center justify-end gap-1.5 tabular-nums`,children:[m,c]}),t[11]=c,t[12]=h);let g;t[13]!==l||t[14]!==h?(g=(0,$.jsxs)(`span`,{className:`ml-auto inline-flex shrink-0 items-center justify-end gap-2`,children:[h,l]}),t[13]=l,t[14]=h,t[15]=g):g=t[15];let _;t[16]!==p||t[17]!==g?(_=(0,$.jsxs)(`div`,{className:`mt-4 flex min-h-5 min-w-0 items-center gap-2 text-xs text-muted-foreground`,children:[p,g]}),t[16]=p,t[17]=g,t[18]=_):_=t[18];let v;return t[19]!==d||t[20]!==_||t[21]!==n?(v=(0,$.jsxs)(`div`,{className:`col-span-2 mt-1 min-w-0 px-4 pb-4`,children:[n,d,_]}),t[19]=d,t[20]=_,t[21]=n,t[22]=v):v=t[22],v}function el(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=K(`flex min-h-7 min-w-0 items-center sm:min-h-6`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function tl(e){let t=(0,Q.c)(18),{tabs:n,value:r,onValueChange:i,onTabIntent:a,inert:o,children:s}=e,c;t[0]===r?c=t[1]:(c=[r],t[0]=r,t[1]=c);let l;t[2]!==i||t[3]!==n?(l=e=>{let t=n.find(t=>t.value===e[0])?.value;t&&i?.(t)},t[2]=i,t[3]=n,t[4]=l):l=t[4];let u;if(t[5]!==a||t[6]!==n){let e;t[8]===a?e=t[9]:(e=e=>(0,$.jsx)(An,{value:e.value,onPointerEnter:a?()=>a(e.value):void 0,onFocus:a?()=>a(e.value):void 0,children:e.label},e.value),t[8]=a,t[9]=e),u=n.map(e),t[5]=a,t[6]=n,t[7]=u}else u=t[7];let d;t[10]!==c||t[11]!==l||t[12]!==u?(d=(0,$.jsx)(kn,{className:`shrink-0`,size:`segmented`,variant:`segmented`,value:c,onValueChange:l,children:u}),t[10]=c,t[11]=l,t[12]=u,t[13]=d):d=t[13];let f;return t[14]!==s||t[15]!==o||t[16]!==d?(f=(0,$.jsxs)(`nav`,{className:`col-span-2 flex min-w-0 flex-wrap items-center gap-2 border-t border-border/60 px-4 py-2`,"aria-label":`Pull request tabs`,inert:o,children:[d,s]}),t[14]=s,t[15]=o,t[16]=d,t[17]=f):f=t[17],f}function nl(e){let t=(0,Q.c)(14),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({icon:r,label:i,className:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===n?o=t[6]:(o=K(`ml-auto flex h-4 min-w-0 flex-1 flex-wrap content-start items-center justify-end gap-x-1.5 overflow-hidden text-xs`,n),t[5]=n,t[6]=o);let s;t[7]===i?s=t[8]:(s=(0,$.jsx)(`span`,{className:`whitespace-nowrap`,children:i}),t[7]=i,t[8]=s);let c;return t[9]!==r||t[10]!==a||t[11]!==o||t[12]!==s?(c=(0,$.jsxs)(`span`,{className:o,...a,children:[r,s]}),t[9]=r,t[10]=a,t[11]=o,t[12]=s,t[13]=c):c=t[13],c}function rl(e){let t=(0,Q.c)(33),{value:n,target:r,copyLabel:i,copiedLabel:a,className:o,tooltipSide:s,onError:c}=e,l=s===void 0?`top`:s,u;t[0]===c?u=t[1]:(u=c?{onError:c}:{},t[0]=c,t[1]=u);let d;t[2]!==u||t[3]!==r?(d={target:r,timeout:1600,...u},t[2]=u,t[3]=r,t[4]=d):d=t[4];let{copyToClipboard:f,isCopied:p}=dt(d),m;t[5]===o?m=t[6]:(m=K(`relative grid w-fit min-w-0 max-w-full shrink cursor-pointer rounded px-1 py-0.5 text-left outline-none transition-colors pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 hover:bg-accent/45 hover:text-foreground focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background`,o),t[5]=o,t[6]=m);let h=p?a:i,g;t[7]!==f||t[8]!==n?(g=()=>f(n),t[7]=f,t[8]=n,t[9]=g):g=t[9];let _;t[10]!==m||t[11]!==h||t[12]!==g?(_=(0,$.jsx)(`button`,{type:`button`,className:m,"aria-label":h,onClick:g}),t[10]=m,t[11]=h,t[12]=g,t[13]=_):_=t[13];let v=p?`opacity-0`:`opacity-100`,y;t[14]===v?y=t[15]:(y=K(`col-start-1 row-start-1 min-w-0 truncate transition-opacity duration-150 motion-reduce:transition-none`,v),t[14]=v,t[15]=y);let b;t[16]!==y||t[17]!==n?(b=(0,$.jsx)(`code`,{className:y,children:n}),t[16]=y,t[17]=n,t[18]=b):b=t[18];let x=p?`opacity-100`:`opacity-0`,S;t[19]===x?S=t[20]:(S=K(`col-start-1 row-start-1 truncate text-center transition-opacity duration-150 motion-reduce:transition-none`,x),t[19]=x,t[20]=S);let C;t[21]===S?C=t[22]:(C=(0,$.jsx)(`span`,{"aria-hidden":`true`,className:S,children:`Copied`}),t[21]=S,t[22]=C);let w;t[23]!==b||t[24]!==C||t[25]!==_?(w=(0,$.jsxs)(q,{render:_,children:[b,C]}),t[23]=b,t[24]=C,t[25]=_,t[26]=w):w=t[26];let T=`${p?`Copied`:i}: ${n}`,E;t[27]!==T||t[28]!==l?(E=(0,$.jsx)(J,{variant:`code`,side:l,children:T}),t[27]=T,t[28]=l,t[29]=E):E=t[29];let D;return t[30]!==w||t[31]!==E?(D=(0,$.jsxs)(Y,{children:[w,E]}),t[30]=w,t[31]=E,t[32]=D):D=t[32],D}function il(e){let t=(0,Q.c)(4),{className:n}=e,r;t[0]===n?r=t[1]:(r=K(`block h-3 rounded bg-muted-foreground/15`,n),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,$.jsx)(`span`,{"aria-hidden":!0,className:r}),t[2]=r,t[3]=i),i}var al=[`w-3/5`,`w-2/5`,`w-1/2`,`w-2/3`,`w-2/5`,`w-3/5`,`w-1/2`],ol=[`w-2/5`,`w-1/3`,`w-2/5`,`w-1/4`,`w-1/3`,`w-2/5`,`w-1/3`],sl=[{value:`summary`,label:`Summary`},{value:`timeline`,label:`Timeline`},{value:`code`,label:`Code`}];function cl(e){let t=(0,Q.c)(8),{rows:n,caption:r}=e,i=n===void 0?7:n,a=r??`Loading pull requests`,o;t[0]===r?o=t[1]:(o=r?(0,$.jsx)(`p`,{className:`px-3 pb-1 text-xs font-medium text-muted-foreground/70`,children:r}):null,t[0]=r,t[1]=o);let s;t[2]===i?s=t[3]:(s=Array.from({length:i},ll),t[2]=i,t[3]=s);let c;return t[4]!==a||t[5]!==o||t[6]!==s?(c=(0,$.jsxs)(`div`,{role:`status`,"aria-label":a,className:`motion-safe:animate-skeleton space-y-0.5`,children:[o,s]}),t[4]=a,t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function ll(e,t){return(0,$.jsxs)(`div`,{className:`grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2 rounded-md px-3 py-2.5`,children:[(0,$.jsx)(il,{className:`size-4 rounded-full`}),(0,$.jsxs)(`div`,{className:`min-w-0 space-y-1.5`,children:[(0,$.jsx)(il,{className:K(`h-4`,al[t%al.length])}),(0,$.jsx)(il,{className:K(`h-3.5`,ol[t%ol.length])})]}),(0,$.jsxs)(`div`,{className:`flex flex-col items-end gap-1.5`,children:[(0,$.jsx)(il,{className:`w-12`}),(0,$.jsx)(il,{className:`w-16`})]})]},t)}function ul(e){let t=(0,Q.c)(80),{seed:n,summary:r,actions:i,checkoutCommand:a,tabs:o,activeTab:s,number:c,onBack:l,onClose:u,onCheckoutError:d}=e,f=o===void 0?sl:o,p,m;t[0]!==n||t[1]!==r?(p=r?{...n,...r,isDraft:r.isDraft??n?.isDraft}:n,m=p?_r({state:p.state,isDraft:p.isDraft??!1}):null,t[0]=n,t[1]=r,t[2]=p,t[3]=m):(p=t[2],m=t[3]);let h=m,g;t[4]===p?g=t[5]:(g=p?.checksState===`failing`||p?.checksState===`pending`?Sr(p.checksState):null,t[4]=p,t[5]=g);let _=g,y=a??null,b=r?.changedFiles??null,x;t[6]!==s||t[7]!==f?(x=f.find(e=>e.value===s)?.value??f[0]?.value??`summary`,t[6]=s,t[7]=f,t[8]=x):x=t[8];let S=x,C=!p&&`motion-safe:animate-skeleton`,w;t[9]===C?w=t[10]:(w=K(`flex h-full min-h-0 flex-col overflow-hidden bg-background`,C),t[9]=C,t[10]=w);let T;t[11]===l?T=t[12]:(T=l?(0,$.jsx)(G,{size:`icon-micro`,variant:`ghost-muted`,className:`-ml-1.5`,onClick:l,"aria-label":`Back to this thread's pull requests`,children:(0,$.jsx)(j,{"aria-hidden":!0,className:`size-3.5`})}):null,t[11]=l,t[12]=T);let E;t[13]!==c||t[14]!==p||t[15]!==h?.toneClassName?(E=p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:p.repository}),(0,$.jsxs)(de,{onClick:()=>void kt()?.shell.openExternal(p.url),"aria-label":`Open pull request #${p.number} on host`,children:[(0,$.jsxs)(`span`,{className:h?.toneClassName,children:[`#`,p.number]}),(0,$.jsx)(O,{"aria-hidden":!0,className:`size-2.5`})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(il,{className:`w-24`}),(0,$.jsxs)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:[`#`,c??`…`]})]}),t[13]=c,t[14]=p,t[15]=h?.toneClassName,t[16]=E):E=t[16];let D;t[17]!==T||t[18]!==E?(D=(0,$.jsx)(`div`,{className:`pl-4 grid h-7 min-w-0 items-center overflow-hidden`,children:(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 text-sm text-muted-foreground sm:text-xs`,children:[T,E]})}),t[17]=T,t[18]=E,t[19]=D):D=t[19];let k;t[20]===i?k=t[21]:(k=i??(0,$.jsx)(il,{className:`h-6 w-16 rounded-md`}),t[20]=i,t[21]=k);let A;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(G,{size:`icon-xs`,variant:`ghost`,disabled:!0,"aria-label":`Pull request actions loading`,children:(0,$.jsx)(v,{"aria-hidden":!0,className:`size-4`})}),t[22]=A):A=t[22];let N;t[23]===u?N=t[24]:(N=u?(0,$.jsx)(G,{size:`icon-xs`,variant:`ghost`,"aria-label":`Collapse pull request panel`,onClick:u,children:(0,$.jsx)(z,{"aria-hidden":!0,className:`size-3.5`})}):null,t[23]=u,t[24]=N);let F;t[25]!==k||t[26]!==N?(F=(0,$.jsxs)(`div`,{className:`mr-4 flex h-7 shrink-0 items-center justify-end gap-1`,children:[k,A,N]}),t[25]=k,t[26]=N,t[27]=F):F=t[27];let I,L,R;t[28]===p?(I=t[29],L=t[30],R=t[31]):(I=(0,$.jsx)(el,{children:p?(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold leading-snug`,children:p.title}):(0,$.jsx)(il,{className:`h-5 w-4/5 max-w-md`})}),L=p?(0,$.jsx)(Or,{actor:p.author??null,tooltip:!1}):(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(il,{className:`size-4 rounded-full`}),(0,$.jsx)(il,{className:`h-3 w-14`})]}),R=p?(0,$.jsxs)(`span`,{children:[`updated `,wn(p.updatedAt)]}):(0,$.jsx)(il,{className:`h-3 w-16`}),t[28]=p,t[29]=I,t[30]=L,t[31]=R);let B;t[32]!==y||t[33]!==d?(B=y?(0,$.jsx)(rl,{value:y,target:`pull request checkout command`,copyLabel:`Copy checkout command`,copiedLabel:`Checkout command copied`,className:`ml-auto font-mono`,tooltipSide:`bottom`,...d?{onError:d}:{}},y):null,t[32]=y,t[33]=d,t[34]=B):B=t[34];let V,H;t[35]===p?(V=t[36],H=t[37]):(V=(0,$.jsx)(`span`,{className:`inline-flex min-w-0 max-w-[40%] shrink-0 items-center gap-1`,children:p?(0,$.jsx)(`code`,{className:`flex min-w-0`,children:(0,$.jsx)(ga,{value:p.baseBranch})}):(0,$.jsx)(il,{className:`h-3 w-12`})}),H=p?(0,$.jsx)(rl,{value:p.headBranch,target:`branch name`,copyLabel:`Copy pull request branch`,copiedLabel:`Branch name copied`,className:`min-w-0 font-mono`},p.headBranch):(0,$.jsx)(il,{className:`h-3 w-32 flex-1`}),t[35]=p,t[36]=V,t[37]=H);let ee;t[38]===b?ee=t[39]:(ee=b===null?(0,$.jsx)(il,{className:`h-3 w-10`}):`${b.toLocaleString()} ${b===1?`file`:`files`}`,t[38]=b,t[39]=ee);let te;t[40]===p?te=t[41]:(te=p?(0,$.jsx)(Er,{additions:p.additions??0,deletions:p.deletions??0,className:`shrink-0 font-mono text-xs`}):(0,$.jsx)(il,{className:`h-3 w-20`}),t[40]=p,t[41]=te);let ne;t[42]!==I||t[43]!==L||t[44]!==R||t[45]!==B||t[46]!==V||t[47]!==H||t[48]!==ee||t[49]!==te?(ne=(0,$.jsx)(`div`,{className:`col-span-2 grid grid-rows-[1fr]`,children:(0,$.jsx)(`div`,{className:`min-h-0 overflow-hidden`,children:(0,$.jsx)($c,{title:I,author:L,updated:R,checkout:B,base:V,head:H,files:ee,diffStat:te})})}),t[42]=I,t[43]=L,t[44]=R,t[45]=B,t[46]=V,t[47]=H,t[48]=ee,t[49]=te,t[50]=ne):ne=t[50];let U;t[51]===_?U=t[52]:(U=_?(0,$.jsx)(nl,{className:_.toneClassName,icon:(0,$.jsx)(_.Icon,{"aria-hidden":!0,className:`size-3.5`}),label:_.label}):(0,$.jsx)(nl,{icon:(0,$.jsx)(il,{className:`my-px size-3.5 rounded-full`}),label:(0,$.jsx)(il,{className:`w-28`})}),t[51]=_,t[52]=U);let W;t[53]!==S||t[54]!==U||t[55]!==f?(W=(0,$.jsx)(tl,{tabs:f,value:S,inert:!0,children:U}),t[53]=S,t[54]=U,t[55]=f,t[56]=W):W=t[56];let re;t[57]!==F||t[58]!==ne||t[59]!==W||t[60]!==D?(re=(0,$.jsxs)(`div`,{className:`@container/pr-header grid min-w-0 shrink-0 grid-cols-[minmax(0,1fr)_auto] items-start gap-x-2 border-b border-border/60`,children:[D,F,ne,W]}),t[57]=F,t[58]=ne,t[59]=W,t[60]=D,t[61]=re):re=t[61];let ie;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,$.jsx)(M,{"aria-hidden":!0,className:`size-3.5`}),`Reviewers`]}),t[62]=ie):ie=t[62];let ae;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsx)(il,{className:`h-3 w-10`}),t[63]=ae):ae=t[63];let oe;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsxs)(`div`,{className:`grid min-h-7 min-w-0 grid-cols-[6rem_minmax(0,1fr)] items-center gap-2 text-xs sm:min-h-6`,children:[ie,(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 text-foreground`,children:[ae,(0,$.jsx)(G,{size:`icon-xs`,variant:`ghost`,disabled:!0,"aria-label":`Reviewers loading`,children:(0,$.jsx)(P,{"aria-hidden":!0,className:`size-3.5`})})]})]}),t[64]=oe):oe=t[64];let se;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,$.jsx)(he,{"aria-hidden":!0,className:`size-3.5`}),`Labels`]}),t[65]=se):se=t[65];let ce;t[66]===n?ce=t[67]:(ce=n?.labels?n.labels.length>0?n.labels.map(dl):(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`None`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(il,{className:`h-4.5 w-24`}),(0,$.jsx)(il,{className:`h-4.5 w-20`})]}),t[66]=n,t[67]=ce);let le;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,$.jsx)(G,{size:`icon-xs`,variant:`ghost`,disabled:!0,"aria-label":`Labels loading`,children:(0,$.jsx)(he,{"aria-hidden":!0,className:`size-3.5`})}),t[68]=le):le=t[68];let ue;t[69]===ce?ue=t[70]:(ue=(0,$.jsx)(`section`,{className:`px-4 pt-2.5 pb-1`,children:(0,$.jsxs)(`div`,{className:`space-y-2`,children:[oe,(0,$.jsxs)(`div`,{className:`grid min-h-7 min-w-0 grid-cols-[6rem_minmax(0,1fr)] items-center gap-2 text-xs sm:min-h-6`,children:[se,(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-1 text-foreground`,children:[ce,le]})]})]})}),t[69]=ce,t[70]=ue);let fe;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,$.jsx)(`div`,{className:`sticky top-0 z-10 flex w-full items-center bg-background pr-4`,children:(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5 px-4 py-3 text-left text-xs font-medium text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:`Description`}),(0,$.jsx)(Pe,{"aria-hidden":!0,className:`size-3.5 rotate-90 text-muted-foreground/60`})]})}),t[71]=fe):fe=t[71];let pe;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,$.jsx)(il,{className:`h-5 w-40`}),t[72]=pe):pe=t[72];let me;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,$.jsxs)(`section`,{children:[fe,(0,$.jsxs)(`div`,{className:`space-y-3 px-4 pb-4`,children:[pe,(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(il,{className:`h-4 w-full`}),(0,$.jsx)(il,{className:`h-4 w-11/12`}),(0,$.jsx)(il,{className:`h-4 w-4/5`}),(0,$.jsx)(il,{className:`h-4 w-2/3`})]})]})]}),t[73]=me):me=t[73];let ge;t[74]===ue?ge=t[75]:(ge=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:[ue,me]}),t[74]=ue,t[75]=ge);let _e;return t[76]!==re||t[77]!==ge||t[78]!==w?(_e=(0,$.jsxs)(`div`,{role:`status`,"aria-label":`Loading pull request`,className:w,children:[re,ge]}),t[76]=re,t[77]=ge,t[78]=w,t[79]=_e):_e=t[79],_e}function dl(e){return(0,$.jsx)(kr,{label:e,size:`default`,className:`max-w-48`},e.name)}function fl(e){let t=(0,Q.c)(2),{rows:n}=e,r=n===void 0?4:n,i;return t[0]===r?i=t[1]:(i=(0,$.jsx)(`div`,{role:`status`,"aria-label":`Loading people`,className:`motion-safe:animate-skeleton space-y-1 p-1`,children:Array.from({length:r},pl)}),t[0]=r,t[1]=i),i}function pl(e,t){return(0,$.jsxs)(`div`,{className:`flex h-7 items-center gap-2 rounded-md px-2`,children:[(0,$.jsx)(il,{className:`size-4 rounded-full`}),(0,$.jsx)(il,{className:ol[t%ol.length]})]},t)}function ml(e){let t=(0,Q.c)(2),{rows:n}=e,r=n===void 0?6:n,i;return t[0]===r?i=t[1]:(i=(0,$.jsx)(`div`,{role:`status`,"aria-label":`Loading timeline`,className:`motion-safe:animate-skeleton px-4 py-5`,children:(0,$.jsx)(`div`,{className:`relative ml-2 border-l border-border/70 pl-5`,children:Array.from({length:r},hl)})}),t[0]=r,t[1]=i),i}function hl(e,t){return(0,$.jsxs)(`div`,{className:`relative pb-5`,children:[(0,$.jsx)(il,{className:`absolute -left-[1.55rem] top-1 size-2 rounded-full`}),(0,$.jsx)(il,{className:K(`h-3.5`,al[t%al.length])}),(0,$.jsx)(il,{className:`mt-1.5 w-16`})]},t)}function gl(e){let t=(0,Q.c)(2),{rows:n}=e,r=n===void 0?3:n,i;return t[0]===r?i=t[1]:(i=(0,$.jsx)(`div`,{role:`status`,"aria-label":`Loading pull request conversation`,className:`motion-safe:animate-skeleton space-y-4 py-2`,children:Array.from({length:r},_l)}),t[0]=r,t[1]=i),i}function _l(e,t){return(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(il,{className:`size-5 shrink-0 rounded-full`}),(0,$.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,$.jsx)(il,{className:ol[t%ol.length]}),(0,$.jsx)(il,{className:`w-full`}),(0,$.jsx)(il,{className:`w-3/4`})]})]},t)}function vl(e){let t=(0,Q.c)(12),{error:n,onRetry:r,compact:i}=e,a=i!==void 0&&i?`py-3`:`min-h-48 px-4 py-10`,o;t[0]===a?o=t[1]:(o=K(`flex flex-col items-center justify-center gap-2 text-center`,a),t[0]=a,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:`Could not load pull request activity`}),t[2]=s):s=t[2];let c;t[3]===n?c=t[4]:(c=(0,$.jsx)(`p`,{className:`max-w-md text-xs text-muted-foreground`,children:n}),t[3]=n,t[4]=c);let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(ya,{"aria-hidden":!0,size:`sm`}),t[5]=l):l=t[5];let u;t[6]===r?u=t[7]:(u=(0,$.jsxs)(G,{size:`sm`,variant:`outline`,onClick:r,children:[l,`Retry`]}),t[6]=r,t[7]=u);let d;return t[8]!==o||t[9]!==c||t[10]!==u?(d=(0,$.jsxs)(`div`,{className:o,children:[s,c,u]}),t[8]=o,t[9]=c,t[10]=u,t[11]=d):d=t[11],d}function yl(e){let t=(0,Q.c)(15),{title:n,error:r,onRetry:i,refreshing:a,gitHubUrl:o}=e,s=n===void 0?`Could not load pull requests`:n,c=a!==void 0&&a,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(Zn,{variant:`icon`,children:(0,$.jsx)(Ir.pullRequest,{})}),t[0]=l):l=t[0];let u;t[1]===s?u=t[2]:(u=(0,$.jsx)($n,{children:s}),t[1]=s,t[2]=u);let d;t[3]===r?d=t[4]:(d=(0,$.jsx)(er,{children:r}),t[3]=r,t[4]=d);let f;t[5]!==u||t[6]!==d?(f=(0,$.jsxs)(Qn,{children:[u,d]}),t[5]=u,t[6]=d,t[7]=f):f=t[7];let p;t[8]!==o||t[9]!==i||t[10]!==c?(p=i||o?(0,$.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:[i?(0,$.jsxs)(G,{size:`sm`,variant:`outline`,onClick:i,disabled:c,"aria-busy":c,children:[(0,$.jsx)(ya,{size:`sm`,refreshing:c}),`Retry`]}):null,o?(0,$.jsxs)(G,{size:`sm`,variant:`outline`,render:(0,$.jsx)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`}),children:[(0,$.jsx)(O,{"aria-hidden":!0,className:`size-3.5`}),`Open on GitHub`]}):null]}):null,t[8]=o,t[9]=i,t[10]=c,t[11]=p):p=t[11];let m;return t[12]!==f||t[13]!==p?(m=(0,$.jsxs)(tr,{className:`scrollbar-gutter-both min-h-0 justify-center-safe overflow-y-auto [&>*]:shrink-0`,children:[l,f,p]}),t[12]=f,t[13]=p,t[14]=m):m=t[14],m}var bl=e=>e===Fr?`Open on host`:`Open on ${e.label}`;function xl(e){return[{id:`copy-link`,label:`Copy link`,icon:`copy`},{id:`open-external`,label:e}]}async function Sl({url:e,openLabel:t,position:n}){let r=kt();if(!r)return;let i=null;try{i=await r.contextMenu.show(xl(t),n)}catch{return}try{i===`copy-link`?await ut(e,`link`):i===`open-external`&&await r.shell.openExternal(e)}catch{lt.add({type:`error`,title:i===`copy-link`?`Could not copy the link`:`Could not open the link`})}}function Cl(e){let t=(0,Q.c)(42),{environmentId:n,reference:r,detail:i,actionPending:a,textareaRef:o,onCommentAction:s,onCommented:c,onClose:l}=e,[u,d]=(0,Z.useState)(``),[f,p]=(0,Z.useState)(null),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={reportFailure:!1},t[0]=m):m=t[0];let h=Tt(Ur.comment,m),g=i.state===`open`&&i.capabilities.actions.includes(`close`)&&i.viewerPermissions.actions.includes(`close`)?`close`:i.state===`closed`&&i.capabilities.actions.includes(`reopen`)&&i.viewerPermissions.actions.includes(`reopen`)?`reopen`:null,_;t[1]!==a||t[2]!==u||t[3]!==n||t[4]!==l||t[5]!==s||t[6]!==c||t[7]!==h||t[8]!==r||t[9]!==f?(_=async e=>{let t=u.trim();if(!(t.length===0||f!==null||a)){if(p(e),e!==`comment`){(await s(t,e)).commentPosted&&(d(``),l()),p(null);return}if((await h({environmentId:n,input:{...r,body:t}}))._tag===`Failure`){p(null),lt.add({type:`error`,title:`Could not post the comment`});return}d(``),p(null),l(),c()}},t[1]=a,t[2]=u,t[3]=n,t[4]=l,t[5]=s,t[6]=c,t[7]=h,t[8]=r,t[9]=f,t[10]=_):_=t[10];let v=_,y=f!==null||a,b;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>d(e.target.value),t[11]=b):b=t[11];let x;t[12]===v?x=t[13]:(x=e=>{e.nativeEvent.isComposing||e.keyCode===229||e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&!e.shiftKey&&!e.altKey&&(e.preventDefault(),e.stopPropagation(),e.repeat||v(`comment`))},t[12]=v,t[13]=x);let S;t[14]!==u||t[15]!==y||t[16]!==x||t[17]!==o?(S=(0,$.jsx)(Dn,{ref:o,disabled:y,value:u,rows:3,placeholder:`Leave a comment`,"aria-label":`Comment on this pull request`,onChange:b,onKeyDown:x}),t[14]=u,t[15]=y,t[16]=x,t[17]=o,t[18]=S):S=t[18];let C;t[19]!==a||t[20]!==u||t[21]!==g||t[22]!==v||t[23]!==f?(C=g===null?null:(0,$.jsxs)(G,{size:`xs`,variant:g===`close`?`destructive-outline`:`outline`,disabled:u.trim().length===0||f!==null||a,onClick:()=>void v(g),children:[g===`close`?(0,$.jsx)(Ir.closed,{className:`size-3.5`}):(0,$.jsx)(Ir.reopen,{className:`size-3.5`}),f===g?g===`close`?`Closing...`:`Reopening...`:g===`close`?`Close with comment`:`Reopen with comment`]}),t[19]=a,t[20]=u,t[21]=g,t[22]=v,t[23]=f,t[24]=C):C=t[24];let w;t[25]!==a||t[26]!==u||t[27]!==f?(w=u.trim().length===0||f!==null||a,t[25]=a,t[26]=u,t[27]=f,t[28]=w):w=t[28];let T;t[29]===v?T=t[30]:(T=()=>void v(`comment`),t[29]=v,t[30]=T);let E;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(ie,{className:`size-3.5`}),t[31]=E):E=t[31];let D=f===`comment`?`Posting...`:`Comment`,O;t[32]!==D||t[33]!==w||t[34]!==T?(O=(0,$.jsxs)(G,{size:`xs`,variant:`outline`,disabled:w,onClick:T,children:[E,D]}),t[32]=D,t[33]=w,t[34]=T,t[35]=O):O=t[35];let k;t[36]!==O||t[37]!==C?(k=(0,$.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[C,O]}),t[36]=O,t[37]=C,t[38]=k):k=t[38];let A;return t[39]!==k||t[40]!==S?(A=(0,$.jsxs)(`div`,{className:`space-y-2`,children:[S,k]}),t[39]=k,t[40]=S,t[41]=A):A=t[41],A}var wl=[{value:`comment`,label:`Comment`,sent:`Review submitted`,icon:(0,$.jsx)(Ae,{className:`size-3`})},{value:`approve`,label:`Approve`,sent:`Pull request approved`,icon:(0,$.jsx)(me,{className:`size-3`})},{value:`request-changes`,label:`Request changes`,sent:`Changes requested`,icon:(0,$.jsx)(C,{className:`size-3`})}];function Tl(e){let t=(0,Q.c)(70),{environmentId:n,reference:r,verdicts:i,requestChangesSummaryRequired:a,textareaRef:o,pending:s,onPendingChange:c,onSubmitted:l}=e,[u,d]=(0,Z.useState)(`comment`),f=zi(r),p;t[0]===r?p=t[1]:(p=Ri(r),t[0]=r,t[1]=p);let m=p,h;t[2]===m?h=t[3]:(h=e=>e.summaries[m]??``,t[2]=m,t[3]=h);let g=Li(h),_=Li(Al),v=Li(kl),y=Li(Ol),b;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(b={reportFailure:!1},t[4]=b):b=t[4];let x=Tt(Ur.submitReview,b),S,C,w,T,E,D,O,k;if(t[5]!==g||t[6]!==y||t[7]!==f||t[8]!==n||t[9]!==c||t[10]!==l||t[11]!==s||t[12]!==r||t[13]!==_||t[14]!==a||t[15]!==u||t[16]!==m||t[17]!==v||t[18]!==x||t[19]!==o||t[20]!==i){let e;t[29]===i?e=t[30]:(e=e=>i.includes(e.value),t[29]=i,t[30]=e);let p=wl.filter(e);C=p.find(e=>e.value===u)??p[0];let h;t[31]!==g||t[32]!==y||t[33]!==f||t[34]!==n||t[35]!==c||t[36]!==l||t[37]!==s||t[38]!==r||t[39]!==_||t[40]!==m||t[41]!==x?(h=async e=>{if(s)return;let t=g,i=f;c(!0);let a=await x({environmentId:n,input:{...r,verdict:e.value,body:t,comments:i}});if(c(!1),a._tag===`Failure`){lt.add({type:`error`,title:`The review could not be submitted`});return}_(m,i.map(Dl)),y(m,t),lt.add({type:`success`,title:e.sent}),l()},t[31]=g,t[32]=y,t[33]=f,t[34]=n,t[35]=c,t[36]=l,t[37]=s,t[38]=r,t[39]=_,t[40]=m,t[41]=x,t[42]=h):h=t[42],w=h;let b;t[43]!==f||t[44]!==a?(b=(e,t)=>e===`request-changes`&&a?t.trim().length>0:e===`approve`||t.trim().length>0||f.length>0,t[43]=f,t[44]=a,t[45]=b):b=t[45];let A=b,j=C===void 0||A(C.value,``)?`Summarize your review (optional)`:C.value===`request-changes`&&a?`Summarize your review (required to request changes)`:`Summarize your review or add line comments`,M;t[46]!==m||t[47]!==v?(M=e=>v(m,e.target.value),t[46]=m,t[47]=v,t[48]=M):M=t[48],t[49]!==g||t[50]!==j||t[51]!==M||t[52]!==o?(k=(0,$.jsx)(Dn,{ref:o,rows:3,value:g,placeholder:j,"aria-label":`Review summary`,onChange:M}),t[49]=g,t[50]=j,t[51]=M,t[52]=o,t[53]=k):k=t[53],D=`mt-2 flex justify-end gap-2`,O=p.length>1?(0,$.jsxs)(st,{value:C?.value??null,disabled:s,onValueChange:e=>{e!==null&&d(e)},children:[(0,$.jsx)(ot,{size:`xs`,className:`mr-auto w-auto min-w-0`,"aria-label":`Review verdict`,children:(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[C?.icon,C?.label]})}),(0,$.jsx)(at,{side:`top`,alignItemWithTrigger:!1,children:p.map(El)})]}):null,S=G,T=`xs`,E=s||C===void 0||!A(C.value,g),t[5]=g,t[6]=y,t[7]=f,t[8]=n,t[9]=c,t[10]=l,t[11]=s,t[12]=r,t[13]=_,t[14]=a,t[15]=u,t[16]=m,t[17]=v,t[18]=x,t[19]=o,t[20]=i,t[21]=S,t[22]=C,t[23]=w,t[24]=T,t[25]=E,t[26]=D,t[27]=O,t[28]=k}else S=t[21],C=t[22],w=t[23],T=t[24],E=t[25],D=t[26],O=t[27],k=t[28];let A;t[54]!==C||t[55]!==w?(A=()=>{C!==void 0&&w(C)},t[54]=C,t[55]=w,t[56]=A):A=t[56];let j=s?`Submitting...`:`Submit review`,M;t[57]!==S||t[58]!==j||t[59]!==T||t[60]!==E||t[61]!==A?(M=(0,$.jsx)(S,{size:T,disabled:E,onClick:A,children:j}),t[57]=S,t[58]=j,t[59]=T,t[60]=E,t[61]=A,t[62]=M):M=t[62];let N;t[63]!==M||t[64]!==D||t[65]!==O?(N=(0,$.jsxs)(`div`,{className:D,children:[O,M]}),t[63]=M,t[64]=D,t[65]=O,t[66]=N):N=t[66];let P;return t[67]!==N||t[68]!==k?(P=(0,$.jsxs)($.Fragment,{children:[k,N]}),t[67]=N,t[68]=k,t[69]=P):P=t[69],P}function El(e){return(0,$.jsx)(it,{value:e.value,children:(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[e.icon,e.label]})},e.value)}function Dl(e){return e.id}function Ol(e){return e.clearSummary}function kl(e){return e.setSummary}function Al(e){return e.removeComments}function jl(e){let t=(0,Q.c)(63),{environmentId:n,reference:r,detail:i,actionPending:a,onCommentAction:o,onCommented:s,onReviewSubmitted:c,openReviewRequest:u}=e,[d,f]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(!1),[h,g]=(0,Z.useState)(`comment`),_=(0,Z.useRef)(null),v=(0,Z.useRef)(null),y=zi(r),b=Li(Ml),x;t[0]===r?x=t[1]:(x=Ri(r),t[0]=r,t[1]=x);let S=x,C;t[2]===S?C=t[3]:(C=e=>(e.summaries[S]??``).trim().length>0,t[2]=S,t[3]=C);let w=Li(C),T=y.length>0||w,[E,D]=(0,Z.useState)(u);u!==E&&(D(u),g(`review`),f(!0));let O=i.capabilities.comment&&i.viewerPermissions.comment,k;if(t[4]!==i.capabilities.review.verdicts||t[5]!==i.viewerPermissions){let e;t[7]===i.viewerPermissions?e=t[8]:(e=e=>i.viewerPermissions.verdicts.includes(e),t[7]=i.viewerPermissions,t[8]=e),k=i.capabilities.review.verdicts.filter(e),t[4]=i.capabilities.review.verdicts,t[5]=i.viewerPermissions,t[6]=k}else k=t[6];let A=k;if(!O&&A.length===0)return null;let j=O?A.length===0?`comment`:h:`review`,M;t[9]===T?M=t[10]:(M=e=>{e&&g(T?`review`:`comment`),f(e)},t[9]=T,t[10]=M);let N;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(G,{size:`icon`,variant:`glass`}),t[11]=N):N=t[11];let P=y.length>0?`Review pull request, ${y.length} ${y.length===1?`comment`:`comments`} pending`:T||!O?`Review pull request`:`Comment on pull request`,F;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(Ae,{className:`size-4`}),t[12]=F):F=t[12];let I;t[13]===y.length?I=t[14]:(I=y.length>0?(0,$.jsx)(`span`,{"aria-hidden":!0,className:`absolute -top-1 -right-1 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-info px-1 text-3xs font-semibold tabular-nums text-white`,children:y.length}):null,t[13]=y.length,t[14]=I);let L;t[15]!==P||t[16]!==I?(L=(0,$.jsxs)(Jr,{render:N,"aria-label":P,children:[F,I]}),t[15]=P,t[16]=I,t[17]=L):L=t[17];let R=j===`review`?v:_,z;t[18]!==O||t[19]!==j||t[20]!==y.length||t[21]!==A.length?(z=O&&A.length>0?(0,$.jsxs)(kn,{"aria-label":`Composer mode`,variant:`segmented`,value:[j],onValueChange:e=>{let t=e[0];(t===`comment`||t===`review`)&&g(t)},children:[(0,$.jsx)(An,{value:`comment`,children:`Comment`}),(0,$.jsx)(An,{value:`review`,children:y.length>0?`Review (${y.length})`:`Review`})]}):(0,$.jsx)(Gr,{children:j===`review`?`Review pull request`:`Comment on pull request`}),t[18]=O,t[19]=j,t[20]=y.length,t[21]=A.length,t[22]=z):z=t[22];let B;t[23]!==b||t[24]!==j||t[25]!==y.length||t[26]!==S||t[27]!==p?(B=j===`review`&&y.length>0?(0,$.jsx)(G,{size:`icon-xs`,variant:`ghost`,"aria-label":`Discard pending line comments`,title:`Discard pending line comments`,disabled:p,onClick:()=>b(S),children:(0,$.jsx)(l,{className:`size-3.5`})}):null,t[23]=b,t[24]=j,t[25]=y.length,t[26]=S,t[27]=p,t[28]=B):B=t[28];let V;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(G,{size:`icon-xs`,variant:`ghost`}),t[29]=V):V=t[29];let ee;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,$.jsx)(qr,{render:V,"aria-label":`Close composer`,children:(0,$.jsx)(H,{className:`size-3.5`})}),t[30]=ee):ee=t[30];let te;t[31]===B?te=t[32]:(te=(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[B,ee]}),t[31]=B,t[32]=te);let ne;t[33]!==z||t[34]!==te?(ne=(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-2`,children:[z,te]}),t[33]=z,t[34]=te,t[35]=ne):ne=t[35];let U;t[36]!==i.provider||t[37]!==n||t[38]!==j||t[39]!==c||t[40]!==r||t[41]!==p||t[42]!==A?(U=A.length>0?(0,$.jsx)(`div`,{hidden:j!==`review`,children:(0,$.jsx)(Tl,{environmentId:n,reference:r,verdicts:A,requestChangesSummaryRequired:Pr.get(i.provider).reviewSummaryRequired(`request-changes`),textareaRef:v,pending:p,onPendingChange:m,onSubmitted:()=>{f(!1),c()}})}):null,t[36]=i.provider,t[37]=n,t[38]=j,t[39]=c,t[40]=r,t[41]=p,t[42]=A,t[43]=U):U=t[43];let W;t[44]!==a||t[45]!==O||t[46]!==i||t[47]!==n||t[48]!==j||t[49]!==o||t[50]!==s||t[51]!==r?(W=O?(0,$.jsx)(`div`,{hidden:j!==`comment`,children:(0,$.jsx)(Cl,{environmentId:n,reference:r,detail:i,actionPending:a,textareaRef:_,onCommentAction:o,onCommented:s,onClose:()=>f(!1)})}):null,t[44]=a,t[45]=O,t[46]=i,t[47]=n,t[48]=j,t[49]=o,t[50]=s,t[51]=r,t[52]=W):W=t[52];let re;t[53]!==R||t[54]!==ne||t[55]!==U||t[56]!==W?(re=(0,$.jsxs)(Kr,{keepMounted:!0,side:`top`,align:`end`,sideOffset:8,width:`lg`,initialFocus:R,"aria-label":`Pull request composer`,children:[ne,U,W]}),t[53]=R,t[54]=ne,t[55]=U,t[56]=W,t[57]=re):re=t[57];let ie;return t[58]!==d||t[59]!==re||t[60]!==M||t[61]!==L?(ie=(0,$.jsxs)(Yr,{open:d,onOpenChange:M,children:[L,re]}),t[58]=d,t[59]=re,t[60]=M,t[61]=L,t[62]=ie):ie=t[62],ie}function Ml(e){return e.clear}function Nl(e){let t=(0,Q.c)(53),{icon:n,label:r,allowed:i,disabledReason:a,open:o,onOpenChange:s,query:c,onQueryChange:l,searchLabel:u,isPending:d,error:f,candidates:p,emptyLabel:m,noMatchLabel:h,errorLabel:g,truncated:_,truncatedLabel:v,candidateKey:y,disabled:b,onSelect:x,children:S}=e;if(!i){let e;t[0]!==n||t[1]!==r?(e=(0,$.jsx)(q,{render:(0,$.jsx)(G,{size:`icon-xs`,variant:`ghost`,disabled:!0,"aria-label":r,children:n})}),t[0]=n,t[1]=r,t[2]=e):e=t[2];let i;t[3]===a?i=t[4]:(i=(0,$.jsx)(J,{side:`bottom`,children:a}),t[3]=a,t[4]=i);let o;return t[5]!==e||t[6]!==i?(o=(0,$.jsxs)(Y,{children:[e,i]}),t[5]=e,t[6]=i,t[7]=o):o=t[7],o}let C;t[8]!==y||t[9]!==p?(C=p.map(y),t[8]=y,t[9]=p,t[10]=C):C=t[10];let w=C,T;t[11]!==y||t[12]!==p||t[13]!==x?(T=e=>{let t=p.find(t=>y(t)===e);t&&x(t)},t[11]=y,t[12]=p,t[13]=x,t[14]=T):T=t[14];let E;t[15]===s?E=t[16]:(E=(e,t)=>{if(!e&&t.reason===`item-press`){t.cancel();return}s(e)},t[15]=s,t[16]=E);let D;t[17]!==n||t[18]!==r?(D=(0,$.jsx)(Mn,{render:(0,$.jsx)(G,{size:`icon-xs`,variant:`ghost`,"aria-label":r,children:n})}),t[17]=n,t[18]=r,t[19]=D):D=t[19];let O;t[20]===l?O=t[21]:(O=e=>l(e.target.value),t[20]=l,t[21]=O);let k;t[22]!==c||t[23]!==u||t[24]!==O?(k=(0,$.jsx)(Fn,{"aria-label":u,placeholder:u,value:c,onChange:O}),t[22]=c,t[23]=u,t[24]=O,t[25]=k):k=t[25];let A;t[26]!==p||t[27]!==S||t[28]!==b||t[29]!==m||t[30]!==f||t[31]!==g||t[32]!==d||t[33]!==w||t[34]!==h||t[35]!==c?(A=d?(0,$.jsx)(fl,{rows:4}):f===null?p.length===0?(0,$.jsx)(`p`,{className:`p-2 text-xs text-muted-foreground`,children:c.length>0?h:m}):p.map((e,t)=>(0,$.jsx)(Pn,{hideIndicator:!0,index:t,value:w[t],disabled:b,children:S(e)},w[t])):(0,$.jsxs)(`p`,{className:`p-2 text-xs text-muted-foreground`,children:[g,` `,f]}),t[26]=p,t[27]=S,t[28]=b,t[29]=m,t[30]=f,t[31]=g,t[32]=d,t[33]=w,t[34]=h,t[35]=c,t[36]=A):A=t[36];let j;t[37]!==_||t[38]!==v?(j=_?(0,$.jsx)(`p`,{className:`px-2 py-1.5 text-xs text-muted-foreground`,children:v}):null,t[37]=_,t[38]=v,t[39]=j):j=t[39];let M;t[40]!==A||t[41]!==j?(M=(0,$.jsxs)(jn,{className:`max-h-72`,children:[A,j]}),t[40]=A,t[41]=j,t[42]=M):M=t[42];let N;t[43]!==k||t[44]!==M?(N=(0,$.jsxs)(Nn,{align:`start`,side:`bottom`,className:`w-72`,children:[k,M]}),t[43]=k,t[44]=M,t[45]=N):N=t[45];let P;return t[46]!==w||t[47]!==o||t[48]!==N||t[49]!==T||t[50]!==E||t[51]!==D?(P=(0,$.jsxs)(In,{items:w,filteredItems:w,filter:null,autoHighlight:!0,value:null,onValueChange:T,open:o,onOpenChange:E,children:[D,N]}),t[46]=w,t[47]=o,t[48]=N,t[49]=T,t[50]=E,t[51]=D,t[52]=P):P=t[52],P}function Pl(e,t){if(t.length===0)return!0;let n=t.toLowerCase();return e.name.toLowerCase().includes(n)||(e.description??``).toLowerCase().includes(n)}function Fl(e){let t=(0,Q.c)(30),{environmentId:n,reference:r,allowed:i}=e,[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(null),d;t[0]!==n||t[1]!==a||t[2]!==r?(d=a?Ur.labelCandidates({environmentId:n,input:r}):null,t[0]=n,t[1]=a,t[2]=r,t[3]=d):d=t[3];let f=wt(d),p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p={reportFailure:!1},t[4]=p):p=t[4];let m=Tt(Ur.setLabels,p),h;t[5]===f.data?.candidates?h=t[6]:(h=f.data?.candidates??[],t[5]=f.data?.candidates,t[6]=h);let g;if(t[7]!==s||t[8]!==h){let e;t[10]===s?e=t[11]:(e=e=>Pl(e,s),t[10]=s,t[11]=e),g=h.filter(e),t[7]=s,t[8]=h,t[9]=g}else g=t[9];let _=g,v;t[12]!==n||t[13]!==l||t[14]!==r||t[15]!==m?(v=async e=>{if(l!==null)return;u(e.name);let t=await m({environmentId:n,input:{...r,labels:[e.name],applied:!e.isApplied}});if(u(null),t._tag===`Failure`){lt.add({type:`error`,title:e.isApplied?`Could not take ${e.name} off`:`Could not put ${e.name} on`,description:li(Ue(t),`The host refused it. Check that you have triage access on this repository.`)});return}},t[12]=n,t[13]=l,t[14]=r,t[15]=m,t[16]=v):v=t[16];let y=v,b;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(he,{className:`size-3.5`}),t[17]=b):b=t[17];let x=f.isPending&&f.data===null,S=f.data===null?f.error:null,C=f.data?.truncated===!0,w=l!==null,T;t[18]===y?T=t[19]:(T=e=>void y(e),t[18]=y,t[19]=T);let E;return t[20]!==i||t[21]!==_||t[22]!==a||t[23]!==s||t[24]!==w||t[25]!==T||t[26]!==x||t[27]!==S||t[28]!==C?(E=(0,$.jsx)(Nl,{icon:b,label:`Change labels`,allowed:i,disabledReason:`Changing labels needs triage access on this repository`,open:a,onOpenChange:o,query:s,onQueryChange:c,searchLabel:`Search labels`,isPending:x,error:S,candidates:_,emptyLabel:`This repository has no labels.`,noMatchLabel:`No label matches that.`,errorLabel:`The labels could not be read.`,truncated:C,truncatedLabel:`This repository has more labels than are listed here. Apply the rest on the host.`,candidateKey:Ll,disabled:w,onSelect:T,children:Il}),t[20]=i,t[21]=_,t[22]=a,t[23]=s,t[24]=w,t[25]=T,t[26]=x,t[27]=S,t[28]=C,t[29]=E):E=t[29],E}function Il(e){let t=Lr(e.color);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`size-2 shrink-0 rounded-full bg-muted-foreground`,...t?{style:{backgroundColor:t}}:{}}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[e.name,e.description?(0,$.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,e.description]}):null]}),e.isApplied?(0,$.jsx)(me,{"aria-label":`Applied`,className:`size-3.5 shrink-0`}):null]})}function Ll(e){return e.name}function Rl(e,t){if(t.length===0)return!0;let n=t.toLowerCase();return e.login.toLowerCase().includes(n)||(e.name??``).toLowerCase().includes(n)}function zl(e){let t=(0,Q.c)(30),{environmentId:n,reference:r,allowed:i}=e,[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(null),d;t[0]!==n||t[1]!==a||t[2]!==r?(d=a?Ur.reviewerCandidates({environmentId:n,input:r}):null,t[0]=n,t[1]=a,t[2]=r,t[3]=d):d=t[3];let f=wt(d),p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p={reportFailure:!1},t[4]=p):p=t[4];let m=Tt(Ur.requestReviewers,p),h;t[5]===f.data?.candidates?h=t[6]:(h=f.data?.candidates??[],t[5]=f.data?.candidates,t[6]=h);let g;if(t[7]!==s||t[8]!==h){let e;t[10]===s?e=t[11]:(e=e=>Rl(e,s),t[10]=s,t[11]=e),g=h.filter(e),t[7]=s,t[8]=h,t[9]=g}else g=t[9];let _=g,v;t[12]!==n||t[13]!==l||t[14]!==r||t[15]!==m?(v=async e=>{if(l!==null)return;u(e.id);let t=await m({environmentId:n,input:{...r,reviewers:[{id:e.id,kind:e.kind}],requested:!e.isRequested}});if(u(null),t._tag===`Failure`){lt.add({type:`error`,title:e.isRequested?`Could not take back the review request to ${e.login}`:`Could not ask ${e.login} for a review`,description:li(Ue(t),`The host refused it. Check that you have write access on this repository, and that they still have access to it.`)});return}lt.add({type:`success`,title:e.isRequested?`Review request to ${e.login} taken back`:`Review requested from ${e.login}`})},t[12]=n,t[13]=l,t[14]=r,t[15]=m,t[16]=v):v=t[16];let y=v,b;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(P,{className:`size-3.5`}),t[17]=b):b=t[17];let x=f.isPending&&f.data===null,S=f.data===null?f.error:null,C=f.data?.truncated===!0,w=l!==null,T;t[18]===y?T=t[19]:(T=e=>void y(e),t[18]=y,t[19]=T);let E;return t[20]!==i||t[21]!==_||t[22]!==a||t[23]!==s||t[24]!==w||t[25]!==T||t[26]!==x||t[27]!==S||t[28]!==C?(E=(0,$.jsx)(Nl,{icon:b,label:`Request a review`,allowed:i,disabledReason:`Asking someone to review needs write access on this repository`,open:a,onOpenChange:o,query:s,onQueryChange:c,searchLabel:`Search people with access`,isPending:x,error:S,candidates:_,emptyLabel:`Nobody else has access to this repository.`,noMatchLabel:`Nobody with access matches that.`,errorLabel:`The people with access could not be read.`,truncated:C,truncatedLabel:`This repository has more people with access than are listed here. Ask for the rest on the host.`,candidateKey:Vl,disabled:w,onSelect:T,children:Bl}),t[20]=i,t[21]=_,t[22]=a,t[23]=s,t[24]=w,t[25]=T,t[26]=x,t[27]=S,t[28]=C,t[29]=E):E=t[29],E}function Bl(e){return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Or,{actor:e,className:`flex-1`}),e.kind===`team`?(0,$.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`team`}):null,e.isRequested?(0,$.jsx)(me,{"aria-label":`Already asked`,className:`size-3.5 shrink-0`}):null]})}function Vl(e){return`${e.kind}:${e.id}`}function Hl(e){let t=(0,Q.c)(28),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(!1),c=(0,Z.useRef)(null),l=(0,Z.useId)(),u,d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{let e=c.current;if(!e)return;let t=()=>s(e.getBoundingClientRect().height>240);return t(),rr(e,t)},d=[],t[3]=u,t[4]=d):(u=t[3],d=t[4]),(0,Z.useEffect)(u,d);let f;t[5]===n?f=t[6]:(f=K(`min-w-0`,n),t[5]=n,t[6]=f);let p=!i&&`max-h-[240px] overflow-hidden`,m;t[7]===p?m=t[8]:(m=K(`relative`,p),t[7]=p,t[8]=m);let h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>a(!0),t[9]=h):h=t[9];let g;t[10]===r?g=t[11]:(g=(0,$.jsx)(`div`,{ref:c,children:(0,$.jsx)(Gs,{...r})}),t[10]=r,t[11]=g);let _;t[12]!==i||t[13]!==o?(_=o&&!i?(0,$.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-10 bg-gradient-to-t from-background to-transparent`}):null,t[12]=i,t[13]=o,t[14]=_):_=t[14];let v;t[15]!==l||t[16]!==m||t[17]!==g||t[18]!==_?(v=(0,$.jsxs)(`div`,{id:l,className:m,onFocusCapture:h,children:[g,_]}),t[15]=l,t[16]=m,t[17]=g,t[18]=_,t[19]=v):v=t[19];let y;t[20]!==i||t[21]!==l||t[22]!==o?(y=o?(0,$.jsx)(G,{size:`xs`,variant:`ghost-muted`,className:`mt-2`,"aria-expanded":i,"aria-controls":l,onClick:()=>{i&&c.current?.parentElement?.scrollIntoView({block:`nearest`}),a(!i)},children:i?`Show less`:`Show full comment`}):null,t[20]=i,t[21]=l,t[22]=o,t[23]=y):y=t[23];let b;return t[24]!==y||t[25]!==f||t[26]!==v?(b=(0,$.jsxs)(`div`,{className:f,children:[v,y]}),t[24]=y,t[25]=f,t[26]=v,t[27]=b):b=t[27],b}var Ul=1;function Wl(e){let t=e.sectionTop<e.viewportTop,n=e.headingTop<=e.viewportTop+Ul;return!t||!n?null:Math.max(0,e.scrollTop+e.sectionTop-e.viewportTop)}function Gl(e){return e.toLowerCase()}function Kl(e){let t=(0,Q.c)(27),{comment:n,detail:r}=e,i=n.author,a;t[0]!==i||t[1]!==r?(a=i?Pr.get(r.provider).authorProfileUrl(i.login,r.url):null,t[0]=i,t[1]=r,t[2]=a):a=t[2];let o=a,s;t[3]!==i||t[4]!==o?(s=(0,$.jsx)(Or,{actor:i,profileUrl:o,className:`max-w-full`}),t[3]=i,t[4]=o,t[5]=s):s=t[5];let c;t[6]===n.url?c=t[7]:(c=n.url?(0,$.jsx)(`a`,{href:n.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground hover:text-foreground hover:underline`}):(0,$.jsx)(`span`,{className:`text-muted-foreground`}),t[6]=n.url,t[7]=c);let l=n.createdAt,u;t[8]===n.createdAt?u=t[9]:(u=wn(n.createdAt),t[8]=n.createdAt,t[9]=u);let d;t[10]!==n.createdAt||t[11]!==u?(d=(0,$.jsx)(`time`,{dateTime:l,children:u}),t[10]=n.createdAt,t[11]=u,t[12]=d):d=t[12];let f;t[13]!==c||t[14]!==d?(f=(0,$.jsx)(q,{render:c,children:d}),t[13]=c,t[14]=d,t[15]=f):f=t[15];let p;t[16]===n.createdAt?p=t[17]:(p=new Date(n.createdAt).toLocaleString(),t[16]=n.createdAt,t[17]=p);let m=n.url?` · Open comment on host`:``,h;t[18]!==p||t[19]!==m?(h=(0,$.jsxs)(J,{children:[p,m]}),t[18]=p,t[19]=m,t[20]=h):h=t[20];let g;t[21]!==h||t[22]!==f?(g=(0,$.jsxs)(Y,{children:[f,h]}),t[21]=h,t[22]=f,t[23]=g):g=t[23];let _;return t[24]!==g||t[25]!==s?(_=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1 text-xs`,children:[s,g]}),t[24]=g,t[25]=s,t[26]=_):_=t[26],_}function ql(e){let t=(0,Q.c)(8),{comment:n,thread:r}=e,i=r?.path??n.path;if(!i)return null;let a=`${i}${r?.line?`:${r.line}`:``}`,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(`span`,{className:`truncate font-mono`}),t[0]=o):o=t[0];let s;t[1]===a?s=t[2]:(s=(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:o,children:a}),(0,$.jsx)(J,{children:a})]}),t[1]=a,t[2]=s);let c;t[3]===r?.isOutdated?c=t[4]:(c=r?.isOutdated?(0,$.jsx)(`span`,{className:`shrink-0`,children:`Outdated`}):null,t[3]=r?.isOutdated,t[4]=c);let l;return t[5]!==s||t[6]!==c?(l=(0,$.jsxs)(`div`,{className:`mt-2 flex min-w-0 items-center gap-2 text-xs text-muted-foreground`,children:[s,c]}),t[5]=s,t[6]=c,t[7]=l):l=t[7],l}function Jl(e){let t=e.toLowerCase().replace(/_/g,` `);return t.charAt(0).toUpperCase()+t.slice(1)}function Yl(e){let t=(0,Q.c)(29),{comment:n,editing:r,className:i}=e;if(r.editingId===n.id){let e;t[0]!==n||t[1]!==r?(e=e=>r.onSave(n,e),t[0]=n,t[1]=r,t[2]=e):e=t[2];let a;t[3]===r?a=t[4]:(a=()=>r.onEdit(null),t[3]=r,t[4]=a);let o;return t[5]!==i||t[6]!==n.body||t[7]!==r.cwd||t[8]!==r.environmentId||t[9]!==r.saving||t[10]!==r.threadRef||t[11]!==e||t[12]!==a?(o=(0,$.jsx)(Ks,{className:i,value:n.body,cwd:r.cwd,environmentId:r.environmentId,threadRef:r.threadRef,label:`Edit comment`,saving:r.saving,onSave:e,onCancel:a}),t[5]=i,t[6]=n.body,t[7]=r.cwd,t[8]=r.environmentId,t[9]=r.saving,t[10]=r.threadRef,t[11]=e,t[12]=a,t[13]=o):o=t[13],o}let a;t[14]===i?a=t[15]:(a=K(`flex items-start gap-1`,i),t[14]=i,t[15]=a);let o;t[16]!==n.body||t[17]!==n.id||t[18]!==r.cwd||t[19]!==r.environmentId||t[20]!==r.threadRef?(o=(0,$.jsx)(Hl,{className:`min-w-0 flex-1`,text:n.body,cwd:r.cwd,environmentId:r.environmentId,threadRef:r.threadRef},n.id),t[16]=n.body,t[17]=n.id,t[18]=r.cwd,t[19]=r.environmentId,t[20]=r.threadRef,t[21]=o):o=t[21];let s;t[22]!==n||t[23]!==r?(s=r.canEdit(n)?(0,$.jsx)(Ss,{"aria-label":`Edit comment`,onClick:()=>r.onEdit(n)}):null,t[22]=n,t[23]=r,t[24]=s):s=t[24];let c;return t[25]!==a||t[26]!==o||t[27]!==s?(c=(0,$.jsxs)(`div`,{className:a,children:[o,s]}),t[25]=a,t[26]=o,t[27]=s,t[28]=c):c=t[28],c}function Xl(e){let t=(0,Q.c)(37),{comment:n,editing:r,label:i,body:a,reactionBar:o,detail:s,thread:c}=e,[l,u]=(0,Z.useState)(!1),d=(0,Z.useRef)(null),f;t[0]!==n||t[1]!==s?(f=(0,$.jsx)(Kl,{comment:n,detail:s}),t[0]=n,t[1]=s,t[2]=f):f=t[2];let p=l&&`rotate-180`,m;t[3]===p?m=t[4]:(m=K(`size-3.5 transition-transform`,p),t[3]=p,t[4]=m);let h;t[5]===m?h=t[6]:(h=(0,$.jsx)(fe,{"aria-hidden":!0,className:m}),t[5]=m,t[6]=h);let g;t[7]!==i||t[8]!==h?(g=(0,$.jsxs)(da,{ref:d,className:`flex shrink-0 items-center gap-1.5 rounded-md px-2 py-1 text-xs text-muted-foreground hover:bg-muted hover:text-foreground`,children:[i,h]}),t[7]=i,t[8]=h,t[9]=g):g=t[9];let _;t[10]!==o||t[11]!==f||t[12]!==g?(_=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2`,children:[f,g,o]}),t[10]=o,t[11]=f,t[12]=g,t[13]=_):_=t[13];let v;t[14]!==n||t[15]!==c?(v=(0,$.jsx)(ql,{comment:n,thread:c}),t[14]=n,t[15]=c,t[16]=v):v=t[16];let y;t[17]!==a||t[18]!==l?(y=!l&&a?(0,$.jsx)(da,{className:`mt-2 block w-full truncate text-left text-xs text-muted-foreground hover:text-foreground`,onClick:()=>d.current?.focus({preventScroll:!0}),children:a.replace(/<!--[\s\S]*?-->/gu,``).replace(/^\s*>?\s*\[!\w+\]\s*$/gmu,``).replace(/!?(\[([^\]]+)\])\([^)]*\)/gu,`$2`).replace(/^[\s>#*-]+/gmu,``).replace(/[*`]/gu,``).replace(/\s+/g,` `).trim()}):null,t[17]=a,t[18]=l,t[19]=y):y=t[19];let b;t[20]!==_||t[21]!==v||t[22]!==y?(b=(0,$.jsxs)(`div`,{className:`p-3`,children:[_,v,y]}),t[20]=_,t[21]=v,t[22]=y,t[23]=b):b=t[23];let x;t[24]!==a||t[25]!==n||t[26]!==r||t[27]!==l?(x=l?(0,$.jsx)(`div`,{className:`px-3 pb-3`,children:a===null&&!r.canEdit(n)?null:(0,$.jsx)(Yl,{className:`mt-2`,comment:n,editing:r})}):null,t[24]=a,t[25]=n,t[26]=r,t[27]=l,t[28]=x):x=t[28];let S;t[29]===x?S=t[30]:(S=(0,$.jsx)(ua,{children:x}),t[29]=x,t[30]=S);let C;t[31]!==S||t[32]!==b?(C=(0,$.jsxs)(`article`,{className:`group rounded-lg border border-border/60 [contain-intrinsic-block-size:44px] [content-visibility:auto]`,children:[b,S]}),t[31]=S,t[32]=b,t[33]=C):C=t[33];let w;return t[34]!==l||t[35]!==C?(w=(0,$.jsx)(pa,{open:l,onOpenChange:u,children:C}),t[34]=l,t[35]=C,t[36]=w):w=t[36],w}function Zl(e){let t=(0,Q.c)(8),{icon:n,label:r,children:i}=e,a;t[0]!==n||t[1]!==r?(a=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[n,r]}),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o;t[3]===i?o=t[4]:(o=(0,$.jsx)(`span`,{className:`min-w-0 text-foreground`,children:i}),t[3]=i,t[4]=o);let s;return t[5]!==a||t[6]!==o?(s=(0,$.jsxs)(`div`,{className:`grid min-h-7 min-w-0 grid-cols-[6rem_minmax(0,1fr)] items-center gap-2 text-xs sm:min-h-6`,children:[a,o]}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Ql(e){let t=(0,Q.c)(25),{title:n,defaultOpen:r,keepMounted:i,actions:a,children:o}=e,s=r===void 0||r,c=i!==void 0&&i,[l,u]=(0,Z.useState)(s),d=(0,Z.useRef)(null),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>{if(!e){let e=d.current,t=e?.closest(`[data-pull-request-summary-section]`),n=e?.closest(`[data-pull-request-summary-scroll]`);if(e&&t&&n){let r=Wl({scrollTop:n.scrollTop,viewportTop:n.getBoundingClientRect().top,sectionTop:t.getBoundingClientRect().top,headingTop:e.getBoundingClientRect().top});r!==null&&(n.scrollTop=r)}}u(e)},t[0]=f):f=t[0];let p=f,m;t[1]===n?m=t[2]:(m=(0,$.jsx)(`section`,{"aria-label":n}),t[1]=n,t[2]=m);let h;t[3]===n?h=t[4]:(h=(0,$.jsx)(`span`,{children:n}),t[3]=n,t[4]=h);let g=l&&`rotate-90`,_;t[5]===g?_=t[6]:(_=K(`size-3.5 text-muted-foreground/60 transition-transform`,g),t[5]=g,t[6]=_);let v;t[7]===_?v=t[8]:(v=(0,$.jsx)(Pe,{"aria-hidden":!0,className:_}),t[7]=_,t[8]=v);let y;t[9]!==h||t[10]!==v?(y=(0,$.jsxs)(da,{className:`flex min-w-0 flex-1 items-center gap-1.5 px-4 py-3 text-left text-xs font-medium text-muted-foreground hover:text-foreground`,children:[h,v]}),t[9]=h,t[10]=v,t[11]=y):y=t[11];let b;t[12]!==a||t[13]!==y?(b=(0,$.jsxs)(`div`,{ref:d,className:`sticky top-0 z-10 flex w-full items-center bg-background pr-4`,children:[y,a]}),t[12]=a,t[13]=y,t[14]=b):b=t[14];let x;t[15]===o?x=t[16]:(x=(0,$.jsx)(`div`,{className:`px-4 pb-4`,children:o}),t[15]=o,t[16]=x);let S;t[17]!==c||t[18]!==x?(S=(0,$.jsx)(ua,{keepMounted:c,children:x}),t[17]=c,t[18]=x,t[19]=S):S=t[19];let C;return t[20]!==l||t[21]!==b||t[22]!==S||t[23]!==m?(C=(0,$.jsxs)(pa,{open:l,onOpenChange:p,render:m,"data-pull-request-summary-section":!0,children:[b,S]}),t[20]=l,t[21]=b,t[22]=S,t[23]=m,t[24]=C):C=t[24],C}var $l=10,eu=`t3code:pull-request-comment-filter:v1`,tu=R({bots:Re,resolved:Re}),nu={bots:!1,resolved:!1};function ru(e){let t=(0,Q.c)(110),{scrollerRef:n,environmentId:r,threadRef:i,reference:a,detail:o,activityPending:c,checksStale:l,activityError:u,pendingFinding:d,fixFindingLabel:f,fixCheckLabel:m,onFixFinding:h,onRefresh:_,onRefreshChecks:v}=e,b=l!==void 0&&l,x=f===void 0?`Fix in a thread`:f,C=m===void 0?`Fix`:m,w=v===void 0?_:v,T;t[0]===o.url?T=t[1]:(T={url:o.url,count:$l},t[0]=o.url,t[1]=T);let[D,O]=(0,Z.useState)(T),A=D.url===o.url?D.count:$l,[j,N]=g(eu,nu,tu),P=new Map(o.reviewThreads.flatMap(du)),F=e=>P.get(e.id)?.isResolved===!0||ni(e.reviewState)===`dismissed`,I=uu,L;t[2]!==j.bots||t[3]!==j.resolved||t[4]!==F?(L=e=>(j.bots||!I(e))&&(j.resolved||!F(e)),t[2]=j.bots,t[3]=j.resolved,t[4]=F,t[5]=L):L=t[5];let R=o.comments.filter(L),z=o.comments.length-R.length,B=R.slice(Math.max(0,R.length-A)),V=R.length-B.length,[H,ee]=(0,Z.useState)(`newest`),te=Ti(B,H),ne;t[6]!==o.url||t[7]!==V||t[8]!==A?(ne=V>0?(0,$.jsxs)(G,{size:`sm`,variant:`outline`,className:`w-full`,onClick:()=>O({url:o.url,count:A+$l}),children:[`Show `,Math.min(V,$l),` older comment`,V===1?``:`s`,` (`,V,` hidden)`]}):null,t[6]=o.url,t[7]=V,t[8]=A,t[9]=ne):ne=t[9];let U=ne,W=di(o.comments,o.commits),re=new Map(W.flatMap(lu)),ie=[...o.reviewers.map(e=>({key:e.login,actor:e,outcome:re.get(Gl(e.login))?.outcome??null,stale:re.get(Gl(e.login))?.stale??!1})),...W.filter(e=>!o.reviewers.some(t=>e.actor!==null&&Gl(t.login)===Gl(e.actor.login))).map(cu)],ae=pr(i),se;t[10]===ae?se=t[11]:(se=e=>{ae(e).catch(su)},t[10]=ae,t[11]=se);let ce=se,le;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(le={reportFailure:!1},t[12]=le):le=t[12];let ue=Tt(Ur.update,le),de;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(de={reportFailure:!1},t[13]=de):de=t[13];let fe=Tt(Ur.updateComment,de),[pe,me]=(0,Z.useState)(null),[ge,_e]=(0,Z.useState)(!1),[ve,ye]=(0,Z.useState)(null),[be,xe]=(0,Z.useState)(!1),Se=ve?.pullRequest===o.url?ve.commentId:null,we;t[14]!==ge||t[15]!==r||t[16]!==_||t[17]!==a||t[18]!==ue?(we=async e=>{if(ge)return;_e(!0);let t=await ue({environmentId:r,input:{...a,body:e}});if(_e(!1),t._tag===`Failure`){lt.add({type:`error`,title:`Could not save the description`});return}me(null),_()},t[14]=ge,t[15]=r,t[16]=_,t[17]=a,t[18]=ue,t[19]=we):we=t[19];let Ee=we,De;t[20]===o?De=t[21]:(De=e=>bs(o,e),t[20]=o,t[21]=De);let Oe;t[22]===o.url?Oe=t[23]:(Oe=e=>ye(e===null?null:{pullRequest:o.url,commentId:e.id}),t[22]=o.url,t[23]=Oe);let ke;t[24]!==be||t[25]!==r||t[26]!==_||t[27]!==a||t[28]!==fe?(ke=async(e,t)=>{if(be||e.kind===`review`)return;xe(!0);let n=await fe({environmentId:r,input:{...a,commentId:e.id,kind:e.kind,body:t}});if(xe(!1),n._tag===`Failure`){lt.add({type:`error`,title:`Could not save the comment`});return}ye(null),_()},t[24]=be,t[25]=r,t[26]=_,t[27]=a,t[28]=fe,t[29]=ke):ke=t[29];let Ae={cwd:o.workspaceRoot,environmentId:r,threadRef:i,canEdit:De,editingId:Se,saving:be,onEdit:Oe,onSave:ke},je=e=>{let t=P.get(e.id),n=hi(e.body);if(F(e))return(0,$.jsx)(Xl,{comment:e,editing:Ae,detail:o,thread:t,label:t?.isResolved?`Resolved`:`Review dismissed`,body:n,reactionBar:(0,$.jsx)(oc,{className:`ml-auto justify-end`,reactions:e.reactions??[],canReact:o.capabilities.reactions===!0,subjectId:e.id,environmentId:r,reference:a,onRefresh:_})},`${o.url}:${e.id}`);let i=ni(e.reviewState),s=e.kind!==`review`&&e.kind!==`review-comment`||i===`approved`?null:t===void 0?n===null?null:{kind:`comment`,comment:e}:{kind:`thread`,thread:t},c=(0,$.jsx)(oc,{reactions:e.reactions??[],canReact:o.capabilities.reactions===!0,subjectId:e.id,environmentId:r,reference:a,onRefresh:_,className:`ml-auto justify-end`});return(0,$.jsxs)(`article`,{className:`group rounded-lg border border-border/60 bg-background [contain-intrinsic-block-size:160px] [content-visibility:auto]`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2 rounded-t-lg bg-muted/25 px-3 py-2.5`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(Kl,{comment:e,detail:o}),i?(0,$.jsx)(Ar,{outcome:i}):e.reviewState?(0,$.jsx)(`span`,{children:Jl(e.reviewState)}):null]}),h&&s?(0,$.jsxs)(G,{size:`xs`,variant:`ghost`,className:`-mt-1 shrink-0`,disabled:d!=null,onClick:()=>h(s),children:[(0,$.jsx)(p,{className:`size-3`}),d===oi(s)?`Preparing...`:x]}):null,c]}),(0,$.jsx)(`div`,{className:`px-3`,children:(0,$.jsx)(ql,{comment:e,thread:t})}),n===null&&!Ae.canEdit(e)?null:(0,$.jsx)(Yl,{className:`px-3 py-3`,comment:e,editing:Ae})]},`${o.url}:${e.id}`)},Me;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(Me=(0,$.jsx)(M,{className:`size-3.5`}),t[30]=Me):Me=t[30];let Ne=ie.length===0?(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`None`}):(0,$.jsx)(`span`,{className:`flex items-center -space-x-1`,children:ie.map(ou)}),Pe;t[31]!==o.capabilities.reviewers.listCandidates||t[32]!==o.capabilities.reviewers.request||t[33]!==o.viewerPermissions||t[34]!==r||t[35]!==a?(Pe=o.capabilities.reviewers.request&&o.capabilities.reviewers.listCandidates?(0,$.jsx)(zl,{environmentId:r,reference:a,allowed:o.viewerPermissions.requestReviewers}):null,t[31]=o.capabilities.reviewers.listCandidates,t[32]=o.capabilities.reviewers.request,t[33]=o.viewerPermissions,t[34]=r,t[35]=a,t[36]=Pe):Pe=t[36];let Fe;t[37]!==Ne||t[38]!==Pe?(Fe=(0,$.jsx)(Zl,{icon:Me,label:`Reviewers`,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[Ne,Pe]})}),t[37]=Ne,t[38]=Pe,t[39]=Fe):Fe=t[39];let Ie;t[40]!==o.capabilities.labels||t[41]!==o.labels||t[42]!==o.viewerPermissions||t[43]!==r||t[44]!==a?(Ie=o.labels.length>0||o.capabilities.labels===!0?(0,$.jsx)(Zl,{icon:(0,$.jsx)(he,{className:`size-3.5`}),label:`Labels`,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-1`,children:[o.labels.length===0?(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`None`}):o.labels.map(au),o.capabilities.labels===!0?(0,$.jsx)(Fl,{environmentId:r,reference:a,allowed:o.viewerPermissions.labels!==!1}):null]})}):null,t[40]=o.capabilities.labels,t[41]=o.labels,t[42]=o.viewerPermissions,t[43]=r,t[44]=a,t[45]=Ie):Ie=t[45];let Le;t[46]!==Fe||t[47]!==Ie?(Le=(0,$.jsx)(`section`,{className:`px-4 pt-2.5 pb-1`,children:(0,$.jsxs)(`div`,{className:`space-y-2`,children:[Fe,Ie]})}),t[46]=Fe,t[47]=Ie,t[48]=Le):Le=t[48];let Re=`description:${o.url}`,ze;t[49]!==ge||t[50]!==pe||t[51]!==o||t[52]!==r||t[53]!==Ee||t[54]!==i?(ze=(0,$.jsx)(`div`,{className:`group`,children:pe===o.url?(0,$.jsx)(Ks,{allowEmpty:!0,value:o.body,cwd:o.workspaceRoot,environmentId:r,threadRef:i,label:`Pull request description`,placeholder:`Describe this pull request`,saving:ge,onSave:e=>void Ee(e),onCancel:()=>me(null)}):(0,$.jsxs)(`div`,{className:`flex items-start gap-1`,children:[(0,$.jsx)(Gs,{className:`min-w-0 flex-1`,text:o.body.trim().length>0?o.body:`_No description provided._`,cwd:o.workspaceRoot,environmentId:r,threadRef:i}),ys(o)?(0,$.jsx)(Ss,{"aria-label":`Edit description`,onClick:()=>me(o.url)}):null]})}),t[49]=ge,t[50]=pe,t[51]=o,t[52]=r,t[53]=Ee,t[54]=i,t[55]=ze):ze=t[55];let Be;t[56]!==Re||t[57]!==ze?(Be=(0,$.jsx)(Ql,{title:`Description`,keepMounted:!0,children:ze},Re),t[56]=Re,t[57]=ze,t[58]=Be):Be=t[58];let Ve=`checks:${o.url}`,He;t[59]!==b||t[60]!==o.checks||t[61]!==C||t[62]!==h||t[63]!==w||t[64]!==ce||t[65]!==d?(He=b?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:`Check details are out of date.`}),(0,$.jsx)(G,{size:`xs`,variant:`ghost`,onClick:w,children:`Refresh`})]}):o.checks.length===0?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No checks reported.`}):o.checks.map((e,t)=>{let n={kind:`check`,check:e},r=e.status===`failure`||e.status===`cancelled`;return(0,$.jsxs)(`div`,{className:`group flex items-center gap-2 rounded-md pr-1 hover:bg-accent/60`,children:[(0,$.jsxs)(`button`,{type:`button`,disabled:!e.url,onClick:()=>e.url&&ce(e.url),className:K(`flex min-w-0 flex-1 items-start gap-2 rounded-md px-2 py-2 text-left text-xs leading-5 [&>svg]:mt-0.5`,e.url?`cursor-pointer`:`cursor-default`),children:[(0,$.jsx)(Cr,{status:e.status}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 wrap-anywhere`,children:e.name}),(0,$.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:Dr(e)})]}),h&&r?(0,$.jsxs)(G,{size:`xs`,variant:`ghost`,className:`shrink-0`,disabled:d!=null,onClick:()=>h(n),children:[(0,$.jsx)(p,{className:`size-3`}),d===oi(n)?`Preparing...`:C]}):null]},`${t}:${e.name}:${e.url??``}`)}),t[59]=b,t[60]=o.checks,t[61]=C,t[62]=h,t[63]=w,t[64]=ce,t[65]=d,t[66]=He):He=t[66];let Ue;t[67]!==Ve||t[68]!==He?(Ue=(0,$.jsx)(Ql,{title:`Checks`,defaultOpen:!1,children:He},Ve),t[67]=Ve,t[68]=He,t[69]=Ue):Ue=t[69];let We=Ql,Ge=`Comments (${o.commentCount})`,Ke;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=(0,$.jsx)(G,{size:`xs`,variant:`ghost-muted`}),t[70]=Ke):Ke=t[70];let qe;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,$.jsx)(s,{"aria-hidden":!0,className:`size-3`}),t[71]=qe):qe=t[71];let Je=z>0?`${z} hidden`:`Filter`,Ye;t[72]===Je?Ye=t[73]:(Ye=(0,$.jsxs)(Ce,{render:Ke,"aria-label":`Filter comments`,children:[qe,Je]}),t[72]=Je,t[73]=Ye);let Xe;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(Xe=(0,$.jsx)(E,{children:`Show`}),t[74]=Xe):Xe=t[74];let Ze;t[75]===N?Ze=t[76]:(Ze=e=>N(t=>({...t,bots:e})),t[75]=N,t[76]=Ze);let Qe;t[77]!==j.bots||t[78]!==Ze?(Qe=(0,$.jsx)(k,{checked:j.bots,closeOnClick:!1,onCheckedChange:Ze,children:`Bot comments`}),t[77]=j.bots,t[78]=Ze,t[79]=Qe):Qe=t[79];let $e;t[80]===N?$e=t[81]:($e=e=>N(t=>({...t,resolved:e})),t[80]=N,t[81]=$e);let et;t[82]!==j.resolved||t[83]!==$e?(et=(0,$.jsx)(k,{checked:j.resolved,closeOnClick:!1,onCheckedChange:$e,children:`Resolved or dismissed`}),t[82]=j.resolved,t[83]=$e,t[84]=et):et=t[84];let tt;t[85]!==Qe||t[86]!==et?(tt=(0,$.jsx)(oe,{align:`end`,children:(0,$.jsxs)(Te,{children:[Xe,Qe,et]})}),t[85]=Qe,t[86]=et,t[87]=tt):tt=t[87];let nt;t[88]!==Ye||t[89]!==tt?(nt=(0,$.jsxs)(y,{children:[Ye,tt]}),t[88]=Ye,t[89]=tt,t[90]=nt):nt=t[90];let rt=H===`newest`?`Show oldest comments first`:`Show newest comments first`,it,at;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(it=()=>ee(iu),at=(0,$.jsx)(S,{"aria-hidden":!0,className:`size-3`}),t[91]=it,t[92]=at):(it=t[91],at=t[92]);let ot=H===`newest`?`Newest first`:`Oldest first`,st;t[93]!==rt||t[94]!==ot?(st=(0,$.jsxs)(G,{size:`xs`,variant:`ghost-muted`,"aria-label":rt,onClick:it,children:[at,ot]}),t[93]=rt,t[94]=ot,t[95]=st):st=t[95];let ct;t[96]!==nt||t[97]!==st?(ct=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[nt,st]}),t[96]=nt,t[97]=st,t[98]=ct):ct=t[98];let ut=c?(0,$.jsx)(gl,{}):u?(0,$.jsx)(vl,{compact:!0,error:u,onRetry:_}):(0,$.jsxs)($.Fragment,{children:[o.commentsTruncated?(0,$.jsxs)(`p`,{className:`mb-2 rounded-md border border-warning/30 bg-warning-surface px-2 py-1.5 text-xs`,children:[`This conversation is longer than this page reads in one go. The most recent`,` `,o.comments.length,` are here; open it on the host to read the rest.`]}):null,o.comments.length===0?(0,$.jsx)(`p`,{className:`py-2 text-xs text-muted-foreground`,children:`No comments yet.`}):R.length===0?(0,$.jsx)(`p`,{className:`py-2 text-xs text-muted-foreground`,children:z===1?`The only comment is hidden by the filter.`:`All ${z} comments are hidden by the filter.`}):(0,$.jsxs)(`div`,{className:`space-y-3`,children:[H===`oldest`?U:null,te.map(je),H===`newest`?U:null,A>$l?(0,$.jsxs)(G,{size:`sm`,variant:`ghost`,className:`w-full`,onClick:()=>O({url:o.url,count:$l}),children:[`Show only `,$l,` recent comments`]}):null]})]}),dt;t[99]!==We||t[100]!==Ge||t[101]!==ct||t[102]!==ut?(dt=(0,$.jsx)(We,{title:Ge,actions:ct,children:ut}),t[99]=We,t[100]=Ge,t[101]=ct,t[102]=ut,t[103]=dt):dt=t[103];let ft;return t[104]!==n||t[105]!==Le||t[106]!==Be||t[107]!==Ue||t[108]!==dt?(ft=(0,$.jsxs)(`div`,{ref:n,className:`h-full overflow-y-auto`,"data-pull-request-summary-scroll":!0,children:[Le,Be,Ue,dt]}),t[104]=n,t[105]=Le,t[106]=Be,t[107]=Ue,t[108]=dt,t[109]=ft):ft=t[109],ft}function iu(e){return e===`newest`?`oldest`:`newest`}function au(e){return(0,$.jsx)(kr,{label:e,size:`default`,className:`max-w-48`},e.name)}function ou(e){let t=e.actor?.login??`ghost`,n=e.actor?.name&&e.actor.name!==t?`${e.actor.name} (@${t})`:t;return(0,$.jsxs)(Y,{children:[(0,$.jsxs)(q,{render:(0,$.jsx)(`span`,{className:K(`relative rounded-full hover:z-10`,e.outcome?hr(e.outcome,e.stale):void 0)}),children:[(0,$.jsx)(Or,{actor:e.actor,tooltip:!1,variant:`avatar`}),e.outcome?(0,$.jsx)(`span`,{className:`sr-only`,children:e.stale?jr(e.outcome):xr(e.outcome)}):null]}),(0,$.jsx)(J,{side:`bottom`,children:e.outcome?`${n} — ${e.stale?jr(e.outcome):xr(e.outcome)}`:n})]},e.key)}function su(e){console.error(e),lt.add({type:`error`,title:`Unable to open check details`})}function cu(e){return{key:e.key,actor:e.actor,outcome:e.outcome,stale:e.stale}}function lu(e){return e.actor?[[Gl(e.actor.login),e]]:[]}function uu(e){return e.author?.isBot===!0||e.author?.login.endsWith(`[bot]`)===!0}function du(e){return e.comments.map(t=>[t.id,e])}function fu(e){let t=(0,Q.c)(6),{body:n,markdown:r,cwd:i,environmentId:a,threadRef:o}=e,s;return t[0]!==n||t[1]!==i||t[2]!==a||t[3]!==r||t[4]!==o?(s=(0,$.jsx)(`div`,{className:`mt-3`,children:r?(0,$.jsx)(Gs,{text:n,cwd:i,environmentId:a,threadRef:o}):(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-xs text-muted-foreground`,children:n})}),t[0]=n,t[1]=i,t[2]=a,t[3]=r,t[4]=o,t[5]=s):s=t[5],s}function pu(e){let t=(0,Q.c)(2),{actor:n}=e,r=n?.login??`ghost`,i;return t[0]===r?i=t[1]:(i=(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:r}),t[0]=r,t[1]=i),i}function mu(e){let t=(0,Q.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=K(`absolute left-0 top-1/2 z-10 flex size-8 -translate-y-1/2 items-center justify-center bg-background`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,$.jsx)(`span`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function hu(e){let t=(0,Q.c)(5),{icon:n,className:r}=e,i;t[0]===n?i=t[1]:(i=(0,$.jsx)(`span`,{className:`flex size-7 items-center justify-center bg-background text-muted-foreground`,children:n}),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,$.jsx)(mu,{className:r,children:i}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function gu(e){let t=(0,Q.c)(5),{actors:n,className:r,fallback:i,muted:a}=e,o=a!==void 0&&a,s=n[0],c;return t[0]!==s||t[1]!==r||t[2]!==i||t[3]!==o?(c=s===void 0?(0,$.jsx)(hu,{className:r,icon:i}):(0,$.jsx)(mu,{className:r,children:(0,$.jsx)(Tr,{actor:s,className:K(`size-7 bg-muted text-3xs transition-opacity`,o&&`opacity-45 grayscale`)})}),t[0]=s,t[1]=r,t[2]=i,t[3]=o,t[4]=c):c=t[4],c}function _u(e){return e.toLowerCase().replaceAll(`_`,` `).replaceAll(`-`,` `).replace(/^\w/u,e=>e.toUpperCase())}function vu(e){let t=(0,Q.c)(4),{state:n}=e,r;t[0]===n?r=t[1]:(r=_u(n),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,$.jsx)(`span`,{className:`text-3xs font-medium text-muted-foreground`,children:r}),t[2]=r,t[3]=i),i}function yu(e){let t=(0,Q.c)(3),{url:n,onOpen:r}=e,i;return t[0]!==r||t[1]!==n?(i=n===null?null:(0,$.jsx)(G,{size:`icon-xs`,variant:`ghost-muted`,className:`-mr-1 -mt-1 shrink-0`,"aria-label":`Open activity on host`,onClick:()=>r(n),children:(0,$.jsx)(O,{className:`size-3`})}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function bu(e){let t=(0,Q.c)(59),{event:n,editable:r,cwd:i,onOpen:a,reactions:o}=e,[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(!1),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d={reportFailure:!1},t[0]=d):d=t[0];let f=Tt(Ur.updateComment,d),p;t[1]!==r||t[2]!==o||t[3]!==l||t[4]!==f?(p=async e=>{if(r===null||l||r.kind===`review`)return;u(!0);let t=await f({environmentId:o.environmentId,input:{...o.reference,commentId:r.id,kind:r.kind,body:e}});if(u(!1),t._tag===`Failure`){lt.add({type:`error`,title:`Could not save the comment`});return}c(!1),o.onRefresh()},t[1]=r,t[2]=o,t[3]=l,t[4]=f,t[5]=p):p=t[5];let m=p,h;t[6]===n.actor?h=t[7]:(h=(0,$.jsx)(pu,{actor:n.actor}),t[6]=n.actor,t[7]=h);let g;t[8]===n.title?g=t[9]:(g=(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:n.title}),t[8]=n.title,t[9]=g);let _;t[10]===n.reviewState?_=t[11]:(_=n.reviewState?(0,$.jsx)(vu,{state:n.reviewState}):null,t[10]=n.reviewState,t[11]=_);let v;t[12]!==h||t[13]!==g||t[14]!==_?(v=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1 text-xs`,children:[h,g,_]}),t[12]=h,t[13]=g,t[14]=_,t[15]=v):v=t[15];let y;t[16]===n.at?y=t[17]:(y=wn(n.at),t[16]=n.at,t[17]=y);let b;t[18]===y?b=t[19]:(b=(0,$.jsx)(`span`,{children:y}),t[18]=y,t[19]=b);let x;t[20]===n.path?x=t[21]:(x=n.path?(0,$.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:[(0,$.jsx)(U,{"aria-hidden":!0,className:`size-3 shrink-0`}),(0,$.jsx)(`span`,{className:`truncate`,children:n.path})]}):null,t[20]=n.path,t[21]=x);let S;t[22]!==b||t[23]!==x?(S=(0,$.jsxs)(vr,{className:`mt-1 flex-wrap text-2xs text-muted-foreground`,children:[b,x]}),t[22]=b,t[23]=x,t[24]=S):S=t[24];let C;t[25]!==S||t[26]!==v?(C=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[v,S]}),t[25]=S,t[26]=v,t[27]=C):C=t[27];let w;t[28]!==r||t[29]!==s?(w=r!==null&&!s?(0,$.jsx)(Ss,{className:`-mt-1`,"aria-label":`Edit comment`,onClick:()=>c(!0)}):null,t[28]=r,t[29]=s,t[30]=w):w=t[30];let T;t[31]!==n.id||t[32]!==n.reactions||t[33]!==o.canReact||t[34]!==o.environmentId||t[35]!==o.onRefresh||t[36]!==o.reference?(T=o.canReact||n.reactions.length>0?(0,$.jsx)(oc,{className:`ml-auto justify-end`,reactions:n.reactions,canReact:o.canReact,subjectId:n.id,environmentId:o.environmentId,reference:o.reference,onRefresh:o.onRefresh}):null,t[31]=n.id,t[32]=n.reactions,t[33]=o.canReact,t[34]=o.environmentId,t[35]=o.onRefresh,t[36]=o.reference,t[37]=T):T=t[37];let E;t[38]!==n.url||t[39]!==a?(E=(0,$.jsx)(yu,{url:n.url,onOpen:a}),t[38]=n.url,t[39]=a,t[40]=E):E=t[40];let D;t[41]!==C||t[42]!==w||t[43]!==T||t[44]!==E?(D=(0,$.jsx)(`div`,{className:`px-2`,children:(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start gap-2`,children:[C,w,T,E]})}),t[41]=C,t[42]=w,t[43]=T,t[44]=E,t[45]=D):D=t[45];let O;t[46]!==i||t[47]!==r||t[48]!==s||t[49]!==n.body||t[50]!==n.markdown||t[51]!==o.environmentId||t[52]!==o.threadRef||t[53]!==m||t[54]!==l?(O=s&&r!==null?(0,$.jsx)(`div`,{className:`px-2 pb-2 pt-3`,children:(0,$.jsx)(Ks,{value:r.body,cwd:i,environmentId:o.environmentId,threadRef:o.threadRef,label:`Edit comment`,saving:l,onSave:e=>void m(e),onCancel:()=>c(!1)})}):n.body?(0,$.jsx)(`div`,{className:`px-2 pb-2`,children:(0,$.jsx)(fu,{body:n.body,markdown:n.markdown,cwd:i,environmentId:o.environmentId,threadRef:o.threadRef})}):null,t[46]=i,t[47]=r,t[48]=s,t[49]=n.body,t[50]=n.markdown,t[51]=o.environmentId,t[52]=o.threadRef,t[53]=m,t[54]=l,t[55]=O):O=t[55];let k;return t[56]!==D||t[57]!==O?(k=(0,$.jsxs)(`article`,{className:`group py-2`,children:[D,O]}),t[56]=D,t[57]=O,t[58]=k):k=t[58],k}function xu(e){let t=new Map;for(let n of e){let e=n.actor;e!==null&&!t.has(e.login)&&t.set(e.login,e)}return[...t.values()]}function Su(e){let t=(0,Q.c)(50),{events:n,editable:r,cwd:i,onOpen:a,reactions:o}=e,[s,c]=(0,Z.useState)(!1),l;t[0]===n?l=t[1]:(l=xu(n),t[0]=n,t[1]=l);let u=l,d=n[0];if(d===void 0)return null;let f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(Ae,{className:`size-3.5`}),t[2]=f):f=t[2];let p=!s,m;t[3]!==u||t[4]!==p?(m=(0,$.jsx)(gu,{actors:u,className:`top-6`,fallback:f,muted:p}),t[3]=u,t[4]=p,t[5]=m):m=t[5];let h=s?`text-foreground opacity-100`:`text-muted-foreground opacity-55`,g;t[6]===h?g=t[7]:(g=K(`flex w-full min-w-0 items-center gap-3 py-2 text-left transition-opacity hover:opacity-100`,h),t[6]=h,t[7]=g);let _;t[8]===n.length?_=t[9]:(_=n.length.toLocaleString(),t[8]=n.length,t[9]=_);let v=n.length===1?`comment`:`comments`,y;t[10]!==_||t[11]!==v?(y=(0,$.jsxs)(`span`,{className:`block text-xs font-semibold`,children:[_,` `,v]}),t[10]=_,t[11]=v,t[12]=y):y=t[12];let b;t[13]===u.length?b=t[14]:(b=u.length.toLocaleString(),t[13]=u.length,t[14]=b);let x=u.length===1?`author`:`authors`,S;t[15]===d.at?S=t[16]:(S=wn(d.at),t[15]=d.at,t[16]=S);let C;t[17]!==b||t[18]!==x||t[19]!==S?(C=(0,$.jsxs)(`span`,{className:`block truncate text-3xs text-muted-foreground`,children:[b,` `,x,` ·`,` `,S]}),t[17]=b,t[18]=x,t[19]=S,t[20]=C):C=t[20];let w;t[21]!==C||t[22]!==y?(w=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[y,C]}),t[21]=C,t[22]=y,t[23]=w):w=t[23];let T=s&&`rotate-180`,E;t[24]===T?E=t[25]:(E=K(`size-3.5 shrink-0 text-muted-foreground transition-transform`,T),t[24]=T,t[25]=E);let D;t[26]===E?D=t[27]:(D=(0,$.jsx)(fe,{"aria-hidden":!0,className:E}),t[26]=E,t[27]=D);let O;t[28]!==w||t[29]!==D||t[30]!==g?(O=(0,$.jsxs)(da,{className:g,children:[w,D]}),t[28]=w,t[29]=D,t[30]=g,t[31]=O):O=t[31];let k;t[32]!==i||t[33]!==r||t[34]!==n||t[35]!==a||t[36]!==s||t[37]!==o?(k=s?(0,$.jsx)(`div`,{className:`mt-1 space-y-1`,children:n.map(e=>(0,$.jsx)(bu,{event:e,editable:r.get(e.id)??null,cwd:i,onOpen:a,reactions:o},`${o.reference.projectId}#${o.reference.number}:${e.id}`))}):null,t[32]=i,t[33]=r,t[34]=n,t[35]=a,t[36]=s,t[37]=o,t[38]=k):k=t[38];let A;t[39]===k?A=t[40]:(A=(0,$.jsx)(ua,{children:k}),t[39]=k,t[40]=A);let j;t[41]!==O||t[42]!==A?(j=(0,$.jsxs)(`div`,{children:[O,A]}),t[41]=O,t[42]=A,t[43]=j):j=t[43];let M;t[44]!==s||t[45]!==j?(M=(0,$.jsx)(pa,{open:s,onOpenChange:c,children:j}),t[44]=s,t[45]=j,t[46]=M):M=t[46];let N;return t[47]!==M||t[48]!==m?(N=(0,$.jsxs)(`div`,{className:`relative mb-5 pl-12 [contain-intrinsic-block-size:48px] [content-visibility:auto]`,children:[m,M]}),t[47]=M,t[48]=m,t[49]=N):N=t[49],N}function Cu(e){let t=(0,Q.c)(33),{event:n,onOpen:r}=e,i=`View commit ${n.id}`,a;t[0]!==n.id||t[1]!==r?(a=()=>r(n.id),t[0]=n.id,t[1]=r,t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(pe,{className:`size-3.5`}),t[3]=o):o=t[3];let s;t[4]===n.commitAuthors?s=t[5]:(s=(0,$.jsx)(gu,{actors:n.commitAuthors,fallback:o}),t[4]=n.commitAuthors,t[5]=s);let c=n.body??`Untitled commit`,l;t[6]===c?l=t[7]:(l=(0,$.jsx)(`div`,{className:`truncate text-xs font-semibold text-foreground transition-colors group-hover:text-primary`,children:c}),t[6]=c,t[7]=l);let u;t[8]===n.id?u=t[9]:(u=n.id.slice(0,7),t[8]=n.id,t[9]=u);let d;t[10]===u?d=t[11]:(d=(0,$.jsx)(`code`,{className:`font-mono`,children:u}),t[10]=u,t[11]=d);let f;t[12]===n.at?f=t[13]:(f=wn(n.at),t[12]=n.at,t[13]=f);let p;t[14]===f?p=t[15]:(p=(0,$.jsx)(`span`,{children:f}),t[14]=f,t[15]=p);let m;t[16]!==p||t[17]!==d?(m=(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-3xs text-muted-foreground`,children:[d,p]}),t[16]=p,t[17]=d,t[18]=m):m=t[18];let h;t[19]!==m||t[20]!==l?(h=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[l,m]}),t[19]=m,t[20]=l,t[21]=h):h=t[21];let g;t[22]!==n.additions||t[23]!==n.deletions?(g=n.additions!==null&&n.deletions!==null?(0,$.jsx)(Er,{additions:n.additions,deletions:n.deletions,className:`ml-auto shrink-0 font-mono text-3xs`}):null,t[22]=n.additions,t[23]=n.deletions,t[24]=g):g=t[24];let _;t[25]!==h||t[26]!==g?(_=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5 py-1.5`,children:[h,g]}),t[25]=h,t[26]=g,t[27]=_):_=t[27];let v;return t[28]!==i||t[29]!==_||t[30]!==a||t[31]!==s?(v=(0,$.jsxs)(`button`,{type:`button`,className:`group relative mb-5 block w-full cursor-pointer rounded-sm pl-12 text-left outline-none [contain-intrinsic-block-size:48px] [content-visibility:auto] focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,"aria-label":i,onClick:a,children:[s,_]}),t[28]=i,t[29]=_,t[30]=a,t[31]=s,t[32]=v):v=t[32],v}function wu(e){let t=(0,Q.c)(21),{event:n}=e,r;t[0]===n.kind?r=t[1]:(r=n.kind===`opened`?{icon:(0,$.jsx)(Ir.pullRequest,{className:`size-3.5`}),label:`Pull request opened`}:n.kind===`merged`?{icon:(0,$.jsx)(Ir.merged,{className:`size-3.5`}),label:`Pull request merged`}:{icon:(0,$.jsx)(Ir.closed,{className:`size-3.5`}),label:`Pull request closed`},t[0]=n.kind,t[1]=r);let i=r,a;t[2]===i.icon?a=t[3]:(a=(0,$.jsx)(hu,{icon:i.icon}),t[2]=i.icon,t[3]=a);let o;t[4]===n.actor?o=t[5]:(o=n.actor?(0,$.jsx)(pu,{actor:n.actor}):null,t[4]=n.actor,t[5]=o);let s;t[6]===i.label?s=t[7]:(s=(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:i.label}),t[6]=i.label,t[7]=s);let c;t[8]!==o||t[9]!==s?(c=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[o,s]}),t[8]=o,t[9]=s,t[10]=c):c=t[10];let l;t[11]===n.at?l=t[12]:(l=wn(n.at),t[11]=n.at,t[12]=l);let u;t[13]===l?u=t[14]:(u=(0,$.jsx)(`div`,{className:`mt-0.5 text-2xs text-muted-foreground`,children:l}),t[13]=l,t[14]=u);let d;t[15]!==c||t[16]!==u?(d=(0,$.jsxs)(`div`,{className:`py-1.5 text-xs`,children:[c,u]}),t[15]=c,t[16]=u,t[17]=d):d=t[17];let f;return t[18]!==a||t[19]!==d?(f=(0,$.jsxs)(`div`,{className:`relative mb-5 pl-12 [contain-intrinsic-block-size:48px] [content-visibility:auto]`,children:[a,d]}),t[18]=a,t[19]=d,t[20]=f):f=t[20],f}function Tu(e){let t=(0,Q.c)(69),{event:n,outcome:r,stale:i,cwd:a,onOpen:o,reactions:s}=e,c;t[0]===n.actor?c=t[1]:(c=n.actor?[n.actor]:[],t[0]=n.actor,t[1]=c);let l;t[2]===r?l=t[3]:(l=(0,$.jsx)(yr,{outcome:r}),t[2]=r,t[3]=l);let u;t[4]!==c||t[5]!==l?(u=(0,$.jsx)(gu,{actors:c,className:`top-6`,fallback:l}),t[4]=c,t[5]=l,t[6]=u):u=t[6];let d;t[7]===n.actor?d=t[8]:(d=(0,$.jsx)(pu,{actor:n.actor}),t[7]=n.actor,t[8]=d);let f=!i,p;t[9]!==r||t[10]!==i?(p=K(`font-medium lowercase`,i?`text-muted-foreground opacity-70`:Nr(r)),t[9]=r,t[10]=i,t[11]=p):p=t[11];let m;t[12]===p?m=t[13]:(m=(0,$.jsx)(`span`,{className:p}),t[12]=p,t[13]=m);let h;t[14]===r?h=t[15]:(h=xr(r),t[14]=r,t[15]=h);let g;t[16]===i?g=t[17]:(g=i?(0,$.jsx)(`span`,{className:`sr-only`,children:`, before the latest commits`}):null,t[16]=i,t[17]=g);let _;t[18]!==m||t[19]!==h||t[20]!==g?(_=(0,$.jsxs)(q,{render:m,children:[h,g]}),t[18]=m,t[19]=h,t[20]=g,t[21]=_):_=t[21];let v;t[22]===r?v=t[23]:(v=jr(r),t[22]=r,t[23]=v);let y;t[24]===v?y=t[25]:(y=(0,$.jsx)(J,{children:v}),t[24]=v,t[25]=y);let b;t[26]!==_||t[27]!==y||t[28]!==f?(b=(0,$.jsxs)(Y,{disabled:f,children:[_,y]}),t[26]=_,t[27]=y,t[28]=f,t[29]=b):b=t[29];let x;t[30]!==b||t[31]!==d?(x=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1 text-xs`,children:[d,b]}),t[30]=b,t[31]=d,t[32]=x):x=t[32];let S;t[33]===n.at?S=t[34]:(S=wn(n.at),t[33]=n.at,t[34]=S);let C;t[35]===S?C=t[36]:(C=(0,$.jsx)(`span`,{children:S}),t[35]=S,t[36]=C);let w;t[37]===n.path?w=t[38]:(w=n.path?(0,$.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:[(0,$.jsx)(U,{"aria-hidden":!0,className:`size-3 shrink-0`}),(0,$.jsx)(`span`,{className:`truncate`,children:n.path})]}):null,t[37]=n.path,t[38]=w);let T;t[39]!==C||t[40]!==w?(T=(0,$.jsx)(`div`,{className:`mt-0.5 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:(0,$.jsxs)(vr,{className:`flex-wrap text-2xs text-muted-foreground`,children:[C,w]})}),t[39]=C,t[40]=w,t[41]=T):T=t[41];let E;t[42]!==x||t[43]!==T?(E=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,T]}),t[42]=x,t[43]=T,t[44]=E):E=t[44];let D;t[45]!==n.id||t[46]!==n.reactions||t[47]!==s.canReact||t[48]!==s.environmentId||t[49]!==s.onRefresh||t[50]!==s.reference?(D=s.canReact||n.reactions.length>0?(0,$.jsx)(oc,{className:`ml-auto justify-end`,reactions:n.reactions,canReact:s.canReact,subjectId:n.id,environmentId:s.environmentId,reference:s.reference,onRefresh:s.onRefresh}):null,t[45]=n.id,t[46]=n.reactions,t[47]=s.canReact,t[48]=s.environmentId,t[49]=s.onRefresh,t[50]=s.reference,t[51]=D):D=t[51];let O;t[52]!==n.url||t[53]!==o?(O=(0,$.jsx)(yu,{url:n.url,onOpen:o}),t[52]=n.url,t[53]=o,t[54]=O):O=t[54];let k;t[55]!==E||t[56]!==D||t[57]!==O?(k=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start gap-2 py-1.5`,children:[E,D,O]}),t[55]=E,t[56]=D,t[57]=O,t[58]=k):k=t[58];let A;t[59]!==a||t[60]!==n.body||t[61]!==n.markdown||t[62]!==s.environmentId||t[63]!==s.threadRef?(A=n.body?(0,$.jsx)(fu,{body:n.body,markdown:n.markdown,cwd:a,environmentId:s.environmentId,threadRef:s.threadRef}):null,t[59]=a,t[60]=n.body,t[61]=n.markdown,t[62]=s.environmentId,t[63]=s.threadRef,t[64]=A):A=t[64];let j;return t[65]!==k||t[66]!==A||t[67]!==u?(j=(0,$.jsxs)(`div`,{className:`group relative mb-5 pl-12 [contain-intrinsic-block-size:48px] [content-visibility:auto]`,children:[u,k,A]}),t[65]=k,t[66]=A,t[67]=u,t[68]=j):j=t[68],j}function Eu(e){let t=(0,Q.c)(38),{scrollerRef:n,detail:r,environmentId:i,threadRef:a,reference:o,order:s,onOpenCommit:c,onRefresh:l}=e,u=a===void 0?null:a,d,f,p,m,h,g,_;if(t[0]!==r||t[1]!==i||t[2]!==c||t[3]!==l||t[4]!==s||t[5]!==o||t[6]!==n||t[7]!==u){d=bi(r);let e=si(r.commits),a=r.capabilities.reactions===!0,v;t[15]!==i||t[16]!==l||t[17]!==o||t[18]!==a||t[19]!==u?(v={canReact:a,environmentId:i,threadRef:u,reference:o,onRefresh:l},t[15]=i,t[16]=l,t[17]=o,t[18]=a,t[19]=u,t[20]=v):v=t[20];let y=v,b;t[21]===r?b=t[22]:(b=new Map(r.comments.filter(e=>bs(r,e)).map(Ou)),t[21]=r,t[22]=b);let x=b,S=s===`newest`?d:d.toReversed(),C=Ni(S),w=Du;g=n,_=`scrollbar-gutter-both h-full overflow-y-auto px-4 py-5`,h=`mx-auto max-w-3xl`,f=`relative`,t[23]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(`span`,{"aria-hidden":!0,className:`absolute bottom-5 left-[15px] top-1 w-px bg-border/45`}),t[23]=p):p=t[23],m=C.map(t=>{if(t.kind===`comments`)return(0,$.jsx)(Su,{events:t.events,editable:x,cwd:r.workspaceRoot,onOpen:w,reactions:y},`comments:${t.events[0]?.id??`empty`}`);let n=t.event;if(n.kind===`commit`)return(0,$.jsx)(Cu,{event:n,onOpen:c},n.id);let i=ni(n.reviewState);return i===null?(0,$.jsx)(wu,{event:n},n.id):(0,$.jsx)(Tu,{event:n,outcome:i,stale:Qr(n.at,e),cwd:r.workspaceRoot,onOpen:w,reactions:y},n.id)}),t[0]=r,t[1]=i,t[2]=c,t[3]=l,t[4]=s,t[5]=o,t[6]=n,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g,t[14]=_}else d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13],_=t[14];let v;t[24]!==f||t[25]!==p||t[26]!==m?(v=(0,$.jsxs)(`div`,{className:f,children:[p,m]}),t[24]=f,t[25]=p,t[26]=m,t[27]=v):v=t[27];let y;t[28]===d.length?y=t[29]:(y=d.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 text-center text-muted-foreground`,children:[(0,$.jsx)(Ir.pullRequest,{className:`mb-2 size-5`}),(0,$.jsx)(`p`,{className:`text-xs`,children:`No activity yet.`})]}):null,t[28]=d.length,t[29]=y);let b;t[30]!==h||t[31]!==v||t[32]!==y?(b=(0,$.jsxs)(`div`,{className:h,children:[v,y]}),t[30]=h,t[31]=v,t[32]=y,t[33]=b):b=t[33];let x;return t[34]!==b||t[35]!==g||t[36]!==_?(x=(0,$.jsx)(`div`,{ref:g,className:_,children:b}),t[34]=b,t[35]=g,t[36]=_,t[37]=x):x=t[37],x}function Du(e){kt()?.shell.openExternal(e)}function Ou(e){return[e.id,e]}function ku(e){let t=(0,Q.c)(10),{environmentId:n,reference:r,threadRef:i}=e,a;t[0]!==n||t[1]!==r?(a=Ur.detail({environmentId:n,input:r}),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=wt(a);if(o.error!==null){let e;return t[3]===o.error?e=t[4]:(e=(0,$.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:o.error}),t[3]=o.error,t[4]=e),e}if(o.data===null){let e=o.isPending?`Loading checks…`:`No checks reported`,n;return t[5]===e?n=t[6]:(n=(0,$.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:e}),t[5]=e,t[6]=n),n}let s;return t[7]!==o.data.checks||t[8]!==i?(s=(0,$.jsx)(Au,{checks:o.data.checks,threadRef:i}),t[7]=o.data.checks,t[8]=i,t[9]=s):s=t[9],s}function Au(e){let t=(0,Q.c)(23),{checks:n,threadRef:r}=e,i=pr(r),[a,o]=(0,Z.useState)(!1),s,c,l,u,d,f;if(t[0]!==n||t[1]!==i||t[2]!==a){f=Symbol.for(`react.early_return_sentinel`);bb0:{let{attention:e,running:r,completed:o}=gi(n);c=e.length+r.length>0&&o.length>0;let p=[...e,...r,...a||!c?o:[]];if(n.length===0){let e;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`No checks reported`}),t[9]=e):e=t[9],f=e;break bb0}s=Hn,d=`max-h-64`,l=`flex flex-col gap-1`,u=p.map((e,t)=>(0,$.jsxs)(`li`,{className:`flex items-center gap-2 text-xs`,children:[(0,$.jsx)(Cr,{status:e.status}),(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name})}),(0,$.jsx)(J,{side:`top`,children:e.description??e.name})]}),(0,$.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:Dr(e)}),e.url===null?null:(0,$.jsx)(`button`,{type:`button`,className:`shrink-0 text-primary hover:underline`,onClick:()=>{e.url&&i(e.url).catch(ju)},children:`Details`})]},`${t}:${e.name}`))}t[0]=n,t[1]=i,t[2]=a,t[3]=s,t[4]=c,t[5]=l,t[6]=u,t[7]=d,t[8]=f}else s=t[3],c=t[4],l=t[5],u=t[6],d=t[7],f=t[8];if(f!==Symbol.for(`react.early_return_sentinel`))return f;let p;t[10]!==l||t[11]!==u?(p=(0,$.jsx)(`ul`,{className:l,children:u}),t[10]=l,t[11]=u,t[12]=p):p=t[12];let m;t[13]!==s||t[14]!==d||t[15]!==p?(m=(0,$.jsx)(s,{className:d,children:p}),t[13]=s,t[14]=d,t[15]=p,t[16]=m):m=t[16];let h;t[17]!==c||t[18]!==a?(h=c?(0,$.jsx)(G,{variant:`ghost`,size:`xs`,"aria-expanded":a,onClick:()=>o(!a),children:a?`Show less`:`Show all`}):null,t[17]=c,t[18]=a,t[19]=h):h=t[19];let g;return t[20]!==m||t[21]!==h?(g=(0,$.jsxs)($.Fragment,{children:[m,h]}),t[20]=m,t[21]=h,t[22]=g):g=t[22],g}function ju(e){console.error(e),lt.add({type:`error`,title:`Unable to open check details`})}function Mu(e){let t=(0,Q.c)(65),{checksState:n,checks:r,stale:i,environmentId:a,reference:o,threadRef:s,variant:c,className:l,render:u}=e,d=i!==void 0&&i,f=s===void 0?null:s,p=c===void 0?`icon`:c,m,h,g,_,v,y,b,x,S,C,w,T,E;if(t[0]!==r||t[1]!==n||t[2]!==l||t[3]!==u||t[4]!==d||t[5]!==p){v=Sr(n);let e;t[19]===r?e=t[20]:(e=r?.filter(Fu).length??0,t[19]=r,t[20]=e),y=e;let i;t[21]===r?i=t[22]:(i=r?.filter(Pu).length??0,t[21]=r,t[22]=i),_=i;let a;t[23]!==r||t[24]!==d?(a=r===void 0||d?null:Mr(r),t[23]=r,t[24]=d,t[25]=a):a=t[25],b=a,g=Yr,h=Jr,C=p===`count`,w=p===`count`?`Open checks: ${b??v.label}`:`Checks: ${v.label}`,t[26]!==l||t[27]!==u||t[28]!==p?(T=p===`count`?u??(0,$.jsx)(G,{variant:`ghost`,size:`sm`,className:l}):(0,$.jsx)(`span`,{role:`button`,tabIndex:0,className:K(`inline-flex shrink-0 cursor-pointer items-center`,l)}),t[26]=l,t[27]=u,t[28]=p,t[29]=T):T=t[29],E=Nu,m=v.Icon,x=!0,S=K(`size-3.5`,v.toneClassName),t[0]=r,t[1]=n,t[2]=l,t[3]=u,t[4]=d,t[5]=p,t[6]=m,t[7]=h,t[8]=g,t[9]=_,t[10]=v,t[11]=y,t[12]=b,t[13]=x,t[14]=S,t[15]=C,t[16]=w,t[17]=T,t[18]=E}else m=t[6],h=t[7],g=t[8],_=t[9],v=t[10],y=t[11],b=t[12],x=t[13],S=t[14],C=t[15],w=t[16],T=t[17],E=t[18];let D;t[30]!==m||t[31]!==x||t[32]!==S?(D=(0,$.jsx)(m,{"aria-hidden":x,className:S}),t[30]=m,t[31]=x,t[32]=S,t[33]=D):D=t[33];let O;t[34]!==r||t[35]!==_||t[36]!==y||t[37]!==p?(O=p===`count`?(0,$.jsx)($.Fragment,{children:r!==void 0&&y>0?(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[y,`/`,r.length]}):_>0?(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[_,` failed`]}):null}):null,t[34]=r,t[35]=_,t[36]=y,t[37]=p,t[38]=O):O=t[38];let k;t[39]!==h||t[40]!==D||t[41]!==O||t[42]!==C||t[43]!==w||t[44]!==T||t[45]!==E?(k=(0,$.jsxs)(h,{nativeButton:C,"aria-label":w,render:T,onClick:E,children:[D,O]}),t[39]=h,t[40]=D,t[41]=O,t[42]=C,t[43]=w,t[44]=T,t[45]=E,t[46]=k):k=t[46];let A;t[47]===v.label?A=t[48]:(A=(0,$.jsx)(`p`,{className:`mb-2 font-medium text-sm`,children:v.label}),t[47]=v.label,t[48]=A);let j;t[49]===b?j=t[50]:(j=b===null?null:(0,$.jsx)(`p`,{className:`mb-2 text-muted-foreground text-xs`,children:b}),t[49]=b,t[50]=j);let M;t[51]!==r||t[52]!==a||t[53]!==o||t[54]!==d||t[55]!==f?(M=d?(0,$.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Check details are out of date. Refresh the pull request to update them.`}):r===void 0?a!==void 0&&o!==void 0?(0,$.jsx)(ku,{environmentId:a,reference:o,threadRef:f}):null:(0,$.jsx)(Au,{checks:r,threadRef:f}),t[51]=r,t[52]=a,t[53]=o,t[54]=d,t[55]=f,t[56]=M):M=t[56];let N;t[57]!==A||t[58]!==j||t[59]!==M?(N=(0,$.jsxs)(Kr,{align:`start`,width:`md`,side:`bottom`,children:[A,j,M]}),t[57]=A,t[58]=j,t[59]=M,t[60]=N):N=t[60];let P;return t[61]!==g||t[62]!==k||t[63]!==N?(P=(0,$.jsxs)(g,{children:[k,N]}),t[61]=g,t[62]=k,t[63]=N,t[64]=P):P=t[64],P}function Nu(e){return e.stopPropagation()}function Pu(e){return e.status===`failure`||e.status===`cancelled`}function Fu(e){return e.status===`pending`}var Iu=(0,Z.createContext)(null);function Lu(e){let t=(0,Q.c)(7),{text:n,plain:r,className:i}=e,a=r!==void 0&&r,o=(0,Z.useContext)(Iu);if(a||o===null)return n;let s=o.cwd,c=o.environmentId,l;t[0]===i?l=t[1]:(l=K(`space-y-0 [&_.chat-markdown]:text-inherit`,i),t[0]=i,t[1]=l);let u;return t[2]!==o.cwd||t[3]!==o.environmentId||t[4]!==l||t[5]!==n?(u=(0,$.jsx)(Gs,{text:n,cwd:s,environmentId:c,className:l}),t[2]=o.cwd,t[3]=o.environmentId,t[4]=l,t[5]=n,t[6]=u):u=t[6],u}function Ru(e,t,n){return Math.max(Math.min(e+t,n-1),0)}function zu(e){return[...new Set([...e.excerpts.map(e=>e.path),...e.files.map(e=>e.path)])]}function Bu(e){let t=zu(e).length;return t===0?`Context, no code`:t===1?`1 file`:`${t} files`}function Vu(e){return e<26?String.fromCharCode(65+e):String(e+1)}function Hu(e){let t=[];return e.hunks.forEach((n,r)=>{let i=n.deletionStart,a=n.additionStart;for(let o of n.hunkContent){if(o.type===`context`){for(let n=0;n<o.lines;n+=1)t.push({kind:`context`,oldLine:i,newLine:a,oldAt:i,newAt:a,text:e.additionLines[o.additionLineIndex+n]??``,hunk:r}),i+=1,a+=1;continue}for(let n=0;n<o.deletions;n+=1)t.push({kind:`deletion`,oldLine:i,newLine:null,oldAt:i,newAt:a,text:e.deletionLines[o.deletionLineIndex+n]??``,hunk:r}),i+=1;for(let n=0;n<o.additions;n+=1)t.push({kind:`addition`,oldLine:null,newLine:a,oldAt:i,newAt:a,text:e.additionLines[o.additionLineIndex+n]??``,hunk:r}),a+=1}}),t}function Uu(e,t){let n=e=>t.side===`new`?e.newLine:e.oldLine,r=e=>{let r=n(e);return r!==null&&r>=t.start&&r<=t.end},i=e.findIndex(r);if(i===-1)return[];let a=e.findLastIndex(r),o=(t,n)=>e[t]?.hunk===e[n]?.hunk;if(t.side===`new`&&e[i]?.kind===`addition`)for(;i>0&&e[i-1]?.kind===`deletion`&&o(i-1,i);)--i;if(t.side===`old`&&e[a]?.kind===`deletion`)for(;a<e.length-1&&e[a+1]?.kind===`addition`&&o(a+1,a);)a+=1;return e.slice(i,a+1)}var Wu={context:` `,addition:`+`,deletion:`-`};function Gu(e,t,n){if(n.length===0)return``;let r=[`diff --git a/${t} b/${e}`,`--- a/${t}`,`+++ b/${e}`],i=0;for(;i<n.length;){let e=i;for(;e+1<n.length&&n[e+1]?.hunk===n[i]?.hunk;)e+=1;let t=n.slice(i,e+1),a=t[0],o=t.filter(e=>e.oldLine!==null).length,s=t.filter(e=>e.newLine!==null).length,c=o===0?Math.max(a.oldAt-1,0):a.oldAt,l=s===0?Math.max(a.newAt-1,0):a.newAt;r.push(`@@ -${c},${o} +${l},${s} @@`);for(let e of t)r.push(`${Wu[e.kind]}${e.text.replace(/\r?\n$/,``)}`);i=e+1}return`${r.join(`
207
+ `))?.[1]:void 0;d!==void 0&&Fs(d)?(i(),t.push({id:`attachment:${t.length}`,kind:`attachment`,url:d,media:`video`}),e=u):n.push(o)}return i(),t}var Rs=/#[1-9]\d*|[0-9a-f]{40}/giu,zs=/[A-Za-z0-9_]/u,Bs=/[\s([{]/u,Vs=new Set([`link`,`linkReference`]);function Hs(e){let t=e.repositoryUrl.replace(/\/+$/u,``);return e=>{Cs(e,Rs,(e,n)=>{let r=e.startsWith(`#`),i=n.input[n.index-1],a=n.input[n.index+e.length];return i!==void 0&&(r?zs.test(i):!Bs.test(i))||a!==void 0&&zs.test(a)?!1:{type:`link`,url:r?`${t}/issues/${e.slice(1)}`:`${t}/commit/${e}`,data:{hProperties:{dataPullRequestAutolink:r?`reference`:`commit`}},children:[{type:`text`,value:r?e:e.slice(0,7)}]}},Vs)}}var Us=(0,Z.createContext)(null);function Ws(e){let t=(0,Q.c)(7),{environmentId:n,cwd:r,url:i,fetchUrl:a}=e,o;t[0]!==r||t[1]!==a?(o={_tag:`github-media`,cwd:r,url:a},t[0]=r,t[1]=a,t[2]=o):o=t[2];let s=o,c=tr(n,s),l=er(n,s),u=c._tag===`Success`?c.url:c._tag===`Failure`?a:null,d=u===null?null:u+Sn(i),f;return t[3]!==l||t[4]!==d||t[5]!==i?(f=(0,$.jsx)(st,{src:d,originalUrl:i,label:`Pull request video`,className:`w-full`,videoClassName:`rounded-lg border border-border/60`,onRetry:l}),t[3]=l,t[4]=d,t[5]=i,t[6]=f):f=t[6],f}function Gs(e){let t=(0,Q.c)(12),{text:n,cwd:r,environmentId:i,threadRef:a,className:o}=e,s=Ls(n),c=(0,Z.useContext)(Us),l=c?.repositoryUrl,u=a??c?.threadRef??void 0,d;t[0]===l?d=t[1]:(d=l?[[Hs,{repositoryUrl:l}]]:[],t[0]=l,t[1]=d);let f=d,p;t[2]===o?p=t[3]:(p=K(`space-y-3 [&_[data-markdown-details]]:border-0 [&_[data-markdown-details-summary]]:text-foreground/80 [&_[data-markdown-details-summary]>svg]:text-muted-foreground/60`,o),t[2]=o,t[3]=p);let m;t[4]!==r||t[5]!==i||t[6]!==f||t[7]!==u?(m=e=>{if(e.kind===`markdown`||e.media===`image`)return(0,$.jsx)(lt,{text:e.kind===`markdown`?e.text:`![](<${e.url}>)`,cwd:r,threadRef:u,pullRequestPanelRef:u??kt,environmentId:i,extraRemarkPlugins:f,githubMedia:!0},e.id);let t=e.media===`video`?ut(e.url):null;return t===null?e.media===`video`?(0,$.jsx)(st,{src:e.url,originalUrl:e.url,label:`Pull request video`,className:`w-full`,videoClassName:`rounded-lg border border-border/60`},`${e.id}:${e.url}`):(0,$.jsxs)(`a`,{href:e.url,rel:`noreferrer noopener`,target:`_blank`,className:`flex items-center gap-2 rounded-lg border border-border/60 bg-muted/30 px-3 py-2 text-sm hover:bg-muted/60`,children:[(0,$.jsx)(Le,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`Open attachment on GitHub`}),(0,$.jsx)(O,{"aria-hidden":!0,className:`size-3 shrink-0 text-muted-foreground`})]},e.id):(0,$.jsx)(Ws,{environmentId:i,cwd:r,url:e.url,fetchUrl:t},`${e.id}:${e.url}`)},t[4]=r,t[5]=i,t[6]=f,t[7]=u,t[8]=m):m=t[8];let h=s.map(m),g;return t[9]!==p||t[10]!==h?(g=(0,$.jsx)(`div`,{className:p,"data-image-gallery":!0,children:h}),t[9]=p,t[10]=h,t[11]=g):g=t[11],g}function Ks(e){let t=(0,Q.c)(52),{value:n,cwd:r,environmentId:i,threadRef:a,placeholder:o,label:s,saving:c,allowEmpty:l,className:u,onSave:d,onCancel:f}=e,p=a===void 0?null:a,m=l!==void 0&&l,h=wt(i,Ie),[g,_]=(0,Z.useState)(n),[v,y]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(n);b!==n&&(x(n),_(n));let S;t[0]===g?S=t[1]:(S=g.trim(),t[0]=g,t[1]=S);let C=S.length===0,w=!h||c||C&&!m,T;t[2]===u?T=t[3]:(T=K(`space-y-2`,u),t[2]=u,t[3]=T);let E;t[4]!==g||t[5]!==i||t[6]!==f||t[7]!==d||t[8]!==w||t[9]!==c?(E=e=>{if(!(e.nativeEvent.isComposing||e.keyCode===229)){if(e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&!e.shiftKey&&!e.altKey){e.preventDefault(),e.stopPropagation(),!w&&!e.repeat&&Tt(i,`source-control:write`)&&d(g);return}e.key!==`Escape`||c||(e.preventDefault(),f())}},t[4]=g,t[5]=i,t[6]=f,t[7]=d,t[8]=w,t[9]=c,t[10]=E):E=t[10];let D=v?`preview`:`write`,O;t[11]===D?O=t[12]:(O=[D],t[11]=D,t[12]=O);let k,A,j;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{let t=e[0];(t===`write`||t===`preview`)&&y(t===`preview`)},j=(0,$.jsx)(An,{value:`write`,children:`Write`}),k=(0,$.jsx)(An,{value:`preview`,children:`Preview`}),t[13]=k,t[14]=A,t[15]=j):(k=t[13],A=t[14],j=t[15]);let M;t[16]!==c||t[17]!==O?(M=(0,$.jsxs)(kn,{"aria-label":`Markdown editor mode`,variant:`segmented`,value:O,disabled:c,onValueChange:A,children:[j,k]}),t[16]=c,t[17]=O,t[18]=M):M=t[18];let N;t[19]!==r||t[20]!==g||t[21]!==C||t[22]!==i||t[23]!==s||t[24]!==o||t[25]!==v||t[26]!==c||t[27]!==p?(N=v?(0,$.jsx)(`div`,{className:`rounded-lg border border-border/60 px-3 py-2`,children:C?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Nothing to preview.`}):(0,$.jsx)(Gs,{text:g,cwd:r,environmentId:i,threadRef:p})}):(0,$.jsx)(Dn,{autoFocus:!0,disabled:c,value:g,rows:6,placeholder:o,"aria-label":s,onChange:e=>_(e.target.value)}),t[19]=r,t[20]=g,t[21]=C,t[22]=i,t[23]=s,t[24]=o,t[25]=v,t[26]=c,t[27]=p,t[28]=N):N=t[28];let P;t[29]!==f||t[30]!==c?(P=(0,$.jsx)(G,{size:`xs`,variant:`ghost`,disabled:c,onClick:f,children:`Cancel`}),t[29]=f,t[30]=c,t[31]=P):P=t[31];let F=!h||c||C&&!m,I;t[32]!==m||t[33]!==g||t[34]!==C||t[35]!==i||t[36]!==d||t[37]!==c?(I=()=>{!Tt(i,`source-control:write`)||c||C&&!m||d(g)},t[32]=m,t[33]=g,t[34]=C,t[35]=i,t[36]=d,t[37]=c,t[38]=I):I=t[38];let L=c?`Saving...`:`Save`,R;t[39]!==F||t[40]!==I||t[41]!==L?(R=(0,$.jsx)(G,{size:`xs`,variant:`outline`,disabled:F,onClick:I,children:L}),t[39]=F,t[40]=I,t[41]=L,t[42]=R):R=t[42];let z;t[43]!==P||t[44]!==R?(z=(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[P,R]}),t[43]=P,t[44]=R,t[45]=z):z=t[45];let B;return t[46]!==M||t[47]!==N||t[48]!==z||t[49]!==T||t[50]!==E?(B=(0,$.jsxs)(`div`,{className:T,onKeyDown:E,children:[M,N,z]}),t[46]=M,t[47]=N,t[48]=z,t[49]=T,t[50]=E,t[51]=B):B=t[51],B}var qs=[`thumbs-up`,`thumbs-down`,`laugh`,`hooray`,`confused`,`heart`,`rocket`,`eyes`],Js={"thumbs-up":`👍`,"thumbs-down":`👎`,laugh:`😄`,hooray:`🎉`,confused:`😕`,heart:`❤️`,rocket:`🚀`,eyes:`👀`},Ys={"thumbs-up":`thumbs up`,"thumbs-down":`thumbs down`,laugh:`laugh`,hooray:`hooray`,confused:`confused`,heart:`heart`,rocket:`rocket`,eyes:`eyes`};function Xs(e){return Js[e]}function Zs(e){return Ys[e]}var Qs=3;function $s(e){return e.length<=1?e[0]??``:e.length===2?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(`, `)}, and ${e.at(-1)}`}function ec(e,t){return t?`${e} ${e===1?`other`:`others`}`:`${e} ${e===1?`person`:`people`}`}function tc(e){let t=e.actors.length<e.count,n=(e.viewerHasReacted&&t?[`You`,...e.actors]:[...e.actors]).slice(0,Math.min(Qs,e.count)),r=Math.max(0,e.count-n.length);return`${$s([...n,...r>0?[ec(r,n.length>0)]:[]])} reacted with ${Zs(e.content)} emoji`}function nc(e,t){if(t.size===0)return e;let n=new Map(e.map(e=>[e.content,e]));for(let[e,r]of t){let t=n.get(e);if(t===void 0){r&&n.set(e,{content:e,count:1,actors:[],viewerHasReacted:!0});continue}if(t.viewerHasReacted===r)continue;let i=t.count+(r?1:-1);i<=0?n.delete(e):n.set(e,{...t,count:i,viewerHasReacted:r})}return qs.flatMap(e=>n.get(e)??[])}var rc=`inline-flex h-6 shrink-0 items-center gap-1 rounded-full border px-2 text-xs outline-none transition-colors focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,ic=new Map;function ac(e){return e.map(e=>`${e.content}:${e.count}:${+!!e.viewerHasReacted}`).join(` `)}function oc(e){let t=(0,Q.c)(23),{reactions:n,canReact:r,subjectId:i,environmentId:a,reference:o,onRefresh:s,className:c}=e,[l,u]=(0,Z.useState)(!1),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d={signature:``,values:ic},t[0]=d):d=t[0];let[f,p]=(0,Z.useState)(d),m;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(m={reportFailure:!1},t[1]=m):m=t[1];let h=Dt(zr.setReaction,m),g,_,v,y;if(t[2]!==r||t[3]!==c||t[4]!==a||t[5]!==s||t[6]!==f.signature||t[7]!==f.values||t[8]!==l||t[9]!==n||t[10]!==o||t[11]!==h||t[12]!==i){y=Symbol.for(`react.early_return_sentinel`);bb0:{let e=ac(n),d=f.signature===e?f.values:ic,m=nc(n,d),b=async(t,n)=>{if(p({signature:e,values:new Map([...d,[t,n]])}),(await h({environmentId:a,input:{...o,...i===void 0?{}:{subjectId:i},content:t,reacted:n}}))._tag===`Failure`){p(e=>{let n=new Map(e.values);return n.delete(t),{signature:e.signature,values:n}}),gt.add({type:`error`,title:`The reaction could not be saved`});return}s()};if(m.length===0&&!r){y=null;break bb0}t[17]===c?g=t[18]:(g=K(`flex min-w-0 max-w-full flex-wrap items-center gap-1`,c),t[17]=c,t[18]=g),_=m.map(e=>(0,$.jsxs)(X,{children:[(0,$.jsxs)(J,{render:(0,$.jsx)(`button`,{type:`button`,"aria-pressed":e.viewerHasReacted,"aria-label":`${Zs(e.content)}, ${e.count}`,disabled:!r,className:K(rc,e.viewerHasReacted?`border-primary/60 bg-primary/10 text-foreground`:`border-border/70 bg-muted/40 text-muted-foreground`,r?`hover:border-primary/60`:`cursor-default`),onClick:()=>void b(e.content,!e.viewerHasReacted)}),children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:Xs(e.content)}),(0,$.jsx)(`span`,{className:`tabular-nums`,children:e.count})]}),(0,$.jsx)(Y,{side:`top`,children:tc(e)})]},e.content)),v=r?(0,$.jsxs)(Gr,{open:l,onOpenChange:u,children:[(0,$.jsx)(Wr,{render:(0,$.jsx)(`button`,{type:`button`,"aria-label":`Add a reaction`,className:K(rc,`border-border/70 px-1.5 text-muted-foreground hover:border-primary/60 hover:text-foreground`)}),children:(0,$.jsx)(ge,{"aria-hidden":!0,className:`size-3.5`})}),(0,$.jsx)(Hr,{align:`start`,side:`top`,padding:`compact`,children:(0,$.jsx)(`div`,{className:`flex items-center gap-0.5`,children:qs.map(e=>{let t=m.find(t=>t.content===e)?.viewerHasReacted??!1;return(0,$.jsx)(`button`,{type:`button`,"aria-pressed":t,"aria-label":Zs(e),className:K(`flex size-7 items-center justify-center rounded-md text-base outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,t&&`bg-primary/10`),onClick:()=>{u(!1),b(e,!t)},children:(0,$.jsx)(`span`,{"aria-hidden":!0,children:Xs(e)})},e)})})})]}):null}t[2]=r,t[3]=c,t[4]=a,t[5]=s,t[6]=f.signature,t[7]=f.values,t[8]=l,t[9]=n,t[10]=o,t[11]=h,t[12]=i,t[13]=g,t[14]=_,t[15]=v,t[16]=y}else g=t[13],_=t[14],v=t[15],y=t[16];if(y!==Symbol.for(`react.early_return_sentinel`))return y;let b;return t[19]!==g||t[20]!==_||t[21]!==v?(b=(0,$.jsxs)(`div`,{className:g,children:[_,v]}),t[19]=g,t[20]=_,t[21]=v,t[22]=b):b=t[22],b}var sc=`mx-3 my-2 rounded-xl border border-border/70 bg-background p-3 text-sm shadow-sm`;function cc(e){return t=>{t.key===`Escape`&&e.onCancel&&(t.preventDefault(),e.onCancel()),yn(t,e.value,e.pending)&&(t.preventDefault(),e.onSubmit())}}function lc(e){return e===`left`?`deletions`:`additions`}function uc(e){switch(e.kind){case`added`:return{line:e.newLine,side:`right`};case`deleted`:return{line:e.oldLine,side:`left`};case`context`:return{line:e.side===`left`?e.oldLine:e.newLine,side:e.side}}}function dc(e){let t=(0,Q.c)(11),{comment:n,onRemove:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=K(sc,`border-dashed`),t[0]=i):i=t[0];let a,o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(Ae,{className:`size-3.5`}),o=(0,$.jsx)(`span`,{children:`Pending — sent when you submit the review`}),t[1]=a,t[2]=o):(a=t[1],o=t[2]);let s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(l,{className:`size-3.5`}),t[3]=s):s=t[3];let c;t[4]===r?c=t[5]:(c=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[a,o,(0,$.jsx)(G,{size:`icon-xs`,variant:`ghost`,className:`ml-auto`,"aria-label":`Discard this comment`,onClick:r,children:s})]}),t[4]=r,t[5]=c);let u;t[6]===n.body?u=t[7]:(u=(0,$.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap leading-relaxed`,children:n.body}),t[6]=n.body,t[7]=u);let d;return t[8]!==c||t[9]!==u?(d=(0,$.jsxs)(`div`,{className:i,contentEditable:!1,onPointerDown:fc,children:[c,u]}),t[8]=c,t[9]=u,t[10]=d):d=t[10],d}function fc(e){return e.stopPropagation()}function pc({thread:e,workspaceRoot:t,canReply:n,canResolve:r,canReact:i,environmentId:a,reference:o,pending:s,fixPending:c,fixLabel:l=`Fix in a thread`,onFix:u,onReply:d,onLoadMore:f,canEditComment:m,onEditComment:h,onToggleResolved:g,onReacted:_}){let[v,y]=(0,Z.useState)(!e.isResolved),[b,x]=(0,Z.useState)(!1),[S,C]=(0,Z.useState)(``),[w,T]=(0,Z.useState)(null),[E,D]=(0,Z.useState)(!1),O=(0,Z.useRef)(!1),[k,A]=(0,Z.useState)(null),[j,M]=(0,Z.useState)(!1),N=k?.threadId===e.id?k:null,P=Yr(e.comments,N?.comments??[]),F=N===null?e.nextCommentsCursor??null:N.nextCursor,I=e.commentCount??P.length,L=async(t,n)=>{if(E)return;D(!0);let r=await h(t,n);D(!1),r&&(A(r=>r?.threadId===e.id?{...r,comments:vi(r.comments,t,n)}:r),T(null))},R=async()=>{let t=S.trim();if(!(t.length===0||s||O.current)){O.current=!0;try{await d(t)&&(A(t=>t?.threadId===e.id?{...t,nextCursor:t.nextCursor??e.nextCommentsCursor??null}:t),C(``),x(!1))}finally{O.current=!1}}},z=async()=>{if(!(F===null||j)){M(!0);try{let t=await f(F);if(t===null)return;A(n=>({threadId:e.id,comments:Yr(n?.threadId===e.id?n.comments:[],t.comments),nextCursor:t.nextCursor}))}finally{M(!1)}}};return(0,$.jsxs)(`div`,{className:sc,contentEditable:!1,onPointerDown:e=>e.stopPropagation(),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(at,{className:K(`size-3.5`,e.isResolved&&`text-success-foreground`),icon:e.isResolved?ot:it}),(0,$.jsxs)(`button`,{type:`button`,className:`hover:text-foreground`,"aria-expanded":v,onClick:()=>y(e=>!e),children:[e.isResolved?`Resolved`:`Open`,` · `,I,` `,I===1?`comment`:`comments`]}),e.isOutdated?(0,$.jsx)(`span`,{children:`outdated`}):null,u?(0,$.jsxs)(G,{size:`xs`,variant:`ghost`,className:`ml-auto`,disabled:s||c,onClick:u,children:[(0,$.jsx)(p,{className:`size-3`}),c?`Preparing...`:l]}):null,r?(0,$.jsx)(G,{size:`xs`,variant:`ghost`,className:u?void 0:`ml-auto`,disabled:s,onClick:g,children:e.isResolved?`Unresolve`:`Resolve`}):null]}),(0,$.jsx)(ua,{open:v,children:(0,$.jsxs)(ga,{children:[(0,$.jsx)(`div`,{className:`mt-2 space-y-3`,children:P.map(e=>(0,$.jsxs)(`article`,{className:`group min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(wr,{actor:e.author}),(0,$.jsx)(`span`,{children:Cn(e.createdAt)}),(0,$.jsx)(oc,{className:`ml-auto justify-end`,reactions:e.reactions??[],canReact:i,subjectId:e.id,environmentId:a,reference:o,onRefresh:_})]}),w===e.id?(0,$.jsx)(Ks,{className:`mt-1`,value:e.body,cwd:t,environmentId:a,label:`Edit comment`,saving:E,onSave:t=>void L(e.id,t),onCancel:()=>T(null)}):(0,$.jsxs)(`div`,{className:`mt-1 flex items-start gap-1`,children:[(0,$.jsx)(Gs,{className:`min-w-0 flex-1 text-sm`,text:e.body,cwd:t,environmentId:a}),m(e)?(0,$.jsx)(Ss,{"aria-label":`Edit comment`,onClick:()=>T(e.id)}):null]})]},e.id))}),F===null?null:(0,$.jsx)(`div`,{className:`mt-2`,children:(0,$.jsx)(G,{size:`xs`,variant:`ghost`,disabled:j,onClick:()=>void z(),children:j?`Loading...`:`Load more comments`})}),n?b?(0,$.jsxs)(`div`,{className:`mt-2`,children:[(0,$.jsx)(Dn,{autoFocus:!0,size:`sm`,value:S,placeholder:`Reply`,"aria-label":`Reply to this conversation`,onChange:e=>C(e.target.value),onKeyDown:cc({value:S,pending:s,onSubmit:()=>void R(),onCancel:()=>x(!1)})}),(0,$.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[(0,$.jsx)(G,{size:`xs`,variant:`ghost`,onClick:()=>x(!1),children:`Cancel`}),(0,$.jsx)(G,{size:`xs`,disabled:s||S.trim().length===0,onClick:()=>void R(),children:`Reply`})]})]}):(0,$.jsx)(G,{size:`xs`,variant:`ghost`,className:`mt-2`,onClick:()=>x(!0),children:`Reply`}):null]})})]})}function mc(e){return e.repositoryIdentity?.canonicalKey?.toLowerCase()}function hc(e,t,n){let r=new Map(t.map((e,t)=>[e,t])),i=new Map;for(let t of e){let e=mc(t);if(!e)continue;let a=r.get(t.environmentId);if(a===void 0)continue;let o=i.get(e);if(o===void 0){i.set(e,t.environmentId);continue}o!==n&&(t.environmentId===n||a<(r.get(o)??2**53-1))&&i.set(e,t.environmentId)}let a=new Map;for(let t of e){if(!r.has(t.environmentId))continue;let e=mc(t);if(e&&i.get(e)!==t.environmentId)continue;let n=a.get(t.environmentId);n===void 0?a.set(t.environmentId,[t.id]):n.push(t.id)}return a}function gc(e,t,n){let r=t.find(t=>t.environmentId===e.environmentId&&t.id===e.projectId),i=r===void 0?void 0:mc(r),a=n.find(t=>t.environmentId===e.environmentId);if(r===void 0||!i||a===void 0)return[];let o=n.flatMap(n=>{if(n.environmentId===e.environmentId)return[];let r=t.find(e=>e.environmentId===n.environmentId&&mc(e)===i);return r===void 0?[]:[{environmentId:n.environmentId,projectId:r.id,workspaceRoot:r.workspaceRoot,label:n.label,...n.machine===void 0?{}:{machine:n.machine}}]});return o.length===0?[]:[{environmentId:e.environmentId,projectId:r.id,workspaceRoot:r.workspaceRoot,label:a.label,...a.machine===void 0?{}:{machine:a.machine}},...o]}function _c(e,t){let n=t.host?.toLowerCase();if(!n)return null;let r=e.filter(e=>e.host.toLowerCase()===n&&e.repository.toLowerCase()===t.repository.toLowerCase()),i=r.filter(e=>e.number===t.number),a=(i.length>0?i:r.filter(e=>e.stack?.layers.some(e=>e.number===t.number))).toSorted((e,t)=>Date.parse(t.snapshot?.syncedAt??t.linkedAt)-Date.parse(e.snapshot?.syncedAt??e.linkedAt))[0]?.stack;return!a||!a.layers.some(e=>e.number===t.number)?null:{id:a.id,number:a.number,url:a.url,base:a.base,layers:a.layers.map(e=>{let t=r.filter(t=>t.number===e.number).toSorted((e,t)=>Date.parse(t.snapshot?.syncedAt??t.linkedAt)-Date.parse(e.snapshot?.syncedAt??e.linkedAt))[0]?.snapshot;return{...e,...t?{title:t.title,isDraft:t.isDraft}:{}}})}}function vc(e,t){let n=e.isSuccess?e.data:e.data??t;return{data:n,isFresh:e.isSuccess,notice:n===null?null:e.error?`Stack data may be stale. We couldn’t refresh it.`:!e.isSuccess||e.isPending?`Refreshing stack… Showing saved data.`:null}}function yc(e,t){let n=(0,Q.c)(13),r=Ke(),i;n[0]!==e||n[1]!==t||n[2]!==r?(i=t===null?null:_c(r.filter(t=>t.environmentId===e).flatMap(bc),t),n[0]=e,n[1]=t,n[2]=r,n[3]=i):i=n[3];let a=i,o;n[4]!==e||n[5]!==t?(o=t===null?null:Pr({environmentId:e,input:t}),n[4]=e,n[5]=t,n[6]=o):o=n[6];let s=Et(o),c;n[7]!==s||n[8]!==a?(c=vc(s,a),n[7]=s,n[8]=a,n[9]=c):c=n[9];let l;return n[10]!==s||n[11]!==c?(l={...s,...c},n[10]=s,n[11]=c,n[12]=l):l=n[12],l}function bc(e){return e.pullRequests??[]}function xc(e){let t=(0,Q.c)(12),{children:n,className:r}=e,i=(0,Z.useRef)(null),[a,o]=(0,Z.useState)(null),s,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=i.current;if(e)return $n(e,e=>{let t=Math.ceil(e.at(-1)?.contentRect.width??0);t>0&&o(t)})},c=[],t[0]=s,t[1]=c):(s=t[0],c=t[1]),(0,Z.useLayoutEffect)(s,c);let l;t[2]===r?l=t[3]:(l=K(`inline-block overflow-hidden transition-[width] duration-150 ease-out motion-reduce:transition-none`,r),t[2]=r,t[3]=l);let u;t[4]===a?u=t[5]:(u=a===null?void 0:{width:a},t[4]=a,t[5]=u);let d;t[6]===n?d=t[7]:(d=(0,$.jsx)(`span`,{ref:i,className:`block w-max whitespace-nowrap`,children:n}),t[6]=n,t[7]=d);let f;return t[8]!==l||t[9]!==u||t[10]!==d?(f=(0,$.jsx)(`span`,{"data-slot":`animated-width`,className:l,style:u,children:d}),t[8]=l,t[9]=u,t[10]=d,t[11]=f):f=t[11],f}var Sc=3e5,Cc=36e4;function wc(e){return e.visible&&e.now-e.lastRefreshedAt>=1e4}function Tc(e){return e.lastRefreshedAt!==void 0&&wc({...e,lastRefreshedAt:e.lastRefreshedAt})}function Ec(e){return e.now-e.lastInteractedAt<36e4&&wc(e)}var Dc=new Map,Oc=0,kc=new Set,Ac=[`pointerdown`,`pointermove`,`keydown`,`wheel`],jc=()=>{let e=Date.now(),t=e-Oc>=Cc;if(Oc=e,t)for(let e of kc)e()};function Mc(e){if(kc.size===0){Oc=Date.now();for(let e of Ac)document.addEventListener(e,jc,{passive:!0})}return kc.add(e),()=>{if(kc.delete(e),!(kc.size>0))for(let e of Ac)document.removeEventListener(e,jc)}}function Nc(e,t={}){let{enabled:n=!0,key:r,intervalMs:i=Sc}=t,a=(0,Z.useRef)(e);a.current=e;let o=(0,Z.useId)(),s=r??o;(0,Z.useEffect)(()=>{if(!n)return;let e=e=>{a.current!==null&&(Dc.set(s,e),a.current())},t=()=>document.visibilityState===`visible`,r=()=>{let n=Date.now();if(n-Oc>=36e4)return;let r=Dc.get(s);if(r===void 0){Dc.set(s,n);return}Tc({visible:t(),now:n,lastRefreshedAt:r})&&e(n)},o=()=>{let n=Date.now(),r=Dc.get(s)??n;Ec({visible:t(),now:n,lastRefreshedAt:r,lastInteractedAt:Oc})&&e(n)},c,l=()=>{clearInterval(c),c=t()?setInterval(o,i):void 0},u=()=>{r(),l()},d=Mc(()=>{r(),l()});return r(),l(),window.addEventListener(`focus`,r),document.addEventListener(`visibilitychange`,u),()=>{clearInterval(c),window.removeEventListener(`focus`,r),document.removeEventListener(`visibilitychange`,u),d()}},[n,s,i])}function Pc(e){let t=(0,Q.c)(22),{layer:n,compact:r}=e,i=r!==void 0&&r,a,o,s,c;t[0]!==n.isDraft||t[1]!==n.state?(o=pr({state:n.state,isDraft:n.isDraft??!1}),a=o.Icon,s=!0,c=K(`size-4 shrink-0`,o.toneClassName),t[0]=n.isDraft,t[1]=n.state,t[2]=a,t[3]=o,t[4]=s,t[5]=c):(a=t[2],o=t[3],s=t[4],c=t[5]);let l;t[6]!==a||t[7]!==s||t[8]!==c?(l=(0,$.jsx)(a,{"aria-hidden":s,className:c}),t[6]=a,t[7]=s,t[8]=c,t[9]=l):l=t[9];let u=n.title||n.headBranch,d;t[10]===u?d=t[11]:(d=(0,$.jsx)(`span`,{className:`block truncate`,children:u}),t[10]=u,t[11]=d);let f=i?null:`${n.headBranch} · `,p;t[12]!==n.number||t[13]!==o.label||t[14]!==f?(p=(0,$.jsxs)(`span`,{className:`block truncate text-xs font-normal text-muted-foreground`,children:[`#`,n.number,` · `,f,o.label]}),t[12]=n.number,t[13]=o.label,t[14]=f,t[15]=p):p=t[15];let m;t[16]!==d||t[17]!==p?(m=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[d,p]}),t[16]=d,t[17]=p,t[18]=m):m=t[18];let h;return t[19]!==l||t[20]!==m?(h=(0,$.jsxs)($.Fragment,{children:[l,m]}),t[19]=l,t[20]=m,t[21]=h):h=t[21],h}function Fc(e){let t=(0,Q.c)(14),{stack:n,reference:r,onSelect:i,pending:a}=e,o=a!==void 0&&a,s;if(t[0]!==i||t[1]!==o||t[2]!==r||t[3]!==n.layers){let e;t[5]!==i||t[6]!==o||t[7]!==r?(e=e=>(0,$.jsxs)(W,{onClick:()=>{i?.({...r,number:e.number})},disabled:!i||o,"aria-current":e.number===r.number?`true`:void 0,children:[(0,$.jsx)(Pc,{layer:e}),e.number===r.number?(0,$.jsx)(me,{"aria-hidden":!0,className:`size-3.5`}):null]},e.number),t[5]=i,t[6]=o,t[7]=r,t[8]=e):e=t[8],s=n.layers.toReversed().map(e),t[0]=i,t[1]=o,t[2]=r,t[3]=n.layers,t[4]=s}else s=t[4];let c;t[9]===n.base?c=t[10]:(c=(0,$.jsxs)(E,{children:[`↳ `,n.base]}),t[9]=n.base,t[10]=c);let l;return t[11]!==s||t[12]!==c?(l=(0,$.jsxs)(`div`,{className:`max-h-80 overflow-y-auto`,children:[s,c]}),t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function Ic(e){let t=(0,Q.c)(8),{number:n,notice:r,stale:i}=e,a=i!==void 0&&i,o;t[0]===n?o=t[1]:(o=(0,$.jsxs)(`span`,{children:[`Stack #`,n]}),t[0]=n,t[1]=o);let s;t[2]!==r||t[3]!==a?(s=r?(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(`span`,{role:`status`,className:`text-xs font-normal`}),children:a?`May be stale`:`Refreshing…`}),(0,$.jsx)(Y,{children:r})]}):null,t[2]=r,t[3]=a,t[4]=s):s=t[4];let c;return t[5]!==o||t[6]!==s?(c=(0,$.jsx)(E,{children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[o,s]})}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function Lc(e){let t=(0,Q.c)(107),{hostLabel:n,stack:r,reference:i,environmentId:a,canMerge:o,canRebase:s,mergeMethod:c,onSelect:l,onActed:u,notice:d,onRetry:f}=e,[p,h]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(null),[v,b]=(0,Z.useState)(!1),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x={reportFailure:!1},t[0]=x):x=t[0];let S=Dt(zr.runAction,x),C,T,E,D,O,k,A,j,M,N,P,F;if(t[1]!==o||t[2]!==s||t[3]!==g||t[4]!==a||t[5]!==n||t[6]!==c||t[7]!==d||t[8]!==u||t[9]!==f||t[10]!==l||t[11]!==p||t[12]!==v||t[13]!==i||t[14]!==S||t[15]!==r){let e=r.layers.at(-1),x=r.layers.filter(qc),I=x.some(Kc),L;t[28]===i?L=t[29]:(L=e=>e.number===i.number,t[28]=i,t[29]=L);let R=r.layers.findIndex(L)+1,z=r.layers.slice(0,R).filter(Gc),B=r.layers[R-1],V=z.some(Wc),H=x.flatMap(Uc).length!==x.length,ee=v||B?.state!==`open`||z.some(Hc)||V||z.length===0||z.some(Vc),te=v||H||I||x.length===0;D=async()=>{if(v||!g||(g===`merge`?!o||ee:!s||te))return;let t=g,l=t===`merge`?B:e;if(!l?.headSha)return;let d=(t===`merge`?z:x).flatMap(Bc);b(!0),_(null);let f=gt.add({type:`loading`,title:t===`merge`?`Merging stack...`:`Rebasing stack...`}),p=await S({environmentId:a,input:{...i,number:l.number,stackNumber:r.number,expectedStackHeads:d,action:t,...t===`merge`?{mergeMethod:c}:{updateMethod:`rebase`}}});b(!1),u(),p._tag===`Failure`?gt.update(f,{type:`error`,title:t===`merge`?`Could not merge the stack`:`Could not rebase the stack`,description:String(Ue(p))}):gt.update(f,{type:`success`,title:t===`merge`?`Stack merge request completed`:`Stack rebased`,description:t===`merge`?`${n} merged the stack or added it to its merge queue.`:void 0})};let ne=g===`merge`?z:x,U=`Stack ${r.number}, layer ${R} of ${r.layers.length}`,re;t[30]===U?re=t[31]:(re=(0,$.jsx)(G,{variant:`ghost`,size:`xs`,"aria-label":U}),t[30]=U,t[31]=re);let ie;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsx)(Mr.stack,{"aria-hidden":!0,className:`size-3.5`}),t[32]=ie):ie=t[32];let ae;t[33]===f?ae=t[34]:(ae=f?(0,$.jsx)(m,{"aria-hidden":!0,className:`size-3 text-warning`}):null,t[33]=f,t[34]=ae);let se;t[35]!==R||t[36]!==r.layers.length||t[37]!==re||t[38]!==ae?(se=(0,$.jsx)(J,{render:(0,$.jsxs)(Ce,{render:re,children:[ie,` `,R,`/`,r.layers.length,ae]})}),t[35]=R,t[36]=r.layers.length,t[37]=re,t[38]=ae,t[39]=se):se=t[39];let ce=d?` · ${d}`:null,le;t[40]!==R||t[41]!==r.layers.length||t[42]!==r.number||t[43]!==ce?(le=(0,$.jsxs)(Y,{children:[`View stack #`,r.number,`, layer `,R,` of `,r.layers.length,ce]}),t[40]=R,t[41]=r.layers.length,t[42]=r.number,t[43]=ce,t[44]=le):le=t[44];let ue;t[45]!==se||t[46]!==le?(ue=(0,$.jsxs)(X,{children:[se,le]}),t[45]=se,t[46]=le,t[47]=ue):ue=t[47];let de=!!f,fe;t[48]!==d||t[49]!==r.number||t[50]!==de?(fe=(0,$.jsx)(Ic,{number:r.number,notice:d,stale:de}),t[48]=d,t[49]=r.number,t[50]=de,t[51]=fe):fe=t[51];let pe;t[52]===f?pe=t[53]:(pe=f?(0,$.jsx)(W,{onClick:f,children:`Retry stack refresh`}):null,t[52]=f,t[53]=pe);let me;t[54]===l?me=t[55]:(me=l?e=>{h(!1),l(e)}:void 0,t[54]=l,t[55]=me);let he;t[56]!==v||t[57]!==i||t[58]!==r||t[59]!==me?(he=(0,$.jsx)(Fc,{stack:r,reference:i,pending:v,onSelect:me}),t[56]=v,t[57]=i,t[58]=r,t[59]=me,t[60]=he):he=t[60];let ge;t[61]!==fe||t[62]!==pe||t[63]!==he?(ge=(0,$.jsxs)(Te,{children:[fe,pe,he]}),t[61]=fe,t[62]=pe,t[63]=he,t[64]=ge):ge=t[64];let _e=o||s?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(je,{}),o?(0,$.jsxs)(W,{disabled:ee,onClick:()=>_(`merge`),children:[(0,$.jsx)(Mr.merged,{"aria-hidden":!0}),`Merge stack (`,z.length,`)`]}):null,s?(0,$.jsxs)(W,{disabled:te,onClick:()=>_(`update-branch`),children:[(0,$.jsx)(w,{"aria-hidden":!0}),`Rebase stack`]}):null,V||z.some(zc)?(0,$.jsx)(`p`,{className:`px-2 py-1 text-xs text-muted-foreground`,children:`Every layer being merged must be open and ready for review.`}):null]}):null,ve;t[65]!==ge||t[66]!==_e?(ve=(0,$.jsxs)(oe,{align:`start`,children:[ge,_e]}),t[65]=ge,t[66]=_e,t[67]=ve):ve=t[67],t[68]!==p||t[69]!==ue||t[70]!==ve?(P=(0,$.jsxs)(y,{open:p,onOpenChange:h,children:[ue,ve]}),t[68]=p,t[69]=ue,t[70]=ve,t[71]=P):P=t[71],F=o&&B?.state===`open`?(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(`span`,{className:`inline-flex`,children:(0,$.jsxs)(G,{variant:`default`,size:`xs`,disabled:ee,onClick:()=>_(`merge`),children:[(0,$.jsx)(Mr.merged,{"aria-hidden":!0,className:`size-3.5`}),`Merge stack`]})})}),(0,$.jsxs)(Y,{children:[`Merge stack through #`,i.number,` into `,r.base,` (`,z.length,` `,z.length===1?`pull request`:`pull requests`,`)`]})]}):null,E=Gn,M=g!==null,t[72]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>{e||_(null)},t[72]=N):N=t[72],T=Wn,A=`max-w-md`;let ye=g===`merge`?`Merge ${z.length} pull requests?`:`Rebase ${x.length} pull requests?`,be;t[73]===ye?be=t[74]:(be=(0,$.jsx)(Bn,{children:ye}),t[73]=ye,t[74]=be);let xe=g===`merge`?`Merge #${i.number} and its unmerged layers below into ${r.base} using ${c}. ${n} checks their rules before merging or queueing them and rebases the remaining stack after merging.`:`Rebase the remote branches from bottom to top onto ${r.base}. This rewrites branch history and may restart checks. If a layer fails, earlier updates remain.`,Se;t[75]===xe?Se=t[76]:(Se=(0,$.jsx)(Un,{children:xe}),t[75]=xe,t[76]=Se),t[77]!==be||t[78]!==Se?(j=(0,$.jsxs)(zn,{children:[be,Se]}),t[77]=be,t[78]=Se,t[79]=j):j=t[79],C=Hn,O=`max-h-48 space-y-1 overflow-y-auto text-sm`,k=ne.map(Rc),t[1]=o,t[2]=s,t[3]=g,t[4]=a,t[5]=n,t[6]=c,t[7]=d,t[8]=u,t[9]=f,t[10]=l,t[11]=p,t[12]=v,t[13]=i,t[14]=S,t[15]=r,t[16]=C,t[17]=T,t[18]=E,t[19]=D,t[20]=O,t[21]=k,t[22]=A,t[23]=j,t[24]=M,t[25]=N,t[26]=P,t[27]=F}else C=t[16],T=t[17],E=t[18],D=t[19],O=t[20],k=t[21],A=t[22],j=t[23],M=t[24],N=t[25],P=t[26],F=t[27];let I;t[80]!==O||t[81]!==k?(I=(0,$.jsx)(`ul`,{className:O,children:k}),t[80]=O,t[81]=k,t[82]=I):I=t[82];let L;t[83]!==C||t[84]!==I?(L=(0,$.jsx)(C,{children:I}),t[83]=C,t[84]=I,t[85]=L):L=t[85];let R;t[86]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(G,{variant:`outline`,onClick:()=>_(null),children:`Cancel`}),t[86]=R):R=t[86];let z;t[87]===D?z=t[88]:(z=()=>void D(),t[87]=D,t[88]=z);let B=g===`merge`?`Merge stack`:`Rebase stack`,V;t[89]!==z||t[90]!==B?(V=(0,$.jsxs)(Vn,{children:[R,(0,$.jsx)(G,{onClick:z,children:B})]}),t[89]=z,t[90]=B,t[91]=V):V=t[91];let H;t[92]!==T||t[93]!==L||t[94]!==V||t[95]!==A||t[96]!==j?(H=(0,$.jsxs)(T,{className:A,children:[j,L,V]}),t[92]=T,t[93]=L,t[94]=V,t[95]=A,t[96]=j,t[97]=H):H=t[97];let ee;t[98]!==E||t[99]!==H||t[100]!==M||t[101]!==N?(ee=(0,$.jsx)(E,{open:M,onOpenChange:N,children:H}),t[98]=E,t[99]=H,t[100]=M,t[101]=N,t[102]=ee):ee=t[102];let te;return t[103]!==ee||t[104]!==P||t[105]!==F?(te=(0,$.jsxs)($.Fragment,{children:[P,F,ee]}),t[103]=ee,t[104]=P,t[105]=F,t[106]=te):te=t[106],te}function Rc(e){return(0,$.jsx)(`li`,{className:`flex items-center gap-2 rounded-md bg-muted/50 px-3 py-2`,children:(0,$.jsx)(Pc,{layer:e,compact:!0})},e.number)}function zc(e){return e.isDraft}function Bc(e){return e.headSha?[{number:e.number,headSha:e.headSha}]:[]}function Vc(e){return e.isDraft}function Hc(e){return!e.headSha}function Uc(e){return e.headSha?[{number:e.number,headSha:e.headSha}]:[]}function Wc(e){return e.state!==`open`}function Gc(e){return e.state!==`merged`}function Kc(e){return e.state!==`open`}function qc(e){return e.state!==`merged`}function Jc(e){let t=(0,Q.c)(3),n=qe();if(ur(n.get(e.environmentId)?.environment.capabilities)===`unsupported`)return null;let r=`${e.environmentId}:${e.url}`,i;return t[0]!==e||t[1]!==r?(i=(0,$.jsx)(Yc,{...e},r),t[0]=e,t[1]=r,t[2]=i):i=t[2],i}function Yc({environmentId:e,reference:t,url:n,threadRef:r,display:i,onPickerOpenChange:a}){let o=Xe(n),s=Ge(r?.environmentId===e?r:null),c=s===null?null:r,l=cr(e),u=l.isLinked(s,n),d=Et(l.mode===`multiple`&&i!==`menu-item`?zr.linkedThreads({environmentId:e,input:o===null?t:{...t,...Je(o)}}):null),[f,p]=(0,Z.useState)(d.data);d.data!==null&&d.data!==f&&p(d.data);let[m,h]=(0,Z.useState)(!1),g=async(r,i)=>{if(!(o===null||m)){h(!0);try{await l.changeLink(A(e,r),n,!i)}catch(e){gt.add({type:`error`,title:i?`Could not unlink the pull request`:`Could not link the pull request`,description:e instanceof Error?e.message:String(e)});return}finally{h(!1)}l.mode===`multiple`&&b.refresh(zr.linkedThreads({environmentId:e,input:{...t,...Je(o)}})),a?.(!1)}};if(o===null||!u&&!l.canLink(n))return null;let _=l.mode===`multiple`?(d.data??f)?.threads??[]:[],v=_.length>0?`Linked from ${_.length} ${_.length===1?`thread`:`threads`}`:`Linked threads`;return(0,$.jsxs)($.Fragment,{children:[i===`count`&&(_.length>0||d.error!==null)?(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsxs)(G,{size:`xs`,variant:`ghost`,"aria-label":v,onClick:()=>ha({query:n,...(d.data??f)===null?{}:{linkedThreads:{environmentId:e,threads:_}}}),children:[(0,$.jsx)(Ae,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(`span`,{"aria-hidden":!0,children:_.length||`?`})]})}),(0,$.jsxs)(Y,{children:[v,`. Search in the command palette.`]})]}):null,i===`menu-item`?(0,$.jsxs)(W,{disabled:m,onClick:()=>{c===null?a?.(!0):g(c.threadId,u)},children:[u?(0,$.jsx)(Mr.unlink,{"aria-hidden":!0,className:`size-3.5`}):(0,$.jsx)(Mr.link,{"aria-hidden":!0,className:`size-3.5`}),u?`Unlink from this thread`:c?`Link to this thread`:`Link to thread`]}):null,i===`picker`?(0,$.jsx)(Gn,{open:!0,onOpenChange:a,children:(0,$.jsxs)(Wn,{className:`max-w-md`,showCloseButton:!1,children:[(0,$.jsx)(Bn,{className:`sr-only`,children:`Link pull request to a thread`}),(0,$.jsx)(Xc,{environmentId:e,url:n,pending:m,onSelect:e=>void g(e,!1)})]})}):null]})}function Xc(e){let t=(0,Q.c)(36),{environmentId:n,url:r,pending:i,onSelect:a}=e,o=Ke(),s=cr(n),c=We(),[l,u]=(0,Z.useState)(``),d;if(t[0]!==n||t[1]!==c){let e;t[3]===n?e=t[4]:(e=e=>e.environmentId===n,t[3]=n,t[4]=e),d=new Map(c.filter(e).map(Qc)),t[0]=n,t[1]=c,t[2]=d}else d=t[2];let f=d,p,m,h,g,_,v,y,b,x;if(t[5]!==n||t[6]!==s||t[7]!==a||t[8]!==i||t[9]!==f||t[10]!==l||t[11]!==o||t[12]!==r){let e=l.trim().toLocaleLowerCase(),c=o.filter(t=>t.environmentId===n&&t.archivedAt===null&&`${t.title} ${f.get(t.projectId)??``}`.toLocaleLowerCase().includes(e)).toSorted(Zc);m=ca,_=`none`,v=l,y=u,b=`Choose a thread`,t[22]===i?x=t[23]:(x=(0,$.jsx)(sa,{placeholder:`Search threads or projects...`,disabled:i}),t[22]=i,t[23]=x),p=oa,h=`max-h-80 overflow-y-auto`,g=c.length===0?(0,$.jsx)(`div`,{className:`px-3 py-6 text-center text-sm text-muted-foreground`,children:`No active threads found.`}):c.map(e=>{let t=s.isLinked(e,r);return(0,$.jsxs)(la,{value:e.id,disabled:i||t,onClick:()=>a(e.id),children:[(0,$.jsx)(Ae,{"aria-hidden":!0,className:`size-4 shrink-0`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(`span`,{className:`truncate`,children:e.title||`Untitled thread`}),(0,$.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:f.get(e.projectId)})]}),t?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(me,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Linked`})]}):null]},e.id)}),t[5]=n,t[6]=s,t[7]=a,t[8]=i,t[9]=f,t[10]=l,t[11]=o,t[12]=r,t[13]=p,t[14]=m,t[15]=h,t[16]=g,t[17]=_,t[18]=v,t[19]=y,t[20]=b,t[21]=x}else p=t[13],m=t[14],h=t[15],g=t[16],_=t[17],v=t[18],y=t[19],b=t[20],x=t[21];let S;t[24]!==p||t[25]!==h||t[26]!==g?(S=(0,$.jsx)(p,{className:h,children:g}),t[24]=p,t[25]=h,t[26]=g,t[27]=S):S=t[27];let C;return t[28]!==m||t[29]!==_||t[30]!==v||t[31]!==y||t[32]!==b||t[33]!==x||t[34]!==S?(C=(0,$.jsxs)(m,{mode:_,value:v,onValueChange:y,"aria-label":b,children:[x,S]}),t[28]=m,t[29]=_,t[30]=v,t[31]=y,t[32]=b,t[33]=x,t[34]=S,t[35]=C):C=t[35],C}function Zc(e,t){return t.updatedAt.localeCompare(e.updatedAt)}function Qc(e){return[e.id,e.title]}function $c(e){let t=(0,Q.c)(23),{title:n,author:r,updated:i,checkout:a,base:o,head:s,files:c,diffStat:l}=e,u;t[0]!==r||t[1]!==i?(u=(0,$.jsxs)(mr,{className:`min-w-0 whitespace-nowrap`,children:[r,i]}),t[0]=r,t[1]=i,t[2]=u):u=t[2];let d;t[3]!==a||t[4]!==u?(d=(0,$.jsxs)(`div`,{className:`mt-2 flex min-h-5 min-w-0 items-center gap-2 text-xs text-muted-foreground`,children:[u,a]}),t[3]=a,t[4]=u,t[5]=d):d=t[5];let f;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(j,{"aria-label":`receives changes from`,className:`size-3.5 shrink-0 opacity-60`}),t[6]=f):f=t[6];let p;t[7]!==o||t[8]!==s?(p=(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1.5 font-mono text-xs text-muted-foreground/70`,children:[o,f,s]}),t[7]=o,t[8]=s,t[9]=p):p=t[9];let m;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(ne,{"aria-hidden":!0,className:`size-3.5`}),t[10]=m):m=t[10];let h;t[11]===c?h=t[12]:(h=(0,$.jsxs)(`span`,{className:`inline-flex min-w-16 items-center justify-end gap-1.5 tabular-nums`,children:[m,c]}),t[11]=c,t[12]=h);let g;t[13]!==l||t[14]!==h?(g=(0,$.jsxs)(`span`,{className:`ml-auto inline-flex shrink-0 items-center justify-end gap-2`,children:[h,l]}),t[13]=l,t[14]=h,t[15]=g):g=t[15];let _;t[16]!==p||t[17]!==g?(_=(0,$.jsxs)(`div`,{className:`mt-4 flex min-h-5 min-w-0 items-center gap-2 text-xs text-muted-foreground`,children:[p,g]}),t[16]=p,t[17]=g,t[18]=_):_=t[18];let v;return t[19]!==d||t[20]!==_||t[21]!==n?(v=(0,$.jsxs)(`div`,{className:`col-span-2 mt-1 min-w-0 px-4 pb-4`,children:[n,d,_]}),t[19]=d,t[20]=_,t[21]=n,t[22]=v):v=t[22],v}function el(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=K(`flex min-h-7 min-w-0 items-center sm:min-h-6`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function tl(e){let t=(0,Q.c)(18),{tabs:n,value:r,onValueChange:i,onTabIntent:a,inert:o,children:s}=e,c;t[0]===r?c=t[1]:(c=[r],t[0]=r,t[1]=c);let l;t[2]!==i||t[3]!==n?(l=e=>{let t=n.find(t=>t.value===e[0])?.value;t&&i?.(t)},t[2]=i,t[3]=n,t[4]=l):l=t[4];let u;if(t[5]!==a||t[6]!==n){let e;t[8]===a?e=t[9]:(e=e=>(0,$.jsx)(An,{value:e.value,onPointerEnter:a?()=>a(e.value):void 0,onFocus:a?()=>a(e.value):void 0,children:e.label},e.value),t[8]=a,t[9]=e),u=n.map(e),t[5]=a,t[6]=n,t[7]=u}else u=t[7];let d;t[10]!==c||t[11]!==l||t[12]!==u?(d=(0,$.jsx)(kn,{className:`shrink-0`,size:`segmented`,variant:`segmented`,value:c,onValueChange:l,children:u}),t[10]=c,t[11]=l,t[12]=u,t[13]=d):d=t[13];let f;return t[14]!==s||t[15]!==o||t[16]!==d?(f=(0,$.jsxs)(`nav`,{className:`col-span-2 flex min-w-0 flex-wrap items-center gap-2 border-t border-border/60 px-4 py-2`,"aria-label":`Pull request tabs`,inert:o,children:[d,s]}),t[14]=s,t[15]=o,t[16]=d,t[17]=f):f=t[17],f}function nl(e){let t=(0,Q.c)(14),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({icon:r,label:i,className:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===n?o=t[6]:(o=K(`ml-auto flex h-4 min-w-0 flex-1 flex-wrap content-start items-center justify-end gap-x-1.5 overflow-hidden text-xs`,n),t[5]=n,t[6]=o);let s;t[7]===i?s=t[8]:(s=(0,$.jsx)(`span`,{className:`whitespace-nowrap`,children:i}),t[7]=i,t[8]=s);let c;return t[9]!==r||t[10]!==a||t[11]!==o||t[12]!==s?(c=(0,$.jsxs)(`span`,{className:o,...a,children:[r,s]}),t[9]=r,t[10]=a,t[11]=o,t[12]=s,t[13]=c):c=t[13],c}function rl(e){let t=(0,Q.c)(33),{value:n,target:r,copyLabel:i,copiedLabel:a,className:o,tooltipSide:s,onError:c}=e,l=s===void 0?`top`:s,u;t[0]===c?u=t[1]:(u=c?{onError:c}:{},t[0]=c,t[1]=u);let d;t[2]!==u||t[3]!==r?(d={target:r,timeout:1600,...u},t[2]=u,t[3]=r,t[4]=d):d=t[4];let{copyToClipboard:f,isCopied:p}=vt(d),m;t[5]===o?m=t[6]:(m=K(`relative grid w-fit min-w-0 max-w-full shrink cursor-pointer rounded px-1 py-0.5 text-left outline-none transition-colors pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 hover:bg-accent/45 hover:text-foreground focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background`,o),t[5]=o,t[6]=m);let h=p?a:i,g;t[7]!==f||t[8]!==n?(g=()=>f(n),t[7]=f,t[8]=n,t[9]=g):g=t[9];let _;t[10]!==m||t[11]!==h||t[12]!==g?(_=(0,$.jsx)(`button`,{type:`button`,className:m,"aria-label":h,onClick:g}),t[10]=m,t[11]=h,t[12]=g,t[13]=_):_=t[13];let v=p?`opacity-0`:`opacity-100`,y;t[14]===v?y=t[15]:(y=K(`col-start-1 row-start-1 min-w-0 truncate transition-opacity duration-150 motion-reduce:transition-none`,v),t[14]=v,t[15]=y);let b;t[16]!==y||t[17]!==n?(b=(0,$.jsx)(`code`,{className:y,children:n}),t[16]=y,t[17]=n,t[18]=b):b=t[18];let x=p?`opacity-100`:`opacity-0`,S;t[19]===x?S=t[20]:(S=K(`col-start-1 row-start-1 truncate text-center transition-opacity duration-150 motion-reduce:transition-none`,x),t[19]=x,t[20]=S);let C;t[21]===S?C=t[22]:(C=(0,$.jsx)(`span`,{"aria-hidden":`true`,className:S,children:`Copied`}),t[21]=S,t[22]=C);let w;t[23]!==b||t[24]!==C||t[25]!==_?(w=(0,$.jsxs)(J,{render:_,children:[b,C]}),t[23]=b,t[24]=C,t[25]=_,t[26]=w):w=t[26];let T=`${p?`Copied`:i}: ${n}`,E;t[27]!==T||t[28]!==l?(E=(0,$.jsx)(Y,{variant:`code`,side:l,children:T}),t[27]=T,t[28]=l,t[29]=E):E=t[29];let D;return t[30]!==w||t[31]!==E?(D=(0,$.jsxs)(X,{children:[w,E]}),t[30]=w,t[31]=E,t[32]=D):D=t[32],D}function il(e){let t=(0,Q.c)(4),{className:n}=e,r;t[0]===n?r=t[1]:(r=K(`block h-3 rounded bg-muted-foreground/15`,n),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,$.jsx)(`span`,{"aria-hidden":!0,className:r}),t[2]=r,t[3]=i),i}var al=[`w-3/5`,`w-2/5`,`w-1/2`,`w-2/3`,`w-2/5`,`w-3/5`,`w-1/2`],ol=[`w-2/5`,`w-1/3`,`w-2/5`,`w-1/4`,`w-1/3`,`w-2/5`,`w-1/3`],sl=[{value:`summary`,label:`Summary`},{value:`timeline`,label:`Timeline`},{value:`code`,label:`Code`}];function cl(e){let t=(0,Q.c)(8),{rows:n,caption:r}=e,i=n===void 0?7:n,a=r??`Loading pull requests`,o;t[0]===r?o=t[1]:(o=r?(0,$.jsx)(`p`,{className:`px-3 pb-1 text-xs font-medium text-muted-foreground/70`,children:r}):null,t[0]=r,t[1]=o);let s;t[2]===i?s=t[3]:(s=Array.from({length:i},ll),t[2]=i,t[3]=s);let c;return t[4]!==a||t[5]!==o||t[6]!==s?(c=(0,$.jsxs)(`div`,{role:`status`,"aria-label":a,className:`motion-safe:animate-skeleton space-y-0.5`,children:[o,s]}),t[4]=a,t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function ll(e,t){return(0,$.jsxs)(`div`,{className:`grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2 rounded-md px-3 py-2.5`,children:[(0,$.jsx)(il,{className:`size-4 rounded-full`}),(0,$.jsxs)(`div`,{className:`min-w-0 space-y-1.5`,children:[(0,$.jsx)(il,{className:K(`h-4`,al[t%al.length])}),(0,$.jsx)(il,{className:K(`h-3.5`,ol[t%ol.length])})]}),(0,$.jsxs)(`div`,{className:`flex flex-col items-end gap-1.5`,children:[(0,$.jsx)(il,{className:`w-12`}),(0,$.jsx)(il,{className:`w-16`})]})]},t)}function ul(e){let t=(0,Q.c)(80),{seed:n,summary:r,actions:i,checkoutCommand:a,tabs:o,activeTab:s,number:c,onBack:l,onClose:u,onCheckoutError:d}=e,f=o===void 0?sl:o,p,m;t[0]!==n||t[1]!==r?(p=r?{...n,...r,isDraft:r.isDraft??n?.isDraft}:n,m=p?pr({state:p.state,isDraft:p.isDraft??!1}):null,t[0]=n,t[1]=r,t[2]=p,t[3]=m):(p=t[2],m=t[3]);let h=m,g;t[4]===p?g=t[5]:(g=p?.checksState===`failing`||p?.checksState===`pending`?vr(p.checksState):null,t[4]=p,t[5]=g);let _=g,y=a??null,b=r?.changedFiles??null,x;t[6]!==s||t[7]!==f?(x=f.find(e=>e.value===s)?.value??f[0]?.value??`summary`,t[6]=s,t[7]=f,t[8]=x):x=t[8];let S=x,C=!p&&`motion-safe:animate-skeleton`,w;t[9]===C?w=t[10]:(w=K(`flex h-full min-h-0 flex-col overflow-hidden bg-background`,C),t[9]=C,t[10]=w);let T;t[11]===l?T=t[12]:(T=l?(0,$.jsx)(G,{size:`icon-micro`,variant:`ghost-muted`,className:`-ml-1.5`,onClick:l,"aria-label":`Back to this thread's pull requests`,children:(0,$.jsx)(j,{"aria-hidden":!0,className:`size-3.5`})}):null,t[11]=l,t[12]=T);let E;t[13]!==c||t[14]!==p||t[15]!==h?.toneClassName?(E=p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:p.repository}),(0,$.jsxs)(de,{onClick:()=>void bt()?.shell.openExternal(p.url),"aria-label":`Open pull request #${p.number} on host`,children:[(0,$.jsxs)(`span`,{className:h?.toneClassName,children:[`#`,p.number]}),(0,$.jsx)(O,{"aria-hidden":!0,className:`size-2.5`})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(il,{className:`w-24`}),(0,$.jsxs)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:[`#`,c??`…`]})]}),t[13]=c,t[14]=p,t[15]=h?.toneClassName,t[16]=E):E=t[16];let D;t[17]!==T||t[18]!==E?(D=(0,$.jsx)(`div`,{className:`pl-4 grid h-7 min-w-0 items-center overflow-hidden`,children:(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 text-sm text-muted-foreground sm:text-xs`,children:[T,E]})}),t[17]=T,t[18]=E,t[19]=D):D=t[19];let k;t[20]===i?k=t[21]:(k=i??(0,$.jsx)(il,{className:`h-6 w-16 rounded-md`}),t[20]=i,t[21]=k);let A;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(G,{size:`icon-xs`,variant:`ghost`,disabled:!0,"aria-label":`Pull request actions loading`,children:(0,$.jsx)(v,{"aria-hidden":!0,className:`size-4`})}),t[22]=A):A=t[22];let N;t[23]===u?N=t[24]:(N=u?(0,$.jsx)(G,{size:`icon-xs`,variant:`ghost`,"aria-label":`Collapse pull request panel`,onClick:u,children:(0,$.jsx)(z,{"aria-hidden":!0,className:`size-3.5`})}):null,t[23]=u,t[24]=N);let F;t[25]!==k||t[26]!==N?(F=(0,$.jsxs)(`div`,{className:`mr-4 flex h-7 shrink-0 items-center justify-end gap-1`,children:[k,A,N]}),t[25]=k,t[26]=N,t[27]=F):F=t[27];let I,L,R;t[28]===p?(I=t[29],L=t[30],R=t[31]):(I=(0,$.jsx)(el,{children:p?(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold leading-snug`,children:p.title}):(0,$.jsx)(il,{className:`h-5 w-4/5 max-w-md`})}),L=p?(0,$.jsx)(wr,{actor:p.author??null,tooltip:!1}):(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(il,{className:`size-4 rounded-full`}),(0,$.jsx)(il,{className:`h-3 w-14`})]}),R=p?(0,$.jsxs)(`span`,{children:[`updated `,Cn(p.updatedAt)]}):(0,$.jsx)(il,{className:`h-3 w-16`}),t[28]=p,t[29]=I,t[30]=L,t[31]=R);let B;t[32]!==y||t[33]!==d?(B=y?(0,$.jsx)(rl,{value:y,target:`pull request checkout command`,copyLabel:`Copy checkout command`,copiedLabel:`Checkout command copied`,className:`ml-auto font-mono`,tooltipSide:`bottom`,...d?{onError:d}:{}},y):null,t[32]=y,t[33]=d,t[34]=B):B=t[34];let V,H;t[35]===p?(V=t[36],H=t[37]):(V=(0,$.jsx)(`span`,{className:`inline-flex min-w-0 max-w-[40%] shrink-0 items-center gap-1`,children:p?(0,$.jsx)(`code`,{className:`flex min-w-0`,children:(0,$.jsx)(fa,{value:p.baseBranch})}):(0,$.jsx)(il,{className:`h-3 w-12`})}),H=p?(0,$.jsx)(rl,{value:p.headBranch,target:`branch name`,copyLabel:`Copy pull request branch`,copiedLabel:`Branch name copied`,className:`min-w-0 font-mono`},p.headBranch):(0,$.jsx)(il,{className:`h-3 w-32 flex-1`}),t[35]=p,t[36]=V,t[37]=H);let ee;t[38]===b?ee=t[39]:(ee=b===null?(0,$.jsx)(il,{className:`h-3 w-10`}):`${b.toLocaleString()} ${b===1?`file`:`files`}`,t[38]=b,t[39]=ee);let te;t[40]===p?te=t[41]:(te=p?(0,$.jsx)(Sr,{additions:p.additions??0,deletions:p.deletions??0,className:`shrink-0 font-mono text-xs`}):(0,$.jsx)(il,{className:`h-3 w-20`}),t[40]=p,t[41]=te);let ne;t[42]!==I||t[43]!==L||t[44]!==R||t[45]!==B||t[46]!==V||t[47]!==H||t[48]!==ee||t[49]!==te?(ne=(0,$.jsx)(`div`,{className:`col-span-2 grid grid-rows-[1fr]`,children:(0,$.jsx)(`div`,{className:`min-h-0 overflow-hidden`,children:(0,$.jsx)($c,{title:I,author:L,updated:R,checkout:B,base:V,head:H,files:ee,diffStat:te})})}),t[42]=I,t[43]=L,t[44]=R,t[45]=B,t[46]=V,t[47]=H,t[48]=ee,t[49]=te,t[50]=ne):ne=t[50];let U;t[51]===_?U=t[52]:(U=_?(0,$.jsx)(nl,{className:_.toneClassName,icon:(0,$.jsx)(_.Icon,{"aria-hidden":!0,className:`size-3.5`}),label:_.label}):(0,$.jsx)(nl,{icon:(0,$.jsx)(il,{className:`my-px size-3.5 rounded-full`}),label:(0,$.jsx)(il,{className:`w-28`})}),t[51]=_,t[52]=U);let W;t[53]!==S||t[54]!==U||t[55]!==f?(W=(0,$.jsx)(tl,{tabs:f,value:S,inert:!0,children:U}),t[53]=S,t[54]=U,t[55]=f,t[56]=W):W=t[56];let re;t[57]!==F||t[58]!==ne||t[59]!==W||t[60]!==D?(re=(0,$.jsxs)(`div`,{className:`@container/pr-header grid min-w-0 shrink-0 grid-cols-[minmax(0,1fr)_auto] items-start gap-x-2 border-b border-border/60`,children:[D,F,ne,W]}),t[57]=F,t[58]=ne,t[59]=W,t[60]=D,t[61]=re):re=t[61];let ie;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,$.jsx)(M,{"aria-hidden":!0,className:`size-3.5`}),`Reviewers`]}),t[62]=ie):ie=t[62];let ae;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsx)(il,{className:`h-3 w-10`}),t[63]=ae):ae=t[63];let oe;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsxs)(`div`,{className:`grid min-h-7 min-w-0 grid-cols-[6rem_minmax(0,1fr)] items-center gap-2 text-xs sm:min-h-6`,children:[ie,(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 text-foreground`,children:[ae,(0,$.jsx)(G,{size:`icon-xs`,variant:`ghost`,disabled:!0,"aria-label":`Reviewers loading`,children:(0,$.jsx)(P,{"aria-hidden":!0,className:`size-3.5`})})]})]}),t[64]=oe):oe=t[64];let se;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,$.jsx)(he,{"aria-hidden":!0,className:`size-3.5`}),`Labels`]}),t[65]=se):se=t[65];let ce;t[66]===n?ce=t[67]:(ce=n?.labels?n.labels.length>0?n.labels.map(dl):(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`None`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(il,{className:`h-4.5 w-24`}),(0,$.jsx)(il,{className:`h-4.5 w-20`})]}),t[66]=n,t[67]=ce);let le;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,$.jsx)(G,{size:`icon-xs`,variant:`ghost`,disabled:!0,"aria-label":`Labels loading`,children:(0,$.jsx)(he,{"aria-hidden":!0,className:`size-3.5`})}),t[68]=le):le=t[68];let ue;t[69]===ce?ue=t[70]:(ue=(0,$.jsx)(`section`,{className:`px-4 pt-2.5 pb-1`,children:(0,$.jsxs)(`div`,{className:`space-y-2`,children:[oe,(0,$.jsxs)(`div`,{className:`grid min-h-7 min-w-0 grid-cols-[6rem_minmax(0,1fr)] items-center gap-2 text-xs sm:min-h-6`,children:[se,(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-1 text-foreground`,children:[ce,le]})]})]})}),t[69]=ce,t[70]=ue);let fe;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,$.jsx)(`div`,{className:`sticky top-0 z-10 flex w-full items-center bg-background pr-4`,children:(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5 px-4 py-3 text-left text-xs font-medium text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:`Description`}),(0,$.jsx)(Pe,{"aria-hidden":!0,className:`size-3.5 rotate-90 text-muted-foreground/60`})]})}),t[71]=fe):fe=t[71];let pe;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,$.jsx)(il,{className:`h-5 w-40`}),t[72]=pe):pe=t[72];let me;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,$.jsxs)(`section`,{children:[fe,(0,$.jsxs)(`div`,{className:`space-y-3 px-4 pb-4`,children:[pe,(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(il,{className:`h-4 w-full`}),(0,$.jsx)(il,{className:`h-4 w-11/12`}),(0,$.jsx)(il,{className:`h-4 w-4/5`}),(0,$.jsx)(il,{className:`h-4 w-2/3`})]})]})]}),t[73]=me):me=t[73];let ge;t[74]===ue?ge=t[75]:(ge=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:[ue,me]}),t[74]=ue,t[75]=ge);let _e;return t[76]!==re||t[77]!==ge||t[78]!==w?(_e=(0,$.jsxs)(`div`,{role:`status`,"aria-label":`Loading pull request`,className:w,children:[re,ge]}),t[76]=re,t[77]=ge,t[78]=w,t[79]=_e):_e=t[79],_e}function dl(e){return(0,$.jsx)(Tr,{label:e,size:`default`,className:`max-w-48`},e.name)}function fl(e){let t=(0,Q.c)(2),{rows:n}=e,r=n===void 0?4:n,i;return t[0]===r?i=t[1]:(i=(0,$.jsx)(`div`,{role:`status`,"aria-label":`Loading people`,className:`motion-safe:animate-skeleton space-y-1 p-1`,children:Array.from({length:r},pl)}),t[0]=r,t[1]=i),i}function pl(e,t){return(0,$.jsxs)(`div`,{className:`flex h-7 items-center gap-2 rounded-md px-2`,children:[(0,$.jsx)(il,{className:`size-4 rounded-full`}),(0,$.jsx)(il,{className:ol[t%ol.length]})]},t)}function ml(e){let t=(0,Q.c)(2),{rows:n}=e,r=n===void 0?6:n,i;return t[0]===r?i=t[1]:(i=(0,$.jsx)(`div`,{role:`status`,"aria-label":`Loading timeline`,className:`motion-safe:animate-skeleton px-4 py-5`,children:(0,$.jsx)(`div`,{className:`relative ml-2 border-l border-border/70 pl-5`,children:Array.from({length:r},hl)})}),t[0]=r,t[1]=i),i}function hl(e,t){return(0,$.jsxs)(`div`,{className:`relative pb-5`,children:[(0,$.jsx)(il,{className:`absolute -left-[1.55rem] top-1 size-2 rounded-full`}),(0,$.jsx)(il,{className:K(`h-3.5`,al[t%al.length])}),(0,$.jsx)(il,{className:`mt-1.5 w-16`})]},t)}function gl(e){let t=(0,Q.c)(2),{rows:n}=e,r=n===void 0?3:n,i;return t[0]===r?i=t[1]:(i=(0,$.jsx)(`div`,{role:`status`,"aria-label":`Loading pull request conversation`,className:`motion-safe:animate-skeleton space-y-4 py-2`,children:Array.from({length:r},_l)}),t[0]=r,t[1]=i),i}function _l(e,t){return(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(il,{className:`size-5 shrink-0 rounded-full`}),(0,$.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,$.jsx)(il,{className:ol[t%ol.length]}),(0,$.jsx)(il,{className:`w-full`}),(0,$.jsx)(il,{className:`w-3/4`})]})]},t)}function vl(e){let t=(0,Q.c)(12),{error:n,onRetry:r,compact:i}=e,a=i!==void 0&&i?`py-3`:`min-h-48 px-4 py-10`,o;t[0]===a?o=t[1]:(o=K(`flex flex-col items-center justify-center gap-2 text-center`,a),t[0]=a,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:`Could not load pull request activity`}),t[2]=s):s=t[2];let c;t[3]===n?c=t[4]:(c=(0,$.jsx)(`p`,{className:`max-w-md text-xs text-muted-foreground`,children:n}),t[3]=n,t[4]=c);let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(_a,{"aria-hidden":!0,size:`sm`}),t[5]=l):l=t[5];let u;t[6]===r?u=t[7]:(u=(0,$.jsxs)(G,{size:`sm`,variant:`outline`,onClick:r,children:[l,`Retry`]}),t[6]=r,t[7]=u);let d;return t[8]!==o||t[9]!==c||t[10]!==u?(d=(0,$.jsxs)(`div`,{className:o,children:[s,c,u]}),t[8]=o,t[9]=c,t[10]=u,t[11]=d):d=t[11],d}function yl(e){let t=(0,Q.c)(15),{title:n,error:r,onRetry:i,refreshing:a,gitHubUrl:o}=e,s=n===void 0?`Could not load pull requests`:n,c=a!==void 0&&a,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(qn,{variant:`icon`,children:(0,$.jsx)(Mr.pullRequest,{})}),t[0]=l):l=t[0];let u;t[1]===s?u=t[2]:(u=(0,$.jsx)(Yn,{children:s}),t[1]=s,t[2]=u);let d;t[3]===r?d=t[4]:(d=(0,$.jsx)(Xn,{children:r}),t[3]=r,t[4]=d);let f;t[5]!==u||t[6]!==d?(f=(0,$.jsxs)(Jn,{children:[u,d]}),t[5]=u,t[6]=d,t[7]=f):f=t[7];let p;t[8]!==o||t[9]!==i||t[10]!==c?(p=i||o?(0,$.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:[i?(0,$.jsxs)(G,{size:`sm`,variant:`outline`,onClick:i,disabled:c,"aria-busy":c,children:[(0,$.jsx)(_a,{size:`sm`,refreshing:c}),`Retry`]}):null,o?(0,$.jsxs)(G,{size:`sm`,variant:`outline`,render:(0,$.jsx)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`}),children:[(0,$.jsx)(O,{"aria-hidden":!0,className:`size-3.5`}),`Open on GitHub`]}):null]}):null,t[8]=o,t[9]=i,t[10]=c,t[11]=p):p=t[11];let m;return t[12]!==f||t[13]!==p?(m=(0,$.jsxs)(Zn,{className:`scrollbar-gutter-both min-h-0 justify-center-safe overflow-y-auto [&>*]:shrink-0`,children:[l,f,p]}),t[12]=f,t[13]=p,t[14]=m):m=t[14],m}var bl=e=>e===jr?`Open on host`:`Open on ${e.label}`;function xl(e){return[{id:`copy-link`,label:`Copy link`,icon:`copy`},{id:`open-external`,label:e}]}async function Sl({url:e,openLabel:t,position:n}){let r=bt();if(!r)return;let i=null;try{i=await r.contextMenu.show(xl(t),n)}catch{return}try{i===`copy-link`?await _t(e,`link`):i===`open-external`&&await r.shell.openExternal(e)}catch{gt.add({type:`error`,title:i===`copy-link`?`Could not copy the link`:`Could not open the link`})}}function Cl(e){let t=(0,Q.c)(42),{environmentId:n,reference:r,detail:i,actionPending:a,textareaRef:o,onCommentAction:s,onCommented:c,onClose:l}=e,[u,d]=(0,Z.useState)(``),[f,p]=(0,Z.useState)(null),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={reportFailure:!1},t[0]=m):m=t[0];let h=Dt(zr.comment,m),g=i.state===`open`&&i.capabilities.actions.includes(`close`)&&i.viewerPermissions.actions.includes(`close`)?`close`:i.state===`closed`&&i.capabilities.actions.includes(`reopen`)&&i.viewerPermissions.actions.includes(`reopen`)?`reopen`:null,_;t[1]!==a||t[2]!==u||t[3]!==n||t[4]!==l||t[5]!==s||t[6]!==c||t[7]!==h||t[8]!==r||t[9]!==f?(_=async e=>{let t=u.trim();if(!(t.length===0||f!==null||a)){if(p(e),e!==`comment`){(await s(t,e)).commentPosted&&(d(``),l()),p(null);return}if((await h({environmentId:n,input:{...r,body:t}}))._tag===`Failure`){p(null),gt.add({type:`error`,title:`Could not post the comment`});return}d(``),p(null),l(),c()}},t[1]=a,t[2]=u,t[3]=n,t[4]=l,t[5]=s,t[6]=c,t[7]=h,t[8]=r,t[9]=f,t[10]=_):_=t[10];let v=_,y=f!==null||a,b;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>d(e.target.value),t[11]=b):b=t[11];let x;t[12]===v?x=t[13]:(x=e=>{e.nativeEvent.isComposing||e.keyCode===229||e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&!e.shiftKey&&!e.altKey&&(e.preventDefault(),e.stopPropagation(),e.repeat||v(`comment`))},t[12]=v,t[13]=x);let S;t[14]!==u||t[15]!==y||t[16]!==x||t[17]!==o?(S=(0,$.jsx)(Dn,{ref:o,disabled:y,value:u,rows:3,placeholder:`Leave a comment`,"aria-label":`Comment on this pull request`,onChange:b,onKeyDown:x}),t[14]=u,t[15]=y,t[16]=x,t[17]=o,t[18]=S):S=t[18];let C;t[19]!==a||t[20]!==u||t[21]!==g||t[22]!==v||t[23]!==f?(C=g===null?null:(0,$.jsxs)(G,{size:`xs`,variant:g===`close`?`destructive-outline`:`outline`,disabled:u.trim().length===0||f!==null||a,onClick:()=>void v(g),children:[g===`close`?(0,$.jsx)(Mr.closed,{className:`size-3.5`}):(0,$.jsx)(Mr.reopen,{className:`size-3.5`}),f===g?g===`close`?`Closing...`:`Reopening...`:g===`close`?`Close with comment`:`Reopen with comment`]}),t[19]=a,t[20]=u,t[21]=g,t[22]=v,t[23]=f,t[24]=C):C=t[24];let w;t[25]!==a||t[26]!==u||t[27]!==f?(w=u.trim().length===0||f!==null||a,t[25]=a,t[26]=u,t[27]=f,t[28]=w):w=t[28];let T;t[29]===v?T=t[30]:(T=()=>void v(`comment`),t[29]=v,t[30]=T);let E;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(ie,{className:`size-3.5`}),t[31]=E):E=t[31];let D=f===`comment`?`Posting...`:`Comment`,O;t[32]!==D||t[33]!==w||t[34]!==T?(O=(0,$.jsxs)(G,{size:`xs`,variant:`outline`,disabled:w,onClick:T,children:[E,D]}),t[32]=D,t[33]=w,t[34]=T,t[35]=O):O=t[35];let k;t[36]!==O||t[37]!==C?(k=(0,$.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[C,O]}),t[36]=O,t[37]=C,t[38]=k):k=t[38];let A;return t[39]!==k||t[40]!==S?(A=(0,$.jsxs)(`div`,{className:`space-y-2`,children:[S,k]}),t[39]=k,t[40]=S,t[41]=A):A=t[41],A}var wl=[{value:`comment`,label:`Comment`,sent:`Review submitted`,icon:(0,$.jsx)(Ae,{className:`size-3`})},{value:`approve`,label:`Approve`,sent:`Pull request approved`,icon:(0,$.jsx)(me,{className:`size-3`})},{value:`request-changes`,label:`Request changes`,sent:`Changes requested`,icon:(0,$.jsx)(C,{className:`size-3`})}];function Tl(e){let t=(0,Q.c)(70),{environmentId:n,reference:r,verdicts:i,requestChangesSummaryRequired:a,textareaRef:o,pending:s,onPendingChange:c,onSubmitted:l}=e,[u,d]=(0,Z.useState)(`comment`),f=Fi(r),p;t[0]===r?p=t[1]:(p=Pi(r),t[0]=r,t[1]=p);let m=p,h;t[2]===m?h=t[3]:(h=e=>e.summaries[m]??``,t[2]=m,t[3]=h);let g=Ni(h),_=Ni(Al),v=Ni(kl),y=Ni(Ol),b;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(b={reportFailure:!1},t[4]=b):b=t[4];let x=Dt(zr.submitReview,b),S,C,w,T,E,D,O,k;if(t[5]!==g||t[6]!==y||t[7]!==f||t[8]!==n||t[9]!==c||t[10]!==l||t[11]!==s||t[12]!==r||t[13]!==_||t[14]!==a||t[15]!==u||t[16]!==m||t[17]!==v||t[18]!==x||t[19]!==o||t[20]!==i){let e;t[29]===i?e=t[30]:(e=e=>i.includes(e.value),t[29]=i,t[30]=e);let p=wl.filter(e);C=p.find(e=>e.value===u)??p[0];let h;t[31]!==g||t[32]!==y||t[33]!==f||t[34]!==n||t[35]!==c||t[36]!==l||t[37]!==s||t[38]!==r||t[39]!==_||t[40]!==m||t[41]!==x?(h=async e=>{if(s)return;let t=g,i=f;c(!0);let a=await x({environmentId:n,input:{...r,verdict:e.value,body:t,comments:i}});if(c(!1),a._tag===`Failure`){gt.add({type:`error`,title:`The review could not be submitted`});return}_(m,i.map(Dl)),y(m,t),gt.add({type:`success`,title:e.sent}),l()},t[31]=g,t[32]=y,t[33]=f,t[34]=n,t[35]=c,t[36]=l,t[37]=s,t[38]=r,t[39]=_,t[40]=m,t[41]=x,t[42]=h):h=t[42],w=h;let b;t[43]!==f||t[44]!==a?(b=(e,t)=>e===`request-changes`&&a?t.trim().length>0:e===`approve`||t.trim().length>0||f.length>0,t[43]=f,t[44]=a,t[45]=b):b=t[45];let A=b,j=C===void 0||A(C.value,``)?`Summarize your review (optional)`:C.value===`request-changes`&&a?`Summarize your review (required to request changes)`:`Summarize your review or add line comments`,M;t[46]!==m||t[47]!==v?(M=e=>v(m,e.target.value),t[46]=m,t[47]=v,t[48]=M):M=t[48],t[49]!==g||t[50]!==j||t[51]!==M||t[52]!==o?(k=(0,$.jsx)(Dn,{ref:o,rows:3,value:g,placeholder:j,"aria-label":`Review summary`,onChange:M}),t[49]=g,t[50]=j,t[51]=M,t[52]=o,t[53]=k):k=t[53],D=`mt-2 flex justify-end gap-2`,O=p.length>1?(0,$.jsxs)(mt,{value:C?.value??null,disabled:s,onValueChange:e=>{e!==null&&d(e)},children:[(0,$.jsx)(pt,{size:`xs`,className:`mr-auto w-auto min-w-0`,"aria-label":`Review verdict`,children:(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[C?.icon,C?.label]})}),(0,$.jsx)(ft,{side:`top`,alignItemWithTrigger:!1,children:p.map(El)})]}):null,S=G,T=`xs`,E=s||C===void 0||!A(C.value,g),t[5]=g,t[6]=y,t[7]=f,t[8]=n,t[9]=c,t[10]=l,t[11]=s,t[12]=r,t[13]=_,t[14]=a,t[15]=u,t[16]=m,t[17]=v,t[18]=x,t[19]=o,t[20]=i,t[21]=S,t[22]=C,t[23]=w,t[24]=T,t[25]=E,t[26]=D,t[27]=O,t[28]=k}else S=t[21],C=t[22],w=t[23],T=t[24],E=t[25],D=t[26],O=t[27],k=t[28];let A;t[54]!==C||t[55]!==w?(A=()=>{C!==void 0&&w(C)},t[54]=C,t[55]=w,t[56]=A):A=t[56];let j=s?`Submitting...`:`Submit review`,M;t[57]!==S||t[58]!==j||t[59]!==T||t[60]!==E||t[61]!==A?(M=(0,$.jsx)(S,{size:T,disabled:E,onClick:A,children:j}),t[57]=S,t[58]=j,t[59]=T,t[60]=E,t[61]=A,t[62]=M):M=t[62];let N;t[63]!==M||t[64]!==D||t[65]!==O?(N=(0,$.jsxs)(`div`,{className:D,children:[O,M]}),t[63]=M,t[64]=D,t[65]=O,t[66]=N):N=t[66];let P;return t[67]!==N||t[68]!==k?(P=(0,$.jsxs)($.Fragment,{children:[k,N]}),t[67]=N,t[68]=k,t[69]=P):P=t[69],P}function El(e){return(0,$.jsx)(dt,{value:e.value,children:(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[e.icon,e.label]})},e.value)}function Dl(e){return e.id}function Ol(e){return e.clearSummary}function kl(e){return e.setSummary}function Al(e){return e.removeComments}function jl(e){let t=(0,Q.c)(63),{environmentId:n,reference:r,detail:i,actionPending:a,onCommentAction:o,onCommented:s,onReviewSubmitted:c,openReviewRequest:u}=e,[d,f]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(!1),[h,g]=(0,Z.useState)(`comment`),_=(0,Z.useRef)(null),v=(0,Z.useRef)(null),y=Fi(r),b=Ni(Ml),x;t[0]===r?x=t[1]:(x=Pi(r),t[0]=r,t[1]=x);let S=x,C;t[2]===S?C=t[3]:(C=e=>(e.summaries[S]??``).trim().length>0,t[2]=S,t[3]=C);let w=Ni(C),T=y.length>0||w,[E,D]=(0,Z.useState)(u);u!==E&&(D(u),g(`review`),f(!0));let O=i.capabilities.comment&&i.viewerPermissions.comment,k;if(t[4]!==i.capabilities.review.verdicts||t[5]!==i.viewerPermissions){let e;t[7]===i.viewerPermissions?e=t[8]:(e=e=>i.viewerPermissions.verdicts.includes(e),t[7]=i.viewerPermissions,t[8]=e),k=i.capabilities.review.verdicts.filter(e),t[4]=i.capabilities.review.verdicts,t[5]=i.viewerPermissions,t[6]=k}else k=t[6];let A=k;if(!O&&A.length===0)return null;let j=O?A.length===0?`comment`:h:`review`,M;t[9]===T?M=t[10]:(M=e=>{e&&g(T?`review`:`comment`),f(e)},t[9]=T,t[10]=M);let N;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(G,{size:`icon`,variant:`glass`}),t[11]=N):N=t[11];let P=y.length>0?`Review pull request, ${y.length} ${y.length===1?`comment`:`comments`} pending`:T||!O?`Review pull request`:`Comment on pull request`,F;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(Ae,{className:`size-4`}),t[12]=F):F=t[12];let I;t[13]===y.length?I=t[14]:(I=y.length>0?(0,$.jsx)(`span`,{"aria-hidden":!0,className:`absolute -top-1 -right-1 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-info px-1 text-3xs font-semibold tabular-nums text-white`,children:y.length}):null,t[13]=y.length,t[14]=I);let L;t[15]!==P||t[16]!==I?(L=(0,$.jsxs)(Wr,{render:N,"aria-label":P,children:[F,I]}),t[15]=P,t[16]=I,t[17]=L):L=t[17];let R=j===`review`?v:_,z;t[18]!==O||t[19]!==j||t[20]!==y.length||t[21]!==A.length?(z=O&&A.length>0?(0,$.jsxs)(kn,{"aria-label":`Composer mode`,variant:`segmented`,value:[j],onValueChange:e=>{let t=e[0];(t===`comment`||t===`review`)&&g(t)},children:[(0,$.jsx)(An,{value:`comment`,children:`Comment`}),(0,$.jsx)(An,{value:`review`,children:y.length>0?`Review (${y.length})`:`Review`})]}):(0,$.jsx)(Vr,{children:j===`review`?`Review pull request`:`Comment on pull request`}),t[18]=O,t[19]=j,t[20]=y.length,t[21]=A.length,t[22]=z):z=t[22];let B;t[23]!==b||t[24]!==j||t[25]!==y.length||t[26]!==S||t[27]!==p?(B=j===`review`&&y.length>0?(0,$.jsx)(G,{size:`icon-xs`,variant:`ghost`,"aria-label":`Discard pending line comments`,title:`Discard pending line comments`,disabled:p,onClick:()=>b(S),children:(0,$.jsx)(l,{className:`size-3.5`})}):null,t[23]=b,t[24]=j,t[25]=y.length,t[26]=S,t[27]=p,t[28]=B):B=t[28];let V;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(G,{size:`icon-xs`,variant:`ghost`}),t[29]=V):V=t[29];let ee;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,$.jsx)(Ur,{render:V,"aria-label":`Close composer`,children:(0,$.jsx)(H,{className:`size-3.5`})}),t[30]=ee):ee=t[30];let te;t[31]===B?te=t[32]:(te=(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[B,ee]}),t[31]=B,t[32]=te);let ne;t[33]!==z||t[34]!==te?(ne=(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-2`,children:[z,te]}),t[33]=z,t[34]=te,t[35]=ne):ne=t[35];let U;t[36]!==i.provider||t[37]!==n||t[38]!==j||t[39]!==c||t[40]!==r||t[41]!==p||t[42]!==A?(U=A.length>0?(0,$.jsx)(`div`,{hidden:j!==`review`,children:(0,$.jsx)(Tl,{environmentId:n,reference:r,verdicts:A,requestChangesSummaryRequired:Ar.get(i.provider).reviewSummaryRequired(`request-changes`),textareaRef:v,pending:p,onPendingChange:m,onSubmitted:()=>{f(!1),c()}})}):null,t[36]=i.provider,t[37]=n,t[38]=j,t[39]=c,t[40]=r,t[41]=p,t[42]=A,t[43]=U):U=t[43];let W;t[44]!==a||t[45]!==O||t[46]!==i||t[47]!==n||t[48]!==j||t[49]!==o||t[50]!==s||t[51]!==r?(W=O?(0,$.jsx)(`div`,{hidden:j!==`comment`,children:(0,$.jsx)(Cl,{environmentId:n,reference:r,detail:i,actionPending:a,textareaRef:_,onCommentAction:o,onCommented:s,onClose:()=>f(!1)})}):null,t[44]=a,t[45]=O,t[46]=i,t[47]=n,t[48]=j,t[49]=o,t[50]=s,t[51]=r,t[52]=W):W=t[52];let re;t[53]!==R||t[54]!==ne||t[55]!==U||t[56]!==W?(re=(0,$.jsxs)(Hr,{keepMounted:!0,side:`top`,align:`end`,sideOffset:8,width:`lg`,initialFocus:R,"aria-label":`Pull request composer`,children:[ne,U,W]}),t[53]=R,t[54]=ne,t[55]=U,t[56]=W,t[57]=re):re=t[57];let ie;return t[58]!==d||t[59]!==re||t[60]!==M||t[61]!==L?(ie=(0,$.jsxs)(Gr,{open:d,onOpenChange:M,children:[L,re]}),t[58]=d,t[59]=re,t[60]=M,t[61]=L,t[62]=ie):ie=t[62],ie}function Ml(e){return e.clear}function Nl(e){let t=(0,Q.c)(53),{icon:n,label:r,allowed:i,disabledReason:a,open:o,onOpenChange:s,query:c,onQueryChange:l,searchLabel:u,isPending:d,error:f,candidates:p,emptyLabel:m,noMatchLabel:h,errorLabel:g,truncated:_,truncatedLabel:v,candidateKey:y,disabled:b,onSelect:x,children:S}=e;if(!i){let e;t[0]!==n||t[1]!==r?(e=(0,$.jsx)(J,{render:(0,$.jsx)(G,{size:`icon-xs`,variant:`ghost`,disabled:!0,"aria-label":r,children:n})}),t[0]=n,t[1]=r,t[2]=e):e=t[2];let i;t[3]===a?i=t[4]:(i=(0,$.jsx)(Y,{side:`bottom`,children:a}),t[3]=a,t[4]=i);let o;return t[5]!==e||t[6]!==i?(o=(0,$.jsxs)(X,{children:[e,i]}),t[5]=e,t[6]=i,t[7]=o):o=t[7],o}let C;t[8]!==y||t[9]!==p?(C=p.map(y),t[8]=y,t[9]=p,t[10]=C):C=t[10];let w=C,T;t[11]!==y||t[12]!==p||t[13]!==x?(T=e=>{let t=p.find(t=>y(t)===e);t&&x(t)},t[11]=y,t[12]=p,t[13]=x,t[14]=T):T=t[14];let E;t[15]===s?E=t[16]:(E=(e,t)=>{if(!e&&t.reason===`item-press`){t.cancel();return}s(e)},t[15]=s,t[16]=E);let D;t[17]!==n||t[18]!==r?(D=(0,$.jsx)(Mn,{render:(0,$.jsx)(G,{size:`icon-xs`,variant:`ghost`,"aria-label":r,children:n})}),t[17]=n,t[18]=r,t[19]=D):D=t[19];let O;t[20]===l?O=t[21]:(O=e=>l(e.target.value),t[20]=l,t[21]=O);let k;t[22]!==c||t[23]!==u||t[24]!==O?(k=(0,$.jsx)(Fn,{"aria-label":u,placeholder:u,value:c,onChange:O}),t[22]=c,t[23]=u,t[24]=O,t[25]=k):k=t[25];let A;t[26]!==p||t[27]!==S||t[28]!==b||t[29]!==m||t[30]!==f||t[31]!==g||t[32]!==d||t[33]!==w||t[34]!==h||t[35]!==c?(A=d?(0,$.jsx)(fl,{rows:4}):f===null?p.length===0?(0,$.jsx)(`p`,{className:`p-2 text-xs text-muted-foreground`,children:c.length>0?h:m}):p.map((e,t)=>(0,$.jsx)(Pn,{hideIndicator:!0,index:t,value:w[t],disabled:b,children:S(e)},w[t])):(0,$.jsxs)(`p`,{className:`p-2 text-xs text-muted-foreground`,children:[g,` `,f]}),t[26]=p,t[27]=S,t[28]=b,t[29]=m,t[30]=f,t[31]=g,t[32]=d,t[33]=w,t[34]=h,t[35]=c,t[36]=A):A=t[36];let j;t[37]!==_||t[38]!==v?(j=_?(0,$.jsx)(`p`,{className:`px-2 py-1.5 text-xs text-muted-foreground`,children:v}):null,t[37]=_,t[38]=v,t[39]=j):j=t[39];let M;t[40]!==A||t[41]!==j?(M=(0,$.jsxs)(jn,{className:`max-h-72`,children:[A,j]}),t[40]=A,t[41]=j,t[42]=M):M=t[42];let N;t[43]!==k||t[44]!==M?(N=(0,$.jsxs)(Nn,{align:`start`,side:`bottom`,className:`w-72`,children:[k,M]}),t[43]=k,t[44]=M,t[45]=N):N=t[45];let P;return t[46]!==w||t[47]!==o||t[48]!==N||t[49]!==T||t[50]!==E||t[51]!==D?(P=(0,$.jsxs)(In,{items:w,filteredItems:w,filter:null,autoHighlight:!0,value:null,onValueChange:T,open:o,onOpenChange:E,children:[D,N]}),t[46]=w,t[47]=o,t[48]=N,t[49]=T,t[50]=E,t[51]=D,t[52]=P):P=t[52],P}function Pl(e,t){if(t.length===0)return!0;let n=t.toLowerCase();return e.name.toLowerCase().includes(n)||(e.description??``).toLowerCase().includes(n)}function Fl(e){let t=(0,Q.c)(30),{environmentId:n,reference:r,allowed:i}=e,[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(null),d;t[0]!==n||t[1]!==a||t[2]!==r?(d=a?zr.labelCandidates({environmentId:n,input:r}):null,t[0]=n,t[1]=a,t[2]=r,t[3]=d):d=t[3];let f=Et(d),p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p={reportFailure:!1},t[4]=p):p=t[4];let m=Dt(zr.setLabels,p),h;t[5]===f.data?.candidates?h=t[6]:(h=f.data?.candidates??[],t[5]=f.data?.candidates,t[6]=h);let g;if(t[7]!==s||t[8]!==h){let e;t[10]===s?e=t[11]:(e=e=>Pl(e,s),t[10]=s,t[11]=e),g=h.filter(e),t[7]=s,t[8]=h,t[9]=g}else g=t[9];let _=g,v;t[12]!==n||t[13]!==l||t[14]!==r||t[15]!==m?(v=async e=>{if(l!==null)return;u(e.name);let t=await m({environmentId:n,input:{...r,labels:[e.name],applied:!e.isApplied}});if(u(null),t._tag===`Failure`){gt.add({type:`error`,title:e.isApplied?`Could not take ${e.name} off`:`Could not put ${e.name} on`,description:ai(Ue(t),`The host refused it. Check that you have triage access on this repository.`)});return}},t[12]=n,t[13]=l,t[14]=r,t[15]=m,t[16]=v):v=t[16];let y=v,b;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(he,{className:`size-3.5`}),t[17]=b):b=t[17];let x=f.isPending&&f.data===null,S=f.data===null?f.error:null,C=f.data?.truncated===!0,w=l!==null,T;t[18]===y?T=t[19]:(T=e=>void y(e),t[18]=y,t[19]=T);let E;return t[20]!==i||t[21]!==_||t[22]!==a||t[23]!==s||t[24]!==w||t[25]!==T||t[26]!==x||t[27]!==S||t[28]!==C?(E=(0,$.jsx)(Nl,{icon:b,label:`Change labels`,allowed:i,disabledReason:`Changing labels needs triage access on this repository`,open:a,onOpenChange:o,query:s,onQueryChange:c,searchLabel:`Search labels`,isPending:x,error:S,candidates:_,emptyLabel:`This repository has no labels.`,noMatchLabel:`No label matches that.`,errorLabel:`The labels could not be read.`,truncated:C,truncatedLabel:`This repository has more labels than are listed here. Apply the rest on the host.`,candidateKey:Ll,disabled:w,onSelect:T,children:Il}),t[20]=i,t[21]=_,t[22]=a,t[23]=s,t[24]=w,t[25]=T,t[26]=x,t[27]=S,t[28]=C,t[29]=E):E=t[29],E}function Il(e){let t=Nr(e.color);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`size-2 shrink-0 rounded-full bg-muted-foreground`,...t?{style:{backgroundColor:t}}:{}}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[e.name,e.description?(0,$.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,e.description]}):null]}),e.isApplied?(0,$.jsx)(me,{"aria-label":`Applied`,className:`size-3.5 shrink-0`}):null]})}function Ll(e){return e.name}function Rl(e,t){if(t.length===0)return!0;let n=t.toLowerCase();return e.login.toLowerCase().includes(n)||(e.name??``).toLowerCase().includes(n)}function zl(e){let t=(0,Q.c)(30),{environmentId:n,reference:r,allowed:i}=e,[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(null),d;t[0]!==n||t[1]!==a||t[2]!==r?(d=a?zr.reviewerCandidates({environmentId:n,input:r}):null,t[0]=n,t[1]=a,t[2]=r,t[3]=d):d=t[3];let f=Et(d),p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p={reportFailure:!1},t[4]=p):p=t[4];let m=Dt(zr.requestReviewers,p),h;t[5]===f.data?.candidates?h=t[6]:(h=f.data?.candidates??[],t[5]=f.data?.candidates,t[6]=h);let g;if(t[7]!==s||t[8]!==h){let e;t[10]===s?e=t[11]:(e=e=>Rl(e,s),t[10]=s,t[11]=e),g=h.filter(e),t[7]=s,t[8]=h,t[9]=g}else g=t[9];let _=g,v;t[12]!==n||t[13]!==l||t[14]!==r||t[15]!==m?(v=async e=>{if(l!==null)return;u(e.id);let t=await m({environmentId:n,input:{...r,reviewers:[{id:e.id,kind:e.kind}],requested:!e.isRequested}});if(u(null),t._tag===`Failure`){gt.add({type:`error`,title:e.isRequested?`Could not take back the review request to ${e.login}`:`Could not ask ${e.login} for a review`,description:ai(Ue(t),`The host refused it. Check that you have write access on this repository, and that they still have access to it.`)});return}gt.add({type:`success`,title:e.isRequested?`Review request to ${e.login} taken back`:`Review requested from ${e.login}`})},t[12]=n,t[13]=l,t[14]=r,t[15]=m,t[16]=v):v=t[16];let y=v,b;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(P,{className:`size-3.5`}),t[17]=b):b=t[17];let x=f.isPending&&f.data===null,S=f.data===null?f.error:null,C=f.data?.truncated===!0,w=l!==null,T;t[18]===y?T=t[19]:(T=e=>void y(e),t[18]=y,t[19]=T);let E;return t[20]!==i||t[21]!==_||t[22]!==a||t[23]!==s||t[24]!==w||t[25]!==T||t[26]!==x||t[27]!==S||t[28]!==C?(E=(0,$.jsx)(Nl,{icon:b,label:`Request a review`,allowed:i,disabledReason:`Asking someone to review needs write access on this repository`,open:a,onOpenChange:o,query:s,onQueryChange:c,searchLabel:`Search people with access`,isPending:x,error:S,candidates:_,emptyLabel:`Nobody else has access to this repository.`,noMatchLabel:`Nobody with access matches that.`,errorLabel:`The people with access could not be read.`,truncated:C,truncatedLabel:`This repository has more people with access than are listed here. Ask for the rest on the host.`,candidateKey:Vl,disabled:w,onSelect:T,children:Bl}),t[20]=i,t[21]=_,t[22]=a,t[23]=s,t[24]=w,t[25]=T,t[26]=x,t[27]=S,t[28]=C,t[29]=E):E=t[29],E}function Bl(e){return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(wr,{actor:e,className:`flex-1`}),e.kind===`team`?(0,$.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`team`}):null,e.isRequested?(0,$.jsx)(me,{"aria-label":`Already asked`,className:`size-3.5 shrink-0`}):null]})}function Vl(e){return`${e.kind}:${e.id}`}function Hl(e){let t=(0,Q.c)(28),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(!1),c=(0,Z.useRef)(null),l=(0,Z.useId)(),u,d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{let e=c.current;if(!e)return;let t=()=>s(e.getBoundingClientRect().height>240);return t(),$n(e,t)},d=[],t[3]=u,t[4]=d):(u=t[3],d=t[4]),(0,Z.useEffect)(u,d);let f;t[5]===n?f=t[6]:(f=K(`min-w-0`,n),t[5]=n,t[6]=f);let p=!i&&`max-h-[240px] overflow-hidden`,m;t[7]===p?m=t[8]:(m=K(`relative`,p),t[7]=p,t[8]=m);let h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>a(!0),t[9]=h):h=t[9];let g;t[10]===r?g=t[11]:(g=(0,$.jsx)(`div`,{ref:c,children:(0,$.jsx)(Gs,{...r})}),t[10]=r,t[11]=g);let _;t[12]!==i||t[13]!==o?(_=o&&!i?(0,$.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-10 bg-gradient-to-t from-background to-transparent`}):null,t[12]=i,t[13]=o,t[14]=_):_=t[14];let v;t[15]!==l||t[16]!==m||t[17]!==g||t[18]!==_?(v=(0,$.jsxs)(`div`,{id:l,className:m,onFocusCapture:h,children:[g,_]}),t[15]=l,t[16]=m,t[17]=g,t[18]=_,t[19]=v):v=t[19];let y;t[20]!==i||t[21]!==l||t[22]!==o?(y=o?(0,$.jsx)(G,{size:`xs`,variant:`ghost-muted`,className:`mt-2`,"aria-expanded":i,"aria-controls":l,onClick:()=>{i&&c.current?.parentElement?.scrollIntoView({block:`nearest`}),a(!i)},children:i?`Show less`:`Show full comment`}):null,t[20]=i,t[21]=l,t[22]=o,t[23]=y):y=t[23];let b;return t[24]!==y||t[25]!==f||t[26]!==v?(b=(0,$.jsxs)(`div`,{className:f,children:[v,y]}),t[24]=y,t[25]=f,t[26]=v,t[27]=b):b=t[27],b}var Ul=1;function Wl(e){let t=e.sectionTop<e.viewportTop,n=e.headingTop<=e.viewportTop+Ul;return!t||!n?null:Math.max(0,e.scrollTop+e.sectionTop-e.viewportTop)}function Gl(e){return e.toLowerCase()}function Kl(e){let t=(0,Q.c)(27),{comment:n,detail:r}=e,i=n.author,a;t[0]!==i||t[1]!==r?(a=i?Ar.get(r.provider).authorProfileUrl(i.login,r.url):null,t[0]=i,t[1]=r,t[2]=a):a=t[2];let o=a,s;t[3]!==i||t[4]!==o?(s=(0,$.jsx)(wr,{actor:i,profileUrl:o,className:`max-w-full`}),t[3]=i,t[4]=o,t[5]=s):s=t[5];let c;t[6]===n.url?c=t[7]:(c=n.url?(0,$.jsx)(`a`,{href:n.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground hover:text-foreground hover:underline`}):(0,$.jsx)(`span`,{className:`text-muted-foreground`}),t[6]=n.url,t[7]=c);let l=n.createdAt,u;t[8]===n.createdAt?u=t[9]:(u=Cn(n.createdAt),t[8]=n.createdAt,t[9]=u);let d;t[10]!==n.createdAt||t[11]!==u?(d=(0,$.jsx)(`time`,{dateTime:l,children:u}),t[10]=n.createdAt,t[11]=u,t[12]=d):d=t[12];let f;t[13]!==c||t[14]!==d?(f=(0,$.jsx)(J,{render:c,children:d}),t[13]=c,t[14]=d,t[15]=f):f=t[15];let p;t[16]===n.createdAt?p=t[17]:(p=new Date(n.createdAt).toLocaleString(),t[16]=n.createdAt,t[17]=p);let m=n.url?` · Open comment on host`:``,h;t[18]!==p||t[19]!==m?(h=(0,$.jsxs)(Y,{children:[p,m]}),t[18]=p,t[19]=m,t[20]=h):h=t[20];let g;t[21]!==h||t[22]!==f?(g=(0,$.jsxs)(X,{children:[f,h]}),t[21]=h,t[22]=f,t[23]=g):g=t[23];let _;return t[24]!==g||t[25]!==s?(_=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1 text-xs`,children:[s,g]}),t[24]=g,t[25]=s,t[26]=_):_=t[26],_}function ql(e){let t=(0,Q.c)(8),{comment:n,thread:r}=e,i=r?.path??n.path;if(!i)return null;let a=`${i}${r?.line?`:${r.line}`:``}`,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(`span`,{className:`truncate font-mono`}),t[0]=o):o=t[0];let s;t[1]===a?s=t[2]:(s=(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:o,children:a}),(0,$.jsx)(Y,{children:a})]}),t[1]=a,t[2]=s);let c;t[3]===r?.isOutdated?c=t[4]:(c=r?.isOutdated?(0,$.jsx)(`span`,{className:`shrink-0`,children:`Outdated`}):null,t[3]=r?.isOutdated,t[4]=c);let l;return t[5]!==s||t[6]!==c?(l=(0,$.jsxs)(`div`,{className:`mt-2 flex min-w-0 items-center gap-2 text-xs text-muted-foreground`,children:[s,c]}),t[5]=s,t[6]=c,t[7]=l):l=t[7],l}function Jl(e){let t=e.toLowerCase().replace(/_/g,` `);return t.charAt(0).toUpperCase()+t.slice(1)}function Yl(e){let t=(0,Q.c)(29),{comment:n,editing:r,className:i}=e;if(r.editingId===n.id){let e;t[0]!==n||t[1]!==r?(e=e=>r.onSave(n,e),t[0]=n,t[1]=r,t[2]=e):e=t[2];let a;t[3]===r?a=t[4]:(a=()=>r.onEdit(null),t[3]=r,t[4]=a);let o;return t[5]!==i||t[6]!==n.body||t[7]!==r.cwd||t[8]!==r.environmentId||t[9]!==r.saving||t[10]!==r.threadRef||t[11]!==e||t[12]!==a?(o=(0,$.jsx)(Ks,{className:i,value:n.body,cwd:r.cwd,environmentId:r.environmentId,threadRef:r.threadRef,label:`Edit comment`,saving:r.saving,onSave:e,onCancel:a}),t[5]=i,t[6]=n.body,t[7]=r.cwd,t[8]=r.environmentId,t[9]=r.saving,t[10]=r.threadRef,t[11]=e,t[12]=a,t[13]=o):o=t[13],o}let a;t[14]===i?a=t[15]:(a=K(`flex items-start gap-1`,i),t[14]=i,t[15]=a);let o;t[16]!==n.body||t[17]!==n.id||t[18]!==r.cwd||t[19]!==r.environmentId||t[20]!==r.threadRef?(o=(0,$.jsx)(Hl,{className:`min-w-0 flex-1`,text:n.body,cwd:r.cwd,environmentId:r.environmentId,threadRef:r.threadRef},n.id),t[16]=n.body,t[17]=n.id,t[18]=r.cwd,t[19]=r.environmentId,t[20]=r.threadRef,t[21]=o):o=t[21];let s;t[22]!==n||t[23]!==r?(s=r.canEdit(n)?(0,$.jsx)(Ss,{"aria-label":`Edit comment`,onClick:()=>r.onEdit(n)}):null,t[22]=n,t[23]=r,t[24]=s):s=t[24];let c;return t[25]!==a||t[26]!==o||t[27]!==s?(c=(0,$.jsxs)(`div`,{className:a,children:[o,s]}),t[25]=a,t[26]=o,t[27]=s,t[28]=c):c=t[28],c}function Xl(e){let t=(0,Q.c)(37),{comment:n,editing:r,label:i,body:a,reactionBar:o,detail:s,thread:c}=e,[l,u]=(0,Z.useState)(!1),d=(0,Z.useRef)(null),f;t[0]!==n||t[1]!==s?(f=(0,$.jsx)(Kl,{comment:n,detail:s}),t[0]=n,t[1]=s,t[2]=f):f=t[2];let p=l&&`rotate-180`,m;t[3]===p?m=t[4]:(m=K(`size-3.5 transition-transform`,p),t[3]=p,t[4]=m);let h;t[5]===m?h=t[6]:(h=(0,$.jsx)(fe,{"aria-hidden":!0,className:m}),t[5]=m,t[6]=h);let g;t[7]!==i||t[8]!==h?(g=(0,$.jsxs)(xa,{ref:d,className:`flex shrink-0 items-center gap-1.5 rounded-md px-2 py-1 text-xs text-muted-foreground hover:bg-muted hover:text-foreground`,children:[i,h]}),t[7]=i,t[8]=h,t[9]=g):g=t[9];let _;t[10]!==o||t[11]!==f||t[12]!==g?(_=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2`,children:[f,g,o]}),t[10]=o,t[11]=f,t[12]=g,t[13]=_):_=t[13];let v;t[14]!==n||t[15]!==c?(v=(0,$.jsx)(ql,{comment:n,thread:c}),t[14]=n,t[15]=c,t[16]=v):v=t[16];let y;t[17]!==a||t[18]!==l?(y=!l&&a?(0,$.jsx)(xa,{className:`mt-2 block w-full truncate text-left text-xs text-muted-foreground hover:text-foreground`,onClick:()=>d.current?.focus({preventScroll:!0}),children:a.replace(/<!--[\s\S]*?-->/gu,``).replace(/^\s*>?\s*\[!\w+\]\s*$/gmu,``).replace(/!?(\[([^\]]+)\])\([^)]*\)/gu,`$2`).replace(/^[\s>#*-]+/gmu,``).replace(/[*`]/gu,``).replace(/\s+/g,` `).trim()}):null,t[17]=a,t[18]=l,t[19]=y):y=t[19];let b;t[20]!==_||t[21]!==v||t[22]!==y?(b=(0,$.jsxs)(`div`,{className:`p-3`,children:[_,v,y]}),t[20]=_,t[21]=v,t[22]=y,t[23]=b):b=t[23];let x;t[24]!==a||t[25]!==n||t[26]!==r||t[27]!==l?(x=l?(0,$.jsx)(`div`,{className:`px-3 pb-3`,children:a===null&&!r.canEdit(n)?null:(0,$.jsx)(Yl,{className:`mt-2`,comment:n,editing:r})}):null,t[24]=a,t[25]=n,t[26]=r,t[27]=l,t[28]=x):x=t[28];let S;t[29]===x?S=t[30]:(S=(0,$.jsx)(ga,{children:x}),t[29]=x,t[30]=S);let C;t[31]!==S||t[32]!==b?(C=(0,$.jsxs)(`article`,{className:`group rounded-lg border border-border/60 [contain-intrinsic-block-size:44px] [content-visibility:auto]`,children:[b,S]}),t[31]=S,t[32]=b,t[33]=C):C=t[33];let w;return t[34]!==l||t[35]!==C?(w=(0,$.jsx)(ua,{open:l,onOpenChange:u,children:C}),t[34]=l,t[35]=C,t[36]=w):w=t[36],w}function Zl(e){let t=(0,Q.c)(8),{icon:n,label:r,children:i}=e,a;t[0]!==n||t[1]!==r?(a=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[n,r]}),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o;t[3]===i?o=t[4]:(o=(0,$.jsx)(`span`,{className:`min-w-0 text-foreground`,children:i}),t[3]=i,t[4]=o);let s;return t[5]!==a||t[6]!==o?(s=(0,$.jsxs)(`div`,{className:`grid min-h-7 min-w-0 grid-cols-[6rem_minmax(0,1fr)] items-center gap-2 text-xs sm:min-h-6`,children:[a,o]}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Ql(e){let t=(0,Q.c)(25),{title:n,defaultOpen:r,keepMounted:i,actions:a,children:o}=e,s=r===void 0||r,c=i!==void 0&&i,[l,u]=(0,Z.useState)(s),d=(0,Z.useRef)(null),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>{if(!e){let e=d.current,t=e?.closest(`[data-pull-request-summary-section]`),n=e?.closest(`[data-pull-request-summary-scroll]`);if(e&&t&&n){let r=Wl({scrollTop:n.scrollTop,viewportTop:n.getBoundingClientRect().top,sectionTop:t.getBoundingClientRect().top,headingTop:e.getBoundingClientRect().top});r!==null&&(n.scrollTop=r)}}u(e)},t[0]=f):f=t[0];let p=f,m;t[1]===n?m=t[2]:(m=(0,$.jsx)(`section`,{"aria-label":n}),t[1]=n,t[2]=m);let h;t[3]===n?h=t[4]:(h=(0,$.jsx)(`span`,{children:n}),t[3]=n,t[4]=h);let g=l&&`rotate-90`,_;t[5]===g?_=t[6]:(_=K(`size-3.5 text-muted-foreground/60 transition-transform`,g),t[5]=g,t[6]=_);let v;t[7]===_?v=t[8]:(v=(0,$.jsx)(Pe,{"aria-hidden":!0,className:_}),t[7]=_,t[8]=v);let y;t[9]!==h||t[10]!==v?(y=(0,$.jsxs)(xa,{className:`flex min-w-0 flex-1 items-center gap-1.5 px-4 py-3 text-left text-xs font-medium text-muted-foreground hover:text-foreground`,children:[h,v]}),t[9]=h,t[10]=v,t[11]=y):y=t[11];let b;t[12]!==a||t[13]!==y?(b=(0,$.jsxs)(`div`,{ref:d,className:`sticky top-0 z-10 flex w-full items-center bg-background pr-4`,children:[y,a]}),t[12]=a,t[13]=y,t[14]=b):b=t[14];let x;t[15]===o?x=t[16]:(x=(0,$.jsx)(`div`,{className:`px-4 pb-4`,children:o}),t[15]=o,t[16]=x);let S;t[17]!==c||t[18]!==x?(S=(0,$.jsx)(ga,{keepMounted:c,children:x}),t[17]=c,t[18]=x,t[19]=S):S=t[19];let C;return t[20]!==l||t[21]!==b||t[22]!==S||t[23]!==m?(C=(0,$.jsxs)(ua,{open:l,onOpenChange:p,render:m,"data-pull-request-summary-section":!0,children:[b,S]}),t[20]=l,t[21]=b,t[22]=S,t[23]=m,t[24]=C):C=t[24],C}var $l=10,eu=`t3code:pull-request-comment-filter:v1`,tu=R({bots:Re,resolved:Re}),nu={bots:!1,resolved:!1};function ru(e){let t=(0,Q.c)(110),{scrollerRef:n,environmentId:r,threadRef:i,reference:a,detail:o,activityPending:c,checksStale:l,activityError:u,pendingFinding:d,fixFindingLabel:f,fixCheckLabel:m,onFixFinding:h,onRefresh:_,onRefreshChecks:v}=e,b=l!==void 0&&l,x=f===void 0?`Fix in a thread`:f,C=m===void 0?`Fix`:m,w=v===void 0?_:v,T;t[0]===o.url?T=t[1]:(T={url:o.url,count:$l},t[0]=o.url,t[1]=T);let[D,O]=(0,Z.useState)(T),A=D.url===o.url?D.count:$l,[j,N]=g(eu,nu,tu),P=new Map(o.reviewThreads.flatMap(du)),F=e=>P.get(e.id)?.isResolved===!0||Qr(e.reviewState)===`dismissed`,I=uu,L;t[2]!==j.bots||t[3]!==j.resolved||t[4]!==F?(L=e=>(j.bots||!I(e))&&(j.resolved||!F(e)),t[2]=j.bots,t[3]=j.resolved,t[4]=F,t[5]=L):L=t[5];let R=o.comments.filter(L),z=o.comments.length-R.length,B=R.slice(Math.max(0,R.length-A)),V=R.length-B.length,[H,ee]=(0,Z.useState)(`newest`),te=xi(B,H),ne;t[6]!==o.url||t[7]!==V||t[8]!==A?(ne=V>0?(0,$.jsxs)(G,{size:`sm`,variant:`outline`,className:`w-full`,onClick:()=>O({url:o.url,count:A+$l}),children:[`Show `,Math.min(V,$l),` older comment`,V===1?``:`s`,` (`,V,` hidden)`]}):null,t[6]=o.url,t[7]=V,t[8]=A,t[9]=ne):ne=t[9];let U=ne,W=si(o.comments,o.commits),re=new Map(W.flatMap(lu)),ie=[...o.reviewers.map(e=>({key:e.login,actor:e,outcome:re.get(Gl(e.login))?.outcome??null,stale:re.get(Gl(e.login))?.stale??!1})),...W.filter(e=>!o.reviewers.some(t=>e.actor!==null&&Gl(t.login)===Gl(e.actor.login))).map(cu)],ae=lr(i),se;t[10]===ae?se=t[11]:(se=e=>{ae(e).catch(su)},t[10]=ae,t[11]=se);let ce=se,le;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(le={reportFailure:!1},t[12]=le):le=t[12];let ue=Dt(zr.update,le),de;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(de={reportFailure:!1},t[13]=de):de=t[13];let fe=Dt(zr.updateComment,de),[pe,me]=(0,Z.useState)(null),[ge,_e]=(0,Z.useState)(!1),[ve,ye]=(0,Z.useState)(null),[be,xe]=(0,Z.useState)(!1),Se=ve?.pullRequest===o.url?ve.commentId:null,we;t[14]!==ge||t[15]!==r||t[16]!==_||t[17]!==a||t[18]!==ue?(we=async e=>{if(ge)return;_e(!0);let t=await ue({environmentId:r,input:{...a,body:e}});if(_e(!1),t._tag===`Failure`){gt.add({type:`error`,title:`Could not save the description`});return}me(null),_()},t[14]=ge,t[15]=r,t[16]=_,t[17]=a,t[18]=ue,t[19]=we):we=t[19];let Ee=we,De;t[20]===o?De=t[21]:(De=e=>bs(o,e),t[20]=o,t[21]=De);let Oe;t[22]===o.url?Oe=t[23]:(Oe=e=>ye(e===null?null:{pullRequest:o.url,commentId:e.id}),t[22]=o.url,t[23]=Oe);let ke;t[24]!==be||t[25]!==r||t[26]!==_||t[27]!==a||t[28]!==fe?(ke=async(e,t)=>{if(be||e.kind===`review`)return;xe(!0);let n=await fe({environmentId:r,input:{...a,commentId:e.id,kind:e.kind,body:t}});if(xe(!1),n._tag===`Failure`){gt.add({type:`error`,title:`Could not save the comment`});return}ye(null),_()},t[24]=be,t[25]=r,t[26]=_,t[27]=a,t[28]=fe,t[29]=ke):ke=t[29];let Ae={cwd:o.workspaceRoot,environmentId:r,threadRef:i,canEdit:De,editingId:Se,saving:be,onEdit:Oe,onSave:ke},je=e=>{let t=P.get(e.id),n=di(e.body);if(F(e))return(0,$.jsx)(Xl,{comment:e,editing:Ae,detail:o,thread:t,label:t?.isResolved?`Resolved`:`Review dismissed`,body:n,reactionBar:(0,$.jsx)(oc,{className:`ml-auto justify-end`,reactions:e.reactions??[],canReact:o.capabilities.reactions===!0,subjectId:e.id,environmentId:r,reference:a,onRefresh:_})},`${o.url}:${e.id}`);let i=Qr(e.reviewState),s=e.kind!==`review`&&e.kind!==`review-comment`||i===`approved`?null:t===void 0?n===null?null:{kind:`comment`,comment:e}:{kind:`thread`,thread:t},c=(0,$.jsx)(oc,{reactions:e.reactions??[],canReact:o.capabilities.reactions===!0,subjectId:e.id,environmentId:r,reference:a,onRefresh:_,className:`ml-auto justify-end`});return(0,$.jsxs)(`article`,{className:`group rounded-lg border border-border/60 bg-background [contain-intrinsic-block-size:160px] [content-visibility:auto]`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2 rounded-t-lg bg-muted/25 px-3 py-2.5`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(Kl,{comment:e,detail:o}),i?(0,$.jsx)(Er,{outcome:i}):e.reviewState?(0,$.jsx)(`span`,{children:Jl(e.reviewState)}):null]}),h&&s?(0,$.jsxs)(G,{size:`xs`,variant:`ghost`,className:`-mt-1 shrink-0`,disabled:d!=null,onClick:()=>h(s),children:[(0,$.jsx)(p,{className:`size-3`}),d===ni(s)?`Preparing...`:x]}):null,c]}),(0,$.jsx)(`div`,{className:`px-3`,children:(0,$.jsx)(ql,{comment:e,thread:t})}),n===null&&!Ae.canEdit(e)?null:(0,$.jsx)(Yl,{className:`px-3 py-3`,comment:e,editing:Ae})]},`${o.url}:${e.id}`)},Me;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(Me=(0,$.jsx)(M,{className:`size-3.5`}),t[30]=Me):Me=t[30];let Ne=ie.length===0?(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`None`}):(0,$.jsx)(`span`,{className:`flex items-center -space-x-1`,children:ie.map(ou)}),Pe;t[31]!==o.capabilities.reviewers.listCandidates||t[32]!==o.capabilities.reviewers.request||t[33]!==o.viewerPermissions||t[34]!==r||t[35]!==a?(Pe=o.capabilities.reviewers.request&&o.capabilities.reviewers.listCandidates?(0,$.jsx)(zl,{environmentId:r,reference:a,allowed:o.viewerPermissions.requestReviewers}):null,t[31]=o.capabilities.reviewers.listCandidates,t[32]=o.capabilities.reviewers.request,t[33]=o.viewerPermissions,t[34]=r,t[35]=a,t[36]=Pe):Pe=t[36];let Fe;t[37]!==Ne||t[38]!==Pe?(Fe=(0,$.jsx)(Zl,{icon:Me,label:`Reviewers`,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[Ne,Pe]})}),t[37]=Ne,t[38]=Pe,t[39]=Fe):Fe=t[39];let Ie;t[40]!==o.capabilities.labels||t[41]!==o.labels||t[42]!==o.viewerPermissions||t[43]!==r||t[44]!==a?(Ie=o.labels.length>0||o.capabilities.labels===!0?(0,$.jsx)(Zl,{icon:(0,$.jsx)(he,{className:`size-3.5`}),label:`Labels`,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-1`,children:[o.labels.length===0?(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`None`}):o.labels.map(au),o.capabilities.labels===!0?(0,$.jsx)(Fl,{environmentId:r,reference:a,allowed:o.viewerPermissions.labels!==!1}):null]})}):null,t[40]=o.capabilities.labels,t[41]=o.labels,t[42]=o.viewerPermissions,t[43]=r,t[44]=a,t[45]=Ie):Ie=t[45];let Le;t[46]!==Fe||t[47]!==Ie?(Le=(0,$.jsx)(`section`,{className:`px-4 pt-2.5 pb-1`,children:(0,$.jsxs)(`div`,{className:`space-y-2`,children:[Fe,Ie]})}),t[46]=Fe,t[47]=Ie,t[48]=Le):Le=t[48];let Re=`description:${o.url}`,ze;t[49]!==ge||t[50]!==pe||t[51]!==o||t[52]!==r||t[53]!==Ee||t[54]!==i?(ze=(0,$.jsx)(`div`,{className:`group`,children:pe===o.url?(0,$.jsx)(Ks,{allowEmpty:!0,value:o.body,cwd:o.workspaceRoot,environmentId:r,threadRef:i,label:`Pull request description`,placeholder:`Describe this pull request`,saving:ge,onSave:e=>void Ee(e),onCancel:()=>me(null)}):(0,$.jsxs)(`div`,{className:`flex items-start gap-1`,children:[(0,$.jsx)(Gs,{className:`min-w-0 flex-1`,text:o.body.trim().length>0?o.body:`_No description provided._`,cwd:o.workspaceRoot,environmentId:r,threadRef:i}),ys(o)?(0,$.jsx)(Ss,{"aria-label":`Edit description`,onClick:()=>me(o.url)}):null]})}),t[49]=ge,t[50]=pe,t[51]=o,t[52]=r,t[53]=Ee,t[54]=i,t[55]=ze):ze=t[55];let Be;t[56]!==Re||t[57]!==ze?(Be=(0,$.jsx)(Ql,{title:`Description`,keepMounted:!0,children:ze},Re),t[56]=Re,t[57]=ze,t[58]=Be):Be=t[58];let Ve=`checks:${o.url}`,He;t[59]!==b||t[60]!==o.checks||t[61]!==C||t[62]!==h||t[63]!==w||t[64]!==ce||t[65]!==d?(He=b?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:`Check details are out of date.`}),(0,$.jsx)(G,{size:`xs`,variant:`ghost`,onClick:w,children:`Refresh`})]}):o.checks.length===0?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No checks reported.`}):o.checks.map((e,t)=>{let n={kind:`check`,check:e},r=e.status===`failure`||e.status===`cancelled`;return(0,$.jsxs)(`div`,{className:`group flex items-center gap-2 rounded-md pr-1 hover:bg-accent/60`,children:[(0,$.jsxs)(`button`,{type:`button`,disabled:!e.url,onClick:()=>e.url&&ce(e.url),className:K(`flex min-w-0 flex-1 items-start gap-2 rounded-md px-2 py-2 text-left text-xs leading-5 [&>svg]:mt-0.5`,e.url?`cursor-pointer`:`cursor-default`),children:[(0,$.jsx)(yr,{status:e.status}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 wrap-anywhere`,children:e.name}),(0,$.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:Cr(e)})]}),h&&r?(0,$.jsxs)(G,{size:`xs`,variant:`ghost`,className:`shrink-0`,disabled:d!=null,onClick:()=>h(n),children:[(0,$.jsx)(p,{className:`size-3`}),d===ni(n)?`Preparing...`:C]}):null]},`${t}:${e.name}:${e.url??``}`)}),t[59]=b,t[60]=o.checks,t[61]=C,t[62]=h,t[63]=w,t[64]=ce,t[65]=d,t[66]=He):He=t[66];let Ue;t[67]!==Ve||t[68]!==He?(Ue=(0,$.jsx)(Ql,{title:`Checks`,defaultOpen:!1,children:He},Ve),t[67]=Ve,t[68]=He,t[69]=Ue):Ue=t[69];let We=Ql,Ge=`Comments (${o.commentCount})`,Ke;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=(0,$.jsx)(G,{size:`xs`,variant:`ghost-muted`}),t[70]=Ke):Ke=t[70];let qe;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,$.jsx)(s,{"aria-hidden":!0,className:`size-3`}),t[71]=qe):qe=t[71];let Je=z>0?`${z} hidden`:`Filter`,Ye;t[72]===Je?Ye=t[73]:(Ye=(0,$.jsxs)(Ce,{render:Ke,"aria-label":`Filter comments`,children:[qe,Je]}),t[72]=Je,t[73]=Ye);let Xe;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(Xe=(0,$.jsx)(E,{children:`Show`}),t[74]=Xe):Xe=t[74];let Ze;t[75]===N?Ze=t[76]:(Ze=e=>N(t=>({...t,bots:e})),t[75]=N,t[76]=Ze);let Qe;t[77]!==j.bots||t[78]!==Ze?(Qe=(0,$.jsx)(k,{checked:j.bots,closeOnClick:!1,onCheckedChange:Ze,children:`Bot comments`}),t[77]=j.bots,t[78]=Ze,t[79]=Qe):Qe=t[79];let $e;t[80]===N?$e=t[81]:($e=e=>N(t=>({...t,resolved:e})),t[80]=N,t[81]=$e);let et;t[82]!==j.resolved||t[83]!==$e?(et=(0,$.jsx)(k,{checked:j.resolved,closeOnClick:!1,onCheckedChange:$e,children:`Resolved or dismissed`}),t[82]=j.resolved,t[83]=$e,t[84]=et):et=t[84];let tt;t[85]!==Qe||t[86]!==et?(tt=(0,$.jsx)(oe,{align:`end`,children:(0,$.jsxs)(Te,{children:[Xe,Qe,et]})}),t[85]=Qe,t[86]=et,t[87]=tt):tt=t[87];let nt;t[88]!==Ye||t[89]!==tt?(nt=(0,$.jsxs)(y,{children:[Ye,tt]}),t[88]=Ye,t[89]=tt,t[90]=nt):nt=t[90];let rt=H===`newest`?`Show oldest comments first`:`Show newest comments first`,it,at;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(it=()=>ee(iu),at=(0,$.jsx)(S,{"aria-hidden":!0,className:`size-3`}),t[91]=it,t[92]=at):(it=t[91],at=t[92]);let ot=H===`newest`?`Newest first`:`Oldest first`,st;t[93]!==rt||t[94]!==ot?(st=(0,$.jsxs)(G,{size:`xs`,variant:`ghost-muted`,"aria-label":rt,onClick:it,children:[at,ot]}),t[93]=rt,t[94]=ot,t[95]=st):st=t[95];let ct;t[96]!==nt||t[97]!==st?(ct=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[nt,st]}),t[96]=nt,t[97]=st,t[98]=ct):ct=t[98];let lt=c?(0,$.jsx)(gl,{}):u?(0,$.jsx)(vl,{compact:!0,error:u,onRetry:_}):(0,$.jsxs)($.Fragment,{children:[o.commentsTruncated?(0,$.jsxs)(`p`,{className:`mb-2 rounded-md border border-warning/30 bg-warning-surface px-2 py-1.5 text-xs`,children:[`This conversation is longer than this page reads in one go. The most recent`,` `,o.comments.length,` are here; open it on the host to read the rest.`]}):null,o.comments.length===0?(0,$.jsx)(`p`,{className:`py-2 text-xs text-muted-foreground`,children:`No comments yet.`}):R.length===0?(0,$.jsx)(`p`,{className:`py-2 text-xs text-muted-foreground`,children:z===1?`The only comment is hidden by the filter.`:`All ${z} comments are hidden by the filter.`}):(0,$.jsxs)(`div`,{className:`space-y-3`,children:[H===`oldest`?U:null,te.map(je),H===`newest`?U:null,A>$l?(0,$.jsxs)(G,{size:`sm`,variant:`ghost`,className:`w-full`,onClick:()=>O({url:o.url,count:$l}),children:[`Show only `,$l,` recent comments`]}):null]})]}),ut;t[99]!==We||t[100]!==Ge||t[101]!==ct||t[102]!==lt?(ut=(0,$.jsx)(We,{title:Ge,actions:ct,children:lt}),t[99]=We,t[100]=Ge,t[101]=ct,t[102]=lt,t[103]=ut):ut=t[103];let dt;return t[104]!==n||t[105]!==Le||t[106]!==Be||t[107]!==Ue||t[108]!==ut?(dt=(0,$.jsxs)(`div`,{ref:n,className:`h-full overflow-y-auto`,"data-pull-request-summary-scroll":!0,children:[Le,Be,Ue,ut]}),t[104]=n,t[105]=Le,t[106]=Be,t[107]=Ue,t[108]=ut,t[109]=dt):dt=t[109],dt}function iu(e){return e===`newest`?`oldest`:`newest`}function au(e){return(0,$.jsx)(Tr,{label:e,size:`default`,className:`max-w-48`},e.name)}function ou(e){let t=e.actor?.login??`ghost`,n=e.actor?.name&&e.actor.name!==t?`${e.actor.name} (@${t})`:t;return(0,$.jsxs)(X,{children:[(0,$.jsxs)(J,{render:(0,$.jsx)(`span`,{className:K(`relative rounded-full hover:z-10`,e.outcome?dr(e.outcome,e.stale):void 0)}),children:[(0,$.jsx)(wr,{actor:e.actor,tooltip:!1,variant:`avatar`}),e.outcome?(0,$.jsx)(`span`,{className:`sr-only`,children:e.stale?Dr(e.outcome):_r(e.outcome)}):null]}),(0,$.jsx)(Y,{side:`bottom`,children:e.outcome?`${n} — ${e.stale?Dr(e.outcome):_r(e.outcome)}`:n})]},e.key)}function su(e){console.error(e),gt.add({type:`error`,title:`Unable to open check details`})}function cu(e){return{key:e.key,actor:e.actor,outcome:e.outcome,stale:e.stale}}function lu(e){return e.actor?[[Gl(e.actor.login),e]]:[]}function uu(e){return e.author?.isBot===!0||e.author?.login.endsWith(`[bot]`)===!0}function du(e){return e.comments.map(t=>[t.id,e])}function fu(e){let t=(0,Q.c)(6),{body:n,markdown:r,cwd:i,environmentId:a,threadRef:o}=e,s;return t[0]!==n||t[1]!==i||t[2]!==a||t[3]!==r||t[4]!==o?(s=(0,$.jsx)(`div`,{className:`mt-3`,children:r?(0,$.jsx)(Gs,{text:n,cwd:i,environmentId:a,threadRef:o}):(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-xs text-muted-foreground`,children:n})}),t[0]=n,t[1]=i,t[2]=a,t[3]=r,t[4]=o,t[5]=s):s=t[5],s}function pu(e){let t=(0,Q.c)(2),{actor:n}=e,r=n?.login??`ghost`,i;return t[0]===r?i=t[1]:(i=(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:r}),t[0]=r,t[1]=i),i}function mu(e){let t=(0,Q.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=K(`absolute left-0 top-1/2 z-10 flex size-8 -translate-y-1/2 items-center justify-center bg-background`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,$.jsx)(`span`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function hu(e){let t=(0,Q.c)(5),{icon:n,className:r}=e,i;t[0]===n?i=t[1]:(i=(0,$.jsx)(`span`,{className:`flex size-7 items-center justify-center bg-background text-muted-foreground`,children:n}),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,$.jsx)(mu,{className:r,children:i}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function gu(e){let t=(0,Q.c)(5),{actors:n,className:r,fallback:i,muted:a}=e,o=a!==void 0&&a,s=n[0],c;return t[0]!==s||t[1]!==r||t[2]!==i||t[3]!==o?(c=s===void 0?(0,$.jsx)(hu,{className:r,icon:i}):(0,$.jsx)(mu,{className:r,children:(0,$.jsx)(xr,{actor:s,className:K(`size-7 bg-muted text-3xs transition-opacity`,o&&`opacity-45 grayscale`)})}),t[0]=s,t[1]=r,t[2]=i,t[3]=o,t[4]=c):c=t[4],c}function _u(e){return e.toLowerCase().replaceAll(`_`,` `).replaceAll(`-`,` `).replace(/^\w/u,e=>e.toUpperCase())}function vu(e){let t=(0,Q.c)(4),{state:n}=e,r;t[0]===n?r=t[1]:(r=_u(n),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,$.jsx)(`span`,{className:`text-3xs font-medium text-muted-foreground`,children:r}),t[2]=r,t[3]=i),i}function yu(e){let t=(0,Q.c)(3),{url:n,onOpen:r}=e,i;return t[0]!==r||t[1]!==n?(i=n===null?null:(0,$.jsx)(G,{size:`icon-xs`,variant:`ghost-muted`,className:`-mr-1 -mt-1 shrink-0`,"aria-label":`Open activity on host`,onClick:()=>r(n),children:(0,$.jsx)(O,{className:`size-3`})}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function bu(e){let t=(0,Q.c)(59),{event:n,editable:r,cwd:i,onOpen:a,reactions:o}=e,[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(!1),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d={reportFailure:!1},t[0]=d):d=t[0];let f=Dt(zr.updateComment,d),p;t[1]!==r||t[2]!==o||t[3]!==l||t[4]!==f?(p=async e=>{if(r===null||l||r.kind===`review`)return;u(!0);let t=await f({environmentId:o.environmentId,input:{...o.reference,commentId:r.id,kind:r.kind,body:e}});if(u(!1),t._tag===`Failure`){gt.add({type:`error`,title:`Could not save the comment`});return}c(!1),o.onRefresh()},t[1]=r,t[2]=o,t[3]=l,t[4]=f,t[5]=p):p=t[5];let m=p,h;t[6]===n.actor?h=t[7]:(h=(0,$.jsx)(pu,{actor:n.actor}),t[6]=n.actor,t[7]=h);let g;t[8]===n.title?g=t[9]:(g=(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:n.title}),t[8]=n.title,t[9]=g);let _;t[10]===n.reviewState?_=t[11]:(_=n.reviewState?(0,$.jsx)(vu,{state:n.reviewState}):null,t[10]=n.reviewState,t[11]=_);let v;t[12]!==h||t[13]!==g||t[14]!==_?(v=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1 text-xs`,children:[h,g,_]}),t[12]=h,t[13]=g,t[14]=_,t[15]=v):v=t[15];let y;t[16]===n.at?y=t[17]:(y=Cn(n.at),t[16]=n.at,t[17]=y);let b;t[18]===y?b=t[19]:(b=(0,$.jsx)(`span`,{children:y}),t[18]=y,t[19]=b);let x;t[20]===n.path?x=t[21]:(x=n.path?(0,$.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:[(0,$.jsx)(U,{"aria-hidden":!0,className:`size-3 shrink-0`}),(0,$.jsx)(`span`,{className:`truncate`,children:n.path})]}):null,t[20]=n.path,t[21]=x);let S;t[22]!==b||t[23]!==x?(S=(0,$.jsxs)(mr,{className:`mt-1 flex-wrap text-2xs text-muted-foreground`,children:[b,x]}),t[22]=b,t[23]=x,t[24]=S):S=t[24];let C;t[25]!==S||t[26]!==v?(C=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[v,S]}),t[25]=S,t[26]=v,t[27]=C):C=t[27];let w;t[28]!==r||t[29]!==s?(w=r!==null&&!s?(0,$.jsx)(Ss,{className:`-mt-1`,"aria-label":`Edit comment`,onClick:()=>c(!0)}):null,t[28]=r,t[29]=s,t[30]=w):w=t[30];let T;t[31]!==n.id||t[32]!==n.reactions||t[33]!==o.canReact||t[34]!==o.environmentId||t[35]!==o.onRefresh||t[36]!==o.reference?(T=o.canReact||n.reactions.length>0?(0,$.jsx)(oc,{className:`ml-auto justify-end`,reactions:n.reactions,canReact:o.canReact,subjectId:n.id,environmentId:o.environmentId,reference:o.reference,onRefresh:o.onRefresh}):null,t[31]=n.id,t[32]=n.reactions,t[33]=o.canReact,t[34]=o.environmentId,t[35]=o.onRefresh,t[36]=o.reference,t[37]=T):T=t[37];let E;t[38]!==n.url||t[39]!==a?(E=(0,$.jsx)(yu,{url:n.url,onOpen:a}),t[38]=n.url,t[39]=a,t[40]=E):E=t[40];let D;t[41]!==C||t[42]!==w||t[43]!==T||t[44]!==E?(D=(0,$.jsx)(`div`,{className:`px-2`,children:(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start gap-2`,children:[C,w,T,E]})}),t[41]=C,t[42]=w,t[43]=T,t[44]=E,t[45]=D):D=t[45];let O;t[46]!==i||t[47]!==r||t[48]!==s||t[49]!==n.body||t[50]!==n.markdown||t[51]!==o.environmentId||t[52]!==o.threadRef||t[53]!==m||t[54]!==l?(O=s&&r!==null?(0,$.jsx)(`div`,{className:`px-2 pb-2 pt-3`,children:(0,$.jsx)(Ks,{value:r.body,cwd:i,environmentId:o.environmentId,threadRef:o.threadRef,label:`Edit comment`,saving:l,onSave:e=>void m(e),onCancel:()=>c(!1)})}):n.body?(0,$.jsx)(`div`,{className:`px-2 pb-2`,children:(0,$.jsx)(fu,{body:n.body,markdown:n.markdown,cwd:i,environmentId:o.environmentId,threadRef:o.threadRef})}):null,t[46]=i,t[47]=r,t[48]=s,t[49]=n.body,t[50]=n.markdown,t[51]=o.environmentId,t[52]=o.threadRef,t[53]=m,t[54]=l,t[55]=O):O=t[55];let k;return t[56]!==D||t[57]!==O?(k=(0,$.jsxs)(`article`,{className:`group py-2`,children:[D,O]}),t[56]=D,t[57]=O,t[58]=k):k=t[58],k}function xu(e){let t=new Map;for(let n of e){let e=n.actor;e!==null&&!t.has(e.login)&&t.set(e.login,e)}return[...t.values()]}function Su(e){let t=(0,Q.c)(50),{events:n,editable:r,cwd:i,onOpen:a,reactions:o}=e,[s,c]=(0,Z.useState)(!1),l;t[0]===n?l=t[1]:(l=xu(n),t[0]=n,t[1]=l);let u=l,d=n[0];if(d===void 0)return null;let f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(Ae,{className:`size-3.5`}),t[2]=f):f=t[2];let p=!s,m;t[3]!==u||t[4]!==p?(m=(0,$.jsx)(gu,{actors:u,className:`top-6`,fallback:f,muted:p}),t[3]=u,t[4]=p,t[5]=m):m=t[5];let h=s?`text-foreground opacity-100`:`text-muted-foreground opacity-55`,g;t[6]===h?g=t[7]:(g=K(`flex w-full min-w-0 items-center gap-3 py-2 text-left transition-opacity hover:opacity-100`,h),t[6]=h,t[7]=g);let _;t[8]===n.length?_=t[9]:(_=n.length.toLocaleString(),t[8]=n.length,t[9]=_);let v=n.length===1?`comment`:`comments`,y;t[10]!==_||t[11]!==v?(y=(0,$.jsxs)(`span`,{className:`block text-xs font-semibold`,children:[_,` `,v]}),t[10]=_,t[11]=v,t[12]=y):y=t[12];let b;t[13]===u.length?b=t[14]:(b=u.length.toLocaleString(),t[13]=u.length,t[14]=b);let x=u.length===1?`author`:`authors`,S;t[15]===d.at?S=t[16]:(S=Cn(d.at),t[15]=d.at,t[16]=S);let C;t[17]!==b||t[18]!==x||t[19]!==S?(C=(0,$.jsxs)(`span`,{className:`block truncate text-3xs text-muted-foreground`,children:[b,` `,x,` ·`,` `,S]}),t[17]=b,t[18]=x,t[19]=S,t[20]=C):C=t[20];let w;t[21]!==C||t[22]!==y?(w=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[y,C]}),t[21]=C,t[22]=y,t[23]=w):w=t[23];let T=s&&`rotate-180`,E;t[24]===T?E=t[25]:(E=K(`size-3.5 shrink-0 text-muted-foreground transition-transform`,T),t[24]=T,t[25]=E);let D;t[26]===E?D=t[27]:(D=(0,$.jsx)(fe,{"aria-hidden":!0,className:E}),t[26]=E,t[27]=D);let O;t[28]!==w||t[29]!==D||t[30]!==g?(O=(0,$.jsxs)(xa,{className:g,children:[w,D]}),t[28]=w,t[29]=D,t[30]=g,t[31]=O):O=t[31];let k;t[32]!==i||t[33]!==r||t[34]!==n||t[35]!==a||t[36]!==s||t[37]!==o?(k=s?(0,$.jsx)(`div`,{className:`mt-1 space-y-1`,children:n.map(e=>(0,$.jsx)(bu,{event:e,editable:r.get(e.id)??null,cwd:i,onOpen:a,reactions:o},`${o.reference.projectId}#${o.reference.number}:${e.id}`))}):null,t[32]=i,t[33]=r,t[34]=n,t[35]=a,t[36]=s,t[37]=o,t[38]=k):k=t[38];let A;t[39]===k?A=t[40]:(A=(0,$.jsx)(ga,{children:k}),t[39]=k,t[40]=A);let j;t[41]!==O||t[42]!==A?(j=(0,$.jsxs)(`div`,{children:[O,A]}),t[41]=O,t[42]=A,t[43]=j):j=t[43];let M;t[44]!==s||t[45]!==j?(M=(0,$.jsx)(ua,{open:s,onOpenChange:c,children:j}),t[44]=s,t[45]=j,t[46]=M):M=t[46];let N;return t[47]!==M||t[48]!==m?(N=(0,$.jsxs)(`div`,{className:`relative mb-5 pl-12 [contain-intrinsic-block-size:48px] [content-visibility:auto]`,children:[m,M]}),t[47]=M,t[48]=m,t[49]=N):N=t[49],N}function Cu(e){let t=(0,Q.c)(33),{event:n,onOpen:r}=e,i=`View commit ${n.id}`,a;t[0]!==n.id||t[1]!==r?(a=()=>r(n.id),t[0]=n.id,t[1]=r,t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(pe,{className:`size-3.5`}),t[3]=o):o=t[3];let s;t[4]===n.commitAuthors?s=t[5]:(s=(0,$.jsx)(gu,{actors:n.commitAuthors,fallback:o}),t[4]=n.commitAuthors,t[5]=s);let c=n.body??`Untitled commit`,l;t[6]===c?l=t[7]:(l=(0,$.jsx)(`div`,{className:`truncate text-xs font-semibold text-foreground transition-colors group-hover:text-primary`,children:c}),t[6]=c,t[7]=l);let u;t[8]===n.id?u=t[9]:(u=n.id.slice(0,7),t[8]=n.id,t[9]=u);let d;t[10]===u?d=t[11]:(d=(0,$.jsx)(`code`,{className:`font-mono`,children:u}),t[10]=u,t[11]=d);let f;t[12]===n.at?f=t[13]:(f=Cn(n.at),t[12]=n.at,t[13]=f);let p;t[14]===f?p=t[15]:(p=(0,$.jsx)(`span`,{children:f}),t[14]=f,t[15]=p);let m;t[16]!==p||t[17]!==d?(m=(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-3xs text-muted-foreground`,children:[d,p]}),t[16]=p,t[17]=d,t[18]=m):m=t[18];let h;t[19]!==m||t[20]!==l?(h=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[l,m]}),t[19]=m,t[20]=l,t[21]=h):h=t[21];let g;t[22]!==n.additions||t[23]!==n.deletions?(g=n.additions!==null&&n.deletions!==null?(0,$.jsx)(Sr,{additions:n.additions,deletions:n.deletions,className:`ml-auto shrink-0 font-mono text-3xs`}):null,t[22]=n.additions,t[23]=n.deletions,t[24]=g):g=t[24];let _;t[25]!==h||t[26]!==g?(_=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5 py-1.5`,children:[h,g]}),t[25]=h,t[26]=g,t[27]=_):_=t[27];let v;return t[28]!==i||t[29]!==_||t[30]!==a||t[31]!==s?(v=(0,$.jsxs)(`button`,{type:`button`,className:`group relative mb-5 block w-full cursor-pointer rounded-sm pl-12 text-left outline-none [contain-intrinsic-block-size:48px] [content-visibility:auto] focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,"aria-label":i,onClick:a,children:[s,_]}),t[28]=i,t[29]=_,t[30]=a,t[31]=s,t[32]=v):v=t[32],v}function wu(e){let t=(0,Q.c)(21),{event:n}=e,r;t[0]===n.kind?r=t[1]:(r=n.kind===`opened`?{icon:(0,$.jsx)(Mr.pullRequest,{className:`size-3.5`}),label:`Pull request opened`}:n.kind===`merged`?{icon:(0,$.jsx)(Mr.merged,{className:`size-3.5`}),label:`Pull request merged`}:{icon:(0,$.jsx)(Mr.closed,{className:`size-3.5`}),label:`Pull request closed`},t[0]=n.kind,t[1]=r);let i=r,a;t[2]===i.icon?a=t[3]:(a=(0,$.jsx)(hu,{icon:i.icon}),t[2]=i.icon,t[3]=a);let o;t[4]===n.actor?o=t[5]:(o=n.actor?(0,$.jsx)(pu,{actor:n.actor}):null,t[4]=n.actor,t[5]=o);let s;t[6]===i.label?s=t[7]:(s=(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:i.label}),t[6]=i.label,t[7]=s);let c;t[8]!==o||t[9]!==s?(c=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[o,s]}),t[8]=o,t[9]=s,t[10]=c):c=t[10];let l;t[11]===n.at?l=t[12]:(l=Cn(n.at),t[11]=n.at,t[12]=l);let u;t[13]===l?u=t[14]:(u=(0,$.jsx)(`div`,{className:`mt-0.5 text-2xs text-muted-foreground`,children:l}),t[13]=l,t[14]=u);let d;t[15]!==c||t[16]!==u?(d=(0,$.jsxs)(`div`,{className:`py-1.5 text-xs`,children:[c,u]}),t[15]=c,t[16]=u,t[17]=d):d=t[17];let f;return t[18]!==a||t[19]!==d?(f=(0,$.jsxs)(`div`,{className:`relative mb-5 pl-12 [contain-intrinsic-block-size:48px] [content-visibility:auto]`,children:[a,d]}),t[18]=a,t[19]=d,t[20]=f):f=t[20],f}function Tu(e){let t=(0,Q.c)(69),{event:n,outcome:r,stale:i,cwd:a,onOpen:o,reactions:s}=e,c;t[0]===n.actor?c=t[1]:(c=n.actor?[n.actor]:[],t[0]=n.actor,t[1]=c);let l;t[2]===r?l=t[3]:(l=(0,$.jsx)(hr,{outcome:r}),t[2]=r,t[3]=l);let u;t[4]!==c||t[5]!==l?(u=(0,$.jsx)(gu,{actors:c,className:`top-6`,fallback:l}),t[4]=c,t[5]=l,t[6]=u):u=t[6];let d;t[7]===n.actor?d=t[8]:(d=(0,$.jsx)(pu,{actor:n.actor}),t[7]=n.actor,t[8]=d);let f=!i,p;t[9]!==r||t[10]!==i?(p=K(`font-medium lowercase`,i?`text-muted-foreground opacity-70`:kr(r)),t[9]=r,t[10]=i,t[11]=p):p=t[11];let m;t[12]===p?m=t[13]:(m=(0,$.jsx)(`span`,{className:p}),t[12]=p,t[13]=m);let h;t[14]===r?h=t[15]:(h=_r(r),t[14]=r,t[15]=h);let g;t[16]===i?g=t[17]:(g=i?(0,$.jsx)(`span`,{className:`sr-only`,children:`, before the latest commits`}):null,t[16]=i,t[17]=g);let _;t[18]!==m||t[19]!==h||t[20]!==g?(_=(0,$.jsxs)(J,{render:m,children:[h,g]}),t[18]=m,t[19]=h,t[20]=g,t[21]=_):_=t[21];let v;t[22]===r?v=t[23]:(v=Dr(r),t[22]=r,t[23]=v);let y;t[24]===v?y=t[25]:(y=(0,$.jsx)(Y,{children:v}),t[24]=v,t[25]=y);let b;t[26]!==_||t[27]!==y||t[28]!==f?(b=(0,$.jsxs)(X,{disabled:f,children:[_,y]}),t[26]=_,t[27]=y,t[28]=f,t[29]=b):b=t[29];let x;t[30]!==b||t[31]!==d?(x=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1 text-xs`,children:[d,b]}),t[30]=b,t[31]=d,t[32]=x):x=t[32];let S;t[33]===n.at?S=t[34]:(S=Cn(n.at),t[33]=n.at,t[34]=S);let C;t[35]===S?C=t[36]:(C=(0,$.jsx)(`span`,{children:S}),t[35]=S,t[36]=C);let w;t[37]===n.path?w=t[38]:(w=n.path?(0,$.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:[(0,$.jsx)(U,{"aria-hidden":!0,className:`size-3 shrink-0`}),(0,$.jsx)(`span`,{className:`truncate`,children:n.path})]}):null,t[37]=n.path,t[38]=w);let T;t[39]!==C||t[40]!==w?(T=(0,$.jsx)(`div`,{className:`mt-0.5 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:(0,$.jsxs)(mr,{className:`flex-wrap text-2xs text-muted-foreground`,children:[C,w]})}),t[39]=C,t[40]=w,t[41]=T):T=t[41];let E;t[42]!==x||t[43]!==T?(E=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,T]}),t[42]=x,t[43]=T,t[44]=E):E=t[44];let D;t[45]!==n.id||t[46]!==n.reactions||t[47]!==s.canReact||t[48]!==s.environmentId||t[49]!==s.onRefresh||t[50]!==s.reference?(D=s.canReact||n.reactions.length>0?(0,$.jsx)(oc,{className:`ml-auto justify-end`,reactions:n.reactions,canReact:s.canReact,subjectId:n.id,environmentId:s.environmentId,reference:s.reference,onRefresh:s.onRefresh}):null,t[45]=n.id,t[46]=n.reactions,t[47]=s.canReact,t[48]=s.environmentId,t[49]=s.onRefresh,t[50]=s.reference,t[51]=D):D=t[51];let O;t[52]!==n.url||t[53]!==o?(O=(0,$.jsx)(yu,{url:n.url,onOpen:o}),t[52]=n.url,t[53]=o,t[54]=O):O=t[54];let k;t[55]!==E||t[56]!==D||t[57]!==O?(k=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start gap-2 py-1.5`,children:[E,D,O]}),t[55]=E,t[56]=D,t[57]=O,t[58]=k):k=t[58];let A;t[59]!==a||t[60]!==n.body||t[61]!==n.markdown||t[62]!==s.environmentId||t[63]!==s.threadRef?(A=n.body?(0,$.jsx)(fu,{body:n.body,markdown:n.markdown,cwd:a,environmentId:s.environmentId,threadRef:s.threadRef}):null,t[59]=a,t[60]=n.body,t[61]=n.markdown,t[62]=s.environmentId,t[63]=s.threadRef,t[64]=A):A=t[64];let j;return t[65]!==k||t[66]!==A||t[67]!==u?(j=(0,$.jsxs)(`div`,{className:`group relative mb-5 pl-12 [contain-intrinsic-block-size:48px] [content-visibility:auto]`,children:[u,k,A]}),t[65]=k,t[66]=A,t[67]=u,t[68]=j):j=t[68],j}function Eu(e){let t=(0,Q.c)(38),{scrollerRef:n,detail:r,environmentId:i,threadRef:a,reference:o,order:s,onOpenCommit:c,onRefresh:l}=e,u=a===void 0?null:a,d,f,p,m,h,g,_;if(t[0]!==r||t[1]!==i||t[2]!==c||t[3]!==l||t[4]!==s||t[5]!==o||t[6]!==n||t[7]!==u){d=gi(r);let e=ri(r.commits),a=r.capabilities.reactions===!0,v;t[15]!==i||t[16]!==l||t[17]!==o||t[18]!==a||t[19]!==u?(v={canReact:a,environmentId:i,threadRef:u,reference:o,onRefresh:l},t[15]=i,t[16]=l,t[17]=o,t[18]=a,t[19]=u,t[20]=v):v=t[20];let y=v,b;t[21]===r?b=t[22]:(b=new Map(r.comments.filter(e=>bs(r,e)).map(Ou)),t[21]=r,t[22]=b);let x=b,S=s===`newest`?d:d.toReversed(),C=ki(S),w=Du;g=n,_=`scrollbar-gutter-both h-full overflow-y-auto px-4 py-5`,h=`mx-auto max-w-3xl`,f=`relative`,t[23]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(`span`,{"aria-hidden":!0,className:`absolute bottom-5 left-[15px] top-1 w-px bg-border/45`}),t[23]=p):p=t[23],m=C.map(t=>{if(t.kind===`comments`)return(0,$.jsx)(Su,{events:t.events,editable:x,cwd:r.workspaceRoot,onOpen:w,reactions:y},`comments:${t.events[0]?.id??`empty`}`);let n=t.event;if(n.kind===`commit`)return(0,$.jsx)(Cu,{event:n,onOpen:c},n.id);let i=Qr(n.reviewState);return i===null?(0,$.jsx)(wu,{event:n},n.id):(0,$.jsx)(Tu,{event:n,outcome:i,stale:Jr(n.at,e),cwd:r.workspaceRoot,onOpen:w,reactions:y},n.id)}),t[0]=r,t[1]=i,t[2]=c,t[3]=l,t[4]=s,t[5]=o,t[6]=n,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g,t[14]=_}else d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13],_=t[14];let v;t[24]!==f||t[25]!==p||t[26]!==m?(v=(0,$.jsxs)(`div`,{className:f,children:[p,m]}),t[24]=f,t[25]=p,t[26]=m,t[27]=v):v=t[27];let y;t[28]===d.length?y=t[29]:(y=d.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 text-center text-muted-foreground`,children:[(0,$.jsx)(Mr.pullRequest,{className:`mb-2 size-5`}),(0,$.jsx)(`p`,{className:`text-xs`,children:`No activity yet.`})]}):null,t[28]=d.length,t[29]=y);let b;t[30]!==h||t[31]!==v||t[32]!==y?(b=(0,$.jsxs)(`div`,{className:h,children:[v,y]}),t[30]=h,t[31]=v,t[32]=y,t[33]=b):b=t[33];let x;return t[34]!==b||t[35]!==g||t[36]!==_?(x=(0,$.jsx)(`div`,{ref:g,className:_,children:b}),t[34]=b,t[35]=g,t[36]=_,t[37]=x):x=t[37],x}function Du(e){bt()?.shell.openExternal(e)}function Ou(e){return[e.id,e]}function ku(e){let t=(0,Q.c)(10),{environmentId:n,reference:r,threadRef:i}=e,a;t[0]!==n||t[1]!==r?(a=zr.detail({environmentId:n,input:r}),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=Et(a);if(o.error!==null){let e;return t[3]===o.error?e=t[4]:(e=(0,$.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:o.error}),t[3]=o.error,t[4]=e),e}if(o.data===null){let e=o.isPending?`Loading checks…`:`No checks reported`,n;return t[5]===e?n=t[6]:(n=(0,$.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:e}),t[5]=e,t[6]=n),n}let s;return t[7]!==o.data.checks||t[8]!==i?(s=(0,$.jsx)(Au,{checks:o.data.checks,threadRef:i}),t[7]=o.data.checks,t[8]=i,t[9]=s):s=t[9],s}function Au(e){let t=(0,Q.c)(23),{checks:n,threadRef:r}=e,i=lr(r),[a,o]=(0,Z.useState)(!1),s,c,l,u,d,f;if(t[0]!==n||t[1]!==i||t[2]!==a){f=Symbol.for(`react.early_return_sentinel`);bb0:{let{attention:e,running:r,completed:o}=fi(n);c=e.length+r.length>0&&o.length>0;let p=[...e,...r,...a||!c?o:[]];if(n.length===0){let e;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`No checks reported`}),t[9]=e):e=t[9],f=e;break bb0}s=Rn,d=`max-h-64`,l=`flex flex-col gap-1`,u=p.map((e,t)=>(0,$.jsxs)(`li`,{className:`flex items-center gap-2 text-xs`,children:[(0,$.jsx)(yr,{status:e.status}),(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name})}),(0,$.jsx)(Y,{side:`top`,children:e.description??e.name})]}),(0,$.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:Cr(e)}),e.url===null?null:(0,$.jsx)(`button`,{type:`button`,className:`shrink-0 text-primary hover:underline`,onClick:()=>{e.url&&i(e.url).catch(ju)},children:`Details`})]},`${t}:${e.name}`))}t[0]=n,t[1]=i,t[2]=a,t[3]=s,t[4]=c,t[5]=l,t[6]=u,t[7]=d,t[8]=f}else s=t[3],c=t[4],l=t[5],u=t[6],d=t[7],f=t[8];if(f!==Symbol.for(`react.early_return_sentinel`))return f;let p;t[10]!==l||t[11]!==u?(p=(0,$.jsx)(`ul`,{className:l,children:u}),t[10]=l,t[11]=u,t[12]=p):p=t[12];let m;t[13]!==s||t[14]!==d||t[15]!==p?(m=(0,$.jsx)(s,{className:d,children:p}),t[13]=s,t[14]=d,t[15]=p,t[16]=m):m=t[16];let h;t[17]!==c||t[18]!==a?(h=c?(0,$.jsx)(G,{variant:`ghost`,size:`xs`,"aria-expanded":a,onClick:()=>o(!a),children:a?`Show less`:`Show all`}):null,t[17]=c,t[18]=a,t[19]=h):h=t[19];let g;return t[20]!==m||t[21]!==h?(g=(0,$.jsxs)($.Fragment,{children:[m,h]}),t[20]=m,t[21]=h,t[22]=g):g=t[22],g}function ju(e){console.error(e),gt.add({type:`error`,title:`Unable to open check details`})}function Mu(e){let t=(0,Q.c)(65),{checksState:n,checks:r,stale:i,environmentId:a,reference:o,threadRef:s,variant:c,className:l,render:u}=e,d=i!==void 0&&i,f=s===void 0?null:s,p=c===void 0?`icon`:c,m,h,g,_,v,y,b,x,S,C,w,T,E;if(t[0]!==r||t[1]!==n||t[2]!==l||t[3]!==u||t[4]!==d||t[5]!==p){v=vr(n);let e;t[19]===r?e=t[20]:(e=r?.filter(Fu).length??0,t[19]=r,t[20]=e),y=e;let i;t[21]===r?i=t[22]:(i=r?.filter(Pu).length??0,t[21]=r,t[22]=i),_=i;let a;t[23]!==r||t[24]!==d?(a=r===void 0||d?null:Or(r),t[23]=r,t[24]=d,t[25]=a):a=t[25],b=a,g=Gr,h=Wr,C=p===`count`,w=p===`count`?`Open checks: ${b??v.label}`:`Checks: ${v.label}`,t[26]!==l||t[27]!==u||t[28]!==p?(T=p===`count`?u??(0,$.jsx)(G,{variant:`ghost`,size:`sm`,className:l}):(0,$.jsx)(`span`,{role:`button`,tabIndex:0,className:K(`inline-flex shrink-0 cursor-pointer items-center`,l)}),t[26]=l,t[27]=u,t[28]=p,t[29]=T):T=t[29],E=Nu,m=v.Icon,x=!0,S=K(`size-3.5`,v.toneClassName),t[0]=r,t[1]=n,t[2]=l,t[3]=u,t[4]=d,t[5]=p,t[6]=m,t[7]=h,t[8]=g,t[9]=_,t[10]=v,t[11]=y,t[12]=b,t[13]=x,t[14]=S,t[15]=C,t[16]=w,t[17]=T,t[18]=E}else m=t[6],h=t[7],g=t[8],_=t[9],v=t[10],y=t[11],b=t[12],x=t[13],S=t[14],C=t[15],w=t[16],T=t[17],E=t[18];let D;t[30]!==m||t[31]!==x||t[32]!==S?(D=(0,$.jsx)(m,{"aria-hidden":x,className:S}),t[30]=m,t[31]=x,t[32]=S,t[33]=D):D=t[33];let O;t[34]!==r||t[35]!==_||t[36]!==y||t[37]!==p?(O=p===`count`?(0,$.jsx)($.Fragment,{children:r!==void 0&&y>0?(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[y,`/`,r.length]}):_>0?(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[_,` failed`]}):null}):null,t[34]=r,t[35]=_,t[36]=y,t[37]=p,t[38]=O):O=t[38];let k;t[39]!==h||t[40]!==D||t[41]!==O||t[42]!==C||t[43]!==w||t[44]!==T||t[45]!==E?(k=(0,$.jsxs)(h,{nativeButton:C,"aria-label":w,render:T,onClick:E,children:[D,O]}),t[39]=h,t[40]=D,t[41]=O,t[42]=C,t[43]=w,t[44]=T,t[45]=E,t[46]=k):k=t[46];let A;t[47]===v.label?A=t[48]:(A=(0,$.jsx)(`p`,{className:`mb-2 font-medium text-sm`,children:v.label}),t[47]=v.label,t[48]=A);let j;t[49]===b?j=t[50]:(j=b===null?null:(0,$.jsx)(`p`,{className:`mb-2 text-muted-foreground text-xs`,children:b}),t[49]=b,t[50]=j);let M;t[51]!==r||t[52]!==a||t[53]!==o||t[54]!==d||t[55]!==f?(M=d?(0,$.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Check details are out of date. Refresh the pull request to update them.`}):r===void 0?a!==void 0&&o!==void 0?(0,$.jsx)(ku,{environmentId:a,reference:o,threadRef:f}):null:(0,$.jsx)(Au,{checks:r,threadRef:f}),t[51]=r,t[52]=a,t[53]=o,t[54]=d,t[55]=f,t[56]=M):M=t[56];let N;t[57]!==A||t[58]!==j||t[59]!==M?(N=(0,$.jsxs)(Hr,{align:`start`,width:`md`,side:`bottom`,children:[A,j,M]}),t[57]=A,t[58]=j,t[59]=M,t[60]=N):N=t[60];let P;return t[61]!==g||t[62]!==k||t[63]!==N?(P=(0,$.jsxs)(g,{children:[k,N]}),t[61]=g,t[62]=k,t[63]=N,t[64]=P):P=t[64],P}function Nu(e){return e.stopPropagation()}function Pu(e){return e.status===`failure`||e.status===`cancelled`}function Fu(e){return e.status===`pending`}var Iu=(0,Z.createContext)(null);function Lu(e){let t=(0,Q.c)(7),{text:n,plain:r,className:i}=e,a=r!==void 0&&r,o=(0,Z.useContext)(Iu);if(a||o===null)return n;let s=o.cwd,c=o.environmentId,l;t[0]===i?l=t[1]:(l=K(`space-y-0 [&_.chat-markdown]:text-inherit`,i),t[0]=i,t[1]=l);let u;return t[2]!==o.cwd||t[3]!==o.environmentId||t[4]!==l||t[5]!==n?(u=(0,$.jsx)(Gs,{text:n,cwd:s,environmentId:c,className:l}),t[2]=o.cwd,t[3]=o.environmentId,t[4]=l,t[5]=n,t[6]=u):u=t[6],u}function Ru(e,t,n){return Math.max(Math.min(e+t,n-1),0)}function zu(e){return[...new Set([...e.excerpts.map(e=>e.path),...e.files.map(e=>e.path)])]}function Bu(e){let t=zu(e).length;return t===0?`Context, no code`:t===1?`1 file`:`${t} files`}function Vu(e){return e<26?String.fromCharCode(65+e):String(e+1)}function Hu(e){let t=[];return e.hunks.forEach((n,r)=>{let i=n.deletionStart,a=n.additionStart;for(let o of n.hunkContent){if(o.type===`context`){for(let n=0;n<o.lines;n+=1)t.push({kind:`context`,oldLine:i,newLine:a,oldAt:i,newAt:a,text:e.additionLines[o.additionLineIndex+n]??``,hunk:r}),i+=1,a+=1;continue}for(let n=0;n<o.deletions;n+=1)t.push({kind:`deletion`,oldLine:i,newLine:null,oldAt:i,newAt:a,text:e.deletionLines[o.deletionLineIndex+n]??``,hunk:r}),i+=1;for(let n=0;n<o.additions;n+=1)t.push({kind:`addition`,oldLine:null,newLine:a,oldAt:i,newAt:a,text:e.additionLines[o.additionLineIndex+n]??``,hunk:r}),a+=1}}),t}function Uu(e,t){let n=e=>t.side===`new`?e.newLine:e.oldLine,r=e=>{let r=n(e);return r!==null&&r>=t.start&&r<=t.end},i=e.findIndex(r);if(i===-1)return[];let a=e.findLastIndex(r),o=(t,n)=>e[t]?.hunk===e[n]?.hunk;if(t.side===`new`&&e[i]?.kind===`addition`)for(;i>0&&e[i-1]?.kind===`deletion`&&o(i-1,i);)--i;if(t.side===`old`&&e[a]?.kind===`deletion`)for(;a<e.length-1&&e[a+1]?.kind===`addition`&&o(a+1,a);)a+=1;return e.slice(i,a+1)}var Wu={context:` `,addition:`+`,deletion:`-`};function Gu(e,t,n){if(n.length===0)return``;let r=[`diff --git a/${t} b/${e}`,`--- a/${t}`,`+++ b/${e}`],i=0;for(;i<n.length;){let e=i;for(;e+1<n.length&&n[e+1]?.hunk===n[i]?.hunk;)e+=1;let t=n.slice(i,e+1),a=t[0],o=t.filter(e=>e.oldLine!==null).length,s=t.filter(e=>e.newLine!==null).length,c=o===0?Math.max(a.oldAt-1,0):a.oldAt,l=s===0?Math.max(a.newAt-1,0):a.newAt;r.push(`@@ -${c},${o} +${l},${s} @@`);for(let e of t)r.push(`${Wu[e.kind]}${e.text.replace(/\r?\n$/,``)}`);i=e+1}return`${r.join(`
208
208
  `)}\n`}function Ku(e,t){let n=t[0];if(n===void 0||t.some(e=>e.hunk!==n.hunk))return null;let r=e.match(/[^\n]*\n|[^\n]+$/g)??[],i=n.newAt-1,a=t.filter(e=>e.newLine!==null).length,o=n.oldAt-1,s=r.slice(0,i),c=o>=s.length?[...Array.from({length:o-s.length},()=>`
209
209
  `),...s]:s.slice(s.length-o),l=t.filter(e=>e.oldLine!==null).map(e=>e.text.endsWith(`
210
210
  `)?e.text:`${e.text}\n`);return[...c,...l,...r.slice(i+a)].join(``)}function qu(e){let t=e.notes.map((e,t)=>({marker:Vu(t),note:e}));return{lettered:t,byExcerpt:e.excerpts.map(e=>{let n=new Map;for(let{marker:r,note:i}of t){if(i.path!==e.path||i.line<e.start||i.line>e.end)continue;let t={marker:r,title:i.title},a=n.get(i.line);a===void 0?n.set(i.line,[t]):a.push(t)}return[...n].map(([e,t])=>({line:e,markers:t}))})}}function Ju(e){let t=(0,Q.c)(15),{stops:n,position:r,seen:i,onSelect:a}=e,o=i.size,s;t[0]!==a||t[1]!==r||t[2]!==i?(s=(e,t)=>(0,$.jsx)(`li`,{children:(0,$.jsx)(Yu,{active:r===t,onClick:()=>a(t),lead:(0,$.jsx)(Xu,{number:t+1,seen:i.has(t)}),title:e.title,detail:(0,$.jsxs)($.Fragment,{children:[e.attention===null?null:(0,$.jsx)(te,{size:`sm`,variant:`warning`,children:`Look closely`}),(0,$.jsx)(`span`,{children:Bu(e)})]})})},t),t[0]=a,t[1]=r,t[2]=i,t[3]=s):s=t[3];let c=s,l;t[4]!==o||t[5]!==n.length?(l=(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground tabular-nums @max-[56rem]/guide:hidden`,children:[o,` of `,n.length,` read`]}),t[4]=o,t[5]=n.length,t[6]=l):l=t[6];let u;t[7]!==c||t[8]!==n?(u=n.map(c),t[7]=c,t[8]=n,t[9]=u):u=t[9];let d;t[10]===u?d=t[11]:(d=(0,$.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,$.jsx)(`ol`,{className:`flex flex-col gap-0.5`,children:u})}),t[10]=u,t[11]=d);let f;return t[12]!==l||t[13]!==d?(f=(0,$.jsxs)(`nav`,{"aria-label":`Review tour`,className:`flex min-h-0 flex-col gap-4`,children:[l,d]}),t[12]=l,t[13]=d,t[14]=f):f=t[14],f}function Yu(e){let t=(0,Q.c)(15),{active:n,onClick:r,lead:i,title:a,detail:o}=e,s=n?`step`:void 0,c=n?`bg-accent text-accent-foreground`:`hover:bg-accent/50`,l;t[0]===c?l=t[1]:(l=K(`flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,c),t[0]=c,t[1]=l);let u;t[2]===a?u=t[3]:(u=(0,$.jsx)(`span`,{className:`text-sm text-foreground`,children:a}),t[2]=a,t[3]=u);let d;t[4]===o?d=t[5]:(d=o===null?null:(0,$.jsx)(`span`,{className:`flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:o}),t[4]=o,t[5]=d);let f;t[6]!==u||t[7]!==d?(f=(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[u,d]}),t[6]=u,t[7]=d,t[8]=f):f=t[8];let p;return t[9]!==i||t[10]!==r||t[11]!==s||t[12]!==l||t[13]!==f?(p=(0,$.jsxs)(`button`,{type:`button`,"aria-current":s,onClick:r,className:l,children:[i,f]}),t[9]=i,t[10]=r,t[11]=s,t[12]=l,t[13]=f,t[14]=p):p=t[14],p}function Xu(e){let t=(0,Q.c)(8),{number:n,seen:r}=e,i=r?`border-success/40 text-success-foreground`:`border-border text-muted-foreground`,a;t[0]===i?a=t[1]:(a=K(`flex size-5 shrink-0 items-center justify-center rounded-full border text-2xs tabular-nums`,i),t[0]=i,t[1]=a);let o;t[2]!==n||t[3]!==r?(o=r?(0,$.jsx)(me,{"aria-label":`Stop ${n}, read`,className:`size-3`}):n,t[2]=n,t[3]=r,t[4]=o):o=t[4];let s;return t[5]!==a||t[6]!==o?(s=(0,$.jsx)(`span`,{className:a,children:o}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Zu(e){let t=(0,Q.c)(2),{marker:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`span`,{"aria-hidden":!0,className:`inline-flex size-4.5 shrink-0 items-center justify-center rounded-full bg-info/16 font-medium text-3xs text-info-foreground tabular-nums`,children:n}),t[0]=n,t[1]=r),r}function Qu(e){let t=(0,Q.c)(12),{notes:n,className:r}=e;if(n.length===0)return null;let i;t[0]===r?i=t[1]:(i=K(`flex min-w-0 flex-col gap-2`,r),t[0]=r,t[1]=i);let a=n.length===1?`1 note`:`${n.length} notes`,o;t[2]===a?o=t[3]:(o=(0,$.jsxs)(`h4`,{className:`flex items-baseline justify-between gap-2 text-xs font-medium text-foreground`,children:[`Notes on this stop`,(0,$.jsx)(`span`,{className:`font-normal text-muted-foreground tabular-nums`,children:a})]}),t[2]=a,t[3]=o);let s;t[4]===n?s=t[5]:(s=n.map($u),t[4]=n,t[5]=s);let c;t[6]===s?c=t[7]:(c=(0,$.jsx)(`ol`,{className:`flex flex-col gap-3`,children:s}),t[6]=s,t[7]=c);let l;return t[8]!==i||t[9]!==o||t[10]!==c?(l=(0,$.jsxs)(`section`,{className:i,children:[o,c]}),t[8]=i,t[9]=o,t[10]=c,t[11]=l):l=t[11],l}function $u(e){let{marker:t,note:n}=e;return(0,$.jsxs)(`li`,{className:`flex min-w-0 gap-2`,children:[(0,$.jsx)(Zu,{marker:t}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,$.jsxs)(`p`,{className:`flex flex-wrap items-baseline gap-x-2 text-xs`,children:[(0,$.jsx)(`span`,{className:`font-medium text-foreground`,children:n.title}),(0,$.jsxs)(`span`,{className:`truncate font-mono text-2xs text-muted-foreground`,children:[n.path.split(`/`).at(-1),`:`,n.line]})]}),n.body.trim()===``?null:(0,$.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:(0,$.jsx)(Lu,{text:n.body})})]})]},t)}var ed=`${Wo}
211
211
  [data-code]::-webkit-scrollbar-thumb {
212
212
  background-color: var(--diffs-bg-context);
213
213
  }
214
- `;function td(e){let t=(0,Q.c)(60),{excerpt:n,file:r,loading:i,notes:s,commenting:c,loadDiffFiles:l,onOpenFile:u}=e,[d,f]=(0,Z.useState)(null),{resolvedTheme:p}=Ot(),m;if(t[0]!==n||t[1]!==r){bb0:{if(r===null){m=null;break bb0}let e=Hu(r),i=Uu(e,n);if(i.length===0){m=null;break bb0}let a=It(Gu(n.path,Lt(r),i),`pull-request-guide-excerpt:${n.path}:${n.side}:${n.start}-${n.end}`),o=a?.kind===`files`?a.files[0]:void 0;if(o===void 0){m=null;break bb0}let s={additions:new Set(i.flatMap(ad)),deletions:new Set(i.flatMap(id))},c;t[3]!==s||t[4]!==o||t[5]!==e||t[6]!==i?(c={fileDiff:o,rows:i,shown:i.length,total:e.length,drawn:s},t[3]=s,t[4]=o,t[5]=e,t[6]=i,t[7]=c):c=t[7],m=c}t[0]=n,t[1]=r,t[2]=m}else m=t[2];let h=m,g=h?.rows??null,v;bb1:{if(g===null||g.some(e=>e.hunk!==g[0]?.hunk)){v=null;break bb1}let e;t[8]!==n.end||t[9]!==n.side||t[10]!==n.start||t[11]!==l||t[12]!==g?(e=async e=>{let t=await l(e),r=Ku(t.newFile.contents,g);return r===null?t:{newFile:t.newFile,oldFile:{name:t.oldFile?.name??t.newFile.name,contents:r,cacheKey:`${t.newFile.cacheKey??t.newFile.name}:excerpt:${n.side}:${n.start}-${n.end}`}}},t[8]=n.end,t[9]=n.side,t[10]=n.start,t[11]=l,t[12]=g,t[13]=e):e=t[13],v=e}let y=v,b;t[14]!==c?.pending||t[15]!==d||t[16]!==n.path||t[17]!==n.side||t[18]!==s||t[19]!==h?.drawn?(b=()=>{let e=new Map,t=(t,n)=>{let r=`${t}:${n}`,i=e.get(r);if(i!==void 0)return i;let a={side:t,lineNumber:n,metadata:{markers:[],pending:[],draft:!1}};return e.set(r,a),a},r=(n,r,i)=>{let a=t(n,r);e.set(`${n}:${r}`,{...a,metadata:i(a.metadata)})},i=n.side===`new`?`additions`:`deletions`;for(let e of s)r(i,e.line,t=>({...t,markers:[...t.markers,...e.markers]}));for(let e of c?.pending??[]){if(e.path!==n.path)continue;let t=uc(e.position),i=lc(t.side);h?.drawn[i].has(t.line)&&r(i,t.line,t=>({...t,pending:[...t.pending,e]}))}if(d!==null){let e=uc(d.position);r(lc(e.side),e.line,rd)}return[...e.values()]},t[14]=c?.pending,t[15]=d,t[16]=n.path,t[17]=n.side,t[18]=s,t[19]=h?.drawn,t[20]=b):b=t[20],c?.pending;let x;t[21]===b?x=t[22]:(x=b(),t[21]=b,t[22]=x);let S=x,C;t[23]===r?C=t[24]:(C=e=>{if(e===null||r===null)return;let t=_(r,e.end,e.endSide??e.side);t!==null&&f({range:e,position:t})},t[23]=r,t[24]=C);let w=C,T=c!==null&&d===null,E=c?.onAskAgent??null,D;t[25]!==d||t[26]!==n.path||t[27]!==r||t[28]!==E?(D=e=>{if(d===null||r===null||E===null)return;let t=o({id:`pull-request-guide:${n.path}:${d.range.start}:${d.range.end}`,sectionId:`pull-request-guide:${n.path}`,sectionTitle:`Review guide`,filePath:n.path,fileDiff:r,range:d.range,text:e});f(null),t!==null&&E(t,e)},t[25]=d,t[26]=n.path,t[27]=r,t[28]=E,t[29]=D):D=t[29];let O=D,k;t[30]===p?k=t[31]:(k=zt(p),t[30]=p,t[31]=k);let A;t[32]===y?A=t[33]:(A=y===null?{hunkSeparators:`simple`}:{loadDiffFiles:y},t[32]=y,t[33]=A);let j;t[34]!==w||t[35]!==T||t[36]!==p||t[37]!==k||t[38]!==A?(j={diffStyle:`unified`,lineDiffType:`none`,overflow:`scroll`,theme:k,themeType:p,preferredHighlighter:ma,unsafeCSS:ed,enableGutterUtility:T,enableLineSelection:T,onGutterUtilityClick:w,onLineSelectionEnd:w,...A},t[34]=w,t[35]=T,t[36]=p,t[37]=k,t[38]=A,t[39]=j):j=t[39];let M=j,N;t[40]===n.caption?N=t[41]:(N=n.caption.trim()===``?null:(0,$.jsx)(`figcaption`,{className:`text-xs text-muted-foreground`,children:(0,$.jsx)(Lu,{text:n.caption,plain:!0})}),t[40]=n.caption,t[41]=N);let P;t[42]!==S||t[43]!==O||t[44]!==c||t[45]!==d||t[46]!==n.end||t[47]!==n.path||t[48]!==n.side||t[49]!==n.start||t[50]!==r||t[51]!==i||t[52]!==E||t[53]!==u||t[54]!==M||t[55]!==h?(P=h===null?i?(0,$.jsxs)(`p`,{className:`rounded-lg border border-border/60 px-3 py-2 text-xs text-muted-foreground`,children:[`Loading `,n.path,`...`]}):(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-border/60 px-3 py-2 text-xs text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`min-w-0 truncate`,children:[(0,$.jsx)(`span`,{className:`font-mono text-foreground`,children:n.path}),` lines `,n.start,`-`,n.end,` are not in the loaded diff.`]}),(0,$.jsx)(G,{size:`xs`,variant:`outline`,onClick:()=>u(n.path),children:`Open in Code`})]}):(0,$.jsx)(`div`,{className:`min-w-0 overflow-hidden rounded-lg border border-border/60`,children:(0,$.jsx)(hn,{fileDiff:h.fileDiff,options:M,lineAnnotations:S,selectedLines:d?.range??null,renderAnnotation:e=>(0,$.jsxs)(`div`,{className:`font-sans`,children:[e.metadata.markers.length>0?(0,$.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 px-3 py-1 text-xs`,children:e.metadata.markers.map(nd)}):null,e.metadata.pending.map(e=>(0,$.jsx)(dc,{comment:e,onRemove:()=>c?.onRemove(e.id)},e.id)),e.metadata.draft&&d!==null&&c!==null?(0,$.jsx)(Sn,{kind:`draft`,rangeLabel:`${n.path}:${uc(d.position).line}`,text:``,placeholder:c.canComment?`Add a comment…`:`Ask the agent about these lines…`,submitLabel:c.canComment?`Add to review`:`Ask agent`,...c.canComment&&E!==null?{secondaryAction:{label:`Ask agent`,onAction:e=>O(e)}}:{},onCancel:()=>f(null),onComment:e=>{if(!c.canComment){O(e);return}c.onComment({path:n.path,oldPath:r===null?null:od(r,n.path),position:d.position,body:e}),f(null)}}):null]}),renderHeaderMetadata:()=>(0,$.jsxs)(`span`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[n.side===`old`?`removed code, `:``,`showing `,h.shown,` of`,` `,h.total,` diff lines`]}),(0,$.jsx)(G,{size:`icon-xs`,variant:`ghost-muted`,"aria-label":`Open ${n.path} in Code`,onClick:()=>u(n.path),children:(0,$.jsx)(a,{"aria-hidden":!0})})]})})}),t[42]=S,t[43]=O,t[44]=c,t[45]=d,t[46]=n.end,t[47]=n.path,t[48]=n.side,t[49]=n.start,t[50]=r,t[51]=i,t[52]=E,t[53]=u,t[54]=M,t[55]=h,t[56]=P):P=t[56];let F;return t[57]!==N||t[58]!==P?(F=(0,$.jsxs)(`figure`,{className:`flex min-w-0 flex-col gap-1.5`,children:[N,P]}),t[57]=N,t[58]=P,t[59]=F):F=t[59],F}function nd(e){return(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,$.jsx)(Zu,{marker:e.marker}),(0,$.jsx)(`span`,{className:`text-foreground`,children:e.title})]},e.marker)}function rd(e){return{...e,draft:!0}}function id(e){return e.oldLine===null?[]:[e.oldLine]}function ad(e){return e.newLine===null?[]:[e.newLine]}function od(e,t){let n=Lt(e);return n===t?null:n}function sd(e){let t=(0,Q.c)(11),{file:n,loadDiffFiles:r}=e,{resolvedTheme:i}=Ot(),a;t[0]===n?a=t[1]:(a=fn(n),t[0]=n,t[1]=a);let o=a,s;t[2]===i?s=t[3]:(s=zt(i),t[2]=i,t[3]=s);let c;t[4]!==r||t[5]!==i||t[6]!==s?(c={diffStyle:`unified`,lineDiffType:`none`,overflow:`scroll`,disableFileHeader:!0,theme:s,themeType:i,preferredHighlighter:ma,unsafeCSS:Wo,loadDiffFiles:r},t[4]=r,t[5]=i,t[6]=s,t[7]=c):c=t[7];let l=c,u;return t[8]!==o||t[9]!==l?(u=(0,$.jsx)(`div`,{className:`border-t border-border/60`,children:(0,$.jsx)(hn,{fileDiff:o,options:l})}),t[8]=o,t[9]=l,t[10]=u):u=t[10],u}var cd={tradeoff:`A tradeoff to weigh`,contract:`A contract to check`,product:`A product call`,risk:`A risk to judge`,accessibility:`An accessibility call`};function ld(e){let t=(0,Q.c)(122),{stop:n,index:i,stopCount:a,railOpen:o,onRailOpenChange:s,stopList:c,nextTitle:l,files:u,loadDiffFiles:d,diffLoading:f,commenting:p,onStep:m,onAsk:h,onFinish:g,onOpenFile:_}=e,v;t[0]===n?v=t[1]:(v=qu(n),t[0]=n,t[1]=v);let{lettered:y,byExcerpt:b}=v,x;t[2]===n.excerpts?x=t[3]:(x=new Set(n.excerpts.map(ud)),t[2]=n.excerpts,t[3]=x);let S=x,C,w,T,E,D,O,k,A,j;if(t[4]!==b||t[5]!==p||t[6]!==f||t[7]!==S||t[8]!==u||t[9]!==i||t[10]!==y||t[11]!==d||t[12]!==_||t[13]!==s||t[14]!==m||t[15]!==o||t[16]!==n.attention||t[17]!==n.excerpts||t[18]!==n.files||t[19]!==n.summary||t[20]!==n.title||t[21]!==a||t[22]!==c){let e;t[32]===S?e=t[33]:(e=e=>!S.has(e.path),t[32]=S,t[33]=e);let r=n.files.filter(e);C=y.length>0;let l=C&&`@min-[90rem]/guide:grid-cols-[minmax(0,1fr)_20rem]`;t[34]===l?w=t[35]:(w=K(`grid gap-8`,l),t[34]=l,t[35]=w),T=`flex min-w-0 flex-col gap-5`;let h=i+1,g;t[36]!==a||t[37]!==h?(g=(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground tabular-nums @max-[56rem]/guide:hidden`,children:[`Stop `,h,` of `,a]}),t[36]=a,t[37]=h,t[38]=g):g=t[38];let v;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(G,{size:`xs`,variant:`ghost-muted`,className:`@min-[56rem]/guide:hidden`}),t[39]=v):v=t[39];let x=i+1,M;t[40]!==a||t[41]!==x?(M=(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[`Stop `,x,` of `,a]}),t[40]=a,t[41]=x,t[42]=M):M=t[42];let N=o&&`rotate-180`,P;t[43]===N?P=t[44]:(P=K(N),t[43]=N,t[44]=P);let F;t[45]===P?F=t[46]:(F=(0,$.jsx)(fe,{"aria-hidden":!0,className:P}),t[45]=P,t[46]=F);let I;t[47]!==M||t[48]!==F?(I=(0,$.jsxs)(da,{render:v,children:[M,F]}),t[47]=M,t[48]=F,t[49]=I):I=t[49];let L=i===0,R;t[50]===m?R=t[51]:(R=()=>m(-1),t[50]=m,t[51]=R);let z;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(ze,{"aria-hidden":!0}),t[52]=z):z=t[52];let B;t[53]!==L||t[54]!==R?(B=(0,$.jsx)(G,{size:`icon-xs`,variant:`outline`,"aria-label":`Previous stop`,disabled:L,onClick:R,children:z}),t[53]=L,t[54]=R,t[55]=B):B=t[55];let V=i===a-1,H;t[56]===m?H=t[57]:(H=()=>m(1),t[56]=m,t[57]=H);let ee;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,$.jsx)(fe,{"aria-hidden":!0}),t[58]=ee):ee=t[58];let te;t[59]!==V||t[60]!==H?(te=(0,$.jsx)(G,{size:`icon-xs`,variant:`outline`,"aria-label":`Next stop`,disabled:V,onClick:H,children:ee}),t[59]=V,t[60]=H,t[61]=te):te=t[61];let ne;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,$.jsxs)(`span`,{"aria-hidden":!0,className:`ml-1 flex items-center gap-0.5 @max-[30rem]/guide:hidden`,children:[(0,$.jsx)(la,{children:`J`}),(0,$.jsx)(la,{children:`K`})]}),t[62]=ne):ne=t[62];let U;t[63]!==B||t[64]!==te?(U=(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[B,te,ne]}),t[63]=B,t[64]=te,t[65]=U):U=t[65];let W;t[66]!==g||t[67]!==I||t[68]!==U?(W=(0,$.jsxs)(`header`,{className:`flex items-center justify-between gap-2`,children:[g,I,U]}),t[66]=g,t[67]=I,t[68]=U,t[69]=W):W=t[69];let re;t[70]===c?re=t[71]:(re=(0,$.jsx)(ua,{className:`@min-[56rem]/guide:hidden`,children:(0,$.jsx)(`div`,{className:`pt-3`,children:c})}),t[70]=c,t[71]=re),t[72]!==s||t[73]!==o||t[74]!==W||t[75]!==re?(E=(0,$.jsxs)(pa,{open:o,onOpenChange:s,children:[W,re]}),t[72]=s,t[73]=o,t[74]=W,t[75]=re,t[76]=E):E=t[76];let ie;t[77]===n.title?ie=t[78]:(ie=(0,$.jsx)(`h2`,{className:`text-lg font-semibold text-foreground`,children:n.title}),t[77]=n.title,t[78]=ie);let oe;t[79]===n.summary?oe=t[80]:(oe=n.summary.trim()===``?null:(0,$.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(Lu,{text:n.summary})}),t[79]=n.summary,t[80]=oe),t[81]!==ie||t[82]!==oe?(D=(0,$.jsxs)(`div`,{className:`flex max-w-[60rem] flex-col gap-2`,children:[ie,oe]}),t[81]=ie,t[82]=oe,t[83]=D):D=t[83],t[84]===n.attention?O=t[85]:(O=n.attention===null?null:(0,$.jsxs)(ca,{controlAlignment:`first-line`,children:[(0,$.jsx)(we,{}),(0,$.jsx)(aa,{children:cd[n.attention.kind]}),(0,$.jsx)(sa,{children:(0,$.jsx)(`div`,{children:(0,$.jsx)(Lu,{text:n.attention.note})})})]}),t[84]=n.attention,t[85]=O),t[86]!==b||t[87]!==p||t[88]!==f||t[89]!==u||t[90]!==d||t[91]!==_||t[92]!==n.excerpts?(k=n.excerpts.length>0?(0,$.jsx)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:(0,$.jsx)(dn,{children:n.excerpts.map((e,t)=>(0,$.jsx)(td,{excerpt:e,file:u.get(e.path)??null,loading:f,notes:b[t]??[],commenting:p,loadDiffFiles:d,onOpenFile:_},`${e.path}:${e.side}:${e.start}-${e.end}`))})}):null,t[86]=b,t[87]=p,t[88]=f,t[89]=u,t[90]=d,t[91]=_,t[92]=n.excerpts,t[93]=k):k=t[93],t[94]===y?A=t[95]:(A=(0,$.jsx)(Qu,{notes:y,className:`@min-[90rem]/guide:hidden`}),t[94]=y,t[95]=A),j=r.length>0?(0,$.jsxs)(`section`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:n.excerpts.length>0?`Also in this stop`:`Files in this stop`}),(0,$.jsx)(dn,{children:(0,$.jsx)(`ul`,{className:`flex flex-col overflow-hidden rounded-lg border border-border/60`,children:r.map(e=>{let t=u.get(e.path),n=t===void 0?null:Ut([t]);return(0,$.jsx)(`li`,{className:`border-border/60 not-first:border-t`,children:(0,$.jsxs)(pa,{children:[(0,$.jsxs)(da,{className:`group flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left text-xs outline-none hover:bg-accent/50 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,children:[(0,$.jsx)(Pe,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground group-data-panel-open:rotate-90`}),(0,$.jsx)(ae,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`min-w-0 truncate font-mono text-foreground`,children:e.path}),e.note!==void 0&&e.note.trim()!==``?(0,$.jsx)(`span`,{className:`ml-auto min-w-0 truncate text-muted-foreground @max-[30rem]/guide:hidden`,children:(0,$.jsx)(Lu,{text:e.note,plain:!0})}):null,n===null?null:(0,$.jsx)(Er,{additions:n.additions,deletions:n.deletions,className:`shrink-0 font-mono`})]}),(0,$.jsx)(ua,{animate:!1,children:t===void 0?(0,$.jsx)(`p`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:f?`Loading the diff...`:`This file is not in the loaded diff.`}):(0,$.jsx)(sd,{file:t,loadDiffFiles:d})})]})},e.path)})})})]}):null,t[4]=b,t[5]=p,t[6]=f,t[7]=S,t[8]=u,t[9]=i,t[10]=y,t[11]=d,t[12]=_,t[13]=s,t[14]=m,t[15]=o,t[16]=n.attention,t[17]=n.excerpts,t[18]=n.files,t[19]=n.summary,t[20]=n.title,t[21]=a,t[22]=c,t[23]=C,t[24]=w,t[25]=T,t[26]=E,t[27]=D,t[28]=O,t[29]=k,t[30]=A,t[31]=j}else C=t[23],w=t[24],T=t[25],E=t[26],D=t[27],O=t[28],k=t[29],A=t[30],j=t[31];let M;t[96]!==h||t[97]!==n.questions?(M=n.questions.length>0||h!==null?(0,$.jsxs)(`section`,{className:`flex flex-col gap-1.5`,children:[n.questions.length>0?(0,$.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:`Questions to consider`}):null,(0,$.jsxs)(`div`,{className:`flex flex-col items-start gap-1.5`,children:[n.questions.map(e=>h===null?(0,$.jsx)(`div`,{className:`text-sm text-foreground`,children:(0,$.jsx)(Lu,{text:e})},e):(0,$.jsxs)(`button`,{type:`button`,onClick:()=>h(e),className:`flex min-w-0 items-start gap-2 rounded-lg border border-border/60 px-3 py-1.5 text-left text-sm text-foreground outline-none hover:bg-accent/50 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,children:[(0,$.jsx)(r,{"aria-hidden":!0,className:`mt-0.5 size-3.5 shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Ask an agent: `}),(0,$.jsx)(`span`,{children:(0,$.jsx)(Lu,{text:e,plain:!0})})]},e)),h===null?null:(0,$.jsxs)(G,{size:`sm`,variant:`ghost-muted`,onClick:()=>h(``),children:[(0,$.jsx)(r,{"aria-hidden":!0}),`Ask about this stop`]})]})]}):null,t[96]=h,t[97]=n.questions,t[98]=M):M=t[98];let N;t[99]!==l||t[100]!==g||t[101]!==m?(N=l===null?g===null?null:(0,$.jsxs)(G,{onClick:g,children:[(0,$.jsx)(Ae,{"aria-hidden":!0}),`Finish review`]}):(0,$.jsxs)(G,{className:`min-w-0`,onClick:()=>m(1),children:[(0,$.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`Next: `,l]}),(0,$.jsx)(Ee,{"aria-hidden":!0})]}),t[99]=l,t[100]=g,t[101]=m,t[102]=N):N=t[102];let P;t[103]===N?P=t[104]:(P=(0,$.jsx)(`footer`,{className:`flex flex-wrap items-center justify-end gap-3 border-t border-border/60 pt-4`,children:N}),t[103]=N,t[104]=P);let F;t[105]!==M||t[106]!==P||t[107]!==T||t[108]!==E||t[109]!==D||t[110]!==O||t[111]!==k||t[112]!==A||t[113]!==j?(F=(0,$.jsxs)(`article`,{className:T,children:[E,D,O,k,A,j,M,P]}),t[105]=M,t[106]=P,t[107]=T,t[108]=E,t[109]=D,t[110]=O,t[111]=k,t[112]=A,t[113]=j,t[114]=F):F=t[114];let I;t[115]!==C||t[116]!==y?(I=C?(0,$.jsx)(`aside`,{className:`hidden @min-[90rem]/guide:block @min-[90rem]/guide:sticky @min-[90rem]/guide:top-4 @min-[90rem]/guide:self-start`,children:(0,$.jsx)(Qu,{notes:y})}):null,t[115]=C,t[116]=y,t[117]=I):I=t[117];let L;return t[118]!==w||t[119]!==F||t[120]!==I?(L=(0,$.jsxs)(`div`,{className:w,children:[F,I]}),t[118]=w,t[119]=F,t[120]=I,t[121]=L):L=t[121],L}function ud(e){return e.path}var dd=new Map;function fd(e){let t=(0,Q.c)(23),{environmentId:n,reference:r,headSha:i,wantedPaths:a}=e,o;t[0]===r?o=t[1]:(o=Ri(r),t[0]=r,t[1]=o);let s=`${n}:${o}:${i}`,c;t[2]===s?c=t[3]:(c={key:s,cursor:null,done:!1,files:dd},t[2]=s,t[3]=c);let[l,u]=(0,Z.useState)(c),d,f,p,m;t[4]!==n||t[5]!==s||t[6]!==l||t[7]!==r||t[8]!==a?(d=l.key===s?l:{key:s,cursor:null,done:!1,files:dd},f=a.some(e=>!d.files.has(e))&&!d.done,p=wt,m=f?Ur.diff({environmentId:n,input:{...r,...d.cursor===null?{}:{cursor:d.cursor}}}):null,t[4]=n,t[5]=s,t[6]=l,t[7]=r,t[8]=a,t[9]=d,t[10]=f,t[11]=p,t[12]=m):(d=t[9],f=t[10],p=t[11],m=t[12]);let h=p(m),g=h.data,_=d.cursor,v,y;t[13]!==_||t[14]!==g||t[15]!==s?(v=()=>{g!==null&&u(e=>{let t=e.key===s?e:{key:s,cursor:null,done:!1,files:dd};if(t.cursor!==_||t.done)return t;let n=It(g.patch,`pull-request-guide:${s}:${_??`first`}`),r=new Map(t.files);if(n?.kind===`files`)for(let e of n.files)r.set(Kt(e),e);return{key:s,cursor:g.nextCursor,done:g.nextCursor===null,files:r}})},y=[_,g,s],t[13]=_,t[14]=g,t[15]=s,t[16]=v,t[17]=y):(v=t[16],y=t[17]),(0,Z.useEffect)(v,y);let b=f&&h.error===null,x=f?h.error:null,S;return t[18]!==d.files||t[19]!==h.refresh||t[20]!==b||t[21]!==x?(S={files:d.files,loading:b,error:x,retry:h.refresh},t[18]=d.files,t[19]=h.refresh,t[20]=b,t[21]=x,t[22]=S):S=t[22],S}function pd(e){let t=(0,Q.c)(63),{environmentId:n,reference:r,guide:i,banner:a,active:o,commenting:s,onAsk:c,onFinish:l,onOpenFile:u}=e,d;t[0]!==n||t[1]!==i.headSha||t[2]!==r?(d=Ki(Wi(n,r),i.headSha),t[0]=n,t[1]=i.headSha,t[2]=r,t[3]=d):d=t[3];let f=d,p=Gi(f),m;t[4]===f?m=t[5]:(m=e=>Hi.getState().setProgress(f,t=>({...t,...e(t)})),t[4]=f,t[5]=m);let h=m,[g,_]=(0,Z.useState)(!1),v=i.stops.length,y=Math.max(Math.min(p.position,v-1),0),b=i.stops[y]??null,x;t[6]===b?x=t[7]:(x=b===null?[]:zu(b),t[6]=b,t[7]=x);let S=x,C;t[8]!==n||t[9]!==i.headSha||t[10]!==r||t[11]!==S?(C={environmentId:n,reference:r,headSha:i.headSha,wantedPaths:S},t[8]=n,t[9]=i.headSha,t[10]=r,t[11]=S,t[12]=C):C=t[12];let w=fd(C),T=Tt(Ur.diffFileContents),E=`pull-request-guide:${f}`,D;t[13]!==n||t[14]!==T||t[15]!==r||t[16]!==E?(D=Jo(T,{environmentId:n,reference:r,commit:null,cacheKey:E}),t[13]=n,t[14]=T,t[15]=r,t[16]=E,t[17]=D):D=t[17];let O=D,k=(0,Z.useRef)(null),A;t[18]!==y||t[19]!==h?(A=e=>{h(t=>({position:e,seen:e>y?new Set(t.seen).add(y):t.seen})),_(!1),k.current?.scrollTo({top:0})},t[18]=y,t[19]=h,t[20]=A):A=t[20];let j=A,M;t[21]!==j||t[22]!==y||t[23]!==v?(M=e=>j(Ru(y,e,v)),t[21]=j,t[22]=y,t[23]=v,t[24]=M):M=t[24];let N=M,P;t[25]===N?P=t[26]:(P=e=>{e.defaultPrevented||e.isComposing||ba()||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||(e.key===`j`||e.key===`k`)&&(Ui(e.target)||(e.preventDefault(),N(e.key===`j`?1:-1)))},t[25]=N,t[26]=P);let F=(0,Z.useEffectEvent)(P),I;t[27]!==o||t[28]!==F?(I=()=>{if(!o)return;let e=e=>F(e);return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},t[27]=o,t[28]=F,t[29]=I):I=t[29];let L;t[30]===o?L=t[31]:(L=[o],t[30]=o,t[31]=L),(0,Z.useEffect)(I,L);let R;t[32]!==j||t[33]!==i.stops||t[34]!==y||t[35]!==p.seen?(R=(0,$.jsx)(`aside`,{className:`sticky top-4 self-start @max-[56rem]/guide:hidden`,children:(0,$.jsx)(Ju,{stops:i.stops,position:y,seen:p.seen,onSelect:j})}),t[32]=j,t[33]=i.stops,t[34]=y,t[35]=p.seen,t[36]=R):R=t[36];let z;t[37]===w.error?z=t[38]:(z=w.error===null?null:(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`The diff could not be loaded, so excerpts are missing: `,w.error]}),t[37]=w.error,t[38]=z);let B;t[39]!==s||t[40]!==w.files||t[41]!==w.loading||t[42]!==j||t[43]!==i.stops||t[44]!==O||t[45]!==c||t[46]!==l||t[47]!==u||t[48]!==y||t[49]!==g||t[50]!==N||t[51]!==b||t[52]!==v||t[53]!==p.seen||t[54]!==h?(B=b===null?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This change has no files to tour.`}):(0,$.jsx)(ld,{stop:b,index:y,stopCount:v,railOpen:g,onRailOpenChange:_,stopList:(0,$.jsx)(Ju,{stops:i.stops,position:y,seen:p.seen,onSelect:j}),nextTitle:i.stops[y+1]?.title??null,files:w.files,loadDiffFiles:O,diffLoading:w.loading,commenting:s,onStep:N,onAsk:c===null?null:e=>c(y,e),onFinish:l===null?null:()=>{h(e=>({seen:new Set(e.seen).add(y)})),l()},onOpenFile:u},y),t[39]=s,t[40]=w.files,t[41]=w.loading,t[42]=j,t[43]=i.stops,t[44]=O,t[45]=c,t[46]=l,t[47]=u,t[48]=y,t[49]=g,t[50]=N,t[51]=b,t[52]=v,t[53]=p.seen,t[54]=h,t[55]=B):B=t[55];let V;t[56]!==a||t[57]!==z||t[58]!==B?(V=(0,$.jsxs)(`main`,{className:`flex min-w-0 flex-col gap-4`,children:[a,z,B]}),t[56]=a,t[57]=z,t[58]=B,t[59]=V):V=t[59];let H;return t[60]!==R||t[61]!==V?(H=(0,$.jsx)(`div`,{ref:k,className:`@container/guide h-full overflow-y-auto scrollbar-gutter-both`,children:(0,$.jsxs)(`div`,{className:`mx-auto grid max-w-[100rem] gap-6 px-4 py-4 @min-[56rem]/guide:grid-cols-[16rem_minmax(0,1fr)] @min-[90rem]/guide:gap-8 @min-[90rem]/guide:px-6`,children:[R,V]})}),t[60]=R,t[61]=V,t[62]=H):H=t[62],H}function md(e){let t=(0,Q.c)(28),{environmentId:n,reference:r,title:i}=e,a;t[0]!==n||t[1]!==r?(a=Ur.reviewGuide({environmentId:n,input:r}),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=wt(a),s;t[3]===n?s=t[4]:(s=Ur.generateReviewGuide.permissionAtom(n),t[3]=n,t[4]=s);let c=re(s),l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l={reportFailure:!1},t[5]=l):l=t[5];let u=Tt(Ur.generateReviewGuide,l),[d,f]=(0,Z.useState)(!1),p=o.data,m=d||p?.run?._tag===`Running`,h;t[6]!==p||t[7]!==n||t[8]!==r||t[9]!==i?(h=()=>Hi.getState().watch({environmentId:n,reference:r,title:i,previousGuideAt:p?.guide?.generatedAt??null,previousFailedAt:p?.run?._tag===`Failed`?p.run.failedAt:null,since:Date.now()}),t[6]=p,t[7]=n,t[8]=r,t[9]=i,t[10]=h):h=t[10];let g=(0,Z.useEffectEvent)(h),_;t[11]!==p?.run?._tag||t[12]!==g?(_=()=>{p?.run?._tag===`Running`&&g()},t[11]=p?.run?._tag,t[12]=g,t[13]=_):_=t[13];let v=p?.run?._tag,y;t[14]===v?y=t[15]:(y=[v],t[14]=v,t[15]=y),(0,Z.useEffect)(_,y);let b;t[16]!==n||t[17]!==u||t[18]!==r||t[19]!==m||t[20]!==g?(b=async()=>{if(m)return;f(!0),g();let e=await u({environmentId:n,input:r});f(!1),e._tag===`Failure`&&(Hi.getState().settle(Wi(n,r)),lt.add({type:`error`,title:`Could not start a review guide`,description:li(Ue(e),`Check the review guide model in Settings → Source Control.`)}))},t[16]=n,t[17]=u,t[18]=r,t[19]=m,t[20]=g,t[21]=b):b=t[21];let x=b,S;return t[22]!==c||t[23]!==p||t[24]!==o||t[25]!==m||t[26]!==x?(S={query:o,data:p,running:m,canWrite:c,write:x},t[22]=c,t[23]=p,t[24]=o,t[25]=m,t[26]=x,t[27]=S):S=t[27],S}function hd(e){let t=(0,Q.c)(68),{environmentId:n,reference:r,title:i,workspaceRoot:a,active:o,canComment:s,onAskAboutLines:c,onAskAboutStop:l,onFinishReview:u,onOpenFile:d,onTourShown:f}=e,p;t[0]!==n||t[1]!==r||t[2]!==i?(p={environmentId:n,reference:r,title:i},t[0]=n,t[1]=r,t[2]=i,t[3]=p):p=t[3];let{query:h,data:g,running:_,canWrite:v,write:y}=md(p),b;t[4]!==n||t[5]!==r?(b=Wi(n,r),t[4]=n,t[5]=r,t[6]=b):b=t[6];let x=b,S;t[7]===r?S=t[8]:(S=Ri(r),t[7]=r,t[8]=S);let C=S,w=zi(r),T=Li(_d),E=Li(gd),D;t[9]!==T||t[10]!==s||t[11]!==c||t[12]!==w||t[13]!==E||t[14]!==C?(D=!s&&c===null?null:{canComment:s,pending:w,onComment:e=>{let{path:t,oldPath:n,position:r,body:i}=e;return T(C,{id:Bi(),path:t,...n===null?{}:{oldPath:n},position:r,body:i})},onRemove:e=>E(C,e),onAskAgent:c},t[9]=T,t[10]=s,t[11]=c,t[12]=w,t[13]=E,t[14]=C,t[15]=D):D=t[15];let O=D,k,A;t[16]!==o||t[17]!==x?(k=()=>{if(o)return Hi.getState().setShown(x),()=>{Hi.getState().shownKey===x&&Hi.getState().setShown(null)}},A=[o,x],t[16]=o,t[17]=x,t[18]=k,t[19]=A):(k=t[18],A=t[19]),(0,Z.useEffect)(k,A);let j=g?.guide??null,M=o&&j!==null,N;t[20]===f?N=t[21]:(N=()=>f?.(),t[20]=f,t[21]=N);let P=(0,Z.useEffectEvent)(N),F;t[22]!==P||t[23]!==M?(F=()=>{M&&P()},t[22]=P,t[23]=M,t[24]=F):F=t[24];let I;t[25]===M?I=t[26]:(I=[M],t[25]=M,t[26]=I),(0,Z.useEffect)(F,I);let L=g?.run??null,R=g?.currentHeadSha??null,z=j!==null&&R!==null&&R!==j.headSha,B=L?._tag===`Failed`&&L.headSha===R?L.detail:null,V;t[27]!==v||t[28]!==_||t[29]!==y?(V=(e,t)=>v?(0,$.jsxs)(G,{size:t,variant:`outline`,disabled:_,onClick:()=>void y(),children:[_?(0,$.jsx)(ct,{}):(0,$.jsx)(le,{"aria-hidden":!0,className:`size-3.5`}),_?`Reading the change...`:e]}):null,t[27]=v,t[28]=_,t[29]=y,t[30]=V):V=t[30];let H=V;if(j===null){if(h.isPending&&g===null){let e;return t[31]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`div`,{className:`flex min-h-48 items-center justify-center`,children:(0,$.jsx)(ct,{})}),t[31]=e):e=t[31],e}let e=_?`Writing a review guide`:`No review guide yet`,n;t[32]===e?n=t[33]:(n=(0,$.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:e}),t[32]=e,t[33]=n);let r=B??h.error??(_?`An agent is reading the change. A large one takes a few minutes. You can leave; you will be told when it is ready.`:`A guide is a tour of the change: stops through the code in reading order, with the calls only a maintainer can make.`),i;t[34]===r?i=t[35]:(i=(0,$.jsx)(`p`,{className:`max-w-md text-xs text-muted-foreground`,children:r}),t[34]=r,t[35]=i);let a=B===null?`Write guide`:`Try again`,o;t[36]!==a||t[37]!==H?(o=H(a,`sm`),t[36]=a,t[37]=H,t[38]=o):o=t[38];let s;return t[39]!==n||t[40]!==i||t[41]!==o?(s=(0,$.jsxs)(`div`,{className:`flex min-h-48 flex-col items-center justify-center gap-2 px-4 py-10 text-center`,children:[n,i,o]}),t[39]=n,t[40]=i,t[41]=o,t[42]=s):s=t[42],s}let ee;t[43]!==v||t[44]!==B||t[45]!==_||t[46]!==z||t[47]!==H?(ee=z||B!==null||_?(0,$.jsxs)(ca,{variant:_?`info`:`warning`,children:[_?(0,$.jsx)(ct,{}):(0,$.jsx)(m,{}),(0,$.jsx)(sa,{children:_?`Rewriting this guide. You will be told when the new one is ready.`:B??`Written before the latest push.`}),!_&&v?(0,$.jsx)(oa,{children:H(`Rewrite`,`xs`)}):null]}):null,t[43]=v,t[44]=B,t[45]=_,t[46]=z,t[47]=H,t[48]=ee):ee=t[48];let te=ee,ne;t[49]!==n||t[50]!==a?(ne={environmentId:n,cwd:a},t[49]=n,t[50]=a,t[51]=ne):ne=t[51];let U;t[52]!==j||t[53]!==l?(U=l===null?null:(e,t)=>{let n=j.stops[e];n!==void 0&&l(n,e,t)},t[52]=j,t[53]=l,t[54]=U):U=t[54];let W;t[55]!==o||t[56]!==te||t[57]!==O||t[58]!==n||t[59]!==j||t[60]!==u||t[61]!==d||t[62]!==r||t[63]!==U?(W=(0,$.jsx)(pd,{environmentId:n,reference:r,guide:j,banner:te,active:o,commenting:O,onAsk:U,onFinish:u,onOpenFile:d}),t[55]=o,t[56]=te,t[57]=O,t[58]=n,t[59]=j,t[60]=u,t[61]=d,t[62]=r,t[63]=U,t[64]=W):W=t[64];let re;return t[65]!==ne||t[66]!==W?(re=(0,$.jsx)(Iu,{value:ne,children:W}),t[65]=ne,t[66]=W,t[67]=re):re=t[67],re}function gd(e){return e.removeComment}function _d(e){return e.addComment}function vd(e){let t=(0,Q.c)(12),[n,r]=(0,Z.useState)(null),i=n?.scopeKey===e?n:null,a,o;t[0]!==n||t[1]!==e?(a=()=>{if(!n)return;let t=()=>r(null);if(n.scopeKey!==e){t();return}let i=e=>{e.target instanceof Node&&!n.element.contains(e.target)&&t()},a=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),t())},o=window.setTimeout(t,3e3);return document.addEventListener(`pointerdown`,i,!0),window.addEventListener(`keydown`,a,!0),window.addEventListener(`blur`,t),()=>{window.clearTimeout(o),document.removeEventListener(`pointerdown`,i,!0),window.removeEventListener(`keydown`,a,!0),window.removeEventListener(`blur`,t)}},o=[n,e],t[0]=n,t[1]=e,t[2]=a,t[3]=o):(a=t[2],o=t[3]),(0,Z.useEffect)(a,o);let s;t[4]===i?.action?s=t[5]:(s=e=>i?.action===e,t[4]=i?.action,t[5]=s);let c;t[6]!==i||t[7]!==e?(c=(t,n)=>({onClick:a=>{i?.action===t&&i.element===a.currentTarget?(r(null),n()):r({scopeKey:e,action:t,element:a.currentTarget})},onBlur:()=>r(null)}),t[6]=i,t[7]=e,t[8]=c):c=t[8];let l;return t[9]!==s||t[10]!==c?(l={isArmed:s,props:c},t[9]=s,t[10]=c,t[11]=l):l=t[11],l}var yd={merge:`Could not merge this pull request`,ready:`Could not mark this ready for review`,draft:`Could not convert this to a draft`,close:`Could not close this pull request`,reopen:`Could not reopen this pull request`,"update-branch":`Could not update this branch`,"enable-auto-merge":`Could not turn on auto-merge`,"disable-auto-merge":`Could not turn off auto-merge`,revert:`Could not open a revert pull request`,"delete-branch":`Could not delete this branch`,"approve-workflows":`Could not approve workflows`},bd={merge:`The host refused the merge. Check that you have write access, that the checks it requires have passed, and that the branch is not conflicting.`,ready:`The host refused it. Check that you have write access to this repository.`,draft:`The host refused it. Check that you have write access to this repository.`,close:`The host refused it. Check that you have write access, or that you opened it.`,reopen:`The host refused it. Check that you have write access, and that the branch still exists.`,"update-branch":`The host refused it. Check that you have write access to the branch — one from a fork also needs its author to allow edits from maintainers — and that it does not conflict with the base.`,"enable-auto-merge":`The host refused it. Check that this repository allows auto-merge, that you have write access, and that there is something left for it to wait on.`,"disable-auto-merge":`The host refused it. Check that you have write access, and that the merge has not already happened.`,revert:`The host refused it. Check that you have write access and that this pull request was merged on the host.`,"delete-branch":`The host refused it. Check that you have write access to the source repository and that the branch has not moved since this page loaded.`,"approve-workflows":`The host refused it. Check that you have Actions write access and that these workflow runs are still awaiting approval.`},xd=`The host refused it. A rebase stops at the first commit that does not apply cleanly; updating with a merge commit may still work.`,Sd=[{value:`summary`,label:`Summary`},{value:`guide`,label:`Guide`},{value:`timeline`,label:`Timeline`},{value:`code`,label:`Code`}],Cd=()=>t(()=>import(`./PullRequestCodeTab-BqH4glgo.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333])),wd=(0,Z.lazy)(Cd),Td=new Map,Ed=e=>typeof e==`string`?e:D(e);function Dd(e){let t=(0,Q.c)(12),{environments:n,value:r,onChange:a,disabled:o}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(je,{}),t[0]=s):s=t[0];let c;t[1]===a?c=t[2]:(c=e=>a(e),t[1]=a,t[2]=c);let l;if(t[3]!==o||t[4]!==n){let e;t[6]===o?e=t[7]:(e=e=>(0,$.jsx)(i,{value:e.environmentId,disabled:o,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(ia,{kind:e.machine??`server`,className:`size-3.5 shrink-0`}),(0,$.jsx)(`span`,{className:`truncate`,children:e.label})]})},e.environmentId),t[6]=o,t[7]=e),l=n.map(e),t[3]=o,t[4]=n,t[5]=l}else l=t[5];let u;return t[8]!==c||t[9]!==l||t[10]!==r?(u=(0,$.jsxs)($.Fragment,{children:[s,(0,$.jsx)(I,{value:r,onValueChange:c,children:l})]}),t[8]=c,t[9]=l,t[10]=r,t[11]=u):u=t[11],u}var Od=(e,t)=>{e.preventDefault(),e.stopPropagation(),Sl({url:t.url,openLabel:bl(Pr.get(t.provider)),position:{x:e.clientX,y:e.clientY}})};function kd(e){let t=(0,Q.c)(28),{baseBranch:n,freshness:r,pending:i,onUpdate:a,iconClassName:o,className:s,children:c}=e,l;t[0]===r.behindBy?l=t[1]:(l=r.behindBy===null?``:` by ${r.behindBy.toLocaleString()} ${r.behindBy===1?`commit`:`commits`}`,t[0]=r.behindBy,t[1]=l);let u=`This branch is out-of-date with ${n}${l}.`,d;t[2]===s?d=t[3]:(d=K(`inline-flex min-w-0 shrink-0 cursor-help items-center gap-1 rounded-sm text-warning-foreground outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,s),t[2]=s,t[3]=d);let f;t[4]!==u||t[5]!==d?(f=(0,$.jsx)(`button`,{type:`button`,"aria-label":u,className:d}),t[4]=u,t[5]=d,t[6]=f):f=t[6];let p;t[7]===o?p=t[8]:(p=K(`size-3.5 shrink-0`,o),t[7]=o,t[8]=p);let h;t[9]===p?h=t[10]:(h=(0,$.jsx)(m,{"aria-hidden":!0,className:p}),t[9]=p,t[10]=h);let g;t[11]!==c||t[12]!==f||t[13]!==h?(g=(0,$.jsxs)(Jr,{openOnHover:!0,delay:0,closeDelay:120,render:f,children:[c,h]}),t[11]=c,t[12]=f,t[13]=h,t[14]=g):g=t[14];let _;t[15]===u?_=t[16]:(_=(0,$.jsx)(`p`,{className:`text-xs text-foreground`,children:u}),t[15]=u,t[16]=_);let v;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:`Changes can be cleanly merged.`}),t[17]=v):v=t[17];let y;t[18]!==r.methods||t[19]!==a||t[20]!==i?(y=r.methods.length>0?(0,$.jsx)(`span`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:r.methods.map(e=>(0,$.jsxs)(G,{size:`xs`,variant:`outline`,disabled:i,onClick:()=>a(e),children:[(0,$.jsx)(Ir.merged,{"aria-hidden":!0,className:`size-3`}),e===`rebase`?`Update with rebase`:`Update branch`]},e))}):null,t[18]=r.methods,t[19]=a,t[20]=i,t[21]=y):y=t[21];let b;t[22]!==_||t[23]!==y?(b=(0,$.jsxs)(Kr,{align:`start`,side:`bottom`,className:`max-w-80`,padding:`compact`,children:[_,v,y]}),t[22]=_,t[23]=y,t[24]=b):b=t[24];let x;return t[25]!==b||t[26]!==g?(x=(0,$.jsxs)(Yr,{children:[g,b]}),t[25]=b,t[26]=g,t[27]=x):x=t[27],x}function Ad({environmentId:e,shortcutsEnabled:t,getShortcutContext:n,threadRef:o=null,reference:s,listEntry:c=null,refreshToken:u=0,onActed:m,onClose:h,context:g=`page`,composerDraftTarget:_,onBack:v,onSelectPullRequest:b,onGuideShown:C}){let w=qe(),T=We(),E=T.find(t=>t.id===s.projectId&&t.environmentId===e),D=E?.repositoryIdentity,k=w.get(e)?.environment.capabilities.threadPullRequests===!0,M=(0,Z.useMemo)(()=>k?fi(s,D):{projectId:s.projectId,repository:s.repository,number:s.number},[s,D,k]),N=`${M.projectId}:${M.host??``}:${M.repository}#${M.number}`,P=c?.projectId===M.projectId&&c.repository.toLowerCase()===M.repository.toLowerCase()&&(M.host===void 0||c.host.toLowerCase()===M.host.toLowerCase())&&c.number===M.number?c:null,[F,R]=(0,Z.useState)(!1),[B,V]=(0,Z.useState)(0),[H,U]=(0,Z.useState)(`summary`),[ie,ae]=(0,Z.useState)(`newest`),[ce,ue]=(0,Z.useState)(()=>({pullRequestKey:N,oid:null})),de=ce.pullRequestKey===N?ce.oid:null,he=e=>{ue({pullRequestKey:N,oid:e})},ge=e=>{he(e),U(`code`)},[ve,ye]=(0,Z.useState)(null),xe=e=>{he(null),ye(t=>({path:e,nonce:(t?.nonce??0)+1})),Cd(),U(`code`)},we=Hi(t=>t.openRequestKey===Wi(e,M));we&&H!==`guide`&&U(`guide`),(0,Z.useEffect)(()=>{we&&Hi.getState().requestOpen(null)},[we]);let Te=`${e}:${N}`,[Ee,Oe]=(0,Z.useState)(()=>({key:Te,tabs:new Set([`summary`])})),Ne=Ee.key===Te?Ee.tabs:new Set([H]);(0,Z.useEffect)(()=>{Oe(e=>e.key===Te?e.tabs.has(H)?e:{key:Te,tabs:new Set(e.tabs).add(H)}:{key:Te,tabs:new Set([H])})},[H,Te]);let[Pe,Fe]=(0,Z.useState)(!1),Le=(0,Z.useRef)({});(0,Z.useEffect)(()=>{Fe(Le.current[H]??!1)},[H]);let Re=Pe,ze=(0,Z.useRef)({}),Ve=(0,Z.useMemo)(()=>({summary:e=>{ze.current.summary=e},timeline:e=>{ze.current.timeline=e},code:e=>{ze.current.code=e}}),[]),Ge=(0,Z.useRef)(null),Ke=(0,Z.useRef)(null),Je=(0,Z.useRef)(null);(0,Z.useLayoutEffect)(()=>{let e=Je.current;e!==null&&(Je.current=null,Re&&e.tab===H&&ze.current[H]===e.scroller&&(e.scroller.scrollTop=Math.max(0,e.scroller.scrollTop+e.delta)))},[Re,H]);let Ze=Ji(e=>e.pullRequestMergeMethod),$e=Ji(e=>e.setPullRequestMergeMethod),et=Sa(e,M.projectId),tt=(0,Z.useMemo)(()=>et(),[et]),[nt,rt]=(0,Z.useState)(null),it=e=>{rt({pullRequestKey:N,method:e})},at=vd(N),[ot,st]=(0,Z.useState)(null),ct=St(e,Ie),ut=wt(Ur.detail({environmentId:e,input:M})),ft=wt(Ur.activity({environmentId:e,input:M})),pt=zr(e),[mt,ht]=(0,Z.useState)(()=>ii(typeof window>`u`?void 0:window.localStorage,e,M));(0,Z.useEffect)(()=>{ht(ii(typeof window>`u`?void 0:window.localStorage,e,M))},[e,N,M.projectId,M.repository,M.number]),(0,Z.useEffect)(()=>{ut.data!==null&&(mi(typeof window>`u`?void 0:window.localStorage,e,M,ut.data),ht(ut.data))},[ut.data,e,N,M.projectId,M.repository,M.number]);let gt=Zr({live:ut.data,cached:mt,reference:M}),_t=(0,Z.useMemo)(()=>P===null?null:Br(P),[P]),vt=(0,Z.useMemo)(()=>ut.data===null?null:{...ut.data,checksState:wr(ut.data.checks)},[ut.data]),Dt=Wr(e,M,vt,ut.dataUpdatedAt),Ot=(0,Z.useMemo)(()=>Hr(gt,Hr(Dt,_t)),[gt,Dt,_t]),Mt=(0,Z.useMemo)(()=>gt===null||Ot===null||Ot===gt?gt:{...gt,title:Ot.title,state:Ot.state,headBranch:Ot.headBranch,baseBranch:Ot.baseBranch,updatedAt:Ot.updatedAt,author:Ot.author??gt.author,additions:Ot.additions??gt.additions,deletions:Ot.deletions??gt.deletions,changedFiles:Ot.changedFiles??gt.changedFiles,mergeability:Ot.mergeability??gt.mergeability,closedAt:Ot.closedAt===void 0?gt.closedAt:Ot.closedAt,mergedAt:Ot.mergedAt===void 0?gt.mergedAt:Ot.mergedAt,isDraft:Ot.isDraft??gt.isDraft},[gt,Ot]),Nt=ft.data,X=(0,Z.useMemo)(()=>Mt===null?null:{...Mt,capabilities:ct?Mt.capabilities:{...Mt.capabilities,reactions:!1,edit:{changeRequest:!1,comment:!1}},viewerPermissions:ct?Mt.viewerPermissions:{...Mt.viewerPermissions,actions:[],comment:!1,resolve:!1,verdicts:[],requestReviewers:!1,updateMethods:[],labels:!1},author:Nt?.author??Mt.author,reviewers:Nt?.reviewers??Mt.reviewers,comments:Nt?.comments??[],commentCount:Nt?.commentCount??0,commentsTruncated:Nt?.commentsTruncated??!1,reviewThreads:Nt?.reviewThreads??[],commits:Nt?.commits??[],reactions:Nt?.reactions??[]},[Nt,ct,Mt]),Pt=X??Ot,Ft=re(xt),{copyToClipboard:It}=dt({target:`pull request reference`,onCopy:e=>lt.add({type:`success`,title:`${e} copied`}),onError:(e,t)=>lt.add({type:`error`,title:`Failed to copy ${t}`,description:e.message})}),Lt=(0,Z.useEffectEvent)(e=>{!t||e.defaultPrevented||ba()||sr(e,Ft,{context:n()})===`pullRequest.copyNumber`&&(e.preventDefault(),e.stopPropagation(),e.repeat||It(`#${M.number}`,`PR number`))});(0,Z.useEffect)(()=>{let e=e=>Lt(e);return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[]),(0,Z.useEffect)(()=>{X?.autoMergeMethod!==void 0&&it(X.autoMergeMethod)},[X?.autoMergeMethod,N]);let Rt=X===null?null:Ye(X.url),zt=Pr.get(X?.provider),Bt=(0,Z.useMemo)(()=>({repositoryUrl:Rt===null?null:zt.referenceAutolinkRepositoryUrl(Rt),threadRef:o}),[zt,Rt,o]),Vt=X?.author&&Rt!==null?zt.authorProfileUrl(X.author.login,Rt):null,Ht=Pt?ai(Pt.provider,Pt.number,Pt.headBranch,X?.headRepositoryNameWithOwner,Ye(Pt.url)):ei(M,D),Ut=(0,Z.useCallback)(e=>{lt.add({type:`error`,title:`Could not copy checkout command`,description:e.message})},[]),Wt=wt(X===null?null:jt.listRefs({environmentId:e,input:{cwd:X.workspaceRoot,includeMatchingRemoteRefs:!0,limit:2}})),Gt=X!==null&&Pi(X.baseBranch,Wt.data?.refs??[]),Kt=yc(e,(0,Z.useMemo)(()=>X===null||X.capabilities.stacks!==!0||!k?null:{...M,host:M.host??Xe(X.url)?.host},[X,M,k])),qt=Kt.data,Jt=k&&X?.capabilities.stacks===!0&&X.capabilities.stackActions===!0&&w.get(e)?.environment.capabilities.pullRequestStackActions===!0,Yt=Ai({supportsStackActions:Jt,hasStack:qt!==null,stackPending:!Kt.isFresh,stackError:Kt.error}),Xt=ft.isPending&&Nt===null,Zt=Nt===null?ft.error:null,Qt=(0,Z.useCallback)(()=>{ut.refresh(),ft.refresh(),Kt.refresh()},[ft.refresh,ut.refresh,Kt.refresh]),[$t,en]=(0,Z.useState)(0),tn=$t+(pt??0),nn=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{if(!Mt)return;let e={key:Te,updatedAt:Mt.updatedAt};if(ri(nn.current,e)){if(ft.isPending)return;ft.refresh(),en(e=>e+1)}nn.current=e},[ft.isPending,ft.refresh,Mt,Te]),Nc(()=>{ut.refresh()},{key:`pull-request:${e}:${N}`});let rn=Tt(Ur.invalidate,{reportFailure:!1}),[an,on]=(0,Z.useState)(!1),sn=an||ut.isPending,cn=(0,Z.useCallback)(async()=>{on(!0);try{await rn({environmentId:e,input:{reference:M}}),Qt(),en(e=>e+1)}finally{on(!1)}},[e,rn,M,Qt]),ln=(0,Z.useRef)(u);(0,Z.useEffect)(()=>{ln.current!==u&&(ln.current=u,cn())},[u,cn]);let un=Tt(Ur.runAction,{reportFailure:!1}),dn=Tt(Ur.comment,{reportFailure:!1}),[fn,pn]=(0,Z.useState)(null),mn=fn!==null,hn=Tt(Ur.update,{reportFailure:!1}),[gn,_n]=(0,Z.useState)(null),vn=gn?.pullRequestKey===N?gn.text:null,[yn,bn]=(0,Z.useState)(!1),xn=ra(),{environments:Sn}=bt(),Cn=(0,Z.useMemo)(()=>{let t=T.find(t=>t.id===M.projectId&&t.environmentId===e)?.repositoryIdentity;return Qe(t,M.repository,M.number)},[e,T,M.number,M.projectId,M.repository]),Tn=(0,Z.useMemo)(()=>g===`page`?gc({environmentId:e,projectId:M.projectId},T,Sn.map(e=>({environmentId:e.environmentId,label:e.label,machine:Be(e.serverConfig)}))):[],[g,e,Sn,T,M.projectId]),[En,Dn]=(0,Z.useState)(null),On=En?.pullRequestKey===N?En.environmentId:e,kn=Tn.find(e=>e.environmentId===On)??null,An=kn?.environmentId??e,jn=kn?.workspaceRoot??X?.workspaceRoot??E?.workspaceRoot??null,Mn=St(An,se),Nn=Ca({environmentId:An,cwd:jn}),Pn=async(t,n,r)=>{m?.(t,`sent`);let i=await un({environmentId:e,input:{...M,action:t,...n?{mergeMethod:n}:{},...r?{updateMethod:r}:{}}});if(pn(null),i._tag===`Failure`){let e=Ue(i),n=r===`rebase`?xd:bd[t];return lt.add({type:`error`,title:yd[t],description:li(e,n)}),m?.(t,`failed`),!1}return t===`revert`&&lt.add({type:`success`,title:`Revert pull request opened`}),t===`delete-branch`&&lt.add({type:`success`,title:`Branch deleted`}),wi(t)?cn():Qt(),m?.(t,`done`),!0},Fn=async(e,t,n)=>!ct||fn!==null?!1:(pn(e),Pn(e,t,n)),In=async(t,n)=>!ct||fn!==null?{commentPosted:!1}:(pn(n),(await dn({environmentId:e,input:{...M,body:t}}))._tag===`Failure`?(pn(null),lt.add({type:`error`,title:`Could not post the comment`}),{commentPosted:!1}):(await Pn(n)||Qt(),{commentPosted:!0})),Ln=async t=>{let n=t.trim();if(!ct||X===null||yn)return;if(n.length===0||n===X.title){_n(null);return}bn(!0);let r=await hn({environmentId:e,input:{...M,title:n}});if(bn(!1),r._tag===`Failure`){lt.add({type:`error`,title:`The title could not be saved`,description:li(Ue(r),`The host refused the new title.`)});return}_n(null),Qt()},Rn=_??null,zn=Nn.isAllowed&&Mn,Bn=Rn!==null||zn,Hn=ci(Rn!==null),Un=md({environmentId:e,reference:M,title:X?.title??null}),Wn=()=>{Un.write(),Un.data?.guide??U(`guide`)},Gn=(e,t)=>{let n=d.getState(),r=n.getComposerDraft(e),i=Ed(e),a=new Set((r?.reviewComments??[]).map(e=>e.id)),o=new Set((t.reviewComments??[]).filter(e=>a.has(e.id)).map(e=>e.id)),s=ki(r?.prompt??``,r?.reviewComments??[],o),c=Fi({prompt:s,lastHandoffPrompt:Td.get(i)},t.prompt);Td.set(i,t.prompt),n.setPrompt(e,c),n.setReviewComments(e,vi(r?.reviewComments??[],t.reviewComments??[]));for(let r of t.reviewComments??[])o.has(r.id)&&n.addReviewComment(e,r,{allowDuplicateReference:!0,insertAtCaret:!1})},Kn=async(e,t,n)=>{let r=n??await xn(e).then(e=>e,()=>null);return r===null?null:(t===null||Gn(r.draftId,t),r)},qn=async(t,n,r)=>{if(!X||ot!==null)return;if(Rn!==null){Gn(Rn,n),lt.add({type:`success`,title:`Added to the composer`,description:n.prompt.length>0?`The question is in the composer — read it over, then send.`:`The pull request is in the composer — type your question, then send.`});return}st(t);let i=x(An,kn?.projectId??X.projectId),a=await Kn(i,n);if(st(null),a!==null&&r?.keepGuide===!0){let t=d.getState().getDraftSession(a.draftId);t!==null&&(Et.getState().openPullRequest(A(t.environmentId,t.threadId),{environmentId:e,projectId:M.projectId,...M.host===void 0?{}:{host:M.host},repository:M.repository,number:M.number,url:X.url}),Hi.getState().requestOpen(Wi(e,M)))}if(a===null){lt.add({type:`error`,title:`Could not open a thread`,description:`Try again from the project, or open a thread first.`});return}lt.add({type:`success`,title:`Asked in a thread`,description:n.prompt.length>0?`The question is in the composer — read it over, then send.`:`The pull request is in the composer — type your question, then send.`})},Jn=async(e,t,n=`worktree`)=>{if(!Pt||ot!==null)return;if(Rn!==null&&t!==null){Gn(Rn,t),lt.add({type:`success`,title:`Added to the composer`,description:`The task is in the composer — read it over, then send.`});return}if(jn===null||!Nn.isAllowed||!Ct(An,`source-control:write`)||n===`worktree`&&!Ct(An,`orchestration:operate`))return;st(e);let r=lt.add({type:`loading`,title:`Preparing the pull request checkout...`}),i=x(An,kn?.projectId??Pt.projectId),a=await xn(i).then(e=>e,()=>null);if(a===null){st(null),lt.update(r,{type:`error`,title:`Could not open a thread for the checkout`,description:`Try again from the project, or open a thread first.`});return}let o=await Nn.run({reference:Pt.url,mode:n,threadId:a.threadId});if(o._tag===`Failure`){st(null);let e=Nn.error instanceof Error?Nn.error.message:null;lt.update(r,{type:`error`,title:`Could not prepare the pull request checkout`,...e?{description:e}:{}});return}if(!await xn(i,{branch:o.value.branch,worktreePath:o.value.worktreePath,envMode:o.value.worktreePath===null?`local`:`worktree`}).then(e=>e!==null,()=>!1)){st(null),lt.update(r,{type:`error`,title:`Checked out, but the thread stayed where it was`,description:`The checkout is ready on \`${o.value.branch}\`. Point a thread at it from the branch picker, then ask again.`});return}st(null);let s={type:`warning`,title:`Checked out, but not on the latest commits`,description:`The checkout could not be moved onto the pull request's latest commits, so the code there is older than the pull request. Uncommitted work or local commits keep it where it is.`};if(t===null){lt.update(r,o.value.isOnPullRequestHead?{type:`success`,title:n===`local`?`Checked out here`:`Checked out`,description:n===`local`?`This repository is on the pull request's branch, with a thread open on it.`:`The pull request is in its own worktree, with a thread open on it.`}:s);return}await Kn(i,t,a),lt.update(r,o.value.isOnPullRequestHead?{type:`success`,title:`Checkout ready`,description:`The task is in the composer — read it over, then send.`}:s)},Yn=()=>{X&&qn(`ask`,{...Di({number:X.number,title:X.title,url:X.url,headBranch:X.headBranch,baseBranch:X.baseBranch,state:X.state,isDraft:X.isDraft})})},Xn=()=>{X&&qn(`explain`,{...ji({number:X.number,title:X.title,url:X.url,headBranch:X.headBranch,baseBranch:X.baseBranch,state:X.state,isDraft:X.isDraft})})},Zn=(e,t,n)=>{X&&qn(`guide-stop:${t}`,_i({number:X.number,title:X.title,url:X.url,headBranch:X.headBranch,baseBranch:X.baseBranch,state:X.state,isDraft:X.isDraft,stop:{index:t,title:e.title,summary:e.summary,attention:e.attention?.note??null,excerpts:e.excerpts},question:n}),{keepGuide:!0})},Qn=(e,t)=>{X&&qn(`selection:${e.comment.id}`,Ci({number:X.number,title:X.title,url:X.url,headBranch:X.headBranch,baseBranch:X.baseBranch,state:X.state,isDraft:X.isDraft,comment:e.comment,request:e.request}),t)},$n=e=>{Pt&&Jn(`checkout:${e}`,null,e)},er=e=>{X&&Jn(oi(e),yi({number:X.number,title:X.title,url:X.url,headBranch:X.headBranch,baseBranch:X.baseBranch,finding:e}))},tr=()=>{X&&Jn(`findings`,Ei({number:X.number,title:X.title,url:X.url,headBranch:X.headBranch,baseBranch:X.baseBranch,reviewThreads:X.reviewThreads,comments:X.comments,checks:kr?[]:X.checks,commentsTruncated:X.commentsTruncated}))},nr=()=>{Pt&&Jn(`conflicts`,{prompt:xi({number:Pt.number,url:Pt.url,headBranch:Pt.headBranch,baseBranch:Pt.baseBranch})})},rr=X?X.capabilities.mergeMethods.filter(e=>X.mergeCapabilities[e]):[],ir=nt?.pullRequestKey===N?nt.method:null,ar=pi(rr,ir,tt,Ze),or=Mi[ar],lr=`Auto-merge (${or.toLowerCase()})`,ur=X?.state===`open`&&X.mergeability===`conflicting`,dr=X?.state===`open`&&X.autoMergeEnabled===!0,fr=X?.autoMergeMethod,pr=fr?`Auto-merge (${Mi[fr].toLowerCase()})`:`Auto-merge`,mr=X?.state===`open`?X.workflowApprovalsRequired??0:0,hr=X===null?null:Ii(X),gr=At(e,e=>e.reviewGuidesEnabled),br=Sd.filter(e=>(e.value!==`code`||X===null||X.capabilities.diff)&&(e.value!==`guide`||gr));(0,Z.useEffect)(()=>{br.some(e=>e.value===H)||U(`summary`)},[H,br]);let xr=e=>X?.capabilities.actions.includes(e)===!0&&X.viewerPermissions.actions.includes(e),Cr=X?wr(X.checks):null,Tr=Ot?.checksState===void 0?Cr:Ot.checksState,Dr=Tr!==`failing`&&X?.checks.some(e=>e.status===`action-required`)?`pending`:Tr,kr=Dr!==Cr,Ar=X?ti({state:X.state,isDraft:X.isDraft,mergeability:X.mergeability,checksState:Dr,autoMergeEnabled:X.autoMergeEnabled,hasMergeMethod:rr.length>0,canMerge:Yt&&xr(`merge`),canMarkReady:xr(`ready`),canEnableAutoMerge:Yt&&xr(`enable-auto-merge`)}):null,jr=X?.state===`open`&&xr(X.isDraft?`ready`:`draft`)&&!(X.isDraft&&Ar===`ready`),Fr=Yt&&X?.state===`open`&&(dr&&xr(`disable-auto-merge`)||!dr&&Ar!==`enable-auto-merge`&&!X.isDraft&&!ur&&xr(`enable-auto-merge`)&&rr.length>0),Lr=Yt&&X?.state===`open`&&(Ar===`enable-auto-merge`||Ar===`auto-merge-armed`)&&xr(`merge`)&&!X.isDraft&&!ur&&rr.length>0,Rr=X?.state===`open`&&xr(`merge`)&&!X.isDraft&&!ur&&rr.length>1,Vr=X?_r({state:X.state,isDraft:X.isDraft}):null,Gr=X!==null&&Oi(X),Kr=Sn.some(t=>t.environmentId===e&&t.connection.phase===`connected`),qr=async()=>{X!==null&&await kt()?.dialogs.confirm([`Delete branch ${X.headBranch}?`,`This deletes ${X.headBranch} from ${X.headRepositoryNameWithOwner??X.repository}. Local branches and worktrees are not changed.`].join(`
215
- `),{variant:`destructive`})&&Fn(`delete-branch`)},Jr=mr>0&&!kr&&xr(`approve-workflows`),Yr=kr?Dr===null?`No checks reported`:Sr(Dr).label:X?Mr(X.checks):null,Qr=X&&!X.commentsTruncated?di(X.comments,X.commits).filter(e=>e.outcome===`approved`&&!e.stale).length:0,$r=g===`page`?(0,$.jsxs)(y,{children:[(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(Ce,{disabled:ot!==null||jn===null,render:(0,$.jsxs)(G,{size:`xs`,variant:`outline`,"aria-label":ot?.startsWith(`checkout`)?`Checking out...`:`Check out`,children:[(0,$.jsx)(be,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`@max-[35rem]/pr-header:hidden`,children:ot?.startsWith(`checkout`)?`Checking out...`:`Check out`}),(0,$.jsx)(fe,{"aria-hidden":!0,className:`size-3.5 text-muted-foreground`})]})})}),(0,$.jsx)(J,{children:`Check out this pull request`})]}),(0,$.jsxs)(oe,{align:`end`,side:`bottom`,children:[(0,$.jsxs)(W,{disabled:!zn,onClick:()=>$n(`worktree`),children:[(0,$.jsx)(be,{className:`mt-1 size-3.5 shrink-0 self-start`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{children:`In a separate worktree`}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Its own folder and thread. Nothing you have open moves.`})]})]}),(0,$.jsxs)(W,{disabled:!Nn.isAllowed,onClick:()=>$n(`local`),children:[(0,$.jsx)(ke,{className:`mt-1 size-3.5 shrink-0 self-start`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{children:`In this repository`}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:"Switches the branch you are working in, like `gh pr checkout`."})]})]}),Tn.length>0?(0,$.jsx)(Dd,{environments:Tn,value:An,onChange:e=>Dn({pullRequestKey:N,environmentId:e}),disabled:ot!==null}):null]})]}):null,ni=(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`span`,{className:`inline-flex shrink-0`,children:(0,$.jsxs)(G,{size:`xs`,variant:`destructive-outline`,disabled:ot!==null||Rn===null&&jn===null,onClick:nr,"aria-label":ot===`conflicts`?`Preparing...`:`Resolve conflicts`,children:[(0,$.jsx)(Ir.conflicting,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`@max-[30rem]/pr-header:hidden`,children:ot===`conflicts`?`Preparing...`:`Resolve conflicts`})]})})}),(0,$.jsx)(J,{side:`top`,children:ot===`conflicts`?`Preparing...`:`Resolve conflicts`})]});return ut.isPending&&!X?(0,$.jsx)(ul,{seed:P,summary:Ot,checkoutCommand:Ht,onCheckoutError:Ut,number:M.number,tabs:br,activeTab:H,...v?{onBack:v}:{},...h?{onClose:h}:{},actions:Pt?(0,$.jsxs)(yt,{delay:150,closeDelay:150,timeout:400,children:[Pt.state===`open`&&Pt.mergeability===`conflicting`?ni:null,$r]}):void 0}):(0,$.jsxs)(`div`,{className:`relative flex h-full min-h-0 w-full flex-col bg-background`,children:[F&&X?(0,$.jsx)(Jc,{display:`picker`,environmentId:e,reference:M,url:X.url,threadRef:null,onPickerOpenChange:R},`${e}:${X.url}`):null,(0,$.jsxs)(`div`,{className:K(`@container/pr-header grid min-w-0 shrink-0 grid-cols-[minmax(0,1fr)_auto] items-start gap-x-2`,X&&`border-b border-border/60`,!X&&!h&&`hidden`),children:[(0,$.jsxs)(`div`,{className:`pl-4 grid h-7 min-w-0 items-center overflow-hidden`,children:[(0,$.jsx)(`div`,{"aria-hidden":Re,inert:Re,className:K(`col-start-1 row-start-1 flex min-w-0 items-center gap-1 text-sm text-muted-foreground transition-[opacity,transform] ease-out motion-reduce:transform-none motion-reduce:transition-none sm:text-xs`,Re?`pointer-events-none -translate-y-1 opacity-0 duration-100`:`translate-y-0 opacity-100 delay-50 duration-150`),children:X&&Vr?(0,$.jsxs)($.Fragment,{children:[v?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(G,{size:`icon-micro`,variant:`ghost-muted`,onClick:v,className:`-ml-1.5`,"aria-label":`Back to this thread's pull requests`,children:(0,$.jsx)(j,{"aria-hidden":!0,className:`size-3.5`})})}),(0,$.jsx)(J,{side:`top`,children:`Back to pull requests`})]}):null,(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:Rt?(0,$.jsx)(`button`,{type:`button`,onClick:()=>void kt()?.shell.openExternal(Rt),className:`min-w-0 cursor-pointer truncate text-left font-medium text-muted-foreground underline-offset-2 hover:text-foreground hover:underline`,children:X.repository}):(0,$.jsx)(`span`,{className:`min-w-0 truncate font-medium text-muted-foreground`,children:X.repository})}),(0,$.jsx)(J,{side:`top`,children:Rt?`Open ${X.repository} repository`:X.repository})]}),(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void kt()?.shell.openExternal(X.url),onContextMenu:e=>Od(e,X),className:K(`inline-flex shrink-0 cursor-pointer items-center gap-0.5 font-medium underline-offset-2 hover:underline`,Vr.toneClassName),"aria-label":`Open pull request #${X.number} on host`,children:[`#`,X.number,(0,$.jsx)(O,{"aria-hidden":!0,className:`size-2.5`})]})}),(0,$.jsx)(J,{side:`top`,children:bl(zt)})]})]}):null}),(0,$.jsx)(`div`,{"aria-hidden":!Re,inert:!Re,className:K(`col-start-1 row-start-1 flex min-w-0 items-center gap-1 text-sm text-muted-foreground transition-[opacity,transform] ease-out motion-reduce:transform-none motion-reduce:transition-none sm:text-xs`,Re?`translate-y-0 opacity-100 delay-50 duration-150`:`pointer-events-none translate-y-1 opacity-0 duration-100`),children:X&&Vr?(0,$.jsxs)($.Fragment,{children:[v?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(G,{size:`icon-micro`,variant:`ghost-muted`,tabIndex:Re?0:-1,onClick:v,className:`-ml-1.5`,"aria-label":`Back to this thread's pull requests`,children:(0,$.jsx)(j,{"aria-hidden":!0,className:`size-3.5`})})}),(0,$.jsx)(J,{side:`top`,children:`Back to pull requests`})]}):null,(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsxs)(`button`,{type:`button`,tabIndex:Re?0:-1,onClick:()=>void kt()?.shell.openExternal(X.url),onContextMenu:e=>Od(e,X),className:K(`inline-flex shrink-0 cursor-pointer items-center gap-0.5 font-medium underline-offset-2 hover:underline`,Vr.toneClassName),"aria-label":`Open pull request #${X.number} on host`,children:[`#`,X.number,(0,$.jsx)(O,{"aria-hidden":!0,className:`size-2.5`})]})}),(0,$.jsx)(J,{side:`top`,children:bl(zt)})]}),(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground`,children:X.title})}),(0,$.jsx)(J,{side:`top`,children:X.title})]})]}):null})]}),(0,$.jsxs)(`div`,{className:`mr-4 flex h-7 shrink-0 items-center justify-end gap-1`,children:[X?(0,$.jsxs)(yt,{delay:150,closeDelay:150,timeout:400,children:[!qt&&Jt&&Kt.error?(0,$.jsx)(G,{variant:`ghost`,size:`xs`,onClick:Kt.refresh,children:`Retry stack lookup`}):null,qt?(0,$.jsx)(Lc,{hostLabel:zt.label,stack:qt,notice:Kt.notice,onRetry:Kt.error?Kt.refresh:void 0,reference:M,environmentId:e,onSelect:b,mergeMethod:ar,canMerge:Kt.isFresh&&Jt&&xr(`merge`)&&rr.length>0,canRebase:Kt.isFresh&&Jt&&X.viewerPermissions.stackRebase===!0,onActed:()=>{Qt(),m?.()}}):null,g===`page`?(0,$.jsx)(Jc,{display:`count`,environmentId:e,reference:M,url:X.url,threadRef:null}):null,dr&&Ar!==`auto-merge-armed`?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsxs)(te,{size:`control`,variant:`info`,role:`img`,"aria-label":pr,children:[(0,$.jsx)(Ir.merged,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`@max-[30rem]/pr-header:hidden`,children:pr})]})}),(0,$.jsxs)(J,{side:`top`,children:[pr,`: the host will merge this on its own once its requirements are met`]})]}):null,Ar===`resolve`?ni:Ar===`ready`?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`span`,{className:`inline-flex shrink-0`,children:(0,$.jsxs)(G,{size:`xs`,variant:`default`,disabled:mn,onClick:()=>void Fn(`ready`),"aria-label":`Ready for review`,children:[(0,$.jsx)(Ir.pullRequest,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`@max-[30rem]/pr-header:hidden`,children:`Ready for review`})]})})}),(0,$.jsx)(J,{side:`top`,children:`Ready for review`})]}):Ar===`enable-auto-merge`?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`span`,{className:`inline-flex shrink-0`,children:(0,$.jsxs)(G,{size:`xs`,variant:`default`,disabled:mn,...at.props(`enable-auto-merge`,()=>void Fn(`enable-auto-merge`,ar)),"aria-label":fn===`enable-auto-merge`?`Enabling...`:at.isArmed(`enable-auto-merge`)?`Confirm auto-merge?`:lr,children:[at.isArmed(`enable-auto-merge`)?(0,$.jsx)(me,{"aria-hidden":!0,className:`size-3.5`}):(0,$.jsx)(Ir.merged,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(xc,{className:`@max-[30rem]/pr-header:hidden`,children:(0,$.jsxs)(`span`,{className:`grid`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`invisible col-start-1 row-start-1`,children:lr}),(0,$.jsx)(`span`,{className:`col-start-1 row-start-1`,children:fn===`enable-auto-merge`?`Enabling...`:at.isArmed(`enable-auto-merge`)?`Confirm auto-merge?`:lr})]})})]})})}),(0,$.jsx)(J,{side:`top`,children:fn===`enable-auto-merge`?`Enabling...`:at.isArmed(`enable-auto-merge`)?`Confirm auto-merge?`:lr})]}):Ar===`auto-merge-armed`?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsxs)(te,{size:`control`,variant:`info`,role:`img`,"aria-label":pr,children:[(0,$.jsx)(Ir.merged,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`@max-[30rem]/pr-header:hidden`,children:pr})]})}),(0,$.jsxs)(J,{side:`top`,children:[pr,`: the host will merge this on its own once its requirements are met`]})]}):Ar===`merge`?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`span`,{className:`inline-flex shrink-0`,children:(0,$.jsxs)(G,{size:`xs`,variant:`default`,disabled:mn,...at.props(`merge`,()=>void Fn(`merge`,ar)),"aria-label":fn===`merge`?`Merging...`:at.isArmed(`merge`)?`Confirm merge?`:or,children:[at.isArmed(`merge`)?(0,$.jsx)(me,{"aria-hidden":!0,className:`size-3.5`}):(0,$.jsx)(Ir.merged,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(xc,{className:`@max-[30rem]/pr-header:hidden`,children:(0,$.jsxs)(`span`,{className:`grid`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`invisible col-start-1 row-start-1`,children:or}),(0,$.jsx)(`span`,{className:`col-start-1 row-start-1`,children:fn===`merge`?`Merging...`:at.isArmed(`merge`)?`Confirm merge?`:or})]})})]})})}),(0,$.jsx)(J,{side:`top`,children:fn===`merge`?`Merging...`:at.isArmed(`merge`)?`Confirm merge?`:or})]}):(Ar===`merged`||Ar===`closed`)&&Vr!==null?(0,$.jsx)(te,{size:`control`,variant:`outline`,children:(0,$.jsxs)(`span`,{className:K(`flex items-center gap-1`,Vr.toneClassName),children:[(0,$.jsx)(Vr.Icon,{className:`size-3.5`}),Vr.label]})}):null,$r,(0,$.jsxs)(y,{children:[(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(Ce,{render:(0,$.jsx)(G,{"aria-label":sn?`Refreshing pull request`:`More pull request actions`,size:`icon-xs`,variant:`ghost-muted`}),children:sn?(0,$.jsx)(ya,{refreshing:!0,size:`md`}):(0,$.jsx)(Me,{className:`size-4`})})}),(0,$.jsx)(J,{children:sn?`Refreshing pull request`:`More pull request actions`})]}),(0,$.jsxs)(oe,{align:`end`,side:`bottom`,children:[(0,$.jsx)(Jc,{display:`menu-item`,environmentId:e,reference:M,url:X.url,threadRef:o??(typeof _==`object`?_:null),onPickerOpenChange:R}),(0,$.jsxs)(W,{disabled:sn,onClick:()=>void cn(),children:[(0,$.jsx)(ya,{size:`sm`,refreshing:sn}),`Refresh`]}),(0,$.jsxs)(W,{disabled:ot!==null,onClick:Yn,children:[(0,$.jsx)(r,{className:`mt-1 size-3.5 shrink-0 self-start`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{children:ot===`ask`?`Opening...`:`Ask a question`}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Rn===null?`Opens a thread that knows which pull request you mean.`:`Adds the pull request to this thread's composer.`})]})]}),(0,$.jsxs)(W,{disabled:ot!==null,onClick:Xn,children:[(0,$.jsx)(De,{className:`mt-1 size-3.5 shrink-0 self-start`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{children:ot===`explain`?`Opening...`:`Explain this PR`}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`A walk through the diff and what to read closely.`})]})]}),(0,$.jsxs)(W,{disabled:ot!==null||!Bn,onClick:tr,children:[(0,$.jsx)(p,{className:`size-3.5`}),ot===`findings`?`Preparing...`:Hn.fixFindings]}),gr&&Un.canWrite?(0,$.jsxs)(W,{disabled:Un.running,onClick:Wn,children:[(0,$.jsx)(le,{className:`size-3.5`}),Un.running?`Writing guide...`:Un.data?.guide==null?`Write guide`:`Rewrite guide`]}):null,Tn.length>0?(0,$.jsx)(Dd,{environments:Tn,value:An,onChange:e=>Dn({pullRequestKey:N,environmentId:e}),disabled:ot!==null}):null,(0,$.jsx)(je,{}),X.state===`open`?(0,$.jsxs)($.Fragment,{children:[jr?(0,$.jsxs)(W,{disabled:mn,onClick:()=>void Fn(X.isDraft?`ready`:`draft`),children:[X.isDraft?(0,$.jsx)(Ir.pullRequest,{className:`size-3.5`}):(0,$.jsx)(Ir.draft,{className:`size-3.5`}),X.isDraft?`Ready for review`:`Convert to draft`]}):null,Lr?(0,$.jsxs)(W,{closeOnClick:at.isArmed(`merge`),"aria-label":at.isArmed(`merge`)?`Confirm merge?`:`Merge now`,disabled:mn,...at.props(`merge`,()=>void Fn(`merge`,ar)),children:[(0,$.jsx)(Ir.merged,{className:`size-3.5`}),at.isArmed(`merge`)?`Confirm merge?`:`Merge now`]}):null,dr&&xr(`disable-auto-merge`)?(0,$.jsxs)(W,{disabled:mn,onClick:()=>void Fn(`disable-auto-merge`),children:[(0,$.jsx)(Ir.merged,{className:`size-3.5`}),`Disable auto-merge`]}):Fr?(0,$.jsxs)(W,{closeOnClick:at.isArmed(`enable-auto-merge`),"aria-label":at.isArmed(`enable-auto-merge`)?`Confirm auto-merge?`:`Enable auto-merge`,disabled:mn,...at.props(`enable-auto-merge`,()=>void Fn(`enable-auto-merge`,ar)),children:[(0,$.jsx)(Ir.merged,{className:`size-3.5`}),at.isArmed(`enable-auto-merge`)?`Confirm auto-merge?`:`Enable auto-merge`]}):null,Rr?(0,$.jsxs)($.Fragment,{children:[jr||Lr||Fr?(0,$.jsx)(je,{}):null,(0,$.jsx)(I,{value:ar,onValueChange:e=>{let t=e;it(t),$e(t)},children:rr.map(e=>(0,$.jsx)(i,{value:e,disabled:mn,closeOnClick:!0,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(Ir.merged,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:Mi[e]})]})},e))})]}):null,Xr(jr,Fr||Lr,Rr)?(0,$.jsx)(je,{}):null]}):null,(0,$.jsxs)(W,{onClick:()=>void kt()?.shell.openExternal(X.url),children:[(0,$.jsx)(a,{className:`size-3.5`}),bl(zt)]}),(0,$.jsxs)(W,{onClick:()=>It(X.url,`PR link`),children:[(0,$.jsx)(L,{className:`size-3.5`}),`Copy link`,(0,$.jsx)(Se,{children:cr(Ft,`thread.copyReference`)})]}),(0,$.jsxs)(W,{onClick:()=>It(`#${M.number}`,`PR number`),children:[(0,$.jsx)(He,{className:`size-3.5`}),`Copy PR number`,(0,$.jsx)(Se,{children:cr(Ft,`pullRequest.copyNumber`)})]}),X.state===`open`&&xr(`close`)?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(je,{}),(0,$.jsxs)(W,{closeOnClick:at.isArmed(`close`),"aria-label":at.isArmed(`close`)?`Confirm close?`:`Close pull request`,variant:`destructive`,disabled:mn,...at.props(`close`,()=>void Fn(`close`)),children:[(0,$.jsx)(Ir.closed,{className:`size-3.5`}),at.isArmed(`close`)?`Confirm close?`:`Close pull request`]})]}):X.state===`closed`&&xr(`reopen`)?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(je,{}),(0,$.jsxs)(W,{disabled:mn,onClick:()=>void Fn(`reopen`),children:[(0,$.jsx)(Ir.reopen,{className:`size-3.5`}),`Reopen pull request`]})]}):X.state===`merged`&&xr(`revert`)?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(je,{}),(0,$.jsxs)(W,{closeOnClick:at.isArmed(`revert`),"aria-label":at.isArmed(`revert`)?`Confirm revert?`:`Revert changes`,variant:at.isArmed(`revert`)?`destructive`:`default`,disabled:mn,...at.props(`revert`,()=>void Fn(`revert`)),children:[(0,$.jsx)(ee,{className:`size-3.5`}),at.isArmed(`revert`)?`Confirm revert?`:`Revert changes`]})]}):null,Gr?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(je,{}),(0,$.jsxs)(W,{variant:`destructive`,disabled:mn||!Kr,onClick:()=>void qr(),children:[(0,$.jsx)(l,{className:`mt-1 size-3.5 shrink-0 self-start`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{children:fn===`delete-branch`?`Deleting branch...`:`Delete branch`}),(0,$.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:Kr?X.headBranch:`Reconnect to delete this branch`})]})]})]}):null]})]})]}):null,h?(0,$.jsx)(G,{size:`icon-xs`,variant:`ghost`,"aria-label":`Collapse pull request panel`,onClick:h,children:(0,$.jsx)(z,{className:`size-3.5`})}):null]}),(0,$.jsx)(`div`,{className:K(`col-span-2 grid`,Re?`grid-rows-[1fr]`:`grid-rows-[0fr] transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none`),children:(0,$.jsx)(`div`,{ref:Ke,className:K(`min-h-0 overflow-hidden transition-[opacity,transform] duration-150 ease-out motion-reduce:transform-none motion-reduce:transition-none`,Re?`translate-y-0 opacity-100 delay-50`:`translate-y-1 opacity-0 duration-100`),inert:!Re,children:X?(0,$.jsx)(`div`,{className:`col-span-2 min-w-0 px-4 pb-2 pt-1`,children:(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 shrink items-center gap-1.5 overflow-hidden text-xs text-muted-foreground`,children:[(0,$.jsx)(Or,{actor:X.author,profileUrl:Vt,variant:`avatar`,className:`shrink-0`}),(0,$.jsx)(`span`,{className:`shrink-0`,children:wn(X.updatedAt)})]}),(0,$.jsx)(`span`,{"aria-hidden":!0,className:`h-3 w-px shrink-0 bg-border/70`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1.5 font-mono text-2xs text-muted-foreground/65`,children:[hr?(0,$.jsxs)(kd,{baseBranch:X.baseBranch,freshness:hr,pending:mn,onUpdate:e=>void Fn(`update-branch`,void 0,e),iconClassName:`size-3`,className:`max-w-[40%]`,children:[Gt?(0,$.jsx)(Ir.stack,{"aria-label":`Stacked pull request`,className:`size-3 shrink-0`}):null,(0,$.jsx)(`code`,{className:`flex min-w-0`,children:(0,$.jsx)(ga,{value:X.baseBranch,showTitle:!1})})]}):(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-[40%] shrink-0 items-center gap-1`,children:[Gt?(0,$.jsx)(Ir.stack,{"aria-label":`Stacked pull request`,className:`size-3 shrink-0`}):null,(0,$.jsx)(`code`,{className:`flex min-w-0`,children:(0,$.jsx)(ga,{value:X.baseBranch,showTitle:!1})})]})}),(0,$.jsx)(J,{side:`top`,children:Gt?`Stacked on ${X.baseBranch}`:X.baseBranch})]}),(0,$.jsx)(j,{"aria-label":`receives changes from`,className:`size-3 shrink-0 opacity-60`}),(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`code`,{className:`flex min-w-0 flex-1`,children:(0,$.jsx)(ga,{value:X.headBranch,showTitle:!1})})}),(0,$.jsx)(J,{side:`top`,children:X.headBranch})]})]}),(0,$.jsxs)(`span`,{className:`ml-auto inline-flex shrink-0 items-center justify-end gap-2 text-2xs`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 tabular-nums`,"aria-label":`${X.changedFiles.toLocaleString()} changed ${X.changedFiles===1?`file`:`files`}`,children:[(0,$.jsx)(ne,{"aria-hidden":!0,className:`size-3`}),X.changedFiles.toLocaleString()]}),(0,$.jsx)(Er,{additions:X.additions,deletions:X.deletions,className:`shrink-0 font-mono text-2xs`})]})]})}):null})}),(0,$.jsx)(`div`,{className:K(`col-span-2 grid`,Re?`grid-rows-[0fr]`:`grid-rows-[1fr] transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none`),children:(0,$.jsx)(`div`,{ref:Ge,className:K(`min-h-0 overflow-hidden transition-[opacity,transform] duration-150 ease-out motion-reduce:transform-none motion-reduce:transition-none`,Re?`-translate-y-1 opacity-0 duration-100`:`translate-y-0 opacity-100 delay-50`),inert:Re,children:X?(0,$.jsx)($c,{title:vn===null?(0,$.jsxs)(el,{className:`group gap-1`,children:[(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`h1`,{className:`min-w-0 flex-1 truncate text-base font-semibold leading-snug`,children:X.title})}),(0,$.jsx)(J,{side:`top`,children:X.title})]}),ys(X)?(0,$.jsx)(Ss,{"aria-label":`Edit title`,onClick:()=>_n({pullRequestKey:N,text:X.title})}):null]}):(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(Vn,{autoFocus:!0,size:`sm`,disabled:yn,value:vn,"aria-label":`Pull request title`,onChange:e=>_n({pullRequestKey:N,text:e.target.value}),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),Ln(vn)):e.key===`Escape`&&(e.preventDefault(),_n(null))}}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(G,{size:`xs`,variant:`ghost`,disabled:yn,onClick:()=>_n(null),children:`Cancel`}),(0,$.jsx)(G,{size:`xs`,variant:`outline`,disabled:!ct||yn||vn.trim().length===0,onClick:()=>void Ln(vn),children:yn?`Saving...`:`Save`})]})]}),author:(0,$.jsx)(Or,{actor:X.author,profileUrl:Vt}),updated:(0,$.jsxs)(`span`,{children:[`updated `,wn(X.updatedAt)]}),checkout:Ht?(0,$.jsx)(rl,{value:Ht,target:`pull request checkout command`,copyLabel:`Copy checkout command`,copiedLabel:`Checkout command copied`,className:`ml-auto font-mono`,tooltipSide:`bottom`,onError:Ut},Ht):null,base:hr?(0,$.jsxs)(kd,{baseBranch:X.baseBranch,freshness:hr,pending:mn,onUpdate:e=>void Fn(`update-branch`,void 0,e),className:`max-w-[40%]`,children:[Gt?(0,$.jsx)(Ir.stack,{"aria-label":`Stacked pull request`,className:`size-3 shrink-0`}):null,(0,$.jsx)(`code`,{className:`flex min-w-0`,children:(0,$.jsx)(ga,{value:X.baseBranch,showTitle:!1})})]}):(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-[40%] shrink-0 items-center gap-1`,children:[Gt?(0,$.jsx)(Ir.stack,{"aria-label":`Stacked pull request`,className:`size-3 shrink-0`}):null,(0,$.jsx)(`code`,{className:`flex min-w-0`,children:(0,$.jsx)(ga,{value:X.baseBranch,showTitle:!1})})]})}),(0,$.jsx)(J,{side:`top`,children:Gt?`Stacked on ${X.baseBranch}`:X.baseBranch})]}),head:(0,$.jsx)(rl,{value:X.headBranch,target:`branch name`,copyLabel:`Copy pull request branch`,copiedLabel:`Branch name copied`},X.headBranch),files:`${X.changedFiles.toLocaleString()} ${X.changedFiles===1?`file`:`files`}`,diffStat:(0,$.jsx)(Er,{additions:X.additions,deletions:X.deletions,className:`shrink-0 font-mono text-xs`})}):null})}),X?(0,$.jsx)(tl,{tabs:br,value:H,onValueChange:U,onTabIntent:e=>{e===`code`&&Cd()},children:H===`summary`?Jr?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`span`,{className:`ml-auto inline-flex shrink-0`,children:(0,$.jsxs)(G,{size:`xs`,variant:`warning-outline`,disabled:mn,...at.props(`approve-workflows`,()=>void Fn(`approve-workflows`)),"aria-label":fn===`approve-workflows`?`Approving...`:at.isArmed(`approve-workflows`)?`Confirm approve?`:`Approve workflows to run`,children:[(0,$.jsx)(_e,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsxs)(`span`,{className:`inline-grid`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`invisible col-start-1 row-start-1`,children:`Approve workflows to run`}),(0,$.jsx)(`span`,{"aria-hidden":!0,className:`invisible col-start-1 row-start-1`,children:`Confirm approve?`}),(0,$.jsx)(`span`,{className:`col-start-1 row-start-1`,children:fn===`approve-workflows`?`Approving...`:at.isArmed(`approve-workflows`)?`Confirm approve?`:`Approve workflows to run`})]})]})})}),(0,$.jsx)(J,{side:`top`,children:fn===`approve-workflows`?`Approving...`:at.isArmed(`approve-workflows`)?`Confirm approve?`:`Approve workflows to run`})]}):(0,$.jsx)(nl,{className:`text-muted-foreground`,"aria-label":Yr?`Checks: ${Yr}`:`Checks`,icon:Dr===null?(0,$.jsx)(f,{"aria-hidden":!0,className:`size-3.5`}):(0,$.jsx)(Mu,{checks:X.checks,stale:kr,checksState:Dr,threadRef:o}),label:Yr}):H===`timeline`?(0,$.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsxs)(vr,{className:K(`whitespace-nowrap text-2xs transition-opacity`,(Xt||Zt)&&`opacity-35`),children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,"aria-label":Zt?`Comments unavailable`:`${X.commentCount.toLocaleString()} ${X.commentCount===1?`comment`:`comments`}`,children:[(0,$.jsx)(Ae,{"aria-hidden":!0,className:`size-3`}),Zt?`—`:Xt?`…`:X.commentCount.toLocaleString()]}),(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,"aria-label":Zt?`Commits unavailable`:`${X.commits.length.toLocaleString()} ${X.commits.length===1?`commit`:`commits`}`,children:[(0,$.jsx)(pe,{"aria-hidden":!0,className:`size-3`}),Zt?`—`:Xt?`…`:X.commits.length.toLocaleString()]}),Qr>0?(0,$.jsxs)(`span`,{className:K(`inline-flex items-center gap-1`,Nr(`approved`)),children:[(0,$.jsx)(yr,{outcome:`approved`,className:`size-3`}),Qr.toLocaleString(),(0,$.jsx)(`span`,{className:`sr-only`,children:Qr===1?`approval`:`approvals`})]}):null]}),(0,$.jsxs)(G,{size:`xs`,variant:`ghost-muted`,"aria-label":ie===`newest`?`Show oldest activity first`:`Show newest activity first`,onClick:()=>ae(e=>e===`newest`?`oldest`:`newest`),children:[(0,$.jsx)(S,{"aria-hidden":!0,className:`size-3`}),ie===`newest`?`Newest first`:`Oldest first`]})]}):null}):null]}),(0,$.jsx)(`div`,{className:`relative flex min-h-0 flex-1 flex-col overflow-hidden`,onScrollCapture:e=>{let t=ze.current[H];if(e.target!==t||t==null)return;let n=t.scrollTop;Fe(e=>{let r=e,i=Ge.current?.scrollHeight??0,a=i-(Ke.current?.scrollHeight??0);return e?n<4&&i>0&&(r=!1):i>0&&n>i+32&&(Je.current={tab:H,scroller:t,delta:-a},r=!0),Le.current[H]=r,r})},children:ut.error&&!X?(0,$.jsx)(yl,{...ui(ut.failure)?{title:`Pull request #${M.number} not found`,error:`It may be an issue rather than a pull request, or this account can't see it.`}:{error:ut.error},refreshing:ut.isPending,onRetry:Qt,...Cn?{gitHubUrl:Cn}:{}}):X?(0,$.jsxs)(Us,{value:Bt,children:[Ne.has(`summary`)?(0,$.jsx)(`div`,{className:K(`absolute inset-0`,H!==`summary`&&`invisible`),children:(0,$.jsx)(ru,{scrollerRef:Ve.summary,environmentId:e,threadRef:o,reference:M,detail:X,activityPending:Xt,checksStale:kr,activityError:Zt,pendingFinding:ot,fixFindingLabel:Hn.fixFinding,fixCheckLabel:Hn.fixCheck,...Bn?{onFixFinding:er}:{},onRefresh:Qt,onRefreshChecks:cn})}):null,Ne.has(`guide`)?(0,$.jsx)(`div`,{className:K(`absolute inset-0`,H!==`guide`&&`invisible`),children:(0,$.jsx)(hd,{environmentId:e,reference:M,active:H===`guide`,title:X.title,workspaceRoot:X.workspaceRoot,canComment:X.capabilities.review.inlineComment&&X.viewerPermissions.comment,onAskAboutLines:(e,t)=>Qn({comment:e,request:t},{keepGuide:!0}),onAskAboutStop:Zn,onFinishReview:X.capabilities.review.verdicts.some(e=>X.viewerPermissions.verdicts.includes(e))?()=>V(e=>e+1):null,onOpenFile:xe,onTourShown:C})}):null,Ne.has(`timeline`)?(0,$.jsx)(`div`,{className:K(`absolute inset-0`,H!==`timeline`&&`invisible`),children:Xt?(0,$.jsx)(ml,{}):Zt?(0,$.jsx)(vl,{error:Zt,onRetry:ft.refresh}):(0,$.jsx)(Eu,{scrollerRef:Ve.timeline,detail:X,environmentId:e,threadRef:o,reference:M,order:ie,onOpenCommit:ge,onRefresh:Qt})}):null,Ne.has(`code`)?(0,$.jsx)(`div`,{className:K(`absolute inset-0`,H!==`code`&&`invisible`),children:(0,$.jsx)(Z.Suspense,{fallback:(0,$.jsx)(Ao,{label:`Loading pull request diff...`}),children:(0,$.jsx)(wd,{scrollerRef:Ve.code,onAddToAgentSelection:Qn,environmentId:e,reference:M,detail:X,selectedCommitOid:de,onSelectedCommitChange:he,pendingFinding:ot,fixFindingLabel:Hn.fixFinding,...Bn?{onFixFinding:er}:{},onRefresh:Qt,refreshToken:tn,revealRequest:ve})})}):null]}):null}),X?(0,$.jsx)(`div`,{className:`absolute right-4 bottom-3 z-20`,children:(0,$.jsx)(jl,{environmentId:e,reference:M,detail:X,actionPending:mn,onCommentAction:In,onCommented:Qt,onReviewSubmitted:Qt,openReviewRequest:B},JSON.stringify([e,M.projectId,M.host,M.repository,M.number]))}):null]})}function jd(e){let t=(0,Q.c)(36),{entry:n,hostActions:r,visible:i,onActed:a,closing:o,sweeping:s,onCloseSweepStart:c}=e,l=o!==void 0&&o,u=s!==void 0&&s,d;t[0]===n.environmentId?d=t[1]:(d=Ur.runAction.permissionAtom(n.environmentId),t[0]=n.environmentId,t[1]=d);let f=re(d),p=Sa(n.environmentId,n.projectId),m;t[2]!==n.host||t[3]!==n.number||t[4]!==n.projectId||t[5]!==n.repository?(m={projectId:n.projectId,host:n.host,repository:n.repository,number:n.number},t[2]=n.host,t[3]=n.number,t[4]=n.projectId,t[5]=n.repository,t[6]=m):m=t[6];let h=m,g;t[7]!==n||t[8]!==a?(g=e=>a?.({entry:n,action:e}),t[7]=n,t[8]=a,t[9]=g):g=t[9];let _;t[10]===p?_=t[11]:(_=e=>{let t=e.capabilities.mergeMethods.filter(t=>e.mergeCapabilities[t]);if(t.length===0)throw Error(`No merge method is available for this repository.`);return pi(t,null,p(),Ji.getState().pullRequestMergeMethod)},t[10]=p,t[11]=_);let v;t[12]!==n.environmentId||t[13]!==h||t[14]!==g||t[15]!==_?(v={environmentId:n.environmentId,reference:h,onSuccess:g,resolveMergeMethod:_},t[12]=n.environmentId,t[13]=h,t[14]=g,t[15]=_,t[16]=v):v=t[16];let{actionPending:y,perform:b}=wa(v),x,S;if(t[17]!==y||t[18]!==f||t[19]!==l||t[20]!==n||t[21]!==r||t[22]!==c||t[23]!==b||t[24]!==u||t[25]!==i){S=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Vr(n,r),a=y||l||u;if(e.length===0){S=null;break bb0}let o=i||a?`flex`:`none`,s;t[28]===o?s=t[29]:(s={display:o},t[28]=o,t[29]=s);let d;t[30]!==a||t[31]!==f||t[32]!==n||t[33]!==c||t[34]!==b?(d=e=>{let t=Md[e].label,r=Md[e].Icon;return(0,$.jsxs)(Y,{children:[(0,$.jsxs)(q,{render:(0,$.jsx)(G,{variant:e===`close`?`destructive-outline`:`outline`,size:`xs`,disabled:!f||a||e===`merge`&&n.stack!==void 0,"aria-label":`${t} #${n.number}`,onClick:()=>void b(e),onPointerDown:t=>{e===`close`&&t.isPrimary&&t.button===0&&(t.stopPropagation(),c?.(n,t.nativeEvent))}}),children:[a?(0,$.jsx)(ct,{size:`xs`}):(0,$.jsx)(r,{"aria-hidden":!0,className:`size-3`}),t]}),(0,$.jsx)(J,{children:e===`merge`&&n.stack?`Open this pull request to merge its stack`:e===`close`&&c?`Close immediately, or drag across rows to close several`:`${t} immediately`})]},e)},t[30]=a,t[31]=f,t[32]=n,t[33]=c,t[34]=b,t[35]=d):d=t[35],x=(0,$.jsx)(`div`,{className:`shrink-0 items-center gap-1 pr-3`,style:s,role:`group`,"aria-label":`Quick actions for pull request #${n.number}`,"data-pull-request-action-pending":y||l,children:e.map(d)})}t[17]=y,t[18]=f,t[19]=l,t[20]=n,t[21]=r,t[22]=c,t[23]=b,t[24]=u,t[25]=i,t[26]=x,t[27]=S}else x=t[26],S=t[27];return S===Symbol.for(`react.early_return_sentinel`)?x:S}var Md={close:{label:`Close`,Icon:Ir.closed},merge:{label:`Merge`,Icon:Ir.merged},ready:{label:`Ready for review`,Icon:Ir.pullRequest},reopen:{label:`Reopen`,Icon:Ir.reopen}},Nd=`group/pr-row flex w-full items-center gap-2 rounded-md py-1 pr-1 text-left`,Pd=`shrink-0 font-mono text-xs tabular-nums text-muted-foreground`;function Fd(e){let t=(0,Q.c)(23),{state:n,isDraft:r,mergeability:i,baseBranch:a,below:o,className:s}=e,c;t[0]===s?c=t[1]:(c=K(`flex w-4 shrink-0 flex-col items-center gap-0.5`,s),t[0]=s,t[1]=c);let l;t[2]!==r||t[3]!==n?(l=(0,$.jsx)(br,{state:n,isDraft:r}),t[2]=r,t[3]=n,t[4]=l):l=t[4];let u;t[5]===i?u=t[6]:(u=i===void 0?{}:{mergeability:i},t[5]=i,t[6]=u);let d;t[7]===a?d=t[8]:(d=a===void 0?{}:{baseBranch:a},t[7]=a,t[8]=d);let f;t[9]!==r||t[10]!==n||t[11]!==u||t[12]!==d?(f=(0,$.jsx)(`span`,{className:`absolute -right-1 -bottom-1 inline-flex`,children:(0,$.jsx)(gr,{state:n,isDraft:r,...u,...d,className:`size-3 fill-background [stroke-width:2.5]`})}),t[9]=r,t[10]=n,t[11]=u,t[12]=d,t[13]=f):f=t[13];let p;t[14]!==l||t[15]!==f?(p=(0,$.jsxs)(`span`,{className:`relative inline-flex`,children:[l,f]}),t[14]=l,t[15]=f,t[16]=p):p=t[16];let m;t[17]===o?m=t[18]:(m=o?(0,$.jsx)(`span`,{className:`inline-flex text-2xs`,children:o}):null,t[17]=o,t[18]=m);let h;return t[19]!==c||t[20]!==p||t[21]!==m?(h=(0,$.jsxs)(`span`,{className:c,children:[p,m]}),t[19]=c,t[20]=p,t[21]=m,t[22]=h):h=t[22],h}function Id(e){let t=(0,Q.c)(22),{number:n,title:r,status:i,signals:a,meta:o,metaClassName:s,updatedAt:c}=e,l;t[0]===r?l=t[1]:(l=(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm`,children:r}),t[0]=r,t[1]=l);let u;t[2]===a?u=t[3]:(u=a?(0,$.jsx)(`span`,{className:`flex shrink-0 items-center gap-1 text-2xs`,children:a}):null,t[2]=a,t[3]=u);let d;t[4]===i?d=t[5]:(d=i?(0,$.jsx)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5 text-2xs`,children:i}):null,t[4]=i,t[5]=d);let f;t[6]!==n||t[7]!==l||t[8]!==u||t[9]!==d?(f=(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[n,l,u,d]}),t[6]=n,t[7]=l,t[8]=u,t[9]=d,t[10]=f):f=t[10];let p;t[11]===s?p=t[12]:(p=K(`flex min-w-0 items-center gap-1.5 overflow-hidden text-2xs text-muted-foreground`,s),t[11]=s,t[12]=p);let m;t[13]===c?m=t[14]:(m=c?(0,$.jsx)(`span`,{className:`ml-auto shrink-0 whitespace-nowrap tabular-nums`,children:wn(c)}):null,t[13]=c,t[14]=m);let h;t[15]!==o||t[16]!==p||t[17]!==m?(h=(0,$.jsxs)(`span`,{className:p,children:[o,m]}),t[15]=o,t[16]=p,t[17]=m,t[18]=h):h=t[18];let g;return t[19]!==f||t[20]!==h?(g=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[f,h]}),t[19]=f,t[20]=h,t[21]=g):g=t[21],g}function Ld(e){let t=(0,Q.c)(20),{actor:n,className:r,labelClassName:i}=e,a=n?.login??`ghost`,o;t[0]===r?o=t[1]:(o=K(`inline-flex min-w-0 items-center gap-1`,r),t[0]=r,t[1]=o);let s;t[2]===o?s=t[3]:(s=(0,$.jsx)(`span`,{className:o}),t[2]=o,t[3]=s);let c;t[4]===n?c=t[5]:(c=(0,$.jsx)(Tr,{actor:n,className:`size-3.5`}),t[4]=n,t[5]=c);let l;t[6]===i?l=t[7]:(l=K(`truncate`,i),t[6]=i,t[7]=l);let u;t[8]!==a||t[9]!==l?(u=(0,$.jsx)(`span`,{className:l,children:a}),t[8]=a,t[9]=l,t[10]=u):u=t[10];let d;t[11]!==s||t[12]!==c||t[13]!==u?(d=(0,$.jsxs)(q,{render:s,children:[c,u]}),t[11]=s,t[12]=c,t[13]=u,t[14]=d):d=t[14];let f=n?.name&&n.name!==a?`${n.name} (@${a})`:a,p;t[15]===f?p=t[16]:(p=(0,$.jsx)(J,{side:`top`,children:f}),t[15]=f,t[16]=p);let m;return t[17]!==d||t[18]!==p?(m=(0,$.jsxs)(Y,{children:[d,p]}),t[17]=d,t[18]=p,t[19]=m):m=t[19],m}function Rd(e){let t=(0,Q.c)(8),{head:n,base:r}=e,i;t[0]===n?i=t[1]:(i=(0,$.jsx)(ga,{value:n}),t[0]=n,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(`span`,{className:`shrink-0`,children:`→`}),t[2]=a):a=t[2];let o;t[3]===r?o=t[4]:(o=(0,$.jsx)(ga,{value:r,className:`max-w-[45%] shrink-0`}),t[3]=r,t[4]=o);let s;return t[5]!==i||t[6]!==o?(s=(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 font-mono`,children:[i,a,o]}),t[5]=i,t[6]=o,t[7]=s):s=t[7],s}var zd=[`[data-slot="dialog-popup"]`,`[data-slot="alert-dialog-popup"]`,`[data-slot="command-dialog-popup"]`,`[data-slot="menu-popup"]`,`[data-slot="select-popup"]`,`[data-slot="popover-popup"]`,`[data-slot="combobox-popup"]`,`[data-slot="autocomplete-popup"]`].join(`,`),Bd={browser:`Only available in the desktop app.`,terminal:`Available when a project is open.`,files:`Available when a project is open.`,diff:`Available for Git repositories.`,pullRequest:`No pull request on this branch yet.`,pullRequests:`No linked pull requests available.`,device:`Available from a thread.`},Vd=1,Hd=[va,ha];function Ud(e){return e?.querySelector(`[data-slot="scroll-area-viewport"]`)??null}function Wd(e,t){return e.kind!==`preview`||!e.resourceId?null:t[e.resourceId]?.tabId??null}function Gd(e){return{label:e.overlay?.audioMuted??!1?`Unmute tab`:`Mute tab`,disabled:e.overlay===null||!e.canResolveRuntimeTabId}}function Kd(e){return e?.audible?e.audioMuted?`muted`:`audible`:`none`}function qd(e,t){return t.defaultPrevented||t.isComposing||t.metaKey||t.ctrlKey||t.altKey?null:e.find(e=>e.available&&e.shortcut.toLowerCase()===t.key.toLowerCase())??null}function Jd(e){return e?.closest(`input, textarea, select, [contenteditable]:not([contenteditable="false"])`)!=null}function Yd(e){let t=(0,Q.c)(7),n;t[0]===e.trigger?n=t[1]:(n=(0,$.jsx)(q,{render:e.trigger}),t[0]=e.trigger,t[1]=n);let r;t[2]===e.reason?r=t[3]:(r=(0,$.jsx)(J,{side:`top`,children:e.reason}),t[2]=e.reason,t[3]=r);let i;return t[4]!==n||t[5]!==r?(i=(0,$.jsxs)(Y,{children:[n,r]}),t[4]=n,t[5]=r,t[6]=i):i=t[6],i}function Xd(e){let t=(0,Q.c)(14),[n,r]=(0,Z.useState)(-1),i=[{label:`Browser`,icon:c,shortcut:`B`,available:e.browserAvailable,disabledReason:Bd.browser,onClick:e.onAddBrowser},{label:`Terminal`,icon:Fe,shortcut:`T`,available:e.terminalAvailable,disabledReason:Bd.terminal,onClick:e.onAddTerminal},{label:`Files`,icon:xe,shortcut:`F`,available:e.filesAvailable,disabledReason:Bd.files,onClick:e.onAddFiles},...e.onAddDesign?[{label:`Design`,icon:Ve,shortcut:`G`,available:e.filesAvailable,disabledReason:`Open a project to use Design.`,onClick:e.onAddDesign}]:[],{label:`Diff`,icon:ne,shortcut:`D`,available:e.diffAvailable,disabledReason:Bd.diff,onClick:e.onAddDiff},{label:`Pull request`,icon:Ir.pullRequest,shortcut:`P`,available:e.pullRequestAvailable,disabledReason:Bd.pullRequest,onClick:e.onAddPullRequest},{label:`Linked pull requests`,icon:Ir.link,shortcut:`L`,available:e.pullRequestsAvailable,disabledReason:Bd.pullRequests,onClick:e.onAddPullRequests},{label:`Device`,description:`Watch an iOS Simulator or Android Emulator.`,icon:Oe,shortcut:`M`,available:e.deviceAvailable,disabledReason:Bd.device,onClick:e.onAddDevice}],a=i.filter(ef),o=a.length===0?-1:Math.min(n,a.length-1),s=(0,Z.useRef)(a);(0,Z.useEffect)(()=>{s.current=a});let l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=[],t[0]=l):l=t[0],(0,Z.useEffect)(()=>{let e=e=>{let t=qd(s.current,e);if(!t||document.querySelector(zd))return;let n=e.composedPath()[0]??e.target;n instanceof Element&&Jd(n)||(e.preventDefault(),e.stopPropagation(),t.onClick())};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},l);let u=e=>{if(!(e.defaultPrevented||e.metaKey||e.ctrlKey||e.altKey)&&a.length!==0){if(e.key===`ArrowDown`||e.key===`ArrowRight`){e.preventDefault(),r((o+1)%a.length);return}if(e.key===`ArrowUp`||e.key===`ArrowLeft`){e.preventDefault(),r(o===-1?a.length-1:(o-1+a.length)%a.length);return}if(e.key===`Enter`){if(e.target!==e.currentTarget)return;let t=a[o];if(!t)return;e.preventDefault(),t.onClick()}}},d=$d,f=e=>o!==-1&&a[o]===e,p=Qd,m;t[1]===a?m=t[2]:(m=a.map(Zd),t[1]=a,t[2]=m);let h=m.join(``),g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(`h3`,{className:`mb-3 font-medium text-foreground text-sm`,children:`Tools`}),t[3]=g):g=t[3];let _=i.map(t=>t.available?(0,$.jsxs)(`div`,{className:`group relative`,onMouseEnter:()=>r(a.indexOf(t)),onMouseLeave:()=>r(e=>e===a.indexOf(t)?-1:e),children:[(0,$.jsxs)(`button`,{type:`button`,onClick:t.onClick,className:K(`flex h-10 w-full cursor-pointer items-center gap-3 rounded-lg bg-card px-3.5 text-left text-sm transition-colors group-hover:bg-card/60`,f(t)&&`bg-card/60`),children:[p(t,`size-4`),(0,$.jsx)(`span`,{className:K(`min-w-0 flex-1 truncate`,t.label===`Browser`&&e.browserProfiles.length>1&&`pr-8`),children:t.label}),(0,$.jsx)(la,{variant:`pill`,children:t.shortcut})]}),t.label===`Browser`&&e.browserProfiles.length>1?(0,$.jsxs)(y,{children:[(0,$.jsx)(Ce,{render:(0,$.jsx)(G,{"aria-label":`Open browser in a profile`,className:`absolute top-1/2 right-10 -translate-y-1/2`,size:`icon-xs`,variant:`ghost-muted`}),children:(0,$.jsx)(fe,{className:`size-3.5`})}),(0,$.jsx)(oe,{align:`end`,side:`bottom`,sideOffset:6,className:`max-w-56`,children:e.browserProfiles.map(t=>(0,$.jsx)(W,{onClick:()=>e.onAddBrowserInProfile(t.id),children:(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:t.name})},t.id))})]}):null]},t.label):(0,$.jsx)(Yd,{reason:t.disabledReason,trigger:(0,$.jsxs)(`div`,{tabIndex:0,"aria-disabled":`true`,className:`flex h-10 w-full cursor-default items-center gap-3 rounded-lg bg-card px-3.5 text-left text-sm opacity-50`,children:[p(t,`size-4`),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.label}),(0,$.jsx)(la,{variant:`pill`,children:t.shortcut})]})},t.label)),v;t[4]===_?v=t[5]:(v=(0,$.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(14rem,1fr))] gap-x-3 gap-y-2`,children:_}),t[4]=_,t[5]=v);let b;t[6]!==v||t[7]!==g?(b=(0,$.jsxs)(`div`,{className:`w-full max-w-3xl`,children:[g,v]}),t[6]=v,t[7]=g,t[8]=b):b=t[8];let x;return t[9]!==d||t[10]!==u||t[11]!==b||t[12]!==h?(x=(0,$.jsx)(`div`,{ref:d,tabIndex:0,onKeyDown:u,"aria-label":`Open a surface`,"data-surface-launcher-keys":h,className:`scrollbar-gutter-both flex min-h-0 flex-1 flex-col overflow-y-auto bg-muted px-5 py-6 outline-none`,children:b}),t[9]=d,t[10]=u,t[11]=b,t[12]=h,t[13]=x):x=t[13],x}function Zd(e){return e.shortcut}function Qd(e,t){let n=t===void 0?`size-4`:t,r=e.icon;return(0,$.jsx)(`span`,{className:`relative inline-flex shrink-0 text-muted-foreground`,children:(0,$.jsx)(r,{className:n})})}function $d(e){e?.focus()}function ef(e){return e.available}function tf(e,t,n){switch(e.kind){case`diff`:return`Diff`;case`design`:return`Design`;case`files`:return`Files`;case`file`:return e.relativePath.slice(Math.max(e.relativePath.lastIndexOf(`/`),e.relativePath.lastIndexOf(`\\`))+1);case`terminal`:return n.get(e.activeTerminalId)??Vi(e.activeTerminalId);case`pull-request`:return`#${e.number}`;case`pull-requests`:return`Pull requests`;case`device`:return e.title??e.target?.name??`Device`;case`preview`:{let n=e.resourceId?t[e.resourceId]:null;if(!n||n.navStatus._tag===`Idle`)return`New tab`;if(n.navStatus.title.trim().length>0)return n.navStatus.title;try{return new URL(n.navStatus.url).host||`Browser`}catch{return`Browser`}}}}function nf(e){let t=(0,Q.c)(8),{capturedUrl:n,url:r}=e,i;t[0]===r?i=t[1]:(i=tt(r,32),t[0]=r,t[1]=i);let a=i,o;t[2]!==n||t[3]!==a?(o=[n,a],t[2]=n,t[3]=a,t[4]=o):o=t[4];let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(c,{className:`size-3 shrink-0`}),t[5]=s):s=t[5];let l;return t[6]===o?l=t[7]:(l=(0,$.jsx)(ps,{sources:o,fallback:s,className:`size-3 shrink-0 rounded-sm object-contain`}),t[6]=o,t[7]=l),l}function rf(e,t){try{return new URL(e).origin===new URL(t).origin}catch{return!1}}function af(e){let t=(0,Q.c)(17),{surface:n,sessions:r,desktopByTabId:i,theme:a,environmentId:o,pullRequestStatusSeeds:s}=e;switch(n.kind){case`preview`:{let e=n.resourceId?r[n.resourceId]:null,a=!e||e.navStatus._tag===`Idle`?null:e.navStatus.url,o=e?i[e.tabId]?.favicon??null:null,s=o&&a&&rf(o.pageUrl,a)?o.dataUrl:null,c;return t[0]!==s||t[1]!==a?(c=(0,$.jsx)(nf,{capturedUrl:s,url:a}),t[0]=s,t[1]=a,t[2]=c):c=t[2],c}case`diff`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ne,{className:`size-3 shrink-0`}),t[3]=e):e=t[3],e}case`design`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ve,{className:`size-3 shrink-0`}),t[4]=e):e=t[4],e}case`files`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(xe,{className:`size-3 shrink-0`}),t[5]=e):e=t[5],e}case`file`:{let e;return t[6]!==n.relativePath||t[7]!==a?(e=(0,$.jsx)(dr,{pathValue:n.relativePath,kind:`file`,theme:a,className:`size-3`}),t[6]=n.relativePath,t[7]=a,t[8]=e):e=t[8],e}case`terminal`:{let e;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Fe,{className:`size-3 shrink-0`}),t[9]=e):e=t[9],e}case`pull-request`:{let e=s?.[n.id],r;return t[10]!==o||t[11]!==n||t[12]!==e?(r=(0,$.jsx)(sf,{surface:n,environmentId:o,seed:e}),t[10]=o,t[11]=n,t[12]=e,t[13]=r):r=t[13],r}case`pull-requests`:{let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ir.link,{className:`size-3 shrink-0`}),t[14]=e):e=t[14],e}case`device`:{let e;return t[15]===n.target?.platform?e=t[16]:(e=n.target?.platform===`ios`?(0,$.jsx)(lr,{className:`size-3 shrink-0`}):n.target?.platform===`android`?(0,$.jsx)(ur,{className:`size-3 shrink-0`}):(0,$.jsx)(Oe,{className:`size-3 shrink-0`}),t[15]=n.target?.platform,t[16]=e),e}}}function of(e,t,n,r){if(t===null||n===null)return;let i;for(let a of e)if(a.environmentId===t)for(let e of $e(a.pullRequests))Ze(e,{host:n,repository:r.repository,number:r.number})&&(i===void 0||(e.snapshot?.syncedAt??``)>(i.snapshot?.syncedAt??``))&&(i=e);return i}function sf(e){let t=(0,Q.c)(11),{surface:n,environmentId:r,seed:i}=e,a=n.environmentId??r,o=We(),s=Ke(),c;t[0]!==a||t[1]!==n.projectId?(c=e=>e.environmentId===a&&e.id===n.projectId,t[0]=a,t[1]=n.projectId,t[2]=c):c=t[2];let l=o.find(c)?.repositoryIdentity,u=n.host??(l?.provider?T(l,l.provider):null),d=qe(),f=a===null?void 0:d.get(a)?.environment.capabilities,p=f?.threadPullRequests===!0?of(s,a,u,n)?.snapshot??null:null,m=wt(a===null||f?.pullRequests!==!0||p!==null?null:Ur.detail({environmentId:a,input:{projectId:n.projectId,...f?.threadPullRequests===!0&&n.host!==void 0?{host:n.host}:{},repository:n.repository,number:n.number}})).data,h=n.projectId,g;t[3]!==n.number||t[4]!==n.repository||t[5]!==h?(g={projectId:h,repository:n.repository,number:n.number},t[3]=n.number,t[4]=n.repository,t[5]=h,t[6]=g):g=t[6];let _=Wr(a,g,null),v=p??Hr(m,_)??i??null;if(v===null){let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ir.pullRequest,{className:`size-3 shrink-0 text-muted-foreground`}),t[7]=e):e=t[7],e}let y=_r({state:v.state,isDraft:v.isDraft??m?.isDraft??i?.isDraft??!1}),b=y.Icon,x=K(`size-3 shrink-0`,y.toneClassName),S;return t[8]!==y||t[9]!==x?(S=(0,$.jsx)(b,{className:x}),t[8]=y,t[9]=x,t[10]=S):S=t[10],S}function cf(e){let t=(0,Q.c)(13),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={activationConstraint:{distance:6}},t[0]=n):n=t[0];let r=Zi(Qi(Xi,n)),i;t[1]===e.surfaces?i=t[2]:(i=e.surfaces.map(lf),t[1]=e.surfaces,t[2]=i);let a=i,{onMove:o,surfaces:s}=e,c;t[3]!==o||t[4]!==s?(c=e=>{let{active:t,over:n}=e;if(!n||t.id===n.id)return;let r=s.findIndex(e=>e.id===n.id);r>=0&&o?.(String(t.id),r)},t[3]=o,t[4]=s,t[5]=c):c=t[5];let l=c,u;t[6]!==e.children||t[7]!==a?(u=(0,$.jsx)(ta,{items:a,strategy:$i,children:e.children}),t[6]=e.children,t[7]=a,t[8]=u):u=t[8];let d;return t[9]!==l||t[10]!==r||t[11]!==u?(d=(0,$.jsx)(ea,{sensors:r,collisionDetection:na,modifiers:Hd,onDragEnd:l,children:u}),t[9]=l,t[10]=r,t[11]=u,t[12]=d):d=t[12],d}function lf(e){return e.id}function uf(e){let t=(0,Q.c)(22),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({surfaceId:a,disabled:r,className:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]!==r||t[6]!==a?(o={id:a,disabled:r},t[5]=r,t[6]=a,t[7]=o):o=t[7];let{listeners:s,setNodeRef:c,transform:l,transition:u,isDragging:d}=qi(o),f;t[8]===l?f=t[9]:(f=Yi.Translate.toString(l),t[8]=l,t[9]=f);let p;t[10]!==f||t[11]!==u?(p={transform:f,transition:u},t[10]=f,t[11]=u,t[12]=p):p=t[12];let m=d&&`relative z-10`,h;t[13]!==n||t[14]!==m?(h=K(n,m),t[13]=n,t[14]=m,t[15]=h):h=t[15];let g;return t[16]!==s||t[17]!==i||t[18]!==c||t[19]!==p||t[20]!==h?(g=(0,$.jsx)(`div`,{...i,...s,ref:c,style:p,className:h}),t[16]=s,t[17]=i,t[18]=c,t[19]=p,t[20]=h,t[21]=g):g=t[21],g}function df(e){let t=(0,Q.c)(101),n=Tn&&e.mode===`inline`,r=or().profiles,{resolvedTheme:i}=Ot(),a=(0,Z.useRef)(null),[o,s]=(0,Z.useState)(null),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={hasOverflow:!1,canScrollLeft:!1,canScrollRight:!1},t[0]=c):c=t[0];let[l,u]=(0,Z.useState)(c),d=e.open!==!1&&e.surfaces.length>0,f;t[1]!==d||t[2]!==e?(f=t=>{if(!(t.defaultPrevented||t.isComposing)&&sr(t,e.keybindings,{context:{...e.getShortcutContext(),rightPanelOpen:!0}})===`rightPanel.new`&&!document.querySelector(zd)&&(!d||e.browserAvailable)&&(t.preventDefault(),t.stopPropagation(),!t.repeat)){if(!d){document.querySelector(`[data-surface-launcher-keys]`)?.focus();return}e.onAddBrowser()}},t[1]=d,t[2]=e,t[3]=f):f=t[3];let p=(0,Z.useEffectEvent)(f),m;t[4]!==p||t[5]!==e.open?(m=()=>{if(e.open!==!1)return document.addEventListener(`keydown`,p,!0),()=>document.removeEventListener(`keydown`,p,!0)},t[4]=p,t[5]=e.open,t[6]=m):m=t[6];let h;t[7]===e.open?h=t[8]:(h=[e.open],t[7]=e.open,t[8]=h),(0,Z.useEffect)(m,h);let g;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{let e=Ud(a.current);if(!e)return;let t=e.scrollWidth-e.clientWidth>Vd,n=t&&e.scrollLeft>Vd,r=t&&e.scrollLeft+e.clientWidth<e.scrollWidth-Vd;u(e=>e.hasOverflow===t&&e.canScrollLeft===n&&e.canScrollRight===r?e:{hasOverflow:t,canScrollLeft:n,canScrollRight:r})},t[9]=g):g=t[9];let _=g,v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{let t=Ud(a.current);if(!t)return;let n=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;t.scrollBy({left:e*Math.max(120,t.clientWidth*.75),behavior:n?`auto`:`smooth`})},t[10]=v):v=t[10];let y=v,b;t[11]===e?b=t[12]:(b=async(t,n)=>{t.preventDefault(),t.stopPropagation();let r=kt();if(!r)return;let i=e.surfaces.findIndex(e=>e.id===n.id);if(i<0)return;let a=[];n.kind===`device`&&e.onRenameDevice&&a.push({id:`rename`,label:`Rename`}),n.kind===`file`&&n.attachment===void 0&&a.push({id:`copy-path`,label:`Copy path`});let o=Wd(n,e.previewSessions),c=o?e.desktopByTabId[o]??null:null,l=c?.audioMuted??!1;n.kind===`preview`&&a.push({id:`toggle-mute`,...Gd({overlay:c,canResolveRuntimeTabId:e.previewRuntimeTabId!==void 0})}),a.push({id:`close`,label:`Close`},{id:`close-others`,label:`Close others`,disabled:e.surfaces.length<=1},{id:`close-to-right`,label:`Close to the right`,disabled:i>=e.surfaces.length-1},{id:`close-all`,label:`Close all`,disabled:e.surfaces.length===0});let u=await r.contextMenu.show(a,{x:t.clientX,y:t.clientY});bb122:switch(u){case`rename`:s(n.id);break bb122;case`copy-path`:n.kind===`file`&&n.attachment===void 0&&e.onCopyFilePath(n.relativePath);break bb122;case`toggle-mute`:{let t=o&&c?e.previewRuntimeTabId?.(o)??null:null;t&&_a?.setAudioMuted(t,!l).catch(hf);break bb122}case`close`:e.onCloseSurface(n);break bb122;case`close-others`:e.onCloseOtherSurfaces(n);break bb122;case`close-to-right`:e.onCloseSurfacesToRight(n);break bb122;case`close-all`:e.onCloseAllSurfaces();break bb122}},t[11]=e,t[12]=b);let x=b,S=mf,C;t[13]===e?C=t[14]:(C=(t,n)=>{t.button===1&&(t.preventDefault(),t.stopPropagation(),e.onCloseSurface(n))},t[13]=e,t[14]=C);let w=C,T,E;t[15]!==e.activeSurfaceId||t[16]!==l.hasOverflow?(T=()=>{e.activeSurfaceId&&l.hasOverflow&&(a.current?.querySelector(`[data-active-tab='true']`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},E=[e.activeSurfaceId,l.hasOverflow],t[15]=e.activeSurfaceId,t[16]=l.hasOverflow,t[17]=T,t[18]=E):(T=t[17],E=t[18]),(0,Z.useEffect)(T,E);let D,O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>{let e=Ud(a.current);if(!e)return;let t=e.firstElementChild,n=rr(t?[e,t]:e,_);return e.addEventListener(`scroll`,_,{passive:!0}),_(),()=>{n(),e.removeEventListener(`scroll`,_)}},O=[_],t[19]=D,t[20]=O):(D=t[19],O=t[20]),(0,Z.useEffect)(D,O);let k,A;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>{let e=Ud(a.current);if(!e)return;let t=t=>{if(t.ctrlKey)return;let n=Math.abs(t.deltaX)>Math.abs(t.deltaY)?t.deltaX:t.deltaY;if(t.deltaMode===WheelEvent.DOM_DELTA_LINE&&(n*=16),t.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(n*=e.clientWidth),n===0)return;let r=e.scrollLeft;e.scrollLeft+=n,e.scrollLeft!==r&&(t.preventDefault(),_())};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},A=[_],t[21]=k,t[22]=A):(k=t[21],A=t[22]),(0,Z.useEffect)(k,A);let j=e.mode,M;t[23]===e.maximized?M=t[24]:(M=e.maximized===void 0?{}:{maximized:e.maximized},t[23]=e.maximized,t[24]=M);let N;t[25]===e.open?N=t[26]:(N=e.open===void 0?{}:{open:e.open},t[25]=e.open,t[26]=N);let P;t[27]===e.widthStorageKey?P=t[28]:(P=e.widthStorageKey===void 0?{}:{widthStorageKey:e.widthStorageKey},t[27]=e.widthStorageKey,t[28]=P);let I;t[29]===e.defaultWidth?I=t[30]:(I=e.defaultWidth===void 0?{}:{defaultWidth:e.defaultWidth},t[29]=e.defaultWidth,t[30]=I);let L;t[31]===e.inlineSize?L=t[32]:(L=e.inlineSize?{inlineSize:e.inlineSize}:{},t[31]=e.inlineSize,t[32]=L);let R=e.mode===`inline`&&!e.layoutControls?`pr-28`:`pr-3`,z=n&&`drag-region`,B=n&&`wco:pr-(--workspace-native-controls-inset)`,V=e.mode===`inline`&&e.maximized&&`[[data-sidebar-state=collapsed]_&]:pl-[var(--workspace-titlebar-content-left)] max-md:[[data-sidebar-state=expanded]_&]:pl-[var(--workspace-titlebar-content-left)]`,ee;t[33]!==R||t[34]!==z||t[35]!==B||t[36]!==V?(ee=K(`flex h-[var(--workspace-topbar-height)] min-h-[var(--workspace-topbar-height)] shrink-0 items-center gap-1 bg-(--app-chrome-background) pl-2`,R,z,B,V),t[33]=R,t[34]=z,t[35]=B,t[36]=V,t[37]=ee):ee=t[37];let te=e.surfaces,ne=e.onMoveSurface,U;t[38]!==w||t[39]!==x||t[40]!==n||t[41]!==e||t[42]!==o||t[43]!==i?(U=e.surfaces.map(t=>{let r=t.id===e.activeSurfaceId,a=e.pendingSurfaceIds.has(t.id),c=tf(t,e.previewSessions,e.terminalLabelsById),l=Wd(t,e.previewSessions),u=Kd(l?e.desktopByTabId[l]??null:null),d=l?e.previewRuntimeTabId?.(l)??null:null;return(0,$.jsxs)(uf,{surfaceId:t.id,disabled:!e.onMoveSurface||o===t.id,"data-active-tab":r,onMouseDown:S,onAuxClick:e=>w(e,t),onContextMenu:e=>void x(e,t),className:K(`cursor-pointer group/tab flex h-7 w-52 shrink-0 items-center gap-2 rounded-md pr-1 pl-2.5 text-sm transition-colors duration-150`,n&&`[-webkit-app-region:no-drag]`,r?`bg-background text-foreground shadow-xs`:`text-muted-foreground hover:bg-accent/60 hover:text-foreground`),children:[(0,$.jsxs)(`span`,{className:`relative flex size-4 shrink-0 items-center justify-center [&_img]:size-3.5 [&_svg]:size-3.5`,children:[(0,$.jsx)(af,{surface:t,sessions:e.previewSessions,desktopByTabId:e.desktopByTabId,theme:i,environmentId:e.environmentId,pullRequestStatusSeeds:e.pullRequestStatusSeeds}),a?(0,$.jsx)(`span`,{className:`absolute -right-0.5 -bottom-0.5 size-1.5 rounded-full bg-current`,"aria-hidden":!0}):null]}),u===`none`||!d?null:(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`button`,{type:`button`,className:`cursor-pointer flex size-4 shrink-0 items-center justify-center rounded-sm hover:bg-muted`,"aria-label":u===`muted`?`Unmute ${c}`:`Mute ${c}`,onClick:e=>{e.stopPropagation(),_a?.setAudioMuted(d,u!==`muted`).catch(pf)},children:(0,$.jsx)(gt,{className:`size-3`,icon:u===`muted`?mt:ft})})}),(0,$.jsx)(J,{children:u===`muted`?`Unmute tab`:`Mute tab`})]}),o===t.id?(0,$.jsx)(`input`,{"aria-label":`Device tab name`,className:`min-w-0 flex-1 rounded-sm bg-background px-1 outline-none ring-1 ring-inset ring-ring`,defaultValue:c,ref:ff,onBlur:n=>{e.onRenameDevice?.(t.id,n.currentTarget.value),s(null)},onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.currentTarget.value=c,e.currentTarget.blur())}}):(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`button`,{type:`button`,onDoubleClick:()=>{t.kind===`device`&&e.onRenameDevice&&s(t.id)},className:`cursor-pointer flex h-full min-w-0 flex-1 items-center`,onClick:()=>e.onActivate(t),children:(0,$.jsx)(`span`,{className:`truncate`,children:c})})}),(0,$.jsx)(J,{children:t.kind===`device`?(0,$.jsx)(gf,{surface:t,environmentId:e.environmentId,title:c}):c})]}),(0,$.jsx)(`button`,{type:`button`,"aria-label":`Close ${c}`,className:K(`cursor-pointer flex size-5 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-opacity duration-150 hover:bg-muted hover:text-foreground focus-visible:opacity-100 pointer-coarse:opacity-100 motion-reduce:transition-none`,r?`opacity-100`:`opacity-0 group-hover/tab:opacity-100`),onClick:()=>e.onCloseSurface(t),children:(0,$.jsx)(H,{className:`size-3.5`})})]},t.id)}),t[38]=w,t[39]=x,t[40]=n,t[41]=e,t[42]=o,t[43]=i,t[44]=U):U=t[44];let W;t[45]!==e.onMoveSurface||t[46]!==e.surfaces||t[47]!==U?(W=(0,$.jsx)(Hn,{radius:`none`,ref:a,hideScrollbars:!0,scrollFade:!0,className:`min-w-0 flex-1`,"data-right-panel-tab-list":!0,children:(0,$.jsx)(`div`,{className:`flex h-full w-max min-w-full items-center gap-1`,children:(0,$.jsx)(cf,{surfaces:te,onMove:ne,children:U})})}),t[45]=e.onMoveSurface,t[46]=e.surfaces,t[47]=U,t[48]=W):W=t[48];let re;t[49]!==l.canScrollLeft||t[50]!==l.canScrollRight||t[51]!==l.hasOverflow?(re=l.hasOverflow?(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5 [-webkit-app-region:no-drag]`,role:`group`,"aria-label":`Scroll panel tabs`,children:[(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`span`,{className:`inline-flex`,children:(0,$.jsx)(G,{"aria-label":`Scroll tabs left`,disabled:!l.canScrollLeft,onClick:()=>y(-1),size:`icon-xs`,variant:`ghost`,children:(0,$.jsx)(ce,{})})})}),(0,$.jsx)(J,{children:`Scroll tabs left`})]}),(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`span`,{className:`inline-flex`,children:(0,$.jsx)(G,{"aria-label":`Scroll tabs right`,disabled:!l.canScrollRight,onClick:()=>y(1),size:`icon-xs`,variant:`ghost`,children:(0,$.jsx)(Pe,{})})})}),(0,$.jsx)(J,{children:`Scroll tabs right`})]})]}):null,t[49]=l.canScrollLeft,t[50]=l.canScrollRight,t[51]=l.hasOverflow,t[52]=re):re=t[52];let ie;t[53]!==d||t[54]!==e.browserAvailable||t[55]!==e.onAddBrowser?(ie=d?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(G,{"aria-label":`New browser tab`,className:`shrink-0 [-webkit-app-region:no-drag]`,disabled:!e.browserAvailable,onClick:e.onAddBrowser,size:`icon-xs`,variant:`ghost-muted`}),children:(0,$.jsx)(F,{className:`size-4`})}),(0,$.jsx)(J,{children:`New browser tab`})]}):null,t[53]=d,t[54]=e.browserAvailable,t[55]=e.onAddBrowser,t[56]=ie):ie=t[56];let ae;t[57]!==n||t[58]!==e.layoutControls?(ae=n&&!e.layoutControls?(0,$.jsx)(`span`,{"aria-hidden":!0,className:`hidden w-24 shrink-0 wco:block`}):null,t[57]=n,t[58]=e.layoutControls,t[59]=ae):ae=t[59];let oe;t[60]===n?oe=t[61]:(oe=n?(0,$.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none fixed top-[var(--workspace-controls-top)] right-[var(--workspace-controls-right)] h-[var(--workspace-topbar-height)] w-28 [-webkit-app-region:no-drag]`}):null,t[60]=n,t[61]=oe);let se;t[62]!==e.layoutControls||t[63]!==ee||t[64]!==W||t[65]!==re||t[66]!==ie||t[67]!==ae||t[68]!==oe?(se=(0,$.jsxs)(`div`,{className:ee,"data-right-panel-tabbar":!0,children:[W,re,ie,e.layoutControls,ae,oe]}),t[62]=e.layoutControls,t[63]=ee,t[64]=W,t[65]=re,t[66]=ie,t[67]=ae,t[68]=oe,t[69]=se):se=t[69];let le;t[70]!==r||t[71]!==e.activeSurfaceId||t[72]!==e.browserAvailable||t[73]!==e.children||t[74]!==e.deviceAvailable||t[75]!==e.diffAvailable||t[76]!==e.filesAvailable||t[77]!==e.onAddBrowser||t[78]!==e.onAddBrowserInProfile||t[79]!==e.onAddDesign||t[80]!==e.onAddDevice||t[81]!==e.onAddDiff||t[82]!==e.onAddFiles||t[83]!==e.onAddPullRequest||t[84]!==e.onAddPullRequests||t[85]!==e.onAddTerminal||t[86]!==e.pullRequestAvailable||t[87]!==e.pullRequestsAvailable||t[88]!==e.terminalAvailable?(le=e.activeSurfaceId===null?(0,$.jsx)(Xd,{onAddBrowser:e.onAddBrowser,onAddBrowserInProfile:e.onAddBrowserInProfile,browserProfiles:r,onAddTerminal:e.onAddTerminal,onAddDiff:e.onAddDiff,onAddFiles:e.onAddFiles,...e.onAddDesign?{onAddDesign:e.onAddDesign}:{},onAddPullRequest:e.onAddPullRequest,onAddPullRequests:e.onAddPullRequests,onAddDevice:e.onAddDevice,browserAvailable:e.browserAvailable,terminalAvailable:e.terminalAvailable,diffAvailable:e.diffAvailable,filesAvailable:e.filesAvailable,pullRequestAvailable:e.pullRequestAvailable,pullRequestsAvailable:e.pullRequestsAvailable,deviceAvailable:e.deviceAvailable}):e.children,t[70]=r,t[71]=e.activeSurfaceId,t[72]=e.browserAvailable,t[73]=e.children,t[74]=e.deviceAvailable,t[75]=e.diffAvailable,t[76]=e.filesAvailable,t[77]=e.onAddBrowser,t[78]=e.onAddBrowserInProfile,t[79]=e.onAddDesign,t[80]=e.onAddDevice,t[81]=e.onAddDiff,t[82]=e.onAddFiles,t[83]=e.onAddPullRequest,t[84]=e.onAddPullRequests,t[85]=e.onAddTerminal,t[86]=e.pullRequestAvailable,t[87]=e.pullRequestsAvailable,t[88]=e.terminalAvailable,t[89]=le):le=t[89];let ue;t[90]===le?ue=t[91]:(ue=(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-right-panel-surface-content":!0,children:le}),t[90]=le,t[91]=ue);let de;return t[92]!==e.mode||t[93]!==M||t[94]!==N||t[95]!==P||t[96]!==I||t[97]!==L||t[98]!==se||t[99]!==ue?(de=(0,$.jsxs)(cs,{mode:j,...M,...N,...P,...I,...L,children:[se,ue]}),t[92]=e.mode,t[93]=M,t[94]=N,t[95]=P,t[96]=I,t[97]=L,t[98]=se,t[99]=ue,t[100]=de):de=t[100],de}function ff(e){e?.focus(),e?.select()}function pf(){}function mf(e){e.button===1&&e.preventDefault()}function hf(){}function gf(e){let t=(0,Q.c)(15),n=e.surface.target,{state:r}=nr(n?e.environmentId:null),i;t[0]!==r||t[1]!==n?(i=n?r.devices.find(e=>e.hostId===n.hostId&&e.id===n.deviceId):void 0,t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o;t[3]!==r||t[4]!==n?(o=n?r.hosts.find(e=>e.id===n.hostId):void 0,t[3]=r,t[4]=n,t[5]=o):o=t[5];let s=o,c;t[6]===e.title?c=t[7]:(c=(0,$.jsx)(`span`,{children:e.title}),t[6]=e.title,t[7]=c);let l;t[8]!==a?.version||t[9]!==s?.label||t[10]!==n?(l=n?(0,$.jsxs)(`span`,{className:`text-muted-foreground`,children:[s?.label??`Device host`,` ·`,` `,a?.version??(n.platform===`ios`?`iOS`:`Android`)]}):null,t[8]=a?.version,t[9]=s?.label,t[10]=n,t[11]=l):l=t[11];let u;return t[12]!==c||t[13]!==l?(u=(0,$.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[c,l]}),t[12]=c,t[13]=l,t[14]=u):u=t[14],u}var _f=(0,Z.memo)(function(e){let t=(0,Q.c)(31),{showThreadPanelControl:n,showTerminalControl:r,showRightPanelControl:i,terminalAvailable:a,terminalOpen:o,terminalShortcutLabel:s,threadPanelOpen:c,threadPanelPresentation:l,threadPanelPopoverHandle:u,threadPanelShortcutLabel:d,rightPanelAvailable:f,rightPanelOpen:p,rightPanelShortcutLabel:m,rightPanelUnavailableLabel:h,rightPanelTabCount:g,onToggleTerminal:_,onToggleThreadPanel:v,onToggleRightPanel:y}=e,b=n===void 0||n,x=r===void 0||r,S=i===void 0||i,C=h===void 0?`Right panel is unavailable`:h,w=g===void 0?0:g,T;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(bf,{}),t[0]=T):T=t[0];let E;t[1]===c?E=t[2]:(E=(0,$.jsx)(On,{className:`relative shrink-0 [-webkit-app-region:no-drag]`,pressed:c,"aria-label":`Toggle thread details panel`,variant:`ghost`,size:`sm`,children:T}),t[1]=c,t[2]=E);let D=E,O;t[3]!==v||t[4]!==l||t[5]!==d?(O=e=>(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:e,...l===`popover`?{}:{onClick:v}}),(0,$.jsxs)(J,{side:`bottom`,children:[`Toggle thread details`,d?` (${d})`:``]})]}),t[3]=v,t[4]=l,t[5]=d,t[6]=O):O=t[6];let k=O,A;t[7]!==b||t[8]!==u||t[9]!==l||t[10]!==D||t[11]!==k?(A=b?k(l===`popover`?(0,$.jsx)(Jr,{handle:u,render:D}):D):null,t[7]=b,t[8]=u,t[9]=l,t[10]=D,t[11]=k,t[12]=A):A=t[12];let j;t[13]!==_||t[14]!==x||t[15]!==a||t[16]!==o||t[17]!==s?(j=x?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`span`,{className:`flex shrink-0`}),children:(0,$.jsx)(On,{className:`shrink-0 [-webkit-app-region:no-drag]`,pressed:o,onPressedChange:_,"aria-label":`Toggle terminal drawer`,variant:`ghost`,size:`sm`,disabled:!a,children:(0,$.jsx)(ue,{className:`size-4`})})}),(0,$.jsx)(J,{side:`bottom`,children:a?`Toggle terminal drawer${s?` (${s})`:``}`:`Terminal drawer is unavailable`})]}):null,t[13]=_,t[14]=x,t[15]=a,t[16]=o,t[17]=s,t[18]=j):j=t[18];let M;t[19]!==y||t[20]!==f||t[21]!==p||t[22]!==m||t[23]!==w||t[24]!==C||t[25]!==S?(M=S?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`span`,{className:`flex shrink-0`}),children:(0,$.jsx)(On,{className:`shrink-0 [-webkit-app-region:no-drag]`,pressed:p,onPressedChange:y,"aria-label":w>0?`Toggle right panel, ${w} ${w===1?`tab`:`tabs`}`:`Toggle right panel`,variant:`ghost`,size:`sm`,disabled:!f,children:w>0?(0,$.jsx)(vf,{count:w}):(0,$.jsx)(ye,{className:`size-4`})})}),(0,$.jsx)(J,{side:`bottom`,children:f?`Toggle right panel${m?` (${m})`:``}`:C})]}):null,t[19]=y,t[20]=f,t[21]=p,t[22]=m,t[23]=w,t[24]=C,t[25]=S,t[26]=M):M=t[26];let N;return t[27]!==j||t[28]!==M||t[29]!==A?(N=(0,$.jsxs)(`div`,{className:`flex h-full shrink-0 items-center gap-1 [-webkit-app-region:no-drag]`,"data-panel-layout-controls":!0,children:[A,j,M]}),t[27]=j,t[28]=M,t[29]=A,t[30]=N):N=t[30],N});function vf(e){let t=(0,Q.c)(4),{count:n}=e,r=n>99?`∞`:String(n),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}),t[0]=i):i=t[0];let a=r.length>1?11:13,o;return t[1]!==r||t[2]!==a?(o=(0,$.jsxs)(`svg`,{"aria-hidden":!0,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`size-4`,children:[i,(0,$.jsx)(`text`,{x:`12`,y:`12.5`,fill:`currentColor`,stroke:`none`,fontSize:a,fontWeight:600,textAnchor:`middle`,dominantBaseline:`central`,className:`tabular-nums`,children:r})]}),t[1]=r,t[2]=a,t[3]=o):o=t[3],o}var yf=(0,Z.memo)(function(e){let t=(0,Q.c)(12),{maximized:n,onToggle:r}=e,i=n?`Restore panel size`:`Maximize panel`,a=n?pt:vt,o;t[0]===a?o=t[1]:(o=(0,$.jsx)(gt,{className:`size-3.5`,icon:a}),t[0]=a,t[1]=o);let s;t[2]!==i||t[3]!==n||t[4]!==r||t[5]!==o?(s=(0,$.jsx)(q,{render:(0,$.jsx)(On,{className:`shrink-0 [-webkit-app-region:no-drag]`,pressed:n,onPressedChange:r,"aria-label":i,variant:`ghost`,size:`sm`,children:o})}),t[2]=i,t[3]=n,t[4]=r,t[5]=o,t[6]=s):s=t[6];let c;t[7]===i?c=t[8]:(c=(0,$.jsx)(J,{side:`bottom`,children:i}),t[7]=i,t[8]=c);let l;return t[9]!==s||t[10]!==c?(l=(0,$.jsxs)(Y,{children:[s,c]}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l});function bf(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`svg`,{"aria-hidden":!0,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,className:`size-4`,children:[(0,$.jsx)(`circle`,{cx:`6`,cy:`7.5`,r:`2.5`}),(0,$.jsx)(`circle`,{cx:`6`,cy:`16.5`,r:`2.5`}),(0,$.jsx)(`path`,{d:`M12 7.5h8`}),(0,$.jsx)(`path`,{d:`M12 16.5h8`})]}),e[0]=t):t=e[0],t}export{cs as A,dc as C,bs as D,lc as E,Oo as F,Ao as I,Do as L,qo as M,Jo as N,xs as O,Go as P,hc as S,uc as T,cl as _,Pd as a,Nc as b,Fd as c,Ad as d,Mu as f,ul as g,yl as h,Nd as i,rs as j,_s as k,Id as l,Sl as m,yf as n,Ld as o,bl as p,df as r,Rd as s,_f as t,jd as u,Ic as v,pc as w,yc as x,Fc as y};
216
- //# sourceMappingURL=PanelLayoutControls-DL7sleZ-.js.map
214
+ `;function td(e){let t=(0,Q.c)(60),{excerpt:n,file:r,loading:i,notes:s,commenting:c,loadDiffFiles:l,onOpenFile:u}=e,[d,f]=(0,Z.useState)(null),{resolvedTheme:p}=xt(),m;if(t[0]!==n||t[1]!==r){bb0:{if(r===null){m=null;break bb0}let e=Hu(r),i=Uu(e,n);if(i.length===0){m=null;break bb0}let a=Ft(Gu(n.path,It(r),i),`pull-request-guide-excerpt:${n.path}:${n.side}:${n.start}-${n.end}`),o=a?.kind===`files`?a.files[0]:void 0;if(o===void 0){m=null;break bb0}let s={additions:new Set(i.flatMap(ad)),deletions:new Set(i.flatMap(id))},c;t[3]!==s||t[4]!==o||t[5]!==e||t[6]!==i?(c={fileDiff:o,rows:i,shown:i.length,total:e.length,drawn:s},t[3]=s,t[4]=o,t[5]=e,t[6]=i,t[7]=c):c=t[7],m=c}t[0]=n,t[1]=r,t[2]=m}else m=t[2];let h=m,g=h?.rows??null,v;bb1:{if(g===null||g.some(e=>e.hunk!==g[0]?.hunk)){v=null;break bb1}let e;t[8]!==n.end||t[9]!==n.side||t[10]!==n.start||t[11]!==l||t[12]!==g?(e=async e=>{let t=await l(e),r=Ku(t.newFile.contents,g);return r===null?t:{newFile:t.newFile,oldFile:{name:t.oldFile?.name??t.newFile.name,contents:r,cacheKey:`${t.newFile.cacheKey??t.newFile.name}:excerpt:${n.side}:${n.start}-${n.end}`}}},t[8]=n.end,t[9]=n.side,t[10]=n.start,t[11]=l,t[12]=g,t[13]=e):e=t[13],v=e}let y=v,b;t[14]!==c?.pending||t[15]!==d||t[16]!==n.path||t[17]!==n.side||t[18]!==s||t[19]!==h?.drawn?(b=()=>{let e=new Map,t=(t,n)=>{let r=`${t}:${n}`,i=e.get(r);if(i!==void 0)return i;let a={side:t,lineNumber:n,metadata:{markers:[],pending:[],draft:!1}};return e.set(r,a),a},r=(n,r,i)=>{let a=t(n,r);e.set(`${n}:${r}`,{...a,metadata:i(a.metadata)})},i=n.side===`new`?`additions`:`deletions`;for(let e of s)r(i,e.line,t=>({...t,markers:[...t.markers,...e.markers]}));for(let e of c?.pending??[]){if(e.path!==n.path)continue;let t=uc(e.position),i=lc(t.side);h?.drawn[i].has(t.line)&&r(i,t.line,t=>({...t,pending:[...t.pending,e]}))}if(d!==null){let e=uc(d.position);r(lc(e.side),e.line,rd)}return[...e.values()]},t[14]=c?.pending,t[15]=d,t[16]=n.path,t[17]=n.side,t[18]=s,t[19]=h?.drawn,t[20]=b):b=t[20],c?.pending;let x;t[21]===b?x=t[22]:(x=b(),t[21]=b,t[22]=x);let S=x,C;t[23]===r?C=t[24]:(C=e=>{if(e===null||r===null)return;let t=_(r,e.end,e.endSide??e.side);t!==null&&f({range:e,position:t})},t[23]=r,t[24]=C);let w=C,T=c!==null&&d===null,E=c?.onAskAgent??null,D;t[25]!==d||t[26]!==n.path||t[27]!==r||t[28]!==E?(D=e=>{if(d===null||r===null||E===null)return;let t=o({id:`pull-request-guide:${n.path}:${d.range.start}:${d.range.end}`,sectionId:`pull-request-guide:${n.path}`,sectionTitle:`Review guide`,filePath:n.path,fileDiff:r,range:d.range,text:e});f(null),t!==null&&E(t,e)},t[25]=d,t[26]=n.path,t[27]=r,t[28]=E,t[29]=D):D=t[29];let O=D,k;t[30]===p?k=t[31]:(k=Rt(p),t[30]=p,t[31]=k);let A;t[32]===y?A=t[33]:(A=y===null?{hunkSeparators:`simple`}:{loadDiffFiles:y},t[32]=y,t[33]=A);let j;t[34]!==w||t[35]!==T||t[36]!==p||t[37]!==k||t[38]!==A?(j={diffStyle:`unified`,lineDiffType:`none`,overflow:`scroll`,theme:k,themeType:p,preferredHighlighter:ba,unsafeCSS:ed,enableGutterUtility:T,enableLineSelection:T,onGutterUtilityClick:w,onLineSelectionEnd:w,...A},t[34]=w,t[35]=T,t[36]=p,t[37]=k,t[38]=A,t[39]=j):j=t[39];let M=j,N;t[40]===n.caption?N=t[41]:(N=n.caption.trim()===``?null:(0,$.jsx)(`figcaption`,{className:`text-xs text-muted-foreground`,children:(0,$.jsx)(Lu,{text:n.caption,plain:!0})}),t[40]=n.caption,t[41]=N);let P;t[42]!==S||t[43]!==O||t[44]!==c||t[45]!==d||t[46]!==n.end||t[47]!==n.path||t[48]!==n.side||t[49]!==n.start||t[50]!==r||t[51]!==i||t[52]!==E||t[53]!==u||t[54]!==M||t[55]!==h?(P=h===null?i?(0,$.jsxs)(`p`,{className:`rounded-lg border border-border/60 px-3 py-2 text-xs text-muted-foreground`,children:[`Loading `,n.path,`...`]}):(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-border/60 px-3 py-2 text-xs text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`min-w-0 truncate`,children:[(0,$.jsx)(`span`,{className:`font-mono text-foreground`,children:n.path}),` lines `,n.start,`-`,n.end,` are not in the loaded diff.`]}),(0,$.jsx)(G,{size:`xs`,variant:`outline`,onClick:()=>u(n.path),children:`Open in Code`})]}):(0,$.jsx)(`div`,{className:`min-w-0 overflow-hidden rounded-lg border border-border/60`,children:(0,$.jsx)(mn,{fileDiff:h.fileDiff,options:M,lineAnnotations:S,selectedLines:d?.range??null,renderAnnotation:e=>(0,$.jsxs)(`div`,{className:`font-sans`,children:[e.metadata.markers.length>0?(0,$.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 px-3 py-1 text-xs`,children:e.metadata.markers.map(nd)}):null,e.metadata.pending.map(e=>(0,$.jsx)(dc,{comment:e,onRemove:()=>c?.onRemove(e.id)},e.id)),e.metadata.draft&&d!==null&&c!==null?(0,$.jsx)(xn,{kind:`draft`,rangeLabel:`${n.path}:${uc(d.position).line}`,text:``,placeholder:c.canComment?`Add a comment…`:`Ask the agent about these lines…`,submitLabel:c.canComment?`Add to review`:`Ask agent`,...c.canComment&&E!==null?{secondaryAction:{label:`Ask agent`,onAction:e=>O(e)}}:{},onCancel:()=>f(null),onComment:e=>{if(!c.canComment){O(e);return}c.onComment({path:n.path,oldPath:r===null?null:od(r,n.path),position:d.position,body:e}),f(null)}}):null]}),renderHeaderMetadata:()=>(0,$.jsxs)(`span`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[n.side===`old`?`removed code, `:``,`showing `,h.shown,` of`,` `,h.total,` diff lines`]}),(0,$.jsx)(G,{size:`icon-xs`,variant:`ghost-muted`,"aria-label":`Open ${n.path} in Code`,onClick:()=>u(n.path),children:(0,$.jsx)(a,{"aria-hidden":!0})})]})})}),t[42]=S,t[43]=O,t[44]=c,t[45]=d,t[46]=n.end,t[47]=n.path,t[48]=n.side,t[49]=n.start,t[50]=r,t[51]=i,t[52]=E,t[53]=u,t[54]=M,t[55]=h,t[56]=P):P=t[56];let F;return t[57]!==N||t[58]!==P?(F=(0,$.jsxs)(`figure`,{className:`flex min-w-0 flex-col gap-1.5`,children:[N,P]}),t[57]=N,t[58]=P,t[59]=F):F=t[59],F}function nd(e){return(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,$.jsx)(Zu,{marker:e.marker}),(0,$.jsx)(`span`,{className:`text-foreground`,children:e.title})]},e.marker)}function rd(e){return{...e,draft:!0}}function id(e){return e.oldLine===null?[]:[e.oldLine]}function ad(e){return e.newLine===null?[]:[e.newLine]}function od(e,t){let n=It(e);return n===t?null:n}function sd(e){let t=(0,Q.c)(11),{file:n,loadDiffFiles:r}=e,{resolvedTheme:i}=xt(),a;t[0]===n?a=t[1]:(a=dn(n),t[0]=n,t[1]=a);let o=a,s;t[2]===i?s=t[3]:(s=Rt(i),t[2]=i,t[3]=s);let c;t[4]!==r||t[5]!==i||t[6]!==s?(c={diffStyle:`unified`,lineDiffType:`none`,overflow:`scroll`,disableFileHeader:!0,theme:s,themeType:i,preferredHighlighter:ba,unsafeCSS:Wo,loadDiffFiles:r},t[4]=r,t[5]=i,t[6]=s,t[7]=c):c=t[7];let l=c,u;return t[8]!==o||t[9]!==l?(u=(0,$.jsx)(`div`,{className:`border-t border-border/60`,children:(0,$.jsx)(mn,{fileDiff:o,options:l})}),t[8]=o,t[9]=l,t[10]=u):u=t[10],u}var cd={tradeoff:`A tradeoff to weigh`,contract:`A contract to check`,product:`A product call`,risk:`A risk to judge`,accessibility:`An accessibility call`};function ld(e){let t=(0,Q.c)(122),{stop:n,index:i,stopCount:a,railOpen:o,onRailOpenChange:s,stopList:c,nextTitle:l,files:u,loadDiffFiles:d,diffLoading:f,commenting:p,onStep:m,onAsk:h,onFinish:g,onOpenFile:_}=e,v;t[0]===n?v=t[1]:(v=qu(n),t[0]=n,t[1]=v);let{lettered:y,byExcerpt:b}=v,x;t[2]===n.excerpts?x=t[3]:(x=new Set(n.excerpts.map(ud)),t[2]=n.excerpts,t[3]=x);let S=x,C,w,T,E,D,O,k,A,j;if(t[4]!==b||t[5]!==p||t[6]!==f||t[7]!==S||t[8]!==u||t[9]!==i||t[10]!==y||t[11]!==d||t[12]!==_||t[13]!==s||t[14]!==m||t[15]!==o||t[16]!==n.attention||t[17]!==n.excerpts||t[18]!==n.files||t[19]!==n.summary||t[20]!==n.title||t[21]!==a||t[22]!==c){let e;t[32]===S?e=t[33]:(e=e=>!S.has(e.path),t[32]=S,t[33]=e);let r=n.files.filter(e);C=y.length>0;let l=C&&`@min-[90rem]/guide:grid-cols-[minmax(0,1fr)_20rem]`;t[34]===l?w=t[35]:(w=K(`grid gap-8`,l),t[34]=l,t[35]=w),T=`flex min-w-0 flex-col gap-5`;let h=i+1,g;t[36]!==a||t[37]!==h?(g=(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground tabular-nums @max-[56rem]/guide:hidden`,children:[`Stop `,h,` of `,a]}),t[36]=a,t[37]=h,t[38]=g):g=t[38];let v;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(G,{size:`xs`,variant:`ghost-muted`,className:`@min-[56rem]/guide:hidden`}),t[39]=v):v=t[39];let x=i+1,M;t[40]!==a||t[41]!==x?(M=(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[`Stop `,x,` of `,a]}),t[40]=a,t[41]=x,t[42]=M):M=t[42];let N=o&&`rotate-180`,P;t[43]===N?P=t[44]:(P=K(N),t[43]=N,t[44]=P);let F;t[45]===P?F=t[46]:(F=(0,$.jsx)(fe,{"aria-hidden":!0,className:P}),t[45]=P,t[46]=F);let I;t[47]!==M||t[48]!==F?(I=(0,$.jsxs)(xa,{render:v,children:[M,F]}),t[47]=M,t[48]=F,t[49]=I):I=t[49];let L=i===0,R;t[50]===m?R=t[51]:(R=()=>m(-1),t[50]=m,t[51]=R);let z;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(ze,{"aria-hidden":!0}),t[52]=z):z=t[52];let B;t[53]!==L||t[54]!==R?(B=(0,$.jsx)(G,{size:`icon-xs`,variant:`outline`,"aria-label":`Previous stop`,disabled:L,onClick:R,children:z}),t[53]=L,t[54]=R,t[55]=B):B=t[55];let V=i===a-1,H;t[56]===m?H=t[57]:(H=()=>m(1),t[56]=m,t[57]=H);let ee;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,$.jsx)(fe,{"aria-hidden":!0}),t[58]=ee):ee=t[58];let te;t[59]!==V||t[60]!==H?(te=(0,$.jsx)(G,{size:`icon-xs`,variant:`outline`,"aria-label":`Next stop`,disabled:V,onClick:H,children:ee}),t[59]=V,t[60]=H,t[61]=te):te=t[61];let ne;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,$.jsxs)(`span`,{"aria-hidden":!0,className:`ml-1 flex items-center gap-0.5 @max-[30rem]/guide:hidden`,children:[(0,$.jsx)(aa,{children:`J`}),(0,$.jsx)(aa,{children:`K`})]}),t[62]=ne):ne=t[62];let U;t[63]!==B||t[64]!==te?(U=(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[B,te,ne]}),t[63]=B,t[64]=te,t[65]=U):U=t[65];let W;t[66]!==g||t[67]!==I||t[68]!==U?(W=(0,$.jsxs)(`header`,{className:`flex items-center justify-between gap-2`,children:[g,I,U]}),t[66]=g,t[67]=I,t[68]=U,t[69]=W):W=t[69];let re;t[70]===c?re=t[71]:(re=(0,$.jsx)(ga,{className:`@min-[56rem]/guide:hidden`,children:(0,$.jsx)(`div`,{className:`pt-3`,children:c})}),t[70]=c,t[71]=re),t[72]!==s||t[73]!==o||t[74]!==W||t[75]!==re?(E=(0,$.jsxs)(ua,{open:o,onOpenChange:s,children:[W,re]}),t[72]=s,t[73]=o,t[74]=W,t[75]=re,t[76]=E):E=t[76];let ie;t[77]===n.title?ie=t[78]:(ie=(0,$.jsx)(`h2`,{className:`text-lg font-semibold text-foreground`,children:n.title}),t[77]=n.title,t[78]=ie);let oe;t[79]===n.summary?oe=t[80]:(oe=n.summary.trim()===``?null:(0,$.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(Lu,{text:n.summary})}),t[79]=n.summary,t[80]=oe),t[81]!==ie||t[82]!==oe?(D=(0,$.jsxs)(`div`,{className:`flex max-w-[60rem] flex-col gap-2`,children:[ie,oe]}),t[81]=ie,t[82]=oe,t[83]=D):D=t[83],t[84]===n.attention?O=t[85]:(O=n.attention===null?null:(0,$.jsxs)(ia,{controlAlignment:`first-line`,children:[(0,$.jsx)(we,{}),(0,$.jsx)(ta,{children:cd[n.attention.kind]}),(0,$.jsx)(ra,{children:(0,$.jsx)(`div`,{children:(0,$.jsx)(Lu,{text:n.attention.note})})})]}),t[84]=n.attention,t[85]=O),t[86]!==b||t[87]!==p||t[88]!==f||t[89]!==u||t[90]!==d||t[91]!==_||t[92]!==n.excerpts?(k=n.excerpts.length>0?(0,$.jsx)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:(0,$.jsx)(un,{children:n.excerpts.map((e,t)=>(0,$.jsx)(td,{excerpt:e,file:u.get(e.path)??null,loading:f,notes:b[t]??[],commenting:p,loadDiffFiles:d,onOpenFile:_},`${e.path}:${e.side}:${e.start}-${e.end}`))})}):null,t[86]=b,t[87]=p,t[88]=f,t[89]=u,t[90]=d,t[91]=_,t[92]=n.excerpts,t[93]=k):k=t[93],t[94]===y?A=t[95]:(A=(0,$.jsx)(Qu,{notes:y,className:`@min-[90rem]/guide:hidden`}),t[94]=y,t[95]=A),j=r.length>0?(0,$.jsxs)(`section`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:n.excerpts.length>0?`Also in this stop`:`Files in this stop`}),(0,$.jsx)(un,{children:(0,$.jsx)(`ul`,{className:`flex flex-col overflow-hidden rounded-lg border border-border/60`,children:r.map(e=>{let t=u.get(e.path),n=t===void 0?null:Ht([t]);return(0,$.jsx)(`li`,{className:`border-border/60 not-first:border-t`,children:(0,$.jsxs)(ua,{children:[(0,$.jsxs)(xa,{className:`group flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left text-xs outline-none hover:bg-accent/50 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,children:[(0,$.jsx)(Pe,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground group-data-panel-open:rotate-90`}),(0,$.jsx)(ae,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`min-w-0 truncate font-mono text-foreground`,children:e.path}),e.note!==void 0&&e.note.trim()!==``?(0,$.jsx)(`span`,{className:`ml-auto min-w-0 truncate text-muted-foreground @max-[30rem]/guide:hidden`,children:(0,$.jsx)(Lu,{text:e.note,plain:!0})}):null,n===null?null:(0,$.jsx)(Sr,{additions:n.additions,deletions:n.deletions,className:`shrink-0 font-mono`})]}),(0,$.jsx)(ga,{animate:!1,children:t===void 0?(0,$.jsx)(`p`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:f?`Loading the diff...`:`This file is not in the loaded diff.`}):(0,$.jsx)(sd,{file:t,loadDiffFiles:d})})]})},e.path)})})})]}):null,t[4]=b,t[5]=p,t[6]=f,t[7]=S,t[8]=u,t[9]=i,t[10]=y,t[11]=d,t[12]=_,t[13]=s,t[14]=m,t[15]=o,t[16]=n.attention,t[17]=n.excerpts,t[18]=n.files,t[19]=n.summary,t[20]=n.title,t[21]=a,t[22]=c,t[23]=C,t[24]=w,t[25]=T,t[26]=E,t[27]=D,t[28]=O,t[29]=k,t[30]=A,t[31]=j}else C=t[23],w=t[24],T=t[25],E=t[26],D=t[27],O=t[28],k=t[29],A=t[30],j=t[31];let M;t[96]!==h||t[97]!==n.questions?(M=n.questions.length>0||h!==null?(0,$.jsxs)(`section`,{className:`flex flex-col gap-1.5`,children:[n.questions.length>0?(0,$.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:`Questions to consider`}):null,(0,$.jsxs)(`div`,{className:`flex flex-col items-start gap-1.5`,children:[n.questions.map(e=>h===null?(0,$.jsx)(`div`,{className:`text-sm text-foreground`,children:(0,$.jsx)(Lu,{text:e})},e):(0,$.jsxs)(`button`,{type:`button`,onClick:()=>h(e),className:`flex min-w-0 items-start gap-2 rounded-lg border border-border/60 px-3 py-1.5 text-left text-sm text-foreground outline-none hover:bg-accent/50 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,children:[(0,$.jsx)(r,{"aria-hidden":!0,className:`mt-0.5 size-3.5 shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Ask an agent: `}),(0,$.jsx)(`span`,{children:(0,$.jsx)(Lu,{text:e,plain:!0})})]},e)),h===null?null:(0,$.jsxs)(G,{size:`sm`,variant:`ghost-muted`,onClick:()=>h(``),children:[(0,$.jsx)(r,{"aria-hidden":!0}),`Ask about this stop`]})]})]}):null,t[96]=h,t[97]=n.questions,t[98]=M):M=t[98];let N;t[99]!==l||t[100]!==g||t[101]!==m?(N=l===null?g===null?null:(0,$.jsxs)(G,{onClick:g,children:[(0,$.jsx)(Ae,{"aria-hidden":!0}),`Finish review`]}):(0,$.jsxs)(G,{className:`min-w-0`,onClick:()=>m(1),children:[(0,$.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`Next: `,l]}),(0,$.jsx)(Ee,{"aria-hidden":!0})]}),t[99]=l,t[100]=g,t[101]=m,t[102]=N):N=t[102];let P;t[103]===N?P=t[104]:(P=(0,$.jsx)(`footer`,{className:`flex flex-wrap items-center justify-end gap-3 border-t border-border/60 pt-4`,children:N}),t[103]=N,t[104]=P);let F;t[105]!==M||t[106]!==P||t[107]!==T||t[108]!==E||t[109]!==D||t[110]!==O||t[111]!==k||t[112]!==A||t[113]!==j?(F=(0,$.jsxs)(`article`,{className:T,children:[E,D,O,k,A,j,M,P]}),t[105]=M,t[106]=P,t[107]=T,t[108]=E,t[109]=D,t[110]=O,t[111]=k,t[112]=A,t[113]=j,t[114]=F):F=t[114];let I;t[115]!==C||t[116]!==y?(I=C?(0,$.jsx)(`aside`,{className:`hidden @min-[90rem]/guide:block @min-[90rem]/guide:sticky @min-[90rem]/guide:top-4 @min-[90rem]/guide:self-start`,children:(0,$.jsx)(Qu,{notes:y})}):null,t[115]=C,t[116]=y,t[117]=I):I=t[117];let L;return t[118]!==w||t[119]!==F||t[120]!==I?(L=(0,$.jsxs)(`div`,{className:w,children:[F,I]}),t[118]=w,t[119]=F,t[120]=I,t[121]=L):L=t[121],L}function ud(e){return e.path}var dd=new Map;function fd(e){let t=(0,Q.c)(23),{environmentId:n,reference:r,headSha:i,wantedPaths:a}=e,o;t[0]===r?o=t[1]:(o=Pi(r),t[0]=r,t[1]=o);let s=`${n}:${o}:${i}`,c;t[2]===s?c=t[3]:(c={key:s,cursor:null,done:!1,files:dd},t[2]=s,t[3]=c);let[l,u]=(0,Z.useState)(c),d,f,p,m;t[4]!==n||t[5]!==s||t[6]!==l||t[7]!==r||t[8]!==a?(d=l.key===s?l:{key:s,cursor:null,done:!1,files:dd},f=a.some(e=>!d.files.has(e))&&!d.done,p=Et,m=f?zr.diff({environmentId:n,input:{...r,...d.cursor===null?{}:{cursor:d.cursor}}}):null,t[4]=n,t[5]=s,t[6]=l,t[7]=r,t[8]=a,t[9]=d,t[10]=f,t[11]=p,t[12]=m):(d=t[9],f=t[10],p=t[11],m=t[12]);let h=p(m),g=h.data,_=d.cursor,v,y;t[13]!==_||t[14]!==g||t[15]!==s?(v=()=>{g!==null&&u(e=>{let t=e.key===s?e:{key:s,cursor:null,done:!1,files:dd};if(t.cursor!==_||t.done)return t;let n=Ft(g.patch,`pull-request-guide:${s}:${_??`first`}`),r=new Map(t.files);if(n?.kind===`files`)for(let e of n.files)r.set(Gt(e),e);return{key:s,cursor:g.nextCursor,done:g.nextCursor===null,files:r}})},y=[_,g,s],t[13]=_,t[14]=g,t[15]=s,t[16]=v,t[17]=y):(v=t[16],y=t[17]),(0,Z.useEffect)(v,y);let b=f&&h.error===null,x=f?h.error:null,S;return t[18]!==d.files||t[19]!==h.refresh||t[20]!==b||t[21]!==x?(S={files:d.files,loading:b,error:x,retry:h.refresh},t[18]=d.files,t[19]=h.refresh,t[20]=b,t[21]=x,t[22]=S):S=t[22],S}function pd(e){let t=(0,Q.c)(63),{environmentId:n,reference:r,guide:i,banner:a,active:o,commenting:s,onAsk:c,onFinish:l,onOpenFile:u}=e,d;t[0]!==n||t[1]!==i.headSha||t[2]!==r?(d=$i(Zi(n,r),i.headSha),t[0]=n,t[1]=i.headSha,t[2]=r,t[3]=d):d=t[3];let f=d,p=Qi(f),m;t[4]===f?m=t[5]:(m=e=>Yi.getState().setProgress(f,t=>({...t,...e(t)})),t[4]=f,t[5]=m);let h=m,[g,_]=(0,Z.useState)(!1),v=i.stops.length,y=Math.max(Math.min(p.position,v-1),0),b=i.stops[y]??null,x;t[6]===b?x=t[7]:(x=b===null?[]:zu(b),t[6]=b,t[7]=x);let S=x,C;t[8]!==n||t[9]!==i.headSha||t[10]!==r||t[11]!==S?(C={environmentId:n,reference:r,headSha:i.headSha,wantedPaths:S},t[8]=n,t[9]=i.headSha,t[10]=r,t[11]=S,t[12]=C):C=t[12];let w=fd(C),T=Dt(zr.diffFileContents),E=`pull-request-guide:${f}`,D;t[13]!==n||t[14]!==T||t[15]!==r||t[16]!==E?(D=Jo(T,{environmentId:n,reference:r,commit:null,cacheKey:E}),t[13]=n,t[14]=T,t[15]=r,t[16]=E,t[17]=D):D=t[17];let O=D,k=(0,Z.useRef)(null),A;t[18]!==y||t[19]!==h?(A=e=>{h(t=>({position:e,seen:e>y?new Set(t.seen).add(y):t.seen})),_(!1),k.current?.scrollTo({top:0})},t[18]=y,t[19]=h,t[20]=A):A=t[20];let j=A,M;t[21]!==j||t[22]!==y||t[23]!==v?(M=e=>j(Ru(y,e,v)),t[21]=j,t[22]=y,t[23]=v,t[24]=M):M=t[24];let N=M,P;t[25]===N?P=t[26]:(P=e=>{e.defaultPrevented||e.isComposing||ma()||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||(e.key===`j`||e.key===`k`)&&(Xi(e.target)||(e.preventDefault(),N(e.key===`j`?1:-1)))},t[25]=N,t[26]=P);let F=(0,Z.useEffectEvent)(P),I;t[27]!==o||t[28]!==F?(I=()=>{if(!o)return;let e=e=>F(e);return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},t[27]=o,t[28]=F,t[29]=I):I=t[29];let L;t[30]===o?L=t[31]:(L=[o],t[30]=o,t[31]=L),(0,Z.useEffect)(I,L);let R;t[32]!==j||t[33]!==i.stops||t[34]!==y||t[35]!==p.seen?(R=(0,$.jsx)(`aside`,{className:`sticky top-4 self-start @max-[56rem]/guide:hidden`,children:(0,$.jsx)(Ju,{stops:i.stops,position:y,seen:p.seen,onSelect:j})}),t[32]=j,t[33]=i.stops,t[34]=y,t[35]=p.seen,t[36]=R):R=t[36];let z;t[37]===w.error?z=t[38]:(z=w.error===null?null:(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`The diff could not be loaded, so excerpts are missing: `,w.error]}),t[37]=w.error,t[38]=z);let B;t[39]!==s||t[40]!==w.files||t[41]!==w.loading||t[42]!==j||t[43]!==i.stops||t[44]!==O||t[45]!==c||t[46]!==l||t[47]!==u||t[48]!==y||t[49]!==g||t[50]!==N||t[51]!==b||t[52]!==v||t[53]!==p.seen||t[54]!==h?(B=b===null?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This change has no files to tour.`}):(0,$.jsx)(ld,{stop:b,index:y,stopCount:v,railOpen:g,onRailOpenChange:_,stopList:(0,$.jsx)(Ju,{stops:i.stops,position:y,seen:p.seen,onSelect:j}),nextTitle:i.stops[y+1]?.title??null,files:w.files,loadDiffFiles:O,diffLoading:w.loading,commenting:s,onStep:N,onAsk:c===null?null:e=>c(y,e),onFinish:l===null?null:()=>{h(e=>({seen:new Set(e.seen).add(y)})),l()},onOpenFile:u},y),t[39]=s,t[40]=w.files,t[41]=w.loading,t[42]=j,t[43]=i.stops,t[44]=O,t[45]=c,t[46]=l,t[47]=u,t[48]=y,t[49]=g,t[50]=N,t[51]=b,t[52]=v,t[53]=p.seen,t[54]=h,t[55]=B):B=t[55];let V;t[56]!==a||t[57]!==z||t[58]!==B?(V=(0,$.jsxs)(`main`,{className:`flex min-w-0 flex-col gap-4`,children:[a,z,B]}),t[56]=a,t[57]=z,t[58]=B,t[59]=V):V=t[59];let H;return t[60]!==R||t[61]!==V?(H=(0,$.jsx)(`div`,{ref:k,className:`@container/guide h-full overflow-y-auto scrollbar-gutter-both`,children:(0,$.jsxs)(`div`,{className:`mx-auto grid max-w-[100rem] gap-6 px-4 py-4 @min-[56rem]/guide:grid-cols-[16rem_minmax(0,1fr)] @min-[90rem]/guide:gap-8 @min-[90rem]/guide:px-6`,children:[R,V]})}),t[60]=R,t[61]=V,t[62]=H):H=t[62],H}function md(e){let t=(0,Q.c)(28),{environmentId:n,reference:r,title:i}=e,a;t[0]!==n||t[1]!==r?(a=zr.reviewGuide({environmentId:n,input:r}),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=Et(a),s;t[3]===n?s=t[4]:(s=zr.generateReviewGuide.permissionAtom(n),t[3]=n,t[4]=s);let c=re(s),l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l={reportFailure:!1},t[5]=l):l=t[5];let u=Dt(zr.generateReviewGuide,l),[d,f]=(0,Z.useState)(!1),p=o.data,m=d||p?.run?._tag===`Running`,h;t[6]!==p||t[7]!==n||t[8]!==r||t[9]!==i?(h=()=>Yi.getState().watch({environmentId:n,reference:r,title:i,previousGuideAt:p?.guide?.generatedAt??null,previousFailedAt:p?.run?._tag===`Failed`?p.run.failedAt:null,since:Date.now()}),t[6]=p,t[7]=n,t[8]=r,t[9]=i,t[10]=h):h=t[10];let g=(0,Z.useEffectEvent)(h),_;t[11]!==p?.run?._tag||t[12]!==g?(_=()=>{p?.run?._tag===`Running`&&g()},t[11]=p?.run?._tag,t[12]=g,t[13]=_):_=t[13];let v=p?.run?._tag,y;t[14]===v?y=t[15]:(y=[v],t[14]=v,t[15]=y),(0,Z.useEffect)(_,y);let b;t[16]!==n||t[17]!==u||t[18]!==r||t[19]!==m||t[20]!==g?(b=async()=>{if(m)return;f(!0),g();let e=await u({environmentId:n,input:r});f(!1),e._tag===`Failure`&&(Yi.getState().settle(Zi(n,r)),gt.add({type:`error`,title:`Could not start a review guide`,description:ai(Ue(e),`Check the review guide model in Settings → Source Control.`)}))},t[16]=n,t[17]=u,t[18]=r,t[19]=m,t[20]=g,t[21]=b):b=t[21];let x=b,S;return t[22]!==c||t[23]!==p||t[24]!==o||t[25]!==m||t[26]!==x?(S={query:o,data:p,running:m,canWrite:c,write:x},t[22]=c,t[23]=p,t[24]=o,t[25]=m,t[26]=x,t[27]=S):S=t[27],S}function hd(e){let t=(0,Q.c)(68),{environmentId:n,reference:r,title:i,workspaceRoot:a,active:o,canComment:s,onAskAboutLines:c,onAskAboutStop:l,onFinishReview:u,onOpenFile:d,onTourShown:f}=e,p;t[0]!==n||t[1]!==r||t[2]!==i?(p={environmentId:n,reference:r,title:i},t[0]=n,t[1]=r,t[2]=i,t[3]=p):p=t[3];let{query:h,data:g,running:_,canWrite:v,write:y}=md(p),b;t[4]!==n||t[5]!==r?(b=Zi(n,r),t[4]=n,t[5]=r,t[6]=b):b=t[6];let x=b,S;t[7]===r?S=t[8]:(S=Pi(r),t[7]=r,t[8]=S);let C=S,w=Fi(r),T=Ni(_d),E=Ni(gd),D;t[9]!==T||t[10]!==s||t[11]!==c||t[12]!==w||t[13]!==E||t[14]!==C?(D=!s&&c===null?null:{canComment:s,pending:w,onComment:e=>{let{path:t,oldPath:n,position:r,body:i}=e;return T(C,{id:Ii(),path:t,...n===null?{}:{oldPath:n},position:r,body:i})},onRemove:e=>E(C,e),onAskAgent:c},t[9]=T,t[10]=s,t[11]=c,t[12]=w,t[13]=E,t[14]=C,t[15]=D):D=t[15];let O=D,k,A;t[16]!==o||t[17]!==x?(k=()=>{if(o)return Yi.getState().setShown(x),()=>{Yi.getState().shownKey===x&&Yi.getState().setShown(null)}},A=[o,x],t[16]=o,t[17]=x,t[18]=k,t[19]=A):(k=t[18],A=t[19]),(0,Z.useEffect)(k,A);let j=g?.guide??null,M=o&&j!==null,N;t[20]===f?N=t[21]:(N=()=>f?.(),t[20]=f,t[21]=N);let P=(0,Z.useEffectEvent)(N),F;t[22]!==P||t[23]!==M?(F=()=>{M&&P()},t[22]=P,t[23]=M,t[24]=F):F=t[24];let I;t[25]===M?I=t[26]:(I=[M],t[25]=M,t[26]=I),(0,Z.useEffect)(F,I);let L=g?.run??null,R=g?.currentHeadSha??null,z=j!==null&&R!==null&&R!==j.headSha,B=L?._tag===`Failed`&&L.headSha===R?L.detail:null,V;t[27]!==v||t[28]!==_||t[29]!==y?(V=(e,t)=>v?(0,$.jsxs)(G,{size:t,variant:`outline`,disabled:_,onClick:()=>void y(),children:[_?(0,$.jsx)(ht,{}):(0,$.jsx)(le,{"aria-hidden":!0,className:`size-3.5`}),_?`Reading the change...`:e]}):null,t[27]=v,t[28]=_,t[29]=y,t[30]=V):V=t[30];let H=V;if(j===null){if(h.isPending&&g===null){let e;return t[31]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`div`,{className:`flex min-h-48 items-center justify-center`,children:(0,$.jsx)(ht,{})}),t[31]=e):e=t[31],e}let e=_?`Writing a review guide`:`No review guide yet`,n;t[32]===e?n=t[33]:(n=(0,$.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:e}),t[32]=e,t[33]=n);let r=B??h.error??(_?`An agent is reading the change. A large one takes a few minutes. You can leave; you will be told when it is ready.`:`A guide is a tour of the change: stops through the code in reading order, with the calls only a maintainer can make.`),i;t[34]===r?i=t[35]:(i=(0,$.jsx)(`p`,{className:`max-w-md text-xs text-muted-foreground`,children:r}),t[34]=r,t[35]=i);let a=B===null?`Write guide`:`Try again`,o;t[36]!==a||t[37]!==H?(o=H(a,`sm`),t[36]=a,t[37]=H,t[38]=o):o=t[38];let s;return t[39]!==n||t[40]!==i||t[41]!==o?(s=(0,$.jsxs)(`div`,{className:`flex min-h-48 flex-col items-center justify-center gap-2 px-4 py-10 text-center`,children:[n,i,o]}),t[39]=n,t[40]=i,t[41]=o,t[42]=s):s=t[42],s}let ee;t[43]!==v||t[44]!==B||t[45]!==_||t[46]!==z||t[47]!==H?(ee=z||B!==null||_?(0,$.jsxs)(ia,{variant:_?`info`:`warning`,children:[_?(0,$.jsx)(ht,{}):(0,$.jsx)(m,{}),(0,$.jsx)(ra,{children:_?`Rewriting this guide. You will be told when the new one is ready.`:B??`Written before the latest push.`}),!_&&v?(0,$.jsx)(na,{children:H(`Rewrite`,`xs`)}):null]}):null,t[43]=v,t[44]=B,t[45]=_,t[46]=z,t[47]=H,t[48]=ee):ee=t[48];let te=ee,ne;t[49]!==n||t[50]!==a?(ne={environmentId:n,cwd:a},t[49]=n,t[50]=a,t[51]=ne):ne=t[51];let U;t[52]!==j||t[53]!==l?(U=l===null?null:(e,t)=>{let n=j.stops[e];n!==void 0&&l(n,e,t)},t[52]=j,t[53]=l,t[54]=U):U=t[54];let W;t[55]!==o||t[56]!==te||t[57]!==O||t[58]!==n||t[59]!==j||t[60]!==u||t[61]!==d||t[62]!==r||t[63]!==U?(W=(0,$.jsx)(pd,{environmentId:n,reference:r,guide:j,banner:te,active:o,commenting:O,onAsk:U,onFinish:u,onOpenFile:d}),t[55]=o,t[56]=te,t[57]=O,t[58]=n,t[59]=j,t[60]=u,t[61]=d,t[62]=r,t[63]=U,t[64]=W):W=t[64];let re;return t[65]!==ne||t[66]!==W?(re=(0,$.jsx)(Iu,{value:ne,children:W}),t[65]=ne,t[66]=W,t[67]=re):re=t[67],re}function gd(e){return e.removeComment}function _d(e){return e.addComment}function vd(e){let t=(0,Q.c)(12),[n,r]=(0,Z.useState)(null),i=n?.scopeKey===e?n:null,a,o;t[0]!==n||t[1]!==e?(a=()=>{if(!n)return;let t=()=>r(null);if(n.scopeKey!==e){t();return}let i=e=>{e.target instanceof Node&&!n.element.contains(e.target)&&t()},a=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),t())},o=window.setTimeout(t,3e3);return document.addEventListener(`pointerdown`,i,!0),window.addEventListener(`keydown`,a,!0),window.addEventListener(`blur`,t),()=>{window.clearTimeout(o),document.removeEventListener(`pointerdown`,i,!0),window.removeEventListener(`keydown`,a,!0),window.removeEventListener(`blur`,t)}},o=[n,e],t[0]=n,t[1]=e,t[2]=a,t[3]=o):(a=t[2],o=t[3]),(0,Z.useEffect)(a,o);let s;t[4]===i?.action?s=t[5]:(s=e=>i?.action===e,t[4]=i?.action,t[5]=s);let c;t[6]!==i||t[7]!==e?(c=(t,n)=>({onClick:a=>{i?.action===t&&i.element===a.currentTarget?(r(null),n()):r({scopeKey:e,action:t,element:a.currentTarget})},onBlur:()=>r(null)}),t[6]=i,t[7]=e,t[8]=c):c=t[8];let l;return t[9]!==s||t[10]!==c?(l={isArmed:s,props:c},t[9]=s,t[10]=c,t[11]=l):l=t[11],l}var yd={merge:`Could not merge this pull request`,ready:`Could not mark this ready for review`,draft:`Could not convert this to a draft`,close:`Could not close this pull request`,reopen:`Could not reopen this pull request`,"update-branch":`Could not update this branch`,"enable-auto-merge":`Could not turn on auto-merge`,"disable-auto-merge":`Could not turn off auto-merge`,revert:`Could not open a revert pull request`,"delete-branch":`Could not delete this branch`,"approve-workflows":`Could not approve workflows`},bd={merge:`The host refused the merge. Check that you have write access, that the checks it requires have passed, and that the branch is not conflicting.`,ready:`The host refused it. Check that you have write access to this repository.`,draft:`The host refused it. Check that you have write access to this repository.`,close:`The host refused it. Check that you have write access, or that you opened it.`,reopen:`The host refused it. Check that you have write access, and that the branch still exists.`,"update-branch":`The host refused it. Check that you have write access to the branch — one from a fork also needs its author to allow edits from maintainers — and that it does not conflict with the base.`,"enable-auto-merge":`The host refused it. Check that this repository allows auto-merge, that you have write access, and that there is something left for it to wait on.`,"disable-auto-merge":`The host refused it. Check that you have write access, and that the merge has not already happened.`,revert:`The host refused it. Check that you have write access and that this pull request was merged on the host.`,"delete-branch":`The host refused it. Check that you have write access to the source repository and that the branch has not moved since this page loaded.`,"approve-workflows":`The host refused it. Check that you have Actions write access and that these workflow runs are still awaiting approval.`},xd=`The host refused it. A rebase stops at the first commit that does not apply cleanly; updating with a merge commit may still work.`,Sd=[{value:`summary`,label:`Summary`},{value:`guide`,label:`Guide`},{value:`timeline`,label:`Timeline`},{value:`code`,label:`Code`}],Cd=()=>t(()=>import(`./PullRequestCodeTab-Ba54Mifj.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336])),wd=(0,Z.lazy)(Cd),Td=new Map,Ed=e=>typeof e==`string`?e:D(e);function Dd(e){let t=(0,Q.c)(12),{environments:n,value:r,onChange:a,disabled:o}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(je,{}),t[0]=s):s=t[0];let c;t[1]===a?c=t[2]:(c=e=>a(e),t[1]=a,t[2]=c);let l;if(t[3]!==o||t[4]!==n){let e;t[6]===o?e=t[7]:(e=e=>(0,$.jsx)(i,{value:e.environmentId,disabled:o,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(ea,{kind:e.machine??`server`,className:`size-3.5 shrink-0`}),(0,$.jsx)(`span`,{className:`truncate`,children:e.label})]})},e.environmentId),t[6]=o,t[7]=e),l=n.map(e),t[3]=o,t[4]=n,t[5]=l}else l=t[5];let u;return t[8]!==c||t[9]!==l||t[10]!==r?(u=(0,$.jsxs)($.Fragment,{children:[s,(0,$.jsx)(I,{value:r,onValueChange:c,children:l})]}),t[8]=c,t[9]=l,t[10]=r,t[11]=u):u=t[11],u}var Od=(e,t)=>{e.preventDefault(),e.stopPropagation(),Sl({url:t.url,openLabel:bl(Ar.get(t.provider)),position:{x:e.clientX,y:e.clientY}})};function kd(e){let t=(0,Q.c)(28),{baseBranch:n,freshness:r,pending:i,onUpdate:a,iconClassName:o,className:s,children:c}=e,l;t[0]===r.behindBy?l=t[1]:(l=r.behindBy===null?``:` by ${r.behindBy.toLocaleString()} ${r.behindBy===1?`commit`:`commits`}`,t[0]=r.behindBy,t[1]=l);let u=`This branch is out-of-date with ${n}${l}.`,d;t[2]===s?d=t[3]:(d=K(`inline-flex min-w-0 shrink-0 cursor-help items-center gap-1 rounded-sm text-warning-foreground outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,s),t[2]=s,t[3]=d);let f;t[4]!==u||t[5]!==d?(f=(0,$.jsx)(`button`,{type:`button`,"aria-label":u,className:d}),t[4]=u,t[5]=d,t[6]=f):f=t[6];let p;t[7]===o?p=t[8]:(p=K(`size-3.5 shrink-0`,o),t[7]=o,t[8]=p);let h;t[9]===p?h=t[10]:(h=(0,$.jsx)(m,{"aria-hidden":!0,className:p}),t[9]=p,t[10]=h);let g;t[11]!==c||t[12]!==f||t[13]!==h?(g=(0,$.jsxs)(Wr,{openOnHover:!0,delay:0,closeDelay:120,render:f,children:[c,h]}),t[11]=c,t[12]=f,t[13]=h,t[14]=g):g=t[14];let _;t[15]===u?_=t[16]:(_=(0,$.jsx)(`p`,{className:`text-xs text-foreground`,children:u}),t[15]=u,t[16]=_);let v;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:`Changes can be cleanly merged.`}),t[17]=v):v=t[17];let y;t[18]!==r.methods||t[19]!==a||t[20]!==i?(y=r.methods.length>0?(0,$.jsx)(`span`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:r.methods.map(e=>(0,$.jsxs)(G,{size:`xs`,variant:`outline`,disabled:i,onClick:()=>a(e),children:[(0,$.jsx)(Mr.merged,{"aria-hidden":!0,className:`size-3`}),e===`rebase`?`Update with rebase`:`Update branch`]},e))}):null,t[18]=r.methods,t[19]=a,t[20]=i,t[21]=y):y=t[21];let b;t[22]!==_||t[23]!==y?(b=(0,$.jsxs)(Hr,{align:`start`,side:`bottom`,className:`max-w-80`,padding:`compact`,children:[_,v,y]}),t[22]=_,t[23]=y,t[24]=b):b=t[24];let x;return t[25]!==b||t[26]!==g?(x=(0,$.jsxs)(Gr,{children:[g,b]}),t[25]=b,t[26]=g,t[27]=x):x=t[27],x}function Ad({environmentId:e,shortcutsEnabled:t,getShortcutContext:n,threadRef:o=null,reference:s,listEntry:c=null,refreshToken:u=0,onActed:m,onClose:h,context:g=`page`,composerDraftTarget:_,onBack:v,onSelectPullRequest:b,onGuideShown:C}){let w=qe(),T=We(),E=T.find(t=>t.id===s.projectId&&t.environmentId===e),D=E?.repositoryIdentity,k=w.get(e)?.environment.capabilities.threadPullRequests===!0,M=(0,Z.useMemo)(()=>k?ci(s,D):{projectId:s.projectId,repository:s.repository,number:s.number},[s,D,k]),N=`${M.projectId}:${M.host??``}:${M.repository}#${M.number}`,P=c?.projectId===M.projectId&&c.repository.toLowerCase()===M.repository.toLowerCase()&&(M.host===void 0||c.host.toLowerCase()===M.host.toLowerCase())&&c.number===M.number?c:null,[F,R]=(0,Z.useState)(!1),[B,V]=(0,Z.useState)(0),[H,U]=(0,Z.useState)(`summary`),[ie,ae]=(0,Z.useState)(`newest`),[ce,ue]=(0,Z.useState)(()=>({pullRequestKey:N,oid:null})),de=ce.pullRequestKey===N?ce.oid:null,he=e=>{ue({pullRequestKey:N,oid:e})},ge=e=>{he(e),U(`code`)},[ve,ye]=(0,Z.useState)(null),xe=e=>{he(null),ye(t=>({path:e,nonce:(t?.nonce??0)+1})),Cd(),U(`code`)},we=Yi(t=>t.openRequestKey===Zi(e,M));we&&H!==`guide`&&U(`guide`),(0,Z.useEffect)(()=>{we&&Yi.getState().requestOpen(null)},[we]);let Te=`${e}:${N}`,[Ee,Oe]=(0,Z.useState)(()=>({key:Te,tabs:new Set([`summary`])})),Ne=Ee.key===Te?Ee.tabs:new Set([H]);(0,Z.useEffect)(()=>{Oe(e=>e.key===Te?e.tabs.has(H)?e:{key:Te,tabs:new Set(e.tabs).add(H)}:{key:Te,tabs:new Set([H])})},[H,Te]);let[Pe,Fe]=(0,Z.useState)(!1),Le=(0,Z.useRef)({});(0,Z.useEffect)(()=>{Fe(Le.current[H]??!1)},[H]);let Re=Pe,ze=(0,Z.useRef)({}),Ve=(0,Z.useMemo)(()=>({summary:e=>{ze.current.summary=e},timeline:e=>{ze.current.timeline=e},code:e=>{ze.current.code=e}}),[]),Ge=(0,Z.useRef)(null),Ke=(0,Z.useRef)(null),Je=(0,Z.useRef)(null);(0,Z.useLayoutEffect)(()=>{let e=Je.current;e!==null&&(Je.current=null,Re&&e.tab===H&&ze.current[H]===e.scroller&&(e.scroller.scrollTop=Math.max(0,e.scroller.scrollTop+e.delta)))},[Re,H]);let Ze=Gi(e=>e.pullRequestMergeMethod),$e=Gi(e=>e.setPullRequestMergeMethod),et=Sa(e,M.projectId),tt=(0,Z.useMemo)(()=>et(),[et]),[nt,rt]=(0,Z.useState)(null),it=e=>{rt({pullRequestKey:N,method:e})},at=vd(N),[ot,st]=(0,Z.useState)(null),ct=wt(e,Ie),lt=Et(zr.detail({environmentId:e,input:M})),ut=Et(zr.activity({environmentId:e,input:M})),dt=Fr(e),[ft,pt]=(0,Z.useState)(()=>ei(typeof window>`u`?void 0:window.localStorage,e,M));(0,Z.useEffect)(()=>{pt(ei(typeof window>`u`?void 0:window.localStorage,e,M))},[e,N,M.projectId,M.repository,M.number]),(0,Z.useEffect)(()=>{lt.data!==null&&(ui(typeof window>`u`?void 0:window.localStorage,e,M,lt.data),pt(lt.data))},[lt.data,e,N,M.projectId,M.repository,M.number]);let mt=qr({live:lt.data,cached:ft,reference:M}),ht=(0,Z.useMemo)(()=>P===null?null:Ir(P),[P]),_t=(0,Z.useMemo)(()=>lt.data===null?null:{...lt.data,checksState:br(lt.data.checks)},[lt.data]),xt=Br(e,M,_t,lt.dataUpdatedAt),kt=(0,Z.useMemo)(()=>Rr(mt,Rr(xt,ht)),[mt,xt,ht]),jt=(0,Z.useMemo)(()=>mt===null||kt===null||kt===mt?mt:{...mt,title:kt.title,state:kt.state,headBranch:kt.headBranch,baseBranch:kt.baseBranch,updatedAt:kt.updatedAt,author:kt.author??mt.author,additions:kt.additions??mt.additions,deletions:kt.deletions??mt.deletions,changedFiles:kt.changedFiles??mt.changedFiles,mergeability:kt.mergeability??mt.mergeability,closedAt:kt.closedAt===void 0?mt.closedAt:kt.closedAt,mergedAt:kt.mergedAt===void 0?mt.mergedAt:kt.mergedAt,isDraft:kt.isDraft??mt.isDraft},[mt,kt]),Mt=ut.data,q=(0,Z.useMemo)(()=>jt===null?null:{...jt,capabilities:ct?jt.capabilities:{...jt.capabilities,reactions:!1,edit:{changeRequest:!1,comment:!1}},viewerPermissions:ct?jt.viewerPermissions:{...jt.viewerPermissions,actions:[],comment:!1,resolve:!1,verdicts:[],requestReviewers:!1,updateMethods:[],labels:!1},author:Mt?.author??jt.author,reviewers:Mt?.reviewers??jt.reviewers,comments:Mt?.comments??[],commentCount:Mt?.commentCount??0,commentsTruncated:Mt?.commentsTruncated??!1,reviewThreads:Mt?.reviewThreads??[],commits:Mt?.commits??[],reactions:Mt?.reactions??[]},[Mt,ct,jt]),Nt=q??kt,Pt=re(Ct),{copyToClipboard:Ft}=vt({target:`pull request reference`,onCopy:e=>gt.add({type:`success`,title:`${e} copied`}),onError:(e,t)=>gt.add({type:`error`,title:`Failed to copy ${t}`,description:e.message})}),It=(0,Z.useEffectEvent)(e=>{!t||e.defaultPrevented||ma()||rr(e,Pt,{context:n()})===`pullRequest.copyNumber`&&(e.preventDefault(),e.stopPropagation(),e.repeat||Ft(`#${M.number}`,`PR number`))});(0,Z.useEffect)(()=>{let e=e=>It(e);return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[]),(0,Z.useEffect)(()=>{q?.autoMergeMethod!==void 0&&it(q.autoMergeMethod)},[q?.autoMergeMethod,N]);let Lt=q===null?null:Ye(q.url),Rt=Ar.get(q?.provider),zt=(0,Z.useMemo)(()=>({repositoryUrl:Lt===null?null:Rt.referenceAutolinkRepositoryUrl(Lt),threadRef:o}),[Rt,Lt,o]),Bt=q?.author&&Lt!==null?Rt.authorProfileUrl(q.author.login,Lt):null,Vt=Nt?ti(Nt.provider,Nt.number,Nt.headBranch,q?.headRepositoryNameWithOwner,Ye(Nt.url)):Xr(M,D),Ht=(0,Z.useCallback)(e=>{gt.add({type:`error`,title:`Could not copy checkout command`,description:e.message})},[]),Ut=Et(q===null?null:At.listRefs({environmentId:e,input:{cwd:q.workspaceRoot,includeMatchingRemoteRefs:!0,limit:2}})),Wt=q!==null&&Ai(q.baseBranch,Ut.data?.refs??[]),Gt=yc(e,(0,Z.useMemo)(()=>q===null||q.capabilities.stacks!==!0||!k?null:{...M,host:M.host??Xe(q.url)?.host},[q,M,k])),Kt=Gt.data,qt=k&&q?.capabilities.stacks===!0&&q.capabilities.stackActions===!0&&w.get(e)?.environment.capabilities.pullRequestStackActions===!0,Jt=Ei({supportsStackActions:qt,hasStack:Kt!==null,stackPending:!Gt.isFresh,stackError:Gt.error}),Yt=ut.isPending&&Mt===null,Xt=Mt===null?ut.error:null,Zt=(0,Z.useCallback)(()=>{lt.refresh(),ut.refresh(),Gt.refresh()},[ut.refresh,lt.refresh,Gt.refresh]),[Qt,$t]=(0,Z.useState)(0),en=Qt+(dt??0),tn=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{if(!jt)return;let e={key:Te,updatedAt:jt.updatedAt};if($r(tn.current,e)){if(ut.isPending)return;ut.refresh(),$t(e=>e+1)}tn.current=e},[ut.isPending,ut.refresh,jt,Te]),Nc(()=>{lt.refresh()},{key:`pull-request:${e}:${N}`});let nn=Dt(zr.invalidate,{reportFailure:!1}),[rn,an]=(0,Z.useState)(!1),on=rn||lt.isPending,sn=(0,Z.useCallback)(async()=>{an(!0);try{await nn({environmentId:e,input:{reference:M}}),Zt(),$t(e=>e+1)}finally{an(!1)}},[e,nn,M,Zt]),cn=(0,Z.useRef)(u);(0,Z.useEffect)(()=>{cn.current!==u&&(cn.current=u,sn())},[u,sn]);let ln=Dt(zr.runAction,{reportFailure:!1}),un=Dt(zr.comment,{reportFailure:!1}),[dn,fn]=(0,Z.useState)(null),pn=dn!==null,mn=Dt(zr.update,{reportFailure:!1}),[hn,gn]=(0,Z.useState)(null),_n=hn?.pullRequestKey===N?hn.text:null,[vn,yn]=(0,Z.useState)(!1),bn=Ji(),{environments:xn}=yt(),Sn=(0,Z.useMemo)(()=>{let t=T.find(t=>t.id===M.projectId&&t.environmentId===e)?.repositoryIdentity;return Qe(t,M.repository,M.number)},[e,T,M.number,M.projectId,M.repository]),wn=(0,Z.useMemo)(()=>g===`page`?gc({environmentId:e,projectId:M.projectId},T,xn.map(e=>({environmentId:e.environmentId,label:e.label,machine:Be(e.serverConfig)}))):[],[g,e,xn,T,M.projectId]),[En,Dn]=(0,Z.useState)(null),On=En?.pullRequestKey===N?En.environmentId:e,kn=wn.find(e=>e.environmentId===On)??null,An=kn?.environmentId??e,jn=kn?.workspaceRoot??q?.workspaceRoot??E?.workspaceRoot??null,Mn=wt(An,se),Nn=Ca({environmentId:An,cwd:jn}),Pn=async(t,n,r)=>{m?.(t,`sent`);let i=await ln({environmentId:e,input:{...M,action:t,...n?{mergeMethod:n}:{},...r?{updateMethod:r}:{}}});if(fn(null),i._tag===`Failure`){let e=Ue(i),n=r===`rebase`?xd:bd[t];return gt.add({type:`error`,title:yd[t],description:ai(e,n)}),m?.(t,`failed`),!1}return t===`revert`&&gt.add({type:`success`,title:`Revert pull request opened`}),t===`delete-branch`&&gt.add({type:`success`,title:`Branch deleted`}),bi(t)?sn():Zt(),m?.(t,`done`),!0},Fn=async(e,t,n)=>!ct||dn!==null?!1:(fn(e),Pn(e,t,n)),In=async(t,n)=>!ct||dn!==null?{commentPosted:!1}:(fn(n),(await un({environmentId:e,input:{...M,body:t}}))._tag===`Failure`?(fn(null),gt.add({type:`error`,title:`Could not post the comment`}),{commentPosted:!1}):(await Pn(n)||Zt(),{commentPosted:!0})),Rn=async t=>{let n=t.trim();if(!ct||q===null||vn)return;if(n.length===0||n===q.title){gn(null);return}yn(!0);let r=await mn({environmentId:e,input:{...M,title:n}});if(yn(!1),r._tag===`Failure`){gt.add({type:`error`,title:`The title could not be saved`,description:ai(Ue(r),`The host refused the new title.`)});return}gn(null),Zt()},zn=_??null,Bn=Nn.isAllowed&&Mn,Vn=zn!==null||Bn,Hn=ii(zn!==null),Un=md({environmentId:e,reference:M,title:q?.title??null}),Wn=()=>{Un.write(),Un.data?.guide??U(`guide`)},Gn=(e,t)=>{let n=d.getState(),r=n.getComposerDraft(e),i=Ed(e),a=new Set((r?.reviewComments??[]).map(e=>e.id)),o=new Set((t.reviewComments??[]).filter(e=>a.has(e.id)).map(e=>e.id)),s=Ti(r?.prompt??``,r?.reviewComments??[],o),c=ji({prompt:s,lastHandoffPrompt:Td.get(i)},t.prompt);Td.set(i,t.prompt),n.setPrompt(e,c),n.setReviewComments(e,mi(r?.reviewComments??[],t.reviewComments??[]));for(let r of t.reviewComments??[])o.has(r.id)&&n.addReviewComment(e,r,{allowDuplicateReference:!0,insertAtCaret:!1})},Kn=async(e,t,n)=>{let r=n??await bn(e).then(e=>e,()=>null);return r===null?null:(t===null||Gn(r.draftId,t),r)},qn=async(t,n,r)=>{if(!q||ot!==null)return;if(zn!==null){Gn(zn,n),gt.add({type:`success`,title:`Added to the composer`,description:n.prompt.length>0?`The question is in the composer — read it over, then send.`:`The pull request is in the composer — type your question, then send.`});return}st(t);let i=x(An,kn?.projectId??q.projectId),a=await Kn(i,n);if(st(null),a!==null&&r?.keepGuide===!0){let t=d.getState().getDraftSession(a.draftId);t!==null&&(Ot.getState().openPullRequest(A(t.environmentId,t.threadId),{environmentId:e,projectId:M.projectId,...M.host===void 0?{}:{host:M.host},repository:M.repository,number:M.number,url:q.url}),Yi.getState().requestOpen(Zi(e,M)))}if(a===null){gt.add({type:`error`,title:`Could not open a thread`,description:`Try again from the project, or open a thread first.`});return}gt.add({type:`success`,title:`Asked in a thread`,description:n.prompt.length>0?`The question is in the composer — read it over, then send.`:`The pull request is in the composer — type your question, then send.`})},Jn=async(e,t,n=`worktree`)=>{if(!Nt||ot!==null)return;if(zn!==null&&t!==null){Gn(zn,t),gt.add({type:`success`,title:`Added to the composer`,description:`The task is in the composer — read it over, then send.`});return}if(jn===null||!Nn.isAllowed||!Tt(An,`source-control:write`)||n===`worktree`&&!Tt(An,`orchestration:operate`))return;st(e);let r=gt.add({type:`loading`,title:`Preparing the pull request checkout...`}),i=x(An,kn?.projectId??Nt.projectId),a=await bn(i).then(e=>e,()=>null);if(a===null){st(null),gt.update(r,{type:`error`,title:`Could not open a thread for the checkout`,description:`Try again from the project, or open a thread first.`});return}let o=await Nn.run({reference:Nt.url,mode:n,threadId:a.threadId});if(o._tag===`Failure`){st(null);let e=Nn.error instanceof Error?Nn.error.message:null;gt.update(r,{type:`error`,title:`Could not prepare the pull request checkout`,...e?{description:e}:{}});return}if(!await bn(i,{branch:o.value.branch,worktreePath:o.value.worktreePath,envMode:o.value.worktreePath===null?`local`:`worktree`}).then(e=>e!==null,()=>!1)){st(null),gt.update(r,{type:`error`,title:`Checked out, but the thread stayed where it was`,description:`The checkout is ready on \`${o.value.branch}\`. Point a thread at it from the branch picker, then ask again.`});return}st(null);let s={type:`warning`,title:`Checked out, but not on the latest commits`,description:`The checkout could not be moved onto the pull request's latest commits, so the code there is older than the pull request. Uncommitted work or local commits keep it where it is.`};if(t===null){gt.update(r,o.value.isOnPullRequestHead?{type:`success`,title:n===`local`?`Checked out here`:`Checked out`,description:n===`local`?`This repository is on the pull request's branch, with a thread open on it.`:`The pull request is in its own worktree, with a thread open on it.`}:s);return}await Kn(i,t,a),gt.update(r,o.value.isOnPullRequestHead?{type:`success`,title:`Checkout ready`,description:`The task is in the composer — read it over, then send.`}:s)},Yn=()=>{q&&qn(`ask`,{...Ci({number:q.number,title:q.title,url:q.url,headBranch:q.headBranch,baseBranch:q.baseBranch,state:q.state,isDraft:q.isDraft})})},Xn=()=>{q&&qn(`explain`,{...Di({number:q.number,title:q.title,url:q.url,headBranch:q.headBranch,baseBranch:q.baseBranch,state:q.state,isDraft:q.isDraft})})},Zn=(e,t,n)=>{q&&qn(`guide-stop:${t}`,pi({number:q.number,title:q.title,url:q.url,headBranch:q.headBranch,baseBranch:q.baseBranch,state:q.state,isDraft:q.isDraft,stop:{index:t,title:e.title,summary:e.summary,attention:e.attention?.note??null,excerpts:e.excerpts},question:n}),{keepGuide:!0})},Qn=(e,t)=>{q&&qn(`selection:${e.comment.id}`,yi({number:q.number,title:q.title,url:q.url,headBranch:q.headBranch,baseBranch:q.baseBranch,state:q.state,isDraft:q.isDraft,comment:e.comment,request:e.request}),t)},$n=e=>{Nt&&Jn(`checkout:${e}`,null,e)},er=e=>{q&&Jn(ni(e),hi({number:q.number,title:q.title,url:q.url,headBranch:q.headBranch,baseBranch:q.baseBranch,finding:e}))},tr=()=>{q&&Jn(`findings`,Si({number:q.number,title:q.title,url:q.url,headBranch:q.headBranch,baseBranch:q.baseBranch,reviewThreads:q.reviewThreads,comments:q.comments,checks:Nr?[]:q.checks,commentsTruncated:q.commentsTruncated}))},nr=()=>{Nt&&Jn(`conflicts`,{prompt:_i({number:Nt.number,url:Nt.url,headBranch:Nt.headBranch,baseBranch:Nt.baseBranch})})},ar=q?q.capabilities.mergeMethods.filter(e=>q.mergeCapabilities[e]):[],or=nt?.pullRequestKey===N?nt.method:null,sr=li(ar,or,tt,Ze),cr=Oi[sr],lr=`Auto-merge (${cr.toLowerCase()})`,ur=q?.state===`open`&&q.mergeability===`conflicting`,dr=q?.state===`open`&&q.autoMergeEnabled===!0,fr=q?.autoMergeMethod,gr=fr?`Auto-merge (${Oi[fr].toLowerCase()})`:`Auto-merge`,_r=q?.state===`open`?q.workflowApprovalsRequired??0:0,yr=q===null?null:Mi(q),xr=St(e,e=>e.reviewGuidesEnabled),Cr=Sd.filter(e=>(e.value!==`code`||q===null||q.capabilities.diff)&&(e.value!==`guide`||xr));(0,Z.useEffect)(()=>{Cr.some(e=>e.value===H)||U(`summary`)},[H,Cr]);let Tr=e=>q?.capabilities.actions.includes(e)===!0&&q.viewerPermissions.actions.includes(e),Er=q?br(q.checks):null,Dr=kt?.checksState===void 0?Er:kt.checksState,jr=Dr!==`failing`&&q?.checks.some(e=>e.status===`action-required`)?`pending`:Dr,Nr=jr!==Er,Pr=q?Zr({state:q.state,isDraft:q.isDraft,mergeability:q.mergeability,checksState:jr,autoMergeEnabled:q.autoMergeEnabled,hasMergeMethod:ar.length>0,canMerge:Jt&&Tr(`merge`),canMarkReady:Tr(`ready`),canEnableAutoMerge:Jt&&Tr(`enable-auto-merge`)}):null,Lr=q?.state===`open`&&Tr(q.isDraft?`ready`:`draft`)&&!(q.isDraft&&Pr===`ready`),Vr=Jt&&q?.state===`open`&&(dr&&Tr(`disable-auto-merge`)||!dr&&Pr!==`enable-auto-merge`&&!q.isDraft&&!ur&&Tr(`enable-auto-merge`)&&ar.length>0),Hr=Jt&&q?.state===`open`&&(Pr===`enable-auto-merge`||Pr===`auto-merge-armed`)&&Tr(`merge`)&&!q.isDraft&&!ur&&ar.length>0,Ur=q?.state===`open`&&Tr(`merge`)&&!q.isDraft&&!ur&&ar.length>1,Wr=q?pr({state:q.state,isDraft:q.isDraft}):null,Gr=q!==null&&wi(q),Jr=xn.some(t=>t.environmentId===e&&t.connection.phase===`connected`),Yr=async()=>{q!==null&&await bt()?.dialogs.confirm([`Delete branch ${q.headBranch}?`,`This deletes ${q.headBranch} from ${q.headRepositoryNameWithOwner??q.repository}. Local branches and worktrees are not changed.`].join(`
215
+ `),{variant:`destructive`})&&Fn(`delete-branch`)},Qr=_r>0&&!Nr&&Tr(`approve-workflows`),ri=Nr?jr===null?`No checks reported`:vr(jr).label:q?Or(q.checks):null,di=q&&!q.commentsTruncated?si(q.comments,q.commits).filter(e=>e.outcome===`approved`&&!e.stale).length:0,fi=g===`page`?(0,$.jsxs)(y,{children:[(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(Ce,{disabled:ot!==null||jn===null,render:(0,$.jsxs)(G,{size:`xs`,variant:`outline`,"aria-label":ot?.startsWith(`checkout`)?`Checking out...`:`Check out`,children:[(0,$.jsx)(be,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`@max-[35rem]/pr-header:hidden`,children:ot?.startsWith(`checkout`)?`Checking out...`:`Check out`}),(0,$.jsx)(fe,{"aria-hidden":!0,className:`size-3.5 text-muted-foreground`})]})})}),(0,$.jsx)(Y,{children:`Check out this pull request`})]}),(0,$.jsxs)(oe,{align:`end`,side:`bottom`,children:[(0,$.jsxs)(W,{disabled:!Bn,onClick:()=>$n(`worktree`),children:[(0,$.jsx)(be,{className:`mt-1 size-3.5 shrink-0 self-start`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{children:`In a separate worktree`}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Its own folder and thread. Nothing you have open moves.`})]})]}),(0,$.jsxs)(W,{disabled:!Nn.isAllowed,onClick:()=>$n(`local`),children:[(0,$.jsx)(ke,{className:`mt-1 size-3.5 shrink-0 self-start`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{children:`In this repository`}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:"Switches the branch you are working in, like `gh pr checkout`."})]})]}),wn.length>0?(0,$.jsx)(Dd,{environments:wn,value:An,onChange:e=>Dn({pullRequestKey:N,environmentId:e}),disabled:ot!==null}):null]})]}):null,gi=(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(`span`,{className:`inline-flex shrink-0`,children:(0,$.jsxs)(G,{size:`xs`,variant:`destructive-outline`,disabled:ot!==null||zn===null&&jn===null,onClick:nr,"aria-label":ot===`conflicts`?`Preparing...`:`Resolve conflicts`,children:[(0,$.jsx)(Mr.conflicting,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`@max-[30rem]/pr-header:hidden`,children:ot===`conflicts`?`Preparing...`:`Resolve conflicts`})]})})}),(0,$.jsx)(Y,{side:`top`,children:ot===`conflicts`?`Preparing...`:`Resolve conflicts`})]});return lt.isPending&&!q?(0,$.jsx)(ul,{seed:P,summary:kt,checkoutCommand:Vt,onCheckoutError:Ht,number:M.number,tabs:Cr,activeTab:H,...v?{onBack:v}:{},...h?{onClose:h}:{},actions:Nt?(0,$.jsxs)(Tn,{delay:150,closeDelay:150,timeout:400,children:[Nt.state===`open`&&Nt.mergeability===`conflicting`?gi:null,fi]}):void 0}):(0,$.jsxs)(`div`,{className:`relative flex h-full min-h-0 w-full flex-col bg-background`,children:[F&&q?(0,$.jsx)(Jc,{display:`picker`,environmentId:e,reference:M,url:q.url,threadRef:null,onPickerOpenChange:R},`${e}:${q.url}`):null,(0,$.jsxs)(`div`,{className:K(`@container/pr-header grid min-w-0 shrink-0 grid-cols-[minmax(0,1fr)_auto] items-start gap-x-2`,q&&`border-b border-border/60`,!q&&!h&&`hidden`),children:[(0,$.jsxs)(`div`,{className:`pl-4 grid h-7 min-w-0 items-center overflow-hidden`,children:[(0,$.jsx)(`div`,{"aria-hidden":Re,inert:Re,className:K(`col-start-1 row-start-1 flex min-w-0 items-center gap-1 text-sm text-muted-foreground transition-[opacity,transform] ease-out motion-reduce:transform-none motion-reduce:transition-none sm:text-xs`,Re?`pointer-events-none -translate-y-1 opacity-0 duration-100`:`translate-y-0 opacity-100 delay-50 duration-150`),children:q&&Wr?(0,$.jsxs)($.Fragment,{children:[v?(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(G,{size:`icon-micro`,variant:`ghost-muted`,onClick:v,className:`-ml-1.5`,"aria-label":`Back to this thread's pull requests`,children:(0,$.jsx)(j,{"aria-hidden":!0,className:`size-3.5`})})}),(0,$.jsx)(Y,{side:`top`,children:`Back to pull requests`})]}):null,(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:Lt?(0,$.jsx)(`button`,{type:`button`,onClick:()=>void bt()?.shell.openExternal(Lt),className:`min-w-0 cursor-pointer truncate text-left font-medium text-muted-foreground underline-offset-2 hover:text-foreground hover:underline`,children:q.repository}):(0,$.jsx)(`span`,{className:`min-w-0 truncate font-medium text-muted-foreground`,children:q.repository})}),(0,$.jsx)(Y,{side:`top`,children:Lt?`Open ${q.repository} repository`:q.repository})]}),(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void bt()?.shell.openExternal(q.url),onContextMenu:e=>Od(e,q),className:K(`inline-flex shrink-0 cursor-pointer items-center gap-0.5 font-medium underline-offset-2 hover:underline`,Wr.toneClassName),"aria-label":`Open pull request #${q.number} on host`,children:[`#`,q.number,(0,$.jsx)(O,{"aria-hidden":!0,className:`size-2.5`})]})}),(0,$.jsx)(Y,{side:`top`,children:bl(Rt)})]})]}):null}),(0,$.jsx)(`div`,{"aria-hidden":!Re,inert:!Re,className:K(`col-start-1 row-start-1 flex min-w-0 items-center gap-1 text-sm text-muted-foreground transition-[opacity,transform] ease-out motion-reduce:transform-none motion-reduce:transition-none sm:text-xs`,Re?`translate-y-0 opacity-100 delay-50 duration-150`:`pointer-events-none translate-y-1 opacity-0 duration-100`),children:q&&Wr?(0,$.jsxs)($.Fragment,{children:[v?(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(G,{size:`icon-micro`,variant:`ghost-muted`,tabIndex:Re?0:-1,onClick:v,className:`-ml-1.5`,"aria-label":`Back to this thread's pull requests`,children:(0,$.jsx)(j,{"aria-hidden":!0,className:`size-3.5`})})}),(0,$.jsx)(Y,{side:`top`,children:`Back to pull requests`})]}):null,(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsxs)(`button`,{type:`button`,tabIndex:Re?0:-1,onClick:()=>void bt()?.shell.openExternal(q.url),onContextMenu:e=>Od(e,q),className:K(`inline-flex shrink-0 cursor-pointer items-center gap-0.5 font-medium underline-offset-2 hover:underline`,Wr.toneClassName),"aria-label":`Open pull request #${q.number} on host`,children:[`#`,q.number,(0,$.jsx)(O,{"aria-hidden":!0,className:`size-2.5`})]})}),(0,$.jsx)(Y,{side:`top`,children:bl(Rt)})]}),(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground`,children:q.title})}),(0,$.jsx)(Y,{side:`top`,children:q.title})]})]}):null})]}),(0,$.jsxs)(`div`,{className:`mr-4 flex h-7 shrink-0 items-center justify-end gap-1`,children:[q?(0,$.jsxs)(Tn,{delay:150,closeDelay:150,timeout:400,children:[!Kt&&qt&&Gt.error?(0,$.jsx)(G,{variant:`ghost`,size:`xs`,onClick:Gt.refresh,children:`Retry stack lookup`}):null,Kt?(0,$.jsx)(Lc,{hostLabel:Rt.label,stack:Kt,notice:Gt.notice,onRetry:Gt.error?Gt.refresh:void 0,reference:M,environmentId:e,onSelect:b,mergeMethod:sr,canMerge:Gt.isFresh&&qt&&Tr(`merge`)&&ar.length>0,canRebase:Gt.isFresh&&qt&&q.viewerPermissions.stackRebase===!0,onActed:()=>{Zt(),m?.()}}):null,g===`page`?(0,$.jsx)(Jc,{display:`count`,environmentId:e,reference:M,url:q.url,threadRef:null}):null,dr&&Pr!==`auto-merge-armed`?(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsxs)(te,{size:`control`,variant:`info`,role:`img`,"aria-label":gr,children:[(0,$.jsx)(Mr.merged,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`@max-[30rem]/pr-header:hidden`,children:gr})]})}),(0,$.jsxs)(Y,{side:`top`,children:[gr,`: the host will merge this on its own once its requirements are met`]})]}):null,Pr===`resolve`?gi:Pr===`ready`?(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(`span`,{className:`inline-flex shrink-0`,children:(0,$.jsxs)(G,{size:`xs`,variant:`default`,disabled:pn,onClick:()=>void Fn(`ready`),"aria-label":`Ready for review`,children:[(0,$.jsx)(Mr.pullRequest,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`@max-[30rem]/pr-header:hidden`,children:`Ready for review`})]})})}),(0,$.jsx)(Y,{side:`top`,children:`Ready for review`})]}):Pr===`enable-auto-merge`?(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(`span`,{className:`inline-flex shrink-0`,children:(0,$.jsxs)(G,{size:`xs`,variant:`default`,disabled:pn,...at.props(`enable-auto-merge`,()=>void Fn(`enable-auto-merge`,sr)),"aria-label":dn===`enable-auto-merge`?`Enabling...`:at.isArmed(`enable-auto-merge`)?`Confirm auto-merge?`:lr,children:[at.isArmed(`enable-auto-merge`)?(0,$.jsx)(me,{"aria-hidden":!0,className:`size-3.5`}):(0,$.jsx)(Mr.merged,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(xc,{className:`@max-[30rem]/pr-header:hidden`,children:(0,$.jsxs)(`span`,{className:`grid`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`invisible col-start-1 row-start-1`,children:lr}),(0,$.jsx)(`span`,{className:`col-start-1 row-start-1`,children:dn===`enable-auto-merge`?`Enabling...`:at.isArmed(`enable-auto-merge`)?`Confirm auto-merge?`:lr})]})})]})})}),(0,$.jsx)(Y,{side:`top`,children:dn===`enable-auto-merge`?`Enabling...`:at.isArmed(`enable-auto-merge`)?`Confirm auto-merge?`:lr})]}):Pr===`auto-merge-armed`?(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsxs)(te,{size:`control`,variant:`info`,role:`img`,"aria-label":gr,children:[(0,$.jsx)(Mr.merged,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`@max-[30rem]/pr-header:hidden`,children:gr})]})}),(0,$.jsxs)(Y,{side:`top`,children:[gr,`: the host will merge this on its own once its requirements are met`]})]}):Pr===`merge`?(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(`span`,{className:`inline-flex shrink-0`,children:(0,$.jsxs)(G,{size:`xs`,variant:`default`,disabled:pn,...at.props(`merge`,()=>void Fn(`merge`,sr)),"aria-label":dn===`merge`?`Merging...`:at.isArmed(`merge`)?`Confirm merge?`:cr,children:[at.isArmed(`merge`)?(0,$.jsx)(me,{"aria-hidden":!0,className:`size-3.5`}):(0,$.jsx)(Mr.merged,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(xc,{className:`@max-[30rem]/pr-header:hidden`,children:(0,$.jsxs)(`span`,{className:`grid`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`invisible col-start-1 row-start-1`,children:cr}),(0,$.jsx)(`span`,{className:`col-start-1 row-start-1`,children:dn===`merge`?`Merging...`:at.isArmed(`merge`)?`Confirm merge?`:cr})]})})]})})}),(0,$.jsx)(Y,{side:`top`,children:dn===`merge`?`Merging...`:at.isArmed(`merge`)?`Confirm merge?`:cr})]}):(Pr===`merged`||Pr===`closed`)&&Wr!==null?(0,$.jsx)(te,{size:`control`,variant:`outline`,children:(0,$.jsxs)(`span`,{className:K(`flex items-center gap-1`,Wr.toneClassName),children:[(0,$.jsx)(Wr.Icon,{className:`size-3.5`}),Wr.label]})}):null,fi,(0,$.jsxs)(y,{children:[(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(Ce,{render:(0,$.jsx)(G,{"aria-label":on?`Refreshing pull request`:`More pull request actions`,size:`icon-xs`,variant:`ghost-muted`}),children:on?(0,$.jsx)(_a,{refreshing:!0,size:`md`}):(0,$.jsx)(Me,{className:`size-4`})})}),(0,$.jsx)(Y,{children:on?`Refreshing pull request`:`More pull request actions`})]}),(0,$.jsxs)(oe,{align:`end`,side:`bottom`,children:[(0,$.jsx)(Jc,{display:`menu-item`,environmentId:e,reference:M,url:q.url,threadRef:o??(typeof _==`object`?_:null),onPickerOpenChange:R}),(0,$.jsxs)(W,{disabled:on,onClick:()=>void sn(),children:[(0,$.jsx)(_a,{size:`sm`,refreshing:on}),`Refresh`]}),(0,$.jsxs)(W,{disabled:ot!==null,onClick:Yn,children:[(0,$.jsx)(r,{className:`mt-1 size-3.5 shrink-0 self-start`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{children:ot===`ask`?`Opening...`:`Ask a question`}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:zn===null?`Opens a thread that knows which pull request you mean.`:`Adds the pull request to this thread's composer.`})]})]}),(0,$.jsxs)(W,{disabled:ot!==null,onClick:Xn,children:[(0,$.jsx)(De,{className:`mt-1 size-3.5 shrink-0 self-start`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{children:ot===`explain`?`Opening...`:`Explain this PR`}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`A walk through the diff and what to read closely.`})]})]}),(0,$.jsxs)(W,{disabled:ot!==null||!Vn,onClick:tr,children:[(0,$.jsx)(p,{className:`size-3.5`}),ot===`findings`?`Preparing...`:Hn.fixFindings]}),xr&&Un.canWrite?(0,$.jsxs)(W,{disabled:Un.running,onClick:Wn,children:[(0,$.jsx)(le,{className:`size-3.5`}),Un.running?`Writing guide...`:Un.data?.guide==null?`Write guide`:`Rewrite guide`]}):null,wn.length>0?(0,$.jsx)(Dd,{environments:wn,value:An,onChange:e=>Dn({pullRequestKey:N,environmentId:e}),disabled:ot!==null}):null,(0,$.jsx)(je,{}),q.state===`open`?(0,$.jsxs)($.Fragment,{children:[Lr?(0,$.jsxs)(W,{disabled:pn,onClick:()=>void Fn(q.isDraft?`ready`:`draft`),children:[q.isDraft?(0,$.jsx)(Mr.pullRequest,{className:`size-3.5`}):(0,$.jsx)(Mr.draft,{className:`size-3.5`}),q.isDraft?`Ready for review`:`Convert to draft`]}):null,Hr?(0,$.jsxs)(W,{closeOnClick:at.isArmed(`merge`),"aria-label":at.isArmed(`merge`)?`Confirm merge?`:`Merge now`,disabled:pn,...at.props(`merge`,()=>void Fn(`merge`,sr)),children:[(0,$.jsx)(Mr.merged,{className:`size-3.5`}),at.isArmed(`merge`)?`Confirm merge?`:`Merge now`]}):null,dr&&Tr(`disable-auto-merge`)?(0,$.jsxs)(W,{disabled:pn,onClick:()=>void Fn(`disable-auto-merge`),children:[(0,$.jsx)(Mr.merged,{className:`size-3.5`}),`Disable auto-merge`]}):Vr?(0,$.jsxs)(W,{closeOnClick:at.isArmed(`enable-auto-merge`),"aria-label":at.isArmed(`enable-auto-merge`)?`Confirm auto-merge?`:`Enable auto-merge`,disabled:pn,...at.props(`enable-auto-merge`,()=>void Fn(`enable-auto-merge`,sr)),children:[(0,$.jsx)(Mr.merged,{className:`size-3.5`}),at.isArmed(`enable-auto-merge`)?`Confirm auto-merge?`:`Enable auto-merge`]}):null,Ur?(0,$.jsxs)($.Fragment,{children:[Lr||Hr||Vr?(0,$.jsx)(je,{}):null,(0,$.jsx)(I,{value:sr,onValueChange:e=>{let t=e;it(t),$e(t)},children:ar.map(e=>(0,$.jsx)(i,{value:e,disabled:pn,closeOnClick:!0,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(Mr.merged,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:Oi[e]})]})},e))})]}):null,Kr(Lr,Vr||Hr,Ur)?(0,$.jsx)(je,{}):null]}):null,(0,$.jsxs)(W,{onClick:()=>void bt()?.shell.openExternal(q.url),children:[(0,$.jsx)(a,{className:`size-3.5`}),bl(Rt)]}),(0,$.jsxs)(W,{onClick:()=>Ft(q.url,`PR link`),children:[(0,$.jsx)(L,{className:`size-3.5`}),`Copy link`,(0,$.jsx)(Se,{children:ir(Pt,`thread.copyReference`)})]}),(0,$.jsxs)(W,{onClick:()=>Ft(`#${M.number}`,`PR number`),children:[(0,$.jsx)(He,{className:`size-3.5`}),`Copy PR number`,(0,$.jsx)(Se,{children:ir(Pt,`pullRequest.copyNumber`)})]}),q.state===`open`&&Tr(`close`)?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(je,{}),(0,$.jsxs)(W,{closeOnClick:at.isArmed(`close`),"aria-label":at.isArmed(`close`)?`Confirm close?`:`Close pull request`,variant:`destructive`,disabled:pn,...at.props(`close`,()=>void Fn(`close`)),children:[(0,$.jsx)(Mr.closed,{className:`size-3.5`}),at.isArmed(`close`)?`Confirm close?`:`Close pull request`]})]}):q.state===`closed`&&Tr(`reopen`)?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(je,{}),(0,$.jsxs)(W,{disabled:pn,onClick:()=>void Fn(`reopen`),children:[(0,$.jsx)(Mr.reopen,{className:`size-3.5`}),`Reopen pull request`]})]}):q.state===`merged`&&Tr(`revert`)?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(je,{}),(0,$.jsxs)(W,{closeOnClick:at.isArmed(`revert`),"aria-label":at.isArmed(`revert`)?`Confirm revert?`:`Revert changes`,variant:at.isArmed(`revert`)?`destructive`:`default`,disabled:pn,...at.props(`revert`,()=>void Fn(`revert`)),children:[(0,$.jsx)(ee,{className:`size-3.5`}),at.isArmed(`revert`)?`Confirm revert?`:`Revert changes`]})]}):null,Gr?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(je,{}),(0,$.jsxs)(W,{variant:`destructive`,disabled:pn||!Jr,onClick:()=>void Yr(),children:[(0,$.jsx)(l,{className:`mt-1 size-3.5 shrink-0 self-start`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{children:dn===`delete-branch`?`Deleting branch...`:`Delete branch`}),(0,$.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:Jr?q.headBranch:`Reconnect to delete this branch`})]})]})]}):null]})]})]}):null,h?(0,$.jsx)(G,{size:`icon-xs`,variant:`ghost`,"aria-label":`Collapse pull request panel`,onClick:h,children:(0,$.jsx)(z,{className:`size-3.5`})}):null]}),(0,$.jsx)(`div`,{className:K(`col-span-2 grid`,Re?`grid-rows-[1fr]`:`grid-rows-[0fr] transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none`),children:(0,$.jsx)(`div`,{ref:Ke,className:K(`min-h-0 overflow-hidden transition-[opacity,transform] duration-150 ease-out motion-reduce:transform-none motion-reduce:transition-none`,Re?`translate-y-0 opacity-100 delay-50`:`translate-y-1 opacity-0 duration-100`),inert:!Re,children:q?(0,$.jsx)(`div`,{className:`col-span-2 min-w-0 px-4 pb-2 pt-1`,children:(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 shrink items-center gap-1.5 overflow-hidden text-xs text-muted-foreground`,children:[(0,$.jsx)(wr,{actor:q.author,profileUrl:Bt,variant:`avatar`,className:`shrink-0`}),(0,$.jsx)(`span`,{className:`shrink-0`,children:Cn(q.updatedAt)})]}),(0,$.jsx)(`span`,{"aria-hidden":!0,className:`h-3 w-px shrink-0 bg-border/70`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1.5 font-mono text-2xs text-muted-foreground/65`,children:[yr?(0,$.jsxs)(kd,{baseBranch:q.baseBranch,freshness:yr,pending:pn,onUpdate:e=>void Fn(`update-branch`,void 0,e),iconClassName:`size-3`,className:`max-w-[40%]`,children:[Wt?(0,$.jsx)(Mr.stack,{"aria-label":`Stacked pull request`,className:`size-3 shrink-0`}):null,(0,$.jsx)(`code`,{className:`flex min-w-0`,children:(0,$.jsx)(fa,{value:q.baseBranch,showTitle:!1})})]}):(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-[40%] shrink-0 items-center gap-1`,children:[Wt?(0,$.jsx)(Mr.stack,{"aria-label":`Stacked pull request`,className:`size-3 shrink-0`}):null,(0,$.jsx)(`code`,{className:`flex min-w-0`,children:(0,$.jsx)(fa,{value:q.baseBranch,showTitle:!1})})]})}),(0,$.jsx)(Y,{side:`top`,children:Wt?`Stacked on ${q.baseBranch}`:q.baseBranch})]}),(0,$.jsx)(j,{"aria-label":`receives changes from`,className:`size-3 shrink-0 opacity-60`}),(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(`code`,{className:`flex min-w-0 flex-1`,children:(0,$.jsx)(fa,{value:q.headBranch,showTitle:!1})})}),(0,$.jsx)(Y,{side:`top`,children:q.headBranch})]})]}),(0,$.jsxs)(`span`,{className:`ml-auto inline-flex shrink-0 items-center justify-end gap-2 text-2xs`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 tabular-nums`,"aria-label":`${q.changedFiles.toLocaleString()} changed ${q.changedFiles===1?`file`:`files`}`,children:[(0,$.jsx)(ne,{"aria-hidden":!0,className:`size-3`}),q.changedFiles.toLocaleString()]}),(0,$.jsx)(Sr,{additions:q.additions,deletions:q.deletions,className:`shrink-0 font-mono text-2xs`})]})]})}):null})}),(0,$.jsx)(`div`,{className:K(`col-span-2 grid`,Re?`grid-rows-[0fr]`:`grid-rows-[1fr] transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none`),children:(0,$.jsx)(`div`,{ref:Ge,className:K(`min-h-0 overflow-hidden transition-[opacity,transform] duration-150 ease-out motion-reduce:transform-none motion-reduce:transition-none`,Re?`-translate-y-1 opacity-0 duration-100`:`translate-y-0 opacity-100 delay-50`),inert:Re,children:q?(0,$.jsx)($c,{title:_n===null?(0,$.jsxs)(el,{className:`group gap-1`,children:[(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(`h1`,{className:`min-w-0 flex-1 truncate text-base font-semibold leading-snug`,children:q.title})}),(0,$.jsx)(Y,{side:`top`,children:q.title})]}),ys(q)?(0,$.jsx)(Ss,{"aria-label":`Edit title`,onClick:()=>gn({pullRequestKey:N,text:q.title})}):null]}):(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(Ln,{autoFocus:!0,size:`sm`,disabled:vn,value:_n,"aria-label":`Pull request title`,onChange:e=>gn({pullRequestKey:N,text:e.target.value}),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),Rn(_n)):e.key===`Escape`&&(e.preventDefault(),gn(null))}}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(G,{size:`xs`,variant:`ghost`,disabled:vn,onClick:()=>gn(null),children:`Cancel`}),(0,$.jsx)(G,{size:`xs`,variant:`outline`,disabled:!ct||vn||_n.trim().length===0,onClick:()=>void Rn(_n),children:vn?`Saving...`:`Save`})]})]}),author:(0,$.jsx)(wr,{actor:q.author,profileUrl:Bt}),updated:(0,$.jsxs)(`span`,{children:[`updated `,Cn(q.updatedAt)]}),checkout:Vt?(0,$.jsx)(rl,{value:Vt,target:`pull request checkout command`,copyLabel:`Copy checkout command`,copiedLabel:`Checkout command copied`,className:`ml-auto font-mono`,tooltipSide:`bottom`,onError:Ht},Vt):null,base:yr?(0,$.jsxs)(kd,{baseBranch:q.baseBranch,freshness:yr,pending:pn,onUpdate:e=>void Fn(`update-branch`,void 0,e),className:`max-w-[40%]`,children:[Wt?(0,$.jsx)(Mr.stack,{"aria-label":`Stacked pull request`,className:`size-3 shrink-0`}):null,(0,$.jsx)(`code`,{className:`flex min-w-0`,children:(0,$.jsx)(fa,{value:q.baseBranch,showTitle:!1})})]}):(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-[40%] shrink-0 items-center gap-1`,children:[Wt?(0,$.jsx)(Mr.stack,{"aria-label":`Stacked pull request`,className:`size-3 shrink-0`}):null,(0,$.jsx)(`code`,{className:`flex min-w-0`,children:(0,$.jsx)(fa,{value:q.baseBranch,showTitle:!1})})]})}),(0,$.jsx)(Y,{side:`top`,children:Wt?`Stacked on ${q.baseBranch}`:q.baseBranch})]}),head:(0,$.jsx)(rl,{value:q.headBranch,target:`branch name`,copyLabel:`Copy pull request branch`,copiedLabel:`Branch name copied`},q.headBranch),files:`${q.changedFiles.toLocaleString()} ${q.changedFiles===1?`file`:`files`}`,diffStat:(0,$.jsx)(Sr,{additions:q.additions,deletions:q.deletions,className:`shrink-0 font-mono text-xs`})}):null})}),q?(0,$.jsx)(tl,{tabs:Cr,value:H,onValueChange:U,onTabIntent:e=>{e===`code`&&Cd()},children:H===`summary`?Qr?(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(`span`,{className:`ml-auto inline-flex shrink-0`,children:(0,$.jsxs)(G,{size:`xs`,variant:`warning-outline`,disabled:pn,...at.props(`approve-workflows`,()=>void Fn(`approve-workflows`)),"aria-label":dn===`approve-workflows`?`Approving...`:at.isArmed(`approve-workflows`)?`Confirm approve?`:`Approve workflows to run`,children:[(0,$.jsx)(_e,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsxs)(`span`,{className:`inline-grid`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`invisible col-start-1 row-start-1`,children:`Approve workflows to run`}),(0,$.jsx)(`span`,{"aria-hidden":!0,className:`invisible col-start-1 row-start-1`,children:`Confirm approve?`}),(0,$.jsx)(`span`,{className:`col-start-1 row-start-1`,children:dn===`approve-workflows`?`Approving...`:at.isArmed(`approve-workflows`)?`Confirm approve?`:`Approve workflows to run`})]})]})})}),(0,$.jsx)(Y,{side:`top`,children:dn===`approve-workflows`?`Approving...`:at.isArmed(`approve-workflows`)?`Confirm approve?`:`Approve workflows to run`})]}):(0,$.jsx)(nl,{className:`text-muted-foreground`,"aria-label":ri?`Checks: ${ri}`:`Checks`,icon:jr===null?(0,$.jsx)(f,{"aria-hidden":!0,className:`size-3.5`}):(0,$.jsx)(Mu,{checks:q.checks,stale:Nr,checksState:jr,threadRef:o}),label:ri}):H===`timeline`?(0,$.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsxs)(mr,{className:K(`whitespace-nowrap text-2xs transition-opacity`,(Yt||Xt)&&`opacity-35`),children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,"aria-label":Xt?`Comments unavailable`:`${q.commentCount.toLocaleString()} ${q.commentCount===1?`comment`:`comments`}`,children:[(0,$.jsx)(Ae,{"aria-hidden":!0,className:`size-3`}),Xt?`—`:Yt?`…`:q.commentCount.toLocaleString()]}),(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,"aria-label":Xt?`Commits unavailable`:`${q.commits.length.toLocaleString()} ${q.commits.length===1?`commit`:`commits`}`,children:[(0,$.jsx)(pe,{"aria-hidden":!0,className:`size-3`}),Xt?`—`:Yt?`…`:q.commits.length.toLocaleString()]}),di>0?(0,$.jsxs)(`span`,{className:K(`inline-flex items-center gap-1`,kr(`approved`)),children:[(0,$.jsx)(hr,{outcome:`approved`,className:`size-3`}),di.toLocaleString(),(0,$.jsx)(`span`,{className:`sr-only`,children:di===1?`approval`:`approvals`})]}):null]}),(0,$.jsxs)(G,{size:`xs`,variant:`ghost-muted`,"aria-label":ie===`newest`?`Show oldest activity first`:`Show newest activity first`,onClick:()=>ae(e=>e===`newest`?`oldest`:`newest`),children:[(0,$.jsx)(S,{"aria-hidden":!0,className:`size-3`}),ie===`newest`?`Newest first`:`Oldest first`]})]}):null}):null]}),(0,$.jsx)(`div`,{className:`relative flex min-h-0 flex-1 flex-col overflow-hidden`,onScrollCapture:e=>{let t=ze.current[H];if(e.target!==t||t==null)return;let n=t.scrollTop;Fe(e=>{let r=e,i=Ge.current?.scrollHeight??0,a=i-(Ke.current?.scrollHeight??0);return e?n<4&&i>0&&(r=!1):i>0&&n>i+32&&(Je.current={tab:H,scroller:t,delta:-a},r=!0),Le.current[H]=r,r})},children:lt.error&&!q?(0,$.jsx)(yl,{...oi(lt.failure)?{title:`Pull request #${M.number} not found`,error:`It may be an issue rather than a pull request, or this account can't see it.`}:{error:lt.error},refreshing:lt.isPending,onRetry:Zt,...Sn?{gitHubUrl:Sn}:{}}):q?(0,$.jsxs)(Us,{value:zt,children:[Ne.has(`summary`)?(0,$.jsx)(`div`,{className:K(`absolute inset-0`,H!==`summary`&&`invisible`),children:(0,$.jsx)(ru,{scrollerRef:Ve.summary,environmentId:e,threadRef:o,reference:M,detail:q,activityPending:Yt,checksStale:Nr,activityError:Xt,pendingFinding:ot,fixFindingLabel:Hn.fixFinding,fixCheckLabel:Hn.fixCheck,...Vn?{onFixFinding:er}:{},onRefresh:Zt,onRefreshChecks:sn})}):null,Ne.has(`guide`)?(0,$.jsx)(`div`,{className:K(`absolute inset-0`,H!==`guide`&&`invisible`),children:(0,$.jsx)(hd,{environmentId:e,reference:M,active:H===`guide`,title:q.title,workspaceRoot:q.workspaceRoot,canComment:q.capabilities.review.inlineComment&&q.viewerPermissions.comment,onAskAboutLines:(e,t)=>Qn({comment:e,request:t},{keepGuide:!0}),onAskAboutStop:Zn,onFinishReview:q.capabilities.review.verdicts.some(e=>q.viewerPermissions.verdicts.includes(e))?()=>V(e=>e+1):null,onOpenFile:xe,onTourShown:C})}):null,Ne.has(`timeline`)?(0,$.jsx)(`div`,{className:K(`absolute inset-0`,H!==`timeline`&&`invisible`),children:Yt?(0,$.jsx)(ml,{}):Xt?(0,$.jsx)(vl,{error:Xt,onRetry:ut.refresh}):(0,$.jsx)(Eu,{scrollerRef:Ve.timeline,detail:q,environmentId:e,threadRef:o,reference:M,order:ie,onOpenCommit:ge,onRefresh:Zt})}):null,Ne.has(`code`)?(0,$.jsx)(`div`,{className:K(`absolute inset-0`,H!==`code`&&`invisible`),children:(0,$.jsx)(Z.Suspense,{fallback:(0,$.jsx)(Ao,{label:`Loading pull request diff...`}),children:(0,$.jsx)(wd,{scrollerRef:Ve.code,onAddToAgentSelection:Qn,environmentId:e,reference:M,detail:q,selectedCommitOid:de,onSelectedCommitChange:he,pendingFinding:ot,fixFindingLabel:Hn.fixFinding,...Vn?{onFixFinding:er}:{},onRefresh:Zt,refreshToken:en,revealRequest:ve})})}):null]}):null}),q?(0,$.jsx)(`div`,{className:`absolute right-4 bottom-3 z-20`,children:(0,$.jsx)(jl,{environmentId:e,reference:M,detail:q,actionPending:pn,onCommentAction:In,onCommented:Zt,onReviewSubmitted:Zt,openReviewRequest:B},JSON.stringify([e,M.projectId,M.host,M.repository,M.number]))}):null]})}function jd(e){let t=(0,Q.c)(36),{entry:n,hostActions:r,visible:i,onActed:a,closing:o,sweeping:s,onCloseSweepStart:c}=e,l=o!==void 0&&o,u=s!==void 0&&s,d;t[0]===n.environmentId?d=t[1]:(d=zr.runAction.permissionAtom(n.environmentId),t[0]=n.environmentId,t[1]=d);let f=re(d),p=Sa(n.environmentId,n.projectId),m;t[2]!==n.host||t[3]!==n.number||t[4]!==n.projectId||t[5]!==n.repository?(m={projectId:n.projectId,host:n.host,repository:n.repository,number:n.number},t[2]=n.host,t[3]=n.number,t[4]=n.projectId,t[5]=n.repository,t[6]=m):m=t[6];let h=m,g;t[7]!==n||t[8]!==a?(g=e=>a?.({entry:n,action:e}),t[7]=n,t[8]=a,t[9]=g):g=t[9];let _;t[10]===p?_=t[11]:(_=e=>{let t=e.capabilities.mergeMethods.filter(t=>e.mergeCapabilities[t]);if(t.length===0)throw Error(`No merge method is available for this repository.`);return li(t,null,p(),Gi.getState().pullRequestMergeMethod)},t[10]=p,t[11]=_);let v;t[12]!==n.environmentId||t[13]!==h||t[14]!==g||t[15]!==_?(v={environmentId:n.environmentId,reference:h,onSuccess:g,resolveMergeMethod:_},t[12]=n.environmentId,t[13]=h,t[14]=g,t[15]=_,t[16]=v):v=t[16];let{actionPending:y,perform:b}=wa(v),x,S;if(t[17]!==y||t[18]!==f||t[19]!==l||t[20]!==n||t[21]!==r||t[22]!==c||t[23]!==b||t[24]!==u||t[25]!==i){S=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Lr(n,r),a=y||l||u;if(e.length===0){S=null;break bb0}let o=i||a?`flex`:`none`,s;t[28]===o?s=t[29]:(s={display:o},t[28]=o,t[29]=s);let d;t[30]!==a||t[31]!==f||t[32]!==n||t[33]!==c||t[34]!==b?(d=e=>{let t=Md[e].label,r=Md[e].Icon;return(0,$.jsxs)(X,{children:[(0,$.jsxs)(J,{render:(0,$.jsx)(G,{variant:e===`close`?`destructive-outline`:`outline`,size:`xs`,disabled:!f||a||e===`merge`&&n.stack!==void 0,"aria-label":`${t} #${n.number}`,onClick:()=>void b(e),onPointerDown:t=>{e===`close`&&t.isPrimary&&t.button===0&&(t.stopPropagation(),c?.(n,t.nativeEvent))}}),children:[a?(0,$.jsx)(ht,{size:`xs`}):(0,$.jsx)(r,{"aria-hidden":!0,className:`size-3`}),t]}),(0,$.jsx)(Y,{children:e===`merge`&&n.stack?`Open this pull request to merge its stack`:e===`close`&&c?`Close immediately, or drag across rows to close several`:`${t} immediately`})]},e)},t[30]=a,t[31]=f,t[32]=n,t[33]=c,t[34]=b,t[35]=d):d=t[35],x=(0,$.jsx)(`div`,{className:`shrink-0 items-center gap-1 pr-3`,style:s,role:`group`,"aria-label":`Quick actions for pull request #${n.number}`,"data-pull-request-action-pending":y||l,children:e.map(d)})}t[17]=y,t[18]=f,t[19]=l,t[20]=n,t[21]=r,t[22]=c,t[23]=b,t[24]=u,t[25]=i,t[26]=x,t[27]=S}else x=t[26],S=t[27];return S===Symbol.for(`react.early_return_sentinel`)?x:S}var Md={close:{label:`Close`,Icon:Mr.closed},merge:{label:`Merge`,Icon:Mr.merged},ready:{label:`Ready for review`,Icon:Mr.pullRequest},reopen:{label:`Reopen`,Icon:Mr.reopen}},Nd=`group/pr-row flex w-full items-center gap-2 rounded-md py-1 pr-1 text-left`,Pd=`shrink-0 font-mono text-xs tabular-nums text-muted-foreground`;function Fd(e){let t=(0,Q.c)(23),{state:n,isDraft:r,mergeability:i,baseBranch:a,below:o,className:s}=e,c;t[0]===s?c=t[1]:(c=K(`flex w-4 shrink-0 flex-col items-center gap-0.5`,s),t[0]=s,t[1]=c);let l;t[2]!==r||t[3]!==n?(l=(0,$.jsx)(gr,{state:n,isDraft:r}),t[2]=r,t[3]=n,t[4]=l):l=t[4];let u;t[5]===i?u=t[6]:(u=i===void 0?{}:{mergeability:i},t[5]=i,t[6]=u);let d;t[7]===a?d=t[8]:(d=a===void 0?{}:{baseBranch:a},t[7]=a,t[8]=d);let f;t[9]!==r||t[10]!==n||t[11]!==u||t[12]!==d?(f=(0,$.jsx)(`span`,{className:`absolute -right-1 -bottom-1 inline-flex`,children:(0,$.jsx)(fr,{state:n,isDraft:r,...u,...d,className:`size-3 fill-background [stroke-width:2.5]`})}),t[9]=r,t[10]=n,t[11]=u,t[12]=d,t[13]=f):f=t[13];let p;t[14]!==l||t[15]!==f?(p=(0,$.jsxs)(`span`,{className:`relative inline-flex`,children:[l,f]}),t[14]=l,t[15]=f,t[16]=p):p=t[16];let m;t[17]===o?m=t[18]:(m=o?(0,$.jsx)(`span`,{className:`inline-flex text-2xs`,children:o}):null,t[17]=o,t[18]=m);let h;return t[19]!==c||t[20]!==p||t[21]!==m?(h=(0,$.jsxs)(`span`,{className:c,children:[p,m]}),t[19]=c,t[20]=p,t[21]=m,t[22]=h):h=t[22],h}function Id(e){let t=(0,Q.c)(22),{number:n,title:r,status:i,signals:a,meta:o,metaClassName:s,updatedAt:c}=e,l;t[0]===r?l=t[1]:(l=(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm`,children:r}),t[0]=r,t[1]=l);let u;t[2]===a?u=t[3]:(u=a?(0,$.jsx)(`span`,{className:`flex shrink-0 items-center gap-1 text-2xs`,children:a}):null,t[2]=a,t[3]=u);let d;t[4]===i?d=t[5]:(d=i?(0,$.jsx)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5 text-2xs`,children:i}):null,t[4]=i,t[5]=d);let f;t[6]!==n||t[7]!==l||t[8]!==u||t[9]!==d?(f=(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[n,l,u,d]}),t[6]=n,t[7]=l,t[8]=u,t[9]=d,t[10]=f):f=t[10];let p;t[11]===s?p=t[12]:(p=K(`flex min-w-0 items-center gap-1.5 overflow-hidden text-2xs text-muted-foreground`,s),t[11]=s,t[12]=p);let m;t[13]===c?m=t[14]:(m=c?(0,$.jsx)(`span`,{className:`ml-auto shrink-0 whitespace-nowrap tabular-nums`,children:Cn(c)}):null,t[13]=c,t[14]=m);let h;t[15]!==o||t[16]!==p||t[17]!==m?(h=(0,$.jsxs)(`span`,{className:p,children:[o,m]}),t[15]=o,t[16]=p,t[17]=m,t[18]=h):h=t[18];let g;return t[19]!==f||t[20]!==h?(g=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[f,h]}),t[19]=f,t[20]=h,t[21]=g):g=t[21],g}function Ld(e){let t=(0,Q.c)(20),{actor:n,className:r,labelClassName:i}=e,a=n?.login??`ghost`,o;t[0]===r?o=t[1]:(o=K(`inline-flex min-w-0 items-center gap-1`,r),t[0]=r,t[1]=o);let s;t[2]===o?s=t[3]:(s=(0,$.jsx)(`span`,{className:o}),t[2]=o,t[3]=s);let c;t[4]===n?c=t[5]:(c=(0,$.jsx)(xr,{actor:n,className:`size-3.5`}),t[4]=n,t[5]=c);let l;t[6]===i?l=t[7]:(l=K(`truncate`,i),t[6]=i,t[7]=l);let u;t[8]!==a||t[9]!==l?(u=(0,$.jsx)(`span`,{className:l,children:a}),t[8]=a,t[9]=l,t[10]=u):u=t[10];let d;t[11]!==s||t[12]!==c||t[13]!==u?(d=(0,$.jsxs)(J,{render:s,children:[c,u]}),t[11]=s,t[12]=c,t[13]=u,t[14]=d):d=t[14];let f=n?.name&&n.name!==a?`${n.name} (@${a})`:a,p;t[15]===f?p=t[16]:(p=(0,$.jsx)(Y,{side:`top`,children:f}),t[15]=f,t[16]=p);let m;return t[17]!==d||t[18]!==p?(m=(0,$.jsxs)(X,{children:[d,p]}),t[17]=d,t[18]=p,t[19]=m):m=t[19],m}function Rd(e){let t=(0,Q.c)(8),{head:n,base:r}=e,i;t[0]===n?i=t[1]:(i=(0,$.jsx)(fa,{value:n}),t[0]=n,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(`span`,{className:`shrink-0`,children:`→`}),t[2]=a):a=t[2];let o;t[3]===r?o=t[4]:(o=(0,$.jsx)(fa,{value:r,className:`max-w-[45%] shrink-0`}),t[3]=r,t[4]=o);let s;return t[5]!==i||t[6]!==o?(s=(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 font-mono`,children:[i,a,o]}),t[5]=i,t[6]=o,t[7]=s):s=t[7],s}var zd=[`[data-slot="dialog-popup"]`,`[data-slot="alert-dialog-popup"]`,`[data-slot="command-dialog-popup"]`,`[data-slot="menu-popup"]`,`[data-slot="select-popup"]`,`[data-slot="popover-popup"]`,`[data-slot="combobox-popup"]`,`[data-slot="autocomplete-popup"]`].join(`,`),Bd={browser:`Only available in the desktop app.`,terminal:`Available when a project is open.`,files:`Available when a project is open.`,diff:`Available for Git repositories.`,pullRequest:`No pull request on this branch yet.`,pullRequests:`No linked pull requests available.`,device:`Available from a thread.`},Vd=1,Hd=[pa,da];function Ud(e){return e?.querySelector(`[data-slot="scroll-area-viewport"]`)??null}function Wd(e,t){return e.kind!==`preview`||!e.resourceId?null:t[e.resourceId]?.tabId??null}function Gd(e){return{label:e.overlay?.audioMuted??!1?`Unmute tab`:`Mute tab`,disabled:e.overlay===null||!e.canResolveRuntimeTabId}}function Kd(e){return e?.audible?e.audioMuted?`muted`:`audible`:`none`}function qd(e,t){return t.defaultPrevented||t.isComposing||t.metaKey||t.ctrlKey||t.altKey?null:e.find(e=>e.available&&e.shortcut.toLowerCase()===t.key.toLowerCase())??null}function Jd(e){return e?.closest(`input, textarea, select, [contenteditable]:not([contenteditable="false"])`)!=null}function Yd(e){let t=(0,Q.c)(7),n;t[0]===e.trigger?n=t[1]:(n=(0,$.jsx)(J,{render:e.trigger}),t[0]=e.trigger,t[1]=n);let r;t[2]===e.reason?r=t[3]:(r=(0,$.jsx)(Y,{side:`top`,children:e.reason}),t[2]=e.reason,t[3]=r);let i;return t[4]!==n||t[5]!==r?(i=(0,$.jsxs)(X,{children:[n,r]}),t[4]=n,t[5]=r,t[6]=i):i=t[6],i}function Xd(e){let t=(0,Q.c)(14),[n,r]=(0,Z.useState)(-1),i=[{label:`Browser`,icon:c,shortcut:`B`,available:e.browserAvailable,disabledReason:Bd.browser,onClick:e.onAddBrowser},{label:`Terminal`,icon:Fe,shortcut:`T`,available:e.terminalAvailable,disabledReason:Bd.terminal,onClick:e.onAddTerminal},{label:`Files`,icon:xe,shortcut:`F`,available:e.filesAvailable,disabledReason:Bd.files,onClick:e.onAddFiles},...e.onAddDesign?[{label:`Design`,icon:Ve,shortcut:`G`,available:e.filesAvailable,disabledReason:`Open a project to use Design.`,onClick:e.onAddDesign}]:[],{label:`Diff`,icon:ne,shortcut:`D`,available:e.diffAvailable,disabledReason:Bd.diff,onClick:e.onAddDiff},{label:`Pull request`,icon:Mr.pullRequest,shortcut:`P`,available:e.pullRequestAvailable,disabledReason:Bd.pullRequest,onClick:e.onAddPullRequest},{label:`Linked pull requests`,icon:Mr.link,shortcut:`L`,available:e.pullRequestsAvailable,disabledReason:Bd.pullRequests,onClick:e.onAddPullRequests},{label:`Device`,description:`Watch an iOS Simulator or Android Emulator.`,icon:Oe,shortcut:`M`,available:e.deviceAvailable,disabledReason:Bd.device,onClick:e.onAddDevice}],a=i.filter(ef),o=a.length===0?-1:Math.min(n,a.length-1),s=(0,Z.useRef)(a);(0,Z.useEffect)(()=>{s.current=a});let l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=[],t[0]=l):l=t[0],(0,Z.useEffect)(()=>{let e=e=>{let t=qd(s.current,e);if(!t||document.querySelector(zd))return;let n=e.composedPath()[0]??e.target;n instanceof Element&&Jd(n)||(e.preventDefault(),e.stopPropagation(),t.onClick())};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},l);let u=e=>{if(!(e.defaultPrevented||e.metaKey||e.ctrlKey||e.altKey)&&a.length!==0){if(e.key===`ArrowDown`||e.key===`ArrowRight`){e.preventDefault(),r((o+1)%a.length);return}if(e.key===`ArrowUp`||e.key===`ArrowLeft`){e.preventDefault(),r(o===-1?a.length-1:(o-1+a.length)%a.length);return}if(e.key===`Enter`){if(e.target!==e.currentTarget)return;let t=a[o];if(!t)return;e.preventDefault(),t.onClick()}}},d=$d,f=e=>o!==-1&&a[o]===e,p=Qd,m;t[1]===a?m=t[2]:(m=a.map(Zd),t[1]=a,t[2]=m);let h=m.join(``),g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(`h3`,{className:`mb-3 font-medium text-foreground text-sm`,children:`Tools`}),t[3]=g):g=t[3];let _=i.map(t=>t.available?(0,$.jsxs)(`div`,{className:`group relative`,onMouseEnter:()=>r(a.indexOf(t)),onMouseLeave:()=>r(e=>e===a.indexOf(t)?-1:e),children:[(0,$.jsxs)(`button`,{type:`button`,onClick:t.onClick,className:K(`flex h-10 w-full cursor-pointer items-center gap-3 rounded-lg bg-card px-3.5 text-left text-sm transition-colors group-hover:bg-card/60`,f(t)&&`bg-card/60`),children:[p(t,`size-4`),(0,$.jsx)(`span`,{className:K(`min-w-0 flex-1 truncate`,t.label===`Browser`&&e.browserProfiles.length>1&&`pr-8`),children:t.label}),(0,$.jsx)(aa,{variant:`pill`,children:t.shortcut})]}),t.label===`Browser`&&e.browserProfiles.length>1?(0,$.jsxs)(y,{children:[(0,$.jsx)(Ce,{render:(0,$.jsx)(G,{"aria-label":`Open browser in a profile`,className:`absolute top-1/2 right-10 -translate-y-1/2`,size:`icon-xs`,variant:`ghost-muted`}),children:(0,$.jsx)(fe,{className:`size-3.5`})}),(0,$.jsx)(oe,{align:`end`,side:`bottom`,sideOffset:6,className:`max-w-56`,children:e.browserProfiles.map(t=>(0,$.jsx)(W,{onClick:()=>e.onAddBrowserInProfile(t.id),children:(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:t.name})},t.id))})]}):null]},t.label):(0,$.jsx)(Yd,{reason:t.disabledReason,trigger:(0,$.jsxs)(`div`,{tabIndex:0,"aria-disabled":`true`,className:`flex h-10 w-full cursor-default items-center gap-3 rounded-lg bg-card px-3.5 text-left text-sm opacity-50`,children:[p(t,`size-4`),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.label}),(0,$.jsx)(aa,{variant:`pill`,children:t.shortcut})]})},t.label)),v;t[4]===_?v=t[5]:(v=(0,$.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(14rem,1fr))] gap-x-3 gap-y-2`,children:_}),t[4]=_,t[5]=v);let b;t[6]!==v||t[7]!==g?(b=(0,$.jsxs)(`div`,{className:`w-full max-w-3xl`,children:[g,v]}),t[6]=v,t[7]=g,t[8]=b):b=t[8];let x;return t[9]!==d||t[10]!==u||t[11]!==b||t[12]!==h?(x=(0,$.jsx)(`div`,{ref:d,tabIndex:0,onKeyDown:u,"aria-label":`Open a surface`,"data-surface-launcher-keys":h,className:`scrollbar-gutter-both flex min-h-0 flex-1 flex-col overflow-y-auto bg-muted px-5 py-6 outline-none`,children:b}),t[9]=d,t[10]=u,t[11]=b,t[12]=h,t[13]=x):x=t[13],x}function Zd(e){return e.shortcut}function Qd(e,t){let n=t===void 0?`size-4`:t,r=e.icon;return(0,$.jsx)(`span`,{className:`relative inline-flex shrink-0 text-muted-foreground`,children:(0,$.jsx)(r,{className:n})})}function $d(e){e?.focus()}function ef(e){return e.available}function tf(e,t,n){switch(e.kind){case`diff`:return`Diff`;case`design`:return`Design`;case`files`:return`Files`;case`file`:return e.relativePath.slice(Math.max(e.relativePath.lastIndexOf(`/`),e.relativePath.lastIndexOf(`\\`))+1);case`terminal`:return n.get(e.activeTerminalId)??Li(e.activeTerminalId);case`pull-request`:return`#${e.number}`;case`pull-requests`:return`Pull requests`;case`device`:return e.title??e.target?.name??`Device`;case`preview`:{let n=e.resourceId?t[e.resourceId]:null;if(!n||n.navStatus._tag===`Idle`)return`New tab`;if(n.navStatus.title.trim().length>0)return n.navStatus.title;try{return new URL(n.navStatus.url).host||`Browser`}catch{return`Browser`}}}}function nf(e){let t=(0,Q.c)(8),{capturedUrl:n,url:r}=e,i;t[0]===r?i=t[1]:(i=ct(r,32),t[0]=r,t[1]=i);let a=i,o;t[2]!==n||t[3]!==a?(o=[n,a],t[2]=n,t[3]=a,t[4]=o):o=t[4];let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(c,{className:`size-3 shrink-0`}),t[5]=s):s=t[5];let l;return t[6]===o?l=t[7]:(l=(0,$.jsx)(ps,{sources:o,fallback:s,className:`size-3 shrink-0 rounded-sm object-contain`}),t[6]=o,t[7]=l),l}function rf(e,t){try{return new URL(e).origin===new URL(t).origin}catch{return!1}}function af(e){let t=(0,Q.c)(17),{surface:n,sessions:r,desktopByTabId:i,theme:a,environmentId:o,pullRequestStatusSeeds:s}=e;switch(n.kind){case`preview`:{let e=n.resourceId?r[n.resourceId]:null,a=!e||e.navStatus._tag===`Idle`?null:e.navStatus.url,o=e?i[e.tabId]?.favicon??null:null,s=o&&a&&rf(o.pageUrl,a)?o.dataUrl:null,c;return t[0]!==s||t[1]!==a?(c=(0,$.jsx)(nf,{capturedUrl:s,url:a}),t[0]=s,t[1]=a,t[2]=c):c=t[2],c}case`diff`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ne,{className:`size-3 shrink-0`}),t[3]=e):e=t[3],e}case`design`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ve,{className:`size-3 shrink-0`}),t[4]=e):e=t[4],e}case`files`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(xe,{className:`size-3 shrink-0`}),t[5]=e):e=t[5],e}case`file`:{let e;return t[6]!==n.relativePath||t[7]!==a?(e=(0,$.jsx)(sr,{pathValue:n.relativePath,kind:`file`,theme:a,className:`size-3`}),t[6]=n.relativePath,t[7]=a,t[8]=e):e=t[8],e}case`terminal`:{let e;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Fe,{className:`size-3 shrink-0`}),t[9]=e):e=t[9],e}case`pull-request`:{let e=s?.[n.id],r;return t[10]!==o||t[11]!==n||t[12]!==e?(r=(0,$.jsx)(sf,{surface:n,environmentId:o,seed:e}),t[10]=o,t[11]=n,t[12]=e,t[13]=r):r=t[13],r}case`pull-requests`:{let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Mr.link,{className:`size-3 shrink-0`}),t[14]=e):e=t[14],e}case`device`:{let e;return t[15]===n.target?.platform?e=t[16]:(e=n.target?.platform===`ios`?(0,$.jsx)(ar,{className:`size-3 shrink-0`}):n.target?.platform===`android`?(0,$.jsx)(or,{className:`size-3 shrink-0`}):(0,$.jsx)(Oe,{className:`size-3 shrink-0`}),t[15]=n.target?.platform,t[16]=e),e}}}function of(e,t,n,r){if(t===null||n===null)return;let i;for(let a of e)if(a.environmentId===t)for(let e of $e(a.pullRequests))Ze(e,{host:n,repository:r.repository,number:r.number})&&(i===void 0||(e.snapshot?.syncedAt??``)>(i.snapshot?.syncedAt??``))&&(i=e);return i}function sf(e){let t=(0,Q.c)(11),{surface:n,environmentId:r,seed:i}=e,a=n.environmentId??r,o=We(),s=Ke(),c;t[0]!==a||t[1]!==n.projectId?(c=e=>e.environmentId===a&&e.id===n.projectId,t[0]=a,t[1]=n.projectId,t[2]=c):c=t[2];let l=o.find(c)?.repositoryIdentity,u=n.host??(l?.provider?T(l,l.provider):null),d=qe(),f=a===null?void 0:d.get(a)?.environment.capabilities,p=f?.threadPullRequests===!0?of(s,a,u,n)?.snapshot??null:null,m=Et(a===null||f?.pullRequests!==!0||p!==null?null:zr.detail({environmentId:a,input:{projectId:n.projectId,...f?.threadPullRequests===!0&&n.host!==void 0?{host:n.host}:{},repository:n.repository,number:n.number}})).data,h=n.projectId,g;t[3]!==n.number||t[4]!==n.repository||t[5]!==h?(g={projectId:h,repository:n.repository,number:n.number},t[3]=n.number,t[4]=n.repository,t[5]=h,t[6]=g):g=t[6];let _=Br(a,g,null),v=p??Rr(m,_)??i??null;if(v===null){let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Mr.pullRequest,{className:`size-3 shrink-0 text-muted-foreground`}),t[7]=e):e=t[7],e}let y=pr({state:v.state,isDraft:v.isDraft??m?.isDraft??i?.isDraft??!1}),b=y.Icon,x=K(`size-3 shrink-0`,y.toneClassName),S;return t[8]!==y||t[9]!==x?(S=(0,$.jsx)(b,{className:x}),t[8]=y,t[9]=x,t[10]=S):S=t[10],S}function cf(e){let t=(0,Q.c)(13),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={activationConstraint:{distance:6}},t[0]=n):n=t[0];let r=Ri(Vi(Bi,n)),i;t[1]===e.surfaces?i=t[2]:(i=e.surfaces.map(lf),t[1]=e.surfaces,t[2]=i);let a=i,{onMove:o,surfaces:s}=e,c;t[3]!==o||t[4]!==s?(c=e=>{let{active:t,over:n}=e;if(!n||t.id===n.id)return;let r=s.findIndex(e=>e.id===n.id);r>=0&&o?.(String(t.id),r)},t[3]=o,t[4]=s,t[5]=c):c=t[5];let l=c,u;t[6]!==e.children||t[7]!==a?(u=(0,$.jsx)(Hi,{items:a,strategy:Ui,children:e.children}),t[6]=e.children,t[7]=a,t[8]=u):u=t[8];let d;return t[9]!==l||t[10]!==r||t[11]!==u?(d=(0,$.jsx)(Ki,{sensors:r,collisionDetection:Wi,modifiers:Hd,onDragEnd:l,children:u}),t[9]=l,t[10]=r,t[11]=u,t[12]=d):d=t[12],d}function lf(e){return e.id}function uf(e){let t=(0,Q.c)(22),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({surfaceId:a,disabled:r,className:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]!==r||t[6]!==a?(o={id:a,disabled:r},t[5]=r,t[6]=a,t[7]=o):o=t[7];let{listeners:s,setNodeRef:c,transform:l,transition:u,isDragging:d}=zi(o),f;t[8]===l?f=t[9]:(f=qi.Translate.toString(l),t[8]=l,t[9]=f);let p;t[10]!==f||t[11]!==u?(p={transform:f,transition:u},t[10]=f,t[11]=u,t[12]=p):p=t[12];let m=d&&`relative z-10`,h;t[13]!==n||t[14]!==m?(h=K(n,m),t[13]=n,t[14]=m,t[15]=h):h=t[15];let g;return t[16]!==s||t[17]!==i||t[18]!==c||t[19]!==p||t[20]!==h?(g=(0,$.jsx)(`div`,{...i,...s,ref:c,style:p,className:h}),t[16]=s,t[17]=i,t[18]=c,t[19]=p,t[20]=h,t[21]=g):g=t[21],g}function df(e){let t=(0,Q.c)(101),n=wn&&e.mode===`inline`,r=nr().profiles,{resolvedTheme:i}=xt(),a=(0,Z.useRef)(null),[o,s]=(0,Z.useState)(null),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={hasOverflow:!1,canScrollLeft:!1,canScrollRight:!1},t[0]=c):c=t[0];let[l,u]=(0,Z.useState)(c),d=e.open!==!1&&e.surfaces.length>0,f;t[1]!==d||t[2]!==e?(f=t=>{if(!(t.defaultPrevented||t.isComposing)&&rr(t,e.keybindings,{context:{...e.getShortcutContext(),rightPanelOpen:!0}})===`rightPanel.new`&&!document.querySelector(zd)&&(!d||e.browserAvailable)&&(t.preventDefault(),t.stopPropagation(),!t.repeat)){if(!d){document.querySelector(`[data-surface-launcher-keys]`)?.focus();return}e.onAddBrowser()}},t[1]=d,t[2]=e,t[3]=f):f=t[3];let p=(0,Z.useEffectEvent)(f),m;t[4]!==p||t[5]!==e.open?(m=()=>{if(e.open!==!1)return document.addEventListener(`keydown`,p,!0),()=>document.removeEventListener(`keydown`,p,!0)},t[4]=p,t[5]=e.open,t[6]=m):m=t[6];let h;t[7]===e.open?h=t[8]:(h=[e.open],t[7]=e.open,t[8]=h),(0,Z.useEffect)(m,h);let g;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{let e=Ud(a.current);if(!e)return;let t=e.scrollWidth-e.clientWidth>Vd,n=t&&e.scrollLeft>Vd,r=t&&e.scrollLeft+e.clientWidth<e.scrollWidth-Vd;u(e=>e.hasOverflow===t&&e.canScrollLeft===n&&e.canScrollRight===r?e:{hasOverflow:t,canScrollLeft:n,canScrollRight:r})},t[9]=g):g=t[9];let _=g,v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{let t=Ud(a.current);if(!t)return;let n=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;t.scrollBy({left:e*Math.max(120,t.clientWidth*.75),behavior:n?`auto`:`smooth`})},t[10]=v):v=t[10];let y=v,b;t[11]===e?b=t[12]:(b=async(t,n)=>{t.preventDefault(),t.stopPropagation();let r=bt();if(!r)return;let i=e.surfaces.findIndex(e=>e.id===n.id);if(i<0)return;let a=[];n.kind===`device`&&e.onRenameDevice&&a.push({id:`rename`,label:`Rename`}),n.kind===`file`&&n.attachment===void 0&&a.push({id:`copy-path`,label:`Copy path`});let o=Wd(n,e.previewSessions),c=o?e.desktopByTabId[o]??null:null,l=c?.audioMuted??!1;n.kind===`preview`&&a.push({id:`toggle-mute`,...Gd({overlay:c,canResolveRuntimeTabId:e.previewRuntimeTabId!==void 0})}),a.push({id:`close`,label:`Close`},{id:`close-others`,label:`Close others`,disabled:e.surfaces.length<=1},{id:`close-to-right`,label:`Close to the right`,disabled:i>=e.surfaces.length-1},{id:`close-all`,label:`Close all`,disabled:e.surfaces.length===0});let u=await r.contextMenu.show(a,{x:t.clientX,y:t.clientY});bb122:switch(u){case`rename`:s(n.id);break bb122;case`copy-path`:n.kind===`file`&&n.attachment===void 0&&e.onCopyFilePath(n.relativePath);break bb122;case`toggle-mute`:{let t=o&&c?e.previewRuntimeTabId?.(o)??null:null;t&&va?.setAudioMuted(t,!l).catch(hf);break bb122}case`close`:e.onCloseSurface(n);break bb122;case`close-others`:e.onCloseOtherSurfaces(n);break bb122;case`close-to-right`:e.onCloseSurfacesToRight(n);break bb122;case`close-all`:e.onCloseAllSurfaces();break bb122}},t[11]=e,t[12]=b);let x=b,S=mf,C;t[13]===e?C=t[14]:(C=(t,n)=>{t.button===1&&(t.preventDefault(),t.stopPropagation(),e.onCloseSurface(n))},t[13]=e,t[14]=C);let w=C,T,E;t[15]!==e.activeSurfaceId||t[16]!==l.hasOverflow?(T=()=>{e.activeSurfaceId&&l.hasOverflow&&(a.current?.querySelector(`[data-active-tab='true']`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},E=[e.activeSurfaceId,l.hasOverflow],t[15]=e.activeSurfaceId,t[16]=l.hasOverflow,t[17]=T,t[18]=E):(T=t[17],E=t[18]),(0,Z.useEffect)(T,E);let D,O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>{let e=Ud(a.current);if(!e)return;let t=e.firstElementChild,n=$n(t?[e,t]:e,_);return e.addEventListener(`scroll`,_,{passive:!0}),_(),()=>{n(),e.removeEventListener(`scroll`,_)}},O=[_],t[19]=D,t[20]=O):(D=t[19],O=t[20]),(0,Z.useEffect)(D,O);let k,A;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>{let e=Ud(a.current);if(!e)return;let t=t=>{if(t.ctrlKey)return;let n=Math.abs(t.deltaX)>Math.abs(t.deltaY)?t.deltaX:t.deltaY;if(t.deltaMode===WheelEvent.DOM_DELTA_LINE&&(n*=16),t.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(n*=e.clientWidth),n===0)return;let r=e.scrollLeft;e.scrollLeft+=n,e.scrollLeft!==r&&(t.preventDefault(),_())};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},A=[_],t[21]=k,t[22]=A):(k=t[21],A=t[22]),(0,Z.useEffect)(k,A);let j=e.mode,M;t[23]===e.maximized?M=t[24]:(M=e.maximized===void 0?{}:{maximized:e.maximized},t[23]=e.maximized,t[24]=M);let N;t[25]===e.open?N=t[26]:(N=e.open===void 0?{}:{open:e.open},t[25]=e.open,t[26]=N);let P;t[27]===e.widthStorageKey?P=t[28]:(P=e.widthStorageKey===void 0?{}:{widthStorageKey:e.widthStorageKey},t[27]=e.widthStorageKey,t[28]=P);let I;t[29]===e.defaultWidth?I=t[30]:(I=e.defaultWidth===void 0?{}:{defaultWidth:e.defaultWidth},t[29]=e.defaultWidth,t[30]=I);let L;t[31]===e.inlineSize?L=t[32]:(L=e.inlineSize?{inlineSize:e.inlineSize}:{},t[31]=e.inlineSize,t[32]=L);let R=e.mode===`inline`&&!e.layoutControls?`pr-28`:`pr-3`,z=n&&`drag-region`,B=n&&`wco:pr-(--workspace-native-controls-inset)`,V=e.mode===`inline`&&e.maximized&&`[[data-sidebar-state=collapsed]_&]:pl-[var(--workspace-titlebar-content-left)] max-md:[[data-sidebar-state=expanded]_&]:pl-[var(--workspace-titlebar-content-left)]`,ee;t[33]!==R||t[34]!==z||t[35]!==B||t[36]!==V?(ee=K(`flex h-[var(--workspace-topbar-height)] min-h-[var(--workspace-topbar-height)] shrink-0 items-center gap-1 bg-(--app-chrome-background) pl-2`,R,z,B,V),t[33]=R,t[34]=z,t[35]=B,t[36]=V,t[37]=ee):ee=t[37];let te=e.surfaces,ne=e.onMoveSurface,U;t[38]!==w||t[39]!==x||t[40]!==n||t[41]!==e||t[42]!==o||t[43]!==i?(U=e.surfaces.map(t=>{let r=t.id===e.activeSurfaceId,a=e.pendingSurfaceIds.has(t.id),c=tf(t,e.previewSessions,e.terminalLabelsById),l=Wd(t,e.previewSessions),u=Kd(l?e.desktopByTabId[l]??null:null),d=l?e.previewRuntimeTabId?.(l)??null:null;return(0,$.jsxs)(uf,{surfaceId:t.id,disabled:!e.onMoveSurface||o===t.id,"data-active-tab":r,onMouseDown:S,onAuxClick:e=>w(e,t),onContextMenu:e=>void x(e,t),className:K(`cursor-pointer group/tab flex h-7 w-52 shrink-0 items-center gap-2 rounded-md pr-1 pl-2.5 text-sm transition-colors duration-150`,n&&`[-webkit-app-region:no-drag]`,r?`bg-background text-foreground shadow-xs`:`text-muted-foreground hover:bg-accent/60 hover:text-foreground`),children:[(0,$.jsxs)(`span`,{className:`relative flex size-4 shrink-0 items-center justify-center [&_img]:size-3.5 [&_svg]:size-3.5`,children:[(0,$.jsx)(af,{surface:t,sessions:e.previewSessions,desktopByTabId:e.desktopByTabId,theme:i,environmentId:e.environmentId,pullRequestStatusSeeds:e.pullRequestStatusSeeds}),a?(0,$.jsx)(`span`,{className:`absolute -right-0.5 -bottom-0.5 size-1.5 rounded-full bg-current`,"aria-hidden":!0}):null]}),u===`none`||!d?null:(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(`button`,{type:`button`,className:`cursor-pointer flex size-4 shrink-0 items-center justify-center rounded-sm hover:bg-muted`,"aria-label":u===`muted`?`Unmute ${c}`:`Mute ${c}`,onClick:e=>{e.stopPropagation(),va?.setAudioMuted(d,u!==`muted`).catch(pf)},children:(0,$.jsx)(at,{className:`size-3`,icon:u===`muted`?et:rt})})}),(0,$.jsx)(Y,{children:u===`muted`?`Unmute tab`:`Mute tab`})]}),o===t.id?(0,$.jsx)(`input`,{"aria-label":`Device tab name`,className:`min-w-0 flex-1 rounded-sm bg-background px-1 outline-none ring-1 ring-inset ring-ring`,defaultValue:c,ref:ff,onBlur:n=>{e.onRenameDevice?.(t.id,n.currentTarget.value),s(null)},onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.currentTarget.value=c,e.currentTarget.blur())}}):(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(`button`,{type:`button`,onDoubleClick:()=>{t.kind===`device`&&e.onRenameDevice&&s(t.id)},className:`cursor-pointer flex h-full min-w-0 flex-1 items-center`,onClick:()=>e.onActivate(t),children:(0,$.jsx)(`span`,{className:`truncate`,children:c})})}),(0,$.jsx)(Y,{children:t.kind===`device`?(0,$.jsx)(gf,{surface:t,environmentId:e.environmentId,title:c}):c})]}),(0,$.jsx)(`button`,{type:`button`,"aria-label":`Close ${c}`,className:K(`cursor-pointer flex size-5 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-opacity duration-150 hover:bg-muted hover:text-foreground focus-visible:opacity-100 pointer-coarse:opacity-100 motion-reduce:transition-none`,r?`opacity-100`:`opacity-0 group-hover/tab:opacity-100`),onClick:()=>e.onCloseSurface(t),children:(0,$.jsx)(H,{className:`size-3.5`})})]},t.id)}),t[38]=w,t[39]=x,t[40]=n,t[41]=e,t[42]=o,t[43]=i,t[44]=U):U=t[44];let W;t[45]!==e.onMoveSurface||t[46]!==e.surfaces||t[47]!==U?(W=(0,$.jsx)(Rn,{radius:`none`,ref:a,hideScrollbars:!0,scrollFade:!0,className:`min-w-0 flex-1`,"data-right-panel-tab-list":!0,children:(0,$.jsx)(`div`,{className:`flex h-full w-max min-w-full items-center gap-1`,children:(0,$.jsx)(cf,{surfaces:te,onMove:ne,children:U})})}),t[45]=e.onMoveSurface,t[46]=e.surfaces,t[47]=U,t[48]=W):W=t[48];let re;t[49]!==l.canScrollLeft||t[50]!==l.canScrollRight||t[51]!==l.hasOverflow?(re=l.hasOverflow?(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5 [-webkit-app-region:no-drag]`,role:`group`,"aria-label":`Scroll panel tabs`,children:[(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(`span`,{className:`inline-flex`,children:(0,$.jsx)(G,{"aria-label":`Scroll tabs left`,disabled:!l.canScrollLeft,onClick:()=>y(-1),size:`icon-xs`,variant:`ghost`,children:(0,$.jsx)(ce,{})})})}),(0,$.jsx)(Y,{children:`Scroll tabs left`})]}),(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(`span`,{className:`inline-flex`,children:(0,$.jsx)(G,{"aria-label":`Scroll tabs right`,disabled:!l.canScrollRight,onClick:()=>y(1),size:`icon-xs`,variant:`ghost`,children:(0,$.jsx)(Pe,{})})})}),(0,$.jsx)(Y,{children:`Scroll tabs right`})]})]}):null,t[49]=l.canScrollLeft,t[50]=l.canScrollRight,t[51]=l.hasOverflow,t[52]=re):re=t[52];let ie;t[53]!==d||t[54]!==e.browserAvailable||t[55]!==e.onAddBrowser?(ie=d?(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(G,{"aria-label":`New browser tab`,className:`shrink-0 [-webkit-app-region:no-drag]`,disabled:!e.browserAvailable,onClick:e.onAddBrowser,size:`icon-xs`,variant:`ghost-muted`}),children:(0,$.jsx)(F,{className:`size-4`})}),(0,$.jsx)(Y,{children:`New browser tab`})]}):null,t[53]=d,t[54]=e.browserAvailable,t[55]=e.onAddBrowser,t[56]=ie):ie=t[56];let ae;t[57]!==n||t[58]!==e.layoutControls?(ae=n&&!e.layoutControls?(0,$.jsx)(`span`,{"aria-hidden":!0,className:`hidden w-24 shrink-0 wco:block`}):null,t[57]=n,t[58]=e.layoutControls,t[59]=ae):ae=t[59];let oe;t[60]===n?oe=t[61]:(oe=n?(0,$.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none fixed top-[var(--workspace-controls-top)] right-[var(--workspace-controls-right)] h-[var(--workspace-topbar-height)] w-28 [-webkit-app-region:no-drag]`}):null,t[60]=n,t[61]=oe);let se;t[62]!==e.layoutControls||t[63]!==ee||t[64]!==W||t[65]!==re||t[66]!==ie||t[67]!==ae||t[68]!==oe?(se=(0,$.jsxs)(`div`,{className:ee,"data-right-panel-tabbar":!0,children:[W,re,ie,e.layoutControls,ae,oe]}),t[62]=e.layoutControls,t[63]=ee,t[64]=W,t[65]=re,t[66]=ie,t[67]=ae,t[68]=oe,t[69]=se):se=t[69];let le;t[70]!==r||t[71]!==e.activeSurfaceId||t[72]!==e.browserAvailable||t[73]!==e.children||t[74]!==e.deviceAvailable||t[75]!==e.diffAvailable||t[76]!==e.filesAvailable||t[77]!==e.onAddBrowser||t[78]!==e.onAddBrowserInProfile||t[79]!==e.onAddDesign||t[80]!==e.onAddDevice||t[81]!==e.onAddDiff||t[82]!==e.onAddFiles||t[83]!==e.onAddPullRequest||t[84]!==e.onAddPullRequests||t[85]!==e.onAddTerminal||t[86]!==e.pullRequestAvailable||t[87]!==e.pullRequestsAvailable||t[88]!==e.terminalAvailable?(le=e.activeSurfaceId===null?(0,$.jsx)(Xd,{onAddBrowser:e.onAddBrowser,onAddBrowserInProfile:e.onAddBrowserInProfile,browserProfiles:r,onAddTerminal:e.onAddTerminal,onAddDiff:e.onAddDiff,onAddFiles:e.onAddFiles,...e.onAddDesign?{onAddDesign:e.onAddDesign}:{},onAddPullRequest:e.onAddPullRequest,onAddPullRequests:e.onAddPullRequests,onAddDevice:e.onAddDevice,browserAvailable:e.browserAvailable,terminalAvailable:e.terminalAvailable,diffAvailable:e.diffAvailable,filesAvailable:e.filesAvailable,pullRequestAvailable:e.pullRequestAvailable,pullRequestsAvailable:e.pullRequestsAvailable,deviceAvailable:e.deviceAvailable}):e.children,t[70]=r,t[71]=e.activeSurfaceId,t[72]=e.browserAvailable,t[73]=e.children,t[74]=e.deviceAvailable,t[75]=e.diffAvailable,t[76]=e.filesAvailable,t[77]=e.onAddBrowser,t[78]=e.onAddBrowserInProfile,t[79]=e.onAddDesign,t[80]=e.onAddDevice,t[81]=e.onAddDiff,t[82]=e.onAddFiles,t[83]=e.onAddPullRequest,t[84]=e.onAddPullRequests,t[85]=e.onAddTerminal,t[86]=e.pullRequestAvailable,t[87]=e.pullRequestsAvailable,t[88]=e.terminalAvailable,t[89]=le):le=t[89];let ue;t[90]===le?ue=t[91]:(ue=(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-right-panel-surface-content":!0,children:le}),t[90]=le,t[91]=ue);let de;return t[92]!==e.mode||t[93]!==M||t[94]!==N||t[95]!==P||t[96]!==I||t[97]!==L||t[98]!==se||t[99]!==ue?(de=(0,$.jsxs)(cs,{mode:j,...M,...N,...P,...I,...L,children:[se,ue]}),t[92]=e.mode,t[93]=M,t[94]=N,t[95]=P,t[96]=I,t[97]=L,t[98]=se,t[99]=ue,t[100]=de):de=t[100],de}function ff(e){e?.focus(),e?.select()}function pf(){}function mf(e){e.button===1&&e.preventDefault()}function hf(){}function gf(e){let t=(0,Q.c)(15),n=e.surface.target,{state:r}=Qn(n?e.environmentId:null),i;t[0]!==r||t[1]!==n?(i=n?r.devices.find(e=>e.hostId===n.hostId&&e.id===n.deviceId):void 0,t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o;t[3]!==r||t[4]!==n?(o=n?r.hosts.find(e=>e.id===n.hostId):void 0,t[3]=r,t[4]=n,t[5]=o):o=t[5];let s=o,c;t[6]===e.title?c=t[7]:(c=(0,$.jsx)(`span`,{children:e.title}),t[6]=e.title,t[7]=c);let l;t[8]!==a?.version||t[9]!==s?.label||t[10]!==n?(l=n?(0,$.jsxs)(`span`,{className:`text-muted-foreground`,children:[s?.label??`Device host`,` ·`,` `,a?.version??(n.platform===`ios`?`iOS`:`Android`)]}):null,t[8]=a?.version,t[9]=s?.label,t[10]=n,t[11]=l):l=t[11];let u;return t[12]!==c||t[13]!==l?(u=(0,$.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[c,l]}),t[12]=c,t[13]=l,t[14]=u):u=t[14],u}var _f=(0,Z.memo)(function(e){let t=(0,Q.c)(31),{showThreadPanelControl:n,showTerminalControl:r,showRightPanelControl:i,terminalAvailable:a,terminalOpen:o,terminalShortcutLabel:s,threadPanelOpen:c,threadPanelPresentation:l,threadPanelPopoverHandle:u,threadPanelShortcutLabel:d,rightPanelAvailable:f,rightPanelOpen:p,rightPanelShortcutLabel:m,rightPanelUnavailableLabel:h,rightPanelTabCount:g,onToggleTerminal:_,onToggleThreadPanel:v,onToggleRightPanel:y}=e,b=n===void 0||n,x=r===void 0||r,S=i===void 0||i,C=h===void 0?`Right panel is unavailable`:h,w=g===void 0?0:g,T;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(bf,{}),t[0]=T):T=t[0];let E;t[1]===c?E=t[2]:(E=(0,$.jsx)(On,{className:`relative shrink-0 [-webkit-app-region:no-drag]`,pressed:c,"aria-label":`Toggle thread details panel`,variant:`ghost`,size:`sm`,children:T}),t[1]=c,t[2]=E);let D=E,O;t[3]!==v||t[4]!==l||t[5]!==d?(O=e=>(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:e,...l===`popover`?{}:{onClick:v}}),(0,$.jsxs)(Y,{side:`bottom`,children:[`Toggle thread details`,d?` (${d})`:``]})]}),t[3]=v,t[4]=l,t[5]=d,t[6]=O):O=t[6];let k=O,A;t[7]!==b||t[8]!==u||t[9]!==l||t[10]!==D||t[11]!==k?(A=b?k(l===`popover`?(0,$.jsx)(Wr,{handle:u,render:D}):D):null,t[7]=b,t[8]=u,t[9]=l,t[10]=D,t[11]=k,t[12]=A):A=t[12];let j;t[13]!==_||t[14]!==x||t[15]!==a||t[16]!==o||t[17]!==s?(j=x?(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(`span`,{className:`flex shrink-0`}),children:(0,$.jsx)(On,{className:`shrink-0 [-webkit-app-region:no-drag]`,pressed:o,onPressedChange:_,"aria-label":`Toggle terminal drawer`,variant:`ghost`,size:`sm`,disabled:!a,children:(0,$.jsx)(ue,{className:`size-4`})})}),(0,$.jsx)(Y,{side:`bottom`,children:a?`Toggle terminal drawer${s?` (${s})`:``}`:`Terminal drawer is unavailable`})]}):null,t[13]=_,t[14]=x,t[15]=a,t[16]=o,t[17]=s,t[18]=j):j=t[18];let M;t[19]!==y||t[20]!==f||t[21]!==p||t[22]!==m||t[23]!==w||t[24]!==C||t[25]!==S?(M=S?(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(`span`,{className:`flex shrink-0`}),children:(0,$.jsx)(On,{className:`shrink-0 [-webkit-app-region:no-drag]`,pressed:p,onPressedChange:y,"aria-label":w>0?`Toggle right panel, ${w} ${w===1?`tab`:`tabs`}`:`Toggle right panel`,variant:`ghost`,size:`sm`,disabled:!f,children:w>0?(0,$.jsx)(vf,{count:w}):(0,$.jsx)(ye,{className:`size-4`})})}),(0,$.jsx)(Y,{side:`bottom`,children:f?`Toggle right panel${m?` (${m})`:``}`:C})]}):null,t[19]=y,t[20]=f,t[21]=p,t[22]=m,t[23]=w,t[24]=C,t[25]=S,t[26]=M):M=t[26];let N;return t[27]!==j||t[28]!==M||t[29]!==A?(N=(0,$.jsxs)(`div`,{className:`flex h-full shrink-0 items-center gap-1 [-webkit-app-region:no-drag]`,"data-panel-layout-controls":!0,children:[A,j,M]}),t[27]=j,t[28]=M,t[29]=A,t[30]=N):N=t[30],N});function vf(e){let t=(0,Q.c)(4),{count:n}=e,r=n>99?`∞`:String(n),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}),t[0]=i):i=t[0];let a=r.length>1?11:13,o;return t[1]!==r||t[2]!==a?(o=(0,$.jsxs)(`svg`,{"aria-hidden":!0,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`size-4`,children:[i,(0,$.jsx)(`text`,{x:`12`,y:`12.5`,fill:`currentColor`,stroke:`none`,fontSize:a,fontWeight:600,textAnchor:`middle`,dominantBaseline:`central`,className:`tabular-nums`,children:r})]}),t[1]=r,t[2]=a,t[3]=o):o=t[3],o}var yf=(0,Z.memo)(function(e){let t=(0,Q.c)(12),{maximized:n,onToggle:r}=e,i=n?`Restore panel size`:`Maximize panel`,a=n?nt:tt,o;t[0]===a?o=t[1]:(o=(0,$.jsx)(at,{className:`size-3.5`,icon:a}),t[0]=a,t[1]=o);let s;t[2]!==i||t[3]!==n||t[4]!==r||t[5]!==o?(s=(0,$.jsx)(J,{render:(0,$.jsx)(On,{className:`shrink-0 [-webkit-app-region:no-drag]`,pressed:n,onPressedChange:r,"aria-label":i,variant:`ghost`,size:`sm`,children:o})}),t[2]=i,t[3]=n,t[4]=r,t[5]=o,t[6]=s):s=t[6];let c;t[7]===i?c=t[8]:(c=(0,$.jsx)(Y,{side:`bottom`,children:i}),t[7]=i,t[8]=c);let l;return t[9]!==s||t[10]!==c?(l=(0,$.jsxs)(X,{children:[s,c]}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l});function bf(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`svg`,{"aria-hidden":!0,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,className:`size-4`,children:[(0,$.jsx)(`circle`,{cx:`6`,cy:`7.5`,r:`2.5`}),(0,$.jsx)(`circle`,{cx:`6`,cy:`16.5`,r:`2.5`}),(0,$.jsx)(`path`,{d:`M12 7.5h8`}),(0,$.jsx)(`path`,{d:`M12 16.5h8`})]}),e[0]=t):t=e[0],t}export{cs as A,dc as C,bs as D,lc as E,Oo as F,Ao as I,Do as L,qo as M,Jo as N,xs as O,Go as P,hc as S,uc as T,cl as _,Pd as a,Nc as b,Fd as c,Ad as d,Mu as f,ul as g,yl as h,Nd as i,rs as j,_s as k,Id as l,Sl as m,yf as n,Ld as o,bl as p,df as r,Rd as s,_f as t,jd as u,Ic as v,pc as w,yc as x,Fc as y};
216
+ //# sourceMappingURL=PanelLayoutControls-yA-MhIU3.js.map