@p4code/cli 0.8.37 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) hide show
  1. package/dist/bin.mjs +1 -1
  2. package/dist/{binCli-mInzhqSL.mjs → binCli-k72_SR2Z.mjs} +2556 -2301
  3. package/dist/client/.vite/manifest.json +2008 -2048
  4. package/dist/client/assets/{2NI2N5EU-DVsZziQ3.js → 2NI2N5EU-DPAxyySd.js} +2 -2
  5. package/dist/client/assets/{4UO7MD6I-Cs3yBe-m.js → 4UO7MD6I-C0aflwpw.js} +2 -2
  6. package/dist/client/assets/{5B3SVYGG-CxW0L1iX.js → 5B3SVYGG-hhn6T1ru.js} +2 -2
  7. package/dist/client/assets/{5GK6JWQ2-Cb25PEnx.js → 5GK6JWQ2-BQ0OdoZ6.js} +2 -2
  8. package/dist/client/assets/{5N7A7DKN-udLyT643.js → 5N7A7DKN-BR8rdHwZ.js} +2 -2
  9. package/dist/client/assets/{5OC2THR4-DqD-reis.js → 5OC2THR4-DVDBlcjJ.js} +2 -2
  10. package/dist/client/assets/{5S6HY5KT-Cy7mIKKq.js → 5S6HY5KT-CjtOXys8.js} +2 -2
  11. package/dist/client/assets/{6IMQ5BUJ-Qu9PVsT7.js → 6IMQ5BUJ-Bpy1Geo9.js} +2 -2
  12. package/dist/client/assets/{6OLKWJ4F-BYzZS9mf.js → 6OLKWJ4F-D2naWV4i.js} +2 -2
  13. package/dist/client/assets/{74OO7NKP-h3ga2-vb.js → 74OO7NKP-CceNos-7.js} +2 -2
  14. package/dist/client/assets/{75O6YZUN-ByAK3P56.js → 75O6YZUN-CnXm_L8w.js} +2 -2
  15. package/dist/client/assets/{77XECAW3-D_lZqaZv.js → 77XECAW3-ECBcD47O.js} +2 -2
  16. package/dist/client/assets/{ABYRPUBD-BPWfXZyu.js → ABYRPUBD-B4F4wZam.js} +2 -2
  17. package/dist/client/assets/AlertDialogRoot-D5eL1YFA.js +2 -0
  18. package/dist/client/assets/{AnimatedHeight-D0-6CAPr.js → AnimatedHeight-BZhIfVtA.js} +2 -2
  19. package/dist/client/assets/AuthSurfaceShell-DR9yRrzS.js +2 -0
  20. package/dist/client/assets/{BB2UYUI2-CGgafKC2.js → BB2UYUI2-Cae7rC8c.js} +2 -2
  21. package/dist/client/assets/{BUM34MOA-Cn4iaSBT.js → BUM34MOA-DBDboDOb.js} +2 -2
  22. package/dist/client/assets/{CEQABKGZ-CmBEfzh3.js → CEQABKGZ-C6UutqUy.js} +2 -2
  23. package/dist/client/assets/{CXAC5362-xibpmz3Y.js → CXAC5362-BnZlf1Fg.js} +2 -2
  24. package/dist/client/assets/{ChatGptUsageButton-DU3PVHJW.js → ChatGptUsageButton-3K5PpaVk.js} +2 -2
  25. package/dist/client/assets/{ChatMarkdown-D-cNSjFn.js → ChatMarkdown-EK5C8Dje.js} +7 -7
  26. package/dist/client/assets/{CheckboxIndicator-CZCy38xt.js → CheckboxIndicator-DZ8vBLEv.js} +2 -2
  27. package/dist/client/assets/{ClippedText-D_rM_XDj.js → ClippedText-Dswe5Mb4.js} +2 -2
  28. package/dist/client/assets/CodexSetupSection.logic-BepCZ25p.js +2 -0
  29. package/dist/client/assets/{ComboboxClear-tOmMpuVi.js → ComboboxClear-By718biy.js} +2 -2
  30. package/dist/client/assets/{ComboboxGroupLabel-CgZZIHwV.js → ComboboxGroupLabel-DjWIIS5_.js} +2 -2
  31. package/dist/client/assets/{CommandBlock-6rjypfVF.js → CommandBlock-C967hvdK.js} +2 -2
  32. package/dist/client/assets/{ComposerPromptEditor-Dxfhec2W.js → ComposerPromptEditor-kPs79YCA.js} +10 -10
  33. package/dist/client/assets/{CompositeRoot-Bsb8efI6.js → CompositeRoot-BFPe8O0M.js} +2 -2
  34. package/dist/client/assets/{ConnectionDiagnosisDetails-Q0M5gCCf.js → ConnectionDiagnosisDetails-B5VXf5lv.js} +2 -2
  35. package/dist/client/assets/{ConnectionStatusDot-DAuD0jkU.js → ConnectionStatusDot-wmgCjAfF.js} +2 -2
  36. package/dist/client/assets/{DRLTVNUE-BVseXOzv.js → DRLTVNUE-Du8kYl_L.js} +2 -2
  37. package/dist/client/assets/{DYY6UVD2-Bz33D3dq.js → DYY6UVD2-DxjEuWNy.js} +2 -2
  38. package/dist/client/assets/{DevicePanel-CsSQr7vQ.js → DevicePanel-YEBH-Vqd.js} +2 -2
  39. package/dist/client/assets/DeviceSetup-CAlj40rJ.js +2 -0
  40. package/dist/client/assets/{DialogTitle-bcvBtKP-.js → DialogTitle-DNp9zThp.js} +2 -2
  41. package/dist/client/assets/{DiffCommentAnnotation-bhzNqujM.js → DiffCommentAnnotation-BOk2MTlv.js} +2 -2
  42. package/dist/client/assets/{DiffFileTree-BySeJqhq.js → DiffFileTree-Dg3cvfi5.js} +2 -2
  43. package/dist/client/assets/{DiffPanel-CCFas4eA.js → DiffPanel-fTHMPAQJ.js} +2 -2
  44. package/dist/client/assets/{DiffWorkerPoolProvider-CkkqWbz-.js → DiffWorkerPoolProvider-CqmToECA.js} +3 -3
  45. package/dist/client/assets/{EmbeddedDesign-iuThcPT3.js → EmbeddedDesign-BXKBSCcw.js} +2 -2
  46. package/dist/client/assets/{EnvironmentMachineIcon-iUmoTUYt.js → EnvironmentMachineIcon-DBWK6C8T.js} +2 -2
  47. package/dist/client/assets/{ExpandableText-ByCx68yv.js → ExpandableText-B9cfY7p2.js} +2 -2
  48. package/dist/client/assets/{FNOVOB4O-DK3iet1g.js → FNOVOB4O-BeMBYVRF.js} +2 -2
  49. package/dist/client/assets/{FieldControl-DtsEariK.js → FieldControl-BOrs67_f.js} +2 -2
  50. package/dist/client/assets/{FileDiff-Bu2BSqBV.js → FileDiff-DW1zPAn5.js} +2 -2
  51. package/dist/client/assets/{FilePreviewPanel-8cI8gciT.js → FilePreviewPanel-CTTCKfik.js} +10 -10
  52. package/dist/client/assets/{FoldedSettingsSection-RYq8GTvV.js → FoldedSettingsSection-ClboCRR4.js} +2 -2
  53. package/dist/client/assets/{FormContext-CIK8MKa2.js → FormContext-DcLeIpxJ.js} +2 -2
  54. package/dist/client/assets/{HDGCDEEZ-B_J1N6RY.js → HDGCDEEZ-DtsLNbcM.js} +2 -2
  55. package/dist/client/assets/{HSJLKHB7-B2SbZQUf.js → HSJLKHB7-Cj1_K-Mg.js} +2 -2
  56. package/dist/client/assets/{Icons-xsXA_L6w.js → Icons-B1qw9fnR.js} +2 -2
  57. package/dist/client/assets/Input-DQflEYBs.js +2 -0
  58. package/dist/client/assets/JZOYTAAL-BrzaFmLe.js +1 -0
  59. package/dist/client/assets/{K3MD6TGW-VU68yYxr.js → K3MD6TGW-SNOidZ8r.js} +2 -2
  60. package/dist/client/assets/{K7RP3OMA-zaD_NBVC.js → K7RP3OMA-CpajkG5B.js} +2 -2
  61. package/dist/client/assets/{KeybindingsSettings.logic-BJe27xmi.js → KeybindingsSettings.logic-BA5WG7V2.js} +2 -2
  62. package/dist/client/assets/{LHDIQX7Q-DCLqoRGy.js → LHDIQX7Q-CAyO0Nv9.js} +2 -2
  63. package/dist/client/assets/{LUXOKEGN-CmxZpSzC.js → LUXOKEGN-Dp60gO-M.js} +2 -2
  64. package/dist/client/assets/{MathTypeset-Hhqwg4PF.js → MathTypeset-DG9QDH3a.js} +2 -2
  65. package/dist/client/assets/{N3JZAHOW-Cev8Cn9M.js → N3JZAHOW-CPZZhC9o.js} +2 -2
  66. package/dist/client/assets/{NUIALGQ3-CV92Kt25.js → NUIALGQ3-Bapg3pv1.js} +2 -2
  67. package/dist/client/assets/{NoProjectsHero-CMqIlSNl.js → NoProjectsHero-DunzHVd0.js} +2 -2
  68. package/dist/client/assets/{O65XPQGZ-bGyTGMsB.js → O65XPQGZ-BmLVfB2-.js} +2 -2
  69. package/dist/client/assets/{O7XIQ6OM-DVdEfB1N.js → O7XIQ6OM-BzZlSmaP.js} +2 -2
  70. package/dist/client/assets/{OFQON5FD-Ca_CNS26.js → OFQON5FD-Ciy1Dfj8.js} +2 -2
  71. package/dist/client/assets/{P4ConnectAccountPages-Buss2oTL.js → P4ConnectAccountPages-DO-fCpTN.js} +2 -2
  72. package/dist/client/assets/{P4ConnectSidebarSignIn-D1n4y6Gq.js → P4ConnectSidebarSignIn-7hkM7xr7.js} +2 -2
  73. package/dist/client/assets/{PJQHF43J-B__IdKwP.js → PJQHF43J-CTTmTIhc.js} +2 -2
  74. package/dist/client/assets/{PanelLayoutControls-EIunk_2Q.js → PanelLayoutControls-clP6N7xc.js} +7 -7
  75. package/dist/client/assets/{PierreEntryIcon-GQImyog1.js → PierreEntryIcon-wm-IkF2y.js} +2 -2
  76. package/dist/client/assets/{PopoverHandle-Cj5egwXv.js → PopoverHandle-CqjlXffy.js} +2 -2
  77. package/dist/client/assets/PreviewPanel-fTwWXayK.js +2 -0
  78. package/dist/client/assets/{ProjectDefaultsSettings-DX2Kf-tx.js → ProjectDefaultsSettings-DABlQCRQ.js} +2 -2
  79. package/dist/client/assets/{ProjectFavicon-OMOnEzVu.js → ProjectFavicon-zExdjKgc.js} +3 -3
  80. package/dist/client/assets/{ProjectIconPickerDialog-Q4GkqwDs.js → ProjectIconPickerDialog-D4Br81iW.js} +2 -2
  81. package/dist/client/assets/{ProjectMonogram-Br5sgd24.js → ProjectMonogram-Ba70a8_s.js} +2 -2
  82. package/dist/client/assets/{ProviderAuthTerminal-Q584HoOn.js → ProviderAuthTerminal-Gf_5AaPE.js} +2 -2
  83. package/dist/client/assets/{ProviderModelPicker-JNM9nJs_.js → ProviderModelPicker-DrfK42fH.js} +2 -2
  84. package/dist/client/assets/{ProviderSettingsForm-CdiKhrJE.js → ProviderSettingsForm-CXVYrIzw.js} +2 -2
  85. package/dist/client/assets/{PullRequestCodeTab-Co76Qf6Z.js → PullRequestCodeTab-DaXxo4Bs.js} +3 -3
  86. package/dist/client/assets/{RHNBAITX-Oryl0UiR.js → RHNBAITX-DKMeuR6R.js} +2 -2
  87. package/dist/client/assets/{ReadOnlySourcePreview-aUjexBVb.js → ReadOnlySourcePreview-DPJWK3HJ.js} +2 -2
  88. package/dist/client/assets/{RenderErrorBoundary-Oe5BzG3n.js → RenderErrorBoundary-BI5KBtsb.js} +2 -2
  89. package/dist/client/assets/{SLD4V6NK-DbsINoTD.js → SLD4V6NK-CR4aIcpx.js} +2 -2
  90. package/dist/client/assets/ScheduledTasksSettings-CTHyd4UX.js +4 -0
  91. package/dist/client/assets/{ScopedSwitch-D8-FelRH.js → ScopedSwitch-De6GoQiO.js} +2 -2
  92. package/dist/client/assets/{ScrollAreaCorner-nnFi-Ecx.js → ScrollAreaCorner-DF4GCx0d.js} +2 -2
  93. package/dist/client/assets/{SecretInput-CqAhFuNO.js → SecretInput-Dg6ZsU9p.js} +2 -2
  94. package/dist/client/assets/{SelectScrollUpArrow-BQJrvk31.js → SelectScrollUpArrow-DeRXucOo.js} +2 -2
  95. package/dist/client/assets/{SettingsPanels-CNgY_ZPe.js → SettingsPanels-D6e2byZQ.js} +8 -8
  96. package/dist/client/assets/{SettingsPanels.logic-Dr_NyHjE.js → SettingsPanels.logic-BSXSdFru.js} +2 -2
  97. package/dist/client/assets/{SettingsScopeNotice-BFxCBOnl.js → SettingsScopeNotice-MbxDDMZ9.js} +2 -2
  98. package/dist/client/assets/SidebarStageBackdrop-B0F--sat.js +2 -0
  99. package/dist/client/assets/{T3PCR2KE-2R1FY5zG.js → T3PCR2KE-C0_7R2Oa.js} +2 -2
  100. package/dist/client/assets/{TKWO2OVW-BjhIZzCe.js → TKWO2OVW-DqJmzuhq.js} +2 -2
  101. package/dist/client/assets/{TSHNXIZL-B_cvoUct.js → TSHNXIZL-CmCl4WMk.js} +2 -2
  102. package/dist/client/assets/ThemeEditorPanel-IhSXPcO9.js +5 -0
  103. package/dist/client/assets/{ThreadTerminalDrawer-DHoyxd6-.js → ThreadTerminalDrawer-DnOstFPr.js} +4 -4
  104. package/dist/client/assets/TooltipViewport-DJXNIjFt.js +2 -0
  105. package/dist/client/assets/{UQJE5E4I-2r98lr05.js → UQJE5E4I-U1f_Qxq0.js} +2 -2
  106. package/dist/client/assets/{USNYFO5S-CvTI5t_o.js → USNYFO5S-BFU1s0-x.js} +2 -2
  107. package/dist/client/assets/{Virtualizer-BgcEI5KE.js → Virtualizer-CI2uidEs.js} +2 -2
  108. package/dist/client/assets/{WEVWDWVA-U7ygIdf3.js → WEVWDWVA-DVuH1I8D.js} +2 -2
  109. package/dist/client/assets/{WorkspaceBreadcrumb-_zND61qF.js → WorkspaceBreadcrumb-Dr-p0Dtn.js} +2 -2
  110. package/dist/client/assets/{WorkspacePageContainer-LYv_7Qc0.js → WorkspacePageContainer-MDWEFwmu.js} +2 -2
  111. package/dist/client/assets/{WorkspacePageHeader-B_0ute56.js → WorkspacePageHeader-CNcKDaqG.js} +2 -2
  112. package/dist/client/assets/{X5RFHQXM-D4S0_b0W.js → X5RFHQXM-DhiPjZ2I.js} +2 -2
  113. package/dist/client/assets/{X62E3GBT-CrIC4h9P.js → X62E3GBT-BoEmDIYA.js} +2 -2
  114. package/dist/client/assets/{XBNEOJTC-D2_RQZjM.js → XBNEOJTC-ACchb7zJ.js} +2 -2
  115. package/dist/client/assets/{YHV2MVVZ-BmAcJLBt.js → YHV2MVVZ-WIW1NclZ.js} +2 -2
  116. package/dist/client/assets/{YURCZMG2-RCCTu3bv.js → YURCZMG2-D8PyipKA.js} +2 -2
  117. package/dist/client/assets/{YVG2LODB-Cvp0Ei-1.js → YVG2LODB-BQvBC9bF.js} +2 -2
  118. package/dist/client/assets/_chat-DDGjgFMR.js +45 -0
  119. package/dist/client/assets/{_chat.design-DX1VqYkX.js → _chat.design-DjIqnlVZ.js} +2 -2
  120. package/dist/client/assets/{_chat.index-Dzh3d42S.js → _chat.index-Dku1iZH1.js} +2 -2
  121. package/dist/client/assets/{_chat.new-BHRvXFPr.js → _chat.new-8-cjg5K7.js} +3 -3
  122. package/dist/client/assets/_chat.pull-requests-DVfSewSZ.js +2 -0
  123. package/dist/client/assets/{alert-BN-r9V4f.js → alert-DpVw79VA.js} +2 -2
  124. package/dist/client/assets/{assetUrls-B6vsSVWR.js → assetUrls-BOJMUK_1.js} +2 -2
  125. package/dist/client/assets/{assets-CID0y4Uv.js → assets-6zZLBDZw.js} +2 -2
  126. package/dist/client/assets/{browserHistoryStore-CK4YsfkQ.js → browserHistoryStore-TJXTYA-V.js} +2 -2
  127. package/dist/client/assets/{browserLinkTarget-BJ30b4-s.js → browserLinkTarget-DRbX4L_9.js} +2 -2
  128. package/dist/client/assets/{checkbox-BJhN1L_L.js → checkbox-4yBjrqWQ.js} +2 -2
  129. package/dist/client/assets/{color-picker-D2LwMwlZ.js → color-picker-B6JEgpDa.js} +2 -2
  130. package/dist/client/assets/{combobox-Cw2-7qyI.js → combobox-CKWbcPIR.js} +2 -2
  131. package/dist/client/assets/{command-BIELTYJu.js → command-D8XZec1r.js} +2 -2
  132. package/dist/client/assets/{connect-D4llmZsa.js → connect-Dp9BB7ev.js} +2 -2
  133. package/dist/client/assets/{connect-agent-BlR0FAbF.js → connect-agent-DkbIqI-8.js} +2 -2
  134. package/dist/client/assets/{design-Cdl1XCBU.js → design-Dn5DzqF2.js} +2 -2
  135. package/dist/client/assets/{device-Bc5H3PTz.js → device-dylO5xoO.js} +2 -2
  136. package/dist/client/assets/{dialog-BRtKKGzk.js → dialog-_vbB7RKH.js} +2 -2
  137. package/dist/client/assets/{diffRendering-DtBTalAD.js → diffRendering-MXukhqw1.js} +2 -2
  138. package/dist/client/assets/{dist-oE_MNxpZ.js → dist-ceTe_mn7.js} +3 -3
  139. package/dist/client/assets/{draft-input-vviXwx5Q.js → draft-input-C-u_3cDw.js} +2 -2
  140. package/dist/client/assets/{duoViewer-kcp00m8a.js → duoViewer-C0aL6Kyr.js} +2 -2
  141. package/dist/client/assets/{dynamic-C8_ODyue.js → dynamic-DTzzXo3L.js} +2 -2
  142. package/dist/client/assets/{embeddedScripts-skldQmE1.js → embeddedScripts-DcWCyBxX.js} +2 -2
  143. package/dist/client/assets/{empty-rC3eYvxq.js → empty-BlKDGTzb.js} +2 -2
  144. package/dist/client/assets/{entities-B8Vupv5g.js → entities-eRiwvW2F.js} +2 -2
  145. package/dist/client/assets/{fileLinks-BoyzENAX.js → fileLinks-CYejoXPq.js} +2 -2
  146. package/dist/client/assets/{fileTreeExpansion-DndrZZAD.js → fileTreeExpansion-wG1G7D6R.js} +2 -2
  147. package/dist/client/assets/{getDiffFileInput-C1QBFdFu.js → getDiffFileInput-CzeweGHs.js} +2 -2
  148. package/dist/client/assets/{guideRunStore-BgFFILxA.js → guideRunStore-DAYN2Zd7.js} +2 -2
  149. package/dist/client/assets/{htmlRender-ddkOIEbT.js → htmlRender-C3rZ0xgC.js} +2 -2
  150. package/dist/client/assets/{index-BwdieRvq.js → index-DA9og9YW.js} +3 -3
  151. package/dist/client/assets/{input-BYd74ook.js → input-DXGWoa4O.js} +2 -2
  152. package/dist/client/assets/{input-group-DMFlSk_7.js → input-group-De0xZXfc.js} +2 -2
  153. package/dist/client/assets/{kbd-rp5mX21h.js → kbd-WWNLIkTn.js} +2 -2
  154. package/dist/client/assets/{keybindings-B_kRk5Fi.js → keybindings-DAHl8jIl.js} +2 -2
  155. package/dist/client/assets/{lazy-CeaQ3-Fj.js → lazy-Ccs3klKO.js} +4 -4
  156. package/dist/client/assets/{lazyRouteComponent-COYyJY2H.js → lazyRouteComponent-BU0ER5FO.js} +2 -2
  157. package/dist/client/assets/{link-CsXnX9WM.js → link-C3TbL1do.js} +2 -2
  158. package/dist/client/assets/{linkedPrompt-B5iI7U8H.js → linkedPrompt-BJh0Yqud.js} +2 -2
  159. package/dist/client/assets/main-DjrB0l0D.css +2 -0
  160. package/dist/client/assets/main-DleJeMZO.js +37 -0
  161. package/dist/client/assets/{mediaReference-ZW7gfO5X.js → mediaReference-BbSbhpkR.js} +2 -2
  162. package/dist/client/assets/{mediaSource-DsT6G6Wm.js → mediaSource-B_75uvyp.js} +2 -2
  163. package/dist/client/assets/{number-field-CEA6qXbs.js → number-field-qEfih146.js} +2 -2
  164. package/dist/client/assets/{observeResize-DSyLC8QK.js → observeResize-DzSkewug.js} +2 -2
  165. package/dist/client/assets/{onboarding-BPkAEHBV.js → onboarding-1Zg3fM0A.js} +2 -2
  166. package/dist/client/assets/{openFileInPreview-CGM83ICx.js → openFileInPreview-CiPuDrfB.js} +2 -2
  167. package/dist/client/assets/{p4ProjectFile-CwpteA7b.js → p4ProjectFile-BVKW5TIA.js} +2 -2
  168. package/dist/client/assets/{pair-D9v8gc0o.js → pair-DUv1mY4i.js} +2 -2
  169. package/dist/client/assets/{pendingSendStore-BuEVrrEM.js → pendingSendStore-BFVsboDn.js} +2 -2
  170. package/dist/client/assets/{phoneViewer-CNE0SVmy.js → phoneViewer-CStYy_tX.js} +2 -2
  171. package/dist/client/assets/{pierre-icons-ChDlOt-h.js → pierre-icons-D3vWvKqU.js} +2 -2
  172. package/dist/client/assets/{popover-BjUpdrKu.js → popover-CogH2zM4.js} +2 -2
  173. package/dist/client/assets/{preview-DHLYKEKb.js → preview-O1ZL8Awg.js} +2 -2
  174. package/dist/client/assets/{preview-3EscFepc.js → preview-ipLyyv_l.js} +2 -2
  175. package/dist/client/assets/{previewMiniPlayerStore-DHjQeV1U.js → previewMiniPlayerStore-C5z1mN8S.js} +2 -2
  176. package/dist/client/assets/{primary-NcsmRI6j.js → primary-CMBPxKMH.js} +2 -2
  177. package/dist/client/assets/{primaryCloudLinkState-DkXIVBHW.js → primaryCloudLinkState-CER468V5.js} +2 -2
  178. package/dist/client/assets/{projectFilesQueryState-0jxJ50Qq.js → projectFilesQueryState-D4FdR3Xm.js} +2 -2
  179. package/dist/client/assets/{projectScriptEditor-CMGXoIEJ.js → projectScriptEditor-4wQTbXvz.js} +2 -2
  180. package/dist/client/assets/{providerSkills-4hnESoi_.js → providerSkills-D3rxPB_g.js} +2 -2
  181. package/dist/client/assets/{pullRequestDetail.logic-sbOM8yDW.js → pullRequestDetail.logic-Bkh57WzV.js} +2 -2
  182. package/dist/client/assets/{pullRequestIcons-B7Om_B_D.js → pullRequestIcons-DPbMXqGp.js} +2 -2
  183. package/dist/client/assets/{pullRequestReviewStore-CIL8WfOG.js → pullRequestReviewStore-BAxwf6rl.js} +2 -2
  184. package/dist/client/assets/{pullRequests-CMTRCOu7.js → pullRequests-DggtcbhA.js} +2 -2
  185. package/dist/client/assets/{queries-hhl_J8u9.js → queries-DJfKGsHe.js} +2 -2
  186. package/dist/client/assets/{query-CfGzD8v6.js → query-B3Zo1YOE.js} +2 -2
  187. package/dist/client/assets/{radio-group-up2QNXjf.js → radio-group-l1Zl-3hQ.js} +2 -2
  188. package/dist/client/assets/{renderScheduler-Dgqqs-EX.js → renderScheduler-BgGYA97h.js} +2 -2
  189. package/dist/client/assets/{rightPanelStore-CGF0-d-1.js → rightPanelStore-Cv1U3yrU.js} +2 -2
  190. package/dist/client/assets/{runtime-Ca_Z-vg5.js → runtime-BOlBBevr.js} +3 -3
  191. package/dist/client/assets/{runtime-OeWFs5Hf.js → runtime-CeFhsGnm.js} +3 -3
  192. package/dist/client/assets/{runtimeModeConfig-BTG9FTYe.js → runtimeModeConfig-BQ0QCQhj.js} +2 -2
  193. package/dist/client/assets/{scheduledTasksSettings.logic-BeuOnCov.js → scheduledTasksSettings.logic-BpOBCcOk.js} +2 -2
  194. package/dist/client/assets/{scroll-area-BNQKEZbp.js → scroll-area-CQNIjQ8U.js} +2 -2
  195. package/dist/client/assets/{select-D_zHR42Y.js → select-Cbpdz6n3.js} +2 -2
  196. package/dist/client/assets/{selfImproveFindings-CAZ0j1GD.js → selfImproveFindings-CT79AgdK.js} +2 -2
  197. package/dist/client/assets/{server-6nKYyc8r.js → server-DvWrfyUO.js} +2 -2
  198. package/dist/client/assets/{session-BxUdP61p.js → session-D3gY-tOR.js} +2 -2
  199. package/dist/client/assets/{session-logic-Dr1plzXe.js → session-logic-OeNFZd_V.js} +3 -3
  200. package/dist/client/assets/{settings-DE_hSu0q.js → settings-C6gUwixG.js} +2 -2
  201. package/dist/client/assets/{settings.appearance-C--uy4It.js → settings.appearance-BdGq8dkT.js} +2 -2
  202. package/dist/client/assets/settings.archived-DobN7ZtC.js +2 -0
  203. package/dist/client/assets/{settings.computer-use-DhnqPqMm.js → settings.computer-use-DTAvnNqQ.js} +2 -2
  204. package/dist/client/assets/settings.connections-CZD-0BNX.js +2 -0
  205. package/dist/client/assets/settings.data-controls-CTVHY8Rd.js +2 -0
  206. package/dist/client/assets/{settings.decisions-CU-6rIpn.js → settings.decisions-D3zMITNw.js} +2 -2
  207. package/dist/client/assets/{settings.designs-DHYhhG4k.js → settings.designs-DWeI1d2s.js} +2 -2
  208. package/dist/client/assets/{settings.diagnostics-csgW1_E8.js → settings.diagnostics-CqC6fhz6.js} +2 -2
  209. package/dist/client/assets/{settings.general-CeBkrL9-.js → settings.general-BDEcQVI4.js} +2 -2
  210. package/dist/client/assets/{settings.integrations-DqSYBosl.js → settings.integrations-BmqNoylk.js} +2 -2
  211. package/dist/client/assets/{settings.keybindings-C7D1i238.js → settings.keybindings-Mt7J5TKC.js} +2 -2
  212. package/dist/client/assets/{settings.open-source-licenses-6oFDgAt7.js → settings.open-source-licenses-Dvex7Jce.js} +2 -2
  213. package/dist/client/assets/{settings.plugins-DfM65Xio.js → settings.plugins-BAFed2wY.js} +4 -4
  214. package/dist/client/assets/settings.projects-DhuXD_vx.js +4 -0
  215. package/dist/client/assets/settings.providers-D_-kNRqH.js +3 -0
  216. package/dist/client/assets/{settings.scheduled-tasks-Csi8wfij.js → settings.scheduled-tasks-Z4aprmEO.js} +2 -2
  217. package/dist/client/assets/settings.snap-shot-o0bdbS5t.js +2 -0
  218. package/dist/client/assets/settings.source-control-CwJzBnSu.js +2 -0
  219. package/dist/client/assets/{settings.storage-DTcg-0aj.js → settings.storage-B4ahmlhx.js} +2 -2
  220. package/dist/client/assets/{settingsLayout-4ySvFdXb.js → settingsLayout-DrhqvTJ8.js} +3 -3
  221. package/dist/client/assets/{sidebar-CHDwV4Ca.js → sidebar-BhJqncti.js} +2 -2
  222. package/dist/client/assets/{sidebarProjectGrouping-BcOVY8p-.js → sidebarProjectGrouping-DDt6qTcu.js} +2 -2
  223. package/dist/client/assets/{skeleton-BcLPbojY.js → skeleton-CFtayHTe.js} +2 -2
  224. package/dist/client/assets/{sourceControl-CPrl7cyO.js → sourceControl-Dqo9EYNC.js} +2 -2
  225. package/dist/client/assets/{sourceControlClients-oNOd36Cq.js → sourceControlClients-DGnHi6Rd.js} +2 -2
  226. package/dist/client/assets/{spinner-_ourbdVb.js → spinner-BZh9P0sD.js} +2 -2
  227. package/dist/client/assets/{terminal-links-DuZi4b83.js → terminal-links-CFKe0iu0.js} +2 -2
  228. package/dist/client/assets/{terminalSessions-D0vbdqqx.js → terminalSessions-BykgTNwT.js} +2 -2
  229. package/dist/client/assets/{textarea-DlXXDHPJ.js → textarea-hXQFbdrS.js} +2 -2
  230. package/dist/client/assets/themePalette-MbAn2gqj.js +5 -0
  231. package/dist/client/assets/{toast-DXWclCrr.js → toast-C61oyZY1.js} +2 -2
  232. package/dist/client/assets/{toggle-Dofc34s2.js → toggle-B03MQDgB.js} +2 -2
  233. package/dist/client/assets/{toggle-group-CYKsfBbD.js → toggle-group-yF5GZ53o.js} +2 -2
  234. package/dist/client/assets/{tooltip-CY3W5y-f.js → tooltip-ChmjT8Ns.js} +2 -2
  235. package/dist/client/assets/uiStateStore-DL8OsPjd.js +2 -0
  236. package/dist/client/assets/{usage-DQcgd75_.js → usage-DATBL2Du.js} +2 -2
  237. package/dist/client/assets/{usageAccess-CCSxXl9X.js → usageAccess-kgUHYKOw.js} +2 -2
  238. package/dist/client/assets/{usageFormat-ByjmRjTe.js → usageFormat-D5Mz5ugL.js} +2 -2
  239. package/dist/client/assets/{usageShortcuts-DOWm0Vo9.js → usageShortcuts-mAekk3eG.js} +2 -2
  240. package/dist/client/assets/{use-atom-command-vqjL7n-x.js → use-atom-command-Bt7x9oO0.js} +2 -2
  241. package/dist/client/assets/{useAriaLabelledBy-B7FNFpmO.js → useAriaLabelledBy-DjNn9irU.js} +2 -2
  242. package/dist/client/assets/useHandleNewThread-BOKOo2wA.js +2 -0
  243. package/dist/client/assets/{useLocation-B_XV0lDx.js → useLocation-Cwv1HZ3K.js} +2 -2
  244. package/dist/client/assets/{useNavigate-BWqAWfiZ.js → useNavigate-Cdrlv-yJ.js} +2 -2
  245. package/dist/client/assets/{useNavigateBack-C52nbvbb.js → useNavigateBack-CwjQ4iuL.js} +2 -2
  246. package/dist/client/assets/{useP4ConnectAuthPrompt-DKhdNYj8.js → useP4ConnectAuthPrompt-D63n-MFC.js} +2 -2
  247. package/dist/client/assets/{useParams-ekGanxxb.js → useParams-C5D_t-0u.js} +2 -2
  248. package/dist/client/assets/{usePermissionStatus-CWV_yoZe.js → usePermissionStatus-CKmeNk61.js} +2 -2
  249. package/dist/client/assets/{usePullRequestActions-DxtkLQ5D.js → usePullRequestActions-D53oZord.js} +2 -2
  250. package/dist/client/assets/{useRegisterFieldControl-BAJIcFiO.js → useRegisterFieldControl-DUs9w2Me.js} +2 -2
  251. package/dist/client/assets/{useScopedModelAvailability-815e0x20.js → useScopedModelAvailability-CeAUx0qZ.js} +2 -2
  252. package/dist/client/assets/useSettings-VTow9ZEM.js +3 -0
  253. package/dist/client/assets/utils-CBe1bHL7.js +37 -0
  254. package/dist/client/assets/{vcsRefInvalidation-CW_MIqdt.js → vcsRefInvalidation-B2f3qDSR.js} +2 -2
  255. package/dist/client/assets/{welcome-k7S47hyM.js → welcome-CQgOocvj.js} +2 -2
  256. package/dist/client/index.html +1 -1
  257. package/dist/{renderer-Ay-1ojn7.mjs → renderer-BBWgEvuE.mjs} +2 -2
  258. package/dist/{runtime-bP6MSuMS.mjs → runtime-DNjlpJkJ.mjs} +286 -242
  259. package/package.json +1 -1
  260. package/dist/client/assets/AlertDialogRoot-BSP6M0Mu.js +0 -2
  261. package/dist/client/assets/AuthSurfaceShell-30QvY1bI.js +0 -2
  262. package/dist/client/assets/CodexSetupSection.logic-g6_GE4bw.js +0 -2
  263. package/dist/client/assets/DeviceSetup-Cl7L9wsi.js +0 -2
  264. package/dist/client/assets/Input-D3Qi4jCN.js +0 -2
  265. package/dist/client/assets/JZOYTAAL-BlxFvoz4.js +0 -1
  266. package/dist/client/assets/PreviewPanel-BkFeksTl.js +0 -2
  267. package/dist/client/assets/ScheduledTasksSettings-1uXNtcPA.js +0 -4
  268. package/dist/client/assets/ThemeEditorPanel-B7MiqZ90.js +0 -5
  269. package/dist/client/assets/TooltipViewport-ThbbZQDo.js +0 -2
  270. package/dist/client/assets/_chat-CwO3_WVM.js +0 -45
  271. package/dist/client/assets/_chat.pull-requests-BZilN1TK.js +0 -2
  272. package/dist/client/assets/composer-logic-P-jVPXi4.js +0 -6
  273. package/dist/client/assets/composerDraftUploads-S66xDlS0.js +0 -2
  274. package/dist/client/assets/main-DdVSHl80.css +0 -2
  275. package/dist/client/assets/main-VfCRP294.js +0 -29
  276. package/dist/client/assets/settings.archived-D-55XnxQ.js +0 -2
  277. package/dist/client/assets/settings.connections-BPVLazeK.js +0 -2
  278. package/dist/client/assets/settings.data-controls-CIzGvqCI.js +0 -2
  279. package/dist/client/assets/settings.projects-CeoZzdMW.js +0 -4
  280. package/dist/client/assets/settings.providers-BBgppyE3.js +0 -3
  281. package/dist/client/assets/settings.snap-shot-BdVdSIJy.js +0 -2
  282. package/dist/client/assets/settings.source-control-Bme3qg7j.js +0 -2
  283. package/dist/client/assets/themePalette-VIM7Gehx.js +0 -5
  284. package/dist/client/assets/uiStateStore-CdkBStdp.js +0 -6
  285. package/dist/client/assets/useHandleNewThread-BYNZXzR_.js +0 -2
  286. package/dist/client/assets/useSettings-gPlpTIWi.js +0 -3
  287. package/dist/client/assets/utils-DhUt689t.js +0 -37
@@ -1,2 +1,2 @@
1
- import{a as e,t}from"./react-DH3P2YXY.js";import{n,t as r}from"./jsx-runtime-BnjsACtP.js";import{Fb as i,Ib as a,Lh as o,Yp as s,aE as c,dr as l,rh as u,t as d,xb as f}from"./utils-DhUt689t.js";import{a as p,c as m,o as h,s as g,t as _}from"./select-D_zHR42Y.js";import{t as v}from"./textarea-DlXXDHPJ.js";import{t as y}from"./input-BYd74ook.js";import{a as b}from"./settingsLayout-4ySvFdXb.js";import{va as x}from"./main-VfCRP294.js";import{t as S}from"./draft-input-vviXwx5Q.js";import{t as C}from"./SecretInput-CqAhFuNO.js";var w=n(),T=e(t(),1),E=e(r(),1);function D(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[-_]+/g,` `).replace(/^./,e=>e.toUpperCase())}function O(e){return a(e)??i(e)}function k(e,t){let n=O(e)?.[t];return typeof n==`string`?n:void 0}function A(e){return O(e)?.providerSettingsForm??{}}function j(e){return i(e.settingsSchema)?.providerSettingsFormSchema??{}}function M(e){let t=f(e)(void 0);return c(t)&&typeof t.value==`boolean`?t.value:void 0}function N(e,t){let n=e.driverKind===`acpRegistry`&&B(t,`source`)===`local`,r=j(e),i=new Map((r.order??[]).map((e,t)=>[e,t])),a=i.size;return Object.keys(e.settingsSchema.fields).map((e,t)=>({key:e,index:t})).toSorted((e,t)=>(i.get(e.key)??a+e.index)-(i.get(t.key)??a+t.index)).flatMap(({key:t})=>{let r=e.settingsSchema.fields[t],i=A(r);if(i.hidden||n&&t!==`source`&&t!==`commandPath`)return[];let a=k(r,`title`),s=k(r,`description`);return[{key:t,control:i.control??`text`,label:n&&t===`commandPath`?`Executable`:a??D(t),...n&&t===`commandPath`?{description:`Executable name or path on this environment.`}:s===void 0?{}:{description:s},...n&&t===`commandPath`?{placeholder:`e.g. dsh`}:i.placeholder===void 0?{}:{placeholder:i.placeholder},clearWhenEmpty:i.clearWhenEmpty??`omit`,...o(r)?{secret:!0}:{},...i.control===`switch`?{defaultBooleanValue:M(r)}:{},...i.control===`select`&&i.options?{options:i.options}:{}}]})}var P=0,F=e=>({id:`provider-argument-${P++}`,value:e});function I(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function L(e){let t=(0,w.c)(21),{value:n,onChange:r}=e,i=typeof n==`object`&&n?n.commandArgs:void 0,a;t[0]===i?a=t[1]:(a=Array.isArray(i)?i.filter(z):[],t[0]=i,t[1]=a);let o=a,c;t[2]===o?c=t[3]:(c=()=>o.map(F),t[2]=o,t[3]=c);let[d,f]=(0,T.useState)(c),p=(0,T.useRef)(d),m=(0,T.useRef)(o),h=(0,T.useRef)(void 0),g,_;t[4]===o?(g=t[5],_=t[6]):(g=()=>{let e=m.current,t=h.current;if(m.current=o,h.current=void 0,I(e,o)||t!==void 0&&I(t,o))return;let n=o.map(F);p.current=n,f(n)},_=[o],t[4]=o,t[5]=g,t[6]=_),(0,T.useEffect)(g,_);let v;t[7]!==r||t[8]!==n?(v=e=>{p.current=e,f(e);let t=e.map(R);h.current=t;let i=typeof n==`object`&&n?{...n}:{};r({...i,commandArgs:t})},t[7]=r,t[8]=n,t[9]=v):v=t[9];let y=v,x;t[10]===y?x=t[11]:(x=()=>y([...p.current,F(``)]),t[10]=y,t[11]=x);let C;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,E.jsx)(s,{}),t[12]=C):C=t[12];let D;t[13]===x?D=t[14]:(D=(0,E.jsxs)(l,{type:`button`,size:`sm`,variant:`outline`,onClick:x,children:[C,`Add argument`]}),t[13]=x,t[14]=D);let O;t[15]!==d||t[16]!==y?(O=d.length>0?(0,E.jsx)(`div`,{className:`mt-3 min-w-0 space-y-2 pb-2`,children:d.map((e,t)=>(0,E.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,E.jsx)(S,{size:`sm`,font:`mono`,value:e.value,onCommit:t=>y(p.current.map(n=>n.id===e.id?{...n,value:t}:n)),"aria-label":`Argument ${t+1}`,spellCheck:!1}),(0,E.jsx)(l,{type:`button`,size:`icon-micro`,variant:`ghost-destructive`,onClick:()=>y(p.current.filter(t=>t.id!==e.id)),"aria-label":`Remove argument ${t+1}`,children:(0,E.jsx)(u,{})})]},e.id))}):null,t[15]=d,t[16]=y,t[17]=O):O=t[17];let k;return t[18]!==D||t[19]!==O?(k=(0,E.jsx)(b,{title:`Arguments`,description:`One literal argument per row, in launch order.`,control:D,children:O}),t[18]=D,t[19]=O,t[20]=k):k=t[20],k}function R(e){return e.value}function z(e){return typeof e==`string`}function B(e,t){if(typeof e!=`object`||!e)return``;let n=e[t];return typeof n==`string`?n:``}function V(e,t,n=!1){if(typeof e!=`object`||!e)return n;let r=e[t];return typeof r==`boolean`?r:n}function H(e,t,n){let r=typeof e==`object`&&e?{...e}:{};if(typeof n==`boolean`){let e=t.defaultBooleanValue??!1;return t.clearWhenEmpty===`omit`&&n===e?delete r[t.key]:r[t.key]=n,Object.keys(r).length>0?r:void 0}let i=n.trim();return t.clearWhenEmpty===`omit`&&i.length===0?delete r[t.key]:r[t.key]=n,Object.keys(r).length>0?r:void 0}function U(e){let t=(0,w.c)(31),{field:n,value:r,inputId:i,size:a,className:o,onChange:s}=e,c;t[0]===n.options?c=t[1]:(c=n.options??[],t[0]=n.options,t[1]=c);let l=c,u=l[0]?.value??``,d;t[2]!==u||t[3]!==n.key||t[4]!==r?(d=B(r,n.key)||u,t[2]=u,t[3]=n.key,t[4]=r,t[5]=d):d=t[5];let f=d,p;t[6]!==f||t[7]!==l?(p=l.find(e=>e.value===f)?.label??f,t[6]=f,t[7]=l,t[8]=p):p=t[8];let v=p,y;t[9]!==u||t[10]!==n||t[11]!==s||t[12]!==r?(y=e=>{typeof e==`string`&&s(H(r,n,e===u?``:e))},t[9]=u,t[10]=n,t[11]=s,t[12]=r,t[13]=y):y=t[13];let b;t[14]===v?b=t[15]:(b=(0,E.jsx)(m,{children:v}),t[14]=v,t[15]=b);let x;t[16]!==o||t[17]!==n.label||t[18]!==i||t[19]!==a||t[20]!==b?(x=(0,E.jsx)(g,{id:i,size:a,className:o,"aria-label":n.label,children:b}),t[16]=o,t[17]=n.label,t[18]=i,t[19]=a,t[20]=b,t[21]=x):x=t[21];let S;t[22]===l?S=t[23]:(S=l.map(W),t[22]=l,t[23]=S);let C;t[24]===S?C=t[25]:(C=(0,E.jsx)(h,{align:`start`,alignItemWithTrigger:!1,children:S}),t[24]=S,t[25]=C);let T;return t[26]!==f||t[27]!==y||t[28]!==x||t[29]!==C?(T=(0,E.jsxs)(_,{value:f,onValueChange:y,children:[x,C]}),t[26]=f,t[27]=y,t[28]=x,t[29]=C,t[30]=T):T=t[30],T}function W(e){return(0,E.jsx)(p,{value:e.value,children:e.label},e.value)}function G(e){let t=(0,w.c)(4);if(e.variant===`card`){let n;return t[0]===e.children?n=t[1]:(n=(0,E.jsx)(`div`,{children:e.children}),t[0]=e.children,t[1]=n),n}let n;return t[2]===e.children?n=t[3]:(n=(0,E.jsx)(`div`,{className:`grid gap-1.5`,children:e.children}),t[2]=e.children,t[3]=n),n}function K(e){let t=(0,w.c)(108),{field:n,value:r,idPrefix:i,variant:a,onChange:o}=e,s=`${i}-${n.key}`,c=a===`dialog`?`text-2xs text-muted-foreground`:`mt-1 block text-xs text-muted-foreground`,l;t[0]===n.label?l=t[1]:(l=(0,E.jsx)(`span`,{className:`text-xs font-medium text-foreground`,children:n.label}),t[0]=n.label,t[1]=l);let u=l,f;t[2]!==c||t[3]!==n.description?(f=n.description?(0,E.jsx)(`span`,{className:c,children:n.description}):null,t[2]=c,t[3]=n.description,t[4]=f):f=t[4];let p=f;if(a===`settings`){let e=n.description?`${s}-description`:void 0,i;t[5]!==e||t[6]!==n||t[7]!==s||t[8]!==o||t[9]!==r?(i=n.control===`switch`?(0,E.jsx)(x,{checked:V(r,n.key,n.defaultBooleanValue),onCheckedChange:e=>o(H(r,n,!!e)),"aria-label":n.label,"aria-describedby":e}):n.control===`select`?(0,E.jsx)(U,{field:n,value:r,inputId:s,size:`sm`,className:`w-full max-w-full @min-[32rem]/settings-row:w-56`,onChange:o}):n.control===`textarea`?(0,E.jsx)(v,{id:s,"aria-describedby":e,className:`w-full max-w-full @min-[32rem]/settings-row:w-[min(24rem,50cqw)]`,value:B(r,n.key),onChange:e=>o(H(r,n,e.target.value)),placeholder:n.placeholder,spellCheck:!1}):n.secret?(0,E.jsx)(C,{id:s,"aria-describedby":e,size:`sm`,className:`w-full max-w-full @min-[32rem]/settings-row:w-56`,configured:B(r,n.key).length>0,value:``,onCommit:e=>o(H(r,n,e))}):(0,E.jsx)(S,{id:s,"aria-describedby":e,size:`sm`,className:`w-full max-w-full @min-[32rem]/settings-row:w-56`,type:n.control===`password`?`password`:void 0,autoComplete:n.control===`password`?`off`:void 0,value:B(r,n.key),placeholder:n.placeholder,onCommit:e=>{o(H(r,n,e))},spellCheck:!1}),t[5]=e,t[6]=n,t[7]=s,t[8]=o,t[9]=r,t[10]=i):i=t[10];let a=i,c;t[11]!==n.control||t[12]!==n.label||t[13]!==s?(c=n.control===`switch`?n.label:(0,E.jsx)(`label`,{htmlFor:s,children:n.label}),t[11]=n.control,t[12]=n.label,t[13]=s,t[14]=c):c=t[14];let l;t[15]!==e||t[16]!==n.description?(l=n.description?(0,E.jsx)(`span`,{id:e,children:n.description}):void 0,t[15]=e,t[16]=n.description,t[17]=l):l=t[17];let u;return t[18]!==a||t[19]!==c||t[20]!==l?(u=(0,E.jsx)(b,{title:c,description:l,control:a}),t[18]=a,t[19]=c,t[20]=l,t[21]=u):u=t[21],u}if(n.control===`switch`){let e;t[22]!==p||t[23]!==u?(e=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[u,p]}),t[22]=p,t[23]=u,t[24]=e):e=t[24];let i;t[25]!==n.defaultBooleanValue||t[26]!==n.key||t[27]!==r?(i=V(r,n.key,n.defaultBooleanValue),t[25]=n.defaultBooleanValue,t[26]=n.key,t[27]=r,t[28]=i):i=t[28];let s;t[29]!==n||t[30]!==o||t[31]!==r?(s=e=>o(H(r,n,!!e)),t[29]=n,t[30]=o,t[31]=r,t[32]=s):s=t[32];let c;t[33]!==n.label||t[34]!==i||t[35]!==s?(c=(0,E.jsx)(x,{checked:i,onCheckedChange:s,"aria-label":n.label}),t[33]=n.label,t[34]=i,t[35]=s,t[36]=c):c=t[36];let l;t[37]!==e||t[38]!==c?(l=(0,E.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[e,c]}),t[37]=e,t[38]=c,t[39]=l):l=t[39];let d;return t[40]!==l||t[41]!==a?(d=(0,E.jsx)(G,{variant:a,children:l}),t[40]=l,t[41]=a,t[42]=d):d=t[42],d}if(n.control===`select`){let e=a===`card`&&`block`,i;t[43]===e?i=t[44]:(i=d(e),t[43]=e,t[44]=i);let c=a===`card`&&`mt-1.5`,l;t[45]===c?l=t[46]:(l=d(`w-full`,c),t[45]=c,t[46]=l);let f;t[47]!==n||t[48]!==s||t[49]!==o||t[50]!==l||t[51]!==r?(f=(0,E.jsx)(U,{field:n,value:r,inputId:s,size:`sm`,className:l,onChange:o}),t[47]=n,t[48]=s,t[49]=o,t[50]=l,t[51]=r,t[52]=f):f=t[52];let m;t[53]!==p||t[54]!==s||t[55]!==u||t[56]!==i||t[57]!==f?(m=(0,E.jsxs)(`label`,{htmlFor:s,className:i,children:[u,f,p]}),t[53]=p,t[54]=s,t[55]=u,t[56]=i,t[57]=f,t[58]=m):m=t[58];let h;return t[59]!==m||t[60]!==a?(h=(0,E.jsx)(G,{variant:a,children:m}),t[59]=m,t[60]=a,t[61]=h):h=t[61],h}if(n.control===`textarea`){let e=a===`card`&&`block`,i;t[62]===e?i=t[63]:(i=d(e),t[62]=e,t[63]=i);let c=a===`card`&&`mt-1.5`,l;t[64]===c?l=t[65]:(l=d(c),t[64]=c,t[65]=l);let f;t[66]!==n.key||t[67]!==r?(f=B(r,n.key),t[66]=n.key,t[67]=r,t[68]=f):f=t[68];let m;t[69]!==n||t[70]!==o||t[71]!==r?(m=e=>o(H(r,n,e.target.value)),t[69]=n,t[70]=o,t[71]=r,t[72]=m):m=t[72];let h;t[73]!==n.placeholder||t[74]!==s||t[75]!==l||t[76]!==f||t[77]!==m?(h=(0,E.jsx)(v,{id:s,className:l,value:f,onChange:m,placeholder:n.placeholder,spellCheck:!1}),t[73]=n.placeholder,t[74]=s,t[75]=l,t[76]=f,t[77]=m,t[78]=h):h=t[78];let g;t[79]!==p||t[80]!==s||t[81]!==u||t[82]!==i||t[83]!==h?(g=(0,E.jsxs)(`label`,{htmlFor:s,className:i,children:[u,h,p]}),t[79]=p,t[80]=s,t[81]=u,t[82]=i,t[83]=h,t[84]=g):g=t[84];let _;return t[85]!==g||t[86]!==a?(_=(0,E.jsx)(G,{variant:a,children:g}),t[85]=g,t[86]=a,t[87]=_):_=t[87],_}let m=n.control===`password`?`password`:void 0,h=n.secret?C:S,g=n.secret?C:y,_=a===`card`&&`block`,T;t[88]===_?T=t[89]:(T=d(_),t[88]=_,t[89]=T);let D;t[90]!==h||t[91]!==g||t[92]!==n||t[93]!==s||t[94]!==o||t[95]!==m||t[96]!==r||t[97]!==a?(D=a===`card`?(0,E.jsx)(h,{id:s,size:`sm`,className:`mt-1.5`,type:n.secret?void 0:m,autoComplete:!n.secret&&n.control===`password`?`off`:void 0,value:B(r,n.key),onCommit:e=>o(H(r,n,e)),placeholder:n.placeholder,spellCheck:!1}):(0,E.jsx)(g,{id:s,type:n.secret?void 0:m,autoComplete:!n.secret&&n.control===`password`?`off`:void 0,value:B(r,n.key),onChange:e=>o(H(r,n,e.target.value)),placeholder:n.placeholder,spellCheck:!1}),t[90]=h,t[91]=g,t[92]=n,t[93]=s,t[94]=o,t[95]=m,t[96]=r,t[97]=a,t[98]=D):D=t[98];let O;t[99]!==p||t[100]!==s||t[101]!==u||t[102]!==T||t[103]!==D?(O=(0,E.jsxs)(`label`,{htmlFor:s,className:T,children:[u,D,p]}),t[99]=p,t[100]=s,t[101]=u,t[102]=T,t[103]=D,t[104]=O):O=t[104];let k;return t[105]!==O||t[106]!==a?(k=(0,E.jsx)(G,{variant:a,children:O}),t[105]=O,t[106]=a,t[107]=k):k=t[107],k}function q(e){let t=(0,w.c)(24),{definition:n,value:r,idPrefix:i,variant:a,onChange:o}=e,s;t[0]!==n||t[1]!==r?(s=N(n,r),t[0]=n,t[1]=r,t[2]=s):s=t[2];let c=s,l;t[3]!==n.driverKind||t[4]!==r?(l=n.driverKind===`acpRegistry`&&B(r,`source`)===`local`,t[3]=n.driverKind,t[4]=r,t[5]=l):l=t[5];let u=l;if(c.length===0)return null;let d;if(t[6]!==c||t[7]!==i||t[8]!==o||t[9]!==r||t[10]!==a){let e;t[12]!==i||t[13]!==o||t[14]!==r||t[15]!==a?(e=e=>(0,E.jsx)(K,{field:e,value:r,idPrefix:i,variant:a,onChange:o},e.key),t[12]=i,t[13]=o,t[14]=r,t[15]=a,t[16]=e):e=t[16],d=c.map(e),t[6]=c,t[7]=i,t[8]=o,t[9]=r,t[10]=a,t[11]=d}else d=t[11];let f;t[17]!==u||t[18]!==o||t[19]!==r?(f=u?(0,E.jsx)(L,{value:r,onChange:o}):null,t[17]=u,t[18]=o,t[19]=r,t[20]=f):f=t[20];let p;return t[21]!==d||t[22]!==f?(p=(0,E.jsxs)(E.Fragment,{children:[d,f]}),t[21]=d,t[22]=f,t[23]=p):p=t[23],p}export{N as n,q as t};
2
- //# sourceMappingURL=ProviderSettingsForm-CdiKhrJE.js.map
1
+ import{a as e,t}from"./react-DH3P2YXY.js";import{n,t as r}from"./jsx-runtime-BnjsACtP.js";import{Fb as i,Ib as a,Lh as o,Yp as s,aE as c,dr as l,rh as u,t as d,xb as f}from"./utils-CBe1bHL7.js";import{a as p,c as m,o as h,s as g,t as _}from"./select-Cbpdz6n3.js";import{t as v}from"./textarea-hXQFbdrS.js";import{t as y}from"./input-DXGWoa4O.js";import{a as b}from"./settingsLayout-DrhqvTJ8.js";import{do as x}from"./main-DleJeMZO.js";import{t as S}from"./draft-input-C-u_3cDw.js";import{t as C}from"./SecretInput-Dg6ZsU9p.js";var w=n(),T=e(t(),1),E=e(r(),1);function D(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[-_]+/g,` `).replace(/^./,e=>e.toUpperCase())}function O(e){return a(e)??i(e)}function k(e,t){let n=O(e)?.[t];return typeof n==`string`?n:void 0}function A(e){return O(e)?.providerSettingsForm??{}}function j(e){return i(e.settingsSchema)?.providerSettingsFormSchema??{}}function M(e){let t=f(e)(void 0);return c(t)&&typeof t.value==`boolean`?t.value:void 0}function N(e,t){let n=e.driverKind===`acpRegistry`&&B(t,`source`)===`local`,r=j(e),i=new Map((r.order??[]).map((e,t)=>[e,t])),a=i.size;return Object.keys(e.settingsSchema.fields).map((e,t)=>({key:e,index:t})).toSorted((e,t)=>(i.get(e.key)??a+e.index)-(i.get(t.key)??a+t.index)).flatMap(({key:t})=>{let r=e.settingsSchema.fields[t],i=A(r);if(i.hidden||n&&t!==`source`&&t!==`commandPath`)return[];let a=k(r,`title`),s=k(r,`description`);return[{key:t,control:i.control??`text`,label:n&&t===`commandPath`?`Executable`:a??D(t),...n&&t===`commandPath`?{description:`Executable name or path on this environment.`}:s===void 0?{}:{description:s},...n&&t===`commandPath`?{placeholder:`e.g. dsh`}:i.placeholder===void 0?{}:{placeholder:i.placeholder},clearWhenEmpty:i.clearWhenEmpty??`omit`,...o(r)?{secret:!0}:{},...i.control===`switch`?{defaultBooleanValue:M(r)}:{},...i.control===`select`&&i.options?{options:i.options}:{}}]})}var P=0,F=e=>({id:`provider-argument-${P++}`,value:e});function I(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function L(e){let t=(0,w.c)(21),{value:n,onChange:r}=e,i=typeof n==`object`&&n?n.commandArgs:void 0,a;t[0]===i?a=t[1]:(a=Array.isArray(i)?i.filter(z):[],t[0]=i,t[1]=a);let o=a,c;t[2]===o?c=t[3]:(c=()=>o.map(F),t[2]=o,t[3]=c);let[d,f]=(0,T.useState)(c),p=(0,T.useRef)(d),m=(0,T.useRef)(o),h=(0,T.useRef)(void 0),g,_;t[4]===o?(g=t[5],_=t[6]):(g=()=>{let e=m.current,t=h.current;if(m.current=o,h.current=void 0,I(e,o)||t!==void 0&&I(t,o))return;let n=o.map(F);p.current=n,f(n)},_=[o],t[4]=o,t[5]=g,t[6]=_),(0,T.useEffect)(g,_);let v;t[7]!==r||t[8]!==n?(v=e=>{p.current=e,f(e);let t=e.map(R);h.current=t;let i=typeof n==`object`&&n?{...n}:{};r({...i,commandArgs:t})},t[7]=r,t[8]=n,t[9]=v):v=t[9];let y=v,x;t[10]===y?x=t[11]:(x=()=>y([...p.current,F(``)]),t[10]=y,t[11]=x);let C;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,E.jsx)(s,{}),t[12]=C):C=t[12];let D;t[13]===x?D=t[14]:(D=(0,E.jsxs)(l,{type:`button`,size:`sm`,variant:`outline`,onClick:x,children:[C,`Add argument`]}),t[13]=x,t[14]=D);let O;t[15]!==d||t[16]!==y?(O=d.length>0?(0,E.jsx)(`div`,{className:`mt-3 min-w-0 space-y-2 pb-2`,children:d.map((e,t)=>(0,E.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,E.jsx)(S,{size:`sm`,font:`mono`,value:e.value,onCommit:t=>y(p.current.map(n=>n.id===e.id?{...n,value:t}:n)),"aria-label":`Argument ${t+1}`,spellCheck:!1}),(0,E.jsx)(l,{type:`button`,size:`icon-micro`,variant:`ghost-destructive`,onClick:()=>y(p.current.filter(t=>t.id!==e.id)),"aria-label":`Remove argument ${t+1}`,children:(0,E.jsx)(u,{})})]},e.id))}):null,t[15]=d,t[16]=y,t[17]=O):O=t[17];let k;return t[18]!==D||t[19]!==O?(k=(0,E.jsx)(b,{title:`Arguments`,description:`One literal argument per row, in launch order.`,control:D,children:O}),t[18]=D,t[19]=O,t[20]=k):k=t[20],k}function R(e){return e.value}function z(e){return typeof e==`string`}function B(e,t){if(typeof e!=`object`||!e)return``;let n=e[t];return typeof n==`string`?n:``}function V(e,t,n=!1){if(typeof e!=`object`||!e)return n;let r=e[t];return typeof r==`boolean`?r:n}function H(e,t,n){let r=typeof e==`object`&&e?{...e}:{};if(typeof n==`boolean`){let e=t.defaultBooleanValue??!1;return t.clearWhenEmpty===`omit`&&n===e?delete r[t.key]:r[t.key]=n,Object.keys(r).length>0?r:void 0}let i=n.trim();return t.clearWhenEmpty===`omit`&&i.length===0?delete r[t.key]:r[t.key]=n,Object.keys(r).length>0?r:void 0}function U(e){let t=(0,w.c)(31),{field:n,value:r,inputId:i,size:a,className:o,onChange:s}=e,c;t[0]===n.options?c=t[1]:(c=n.options??[],t[0]=n.options,t[1]=c);let l=c,u=l[0]?.value??``,d;t[2]!==u||t[3]!==n.key||t[4]!==r?(d=B(r,n.key)||u,t[2]=u,t[3]=n.key,t[4]=r,t[5]=d):d=t[5];let f=d,p;t[6]!==f||t[7]!==l?(p=l.find(e=>e.value===f)?.label??f,t[6]=f,t[7]=l,t[8]=p):p=t[8];let v=p,y;t[9]!==u||t[10]!==n||t[11]!==s||t[12]!==r?(y=e=>{typeof e==`string`&&s(H(r,n,e===u?``:e))},t[9]=u,t[10]=n,t[11]=s,t[12]=r,t[13]=y):y=t[13];let b;t[14]===v?b=t[15]:(b=(0,E.jsx)(m,{children:v}),t[14]=v,t[15]=b);let x;t[16]!==o||t[17]!==n.label||t[18]!==i||t[19]!==a||t[20]!==b?(x=(0,E.jsx)(g,{id:i,size:a,className:o,"aria-label":n.label,children:b}),t[16]=o,t[17]=n.label,t[18]=i,t[19]=a,t[20]=b,t[21]=x):x=t[21];let S;t[22]===l?S=t[23]:(S=l.map(W),t[22]=l,t[23]=S);let C;t[24]===S?C=t[25]:(C=(0,E.jsx)(h,{align:`start`,alignItemWithTrigger:!1,children:S}),t[24]=S,t[25]=C);let T;return t[26]!==f||t[27]!==y||t[28]!==x||t[29]!==C?(T=(0,E.jsxs)(_,{value:f,onValueChange:y,children:[x,C]}),t[26]=f,t[27]=y,t[28]=x,t[29]=C,t[30]=T):T=t[30],T}function W(e){return(0,E.jsx)(p,{value:e.value,children:e.label},e.value)}function G(e){let t=(0,w.c)(4);if(e.variant===`card`){let n;return t[0]===e.children?n=t[1]:(n=(0,E.jsx)(`div`,{children:e.children}),t[0]=e.children,t[1]=n),n}let n;return t[2]===e.children?n=t[3]:(n=(0,E.jsx)(`div`,{className:`grid gap-1.5`,children:e.children}),t[2]=e.children,t[3]=n),n}function K(e){let t=(0,w.c)(108),{field:n,value:r,idPrefix:i,variant:a,onChange:o}=e,s=`${i}-${n.key}`,c=a===`dialog`?`text-2xs text-muted-foreground`:`mt-1 block text-xs text-muted-foreground`,l;t[0]===n.label?l=t[1]:(l=(0,E.jsx)(`span`,{className:`text-xs font-medium text-foreground`,children:n.label}),t[0]=n.label,t[1]=l);let u=l,f;t[2]!==c||t[3]!==n.description?(f=n.description?(0,E.jsx)(`span`,{className:c,children:n.description}):null,t[2]=c,t[3]=n.description,t[4]=f):f=t[4];let p=f;if(a===`settings`){let e=n.description?`${s}-description`:void 0,i;t[5]!==e||t[6]!==n||t[7]!==s||t[8]!==o||t[9]!==r?(i=n.control===`switch`?(0,E.jsx)(x,{checked:V(r,n.key,n.defaultBooleanValue),onCheckedChange:e=>o(H(r,n,!!e)),"aria-label":n.label,"aria-describedby":e}):n.control===`select`?(0,E.jsx)(U,{field:n,value:r,inputId:s,size:`sm`,className:`w-full max-w-full @min-[32rem]/settings-row:w-56`,onChange:o}):n.control===`textarea`?(0,E.jsx)(v,{id:s,"aria-describedby":e,className:`w-full max-w-full @min-[32rem]/settings-row:w-[min(24rem,50cqw)]`,value:B(r,n.key),onChange:e=>o(H(r,n,e.target.value)),placeholder:n.placeholder,spellCheck:!1}):n.secret?(0,E.jsx)(C,{id:s,"aria-describedby":e,size:`sm`,className:`w-full max-w-full @min-[32rem]/settings-row:w-56`,configured:B(r,n.key).length>0,value:``,onCommit:e=>o(H(r,n,e))}):(0,E.jsx)(S,{id:s,"aria-describedby":e,size:`sm`,className:`w-full max-w-full @min-[32rem]/settings-row:w-56`,type:n.control===`password`?`password`:void 0,autoComplete:n.control===`password`?`off`:void 0,value:B(r,n.key),placeholder:n.placeholder,onCommit:e=>{o(H(r,n,e))},spellCheck:!1}),t[5]=e,t[6]=n,t[7]=s,t[8]=o,t[9]=r,t[10]=i):i=t[10];let a=i,c;t[11]!==n.control||t[12]!==n.label||t[13]!==s?(c=n.control===`switch`?n.label:(0,E.jsx)(`label`,{htmlFor:s,children:n.label}),t[11]=n.control,t[12]=n.label,t[13]=s,t[14]=c):c=t[14];let l;t[15]!==e||t[16]!==n.description?(l=n.description?(0,E.jsx)(`span`,{id:e,children:n.description}):void 0,t[15]=e,t[16]=n.description,t[17]=l):l=t[17];let u;return t[18]!==a||t[19]!==c||t[20]!==l?(u=(0,E.jsx)(b,{title:c,description:l,control:a}),t[18]=a,t[19]=c,t[20]=l,t[21]=u):u=t[21],u}if(n.control===`switch`){let e;t[22]!==p||t[23]!==u?(e=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[u,p]}),t[22]=p,t[23]=u,t[24]=e):e=t[24];let i;t[25]!==n.defaultBooleanValue||t[26]!==n.key||t[27]!==r?(i=V(r,n.key,n.defaultBooleanValue),t[25]=n.defaultBooleanValue,t[26]=n.key,t[27]=r,t[28]=i):i=t[28];let s;t[29]!==n||t[30]!==o||t[31]!==r?(s=e=>o(H(r,n,!!e)),t[29]=n,t[30]=o,t[31]=r,t[32]=s):s=t[32];let c;t[33]!==n.label||t[34]!==i||t[35]!==s?(c=(0,E.jsx)(x,{checked:i,onCheckedChange:s,"aria-label":n.label}),t[33]=n.label,t[34]=i,t[35]=s,t[36]=c):c=t[36];let l;t[37]!==e||t[38]!==c?(l=(0,E.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[e,c]}),t[37]=e,t[38]=c,t[39]=l):l=t[39];let d;return t[40]!==l||t[41]!==a?(d=(0,E.jsx)(G,{variant:a,children:l}),t[40]=l,t[41]=a,t[42]=d):d=t[42],d}if(n.control===`select`){let e=a===`card`&&`block`,i;t[43]===e?i=t[44]:(i=d(e),t[43]=e,t[44]=i);let c=a===`card`&&`mt-1.5`,l;t[45]===c?l=t[46]:(l=d(`w-full`,c),t[45]=c,t[46]=l);let f;t[47]!==n||t[48]!==s||t[49]!==o||t[50]!==l||t[51]!==r?(f=(0,E.jsx)(U,{field:n,value:r,inputId:s,size:`sm`,className:l,onChange:o}),t[47]=n,t[48]=s,t[49]=o,t[50]=l,t[51]=r,t[52]=f):f=t[52];let m;t[53]!==p||t[54]!==s||t[55]!==u||t[56]!==i||t[57]!==f?(m=(0,E.jsxs)(`label`,{htmlFor:s,className:i,children:[u,f,p]}),t[53]=p,t[54]=s,t[55]=u,t[56]=i,t[57]=f,t[58]=m):m=t[58];let h;return t[59]!==m||t[60]!==a?(h=(0,E.jsx)(G,{variant:a,children:m}),t[59]=m,t[60]=a,t[61]=h):h=t[61],h}if(n.control===`textarea`){let e=a===`card`&&`block`,i;t[62]===e?i=t[63]:(i=d(e),t[62]=e,t[63]=i);let c=a===`card`&&`mt-1.5`,l;t[64]===c?l=t[65]:(l=d(c),t[64]=c,t[65]=l);let f;t[66]!==n.key||t[67]!==r?(f=B(r,n.key),t[66]=n.key,t[67]=r,t[68]=f):f=t[68];let m;t[69]!==n||t[70]!==o||t[71]!==r?(m=e=>o(H(r,n,e.target.value)),t[69]=n,t[70]=o,t[71]=r,t[72]=m):m=t[72];let h;t[73]!==n.placeholder||t[74]!==s||t[75]!==l||t[76]!==f||t[77]!==m?(h=(0,E.jsx)(v,{id:s,className:l,value:f,onChange:m,placeholder:n.placeholder,spellCheck:!1}),t[73]=n.placeholder,t[74]=s,t[75]=l,t[76]=f,t[77]=m,t[78]=h):h=t[78];let g;t[79]!==p||t[80]!==s||t[81]!==u||t[82]!==i||t[83]!==h?(g=(0,E.jsxs)(`label`,{htmlFor:s,className:i,children:[u,h,p]}),t[79]=p,t[80]=s,t[81]=u,t[82]=i,t[83]=h,t[84]=g):g=t[84];let _;return t[85]!==g||t[86]!==a?(_=(0,E.jsx)(G,{variant:a,children:g}),t[85]=g,t[86]=a,t[87]=_):_=t[87],_}let m=n.control===`password`?`password`:void 0,h=n.secret?C:S,g=n.secret?C:y,_=a===`card`&&`block`,T;t[88]===_?T=t[89]:(T=d(_),t[88]=_,t[89]=T);let D;t[90]!==h||t[91]!==g||t[92]!==n||t[93]!==s||t[94]!==o||t[95]!==m||t[96]!==r||t[97]!==a?(D=a===`card`?(0,E.jsx)(h,{id:s,size:`sm`,className:`mt-1.5`,type:n.secret?void 0:m,autoComplete:!n.secret&&n.control===`password`?`off`:void 0,value:B(r,n.key),onCommit:e=>o(H(r,n,e)),placeholder:n.placeholder,spellCheck:!1}):(0,E.jsx)(g,{id:s,type:n.secret?void 0:m,autoComplete:!n.secret&&n.control===`password`?`off`:void 0,value:B(r,n.key),onChange:e=>o(H(r,n,e.target.value)),placeholder:n.placeholder,spellCheck:!1}),t[90]=h,t[91]=g,t[92]=n,t[93]=s,t[94]=o,t[95]=m,t[96]=r,t[97]=a,t[98]=D):D=t[98];let O;t[99]!==p||t[100]!==s||t[101]!==u||t[102]!==T||t[103]!==D?(O=(0,E.jsxs)(`label`,{htmlFor:s,className:T,children:[u,D,p]}),t[99]=p,t[100]=s,t[101]=u,t[102]=T,t[103]=D,t[104]=O):O=t[104];let k;return t[105]!==O||t[106]!==a?(k=(0,E.jsx)(G,{variant:a,children:O}),t[105]=O,t[106]=a,t[107]=k):k=t[107],k}function q(e){let t=(0,w.c)(24),{definition:n,value:r,idPrefix:i,variant:a,onChange:o}=e,s;t[0]!==n||t[1]!==r?(s=N(n,r),t[0]=n,t[1]=r,t[2]=s):s=t[2];let c=s,l;t[3]!==n.driverKind||t[4]!==r?(l=n.driverKind===`acpRegistry`&&B(r,`source`)===`local`,t[3]=n.driverKind,t[4]=r,t[5]=l):l=t[5];let u=l;if(c.length===0)return null;let d;if(t[6]!==c||t[7]!==i||t[8]!==o||t[9]!==r||t[10]!==a){let e;t[12]!==i||t[13]!==o||t[14]!==r||t[15]!==a?(e=e=>(0,E.jsx)(K,{field:e,value:r,idPrefix:i,variant:a,onChange:o},e.key),t[12]=i,t[13]=o,t[14]=r,t[15]=a,t[16]=e):e=t[16],d=c.map(e),t[6]=c,t[7]=i,t[8]=o,t[9]=r,t[10]=a,t[11]=d}else d=t[11];let f;t[17]!==u||t[18]!==o||t[19]!==r?(f=u?(0,E.jsx)(L,{value:r,onChange:o}):null,t[17]=u,t[18]=o,t[19]=r,t[20]=f):f=t[20];let p;return t[21]!==d||t[22]!==f?(p=(0,E.jsxs)(E.Fragment,{children:[d,f]}),t[21]=d,t[22]=f,t[23]=p):p=t[23],p}export{N as n,q as t};
2
+ //# sourceMappingURL=ProviderSettingsForm-CXVYrIzw.js.map
@@ -1,6 +1,6 @@
1
- import{a as e,t}from"./react-DH3P2YXY.js";import{t as n}from"./jsx-runtime-BnjsACtP.js";import{$n as r,A as i,Ad as a,Bm as o,Ef as s,F as c,Fm as l,Md as u,Ms as d,Qd as ee,Uy as f,Wp as p,Xn as te,Yn as m,_p as ne,ar as re,dr as h,es as ie,fm as ae,nr as g,qf as oe,rr as _,sm as se,t as ce,tr as le,ur as ue}from"./utils-DhUt689t.js";import{R as v}from"./runtime-OeWFs5Hf.js";import{M as de}from"./runtime-Ca_Z-vg5.js";import{f as fe,g as pe,h as me,l as he,p as ge}from"./TooltipViewport-ThbbZQDo.js";import{i as _e}from"./toast-DXWclCrr.js";import{a as ve,n as ye,r as be,t as xe}from"./DiffFileTree-BySeJqhq.js";import{K as Se,s as Ce,v as we}from"./useSettings-gPlpTIWi.js";import{n as Te}from"./query-CfGzD8v6.js";import{t as y}from"./use-atom-command-vqjL7n-x.js";import{a as Ee,c as De,d as Oe,i as ke,l as Ae,s as je,u as b}from"./diffRendering-DtBTalAD.js";import{A as Me,D as Ne,E as Pe,F as Fe,I as Ie,O as Le,R as Re,T as ze,k as Be}from"./PanelLayoutControls-EIunk_2Q.js";import{t as Ve}from"./DiffCommentAnnotation-bhzNqujM.js";import{a as x,n as S,t as C}from"./tooltip-CY3W5y-f.js";import{n as He,t as w}from"./toggle-group-CYKsfBbD.js";import{d as Ue,l as We}from"./RenderErrorBoundary-Oe5BzG3n.js";import{r as T}from"./pullRequests-CMTRCOu7.js";import{N as Ge}from"./pullRequestDetail.logic-sbOM8yDW.js";import{t as Ke}from"./checkbox-BJhN1L_L.js";import{i as qe,n as Je,r as Ye,t as Xe}from"./pullRequestReviewStore-CIL8WfOG.js";import{_a as Ze,ga as Qe,ha as $e,ya as et}from"./main-VfCRP294.js";var E=e(t(),1),tt=new Set([`pnpm-lock.yaml`,`yarn.lock`,`package-lock.json`,`bun.lockb`,`Cargo.lock`,`go.sum`,`composer.lock`,`Gemfile.lock`]),nt=new Set([`__snapshots__`,`__generated__`,`dist`,`build`,`vendor`]),rt=new Set([`__tests__`,`tests`,`test`]),it=[`.ts`,`.tsx`,`.js`,`.jsx`,`.mjs`,`.cjs`];function at(e){let t=e.split(`/`),n=t.at(-1)??``;return tt.has(n)||n.endsWith(`.snap`)||n.endsWith(`.min.js`)||n.endsWith(`.min.css`)||/\.generated\./.test(n)||t.slice(0,-1).some(e=>nt.has(e))?`generated`:/\.(?:test|spec)\./.test(n)||t.slice(0,-1).some(e=>rt.has(e))?`test`:`source`}function ot(e){let t=e.lastIndexOf(`.`);return t>e.lastIndexOf(`/`)?e.slice(0,t):e}function D(e){return ot(e.split(`/`).at(-1)??``)}function st(e,t){let n=e.split(`/`).slice(0,-1);for(let e of t.split(`/`))e!==`.`&&e!==``&&(e===`..`?n.pop():n.push(e));return n.join(`/`)}var O=/(?:\bfrom|\bimport|\brequire\s*\()\s*\(?\s*["']([^"']+)["']/g;function k(e,t,n,r){let i=new Set;for(let a of t){O.lastIndex=0;let t=O.exec(a);for(;t!==null;){let o=t[1]??``,s=o.startsWith(`.`)?st(e,o):o,c=it.find(e=>s.endsWith(e)),l=c===void 0?s:s.slice(0,-c.length),u=n.get(l)??n.get(`${l}/index`)??r.get(D(l));u!==void 0&&u!==e&&i.add(u),t=O.exec(a)}}return i}function A(e,t){let n=new Set(e),r=[],i=[...e].sort((e,t)=>e.localeCompare(t));for(;n.size>0;){let e=i.filter(e=>n.has(e)),a=e.find(e=>[...t.get(e)??[]].every(e=>!n.has(e)))??e[0];n.delete(a),r.push(a)}return r}function ct(e){return(e.split(`/`).at(-1)??``).replace(/\.(?:test|spec)\..*$/,``).replace(/\.[^.]+$/,``)}function lt(e){let t=new Map;for(let n of e)t.set(b(n),n);let n=new Map;for(let e of t.keys())n.set(e,at(e));let r=[...t.keys()].filter(e=>n.get(e)===`source`),i=new Map,a=new Set,o=new Map;for(let e of r){i.set(ot(e),e);let t=D(e);o.has(t)&&a.add(t),o.set(t,e)}for(let e of a)o.delete(e);let s=new Map;for(let e of r){let n=t.get(e);s.set(e,k(e,[...n.additionLines,...n.deletionLines],i,o))}let c=A(r,s),l=new Map;c.forEach((e,t)=>{let n=D(e);l.has(n)||l.set(n,t)});let u=[...t.keys()].filter(e=>n.get(e)===`test`).sort((e,t)=>(l.get(ct(e))??2**53-1)-(l.get(ct(t))??2**53-1)||e.localeCompare(t)),d=[...t.keys()].filter(e=>n.get(e)===`generated`).sort((e,t)=>e.localeCompare(t));return[...c,...u,...d].map(e=>t.get(e))}function ut(e,t,n){return e.hunks.some(e=>t===`left`?n>=e.deletionStart&&n<e.deletionStart+e.deletionCount:n>=e.additionStart&&n<e.additionStart+e.additionCount)}function dt(e,t,n){let r=t===`folded`;return n.has(e)?!r:r}function ft(e,t,n,r){if(dt(e,n,r)===t)return r;let i=new Set(r);return i.has(e)?i.delete(e):i.add(e),i}function j(e){return e===null?null:new Map(e.files.map(e=>[e.path,e.state]))}function M(e){return e===`viewed`}function pt(e){return e===`dismissed`}function mt(e,t,n){return n.get(e)??M(t?.get(e))}function ht(e,t,n){return e.reduce((e,r)=>mt(r,t,n)?e+1:e,0)}function N(e,t,n,r){if(t===null||e.size===0)return e;let i=new Map(e);for(let[a,o]of e)n.has(a)||(r.has(a)||M(t.get(a))===o)&&i.delete(a);return i.size===e.size?e:i}function P(e,t,n){let r=new Map(e);for(let{path:e,viewed:i}of t)n.has(e)&&r.get(e)===i&&r.delete(e);return r.size===e.size?e:r}function gt(e){return[...e].map(([e,t])=>({path:e,viewed:t}))}var F=400,_t=new Map;function vt(e){let{environmentId:t,reference:n,enabled:r,paths:i}=e,a=Te(r?T.filesViewed({environmentId:t,input:n}):null),o=a.refresh,s=(0,E.useMemo)(()=>j(a.data),[a.data]),c=a.data?.truncated===!0,l=a.error,[u,d]=(0,E.useState)(_t),ee=y(T.setFilesViewed,{reportFailure:!1}),f=(0,E.useRef)(new Map),p=(0,E.useRef)(new Map),te=(0,E.useRef)(0),m=(0,E.useRef)(null),ne=`${t} ${n.projectId} ${n.repository} ${n.number}`,re=(0,E.useRef)(ne),h=(0,E.useRef)(new Map),ie=(0,E.useRef)(s);ie.current=s,(0,E.useEffect)(()=>{let e=new Set([...f.current.keys(),...p.current.keys()]),t=new Set;for(let[n,r]of h.current)e.has(n)||r===s||(t.add(n),h.current.delete(n));d(n=>N(n,s,e,t))},[s]);let ae=(0,E.useCallback)(()=>{m.current=null;let e=gt(f.current);if(e.length===0)return;f.current=new Map;let r=re.current,i=++te.current;for(let t of e)p.current.set(t.path,i);ee({environmentId:t,input:{...n,files:e}}).then(t=>{let n=e.map(e=>e.path).filter(e=>p.current.get(e)===i);for(let e of n)p.current.delete(e);if(re.current===r){if(t._tag===`Failure`){let r=new Set(n.filter(e=>!f.current.has(e)));d(t=>P(t,e,r)),r.size>0&&!v(t)&&_e.add({type:`error`,title:`Could not update viewed files`});return}for(let e of n)h.current.set(e,ie.current);o()}})},[t,n,o,ee]),g=(0,E.useRef)(ae);g.current=ae,(0,E.useEffect)(()=>{let e=g.current;return re.current=ne,()=>{m.current!==null&&(clearTimeout(m.current),e()),f.current=new Map,p.current=new Map,h.current=new Map,d(_t)}},[ne]);let oe=(0,E.useRef)(o);oe.current=o;let _=(0,E.useCallback)(()=>oe.current(),[]),se=(0,E.useCallback)((e,t)=>{d(n=>new Map(n).set(e,t)),f.current.set(e,t),m.current!==null&&clearTimeout(m.current),m.current=setTimeout(()=>g.current(),F)},[]),ce=(0,E.useCallback)(e=>mt(e,s,u),[u,s]),le=(0,E.useCallback)(e=>!u.has(e)&&pt(s?.get(e)),[u,s]),ue=(0,E.useMemo)(()=>ht(i,s,u),[u,i,s]);return(0,E.useMemo)(()=>({enabled:r,isViewed:ce,isStale:le,setViewed:se,viewedCount:ue,truncated:c,error:l,refresh:_}),[r,l,le,ce,_,se,c,ue])}var I=e(n(),1),yt=10,bt=`p4code.pullRequestFileTreeOpen`,xt=`
1
+ import{a as e,t}from"./react-DH3P2YXY.js";import{t as n}from"./jsx-runtime-BnjsACtP.js";import{$n as r,A as i,Ad as a,Bm as o,Ef as s,F as c,Fm as l,Md as u,Ms as d,Qd as ee,Uy as f,Wp as p,Xn as te,Yn as m,_p as ne,ar as re,dr as h,es as ie,fm as ae,nr as g,qf as oe,rr as _,sm as se,t as ce,tr as le,ur as ue}from"./utils-CBe1bHL7.js";import{R as v}from"./runtime-CeFhsGnm.js";import{M as de}from"./runtime-BOlBBevr.js";import{f as fe,g as pe,h as me,l as he,p as ge}from"./TooltipViewport-DJXNIjFt.js";import{i as _e}from"./toast-C61oyZY1.js";import{a as ve,n as ye,r as be,t as xe}from"./DiffFileTree-Dg3cvfi5.js";import{G as Se,_ as Ce,s as we}from"./useSettings-VTow9ZEM.js";import{n as Te}from"./query-B3Zo1YOE.js";import{t as y}from"./use-atom-command-Bt7x9oO0.js";import{a as Ee,c as De,d as Oe,i as ke,l as Ae,s as je,u as b}from"./diffRendering-MXukhqw1.js";import{A as Me,D as Ne,E as Pe,F as Fe,I as Ie,O as Le,R as Re,T as ze,k as Be}from"./PanelLayoutControls-clP6N7xc.js";import{t as Ve}from"./DiffCommentAnnotation-BOk2MTlv.js";import{a as x,n as S,t as C}from"./tooltip-ChmjT8Ns.js";import{n as He,t as w}from"./toggle-group-yF5GZ53o.js";import{d as Ue,l as We}from"./RenderErrorBoundary-BI5KBtsb.js";import{r as T}from"./pullRequests-DggtcbhA.js";import{N as Ge}from"./pullRequestDetail.logic-Bkh57WzV.js";import{t as Ke}from"./checkbox-4yBjrqWQ.js";import{i as qe,n as Je,r as Ye,t as Xe}from"./pullRequestReviewStore-BAxwf6rl.js";import{co as Ze,fo as Qe,lo as $e,uo as et}from"./main-DleJeMZO.js";var E=e(t(),1),tt=new Set([`pnpm-lock.yaml`,`yarn.lock`,`package-lock.json`,`bun.lockb`,`Cargo.lock`,`go.sum`,`composer.lock`,`Gemfile.lock`]),nt=new Set([`__snapshots__`,`__generated__`,`dist`,`build`,`vendor`]),rt=new Set([`__tests__`,`tests`,`test`]),it=[`.ts`,`.tsx`,`.js`,`.jsx`,`.mjs`,`.cjs`];function at(e){let t=e.split(`/`),n=t.at(-1)??``;return tt.has(n)||n.endsWith(`.snap`)||n.endsWith(`.min.js`)||n.endsWith(`.min.css`)||/\.generated\./.test(n)||t.slice(0,-1).some(e=>nt.has(e))?`generated`:/\.(?:test|spec)\./.test(n)||t.slice(0,-1).some(e=>rt.has(e))?`test`:`source`}function ot(e){let t=e.lastIndexOf(`.`);return t>e.lastIndexOf(`/`)?e.slice(0,t):e}function D(e){return ot(e.split(`/`).at(-1)??``)}function st(e,t){let n=e.split(`/`).slice(0,-1);for(let e of t.split(`/`))e!==`.`&&e!==``&&(e===`..`?n.pop():n.push(e));return n.join(`/`)}var O=/(?:\bfrom|\bimport|\brequire\s*\()\s*\(?\s*["']([^"']+)["']/g;function k(e,t,n,r){let i=new Set;for(let a of t){O.lastIndex=0;let t=O.exec(a);for(;t!==null;){let o=t[1]??``,s=o.startsWith(`.`)?st(e,o):o,c=it.find(e=>s.endsWith(e)),l=c===void 0?s:s.slice(0,-c.length),u=n.get(l)??n.get(`${l}/index`)??r.get(D(l));u!==void 0&&u!==e&&i.add(u),t=O.exec(a)}}return i}function A(e,t){let n=new Set(e),r=[],i=[...e].sort((e,t)=>e.localeCompare(t));for(;n.size>0;){let e=i.filter(e=>n.has(e)),a=e.find(e=>[...t.get(e)??[]].every(e=>!n.has(e)))??e[0];n.delete(a),r.push(a)}return r}function ct(e){return(e.split(`/`).at(-1)??``).replace(/\.(?:test|spec)\..*$/,``).replace(/\.[^.]+$/,``)}function lt(e){let t=new Map;for(let n of e)t.set(b(n),n);let n=new Map;for(let e of t.keys())n.set(e,at(e));let r=[...t.keys()].filter(e=>n.get(e)===`source`),i=new Map,a=new Set,o=new Map;for(let e of r){i.set(ot(e),e);let t=D(e);o.has(t)&&a.add(t),o.set(t,e)}for(let e of a)o.delete(e);let s=new Map;for(let e of r){let n=t.get(e);s.set(e,k(e,[...n.additionLines,...n.deletionLines],i,o))}let c=A(r,s),l=new Map;c.forEach((e,t)=>{let n=D(e);l.has(n)||l.set(n,t)});let u=[...t.keys()].filter(e=>n.get(e)===`test`).sort((e,t)=>(l.get(ct(e))??2**53-1)-(l.get(ct(t))??2**53-1)||e.localeCompare(t)),d=[...t.keys()].filter(e=>n.get(e)===`generated`).sort((e,t)=>e.localeCompare(t));return[...c,...u,...d].map(e=>t.get(e))}function ut(e,t,n){return e.hunks.some(e=>t===`left`?n>=e.deletionStart&&n<e.deletionStart+e.deletionCount:n>=e.additionStart&&n<e.additionStart+e.additionCount)}function dt(e,t,n){let r=t===`folded`;return n.has(e)?!r:r}function ft(e,t,n,r){if(dt(e,n,r)===t)return r;let i=new Set(r);return i.has(e)?i.delete(e):i.add(e),i}function j(e){return e===null?null:new Map(e.files.map(e=>[e.path,e.state]))}function M(e){return e===`viewed`}function pt(e){return e===`dismissed`}function mt(e,t,n){return n.get(e)??M(t?.get(e))}function ht(e,t,n){return e.reduce((e,r)=>mt(r,t,n)?e+1:e,0)}function N(e,t,n,r){if(t===null||e.size===0)return e;let i=new Map(e);for(let[a,o]of e)n.has(a)||(r.has(a)||M(t.get(a))===o)&&i.delete(a);return i.size===e.size?e:i}function P(e,t,n){let r=new Map(e);for(let{path:e,viewed:i}of t)n.has(e)&&r.get(e)===i&&r.delete(e);return r.size===e.size?e:r}function gt(e){return[...e].map(([e,t])=>({path:e,viewed:t}))}var F=400,_t=new Map;function vt(e){let{environmentId:t,reference:n,enabled:r,paths:i}=e,a=Te(r?T.filesViewed({environmentId:t,input:n}):null),o=a.refresh,s=(0,E.useMemo)(()=>j(a.data),[a.data]),c=a.data?.truncated===!0,l=a.error,[u,d]=(0,E.useState)(_t),ee=y(T.setFilesViewed,{reportFailure:!1}),f=(0,E.useRef)(new Map),p=(0,E.useRef)(new Map),te=(0,E.useRef)(0),m=(0,E.useRef)(null),ne=`${t} ${n.projectId} ${n.repository} ${n.number}`,re=(0,E.useRef)(ne),h=(0,E.useRef)(new Map),ie=(0,E.useRef)(s);ie.current=s,(0,E.useEffect)(()=>{let e=new Set([...f.current.keys(),...p.current.keys()]),t=new Set;for(let[n,r]of h.current)e.has(n)||r===s||(t.add(n),h.current.delete(n));d(n=>N(n,s,e,t))},[s]);let ae=(0,E.useCallback)(()=>{m.current=null;let e=gt(f.current);if(e.length===0)return;f.current=new Map;let r=re.current,i=++te.current;for(let t of e)p.current.set(t.path,i);ee({environmentId:t,input:{...n,files:e}}).then(t=>{let n=e.map(e=>e.path).filter(e=>p.current.get(e)===i);for(let e of n)p.current.delete(e);if(re.current===r){if(t._tag===`Failure`){let r=new Set(n.filter(e=>!f.current.has(e)));d(t=>P(t,e,r)),r.size>0&&!v(t)&&_e.add({type:`error`,title:`Could not update viewed files`});return}for(let e of n)h.current.set(e,ie.current);o()}})},[t,n,o,ee]),g=(0,E.useRef)(ae);g.current=ae,(0,E.useEffect)(()=>{let e=g.current;return re.current=ne,()=>{m.current!==null&&(clearTimeout(m.current),e()),f.current=new Map,p.current=new Map,h.current=new Map,d(_t)}},[ne]);let oe=(0,E.useRef)(o);oe.current=o;let _=(0,E.useCallback)(()=>oe.current(),[]),se=(0,E.useCallback)((e,t)=>{d(n=>new Map(n).set(e,t)),f.current.set(e,t),m.current!==null&&clearTimeout(m.current),m.current=setTimeout(()=>g.current(),F)},[]),ce=(0,E.useCallback)(e=>mt(e,s,u),[u,s]),le=(0,E.useCallback)(e=>!u.has(e)&&pt(s?.get(e)),[u,s]),ue=(0,E.useMemo)(()=>ht(i,s,u),[u,i,s]);return(0,E.useMemo)(()=>({enabled:r,isViewed:ce,isStale:le,setViewed:se,viewedCount:ue,truncated:c,error:l,refresh:_}),[r,l,le,ce,_,se,c,ue])}var I=e(n(),1),yt=10,bt=`p4code.pullRequestFileTreeOpen`,xt=`
2
2
  [data-diffs-header] [data-additions-count],
3
3
  [data-diffs-header] [data-deletions-count] {
4
4
  display: none !important;
5
- }`,St=[];function L({scrollerRef:e,environmentId:t,reference:n,detail:v,selectedCommitOid:tt,onSelectedCommitChange:nt,pendingFinding:rt,fixFindingLabel:it=`Fix in a thread`,onFixFinding:at,onAddToAgentSelection:ot,onRefresh:D,refreshToken:st=0,revealRequest:O=null}){let{resolvedTheme:k}=Se(),A=Ce(),[ct,j]=(0,E.useState)(()=>new Set),[M,pt]=(0,E.useState)(yt),[mt,ht]=(0,E.useState)(null),N=mt??(A.diffFilesCollapsed?`folded`:`expanded`),P=A.diffLayout,gt=we(),[F,_t]=(0,E.useState)(A.wordWrap),[L,Ct]=(0,E.useState)(A.diffIgnoreWhitespace),[wt,Tt]=d(bt,!1,f),[Et,R]=(0,E.useState)(null),[z,B]=(0,E.useState)(null),[Dt,Ot]=(0,E.useState)(!1),[kt,At]=(0,E.useState)(!1),[jt,Mt]=(0,E.useState)({key:``,cursor:null,slices:St}),Nt=(0,E.useRef)(new Map),[Pt,Ft]=(0,E.useState)(null),V=Je(n),H=tt,U=H===null?V:`${V}@${H}`;(0,E.useEffect)(()=>{B(null),R(null),j(new Set),ht(null),pt(yt),At(!1),Mt({key:U,cursor:null,slices:St}),Nt.current.clear()},[U]);let W=jt.key===U?jt.slices:St,G=jt.key===U?jt.cursor:null,K=Te(T.diff({environmentId:t,input:{...n,...G===null?{}:{cursor:G},...H===null?{}:{commit:H}}})),[It,Lt]=(0,E.useState)(0);(0,E.useEffect)(()=>{let e=K.data;e!==null&&Mt(t=>{let n=t.key===U?t.slices:St,r={cursor:G,patch:e.patch,truncated:e.truncated,nextCursor:e.nextCursor,omittedFileStats:e.omittedFileStats??[]},i=n.findIndex(e=>e.cursor===G);if(i===-1)return{key:U,cursor:G,slices:[...n,r]};let a=n[i];return a!==void 0&&a.patch===r.patch&&a.truncated===r.truncated&&a.nextCursor===r.nextCursor&&a.omittedFileStats.length===r.omittedFileStats.length&&a.omittedFileStats.every((e,t)=>{let n=r.omittedFileStats[t];return n!==void 0&&n.path===e.path&&n.additions===e.additions&&n.deletions===e.deletions})?t:{key:U,cursor:G,slices:[...n.slice(0,i),r]}})},[G,K.data,It,U]);let Rt=ie(T.diff({environmentId:t,input:{...n,...H===null?{}:{commit:H}}})),zt=V,Bt=Ye(n),Vt=qe(e=>e.addComment),Ht=qe(e=>e.removeComment),Ut=y(T.replyToThread,{reportFailure:!1}),Wt=y(T.setThreadResolution,{reportFailure:!1}),Gt=y(T.updateComment,{reportFailure:!1}),Kt=y(T.threadComments,{reportFailure:!1}),qt=y(T.diffFileContents),Jt=(0,E.useMemo)(()=>Fe(qt,{environmentId:t,reference:n,commit:H,cacheKey:`pull-request:${V}:${v.updatedAt}:${H??`all`}`}),[H,v.updatedAt,t,qt,n,V]),q=(0,E.useMemo)(()=>{let e=v.capabilities.review,t=v.viewerPermissions;return{inlineComment:e.inlineComment&&t.comment,reply:e.reply&&t.comment,resolve:e.resolve&&t.resolve}},[v.capabilities.review,v.viewerPermissions]),Yt=q.inlineComment&&H===null,J=(0,E.useMemo)(()=>W.map(e=>{let t=`pull-request:${U}:${k}:${L}:${e.cursor??`first`}:${Ee(e.patch)}`,n=Nt.current.get(t);if(n)return n;let r=De(e.patch,t,{compactPartialHunkOffsets:!0,ignoreWhitespace:L});return r&&Nt.current.set(t,r),r}),[W,k,U,L]),Y=(0,E.useMemo)(()=>J.flatMap(e=>e?.kind===`files`?lt(e.files):[]),[J]),Xt=(0,E.useMemo)(()=>Y.map(e=>b(e)),[Y]),Zt=v.capabilities.viewedFiles,X=vt({environmentId:t,reference:n,enabled:Zt!==void 0,paths:Xt}),{setViewed:Qt,refresh:$t,enabled:en,isViewed:tn,isStale:nn}=X,rn=(0,E.useRef)(st);(0,E.useEffect)(()=>{rn.current!==st&&(rn.current=st,Mt({key:U,cursor:null,slices:St}),Lt(e=>e+1),Rt(),$t())},[st,U,Rt,$t]);let Z=W.at(-1)?.nextCursor??null,an=W.some(e=>e.truncated)||J.some(e=>e?.kind===`raw`),on=(0,E.useMemo)(()=>{let e=new Set;if(H!==null)return e;for(let t of Y){let n=b(t);for(let r of v.reviewThreads)r.path===n&&r.line!==null&&ut(t,r.side,r.line)&&e.add(r.id)}return e},[H,v.reviewThreads,Y]),sn=(0,E.useMemo)(()=>Y.map(e=>{let t=ke(e),n=b(e),r=new Map,i=(e,t)=>{let n=`${e}:${t}`,i=r.get(n);if(i)return i;let a={side:e,line:t,threads:[],pending:[],draft:!1};return r.set(n,a),a};for(let e of v.reviewThreads)e.path===n&&e.line!==null&&on.has(e.id)&&i(e.side,e.line).threads.push(e);if(H===null)for(let e of Bt){if(e.path!==n)continue;let t=Ne(e.position);i(t.side,t.line).pending.push(e)}if(z?.fileKey===t){let e=Ne(z.position);i(e.side,e.line).draft=!0}let a=[...r.values()].map(e=>({side:Le(e.side),lineNumber:e.line,metadata:{threads:e.threads,pending:e.pending,draft:e.draft}}));return{fileKey:t,path:n,fileDiff:e,annotations:a,annotationsVersion:Ee(a.map(({side:e,lineNumber:t,metadata:n})=>`${e}:${t}:${n.draft?`d`:``}:${n.pending.map(e=>`${e.id}:${e.body}`).join(`,`)}:${n.threads.map(e=>`${e.id}:${e.isResolved?`r`:``}:${e.isOutdated?`o`:``}:${e.comments.map(e=>`${e.id}:${e.author?.login??``}:${e.createdAt}:${e.body}:${(e.reactions??[]).map(e=>`${e.content}:${e.count}:${e.viewerHasReacted?`v`:``}`).join(`,`)}`).join(`;`)}`).join(`,`)}`).join(`|`))}}),[H,v.reviewThreads,z,Y,Bt,on]),Q=(0,E.useMemo)(()=>sn.map(({fileKey:e,path:t,fileDiff:n,annotations:r,annotationsVersion:i})=>{let a=dt(e,N,ct),o=en?`e${tn(t)?`v`:``}${nn(t)?`s`:``}`:``;return{id:e,type:`diff`,fileDiff:n,annotations:r,collapsed:a,version:Ee(`${a?`1`:`0`}:${o}:${i}`)}}),[sn,en,N,tn,nn,ct]),cn=(0,E.useMemo)(()=>new Map(W.flatMap(e=>e.omittedFileStats.map(e=>[e.path,e]))),[W]),ln=(0,E.useMemo)(()=>new Map(J.flatMap(e=>e?.kind===`files`?e.files.map((t,n)=>[ke(t),je([e.sourceFiles[n]??t])]):[])),[J]),un=(0,E.useMemo)(()=>Q.map(e=>e.id),[Q]),dn=(0,E.useMemo)(()=>new Set(Q.filter(e=>e.collapsed===!0).map(e=>e.id)),[Q]),fn=be(un,dn),pn=(0,E.useMemo)(()=>ye(Y),[Y]),mn=Z!==null&&Z!==G&&!K.isPending&&K.error===null,hn=(0,E.useCallback)(()=>{Z!==null&&Mt(e=>({...e,cursor:Z}))},[Z]),[gn,_n]=(0,E.useState)(null);(0,E.useEffect)(()=>{if(gn===null||!mn)return;let e=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&hn()},{rootMargin:`240px`});return e.observe(gn),()=>e.disconnect()},[mn,hn,gn]);let vn=(0,E.useCallback)(e=>j(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),[]),yn=(0,E.useCallback)((e,t,n)=>{Qt(t,n),j(t=>ft(e,n,N,t))},[N,Qt]),bn=ve(Pt,U),xn=(0,E.useCallback)(e=>{let t=Q.find(t=>b(t.fileDiff)===e);t!==void 0&&(t.collapsed===!0&&vn(t.id),bn(t.id))},[Q,bn,vn]),Sn=(0,E.useRef)(null);(0,E.useEffect)(()=>{if(O!==null&&Sn.current!==O.nonce){if(!Q.some(e=>b(e.fileDiff)===O.path)){mn&&hn();return}Sn.current=O.nonce,xn(O.path)}},[mn,Q,hn,xn,O]);let Cn=()=>{ht(be(un,dn)?`expanded`:`folded`),j(new Set)},$=(0,E.useMemo)(()=>v.commits.toSorted((e,t)=>Date.parse(t.committedDate)-Date.parse(e.committedDate)),[v.commits]),wn=(0,E.useCallback)((e,t)=>{if(!e||!Yt)return;let n=t.item;if(n.type!==`diff`)return;let r=Y.find(e=>ke(e)===n.id);if(!r)return;let i=b(r),a=Oe(r),o=J.flatMap(e=>e?.kind===`files`?e.sourceFiles:[]).find(e=>b(e)===i),s=e.endSide??e.side,l=(o&&c(o,e.end,s))??c(r,e.end,s);l!==null&&B({fileKey:n.id,path:i,oldPath:a===i?null:a,position:l,range:e})},[Yt,Y,J]),Tn=(0,E.useCallback)((e,t,n)=>{let r=Y.find(t=>ke(t)===e.fileKey),a=r===void 0?null:i({id:`pull-request-selection:${e.fileKey}:${e.range.start}:${e.range.end}`,sectionId:`pull-request:${v.number}`,sectionTitle:`PR #${v.number} review`,filePath:e.path,fileDiff:r,range:e.range,text:t});B(null),R(null),a!==null&&n(a)},[v.number,Y]),En=(0,E.useCallback)(()=>Z===null?null:(0,I.jsx)(`div`,{ref:_n,className:`flex items-center justify-center gap-2 py-2 text-xs text-muted-foreground`,children:K.error===null?K.isPending?`Loading more files...`:null:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`span`,{children:`The rest of this diff could not be loaded.`}),(0,I.jsx)(h,{size:`xs`,variant:`outline`,onClick:()=>K.refresh(),children:`Retry`})]})}),[Z,K.error,K.isPending,K.refresh]),Dn=(0,E.useCallback)(e=>{let t=e.collapsed===!0;return(0,I.jsx)(h,{size:`icon-micro`,variant:`ghost-muted`,"aria-expanded":!t,"aria-label":t?`Expand diff`:`Collapse diff`,className:`mr-1`,onClick:t=>{t.stopPropagation(),vn(e.id)},children:(0,I.jsx)(he,{className:`size-4`,icon:t?ge:fe})})},[vn]),On=(0,E.useRef)(X);On.current=X;let kn=(0,E.useRef)(yn);kn.current=yn;let An=(0,E.useCallback)(e=>{if(e.type!==`diff`)return null;let{additions:t,deletions:n}=ln.get(e.id)??je([e.fileDiff]),r=b(e.fileDiff);if(t===0&&n===0){let e=cn.get(r);e&&({additions:t,deletions:n}=e)}let i=(0,I.jsx)(We,{additions:t,deletions:n,className:`font-mono text-2xs`}),a=On.current;if(!a.enabled)return i;let o=a.isViewed(r),s=a.isStale(r);return(0,I.jsxs)(`span`,{className:`flex items-center gap-3`,children:[i,(0,I.jsxs)(`label`,{"data-viewed-toggle":``,className:`flex cursor-pointer select-none items-center gap-1.5 text-2xs text-muted-foreground`,onClick:e=>e.stopPropagation(),children:[(0,I.jsx)(Ke,{"aria-label":s?`Changed`:`Viewed`,checked:o,onCheckedChange:t=>kn.current(e.id,r,t===!0)}),s?(0,I.jsxs)(C,{children:[(0,I.jsx)(x,{render:(0,I.jsx)(`span`,{className:`text-warning-foreground`}),children:`Changed`}),(0,I.jsx)(S,{side:`bottom`,children:`This file has been pushed to since you marked it viewed.`})]}):(0,I.jsx)(`span`,{className:`@max-xs:hidden`,children:`Viewed`})]})]})},[cn,ln]),jn=(0,E.useMemo)(()=>({diffStyle:P===`split`?`split`:`unified`,lineDiffType:`none`,overflow:F?`wrap`:`scroll`,theme:Ae(k),preferredHighlighter:et,themeType:k,stickyHeaders:!0,loadDiffFiles:Jt,enableGutterUtility:Yt&&z===null,enableLineSelection:Yt&&z===null,onGutterUtilityClick:wn,onLineSelectionEnd:wn}),[P,F,k,Jt,Yt,z,wn]),Mn=(0,E.useCallback)(async(e,t)=>{if(Dt)return!1;Ot(!0);let n=await t();return Ot(!1),n._tag===`Failure`?(_e.add({type:`error`,title:e}),!1):(D(),!0)},[D,Dt]),Nn=(0,E.useCallback)(e=>(0,I.jsx)(Pe,{thread:e,workspaceRoot:v.workspaceRoot,canReply:q.reply,canResolve:q.resolve&&Me(v,e),canReact:v.capabilities.reactions===!0,environmentId:t,reference:n,pending:Dt,fixPending:rt===Ge({kind:`thread`,thread:e}),fixLabel:it,...at?{onFix:()=>at({kind:`thread`,thread:e})}:{},onLoadMore:async r=>{let i=await Kt({environmentId:t,input:{...n,threadId:e.id,cursor:r}});return i._tag===`Failure`?(_e.add({type:`error`,title:`More comments could not be loaded`}),null):i.value},onReply:r=>Mn(`Reply could not be posted`,()=>Ut({environmentId:t,input:{...n,threadId:e.id,body:r}})),canEditComment:e=>Be(v,{author:e.author,kind:`review-comment`,canEdit:e.canEdit}),onEditComment:(e,r)=>Mn(`The comment could not be saved`,()=>Gt({environmentId:t,input:{...n,commentId:e,kind:`review-comment`,body:r}})),onToggleResolved:()=>void Mn(`The conversation could not be updated`,()=>Wt({environmentId:t,input:{...n,threadId:e.id,resolved:!e.isResolved}})),onReacted:D},`${n.projectId}#${n.number}:${e.id}`),[v,t,it,Kt,D,at,rt,n,Ut,q.reply,q.resolve,Mn,Wt,Dt,Gt]),Pn=(0,E.useCallback)(e=>(0,I.jsxs)(`div`,{className:`py-1 font-sans text-foreground`,children:[e.metadata.threads.map(Nn),e.metadata.pending.map(e=>(0,I.jsx)(ze,{comment:e,onRemove:()=>Ht(zt,e.id)},e.id)),e.metadata.draft&&z?(0,I.jsx)(Ve,{kind:`draft`,rangeLabel:`${z.path}:${Ne(z.position).line}`,text:``,submitLabel:`Add to review`,...ot?{secondaryAction:{label:`Add to agent`,onAction:e=>Tn(z,e,t=>ot({comment:t,request:e}))}}:{},onCancel:()=>{B(null),R(null)},onComment:e=>{Vt(zt,{id:Xe(),path:z.path,...z.oldPath===null?{}:{oldPath:z.oldPath},position:z.position,body:e}),B(null),R(null)}}):null]}),[Vt,z,Tn,ot,Ht,Nn,zt]),Fn=$.find(e=>e.oid===H);(0,E.useEffect)(()=>{H!==null&&Fn===void 0&&nt(null)},[H,nt,Fn]);let In=Fn?Fn.messageHeadline:`All commits`,Ln=e=>{Ct(e),B(null),R(null)},Rn=(0,I.jsxs)(`div`,{className:`@container flex h-10 min-h-10 shrink-0 items-center justify-between gap-2 border-b border-border/60 bg-background px-4 text-xs text-muted-foreground`,children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[$.length>0?(0,I.jsxs)(m,{children:[(0,I.jsxs)(ue,{render:(0,I.jsx)(h,{size:`xs`,variant:`secondary`}),className:`min-w-0 max-w-64`,"aria-label":`Diff scope: ${In}`,children:[(0,I.jsx)(`span`,{className:`truncate`,children:In}),(0,I.jsx)(a,{className:`size-3.5 shrink-0 opacity-70`})]}),(0,I.jsxs)(le,{align:`start`,className:`max-w-[min(28rem,calc(100vw-2rem))]`,children:[(0,I.jsxs)(g,{value:H??`all`,onValueChange:e=>nt(e===`all`?null:e),children:[(0,I.jsx)(_,{value:`all`,closeOnClick:!0,children:(0,I.jsx)(`span`,{children:`All commits`})}),$.slice(0,M).map(e=>(0,I.jsx)(_,{value:e.oid,closeOnClick:!0,children:(0,I.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,I.jsxs)(C,{children:[(0,I.jsx)(x,{render:(0,I.jsx)(`span`,{className:`min-w-0 truncate`,children:e.messageHeadline})}),(0,I.jsx)(S,{side:`top`,children:e.messageHeadline})]}),(0,I.jsx)(`span`,{className:`ml-auto shrink-0 font-mono text-xs text-muted-foreground`,children:e.oid.slice(0,7)})]})},e.oid))]}),$.length>M?(0,I.jsx)(r,{closeOnClick:!1,onClick:()=>pt(e=>e+yt),children:(0,I.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Show more (`,$.length-M,` left)`]})}):null]})]}):null,(0,I.jsxs)(Ue,{children:[(0,I.jsxs)(`span`,{className:`shrink-0 tabular-nums`,children:[Y.length,` `,Y.length===1?`file`:`files`,Z===null?``:`+`]}),X.enabled&&Y.length>0?(0,I.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 tabular-nums`,children:[(0,I.jsxs)(`span`,{className:`shrink-0`,children:[X.viewedCount,` / `,Y.length]}),(0,I.jsx)(`span`,{className:`truncate`,children:Zt===`environment`?`viewed in ${de}`:`viewed`}),Zt===`environment`?(0,I.jsxs)(C,{children:[(0,I.jsx)(x,{render:(0,I.jsx)(`span`,{className:`flex shrink-0 items-center`}),children:(0,I.jsx)(oe,{"aria-label":`These ticks are kept here, not on the host`,className:`text-muted-foreground size-3.5`})}),(0,I.jsx)(S,{side:`bottom`,children:`This host keeps no shared record of which files you have read, so these ticks are kept by this environment. They follow you between the apps connected to it, but the host's own web UI will not show them.`})]}):null,X.error===null?null:(0,I.jsxs)(C,{children:[(0,I.jsx)(x,{render:(0,I.jsx)(`span`,{className:`flex shrink-0 items-center`}),children:(0,I.jsx)(o,{"aria-label":`Your ticks could not be read`,className:`size-3.5 text-warning-foreground`})}),(0,I.jsxs)(S,{side:`bottom`,children:[`The boxes below are whatever was last read, and empty if nothing has been read yet. `,X.error]})]}),X.truncated?(0,I.jsxs)(C,{children:[(0,I.jsx)(x,{render:(0,I.jsx)(`span`,{className:`flex shrink-0 items-center`}),children:(0,I.jsx)(o,{"aria-label":`This count covers only part of the change`,className:`size-3.5 text-warning-foreground`})}),(0,I.jsx)(S,{side:`bottom`,children:`This change has more files than the host will report ticks for in one read, so the count is short and some boxes below start empty.`})]}):null]}):null,an?(0,I.jsxs)(C,{children:[(0,I.jsx)(x,{render:(0,I.jsx)(`span`,{className:`flex shrink-0 items-center`}),children:(0,I.jsx)(o,{"aria-label":`Some of this diff was not shown`,className:`size-3.5 text-warning-foreground`})}),(0,I.jsx)(S,{side:`bottom`,children:`The host withheld part of this diff — a binary file, or a change too large to inline.`})]}):null,H!==null&&q.inlineComment?(0,I.jsxs)(C,{children:[(0,I.jsx)(x,{render:(0,I.jsx)(`span`,{className:`flex shrink-0 items-center`}),children:(0,I.jsx)(ne,{"aria-label":`Line comments are written from the whole change`,className:`size-3.5`})}),(0,I.jsx)(S,{side:`bottom`,children:`A comment is anchored to the whole change, so switch to All commits to write one.`})]}):null]})]}),(0,I.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,I.jsxs)(m,{children:[(0,I.jsxs)(C,{children:[(0,I.jsx)(x,{render:(0,I.jsx)(ue,{render:(0,I.jsx)(h,{size:`icon-sm`,variant:`ghost`}),className:`@lg:hidden`,"aria-label":`Diff options`}),children:(0,I.jsx)(ae,{className:`size-3.5`})}),(0,I.jsx)(S,{side:`top`,children:`Diff options`})]}),(0,I.jsxs)(le,{align:`end`,children:[(0,I.jsx)(te,{checked:L,onCheckedChange:e=>Ln(e),children:`Hide whitespace changes`}),(0,I.jsx)(te,{checked:F,onCheckedChange:e=>_t(e),children:`Wrap lines`}),(0,I.jsx)(re,{}),(0,I.jsxs)(g,{value:P,onValueChange:e=>{(e===`stacked`||e===`split`)&&gt({diffLayout:e})},children:[(0,I.jsx)(_,{value:`stacked`,closeOnClick:!0,children:`Stacked`}),(0,I.jsx)(_,{value:`split`,closeOnClick:!0,children:`Split`})]})]})]}),(0,I.jsxs)(`div`,{className:`hidden items-center gap-1 @lg:flex`,children:[(0,I.jsxs)(C,{children:[(0,I.jsx)(x,{render:(0,I.jsx)(w,{"aria-label":L?`Show whitespace changes`:`Hide whitespace changes`,variant:`ghost`,size:`sm`,pressed:L,onPressedChange:e=>Ln(!!e)}),children:(0,I.jsx)(p,{className:`size-3.5`})}),(0,I.jsx)(S,{side:`top`,children:L?`Show whitespace changes`:`Hide whitespace changes`})]}),(0,I.jsxs)(He,{"aria-label":`Diff layout`,className:`shrink-0`,variant:`segmented`,value:[P],onValueChange:e=>{let t=e[0];(t===`stacked`||t===`split`)&&gt({diffLayout:t})},children:[(0,I.jsx)(w,{"aria-label":`Stacked diff view`,value:`stacked`,children:(0,I.jsx)(se,{className:`size-3.5`})}),(0,I.jsx)(w,{"aria-label":`Split diff view`,value:`split`,children:(0,I.jsx)(ee,{className:`size-3.5`})})]}),(0,I.jsxs)(C,{children:[(0,I.jsx)(x,{render:(0,I.jsx)(w,{"aria-label":F?`Disable diff line wrapping`:`Enable diff line wrapping`,variant:`ghost`,size:`sm`,pressed:F,onPressedChange:e=>{_t(!!e)}}),children:(0,I.jsx)(l,{className:`size-3.5`})}),(0,I.jsx)(S,{side:`top`,children:F?`Disable line wrapping`:`Enable line wrapping`})]})]}),un.length>0?(0,I.jsx)(h,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":fn?`Expand all files`:`Collapse all files`,onClick:Cn,children:(0,I.jsx)(he,{className:`size-3.5`,icon:fn?pe:me})}):null,un.length>0?(0,I.jsxs)(C,{children:[(0,I.jsx)(x,{render:(0,I.jsx)(w,{"aria-label":wt?`Hide file tree`:`Show file tree`,variant:`ghost`,size:`sm`,pressed:wt,onPressedChange:e=>Tt(!!e)}),children:(0,I.jsx)(s,{className:`size-3.5`})}),(0,I.jsx)(S,{side:`top`,children:wt?`Hide file tree`:`Show file tree`})]}):null]})]}),zn=t=>(0,I.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[Rn,(0,I.jsx)(`div`,{ref:e,className:`min-h-0 flex-1 overflow-auto`,children:t})]});if(K.isPending&&W.length===0)return zn((0,I.jsx)(Re,{label:`Loading pull request diff...`}));if(K.error&&W.length===0)return zn((0,I.jsx)(`p`,{className:`px-4 py-5 text-sm text-muted-foreground`,children:K.error}));let Bn=Z===null?J.flatMap(e=>e?.kind===`raw`?[e]:[]):[];if(Y.length===0&&Bn.length>0)return zn((0,I.jsx)(`div`,{className:`space-y-4 px-4 py-5`,children:Bn.map(e=>(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.reason}),(0,I.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs`,children:e.text})]},`${e.reason}:${e.text.slice(0,64)}`))}));if(Q.length===0&&Z===null)return zn((0,I.jsx)(`p`,{className:`px-4 py-5 text-sm text-muted-foreground`,children:H===null?`This pull request has no file changes.`:`This commit has no file changes.`}));let Vn=v.reviewThreads.filter(e=>!on.has(e.id)),Hn=new Map;for(let e of Vn){let t=Hn.get(e.path);t?t.push(e):Hn.set(e.path,[e])}let Un=Bn.length===0?null:(0,I.jsx)(`div`,{className:`space-y-4 border-t border-border/60 px-4 py-5`,children:Bn.map(e=>(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.reason}),(0,I.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs`,children:e.text})]},`${e.reason}:${e.text.slice(0,64)}`))});return(0,I.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[Rn,Hn.size>0?(0,I.jsx)(`div`,{className:`shrink-0 border-b border-border/60`,children:(0,I.jsxs)($e,{open:kt,onOpenChange:At,children:[(0,I.jsx)(`h2`,{children:(0,I.jsxs)(Ze,{className:`flex w-full items-center gap-1.5 px-4 py-2 text-left text-xs text-muted-foreground`,children:[(0,I.jsx)(`span`,{children:Z===null?`Conversations not on the current diff`:`Conversations not on the diff loaded so far`}),(0,I.jsx)(u,{"aria-hidden":!0,className:ce(`size-3.5 transition-transform`,kt&&`rotate-90`)}),(0,I.jsx)(`span`,{"aria-hidden":!0,className:`tabular-nums`,children:Vn.length}),(0,I.jsx)(`span`,{className:`sr-only`,children:Vn.length===1?`1 conversation`:`${Vn.length} conversations`})]})}),(0,I.jsx)(Qe,{children:(0,I.jsx)(`div`,{className:`max-h-64 space-y-3 overflow-auto px-4 pb-3`,children:[...Hn].map(([e,t])=>(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(C,{children:[(0,I.jsx)(x,{render:(0,I.jsx)(`p`,{className:`truncate px-3 text-xs text-muted-foreground`,children:e})}),(0,I.jsx)(S,{side:`top`,children:e})]}),(0,I.jsx)(`div`,{className:`mt-1 space-y-2`,children:t.map(e=>(0,I.jsxs)(`div`,{children:[e.line===null?null:(0,I.jsxs)(`p`,{className:`px-3 text-xs text-muted-foreground`,children:[`Line `,e.line]}),Nn(e)]},e.id))})]},e))})})]})}):null,(0,I.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[(0,I.jsx)(`div`,{className:`relative min-h-0 min-w-0 flex-1`,onClickCapture:e=>{let t=e.nativeEvent.composedPath?.()??[];for(let e of t)if(e instanceof HTMLElement){if(e instanceof HTMLButtonElement||e instanceof HTMLAnchorElement||e.hasAttribute(`data-viewed-toggle`))return;if(e.hasAttribute(`data-diffs-header`)){let t=e.querySelector(`[data-title]`)?.textContent?.trim();if(t===void 0||t===``)return;let n=Q.find(e=>b(e.fileDiff)===t);n!==void 0&&vn(n.id);return}}},children:(0,I.jsx)(Ie,{className:`@container h-full overflow-auto [scrollbar-gutter:stable]`,containerRef:e,viewerRef:Ft,items:Q,selectedLines:Et,onSelectedLinesChange:R,options:jn,renderCodeViewFooter:En,renderHeaderPrefix:Dn,renderHeaderMetadata:An,renderAnnotation:Pn,onRevealSearchMatch:e=>j(t=>ft(e.id,!1,N,t)),unsafeCSSExtra:xt})}),wt?(0,I.jsx)(`aside`,{className:`flex w-[min(20rem,40%)] min-w-48 shrink-0 border-l border-border/60`,children:(0,I.jsx)(xe,{ariaLabel:`Pull request #${v.number} files`,entries:pn,onSelectFile:xn,footer:Z===null?null:(0,I.jsx)(`div`,{className:`shrink-0 border-t border-border/60 p-2`,children:(0,I.jsx)(h,{type:`button`,size:`xs`,variant:`outline`,className:`w-full`,disabled:K.isPending,onClick:K.error===null?hn:()=>K.refresh(),children:K.error===null?K.isPending?`Loading more files...`:`Load more files`:`Retry`})})})}):null]}),Un]})}export{L as default};
6
- //# sourceMappingURL=PullRequestCodeTab-Co76Qf6Z.js.map
5
+ }`,St=[];function L({scrollerRef:e,environmentId:t,reference:n,detail:v,selectedCommitOid:tt,onSelectedCommitChange:nt,pendingFinding:rt,fixFindingLabel:it=`Fix in a thread`,onFixFinding:at,onAddToAgentSelection:ot,onRefresh:D,refreshToken:st=0,revealRequest:O=null}){let{resolvedTheme:k}=Se(),A=we(),[ct,j]=(0,E.useState)(()=>new Set),[M,pt]=(0,E.useState)(yt),[mt,ht]=(0,E.useState)(null),N=mt??(A.diffFilesCollapsed?`folded`:`expanded`),P=A.diffLayout,gt=Ce(),[F,_t]=(0,E.useState)(A.wordWrap),[L,Ct]=(0,E.useState)(A.diffIgnoreWhitespace),[wt,Tt]=d(bt,!1,f),[Et,R]=(0,E.useState)(null),[z,B]=(0,E.useState)(null),[Dt,Ot]=(0,E.useState)(!1),[kt,At]=(0,E.useState)(!1),[jt,Mt]=(0,E.useState)({key:``,cursor:null,slices:St}),Nt=(0,E.useRef)(new Map),[Pt,Ft]=(0,E.useState)(null),V=Je(n),H=tt,U=H===null?V:`${V}@${H}`;(0,E.useEffect)(()=>{B(null),R(null),j(new Set),ht(null),pt(yt),At(!1),Mt({key:U,cursor:null,slices:St}),Nt.current.clear()},[U]);let W=jt.key===U?jt.slices:St,G=jt.key===U?jt.cursor:null,K=Te(T.diff({environmentId:t,input:{...n,...G===null?{}:{cursor:G},...H===null?{}:{commit:H}}})),[It,Lt]=(0,E.useState)(0);(0,E.useEffect)(()=>{let e=K.data;e!==null&&Mt(t=>{let n=t.key===U?t.slices:St,r={cursor:G,patch:e.patch,truncated:e.truncated,nextCursor:e.nextCursor,omittedFileStats:e.omittedFileStats??[]},i=n.findIndex(e=>e.cursor===G);if(i===-1)return{key:U,cursor:G,slices:[...n,r]};let a=n[i];return a!==void 0&&a.patch===r.patch&&a.truncated===r.truncated&&a.nextCursor===r.nextCursor&&a.omittedFileStats.length===r.omittedFileStats.length&&a.omittedFileStats.every((e,t)=>{let n=r.omittedFileStats[t];return n!==void 0&&n.path===e.path&&n.additions===e.additions&&n.deletions===e.deletions})?t:{key:U,cursor:G,slices:[...n.slice(0,i),r]}})},[G,K.data,It,U]);let Rt=ie(T.diff({environmentId:t,input:{...n,...H===null?{}:{commit:H}}})),zt=V,Bt=Ye(n),Vt=qe(e=>e.addComment),Ht=qe(e=>e.removeComment),Ut=y(T.replyToThread,{reportFailure:!1}),Wt=y(T.setThreadResolution,{reportFailure:!1}),Gt=y(T.updateComment,{reportFailure:!1}),Kt=y(T.threadComments,{reportFailure:!1}),qt=y(T.diffFileContents),Jt=(0,E.useMemo)(()=>Fe(qt,{environmentId:t,reference:n,commit:H,cacheKey:`pull-request:${V}:${v.updatedAt}:${H??`all`}`}),[H,v.updatedAt,t,qt,n,V]),q=(0,E.useMemo)(()=>{let e=v.capabilities.review,t=v.viewerPermissions;return{inlineComment:e.inlineComment&&t.comment,reply:e.reply&&t.comment,resolve:e.resolve&&t.resolve}},[v.capabilities.review,v.viewerPermissions]),Yt=q.inlineComment&&H===null,J=(0,E.useMemo)(()=>W.map(e=>{let t=`pull-request:${U}:${k}:${L}:${e.cursor??`first`}:${Ee(e.patch)}`,n=Nt.current.get(t);if(n)return n;let r=De(e.patch,t,{compactPartialHunkOffsets:!0,ignoreWhitespace:L});return r&&Nt.current.set(t,r),r}),[W,k,U,L]),Y=(0,E.useMemo)(()=>J.flatMap(e=>e?.kind===`files`?lt(e.files):[]),[J]),Xt=(0,E.useMemo)(()=>Y.map(e=>b(e)),[Y]),Zt=v.capabilities.viewedFiles,X=vt({environmentId:t,reference:n,enabled:Zt!==void 0,paths:Xt}),{setViewed:Qt,refresh:$t,enabled:en,isViewed:tn,isStale:nn}=X,rn=(0,E.useRef)(st);(0,E.useEffect)(()=>{rn.current!==st&&(rn.current=st,Mt({key:U,cursor:null,slices:St}),Lt(e=>e+1),Rt(),$t())},[st,U,Rt,$t]);let Z=W.at(-1)?.nextCursor??null,an=W.some(e=>e.truncated)||J.some(e=>e?.kind===`raw`),on=(0,E.useMemo)(()=>{let e=new Set;if(H!==null)return e;for(let t of Y){let n=b(t);for(let r of v.reviewThreads)r.path===n&&r.line!==null&&ut(t,r.side,r.line)&&e.add(r.id)}return e},[H,v.reviewThreads,Y]),sn=(0,E.useMemo)(()=>Y.map(e=>{let t=ke(e),n=b(e),r=new Map,i=(e,t)=>{let n=`${e}:${t}`,i=r.get(n);if(i)return i;let a={side:e,line:t,threads:[],pending:[],draft:!1};return r.set(n,a),a};for(let e of v.reviewThreads)e.path===n&&e.line!==null&&on.has(e.id)&&i(e.side,e.line).threads.push(e);if(H===null)for(let e of Bt){if(e.path!==n)continue;let t=Ne(e.position);i(t.side,t.line).pending.push(e)}if(z?.fileKey===t){let e=Ne(z.position);i(e.side,e.line).draft=!0}let a=[...r.values()].map(e=>({side:Le(e.side),lineNumber:e.line,metadata:{threads:e.threads,pending:e.pending,draft:e.draft}}));return{fileKey:t,path:n,fileDiff:e,annotations:a,annotationsVersion:Ee(a.map(({side:e,lineNumber:t,metadata:n})=>`${e}:${t}:${n.draft?`d`:``}:${n.pending.map(e=>`${e.id}:${e.body}`).join(`,`)}:${n.threads.map(e=>`${e.id}:${e.isResolved?`r`:``}:${e.isOutdated?`o`:``}:${e.comments.map(e=>`${e.id}:${e.author?.login??``}:${e.createdAt}:${e.body}:${(e.reactions??[]).map(e=>`${e.content}:${e.count}:${e.viewerHasReacted?`v`:``}`).join(`,`)}`).join(`;`)}`).join(`,`)}`).join(`|`))}}),[H,v.reviewThreads,z,Y,Bt,on]),Q=(0,E.useMemo)(()=>sn.map(({fileKey:e,path:t,fileDiff:n,annotations:r,annotationsVersion:i})=>{let a=dt(e,N,ct),o=en?`e${tn(t)?`v`:``}${nn(t)?`s`:``}`:``;return{id:e,type:`diff`,fileDiff:n,annotations:r,collapsed:a,version:Ee(`${a?`1`:`0`}:${o}:${i}`)}}),[sn,en,N,tn,nn,ct]),cn=(0,E.useMemo)(()=>new Map(W.flatMap(e=>e.omittedFileStats.map(e=>[e.path,e]))),[W]),ln=(0,E.useMemo)(()=>new Map(J.flatMap(e=>e?.kind===`files`?e.files.map((t,n)=>[ke(t),je([e.sourceFiles[n]??t])]):[])),[J]),un=(0,E.useMemo)(()=>Q.map(e=>e.id),[Q]),dn=(0,E.useMemo)(()=>new Set(Q.filter(e=>e.collapsed===!0).map(e=>e.id)),[Q]),fn=be(un,dn),pn=(0,E.useMemo)(()=>ye(Y),[Y]),mn=Z!==null&&Z!==G&&!K.isPending&&K.error===null,hn=(0,E.useCallback)(()=>{Z!==null&&Mt(e=>({...e,cursor:Z}))},[Z]),[gn,_n]=(0,E.useState)(null);(0,E.useEffect)(()=>{if(gn===null||!mn)return;let e=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&hn()},{rootMargin:`240px`});return e.observe(gn),()=>e.disconnect()},[mn,hn,gn]);let vn=(0,E.useCallback)(e=>j(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),[]),yn=(0,E.useCallback)((e,t,n)=>{Qt(t,n),j(t=>ft(e,n,N,t))},[N,Qt]),bn=ve(Pt,U),xn=(0,E.useCallback)(e=>{let t=Q.find(t=>b(t.fileDiff)===e);t!==void 0&&(t.collapsed===!0&&vn(t.id),bn(t.id))},[Q,bn,vn]),Sn=(0,E.useRef)(null);(0,E.useEffect)(()=>{if(O!==null&&Sn.current!==O.nonce){if(!Q.some(e=>b(e.fileDiff)===O.path)){mn&&hn();return}Sn.current=O.nonce,xn(O.path)}},[mn,Q,hn,xn,O]);let Cn=()=>{ht(be(un,dn)?`expanded`:`folded`),j(new Set)},$=(0,E.useMemo)(()=>v.commits.toSorted((e,t)=>Date.parse(t.committedDate)-Date.parse(e.committedDate)),[v.commits]),wn=(0,E.useCallback)((e,t)=>{if(!e||!Yt)return;let n=t.item;if(n.type!==`diff`)return;let r=Y.find(e=>ke(e)===n.id);if(!r)return;let i=b(r),a=Oe(r),o=J.flatMap(e=>e?.kind===`files`?e.sourceFiles:[]).find(e=>b(e)===i),s=e.endSide??e.side,l=(o&&c(o,e.end,s))??c(r,e.end,s);l!==null&&B({fileKey:n.id,path:i,oldPath:a===i?null:a,position:l,range:e})},[Yt,Y,J]),Tn=(0,E.useCallback)((e,t,n)=>{let r=Y.find(t=>ke(t)===e.fileKey),a=r===void 0?null:i({id:`pull-request-selection:${e.fileKey}:${e.range.start}:${e.range.end}`,sectionId:`pull-request:${v.number}`,sectionTitle:`PR #${v.number} review`,filePath:e.path,fileDiff:r,range:e.range,text:t});B(null),R(null),a!==null&&n(a)},[v.number,Y]),En=(0,E.useCallback)(()=>Z===null?null:(0,I.jsx)(`div`,{ref:_n,className:`flex items-center justify-center gap-2 py-2 text-xs text-muted-foreground`,children:K.error===null?K.isPending?`Loading more files...`:null:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`span`,{children:`The rest of this diff could not be loaded.`}),(0,I.jsx)(h,{size:`xs`,variant:`outline`,onClick:()=>K.refresh(),children:`Retry`})]})}),[Z,K.error,K.isPending,K.refresh]),Dn=(0,E.useCallback)(e=>{let t=e.collapsed===!0;return(0,I.jsx)(h,{size:`icon-micro`,variant:`ghost-muted`,"aria-expanded":!t,"aria-label":t?`Expand diff`:`Collapse diff`,className:`mr-1`,onClick:t=>{t.stopPropagation(),vn(e.id)},children:(0,I.jsx)(he,{className:`size-4`,icon:t?ge:fe})})},[vn]),On=(0,E.useRef)(X);On.current=X;let kn=(0,E.useRef)(yn);kn.current=yn;let An=(0,E.useCallback)(e=>{if(e.type!==`diff`)return null;let{additions:t,deletions:n}=ln.get(e.id)??je([e.fileDiff]),r=b(e.fileDiff);if(t===0&&n===0){let e=cn.get(r);e&&({additions:t,deletions:n}=e)}let i=(0,I.jsx)(We,{additions:t,deletions:n,className:`font-mono text-2xs`}),a=On.current;if(!a.enabled)return i;let o=a.isViewed(r),s=a.isStale(r);return(0,I.jsxs)(`span`,{className:`flex items-center gap-3`,children:[i,(0,I.jsxs)(`label`,{"data-viewed-toggle":``,className:`flex cursor-pointer select-none items-center gap-1.5 text-2xs text-muted-foreground`,onClick:e=>e.stopPropagation(),children:[(0,I.jsx)(Ke,{"aria-label":s?`Changed`:`Viewed`,checked:o,onCheckedChange:t=>kn.current(e.id,r,t===!0)}),s?(0,I.jsxs)(C,{children:[(0,I.jsx)(x,{render:(0,I.jsx)(`span`,{className:`text-warning-foreground`}),children:`Changed`}),(0,I.jsx)(S,{side:`bottom`,children:`This file has been pushed to since you marked it viewed.`})]}):(0,I.jsx)(`span`,{className:`@max-xs:hidden`,children:`Viewed`})]})]})},[cn,ln]),jn=(0,E.useMemo)(()=>({diffStyle:P===`split`?`split`:`unified`,lineDiffType:`none`,overflow:F?`wrap`:`scroll`,theme:Ae(k),preferredHighlighter:Qe,themeType:k,stickyHeaders:!0,loadDiffFiles:Jt,enableGutterUtility:Yt&&z===null,enableLineSelection:Yt&&z===null,onGutterUtilityClick:wn,onLineSelectionEnd:wn}),[P,F,k,Jt,Yt,z,wn]),Mn=(0,E.useCallback)(async(e,t)=>{if(Dt)return!1;Ot(!0);let n=await t();return Ot(!1),n._tag===`Failure`?(_e.add({type:`error`,title:e}),!1):(D(),!0)},[D,Dt]),Nn=(0,E.useCallback)(e=>(0,I.jsx)(Pe,{thread:e,workspaceRoot:v.workspaceRoot,canReply:q.reply,canResolve:q.resolve&&Me(v,e),canReact:v.capabilities.reactions===!0,environmentId:t,reference:n,pending:Dt,fixPending:rt===Ge({kind:`thread`,thread:e}),fixLabel:it,...at?{onFix:()=>at({kind:`thread`,thread:e})}:{},onLoadMore:async r=>{let i=await Kt({environmentId:t,input:{...n,threadId:e.id,cursor:r}});return i._tag===`Failure`?(_e.add({type:`error`,title:`More comments could not be loaded`}),null):i.value},onReply:r=>Mn(`Reply could not be posted`,()=>Ut({environmentId:t,input:{...n,threadId:e.id,body:r}})),canEditComment:e=>Be(v,{author:e.author,kind:`review-comment`,canEdit:e.canEdit}),onEditComment:(e,r)=>Mn(`The comment could not be saved`,()=>Gt({environmentId:t,input:{...n,commentId:e,kind:`review-comment`,body:r}})),onToggleResolved:()=>void Mn(`The conversation could not be updated`,()=>Wt({environmentId:t,input:{...n,threadId:e.id,resolved:!e.isResolved}})),onReacted:D},`${n.projectId}#${n.number}:${e.id}`),[v,t,it,Kt,D,at,rt,n,Ut,q.reply,q.resolve,Mn,Wt,Dt,Gt]),Pn=(0,E.useCallback)(e=>(0,I.jsxs)(`div`,{className:`py-1 font-sans text-foreground`,children:[e.metadata.threads.map(Nn),e.metadata.pending.map(e=>(0,I.jsx)(ze,{comment:e,onRemove:()=>Ht(zt,e.id)},e.id)),e.metadata.draft&&z?(0,I.jsx)(Ve,{kind:`draft`,rangeLabel:`${z.path}:${Ne(z.position).line}`,text:``,submitLabel:`Add to review`,...ot?{secondaryAction:{label:`Add to agent`,onAction:e=>Tn(z,e,t=>ot({comment:t,request:e}))}}:{},onCancel:()=>{B(null),R(null)},onComment:e=>{Vt(zt,{id:Xe(),path:z.path,...z.oldPath===null?{}:{oldPath:z.oldPath},position:z.position,body:e}),B(null),R(null)}}):null]}),[Vt,z,Tn,ot,Ht,Nn,zt]),Fn=$.find(e=>e.oid===H);(0,E.useEffect)(()=>{H!==null&&Fn===void 0&&nt(null)},[H,nt,Fn]);let In=Fn?Fn.messageHeadline:`All commits`,Ln=e=>{Ct(e),B(null),R(null)},Rn=(0,I.jsxs)(`div`,{className:`@container flex h-10 min-h-10 shrink-0 items-center justify-between gap-2 border-b border-border/60 bg-background px-4 text-xs text-muted-foreground`,children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[$.length>0?(0,I.jsxs)(m,{children:[(0,I.jsxs)(ue,{render:(0,I.jsx)(h,{size:`xs`,variant:`secondary`}),className:`min-w-0 max-w-64`,"aria-label":`Diff scope: ${In}`,children:[(0,I.jsx)(`span`,{className:`truncate`,children:In}),(0,I.jsx)(a,{className:`size-3.5 shrink-0 opacity-70`})]}),(0,I.jsxs)(le,{align:`start`,className:`max-w-[min(28rem,calc(100vw-2rem))]`,children:[(0,I.jsxs)(g,{value:H??`all`,onValueChange:e=>nt(e===`all`?null:e),children:[(0,I.jsx)(_,{value:`all`,closeOnClick:!0,children:(0,I.jsx)(`span`,{children:`All commits`})}),$.slice(0,M).map(e=>(0,I.jsx)(_,{value:e.oid,closeOnClick:!0,children:(0,I.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,I.jsxs)(C,{children:[(0,I.jsx)(x,{render:(0,I.jsx)(`span`,{className:`min-w-0 truncate`,children:e.messageHeadline})}),(0,I.jsx)(S,{side:`top`,children:e.messageHeadline})]}),(0,I.jsx)(`span`,{className:`ml-auto shrink-0 font-mono text-xs text-muted-foreground`,children:e.oid.slice(0,7)})]})},e.oid))]}),$.length>M?(0,I.jsx)(r,{closeOnClick:!1,onClick:()=>pt(e=>e+yt),children:(0,I.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Show more (`,$.length-M,` left)`]})}):null]})]}):null,(0,I.jsxs)(Ue,{children:[(0,I.jsxs)(`span`,{className:`shrink-0 tabular-nums`,children:[Y.length,` `,Y.length===1?`file`:`files`,Z===null?``:`+`]}),X.enabled&&Y.length>0?(0,I.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 tabular-nums`,children:[(0,I.jsxs)(`span`,{className:`shrink-0`,children:[X.viewedCount,` / `,Y.length]}),(0,I.jsx)(`span`,{className:`truncate`,children:Zt===`environment`?`viewed in ${de}`:`viewed`}),Zt===`environment`?(0,I.jsxs)(C,{children:[(0,I.jsx)(x,{render:(0,I.jsx)(`span`,{className:`flex shrink-0 items-center`}),children:(0,I.jsx)(oe,{"aria-label":`These ticks are kept here, not on the host`,className:`text-muted-foreground size-3.5`})}),(0,I.jsx)(S,{side:`bottom`,children:`This host keeps no shared record of which files you have read, so these ticks are kept by this environment. They follow you between the apps connected to it, but the host's own web UI will not show them.`})]}):null,X.error===null?null:(0,I.jsxs)(C,{children:[(0,I.jsx)(x,{render:(0,I.jsx)(`span`,{className:`flex shrink-0 items-center`}),children:(0,I.jsx)(o,{"aria-label":`Your ticks could not be read`,className:`size-3.5 text-warning-foreground`})}),(0,I.jsxs)(S,{side:`bottom`,children:[`The boxes below are whatever was last read, and empty if nothing has been read yet. `,X.error]})]}),X.truncated?(0,I.jsxs)(C,{children:[(0,I.jsx)(x,{render:(0,I.jsx)(`span`,{className:`flex shrink-0 items-center`}),children:(0,I.jsx)(o,{"aria-label":`This count covers only part of the change`,className:`size-3.5 text-warning-foreground`})}),(0,I.jsx)(S,{side:`bottom`,children:`This change has more files than the host will report ticks for in one read, so the count is short and some boxes below start empty.`})]}):null]}):null,an?(0,I.jsxs)(C,{children:[(0,I.jsx)(x,{render:(0,I.jsx)(`span`,{className:`flex shrink-0 items-center`}),children:(0,I.jsx)(o,{"aria-label":`Some of this diff was not shown`,className:`size-3.5 text-warning-foreground`})}),(0,I.jsx)(S,{side:`bottom`,children:`The host withheld part of this diff — a binary file, or a change too large to inline.`})]}):null,H!==null&&q.inlineComment?(0,I.jsxs)(C,{children:[(0,I.jsx)(x,{render:(0,I.jsx)(`span`,{className:`flex shrink-0 items-center`}),children:(0,I.jsx)(ne,{"aria-label":`Line comments are written from the whole change`,className:`size-3.5`})}),(0,I.jsx)(S,{side:`bottom`,children:`A comment is anchored to the whole change, so switch to All commits to write one.`})]}):null]})]}),(0,I.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,I.jsxs)(m,{children:[(0,I.jsxs)(C,{children:[(0,I.jsx)(x,{render:(0,I.jsx)(ue,{render:(0,I.jsx)(h,{size:`icon-sm`,variant:`ghost`}),className:`@lg:hidden`,"aria-label":`Diff options`}),children:(0,I.jsx)(ae,{className:`size-3.5`})}),(0,I.jsx)(S,{side:`top`,children:`Diff options`})]}),(0,I.jsxs)(le,{align:`end`,children:[(0,I.jsx)(te,{checked:L,onCheckedChange:e=>Ln(e),children:`Hide whitespace changes`}),(0,I.jsx)(te,{checked:F,onCheckedChange:e=>_t(e),children:`Wrap lines`}),(0,I.jsx)(re,{}),(0,I.jsxs)(g,{value:P,onValueChange:e=>{(e===`stacked`||e===`split`)&&gt({diffLayout:e})},children:[(0,I.jsx)(_,{value:`stacked`,closeOnClick:!0,children:`Stacked`}),(0,I.jsx)(_,{value:`split`,closeOnClick:!0,children:`Split`})]})]})]}),(0,I.jsxs)(`div`,{className:`hidden items-center gap-1 @lg:flex`,children:[(0,I.jsxs)(C,{children:[(0,I.jsx)(x,{render:(0,I.jsx)(w,{"aria-label":L?`Show whitespace changes`:`Hide whitespace changes`,variant:`ghost`,size:`sm`,pressed:L,onPressedChange:e=>Ln(!!e)}),children:(0,I.jsx)(p,{className:`size-3.5`})}),(0,I.jsx)(S,{side:`top`,children:L?`Show whitespace changes`:`Hide whitespace changes`})]}),(0,I.jsxs)(He,{"aria-label":`Diff layout`,className:`shrink-0`,variant:`segmented`,value:[P],onValueChange:e=>{let t=e[0];(t===`stacked`||t===`split`)&&gt({diffLayout:t})},children:[(0,I.jsx)(w,{"aria-label":`Stacked diff view`,value:`stacked`,children:(0,I.jsx)(se,{className:`size-3.5`})}),(0,I.jsx)(w,{"aria-label":`Split diff view`,value:`split`,children:(0,I.jsx)(ee,{className:`size-3.5`})})]}),(0,I.jsxs)(C,{children:[(0,I.jsx)(x,{render:(0,I.jsx)(w,{"aria-label":F?`Disable diff line wrapping`:`Enable diff line wrapping`,variant:`ghost`,size:`sm`,pressed:F,onPressedChange:e=>{_t(!!e)}}),children:(0,I.jsx)(l,{className:`size-3.5`})}),(0,I.jsx)(S,{side:`top`,children:F?`Disable line wrapping`:`Enable line wrapping`})]})]}),un.length>0?(0,I.jsx)(h,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":fn?`Expand all files`:`Collapse all files`,onClick:Cn,children:(0,I.jsx)(he,{className:`size-3.5`,icon:fn?pe:me})}):null,un.length>0?(0,I.jsxs)(C,{children:[(0,I.jsx)(x,{render:(0,I.jsx)(w,{"aria-label":wt?`Hide file tree`:`Show file tree`,variant:`ghost`,size:`sm`,pressed:wt,onPressedChange:e=>Tt(!!e)}),children:(0,I.jsx)(s,{className:`size-3.5`})}),(0,I.jsx)(S,{side:`top`,children:wt?`Hide file tree`:`Show file tree`})]}):null]})]}),zn=t=>(0,I.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[Rn,(0,I.jsx)(`div`,{ref:e,className:`min-h-0 flex-1 overflow-auto`,children:t})]});if(K.isPending&&W.length===0)return zn((0,I.jsx)(Re,{label:`Loading pull request diff...`}));if(K.error&&W.length===0)return zn((0,I.jsx)(`p`,{className:`px-4 py-5 text-sm text-muted-foreground`,children:K.error}));let Bn=Z===null?J.flatMap(e=>e?.kind===`raw`?[e]:[]):[];if(Y.length===0&&Bn.length>0)return zn((0,I.jsx)(`div`,{className:`space-y-4 px-4 py-5`,children:Bn.map(e=>(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.reason}),(0,I.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs`,children:e.text})]},`${e.reason}:${e.text.slice(0,64)}`))}));if(Q.length===0&&Z===null)return zn((0,I.jsx)(`p`,{className:`px-4 py-5 text-sm text-muted-foreground`,children:H===null?`This pull request has no file changes.`:`This commit has no file changes.`}));let Vn=v.reviewThreads.filter(e=>!on.has(e.id)),Hn=new Map;for(let e of Vn){let t=Hn.get(e.path);t?t.push(e):Hn.set(e.path,[e])}let Un=Bn.length===0?null:(0,I.jsx)(`div`,{className:`space-y-4 border-t border-border/60 px-4 py-5`,children:Bn.map(e=>(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.reason}),(0,I.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs`,children:e.text})]},`${e.reason}:${e.text.slice(0,64)}`))});return(0,I.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[Rn,Hn.size>0?(0,I.jsx)(`div`,{className:`shrink-0 border-b border-border/60`,children:(0,I.jsxs)(Ze,{open:kt,onOpenChange:At,children:[(0,I.jsx)(`h2`,{children:(0,I.jsxs)(et,{className:`flex w-full items-center gap-1.5 px-4 py-2 text-left text-xs text-muted-foreground`,children:[(0,I.jsx)(`span`,{children:Z===null?`Conversations not on the current diff`:`Conversations not on the diff loaded so far`}),(0,I.jsx)(u,{"aria-hidden":!0,className:ce(`size-3.5 transition-transform`,kt&&`rotate-90`)}),(0,I.jsx)(`span`,{"aria-hidden":!0,className:`tabular-nums`,children:Vn.length}),(0,I.jsx)(`span`,{className:`sr-only`,children:Vn.length===1?`1 conversation`:`${Vn.length} conversations`})]})}),(0,I.jsx)($e,{children:(0,I.jsx)(`div`,{className:`max-h-64 space-y-3 overflow-auto px-4 pb-3`,children:[...Hn].map(([e,t])=>(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(C,{children:[(0,I.jsx)(x,{render:(0,I.jsx)(`p`,{className:`truncate px-3 text-xs text-muted-foreground`,children:e})}),(0,I.jsx)(S,{side:`top`,children:e})]}),(0,I.jsx)(`div`,{className:`mt-1 space-y-2`,children:t.map(e=>(0,I.jsxs)(`div`,{children:[e.line===null?null:(0,I.jsxs)(`p`,{className:`px-3 text-xs text-muted-foreground`,children:[`Line `,e.line]}),Nn(e)]},e.id))})]},e))})})]})}):null,(0,I.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[(0,I.jsx)(`div`,{className:`relative min-h-0 min-w-0 flex-1`,onClickCapture:e=>{let t=e.nativeEvent.composedPath?.()??[];for(let e of t)if(e instanceof HTMLElement){if(e instanceof HTMLButtonElement||e instanceof HTMLAnchorElement||e.hasAttribute(`data-viewed-toggle`))return;if(e.hasAttribute(`data-diffs-header`)){let t=e.querySelector(`[data-title]`)?.textContent?.trim();if(t===void 0||t===``)return;let n=Q.find(e=>b(e.fileDiff)===t);n!==void 0&&vn(n.id);return}}},children:(0,I.jsx)(Ie,{className:`@container h-full overflow-auto [scrollbar-gutter:stable]`,containerRef:e,viewerRef:Ft,items:Q,selectedLines:Et,onSelectedLinesChange:R,options:jn,renderCodeViewFooter:En,renderHeaderPrefix:Dn,renderHeaderMetadata:An,renderAnnotation:Pn,onRevealSearchMatch:e=>j(t=>ft(e.id,!1,N,t)),unsafeCSSExtra:xt})}),wt?(0,I.jsx)(`aside`,{className:`flex w-[min(20rem,40%)] min-w-48 shrink-0 border-l border-border/60`,children:(0,I.jsx)(xe,{ariaLabel:`Pull request #${v.number} files`,entries:pn,onSelectFile:xn,footer:Z===null?null:(0,I.jsx)(`div`,{className:`shrink-0 border-t border-border/60 p-2`,children:(0,I.jsx)(h,{type:`button`,size:`xs`,variant:`outline`,className:`w-full`,disabled:K.isPending,onClick:K.error===null?hn:()=>K.refresh(),children:K.error===null?K.isPending?`Loading more files...`:`Load more files`:`Retry`})})})}):null]}),Un]})}export{L as default};
6
+ //# sourceMappingURL=PullRequestCodeTab-DaXxo4Bs.js.map
@@ -1,4 +1,4 @@
1
- import{_ as e,d as t,f as n,g as r,l as i,o as a,r as o,s,t as c,y as l}from"./77XECAW3-D_lZqaZv.js";import{a as u,i as d,l as f,s as p,u as m}from"./N3JZAHOW-Cev8Cn9M.js";import{a as h,t as g}from"./DKTLEL5E-DciMwFJ1.js";import{n as _,r as v}from"./74OO7NKP-h3ga2-vb.js";import{i as y,n as b,r as x,t as S}from"./NUIALGQ3-CV92Kt25.js";import{a as C,i as w,o as T,r as E,t as D}from"./5N7A7DKN-udLyT643.js";import{t as ee}from"./7WLXJQOR-D6QVYUu9.js";import{a as te,i as O,t as k}from"./ABYRPUBD-BPWfXZyu.js";import{n as A,t as j}from"./FTXIJQGB-CggtIYAM.js";import{PeleError as M,_ as ne,i as N,m as re,n as P,r as F,u as I}from"./lazy-CeaQ3-Fj.js";var L=new Map([[`task`,`roundedRect`],[`tool`,`subroutine`],[`input`,`lean-right`],[`decision`,`diamond`],[`refdoc`,`lin-doc`],[`action`,`hexagon`],[`round`,`rect`]]),R=new Set(`doc.stadium.terminal.circle.trapezoid.inv_trapezoid.inv-trapezoid.doublecircle.double-circle.typeDeclaration.procs.lean_left.lean-left.in-out.cylinder.ellipse.odd.tag-rect.tagged-rectangle.delay.half-rounded-rectangle.lin-rect.lined-rectangle.win-pane.window-pane.curv-trap.curved-trapezoid`.split(`.`)),z=new Set([`roundedRect`,`subroutine`,`subprocess`,`subproc`,`framed-rectangle`,`lean-right`,`diamond`,`lin-doc`,`lined-document`,`hexagon`,`hex`,`connector`,`collapsedGroup`]),B=`roundedRect`;function V(e){return e&&(L.get(e)??e)}function ie(e){return j(e)||e===`constructor`}function ae(e,t){for(let n of e)n.isGroup||((!n.shape||n.shape===`squareRect`||n.shape===`rect`)&&(n.shape=B),R.has(n.shape)?(t.emitError(`SHAPE_REMOVED`,`shape "${n.shape}" was removed in v0.8.1, using "${B}"`,{nodeId:n.id}),n.shape=B):z.has(n.shape)||(t.emitWarning(`SHAPE_UNSUPPORTED`,`shape "${n.shape}" is not supported, using "${B}"`,{nodeId:n.id}),n.shape=B))}var oe=new Set([`shape`,`view`,`icon`,`img`,`form`,`pos`,`w`,`h`,`class`,`style`,`labelType`]),H=new Set([`subroutine`,`subprocess`,`subproc`,`framed-rectangle`,`tool`]);function se(e){return H.has(e.type)}function U(e){return e===`markdown`||e===`string`||e===`text`?e:`markdown`}function ce(e){return e.startsWith(`"`)&&e.endsWith(`"`)?e.substring(1,e.length-1):e}function W(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function G(e){let t=e=>Array.isArray(e)?[]:W(e)?{}:e,n=t(e),r=[[e,n]];for(;r.length>0;){let[e,n]=r.pop();if(Array.isArray(e))for(let i of e){let e=t(i);n.push(e),typeof i==`object`&&i&&r.push([i,e])}else if(W(e))for(let i of Object.keys(e)){if(i===`__proto__`||i===`constructor`||i===`prototype`)continue;let a=e[i],o=t(a);n[i]=o,typeof a==`object`&&a&&r.push([a,o])}}return n}function K(e,t){return Object.assign(e??{},t)}var q=/:\s*[>|][\d+-]*\s*$/,le=/,([\t ]*)$/;function ue(e){let t=!1,n=!1,r=0,i,a=[];for(let o of e.split(`
1
+ import{_ as e,d as t,f as n,g as r,l as i,o as a,r as o,s,t as c,y as l}from"./77XECAW3-ECBcD47O.js";import{a as u,i as d,l as f,s as p,u as m}from"./N3JZAHOW-CPZZhC9o.js";import{a as h,t as g}from"./DKTLEL5E-DciMwFJ1.js";import{n as _,r as v}from"./74OO7NKP-CceNos-7.js";import{i as y,n as b,r as x,t as S}from"./NUIALGQ3-Bapg3pv1.js";import{a as C,i as w,o as T,r as E,t as D}from"./5N7A7DKN-BR8rdHwZ.js";import{t as ee}from"./7WLXJQOR-D6QVYUu9.js";import{a as te,i as O,t as k}from"./ABYRPUBD-B4F4wZam.js";import{n as A,t as j}from"./FTXIJQGB-CggtIYAM.js";import{PeleError as M,_ as ne,i as N,m as re,n as P,r as F,u as I}from"./lazy-Ccs3klKO.js";var L=new Map([[`task`,`roundedRect`],[`tool`,`subroutine`],[`input`,`lean-right`],[`decision`,`diamond`],[`refdoc`,`lin-doc`],[`action`,`hexagon`],[`round`,`rect`]]),R=new Set(`doc.stadium.terminal.circle.trapezoid.inv_trapezoid.inv-trapezoid.doublecircle.double-circle.typeDeclaration.procs.lean_left.lean-left.in-out.cylinder.ellipse.odd.tag-rect.tagged-rectangle.delay.half-rounded-rectangle.lin-rect.lined-rectangle.win-pane.window-pane.curv-trap.curved-trapezoid`.split(`.`)),z=new Set([`roundedRect`,`subroutine`,`subprocess`,`subproc`,`framed-rectangle`,`lean-right`,`diamond`,`lin-doc`,`lined-document`,`hexagon`,`hex`,`connector`,`collapsedGroup`]),B=`roundedRect`;function V(e){return e&&(L.get(e)??e)}function ie(e){return j(e)||e===`constructor`}function ae(e,t){for(let n of e)n.isGroup||((!n.shape||n.shape===`squareRect`||n.shape===`rect`)&&(n.shape=B),R.has(n.shape)?(t.emitError(`SHAPE_REMOVED`,`shape "${n.shape}" was removed in v0.8.1, using "${B}"`,{nodeId:n.id}),n.shape=B):z.has(n.shape)||(t.emitWarning(`SHAPE_UNSUPPORTED`,`shape "${n.shape}" is not supported, using "${B}"`,{nodeId:n.id}),n.shape=B))}var oe=new Set([`shape`,`view`,`icon`,`img`,`form`,`pos`,`w`,`h`,`class`,`style`,`labelType`]),H=new Set([`subroutine`,`subprocess`,`subproc`,`framed-rectangle`,`tool`]);function se(e){return H.has(e.type)}function U(e){return e===`markdown`||e===`string`||e===`text`?e:`markdown`}function ce(e){return e.startsWith(`"`)&&e.endsWith(`"`)?e.substring(1,e.length-1):e}function W(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function G(e){let t=e=>Array.isArray(e)?[]:W(e)?{}:e,n=t(e),r=[[e,n]];for(;r.length>0;){let[e,n]=r.pop();if(Array.isArray(e))for(let i of e){let e=t(i);n.push(e),typeof i==`object`&&i&&r.push([i,e])}else if(W(e))for(let i of Object.keys(e)){if(i===`__proto__`||i===`constructor`||i===`prototype`)continue;let a=e[i],o=t(a);n[i]=o,typeof a==`object`&&a&&r.push([a,o])}}return n}function K(e,t){return Object.assign(e??{},t)}var q=/:\s*[>|][\d+-]*\s*$/,le=/,([\t ]*)$/;function ue(e){let t=!1,n=!1,r=0,i,a=[];for(let o of e.split(`
2
2
  `)){if(i!==void 0){let e=o.length-o.trimStart().length;if(o.trim()===``||e>i){a.push(o);continue}i=void 0}let e=-1;for(let i=0;i<o.length;i++){let a=o[i];if(n)a===`\\`?i++:a===`"`&&(n=!1);else if(t)a===`'`&&(t=!1);else if(a===`"`)n=!0;else if(a===`'`)t=!0;else if(a===`#`&&(i===0||o[i-1]===` `||o[i-1]===` `)){e=i;break}else a===`[`||a===`{`?r++:(a===`]`||a===`}`)&&(r=Math.max(0,r-1))}if(t||n||r>0){a.push(o);continue}let s=e>=0?o.slice(0,e):o,c=e>=0?o.slice(e):``;if(q.test(s)){i=o.length-o.trimStart().length,a.push(o);continue}a.push(s.replace(le,`$1`)+c)}return a.join(`
3
3
  `)}function de(e,t){if(e===`arrow_point`&&t===`normal`)return`sequence`;if(e===`arrow_cross`&&t===`normal`)return`failure`;if(e===`arrow_open`&&t===`dotted`)return`reference`}function fe(e){let t=e.trim(),n=t.slice(0,-1),r=`arrow_open`;switch(t.slice(-1)){case`x`:r=`arrow_cross`;break;case`>`:r=`arrow_point`;break;case`-`:case`.`:n=t}let i=`normal`,a=n.length-1,o=0;for(let e=0;e<n.length;e++)n[e]===`.`&&o++;return o>0&&(i=`dotted`,a=o),{type:r,stroke:i,length:a}}function J(e){if(!e)return;let t={},n=!1;for(let r of Object.keys(e))oe.has(r)||(t[r]=e[r],n=!0);return n?t:void 0}var pe=class{type=`agentflow`;direction;nodes=new Map;edges=[];subgraphs=[];connectors=new Map;classes=new Map;tooltips=new Map;defaultEdgeStyle;defaultInterpolate;mappings=[];diagnostics=[];title;accTitle;accDescr;lineOffset;subgraphLookup=new Map;globalNodes=new Set;members=new Set;edgeById=new Map;pairCount=new Map;subCount=0;bareMappings=new Set;firstMapping=new Map;reported=new Map;options;constructor(e={}){this.options=e,this.lineOffset=e.lineOffset??0}metadata(e,t,n){let r=t.includes(`
4
4
  `),i;try{i=P(r?t+`
@@ -10,4 +10,4 @@ import{_ as e,d as t,f as n,g as r,l as i,o as a,r as o,s,t as c,y as l}from"./7
10
10
  `,n+2);return r===-1?t:r},L=()=>{e.charCodeAt(c+1)===96?(O(2),w(c+2)):(O(1),w(c+1))},R=t=>{let n=e.charCodeAt(c+1);return t===40?(n===45?(O(8),E(47,c+2)):n===91?(O(7),E(49,c+2)):n===40&&e.charCodeAt(c+2)===40?(O(7),E(57,c+3)):(O(7),E(72,c+1)),!0):t===91?(n===91?(O(7),E(51,c+2)):n===40?(O(7),E(55,c+2)):n===47?(O(9),E(60,c+2)):n===92?(O(9),E(61,c+2)):(O(7),E(74,c+1)),!0):t===124?(O(7),E(70,c+1),!0):t===123&&(O(7),E(76,c+1),!0)},z=()=>{let n=c;for(;n<t;){let r=e.charCodeAt(n);if(r<128&&me[r]===1)n++;else if(r===45&&n+1<t){let t=e.charCodeAt(n+1);if(t===62||t===45||t===46)break;n++}else break}return n!==c&&(E(67,n),!0)},B=n=>{let r=n;for(;r<t;){let t=e.charCodeAt(r);if(t!==32&&t!==9)break;r++}return r},V=n=>{let r;switch(n){case 97:if(e.startsWith(`acc`,c)){if((r=A(he,c))>=0)return O(3),T(2,r),!0;if((r=A(ge,c))>=0)return O(4),T(4,r),!0;if((r=A(_e,c))>=0)return O(5),w(r),!0}if(j(`agentflow-beta`))return d&&(d=!1,O(6)),E(20,c+14),!0;break;case 64:if(e.charCodeAt(c+1)===123)return O(14),te(7,``,c+2),!0;break;case 99:if((r=A(ve,c))>=0)return O(12),w(r),!0;if(j(`classDef`))return E(16,c+8),!0;if(j(`class`))return E(17,c+5),!0;if((r=A(ye,c))>=0)return O(11),w(r),!0;if(j(`connector`))return E(22,c+9),!0;break;case 34:return L(),!0;case 115:if(j(`style`))return E(12,c+5),!0;break;case 100:if(j(`default`))return E(13,c+7),!0;break;case 108:if(j(`linkStyle`))return E(14,c+9),!0;break;case 105:if(j(`interpolate`))return E(15,c+11),!0;break;case 104:if(e.startsWith(`href`,c)&&F(e.charCodeAt(c+4)))return T(18,c+5),!0;break;case 102:if(j(`flow`))return E(21,c+4),!0;break;case 103:if(j(`global`))return E(23,B(c+6)),!0;break;case 101:if(j(`end`))return E(24,B(c+3)),!0;break;case 95:if(j(`_self`))return E(25,c+5),!0;if(j(`_blank`))return E(25,c+6),!0;if(j(`_parent`))return E(25,c+7),!0;if(j(`_top`))return E(25,c+4),!0}if(f!==-1&&c>=h&&(f<c&&(f=e.indexOf(`direction`,c)),f!==-1&&(m<c&&(X.lastIndex=c,m=X.test(e)?X.lastIndex-1:t),f<m))){for(let e=0;e<5;e++)if((r=A(we[e],c))>=0)return T(28+e,r),!0;h=m}if(p!==-1&&n!==34&&!F(n)){if(c>=g){p<c&&(p=e.indexOf(`@`,c));let n=c;for(;n<t;){let t=e.charCodeAt(n);if(t===34||F(t))break;n++}if(g=n,_=-1,p!==-1&&p<n)for(let r=Math.min(n,t-1)-1;r>=p;r--){if(e.charCodeAt(r)!==64)continue;let t=e.charCodeAt(r+1);if(t!==123&&t!==34){_=r;break}}}if(_>c)return E(33,_+1),!0}if(n>=48&&n<=57){let n=c+1;for(;n<t;){let t=e.charCodeAt(n);if(t<48||t>57)break;n++}return E(34,n),!0}switch(n){case 35:return E(35,c+1),!0;case 58:return e.charCodeAt(c+1)===58&&e.charCodeAt(c+2)===58?E(36,c+3):E(37,c+1),!0;case 38:return E(38,c+1),!0;case 59:return E(39,c+1),!0;case 44:return E(40,c+1),!0;case 42:return E(41,c+1),!0;case 60:return E(62,c+1),!0;case 45:return P()||z()||E(68,c+1),!0;case 40:return R(n);case 91:return e.charCodeAt(c+1)===124?(E(52,c+2),!0):R(n);case 124:case 123:return R(n);case 62:return O(7),E(53,c+1),!0;case 94:return E(63,c+1),!0;case 92:return e.charCodeAt(c+1)===124?(E(64,c+2),!0):z();case 118:return N(e.charCodeAt(c+1))?z():(E(65,c+1),!0);case 37:return(r=I(c))>=0?(T(66,r),!0):z()}if(F(n)){if(P())return!0;if((n===32||n===9)&&(r=I(ne(c)))>=0)return T(66,r),!0;for(r=c;;){let t=e.charCodeAt(r);if(t===10)r++;else if(t===13&&e.charCodeAt(r+1)===10)r+=2;else break}return r>c?T(77,r):T(78,c+1),!0}return n<128?z():ee(n)?(E(69,c+1),!0):!1};e:for(;;){if(c>=t){let e=-1;switch(s){case 0:e=79;break;case 3:e=3;break;case 4:e=5;break;case 5:e=6;break;case 11:e=19;break;case 12:e=8;break;case 13:e=9}e!==-1&&E(e,t);break}let o=e.charCodeAt(c),d=!0;switch(s){case 0:d=V(o);break;case 1:if(o===34)e.charCodeAt(c+1)===96?(O(2),w(c+2)):(k(),w(c+1));else{let n=e.indexOf(`"`,c);T(11,n===-1?t:n)}break;case 2:if(o===96)e.charCodeAt(c+1)===34?(k(),w(c+2)):d=!1;else if(o===34)L();else{let n=c+1;for(;n<t;){let t=e.charCodeAt(n);if(t===96||t===34)break;n++}T(10,n)}break;case 3:case 4:{let n=e.indexOf(`
11
11
  `,c);n===-1&&(n=t);let r=s===3?3:5;k(),T(r,n);break}case 5:if(o===125)k(),w(c+1);else{let n=e.indexOf(`}`,c);n===-1&&(n=t),T(6,n)}break;case 6:{let e;o===34?L():(e=A(be,c))>=0?(k(),T(26,e)):(e=A(xe,c))>=0||(e=A(Se,c))>=0||(e=A(Ce,c))>=0?(k(),T(27,e)):d=R(o);break}case 7:{let n=e.charCodeAt(c+1);switch(o){case 34:L();break;case 40:case 91:case 123:R(o);break;case 93:k(),n===41?E(48,c+2):n===93?E(50,c+2):E(73,c+1);break;case 41:k(),n===93?E(54,c+2):n===41&&e.charCodeAt(c+2)===41?E(56,c+3):E(71,c+1);break;case 124:k(),E(70,c+1);break;case 125:k(),E(75,c+1);break;case 37:{let e=I(c);e>=0?w(e):d=!1;break}default:{let n=c+1;for(;n<t;){let t=e.charCodeAt(n);if(t===91||t===93||t===40||t===41||t===123||t===125||t===124||t===34||t===37)break;n++}T(46,n)}}break}case 8:{let n=e.charCodeAt(c+1),r;if(o===34)L();else if(o===37&&(r=I(c))>=0)w(r);else if((o===45||o===47||o===41)&&n===41)k(),E(45,c+2);else if(o===40||o===91||o===123)R(o);else if(o===41||o===93||o===125)d=!1;else{let n=c+1;for(;n<t;){let t=e.charCodeAt(n);if(t===34||t===40||t===41||t===91||t===93||t===123||t===125||(t===45||t===47)&&e.charCodeAt(n+1)===41||t===37&&e.charCodeAt(n+1)===37&&e.charCodeAt(n+2)!==123)break;n++}D(46,n)}break}case 9:{let n=e.charCodeAt(c+1);if(o===34){L();break}switch(o){case 40:n===45||n===91||n===40&&e.charCodeAt(c+2)===40?R(o):n===93?(k(),E(58,c+2)):R(o);break;case 91:case 123:R(o);break;case 92:n===93?(k(),E(58,c+2)):E(46,c+1);break;case 47:n===93?(k(),E(59,c+2)):E(46,c+1);break;case 93:case 41:n===93?(k(),E(58,c+2)):d=!1;break;case 125:d=!1;break;case 37:{let e=I(c);e>=0?w(e):d=!1;break}default:{if((o===63||o===61)&&n===93){k(),E(58,c+2);break}let r=c+1;for(;r<t;){let t=e.charCodeAt(r);if(t===92||t===91||t===93||t===40||t===41||t===123||t===125||t===47||t===37)break;r++}T(46,r)}}break}case 10:{if(o===34){L();break}let n=re(c);if(n>=0){k(),T(42,n);break}if(o===45&&e.charCodeAt(c+1)===45){d=!1;break}let r=c+1;for(;r<t;){let t=e.charCodeAt(r);if(t===34)break;if(t===45){if(e.charCodeAt(r+1)===45)break}else if(F(t)&&re(r)>=0)break;r++}D(44,r);break}case 11:if(o===34)L();else if(F(o))k(),w(c+1);else{let n=c+1;for(;n<t&&!F(e.charCodeAt(n));)n++;E(19,n)}break;case 12:if(o===40){let e=A(Te,c);k(),e>=0?w(e):(O(13),w(c+1))}else{let n=e.indexOf(`(`,c);n===-1&&(n=t),T(8,n)}break;case 13:if(o===41)k(),w(c+1);else{let n=e.indexOf(`)`,c);n===-1&&(n=t),T(9,n)}break;case 14:if(o===34)O(15),E(7,c+1);else if(o===125)k(),w(c+1);else if(o===94)d=!1;else{let n=c+1;for(;n<t;){let t=e.charCodeAt(n);if(t===125||t===94||t===34)break;n++}T(7,n)}break;case 15:if(o===34)k(),E(7,c+1);else{let n=e.indexOf(`"`,c);n===-1&&(n=t),te(7,e.slice(c,n).replace(Ee,`<br/>`),n)}}if(!d)return n.push(1),r.push(``),i.push(c),a.push(l,u,l,u),{types:n,texts:r,starts:i,locs:a};continue e}return n.push(0),r.push(``),i.push(t),a.push(l,u,l,u),{types:n,texts:r,starts:i,locs:a}}var Oe=new Uint8Array(80);for(let e of[34,67,65,68,13,40,37,38,35,41,69])Oe[e]=1;var ke=new Uint8Array(80);for(let e of[34,69,67,27,65,68,40,37,38,35,41])ke[e]=1;var Ae=new Uint8Array(80);for(let e of[34,67,78,68,38,69,37,41,35,12,14,16,17,19,20,27,21,22,23,24,65,63,43])Ae[e]=1;var je=new Uint8Array(80);for(let e of[34,67,37,78,35,12])je[e]=1;var Me=new Uint8Array(80);for(let e of[77,39,79,66])Me[e]=1;var Ne=`'UNICODE_TEXT', 'TEXT', 'TAGSTART'`,Pe=`'COMMENT', 'SEMI', 'NEWLINE', 'EOF'`,Z=[],Fe=/}[^\S\n]*\n/g;function Ie(e,t,n=!1){let r=!n&&e.includes(`}`)?e.replace(Fe,`}
12
12
  `):e,{types:i,texts:a,starts:o,locs:s}=De(r),c=0,l,u=0,d=0,f=e=>{let t=i[c];throw t===1?I(`agentflow`,r,o[c],``,!0):I(`agentflow`,r,o[c],`Expecting ${e}, got '${Y[t]}'`)},p=(e,t)=>({first_line:s[4*e],first_column:s[4*e+1],last_line:s[4*t+2],last_column:s[4*t+3]}),m=(e,t=``)=>(i[c]!==e&&f(`'${Y[e]}'${t?`, `+t:``}`),a[c++]),h=()=>{Me[i[c]]===0&&f(Pe),c++},g=()=>{Oe[i[c]]===0&&f(`'NODE_STRING'`);let e=a[c++];for(;Oe[i[c]]===1;)e+=a[c++];return e},_=()=>{ke[i[c]]===0&&f(`'NODE_STRING'`);let e=a[c++];for(;ke[i[c]]===1;)e+=a[c++];return e},v=()=>{let e=i[c],t;if(e===11)t=`string`;else if(e===10)t=`markdown`;else if(e===46||e===62||e===53||e===69)t=`text`;else return f(`${Ne}, 'TAGEND', 'STR', 'MD_STR'`);let n=a[c++];for(;;){let e=i[c];if(e!==46&&e!==62&&e!==53&&e!==69)break;n+=a[c++]}return{text:n,type:t}},y=e=>{m(e,Ne)},b=()=>{let e=i[c],t;if(e===11)t=`string`;else if(e===10)t=`markdown`;else if(e===44||e===69)t=`text`;else return f(`'EDGE_TEXT', 'STR', 'MD_STR'`);let n=a[c++];for(;i[c]===44||i[c]===69;)n+=a[c++];return{text:n,type:t}},x=()=>{let e=i[c],t;if(e===11)t=`text`;else if(e===10)t=`markdown`;else if(Ae[e]===1)t=`text`;else return f(`'NODE_STRING', 'STR', 'MD_STR'`);let n=a[c++];for(;Ae[i[c]]===1;)n+=a[c++];return{text:n,type:t}},S=()=>{u=c;let e=a[c++];for(;i[c]===7;)e+=a[c++];return d=c-1,e},C=(e,n,r,i)=>{let a=p(r,i);t.addVertex(e,void 0,void 0,void 0,void 0,void 0,void 0,n,a),t.extendVertexMapping(e,a)},w=(e,n)=>{n.data!==void 0&&t.addVertex(e,void 0,void 0,void 0,void 0,void 0,void 0,n.data,p(n.dataFrom,n.dataTo))},T=()=>{let e=c,n=g(),r,a,o;switch(i[c]){case 74:c++,r=v(),y(73),a=`square`;break;case 57:c++,r=v(),y(56),a=`doublecircle`;break;case 72:c++,i[c]===72?(c++,r=v(),y(71),m(71),a=`circle`):(r=v(),y(71),a=`round`);break;case 47:c++,r=v(),y(45),a=`ellipse`;break;case 49:c++,r=v(),y(48),a=`stadium`;break;case 51:c++,r=v(),y(50),a=`subroutine`;break;case 52:{c++;let e=m(67);m(37);let t=m(67);m(70),r=v(),y(73),a=`rect`,o={[e]:t};break}case 55:c++,r=v(),y(54),a=`cylinder`;break;case 76:c++,i[c]===76?(c++,r=v(),y(75),m(75),a=`hexagon`):(r=v(),y(75),a=`diamond`);break;case 53:c++,r=v(),y(73),a=`odd`;break;case 60:c++,r=v(),i[c]===59?(c++,a=`lean_right`):(y(58),a=`trapezoid`);break;case 61:c++,r=v(),i[c]===58?(c++,a=`lean_left`):(y(59),a=`inv_trapezoid`)}return o===void 0?a===void 0?t.addVertex(n):t.addVertex(n,r,a):t.addVertex(n,r,a,void 0,void 0,void 0,o),t.addVertexMapping(n,r,a,p(e,c-1)),n},E=()=>{let e=T();return i[c]===36&&(c++,t.setClass(e,g())),e},D=()=>{let e=[E()];for(l=void 0;;){let t=i[c]===7?S():void 0,n=u,r=d;if(i[c]!==78)return l=t,e;do c++;while(i[c]===78);if(i[c]!==38)return t!==void 0&&f(`'AMP'`),e;c++,i[c]!==78&&f(`'SPACE'`);do c++;while(i[c]===78);let a=E();t!==void 0&&C(e[e.length-1],t,n,r),e.push(a)}},ee=()=>{let e;if(i[c]===33&&(e=a[c++]),i[c]===42){let n=t.destructLink(a[c++]);return e!==void 0&&(n.id=e),i[c]===70&&(c++,n.text=v(),y(70),i[c]===78&&c++),n}if(i[c]===43){let n=a[c++],r=b(),i=m(42,`'EDGE_TEXT'`),o=t.destructLink(i,n);return o.text=r,e!==void 0&&(o.id=e),o}return f(`'LINK', 'START_LINK'`)},te=()=>{let e=c,n=D();l!==void 0&&C(n[n.length-1],l,u,d);let r=n;for(;;){let a=i[c];if(a!==42&&a!==43&&a!==33)return r;let o=ee(),s=D();l!==void 0&&C(s[s.length-1],l,u,d),t.addLink(n,s,o),t.addEdgeMapping(n,s,o,p(e,c-1)),r=s.concat(r),n=s}},O=()=>{je[i[c]]===0&&f(`'NODE_STRING', 'NUM', 'COLON', 'BRKT'`);let e=a[c++];for(;je[i[c]]===1;)e+=a[c++];return e},k=()=>{let e=[O()];for(;i[c]===40;)c++,e.push(O());return e},A=()=>{c++,m(78);let e;if(i[c]===13)e=[a[c++]];else for(e=[m(34,`'DEFAULT'`)];i[c]===40;)c++,e.push(m(34));if(m(78),i[c]!==15){t.updateLink(e,k());return}c++,m(78);let n=_();if(i[c]===78){c++;let r=k();t.updateLinkInterpolate(e,n),t.updateLink(e,r)}else t.updateLinkInterpolate(e,n)},j=(e,n)=>{if(i[c]!==78){t.setLink(e,n);return}if(c++,i[c]===25){t.setLink(e,n,a[c++]);return}let r=m(11,`'LINK_TARGET'`);i[c]===78?(c++,t.setLink(e,n,m(25))):t.setLink(e,n),t.setTooltip(e,r)},M=()=>{let e=a[c++];switch(i[c]){case 8:{let n=a[c++],r=i[c]===9,o=r?a[c++]:void 0,s;i[c]===78&&(c++,s=m(11)),r?t.setClickEvent(e,n,o):t.setClickEvent(e,n),s!==void 0&&t.setTooltip(e,s);return}case 18:c++,j(e,m(11));return;case 11:j(e,a[c++]);return;default:{let n=_();if(i[c]===78){c++;let r=m(11);t.setClickEvent(e,n),t.setTooltip(e,r)}else t.setClickEvent(e,n)}}},ne=e=>{m(78,Pe);let t=x(),n={text:``,type:`text`};i[c]===74&&(c++,n=v(),y(73));let r=i[c]===7?S():void 0;return Me[i[c]]===0&&f(`${Pe}, 'SHAPE_DATA'`),{global:!1,at:e,id:t,title:n,data:r,dataFrom:u,dataTo:d,list:[],collect:!1}},N=()=>{let e=i[c];switch(e){case 12:{c++,m(78);let e=g();return m(78),t.addVertex(e,void 0,void 0,k()),h(),Z}case 14:return A(),h(),Z;case 16:{c++,m(78);let e=g();return m(78),t.addClass(e,k()),h(),Z}case 17:{c++,m(78);let e=g();return m(78),t.setClass(e,g()),h(),Z}case 19:return M(),h(),Z;case 22:{let e=ne(c++),n=c++,r=t.addConnector(e.id,e.title);return w(r,e),t.addConnectorMapping(e.id,e.title,p(e.at,e.at),p(n,n)),r}case 28:case 29:case 30:case 31:case 32:return c++,{stmt:`dir`,value:Le[e-28]};case 2:{c++;let e=m(3).trim();return t.setAccTitle(e),e}case 4:{c++;let e=m(5).trim();return t.setAccDescription(e),e}case 6:{let e=a[c++].trim();return t.setAccDescription(e),e}default:{Oe[e]===0&&f(Re);let t=te();return h(),t}}},re=()=>{let e=[],n=[],r=!1;for(;;){let o=i[c];if(o===0)break;if(o===24){let i=e.pop();if(i===void 0)break;let a=c++;if(i.global){t.addGlobal(n),n=i.list,r=i.collect;continue}let o=t.addSubGraph(i.id,n,i.title,`flow`);w(o,i),t.addSubgraphMapping(i.id,i.title,p(i.at,i.at),p(a,a)),n=i.list,r=i.collect,r&&n.push(o)}else if(o===39||o===77||o===78||o===79)r&&n.push(a[c]),c++;else if(o===66)c++;else if(o===21||o===23){let t=c++,a;o===23||Me[i[c]]===1?(a={global:o===23,at:t,id:void 0,title:void 0,data:void 0,dataFrom:0,dataTo:0,list:n,collect:r},h()):(a=ne(t),a.list=n,a.collect=r,c++),e.push(a),n=[],r=!0}else{let e=N();r&&(!Array.isArray(e)||e.length>0)&&n.push(e)}}e.length>0&&f(`'end'`)};for(;i[c]===78||i[c]===77||i[c]===66;)c++;if(m(20,`'SPACE', 'NEWLINE', 'COMMENT'`),i[c]===26)c++,t.setDirection(`TB`);else{let e=m(27,`'NODIR'`),n=i[c];if(n===78){do c++;while(i[c]===78);n=i[c],n!==77&&f(`'NEWLINE', 'SPACE'`)}else n!==39&&n!==77&&n!==66&&f(`'COMMENT', 'SEMI', 'NEWLINE', 'SPACE'`);c++,t.setDirection(e)}re(),i[c]!==0&&f(Re)}var Le=[`TB`,`BT`,`RL`,`LR`,`TD`],Re=`'COMMENT', 'SEMI', 'NEWLINE', 'SPACE', 'EOF', 'flow', 'global', 'connector', 'acc_title', 'acc_descr', 'acc_descr_multiline_value', 'STYLE', 'LINKSTYLE', 'CLASSDEF', 'CLASS', 'CLICK', 'NODE_STRING'`,Q=new Map([[`tool`,0],[`task`,1],[`decision`,2],[`input`,3],[`refdoc`,4],[`connector`,5],[`action`,6]]),ze=Q.size,Be=e=>Math.max(1,e-ze),Ve=(e,t)=>{let n=ze+e%Be(t);return t>0?n%t:n};function He(e,t,n,r){let i=n.size;for(let a of e){if(a.isGroup||a.shape===`collapsedGroup`){a.colorIndex=Ve(n.get(a.id)??i++,r);continue}let e=t(a.id);e&&Q.has(e)&&(a.kind=e)}}function Ue(e,t,n){let r=[],i=[],a=e.subgraphs,o=t=>{let n=[];for(let r of t){let t=e.classes.get(r);t?.styles&&(n=[...n,...t.styles].map(e=>e.trim())),t?.textStyles&&(n=[...n,...t.textStyles].map(e=>e.trim()))}return n},s=new Set,c=new Map,l=new Set;for(let t of a){if(t.metadata?.view!==`collapsed`||s.has(t.id))continue;let n=[t.id];for(;n.length>0;){let r=e.subgraph(n.pop())?.nodes;if(r!==void 0)for(let e of r)e===t.id||s.has(e)||(s.add(e),c.set(e,t.id),l.has(e)||n.push(e))}l.add(t.id)}let u=new Map;for(let e of s){let t=[e],n=c.get(e);for(;;){let e=u.get(n),r=e??c.get(n);if(r===void 0||(e===void 0&&t.push(n),n=r,e!==void 0))break}for(let e of t)u.set(e,n)}let d=new Map;a.forEach((e,t)=>d.set(e.id,t));let f=new Map,p=(e,t,n)=>{let r=d.get(e);if(r===void 0||r<n)return!1;let i=t;for(let t=0;i!==void 0&&t<=a.length;t++){if(i===e)return!0;i=f.get(i)}return!1};for(let t=a.length-1;t>=0;t--){let n=a[t];if(!s.has(n.id))for(let r of n.nodes){if(p(r,n.id,t)){e.emitWarning(`CONTAINMENT_VIOLATION`,`Container "${n.id}" cannot contain "${r}" because "${r}" already contains it. The nesting that would close the loop is dropped.`,{nodeId:r});continue}f.set(r,n.id)}}let m=new Map;for(let e=a.length-1;e>=0;e--){let t=a[e];if(s.has(t.id))continue;let n=t.metadata?.view===`collapsed`,i={id:t.id,label:t.title,labelType:t.labelType,parentId:f.get(t.id),cssStyles:[],cssCompiledStyles:o(t.classes),cssClasses:t.classes.join(` `),shape:n?`collapsedGroup`:`flowGroup`,dir:t.dir,isGroup:!n,metadata:n?{...t.metadata,containerType:t.type}:t.metadata};r.push(i),m.set(t.id,i)}for(let t of e.nodes.values()){if(s.has(t.id))continue;let n=m.get(t.id);if(n){n.cssStyles=t.styles,n.cssCompiledStyles=o(t.classes),n.cssClasses=t.classes.join(` `);continue}let i=V(t.type),a={id:t.id,label:t.text,labelType:t.labelType,parentId:f.get(t.id),cssStyles:t.styles,cssCompiledStyles:o([`default`,`node`,...t.classes]),cssClasses:`default `+t.classes.join(` `),dir:t.dir,link:t.link,linkTarget:t.linkTarget,tooltip:e.tooltips.get(t.id),metadata:t.metadata,isGroup:!1,shape:i===`square`||i===void 0?`squareRect`:i};r.push(a),m.set(t.id,a)}e.edges.forEach((t,r)=>{let a=u.get(t.start)??t.start,s=u.get(t.end)??t.end;if(a===s&&t.start!==t.end)return;let c=[...e.defaultEdgeStyle??[]];t.style&&c.push(...t.style);let l=t.type===`arrow_open`?`none`:t.type===`arrow_cross`||t.type===`arrow_point`?t.type:`arrow_point`;i.push({id:t.id||`L_${a}_${s}_${r}`,isUserDefinedId:t.isUserDefinedId,start:a,end:s,type:t.type??`normal`,label:t.text,labelType:t.labelType,thickness:t.stroke,pattern:t.stroke,minlen:t.length,classes:`edge-thickness-normal edge-pattern-solid flowchart-link`,arrowTypeStart:`none`,arrowTypeEnd:l,cssCompiledStyles:o(t.classes),style:c,animate:t.animate,animation:t.animation,curve:t.interpolate||e.defaultInterpolate||n,metadata:t.metadata})}),ae(r,e);let h=new Map;for(let e of a){let t=f.get(e.id);if(t===void 0)continue;let n=h.get(t);n?n.push(e.id):h.set(t,[e.id])}let g=new Map;for(let e of a){if(f.get(e.id)!==void 0)continue;let t=[e.id];for(;t.length>0;){let e=t.pop();if(g.has(e))continue;g.set(e,g.size);let n=h.get(e);if(n)for(let e=n.length-1;e>=0;e--)t.push(n[e])}}return He(r,t=>{if(e.connectors.has(t))return`connector`;let n=e.nodes.get(t);return n?e.vertexKind(n):void 0},g,t),{nodes:r,edges:i}}var We=8,Ge=40,Ke=16,qe=48,$=20,Je=26,Ye=14,Xe=`collapsed`,Ze={TB:2,RL:3,BT:0,LR:1},Qe=new WeakMap;function $e(e,t){let n=Qe.get(e);if(n===void 0){let r=t.flowchart?.curve;n=Ue(e,We,typeof r==`string`?r:void 0),Qe.set(e,n)}return n}function et(e,t,n){let r=e.agentflow?.[t];return typeof r==`number`&&r>0?Math.min(r,2e3):n}var tt=/[";]fill:/;function nt(e,n,r){let i=t(e);return` fill="${i}"${tt.test(r.shape)?``:` fill-opacity="${n}"`} stroke="${i}"`}function rt(e,t,n){return h(e.direction)?g(n,r=>it(e,t,n,r)):it(e,t,n,!1)}function it(h,g,D,ee){let j=$e(h,g),M=D.fontSize??16,N=Math.round(M*.875),P=D.measurer??ne(D.fontFamily),F=et(g,`wrappingWidth`,120),I=et(g,`minNodeWidth`,120),L=D.padding??8,R=D.icons,z=new Map,B=[],V=[];j.nodes.forEach((e,t)=>z.set(e.id,t));for(let e of j.nodes){let t=e.cssStyles.length>0?e.cssCompiledStyles.concat(e.cssStyles):e.cssCompiledStyles,n=i(t),r=+!!n.bold|(n.italic?2:0),a=e.labelType===`markdown`,o=n.fontSize??M,c,l;if(e.isGroup){let t=s(e.label,a,P,o,4e3,r);c={node:e,style:n,label:t,shape:`group`,w:0,h:0,dy:0,loops:0},l=S(0,0),l.isGroup=!0,l.dir=e.dir?x(e.dir):void 0,l.padX=$,l.padTop=t.height>0?t.height+16:$,l.padBottom=$,l.minW=t.width+2*$-12}else if(e.shape===`collapsedGroup`){let t=s(e.label,a,P,o,F,r),i=Math.max(t.width,I)+36,u=t.height+24+Ye;c={node:e,style:n,label:t,shape:Xe,w:i,h:u,dy:-Ye/2,loops:0},l=S(i,u)}else{let t=A(e.shape),i=s(e.label,a,P,o,F,r),u=O(t,t===`diam`?i.width:Math.max(i.width,I),i.height);c={node:e,style:n,label:i,shape:t,w:u.w,h:u.h,dy:u.dy,loops:0},l=S(u.w,u.h)}l.seq=B.length,B.push(c),V.push(l)}j.nodes.forEach((e,t)=>{V[t].parent=e.parentId===void 0?-1:z.get(e.parentId)??-1});let ie=ee?`TB`:x(h.direction),ae=e=>{let t;for(let n=V[e].parent,r=0;n>=0&&t===void 0&&r<1e4;n=V[n].parent,r++)t=V[n].dir;return t??ie},oe=e=>{let t=ae(e);return t===`LR`||t===`RL`},H=new Int32Array(V.length).fill(-1);for(let e=0;e<V.length;e++){let t=[],n=e;for(;n>=0&&H[n]<0&&t.length<=V.length;)t.push(n),n=V[n].parent;let r=n>=0?H[n]+1:0;for(let e=t.length-1;e>=0;e--)H[t[e]]=r++}let se=(e,t)=>{let n=t;for(let r=H[t];r>H[e];r--)n=V[n].parent;return n===e&&t!==e},U=[],ce=[],W=[],G=[];for(let e of j.edges){let t=z.get(e.start),n=z.get(e.end);if(t===void 0||n===void 0)continue;let r=s(e.label,e.labelType===`markdown`,P,N,F);if(se(t,n)||se(n,t)){G.push({edge:e,label:r,src:t,dst:n});continue}t===n&&(B[t].loops++,oe(t)?V[t].h+=2*(Je+(r.height>0?r.height+8:0)):V[t].w+=2*(Je+(r.width>0?r.width+12:0))),W.push(e),ce.push(r),U.push({src:t,dst:n,minlen:e.minlen??1,labelW:r.width>0?r.width+12:0,labelH:r.height>0?r.height+4:0,route:[],labelX:0,labelY:0})}let K=y(V,U,ie,{nodeSep:et(g,`nodeSpacing`,Ge),edgeSep:Ke,rankSep:et(g,`rankSpacing`,qe),portSep:20}),q=s(h.title,!1,P,M,4e3,1),le=q.height>0?q.height+12:0,ue=Math.max(K.width,q.width),de=L+(ue-K.width)/2,fe=L+le;b(V,U,de,fe);let J=Math.ceil(ue+2*L),pe=Math.ceil(K.height+le+2*L),Y=[],me=[],he=[],ge=[],_e=G.length*V.length<2e6;for(let{edge:e,src:t,dst:n}of G){let r=se(n,t),i=r?n:t,a=r?t:n,o=V[i],s=V[a],c=Ze[o.dir??ae(i)],l=r?c:c+2&3,d=e=>{let t=!(e&1),n=e===0||e===3?-1:1,i=t?s.x:s.x+n*s.w/2,a=t?s.y+n*s.h/2:s.y,c=t?s.x:o.x+n*o.w/2,l=t?o.y+n*o.h/2:s.y,u=+!t;return r?[i,a,u,c,l,u]:[c,l,u,i,a,u]},p=e=>{for(let t=0;t<V.length;t++){let n=V[t];if(t!==a&&!n.isGroup&&n.x+n.w/2>Math.min(e[0],e[3])-1&&n.x-n.w/2<Math.max(e[0],e[3])+1&&n.y+n.h/2>Math.min(e[1],e[4])-1&&n.y-n.h/2<Math.max(e[1],e[4])+1)return!0}return!1},m=d(l);if(_e&&p(m))for(let e of[l+1&3,l+3&3,l+2&3]){let t=d(e);if(!p(t)){m=t;break}}ge.push(m),he.push((m[0]+m[3])/2,(m[1]+m[4])/2);let h=m.slice();k(h,r?0:3,B[a],s),me.push(f(h,`linear`,0,u(e.arrowTypeEnd)))}let ve=new Map,ye=!1;for(let e of V)e.isGroup&&(ye=!0);if(ye){for(let e of U)v(ve,e.route);for(let e of ge)v(ve,e)}let be=``,xe=``;for(let r=0;r<B.length;r++){let i=B[r],s=V[r],u=i.node,d=s.x,f=s.y,p=e(u.cssClasses.replace(/^default\s?/,``)),m=o(u.id);if(s.isGroup){let e=_(s,i.label.width,ve,$);be+=`<g class="pele-cluster pele-flow${p}" data-id="${m}"><rect x="${n(d-s.w/2)}" y="${n(f-s.h/2)}" width="${n(s.w)}" height="${n(s.h)}"${a(nt(u.colorIndex??Q.size,`0.06`,i.style)+i.style.shape)}/>`+c(i.label,e,f-s.h/2+8+i.label.height/2,` class="pele-cluster-label" fill="var(--_m)"${i.style.text}`,R)+`</g>`;continue}let h=i.w,g=i.h,v=``,y;if(i.shape===Xe){let e=t(u.colorIndex??Q.size),r=g/2-Ye-2,o=r+(Ye+2)/2;y=`<rect x="${n(-h/2)}" y="${n(-g/2)}" width="${n(h)}" height="${n(g)}"${a(nt(u.colorIndex??Q.size,`0.06`,i.style)+i.style.shape)}/><path d="M${n(-h/2+10)},${n(r)}H${n(h/2-10)}" fill="none" stroke="${e}" stroke-dasharray="3 3"${i.style.line}/><path class="pele-collapsed-mark" d="${at(-9,o)}${at(0,o)}${at(9,o)}" fill="${e}" stroke="none"/>`}else{let e=Q.get(u.kind??`task`)??1;v=` pele-kind-${u.kind??`task`}`,y=te(i.shape,h,g,nt(e,`0.14`,i.style)+i.style.shape,` stroke="${t(e)}"`+i.style.line)}let b=c(i.label,0,i.dy,` class="pele-label"${i.style.text}`,R);if(/ internal-link(?: |$)/.test(p+` `)&&u.label&&D.links!==!1){let e=re(u.label),t=w(E(e),D)!==void 0,n=l(e);b=`<a class="internal-link"${t?` href="${n}"${T(D)}`:``} data-href="${n}">${b}</a>`,Y.push({id:u.id,href:e,internal:!0})}let x=y+b;u.tooltip&&(x=`<title>${o(u.tooltip)}</title>`+x),u.link&&(x=C(x,u.link,u.id,Y,D,u.linkTarget?` target="${l(u.linkTarget)}"`:``)),xe+=`<g class="pele-node pele-shape-${i.shape}${v}${p}" data-id="${m}" transform="translate(${n(d)},${n(f)})">${x}</g>`}let Se=``,Ce=``,we=(t,n,r,a,s)=>{let c=t.style.length>0||t.cssCompiledStyles.length>0?i(t.cssCompiledStyles.concat(t.style)):void 0,u=t.arrowTypeEnd,f=c?.stroke?l(c.stroke):`var(--_l)`,m=t.thickness===`dotted`?`reference`:u===`arrow_cross`?`failure`:`sequence`,h=e(t.classes.replace(/edge-thickness-normal|edge-pattern-solid|flowchart-link/g,``));Se+=`<g class="pele-edge pele-edge-${m}${h}" data-id="${o(t.id)}"${c?.line??``}><path d="${r.d}"${t.thickness===`dotted`?` stroke-dasharray="3 4"`:``}/>`+p(u,r.ex,r.ey,r.edx,r.edy,f)+`</g>`,n.width>0&&(Ce+=d(t.id,n,a,s,c?.text??``,R))},X=new Map;for(let e=0;e<U.length;e++){let t=U[e],n=W[e],r=ce[e],i=n.arrowTypeEnd,a;if(t.src===t.dst){let e=B[t.src],n=X.get(t.src)??0;X.set(t.src,n+1),a=m(V[t.src],e.w,e.h,n,oe(t.src),Je,u(i),t)}else{let e=t.route.slice();k(e,0,B[t.src],V[t.src]),k(e,e.length-3,B[t.dst],V[t.dst]),a=f(e,n.curve,0,u(i))}we(n,r,a,t.labelX,t.labelY)}return G.forEach((e,t)=>we(e.edge,e.label,me[t],he[2*t],he[2*t+1])),{svg:r(`agentflow`,J,pe,M,D,h,c(q,J/2,L+q.height/2,` class="pele-title" font-weight="var(--_tw)"`)+(be?`<g class="pele-clusters">${be}</g>`:``)+(Se?`<g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round">${Se}</g>`:``)+(Ce?`<g class="pele-edge-labels" font-size="${N}">${Ce}</g>`:``)+`<g class="pele-nodes">${xe}</g>`),width:J,height:pe,links:Y}}function at(e,t){return`M${n(e-1.75)},${n(t)}a1.75,1.75 0 1 0 3.5,0a1.75,1.75 0 1 0 -3.5,0Z`}var ot={type:`agentflow`,keepComments:!0,parse(e,t,n,r,i){let a=new pe({inheritDir:(t.flowchart??{}).inheritDir===!0,direction:typeof t.direction==`string`?t.direction:void 0,lineOffset:r,maxEdges:i.maxEdges});return n&&(a.title=n),Ie(e,a),$e(a,t),a},render:rt};export{ot as agentflow};
13
- //# sourceMappingURL=RHNBAITX-Oryl0UiR.js.map
13
+ //# sourceMappingURL=RHNBAITX-DKMeuR6R.js.map
@@ -1,2 +1,2 @@
1
- import{a as e,r as t,t as n}from"./react-DH3P2YXY.js";import{n as r,t as i}from"./jsx-runtime-BnjsACtP.js";import{K as a,s as o}from"./useSettings-gPlpTIWi.js";import{ft as s,l as c}from"./diffRendering-DtBTalAD.js";import{I as l,U as u,c as d,d as f,i as p,n as m,r as h,t as g,u as _}from"./Virtualizer-BgcEI5KE.js";import{Q as v}from"./getDiffFileInput-C1QBFdFu.js";import{a as y,i as b,r as x,t as S}from"./DiffWorkerPoolProvider-CkkqWbz-.js";import{x as C}from"./ComposerPromptEditor-Dxfhec2W.js";import{ya as w}from"./main-VfCRP294.js";var T=e(n(),1),E=typeof window>`u`?T.useEffect:T.useLayoutEffect;function D({file:e,options:t,editorOptions:n,editStateKey:r,lineAnnotations:i,selectedLines:a,prerenderedHTML:o,metrics:s,hasGutterRenderUtility:c,hasCustomHeader:l,disableWorkerPool:d,edit:h,onEditChange:g,onEditComplete:x}){let S=m(),C=a!==void 0,w=(0,T.useContext)(p),D=_(),j=f(e=>g?.(e)),M=g==null?void 0:j,N=(0,T.useRef)(null),P=f(e=>{let t=x?.(e)??`reject`;return t===`accept`&&(N.current={file:{installed:e.file,stale:e.originalFile},annotations:{installed:e.lineAnnotations,stale:e.originalLineAnnotations}}),t}),F=x==null?void 0:P,I=(0,T.useRef)(null),L=(0,T.useRef)(null),R=f(()=>{if(D==null)throw Error(`File: EditContext is not attached`);return D(`file`,n??{},r)}),z=f(n=>{if(n!=null){if(I.current!=null)throw Error(`File: An instance should not already exist when a node is created`);S==null?I.current=new y(k({controlledSelection:C,hasCustomHeader:l,hasGutterRenderUtility:c,onEditChange:M,onEditComplete:F,options:t}),d?void 0:w,!0):I.current=new b(k({controlledSelection:C,hasCustomHeader:l,hasGutterRenderUtility:c,onEditChange:M,onEditComplete:F,options:t}),S,s,d?void 0:w,!0),h&&L.current==null&&(L.current=A(I.current,R)),I.current.hydrate({file:e,fileContainer:n,lineAnnotations:i,prerenderedHTML:o})}else{if(I.current==null)throw Error(`File: A File instance should exist when unmounting`);I.current.cleanUp(),I.current=null,L.current=null}});return E(()=>{let{current:n}=I;if(n==null)return;let r=k({controlledSelection:C,hasCustomHeader:l,hasGutterRenderUtility:c,onEditChange:M,onEditComplete:F,options:t}),o=r!==void 0&&!u(n.options,r);if(n.setOptions(r),!h&&L.current!=null){let{current:e}=L;L.current=null,e()}let s=O(e,i,N);n.render({file:s.file,lineAnnotations:s.lineAnnotations,forceRender:o}),a!==void 0&&n.setSelectedLines(a),h&&L.current==null&&(L.current=A(n,R))}),{ref:z,getHoveredLine:(0,T.useCallback)(()=>I.current?.getHoveredLine(),[]),getAnnotationSlotName:(0,T.useCallback)(e=>I.current?.getAnnotationSlotName(e)??v(e),[])}}function O(e,t,n){let{current:r}=n;if(r==null)return{file:e,lineAnnotations:t};let{file:i,annotations:a}=r,o=e;i!=null&&(l(e,i.stale)?o=i.installed:r.file=null);let s=t;return a!=null&&(t===a.stale?s=a.installed:r.annotations=null),r.file==null&&r.annotations==null&&(n.current=null),{file:o,lineAnnotations:s}}function k({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r,onEditChange:i,onEditComplete:a}){return t||r||n||i!=null||a!=null?{...e,controlledSelection:t,renderCustomHeader:n?d:e?.renderCustomHeader,renderGutterUtility:r?d:e?.renderGutterUtility,onEditChange:i,onEditComplete:a}:e}function A(e,t){let n=t();try{return n.edit(e)}catch(e){throw n.cleanUp(),e}}var j=e(i(),1);function M({file:e,lineAnnotations:t,selectedLines:n,options:r,editorOptions:i,editStateKey:a,metrics:o,className:c,style:l,renderAnnotation:u,renderCustomHeader:d,renderHeaderPrefix:f,renderHeaderFilenameSuffix:p,renderHeaderMetadata:m,prerenderedHTML:g,renderGutterUtility:_,disableWorkerPool:v=!1,edit:y=!1,onEditChange:b,onEditComplete:S}){let{ref:C,getHoveredLine:w,getAnnotationSlotName:T}=D({file:e,options:r,editorOptions:i,editStateKey:a,metrics:o,lineAnnotations:t,selectedLines:n,prerenderedHTML:g,hasGutterRenderUtility:_!=null,hasCustomHeader:d!=null,disableWorkerPool:v,edit:y,onEditChange:b,onEditComplete:S}),E=x({file:e,renderAnnotation:u,renderCustomHeader:d,renderHeaderPrefix:f,renderHeaderFilenameSuffix:p,renderHeaderMetadata:m,renderGutterUtility:_,lineAnnotations:t,getHoveredLine:w,getAnnotationSlotName:T});return(0,j.jsx)(s,{ref:C,className:c,style:l,children:h(E,g)})}var N=t({default:()=>F}),P=r();function F(e){let t=(0,P.c)(22),{resolvedTheme:n}=a(),r=o(I),i=`${e.name}:${n}:${e.text.length}`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={overscrollSize:600,intersectionObserverMargin:1200},t[0]=s):s=t[0];let l;t[1]===e.cacheKey?l=t[2]:(l=e.cacheKey?{cacheKey:e.cacheKey}:{},t[1]=e.cacheKey,t[2]=l);let u;t[3]!==e.name||t[4]!==e.text||t[5]!==l?(u={name:e.name,contents:e.text,...l},t[3]=e.name,t[4]=e.text,t[5]=l,t[6]=u):u=t[6];let d=r?`wrap`:`scroll`,f;t[7]===n?f=t[8]:(f=c(n),t[7]=n,t[8]=f);let p;t[9]===e.onPostRender?p=t[10]:(p=e.onPostRender?{onPostRender:e.onPostRender}:{},t[9]=e.onPostRender,t[10]=p);let m;t[11]!==n||t[12]!==d||t[13]!==f||t[14]!==p?(m={disableFileHeader:!0,overflow:d,theme:f,preferredHighlighter:w,themeType:n,unsafeCSS:C,...p},t[11]=n,t[12]=d,t[13]=f,t[14]=p,t[15]=m):m=t[15];let h;t[16]!==u||t[17]!==m?(h=(0,j.jsx)(M,{file:u,options:m,className:`min-h-full`}),t[16]=u,t[17]=m,t[18]=h):h=t[18];let _;return t[19]!==i||t[20]!==h?(_=(0,j.jsx)(S,{children:(0,j.jsx)(g,{className:`file-preview-virtualizer min-h-0 flex-1 overflow-auto`,config:s,children:h},i)}),t[19]=i,t[20]=h,t[21]=_):_=t[21],_}function I(e){return e.wordWrap}export{N as n,M as r,F as t};
2
- //# sourceMappingURL=ReadOnlySourcePreview-aUjexBVb.js.map
1
+ import{a as e,r as t,t as n}from"./react-DH3P2YXY.js";import{n as r,t as i}from"./jsx-runtime-BnjsACtP.js";import{G as a,s as o}from"./useSettings-VTow9ZEM.js";import{ft as s,l as c}from"./diffRendering-MXukhqw1.js";import{I as l,U as u,c as d,d as f,i as p,n as m,r as h,t as g,u as _}from"./Virtualizer-CI2uidEs.js";import{Q as v}from"./getDiffFileInput-CzeweGHs.js";import{a as y,i as b,r as x,t as S}from"./DiffWorkerPoolProvider-CqmToECA.js";import{x as C}from"./ComposerPromptEditor-kPs79YCA.js";import{fo as w}from"./main-DleJeMZO.js";var T=e(n(),1),E=typeof window>`u`?T.useEffect:T.useLayoutEffect;function D({file:e,options:t,editorOptions:n,editStateKey:r,lineAnnotations:i,selectedLines:a,prerenderedHTML:o,metrics:s,hasGutterRenderUtility:c,hasCustomHeader:l,disableWorkerPool:d,edit:h,onEditChange:g,onEditComplete:x}){let S=m(),C=a!==void 0,w=(0,T.useContext)(p),D=_(),j=f(e=>g?.(e)),M=g==null?void 0:j,N=(0,T.useRef)(null),P=f(e=>{let t=x?.(e)??`reject`;return t===`accept`&&(N.current={file:{installed:e.file,stale:e.originalFile},annotations:{installed:e.lineAnnotations,stale:e.originalLineAnnotations}}),t}),F=x==null?void 0:P,I=(0,T.useRef)(null),L=(0,T.useRef)(null),R=f(()=>{if(D==null)throw Error(`File: EditContext is not attached`);return D(`file`,n??{},r)}),z=f(n=>{if(n!=null){if(I.current!=null)throw Error(`File: An instance should not already exist when a node is created`);S==null?I.current=new y(k({controlledSelection:C,hasCustomHeader:l,hasGutterRenderUtility:c,onEditChange:M,onEditComplete:F,options:t}),d?void 0:w,!0):I.current=new b(k({controlledSelection:C,hasCustomHeader:l,hasGutterRenderUtility:c,onEditChange:M,onEditComplete:F,options:t}),S,s,d?void 0:w,!0),h&&L.current==null&&(L.current=A(I.current,R)),I.current.hydrate({file:e,fileContainer:n,lineAnnotations:i,prerenderedHTML:o})}else{if(I.current==null)throw Error(`File: A File instance should exist when unmounting`);I.current.cleanUp(),I.current=null,L.current=null}});return E(()=>{let{current:n}=I;if(n==null)return;let r=k({controlledSelection:C,hasCustomHeader:l,hasGutterRenderUtility:c,onEditChange:M,onEditComplete:F,options:t}),o=r!==void 0&&!u(n.options,r);if(n.setOptions(r),!h&&L.current!=null){let{current:e}=L;L.current=null,e()}let s=O(e,i,N);n.render({file:s.file,lineAnnotations:s.lineAnnotations,forceRender:o}),a!==void 0&&n.setSelectedLines(a),h&&L.current==null&&(L.current=A(n,R))}),{ref:z,getHoveredLine:(0,T.useCallback)(()=>I.current?.getHoveredLine(),[]),getAnnotationSlotName:(0,T.useCallback)(e=>I.current?.getAnnotationSlotName(e)??v(e),[])}}function O(e,t,n){let{current:r}=n;if(r==null)return{file:e,lineAnnotations:t};let{file:i,annotations:a}=r,o=e;i!=null&&(l(e,i.stale)?o=i.installed:r.file=null);let s=t;return a!=null&&(t===a.stale?s=a.installed:r.annotations=null),r.file==null&&r.annotations==null&&(n.current=null),{file:o,lineAnnotations:s}}function k({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r,onEditChange:i,onEditComplete:a}){return t||r||n||i!=null||a!=null?{...e,controlledSelection:t,renderCustomHeader:n?d:e?.renderCustomHeader,renderGutterUtility:r?d:e?.renderGutterUtility,onEditChange:i,onEditComplete:a}:e}function A(e,t){let n=t();try{return n.edit(e)}catch(e){throw n.cleanUp(),e}}var j=e(i(),1);function M({file:e,lineAnnotations:t,selectedLines:n,options:r,editorOptions:i,editStateKey:a,metrics:o,className:c,style:l,renderAnnotation:u,renderCustomHeader:d,renderHeaderPrefix:f,renderHeaderFilenameSuffix:p,renderHeaderMetadata:m,prerenderedHTML:g,renderGutterUtility:_,disableWorkerPool:v=!1,edit:y=!1,onEditChange:b,onEditComplete:S}){let{ref:C,getHoveredLine:w,getAnnotationSlotName:T}=D({file:e,options:r,editorOptions:i,editStateKey:a,metrics:o,lineAnnotations:t,selectedLines:n,prerenderedHTML:g,hasGutterRenderUtility:_!=null,hasCustomHeader:d!=null,disableWorkerPool:v,edit:y,onEditChange:b,onEditComplete:S}),E=x({file:e,renderAnnotation:u,renderCustomHeader:d,renderHeaderPrefix:f,renderHeaderFilenameSuffix:p,renderHeaderMetadata:m,renderGutterUtility:_,lineAnnotations:t,getHoveredLine:w,getAnnotationSlotName:T});return(0,j.jsx)(s,{ref:C,className:c,style:l,children:h(E,g)})}var N=t({default:()=>F}),P=r();function F(e){let t=(0,P.c)(22),{resolvedTheme:n}=a(),r=o(I),i=`${e.name}:${n}:${e.text.length}`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={overscrollSize:600,intersectionObserverMargin:1200},t[0]=s):s=t[0];let l;t[1]===e.cacheKey?l=t[2]:(l=e.cacheKey?{cacheKey:e.cacheKey}:{},t[1]=e.cacheKey,t[2]=l);let u;t[3]!==e.name||t[4]!==e.text||t[5]!==l?(u={name:e.name,contents:e.text,...l},t[3]=e.name,t[4]=e.text,t[5]=l,t[6]=u):u=t[6];let d=r?`wrap`:`scroll`,f;t[7]===n?f=t[8]:(f=c(n),t[7]=n,t[8]=f);let p;t[9]===e.onPostRender?p=t[10]:(p=e.onPostRender?{onPostRender:e.onPostRender}:{},t[9]=e.onPostRender,t[10]=p);let m;t[11]!==n||t[12]!==d||t[13]!==f||t[14]!==p?(m={disableFileHeader:!0,overflow:d,theme:f,preferredHighlighter:w,themeType:n,unsafeCSS:C,...p},t[11]=n,t[12]=d,t[13]=f,t[14]=p,t[15]=m):m=t[15];let h;t[16]!==u||t[17]!==m?(h=(0,j.jsx)(M,{file:u,options:m,className:`min-h-full`}),t[16]=u,t[17]=m,t[18]=h):h=t[18];let _;return t[19]!==i||t[20]!==h?(_=(0,j.jsx)(S,{children:(0,j.jsx)(g,{className:`file-preview-virtualizer min-h-0 flex-1 overflow-auto`,config:s,children:h},i)}),t[19]=i,t[20]=h,t[21]=_):_=t[21],_}function I(e){return e.wordWrap}export{N as n,M as r,F as t};
2
+ //# sourceMappingURL=ReadOnlySourcePreview-DPJWK3HJ.js.map
@@ -1,4 +1,4 @@
1
- import{a as e,n as t,r as n,t as r}from"./react-DH3P2YXY.js";import{n as i,t as a}from"./jsx-runtime-BnjsACtP.js";import{Bd as o,Jn as s,Ju as c,Km as l,Vd as u,Wd as d,Xm as f,Xu as p,Ym as m,Yu as h,fr as g,t as _,tE as v,ts as y,xb as b,zd as x}from"./utils-DhUt689t.js";import{R as S,W as C}from"./runtime-OeWFs5Hf.js";import{T as w,V as T,w as E}from"./entities-B8Vupv5g.js";import{Sn as D,fn as O,hn as k,sn as ee,vn as te,yn as A}from"./runtime-Ca_Z-vg5.js";import{t as j}from"./spinner-_ourbdVb.js";import{t as ne}from"./useNavigate-BWqAWfiZ.js";import{i as re}from"./toast-DXWclCrr.js";import{J as M,O as ie,s as ae}from"./useSettings-gPlpTIWi.js";import{f as oe}from"./server-6nKYyc8r.js";import{n as se}from"./session-BxUdP61p.js";import{t as ce}from"./use-atom-command-vqjL7n-x.js";import{u as le}from"./rightPanelStore-CGF0-d-1.js";import{t as ue}from"./toastHelpers-DxXYm50b.js";import{N as de}from"./diffRendering-DtBTalAD.js";import{a as fe,n as pe,t as me}from"./tooltip-CY3W5y-f.js";import{n as he}from"./browserHistoryStore-CK4YsfkQ.js";import{a as ge,n as _e}from"./openFileInPreview-CGM83ICx.js";import{t as ve}from"./preview-3EscFepc.js";import{n as ye}from"./sourceControlClients-oNOd36Cq.js";import{i as be,r as xe,t as Se}from"./browserLinkTarget-BJ30b4-s.js";import{n as Ce,t as we}from"./pullRequestIcons-B7Om_B_D.js";import{D as Te}from"./pullRequests-CMTRCOu7.js";var N=i();function Ee(e){return e?.threadPullRequests===!0?`multiple`:e?.threadPullRequestLinking===!0?`single`:`unsupported`}function De({capabilities:e,threadId:t,reference:n,legacyProjectId:r,legacyRepository:i,linked:a}){let o=ee(n);switch(Ee(e)){case`multiple`:return a?{type:`thread.pull-request.link`,input:{threadId:t,...n,...o,source:`manual`}}:{type:`thread.pull-request.unlink`,input:{threadId:t,...o}};case`single`:return a&&r===null?null:{type:`thread.meta.update`,input:{threadId:t,linkedPullRequest:a&&r!==null?{projectId:r,repository:i??n.repository,number:n.number,url:n.url}:null}};case`unsupported`:return null}}var Oe={metaKey:!1,ctrlKey:!1};function ke(e){let t=(0,N.c)(4),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={reportFailure:!1},t[0]=n):n=t[0];let r=ce(ve.open,n),i;return t[1]!==r||t[2]!==e?(i=async(t,n)=>{let i=n===void 0?{}:n,a=i.threadRef??e;if(be({url:t,event:i.event??Oe,preference:await xe(),canOpenInApp:a!=null&&se(a.environmentId,`preview:operate`)&&Se(a)})===`app`&&a){let e=await ge({threadRef:a,url:t,openPreview:r});if(S(e))return;if(e._tag===`Success`){he(a,t);return}let n=C(e);if(n instanceof _e)throw n;console.error(e.cause)}let o=M();if(!o)throw Error(`Link opening is unavailable.`);await o.shell.openExternal(t)},t[1]=r,t[2]=e,t[3]=i):i=t[3],i}function Ae(e,t){return e.find(e=>{let n=e.repositoryIdentity;return n?.provider!==void 0&&ye.get(n.provider).isChangeRequestInRepository(n,t)})}function je({environmentId:e,projects:t,pullRequestsEnabled:n,url:r}){if(!n||e===null)return null;let i=A(r);if(i===null)return null;let a=Ae(t.filter(t=>t.environmentId===e),i);return a===void 0?null:{environmentId:e,input:{projectId:a.id,host:i.authority??i.host,repository:D(a.repositoryIdentity)??i.repository,number:i.number}}}function Me(e,t){let n=(0,N.c)(7),r=E(),i;n[0]===e?i=n[1]:(i=oe.configValueAtom(e),n[0]=e,n[1]=i);let a=y(i)?.environment.capabilities.pullRequests===!0,o;return n[2]!==e||n[3]!==r||n[4]!==a||n[5]!==t?(o=je({environmentId:e,projects:r,pullRequestsEnabled:a,url:t}),n[2]=e,n[3]=r,n[4]=a,n[5]=t,n[6]=o):o=n[6],o}function Ne(e,t){let n=Ae(e,t);return n===void 0?e.find(e=>{let n=e.repositoryIdentity;return n?.provider!==void 0&&ye.get(n.provider).canReadChangeRequestOnHost(n,t)}):n}function Pe(e){return e.metaKey||e.ctrlKey}function Fe(e,t){let n=(0,N.c)(8),r=ne(),i=E(),a=w(),o=ie(),s=ae(Ie),c;return n[0]!==i||n[1]!==r||n[2]!==s||n[3]!==t||n[4]!==o||n[5]!==a||n[6]!==e?(c=(n,c,l,u)=>{if(!s||Pe(n))return!1;let d=l??e,f=t??d,p=A(c);if(p===null)return!1;let m=e=>a.get(e)?.environment.capabilities.pullRequests===!0,h=d?i.filter(e=>e.environmentId===d.environmentId):u?i.filter(e=>e.environmentId===u):i.filter(e=>m(e.environmentId)).toSorted((e,t)=>Number(t.environmentId===o)-Number(e.environmentId===o)),g=Ae(h,p)??(f?Ne(h.filter(e=>a.get(e.environmentId)?.environment.capabilities.threadPullRequests===!0),p):void 0);if(g===void 0||!m(g.environmentId))return!1;let _=a.get(g.environmentId)?.environment.capabilities.threadPullRequests===!0?p.repository:D(g.repositoryIdentity)??p.repository;return n.preventDefault(),n.stopPropagation(),f?(le.getState().openPullRequest(f,{...f.environmentId===g.environmentId?{}:{environmentId:g.environmentId},projectId:g.id,...a.get(g.environmentId)?.environment.capabilities.threadPullRequests===!0?{host:p.authority??p.host}:{},repository:_,url:c,number:p.number}),d||r({to:`/pull-requests`,search:e=>({...e,involvement:e.involvement??`all`,state:e.state??`all`,repository:_,number:p.number,selectedHost:p.authority??p.host,selectedProjectId:g.id,selectedEnvironmentId:g.environmentId}),replace:!0}),!0):(r({to:`/pull-requests`,search:{involvement:`all`,state:`all`,repository:_,number:p.number,selectedHost:p.authority??p.host,selectedProjectId:g.id,selectedEnvironmentId:g.environmentId}}),!0)},n[0]=i,n[1]=r,n[2]=s,n[3]=t,n[4]=o,n[5]=a,n[6]=e,n[7]=c):c=n[7],c}function Ie(e){return e.pullRequestLinksOpenInApp}function Le(e){let t=(0,N.c)(3),n=Fe(e),r=ke(e),i;return t[0]!==n||t[1]!==r?(i=(e,t,i)=>{e.stopPropagation();let a=Pe(e),o=e.currentTarget instanceof HTMLAnchorElement&&e.currentTarget.href.length>0;return a&&o?!1:(e.preventDefault(),!a&&n(e,t,i)?!0:(r(t,{event:e,threadRef:i}).catch(Re),!1))},t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function Re(e){console.error(e),re.add(ue({type:`error`,title:`Unable to open pull request link`,description:e instanceof Error?e.message:`An error occurred.`}))}function ze(e,t,n){return e===`unsupported`?!1:e===`multiple`||Ae(t,n)!==void 0}function Be(e){let t=(0,N.c)(30),n=w(),r=E(),i,a;t[0]!==n||t[1]!==e?(i=e==null?void 0:n.get(e)?.environment.capabilities,a=Ee(i),t[0]=n,t[1]=e,t[2]=i,t[3]=a):(i=t[2],a=t[3]);let o=a,s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s={reportFailure:!1},t[4]=s):s=t[4];let c=ce(T.linkPullRequest,s),l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l={reportFailure:!1},t[5]=l):l=t[5];let u=ce(T.unlinkPullRequest,l),d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d={reportFailure:!1},t[6]=d):d=t[6];let f=ce(T.updateMetadata,d),p;if(t[7]!==e||t[8]!==r){let n;t[10]===e?n=t[11]:(n=t=>t.environmentId===e,t[10]=e,t[11]=n),p=r.filter(n),t[7]=e,t[8]=r,t[9]=p}else p=t[9];let m=p,h;t[12]!==m||t[13]!==o?(h=e=>{let t=A(e);return t!==null&&ze(o,m,t)},t[12]=m,t[13]=o,t[14]=h):h=t[14];let g=h,_;t[15]===o?_=t[16]:(_=(e,t)=>{if(e===null||o===`unsupported`)return!1;if(o!==`multiple`)return e.linkedPullRequest!=null&&te(e.linkedPullRequest,t);let n=A(t);return n!==null&&k(e.pullRequests??[]).some(e=>O(e,n))},t[15]=o,t[16]=_);let v=_,y;t[17]!==g||t[18]!==i||t[19]!==e||t[20]!==m||t[21]!==c||t[22]!==u||t[23]!==f?(y=async(t,n,r)=>{let a=A(n);if(a===null||t.environmentId!==e||r&&!g(n))throw Error(`The pull request is not available in this environment.`);let o=Ae(m,a),s=De({capabilities:i,threadId:t.threadId,reference:{...a,url:n},legacyProjectId:o?.id??null,legacyRepository:D(o?.repositoryIdentity)??void 0,linked:r});if(s===null)throw Error(`This environment does not support linking this pull request.`);let l=await(s.type===`thread.meta.update`?f({environmentId:t.environmentId,input:s.input}):s.type===`thread.pull-request.link`?c({environmentId:t.environmentId,input:s.input}):u({environmentId:t.environmentId,input:s.input}));if(l._tag===`Failure`)throw S(l)?Error(`Link update interrupted.`):C(l)},t[17]=g,t[18]=i,t[19]=e,t[20]=m,t[21]=c,t[22]=u,t[23]=f,t[24]=y):y=t[24];let b=y,x;return t[25]!==g||t[26]!==b||t[27]!==v||t[28]!==o?(x={mode:o,canLink:g,isLinked:v,changeLink:b},t[25]=g,t[26]=b,t[27]=v,t[28]=o,t[29]=x):x=t[29],x}function Ve(){}function He(){}var Ue=(function(e){if(e==null)return Je;if(typeof e==`function`)return qe(e);if(typeof e==`object`)return Array.isArray(e)?We(e):Ge(e);if(typeof e==`string`)return Ke(e);throw Error(`Expected function, string, or object as test`)});function We(e){let t=[],n=-1;for(;++n<e.length;)t[n]=Ue(e[n]);return qe(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function Ge(e){let t=e;return qe(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function Ke(e){return qe(t);function t(t){return t&&t.type===e}}function qe(e){return t;function t(t,n,r){return!!(Ye(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function Je(){return!0}function Ye(e){return typeof e==`object`&&!!e&&`type`in e}function Xe(e){return e}var Ze=[];function Qe(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=Ue(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+Xe(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=Ze,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=$e(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function $e(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?Ze:[e]}function et(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),Qe(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}function tt(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function nt(e,t,n){let r=Ue((n||{}).ignore||[]),i=rt(t),a=-1;for(;++a<i.length;)Qe(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function rt(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([it(e[0]),at(e[1])])}return t}function it(e){return typeof e==`string`?new RegExp(tt(e),`g`):e}function at(e){return typeof e==`function`?e:function(){return e}}var P=B(/[A-Za-z]/),F=B(/[\dA-Za-z]/),ot=B(/[#-'*+\--9=?A-Z^-~]/);function st(e){return e!==null&&(e<32||e===127)}var ct=B(/\d/),lt=B(/[\dA-Fa-f]/),ut=B(/[!-/:-@[-`{-~]/);function I(e){return e!==null&&e<-2}function L(e){return e!==null&&(e<0||e===32)}function R(e){return e===-2||e===-1||e===32}var dt=B(/\p{P}|\p{S}/u),z=B(/\s/);function B(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}var ft=`phrasing`,pt=[`autolink`,`link`,`image`,`label`];function mt(){return{transforms:[St],enter:{literalAutolink:gt,literalAutolinkEmail:_t,literalAutolinkHttp:_t,literalAutolinkWww:_t},exit:{literalAutolink:xt,literalAutolinkEmail:bt,literalAutolinkHttp:vt,literalAutolinkWww:yt}}}function ht(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:ft,notInConstruct:pt},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:ft,notInConstruct:pt},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:ft,notInConstruct:pt}]}}function gt(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function _t(e){this.config.enter.autolinkProtocol.call(this,e)}function vt(e){this.config.exit.autolinkProtocol.call(this,e)}function yt(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function bt(e){this.config.exit.autolinkEmail.call(this,e)}function xt(e){this.exit(e)}function St(e){nt(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Ct],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,wt]],{ignore:[`link`,`linkReference`]})}function Ct(e,t,n,r,i){let a=``;if(!Dt(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!Tt(n)))return!1;let o=Et(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function wt(e,t,n,r){return!Dt(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function Tt(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function Et(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=de(e,`(`),a=de(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function Dt(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||z(n)||dt(n))&&(!t||n!==47)}function V(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}Lt.peek=It;function Ot(){this.buffer()}function kt(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function At(){this.buffer()}function jt(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function Mt(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=V(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Nt(e){this.exit(e)}function Pt(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=V(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Ft(e){this.exit(e)}function It(){return`[`}function Lt(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function Rt(){return{enter:{gfmFootnoteCallString:Ot,gfmFootnoteCall:kt,gfmFootnoteDefinitionLabelString:At,gfmFootnoteDefinition:jt},exit:{gfmFootnoteCallString:Mt,gfmFootnoteCall:Nt,gfmFootnoteDefinitionLabelString:Pt,gfmFootnoteDefinition:Ft}}}function zt(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Lt},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
1
+ import{a as e,n as t,r as n,t as r}from"./react-DH3P2YXY.js";import{n as i,t as a}from"./jsx-runtime-BnjsACtP.js";import{Bd as o,Jn as s,Ju as c,Km as l,Vd as u,Wd as d,Xm as f,Xu as p,Ym as m,Yu as h,fr as g,t as _,tE as v,ts as y,xb as b,zd as x}from"./utils-CBe1bHL7.js";import{R as S,W as C}from"./runtime-CeFhsGnm.js";import{T as w,V as T,w as E}from"./entities-eRiwvW2F.js";import{Sn as D,fn as O,hn as k,sn as ee,vn as te,yn as A}from"./runtime-BOlBBevr.js";import{t as j}from"./spinner-BZh9P0sD.js";import{t as ne}from"./useNavigate-Cdrlv-yJ.js";import{i as re}from"./toast-C61oyZY1.js";import{D as M,q as ie,s as ae}from"./useSettings-VTow9ZEM.js";import{f as oe}from"./server-DvWrfyUO.js";import{n as se}from"./session-D3gY-tOR.js";import{t as ce}from"./use-atom-command-Bt7x9oO0.js";import{u as le}from"./rightPanelStore-Cv1U3yrU.js";import{t as ue}from"./toastHelpers-DxXYm50b.js";import{N as de}from"./diffRendering-MXukhqw1.js";import{a as fe,n as pe,t as me}from"./tooltip-ChmjT8Ns.js";import{n as he}from"./browserHistoryStore-TJXTYA-V.js";import{a as ge,n as _e}from"./openFileInPreview-CiPuDrfB.js";import{t as ve}from"./preview-ipLyyv_l.js";import{n as ye}from"./sourceControlClients-DGnHi6Rd.js";import{i as be,r as xe,t as Se}from"./browserLinkTarget-DRbX4L_9.js";import{n as Ce,t as we}from"./pullRequestIcons-DPbMXqGp.js";import{D as Te}from"./pullRequests-DggtcbhA.js";var N=i();function Ee(e){return e?.threadPullRequests===!0?`multiple`:e?.threadPullRequestLinking===!0?`single`:`unsupported`}function De({capabilities:e,threadId:t,reference:n,legacyProjectId:r,legacyRepository:i,linked:a}){let o=ee(n);switch(Ee(e)){case`multiple`:return a?{type:`thread.pull-request.link`,input:{threadId:t,...n,...o,source:`manual`}}:{type:`thread.pull-request.unlink`,input:{threadId:t,...o}};case`single`:return a&&r===null?null:{type:`thread.meta.update`,input:{threadId:t,linkedPullRequest:a&&r!==null?{projectId:r,repository:i??n.repository,number:n.number,url:n.url}:null}};case`unsupported`:return null}}var Oe={metaKey:!1,ctrlKey:!1};function ke(e){let t=(0,N.c)(4),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={reportFailure:!1},t[0]=n):n=t[0];let r=ce(ve.open,n),i;return t[1]!==r||t[2]!==e?(i=async(t,n)=>{let i=n===void 0?{}:n,a=i.threadRef??e;if(be({url:t,event:i.event??Oe,preference:await xe(),canOpenInApp:a!=null&&se(a.environmentId,`preview:operate`)&&Se(a)})===`app`&&a){let e=await ge({threadRef:a,url:t,openPreview:r});if(S(e))return;if(e._tag===`Success`){he(a,t);return}let n=C(e);if(n instanceof _e)throw n;console.error(e.cause)}let o=ie();if(!o)throw Error(`Link opening is unavailable.`);await o.shell.openExternal(t)},t[1]=r,t[2]=e,t[3]=i):i=t[3],i}function Ae(e,t){return e.find(e=>{let n=e.repositoryIdentity;return n?.provider!==void 0&&ye.get(n.provider).isChangeRequestInRepository(n,t)})}function je({environmentId:e,projects:t,pullRequestsEnabled:n,url:r}){if(!n||e===null)return null;let i=A(r);if(i===null)return null;let a=Ae(t.filter(t=>t.environmentId===e),i);return a===void 0?null:{environmentId:e,input:{projectId:a.id,host:i.authority??i.host,repository:D(a.repositoryIdentity)??i.repository,number:i.number}}}function Me(e,t){let n=(0,N.c)(7),r=E(),i;n[0]===e?i=n[1]:(i=oe.configValueAtom(e),n[0]=e,n[1]=i);let a=y(i)?.environment.capabilities.pullRequests===!0,o;return n[2]!==e||n[3]!==r||n[4]!==a||n[5]!==t?(o=je({environmentId:e,projects:r,pullRequestsEnabled:a,url:t}),n[2]=e,n[3]=r,n[4]=a,n[5]=t,n[6]=o):o=n[6],o}function Ne(e,t){let n=Ae(e,t);return n===void 0?e.find(e=>{let n=e.repositoryIdentity;return n?.provider!==void 0&&ye.get(n.provider).canReadChangeRequestOnHost(n,t)}):n}function Pe(e){return e.metaKey||e.ctrlKey}function Fe(e,t){let n=(0,N.c)(8),r=ne(),i=E(),a=w(),o=M(),s=ae(Ie),c;return n[0]!==i||n[1]!==r||n[2]!==s||n[3]!==t||n[4]!==o||n[5]!==a||n[6]!==e?(c=(n,c,l,u)=>{if(!s||Pe(n))return!1;let d=l??e,f=t??d,p=A(c);if(p===null)return!1;let m=e=>a.get(e)?.environment.capabilities.pullRequests===!0,h=d?i.filter(e=>e.environmentId===d.environmentId):u?i.filter(e=>e.environmentId===u):i.filter(e=>m(e.environmentId)).toSorted((e,t)=>Number(t.environmentId===o)-Number(e.environmentId===o)),g=Ae(h,p)??(f?Ne(h.filter(e=>a.get(e.environmentId)?.environment.capabilities.threadPullRequests===!0),p):void 0);if(g===void 0||!m(g.environmentId))return!1;let _=a.get(g.environmentId)?.environment.capabilities.threadPullRequests===!0?p.repository:D(g.repositoryIdentity)??p.repository;return n.preventDefault(),n.stopPropagation(),f?(le.getState().openPullRequest(f,{...f.environmentId===g.environmentId?{}:{environmentId:g.environmentId},projectId:g.id,...a.get(g.environmentId)?.environment.capabilities.threadPullRequests===!0?{host:p.authority??p.host}:{},repository:_,url:c,number:p.number}),d||r({to:`/pull-requests`,search:e=>({...e,involvement:e.involvement??`all`,state:e.state??`all`,repository:_,number:p.number,selectedHost:p.authority??p.host,selectedProjectId:g.id,selectedEnvironmentId:g.environmentId}),replace:!0}),!0):(r({to:`/pull-requests`,search:{involvement:`all`,state:`all`,repository:_,number:p.number,selectedHost:p.authority??p.host,selectedProjectId:g.id,selectedEnvironmentId:g.environmentId}}),!0)},n[0]=i,n[1]=r,n[2]=s,n[3]=t,n[4]=o,n[5]=a,n[6]=e,n[7]=c):c=n[7],c}function Ie(e){return e.pullRequestLinksOpenInApp}function Le(e){let t=(0,N.c)(3),n=Fe(e),r=ke(e),i;return t[0]!==n||t[1]!==r?(i=(e,t,i)=>{e.stopPropagation();let a=Pe(e),o=e.currentTarget instanceof HTMLAnchorElement&&e.currentTarget.href.length>0;return a&&o?!1:(e.preventDefault(),!a&&n(e,t,i)?!0:(r(t,{event:e,threadRef:i}).catch(Re),!1))},t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function Re(e){console.error(e),re.add(ue({type:`error`,title:`Unable to open pull request link`,description:e instanceof Error?e.message:`An error occurred.`}))}function ze(e,t,n){return e===`unsupported`?!1:e===`multiple`||Ae(t,n)!==void 0}function Be(e){let t=(0,N.c)(30),n=w(),r=E(),i,a;t[0]!==n||t[1]!==e?(i=e==null?void 0:n.get(e)?.environment.capabilities,a=Ee(i),t[0]=n,t[1]=e,t[2]=i,t[3]=a):(i=t[2],a=t[3]);let o=a,s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s={reportFailure:!1},t[4]=s):s=t[4];let c=ce(T.linkPullRequest,s),l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l={reportFailure:!1},t[5]=l):l=t[5];let u=ce(T.unlinkPullRequest,l),d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d={reportFailure:!1},t[6]=d):d=t[6];let f=ce(T.updateMetadata,d),p;if(t[7]!==e||t[8]!==r){let n;t[10]===e?n=t[11]:(n=t=>t.environmentId===e,t[10]=e,t[11]=n),p=r.filter(n),t[7]=e,t[8]=r,t[9]=p}else p=t[9];let m=p,h;t[12]!==m||t[13]!==o?(h=e=>{let t=A(e);return t!==null&&ze(o,m,t)},t[12]=m,t[13]=o,t[14]=h):h=t[14];let g=h,_;t[15]===o?_=t[16]:(_=(e,t)=>{if(e===null||o===`unsupported`)return!1;if(o!==`multiple`)return e.linkedPullRequest!=null&&te(e.linkedPullRequest,t);let n=A(t);return n!==null&&k(e.pullRequests??[]).some(e=>O(e,n))},t[15]=o,t[16]=_);let v=_,y;t[17]!==g||t[18]!==i||t[19]!==e||t[20]!==m||t[21]!==c||t[22]!==u||t[23]!==f?(y=async(t,n,r)=>{let a=A(n);if(a===null||t.environmentId!==e||r&&!g(n))throw Error(`The pull request is not available in this environment.`);let o=Ae(m,a),s=De({capabilities:i,threadId:t.threadId,reference:{...a,url:n},legacyProjectId:o?.id??null,legacyRepository:D(o?.repositoryIdentity)??void 0,linked:r});if(s===null)throw Error(`This environment does not support linking this pull request.`);let l=await(s.type===`thread.meta.update`?f({environmentId:t.environmentId,input:s.input}):s.type===`thread.pull-request.link`?c({environmentId:t.environmentId,input:s.input}):u({environmentId:t.environmentId,input:s.input}));if(l._tag===`Failure`)throw S(l)?Error(`Link update interrupted.`):C(l)},t[17]=g,t[18]=i,t[19]=e,t[20]=m,t[21]=c,t[22]=u,t[23]=f,t[24]=y):y=t[24];let b=y,x;return t[25]!==g||t[26]!==b||t[27]!==v||t[28]!==o?(x={mode:o,canLink:g,isLinked:v,changeLink:b},t[25]=g,t[26]=b,t[27]=v,t[28]=o,t[29]=x):x=t[29],x}function Ve(){}function He(){}var Ue=(function(e){if(e==null)return Je;if(typeof e==`function`)return qe(e);if(typeof e==`object`)return Array.isArray(e)?We(e):Ge(e);if(typeof e==`string`)return Ke(e);throw Error(`Expected function, string, or object as test`)});function We(e){let t=[],n=-1;for(;++n<e.length;)t[n]=Ue(e[n]);return qe(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function Ge(e){let t=e;return qe(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function Ke(e){return qe(t);function t(t){return t&&t.type===e}}function qe(e){return t;function t(t,n,r){return!!(Ye(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function Je(){return!0}function Ye(e){return typeof e==`object`&&!!e&&`type`in e}function Xe(e){return e}var Ze=[];function Qe(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=Ue(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+Xe(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=Ze,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=$e(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function $e(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?Ze:[e]}function et(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),Qe(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}function tt(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function nt(e,t,n){let r=Ue((n||{}).ignore||[]),i=rt(t),a=-1;for(;++a<i.length;)Qe(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function rt(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([it(e[0]),at(e[1])])}return t}function it(e){return typeof e==`string`?new RegExp(tt(e),`g`):e}function at(e){return typeof e==`function`?e:function(){return e}}var P=B(/[A-Za-z]/),F=B(/[\dA-Za-z]/),ot=B(/[#-'*+\--9=?A-Z^-~]/);function st(e){return e!==null&&(e<32||e===127)}var ct=B(/\d/),lt=B(/[\dA-Fa-f]/),ut=B(/[!-/:-@[-`{-~]/);function I(e){return e!==null&&e<-2}function L(e){return e!==null&&(e<0||e===32)}function R(e){return e===-2||e===-1||e===32}var dt=B(/\p{P}|\p{S}/u),z=B(/\s/);function B(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}var ft=`phrasing`,pt=[`autolink`,`link`,`image`,`label`];function mt(){return{transforms:[St],enter:{literalAutolink:gt,literalAutolinkEmail:_t,literalAutolinkHttp:_t,literalAutolinkWww:_t},exit:{literalAutolink:xt,literalAutolinkEmail:bt,literalAutolinkHttp:vt,literalAutolinkWww:yt}}}function ht(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:ft,notInConstruct:pt},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:ft,notInConstruct:pt},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:ft,notInConstruct:pt}]}}function gt(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function _t(e){this.config.enter.autolinkProtocol.call(this,e)}function vt(e){this.config.exit.autolinkProtocol.call(this,e)}function yt(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function bt(e){this.config.exit.autolinkEmail.call(this,e)}function xt(e){this.exit(e)}function St(e){nt(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Ct],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,wt]],{ignore:[`link`,`linkReference`]})}function Ct(e,t,n,r,i){let a=``;if(!Dt(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!Tt(n)))return!1;let o=Et(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function wt(e,t,n,r){return!Dt(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function Tt(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function Et(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=de(e,`(`),a=de(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function Dt(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||z(n)||dt(n))&&(!t||n!==47)}function V(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}Lt.peek=It;function Ot(){this.buffer()}function kt(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function At(){this.buffer()}function jt(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function Mt(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=V(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Nt(e){this.exit(e)}function Pt(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=V(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Ft(e){this.exit(e)}function It(){return`[`}function Lt(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function Rt(){return{enter:{gfmFootnoteCallString:Ot,gfmFootnoteCall:kt,gfmFootnoteDefinitionLabelString:At,gfmFootnoteDefinition:jt},exit:{gfmFootnoteCallString:Mt,gfmFootnoteCall:Nt,gfmFootnoteDefinitionLabelString:Pt,gfmFootnoteDefinition:Ft}}}function zt(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Lt},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
2
2
  `:` `)+r.indentLines(r.containerFlow(e,a.current()),t?Vt:Bt))),s(),o}}function Bt(e,t,n){return t===0?e:Vt(e,t,n)}function Vt(e,t,n){return(n?``:` `)+e}var Ht=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];qt.peek=Jt;function Ut(){return{canContainEols:[`delete`],enter:{strikethrough:Gt},exit:{strikethrough:Kt}}}function Wt(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:Ht}],handlers:{delete:qt}}}function Gt(e){this.enter({type:`delete`,children:[]},e)}function Kt(e){this.exit(e)}function qt(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function Jt(){return`~`}function Yt(e){return e.length}function Xt(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||Yt,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=Zt(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=Qt(r[d]);else{let e=Qt(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&(n.alignDelimiters!==!1||i!==``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
3
3
  `)}function Zt(e){return e==null?``:String(e)}function Qt(e){let t=typeof e==`string`?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function $t(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),en);return i(),o}function en(e,t,n){return`>`+(n?``:` `)+e}function tn(e,t){return nn(e,t.inConstruct,!0)&&!nn(e,t.notInConstruct,!1)}function nn(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function rn(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
4
4
  `&&tn(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
@@ -20,4 +20,4 @@ import{a as e,n as t,r as n,t as r}from"./react-DH3P2YXY.js";import{n as i,t as
20
20
  `,before:c,encode:[`$`],...a.current()})),t()}return c+=a.move(`
21
21
  `),i&&(c+=a.move(i+`
22
22
  `)),c+=a.move(o),s(),c}function r(e,n,r){let i=e.value||``,a=1;for(t||a++;RegExp(`(^|[^$])`+`\\$`.repeat(a)+`([^$]|$)`).test(i);)a++;let o=`$`.repeat(a);/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^\$|\$$/.test(i))&&(i=` `+i+` `);let s=-1;for(;++s<r.unsafe.length;){let e=r.unsafe[s];if(!e.atBreak)continue;let t=r.compilePattern(e),n;for(;n=t.exec(i);){let e=n.index;i.codePointAt(e)===10&&i.codePointAt(e-1)===13&&e--,i=i.slice(0,e)+` `+i.slice(n.index+1)}}return o+i+o}function i(){return`$`}}var Pc={tokenize:Ic,concrete:!0,name:`mathFlow`},Fc={tokenize:Lc,partial:!0};function Ic(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===Y.linePrefix?i[2].sliceSerialize(i[1],!0).length:0,o=0,s=!1,c=0,l=!1;return u;function u(t){return J.dollarSign,e.enter(`mathFlow`),e.enter(`mathFlowFence`),e.enter(`mathFlowFenceSequence`),d(t)}function d(t){return t===J.dollarSign?(e.consume(t),o++,d):o<2?n(t):(e.exit(`mathFlowFenceSequence`),K(e,f,Y.whitespace)(t))}function f(n){return n===J.eof||I(n)?p(n):(e.exit(`mathFlowFence`),r.interrupt?t(n):g(n))}function p(n){return e.exit(`mathFlowFence`),r.interrupt?t(n):e.attempt(Fc,m,b)(n)}function m(t){return e.attempt({tokenize:x,partial:!0},b,h)(t)}function h(t){return(a?K(e,g,Y.linePrefix,a+1):g)(t)}function g(t){return t===J.eof?b(t):I(t)?e.attempt(Fc,m,b)(t):t===J.dollarSign?e.attempt({tokenize:y,partial:!0},b,v)(t):(e.enter(`mathFlowValue`),_(t))}function _(t){let n=c%2==1;return c=t===J.backslash?c+1:0,t===J.eof||I(t)?(e.exit(`mathFlowValue`),g(t)):t===J.dollarSign&&!n?(e.exit(`mathFlowValue`),e.attempt({tokenize:y,partial:!0},b,v)(t)):(e.consume(t),_)}function v(t){return l?n(t):(e.enter(`mathFlowValue`),e.consume(t),_)}function y(e,t,n){let r=0;return i;function i(t){return e.enter(`mathFlowFence`),e.enter(`mathFlowFenceSequence`),a(t)}function a(t){return t===J.dollarSign?(r++,e.consume(t),a):r<o?n(t):(e.exit(`mathFlowFenceSequence`),K(e,c,Y.whitespace)(t))}function c(r){return r===J.eof||I(r)?(e.exit(`mathFlowFence`),s=!0,t(r)):(l=!0,n(r))}}function b(r){return s?(e.exit(`mathFlow`),t(r)):n(r)}function x(e,t,n){let i=0;return r.parser.constructs.disable.null,K(e,a,Y.linePrefix,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:Va.tabSize);function a(t){return e.enter(`mathFlowFence`),e.enter(`mathFlowFenceSequence`),c(t)}function c(t){return t===J.dollarSign?(i++,e.consume(t),c):i<o?n(t):(e.exit(`mathFlowFenceSequence`),K(e,l,Y.whitespace)(t))}function l(r){return r===J.eof||I(r)?(e.exit(`mathFlowFence`),s=!0,t(r)):n(r)}}}function Lc(e,t,n){let r=this;return i;function i(n){return n===null?t(n):(e.enter(Y.lineEnding),e.consume(n),e.exit(Y.lineEnding),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function Rc(e){let t=(e||{}).singleDollarTextMath;return t??=!0,{tokenize:n,resolve:zc,previous:Bc,name:`mathText`};function n(e,n,r){let i=this,a=0,o,s,c,l,u=0,d,f;return p;function p(t){return J.dollarSign,Bc.call(i,i.previous),e.enter(`mathText`),e.enter(`mathTextSequence`),m(t)}function m(n){return n===J.dollarSign?(e.consume(n),a++,m):a<2&&!t||(e.exit(`mathTextSequence`),I(n))||(c=n===J.space||n===J.horizontalTab||n===J.comma,a===1&&c)?r(n):h(n)}function h(t){return t===J.eof||t===J.graveAccent||(a===1||i.mathSingleLine)&&I(t)?r(t):t===J.dollarSign?(s=e.enter(`mathTextSequence`),o=0,l=i.previous,_(t)):t===J.space?(e.enter(`space`),e.consume(t),e.exit(`space`),h):I(t)?(e.enter(Y.lineEnding),e.consume(t),e.exit(Y.lineEnding),h):(e.enter(`mathTextData`),g(t))}function g(t){return t===J.graveAccent?r(t):t===J.dollarSign&&u%2==1?(u=0,e.consume(t),g):t===J.slash&&d===J.slash&&f===J.colon?r(t):(f=d,d=t,u=t===J.backslash?u+1:0,t===J.eof||t===J.space||t===J.dollarSign||I(t)?(e.exit(`mathTextData`),h(t)):(e.consume(t),g))}function _(t){if(t===J.dollarSign)return e.consume(t),o++,_;if(o===a){if(I(l)||t!==null&&t>=J.digit0&&t<=J.digit9)return r(t);let i=l===J.space||l===J.horizontalTab||l===J.comma;return c===i?(e.exit(`mathTextSequence`),e.exit(`mathText`),n(t)):r(t)}return s.type=`mathTextData`,g(t)}}}function zc(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===Y.lineEnding||e[n][1].type===`space`)&&(e[t][1].type===Y.lineEnding||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`mathTextData`){e[t][1].type=`mathTextPadding`,e[n][1].type=`mathTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==Y.lineEnding&&(i=r):(r===t||e[r][1].type===Y.lineEnding)&&(e[i][1].type=`mathTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Bc(e){return e!==J.dollarSign||this.events[this.events.length-1][1].type===Y.characterEscape}var Vc={tokenize:Uc,concrete:!0,name:`mathTexFlow`},Hc={tokenize:Wc,partial:!0};function Uc(e,t,n){let r=this,i=!1,a=r.events[r.events.length-1],o=a&&a[1].type===Y.linePrefix?a[2].sliceSerialize(a[1],!0).length:0;return s;function s(t){return J.backslash,e.enter(`mathFlow`),e.enter(`mathFlowFence`),e.enter(`mathFlowFenceSequence`),e.consume(t),c}function c(t){return t===J.leftSquareBracket?(e.consume(t),e.exit(`mathFlowFenceSequence`),K(e,l,Y.whitespace)):n(t)}function l(i){return i!==J.eof&&!I(i)?n(i):(e.exit(`mathFlowFence`),r.interrupt?t(i):e.attempt(Hc,u,g)(i))}function u(t){return t===J.eof?g(t):e.attempt({tokenize:_,partial:!0},g,d)(t)}function d(t){return(o?K(e,f,Y.linePrefix,o+1):f)(t)}function f(t){return t===J.eof?g(t):t===J.backslash?e.attempt({tokenize:Gc,partial:!0},h,p)(t):I(t)?e.attempt(Hc,u,g)(t):(e.enter(`mathFlowValue`),h(t))}function p(t){return e.attempt({tokenize:_,partial:!0},g,m)(t)}function m(t){return e.enter(`mathFlowValue`),e.consume(t),h}function h(t){return t===J.eof||t===J.backslash||I(t)?(e.exit(`mathFlowValue`),f(t)):(e.consume(t),h)}function g(r){return i?(e.exit(`mathFlow`),t(r)):n(r)}function _(e,t,n){return r.parser.constructs.disable.null,K(e,a,Y.linePrefix,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:Va.tabSize);function a(t){return e.enter(`mathFlowFence`),e.enter(`mathFlowFenceSequence`),e.consume(t),o}function o(t){return t===J.rightSquareBracket?(e.consume(t),e.exit(`mathFlowFenceSequence`),K(e,s,Y.whitespace)):n(t)}function s(r){return r===J.eof||I(r)?(e.exit(`mathFlowFence`),i=!0,t(r)):n(r)}}}function Wc(e,t,n){let r=this;return i;function i(n){return n===null?t(n):I(n)?(e.enter(Y.lineEnding),e.consume(n),e.exit(Y.lineEnding),a):a(n)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function Gc(e,t,n){return r;function r(t){return J.backslash,e.enter(`mathFlowValue`),e.consume(t),i}function i(e){return e===J.rightSquareBracket?n(e):t(e)}}var Kc={tokenize:qc,resolve:Rc().resolve,previous:Jc,name:`mathTexText`};function qc(e,t,n){let r=this,i,a,o=!1;return s;function s(t){return J.backslash,Jc.call(r,r.previous),e.enter(`mathText`),e.enter(`mathTextSequence`),e.consume(t),c}function c(t){return t!==J.leftParenthesis&&t!==J.leftSquareBracket?n(t):(a=t,e.consume(t),e.exit(`mathTextSequence`),l)}function l(t){return t===J.eof||t===J.graveAccent||r.mathSingleLine&&I(t)?n(t):t===J.backslash?(i=e.enter(`mathTextSequence`),e.consume(t),d):t===J.space?(e.enter(`space`),e.consume(t),e.exit(`space`),l):I(t)?(e.enter(Y.lineEnding),e.consume(t),e.exit(Y.lineEnding),l):(e.enter(`mathTextData`),u(t))}function u(t){return t===J.graveAccent?n(t):(t!==J.backslash&&t!==J.eof&&t!==J.space&&t!==J.comma&&!I(t)&&!(t>=J.digit0&&t<=J.digit9)&&(o=!0),t===J.eof||t===J.space||t===J.backslash||I(t)?(e.exit(`mathTextData`),l(t)):(e.consume(t),u))}function d(r){return r===(a===J.leftParenthesis?J.rightParenthesis:J.rightSquareBracket)?a===J.leftSquareBracket&&!o?n(r):(e.consume(r),e.exit(`mathTextSequence`),e.exit(`mathText`),t(r)):r===J.backslash?(e.consume(r),i.type=`mathTextData`,u):(i.type=`mathTextData`,u(r))}}function Jc(e){return e!==J.backslash}function Yc(e){return{flow:{[J.dollarSign]:Pc,[J.backslash]:Vc},text:{[J.dollarSign]:Rc(e),[J.backslash]:Kc}}}var Xc={};function Zc(e){let t=this,n=e||Xc,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(Yc(n)),a.push(Mc()),o.push(Nc(n))}var Qc=vs().use(Ko).use(ro).use(Zc,{singleDollarTextMath:!0}).freeze();function $c(e){return Qc.parse(e)}function el(e,t){let n=[];if(!tl(e))return n;let r=(t,i=!1)=>{let a=i||t.type===`tableCell`;if(t.type===`math`||t.type===`inlineMath`||t.type===`code`&&t.lang===`math`){let r=t.position?.start.offset,i=t.position?.end.offset;if(r===void 0||i===void 0)return;let o=e.slice(r,i);if(t.type===`code`){let e=/^[ \t]*(`{3,}|~{3,})/.exec(o)?.[1],t=/\n[ \t>]*(`{3,}|~{3,})[ \t\r]*$/.exec(o)?.[1];if(!e||!t||e[0]!==t[0]||t.length<e.length)return}let s=t.type!==`inlineMath`||/^(?:\$\$|\\\[)/.test(o);n.push({start:r,end:i,source:o,tex:t.value,display:s,inTable:a})}else`children`in t&&t.children.forEach(e=>r(e,a))};return r(t??$c(e)),n}function tl(e){return e.includes(`$`)||e.includes(`\\(`)||e.includes(`\\[`)||/(?:`{3,}|~{3,})[ \t]*math\b/.test(e)}function nl(e){return e?.includes(`language-math`)?e.includes(`math-display`)?`display`:e.includes(`math-inline`)?`inline`:null:null}var rl=class extends rc.Component{state={failed:!1,resetKeys:this.props.resetKeys};static getDerivedStateFromProps({resetKeys:e},t){return e?.length!==t.resetKeys?.length||e?.some((e,n)=>!Object.is(e,t.resetKeys?.[n]))?{failed:!1,resetKeys:e}:null}static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?this.props.fallback:this.props.children}};export{et as $,Js as A,Z as B,sc as C,$s as D,Xs as E,zs as F,nr as G,ro as H,Rs as I,L as J,F as K,Is as L,Zs as M,qs as N,Qs as O,Bs as P,nt as Q,vs as R,yc as S,nc as T,Ii as U,Ko as V,K as W,dt as X,R as Y,z as Z,_c as _,Tc as a,je as at,bc as b,uc as c,Me as ct,kc as d,Ve as et,oc as f,pc as g,lc as h,Zc as i,Ne as it,Ys as j,ec as k,Dc as l,ke as lt,Sc as m,el as n,Be as nt,Ec as o,Fe as ot,wc as p,I as q,nl as r,Ae as rt,mc as s,Le as st,rl as t,He as tt,ic as u,Ee as ut,gc as v,jc as w,xc as x,Cc as y,ds as z};
23
- //# sourceMappingURL=RenderErrorBoundary-Oe5BzG3n.js.map
23
+ //# sourceMappingURL=RenderErrorBoundary-BI5KBtsb.js.map
@@ -1,3 +1,3 @@
1
- import{_ as e,f as t,g as n,l as r,o as i,r as a,s as o,t as s}from"./77XECAW3-D_lZqaZv.js";import{a as c,i as l,s as u}from"./N3JZAHOW-Cev8Cn9M.js";import{o as d,r as f}from"./DKTLEL5E-DciMwFJ1.js";import{t as p}from"./TSHNXIZL-B_cvoUct.js";import{a as m,i as h,o as g}from"./ABYRPUBD-BPWfXZyu.js";import{PeleError as _,_ as v,i as y,r as b,u as x}from"./lazy-CeaQ3-Fj.js";var S=1e5;function C(e){switch(e){case`[]`:return`square`;case`()`:return`round`;case`(())`:return`circle`;case`>]`:return`rect_left_inv_arrow`;case`{}`:return`diamond`;case`{{}}`:return`hexagon`;case`([])`:return`stadium`;case`[[]]`:return`subroutine`;case`[()]`:return`cylinder`;case`((()))`:return`doublecircle`;case`[//]`:return`lean_right`;case`[\\\\]`:return`lean_left`;case`[/\\]`:return`trapezoid`;case`[\\/]`:return`inv_trapezoid`;case`<[]>`:return`block_arrow`;default:return`na`}}function w(e){switch(e.trim().slice(-1)){case`x`:return`arrow_cross`;case`o`:return`arrow_circle`;case`>`:return`arrow_point`;default:return``}}function T(e){switch(e.trim().charAt(0)){case`x`:return`arrow_cross`;case`o`:return`arrow_circle`;case`<`:return`arrow_point`;default:return`arrow_open`}}function E(e){return e.includes(`==`)?`thick`:`normal`}function D(e){return e.includes(`.-`)?`dotted`:`solid`}function O(e,t){let n=e.flat(),r=-1;for(let e of n)if(e.type===`column-setting`){r=e.columns??-1;break}return{list:n,at:0,parent:t,children:[],columns:r}}var k=class{type=`block`;title;root={id:`root`,type:`composite`,children:[],columns:-1};blocks=[];edges=[];classes=new Map;byId=new Map;typeStr2Type=C;edgeStrToEdgeData=w;edgeStrToEdgeStartData=T;edgeStrToThickness=E;edgeStrToPattern=D;warn;pending=new Set;edgeCount=new Map;ids=0;colors=0;spaces=0;constructor(e={}){this.warn=e.warn}generateId(){return`id-`+ ++this.ids}addStyleClass(e,t=``){let n=this.classes.get(e);n||(n={id:e,styles:[],textStyles:[]},this.classes.set(e,n));for(let e of t.split(`,`)){let t=e.indexOf(`;`),r=(t===-1?e:e.slice(0,t)+e.slice(t+1)).trim();e.includes(`color`)&&n.textStyles.push(r.replace(`fill`,`bgFill`).replace(`color`,`fill`)),n.styles.push(r)}}addStyle2Node(e,t=``){this.named(e).styles=t.split(`,`)}setCssClass(e,t){for(let n of e.split(`,`))(this.named(n.trim()).classes??=[]).push(t)}named(e){let t=this.byId.get(e);return t===void 0&&(t={id:e,type:`na`,children:[]},this.byId.set(e,t),this.pending.add(e)),t}setHierarchy(e){let t=[O(e,this.root)];for(;t.length>0;){let e=t[t.length-1];if(e.at===e.list.length){e.parent.children=e.children,t.pop();continue}let n=e.list[e.at++];switch(e.columns>0&&n.type!==`column-setting`&&typeof n.widthInColumns==`number`&&n.widthInColumns>e.columns&&this.warn?.(`Block ${n.id} width ${n.widthInColumns} exceeds configured column width ${e.columns}`),n.type){case`classDef`:this.addStyleClass(n.id,n.css);continue;case`applyClass`:this.setCssClass(n.id,n.styleClass??``);continue;case`applyStyles`:n.stylesStr&&this.addStyle2Node(n.id,n.stylesStr);continue;case`column-setting`:e.parent.columns=n.columns??-1;continue;case`edge`:{let e=(this.edgeCount.get(n.id)??0)+1;this.edgeCount.set(n.id,e),n.id=e+`-`+n.id,this.edges.push(n);continue}}n.id??=this.generateId(),n.label||=n.type===`composite`?``:n.id;let r=this.byId.get(n.id),i=r===void 0||this.pending.delete(n.id);i?(r&&(n.classes=r.classes,n.styles=r.styles),n.type===`composite`&&(n.colorIndex=this.colors++),this.byId.set(n.id,n)):(n.type!==`na`&&(r.type=n.type),n.label!==n.id&&(r.label=n.label));let a=n.children;if(n.children=[],n.type===`space`){let t=n.width??1;if(!(t<=S-this.spaces))throw new _(`A block diagram can hold at most ${S} space blocks.`,`limit`,{type:`block`});this.spaces+=Math.max(t,0);for(let r=0;r<t;r++){let t={...n,id:n.id+`-`+r,children:[]};this.byId.set(t.id,t),e.children.push(t)}}else i&&e.children.push(n);a&&a.length>0&&t.push(O(a,n))}this.blocks=this.root.children??[]}},A=`$end.INVALID.BLOCK_DIAGRAM_KEY.id-block.COLUMNS.MD_STR.STR.SPACE_BLOCK.DEFAULT.LINKSTYLE.INTERPOLATE.classDef.DEFAULT_CLASSDEF_ID.CLASSDEF_ID.CLASSDEF_STYLEOPTS.class.CLASSENTITY_IDS.STYLECLASS.style.STYLE_ENTITY_IDS.STYLE_DEFINITION_DATA.acc_title.acc_title_value.acc_descr.acc_descr_value.acc_descr_multiline_value.end.NODE_DSTART.NODE_DEND.BLOCK_ARROW_START.BLOCK_ARROW_END.DIR.NODE_ID.LINK.START_LINK.LINK_LABEL.SIZE.EOF`.split(`.`),j=[`right`,`left`,`x`,`y`,`up`,`down`],M=new Uint8Array(128);for(let e of[9,10,11,12,13,32,40,41,45,58,60,61,62,91,123,125])M[e]=1;function ee(e){let t=e.length,n=[],r=[],i=[],a=[],o=0,s=0,c=(e,t,a)=>(n.push(e),r.push(t),i.push(s),s=a,!0),l=(t,n)=>c(t,e.slice(s,n),n),u=e=>{a.push(o),o=e},d=()=>{a.length>0&&(o=a.pop())},f=n=>{for(;n<t&&b(e.charCodeAt(n));)n++;return n},p=n=>{for(;n<t;){let t=e.charCodeAt(n);if(t<48||t>57)break;n++}return n},m=n=>{for(;n<t&&y(e.charCodeAt(n));)n++;return n},h=t=>e.startsWith(t,s)&&!y(e.charCodeAt(s+t.length)),g=()=>(e.charCodeAt(s+1)===96?(u(2),s+=2):(u(1),s++),!0),_=t=>{if(e.charCodeAt(t)!==46)return-1;do t++;while(e.charCodeAt(t)===46);if(e.charCodeAt(t)!==45)return-1;let n=e.charCodeAt(t+1);return n===120||n===111||n===62?t+2:t+1},v=t=>{let n=e.charCodeAt(t);(n===120||n===111||n===60)&&t++;let r=e.charCodeAt(t);if(r===46)return _(t);if(r!==45&&r!==61)return-1;let i=t+1;for(;e.charCodeAt(i)===r;)i++;if(i-t===1)return r===45?_(i):-1;let a=e.charCodeAt(i);return a===120||a===111||a===62?i+1:i-t>=3?i:-1},x=()=>{let t=v(s);if(t>=0)return l(33,f(t));let n=e.charCodeAt(s)===60?s+1:s,r=e.charCodeAt(n),i=e.charCodeAt(n+1);return r===45&&(i===45||i===46)||r===61&&i===61?(u(6),l(34,f(n+2))):!1},S=n=>{let r=e.indexOf(`
1
+ import{_ as e,f as t,g as n,l as r,o as i,r as a,s as o,t as s}from"./77XECAW3-ECBcD47O.js";import{a as c,i as l,s as u}from"./N3JZAHOW-CPZZhC9o.js";import{o as d,r as f}from"./DKTLEL5E-DciMwFJ1.js";import{t as p}from"./TSHNXIZL-CmCl4WMk.js";import{a as m,i as h,o as g}from"./ABYRPUBD-B4F4wZam.js";import{PeleError as _,_ as v,i as y,r as b,u as x}from"./lazy-Ccs3klKO.js";var S=1e5;function C(e){switch(e){case`[]`:return`square`;case`()`:return`round`;case`(())`:return`circle`;case`>]`:return`rect_left_inv_arrow`;case`{}`:return`diamond`;case`{{}}`:return`hexagon`;case`([])`:return`stadium`;case`[[]]`:return`subroutine`;case`[()]`:return`cylinder`;case`((()))`:return`doublecircle`;case`[//]`:return`lean_right`;case`[\\\\]`:return`lean_left`;case`[/\\]`:return`trapezoid`;case`[\\/]`:return`inv_trapezoid`;case`<[]>`:return`block_arrow`;default:return`na`}}function w(e){switch(e.trim().slice(-1)){case`x`:return`arrow_cross`;case`o`:return`arrow_circle`;case`>`:return`arrow_point`;default:return``}}function T(e){switch(e.trim().charAt(0)){case`x`:return`arrow_cross`;case`o`:return`arrow_circle`;case`<`:return`arrow_point`;default:return`arrow_open`}}function E(e){return e.includes(`==`)?`thick`:`normal`}function D(e){return e.includes(`.-`)?`dotted`:`solid`}function O(e,t){let n=e.flat(),r=-1;for(let e of n)if(e.type===`column-setting`){r=e.columns??-1;break}return{list:n,at:0,parent:t,children:[],columns:r}}var k=class{type=`block`;title;root={id:`root`,type:`composite`,children:[],columns:-1};blocks=[];edges=[];classes=new Map;byId=new Map;typeStr2Type=C;edgeStrToEdgeData=w;edgeStrToEdgeStartData=T;edgeStrToThickness=E;edgeStrToPattern=D;warn;pending=new Set;edgeCount=new Map;ids=0;colors=0;spaces=0;constructor(e={}){this.warn=e.warn}generateId(){return`id-`+ ++this.ids}addStyleClass(e,t=``){let n=this.classes.get(e);n||(n={id:e,styles:[],textStyles:[]},this.classes.set(e,n));for(let e of t.split(`,`)){let t=e.indexOf(`;`),r=(t===-1?e:e.slice(0,t)+e.slice(t+1)).trim();e.includes(`color`)&&n.textStyles.push(r.replace(`fill`,`bgFill`).replace(`color`,`fill`)),n.styles.push(r)}}addStyle2Node(e,t=``){this.named(e).styles=t.split(`,`)}setCssClass(e,t){for(let n of e.split(`,`))(this.named(n.trim()).classes??=[]).push(t)}named(e){let t=this.byId.get(e);return t===void 0&&(t={id:e,type:`na`,children:[]},this.byId.set(e,t),this.pending.add(e)),t}setHierarchy(e){let t=[O(e,this.root)];for(;t.length>0;){let e=t[t.length-1];if(e.at===e.list.length){e.parent.children=e.children,t.pop();continue}let n=e.list[e.at++];switch(e.columns>0&&n.type!==`column-setting`&&typeof n.widthInColumns==`number`&&n.widthInColumns>e.columns&&this.warn?.(`Block ${n.id} width ${n.widthInColumns} exceeds configured column width ${e.columns}`),n.type){case`classDef`:this.addStyleClass(n.id,n.css);continue;case`applyClass`:this.setCssClass(n.id,n.styleClass??``);continue;case`applyStyles`:n.stylesStr&&this.addStyle2Node(n.id,n.stylesStr);continue;case`column-setting`:e.parent.columns=n.columns??-1;continue;case`edge`:{let e=(this.edgeCount.get(n.id)??0)+1;this.edgeCount.set(n.id,e),n.id=e+`-`+n.id,this.edges.push(n);continue}}n.id??=this.generateId(),n.label||=n.type===`composite`?``:n.id;let r=this.byId.get(n.id),i=r===void 0||this.pending.delete(n.id);i?(r&&(n.classes=r.classes,n.styles=r.styles),n.type===`composite`&&(n.colorIndex=this.colors++),this.byId.set(n.id,n)):(n.type!==`na`&&(r.type=n.type),n.label!==n.id&&(r.label=n.label));let a=n.children;if(n.children=[],n.type===`space`){let t=n.width??1;if(!(t<=S-this.spaces))throw new _(`A block diagram can hold at most ${S} space blocks.`,`limit`,{type:`block`});this.spaces+=Math.max(t,0);for(let r=0;r<t;r++){let t={...n,id:n.id+`-`+r,children:[]};this.byId.set(t.id,t),e.children.push(t)}}else i&&e.children.push(n);a&&a.length>0&&t.push(O(a,n))}this.blocks=this.root.children??[]}},A=`$end.INVALID.BLOCK_DIAGRAM_KEY.id-block.COLUMNS.MD_STR.STR.SPACE_BLOCK.DEFAULT.LINKSTYLE.INTERPOLATE.classDef.DEFAULT_CLASSDEF_ID.CLASSDEF_ID.CLASSDEF_STYLEOPTS.class.CLASSENTITY_IDS.STYLECLASS.style.STYLE_ENTITY_IDS.STYLE_DEFINITION_DATA.acc_title.acc_title_value.acc_descr.acc_descr_value.acc_descr_multiline_value.end.NODE_DSTART.NODE_DEND.BLOCK_ARROW_START.BLOCK_ARROW_END.DIR.NODE_ID.LINK.START_LINK.LINK_LABEL.SIZE.EOF`.split(`.`),j=[`right`,`left`,`x`,`y`,`up`,`down`],M=new Uint8Array(128);for(let e of[9,10,11,12,13,32,40,41,45,58,60,61,62,91,123,125])M[e]=1;function ee(e){let t=e.length,n=[],r=[],i=[],a=[],o=0,s=0,c=(e,t,a)=>(n.push(e),r.push(t),i.push(s),s=a,!0),l=(t,n)=>c(t,e.slice(s,n),n),u=e=>{a.push(o),o=e},d=()=>{a.length>0&&(o=a.pop())},f=n=>{for(;n<t&&b(e.charCodeAt(n));)n++;return n},p=n=>{for(;n<t;){let t=e.charCodeAt(n);if(t<48||t>57)break;n++}return n},m=n=>{for(;n<t&&y(e.charCodeAt(n));)n++;return n},h=t=>e.startsWith(t,s)&&!y(e.charCodeAt(s+t.length)),g=()=>(e.charCodeAt(s+1)===96?(u(2),s+=2):(u(1),s++),!0),_=t=>{if(e.charCodeAt(t)!==46)return-1;do t++;while(e.charCodeAt(t)===46);if(e.charCodeAt(t)!==45)return-1;let n=e.charCodeAt(t+1);return n===120||n===111||n===62?t+2:t+1},v=t=>{let n=e.charCodeAt(t);(n===120||n===111||n===60)&&t++;let r=e.charCodeAt(t);if(r===46)return _(t);if(r!==45&&r!==61)return-1;let i=t+1;for(;e.charCodeAt(i)===r;)i++;if(i-t===1)return r===45?_(i):-1;let a=e.charCodeAt(i);return a===120||a===111||a===62?i+1:i-t>=3?i:-1},x=()=>{let t=v(s);if(t>=0)return l(33,f(t));let n=e.charCodeAt(s)===60?s+1:s,r=e.charCodeAt(n),i=e.charCodeAt(n+1);return r===45&&(i===45||i===46)||r===61&&i===61?(u(6),l(34,f(n+2))):!1},S=n=>{let r=e.indexOf(`
2
2
  `,s);return r===-1&&(r=t),d(),l(n,r)},C=(t,n)=>{let r=m(s);if(r===s)return!1;for(;e.charCodeAt(r)===44;){let e=f(r+1),t=m(e);if(t===e)break;r=t}return o=n,l(t,r)},w=n=>{if(b(n))return s=f(s+1),!0;let r;switch(n){case 98:if(e.startsWith(`block`,s)){if(h(`block-beta`))return l(2,s+10);if(e.charCodeAt(s+5)===58)return l(3,s+6);if(!y(e.charCodeAt(s+5)))return l(2,s+5)}break;case 99:if(e.startsWith(`columns`,s)){if(r=f(s+7),r>s+7){if(e.startsWith(`auto`,r)&&!y(e.charCodeAt(r+4)))return c(4,`-1`,r+4);let t=p(r);if(t>r)return c(4,e.slice(r,t),t)}}else if(e.startsWith(`class`,s)){let t=e.startsWith(`Def`,s+5),n=t?s+8:s+5;if(r=f(n),r>n)return u(t?7:9),l(t?11:15,r)}break;case 34:return g();case 115:if(e.startsWith(`space`,s)){if(e.charCodeAt(s+5)===58){let t=p(s+6);if(t>s+6)return c(7,e.slice(s+6,t),t)}if(!y(e.charCodeAt(s+5)))return c(7,`1`,s+5)}else if(e.startsWith(`style`,s)&&(r=f(s+5),r>s+5))return u(11),l(18,r);break;case 100:if(h(`default`))return l(8,s+7);break;case 108:if(h(`linkStyle`))return l(9,s+9);break;case 105:if(h(`interpolate`))return l(10,s+11);break;case 97:if(e.startsWith(`accTitle`,s)){if(r=f(s+8),e.charCodeAt(r)===58)return u(13),l(21,f(r+1))}else if(e.startsWith(`accDescr`,s)){r=f(s+8);let t=e.charCodeAt(r);if(t===58)return u(14),l(23,f(r+1));if(t===123)return u(15),s=f(r+1),!0}break;case 101:if(h(`end`))return l(26,f(s+3));break;case 45:return e.charCodeAt(s+1)===41?(u(3),l(27,s+2)):x();case 61:return x();case 60:return e.charCodeAt(s+1)===91?(u(4),l(29,s+2)):x();case 40:{let t=e.charCodeAt(s+1),n=t===45||t===91?2:t===40?e.charCodeAt(s+2)===40?3:2:1;return u(3),l(27,s+n)}case 41:case 123:return u(3),l(27,e.charCodeAt(s+1)===n?s+2:s+1);case 62:return u(3),l(27,s+1);case 91:{let t=e.charCodeAt(s+1);return u(3),l(27,t===91||t===124||t===40||t===92||t===47?s+2:s+1)}case 58:{let t=p(s+1);return t>s+1&&c(36,e.slice(s+1,t),t)}}for(r=s;r<t;){let t=e.charCodeAt(r);if(t<128?M[t]===1:b(t))break;r++}return r>s&&l(32,r)},T=t=>{let n=e.charCodeAt(s+1),r=0;switch(t){case 34:return g();case 40:r=n===45?2:n===40?e.charCodeAt(s+2)===40?3:2:1;break;case 41:r=n===41?e.charCodeAt(s+2)===41?3:2:n===93?2:1;break;case 125:r=n===125?2:1;break;case 45:r=n===41?2:0;break;case 93:r=n===93||n===41||n===62?2:1;break;case 92:case 47:r=n===93?2:0}return r!==0&&(d(),l(28,s+r))},E=t=>{if(t===41)return d(),d(),c(30,`]>`,f(s+1));let n=f(t===44?s+1:s);for(let r of j)if(e.startsWith(r,n)){let i=f(n+r.length);return c(31,e.slice(t===44?n:s,i),i)}return!1};for(;;){if(s>=t){let e=-1;switch(o){case 0:e=37;break;case 1:e=6;break;case 8:e=14;break;case 10:e=17;break;case 12:e=20;break;case 13:e=22;break;case 14:e=24;break;case 15:e=25}s=t,e!==-1&&c(e,``,t);break}let a=e.charCodeAt(s),p=!0;switch(o){case 0:p=w(a);break;case 1:if(a===34)d(),s++;else{let n=e.indexOf(`"`,s);l(6,n===-1?t:n)}break;case 2:if(a===96)p=e.charCodeAt(s+1)===34,p&&(d(),s+=2);else if(a===34)p=!1;else{let n=s+1;for(;n<t;){let t=e.charCodeAt(n);if(t===96||t===34)break;n++}l(5,n)}break;case 3:p=T(a);break;case 4:if(a===34)g();else if(a===93&&e.charCodeAt(s+1)===62){let t=f(s+2);p=e.charCodeAt(t)===40,p&&(u(5),s=t+1)}else p=!1;break;case 5:p=E(a);break;case 6:if(a===34)e.charCodeAt(s+1)===96?g():(l(35,s+1),u(1));else{let e=v(f(s));p=e>=0,p&&(d(),l(33,f(e)))}break;case 7:{let t=12,n=e.startsWith(`DEFAULT`,s)?s+7:s,r=f(n);(n===s||r===n)&&(t=13,n=m(s),r=f(n)),p=n>s&&r>n,p&&(o=8,l(t,r));break}case 8:S(14);break;case 9:p=C(16,10);break;case 10:S(17);break;case 11:p=C(19,12);break;case 12:S(20);break;case 13:S(22);break;case 14:S(24);break;case 15:if(a===125)d(),s++;else{let n=e.indexOf(`}`,s);l(25,n===-1?t:n)}}if(!p)return n.push(1),r.push(``),i.push(s),{types:n,texts:r,starts:i}}return n.push(0),r.push(``),i.push(t),{types:n,texts:r,starts:i}}var N=`'NODE_ID', 'COLUMNS', 'SPACE_BLOCK', 'BLOCK_DIAGRAM_KEY', 'id-block', 'classDef', 'class', 'style'`;function P(e){let t=e[e.length-1];return Array.isArray(t)?(e.pop(),e.concat(t)):e}function te(e,t){let{types:n,texts:r,starts:i}=ee(e),a=0,o=t=>{let r=n[a];throw r===1?x(`block`,e,i[a],``,!0):x(`block`,e,i[a],`Expecting ${t}, got '${A[r]}'`)},s=e=>(n[a]!==e&&o(`'${A[e]}'`),r[a++]),c=()=>{let e=s(32);if(n[a]===27){let t=r[a++];return{id:e,label:s(6),typeStr:t+s(28)}}if(n[a]===29){let t=r[a++],i=s(6),o=[s(31)];for(;n[a]===31;)o.push(r[a++]);return{id:e,label:i,typeStr:t+s(30),directions:o}}return{id:e}},l=()=>{let e=c(),i=n[a]===36?parseInt(r[a++],10):1,o={id:e.id,label:e.label,type:t.typeStr2Type(e.typeStr),directions:e.directions,widthInColumns:i},l;for(;n[a]===33||n[a]===34;){let e=``;n[a++]===34&&(s(35),e=s(6),s(33));let i=r[a-1],u=c(),d=t.edgeStrToEdgeData(i),f=t.edgeStrToEdgeStartData(i),p=t.edgeStrToThickness(i),m=t.edgeStrToPattern(i);l??=[{id:o.id,label:o.label,type:o.type,directions:o.directions}],o={id:u.id,label:u.label,type:t.typeStr2Type(u.typeStr),directions:u.directions},l.push({id:l[l.length-1].id+`-`+u.id,start:l[l.length-1].id,end:u.id,label:e,type:`edge`,thickness:p,pattern:m,directions:u.directions,arrowTypeEnd:d,arrowTypeStart:f},o)}return l??o};s(2);let u=[],d=[];for(;;)switch(n[a]){case 32:d.push(l());break;case 4:d.push({type:`column-setting`,columns:parseInt(r[a++],10)});break;case 7:{let e=parseInt(r[a++],10);d.push({id:t.generateId(),type:`space`,label:``,width:e,children:[]});break}case 2:a++,u.push({list:d,header:void 0}),d=[];break;case 3:a++,n[a]!==32&&o(`'NODE_ID'`),u.push({list:d,header:l()}),d=[];break;case 26:{let e=u.pop();if(e===void 0||d.length===0)return o(N);a++;let n=t.generateId(),r=P(d);d=e.list,d.push(e.header===void 0?{id:n,type:`composite`,label:``,children:r}:{...e.header,type:`composite`,children:r});break}case 11:{a++;let e=s(13).trim();d.push({type:`classDef`,id:e,css:s(14).trim()});break}case 15:{a++;let e=s(16).trim();d.push({type:`applyClass`,id:e,styleClass:s(17).trim()});break}case 18:{a++;let e=s(19).trim();d.push({type:`applyStyles`,id:e,stylesStr:s(20).trim()});break}case 37:u.length>0&&o(N+`, 'end'`),d.length===0&&o(N),t.setHierarchy(P(d));return;default:o(d.length===0?N:N+(u.length>0?`, 'end'`:`, 'EOF'`))}}var F=1,I=2,L=4,R=8,z=7,B=20,V=12;function ne(e){let t=0;if(e)for(let n of e)switch(n.trim()){case`right`:t|=F;break;case`left`:t|=I;break;case`up`:t|=L;break;case`down`:t|=R;break;case`x`:t|=F|I;break;case`y`:t|=L|R}return t}var H=(e,t)=>e&t?1:0;function U(e){return e!==0&&(e&(L|R))===0?`x`:e!==0&&(e&(F|I))===0?`y`:``}function re(e,t,n){let r=U(e),i=H(e,I)-H(e,F),a=H(e,L)-H(e,R);if(r===`x`){let r=Math.max(n+8,14)+2*z,a=Math.min(r/2,B);return{w:Math.max(t+12,16)+a*(e===(F|I)?2:1),h:r,dx:i*a/2,dy:0}}if(r===`y`){let r=Math.max(t+16,14)+2*z,i=Math.min(r/2,B);return{w:r,h:Math.max(n+8,16)+i*(e===(L|R)?2:1),dx:0,dy:a*i/2}}return{w:Math.max(t+16,24)+V*(H(e,I)+H(e,F)),h:Math.max(n+8,24)+V*(H(e,L)+H(e,R)),dx:i*V/2,dy:a*V/2}}function ie(e,n,r,i){let a=U(e),o=n/2,s=r/2,c;if(a===`x`){let t=Math.min(s,B),n=s-z,r=e&I?-o+t:-o,i=e&F?o-t:o;c=[r,-n,i,-n],e&F&&c.push(i,-s,o,0,i,s),c.push(i,n,r,n),e&I&&c.push(r,s,-o,0,r,-s)}else if(a===`y`){let t=Math.min(o,B),n=o-z,r=e&L?-s+t:-s,i=e&R?s-t:s;c=[n,r,n,i],e&R&&c.push(o,i,0,s,-o,i),c.push(-n,i,-n,r),e&L&&c.push(-o,r,0,-s,o,r)}else{let t=e&I?-o+V:-o,n=e&F?o-V:o,r=e&L?-s+V:-s,i=e&R?s-V:s,a=(t+n)/2,l=(r+i)/2,u=Math.min(10,(n-t)/2),d=Math.min(10,(i-r)/2);c=[t,r],e&L&&c.push(a-u,r,a,-s,a+u,r),c.push(n,r),e&F&&c.push(n,l-d,o,l,n,l+d),c.push(n,i),e&R&&c.push(a+u,i,a,s,a-u,i),c.push(t,i),e&I&&c.push(t,l+d,-o,l,t,l-d)}let l=``;for(let e=0;e<c.length;e+=2)l+=(e?` `:``)+t(c[e])+`,`+t(c[e+1]);return`<polygon points="${l}" stroke-linejoin="round"${i}/>`}var ae=1e3;function W(e,t){if(e===0||!Number.isInteger(e))throw new _(`Columns must be an integer !== 0.`,`semantic`,{type:`block`});if(t<0||!Number.isInteger(t))throw new _(`Position must be a non-negative integer.`+t,`semantic`,{type:`block`});return e<0?{px:t,py:0}:{px:t%e,py:Math.floor(t/e)}}function G(e,t,n){let r=e.columns,i=[],a=0,o=0,s=0,c=0;for(let n of e.children){let{px:e,py:l}=W(r,a),u=n.span>=1?Math.min(n.span,ae):1;if(r>0&&u>r-e&&(u=r-e),n.span=u,n.col=e,n.row=l,a+=u,e+u>o&&(o=e+u),l===i.length&&i.push(0),n.children.length===0?i[l]=-1:i[l]>=0&&n.nh>i[l]&&(i[l]=n.nh),n.space)continue;let d=(n.nw-t*(u-1))/u;d>s&&(s=d),n.nh>c&&(c=n.nh)}let l=(i.length-1)*t;for(let e=0;e<i.length;e++)i[e]<0&&(i[e]=c),l+=i[e];e.cols=o,e.heights=i,e.nw=Math.max(e.nw,o*s+(o-1)*t+2*n),e.nh=l+2*n+e.head}function K(e,t,n){let{cols:r,heights:i}=e,a=i.length,o=(e.w-2*n-(r-1)*t)/r,s=e.h-2*n-e.head-(a-1)*t,c=0;for(let e of i)c+=e;let l=c>0?s/c:0,u=c>0?0:s/a,d=e.x-e.w/2+n,f=e.y-e.h/2+n+e.head,p=0;for(let n of e.children){for(;p<n.row;p++)f+=i[p]*l+u+t;n.w=o*n.span+t*(n.span-1),n.h=i[p]*l+u,n.x=d+n.col*(o+t)+n.w/2,n.y=f+n.h/2}}function oe(e,t){let n=[e];for(let e=0;e<n.length;e++)for(let t of n[e].children)n.push(t);for(let e=n.length-1;e>=0;e--){let r=n[e];r.children.length>0&&G(r,t,e===0?0:t)}e.w=e.nw,e.h=e.nh,e.x=e.w/2,e.y=e.h/2;for(let e=0;e<n.length;e++){let r=n[e];r.children.length>0&&K(r,t,e===0?0:t)}return{width:e.w,height:e.h}}var se=12,ce=200,q=8,le=` fill="var(--_s)" stroke="var(--_b)"`,ue=` stroke="var(--_b)"`,de=[],fe=[],pe=[],me=[`default`],he=2e6,ge=new Map([[`square`,`rect`],[`round`,`rounded`],[`circle`,`circle`],[`doublecircle`,`dbl-circ`],[`diamond`,`diam`],[`hexagon`,`hex`],[`stadium`,`stadium`],[`subroutine`,`fr-rect`],[`cylinder`,`cyl`],[`rect_left_inv_arrow`,`odd`],[`lean_right`,`lean-r`],[`lean_left`,`lean-l`],[`trapezoid`,`trap-b`],[`inv_trapezoid`,`trap-t`]]),_e=new Set([`circle`,`dbl-circ`,`diam`]),ve=new Set([`stadium`,`hex`,`odd`,`lean-r`,`lean-l`,`trap-b`,`trap-t`]);function J(e){return e.kind===0&&(e.shape===`circle`||e.shape===`dbl-circ`)}function Y(e,t,n){let r=e.bw/2,i=e.bh/2,a=Math.abs(t-e.x),o=i;return J(e)?o=Math.sqrt(Math.max(r*r-a*a,0)):e.kind===0&&e.shape===`diam`?o=i*Math.max(1-a/r,0):e.kind===0?o=i-g(e.shape,e.bw,e.bh,n>0?2:0):e.kind===1&&U(e.mask)===`x`&&(o=i-z),e.y+n*o}function X(e,t,n){let r=e.bw/2,i=e.bh/2,a=Math.abs(t-e.y),o=r;return J(e)?o=Math.sqrt(Math.max(i*i-a*a,0)):e.kind===0&&e.shape===`diam`?o=r*Math.max(1-a/i,0):e.kind===0?o=r-g(e.shape,e.bw,e.bh,n>0?1:3):e.kind===1&&U(e.mask)===`y`&&(o=r-z),e.x+n*o}function Z(e,t,n,r){let i=t-e.x,a=n-e.y,o=e.bw/2,s=e.bh/2,c;c=J(e)?o/(Math.hypot(i,a)||1):e.kind===0&&e.shape===`diam`?1/(Math.abs(i)/o+Math.abs(a)/s||1):Math.min(i===0?1/0:o/Math.abs(i),a===0?1/0:s/Math.abs(a)),c===1/0&&(c=0),r.push(e.x+i*c,e.y+a*c)}function ye(e,t,n,r,i){let a=i.x-i.bw/2+1,o=i.x+i.bw/2-1,s=i.y-i.bh/2+1,c=i.y+i.bh/2-1;if(e<a&&n<a||e>o&&n>o||t<s&&r<s||t>c&&r>c)return!1;if(e===n||t===r)return!0;let l=n-e,u=r-t,d=(n,r)=>Math.sign(l*(r-t)-u*(n-e)),f=d(a,s);return f===0||d(o,s)!==f||d(o,c)!==f||d(a,c)!==f}function Q(e,t,n,r){let i=0;for(let a of r)if(a!==t&&a!==n){for(let t=0;t+3<e.length;t+=2)if(ye(e[t],e[t+1],e[t+2],e[t+3],a)){i++;break}}return i}function be(e,t,n,r){let i=e.x-e.bw/2,a=e.x+e.bw/2,o=e.y-e.bh/2,s=e.y+e.bh/2,c=t.x-t.bw/2,l=t.x+t.bw/2,u=t.y-t.bh/2,d=t.y+t.bh/2,f=Math.max(i,c),p=Math.min(a,l),m=Math.max(o,u),h=Math.min(s,d),g=p-f>6,_=h-m>6;if(g&&_){let n=e.bw*e.bh<=t.bw*t.bh?e:t,r=n===e?t:e,i=n.y-n.bh/2-(r.y-r.bh/2),a=r.y+r.bh/2-(n.y+n.bh/2),o=n.x-n.bw/2-(r.x-r.bw/2),s=r.x+r.bw/2-(n.x+n.bw/2),c=Math.min(i,a,o,s),l;return l=c===a?[n.x,Y(n,n.x,1),n.x,r.y+r.bh/2]:c===i?[n.x,Y(n,n.x,-1),n.x,r.y-r.bh/2]:c===s?[X(n,n.y,1),n.y,r.x+r.bw/2,n.y]:[X(n,n.y,-1),n.y,r.x-r.bw/2,n.y],n===e?l:[l[2],l[3],l[0],l[1]]}if(g){let r=Math.min(6,(p-f)/2),i=Math.min(Math.max((f+p)/2+n,f+r),p-r),a=t.y>e.y?1:-1;return[i,Y(e,i,a),i,Y(t,i,-a)]}if(_){let r=Math.min(6,(h-m)/2),i=Math.min(Math.max((m+h)/2+n,m+r),h-r),a=t.x>e.x?1:-1;return[X(e,i,a),i,X(t,i,-a),i]}let v=t.x>e.x?1:-1,y=t.y>e.y?1:-1,b=[X(e,e.y,v),e.y,t.x,e.y,t.x,Y(t,t.x,-y)],x=[e.x,Y(e,e.x,y),e.x,t.y,X(t,t.y,-v),t.y],S=Math.abs(t.x-e.x)>=Math.abs(t.y-e.y),C=S?b:x;if(r===void 0)return C;let w=Q(C,e,t,r);if(w===0)return C;let T=S?x:b,E=Q(T,e,t,r);if(E<w&&(C=T,w=E),w===0)return C;let D=[];return Z(e,t.x,t.y,D),Z(t,e.x,e.y,D),Q(D,e,t,r)<w?D:C}function xe(e,n,r){let i=e.length,a=e[0],o=e[1],s=e[i-2],c=e[i-1],l=e[2]-a,u=e[3]-o,d=Math.hypot(l,u);l/=d||1,u/=d||1;let f=s-e[i-4],p=c-e[i-3],m=Math.hypot(f,p);if(f/=m||1,p/=m||1,i===4&&n+r>d){let e=d/(n+r);n*=e,r*=e}n=Math.min(n,d),r=Math.min(r,m);let h=`M${t(a+l*n)},${t(o+u*n)}`;if(i===6){let i=Math.max(0,Math.min(q,d-n,m-r));h+=`L${t(e[2]-l*i)},${t(e[3]-u*i)}Q${t(e[2])},${t(e[3])} ${t(e[2]+f*i)},${t(e[3]+p*i)}`}return h+=`L${t(s-f*r)},${t(c-p*r)}`,{d:h,sx:a,sy:o,sdx:-l,sdy:-u,ex:s,ey:c,edx:f,edy:p}}function Se(e,t){let n=e.bw/2,r=e.bh/2,i=Math.max(1,Math.min(10+5*(t-1),n,r));if(J(e)){let t=e.x+n*Math.SQRT1_2,r=e.y-n*Math.SQRT1_2,a=2*Math.asin(Math.min(1,i/(2*n))),o=i=>Math.atan2(e.y-n*Math.sin(i)-r,e.x+n*Math.cos(i)-t);return[t,r,i,o(Math.PI/4+a),o(Math.PI/4-a)]}if(e.kind===0&&e.shape===`diam`){let t=Math.atan2(r,n);return[e.x+n/2,e.y-r/2,i,t+Math.PI,t]}return[e.x+n,e.y-r,i,Math.PI,Math.PI/2]}function Ce(e,n,r,i){let[a,o,s,c,l]=Se(e,n),u=c+r/s,d=l-i/s,f=(d-u)%(2*Math.PI);f<=0&&(f+=2*Math.PI);let p=a+s*Math.cos(u),m=o+s*Math.sin(u),h=a+s*Math.cos(d),g=o+s*Math.sin(d),_=a+s*Math.cos(c),v=o+s*Math.sin(c),y=a+s*Math.cos(l),b=o+s*Math.sin(l),x=Math.hypot(_-p,v-m),S=Math.hypot(y-h,b-g);return{d:`M${t(p)},${t(m)}A${t(s)},${t(s)} 0 ${+(f>Math.PI)} 1 ${t(h)},${t(g)}`,sx:_,sy:v,sdx:x>0?(_-p)/x:Math.sin(c),sdy:x>0?(v-m)/x:-Math.cos(c),ex:y,ey:b,edx:S>0?(y-h)/S:-Math.sin(l),edy:S>0?(b-g)/S:Math.cos(l)}}var $=[.5,.3,.7,.15,.85];function we(e,t,n,r,i,a,o){if(o===void 0)return .5;for(let s of $){let c=e[t]+(e[t+2]-e[t])*s,l=e[t+1]+(e[t+3]-e[t+1])*s,u=!0;for(let e of o)if(e!==i&&e!==a&&Math.abs(c-e.x)<(n+e.bw)/2&&Math.abs(l-e.y)<(r+e.bh)/2){u=!1;break}if(u)return s}return .5}function Te(e,t,n){return d(n,r=>Ee(e,t,n,r))}function Ee(d,g,_,y){let b=_.fontSize??16,x=Math.round(b*.875),S=_.measurer??v(_.fontFamily),C=_.padding??8,w=_.icons,T=g.block?.padding,E=Math.min(typeof T==`number`&&T>=0?Math.min(T,200):se,y?6:1/0),D=y?80:ce,O=e=>{let t=[],n=e=>{for(let n of e)for(let e of n.split(`;`))t.push(e)};for(let t of e.classes&&e.classes.length>0?e.classes:me){let e=d.classes.get(t);e&&n(e.styles)}return e.styles&&n(e.styles),r(t)},k=(e,t)=>{let n=e.type,i=n===`space`?r(de):O(e),a=+!!i.bold|(i.italic?2:0),s=i.fontSize??b,c=0,l=``,u,d=0,p=0,m=0,g=0,v=0,x=0;if(n===`space`)c=3,u=o(void 0,!1,S,s,D);else if(n===`composite`)c=2,u=o(e.label,!1,S,s,y?f(_):4e3,a),m=u.height>0?u.height+4:0,d=u.width+2*E,p=m+2*E;else if(n===`block_arrow`){c=1,u=o(e.label,!1,S,s,D,a);let t=!0;for(let e of u.lines)for(let n of e)(n.icon!==void 0||n.text.trim()!==``)&&(t=!1);g=ne(e.directions);let n=t?re(g,0,0):re(g,u.width,u.height);d=n.w,p=n.h,v=n.dx,x=n.dy}else{l=ge.get(n??``)??`rect`,u=o(e.label,!1,S,s,D,a);let t=h(l,u.width,u.height);d=t.w,p=l===`cyl`?Math.max(t.h,u.height+40):t.h,x=t.dy}return{children:[],columns:c===2?e.columns??-1:-1,span:c===3?1:e.widthInColumns??1,space:c===3,head:m,nw:d,nh:p,col:0,row:0,cols:0,heights:pe,x:0,y:0,w:0,h:0,block:e,kind:c,index:t,shape:l,label:u,style:i,mask:g,dx:v,dy:x,bw:0,bh:0}},A=k(d.root,0);A.nw=0,A.nh=0;let j=[A],M=new Map;for(let e=0;e<j.length;e++){let t=j[e];if(t.kind===2)for(let e of t.block.children??fe){let n=k(e,j.length);t.children.push(n),j.push(n),n.kind!==3&&M.set(e.id,n)}}let ee=oe(A,E),N=[];for(let e of j)e.kind===0&&_e.has(e.shape)?(e.bw=e.nw,e.bh=e.nh):e.kind===1?(e.bw=e.span>1?e.w:e.nw,e.bh=e.nh):(e.bw=e.w,e.bh=e.kind===0&&ve.has(e.shape)?e.nh:e.h),e.kind===0&&e.shape===`cyl`&&(e.dy=Math.min(12,Math.max(6,e.bw/14))/2),(e.kind===0||e.kind===1)&&N.push(e);let P=new Map,te=new Set,F=[],I=[];for(let e of d.edges){let t=M.get(e.start??``),n=M.get(e.end??``);if(t===void 0||n===void 0)continue;let r=Math.min(t.index,n.index)*j.length+Math.max(t.index,n.index);P.set(r,(P.get(r)??0)+1),e.label&&te.add(r),F.push([t,n]),I.push(e)}let L=I.length*N.length<=he?N:void 0,R=new Map,z=[],B=0,V=0,H=ee.width,U=ee.height,ae=(e,t,n,r)=>{e-n/2<B&&(B=e-n/2),e+n/2>H&&(H=e+n/2),t-r/2<V&&(V=t-r/2),t+r/2>U&&(U=t+r/2)};for(let e=0;e<I.length;e++){let[t,n]=F[e],r=Math.min(t.index,n.index)*j.length+Math.max(t.index,n.index),i=P.get(r)??1,a=R.get(r)??0;R.set(r,a+1);let s=o(I[e].label,!1,S,x,ce),c,l,u;if(t===n){let[e,n,r]=Se(t,a+1);c=[],ae(e,n,2*r+2,2*r+2),l=e+r+6+s.width/2,u=n-r/2}else{let e=te.has(r)?Math.round(x*1.5)+2:14;c=be(t,n,(a-(i-1)/2)*e,L);let o=c.length,d=Math.abs(c[2]-c[0])+Math.abs(c[3]-c[1]),f=Math.abs(c[o-2]-c[o-4])+Math.abs(c[o-1]-c[o-3]),p=o===6&&f>d?2:0,m=s.width>0?we(c,p,s.width+8,s.height,t,n,L):.5;l=c[p]+(c[p+2]-c[p])*m,u=c[p+1]+(c[p+3]-c[p+1])*m}s.width>0&&ae(l,u,s.width+8,s.height),z.push({edge:I[e],points:c,loop:t===n?a+1:0,label:s,lx:l,ly:u})}let W=p(d.title,S,b,y?f(_):4e3),G=W.height>0?W.height+12:0,K=Math.max(H-B,W.width),q=C-B+(K-(H-B))/2,J=C+G-V;for(let e of j)e.x+=q,e.y+=J;let Y=Math.ceil(K+2*C),X=Math.ceil(U-V+G+2*C),Z=``,ye=``;for(let n=1;n<j.length;n++){let r=j[n];if(r.kind===3)continue;let o=e((r.block.classes??de).join(` `)),c=a(r.block.id);if(r.kind===2){let e=r.y-r.h/2;Z+=`<g class="pele-cluster${o}" data-id="${c}"><rect x="${t(r.x-r.w/2)}" y="${t(e)}" width="${t(r.w)}" height="${t(r.h)}" fill="var(--_a)" fill-opacity="0.5" stroke="var(--_b)"${i(r.style.shape)}/>`+s(r.label,r.x,e+(r.head+E)/2+2,` class="pele-cluster-label" fill="var(--_m)"${r.style.text}`,w)+`</g>`;continue}let l=r.kind===1;ye+=`<g class="pele-node pele-shape-${l?`block-arrow`:r.shape}${o}" data-id="${c}" transform="translate(${t(r.x)},${t(r.y)})">`+(l?ie(r.mask,r.bw,r.bh,le+r.style.shape):m(r.shape,r.bw,r.bh,le+r.style.shape,ue+r.style.line))+s(r.label,r.dx,r.dy,` class="pele-label"${r.style.text}`,w)+`</g>`}let Q=``,$=``;for(let e=0;e<z.length;e++){let{edge:t,points:n,loop:r,label:i}=z[e],o=t.arrowTypeStart??``,s=t.arrowTypeEnd??``,d;if(r>0)d=Ce(F[e][0],r,c(o),c(s));else{for(let e=0;e<n.length;e+=2)n[e]+=q,n[e+1]+=J;d=xe(n,c(o),c(s))}let f=a(t.id);if(Q+=`<g class="pele-edge" data-id="${f}"><path d="${d.d}"${t.thickness===`thick`?` stroke-width="2.5"`:``}${t.pattern===`dotted`?` stroke-dasharray="3 4"`:``}/>`+u(o,d.sx,d.sy,d.sdx,d.sdy,`var(--_l)`)+u(s,d.ex,d.ey,d.edx,d.edy,`var(--_l)`)+`</g>`,i.width>0){let n=z[e].lx+q,r=z[e].ly+J;$+=l(t.id,i,n,r,``,w)}}return{svg:n(`block`,Y,X,b,_,d,s(W,Y/2,C+W.height/2,` class="pele-title" font-weight="var(--_tw)"`)+(Z?`<g class="pele-clusters">${Z}</g>`:``)+(Q?`<g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round">${Q}</g>`:``)+`<g class="pele-nodes">${ye}</g>`+($?`<g class="pele-edge-labels" font-size="${x}">${$}</g>`:``)),width:Y,height:X,links:[]}}var De={type:`block`,math:!0,parse(e,t,n){let r=new k;return r.title=n,te(e,r),r},render:Te};export{De as block};
3
- //# sourceMappingURL=SLD4V6NK-DbsINoTD.js.map
3
+ //# sourceMappingURL=SLD4V6NK-CR4aIcpx.js.map