@p4code/cli 0.9.6 → 0.9.7

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 (273) hide show
  1. package/dist/bin.mjs +1 -1
  2. package/dist/{binCli-0A0KffG3.mjs → binCli-BDhIHi_h.mjs} +2373 -1017
  3. package/dist/client/.vite/manifest.json +2000 -2000
  4. package/dist/client/assets/{2NI2N5EU-BEr-Tfqs.js → 2NI2N5EU-sFO2CLlt.js} +2 -2
  5. package/dist/client/assets/{4UO7MD6I-z55jzCJI.js → 4UO7MD6I-CcT8Zfhc.js} +2 -2
  6. package/dist/client/assets/{5B3SVYGG-BFexm37i.js → 5B3SVYGG-Bd_wcJLx.js} +2 -2
  7. package/dist/client/assets/{5GK6JWQ2-Bn_JiXgJ.js → 5GK6JWQ2-Cp0eFbVE.js} +2 -2
  8. package/dist/client/assets/{5N7A7DKN-Duo22cWA.js → 5N7A7DKN-Czpp-hnK.js} +2 -2
  9. package/dist/client/assets/{5OC2THR4-DidiZL1J.js → 5OC2THR4-C6OEDFC6.js} +2 -2
  10. package/dist/client/assets/{5S6HY5KT-DQ4fJlKq.js → 5S6HY5KT-DUo-T0Pv.js} +2 -2
  11. package/dist/client/assets/{6IMQ5BUJ-JMPhBK1B.js → 6IMQ5BUJ-ZY7dYS3y.js} +2 -2
  12. package/dist/client/assets/{6OLKWJ4F-CpaocvvP.js → 6OLKWJ4F-KMXuFNsu.js} +2 -2
  13. package/dist/client/assets/{74OO7NKP-Btg8U3A7.js → 74OO7NKP-aJ6kvSey.js} +2 -2
  14. package/dist/client/assets/{75O6YZUN-BVcu_3G6.js → 75O6YZUN-DIHv8J29.js} +2 -2
  15. package/dist/client/assets/{77XECAW3-B2dqs2a0.js → 77XECAW3-JuMUaReb.js} +2 -2
  16. package/dist/client/assets/{ABYRPUBD-csm8mwzG.js → ABYRPUBD-2Yn9PEzm.js} +2 -2
  17. package/dist/client/assets/AlertDialogRoot-CW_9Mq9o.js +2 -0
  18. package/dist/client/assets/{AnimatedHeight-CU3C1NcV.js → AnimatedHeight-Cd_V66Dq.js} +2 -2
  19. package/dist/client/assets/{AuthSurfaceShell-DT2jFrxd.js → AuthSurfaceShell-z6JhHCp1.js} +2 -2
  20. package/dist/client/assets/{BB2UYUI2-CrLDpD9c.js → BB2UYUI2-D5xDmPxh.js} +2 -2
  21. package/dist/client/assets/{BUM34MOA-DGaisF3P.js → BUM34MOA-B9FvXzqk.js} +2 -2
  22. package/dist/client/assets/{CEQABKGZ-BHUFEz8L.js → CEQABKGZ-Dx_FGvDv.js} +2 -2
  23. package/dist/client/assets/{CXAC5362-CF0Q8UlN.js → CXAC5362-DGpvh6KQ.js} +2 -2
  24. package/dist/client/assets/ChatGptUsageButton-hgahwAd8.js +2 -0
  25. package/dist/client/assets/{ChatMarkdown-WBYeOz6B.js → ChatMarkdown-DzBQ6o2z.js} +7 -7
  26. package/dist/client/assets/{CheckboxIndicator-CT--c3fO.js → CheckboxIndicator-mFuXoA30.js} +2 -2
  27. package/dist/client/assets/{ClippedText-BWXvwYxu.js → ClippedText-3QYVxO0t.js} +2 -2
  28. package/dist/client/assets/{CodexSetupSection.logic-7Ae1lVg1.js → CodexSetupSection.logic-BBoRdk5p.js} +2 -2
  29. package/dist/client/assets/{ComboboxClear-CRWQGFjR.js → ComboboxClear-BNtFgSHF.js} +2 -2
  30. package/dist/client/assets/{ComboboxGroupLabel-BMo03qXe.js → ComboboxGroupLabel-sq7Mhle4.js} +2 -2
  31. package/dist/client/assets/{CommandBlock-D57LdSoM.js → CommandBlock-DHXlU5C7.js} +2 -2
  32. package/dist/client/assets/{ComposerPromptEditor-DJ9XwB1O.js → ComposerPromptEditor-qOyyjScc.js} +4 -4
  33. package/dist/client/assets/{CompositeRoot-DSNl3c3G.js → CompositeRoot-DY7iUA_s.js} +2 -2
  34. package/dist/client/assets/{ConnectionDiagnosisDetails-CMRX7VzH.js → ConnectionDiagnosisDetails-xhfXplsX.js} +2 -2
  35. package/dist/client/assets/{ConnectionStatusDot-CiISG6eT.js → ConnectionStatusDot-BBmbajLh.js} +2 -2
  36. package/dist/client/assets/{DRLTVNUE-BjIXDJQN.js → DRLTVNUE-v1NbOvdX.js} +2 -2
  37. package/dist/client/assets/{DYY6UVD2-Dpro9qr4.js → DYY6UVD2-Dgv-rkDR.js} +2 -2
  38. package/dist/client/assets/{DevicePanel-DtM34nRC.js → DevicePanel-Cyg1Yk9F.js} +2 -2
  39. package/dist/client/assets/{DeviceSetup-BgzTguQP.js → DeviceSetup-C2Zve35j.js} +2 -2
  40. package/dist/client/assets/{DialogTitle-CACErOl5.js → DialogTitle-9BKGozK3.js} +2 -2
  41. package/dist/client/assets/{DiffCommentAnnotation-Bcjn-Btj.js → DiffCommentAnnotation-shKWlLXb.js} +2 -2
  42. package/dist/client/assets/{DiffFileTree-1s_6Y4bE.js → DiffFileTree-Cw3IoBPF.js} +2 -2
  43. package/dist/client/assets/{DiffPanel-BTNwksR-.js → DiffPanel-DhYILwt4.js} +2 -2
  44. package/dist/client/assets/{DiffWorkerPoolProvider-DDVuzh7w.js → DiffWorkerPoolProvider-DwAxcJ_J.js} +2 -2
  45. package/dist/client/assets/{EmbeddedDesign-3XobSUFO.js → EmbeddedDesign-BwBy_4w8.js} +2 -2
  46. package/dist/client/assets/{EnvironmentMachineIcon-B6RgXF8A.js → EnvironmentMachineIcon-KqncPHh8.js} +2 -2
  47. package/dist/client/assets/{ExpandableText-B3WqZ3eC.js → ExpandableText-CEDcsLah.js} +2 -2
  48. package/dist/client/assets/{FNOVOB4O-BxVVUi2o.js → FNOVOB4O-D_GK0hHx.js} +2 -2
  49. package/dist/client/assets/{FieldControl-BDrBhdoh.js → FieldControl-CVCCrg1T.js} +2 -2
  50. package/dist/client/assets/{FileDiff-DM8e9Pyt.js → FileDiff-CkTyrHs_.js} +2 -2
  51. package/dist/client/assets/{FilePreviewPanel-CRdP4-01.js → FilePreviewPanel-pD3XdWFT.js} +6 -6
  52. package/dist/client/assets/{FoldedSettingsSection-CsaWcgI5.js → FoldedSettingsSection-VcaJg5wH.js} +2 -2
  53. package/dist/client/assets/{FormContext-BZ8Nuwwa.js → FormContext-CbLQYizu.js} +2 -2
  54. package/dist/client/assets/{HDGCDEEZ-9x1WhMZA.js → HDGCDEEZ-B_87CdVQ.js} +2 -2
  55. package/dist/client/assets/{HSJLKHB7-BI4g8Uha.js → HSJLKHB7-BWrZ2oua.js} +2 -2
  56. package/dist/client/assets/{Icons-CPaJO8_C.js → Icons-CQY6Z_tn.js} +2 -2
  57. package/dist/client/assets/Input-Bple6iXe.js +2 -0
  58. package/dist/client/assets/JZOYTAAL-BMx5dMBx.js +1 -0
  59. package/dist/client/assets/{K3MD6TGW-QvtIomBt.js → K3MD6TGW-Dl_xvRh8.js} +2 -2
  60. package/dist/client/assets/{K7RP3OMA-CenKL848.js → K7RP3OMA-CMEWK15T.js} +2 -2
  61. package/dist/client/assets/{KeybindingsSettings.logic-Dk-UU5gV.js → KeybindingsSettings.logic-6SIFjdPx.js} +2 -2
  62. package/dist/client/assets/{LHDIQX7Q-Du31c03t.js → LHDIQX7Q-BYodQH-L.js} +2 -2
  63. package/dist/client/assets/{LUXOKEGN-DwVZaHZy.js → LUXOKEGN-qRQxfpo6.js} +2 -2
  64. package/dist/client/assets/{MathTypeset-DUJJZ0qR.js → MathTypeset-DEu7ewh2.js} +2 -2
  65. package/dist/client/assets/{N3JZAHOW-f6rXQzfb.js → N3JZAHOW-D39dZXbh.js} +2 -2
  66. package/dist/client/assets/{NUIALGQ3-B7-2dGpz.js → NUIALGQ3-DesFcM7Z.js} +2 -2
  67. package/dist/client/assets/{NoProjectsHero-BJZpoal_.js → NoProjectsHero-DR2kWrZ4.js} +2 -2
  68. package/dist/client/assets/{O65XPQGZ-pxAza1nz.js → O65XPQGZ-xGzNLFO_.js} +2 -2
  69. package/dist/client/assets/{O7XIQ6OM-nX2_hGto.js → O7XIQ6OM-D_A5CSzR.js} +2 -2
  70. package/dist/client/assets/{OFQON5FD-y110aBJF.js → OFQON5FD-wUDkF0Vl.js} +2 -2
  71. package/dist/client/assets/{P4ConnectAccountPages-C1rFKA40.js → P4ConnectAccountPages-CCDq5J6P.js} +2 -2
  72. package/dist/client/assets/{P4ConnectSidebarSignIn-40UlSrjv.js → P4ConnectSidebarSignIn-CX9WTYV1.js} +2 -2
  73. package/dist/client/assets/{PJQHF43J-CbQqRUq6.js → PJQHF43J-CDUmALBZ.js} +2 -2
  74. package/dist/client/assets/{PanelLayoutControls-CrSkXhVM.js → PanelLayoutControls-C34I_7ba.js} +6 -6
  75. package/dist/client/assets/{PierreEntryIcon-C488PFw3.js → PierreEntryIcon-Cuq8Bvxz.js} +2 -2
  76. package/dist/client/assets/{PopoverHandle-ByI17B8T.js → PopoverHandle-CaIeAISC.js} +2 -2
  77. package/dist/client/assets/{PreviewPanel-CsAlP3Pf.js → PreviewPanel-CG-MeUjw.js} +2 -2
  78. package/dist/client/assets/{ProjectDefaultsSettings-b9JKMHCZ.js → ProjectDefaultsSettings-Bxz5MdOY.js} +2 -2
  79. package/dist/client/assets/{ProjectFavicon-BhuB_Su5.js → ProjectFavicon-DCKipqYA.js} +3 -3
  80. package/dist/client/assets/{ProjectIconPickerDialog-Cug9qYje.js → ProjectIconPickerDialog-DqEEBoMA.js} +2 -2
  81. package/dist/client/assets/{ProjectMonogram-DdSkqGzz.js → ProjectMonogram-CjI4Va2u.js} +2 -2
  82. package/dist/client/assets/{ProviderAuthTerminal-BiaVsusp.js → ProviderAuthTerminal-UctA57cb.js} +2 -2
  83. package/dist/client/assets/{ProviderModelPicker-CHf8PGFh.js → ProviderModelPicker-QRPUsruj.js} +2 -2
  84. package/dist/client/assets/{ProviderSettingsForm-DTCgpI31.js → ProviderSettingsForm-BEq2pSXW.js} +2 -2
  85. package/dist/client/assets/{PullRequestCodeTab-CruWTaey.js → PullRequestCodeTab-DQDQ2-AY.js} +2 -2
  86. package/dist/client/assets/{RHNBAITX-NhKz5kz6.js → RHNBAITX-C7xWa0v8.js} +2 -2
  87. package/dist/client/assets/{ReadOnlySourcePreview-BVjNlm_O.js → ReadOnlySourcePreview-BzoQdNnt.js} +2 -2
  88. package/dist/client/assets/{RenderErrorBoundary-C2PF8Cmu.js → RenderErrorBoundary-BQJlFG3C.js} +2 -2
  89. package/dist/client/assets/{SLD4V6NK-Ca5SsXR4.js → SLD4V6NK-DmuNvRiU.js} +2 -2
  90. package/dist/client/assets/{ScheduledTasksSettings-QWakG9R_.js → ScheduledTasksSettings-BslOTNM_.js} +2 -2
  91. package/dist/client/assets/{ScopedSwitch-Dpqx-0tY.js → ScopedSwitch-B93s5VHZ.js} +2 -2
  92. package/dist/client/assets/{ScrollAreaCorner-CGc2ioKQ.js → ScrollAreaCorner-Dhc-TjWb.js} +2 -2
  93. package/dist/client/assets/{SecretInput-D6soOcQS.js → SecretInput-B2ihrOsq.js} +2 -2
  94. package/dist/client/assets/{SelectScrollUpArrow-CjMNXdhr.js → SelectScrollUpArrow-krk2Fk-_.js} +2 -2
  95. package/dist/client/assets/{SettingsPanels-5CR3ByhH.js → SettingsPanels-DxAtLrQJ.js} +4 -4
  96. package/dist/client/assets/{SettingsPanels.logic-DYKv08oD.js → SettingsPanels.logic-Bl4RFuAy.js} +2 -2
  97. package/dist/client/assets/{SettingsScopeNotice-Bq20tBUp.js → SettingsScopeNotice-LfKqlEQx.js} +2 -2
  98. package/dist/client/assets/{SidebarStageBackdrop-CEjjEyUl.js → SidebarStageBackdrop-6e7hvpNA.js} +2 -2
  99. package/dist/client/assets/{T3PCR2KE-D-xJTbp-.js → T3PCR2KE-CiK8lMNJ.js} +2 -2
  100. package/dist/client/assets/{TKWO2OVW-JaByeldU.js → TKWO2OVW-BdJsjYHm.js} +2 -2
  101. package/dist/client/assets/{TSHNXIZL-7SUhC5Vk.js → TSHNXIZL-CRJjDWez.js} +2 -2
  102. package/dist/client/assets/{ThemeEditorPanel-TxkY9El4.js → ThemeEditorPanel-D8zwe2Nv.js} +2 -2
  103. package/dist/client/assets/{ThreadTerminalDrawer-CW0oM3tO.js → ThreadTerminalDrawer-Dscicgos.js} +2 -2
  104. package/dist/client/assets/{TooltipViewport-beytMJmq.js → TooltipViewport-MMBPNW3u.js} +2 -2
  105. package/dist/client/assets/{UQJE5E4I-CHN9jRa_.js → UQJE5E4I-V8ZBwQ4s.js} +2 -2
  106. package/dist/client/assets/{USNYFO5S-Bvrc0sLJ.js → USNYFO5S-B5nY9-j7.js} +2 -2
  107. package/dist/client/assets/{Virtualizer-vgqc_DSl.js → Virtualizer-CzVPu6W0.js} +2 -2
  108. package/dist/client/assets/{WEVWDWVA-BaKbLsuO.js → WEVWDWVA-roZxnVYX.js} +2 -2
  109. package/dist/client/assets/{WorkspaceBreadcrumb-1f5BN5n1.js → WorkspaceBreadcrumb-DHwNjJoP.js} +2 -2
  110. package/dist/client/assets/{WorkspacePageContainer-CDQRGmcV.js → WorkspacePageContainer-BEL6F4GP.js} +2 -2
  111. package/dist/client/assets/{WorkspacePageHeader-Q5YQyOFt.js → WorkspacePageHeader-eTadd7tx.js} +2 -2
  112. package/dist/client/assets/{X5RFHQXM-BfoStT6R.js → X5RFHQXM-3waZyk5u.js} +2 -2
  113. package/dist/client/assets/{X62E3GBT-DPqQZAUV.js → X62E3GBT-B2f7sUz7.js} +2 -2
  114. package/dist/client/assets/{XBNEOJTC-a4pknpW1.js → XBNEOJTC-C4ImOubv.js} +2 -2
  115. package/dist/client/assets/{YHV2MVVZ-CLYitNzo.js → YHV2MVVZ-D1HZySVT.js} +2 -2
  116. package/dist/client/assets/{YURCZMG2-D5G4Gqxk.js → YURCZMG2-B95ZHwnq.js} +2 -2
  117. package/dist/client/assets/{YVG2LODB-BaOOPjOj.js → YVG2LODB-Ba9ElJXR.js} +2 -2
  118. package/dist/client/assets/_chat-CAKiqq8Z.js +45 -0
  119. package/dist/client/assets/{_chat.design-C8CbENny.js → _chat.design-xDdLq2Pm.js} +2 -2
  120. package/dist/client/assets/{_chat.index-CWE510ct.js → _chat.index-DZFF0AGm.js} +2 -2
  121. package/dist/client/assets/{_chat.new-wb1utvr4.js → _chat.new-UcQULkDl.js} +2 -2
  122. package/dist/client/assets/{_chat.pull-requests-D0bA9kLT.js → _chat.pull-requests-wqTxTIsj.js} +2 -2
  123. package/dist/client/assets/{alert-Cq0DAg5J.js → alert-BeaSxmEt.js} +2 -2
  124. package/dist/client/assets/{assetUrls-DpLOinYe.js → assetUrls-DSRw9lrZ.js} +2 -2
  125. package/dist/client/assets/{assets-Dls9s4TR.js → assets-DhuueFtK.js} +2 -2
  126. package/dist/client/assets/{browserHistoryStore-CUc0_P_z.js → browserHistoryStore-Cb-pQxvb.js} +2 -2
  127. package/dist/client/assets/{browserLinkTarget-BmW74g3V.js → browserLinkTarget-DnEgq1JN.js} +2 -2
  128. package/dist/client/assets/{checkbox-CoJ-ki0Z.js → checkbox-BwnKO_BU.js} +2 -2
  129. package/dist/client/assets/{color-picker-ABTfqBnJ.js → color-picker-D8AK_9SM.js} +2 -2
  130. package/dist/client/assets/{combobox-C6NpXSFx.js → combobox-CXEo8oot.js} +2 -2
  131. package/dist/client/assets/{command-BOsIZcjU.js → command-BAykm7lf.js} +2 -2
  132. package/dist/client/assets/{connect-B3OIDtgH.js → connect-DsnzdYd-.js} +2 -2
  133. package/dist/client/assets/{connect-agent-BcH8kUjm.js → connect-agent-BHUM9uJ5.js} +2 -2
  134. package/dist/client/assets/{design-D0u5lYcP.js → design-BugojS6P.js} +2 -2
  135. package/dist/client/assets/{device-UePDkr_L.js → device-CH53vde0.js} +2 -2
  136. package/dist/client/assets/{dialog-r1KpDpid.js → dialog-CsGXTrQp.js} +2 -2
  137. package/dist/client/assets/{diffRendering-cPnt2kIt.js → diffRendering-WBaaL1Hw.js} +2 -2
  138. package/dist/client/assets/{dist-D4Fzk6mX.js → dist-CEhsFKQt.js} +3 -3
  139. package/dist/client/assets/{draft-input-eAeawUnI.js → draft-input-DSO1M98X.js} +2 -2
  140. package/dist/client/assets/{duoViewer-6tHPOGH8.js → duoViewer-DWTF6ZzH.js} +2 -2
  141. package/dist/client/assets/{dynamic-bKXiwQos.js → dynamic-cm3g4l5C.js} +2 -2
  142. package/dist/client/assets/{embeddedScripts-CALp_TgN.js → embeddedScripts-CCEJSzbY.js} +2 -2
  143. package/dist/client/assets/{empty-B5VIjZQf.js → empty-D39LEkAH.js} +2 -2
  144. package/dist/client/assets/{entities-DhRbI2L4.js → entities-BjGK6yEY.js} +2 -2
  145. package/dist/client/assets/{fileLinks-B4-TDufo.js → fileLinks-BGiaZuCI.js} +2 -2
  146. package/dist/client/assets/{fileTreeExpansion-WgU7oBBt.js → fileTreeExpansion-B5-rhZPf.js} +2 -2
  147. package/dist/client/assets/{getDiffFileInput-CIsReQa3.js → getDiffFileInput-BVsGumGL.js} +2 -2
  148. package/dist/client/assets/{guideRunStore-D6SjxVHH.js → guideRunStore-CIC0I9tc.js} +2 -2
  149. package/dist/client/assets/{htmlRender-eKT33KVk.js → htmlRender-CuZDEfr_.js} +2 -2
  150. package/dist/client/assets/{index-Gp6V8OPo.js → index-DFvDwgHR.js} +3 -3
  151. package/dist/client/assets/{input-CySdZpuF.js → input-DTnuNfU_.js} +2 -2
  152. package/dist/client/assets/{input-group-BRBXX90v.js → input-group-ZnG52HFh.js} +2 -2
  153. package/dist/client/assets/{kbd-BEi8qVF9.js → kbd-NONAAU_c.js} +2 -2
  154. package/dist/client/assets/{keybindings-COfPuZJ9.js → keybindings-CCgj9REF.js} +2 -2
  155. package/dist/client/assets/{lazy-BKgu9oVK.js → lazy-BGLv0LoM.js} +4 -4
  156. package/dist/client/assets/{lazyRouteComponent-BUMdW5GA.js → lazyRouteComponent-D02c00C-.js} +2 -2
  157. package/dist/client/assets/{link-BLuLRp-C.js → link-oQzJ7nu3.js} +2 -2
  158. package/dist/client/assets/{linkedPrompt-BCdDQK81.js → linkedPrompt-C_XIR4Xr.js} +2 -2
  159. package/dist/client/assets/{main-1tW7jidE.js → main-BqFaDMNs.js} +17 -17
  160. package/dist/client/assets/main-DsXJbQH-.css +2 -0
  161. package/dist/client/assets/{mediaReference-DAak-Bfh.js → mediaReference-DKoeCSSJ.js} +2 -2
  162. package/dist/client/assets/mediaSource-CENz-NYA.js +2 -0
  163. package/dist/client/assets/{number-field-DqB5oGdp.js → number-field-D1mdZQVp.js} +2 -2
  164. package/dist/client/assets/{observeResize-CAGp2C1D.js → observeResize-BNf0FASw.js} +2 -2
  165. package/dist/client/assets/{onboarding-JbZFsvi9.js → onboarding-B-b2hpCr.js} +2 -2
  166. package/dist/client/assets/{openFileInPreview-CDCQ6rKJ.js → openFileInPreview-CLTNM-qs.js} +2 -2
  167. package/dist/client/assets/{p4ProjectFile-DuMklfjR.js → p4ProjectFile-BQUacEue.js} +2 -2
  168. package/dist/client/assets/{pair-3U4lhizd.js → pair-DTrJC971.js} +2 -2
  169. package/dist/client/assets/{pendingSendStore-BaAUC-mU.js → pendingSendStore-BsAQrtOv.js} +2 -2
  170. package/dist/client/assets/{phoneViewer-BhDgaxtz.js → phoneViewer-D64KFma1.js} +2 -2
  171. package/dist/client/assets/{pierre-icons-BnU3xLFM.js → pierre-icons-CtTUePAY.js} +2 -2
  172. package/dist/client/assets/{popover-Cmd3nOX1.js → popover-Cr0R7gdF.js} +2 -2
  173. package/dist/client/assets/{preview-BhM7y-5f.js → preview-BuuE-gMP.js} +2 -2
  174. package/dist/client/assets/{preview-DzgdX_e_.js → preview-C1PD_g9k.js} +2 -2
  175. package/dist/client/assets/{previewMiniPlayerStore-JEelmjkF.js → previewMiniPlayerStore-v5xBLM6_.js} +2 -2
  176. package/dist/client/assets/{primary-C5Pkih-v.js → primary-BMTtrcja.js} +2 -2
  177. package/dist/client/assets/{primaryCloudLinkState-1Xmc8JzR.js → primaryCloudLinkState-CJaRG6QK.js} +2 -2
  178. package/dist/client/assets/{projectFilesQueryState-D9gKctiS.js → projectFilesQueryState-CZkTtV37.js} +2 -2
  179. package/dist/client/assets/{projectScriptEditor-D20MTQIS.js → projectScriptEditor-BApTdMa4.js} +2 -2
  180. package/dist/client/assets/{providerSkills-DY_Eya4r.js → providerSkills-CK0_chtE.js} +2 -2
  181. package/dist/client/assets/{pullRequestDetail.logic-CLAnM03l.js → pullRequestDetail.logic-BmPSn0PA.js} +2 -2
  182. package/dist/client/assets/{pullRequestIcons-1vN39RsA.js → pullRequestIcons-CfKXhDuO.js} +2 -2
  183. package/dist/client/assets/{pullRequestReviewStore-z8tuJFXD.js → pullRequestReviewStore-CrDUhUKX.js} +2 -2
  184. package/dist/client/assets/{pullRequests-Dqd6r9gw.js → pullRequests-D-lKKR28.js} +2 -2
  185. package/dist/client/assets/{queries-B6XxcqnT.js → queries-CEdylITb.js} +2 -2
  186. package/dist/client/assets/{query-yuF2-QRx.js → query-DM1uxcKV.js} +2 -2
  187. package/dist/client/assets/{radio-group-Dcl3ANRp.js → radio-group-CkR7fabD.js} +2 -2
  188. package/dist/client/assets/{renderScheduler-CfBAnW7l.js → renderScheduler-BJowI8SS.js} +2 -2
  189. package/dist/client/assets/{rightPanelStore-DKH3Bw74.js → rightPanelStore-DUtuG_mq.js} +2 -2
  190. package/dist/client/assets/{runtime-DYpzE3gq.js → runtime-Du_4upLP.js} +3 -3
  191. package/dist/client/assets/{runtime-Csw1ghUb.js → runtime-mXszmljC.js} +3 -3
  192. package/dist/client/assets/{runtimeModeConfig-cuNxQIV-.js → runtimeModeConfig-CZ3ZrCmY.js} +2 -2
  193. package/dist/client/assets/{scheduledTasksSettings.logic-9aUS0PH9.js → scheduledTasksSettings.logic-YVexB6ub.js} +2 -2
  194. package/dist/client/assets/{scroll-area-DMQd4YlU.js → scroll-area-D1ITiKsD.js} +2 -2
  195. package/dist/client/assets/{select-kRO2vVzo.js → select-CT4O76xq.js} +2 -2
  196. package/dist/client/assets/{selfImproveFindings-uaqHvfDg.js → selfImproveFindings-wLxnhAIe.js} +2 -2
  197. package/dist/client/assets/{server-DXSwZxzT.js → server-BRIc5okw.js} +2 -2
  198. package/dist/client/assets/session-logic-BiU6P8DR.js +26 -0
  199. package/dist/client/assets/{session-meZM9Xpf.js → session-wmJod3Hf.js} +2 -2
  200. package/dist/client/assets/{settings-DFDwiVWH.js → settings-NLDl4Bmy.js} +2 -2
  201. package/dist/client/assets/{settings.appearance-Cfti608t.js → settings.appearance-CJCZI-Xj.js} +2 -2
  202. package/dist/client/assets/settings.archived-CLWZylu3.js +2 -0
  203. package/dist/client/assets/{settings.computer-use-BlDOxUzy.js → settings.computer-use-CijjzsIQ.js} +2 -2
  204. package/dist/client/assets/settings.connections-Cf7-ZN_h.js +2 -0
  205. package/dist/client/assets/{settings.data-controls-DUdW2NVF.js → settings.data-controls-DkLkW74X.js} +2 -2
  206. package/dist/client/assets/{settings.decisions-DrG6xwiq.js → settings.decisions-JeevVBZt.js} +2 -2
  207. package/dist/client/assets/{settings.designs-BtuTLR8n.js → settings.designs-DS1WBGjv.js} +2 -2
  208. package/dist/client/assets/{settings.diagnostics-BK6KmZ6a.js → settings.diagnostics-lQ8O62tl.js} +2 -2
  209. package/dist/client/assets/{settings.general-BmfZwZYV.js → settings.general-BWHDfXfO.js} +2 -2
  210. package/dist/client/assets/{settings.integrations-D1gZz8sk.js → settings.integrations-DEdu9gwQ.js} +2 -2
  211. package/dist/client/assets/{settings.keybindings-BTpVSO__.js → settings.keybindings-tc_MLaPn.js} +2 -2
  212. package/dist/client/assets/{settings.open-source-licenses-XO8zNkrl.js → settings.open-source-licenses-ucPvq0ML.js} +2 -2
  213. package/dist/client/assets/{settings.plugins-VlmvBnPN.js → settings.plugins-M2Rc23zw.js} +2 -2
  214. package/dist/client/assets/{settings.projects-M8mb50zO.js → settings.projects-tykSh6-D.js} +3 -3
  215. package/dist/client/assets/settings.providers--RJFEbkT.js +3 -0
  216. package/dist/client/assets/{settings.scheduled-tasks-Dm3QDHlc.js → settings.scheduled-tasks-BTioGx2i.js} +2 -2
  217. package/dist/client/assets/{settings.snap-shot-BxcK0LEY.js → settings.snap-shot-BUehYnKo.js} +2 -2
  218. package/dist/client/assets/{settings.source-control-DbAJM2fi.js → settings.source-control-Dxm6Jir5.js} +2 -2
  219. package/dist/client/assets/{settings.storage-BWTGbbAs.js → settings.storage-CrdP11yD.js} +2 -2
  220. package/dist/client/assets/{settingsLayout-D3zsCQTE.js → settingsLayout-7rl00kQL.js} +2 -2
  221. package/dist/client/assets/{sidebar-C_Z-zEdU.js → sidebar-DRWJdn3r.js} +2 -2
  222. package/dist/client/assets/{sidebarProjectGrouping-upKKecFM.js → sidebarProjectGrouping-BRZt_Xqk.js} +2 -2
  223. package/dist/client/assets/{skeleton-CAZWrHi2.js → skeleton-DOfA4sjN.js} +2 -2
  224. package/dist/client/assets/{sourceControl-Bb4nr0Wx.js → sourceControl-CKZL-8Mu.js} +2 -2
  225. package/dist/client/assets/{sourceControlClients-DExT5Wem.js → sourceControlClients-D-frc1l_.js} +2 -2
  226. package/dist/client/assets/{spinner-DN7lJfwl.js → spinner-DMCmqCAh.js} +2 -2
  227. package/dist/client/assets/{terminal-links-Dj73wz5S.js → terminal-links-Cdw7HYhQ.js} +2 -2
  228. package/dist/client/assets/{terminalSessions-CyoMi8Lk.js → terminalSessions-DGp0Zt7-.js} +2 -2
  229. package/dist/client/assets/{textarea-U0rH71iw.js → textarea-B2ogIlGU.js} +2 -2
  230. package/dist/client/assets/{themePalette-B5YWcpxp.js → themePalette-CiLEjm0l.js} +2 -2
  231. package/dist/client/assets/{toast-C1lIuL0v.js → toast-NSvYVPhH.js} +2 -2
  232. package/dist/client/assets/{toggle-CrlljXsx.js → toggle-BrZqohX5.js} +2 -2
  233. package/dist/client/assets/{toggle-group-BIVeiRdg.js → toggle-group-DpO88ac2.js} +2 -2
  234. package/dist/client/assets/{tooltip-CMPhQaPE.js → tooltip-QdplMyeY.js} +2 -2
  235. package/dist/client/assets/{uiStateStore-C6-jXt5N.js → uiStateStore-vt_JyvTj.js} +2 -2
  236. package/dist/client/assets/{usage-TbP8vhYG.js → usage-CHD3cyvN.js} +2 -2
  237. package/dist/client/assets/{usageAccess-B68ifs1q.js → usageAccess-DVnjHuB7.js} +2 -2
  238. package/dist/client/assets/{usageFormat-5HVN-IRu.js → usageFormat-tjRl8Hbq.js} +2 -2
  239. package/dist/client/assets/{usageShortcuts-cMgT39NO.js → usageShortcuts-DMKWst47.js} +2 -2
  240. package/dist/client/assets/{use-atom-command-sg76DXcz.js → use-atom-command-BfhNaUIU.js} +2 -2
  241. package/dist/client/assets/{useAriaLabelledBy-D_ENSt33.js → useAriaLabelledBy-BlIdXeWO.js} +2 -2
  242. package/dist/client/assets/useHandleNewThread-Bv9hl6Vv.js +2 -0
  243. package/dist/client/assets/{useLocation-t7z8sUje.js → useLocation-jsSq4KCV.js} +2 -2
  244. package/dist/client/assets/{useNavigate-kfVoxx_T.js → useNavigate-ut7tie8O.js} +2 -2
  245. package/dist/client/assets/{useNavigateBack-B79USD1h.js → useNavigateBack-DQAO81KK.js} +2 -2
  246. package/dist/client/assets/{useP4ConnectAuthPrompt-Caj-XRNA.js → useP4ConnectAuthPrompt-IuajGXvV.js} +2 -2
  247. package/dist/client/assets/{useParams-DuqJgNNY.js → useParams-2ErCyxxB.js} +2 -2
  248. package/dist/client/assets/{usePermissionStatus-hWpY6-jP.js → usePermissionStatus-BlueIAuh.js} +2 -2
  249. package/dist/client/assets/{usePullRequestActions-B6Nj3E46.js → usePullRequestActions-VZpGy8dq.js} +2 -2
  250. package/dist/client/assets/{useRegisterFieldControl-y1AHmvVZ.js → useRegisterFieldControl-BTyFUE5E.js} +2 -2
  251. package/dist/client/assets/{useScopedModelAvailability-Cb_UE0gJ.js → useScopedModelAvailability-CH6hfrU_.js} +2 -2
  252. package/dist/client/assets/useSettings-FRbaNpbg.js +3 -0
  253. package/dist/client/assets/utils-CxCThU1r.js +37 -0
  254. package/dist/client/assets/{vcsRefInvalidation-Bkr613aV.js → vcsRefInvalidation-CiJ0pwCz.js} +2 -2
  255. package/dist/client/assets/{welcome-Dj-C1U_A.js → welcome-CBJlRbzG.js} +2 -2
  256. package/dist/client/index.html +1 -1
  257. package/dist/{renderer-BaYdZX9b.mjs → renderer-DKZZL6cd.mjs} +2 -2
  258. package/dist/{runtime-xvtWpueC.mjs → runtime-Bbjyj8bt.mjs} +134 -47
  259. package/package.json +1 -1
  260. package/dist/client/assets/AlertDialogRoot-zitC_5YS.js +0 -2
  261. package/dist/client/assets/ChatGptUsageButton-LTPdlo27.js +0 -2
  262. package/dist/client/assets/Input-CTKz2gGc.js +0 -2
  263. package/dist/client/assets/JZOYTAAL-BSyl5qdX.js +0 -1
  264. package/dist/client/assets/_chat-DLjkfz3i.js +0 -45
  265. package/dist/client/assets/main-BE5xGjw3.css +0 -2
  266. package/dist/client/assets/mediaSource-CI8DI4FI.js +0 -2
  267. package/dist/client/assets/session-logic-C42l2TRa.js +0 -26
  268. package/dist/client/assets/settings.archived-Bh4SpQp7.js +0 -2
  269. package/dist/client/assets/settings.connections-BTrzLXQG.js +0 -2
  270. package/dist/client/assets/settings.providers-CQ0OTnQ1.js +0 -3
  271. package/dist/client/assets/useHandleNewThread-DglymQWA.js +0 -2
  272. package/dist/client/assets/useSettings-CyF6ezIl.js +0 -3
  273. package/dist/client/assets/utils-BlwLA0C4.js +0 -37
@@ -1,2 +1,2 @@
1
- import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{Ah as i,CT as a,Fs as o,Ft as s,Ht as c,It as l,Jn as u,Jt as d,Nt as f,TT as p,Vt as m,aE as h,cf as g,dr as _,fr as v,hh as y,jd as b,kh as x,lf as S,rn as C,sf as w,t as T}from"./utils-BlwLA0C4.js";import{a as E,i as D,n as O,r as k,t as A}from"./number-field-DqB5oGdp.js";import{a as j,c as M,o as N,s as P,t as F}from"./select-kRO2vVzo.js";import{t as ee}from"./useNavigate-kfVoxx_T.js";import{i as te}from"./toast-C1lIuL0v.js";import{F as ne,M as re,N as ie,P as ae,R as oe,d as I}from"./useSettings-CyF6ezIl.js";import{f as se,t as ce}from"./server-DXSwZxzT.js";import{n as le}from"./query-yuF2-QRx.js";import{t as ue}from"./use-atom-command-sg76DXcz.js";import{a as de,n as fe,t as pe}from"./tooltip-CMPhQaPE.js";import{t as L}from"./skeleton-CAZWrHi2.js";import{t as me}from"./textarea-U0rH71iw.js";import{t as he}from"./input-CySdZpuF.js";import{a as ge,i as _e,n as R,o as ve,r as ye,t as be}from"./empty-B5VIjZQf.js";import{t as z}from"./sourceControl-Bb4nr0Wx.js";import{g as xe,m as Se}from"./Icons-CPaJO8_C.js";import{n as Ce,t as we}from"./sourceControlClients-DExT5Wem.js";import{n as B}from"./pullRequestIcons-1vN39RsA.js";import{F as Te,I as Ee,R as De,V as Oe,a as V,f as H,i as ke,n as Ae,o as U,r as je,s as Me,t as Ne}from"./settingsLayout-D3zsCQTE.js";import{Dr as Pe,Or as W,Tn as Fe,br as Ie,co as Le,do as Re,lo as ze,sa as Be,xo as Ve,yr as G}from"./main-1tW7jidE.js";import{t as He}from"./ProviderModelPicker-CHf8PGFh.js";import{t as Ue}from"./useScopedModelAvailability-Cb_UE0gJ.js";import{t as We}from"./ProjectDefaultsSettings-b9JKMHCZ.js";import{t as Ge}from"./SecretInput-D6soOcQS.js";import{t as Ke}from"./ProviderSettingsForm-DTCgpI31.js";var K=n(),q=e(t(),1),J=e(r(),1);function qe({environmentId:e,definition:t,onSaved:n}){let r=I(e,e=>e.sourceControlHosts[t.kind]),i=ue(se.updateSettings,{label:`save ${t.label} settings`}),[a,o]=(0,q.useState)(!1),s={settingsSchema:t.settings},c=Object.values(r??{}).some(e=>e!==``),l=async r=>{o(!0);try{(await i({environmentId:e,input:{patch:{sourceControlHosts:{[t.kind]:r}}}}))._tag===`Success`&&n()}finally{o(!1)}};return(0,J.jsxs)(`fieldset`,{disabled:a,className:`contents`,children:[(0,J.jsx)(Ke,{definition:s,value:r??{},idPrefix:`source-control-${t.kind}-${e}`,variant:`settings`,onChange:e=>{let t=e??{},n=Object.fromEntries(Object.entries(t).filter(([e,t])=>r?.[e]!==t)),i=Object.keys(r??{}).filter(e=>!(e in t));l({...n,...Object.fromEntries(i.map(e=>[e,``]))})}}),c?(0,J.jsx)(`div`,{className:`flex justify-end pt-2`,children:(0,J.jsx)(_,{size:`xs`,variant:`outline`,onClick:()=>void l(Object.fromEntries(Object.keys(r??{}).map(e=>[e,``]))),children:`Remove`})}):null]})}function Je(e){return[...new Set(e.map(e=>e.host))].map(t=>{let n=e.filter(e=>e.host===t),r=n.filter(e=>e.environmentVariable===void 0),i=r.filter(e=>e.authenticated);return{host:t,activeAccount:(i.find(e=>e.active)??i[0])?.account??null,selectable:i.map(e=>e.account),broken:r.filter(e=>!e.authenticated),environmentVariable:n.find(e=>e.environmentVariable)?.environmentVariable??null}})}function Ye(e,t,n){let r=e[t],i=n.enabled??r?.enabled??!0,a=n.account===void 0?r?.account:n.account??void 0,{[t]:o,...s}=e;return i&&a===void 0?s:{...s,[t]:{enabled:i,...a===void 0?{}:{account:a}}}}var Xe=`active gh account`;function Y(e){let t=(0,K.c)(4),n;return t[0]!==e.account||t[1]!==e.label||t[2]!==e.revealed?(n=e.revealed?(0,J.jsx)(`span`,{className:`min-w-0 truncate font-mono text-2xs`,children:e.account}):(0,J.jsxs)(`span`,{className:`min-w-0 truncate font-mono text-2xs`,children:[(0,J.jsx)(`span`,{className:`select-none blur-xs`,"aria-hidden":!0,children:W(e.account)}),(0,J.jsx)(`span`,{className:`sr-only`,children:e.label??`Hidden account`})]}),t[0]=e.account,t[1]=e.label,t[2]=e.revealed,t[3]=n):n=t[3],n}function Ze({environmentId:e,auth:t,onSaved:n}){let r=I(e,we).hosts,i=ue(se.updateSettings,{label:`save GitHub account settings`}),[a,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(!1),l=Je(t.accounts??[]),u=async(t,a)=>{o(!0);try{(await i({environmentId:e,input:{patch:{sourceControlHosts:{github:{hosts:Ye(r,t,a)}}}}}))._tag===`Success`&&n()}finally{o(!1)}};return l.length===0?(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Sign in with `,(0,J.jsx)(`code`,{className:`rounded bg-muted px-1 py-px text-2xs`,children:`gh auth login`}),` on the server host, then rescan to choose accounts here.`]}):(0,J.jsxs)(`div`,{className:`grid gap-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsxs)(`p`,{className:`max-w-2xl text-xs leading-relaxed text-muted-foreground`,children:[`Choose which `,(0,J.jsx)(`code`,{className:`rounded bg-muted px-1 py-px text-2xs`,children:`gh`}),` login each GitHub host uses, or turn a host off.`]}),(0,J.jsx)(_,{size:`icon-xs`,variant:`ghost-muted`,onClick:()=>c(e=>!e),"aria-label":s?`Hide GitHub accounts`:`Reveal GitHub accounts`,"aria-pressed":s,children:s?(0,J.jsx)(S,{}):(0,J.jsx)(g,{})})]}),l.map(e=>{let t=r[e.host],n=t?.enabled??!0,i=t?.account!==void 0&&!e.selectable.includes(t.account),o=t?.account!==void 0&&!i?t.account:Xe;return(0,J.jsxs)(`div`,{className:`grid gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 space-y-0.5`,children:[(0,J.jsx)(`span`,{className:`text-xs font-medium text-foreground`,children:e.host}),e.selectable.length===1&&e.selectable[0]!==void 0?(0,J.jsxs)(`p`,{className:`flex min-w-0 items-center gap-1 text-xs text-muted-foreground`,children:[(0,J.jsx)(`span`,{children:`Signed in as`}),(0,J.jsx)(Y,{revealed:s,account:e.selectable[0]})]}):null]}),(0,J.jsx)(Re,{checked:n,disabled:a,"aria-label":`Use GitHub on ${e.host}`,onCheckedChange:t=>void u(e.host,{enabled:t})})]}),e.selectable.length>1?(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Account`}),(0,J.jsx)(`div`,{className:`w-64 max-w-full`,children:(0,J.jsxs)(F,{value:o,disabled:a||!n,onValueChange:t=>{typeof t==`string`&&u(e.host,{account:t===Xe?null:t})},children:[(0,J.jsx)(P,{size:`sm`,"aria-label":`GitHub account for ${e.host}`,children:(0,J.jsx)(M,{children:t=>t===Xe?(0,J.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[`Active gh account`,e.activeAccount?(0,J.jsxs)(J.Fragment,{children:[`(`,(0,J.jsx)(Y,{revealed:s,account:e.activeAccount}),`)`]}):null]}):(0,J.jsx)(Y,{revealed:s,account:t})})}),(0,J.jsxs)(N,{align:`end`,alignItemWithTrigger:!1,children:[(0,J.jsx)(j,{value:Xe,children:(0,J.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[`Active gh account`,e.activeAccount?(0,J.jsxs)(J.Fragment,{children:[`(`,(0,J.jsx)(Y,{revealed:s,account:e.activeAccount}),`)`]}):null]})}),e.selectable.map((e,t)=>(0,J.jsx)(j,{value:e,children:(0,J.jsx)(Y,{revealed:s,account:e,label:`Account ${t+1}`})},e))]})]})})]}):null,i?(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`p`,{className:`text-xs text-warning`,children:`The chosen login is no longer signed in, so the active gh login is used.`}),(0,J.jsx)(_,{size:`xs`,variant:`outline`,disabled:a,onClick:()=>void u(e.host,{account:null}),children:`Use active login`})]}):null,e.broken.map(e=>(0,J.jsxs)(`p`,{className:`flex min-w-0 flex-wrap items-center gap-1 text-xs text-muted-foreground/70`,children:[(0,J.jsx)(Y,{revealed:s,account:e.account}),(0,J.jsxs)(`span`,{children:[`can't be used: `,e.error??`gh reports this login as invalid.`]})]},e.account)),e.environmentVariable?(0,J.jsxs)(`p`,{className:`text-xs text-warning`,children:[e.environmentVariable,` is set on the server, so it overrides the account chosen here until it is unset.`]}):null]},e.host)})]})}var X=`github.com`;function Qe(e){return`https://${e}/settings/personal-access-tokens/new`}function $e({environmentId:e,onSaved:t}){let{tokens:n}=I(e,we),r=ue(se.updateSettings,{label:`save GitHub token`}),[i,a]=(0,q.useState)(X),[o,s]=(0,q.useState)(``),[c,l]=(0,q.useState)(!1),u=i.trim().toLowerCase(),d=(n[u]??``).length>0,f=Object.entries(n).filter(([,e])=>e.length>0).map(([e])=>e),p=async(i,a)=>{l(!0);try{(await r({environmentId:e,input:{patch:{sourceControlHosts:{github:{tokens:{...n,[i]:a}}}}}}))._tag===`Success`&&(s(``),t())}finally{l(!1)}};return(0,J.jsx)(`form`,{className:`grid gap-3`,onSubmit:e=>{e.preventDefault(),u&&o.trim()&&p(u,o.trim())},children:(0,J.jsxs)(`fieldset`,{disabled:c,className:`contents`,children:[(0,J.jsxs)(`p`,{className:`max-w-2xl text-xs leading-relaxed text-muted-foreground`,children:[`A token saved here is used before`,` `,(0,J.jsx)(`code`,{className:`rounded bg-muted px-1 py-px text-2xs`,children:`GH_TOKEN`}),` and the`,` `,(0,J.jsx)(`code`,{className:`rounded bg-muted px-1 py-px text-2xs`,children:`gh`}),` login, so GitHub works without the GitHub CLI. Give it read and write access to pull requests and contents.`,` `,(0,J.jsxs)(v,{render:(0,J.jsx)(`a`,{href:Qe(u||X),target:`_blank`,rel:`noreferrer noopener`}),children:[`Create a token`,(0,J.jsx)(w,{"aria-hidden":!0,className:`size-3`})]})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[12rem_1fr]`,children:[(0,J.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,J.jsx)(Be,{htmlFor:`github-token-host-${e}`,children:`Host`}),(0,J.jsx)(he,{id:`github-token-host-${e}`,autoComplete:`off`,size:`sm`,placeholder:X,value:i,onChange:e=>a(e.target.value)})]}),(0,J.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,J.jsx)(Be,{htmlFor:`github-token-${e}`,children:`Token`}),(0,J.jsx)(Ge,{id:`github-token-${e}`,size:`sm`,configured:d,value:o,onChange:e=>s(e.target.value)})]})]}),(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:f.length===0?`No token saved; the server uses GH_TOKEN or the gh login.`:`Saved for ${f.join(`, `)}.`}),(0,J.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[d?(0,J.jsx)(_,{size:`xs`,variant:`outline`,disabled:c,onClick:()=>void p(u,``),children:`Remove`}):null,(0,J.jsx)(_,{type:`submit`,size:`xs`,disabled:!u||!o.trim()||c,children:`Save`})]})]})]})})}var et={static:`Static prefix`,semantic:`Semantic prefix`,custom:`Custom instructions`};function tt(){let e=(0,K.c)(40),t=Te(),{targets:n}=Oe(),r;e[0]===n?r=e[1]:(r=n.map(it).join(`,`),e[0]=n,e[1]=r);let i=r,a=(0,q.useRef)(!1),o=(0,q.useRef)(!1),s=De(),c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=[`branchNamingMode`],e[2]=c):c=e[2];let l=Ee(c),u;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=[`branchNamePrefix`],e[3]=u):u=e[3];let d=Ee(u),f;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=[`branchNameInstructions`],e[4]=f):f=e[4];let p=Ee(f),m,h;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=[`branchNamingMode`],h=G(`worktree-branch-naming`),e[5]=m,e[6]=h):(m=e[5],h=e[6]);let g=!l&&t.branchNamingMode===`semantic`?`The model chooses a prefix that describes the work, such as feat/add-search, fix/login-timeout, or refactor/auth.`:void 0,_;e[7]!==l||e[8]!==t.branchNamingMode||e[9]!==s?(_=t.branchNamingMode!==x.branchNamingMode||l?(0,J.jsx)(je,{label:`branch naming`,onClick:()=>s({branchNamingMode:x.branchNamingMode})}):null,e[7]=l,e[8]=t.branchNamingMode,e[9]=s,e[10]=_):_=e[10];let v=l?null:t.branchNamingMode,b;e[11]===s?b=e[12]:(b=e=>{y.literals.includes(e)&&s({branchNamingMode:e})},e[11]=s,e[12]=b);let S;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,J.jsx)(P,{size:`sm`,"aria-label":`Worktree branch naming`,children:(0,J.jsx)(M,{children:rt})}),e[13]=S):S=e[13];let C;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,J.jsx)(N,{align:`end`,alignItemWithTrigger:!1,children:y.literals.map(nt)}),e[14]=C):C=e[14];let w;e[15]!==v||e[16]!==b?(w=(0,J.jsxs)(F,{value:v,onValueChange:b,children:[S,C]}),e[15]=v,e[16]=b,e[17]=w):w=e[17];let T;e[18]!==w||e[19]!==g||e[20]!==_?(T=(0,J.jsx)(V,{serverScoped:!0,settingKeys:m,...h,description:`Choose how new worktree branches are named from your first message.`,status:g,resetAction:_,control:w}),e[18]=w,e[19]=g,e[20]=_,e[21]=T):T=e[21];let E;e[22]!==l||e[23]!==d||e[24]!==i||e[25]!==t.branchNamePrefix||e[26]!==t.branchNamingMode||e[27]!==s?(E=!l&&t.branchNamingMode===`static`?(0,J.jsx)(V,{serverScoped:!0,settingKeys:[`branchNamePrefix`],title:`Branch prefix`,description:`For example, p4 or p4/ produces p4/add-search. Leave empty for no prefix.`,resetAction:d||t.branchNamePrefix!==x.branchNamePrefix?(0,J.jsx)(je,{label:`branch prefix`,onClick:()=>s({branchNamePrefix:x.branchNamePrefix})}):null,control:(0,J.jsx)(he,{"aria-label":`Branch prefix`,autoCapitalize:`none`,spellCheck:!1,onChange:()=>{a.current=!0},placeholder:d?`Mixed`:`No prefix`,defaultValue:d?``:t.branchNamePrefix,onBlur:e=>{let n=e.target.value.trim();a.current&&(d||n!==t.branchNamePrefix)&&s({branchNamePrefix:n}),a.current=!1}},`${i}:${d}:${t.branchNamePrefix}`)}):null,e[22]=l,e[23]=d,e[24]=i,e[25]=t.branchNamePrefix,e[26]=t.branchNamingMode,e[27]=s,e[28]=E):E=e[28];let D;e[29]!==p||e[30]!==l||e[31]!==i||e[32]!==t.branchNameInstructions||e[33]!==t.branchNamingMode||e[34]!==s?(D=!l&&t.branchNamingMode===`custom`?(0,J.jsx)(V,{serverScoped:!0,settingKeys:[`branchNameInstructions`],title:`Branch naming instructions`,description:`Appended to the naming prompt. The model returns the complete branch name; no prefix or suffix is added.`,resetAction:p||t.branchNameInstructions!==``?(0,J.jsx)(je,{label:`branch naming instructions`,onClick:()=>s({branchNameInstructions:``})}):null,children:(0,J.jsx)(`div`,{className:`mt-3 max-w-2xl pb-3.5`,children:(0,J.jsx)(me,{"aria-label":`Branch naming instructions`,onChange:()=>{o.current=!0},rows:4,defaultValue:p?``:t.branchNameInstructions,placeholder:p?`Mixed. Enter instructions to apply to all selected targets.`:`Use julius/ followed by the issue ID and a short description.`,onBlur:e=>{let n=e.target.value.trim();o.current&&(p||n!==t.branchNameInstructions)&&s({branchNameInstructions:n}),o.current=!1}},`${i}:${p}:${t.branchNameInstructions}`)})}):null,e[29]=p,e[30]=l,e[31]=i,e[32]=t.branchNameInstructions,e[33]=t.branchNamingMode,e[34]=s,e[35]=D):D=e[35];let O;return e[36]!==T||e[37]!==E||e[38]!==D?(O=(0,J.jsxs)(J.Fragment,{children:[T,E,D]}),e[36]=T,e[37]=E,e[38]=D,e[39]=O):O=e[39],O}function nt(e){return(0,J.jsx)(j,{value:e,children:et[e]},e)}function rt(e){return e===null?`Mixed`:et[e]}function it(e){return`${e.environmentId}:${e.projectId}`}var at={repo_conventions:{label:`Repository conventions`,description:`In each project, matches recent change descriptions and change request titles.`},conventional_commits:{label:`Conventional Commits`,description:`Use Conventional Commit prefixes and keep change request text concise.`},custom:{label:`Custom instructions`,description:`Use your instructions for change descriptions and change requests in every project.`}};function ot(){let e=(0,K.c)(80),t=Te(),n=De(),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[`reviewGuidesEnabled`],e[0]=r):r=e[0];let a=Ee(r),u=ee(),{environment:p,connectedEnvironments:h,targets:g,target:v}=Oe(),y=p?.environmentId??null,b=h.length>0,x=p?.serverConfig?.providers??ce,S;e[1]===g?S=e[2]:(S=e=>{let t=g[0];return t!==void 0&&g.some(n=>n.settings.sourceControlWritingStyle[e]!==t.settings.sourceControlWritingStyle[e])},e[1]=g,e[2]=S);let w=S,T;e[3]===w?T=e[4]:(T=w(`mode`),e[3]=w,e[4]=T);let E=T,D;e[5]===w?D=e[6]:(D=w(`customInstructions`),e[5]=w,e[6]=D);let O=D,k;e[7]===w?k=e[8]:(k=w(`followChangeRequestTemplates`),e[7]=w,e[8]=k);let A=k,j=E||O,ne;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(ne=[`sourceControlWriterModelSelection`],e[9]=ne):ne=e[9];let ae=Ee(ne),oe;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(oe=[`reviewGuideModelSelection`],e[10]=oe):oe=e[10];let I=Ee(oe),se;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(se=[`reviewGuideInstructions`],e[11]=se):se=e[11];let le=Ee(se),ue=(0,q.useRef)(!1),de;e[12]===g?de=e[13]:(de=g.map(ft).join(`,`),e[12]=g,e[13]=de);let fe=de,pe=(0,q.useRef)(null),[L,he]=(0,q.useState)(!1),[ge,_e]=(0,q.useState)(null),R=t.sourceControlWritingStyle,ve=i.sourceControlWritingStyle,ye=j||R.mode!==ve.mode||R.customInstructions!==ve.customInstructions,be=x.filter(dt),z=d(m(c(be),t,v?.projectId??null)),xe=new Set(z.filter(ut).map(lt)),Se=be.filter(e=>xe.has(e.instanceId)),Ce=s(t,Se),we=t.sourceControlWriterModelSelection!==null,B=s({...t,textGenerationModelSelection:ie(t,Se,v?.projectId??null)},Se),H=z.some(e=>e.instanceId===Ce.instanceId&&e.enabled&&e.isAvailable),ke=f(t,Se,B.instanceId,B.model),U=Ue(t,z),Ne=z.find(e=>e.instanceId===B.instanceId),Pe=t.reviewGuideModelSelection!==null,W=s({...t,textGenerationModelSelection:re(t,be,v?.projectId??null)},be),Fe=f(t,be,W.instanceId,W.model),Ie=z.find(e=>e.instanceId===W.instanceId),Le=Me,ze;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(ze=(0,J.jsx)(tt,{}),e[14]=ze):ze=e[14];let Be;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(Be=[`sourceControlWritingStyle`],e[15]=Be):Be=e[15];let Ve;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=G(`source-control-writing-style`),e[16]=Ve):Ve=e[16];let We=at[R.mode],Ge;e[17]!==ye||e[18]!==n?(Ge=ye?(0,J.jsx)(je,{label:`source control writing style`,onClick:()=>n({sourceControlWritingStyle:{mode:ve.mode,customInstructions:ve.customInstructions}})}):null,e[17]=ye,e[18]=n,e[19]=Ge):Ge=e[19];let Ke=E?null:R.mode,qe;e[20]===n?qe=e[21]:(qe=e=>{let t=pe.current?.value.trim();n({sourceControlWritingStyle:{mode:e,...t===void 0?{}:{customInstructions:t}}})},e[20]=n,e[21]=qe);let Je;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(Je=(0,J.jsx)(P,{size:`sm`,className:`w-full sm:w-56`,"aria-label":`Source control writing style`,children:(0,J.jsx)(M,{children:ct})}),e[22]=Je):Je=e[22];let Ye;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=Object.keys(at),e[23]=Ye):Ye=e[23];let Xe;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(Xe=(0,J.jsx)(N,{align:`end`,alignItemWithTrigger:!1,children:Ye.map(st)}),e[24]=Xe):Xe=e[24];let Y;e[25]!==Ke||e[26]!==qe?(Y=(0,J.jsxs)(F,{value:Ke,onValueChange:qe,children:[Je,Xe]}),e[25]=Ke,e[26]=qe,e[27]=Y):Y=e[27];let Ze;e[28]!==ge||e[29]!==L||e[30]!==R.customInstructions||e[31]!==R.mode||e[32]!==n||e[33]!==j?(Ze=j?(0,J.jsx)(`div`,{className:`mt-3 max-w-2xl space-y-2 pb-3.5`,children:L?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(me,{value:ge??``,onChange:e=>_e(e.target.value),rows:4,"aria-label":`Custom source control instructions for all selected environments`,placeholder:`Write the instructions each selected environment should use.`}),(0,J.jsx)(_,{size:`sm`,variant:`outline`,disabled:ge===null,onClick:()=>{ge!==null&&(n({sourceControlWritingStyle:{mode:`custom`,customInstructions:ge.trim()}}),he(!1))},children:`Apply instructions to all`})]}):(0,J.jsx)(_,{size:`sm`,variant:`outline`,onClick:()=>{_e(null),he(!0)},children:`Write custom instructions for all`})}):R.mode===`custom`?(0,J.jsx)(`div`,{className:`mt-3 max-w-2xl pb-3.5`,children:(0,J.jsx)(me,{ref:pe,defaultValue:R.customInstructions,onBlur:e=>{let t=e.target.value.trim();t!==R.customInstructions&&n({sourceControlWritingStyle:{customInstructions:t}})},rows:4,placeholder:`Keep titles concise. Use short bullet points in descriptions.`,"aria-label":`Custom source control writing instructions`},R.customInstructions)}):null,e[28]=ge,e[29]=L,e[30]=R.customInstructions,e[31]=R.mode,e[32]=n,e[33]=j,e[34]=Ze):Ze=e[34];let X;e[35]!==We.description||e[36]!==Ge||e[37]!==Y||e[38]!==Ze||e[39]!==j?(X=(0,J.jsx)(V,{serverScoped:!0,settingKeys:Be,mixed:j,...Ve,description:We.description,resetAction:Ge,control:Y,children:Ze}),e[35]=We.description,e[36]=Ge,e[37]=Y,e[38]=Ze,e[39]=j,e[40]=X):X=e[40];let Qe;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=[`sourceControlWritingStyle`],e[41]=Qe):Qe=e[41];let $e;e[42]===Symbol.for(`react.memo_cache_sentinel`)?($e=G(`follow-change-request-templates`),e[42]=$e):$e=e[42];let et;e[43]!==R.followChangeRequestTemplates||e[44]!==A||e[45]!==n?(et=A||R.followChangeRequestTemplates!==ve.followChangeRequestTemplates?(0,J.jsx)(je,{label:`change request templates`,onClick:()=>n({sourceControlWritingStyle:{followChangeRequestTemplates:ve.followChangeRequestTemplates}})}):null,e[43]=R.followChangeRequestTemplates,e[44]=A,e[45]=n,e[46]=et):et=e[46];let nt=!A&&R.followChangeRequestTemplates,rt;e[47]===n?rt=e[48]:(rt=e=>n({sourceControlWritingStyle:{followChangeRequestTemplates:!!e}}),e[47]=n,e[48]=rt);let it;e[49]!==nt||e[50]!==rt||e[51]!==A?(it=(0,J.jsx)(Re,{mixed:A,checked:nt,onCheckedChange:rt,"aria-label":`Follow change request templates`}),e[49]=nt,e[50]=rt,e[51]=A,e[52]=it):it=e[52];let ot;e[53]!==et||e[54]!==it||e[55]!==A?(ot=(0,J.jsx)(V,{serverScoped:!0,settingKeys:Qe,mixed:A,...$e,description:`Use the repository's template for change request descriptions when available.`,resetAction:et,control:it}),e[53]=et,e[54]=it,e[55]=A,e[56]=ot):ot=e[56];let pt,mt;e[57]===Symbol.for(`react.memo_cache_sentinel`)?(pt=[`sourceControlWriterModelSelection`],mt=G(`source-control-writer-model`),e[57]=pt,e[58]=mt):(pt=e[57],mt=e[58]);let ht=b?(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[we&&!H?(0,J.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`No text generation providers available.`}):null,we&&H?(0,J.jsx)(He,{environmentId:y,activeInstanceId:B.instanceId,model:B.model,lockedProvider:null,instanceEntries:z,modelOptionsByInstance:ke,triggerClassName:Ae,triggerAriaLabel:`Source control writer model`,...ae?{triggerLabel:`Mixed`}:{},...y?{onOpenProviderSetup:e=>{u({to:`/settings/providers`,search:{environmentId:y,instanceId:e}})}}:{},getModelDisabledReason:U,onInstanceModelChange:(e,t)=>{let r=U(e,t);r?te.add({type:`error`,title:`Source control writer model not saved`,description:r}):n({sourceControlWriterModelSelection:o(e,t)})}}):null,we&&H&&!ae&&Ne?(0,J.jsx)(C,{provider:Ne.driverKind,models:Ne.models,model:B.model,modelOptions:B.options??[],allowPromptInjectedEffort:!1,planModeEnabled:t.planModeEnabled||l(B.options),triggerClassName:Ae,onModelOptionsChange:e=>n({sourceControlWriterModelSelection:o(B.instanceId,B.model,e)})}):null,(0,J.jsx)(Re,{checked:we,disabled:!we&&!H,onCheckedChange:e=>n({sourceControlWriterModelSelection:e?o(Ce.instanceId,Ce.model,Ce.options):null}),"aria-label":`Use a separate source control writer model`})]}):(0,J.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Connect an environment to choose its source control writer model.`}),gt;e[59]===ht?gt=e[60]:(gt=(0,J.jsx)(V,{serverScoped:!0,settingKeys:pt,...mt,description:`Model for source control text and branch or bookmark names. Off uses the environment's text generation model.`,control:ht}),e[59]=ht,e[60]=gt);let _t;e[61]===Symbol.for(`react.memo_cache_sentinel`)?(_t=[`reviewGuidesEnabled`],e[61]=_t):_t=e[61];let vt;e[62]===Symbol.for(`react.memo_cache_sentinel`)?(vt=G(`review-guides`),e[62]=vt):vt=e[62];let yt=!a&&t.reviewGuidesEnabled,Z;e[63]===n?Z=e[64]:(Z=e=>n({reviewGuidesEnabled:!!e}),e[63]=n,e[64]=Z);let Q;e[65]!==a||e[66]!==yt||e[67]!==Z?(Q=(0,J.jsx)(Re,{mixed:a,checked:yt,onCheckedChange:Z,"aria-label":`Review guides`}),e[65]=a,e[66]=yt,e[67]=Z,e[68]=Q):Q=e[68];let $;e[69]!==a||e[70]!==Q?($=(0,J.jsx)(V,{serverScoped:!0,settingKeys:_t,mixed:a,...vt,description:`Adds a Guide tab to pull requests: an agent writes a tour of the change, stop by stop, with the calls a maintainer should make.`,control:Q}),e[69]=a,e[70]=Q,e[71]=$):$=e[71];let bt=t.reviewGuidesEnabled||a?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(V,{serverScoped:!0,settingKeys:[`reviewGuideModelSelection`],...G(`review-guide-model`),description:`Model that reads a pull request to write its review guide. It reads the change itself over many steps, so a stronger model helps. Off uses the source control writer model.`,control:b?(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(Pe||I)&&H?(0,J.jsx)(He,{environmentId:y,activeInstanceId:W.instanceId,model:W.model,lockedProvider:null,instanceEntries:z,modelOptionsByInstance:Fe,triggerClassName:Ae,triggerAriaLabel:`Review guide model`,...I?{triggerLabel:`Mixed`}:{},getModelDisabledReason:U,onInstanceModelChange:(e,t)=>{let r=U(e,t);r?te.add({type:`error`,title:`Review guide model not saved`,description:r}):n({reviewGuideModelSelection:o(e,t)})}}):null,Pe&&H&&!I&&Ie?(0,J.jsx)(C,{provider:Ie.driverKind,models:Ie.models,model:W.model,modelOptions:W.options??[],allowPromptInjectedEffort:!1,planModeEnabled:t.planModeEnabled||l(W.options),triggerClassName:Ae,onModelOptionsChange:e=>n({reviewGuideModelSelection:o(W.instanceId,W.model,e)})}):null,(0,J.jsx)(Re,{mixed:I,checked:!I&&Pe,disabled:!Pe&&!H,onCheckedChange:e=>{if(!e){n({reviewGuideModelSelection:null});return}let t=U(B.instanceId,B.model);t?te.add({type:`error`,title:`Review guide model not saved`,description:t}):n({reviewGuideModelSelection:o(B.instanceId,B.model,B.options)})},"aria-label":`Use a separate review guide model`})]}):(0,J.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Connect an environment to choose its review guide model.`})}),(0,J.jsx)(V,{serverScoped:!0,settingKeys:[`reviewGuideInstructions`],...G(`review-guide-instructions`),description:`Your preferences for review guides: what to show first, dwell on, or skip. The guide's format and coverage stay the same.`,resetAction:le||t.reviewGuideInstructions!==``?(0,J.jsx)(je,{label:`review guide instructions`,onClick:()=>n({reviewGuideInstructions:``})}):null,children:(0,J.jsx)(`div`,{className:`mt-3 max-w-2xl pb-3.5`,children:(0,J.jsx)(me,{"aria-label":`Review guide instructions`,onChange:()=>{ue.current=!0},rows:4,defaultValue:le?``:t.reviewGuideInstructions,placeholder:le?`Mixed. Enter instructions to apply to all selected targets.`:`Show service interfaces before implementations. Skip test files unless they change behavior. Keep summaries to two sentences.`,onBlur:e=>{let r=e.target.value.trim();ue.current&&(le||r!==t.reviewGuideInstructions)&&n({reviewGuideInstructions:r}),ue.current=!1}},`${fe}:${le}:${t.reviewGuideInstructions}`)})})]}):null,xt;return e[72]!==Le||e[73]!==ze||e[74]!==X||e[75]!==ot||e[76]!==gt||e[77]!==$||e[78]!==bt?(xt=(0,J.jsxs)(Le,{id:`source-control-text-generation`,title:`Text generation`,children:[ze,X,ot,gt,$,bt]}),e[72]=Le,e[73]=ze,e[74]=X,e[75]=ot,e[76]=gt,e[77]=$,e[78]=bt,e[79]=xt):xt=e[79],xt}function st(e){return(0,J.jsx)(j,{hideIndicator:!0,value:e,children:at[e].label},e)}function ct(e){return e===null?`Mixed`:at[e].label}function lt(e){return e.instanceId}function ut(e){return e.enabled&&e.isAvailable}function dt(e){return e.supportsTextGeneration!==!1}function ft(e){return`${e.environmentId}:${e.projectId}`}var pt={versionControlSystems:[],sourceControlProviders:[]},mt={git:Se,jj:xe},ht=[`primary`,`secondary`],gt=5;function _t(e){return Math.round(p(e)/1e3)}function vt(e){return e===null||!Number.isFinite(e)?0:Math.max(0,Math.round(e))}function yt(e,t){let n={...e.overrides,...t};for(let[e,t]of Object.entries(n))t===void 0&&delete n[e];return{backgroundActivity:{schemaVersion:1,profile:`custom`,baseProfile:ae(e),overrides:n}}}function Z(e){return h(e)}function Q(e){return`auth`in e}function $(e){return!Q(e)&&!e.implemented}function bt(e){return e.status===`authenticated`?{label:`Authenticated`,badge:null}:e.status===`unauthenticated`?{label:`Not authenticated`,badge:`warning`}:{label:`Status unknown`,badge:null}}function xt(e){let t=(0,K.c)(2),n;return t[0]===e.account?n=t[1]:(n=(0,J.jsx)(Pe,{value:e.account,ariaLabel:`Toggle source control account visibility`,revealTooltip:`Click to reveal account`,hideTooltip:`Click to hide account`}),t[0]=e.account,t[1]=n),n}function St(e){return $(e)?`bg-muted-foreground/35`:e.status!==`available`||Q(e)&&e.auth.status!==`authenticated`?`bg-warning`:`bg-success`}function Ct(e){let t=(0,K.c)(13),{item:n}=e,r,i,a,o;if(t[0]!==n){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=St(n),s=Q(n)?Ce.find(n.kind):void 0,c=Q(n)?s&&Fe(s):mt[n.kind];if(!c){o=(0,J.jsx)(`span`,{className:T(`size-2 shrink-0 rounded-full`,e),"aria-hidden":!0});break bb0}i=`relative inline-flex size-5 shrink-0 items-center justify-center`,t[5]===c?a=t[6]:(a=(0,J.jsx)(c,{className:`size-4.5 text-foreground/80`,"aria-hidden":!0}),t[5]=c,t[6]=a),r=T(`pointer-events-none absolute -left-0.5 -top-0.5 size-2 rounded-full ring-2 ring-background`,e)}t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o}else r=t[1],i=t[2],a=t[3],o=t[4];if(o!==Symbol.for(`react.early_return_sentinel`))return o;let s;t[7]===r?s=t[8]:(s=(0,J.jsx)(`span`,{className:r,"aria-hidden":!0}),t[7]=r,t[8]=s);let c;return t[9]!==i||t[10]!==a||t[11]!==s?(c=(0,J.jsxs)(`span`,{className:i,children:[a,s]}),t[9]=i,t[10]=a,t[11]=s,t[12]=c):c=t[12],c}function wt({item:e,auth:t,authAccount:n}){if($(e))return(0,J.jsxs)(`span`,{children:[`Support for `,e.label,` is coming soon.`]});if(e.status!==`available`)return(0,J.jsxs)(`span`,{children:[`Not available on this server: `,e.installHint]});if(t){if(t.status===`authenticated`){let e=Z(t.detail);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{children:`Authenticated`}),n?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{"aria-hidden":!0,children:`as`}),(0,J.jsx)(xt,{account:n})]}):null,e?(0,J.jsxs)(`span`,{children:[`· `,e]}):null]})}if(!e.executable&&t.status===`unauthenticated`)return(0,J.jsxs)(`span`,{children:[`Available. `,e.installHint]});if(t.status===`unauthenticated`&&t.accounts?.some(e=>e.authenticated))return(0,J.jsx)(`span`,{children:Z(t.detail)??`Every ${e.label} host is turned off.`});if(t.status===`unauthenticated`)return(0,J.jsxs)(`span`,{children:[e.label,` is not authenticated on this server. Sign in or configure credentials using the `,(0,J.jsx)(`code`,{className:`rounded bg-muted px-1 py-px text-2xs`,children:e.executable}),` tool on the server host to enable change request features.`]});let r=Z(t.detail);return(0,J.jsxs)(`span`,{children:[`Could not verify `,e.label,`. `,r??e.installHint]})}return(0,J.jsx)(`span`,{children:`Available`})}function Tt(e){let t=(0,K.c)(57),{item:n,children:r}=e,i;t[0]===n.version?i=t[1]:(i=Z(n.version),t[0]=n.version,t[1]=i);let a=i,o=Q(n)?n.status===`available`&&n.auth.status===`authenticated`:n.status===`available`&&n.implemented,s=Q(n)?n.auth:null,c;t[2]===s?c=t[3]:(c=s?bt(s):null,t[2]=s,t[3]=c);let l=c,d=s?Z(s.account):null,[f,p]=(0,q.useState)(!1),m=r!==void 0,h=H(),g;t[4]!==n.kind||t[5]!==h||t[6]!==p?(g=()=>{(n.kind===`git`&&h===G(`git-fetch-interval`).id||h===Ie(n.kind)||n.kind===`github`&&h===G(`github-accounts`).id)&&p(!0)},t[4]=n.kind,t[5]=h,t[6]=p,t[7]=g):g=t[7];let v;t[8]!==n.kind||t[9]!==h?(v=[n.kind,h],t[8]=n.kind,t[9]=h,t[10]=v):v=t[10],(0,q.useEffect)(g,v);let y;t[11]===n?y=t[12]:(y=T(`first:rounded-t-xl last:rounded-b-xl transition-colors hover:bg-muted/20`,$(n)&&`opacity-80`),t[11]=n,t[12]=y);let x;t[13]===n?x=t[14]:(x=(0,J.jsx)(Ct,{item:n}),t[13]=n,t[14]=x);let S;t[15]===n.label?S=t[16]:(S=(0,J.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:n.label}),t[15]=n.label,t[16]=S);let C;t[17]===a?C=t[18]:(C=a?(0,J.jsx)(`code`,{className:`text-xs text-muted-foreground`,children:a}):null,t[17]=a,t[18]=C);let w;t[19]===n?w=t[20]:(w=$(n)?(0,J.jsx)(u,{variant:`warning`,size:`sm`,children:`Coming Soon`}):null,t[19]=n,t[20]=w);let E;t[21]===l?E=t[22]:(E=l?.badge?(0,J.jsx)(u,{variant:l.badge,size:`sm`,children:l.label}):null,t[21]=l,t[22]=E);let D;t[23]!==S||t[24]!==C||t[25]!==w||t[26]!==E||t[27]!==x?(D=(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[x,S,C,w,E]}),t[23]=S,t[24]=C,t[25]=w,t[26]=E,t[27]=x,t[28]=D):D=t[28];let O=wt({item:n,auth:s,authAccount:d}),k;t[29]===O?k=t[30]:(k=(0,J.jsx)(`p`,{className:`flex min-w-0 flex-wrap items-center gap-x-1 text-xs leading-normal text-muted-foreground/80`,children:O}),t[29]=O,t[30]=k);let A;t[31]!==D||t[32]!==k?(A=(0,J.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[D,k]}),t[31]=D,t[32]=k,t[33]=A):A=t[33];let j;t[34]!==m||t[35]!==f||t[36]!==n.label||t[37]!==p?(j=m?(0,J.jsx)(_,{size:`icon-xs`,variant:`ghost-muted`,onClick:()=>p(Et),"aria-expanded":f,"aria-label":`Toggle ${n.label} details`,children:(0,J.jsx)(b,{className:T(`size-3.5 transition-transform`,f&&`rotate-180`)})}):null,t[34]=m,t[35]=f,t[36]=n.label,t[37]=p,t[38]=j):j=t[38];let M;t[39]!==o||t[40]!==n?(M=$(n)?null:(0,J.jsx)(Re,{checked:o,disabled:!0,"aria-label":`${n.label} availability`}),t[39]=o,t[40]=n,t[41]=M):M=t[41];let N;t[42]!==j||t[43]!==M?(N=(0,J.jsxs)(`div`,{className:`flex w-full shrink-0 items-center gap-2 sm:w-auto sm:justify-end`,children:[j,M]}),t[42]=j,t[43]=M,t[44]=N):N=t[44];let P;t[45]!==A||t[46]!==N?(P=(0,J.jsx)(`div`,{className:`px-3 py-3 sm:px-4`,children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[A,N]})}),t[45]=A,t[46]=N,t[47]=P):P=t[47];let F;t[48]!==r||t[49]!==m||t[50]!==f||t[51]!==p?(F=m?(0,J.jsx)(Le,{open:f,onOpenChange:p,children:(0,J.jsx)(ze,{children:(0,J.jsx)(`div`,{className:`px-3 pb-4 pt-1 sm:px-4`,children:r})})}):null,t[48]=r,t[49]=m,t[50]=f,t[51]=p,t[52]=F):F=t[52];let ee;return t[53]!==P||t[54]!==F||t[55]!==y?(ee=(0,J.jsxs)(`div`,{className:y,children:[P,F]}),t[53]=P,t[54]=F,t[55]=y,t[56]=ee):ee=t[56],ee}function Et(e){return!e}function Dt(){let e=(0,K.c)(33),t=Te(),n=De(),r;e[0]===t?r=e[1]:(r=_t(oe(t).automaticGitFetchInterval),e[0]=t,e[1]=r);let i=r,o;e[2]===t.backgroundActivity?o=e[3]:(o=_t(ne(ae(t.backgroundActivity)).automaticGitFetchInterval),e[2]=t.backgroundActivity,e[3]=o);let s=i!==o,c;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=G(`git-fetch-interval`),e[4]=c):c=e[4];let l=c,u=l.id,d,f;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,J.jsx)(`span`,{className:`text-xs font-medium text-foreground`,children:l.title}),f=(0,J.jsx)(Ne,{children:`This interval is configured for Git only. The shared Background activity policy still decides whether Git refreshes may run when the timer fires. Custom intervals appear as Advanced in General settings.`}),e[5]=d,e[6]=f):(d=e[5],f=e[6]);let p=s?`opacity-100`:`pointer-events-none opacity-0`,m;e[7]===p?m=e[8]:(m=T(`inline-flex size-5 shrink-0 items-center justify-center transition-opacity`,p),e[7]=p,e[8]=m);let h=!s,g;e[9]!==s||e[10]!==t.backgroundActivity||e[11]!==n?(g=s?(0,J.jsx)(je,{label:`fetch interval`,onClick:()=>n(yt(t.backgroundActivity,{automaticGitFetchInterval:void 0}))}):null,e[9]=s,e[10]=t.backgroundActivity,e[11]=n,e[12]=g):g=e[12];let _;e[13]!==m||e[14]!==h||e[15]!==g?(_=(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[d,f,(0,J.jsx)(`span`,{className:m,"aria-hidden":h,children:g})]}),e[13]=m,e[14]=h,e[15]=g,e[16]=_):_=e[16];let v;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,J.jsx)(`p`,{className:`max-w-2xl text-xs leading-relaxed text-muted-foreground`,children:`Refresh remote branches in the background. Set to 0 to avoid automatic Git prompts.`}),e[17]=v):v=e[17];let y;e[18]===_?y=e[19]:(y=(0,J.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[_,v]}),e[18]=_,e[19]=y);let b;e[20]!==t.backgroundActivity||e[21]!==n?(b=e=>n(yt(t.backgroundActivity,{automaticGitFetchInterval:a(vt(e))})),e[20]=t.backgroundActivity,e[21]=n,e[22]=b):b=e[22];let x;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,J.jsxs)(k,{children:[(0,J.jsx)(O,{"aria-label":`Decrease fetch interval`}),(0,J.jsx)(E,{"aria-label":`Automatic Git fetch interval in seconds`}),(0,J.jsx)(D,{"aria-label":`Increase fetch interval`})]}),e[23]=x):x=e[23];let S;e[24]!==i||e[25]!==b?(S=(0,J.jsx)(A,{value:i,min:0,step:gt,size:`sm`,className:`w-32`,onValueChange:b,children:x}),e[24]=i,e[25]=b,e[26]=S):S=e[26];let C;e[27]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,J.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`seconds`}),e[27]=C):C=e[27];let w;e[28]===S?w=e[29]:(w=(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[S,C]}),e[28]=S,e[29]=w);let j;return e[30]!==y||e[31]!==w?(j=(0,J.jsx)(U,{id:u,className:`grid gap-3`,children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[y,w]})}),e[30]=y,e[31]=w,e[32]=j):j=e[32],j}function Ot(e){let t=(0,K.c)(4),{title:n,headerAction:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=ht.map(kt),t[0]=i):i=t[0];let a;return t[1]!==r||t[2]!==n?(a=(0,J.jsx)(Me,{title:n,headerAction:r,children:i}),t[1]=r,t[2]=n,t[3]=a):a=t[3],a}function kt(e){return(0,J.jsx)(`div`,{className:`first:rounded-t-xl last:rounded-b-xl px-3 py-3 sm:px-4`,children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsxs)(`span`,{className:`relative inline-flex size-5 shrink-0 items-center justify-center`,children:[(0,J.jsx)(L,{className:`size-4.5`}),(0,J.jsx)(L,{shape:`pill`,className:`pointer-events-none absolute -left-0.5 -top-0.5 size-2`,"aria-hidden":!0})]}),(0,J.jsx)(L,{shape:`pill`,className:`h-4 w-28`}),(0,J.jsx)(L,{shape:`pill`,className:`h-5 w-14`})]}),(0,J.jsx)(L,{shape:`pill`,className:`h-3 w-full max-w-xs`})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,J.jsx)(L,{className:`size-7`}),(0,J.jsx)(L,{shape:`pill`,className:`h-5 w-9`})]})]})},e)}function At(e){let t=(0,K.c)(18),{error:n,isPending:r,onScan:i}=e,a=n!==null,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=G(`source-control`),t[0]=o):o=t[0];let s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,J.jsx)(ge,{variant:`icon`,children:(0,J.jsx)(B.pullRequest,{})}),t[1]=s):s=t[1];let c=a?`Could not scan the server environment`:`Nothing detected yet`,l;t[2]===c?l=t[3]:(l=(0,J.jsx)(ve,{children:c}),t[2]=c,t[3]=l);let u=a?n:`Install Git on the server, add optional hosting integrations or credentials your workspace needs, then rescan.`,d;t[4]===u?d=t[5]:(d=(0,J.jsx)(ye,{children:u}),t[4]=u,t[5]=d);let f;t[6]!==l||t[7]!==d?(f=(0,J.jsxs)(_e,{children:[l,d]}),t[6]=l,t[7]=d,t[8]=f):f=t[8];let p;t[9]===r?p=t[10]:(p=(0,J.jsx)(Ve,{size:`sm`,refreshing:r}),t[9]=r,t[10]=p);let m;t[11]!==r||t[12]!==i||t[13]!==p?(m=(0,J.jsx)(R,{children:(0,J.jsxs)(_,{size:`sm`,variant:`outline`,onClick:i,disabled:r,children:[p,`Scan`]})}),t[11]=r,t[12]=i,t[13]=p,t[14]=m):m=t[14];let h;return t[15]!==f||t[16]!==m?(h=(0,J.jsx)(Me,{id:o.id,title:`Server environment`,children:(0,J.jsxs)(be,{children:[s,f,m]})}),t[15]=f,t[16]=m,t[17]=h):h=t[17],h}function jt(){let e=(0,K.c)(33),{scope:t,environment:n,connectedEnvironments:r}=Oe(),i=n?.connection.phase===`connected`?n.environmentId:null,a=t.environmentIds.length!==1&&r.length>1&&n?` · ${n.label}`:``,o;e[0]===i?o=e[1]:(o=i===null?null:z.discovery({environmentId:i,input:{}}),e[0]=i,e[1]=o);let s=le(o),c=s.data??pt,l=c.versionControlSystems.length>0,u=l||c.sourceControlProviders.length>0,d=s.isPending&&s.data===null,f;e[2]===s?f=e[3]:(f=()=>{s.refresh()},e[2]=s,e[3]=f);let p=f,m;e[4]!==i||e[5]!==p?(m=e=>{let t=Ce.find(e);if(t?.settings&&i!==null)return(0,J.jsx)(U,{id:Ie(e),children:(0,J.jsx)(qe,{environmentId:i,definition:{...t,settings:t.settings},onSaved:p},i)})},e[4]=i,e[5]=p,e[6]=m):m=e[6];let h=m,g;e[7]===s.isPending?g=e[8]:(g=(0,J.jsx)(Ve,{refreshing:s.isPending}),e[7]=s.isPending,e[8]=g);let v;e[9]!==s.isPending||e[10]!==p||e[11]!==g?(v=(0,J.jsx)(de,{render:(0,J.jsx)(_,{size:`icon-xs`,variant:`ghost-muted`,onClick:p,disabled:s.isPending,"aria-label":`Rescan server environment`,children:g})}),e[9]=s.isPending,e[10]=p,e[11]=g,e[12]=v):v=e[12];let y;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,J.jsx)(fe,{side:`top`,children:`Rescan Git and hosting integrations`}),e[13]=y):y=e[13];let b;e[14]===v?b=e[15]:(b=(0,J.jsxs)(pe,{children:[v,y]}),e[14]=v,e[15]=b);let x=b,S;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,J.jsx)(We,{category:`source-control`}),e[16]=S):S=e[16];let C;e[17]!==s.error||e[18]!==s.isPending||e[19]!==i||e[20]!==a||e[21]!==p||e[22]!==u||e[23]!==l||e[24]!==h||e[25]!==d||e[26]!==c.sourceControlProviders||e[27]!==c.versionControlSystems||e[28]!==x?(C=i===null?(0,J.jsx)(Me,{id:G(`source-control`).id,title:`Server environment`,children:(0,J.jsx)(`p`,{className:`px-4 py-3 text-sm text-muted-foreground`,children:`Connect an environment to inspect its version control tools and hosting integrations.`})}):d?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Ot,{title:`Version Control${a}`,headerAction:x}),(0,J.jsx)(Ot,{title:`Source Control Providers`})]}):u?(0,J.jsxs)(J.Fragment,{children:[l?(0,J.jsx)(Me,{id:G(`source-control`).id,title:`Version Control${a}`,headerAction:x,children:c.versionControlSystems.map(Mt)}):null,c.sourceControlProviders.length>0?(0,J.jsx)(Me,{id:l?void 0:G(`source-control`).id,title:l?`Source Control Providers`:`Source Control Providers${a}`,headerAction:l?null:x,children:c.sourceControlProviders.map(e=>(0,J.jsx)(Tt,{item:e,children:e.kind===`github`?(0,J.jsx)(U,{id:G(`github-accounts`).id,children:(0,J.jsxs)(`div`,{className:`grid gap-6`,children:[(0,J.jsx)($e,{environmentId:i,onSaved:p},`token-${i}`),e.status===`available`?(0,J.jsx)(Ze,{environmentId:i,auth:e.auth,onSaved:p},i):null]})}):h(e.kind)},`provider:${e.kind}`))}):null]}):(0,J.jsx)(At,{error:s.error,isPending:s.isPending,onScan:p}),e[17]=s.error,e[18]=s.isPending,e[19]=i,e[20]=a,e[21]=p,e[22]=u,e[23]=l,e[24]=h,e[25]=d,e[26]=c.sourceControlProviders,e[27]=c.versionControlSystems,e[28]=x,e[29]=C):C=e[29];let w;e[30]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,J.jsx)(ot,{}),e[30]=w):w=e[30];let T;return e[31]===C?T=e[32]:(T=(0,J.jsxs)(ke,{children:[S,C,w]}),e[31]=C,e[32]=T),T}function Mt(e){return(0,J.jsx)(Tt,{item:e,children:e.kind===`git`?(0,J.jsx)(Dt,{}):void 0},`vcs:${e.kind}`)}var Nt=jt;export{Nt as component};
2
- //# sourceMappingURL=settings.source-control-DbAJM2fi.js.map
1
+ import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{Ah as i,CT as a,Fs as o,Ft as s,Ht as c,It as l,Jn as u,Jt as d,Nt as f,TT as p,Vt as m,aE as h,cf as g,dr as _,fr as v,hh as y,jd as b,kh as x,lf as S,rn as C,sf as w,t as T}from"./utils-CxCThU1r.js";import{a as E,i as D,n as O,r as k,t as A}from"./number-field-D1mdZQVp.js";import{a as j,c as M,o as N,s as P,t as F}from"./select-CT4O76xq.js";import{t as ee}from"./useNavigate-ut7tie8O.js";import{i as te}from"./toast-NSvYVPhH.js";import{F as ne,M as re,N as ie,P as ae,R as oe,d as I}from"./useSettings-FRbaNpbg.js";import{f as se,t as ce}from"./server-BRIc5okw.js";import{n as le}from"./query-DM1uxcKV.js";import{t as ue}from"./use-atom-command-BfhNaUIU.js";import{a as de,n as fe,t as pe}from"./tooltip-QdplMyeY.js";import{t as L}from"./skeleton-DOfA4sjN.js";import{t as me}from"./textarea-B2ogIlGU.js";import{t as he}from"./input-DTnuNfU_.js";import{a as ge,i as _e,n as R,o as ve,r as ye,t as be}from"./empty-D39LEkAH.js";import{t as z}from"./sourceControl-CKZL-8Mu.js";import{g as xe,m as Se}from"./Icons-CQY6Z_tn.js";import{n as Ce,t as we}from"./sourceControlClients-D-frc1l_.js";import{n as B}from"./pullRequestIcons-CfKXhDuO.js";import{F as Te,I as Ee,R as De,V as Oe,a as V,f as H,i as ke,n as Ae,o as U,r as je,s as Me,t as Ne}from"./settingsLayout-7rl00kQL.js";import{Dr as Pe,Or as W,Tn as Fe,br as Ie,co as Le,do as Re,lo as ze,sa as Be,xo as Ve,yr as G}from"./main-BqFaDMNs.js";import{t as He}from"./ProviderModelPicker-QRPUsruj.js";import{t as Ue}from"./useScopedModelAvailability-CH6hfrU_.js";import{t as We}from"./ProjectDefaultsSettings-Bxz5MdOY.js";import{t as Ge}from"./SecretInput-B2ihrOsq.js";import{t as Ke}from"./ProviderSettingsForm-BEq2pSXW.js";var K=n(),q=e(t(),1),J=e(r(),1);function qe({environmentId:e,definition:t,onSaved:n}){let r=I(e,e=>e.sourceControlHosts[t.kind]),i=ue(se.updateSettings,{label:`save ${t.label} settings`}),[a,o]=(0,q.useState)(!1),s={settingsSchema:t.settings},c=Object.values(r??{}).some(e=>e!==``),l=async r=>{o(!0);try{(await i({environmentId:e,input:{patch:{sourceControlHosts:{[t.kind]:r}}}}))._tag===`Success`&&n()}finally{o(!1)}};return(0,J.jsxs)(`fieldset`,{disabled:a,className:`contents`,children:[(0,J.jsx)(Ke,{definition:s,value:r??{},idPrefix:`source-control-${t.kind}-${e}`,variant:`settings`,onChange:e=>{let t=e??{},n=Object.fromEntries(Object.entries(t).filter(([e,t])=>r?.[e]!==t)),i=Object.keys(r??{}).filter(e=>!(e in t));l({...n,...Object.fromEntries(i.map(e=>[e,``]))})}}),c?(0,J.jsx)(`div`,{className:`flex justify-end pt-2`,children:(0,J.jsx)(_,{size:`xs`,variant:`outline`,onClick:()=>void l(Object.fromEntries(Object.keys(r??{}).map(e=>[e,``]))),children:`Remove`})}):null]})}function Je(e){return[...new Set(e.map(e=>e.host))].map(t=>{let n=e.filter(e=>e.host===t),r=n.filter(e=>e.environmentVariable===void 0),i=r.filter(e=>e.authenticated);return{host:t,activeAccount:(i.find(e=>e.active)??i[0])?.account??null,selectable:i.map(e=>e.account),broken:r.filter(e=>!e.authenticated),environmentVariable:n.find(e=>e.environmentVariable)?.environmentVariable??null}})}function Ye(e,t,n){let r=e[t],i=n.enabled??r?.enabled??!0,a=n.account===void 0?r?.account:n.account??void 0,{[t]:o,...s}=e;return i&&a===void 0?s:{...s,[t]:{enabled:i,...a===void 0?{}:{account:a}}}}var Xe=`active gh account`;function Y(e){let t=(0,K.c)(4),n;return t[0]!==e.account||t[1]!==e.label||t[2]!==e.revealed?(n=e.revealed?(0,J.jsx)(`span`,{className:`min-w-0 truncate font-mono text-2xs`,children:e.account}):(0,J.jsxs)(`span`,{className:`min-w-0 truncate font-mono text-2xs`,children:[(0,J.jsx)(`span`,{className:`select-none blur-xs`,"aria-hidden":!0,children:W(e.account)}),(0,J.jsx)(`span`,{className:`sr-only`,children:e.label??`Hidden account`})]}),t[0]=e.account,t[1]=e.label,t[2]=e.revealed,t[3]=n):n=t[3],n}function Ze({environmentId:e,auth:t,onSaved:n}){let r=I(e,we).hosts,i=ue(se.updateSettings,{label:`save GitHub account settings`}),[a,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(!1),l=Je(t.accounts??[]),u=async(t,a)=>{o(!0);try{(await i({environmentId:e,input:{patch:{sourceControlHosts:{github:{hosts:Ye(r,t,a)}}}}}))._tag===`Success`&&n()}finally{o(!1)}};return l.length===0?(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Sign in with `,(0,J.jsx)(`code`,{className:`rounded bg-muted px-1 py-px text-2xs`,children:`gh auth login`}),` on the server host, then rescan to choose accounts here.`]}):(0,J.jsxs)(`div`,{className:`grid gap-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsxs)(`p`,{className:`max-w-2xl text-xs leading-relaxed text-muted-foreground`,children:[`Choose which `,(0,J.jsx)(`code`,{className:`rounded bg-muted px-1 py-px text-2xs`,children:`gh`}),` login each GitHub host uses, or turn a host off.`]}),(0,J.jsx)(_,{size:`icon-xs`,variant:`ghost-muted`,onClick:()=>c(e=>!e),"aria-label":s?`Hide GitHub accounts`:`Reveal GitHub accounts`,"aria-pressed":s,children:s?(0,J.jsx)(S,{}):(0,J.jsx)(g,{})})]}),l.map(e=>{let t=r[e.host],n=t?.enabled??!0,i=t?.account!==void 0&&!e.selectable.includes(t.account),o=t?.account!==void 0&&!i?t.account:Xe;return(0,J.jsxs)(`div`,{className:`grid gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 space-y-0.5`,children:[(0,J.jsx)(`span`,{className:`text-xs font-medium text-foreground`,children:e.host}),e.selectable.length===1&&e.selectable[0]!==void 0?(0,J.jsxs)(`p`,{className:`flex min-w-0 items-center gap-1 text-xs text-muted-foreground`,children:[(0,J.jsx)(`span`,{children:`Signed in as`}),(0,J.jsx)(Y,{revealed:s,account:e.selectable[0]})]}):null]}),(0,J.jsx)(Re,{checked:n,disabled:a,"aria-label":`Use GitHub on ${e.host}`,onCheckedChange:t=>void u(e.host,{enabled:t})})]}),e.selectable.length>1?(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Account`}),(0,J.jsx)(`div`,{className:`w-64 max-w-full`,children:(0,J.jsxs)(F,{value:o,disabled:a||!n,onValueChange:t=>{typeof t==`string`&&u(e.host,{account:t===Xe?null:t})},children:[(0,J.jsx)(P,{size:`sm`,"aria-label":`GitHub account for ${e.host}`,children:(0,J.jsx)(M,{children:t=>t===Xe?(0,J.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[`Active gh account`,e.activeAccount?(0,J.jsxs)(J.Fragment,{children:[`(`,(0,J.jsx)(Y,{revealed:s,account:e.activeAccount}),`)`]}):null]}):(0,J.jsx)(Y,{revealed:s,account:t})})}),(0,J.jsxs)(N,{align:`end`,alignItemWithTrigger:!1,children:[(0,J.jsx)(j,{value:Xe,children:(0,J.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[`Active gh account`,e.activeAccount?(0,J.jsxs)(J.Fragment,{children:[`(`,(0,J.jsx)(Y,{revealed:s,account:e.activeAccount}),`)`]}):null]})}),e.selectable.map((e,t)=>(0,J.jsx)(j,{value:e,children:(0,J.jsx)(Y,{revealed:s,account:e,label:`Account ${t+1}`})},e))]})]})})]}):null,i?(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`p`,{className:`text-xs text-warning`,children:`The chosen login is no longer signed in, so the active gh login is used.`}),(0,J.jsx)(_,{size:`xs`,variant:`outline`,disabled:a,onClick:()=>void u(e.host,{account:null}),children:`Use active login`})]}):null,e.broken.map(e=>(0,J.jsxs)(`p`,{className:`flex min-w-0 flex-wrap items-center gap-1 text-xs text-muted-foreground/70`,children:[(0,J.jsx)(Y,{revealed:s,account:e.account}),(0,J.jsxs)(`span`,{children:[`can't be used: `,e.error??`gh reports this login as invalid.`]})]},e.account)),e.environmentVariable?(0,J.jsxs)(`p`,{className:`text-xs text-warning`,children:[e.environmentVariable,` is set on the server, so it overrides the account chosen here until it is unset.`]}):null]},e.host)})]})}var X=`github.com`;function Qe(e){return`https://${e}/settings/personal-access-tokens/new`}function $e({environmentId:e,onSaved:t}){let{tokens:n}=I(e,we),r=ue(se.updateSettings,{label:`save GitHub token`}),[i,a]=(0,q.useState)(X),[o,s]=(0,q.useState)(``),[c,l]=(0,q.useState)(!1),u=i.trim().toLowerCase(),d=(n[u]??``).length>0,f=Object.entries(n).filter(([,e])=>e.length>0).map(([e])=>e),p=async(i,a)=>{l(!0);try{(await r({environmentId:e,input:{patch:{sourceControlHosts:{github:{tokens:{...n,[i]:a}}}}}}))._tag===`Success`&&(s(``),t())}finally{l(!1)}};return(0,J.jsx)(`form`,{className:`grid gap-3`,onSubmit:e=>{e.preventDefault(),u&&o.trim()&&p(u,o.trim())},children:(0,J.jsxs)(`fieldset`,{disabled:c,className:`contents`,children:[(0,J.jsxs)(`p`,{className:`max-w-2xl text-xs leading-relaxed text-muted-foreground`,children:[`A token saved here is used before`,` `,(0,J.jsx)(`code`,{className:`rounded bg-muted px-1 py-px text-2xs`,children:`GH_TOKEN`}),` and the`,` `,(0,J.jsx)(`code`,{className:`rounded bg-muted px-1 py-px text-2xs`,children:`gh`}),` login, so GitHub works without the GitHub CLI. Give it read and write access to pull requests and contents.`,` `,(0,J.jsxs)(v,{render:(0,J.jsx)(`a`,{href:Qe(u||X),target:`_blank`,rel:`noreferrer noopener`}),children:[`Create a token`,(0,J.jsx)(w,{"aria-hidden":!0,className:`size-3`})]})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[12rem_1fr]`,children:[(0,J.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,J.jsx)(Be,{htmlFor:`github-token-host-${e}`,children:`Host`}),(0,J.jsx)(he,{id:`github-token-host-${e}`,autoComplete:`off`,size:`sm`,placeholder:X,value:i,onChange:e=>a(e.target.value)})]}),(0,J.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,J.jsx)(Be,{htmlFor:`github-token-${e}`,children:`Token`}),(0,J.jsx)(Ge,{id:`github-token-${e}`,size:`sm`,configured:d,value:o,onChange:e=>s(e.target.value)})]})]}),(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:f.length===0?`No token saved; the server uses GH_TOKEN or the gh login.`:`Saved for ${f.join(`, `)}.`}),(0,J.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[d?(0,J.jsx)(_,{size:`xs`,variant:`outline`,disabled:c,onClick:()=>void p(u,``),children:`Remove`}):null,(0,J.jsx)(_,{type:`submit`,size:`xs`,disabled:!u||!o.trim()||c,children:`Save`})]})]})]})})}var et={static:`Static prefix`,semantic:`Semantic prefix`,custom:`Custom instructions`};function tt(){let e=(0,K.c)(40),t=Te(),{targets:n}=Oe(),r;e[0]===n?r=e[1]:(r=n.map(it).join(`,`),e[0]=n,e[1]=r);let i=r,a=(0,q.useRef)(!1),o=(0,q.useRef)(!1),s=De(),c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=[`branchNamingMode`],e[2]=c):c=e[2];let l=Ee(c),u;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=[`branchNamePrefix`],e[3]=u):u=e[3];let d=Ee(u),f;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=[`branchNameInstructions`],e[4]=f):f=e[4];let p=Ee(f),m,h;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=[`branchNamingMode`],h=G(`worktree-branch-naming`),e[5]=m,e[6]=h):(m=e[5],h=e[6]);let g=!l&&t.branchNamingMode===`semantic`?`The model chooses a prefix that describes the work, such as feat/add-search, fix/login-timeout, or refactor/auth.`:void 0,_;e[7]!==l||e[8]!==t.branchNamingMode||e[9]!==s?(_=t.branchNamingMode!==x.branchNamingMode||l?(0,J.jsx)(je,{label:`branch naming`,onClick:()=>s({branchNamingMode:x.branchNamingMode})}):null,e[7]=l,e[8]=t.branchNamingMode,e[9]=s,e[10]=_):_=e[10];let v=l?null:t.branchNamingMode,b;e[11]===s?b=e[12]:(b=e=>{y.literals.includes(e)&&s({branchNamingMode:e})},e[11]=s,e[12]=b);let S;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,J.jsx)(P,{size:`sm`,"aria-label":`Worktree branch naming`,children:(0,J.jsx)(M,{children:rt})}),e[13]=S):S=e[13];let C;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,J.jsx)(N,{align:`end`,alignItemWithTrigger:!1,children:y.literals.map(nt)}),e[14]=C):C=e[14];let w;e[15]!==v||e[16]!==b?(w=(0,J.jsxs)(F,{value:v,onValueChange:b,children:[S,C]}),e[15]=v,e[16]=b,e[17]=w):w=e[17];let T;e[18]!==w||e[19]!==g||e[20]!==_?(T=(0,J.jsx)(V,{serverScoped:!0,settingKeys:m,...h,description:`Choose how new worktree branches are named from your first message.`,status:g,resetAction:_,control:w}),e[18]=w,e[19]=g,e[20]=_,e[21]=T):T=e[21];let E;e[22]!==l||e[23]!==d||e[24]!==i||e[25]!==t.branchNamePrefix||e[26]!==t.branchNamingMode||e[27]!==s?(E=!l&&t.branchNamingMode===`static`?(0,J.jsx)(V,{serverScoped:!0,settingKeys:[`branchNamePrefix`],title:`Branch prefix`,description:`For example, p4 or p4/ produces p4/add-search. Leave empty for no prefix.`,resetAction:d||t.branchNamePrefix!==x.branchNamePrefix?(0,J.jsx)(je,{label:`branch prefix`,onClick:()=>s({branchNamePrefix:x.branchNamePrefix})}):null,control:(0,J.jsx)(he,{"aria-label":`Branch prefix`,autoCapitalize:`none`,spellCheck:!1,onChange:()=>{a.current=!0},placeholder:d?`Mixed`:`No prefix`,defaultValue:d?``:t.branchNamePrefix,onBlur:e=>{let n=e.target.value.trim();a.current&&(d||n!==t.branchNamePrefix)&&s({branchNamePrefix:n}),a.current=!1}},`${i}:${d}:${t.branchNamePrefix}`)}):null,e[22]=l,e[23]=d,e[24]=i,e[25]=t.branchNamePrefix,e[26]=t.branchNamingMode,e[27]=s,e[28]=E):E=e[28];let D;e[29]!==p||e[30]!==l||e[31]!==i||e[32]!==t.branchNameInstructions||e[33]!==t.branchNamingMode||e[34]!==s?(D=!l&&t.branchNamingMode===`custom`?(0,J.jsx)(V,{serverScoped:!0,settingKeys:[`branchNameInstructions`],title:`Branch naming instructions`,description:`Appended to the naming prompt. The model returns the complete branch name; no prefix or suffix is added.`,resetAction:p||t.branchNameInstructions!==``?(0,J.jsx)(je,{label:`branch naming instructions`,onClick:()=>s({branchNameInstructions:``})}):null,children:(0,J.jsx)(`div`,{className:`mt-3 max-w-2xl pb-3.5`,children:(0,J.jsx)(me,{"aria-label":`Branch naming instructions`,onChange:()=>{o.current=!0},rows:4,defaultValue:p?``:t.branchNameInstructions,placeholder:p?`Mixed. Enter instructions to apply to all selected targets.`:`Use julius/ followed by the issue ID and a short description.`,onBlur:e=>{let n=e.target.value.trim();o.current&&(p||n!==t.branchNameInstructions)&&s({branchNameInstructions:n}),o.current=!1}},`${i}:${p}:${t.branchNameInstructions}`)})}):null,e[29]=p,e[30]=l,e[31]=i,e[32]=t.branchNameInstructions,e[33]=t.branchNamingMode,e[34]=s,e[35]=D):D=e[35];let O;return e[36]!==T||e[37]!==E||e[38]!==D?(O=(0,J.jsxs)(J.Fragment,{children:[T,E,D]}),e[36]=T,e[37]=E,e[38]=D,e[39]=O):O=e[39],O}function nt(e){return(0,J.jsx)(j,{value:e,children:et[e]},e)}function rt(e){return e===null?`Mixed`:et[e]}function it(e){return`${e.environmentId}:${e.projectId}`}var at={repo_conventions:{label:`Repository conventions`,description:`In each project, matches recent change descriptions and change request titles.`},conventional_commits:{label:`Conventional Commits`,description:`Use Conventional Commit prefixes and keep change request text concise.`},custom:{label:`Custom instructions`,description:`Use your instructions for change descriptions and change requests in every project.`}};function ot(){let e=(0,K.c)(80),t=Te(),n=De(),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[`reviewGuidesEnabled`],e[0]=r):r=e[0];let a=Ee(r),u=ee(),{environment:p,connectedEnvironments:h,targets:g,target:v}=Oe(),y=p?.environmentId??null,b=h.length>0,x=p?.serverConfig?.providers??ce,S;e[1]===g?S=e[2]:(S=e=>{let t=g[0];return t!==void 0&&g.some(n=>n.settings.sourceControlWritingStyle[e]!==t.settings.sourceControlWritingStyle[e])},e[1]=g,e[2]=S);let w=S,T;e[3]===w?T=e[4]:(T=w(`mode`),e[3]=w,e[4]=T);let E=T,D;e[5]===w?D=e[6]:(D=w(`customInstructions`),e[5]=w,e[6]=D);let O=D,k;e[7]===w?k=e[8]:(k=w(`followChangeRequestTemplates`),e[7]=w,e[8]=k);let A=k,j=E||O,ne;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(ne=[`sourceControlWriterModelSelection`],e[9]=ne):ne=e[9];let ae=Ee(ne),oe;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(oe=[`reviewGuideModelSelection`],e[10]=oe):oe=e[10];let I=Ee(oe),se;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(se=[`reviewGuideInstructions`],e[11]=se):se=e[11];let le=Ee(se),ue=(0,q.useRef)(!1),de;e[12]===g?de=e[13]:(de=g.map(ft).join(`,`),e[12]=g,e[13]=de);let fe=de,pe=(0,q.useRef)(null),[L,he]=(0,q.useState)(!1),[ge,_e]=(0,q.useState)(null),R=t.sourceControlWritingStyle,ve=i.sourceControlWritingStyle,ye=j||R.mode!==ve.mode||R.customInstructions!==ve.customInstructions,be=x.filter(dt),z=d(m(c(be),t,v?.projectId??null)),xe=new Set(z.filter(ut).map(lt)),Se=be.filter(e=>xe.has(e.instanceId)),Ce=s(t,Se),we=t.sourceControlWriterModelSelection!==null,B=s({...t,textGenerationModelSelection:ie(t,Se,v?.projectId??null)},Se),H=z.some(e=>e.instanceId===Ce.instanceId&&e.enabled&&e.isAvailable),ke=f(t,Se,B.instanceId,B.model),U=Ue(t,z),Ne=z.find(e=>e.instanceId===B.instanceId),Pe=t.reviewGuideModelSelection!==null,W=s({...t,textGenerationModelSelection:re(t,be,v?.projectId??null)},be),Fe=f(t,be,W.instanceId,W.model),Ie=z.find(e=>e.instanceId===W.instanceId),Le=Me,ze;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(ze=(0,J.jsx)(tt,{}),e[14]=ze):ze=e[14];let Be;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(Be=[`sourceControlWritingStyle`],e[15]=Be):Be=e[15];let Ve;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=G(`source-control-writing-style`),e[16]=Ve):Ve=e[16];let We=at[R.mode],Ge;e[17]!==ye||e[18]!==n?(Ge=ye?(0,J.jsx)(je,{label:`source control writing style`,onClick:()=>n({sourceControlWritingStyle:{mode:ve.mode,customInstructions:ve.customInstructions}})}):null,e[17]=ye,e[18]=n,e[19]=Ge):Ge=e[19];let Ke=E?null:R.mode,qe;e[20]===n?qe=e[21]:(qe=e=>{let t=pe.current?.value.trim();n({sourceControlWritingStyle:{mode:e,...t===void 0?{}:{customInstructions:t}}})},e[20]=n,e[21]=qe);let Je;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(Je=(0,J.jsx)(P,{size:`sm`,className:`w-full sm:w-56`,"aria-label":`Source control writing style`,children:(0,J.jsx)(M,{children:ct})}),e[22]=Je):Je=e[22];let Ye;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=Object.keys(at),e[23]=Ye):Ye=e[23];let Xe;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(Xe=(0,J.jsx)(N,{align:`end`,alignItemWithTrigger:!1,children:Ye.map(st)}),e[24]=Xe):Xe=e[24];let Y;e[25]!==Ke||e[26]!==qe?(Y=(0,J.jsxs)(F,{value:Ke,onValueChange:qe,children:[Je,Xe]}),e[25]=Ke,e[26]=qe,e[27]=Y):Y=e[27];let Ze;e[28]!==ge||e[29]!==L||e[30]!==R.customInstructions||e[31]!==R.mode||e[32]!==n||e[33]!==j?(Ze=j?(0,J.jsx)(`div`,{className:`mt-3 max-w-2xl space-y-2 pb-3.5`,children:L?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(me,{value:ge??``,onChange:e=>_e(e.target.value),rows:4,"aria-label":`Custom source control instructions for all selected environments`,placeholder:`Write the instructions each selected environment should use.`}),(0,J.jsx)(_,{size:`sm`,variant:`outline`,disabled:ge===null,onClick:()=>{ge!==null&&(n({sourceControlWritingStyle:{mode:`custom`,customInstructions:ge.trim()}}),he(!1))},children:`Apply instructions to all`})]}):(0,J.jsx)(_,{size:`sm`,variant:`outline`,onClick:()=>{_e(null),he(!0)},children:`Write custom instructions for all`})}):R.mode===`custom`?(0,J.jsx)(`div`,{className:`mt-3 max-w-2xl pb-3.5`,children:(0,J.jsx)(me,{ref:pe,defaultValue:R.customInstructions,onBlur:e=>{let t=e.target.value.trim();t!==R.customInstructions&&n({sourceControlWritingStyle:{customInstructions:t}})},rows:4,placeholder:`Keep titles concise. Use short bullet points in descriptions.`,"aria-label":`Custom source control writing instructions`},R.customInstructions)}):null,e[28]=ge,e[29]=L,e[30]=R.customInstructions,e[31]=R.mode,e[32]=n,e[33]=j,e[34]=Ze):Ze=e[34];let X;e[35]!==We.description||e[36]!==Ge||e[37]!==Y||e[38]!==Ze||e[39]!==j?(X=(0,J.jsx)(V,{serverScoped:!0,settingKeys:Be,mixed:j,...Ve,description:We.description,resetAction:Ge,control:Y,children:Ze}),e[35]=We.description,e[36]=Ge,e[37]=Y,e[38]=Ze,e[39]=j,e[40]=X):X=e[40];let Qe;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=[`sourceControlWritingStyle`],e[41]=Qe):Qe=e[41];let $e;e[42]===Symbol.for(`react.memo_cache_sentinel`)?($e=G(`follow-change-request-templates`),e[42]=$e):$e=e[42];let et;e[43]!==R.followChangeRequestTemplates||e[44]!==A||e[45]!==n?(et=A||R.followChangeRequestTemplates!==ve.followChangeRequestTemplates?(0,J.jsx)(je,{label:`change request templates`,onClick:()=>n({sourceControlWritingStyle:{followChangeRequestTemplates:ve.followChangeRequestTemplates}})}):null,e[43]=R.followChangeRequestTemplates,e[44]=A,e[45]=n,e[46]=et):et=e[46];let nt=!A&&R.followChangeRequestTemplates,rt;e[47]===n?rt=e[48]:(rt=e=>n({sourceControlWritingStyle:{followChangeRequestTemplates:!!e}}),e[47]=n,e[48]=rt);let it;e[49]!==nt||e[50]!==rt||e[51]!==A?(it=(0,J.jsx)(Re,{mixed:A,checked:nt,onCheckedChange:rt,"aria-label":`Follow change request templates`}),e[49]=nt,e[50]=rt,e[51]=A,e[52]=it):it=e[52];let ot;e[53]!==et||e[54]!==it||e[55]!==A?(ot=(0,J.jsx)(V,{serverScoped:!0,settingKeys:Qe,mixed:A,...$e,description:`Use the repository's template for change request descriptions when available.`,resetAction:et,control:it}),e[53]=et,e[54]=it,e[55]=A,e[56]=ot):ot=e[56];let pt,mt;e[57]===Symbol.for(`react.memo_cache_sentinel`)?(pt=[`sourceControlWriterModelSelection`],mt=G(`source-control-writer-model`),e[57]=pt,e[58]=mt):(pt=e[57],mt=e[58]);let ht=b?(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[we&&!H?(0,J.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`No text generation providers available.`}):null,we&&H?(0,J.jsx)(He,{environmentId:y,activeInstanceId:B.instanceId,model:B.model,lockedProvider:null,instanceEntries:z,modelOptionsByInstance:ke,triggerClassName:Ae,triggerAriaLabel:`Source control writer model`,...ae?{triggerLabel:`Mixed`}:{},...y?{onOpenProviderSetup:e=>{u({to:`/settings/providers`,search:{environmentId:y,instanceId:e}})}}:{},getModelDisabledReason:U,onInstanceModelChange:(e,t)=>{let r=U(e,t);r?te.add({type:`error`,title:`Source control writer model not saved`,description:r}):n({sourceControlWriterModelSelection:o(e,t)})}}):null,we&&H&&!ae&&Ne?(0,J.jsx)(C,{provider:Ne.driverKind,models:Ne.models,model:B.model,modelOptions:B.options??[],allowPromptInjectedEffort:!1,planModeEnabled:t.planModeEnabled||l(B.options),triggerClassName:Ae,onModelOptionsChange:e=>n({sourceControlWriterModelSelection:o(B.instanceId,B.model,e)})}):null,(0,J.jsx)(Re,{checked:we,disabled:!we&&!H,onCheckedChange:e=>n({sourceControlWriterModelSelection:e?o(Ce.instanceId,Ce.model,Ce.options):null}),"aria-label":`Use a separate source control writer model`})]}):(0,J.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Connect an environment to choose its source control writer model.`}),gt;e[59]===ht?gt=e[60]:(gt=(0,J.jsx)(V,{serverScoped:!0,settingKeys:pt,...mt,description:`Model for source control text and branch or bookmark names. Off uses the environment's text generation model.`,control:ht}),e[59]=ht,e[60]=gt);let _t;e[61]===Symbol.for(`react.memo_cache_sentinel`)?(_t=[`reviewGuidesEnabled`],e[61]=_t):_t=e[61];let vt;e[62]===Symbol.for(`react.memo_cache_sentinel`)?(vt=G(`review-guides`),e[62]=vt):vt=e[62];let yt=!a&&t.reviewGuidesEnabled,Z;e[63]===n?Z=e[64]:(Z=e=>n({reviewGuidesEnabled:!!e}),e[63]=n,e[64]=Z);let Q;e[65]!==a||e[66]!==yt||e[67]!==Z?(Q=(0,J.jsx)(Re,{mixed:a,checked:yt,onCheckedChange:Z,"aria-label":`Review guides`}),e[65]=a,e[66]=yt,e[67]=Z,e[68]=Q):Q=e[68];let $;e[69]!==a||e[70]!==Q?($=(0,J.jsx)(V,{serverScoped:!0,settingKeys:_t,mixed:a,...vt,description:`Adds a Guide tab to pull requests: an agent writes a tour of the change, stop by stop, with the calls a maintainer should make.`,control:Q}),e[69]=a,e[70]=Q,e[71]=$):$=e[71];let bt=t.reviewGuidesEnabled||a?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(V,{serverScoped:!0,settingKeys:[`reviewGuideModelSelection`],...G(`review-guide-model`),description:`Model that reads a pull request to write its review guide. It reads the change itself over many steps, so a stronger model helps. Off uses the source control writer model.`,control:b?(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(Pe||I)&&H?(0,J.jsx)(He,{environmentId:y,activeInstanceId:W.instanceId,model:W.model,lockedProvider:null,instanceEntries:z,modelOptionsByInstance:Fe,triggerClassName:Ae,triggerAriaLabel:`Review guide model`,...I?{triggerLabel:`Mixed`}:{},getModelDisabledReason:U,onInstanceModelChange:(e,t)=>{let r=U(e,t);r?te.add({type:`error`,title:`Review guide model not saved`,description:r}):n({reviewGuideModelSelection:o(e,t)})}}):null,Pe&&H&&!I&&Ie?(0,J.jsx)(C,{provider:Ie.driverKind,models:Ie.models,model:W.model,modelOptions:W.options??[],allowPromptInjectedEffort:!1,planModeEnabled:t.planModeEnabled||l(W.options),triggerClassName:Ae,onModelOptionsChange:e=>n({reviewGuideModelSelection:o(W.instanceId,W.model,e)})}):null,(0,J.jsx)(Re,{mixed:I,checked:!I&&Pe,disabled:!Pe&&!H,onCheckedChange:e=>{if(!e){n({reviewGuideModelSelection:null});return}let t=U(B.instanceId,B.model);t?te.add({type:`error`,title:`Review guide model not saved`,description:t}):n({reviewGuideModelSelection:o(B.instanceId,B.model,B.options)})},"aria-label":`Use a separate review guide model`})]}):(0,J.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Connect an environment to choose its review guide model.`})}),(0,J.jsx)(V,{serverScoped:!0,settingKeys:[`reviewGuideInstructions`],...G(`review-guide-instructions`),description:`Your preferences for review guides: what to show first, dwell on, or skip. The guide's format and coverage stay the same.`,resetAction:le||t.reviewGuideInstructions!==``?(0,J.jsx)(je,{label:`review guide instructions`,onClick:()=>n({reviewGuideInstructions:``})}):null,children:(0,J.jsx)(`div`,{className:`mt-3 max-w-2xl pb-3.5`,children:(0,J.jsx)(me,{"aria-label":`Review guide instructions`,onChange:()=>{ue.current=!0},rows:4,defaultValue:le?``:t.reviewGuideInstructions,placeholder:le?`Mixed. Enter instructions to apply to all selected targets.`:`Show service interfaces before implementations. Skip test files unless they change behavior. Keep summaries to two sentences.`,onBlur:e=>{let r=e.target.value.trim();ue.current&&(le||r!==t.reviewGuideInstructions)&&n({reviewGuideInstructions:r}),ue.current=!1}},`${fe}:${le}:${t.reviewGuideInstructions}`)})})]}):null,xt;return e[72]!==Le||e[73]!==ze||e[74]!==X||e[75]!==ot||e[76]!==gt||e[77]!==$||e[78]!==bt?(xt=(0,J.jsxs)(Le,{id:`source-control-text-generation`,title:`Text generation`,children:[ze,X,ot,gt,$,bt]}),e[72]=Le,e[73]=ze,e[74]=X,e[75]=ot,e[76]=gt,e[77]=$,e[78]=bt,e[79]=xt):xt=e[79],xt}function st(e){return(0,J.jsx)(j,{hideIndicator:!0,value:e,children:at[e].label},e)}function ct(e){return e===null?`Mixed`:at[e].label}function lt(e){return e.instanceId}function ut(e){return e.enabled&&e.isAvailable}function dt(e){return e.supportsTextGeneration!==!1}function ft(e){return`${e.environmentId}:${e.projectId}`}var pt={versionControlSystems:[],sourceControlProviders:[]},mt={git:Se,jj:xe},ht=[`primary`,`secondary`],gt=5;function _t(e){return Math.round(p(e)/1e3)}function vt(e){return e===null||!Number.isFinite(e)?0:Math.max(0,Math.round(e))}function yt(e,t){let n={...e.overrides,...t};for(let[e,t]of Object.entries(n))t===void 0&&delete n[e];return{backgroundActivity:{schemaVersion:1,profile:`custom`,baseProfile:ae(e),overrides:n}}}function Z(e){return h(e)}function Q(e){return`auth`in e}function $(e){return!Q(e)&&!e.implemented}function bt(e){return e.status===`authenticated`?{label:`Authenticated`,badge:null}:e.status===`unauthenticated`?{label:`Not authenticated`,badge:`warning`}:{label:`Status unknown`,badge:null}}function xt(e){let t=(0,K.c)(2),n;return t[0]===e.account?n=t[1]:(n=(0,J.jsx)(Pe,{value:e.account,ariaLabel:`Toggle source control account visibility`,revealTooltip:`Click to reveal account`,hideTooltip:`Click to hide account`}),t[0]=e.account,t[1]=n),n}function St(e){return $(e)?`bg-muted-foreground/35`:e.status!==`available`||Q(e)&&e.auth.status!==`authenticated`?`bg-warning`:`bg-success`}function Ct(e){let t=(0,K.c)(13),{item:n}=e,r,i,a,o;if(t[0]!==n){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=St(n),s=Q(n)?Ce.find(n.kind):void 0,c=Q(n)?s&&Fe(s):mt[n.kind];if(!c){o=(0,J.jsx)(`span`,{className:T(`size-2 shrink-0 rounded-full`,e),"aria-hidden":!0});break bb0}i=`relative inline-flex size-5 shrink-0 items-center justify-center`,t[5]===c?a=t[6]:(a=(0,J.jsx)(c,{className:`size-4.5 text-foreground/80`,"aria-hidden":!0}),t[5]=c,t[6]=a),r=T(`pointer-events-none absolute -left-0.5 -top-0.5 size-2 rounded-full ring-2 ring-background`,e)}t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o}else r=t[1],i=t[2],a=t[3],o=t[4];if(o!==Symbol.for(`react.early_return_sentinel`))return o;let s;t[7]===r?s=t[8]:(s=(0,J.jsx)(`span`,{className:r,"aria-hidden":!0}),t[7]=r,t[8]=s);let c;return t[9]!==i||t[10]!==a||t[11]!==s?(c=(0,J.jsxs)(`span`,{className:i,children:[a,s]}),t[9]=i,t[10]=a,t[11]=s,t[12]=c):c=t[12],c}function wt({item:e,auth:t,authAccount:n}){if($(e))return(0,J.jsxs)(`span`,{children:[`Support for `,e.label,` is coming soon.`]});if(e.status!==`available`)return(0,J.jsxs)(`span`,{children:[`Not available on this server: `,e.installHint]});if(t){if(t.status===`authenticated`){let e=Z(t.detail);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{children:`Authenticated`}),n?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{"aria-hidden":!0,children:`as`}),(0,J.jsx)(xt,{account:n})]}):null,e?(0,J.jsxs)(`span`,{children:[`· `,e]}):null]})}if(!e.executable&&t.status===`unauthenticated`)return(0,J.jsxs)(`span`,{children:[`Available. `,e.installHint]});if(t.status===`unauthenticated`&&t.accounts?.some(e=>e.authenticated))return(0,J.jsx)(`span`,{children:Z(t.detail)??`Every ${e.label} host is turned off.`});if(t.status===`unauthenticated`)return(0,J.jsxs)(`span`,{children:[e.label,` is not authenticated on this server. Sign in or configure credentials using the `,(0,J.jsx)(`code`,{className:`rounded bg-muted px-1 py-px text-2xs`,children:e.executable}),` tool on the server host to enable change request features.`]});let r=Z(t.detail);return(0,J.jsxs)(`span`,{children:[`Could not verify `,e.label,`. `,r??e.installHint]})}return(0,J.jsx)(`span`,{children:`Available`})}function Tt(e){let t=(0,K.c)(57),{item:n,children:r}=e,i;t[0]===n.version?i=t[1]:(i=Z(n.version),t[0]=n.version,t[1]=i);let a=i,o=Q(n)?n.status===`available`&&n.auth.status===`authenticated`:n.status===`available`&&n.implemented,s=Q(n)?n.auth:null,c;t[2]===s?c=t[3]:(c=s?bt(s):null,t[2]=s,t[3]=c);let l=c,d=s?Z(s.account):null,[f,p]=(0,q.useState)(!1),m=r!==void 0,h=H(),g;t[4]!==n.kind||t[5]!==h||t[6]!==p?(g=()=>{(n.kind===`git`&&h===G(`git-fetch-interval`).id||h===Ie(n.kind)||n.kind===`github`&&h===G(`github-accounts`).id)&&p(!0)},t[4]=n.kind,t[5]=h,t[6]=p,t[7]=g):g=t[7];let v;t[8]!==n.kind||t[9]!==h?(v=[n.kind,h],t[8]=n.kind,t[9]=h,t[10]=v):v=t[10],(0,q.useEffect)(g,v);let y;t[11]===n?y=t[12]:(y=T(`first:rounded-t-xl last:rounded-b-xl transition-colors hover:bg-muted/20`,$(n)&&`opacity-80`),t[11]=n,t[12]=y);let x;t[13]===n?x=t[14]:(x=(0,J.jsx)(Ct,{item:n}),t[13]=n,t[14]=x);let S;t[15]===n.label?S=t[16]:(S=(0,J.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:n.label}),t[15]=n.label,t[16]=S);let C;t[17]===a?C=t[18]:(C=a?(0,J.jsx)(`code`,{className:`text-xs text-muted-foreground`,children:a}):null,t[17]=a,t[18]=C);let w;t[19]===n?w=t[20]:(w=$(n)?(0,J.jsx)(u,{variant:`warning`,size:`sm`,children:`Coming Soon`}):null,t[19]=n,t[20]=w);let E;t[21]===l?E=t[22]:(E=l?.badge?(0,J.jsx)(u,{variant:l.badge,size:`sm`,children:l.label}):null,t[21]=l,t[22]=E);let D;t[23]!==S||t[24]!==C||t[25]!==w||t[26]!==E||t[27]!==x?(D=(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[x,S,C,w,E]}),t[23]=S,t[24]=C,t[25]=w,t[26]=E,t[27]=x,t[28]=D):D=t[28];let O=wt({item:n,auth:s,authAccount:d}),k;t[29]===O?k=t[30]:(k=(0,J.jsx)(`p`,{className:`flex min-w-0 flex-wrap items-center gap-x-1 text-xs leading-normal text-muted-foreground/80`,children:O}),t[29]=O,t[30]=k);let A;t[31]!==D||t[32]!==k?(A=(0,J.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[D,k]}),t[31]=D,t[32]=k,t[33]=A):A=t[33];let j;t[34]!==m||t[35]!==f||t[36]!==n.label||t[37]!==p?(j=m?(0,J.jsx)(_,{size:`icon-xs`,variant:`ghost-muted`,onClick:()=>p(Et),"aria-expanded":f,"aria-label":`Toggle ${n.label} details`,children:(0,J.jsx)(b,{className:T(`size-3.5 transition-transform`,f&&`rotate-180`)})}):null,t[34]=m,t[35]=f,t[36]=n.label,t[37]=p,t[38]=j):j=t[38];let M;t[39]!==o||t[40]!==n?(M=$(n)?null:(0,J.jsx)(Re,{checked:o,disabled:!0,"aria-label":`${n.label} availability`}),t[39]=o,t[40]=n,t[41]=M):M=t[41];let N;t[42]!==j||t[43]!==M?(N=(0,J.jsxs)(`div`,{className:`flex w-full shrink-0 items-center gap-2 sm:w-auto sm:justify-end`,children:[j,M]}),t[42]=j,t[43]=M,t[44]=N):N=t[44];let P;t[45]!==A||t[46]!==N?(P=(0,J.jsx)(`div`,{className:`px-3 py-3 sm:px-4`,children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[A,N]})}),t[45]=A,t[46]=N,t[47]=P):P=t[47];let F;t[48]!==r||t[49]!==m||t[50]!==f||t[51]!==p?(F=m?(0,J.jsx)(Le,{open:f,onOpenChange:p,children:(0,J.jsx)(ze,{children:(0,J.jsx)(`div`,{className:`px-3 pb-4 pt-1 sm:px-4`,children:r})})}):null,t[48]=r,t[49]=m,t[50]=f,t[51]=p,t[52]=F):F=t[52];let ee;return t[53]!==P||t[54]!==F||t[55]!==y?(ee=(0,J.jsxs)(`div`,{className:y,children:[P,F]}),t[53]=P,t[54]=F,t[55]=y,t[56]=ee):ee=t[56],ee}function Et(e){return!e}function Dt(){let e=(0,K.c)(33),t=Te(),n=De(),r;e[0]===t?r=e[1]:(r=_t(oe(t).automaticGitFetchInterval),e[0]=t,e[1]=r);let i=r,o;e[2]===t.backgroundActivity?o=e[3]:(o=_t(ne(ae(t.backgroundActivity)).automaticGitFetchInterval),e[2]=t.backgroundActivity,e[3]=o);let s=i!==o,c;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=G(`git-fetch-interval`),e[4]=c):c=e[4];let l=c,u=l.id,d,f;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,J.jsx)(`span`,{className:`text-xs font-medium text-foreground`,children:l.title}),f=(0,J.jsx)(Ne,{children:`This interval is configured for Git only. The shared Background activity policy still decides whether Git refreshes may run when the timer fires. Custom intervals appear as Advanced in General settings.`}),e[5]=d,e[6]=f):(d=e[5],f=e[6]);let p=s?`opacity-100`:`pointer-events-none opacity-0`,m;e[7]===p?m=e[8]:(m=T(`inline-flex size-5 shrink-0 items-center justify-center transition-opacity`,p),e[7]=p,e[8]=m);let h=!s,g;e[9]!==s||e[10]!==t.backgroundActivity||e[11]!==n?(g=s?(0,J.jsx)(je,{label:`fetch interval`,onClick:()=>n(yt(t.backgroundActivity,{automaticGitFetchInterval:void 0}))}):null,e[9]=s,e[10]=t.backgroundActivity,e[11]=n,e[12]=g):g=e[12];let _;e[13]!==m||e[14]!==h||e[15]!==g?(_=(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[d,f,(0,J.jsx)(`span`,{className:m,"aria-hidden":h,children:g})]}),e[13]=m,e[14]=h,e[15]=g,e[16]=_):_=e[16];let v;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,J.jsx)(`p`,{className:`max-w-2xl text-xs leading-relaxed text-muted-foreground`,children:`Refresh remote branches in the background. Set to 0 to avoid automatic Git prompts.`}),e[17]=v):v=e[17];let y;e[18]===_?y=e[19]:(y=(0,J.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[_,v]}),e[18]=_,e[19]=y);let b;e[20]!==t.backgroundActivity||e[21]!==n?(b=e=>n(yt(t.backgroundActivity,{automaticGitFetchInterval:a(vt(e))})),e[20]=t.backgroundActivity,e[21]=n,e[22]=b):b=e[22];let x;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,J.jsxs)(k,{children:[(0,J.jsx)(O,{"aria-label":`Decrease fetch interval`}),(0,J.jsx)(E,{"aria-label":`Automatic Git fetch interval in seconds`}),(0,J.jsx)(D,{"aria-label":`Increase fetch interval`})]}),e[23]=x):x=e[23];let S;e[24]!==i||e[25]!==b?(S=(0,J.jsx)(A,{value:i,min:0,step:gt,size:`sm`,className:`w-32`,onValueChange:b,children:x}),e[24]=i,e[25]=b,e[26]=S):S=e[26];let C;e[27]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,J.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`seconds`}),e[27]=C):C=e[27];let w;e[28]===S?w=e[29]:(w=(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[S,C]}),e[28]=S,e[29]=w);let j;return e[30]!==y||e[31]!==w?(j=(0,J.jsx)(U,{id:u,className:`grid gap-3`,children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[y,w]})}),e[30]=y,e[31]=w,e[32]=j):j=e[32],j}function Ot(e){let t=(0,K.c)(4),{title:n,headerAction:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=ht.map(kt),t[0]=i):i=t[0];let a;return t[1]!==r||t[2]!==n?(a=(0,J.jsx)(Me,{title:n,headerAction:r,children:i}),t[1]=r,t[2]=n,t[3]=a):a=t[3],a}function kt(e){return(0,J.jsx)(`div`,{className:`first:rounded-t-xl last:rounded-b-xl px-3 py-3 sm:px-4`,children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsxs)(`span`,{className:`relative inline-flex size-5 shrink-0 items-center justify-center`,children:[(0,J.jsx)(L,{className:`size-4.5`}),(0,J.jsx)(L,{shape:`pill`,className:`pointer-events-none absolute -left-0.5 -top-0.5 size-2`,"aria-hidden":!0})]}),(0,J.jsx)(L,{shape:`pill`,className:`h-4 w-28`}),(0,J.jsx)(L,{shape:`pill`,className:`h-5 w-14`})]}),(0,J.jsx)(L,{shape:`pill`,className:`h-3 w-full max-w-xs`})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,J.jsx)(L,{className:`size-7`}),(0,J.jsx)(L,{shape:`pill`,className:`h-5 w-9`})]})]})},e)}function At(e){let t=(0,K.c)(18),{error:n,isPending:r,onScan:i}=e,a=n!==null,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=G(`source-control`),t[0]=o):o=t[0];let s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,J.jsx)(ge,{variant:`icon`,children:(0,J.jsx)(B.pullRequest,{})}),t[1]=s):s=t[1];let c=a?`Could not scan the server environment`:`Nothing detected yet`,l;t[2]===c?l=t[3]:(l=(0,J.jsx)(ve,{children:c}),t[2]=c,t[3]=l);let u=a?n:`Install Git on the server, add optional hosting integrations or credentials your workspace needs, then rescan.`,d;t[4]===u?d=t[5]:(d=(0,J.jsx)(ye,{children:u}),t[4]=u,t[5]=d);let f;t[6]!==l||t[7]!==d?(f=(0,J.jsxs)(_e,{children:[l,d]}),t[6]=l,t[7]=d,t[8]=f):f=t[8];let p;t[9]===r?p=t[10]:(p=(0,J.jsx)(Ve,{size:`sm`,refreshing:r}),t[9]=r,t[10]=p);let m;t[11]!==r||t[12]!==i||t[13]!==p?(m=(0,J.jsx)(R,{children:(0,J.jsxs)(_,{size:`sm`,variant:`outline`,onClick:i,disabled:r,children:[p,`Scan`]})}),t[11]=r,t[12]=i,t[13]=p,t[14]=m):m=t[14];let h;return t[15]!==f||t[16]!==m?(h=(0,J.jsx)(Me,{id:o.id,title:`Server environment`,children:(0,J.jsxs)(be,{children:[s,f,m]})}),t[15]=f,t[16]=m,t[17]=h):h=t[17],h}function jt(){let e=(0,K.c)(33),{scope:t,environment:n,connectedEnvironments:r}=Oe(),i=n?.connection.phase===`connected`?n.environmentId:null,a=t.environmentIds.length!==1&&r.length>1&&n?` · ${n.label}`:``,o;e[0]===i?o=e[1]:(o=i===null?null:z.discovery({environmentId:i,input:{}}),e[0]=i,e[1]=o);let s=le(o),c=s.data??pt,l=c.versionControlSystems.length>0,u=l||c.sourceControlProviders.length>0,d=s.isPending&&s.data===null,f;e[2]===s?f=e[3]:(f=()=>{s.refresh()},e[2]=s,e[3]=f);let p=f,m;e[4]!==i||e[5]!==p?(m=e=>{let t=Ce.find(e);if(t?.settings&&i!==null)return(0,J.jsx)(U,{id:Ie(e),children:(0,J.jsx)(qe,{environmentId:i,definition:{...t,settings:t.settings},onSaved:p},i)})},e[4]=i,e[5]=p,e[6]=m):m=e[6];let h=m,g;e[7]===s.isPending?g=e[8]:(g=(0,J.jsx)(Ve,{refreshing:s.isPending}),e[7]=s.isPending,e[8]=g);let v;e[9]!==s.isPending||e[10]!==p||e[11]!==g?(v=(0,J.jsx)(de,{render:(0,J.jsx)(_,{size:`icon-xs`,variant:`ghost-muted`,onClick:p,disabled:s.isPending,"aria-label":`Rescan server environment`,children:g})}),e[9]=s.isPending,e[10]=p,e[11]=g,e[12]=v):v=e[12];let y;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,J.jsx)(fe,{side:`top`,children:`Rescan Git and hosting integrations`}),e[13]=y):y=e[13];let b;e[14]===v?b=e[15]:(b=(0,J.jsxs)(pe,{children:[v,y]}),e[14]=v,e[15]=b);let x=b,S;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,J.jsx)(We,{category:`source-control`}),e[16]=S):S=e[16];let C;e[17]!==s.error||e[18]!==s.isPending||e[19]!==i||e[20]!==a||e[21]!==p||e[22]!==u||e[23]!==l||e[24]!==h||e[25]!==d||e[26]!==c.sourceControlProviders||e[27]!==c.versionControlSystems||e[28]!==x?(C=i===null?(0,J.jsx)(Me,{id:G(`source-control`).id,title:`Server environment`,children:(0,J.jsx)(`p`,{className:`px-4 py-3 text-sm text-muted-foreground`,children:`Connect an environment to inspect its version control tools and hosting integrations.`})}):d?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Ot,{title:`Version Control${a}`,headerAction:x}),(0,J.jsx)(Ot,{title:`Source Control Providers`})]}):u?(0,J.jsxs)(J.Fragment,{children:[l?(0,J.jsx)(Me,{id:G(`source-control`).id,title:`Version Control${a}`,headerAction:x,children:c.versionControlSystems.map(Mt)}):null,c.sourceControlProviders.length>0?(0,J.jsx)(Me,{id:l?void 0:G(`source-control`).id,title:l?`Source Control Providers`:`Source Control Providers${a}`,headerAction:l?null:x,children:c.sourceControlProviders.map(e=>(0,J.jsx)(Tt,{item:e,children:e.kind===`github`?(0,J.jsx)(U,{id:G(`github-accounts`).id,children:(0,J.jsxs)(`div`,{className:`grid gap-6`,children:[(0,J.jsx)($e,{environmentId:i,onSaved:p},`token-${i}`),e.status===`available`?(0,J.jsx)(Ze,{environmentId:i,auth:e.auth,onSaved:p},i):null]})}):h(e.kind)},`provider:${e.kind}`))}):null]}):(0,J.jsx)(At,{error:s.error,isPending:s.isPending,onScan:p}),e[17]=s.error,e[18]=s.isPending,e[19]=i,e[20]=a,e[21]=p,e[22]=u,e[23]=l,e[24]=h,e[25]=d,e[26]=c.sourceControlProviders,e[27]=c.versionControlSystems,e[28]=x,e[29]=C):C=e[29];let w;e[30]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,J.jsx)(ot,{}),e[30]=w):w=e[30];let T;return e[31]===C?T=e[32]:(T=(0,J.jsxs)(ke,{children:[S,C,w]}),e[31]=C,e[32]=T),T}function Mt(e){return(0,J.jsx)(Tt,{item:e,children:e.kind===`git`?(0,J.jsx)(Dt,{}):void 0},`vcs:${e.kind}`)}var Nt=jt;export{Nt as component};
2
+ //# sourceMappingURL=settings.source-control-Dxm6Jir5.js.map
@@ -1,2 +1,2 @@
1
- import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{Ms as i,Xh as a,as as o,dr as s,qy as c,ts as l}from"./utils-BlwLA0C4.js";import{R as u,W as d}from"./runtime-DYpzE3gq.js";import{a as f,i as p,n as m,r as h,t as g}from"./number-field-DqB5oGdp.js";import{a as _,c as v,o as y,s as b,t as x}from"./select-kRO2vVzo.js";import{i as S,p as C}from"./toast-C1lIuL0v.js";import{f as w}from"./server-DXSwZxzT.js";import{t as T}from"./use-atom-command-sg76DXcz.js";import{o as E}from"./timestampFormat-wac2e_Jz.js";import{t as D}from"./input-CySdZpuF.js";import{a as O}from"./p4ProjectFile-DuMklfjR.js";import{F as k,G as A,I as j,N as ee,R as M,V as N,a as P,i as F,r as I,s as L,u as R}from"./settingsLayout-D3zsCQTE.js";import{do as z,fn as B,yr as V}from"./main-1tW7jidE.js";import{t as H}from"./FoldedSettingsSection-CsaWcgI5.js";import{t as U}from"./SettingsScopeNotice-Bq20tBUp.js";var W=e(t(),1),G=n(),K=e(r(),1);function q(e){let t=(0,G.c)(25),{environmentId:n,label:r}=e,o;t[0]===n?o=t[1]:(o=w.databaseStorage({environmentId:n,input:{}}),t[0]=n,t[1]=o);let u=l(o),[d,f]=i(`database-storage-notice-dismissed:${n}`,!1,c),p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p={target:`command`},t[2]=p):p=t[2];let{copyToClipboard:m}=C(p),h=u._tag===`Success`?u.value:null;if(d||h===null||!a(h))return null;let g=`storage-database-${n}`,_=h.reclaimableBytes/1073741824,v;t[3]===_?v=t[4]:(v=_.toFixed(1),t[3]=_,t[4]=v);let y=`Reclaim ${v} GiB on ${r}`,b;t[5]===h.compactCommand?b=t[6]:(b=(0,K.jsx)(`code`,{className:`mt-2 block select-text break-all`,children:h.compactCommand}),t[5]=h.compactCommand,t[6]=b);let x;t[7]!==r||t[8]!==b?(x=(0,K.jsxs)(K.Fragment,{children:[`Old history is cleaned up automatically, but this database still holds the freed space. Run the command on `,r,` to return it to disk; it pauses and restarts the background service. Quit the desktop app first if it hosts this environment.`,b]}),t[7]=r,t[8]=b,t[9]=x):x=t[9];let S;t[10]!==m||t[11]!==h.compactCommand?(S=(0,K.jsx)(s,{variant:`outline`,size:`sm`,onClick:()=>m(h.compactCommand,void 0),children:`Copy command`}),t[10]=m,t[11]=h.compactCommand,t[12]=S):S=t[12];let T;t[13]===f?T=t[14]:(T=(0,K.jsx)(s,{variant:`ghost`,size:`sm`,onClick:()=>f(!0),children:`Dismiss`}),t[13]=f,t[14]=T);let E;t[15]!==T||t[16]!==S?(E=(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[S,T]}),t[15]=T,t[16]=S,t[17]=E):E=t[17];let D;t[18]!==E||t[19]!==y||t[20]!==x?(D=(0,K.jsx)(A,{children:(0,K.jsx)(P,{title:y,description:x,control:E})}),t[18]=E,t[19]=y,t[20]=x,t[21]=D):D=t[21];let O;return t[22]!==D||t[23]!==g?(O=(0,K.jsx)(L,{id:g,title:`Database`,children:D}),t[22]=D,t[23]=g,t[24]=O):O=t[24],O}function J(){let e=(0,G.c)(22),{connectedEnvironments:t,targets:n}=N(),r=k(),i=M(),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=[`worktreesDirectory`],e[0]=a):a=e[0];let o=j(a),s=(0,W.useRef)(!1);if(t.some(X))return null;let c;e[1]===n?c=e[2]:(c=n.map(Y).join(`,`),e[1]=n,e[2]=c);let l=c,u;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=V(`storage-worktrees-location`),e[3]=u):u=e[3];let d;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=[`worktreesDirectory`],e[4]=d):d=e[4];let f;e[5]!==o||e[6]!==r.worktreesDirectory||e[7]!==i?(f=o||r.worktreesDirectory!==``?(0,K.jsx)(I,{label:`worktree location`,onClick:()=>i({worktreesDirectory:``})}):null,e[5]=o,e[6]=r.worktreesDirectory,e[7]=i,e[8]=f):f=e[8];let p=`${l}:${o}:${r.worktreesDirectory}`,m=o?`Mixed`:`Default`,h=o?``:r.worktreesDirectory,g;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{s.current=!0},e[9]=g):g=e[9];let _;e[10]!==o||e[11]!==r.worktreesDirectory||e[12]!==i?(_=e=>{let t=e.target.value.trim();s.current&&(o||t!==r.worktreesDirectory)&&i({worktreesDirectory:t}),s.current=!1},e[10]=o,e[11]=r.worktreesDirectory,e[12]=i,e[13]=_):_=e[13];let v;e[14]!==p||e[15]!==m||e[16]!==h||e[17]!==_?(v=(0,K.jsx)(D,{"aria-label":`Worktree location`,autoCapitalize:`none`,spellCheck:!1,placeholder:m,defaultValue:h,onChange:g,onBlur:_},p),e[14]=p,e[15]=m,e[16]=h,e[17]=_,e[18]=v):v=e[18];let y;return e[19]!==v||e[20]!==f?(y=(0,K.jsx)(P,{...u,description:`Folder where new worktrees are created, on any drive, such as D:\\worktrees or ~/worktrees. Existing worktrees stay where they are. Leave empty to use the P4 Code home folder.`,serverScoped:!0,settingKeys:d,resetAction:f,control:v}),e[19]=v,e[20]=f,e[21]=y):y=e[21],y}function Y(e){return e.environmentId}function X(e){return e.serverConfig?.environment.capabilities.worktreesDirectory!==!0}function Z(e){let t=(0,G.c)(15),{label:n,value:r,onChange:i,minimum:a}=e,o=a===void 0?1:a,[s,c]=(0,W.useState)(r),[l,u]=(0,W.useState)(r);l!==r&&(u(r),c(r));let d;t[0]!==s||t[1]!==n||t[2]!==o||t[3]!==i||t[4]!==r?(d=r===null?(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Off`}):(0,K.jsx)(g,{value:s,min:o,max:3650,step:1,size:`sm`,className:`w-auto`,onValueChange:c,onValueCommitted:e=>{if(e===null)c(r);else{let t=Math.min(3650,Math.max(o,Math.round(e)));c(t),i(t)}},children:(0,K.jsxs)(h,{children:[(0,K.jsx)(m,{"aria-label":`Decrease ${n}`}),(0,K.jsx)(f,{"aria-label":`${n} in days`,size:new Intl.NumberFormat().format(s??r).length,className:`field-sizing-content w-auto min-w-[1ch] grow-0 text-right`}),(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`self-center pr-2 text-xs`,children:`days`}),(0,K.jsx)(p,{"aria-label":`Increase ${n}`})]})}),t[0]=s,t[1]=n,t[2]=o,t[3]=i,t[4]=r,t[5]=d):d=t[5];let _=r!==null,v;t[6]===i?v=t[7]:(v=e=>i(e?8:null),t[6]=i,t[7]=v);let y;t[8]!==n||t[9]!==_||t[10]!==v?(y=(0,K.jsx)(z,{"aria-label":n,checked:_,onCheckedChange:v}),t[8]=n,t[9]=_,t[10]=v,t[11]=y):y=t[11];let b;return t[12]!==d||t[13]!==y?(b=(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[d,y]}),t[12]=d,t[13]=y,t[14]=b):b=t[14],b}var Q={"any-local-files":`Any local files`,"uncommitted-changes":`Uncommitted changes`,"tracked-changes":`Edited tracked files`};function te(e){let t=(0,G.c)(16),{report:n,environmentLabel:r}=e,i;if(t[0]!==r||t[1]!==n.entries){let e;t[3]===r?e=t[4]:(e=(e,t)=>{let n=e.kind===`worktree`?e.path?.split(/[\\/]/).findLast(Boolean)??`Worktrees`:e.kind===`logs`?`Rotated logs`:`Browser artifacts`;return(0,K.jsx)(P,{title:r?`${r}: ${n}`:n,description:(0,K.jsxs)(`span`,{className:`wrap-anywhere ${e.outcome===`failed`?`text-destructive`:``}`,children:[e.threadTitle&&e.threadTitle!==n?`${e.threadTitle}. `:``,e.reason]}),control:e.outcome===`removed`&&(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:[e.kind!==`worktree`&&e.files!==null?`${e.files.toLocaleString()} ${e.files===1?`file`:`files`}`:null,e.bytes===null?null:B(e.bytes)].filter(Boolean).join(` · `)})},`${e.path??e.kind}:${e.threadId??t}`)},t[3]=r,t[4]=e),i=n.entries.map(e),t[0]=r,t[1]=n.entries,t[2]=i}else i=t[2];let a;t[5]!==r||t[6]!==n.omittedCount?(a=n.omittedCount>0&&(0,K.jsxs)(`p`,{className:`px-3 py-2.5 text-xs text-muted-foreground sm:px-4`,children:[r?`${r}: `:``,n.omittedCount.toLocaleString(),` more results.`]}),t[5]=r,t[6]=n.omittedCount,t[7]=a):a=t[7];let o;t[8]!==r||t[9]!==n.entries.length||t[10]!==n.omittedCount?(o=n.entries.length===0&&n.omittedCount===0&&(0,K.jsxs)(`p`,{className:`px-3 py-2.5 text-xs text-muted-foreground sm:px-4`,children:[r?`${r}: `:``,`Nothing needed cleanup.`]}),t[8]=r,t[9]=n.entries.length,t[10]=n.omittedCount,t[11]=o):o=t[11];let s;return t[12]!==i||t[13]!==a||t[14]!==o?(s=(0,K.jsxs)(K.Fragment,{children:[i,a,o]}),t[12]=i,t[13]=a,t[14]=o,t[15]=s):s=t[15],s}function ne(){R(6e4);let{connectedEnvironments:e}=N(),[t,n]=(0,W.useState)(!1),r=T(w.runStorageCleanup),i=e.filter(e=>e.serverConfig?.environment.capabilities.storageCleanupRun===!0),a=l((0,W.useMemo)(()=>o(t=>e.flatMap(e=>{if(e.serverConfig?.environment.capabilities.storageCleanupRun!==!0)return[];let n=t(w.storageCleanupReport({environmentId:e.environmentId,input:{}}));return[{environmentId:e.environmentId,allowed:t(w.runStorageCleanup.permissionAtom(e.environmentId)),report:n._tag===`Success`?n.value:null,loading:n.waiting,failed:n._tag===`Failure`}]})),[e])),c=i.some(e=>{let t=e.serverConfig?.settings;if(!t)return!1;let n=e=>e.worktreeAfterDays!==null||e.worktreeSettledAfterDays!==null||e.worktreeOnMerge||e.worktreeOnDelete||e.worktreeUnchanged;return t.storageCleanup.browserArtifactsAfterDays!==null||t.storageCleanup.logsAfterDays!==null||n(O(t,null))||Object.values(t.projectSettingsOverrides).some(e=>e.worktreeCleanup?.mode===`custom`&&n(e.worktreeCleanup.rules))});if(i.length===0)return null;let f=i.map(e=>{let t=a.find(t=>t.environmentId===e.environmentId),n=t?.report??null;return{environment:e,report:n,description:n?`Last run ${E(n.finishedAt)}. ${B(n.bytesFreed)} recovered.${n.counts.failed>0?` ${n.counts.failed} ${n.counts.failed===1?`item`:`items`} couldn't be removed.`:``}`:t?.failed?`Could not load the last run.`:t?.loading?`Loading last run…`:`Cleanup hasn't run yet.`}}),p=async()=>{if(!t){n(!0);try{await Promise.all(i.filter(e=>a.some(t=>t.environmentId===e.environmentId&&t.allowed)).map(async e=>{let t=await r({environmentId:e.environmentId,input:{}});if(t._tag===`Success`){let n=t.value.entries.filter(e=>e.outcome===`failed`);n.length>0&&S.add({type:`error`,title:`Cleanup failed on ${e.label}`,description:n[0].reason})}else u(t)||S.add({type:`error`,title:`Could not run cleanup on ${e.label}`,description:String(d(t))})}))}finally{n(!1)}}};return(0,K.jsxs)(L,{id:`storage-cleanup`,title:`Cleanup`,variant:`plain`,children:[(0,K.jsx)(A,{children:(0,K.jsx)(P,{...V(`storage-delete-now`),description:(0,K.jsx)(`span`,{children:c?f.map(({environment:e,description:t})=>(0,K.jsxs)(`span`,{className:`block`,children:[i.length>1?`${e.label}: `:``,t]},e.environmentId)):`Turn on a cleanup rule to use this.`}),control:(0,K.jsx)(s,{variant:`outline`,size:`sm`,disabled:t||!c||!a.some(e=>e.allowed),onClick:()=>void p(),children:t?`Deleting…`:`Delete now`})})}),f.some(({report:e})=>e!==null)&&(0,K.jsx)(H,{id:`storage-cleanup-last-run`,title:`Last run`,headerPlacement:`inside`,summary:f.flatMap(({environment:t,report:n})=>n?[`${e.length>1?`${t.label}: `:``}${n.counts.removed} removed, ${n.counts.kept} kept${n.counts.failed>0?`, ${n.counts.failed} failed`:``}`]:[]).join(` · `),children:f.map(({environment:t,report:n})=>n&&(0,K.jsx)(te,{report:n,environmentLabel:e.length>1?t.label:void 0},t.environmentId))})]})}function re(){let e=(0,G.c)(62),{scope:t,environments:n,connectedEnvironments:r,targets:i,target:a}=N(),o=k(),s=t.kind===`project`||t.kind===`checkout`,c=o.storageCleanup,l;e[0]===o?l=e[1]:(l=O(o,null),e[0]=o,e[1]=l);let u;e[2]!==o.storageCleanup||e[3]!==l?(u={...c,...l},e[2]=o.storageCleanup,e[3]=l,e[4]=u):u=e[4];let d=u,f=de,p;e[5]===a?p=e[6]:(p=f(a),e[5]=a,e[6]=p);let m=p,h;if(e[7]!==m||e[8]!==i){let t;e[10]===m?t=e[11]:(t=e=>f(e)!==m,e[10]=m,e[11]=t),h=i.some(t),e[7]=m,e[8]=i,e[9]=h}else h=e[9];let g=h,S=M(),C=ee(),w;e[12]!==d||e[13]!==i?(w=e=>i.some(t=>({...t.settings.storageCleanup,...O(t.settings,null)})[e]!==d[e])?`Mixed across selected machines`:void 0,e[12]=d,e[13]=i,e[14]=w):w=e[14];let T=w,E;e[15]===S?E=e[16]:(E=e=>S({storageCleanup:e}),e[15]=S,e[16]=E);let D=E,A;e[17]!==s||e[18]!==D||e[19]!==S?(A=e=>s?S({worktreeCleanup:{mode:`custom`,rules:e}}):D(e),e[17]=s,e[18]=D,e[19]=S,e[20]=A):A=e[20];let j=A;if(s&&r.some(ue)){let t;return e[21]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsx)(U,{target:`all`,children:`Update the selected machines to configure project worktree cleanup.`}),e[21]=t):t=e[21],t}if(r.some(le)){let t;e[22]===r?t=e[23]:(t=r.filter(ce).map(se),e[22]=r,e[23]=t);let n;return e[24]===t?n=e[25]:(n=(0,K.jsx)(U,{target:`environment`,eligibleEnvironmentIds:t,children:`Update the selected environments to use storage cleanup, or choose a machine that supports it.`}),e[24]=t,e[25]=n),n}let I;e[26]!==r||e[27]!==s?(I=!s&&r.filter($).map(oe),e[26]=r,e[27]=s,e[28]=I):I=e[28];let R;e[29]===s?R=e[30]:(R=!s&&(0,K.jsx)(J,{}),e[29]=s,e[30]=R);let B;e[31]!==C||e[32]!==s||e[33]!==g||e[34]!==m||e[35]!==S?(B=s&&(0,K.jsx)(P,{title:`Automatic worktree cleanup`,description:m===`off`?`Keep this project's worktrees until you delete them manually.`:m===`custom`?`Use these rules for this project.`:`Use each machine's worktree cleanup settings.`,serverScoped:!0,settingKeys:[`worktreeCleanup`],mixed:g,control:(0,K.jsxs)(x,{value:g?null:m,onValueChange:e=>{e===`inherit`?C([`worktreeCleanup`]):e===`off`?S({worktreeCleanup:{mode:`off`}}):e===`custom`&&S({worktreeCleanup:{mode:`custom`,rules:{}}})},children:[(0,K.jsx)(b,{size:`sm`,"aria-label":`Automatic worktree cleanup`,children:(0,K.jsx)(v,{children:g?`Mixed`:m===`inherit`?`Inherit`:m===`off`?`Off`:`Custom`})}),(0,K.jsxs)(y,{align:`end`,alignItemWithTrigger:!1,children:[(0,K.jsx)(_,{value:`inherit`,children:`Inherit`}),(0,K.jsx)(_,{value:`off`,children:`Off`}),(0,K.jsx)(_,{value:`custom`,children:`Custom`})]})]})}),e[31]=C,e[32]=s,e[33]=g,e[34]=m,e[35]=S,e[36]=B):B=e[36];let H;e[37]!==r||e[38]!==n||e[39]!==s||e[40]!==g||e[41]!==m||e[42]!==T||e[43]!==d||e[44]!==j?(H=(!s||!g&&m===`custom`)&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(P,{title:`Delete worktrees with deleted threads`,status:T(`worktreeOnDelete`),description:`Remove unused worktrees when active or archived threads are deleted. Worktrees with local changes are kept.`,serverScoped:!s,control:(0,K.jsx)(z,{"aria-label":`Delete worktrees with deleted threads`,checked:d.worktreeOnDelete,onCheckedChange:e=>j({worktreeOnDelete:e})})}),(0,K.jsx)(P,{title:`Delete inactive worktrees`,status:T(`worktreeAfterDays`),description:`Remove worktrees after their threads have been inactive for this many days. Branches and thread history are kept.`,serverScoped:!s,control:(0,K.jsx)(Z,{label:`Delete inactive worktrees`,value:d.worktreeAfterDays,onChange:e=>j({worktreeAfterDays:e})})}),r.length>0&&r.every(ae)&&(0,K.jsx)(P,{title:`Delete settled worktrees`,status:[T(`worktreeSettledAfterDays`),n.length>r.length?`Offline machines will not get this setting`:void 0].filter(Boolean).join(`. `),description:`Remove worktrees this many days after their thread settles. Set 0 days to remove them at the next cleanup. Branches and thread history are kept.`,serverScoped:!s,control:(0,K.jsx)(Z,{label:`Delete settled worktrees`,value:d.worktreeSettledAfterDays,minimum:0,onChange:e=>j({worktreeSettledAfterDays:e})})}),(0,K.jsx)(P,{title:`Delete merged worktrees`,status:T(`worktreeOnMerge`),description:`Remove worktrees whose pull request is merged and whose commits are included in the default branch.`,serverScoped:!s,control:(0,K.jsx)(z,{"aria-label":`Delete merged worktrees`,checked:d.worktreeOnMerge,onCheckedChange:e=>j({worktreeOnMerge:e})})}),(0,K.jsx)(P,{title:`Delete unchanged worktrees`,status:T(`worktreeUnchanged`),description:`Remove worktrees with no commits beyond the default branch.`,serverScoped:!s,control:(0,K.jsx)(z,{"aria-label":`Delete unchanged worktrees`,checked:d.worktreeUnchanged,onCheckedChange:e=>j({worktreeUnchanged:e})})}),r.every(ie)&&(0,K.jsx)(P,{...V(`storage-worktree-keep-when`),status:T(`worktreeKeepWhen`),description:d.worktreeKeepWhen===`any-local-files`?`Includes ignored files, except node_modules.`:d.worktreeKeepWhen===`tracked-changes`?`Deletes untracked and ignored files, including .env.`:`Keeps edits and untracked files. Deletes ignored files, including .env.`,serverScoped:!s,control:(0,K.jsxs)(x,{value:T(`worktreeKeepWhen`)?null:d.worktreeKeepWhen,onValueChange:e=>{(e===`any-local-files`||e===`uncommitted-changes`||e===`tracked-changes`)&&j({worktreeKeepWhen:e})},children:[(0,K.jsx)(b,{size:`sm`,"aria-label":`Keep worktrees with local changes`,children:(0,K.jsx)(v,{children:T(`worktreeKeepWhen`)?`Mixed`:Q[d.worktreeKeepWhen]})}),(0,K.jsxs)(y,{align:`end`,alignItemWithTrigger:!1,children:[(0,K.jsx)(_,{value:`any-local-files`,children:`Any local files`}),(0,K.jsx)(_,{value:`uncommitted-changes`,children:`Uncommitted changes`}),(0,K.jsx)(_,{value:`tracked-changes`,children:`Edited tracked files`})]})]})})]}),e[37]=r,e[38]=n,e[39]=s,e[40]=g,e[41]=m,e[42]=T,e[43]=d,e[44]=j,e[45]=H):H=e[45];let W;e[46]!==B||e[47]!==H||e[48]!==R?(W=(0,K.jsxs)(L,{id:`storage-worktrees`,title:`Worktrees`,children:[R,B,H]}),e[46]=B,e[47]=H,e[48]=R,e[49]=W):W=e[49];let q;e[50]!==s||e[51]!==T||e[52]!==d||e[53]!==D?(q=!s&&(0,K.jsxs)(L,{id:`storage-artifacts`,title:`Artifacts and logs`,children:[(0,K.jsx)(P,{title:`Delete old browser artifacts`,status:T(`browserArtifactsAfterDays`),description:`Delete saved browser captures after this many days. Older capture links will no longer open.`,serverScoped:!0,control:(0,K.jsx)(Z,{label:`Delete old browser artifacts`,value:d.browserArtifactsAfterDays,onChange:e=>D({browserArtifactsAfterDays:e})})}),(0,K.jsx)(P,{title:`Delete old rotated logs`,status:T(`logsAfterDays`),description:`Delete inactive rotated log files after this many days. Current logs are kept.`,serverScoped:!0,control:(0,K.jsx)(Z,{label:`Delete old rotated logs`,value:d.logsAfterDays,onChange:e=>D({logsAfterDays:e})})})]}),e[50]=s,e[51]=T,e[52]=d,e[53]=D,e[54]=q):q=e[54];let Y;e[55]===s?Y=e[56]:(Y=!s&&(0,K.jsx)(ne,{}),e[55]=s,e[56]=Y);let X;return e[57]!==W||e[58]!==q||e[59]!==Y||e[60]!==I?(X=(0,K.jsxs)(F,{children:[I,W,q,Y]}),e[57]=W,e[58]=q,e[59]=Y,e[60]=I,e[61]=X):X=e[61],X}function ie(e){return e.serverConfig?.environment.capabilities.storageCleanupRun===!0}function ae(e){return e.serverConfig?.environment.capabilities.settledWorktreeCleanup===!0}function oe(e){return(0,K.jsx)(q,{environmentId:e.environmentId,label:e.label},e.environmentId)}function $(e){return e.serverConfig?.environment.capabilities.databaseStorage===!0}function se(e){return e.environmentId}function ce(e){return e.serverConfig?.environment.capabilities.storageCleanup===!0}function le(e){return e.serverConfig?.environment.capabilities.storageCleanup!==!0}function ue(e){return e.serverConfig?.environment.capabilities.projectWorktreeCleanup!==!0}function de(e){return e?.sources.worktreeCleanup===`project`?e.settings.worktreeCleanup?.mode??`inherit`:`inherit`}var fe=re;export{fe as component};
2
- //# sourceMappingURL=settings.storage-BWTGbbAs.js.map
1
+ import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{Ms as i,Xh as a,as as o,dr as s,qy as c,ts as l}from"./utils-CxCThU1r.js";import{R as u,W as d}from"./runtime-Du_4upLP.js";import{a as f,i as p,n as m,r as h,t as g}from"./number-field-D1mdZQVp.js";import{a as _,c as v,o as y,s as b,t as x}from"./select-CT4O76xq.js";import{i as S,p as C}from"./toast-NSvYVPhH.js";import{f as w}from"./server-BRIc5okw.js";import{t as T}from"./use-atom-command-BfhNaUIU.js";import{o as E}from"./timestampFormat-wac2e_Jz.js";import{t as D}from"./input-DTnuNfU_.js";import{a as O}from"./p4ProjectFile-BQUacEue.js";import{F as k,G as A,I as j,N as ee,R as M,V as N,a as P,i as F,r as I,s as L,u as R}from"./settingsLayout-7rl00kQL.js";import{do as z,fn as B,yr as V}from"./main-BqFaDMNs.js";import{t as H}from"./FoldedSettingsSection-VcaJg5wH.js";import{t as U}from"./SettingsScopeNotice-LfKqlEQx.js";var W=e(t(),1),G=n(),K=e(r(),1);function q(e){let t=(0,G.c)(25),{environmentId:n,label:r}=e,o;t[0]===n?o=t[1]:(o=w.databaseStorage({environmentId:n,input:{}}),t[0]=n,t[1]=o);let u=l(o),[d,f]=i(`database-storage-notice-dismissed:${n}`,!1,c),p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p={target:`command`},t[2]=p):p=t[2];let{copyToClipboard:m}=C(p),h=u._tag===`Success`?u.value:null;if(d||h===null||!a(h))return null;let g=`storage-database-${n}`,_=h.reclaimableBytes/1073741824,v;t[3]===_?v=t[4]:(v=_.toFixed(1),t[3]=_,t[4]=v);let y=`Reclaim ${v} GiB on ${r}`,b;t[5]===h.compactCommand?b=t[6]:(b=(0,K.jsx)(`code`,{className:`mt-2 block select-text break-all`,children:h.compactCommand}),t[5]=h.compactCommand,t[6]=b);let x;t[7]!==r||t[8]!==b?(x=(0,K.jsxs)(K.Fragment,{children:[`Old history is cleaned up automatically, but this database still holds the freed space. Run the command on `,r,` to return it to disk; it pauses and restarts the background service. Quit the desktop app first if it hosts this environment.`,b]}),t[7]=r,t[8]=b,t[9]=x):x=t[9];let S;t[10]!==m||t[11]!==h.compactCommand?(S=(0,K.jsx)(s,{variant:`outline`,size:`sm`,onClick:()=>m(h.compactCommand,void 0),children:`Copy command`}),t[10]=m,t[11]=h.compactCommand,t[12]=S):S=t[12];let T;t[13]===f?T=t[14]:(T=(0,K.jsx)(s,{variant:`ghost`,size:`sm`,onClick:()=>f(!0),children:`Dismiss`}),t[13]=f,t[14]=T);let E;t[15]!==T||t[16]!==S?(E=(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[S,T]}),t[15]=T,t[16]=S,t[17]=E):E=t[17];let D;t[18]!==E||t[19]!==y||t[20]!==x?(D=(0,K.jsx)(A,{children:(0,K.jsx)(P,{title:y,description:x,control:E})}),t[18]=E,t[19]=y,t[20]=x,t[21]=D):D=t[21];let O;return t[22]!==D||t[23]!==g?(O=(0,K.jsx)(L,{id:g,title:`Database`,children:D}),t[22]=D,t[23]=g,t[24]=O):O=t[24],O}function J(){let e=(0,G.c)(22),{connectedEnvironments:t,targets:n}=N(),r=k(),i=M(),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=[`worktreesDirectory`],e[0]=a):a=e[0];let o=j(a),s=(0,W.useRef)(!1);if(t.some(X))return null;let c;e[1]===n?c=e[2]:(c=n.map(Y).join(`,`),e[1]=n,e[2]=c);let l=c,u;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=V(`storage-worktrees-location`),e[3]=u):u=e[3];let d;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=[`worktreesDirectory`],e[4]=d):d=e[4];let f;e[5]!==o||e[6]!==r.worktreesDirectory||e[7]!==i?(f=o||r.worktreesDirectory!==``?(0,K.jsx)(I,{label:`worktree location`,onClick:()=>i({worktreesDirectory:``})}):null,e[5]=o,e[6]=r.worktreesDirectory,e[7]=i,e[8]=f):f=e[8];let p=`${l}:${o}:${r.worktreesDirectory}`,m=o?`Mixed`:`Default`,h=o?``:r.worktreesDirectory,g;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{s.current=!0},e[9]=g):g=e[9];let _;e[10]!==o||e[11]!==r.worktreesDirectory||e[12]!==i?(_=e=>{let t=e.target.value.trim();s.current&&(o||t!==r.worktreesDirectory)&&i({worktreesDirectory:t}),s.current=!1},e[10]=o,e[11]=r.worktreesDirectory,e[12]=i,e[13]=_):_=e[13];let v;e[14]!==p||e[15]!==m||e[16]!==h||e[17]!==_?(v=(0,K.jsx)(D,{"aria-label":`Worktree location`,autoCapitalize:`none`,spellCheck:!1,placeholder:m,defaultValue:h,onChange:g,onBlur:_},p),e[14]=p,e[15]=m,e[16]=h,e[17]=_,e[18]=v):v=e[18];let y;return e[19]!==v||e[20]!==f?(y=(0,K.jsx)(P,{...u,description:`Folder where new worktrees are created, on any drive, such as D:\\worktrees or ~/worktrees. Existing worktrees stay where they are. Leave empty to use the P4 Code home folder.`,serverScoped:!0,settingKeys:d,resetAction:f,control:v}),e[19]=v,e[20]=f,e[21]=y):y=e[21],y}function Y(e){return e.environmentId}function X(e){return e.serverConfig?.environment.capabilities.worktreesDirectory!==!0}function Z(e){let t=(0,G.c)(15),{label:n,value:r,onChange:i,minimum:a}=e,o=a===void 0?1:a,[s,c]=(0,W.useState)(r),[l,u]=(0,W.useState)(r);l!==r&&(u(r),c(r));let d;t[0]!==s||t[1]!==n||t[2]!==o||t[3]!==i||t[4]!==r?(d=r===null?(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Off`}):(0,K.jsx)(g,{value:s,min:o,max:3650,step:1,size:`sm`,className:`w-auto`,onValueChange:c,onValueCommitted:e=>{if(e===null)c(r);else{let t=Math.min(3650,Math.max(o,Math.round(e)));c(t),i(t)}},children:(0,K.jsxs)(h,{children:[(0,K.jsx)(m,{"aria-label":`Decrease ${n}`}),(0,K.jsx)(f,{"aria-label":`${n} in days`,size:new Intl.NumberFormat().format(s??r).length,className:`field-sizing-content w-auto min-w-[1ch] grow-0 text-right`}),(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`self-center pr-2 text-xs`,children:`days`}),(0,K.jsx)(p,{"aria-label":`Increase ${n}`})]})}),t[0]=s,t[1]=n,t[2]=o,t[3]=i,t[4]=r,t[5]=d):d=t[5];let _=r!==null,v;t[6]===i?v=t[7]:(v=e=>i(e?8:null),t[6]=i,t[7]=v);let y;t[8]!==n||t[9]!==_||t[10]!==v?(y=(0,K.jsx)(z,{"aria-label":n,checked:_,onCheckedChange:v}),t[8]=n,t[9]=_,t[10]=v,t[11]=y):y=t[11];let b;return t[12]!==d||t[13]!==y?(b=(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[d,y]}),t[12]=d,t[13]=y,t[14]=b):b=t[14],b}var Q={"any-local-files":`Any local files`,"uncommitted-changes":`Uncommitted changes`,"tracked-changes":`Edited tracked files`};function te(e){let t=(0,G.c)(16),{report:n,environmentLabel:r}=e,i;if(t[0]!==r||t[1]!==n.entries){let e;t[3]===r?e=t[4]:(e=(e,t)=>{let n=e.kind===`worktree`?e.path?.split(/[\\/]/).findLast(Boolean)??`Worktrees`:e.kind===`logs`?`Rotated logs`:`Browser artifacts`;return(0,K.jsx)(P,{title:r?`${r}: ${n}`:n,description:(0,K.jsxs)(`span`,{className:`wrap-anywhere ${e.outcome===`failed`?`text-destructive`:``}`,children:[e.threadTitle&&e.threadTitle!==n?`${e.threadTitle}. `:``,e.reason]}),control:e.outcome===`removed`&&(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:[e.kind!==`worktree`&&e.files!==null?`${e.files.toLocaleString()} ${e.files===1?`file`:`files`}`:null,e.bytes===null?null:B(e.bytes)].filter(Boolean).join(` · `)})},`${e.path??e.kind}:${e.threadId??t}`)},t[3]=r,t[4]=e),i=n.entries.map(e),t[0]=r,t[1]=n.entries,t[2]=i}else i=t[2];let a;t[5]!==r||t[6]!==n.omittedCount?(a=n.omittedCount>0&&(0,K.jsxs)(`p`,{className:`px-3 py-2.5 text-xs text-muted-foreground sm:px-4`,children:[r?`${r}: `:``,n.omittedCount.toLocaleString(),` more results.`]}),t[5]=r,t[6]=n.omittedCount,t[7]=a):a=t[7];let o;t[8]!==r||t[9]!==n.entries.length||t[10]!==n.omittedCount?(o=n.entries.length===0&&n.omittedCount===0&&(0,K.jsxs)(`p`,{className:`px-3 py-2.5 text-xs text-muted-foreground sm:px-4`,children:[r?`${r}: `:``,`Nothing needed cleanup.`]}),t[8]=r,t[9]=n.entries.length,t[10]=n.omittedCount,t[11]=o):o=t[11];let s;return t[12]!==i||t[13]!==a||t[14]!==o?(s=(0,K.jsxs)(K.Fragment,{children:[i,a,o]}),t[12]=i,t[13]=a,t[14]=o,t[15]=s):s=t[15],s}function ne(){R(6e4);let{connectedEnvironments:e}=N(),[t,n]=(0,W.useState)(!1),r=T(w.runStorageCleanup),i=e.filter(e=>e.serverConfig?.environment.capabilities.storageCleanupRun===!0),a=l((0,W.useMemo)(()=>o(t=>e.flatMap(e=>{if(e.serverConfig?.environment.capabilities.storageCleanupRun!==!0)return[];let n=t(w.storageCleanupReport({environmentId:e.environmentId,input:{}}));return[{environmentId:e.environmentId,allowed:t(w.runStorageCleanup.permissionAtom(e.environmentId)),report:n._tag===`Success`?n.value:null,loading:n.waiting,failed:n._tag===`Failure`}]})),[e])),c=i.some(e=>{let t=e.serverConfig?.settings;if(!t)return!1;let n=e=>e.worktreeAfterDays!==null||e.worktreeSettledAfterDays!==null||e.worktreeOnMerge||e.worktreeOnDelete||e.worktreeUnchanged;return t.storageCleanup.browserArtifactsAfterDays!==null||t.storageCleanup.logsAfterDays!==null||n(O(t,null))||Object.values(t.projectSettingsOverrides).some(e=>e.worktreeCleanup?.mode===`custom`&&n(e.worktreeCleanup.rules))});if(i.length===0)return null;let f=i.map(e=>{let t=a.find(t=>t.environmentId===e.environmentId),n=t?.report??null;return{environment:e,report:n,description:n?`Last run ${E(n.finishedAt)}. ${B(n.bytesFreed)} recovered.${n.counts.failed>0?` ${n.counts.failed} ${n.counts.failed===1?`item`:`items`} couldn't be removed.`:``}`:t?.failed?`Could not load the last run.`:t?.loading?`Loading last run…`:`Cleanup hasn't run yet.`}}),p=async()=>{if(!t){n(!0);try{await Promise.all(i.filter(e=>a.some(t=>t.environmentId===e.environmentId&&t.allowed)).map(async e=>{let t=await r({environmentId:e.environmentId,input:{}});if(t._tag===`Success`){let n=t.value.entries.filter(e=>e.outcome===`failed`);n.length>0&&S.add({type:`error`,title:`Cleanup failed on ${e.label}`,description:n[0].reason})}else u(t)||S.add({type:`error`,title:`Could not run cleanup on ${e.label}`,description:String(d(t))})}))}finally{n(!1)}}};return(0,K.jsxs)(L,{id:`storage-cleanup`,title:`Cleanup`,variant:`plain`,children:[(0,K.jsx)(A,{children:(0,K.jsx)(P,{...V(`storage-delete-now`),description:(0,K.jsx)(`span`,{children:c?f.map(({environment:e,description:t})=>(0,K.jsxs)(`span`,{className:`block`,children:[i.length>1?`${e.label}: `:``,t]},e.environmentId)):`Turn on a cleanup rule to use this.`}),control:(0,K.jsx)(s,{variant:`outline`,size:`sm`,disabled:t||!c||!a.some(e=>e.allowed),onClick:()=>void p(),children:t?`Deleting…`:`Delete now`})})}),f.some(({report:e})=>e!==null)&&(0,K.jsx)(H,{id:`storage-cleanup-last-run`,title:`Last run`,headerPlacement:`inside`,summary:f.flatMap(({environment:t,report:n})=>n?[`${e.length>1?`${t.label}: `:``}${n.counts.removed} removed, ${n.counts.kept} kept${n.counts.failed>0?`, ${n.counts.failed} failed`:``}`]:[]).join(` · `),children:f.map(({environment:t,report:n})=>n&&(0,K.jsx)(te,{report:n,environmentLabel:e.length>1?t.label:void 0},t.environmentId))})]})}function re(){let e=(0,G.c)(62),{scope:t,environments:n,connectedEnvironments:r,targets:i,target:a}=N(),o=k(),s=t.kind===`project`||t.kind===`checkout`,c=o.storageCleanup,l;e[0]===o?l=e[1]:(l=O(o,null),e[0]=o,e[1]=l);let u;e[2]!==o.storageCleanup||e[3]!==l?(u={...c,...l},e[2]=o.storageCleanup,e[3]=l,e[4]=u):u=e[4];let d=u,f=de,p;e[5]===a?p=e[6]:(p=f(a),e[5]=a,e[6]=p);let m=p,h;if(e[7]!==m||e[8]!==i){let t;e[10]===m?t=e[11]:(t=e=>f(e)!==m,e[10]=m,e[11]=t),h=i.some(t),e[7]=m,e[8]=i,e[9]=h}else h=e[9];let g=h,S=M(),C=ee(),w;e[12]!==d||e[13]!==i?(w=e=>i.some(t=>({...t.settings.storageCleanup,...O(t.settings,null)})[e]!==d[e])?`Mixed across selected machines`:void 0,e[12]=d,e[13]=i,e[14]=w):w=e[14];let T=w,E;e[15]===S?E=e[16]:(E=e=>S({storageCleanup:e}),e[15]=S,e[16]=E);let D=E,A;e[17]!==s||e[18]!==D||e[19]!==S?(A=e=>s?S({worktreeCleanup:{mode:`custom`,rules:e}}):D(e),e[17]=s,e[18]=D,e[19]=S,e[20]=A):A=e[20];let j=A;if(s&&r.some(ue)){let t;return e[21]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsx)(U,{target:`all`,children:`Update the selected machines to configure project worktree cleanup.`}),e[21]=t):t=e[21],t}if(r.some(le)){let t;e[22]===r?t=e[23]:(t=r.filter(ce).map(se),e[22]=r,e[23]=t);let n;return e[24]===t?n=e[25]:(n=(0,K.jsx)(U,{target:`environment`,eligibleEnvironmentIds:t,children:`Update the selected environments to use storage cleanup, or choose a machine that supports it.`}),e[24]=t,e[25]=n),n}let I;e[26]!==r||e[27]!==s?(I=!s&&r.filter($).map(oe),e[26]=r,e[27]=s,e[28]=I):I=e[28];let R;e[29]===s?R=e[30]:(R=!s&&(0,K.jsx)(J,{}),e[29]=s,e[30]=R);let B;e[31]!==C||e[32]!==s||e[33]!==g||e[34]!==m||e[35]!==S?(B=s&&(0,K.jsx)(P,{title:`Automatic worktree cleanup`,description:m===`off`?`Keep this project's worktrees until you delete them manually.`:m===`custom`?`Use these rules for this project.`:`Use each machine's worktree cleanup settings.`,serverScoped:!0,settingKeys:[`worktreeCleanup`],mixed:g,control:(0,K.jsxs)(x,{value:g?null:m,onValueChange:e=>{e===`inherit`?C([`worktreeCleanup`]):e===`off`?S({worktreeCleanup:{mode:`off`}}):e===`custom`&&S({worktreeCleanup:{mode:`custom`,rules:{}}})},children:[(0,K.jsx)(b,{size:`sm`,"aria-label":`Automatic worktree cleanup`,children:(0,K.jsx)(v,{children:g?`Mixed`:m===`inherit`?`Inherit`:m===`off`?`Off`:`Custom`})}),(0,K.jsxs)(y,{align:`end`,alignItemWithTrigger:!1,children:[(0,K.jsx)(_,{value:`inherit`,children:`Inherit`}),(0,K.jsx)(_,{value:`off`,children:`Off`}),(0,K.jsx)(_,{value:`custom`,children:`Custom`})]})]})}),e[31]=C,e[32]=s,e[33]=g,e[34]=m,e[35]=S,e[36]=B):B=e[36];let H;e[37]!==r||e[38]!==n||e[39]!==s||e[40]!==g||e[41]!==m||e[42]!==T||e[43]!==d||e[44]!==j?(H=(!s||!g&&m===`custom`)&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(P,{title:`Delete worktrees with deleted threads`,status:T(`worktreeOnDelete`),description:`Remove unused worktrees when active or archived threads are deleted. Worktrees with local changes are kept.`,serverScoped:!s,control:(0,K.jsx)(z,{"aria-label":`Delete worktrees with deleted threads`,checked:d.worktreeOnDelete,onCheckedChange:e=>j({worktreeOnDelete:e})})}),(0,K.jsx)(P,{title:`Delete inactive worktrees`,status:T(`worktreeAfterDays`),description:`Remove worktrees after their threads have been inactive for this many days. Branches and thread history are kept.`,serverScoped:!s,control:(0,K.jsx)(Z,{label:`Delete inactive worktrees`,value:d.worktreeAfterDays,onChange:e=>j({worktreeAfterDays:e})})}),r.length>0&&r.every(ae)&&(0,K.jsx)(P,{title:`Delete settled worktrees`,status:[T(`worktreeSettledAfterDays`),n.length>r.length?`Offline machines will not get this setting`:void 0].filter(Boolean).join(`. `),description:`Remove worktrees this many days after their thread settles. Set 0 days to remove them at the next cleanup. Branches and thread history are kept.`,serverScoped:!s,control:(0,K.jsx)(Z,{label:`Delete settled worktrees`,value:d.worktreeSettledAfterDays,minimum:0,onChange:e=>j({worktreeSettledAfterDays:e})})}),(0,K.jsx)(P,{title:`Delete merged worktrees`,status:T(`worktreeOnMerge`),description:`Remove worktrees whose pull request is merged and whose commits are included in the default branch.`,serverScoped:!s,control:(0,K.jsx)(z,{"aria-label":`Delete merged worktrees`,checked:d.worktreeOnMerge,onCheckedChange:e=>j({worktreeOnMerge:e})})}),(0,K.jsx)(P,{title:`Delete unchanged worktrees`,status:T(`worktreeUnchanged`),description:`Remove worktrees with no commits beyond the default branch.`,serverScoped:!s,control:(0,K.jsx)(z,{"aria-label":`Delete unchanged worktrees`,checked:d.worktreeUnchanged,onCheckedChange:e=>j({worktreeUnchanged:e})})}),r.every(ie)&&(0,K.jsx)(P,{...V(`storage-worktree-keep-when`),status:T(`worktreeKeepWhen`),description:d.worktreeKeepWhen===`any-local-files`?`Includes ignored files, except node_modules.`:d.worktreeKeepWhen===`tracked-changes`?`Deletes untracked and ignored files, including .env.`:`Keeps edits and untracked files. Deletes ignored files, including .env.`,serverScoped:!s,control:(0,K.jsxs)(x,{value:T(`worktreeKeepWhen`)?null:d.worktreeKeepWhen,onValueChange:e=>{(e===`any-local-files`||e===`uncommitted-changes`||e===`tracked-changes`)&&j({worktreeKeepWhen:e})},children:[(0,K.jsx)(b,{size:`sm`,"aria-label":`Keep worktrees with local changes`,children:(0,K.jsx)(v,{children:T(`worktreeKeepWhen`)?`Mixed`:Q[d.worktreeKeepWhen]})}),(0,K.jsxs)(y,{align:`end`,alignItemWithTrigger:!1,children:[(0,K.jsx)(_,{value:`any-local-files`,children:`Any local files`}),(0,K.jsx)(_,{value:`uncommitted-changes`,children:`Uncommitted changes`}),(0,K.jsx)(_,{value:`tracked-changes`,children:`Edited tracked files`})]})]})})]}),e[37]=r,e[38]=n,e[39]=s,e[40]=g,e[41]=m,e[42]=T,e[43]=d,e[44]=j,e[45]=H):H=e[45];let W;e[46]!==B||e[47]!==H||e[48]!==R?(W=(0,K.jsxs)(L,{id:`storage-worktrees`,title:`Worktrees`,children:[R,B,H]}),e[46]=B,e[47]=H,e[48]=R,e[49]=W):W=e[49];let q;e[50]!==s||e[51]!==T||e[52]!==d||e[53]!==D?(q=!s&&(0,K.jsxs)(L,{id:`storage-artifacts`,title:`Artifacts and logs`,children:[(0,K.jsx)(P,{title:`Delete old browser artifacts`,status:T(`browserArtifactsAfterDays`),description:`Delete saved browser captures after this many days. Older capture links will no longer open.`,serverScoped:!0,control:(0,K.jsx)(Z,{label:`Delete old browser artifacts`,value:d.browserArtifactsAfterDays,onChange:e=>D({browserArtifactsAfterDays:e})})}),(0,K.jsx)(P,{title:`Delete old rotated logs`,status:T(`logsAfterDays`),description:`Delete inactive rotated log files after this many days. Current logs are kept.`,serverScoped:!0,control:(0,K.jsx)(Z,{label:`Delete old rotated logs`,value:d.logsAfterDays,onChange:e=>D({logsAfterDays:e})})})]}),e[50]=s,e[51]=T,e[52]=d,e[53]=D,e[54]=q):q=e[54];let Y;e[55]===s?Y=e[56]:(Y=!s&&(0,K.jsx)(ne,{}),e[55]=s,e[56]=Y);let X;return e[57]!==W||e[58]!==q||e[59]!==Y||e[60]!==I?(X=(0,K.jsxs)(F,{children:[I,W,q,Y]}),e[57]=W,e[58]=q,e[59]=Y,e[60]=I,e[61]=X):X=e[61],X}function ie(e){return e.serverConfig?.environment.capabilities.storageCleanupRun===!0}function ae(e){return e.serverConfig?.environment.capabilities.settledWorktreeCleanup===!0}function oe(e){return(0,K.jsx)(q,{environmentId:e.environmentId,label:e.label},e.environmentId)}function $(e){return e.serverConfig?.environment.capabilities.databaseStorage===!0}function se(e){return e.environmentId}function ce(e){return e.serverConfig?.environment.capabilities.storageCleanup===!0}function le(e){return e.serverConfig?.environment.capabilities.storageCleanup!==!0}function ue(e){return e.serverConfig?.environment.capabilities.projectWorktreeCleanup!==!0}function de(e){return e?.sources.worktreeCleanup===`project`?e.settings.worktreeCleanup?.mode??`inherit`:`inherit`}var fe=re;export{fe as component};
2
+ //# sourceMappingURL=settings.storage-CrdP11yD.js.map
@@ -1,3 +1,3 @@
1
- import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{Ad as i,Gh as a,Ih as o,Jf as s,Lh as c,Nh as l,Ol as u,Os as d,Ph as f,Rw as p,SE as m,Um as h,Wh as g,Yn as _,Zf as v,aE as y,ar as b,as as x,bs as S,dr as C,eb as w,fr as T,ir as E,jd as D,kh as O,ll as k,lv as A,nT as j,nr as M,rr as N,rv as ee,t as P,tr as te,ts as F,ul as I,ur as ne,vh as re,zh as ie}from"./utils-BlwLA0C4.js";import{w as ae}from"./entities-DhRbI2L4.js";import{t as oe}from"./useNavigate-kfVoxx_T.js";import{t as L}from"./useLocation-t7z8sUje.js";import{i as se}from"./toast-C1lIuL0v.js";import{D as ce,E as le,T as ue,a as de,f as fe,h as pe,i as me,s as R,t as he}from"./useSettings-CyF6ezIl.js";import{f as ge}from"./server-DXSwZxzT.js";import{i as _e,n as ve,o as ye}from"./session-meZM9Xpf.js";import{t as be}from"./use-atom-command-sg76DXcz.js";import{m as xe}from"./queries-B6XxcqnT.js";import{a as Se,n as Ce,t as we}from"./tooltip-CMPhQaPE.js";import{o as Te}from"./threadSort-Bd2rijEy.js";import{i as Ee,o as De,t as Oe}from"./popover-Cmd3nOX1.js";import{t as ke}from"./ProjectFavicon-BhuB_Su5.js";import{r as z,s as B}from"./projectFilesQueryState-D9gKctiS.js";import{t as V}from"./pullRequestDetail.logic-CLAnM03l.js";import{a as H,f as U,i as W,n as G,t as K}from"./p4ProjectFile-DuMklfjR.js";import{r as q}from"./sidebarProjectGrouping-upKKecFM.js";import{n as J}from"./EnvironmentMachineIcon-B6RgXF8A.js";import{t as Y}from"./WorkspacePageContainer-CDQRGmcV.js";var X=n(),Z=e(r(),1);function Ae(e){let t=(0,X.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({variant:i,divided:a,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`grouped`:i,s=a===void 0||a,c=o===`grouped`?`rounded-xl border border-border/60 bg-card/40 shadow-xs/5`:`space-y-1`,l=o===`grouped`&&s&&`[&>*+*]:border-t [&>*+*]:border-border/50 [&>[data-slot=settings-row]]:rounded-none`,u;t[5]!==n||t[6]!==c||t[7]!==l?(u=P(`relative overflow-visible text-foreground`,c,l,n),t[5]=n,t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;return t[9]!==r||t[10]!==u?(d=(0,Z.jsx)(`div`,{...r,className:u}),t[9]=r,t[10]=u,t[11]=d):d=t[11],d}var Q=e(t(),1);function je(){let e=(0,X.c)(5),t=ae(),n=R(U),r=ce(),{environments:i}=ue(),a;if(e[0]!==i||e[1]!==r||e[2]!==t||e[3]!==n){let o=new Map(i.map(Ne));a=q({projects:t,settings:n,primaryEnvironmentId:r,resolveEnvironmentLabel:e=>o.get(e)??null}).sort(Me),e[0]=i,e[1]=r,e[2]=t,e[3]=n,e[4]=a}else a=e[4];return a}function Me(e,t){return e.displayName.localeCompare(t.displayName)}function Ne(e){return[e.environmentId,e.label]}var Pe=new Set(Object.keys(f.fields)),Fe=new Set(Object.keys(re.fields)),Ie=new Set(l);function $(e){return Ie.has(e)}function Le(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Re(e,t,n){let r=new Set(e.environmentIds),i=t.filter(e=>r.has(e.environmentId)),a=i.filter(e=>e.connection.phase===`connected`&&e.serverConfig!==null);return{environments:i,connectedEnvironments:a,environment:a.find(e=>e.environmentId===n)??a[0]??null}}function ze(e,t,n){let r=new Map(t.map(e=>[e.environmentId,e]));return e.kind===`project`||e.kind===`checkout`?e.members.flatMap(e=>{let t=r.get(e.environmentId);if(!t?.serverConfig)return[];let i=n?.get(e.physicalProjectKey),a=i===void 0?W(t.serverConfig.settings,e.id):W(t.serverConfig.settings,e.id,null,i);return[{environmentId:e.environmentId,label:t.label,projectId:e.id,settings:a.settings,sources:a.sources}]}):t.flatMap(e=>e.serverConfig?[{environmentId:e.environmentId,label:e.label,projectId:null,settings:e.serverConfig.settings,sources:W(e.serverConfig.settings,null).sources}]:[])}function Be(e,t){let n=e[0];return n!==void 0&&e.some(e=>t.some(t=>!m(n.settings[t],e.settings[t])))}function Ve(e){let t=e.map(e=>o(e.settings));return{mixed:t.some(e=>e!==t[0]),neverAvailable:e.every(e=>g(e.settings))}}function He(e,t){let n=t.filter($);if(n.length===0||e.length===0)return`environment`;let r=new Set(e.flatMap(e=>n.map(t=>e.sources[t])));return r.size>1?`mixed`:r.has(`project`)?`project`:r.has(`p4.json`)?`p4.json`:`environment`}function Ue(e,t,n){let r=new Map(t.map(e=>[e.environmentId,e])),i=new Map;for(let t of e.members){let e=r.get(t.environmentId);if(!e?.serverConfig||e.connection.phase!==`connected`||e.serverConfig.environment?.capabilities.projectSettingsOverrides!==!0)continue;let a=e.serverConfig.settings,o=n(a.projectSettingsOverrides[t.id]??{},a,t.id),s=i.get(t.environmentId);i.set(t.environmentId,{environmentId:t.environmentId,label:e.label,previous:a,patch:{projectSettingsOverrides:{...s?.patch.projectSettingsOverrides,[t.id]:o}}})}return[...i.values()]}function We(e,t){if(t.idleCompaction===void 0)return t;let{idleCompaction:n,compactIdleThreads:r,...i}=t;return{...i,...c(e,n)}}function Ge(e,t,n){let r=Object.fromEntries(Object.entries(n).filter(([e])=>Fe.has(e)&&!Pe.has(e))),i=Object.fromEntries(Object.entries(n).filter(([e])=>Pe.has(e))),a=Object.keys(i),{connectedEnvironments:o}=Re(e,t,null),s=e.kind===`project`||e.kind===`checkout`,c=s?a.filter(e=>!$(e)):[],l=a.length===0?[]:s?c.length>0?[]:Ue(e,t,(e,t,n)=>{let r=W(t,n).settings,a={...e};for(let[e,o]of Object.entries(i)){if(e===`worktreeCleanup`&&i.worktreeCleanup?.mode===`custom`){a[e]={mode:`custom`,rules:{...H(t,n),...i.worktreeCleanup.rules}};continue}if(o===null&&!ie(e)){delete a[e];continue}let s=r[e];a[e]=Le(o)&&Le(s)?{...s,...o}:o}return a}):e.kind===`all`||e.kind===`environment`?o.flatMap(e=>{let t=e.serverConfig?.settings;return t?[{environmentId:e.environmentId,label:e.label,previous:t,patch:We(t,t.worktreeCleanup!=null&&i.storageCleanup&&Object.keys(i.storageCleanup).some(e=>e.startsWith(`worktree`))?{...i,worktreeCleanup:{mode:`custom`,rules:{...H(t,null),...Object.fromEntries(Object.entries(i.storageCleanup).filter(([e])=>e.startsWith(`worktree`)))}}}:i)}]:[]}):[],u=Object.keys(r).length>0;return{clientPatch:r,hasClientWrite:u,serverWrites:l,unavailableReason:u||l.length>0||Object.keys(n).length===0?null:e.kind===`unavailable`?e.message:c.length>0?`This setting is environment-wide and cannot be overridden by a project.`:s?`Connect the selected checkouts, or update their environments, to save a project override.`:`Connect ${e.kind===`environment`?e.label:`an environment`} to save this setting.`}}function Ke(e,t,n){let r=e.kind===`project`||e.kind===`checkout`?Ue(e,t,(e,t,r)=>G(t,r,n)):[];return{clientPatch:{},hasClientWrite:!1,serverWrites:r,unavailableReason:r.length>0?null:`Connect the selected checkouts, or update their environments, to reset this override.`}}function qe(e,t){let n=t.filter($);return n.length===0?[]:e.flatMap(e=>{let t=e.serverConfig?.settings.projectSettingsOverrides;return t?Object.entries(t).flatMap(([t,r])=>n.some(e=>Object.hasOwn(r,e))?[{environmentId:e.environmentId,projectId:t}]:[]):[]})}function Je(e,t,n){let r=new Map(e.map(e=>[e.environmentId,e])),i=new Map;for(let{environmentId:e,projectId:a}of t){let t=r.get(e);if(!t?.serverConfig||t.connection.phase!==`connected`)continue;let o=t.serverConfig.settings,s=i.get(e);i.set(e,{environmentId:e,label:t.label,previous:o,patch:{projectSettingsOverrides:{...s?.patch.projectSettingsOverrides,[a]:G(o,a,n)}}})}let a=[...i.values()];return{clientPatch:{},hasClientWrite:!1,serverWrites:a,unavailableReason:a.length>0?null:`Connect the environments to reset these overrides.`}}function Ye(e,t,n){if(e===null)return t!=null&&m(n,t);if(Le(e)&&!Array.isArray(t)&&!Array.isArray(n)){let r=(e,t)=>Le(e)?e[t]:void 0;return Object.entries(e).some(([e,i])=>Ye(i,r(t,e),r(n,e)))}return!(typeof e==`string`&&typeof t==`string`?e.trim()===t:m(e,t))&&m(n,t)}function Xe(e,t){return t===void 0?[]:Object.entries(e.patch).flatMap(([n,r])=>Ye(r,e.previous[n],t[n])?[n]:[])}async function Ze(e,t,n){e.hasClientWrite&&n(e.clientPatch);let r=await Promise.allSettled(e.serverWrites.map(({environmentId:e,patch:n})=>t({environmentId:e,input:{patch:n}}))),i=t=>{let n=r[t];return n?.status===`fulfilled`&&n.value._tag===`Success`&&Xe(e.serverWrites[t],n.value.value).length===0},a=e.serverWrites.flatMap((e,t)=>{if(i(t))return[];let n=r[t];if(n?.status===`fulfilled`&&n.value._tag===`Success`)return[{...e,message:`This environment does not support this setting. Update P4 Code on it.`}];let a=n?.status===`rejected`?n.reason:n?.status===`fulfilled`&&n.value.cause?j(n.value.cause):void 0;return[{...e,message:a instanceof Error?a.message:`The save failed. Try reconnecting and saving again.`}]}),o=e.serverWrites.filter((e,t)=>i(t));return{failedEnvironments:a,savedEnvironments:o,savedEnvironmentCount:o.length}}function Qe(e){let t=e=>typeof e==`string`&&e.trim().length>0?e:void 0,n=t(e.project),r=t(e.machine),i=t(e.checkout);return{...n===void 0?{}:{project:n},...r===void 0?{}:{machine:r},...i===void 0?{}:{checkout:i}}}function $e(e,t,n){let r=(e,t)=>({kind:`unavailable`,reason:e,label:`Unavailable selection`,message:t,members:[],environmentIds:[]});if(e.checkout&&!e.project)return r(`project-required`,`Select a project to choose one of its checkouts.`);let i=n.find(t=>t.environmentId===e.machine);if(e.machine&&!i)return r(`environment-missing`,`This environment is no longer available.`);if(e.project){let a=t.find(t=>t.projectKey===e.project);if(!a)return r(`project-missing`,`This project is no longer available.`);let o=a.memberProjects.filter(t=>(e.machine===void 0||t.environmentId===e.machine)&&(e.checkout===void 0||t.physicalProjectKey===e.checkout));if(o.length===0)return r(`checkout-missing`,e.checkout?`This checkout is no longer available in the selected project and environment.`:`This project has no checkout on this environment.`);if(e.checkout){let e=o[0],t=n.find(t=>t.environmentId===e.environmentId);if(!t)return r(`environment-missing`,`This checkout's environment is no longer available.`);let i=a.memberProjects.some(t=>t.environmentId===e.environmentId&&t.physicalProjectKey!==e.physicalProjectKey);return{kind:`checkout`,group:a,checkout:e,environmentId:e.environmentId,label:`${a.displayName} / ${t.label}${i?` · ${e.workspaceRoot}`:``}`,members:o,environmentIds:[e.environmentId]}}return{kind:`project`,group:a,environmentId:i?.environmentId??null,label:`${a.displayName} / ${i?.label??`All checkouts`}`,members:o,environmentIds:[...new Set(o.map(e=>e.environmentId))]}}return i?{kind:`environment`,environmentId:i.environmentId,label:i.label,members:[],environmentIds:[i.environmentId]}:{kind:`all`,label:`All environments`,members:[],environmentIds:n.map(e=>e.environmentId)}}function et(e,t){return t.some(t=>t.environmentId!==e.environmentId&&t.label===e.label)?`${e.label} · ${e.displayUrl??e.environmentId}`:e.label}function tt(e,t){return e.machine??t??`all`}function nt(e){return e.project??`all`}function rt(e,t){let n={};return e.project&&(n.project=e.project),t!==`all`&&(n.machine=t),n}function it(e,t){let n={};return t!==`all`&&(n.project=t),e.machine&&(n.machine=e.machine),n}function at(e,t,n,r){if(e.machine||t.kind===`unavailable`)return e;let i=new Set(t.environmentIds),a=n.filter(e=>i.has(e.environmentId)),o=a.find(e=>e.environmentId===r)??a.find(e=>e.connection.phase===`connected`)??a[0];return o?{...e,machine:o.environmentId}:e}function ot(e){let t=(0,X.c)(5),n;t[0]!==e.kind||t[1]!==e.members?(n=e.kind===`project`||e.kind===`checkout`?e.members:[],t[0]=e.kind,t[1]=e.members,t[2]=n):n=t[2];let r=n,i;return t[3]===r?i=t[4]:(i=x(e=>{let t=new Map;for(let n of r){let r=e(z(n.environmentId,n.workspaceRoot,k));if(r.waiting)continue;let i=y(d(r)),a=e(B(n.environmentId,n.workspaceRoot,`p4.json`))?.data??e(B(n.environmentId,n.workspaceRoot,i?.relativePath??`p4.json`))?.data??i;t.set(n.physicalProjectKey,a===null||a.truncated?null:K(a.contents))}return t}),t[3]=r,t[4]=i),F(i)}function st(e,t){let n=(0,X.c)(24),r=je(),{environments:i}=ue(),a=ce(),o;n[0]!==i||n[1]!==r||n[2]!==a||n[3]!==e||n[4]!==t?(o=t?at(e,$e(e,r,i),i,a):e,n[0]=i,n[1]=r,n[2]=a,n[3]=e,n[4]=t,n[5]=o):o=n[5];let s=o,c;n[6]!==i||n[7]!==r||n[8]!==s?(c=$e(s,r,i),n[6]=i,n[7]=r,n[8]=s,n[9]=c):c=n[9];let l=c,u=ot(l),d,f,p;n[10]!==i||n[11]!==a||n[12]!==u||n[13]!==l?(d=Re(l,i,a),p=ze(l,d.connectedEnvironments,u),f=p.find(e=>e.environmentId===d.environment?.environmentId)??p[0]??null,n[10]=i,n[11]=a,n[12]=u,n[13]=l,n[14]=d,n[15]=f,n[16]=p):(d=n[14],f=n[15],p=n[16]);let m=f,h;return n[17]!==r||n[18]!==l||n[19]!==s||n[20]!==d||n[21]!==m||n[22]!==p?(h={scope:l,groups:r,search:s,...d,targets:p,target:m},n[17]=r,n[18]=l,n[19]=s,n[20]=d,n[21]=m,n[22]=p,n[23]=h):h=n[23],h}var ct=(0,Q.createContext)(null);function lt(e){let t=(0,X.c)(7),{search:n,onChange:r,children:i,singleEnvironment:a}=e,o=a!==void 0&&a,s=st(n,o),c;t[0]!==r||t[1]!==s||t[2]!==o?(c={...s,singleEnvironment:o,selectScope:r},t[0]=r,t[1]=s,t[2]=o,t[3]=c):c=t[3];let l=c,u;return t[4]!==i||t[5]!==l?(u=(0,Z.jsx)(ct,{value:l,children:i}),t[4]=i,t[5]=l,t[6]=u):u=t[6],u}function ut(){return(0,Q.useContext)(ct)}function dt(){let e=ut();if(e===null)throw Error(`Settings scope must be read inside SettingsScopeProvider.`);return e}var ft=new Set([`/settings/appearance`,`/settings/snap-shot`,`/settings/connections`]);function pt(){let e=(0,X.c)(20),t=ut(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={select:mt},e[0]=n):n=e[0];let r=L(n),{environments:i}=ue();if(t===null||ft.has(r))return null;let a;e[1]!==i||e[2]!==t.groups||e[3]!==t.search||e[4]!==t.selectScope||e[5]!==t.singleEnvironment?(a={value:t.search,singleEnvironment:t.singleEnvironment,groups:t.groups,environments:i,onChange:t.selectScope},e[1]=i,e[2]=t.groups,e[3]=t.search,e[4]=t.selectScope,e[5]=t.singleEnvironment,e[6]=a):a=e[6];let o=a,s;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(`span`,{className:`shrink-0`,children:`Applying settings for`}),e[7]=s):s=e[7];let c;e[8]===o?c=e[9]:(c=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[s,(0,Z.jsx)(_t,{...o})]}),e[8]=o,e[9]=c);let l=t.search.machine||t.scope.kind===`checkout`?`on`:`across`,u;e[10]===l?u=e[11]:(u=(0,Z.jsx)(`span`,{className:`shrink-0`,children:l}),e[10]=l,e[11]=u);let d;e[12]===o?d=e[13]:(d=(0,Z.jsx)(gt,{...o}),e[12]=o,e[13]=d);let f;e[14]!==u||e[15]!==d?(f=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[u,d]}),e[14]=u,e[15]=d,e[16]=f):f=e[16];let p;return e[17]!==c||e[18]!==f?(p=(0,Z.jsxs)(`p`,{className:`flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1 px-3 text-base text-muted-foreground sm:px-4`,children:[c,f]}),e[17]=c,e[18]=f,e[19]=p):p=e[19],p}function mt(e){return e.pathname}function ht(e){let t=(0,X.c)(13),{ariaLabel:n,icon:r,label:i,children:a}=e,o=`${n}: ${i}`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(T,{tone:`picker`}),t[0]=s):s=t[0];let c;t[1]===i?c=t[2]:(c=(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:i}),t[1]=i,t[2]=c);let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(D,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),t[3]=l):l=t[3];let u;t[4]!==r||t[5]!==o||t[6]!==c?(u=(0,Z.jsxs)(ne,{"aria-label":o,render:s,className:`min-w-0 max-w-72`,children:[r,c,l]}),t[4]=r,t[5]=o,t[6]=c,t[7]=u):u=t[7];let d;t[8]===a?d=t[9]:(d=(0,Z.jsx)(te,{align:`start`,children:a}),t[8]=a,t[9]=d);let f;return t[10]!==u||t[11]!==d?(f=(0,Z.jsxs)(_,{children:[u,d]}),t[10]=u,t[11]=d,t[12]=f):f=t[12],f}function gt(e){let t=(0,X.c)(31),{value:n,groups:r,environments:i,onChange:a,singleEnvironment:o}=e,s;if(t[0]!==i||t[1]!==r||t[2]!==n){let e=$e(n,r,i);s=tt(n,e.kind===`checkout`?e.environmentId:null),t[0]=i,t[1]=r,t[2]=n,t[3]=s}else s=t[3];let c=s,l,d,f,p;if(t[4]!==c||t[5]!==i||t[6]!==o){let e;t[11]===c?e=t[12]:(e=e=>e.environmentId===c,t[11]=c,t[12]=e);let n=i.find(e);l=ht,d=`Environment scope`,f=n?(0,Z.jsx)(J,{"aria-hidden":!0,kind:u(n.serverConfig),className:`size-3.5 shrink-0`}):null,p=n?et(n,i):c===`all`?o?`No environments`:`All environments`:`Unavailable environment`,t[4]=c,t[5]=i,t[6]=o,t[7]=l,t[8]=d,t[9]=f,t[10]=p}else l=t[7],d=t[8],f=t[9],p=t[10];let m;t[13]!==a||t[14]!==n?(m=e=>{typeof e==`string`&&a(rt(n,e))},t[13]=a,t[14]=n,t[15]=m):m=t[15];let h;t[16]===o?h=t[17]:(h=o?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(N,{value:`all`,closeOnClick:!0,children:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(v,{"aria-hidden":!0,className:`size-3.5`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`All environments`}),(0,Z.jsx)(E,{})]})}),(0,Z.jsx)(b,{})]}),t[16]=o,t[17]=h);let g;t[18]===i?g=t[19]:(g=i.map(e=>(0,Z.jsx)(N,{value:e.environmentId,closeOnClick:!0,children:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(J,{"aria-hidden":!0,kind:u(e.serverConfig),className:`size-3.5`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:et(e,i)}),e.connection.phase===`connected`?null:(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`Offline`}),(0,Z.jsx)(E,{})]})},e.environmentId)),t[18]=i,t[19]=g);let _;t[20]!==c||t[21]!==m||t[22]!==h||t[23]!==g?(_=(0,Z.jsxs)(M,{value:c,onValueChange:m,children:[h,g]}),t[20]=c,t[21]=m,t[22]=h,t[23]=g,t[24]=_):_=t[24];let y;return t[25]!==l||t[26]!==d||t[27]!==f||t[28]!==p||t[29]!==_?(y=(0,Z.jsx)(l,{ariaLabel:d,icon:f,label:p,children:_}),t[25]=l,t[26]=d,t[27]=f,t[28]=p,t[29]=_,t[30]=y):y=t[30],y}function _t(e){let t=(0,X.c)(24),{value:n,groups:r,onChange:i}=e,a;if(t[0]!==r||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>e.projectKey===n.project,t[3]=n,t[4]=e),a=r.find(e),t[0]=r,t[1]=n,t[2]=a}else a=t[2];let o=a,s;t[5]===o?s=t[6]:(s=o?(0,Z.jsx)(ke,{project:o,className:`size-3.5 shrink-0`}):null,t[5]=o,t[6]=s);let c=o?.displayName??(n.project?`Unavailable project`:`All projects`),l;t[7]===n?l=t[8]:(l=nt(n),t[7]=n,t[8]=l);let u;t[9]!==i||t[10]!==n?(u=e=>{typeof e==`string`&&i(it(n,e))},t[9]=i,t[10]=n,t[11]=u):u=t[11];let d,f;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(N,{value:`all`,closeOnClick:!0,children:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`All projects`}),(0,Z.jsx)(E,{})]})}),f=(0,Z.jsx)(b,{}),t[12]=d,t[13]=f):(d=t[12],f=t[13]);let p;t[14]===r?p=t[15]:(p=r.map(vt),t[14]=r,t[15]=p);let m;t[16]!==l||t[17]!==u||t[18]!==p?(m=(0,Z.jsxs)(M,{value:l,onValueChange:u,children:[d,f,p]}),t[16]=l,t[17]=u,t[18]=p,t[19]=m):m=t[19];let h;return t[20]!==s||t[21]!==c||t[22]!==m?(h=(0,Z.jsx)(ht,{ariaLabel:`Project scope`,icon:s,label:c,children:m}),t[20]=s,t[21]=c,t[22]=m,t[23]=h):h=t[23],h}function vt(e){return(0,Z.jsx)(N,{value:e.projectKey,closeOnClick:!0,children:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(ke,{project:e,className:`size-3.5`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.displayName}),(0,Z.jsx)(E,{})]})},e.projectKey)}function yt(e){let t=(0,X.c)(6),{target:n}=dt(),r=R(),i=n?.settings??O;fe(n?.environmentId??null,n?.settings??null);let a;t[0]!==r||t[1]!==i?(a=me(i,r),t[0]=r,t[1]=i,t[2]=a):a=t[2];let o=a,s;return t[3]!==e||t[4]!==o?(s=e?e(o):o,t[3]=e,t[4]=o,t[5]=s):s=t[5],s}function bt(e){let t=(0,X.c)(3),{targets:n}=dt(),r;return t[0]!==e||t[1]!==n?(r=Be(n,e),t[0]=e,t[1]=n,t[2]=r):r=t[2],r}function xt(e){let t=(0,X.c)(3),{targets:n}=dt(),r;return t[0]!==e||t[1]!==n?(r=He(n,e),t[0]=e,t[1]=n,t[2]=r):r=t[2],r}function St(){let e=(0,X.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={reportFailure:!1},e[0]=t):t=e[0];let n=be(ge.updateSettings,t),r;return e[1]===n?r=e[2]:(r=e=>{e.unavailableReason?se.add({type:`warning`,title:`Setting not saved`,description:e.unavailableReason}):Ze(e,async e=>{let t=a(e.input.patch).find(t=>!ve(e.environmentId,t));return t?S(p(new A({requiredScope:t,message:`This connection lacks permission to change these settings.`}))):n(e)},de).then(Ct)},e[1]=n,e[2]=r),r}function Ct(e){let{failedEnvironments:t,savedEnvironments:n,savedEnvironmentCount:r}=e;t.length!==0&&se.add({type:`error`,title:r>0?`Setting saved on some environments`:`Setting not saved`,description:[...t.map(Tt),...r>0?[`Saved on ${n.map(wt).join(`, `)}.`]:[]].join(`
1
+ import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{Ad as i,Gh as a,Ih as o,Jf as s,Lh as c,Nh as l,Ol as u,Os as d,Ph as f,Rw as p,SE as m,Um as h,Wh as g,Yn as _,Zf as v,aE as y,ar as b,as as x,bs as S,dr as C,eb as w,fr as T,ir as E,jd as D,kh as O,ll as k,lv as A,nT as j,nr as M,rr as N,rv as ee,t as P,tr as te,ts as F,ul as I,ur as ne,vh as re,zh as ie}from"./utils-CxCThU1r.js";import{w as ae}from"./entities-BjGK6yEY.js";import{t as oe}from"./useNavigate-ut7tie8O.js";import{t as L}from"./useLocation-jsSq4KCV.js";import{i as se}from"./toast-NSvYVPhH.js";import{D as ce,E as le,T as ue,a as de,f as fe,h as pe,i as me,s as R,t as he}from"./useSettings-FRbaNpbg.js";import{f as ge}from"./server-BRIc5okw.js";import{i as _e,n as ve,o as ye}from"./session-wmJod3Hf.js";import{t as be}from"./use-atom-command-BfhNaUIU.js";import{m as xe}from"./queries-CEdylITb.js";import{a as Se,n as Ce,t as we}from"./tooltip-QdplMyeY.js";import{o as Te}from"./threadSort-Bd2rijEy.js";import{i as Ee,o as De,t as Oe}from"./popover-Cr0R7gdF.js";import{t as ke}from"./ProjectFavicon-DCKipqYA.js";import{r as z,s as B}from"./projectFilesQueryState-CZkTtV37.js";import{t as V}from"./pullRequestDetail.logic-BmPSn0PA.js";import{a as H,f as U,i as W,n as G,t as K}from"./p4ProjectFile-BQUacEue.js";import{r as q}from"./sidebarProjectGrouping-BRZt_Xqk.js";import{n as J}from"./EnvironmentMachineIcon-KqncPHh8.js";import{t as Y}from"./WorkspacePageContainer-BEL6F4GP.js";var X=n(),Z=e(r(),1);function Ae(e){let t=(0,X.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({variant:i,divided:a,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`grouped`:i,s=a===void 0||a,c=o===`grouped`?`rounded-xl border border-border/60 bg-card/40 shadow-xs/5`:`space-y-1`,l=o===`grouped`&&s&&`[&>*+*]:border-t [&>*+*]:border-border/50 [&>[data-slot=settings-row]]:rounded-none`,u;t[5]!==n||t[6]!==c||t[7]!==l?(u=P(`relative overflow-visible text-foreground`,c,l,n),t[5]=n,t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;return t[9]!==r||t[10]!==u?(d=(0,Z.jsx)(`div`,{...r,className:u}),t[9]=r,t[10]=u,t[11]=d):d=t[11],d}var Q=e(t(),1);function je(){let e=(0,X.c)(5),t=ae(),n=R(U),r=ce(),{environments:i}=ue(),a;if(e[0]!==i||e[1]!==r||e[2]!==t||e[3]!==n){let o=new Map(i.map(Ne));a=q({projects:t,settings:n,primaryEnvironmentId:r,resolveEnvironmentLabel:e=>o.get(e)??null}).sort(Me),e[0]=i,e[1]=r,e[2]=t,e[3]=n,e[4]=a}else a=e[4];return a}function Me(e,t){return e.displayName.localeCompare(t.displayName)}function Ne(e){return[e.environmentId,e.label]}var Pe=new Set(Object.keys(f.fields)),Fe=new Set(Object.keys(re.fields)),Ie=new Set(l);function $(e){return Ie.has(e)}function Le(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Re(e,t,n){let r=new Set(e.environmentIds),i=t.filter(e=>r.has(e.environmentId)),a=i.filter(e=>e.connection.phase===`connected`&&e.serverConfig!==null);return{environments:i,connectedEnvironments:a,environment:a.find(e=>e.environmentId===n)??a[0]??null}}function ze(e,t,n){let r=new Map(t.map(e=>[e.environmentId,e]));return e.kind===`project`||e.kind===`checkout`?e.members.flatMap(e=>{let t=r.get(e.environmentId);if(!t?.serverConfig)return[];let i=n?.get(e.physicalProjectKey),a=i===void 0?W(t.serverConfig.settings,e.id):W(t.serverConfig.settings,e.id,null,i);return[{environmentId:e.environmentId,label:t.label,projectId:e.id,settings:a.settings,sources:a.sources}]}):t.flatMap(e=>e.serverConfig?[{environmentId:e.environmentId,label:e.label,projectId:null,settings:e.serverConfig.settings,sources:W(e.serverConfig.settings,null).sources}]:[])}function Be(e,t){let n=e[0];return n!==void 0&&e.some(e=>t.some(t=>!m(n.settings[t],e.settings[t])))}function Ve(e){let t=e.map(e=>o(e.settings));return{mixed:t.some(e=>e!==t[0]),neverAvailable:e.every(e=>g(e.settings))}}function He(e,t){let n=t.filter($);if(n.length===0||e.length===0)return`environment`;let r=new Set(e.flatMap(e=>n.map(t=>e.sources[t])));return r.size>1?`mixed`:r.has(`project`)?`project`:r.has(`p4.json`)?`p4.json`:`environment`}function Ue(e,t,n){let r=new Map(t.map(e=>[e.environmentId,e])),i=new Map;for(let t of e.members){let e=r.get(t.environmentId);if(!e?.serverConfig||e.connection.phase!==`connected`||e.serverConfig.environment?.capabilities.projectSettingsOverrides!==!0)continue;let a=e.serverConfig.settings,o=n(a.projectSettingsOverrides[t.id]??{},a,t.id),s=i.get(t.environmentId);i.set(t.environmentId,{environmentId:t.environmentId,label:e.label,previous:a,patch:{projectSettingsOverrides:{...s?.patch.projectSettingsOverrides,[t.id]:o}}})}return[...i.values()]}function We(e,t){if(t.idleCompaction===void 0)return t;let{idleCompaction:n,compactIdleThreads:r,...i}=t;return{...i,...c(e,n)}}function Ge(e,t,n){let r=Object.fromEntries(Object.entries(n).filter(([e])=>Fe.has(e)&&!Pe.has(e))),i=Object.fromEntries(Object.entries(n).filter(([e])=>Pe.has(e))),a=Object.keys(i),{connectedEnvironments:o}=Re(e,t,null),s=e.kind===`project`||e.kind===`checkout`,c=s?a.filter(e=>!$(e)):[],l=a.length===0?[]:s?c.length>0?[]:Ue(e,t,(e,t,n)=>{let r=W(t,n).settings,a={...e};for(let[e,o]of Object.entries(i)){if(e===`worktreeCleanup`&&i.worktreeCleanup?.mode===`custom`){a[e]={mode:`custom`,rules:{...H(t,n),...i.worktreeCleanup.rules}};continue}if(o===null&&!ie(e)){delete a[e];continue}let s=r[e];a[e]=Le(o)&&Le(s)?{...s,...o}:o}return a}):e.kind===`all`||e.kind===`environment`?o.flatMap(e=>{let t=e.serverConfig?.settings;return t?[{environmentId:e.environmentId,label:e.label,previous:t,patch:We(t,t.worktreeCleanup!=null&&i.storageCleanup&&Object.keys(i.storageCleanup).some(e=>e.startsWith(`worktree`))?{...i,worktreeCleanup:{mode:`custom`,rules:{...H(t,null),...Object.fromEntries(Object.entries(i.storageCleanup).filter(([e])=>e.startsWith(`worktree`)))}}}:i)}]:[]}):[],u=Object.keys(r).length>0;return{clientPatch:r,hasClientWrite:u,serverWrites:l,unavailableReason:u||l.length>0||Object.keys(n).length===0?null:e.kind===`unavailable`?e.message:c.length>0?`This setting is environment-wide and cannot be overridden by a project.`:s?`Connect the selected checkouts, or update their environments, to save a project override.`:`Connect ${e.kind===`environment`?e.label:`an environment`} to save this setting.`}}function Ke(e,t,n){let r=e.kind===`project`||e.kind===`checkout`?Ue(e,t,(e,t,r)=>G(t,r,n)):[];return{clientPatch:{},hasClientWrite:!1,serverWrites:r,unavailableReason:r.length>0?null:`Connect the selected checkouts, or update their environments, to reset this override.`}}function qe(e,t){let n=t.filter($);return n.length===0?[]:e.flatMap(e=>{let t=e.serverConfig?.settings.projectSettingsOverrides;return t?Object.entries(t).flatMap(([t,r])=>n.some(e=>Object.hasOwn(r,e))?[{environmentId:e.environmentId,projectId:t}]:[]):[]})}function Je(e,t,n){let r=new Map(e.map(e=>[e.environmentId,e])),i=new Map;for(let{environmentId:e,projectId:a}of t){let t=r.get(e);if(!t?.serverConfig||t.connection.phase!==`connected`)continue;let o=t.serverConfig.settings,s=i.get(e);i.set(e,{environmentId:e,label:t.label,previous:o,patch:{projectSettingsOverrides:{...s?.patch.projectSettingsOverrides,[a]:G(o,a,n)}}})}let a=[...i.values()];return{clientPatch:{},hasClientWrite:!1,serverWrites:a,unavailableReason:a.length>0?null:`Connect the environments to reset these overrides.`}}function Ye(e,t,n){if(e===null)return t!=null&&m(n,t);if(Le(e)&&!Array.isArray(t)&&!Array.isArray(n)){let r=(e,t)=>Le(e)?e[t]:void 0;return Object.entries(e).some(([e,i])=>Ye(i,r(t,e),r(n,e)))}return!(typeof e==`string`&&typeof t==`string`?e.trim()===t:m(e,t))&&m(n,t)}function Xe(e,t){return t===void 0?[]:Object.entries(e.patch).flatMap(([n,r])=>Ye(r,e.previous[n],t[n])?[n]:[])}async function Ze(e,t,n){e.hasClientWrite&&n(e.clientPatch);let r=await Promise.allSettled(e.serverWrites.map(({environmentId:e,patch:n})=>t({environmentId:e,input:{patch:n}}))),i=t=>{let n=r[t];return n?.status===`fulfilled`&&n.value._tag===`Success`&&Xe(e.serverWrites[t],n.value.value).length===0},a=e.serverWrites.flatMap((e,t)=>{if(i(t))return[];let n=r[t];if(n?.status===`fulfilled`&&n.value._tag===`Success`)return[{...e,message:`This environment does not support this setting. Update P4 Code on it.`}];let a=n?.status===`rejected`?n.reason:n?.status===`fulfilled`&&n.value.cause?j(n.value.cause):void 0;return[{...e,message:a instanceof Error?a.message:`The save failed. Try reconnecting and saving again.`}]}),o=e.serverWrites.filter((e,t)=>i(t));return{failedEnvironments:a,savedEnvironments:o,savedEnvironmentCount:o.length}}function Qe(e){let t=e=>typeof e==`string`&&e.trim().length>0?e:void 0,n=t(e.project),r=t(e.machine),i=t(e.checkout);return{...n===void 0?{}:{project:n},...r===void 0?{}:{machine:r},...i===void 0?{}:{checkout:i}}}function $e(e,t,n){let r=(e,t)=>({kind:`unavailable`,reason:e,label:`Unavailable selection`,message:t,members:[],environmentIds:[]});if(e.checkout&&!e.project)return r(`project-required`,`Select a project to choose one of its checkouts.`);let i=n.find(t=>t.environmentId===e.machine);if(e.machine&&!i)return r(`environment-missing`,`This environment is no longer available.`);if(e.project){let a=t.find(t=>t.projectKey===e.project);if(!a)return r(`project-missing`,`This project is no longer available.`);let o=a.memberProjects.filter(t=>(e.machine===void 0||t.environmentId===e.machine)&&(e.checkout===void 0||t.physicalProjectKey===e.checkout));if(o.length===0)return r(`checkout-missing`,e.checkout?`This checkout is no longer available in the selected project and environment.`:`This project has no checkout on this environment.`);if(e.checkout){let e=o[0],t=n.find(t=>t.environmentId===e.environmentId);if(!t)return r(`environment-missing`,`This checkout's environment is no longer available.`);let i=a.memberProjects.some(t=>t.environmentId===e.environmentId&&t.physicalProjectKey!==e.physicalProjectKey);return{kind:`checkout`,group:a,checkout:e,environmentId:e.environmentId,label:`${a.displayName} / ${t.label}${i?` · ${e.workspaceRoot}`:``}`,members:o,environmentIds:[e.environmentId]}}return{kind:`project`,group:a,environmentId:i?.environmentId??null,label:`${a.displayName} / ${i?.label??`All checkouts`}`,members:o,environmentIds:[...new Set(o.map(e=>e.environmentId))]}}return i?{kind:`environment`,environmentId:i.environmentId,label:i.label,members:[],environmentIds:[i.environmentId]}:{kind:`all`,label:`All environments`,members:[],environmentIds:n.map(e=>e.environmentId)}}function et(e,t){return t.some(t=>t.environmentId!==e.environmentId&&t.label===e.label)?`${e.label} · ${e.displayUrl??e.environmentId}`:e.label}function tt(e,t){return e.machine??t??`all`}function nt(e){return e.project??`all`}function rt(e,t){let n={};return e.project&&(n.project=e.project),t!==`all`&&(n.machine=t),n}function it(e,t){let n={};return t!==`all`&&(n.project=t),e.machine&&(n.machine=e.machine),n}function at(e,t,n,r){if(e.machine||t.kind===`unavailable`)return e;let i=new Set(t.environmentIds),a=n.filter(e=>i.has(e.environmentId)),o=a.find(e=>e.environmentId===r)??a.find(e=>e.connection.phase===`connected`)??a[0];return o?{...e,machine:o.environmentId}:e}function ot(e){let t=(0,X.c)(5),n;t[0]!==e.kind||t[1]!==e.members?(n=e.kind===`project`||e.kind===`checkout`?e.members:[],t[0]=e.kind,t[1]=e.members,t[2]=n):n=t[2];let r=n,i;return t[3]===r?i=t[4]:(i=x(e=>{let t=new Map;for(let n of r){let r=e(z(n.environmentId,n.workspaceRoot,k));if(r.waiting)continue;let i=y(d(r)),a=e(B(n.environmentId,n.workspaceRoot,`p4.json`))?.data??e(B(n.environmentId,n.workspaceRoot,i?.relativePath??`p4.json`))?.data??i;t.set(n.physicalProjectKey,a===null||a.truncated?null:K(a.contents))}return t}),t[3]=r,t[4]=i),F(i)}function st(e,t){let n=(0,X.c)(24),r=je(),{environments:i}=ue(),a=ce(),o;n[0]!==i||n[1]!==r||n[2]!==a||n[3]!==e||n[4]!==t?(o=t?at(e,$e(e,r,i),i,a):e,n[0]=i,n[1]=r,n[2]=a,n[3]=e,n[4]=t,n[5]=o):o=n[5];let s=o,c;n[6]!==i||n[7]!==r||n[8]!==s?(c=$e(s,r,i),n[6]=i,n[7]=r,n[8]=s,n[9]=c):c=n[9];let l=c,u=ot(l),d,f,p;n[10]!==i||n[11]!==a||n[12]!==u||n[13]!==l?(d=Re(l,i,a),p=ze(l,d.connectedEnvironments,u),f=p.find(e=>e.environmentId===d.environment?.environmentId)??p[0]??null,n[10]=i,n[11]=a,n[12]=u,n[13]=l,n[14]=d,n[15]=f,n[16]=p):(d=n[14],f=n[15],p=n[16]);let m=f,h;return n[17]!==r||n[18]!==l||n[19]!==s||n[20]!==d||n[21]!==m||n[22]!==p?(h={scope:l,groups:r,search:s,...d,targets:p,target:m},n[17]=r,n[18]=l,n[19]=s,n[20]=d,n[21]=m,n[22]=p,n[23]=h):h=n[23],h}var ct=(0,Q.createContext)(null);function lt(e){let t=(0,X.c)(7),{search:n,onChange:r,children:i,singleEnvironment:a}=e,o=a!==void 0&&a,s=st(n,o),c;t[0]!==r||t[1]!==s||t[2]!==o?(c={...s,singleEnvironment:o,selectScope:r},t[0]=r,t[1]=s,t[2]=o,t[3]=c):c=t[3];let l=c,u;return t[4]!==i||t[5]!==l?(u=(0,Z.jsx)(ct,{value:l,children:i}),t[4]=i,t[5]=l,t[6]=u):u=t[6],u}function ut(){return(0,Q.useContext)(ct)}function dt(){let e=ut();if(e===null)throw Error(`Settings scope must be read inside SettingsScopeProvider.`);return e}var ft=new Set([`/settings/appearance`,`/settings/snap-shot`,`/settings/connections`]);function pt(){let e=(0,X.c)(20),t=ut(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={select:mt},e[0]=n):n=e[0];let r=L(n),{environments:i}=ue();if(t===null||ft.has(r))return null;let a;e[1]!==i||e[2]!==t.groups||e[3]!==t.search||e[4]!==t.selectScope||e[5]!==t.singleEnvironment?(a={value:t.search,singleEnvironment:t.singleEnvironment,groups:t.groups,environments:i,onChange:t.selectScope},e[1]=i,e[2]=t.groups,e[3]=t.search,e[4]=t.selectScope,e[5]=t.singleEnvironment,e[6]=a):a=e[6];let o=a,s;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(`span`,{className:`shrink-0`,children:`Applying settings for`}),e[7]=s):s=e[7];let c;e[8]===o?c=e[9]:(c=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[s,(0,Z.jsx)(_t,{...o})]}),e[8]=o,e[9]=c);let l=t.search.machine||t.scope.kind===`checkout`?`on`:`across`,u;e[10]===l?u=e[11]:(u=(0,Z.jsx)(`span`,{className:`shrink-0`,children:l}),e[10]=l,e[11]=u);let d;e[12]===o?d=e[13]:(d=(0,Z.jsx)(gt,{...o}),e[12]=o,e[13]=d);let f;e[14]!==u||e[15]!==d?(f=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[u,d]}),e[14]=u,e[15]=d,e[16]=f):f=e[16];let p;return e[17]!==c||e[18]!==f?(p=(0,Z.jsxs)(`p`,{className:`flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1 px-3 text-base text-muted-foreground sm:px-4`,children:[c,f]}),e[17]=c,e[18]=f,e[19]=p):p=e[19],p}function mt(e){return e.pathname}function ht(e){let t=(0,X.c)(13),{ariaLabel:n,icon:r,label:i,children:a}=e,o=`${n}: ${i}`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(T,{tone:`picker`}),t[0]=s):s=t[0];let c;t[1]===i?c=t[2]:(c=(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:i}),t[1]=i,t[2]=c);let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(D,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),t[3]=l):l=t[3];let u;t[4]!==r||t[5]!==o||t[6]!==c?(u=(0,Z.jsxs)(ne,{"aria-label":o,render:s,className:`min-w-0 max-w-72`,children:[r,c,l]}),t[4]=r,t[5]=o,t[6]=c,t[7]=u):u=t[7];let d;t[8]===a?d=t[9]:(d=(0,Z.jsx)(te,{align:`start`,children:a}),t[8]=a,t[9]=d);let f;return t[10]!==u||t[11]!==d?(f=(0,Z.jsxs)(_,{children:[u,d]}),t[10]=u,t[11]=d,t[12]=f):f=t[12],f}function gt(e){let t=(0,X.c)(31),{value:n,groups:r,environments:i,onChange:a,singleEnvironment:o}=e,s;if(t[0]!==i||t[1]!==r||t[2]!==n){let e=$e(n,r,i);s=tt(n,e.kind===`checkout`?e.environmentId:null),t[0]=i,t[1]=r,t[2]=n,t[3]=s}else s=t[3];let c=s,l,d,f,p;if(t[4]!==c||t[5]!==i||t[6]!==o){let e;t[11]===c?e=t[12]:(e=e=>e.environmentId===c,t[11]=c,t[12]=e);let n=i.find(e);l=ht,d=`Environment scope`,f=n?(0,Z.jsx)(J,{"aria-hidden":!0,kind:u(n.serverConfig),className:`size-3.5 shrink-0`}):null,p=n?et(n,i):c===`all`?o?`No environments`:`All environments`:`Unavailable environment`,t[4]=c,t[5]=i,t[6]=o,t[7]=l,t[8]=d,t[9]=f,t[10]=p}else l=t[7],d=t[8],f=t[9],p=t[10];let m;t[13]!==a||t[14]!==n?(m=e=>{typeof e==`string`&&a(rt(n,e))},t[13]=a,t[14]=n,t[15]=m):m=t[15];let h;t[16]===o?h=t[17]:(h=o?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(N,{value:`all`,closeOnClick:!0,children:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(v,{"aria-hidden":!0,className:`size-3.5`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`All environments`}),(0,Z.jsx)(E,{})]})}),(0,Z.jsx)(b,{})]}),t[16]=o,t[17]=h);let g;t[18]===i?g=t[19]:(g=i.map(e=>(0,Z.jsx)(N,{value:e.environmentId,closeOnClick:!0,children:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(J,{"aria-hidden":!0,kind:u(e.serverConfig),className:`size-3.5`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:et(e,i)}),e.connection.phase===`connected`?null:(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`Offline`}),(0,Z.jsx)(E,{})]})},e.environmentId)),t[18]=i,t[19]=g);let _;t[20]!==c||t[21]!==m||t[22]!==h||t[23]!==g?(_=(0,Z.jsxs)(M,{value:c,onValueChange:m,children:[h,g]}),t[20]=c,t[21]=m,t[22]=h,t[23]=g,t[24]=_):_=t[24];let y;return t[25]!==l||t[26]!==d||t[27]!==f||t[28]!==p||t[29]!==_?(y=(0,Z.jsx)(l,{ariaLabel:d,icon:f,label:p,children:_}),t[25]=l,t[26]=d,t[27]=f,t[28]=p,t[29]=_,t[30]=y):y=t[30],y}function _t(e){let t=(0,X.c)(24),{value:n,groups:r,onChange:i}=e,a;if(t[0]!==r||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>e.projectKey===n.project,t[3]=n,t[4]=e),a=r.find(e),t[0]=r,t[1]=n,t[2]=a}else a=t[2];let o=a,s;t[5]===o?s=t[6]:(s=o?(0,Z.jsx)(ke,{project:o,className:`size-3.5 shrink-0`}):null,t[5]=o,t[6]=s);let c=o?.displayName??(n.project?`Unavailable project`:`All projects`),l;t[7]===n?l=t[8]:(l=nt(n),t[7]=n,t[8]=l);let u;t[9]!==i||t[10]!==n?(u=e=>{typeof e==`string`&&i(it(n,e))},t[9]=i,t[10]=n,t[11]=u):u=t[11];let d,f;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(N,{value:`all`,closeOnClick:!0,children:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`All projects`}),(0,Z.jsx)(E,{})]})}),f=(0,Z.jsx)(b,{}),t[12]=d,t[13]=f):(d=t[12],f=t[13]);let p;t[14]===r?p=t[15]:(p=r.map(vt),t[14]=r,t[15]=p);let m;t[16]!==l||t[17]!==u||t[18]!==p?(m=(0,Z.jsxs)(M,{value:l,onValueChange:u,children:[d,f,p]}),t[16]=l,t[17]=u,t[18]=p,t[19]=m):m=t[19];let h;return t[20]!==s||t[21]!==c||t[22]!==m?(h=(0,Z.jsx)(ht,{ariaLabel:`Project scope`,icon:s,label:c,children:m}),t[20]=s,t[21]=c,t[22]=m,t[23]=h):h=t[23],h}function vt(e){return(0,Z.jsx)(N,{value:e.projectKey,closeOnClick:!0,children:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(ke,{project:e,className:`size-3.5`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.displayName}),(0,Z.jsx)(E,{})]})},e.projectKey)}function yt(e){let t=(0,X.c)(6),{target:n}=dt(),r=R(),i=n?.settings??O;fe(n?.environmentId??null,n?.settings??null);let a;t[0]!==r||t[1]!==i?(a=me(i,r),t[0]=r,t[1]=i,t[2]=a):a=t[2];let o=a,s;return t[3]!==e||t[4]!==o?(s=e?e(o):o,t[3]=e,t[4]=o,t[5]=s):s=t[5],s}function bt(e){let t=(0,X.c)(3),{targets:n}=dt(),r;return t[0]!==e||t[1]!==n?(r=Be(n,e),t[0]=e,t[1]=n,t[2]=r):r=t[2],r}function xt(e){let t=(0,X.c)(3),{targets:n}=dt(),r;return t[0]!==e||t[1]!==n?(r=He(n,e),t[0]=e,t[1]=n,t[2]=r):r=t[2],r}function St(){let e=(0,X.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={reportFailure:!1},e[0]=t):t=e[0];let n=be(ge.updateSettings,t),r;return e[1]===n?r=e[2]:(r=e=>{e.unavailableReason?se.add({type:`warning`,title:`Setting not saved`,description:e.unavailableReason}):Ze(e,async e=>{let t=a(e.input.patch).find(t=>!ve(e.environmentId,t));return t?S(p(new A({requiredScope:t,message:`This connection lacks permission to change these settings.`}))):n(e)},de).then(Ct)},e[1]=n,e[2]=r),r}function Ct(e){let{failedEnvironments:t,savedEnvironments:n,savedEnvironmentCount:r}=e;t.length!==0&&se.add({type:`error`,title:r>0?`Setting saved on some environments`:`Setting not saved`,description:[...t.map(Tt),...r>0?[`Saved on ${n.map(wt).join(`, `)}.`]:[]].join(`
2
2
  `)})}function wt(e){let{label:t}=e;return t}function Tt(e){let{label:t,message:n}=e;return`Could not save on ${t}: ${n}`}function Et(){let e=(0,X.c)(4),{scope:t,environments:n}=dt(),r=St(),i;return e[0]!==n||e[1]!==r||e[2]!==t?(i=e=>r(Ge(t,n,e)),e[0]=n,e[1]=r,e[2]=t,e[3]=i):i=e[3],i}function Dt(){let e=(0,X.c)(3),t=ut(),n=St(),r;return e[0]!==t||e[1]!==n?(r=e=>{t!==null&&n(Ke(t.scope,t.environments,e))},e[0]=t,e[1]=n,e[2]=r):r=e[2],r}function Ot(){let e=(0,X.c)(3),t=ut(),n=St(),r;return e[0]!==t||e[1]!==n?(r=(e,r)=>{t!==null&&n(Je(t.environments,e,r))},e[0]=t,e[1]=n,e[2]=r):r=e[2],r}function kt(){let e=(0,X.c)(3),{connectedEnvironments:t}=dt(),n=ye(t,ee),r;return e[0]!==t||e[1]!==n?(r=t.length>0&&t.every(e=>n.has(e.environmentId)),e[0]=t,e[1]=n,e[2]=r):r=e[2],r}var At=`flex min-w-0 items-center gap-1.5 opacity-55 in-data-highlighted:opacity-100 in-data-popup-open:opacity-100`;w([`auto`,`local`,`worktree`]);function jt(e){return e!==`local`}var Mt=new Set([`local`,`local environment`]);function Nt(e){let t=e?.trim();return t&&t.length>0?t:null}function Pt(e){let t=Nt(e.runtimeLabel),n=Nt(e.savedLabel);return e.isPrimary?[t,n].find(e=>e?!Mt.has(e.toLowerCase()):!1)??`This device`:t??n??e.environmentId}function Ft(e){return e.canPickEnvironment?!0:e.activeEnvironment!==null&&!e.activeEnvironment.isPrimary}function It(e){return e.hasActiveProject&&(e.isDraftHeroState||e.persistInActiveThreads)&&(e.isGitRepo||e.showEnvironmentIndicator||e.hostsRestingComposerControls)}var Lt=16;function Rt(e){return e.compact?e.neededWidth>e.availableWidth-Lt:e.neededWidth>e.availableWidth}function zt(e){return e===`worktree`?`New worktree`:e===`auto`?`Auto`:`Current checkout`}var Bt={recursive:`Recursive`,"top-level":`Top level only`,none:`Skip`};function Vt(e){return e?`Current worktree`:zt(`local`)}function Ht(e,t){return e?`Worktree`:t===`worktree`?zt(`worktree`):`Local checkout`}function Ut(e){let t=null;for(let n of e.threads){if(!n.worktreePath||n.worktreePath===e.currentWorktreePath||(n.archivedAt??null)!==null)continue;let r=Te(n.updatedAt);r!==null&&(t===null||r>t.updatedAt)&&(t={branch:n.branch,worktreePath:n.worktreePath,updatedAt:r})}return t===null?null:{branch:t.branch,worktreePath:t.worktreePath}}function Wt(e){return e.branch?`Previous worktree (${e.branch})`:`Previous worktree`}function Gt(e){let{activeWorktreePath:t,hasServerThread:n,draftThreadEnvMode:r,preparingWorktree:i}=e;return n?t||i?`worktree`:`local`:t?`local`:r??`local`}function Kt(e){let{nextWorktreePath:t,currentWorktreePath:n,effectiveEnvMode:r}=e;return t?`worktree`:jt(r)&&!n?r:`local`}function qt(e){let{envMode:t,activeWorktreePath:n,activeThreadBranch:r,currentGitBranch:i}=e;return jt(t)&&!n?r??i:i??r}function Jt(e){let{activeWorktreePath:t,effectiveEnvMode:n,resolvedActiveBranch:r,resolvedActiveBranchIsRemote:i,startFromOrigin:a}=e;return r?jt(n)&&!t?`From ${a&&i===!1?`origin/${r}`:r}`:r:`Select ref`}function Yt(e){return e.activeThreadBranch===e.resolvedActiveBranch?e.activeThreadBranch:null}function Xt(e){let{effectiveEnvMode:t,activeWorktreePath:n,activeThreadBranch:r,currentGitBranch:i}=e;return t!==`local`||n!==null||!r||!i||r===i?null:{threadBranch:r,currentBranch:i}}function Zt(e){let{activeProjectCwd:t,activeWorktreePath:n,refName:r}=e;if(r.worktreePath)return{checkoutCwd:r.worktreePath,nextWorktreePath:r.worktreePath===t?null:r.worktreePath,reuseExistingWorktree:!0};let i=n!==null&&r.isDefault?null:n;return{checkoutCwd:i??t,nextWorktreePath:i,reuseExistingWorktree:!1}}function Qt(e){let{itemValue:t,normalizedQuery:n,createBranchItemValue:r,checkoutPullRequestItemValue:i}=e;if(n.length===0||r&&t===r||i&&t===i)return!0;let a=t.toLowerCase();if(a.includes(n))return!0;let o=xe(n);return o.length>0&&o!==n&&a.includes(o)}var $t={repo_conventions:`Repository conventions`,conventional_commits:`Conventional Commits`,custom:`Custom instructions`};function en(e,t){if(t==null)return e===`pullRequestMergeMethod`?`Last selected`:e===`sidebarAutoSettleAfterDays`?`Never`:e===`defaultModelSelection`?`Automatic`:e===`sourceControlWriterModelSelection`?`Text generation model`:e===`reviewGuideModelSelection`?`Source control writer model`:e===`defaultThreadEnvMode`||e===`worktreeSubmodules`?`Inherit`:`Not set`;if(typeof t==`boolean`)return t?`On`:`Off`;if(typeof t==`number`)return e===`sidebarAutoSettleAfterDays`?`${t} ${t===1?`day`:`days`}`:String(t);if(typeof t==`string`)return e===`defaultThreadEnvMode`&&(t===`auto`||t===`local`||t===`worktree`)?zt(t):e===`worktreeSubmodules`&&t in Bt?Bt[t]:e===`pullRequestMergeMethod`&&t in V?V[t]:t===``?`Empty`:t;if(Array.isArray(t))return`${t.length} ${t.length===1?`item`:`items`}`;if(typeof t==`object`){if(`model`in t&&typeof t.model==`string`)return t.model;if(`mode`in t&&typeof t.mode==`string`)return $t[t.mode]??t.mode}return`Custom`}function tn(e,t,n){let r=t[n],i=$(n)?e.sources[n]:`environment`,a=!m(r,O[n]),o=nn(n),s=[];e.projectId!==null&&$(n)&&s.push({key:`project`,label:`Project`,value:i===`project`?en(n,e.settings[n]):`Inherits`,effective:i===`project`,set:i===`project`}),s.push({key:`environment`,label:e.label,value:a?en(n,r):`Inherits`,effective:i===`environment`&&a,set:a}),o&&e.projectId!==null&&s.push({key:`p4.json`,label:`p4.json`,value:i===`p4.json`?en(n,e.settings[n]):`Inherits`,effective:i===`p4.json`,set:i===`p4.json`});let c=o?I[n].builtIn:O[n];return s.push({key:`built-in`,label:`Default`,value:en(n,c),effective:i===`environment`&&!a,set:!0}),s}function nn(e){return Object.hasOwn(I,e)}function rn(e){let t=(0,X.c)(52),{state:n,summary:r,targets:i,environments:a,keys:o,overridingProjects:s,onClearOverrides:c}=e,l;t[0]===s?l=t[1]:(l=s===void 0?[]:s,t[0]=s,t[1]=l);let d=l,f=o[0];if(!f||i.length===0)return null;let p=d.length>0?`${r} · ${d.length} project ${d.length===1?`override`:`overrides`}`:r,m,h,g,_,y,b,x,S;if(t[2]!==a||t[3]!==f||t[4]!==c||t[5]!==p||t[6]!==d||t[7]!==n||t[8]!==i){let e;t[17]!==a||t[18]!==f?(e=e=>{let t=a.find(t=>t.environmentId===e.environmentId);return t?.serverConfig?[{target:e,environment:{...t,serverConfig:t.serverConfig},machine:u(t.serverConfig),layers:tn(e,t.serverConfig.settings,f)}]:[]},t[17]=a,t[18]=f,t[19]=e):e=t[19];let r=i.flatMap(e);h=Oe;let o=`${p}. Show where this value comes from`,s;t[20]===o?s=t[21]:(s=(0,Z.jsx)(De,{render:(0,Z.jsx)(C,{size:`icon-micro`,variant:`ghost-muted`,"aria-label":o})}),t[20]=o,t[21]=s);let l=n===`overridden`&&`text-primary`,w=n===`mixed`&&`text-warning`,E;t[22]!==l||t[23]!==w?(E=P(`size-3`,l,w),t[22]=l,t[23]=w,t[24]=E):E=t[24];let D;t[25]===E?D=t[26]:(D=(0,Z.jsx)(v,{className:E}),t[25]=E,t[26]=D);let O;t[27]!==s||t[28]!==D?(O=(0,Z.jsx)(Se,{render:s,children:D}),t[27]=s,t[28]=D,t[29]=O):O=t[29];let k;t[30]===p?k=t[31]:(k=(0,Z.jsx)(Ce,{side:`top`,children:p}),t[30]=p,t[31]=k),t[32]!==O||t[33]!==k?(S=(0,Z.jsxs)(we,{children:[O,k]}),t[32]=O,t[33]=k,t[34]=S):S=t[34],m=Ee,y=`start`,b=`md`,x=`none`,g=`divide-y divide-border/60`;let A;t[35]!==f||t[36]!==c||t[37]!==d?(A=e=>{let{target:t,environment:n,machine:r,layers:i}=e;return(0,Z.jsxs)(`section`,{className:`px-3 py-2.5`,children:[(0,Z.jsxs)(`h4`,{className:`flex items-center gap-1.5 pb-1.5 text-xs font-medium text-muted-foreground`,children:[(0,Z.jsx)(J,{"aria-hidden":!0,kind:r,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:t.label})]}),(0,Z.jsx)(`ol`,{role:`list`,className:`text-sm`,children:i.map(an)}),(()=>{let e=d.filter(e=>e.environmentId===t.environmentId);if(e.length===0)return null;let r=n.serverConfig.settings.projectSettingsOverrides;return(0,Z.jsxs)(`div`,{className:`mt-2 border-t border-border/60 pt-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(`span`,{children:`Overridden by`}),c?(0,Z.jsxs)(T,{onClick:()=>c(e),children:[`Reset `,e.length===1?`it`:`all`]}):null]}),(0,Z.jsx)(`ul`,{role:`list`,className:`mt-0.5 text-sm`,children:e.map(e=>(0,Z.jsxs)(`li`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 px-2 py-1`,children:[(0,Z.jsx)(T,{className:`min-w-0 justify-start`,onClick:e.open,children:(0,Z.jsx)(`span`,{className:`truncate`,children:e.label})}),(0,Z.jsx)(`span`,{className:`max-w-32 truncate text-muted-foreground tabular-nums`,children:$(f)?en(f,r[e.projectId]?.[f]):null})]},e.projectId))})]})})()]},`${t.environmentId}:${t.projectId??``}`)},t[35]=f,t[36]=c,t[37]=d,t[38]=A):A=t[38],_=r.map(A),t[2]=a,t[3]=f,t[4]=c,t[5]=p,t[6]=d,t[7]=n,t[8]=i,t[9]=m,t[10]=h,t[11]=g,t[12]=_,t[13]=y,t[14]=b,t[15]=x,t[16]=S}else m=t[9],h=t[10],g=t[11],_=t[12],y=t[13],b=t[14],x=t[15],S=t[16];let w;t[39]!==g||t[40]!==_?(w=(0,Z.jsx)(`div`,{className:g,children:_}),t[39]=g,t[40]=_,t[41]=w):w=t[41];let E;t[42]!==m||t[43]!==y||t[44]!==b||t[45]!==x||t[46]!==w?(E=(0,Z.jsx)(m,{align:y,width:b,padding:x,children:w}),t[42]=m,t[43]=y,t[44]=b,t[45]=x,t[46]=w,t[47]=E):E=t[47];let D;return t[48]!==h||t[49]!==E||t[50]!==S?(D=(0,Z.jsxs)(h,{children:[S,E]}),t[48]=h,t[49]=E,t[50]=S,t[51]=D):D=t[51],D}function an(e){return(0,Z.jsxs)(`li`,{className:P(`grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 rounded-md px-2 py-1`,e.effective&&`bg-foreground/[0.06]`),children:[(0,Z.jsx)(`span`,{className:P(`min-w-0 truncate`,e.effective?`font-medium text-foreground`:`text-muted-foreground`),children:e.key===`environment`?`Environment`:e.label}),(0,Z.jsxs)(`span`,{className:P(`flex items-center gap-1.5 tabular-nums`,e.effective?`text-foreground`:e.set?`text-muted-foreground`:`text-muted-foreground/60`),children:[(0,Z.jsx)(`span`,{className:`max-w-32 truncate`,children:e.value}),e.effective?(0,Z.jsx)(i,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-primary`}):(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`size-3.5 shrink-0`})]})]},e.key)}var on=[],sn=()=>void 0,cn=(0,Q.createContext)({targetId:null,highlightTarget:!0,onTargetHandled:sn});function ln(e){let t=(0,X.c)(7),{targetId:n,highlightTarget:r,onTargetHandled:i,children:a}=e,o=r===void 0||r,s=i===void 0?sn:i,c;t[0]!==o||t[1]!==s||t[2]!==n?(c={targetId:n,highlightTarget:o,onTargetHandled:s},t[0]=o,t[1]=s,t[2]=n,t[3]=c):c=t[3];let l=c,u;return t[4]!==a||t[5]!==l?(u=(0,Z.jsx)(cn,{value:l,children:a}),t[4]=a,t[5]=l,t[6]=u):u=t[6],u}function un(e,t=!0){let n=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;((typeof e.querySelector==`function`?e.querySelector(`:scope > [data-settings-scroll-target]`):null)??(e.tagName===`SECTION`&&e.firstElementChild?e.firstElementChild:e)).scrollIntoView({behavior:n?`auto`:`smooth`,block:`center`}),e.focus({preventScroll:!0}),e.classList.remove(`settings-search-target-pulse`),t&&!n&&(e.offsetWidth,e.classList.add(`settings-search-target-pulse`),e.addEventListener(`blur`,()=>e.classList.remove(`settings-search-target-pulse`),{once:!0}))}function dn(){return(0,Q.useContext)(cn).targetId}function fn(e){let t=(0,X.c)(4),{targetId:n,highlightTarget:r,onTargetHandled:i}=(0,Q.useContext)(cn),a=e!==void 0&&e===n,o;return t[0]!==r||t[1]!==a||t[2]!==i?(o=e=>{e&&a&&(un(e,r),i())},t[0]=r,t[1]=a,t[2]=i,t[3]=o):o=t[3],o}function pn(e){let t=(0,X.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i=fn(r.id),a=r.id?-1:r.tabIndex,o;return t[3]!==n||t[4]!==a||t[5]!==r||t[6]!==i?(o=(0,Z.jsx)(`div`,{...r,ref:i,tabIndex:a,children:n}),t[3]=n,t[4]=a,t[5]=r,t[6]=i,t[7]=o):o=t[7],o}var mn=`min-w-0 max-w-none shrink-0`;function hn(e){let t=(0,X.c)(3),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Se,{delay:200,render:(0,Z.jsx)(C,{size:`icon-micro`,variant:`ghost-muted`,"aria-label":`Background policy details`,children:(0,Z.jsx)(s,{className:`size-3.5`})})}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,Z.jsxs)(we,{children:[r,(0,Z.jsx)(Ce,{side:`top`,children:n})]}),t[1]=n,t[2]=i),i}function gn(e){let t=(0,X.c)(3),n=e===void 0?1e3:e,[r,i]=(0,Q.useState)(_n),a,o;return t[0]===n?(a=t[1],o=t[2]):(a=()=>{let e=setInterval(()=>i(Date.now()),n);return()=>clearInterval(e)},o=[n],t[0]=n,t[1]=a,t[2]=o),(0,Q.useEffect)(a,o),r}function _n(){return Date.now()}function vn(e){let t=(0,X.c)(30),n,r,i,a,o,s,c,l,u;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9]):({title:l,hideTitle:s,icon:a,titleAction:u,headerAction:i,variant:c,children:n,className:r,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u);let d=s!==void 0&&s,f=c===void 0?`grouped`:c,p=fn(o.id),m=o.id?-1:o.tabIndex,h=!d&&`space-y-2.5`,g;t[10]!==r||t[11]!==h?(g=P(h,r),t[10]=r,t[11]=h,t[12]=g):g=t[12];let _;t[13]!==i||t[14]!==d||t[15]!==a||t[16]!==l||t[17]!==u?(_=d?(0,Z.jsx)(`h2`,{className:`sr-only`,children:l}):(0,Z.jsxs)(`div`,{"data-settings-scroll-target":!0,className:`flex min-h-7 items-start justify-between gap-4 px-3 sm:px-4`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,Z.jsxs)(`h2`,{className:`flex min-h-7 items-center gap-2 text-sm font-normal text-foreground/70`,children:[a,l]}),u]}),(0,Z.jsx)(`div`,{className:`flex min-h-7 min-w-7 items-center justify-end`,children:i})]}),t[13]=i,t[14]=d,t[15]=a,t[16]=l,t[17]=u,t[18]=_):_=t[18];let v=d?``:void 0,y;t[19]!==n||t[20]!==v||t[21]!==f?(y=(0,Z.jsx)(Ae,{"data-settings-scroll-target":v,variant:f,children:n}),t[19]=n,t[20]=v,t[21]=f,t[22]=y):y=t[22];let b;return t[23]!==o||t[24]!==m||t[25]!==g||t[26]!==_||t[27]!==y||t[28]!==p?(b=(0,Z.jsxs)(`section`,{...o,ref:p,tabIndex:m,className:g,children:[_,y]}),t[23]=o,t[24]=m,t[25]=g,t[26]=_,t[27]=y,t[28]=p,t[29]=b):b=t[29],b}function yn(e){let t=(0,X.c)(8),{children:n,message:r}=e;if(r===void 0)return n;let i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(s,{className:`mt-0.5 size-3.5 shrink-0 text-warning`}),t[0]=i):i=t[0];let a;t[1]===r?a=t[2]:(a=(0,Z.jsxs)(`div`,{className:`flex items-start gap-2 px-3 py-2 text-xs leading-relaxed text-muted-foreground sm:px-4`,children:[i,(0,Z.jsx)(`p`,{children:r})]}),t[1]=r,t[2]=a);let o;t[3]===n?o=t[4]:(o=(0,Z.jsx)(`div`,{className:`[&_h3]:opacity-64 [&_p]:opacity-64`,children:n}),t[3]=n,t[4]=o);let c;return t[5]!==a||t[6]!==o?(c=(0,Z.jsxs)(`div`,{className:`border-border/60 bg-muted/20 py-1.5`,children:[a,o]}),t[5]=a,t[6]=o,t[7]=c):c=t[7],c}function bn(e){let t=(0,X.c)(118),n,r,i,a,o,s,c,l,u,d,f,p;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11],p=t[12]):({title:p,description:a,status:u,resetAction:c,onResetOverride:s,control:i,serverScoped:d,settingKeys:f,mixed:o,children:n,className:r,...l}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p);let h=d!==void 0&&d,g=f===void 0?on:f,_=fn(l.id),v=pe(),y=ut(),b=ce(),x=le(),S=_e(b,ee),C;t[13]===y?.connectedEnvironments?C=t[14]:(C=y?.connectedEnvironments??[],t[13]=y?.connectedEnvironments,t[14]=C);let w=ye(C,ee),T;t[15]!==y||t[16]!==S||t[17]!==w?(T=y?y.connectedEnvironments.length>0&&y.connectedEnvironments.every(e=>w.has(e.environmentId)):S,t[15]=y,t[16]=S,t[17]=w,t[18]=T):T=t[18];let E=T,D=Dt(),k=Ot(),A=y!==null&&(y.scope.kind===`project`||y.scope.kind===`checkout`),j,M,N,te;if(t[19]!==y||t[20]!==A||t[21]!==o||t[22]!==h||t[23]!==g){N=g.filter($),j=A&&h&&N.length===0;let e;t[28]!==y||t[29]!==o||t[30]!==g?(e=o??(y!==null&&Be(y.targets,g)),t[28]=y,t[29]=o,t[30]=g,t[31]=e):e=t[31],M=e,te=y&&A?He(y.targets,N):null,t[19]=y,t[20]=A,t[21]=o,t[22]=h,t[23]=g,t[24]=j,t[25]=M,t[26]=N,t[27]=te}else j=t[24],M=t[25],N=t[26],te=t[27];let F=te,I=h&&(!E||!(y?y.connectedEnvironments.length>0:v)),ne;t[32]!==y||t[33]!==F?(ne=F===`environment`&&y?.scope.environmentIds.length===1?y.environments.find(e=>e.environmentId===y.scope.environmentIds[0])?.label??`environment`:`environment`,t[32]=y,t[33]=F,t[34]=ne):ne=t[34];let re=ne;y?.connectedEnvironments;let ie;t[35]===y?.connectedEnvironments?ie=t[36]:(ie=new Map((y?.connectedEnvironments??[]).flatMap(Sn)),t[35]=y?.connectedEnvironments,t[36]=ie);let ae=ie,oe;bb0:{if(y===null||A||N.length===0){let e;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[37]=e):e=t[37],oe=e;break bb0}let e;if(t[38]!==y||t[39]!==N){let n;t[41]===y?n=t[42]:(n=e=>{let t=y.groups.find(t=>t.memberProjects.some(t=>t.environmentId===e.environmentId&&t.id===e.projectId));return t?[{...e,label:t.displayName,open:()=>y.selectScope({project:t.projectKey,...y.search.machine?{machine:y.search.machine}:{}})}]:[]},t[41]=y,t[42]=n),e=qe(y.connectedEnvironments,N).flatMap(n),t[38]=y,t[39]=N,t[40]=e}else e=t[40];oe=e}let L=oe,se;t[43]!==D||t[44]!==A||t[45]!==s||t[46]!==c||t[47]!==N||t[48]!==F||t[49]!==p||t[50]!==I?(se=I?null:A&&N.length>0?F===`project`||F===`mixed`?(0,Z.jsx)(Cn,{label:typeof p==`string`?p:`override`,tooltip:`Reset to inherited value`,onClick:()=>s?s():D(N)}):null:c,t[43]=D,t[44]=A,t[45]=s,t[46]=c,t[47]=N,t[48]=F,t[49]=p,t[50]=I,t[51]=se):se=t[51];let ue=se,de;t[52]===i?de=t[53]:(de=e=>(0,Z.jsxs)(we,{children:[(0,Z.jsx)(Se,{render:(0,Z.jsx)(`span`,{tabIndex:0,className:`flex w-full items-center rounded-md outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring @min-[32rem]/settings-row:w-auto`}),children:(0,Z.jsx)(`div`,{inert:!0,className:`flex w-full items-center gap-2 opacity-50 @min-[32rem]/settings-row:w-auto`,children:i})}),(0,Z.jsx)(Ce,{side:`top`,children:e})]}),t[52]=i,t[53]=de);let fe=de,me;t[54]!==E||t[55]!==y||t[56]!==i||t[57]!==j||t[58]!==fe||t[59]!==x?.label||t[60]!==I||t[61]!==w?(me=I&&i?fe(E?y?`Reconnect the selected environment to change this setting.`:he:`This connection lacks permission to change settings on ${y?y.connectedEnvironments.filter(e=>!w.has(e.environmentId)).map(xn).join(`, `)||`the selected environment`:x?.label??`the primary environment`}.`):j&&i?fe(`Environment-wide setting. Select an environment to change it.`):i,t[54]=E,t[55]=y,t[56]=i,t[57]=j,t[58]=fe,t[59]=x?.label,t[60]=I,t[61]=w,t[62]=me):me=t[62];let R=me,ge;t[63]!==y||t[64]!==ae||t[65]!==g?(ge=y!==null&&g.some(e=>y.targets.some(t=>{let n=ae.get(t.environmentId);return n!==void 0&&!m(n[e],O[e])})),t[63]=y,t[64]=ae,t[65]=g,t[66]=ge):ge=t[66];let ve=ge,be;t[67]!==ve||t[68]!==re||t[69]!==M||t[70]!==N||t[71]!==F?(be=M?{state:`mixed`,summary:`Mixed across selected environments`}:F===`project`?{state:`overridden`,summary:`Overridden for this project`}:F===`p4.json`?{state:`inherited`,summary:`Inherited from the repository's p4.json`}:F===`environment`&&N.length>0?{state:`inherited`,summary:`Inherited from ${re}`}:ve?{state:`environment`,summary:`Set on the environment`}:{state:`default`,summary:`Built-in default`},t[67]=ve,t[68]=re,t[69]=M,t[70]=N,t[71]=F,t[72]=be):be=t[72];let xe=be,Te;t[73]!==E||t[74]!==k||t[75]!==y||t[76]!==xe||t[77]!==L||t[78]!==N||t[79]!==h||t[80]!==g?(Te=y&&h&&g.length>0?(0,Z.jsx)(rn,{state:xe.state,summary:xe.summary,targets:y.targets,environments:y.connectedEnvironments,keys:g,overridingProjects:L,...E?{onClearOverrides:e=>k(e,N)}:{}}):null,t[73]=E,t[74]=k,t[75]=y,t[76]=xe,t[77]=L,t[78]=N,t[79]=h,t[80]=g,t[81]=Te):Te=t[81];let Ee=Te,De=u,Oe=l.id?-1:l.tabIndex,ke=n?`pt-3 pb-1`:`py-3`,z;t[82]!==r||t[83]!==ke?(z=P(`@container/settings-row rounded-xl px-3 sm:px-4 aria-disabled:opacity-64 aria-disabled:[&_*]:text-muted-foreground`,ke,r),t[82]=r,t[83]=ke,t[84]=z):z=t[84];let B;t[85]===p?B=t[86]:(B=(0,Z.jsx)(`h3`,{className:`text-sm font-medium text-foreground`,children:p}),t[85]=p,t[86]=B);let V;t[87]===Ee?V=t[88]:(V=Ee?(0,Z.jsx)(`span`,{className:`inline-flex h-5 w-5 shrink-0 items-center justify-center`,children:Ee}):null,t[87]=Ee,t[88]=V);let H;t[89]===ue?H=t[90]:(H=(0,Z.jsx)(`span`,{className:`inline-flex h-5 w-5 shrink-0 items-center justify-center`,children:ue}),t[89]=ue,t[90]=H);let U;t[91]!==B||t[92]!==V||t[93]!==H?(U=(0,Z.jsxs)(`div`,{className:`flex min-h-5 items-center gap-1.5`,children:[B,V,H]}),t[91]=B,t[92]=V,t[93]=H,t[94]=U):U=t[94];let W;t[95]===a?W=t[96]:(W=a?(0,Z.jsx)(`p`,{className:`max-w-xl text-xs leading-normal text-muted-foreground/80`,children:a}):null,t[95]=a,t[96]=W);let G;t[97]===De?G=t[98]:(G=De?(0,Z.jsx)(`div`,{className:`pt-0.5 text-xs text-muted-foreground`,children:De}):null,t[97]=De,t[98]=G);let K;t[99]!==U||t[100]!==W||t[101]!==G?(K=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[U,W,G]}),t[99]=U,t[100]=W,t[101]=G,t[102]=K):K=t[102];let q;t[103]===R?q=t[104]:(q=R?(0,Z.jsx)(`div`,{className:`flex w-full min-w-0 shrink-0 items-center gap-2 @min-[32rem]/settings-row:w-auto @min-[32rem]/settings-row:justify-end`,children:R}):null,t[103]=R,t[104]=q);let J;t[105]!==K||t[106]!==q?(J=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3 @min-[32rem]/settings-row:grid @min-[32rem]/settings-row:grid-cols-[minmax(0,1fr)_minmax(10rem,auto)] @min-[32rem]/settings-row:items-center @min-[32rem]/settings-row:gap-8`,children:[K,q]}),t[105]=K,t[106]=q,t[107]=J):J=t[107];let Y;t[108]!==n||t[109]!==I?(Y=I&&n?(0,Z.jsx)(`div`,{inert:!0,className:`opacity-50`,children:n}):n,t[108]=n,t[109]=I,t[110]=Y):Y=t[110];let Ae;return t[111]!==l||t[112]!==Oe||t[113]!==z||t[114]!==J||t[115]!==Y||t[116]!==_?(Ae=(0,Z.jsxs)(`div`,{...l,ref:_,tabIndex:Oe,"data-slot":`settings-row`,className:z,children:[J,Y]}),t[111]=l,t[112]=Oe,t[113]=z,t[114]=J,t[115]=Y,t[116]=_,t[117]=Ae):Ae=t[117],Ae}function xn(e){return e.label}function Sn(e){return e.serverConfig?[[e.environmentId,e.serverConfig.settings]]:[]}function Cn(e){let t=(0,X.c)(12),{label:n,tooltip:r,disabled:i,onClick:a}=e,o=r===void 0?`Reset to default`:r,s=i!==void 0&&i,c=`Reset ${n} to default`,l;t[0]===a?l=t[1]:(l=e=>{e.stopPropagation(),a()},t[0]=a,t[1]=l);let u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(h,{className:`size-3`}),t[2]=u):u=t[2];let d;t[3]!==s||t[4]!==c||t[5]!==l?(d=(0,Z.jsx)(Se,{render:(0,Z.jsx)(C,{size:`icon-micro`,variant:`ghost-muted`,"aria-label":c,disabled:s,onClick:l,children:u})}),t[3]=s,t[4]=c,t[5]=l,t[6]=d):d=t[6];let f;t[7]===o?f=t[8]:(f=(0,Z.jsx)(Ce,{side:`top`,children:o}),t[7]=o,t[8]=f);let p;return t[9]!==d||t[10]!==f?(p=(0,Z.jsxs)(we,{children:[d,f]}),t[9]=d,t[10]=f,t[11]=p):p=t[11],p}function wn(e){let t=(0,X.c)(18),{children:n,className:r,width:i}=e,a=i===void 0?`readable`:i,o=oe(),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={select:En},t[0]=s):s=t[0];let c=L(s),l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l={select:Tn},t[1]=l):l=t[1];let u=L(l),d;t[2]===c?d=t[3]:(d=c.replace(/^#/,``)||null,t[2]=c,t[3]=d);let f=d,p;t[4]===o?p=t[5]:(p=()=>{o({hash:``,replace:!0,resetScroll:!1,hashScrollIntoView:!1,state:{settingsTargetHighlight:!0}})},t[4]=o,t[5]=p);let m=p,h;t[6]===r?h=t[7]:(h=P(`gap-8`,r),t[6]=r,t[7]=h);let g;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(pt,{}),t[8]=g):g=t[8];let _;t[9]!==n||t[10]!==h||t[11]!==a?(_=(0,Z.jsx)(`div`,{className:`topbar-scroll-fade scrollbar-gutter-both flex-1 overflow-y-auto`,"data-settings-page-scroll":!0,children:(0,Z.jsxs)(Y,{width:a,className:h,children:[g,n]})}),t[9]=n,t[10]=h,t[11]=a,t[12]=_):_=t[12];let v;return t[13]!==m||t[14]!==u||t[15]!==_||t[16]!==f?(v=(0,Z.jsx)(ln,{targetId:f,highlightTarget:u,onTargetHandled:m,children:_}),t[13]=m,t[14]=u,t[15]=_,t[16]=f,t[17]=v):v=t[17],v}function Tn(e){return e.state.settingsTargetHighlight!==!1}function En(e){return e.hash}function Dn(e,{highlight:t=!0}={}){let n=document.getElementById(e);return n?(un(n,t),!0):!1}export{It as A,lt as B,zt as C,Wt as D,Ht as E,yt as F,Ae as G,Qe as H,bt as I,kt as L,jt as M,Dt as N,Ut as O,xt as P,Et as R,Gt as S,Xt as T,Ve as U,dt as V,je as W,qt as _,bn as a,Vt as b,yn as c,fn as d,dn as f,Yt as g,Zt as h,wn as i,Ft as j,Qt as k,Dn as l,Bt as m,mn as n,pn as o,At as p,Cn as r,vn as s,hn as t,gn as u,Jt as v,Pt as w,Kt as x,Rt as y,ft as z};
3
- //# sourceMappingURL=settingsLayout-D3zsCQTE.js.map
3
+ //# sourceMappingURL=settingsLayout-7rl00kQL.js.map
@@ -1,2 +1,2 @@
1
- import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{Qu as i,To as a,Zy as o,dr as s,ih as c,js as l,ks as u,mr as d,t as f}from"./utils-BlwLA0C4.js";import{R as p,l as m,z as h}from"./TooltipViewport-beytMJmq.js";import{a as g,n as _,t as v}from"./tooltip-CMPhQaPE.js";import{t as y}from"./input-CySdZpuF.js";import{t as b}from"./scroll-area-DMQd4YlU.js";import{c as x,l as S,n as C,o as w,r as T,s as E,t as D,u as O}from"./DialogTitle-CACErOl5.js";import{t as k}from"./useResizeDrag-CWrW8GV3.js";var A=e(t(),1),j=n(),M=e(r(),1),N=T,P=w;function F(e){let t=(0,j.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=f(`fixed inset-0 z-(--z-sheet) bg-background/60 backdrop-blur-xs transition-all duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,M.jsx)(O,{className:i,"data-slot":`sheet-backdrop`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function I(e){let t=(0,j.c)(15),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,side:i,variant:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s=i===`bottom`&&`grid grid-rows-[1fr_auto] pt-12`,c=i===`top`&&`grid grid-rows-[auto_1fr] pb-12`,l=i===`left`&&`flex justify-start`,u=i===`right`&&`flex justify-end`,d=o===`inset`&&`sm:p-4`,p;t[5]!==n||t[6]!==s||t[7]!==c||t[8]!==l||t[9]!==u||t[10]!==d?(p=f(`fixed inset-0 z-(--z-sheet) grid`,s,c,l,u,d,n),t[5]=n,t[6]=s,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=p):p=t[11];let m;return t[12]!==r||t[13]!==p?(m=(0,M.jsx)(C,{className:p,"data-slot":`sheet-viewport`,...r}),t[12]=r,t[13]=p,t[14]=m):m=t[14],m}function L(e){let t=(0,j.c)(42),n,r,i,a,o,l,u,d,p;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],l=t[6],u=t[7],d=t[8],p=t[9]):({className:r,children:n,showCloseButton:o,keepMounted:l,transitionDurationMs:p,side:u,variant:d,style:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=l,t[7]=u,t[8]=d,t[9]=p);let m=o===void 0||o,h=l!==void 0&&l,g=u===void 0?`right`:u,_=d===void 0?`default`:d,v;t[10]===p?v=t[11]:(v=p===void 0?void 0:{transitionDuration:`${p}ms`},t[10]=p,t[11]=v);let y=v,b=p===0,x=b?`transition-none! data-ending-style:opacity-100! data-starting-style:opacity-100!`:void 0,C;t[12]!==x||t[13]!==y?(C=(0,M.jsx)(F,{className:x,style:y}),t[12]=x,t[13]=y,t[14]=C):C=t[14];let w=g===`bottom`&&`row-start-2 border-t data-ending-style:translate-y-8 data-starting-style:translate-y-8`,T=g===`top`&&`data-ending-style:-translate-y-8 data-starting-style:-translate-y-8 border-b`,D=g===`left`&&`data-ending-style:-translate-x-8 data-starting-style:-translate-x-8 w-[calc(100%-(--spacing(12)))] max-w-md border-e`,O=g===`right`&&`col-start-2 w-[calc(100%-(--spacing(12)))] max-w-md border-s data-ending-style:translate-x-8 data-starting-style:translate-x-8`,k=_===`inset`&&`before:hidden sm:rounded-2xl sm:border sm:before:rounded-[calc(var(--radius-2xl)-1px)] sm:**:data-[slot=sheet-footer]:rounded-b-[calc(var(--radius-2xl)-1px)]`,A=b&&`transition-none! will-change-auto! data-ending-style:translate-x-0! data-starting-style:translate-x-0! data-ending-style:translate-y-0! data-starting-style:translate-y-0! data-ending-style:opacity-100! data-starting-style:opacity-100!`,N;t[15]!==r||t[16]!==D||t[17]!==O||t[18]!==k||t[19]!==A||t[20]!==w||t[21]!==T?(N=f(`relative flex max-h-full min-h-0 w-full min-w-0 flex-col bg-popover not-dark:bg-clip-padding text-popover-foreground shadow-lg/5 transition-[opacity,translate] duration-200 ease-in-out will-change-transform before:pointer-events-none before:absolute before:inset-0 before:shadow-[0_1px_--theme(--color-black/4%)] data-ending-style:opacity-0 data-starting-style:opacity-0 max-sm:before:hidden dark:before:shadow-[0_-1px_--theme(--color-white/6%)]`,w,T,D,O,k,A,r),t[15]=r,t[16]=D,t[17]=O,t[18]=k,t[19]=A,t[20]=w,t[21]=T,t[22]=N):N=t[22];let L;t[23]!==a||t[24]!==y?(L={...y,...a},t[23]=a,t[24]=y,t[25]=L):L=t[25];let R;t[26]===m?R=t[27]:(R=m&&(0,M.jsx)(S,{"aria-label":`Close`,className:`absolute end-2 top-2`,render:(0,M.jsx)(s,{size:`icon`,variant:`ghost`}),children:(0,M.jsx)(c,{})}),t[26]=m,t[27]=R);let z;t[28]!==n||t[29]!==i||t[30]!==N||t[31]!==L||t[32]!==R?(z=(0,M.jsxs)(E,{className:N,"data-slot":`sheet-popup`,style:L,...i,children:[n,R]}),t[28]=n,t[29]=i,t[30]=N,t[31]=L,t[32]=R,t[33]=z):z=t[33];let B;t[34]!==g||t[35]!==z||t[36]!==_?(B=(0,M.jsx)(I,{side:g,variant:_,children:z}),t[34]=g,t[35]=z,t[36]=_,t[37]=B):B=t[37];let V;return t[38]!==h||t[39]!==B||t[40]!==C?(V=(0,M.jsxs)(P,{keepMounted:h,children:[C,B]}),t[38]=h,t[39]=B,t[40]=C,t[41]=V):V=t[41],V}function R(e){let t=(0,j.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=f(`flex flex-col gap-2 p-6 in-[[data-slot=sheet-popup]:has([data-slot=sheet-panel])]:pb-3 max-sm:pb-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,M.jsx)(`div`,{className:i,"data-slot":`sheet-header`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function z(e){let t=(0,j.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=f(`font-semibold text-xl leading-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,M.jsx)(D,{className:i,"data-slot":`sheet-title`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function B(e){let t=(0,j.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=f(`text-muted-foreground text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,M.jsx)(x,{className:i,"data-slot":`sheet-description`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var V={"2xl":1536,"3xl":1600,"4xl":2e3,lg:1024,md:768,sm:640,xl:1280};function H(e){return`(min-width: ${typeof e==`number`?e:V[e]}px)`}function U(e){return`(max-width: ${(typeof e==`number`?e:V[e])-1}px)`}function ee(e){if(typeof e!=`string`){let t=[];return e.min!=null&&t.push(H(e.min)),e.max!=null&&t.push(U(e.max)),e.pointer===`coarse`&&t.push(`(pointer: coarse)`),e.pointer===`fine`&&t.push(`(pointer: fine)`),t.length===0?`(min-width: 0px)`:t.join(` and `)}if(e.startsWith(`(`))return e;let t=[];for(let n of e.split(`:`))if(n.startsWith(`max-`)){let e=n.slice(4);e in V&&t.push(U(e))}else n in V&&t.push(H(n));return t.length>0?t.join(` and `):e}function te(){return!1}function W(e){let t=(0,j.c)(6),n;t[0]===e?n=t[1]:(n=ee(e),t[0]=e,t[1]=n);let r=n,i;t[2]===r?i=t[3]:(i=e=>{if(typeof window>`u`)return ne;let t=window.matchMedia(r);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)},t[2]=r,t[3]=i);let a=i,o;return t[4]===r?o=t[5]:(o=()=>typeof window>`u`?!1:window.matchMedia(r).matches,t[4]=r,t[5]=o),(0,A.useSyncExternalStore)(a,o,te)}function ne(){}function G(){return W(`max-md`)}function re(e){return(e.isMobile?e.openMobile:e.open)?`expanded`:`collapsed`}var ie=`sidebar_state`,ae=604800,K=`16rem`,q=`calc(100vw - var(--spacing(3)))`,oe=`3rem`,se=256,J=`max-sm:[--workspace-titlebar-control-size:--spacing(8)]`,Y=A.createContext(null),X=A.createContext(null);function Z(){let e=A.use(Y);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function ce(){let{isMobile:e,open:t,openMobile:n}=Z();return e?n:t}function le(e){let t=(0,j.c)(40),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({defaultOpen:c,open:i,onOpenChange:o,className:r,style:s,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=c===void 0||c,u=G(),[d,p]=A.useState(!1),[m,h]=A.useState(!1),g;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>{h(e!==null)},t[8]=g):g=t[8];let _=g,[v,y]=A.useState(l),b=i??v,x;t[9]!==b||t[10]!==o?(x=async e=>{let t=typeof e==`function`?e(b):e;o?o(t):y(t),await cookieStore.set({expires:Date.now()+ae*1e3,name:ie,path:`/`,value:String(t)})},t[9]=b,t[10]=o,t[11]=x):x=t[11];let S=x,C;t[12]!==u||t[13]!==S?(C=()=>u?p(de):S(ue),t[12]=u,t[13]=S,t[14]=C):C=t[14];let w=C,T;t[15]!==u||t[16]!==b||t[17]!==d?(T=re({isMobile:u,open:b,openMobile:d}),t[15]=u,t[16]=b,t[17]=d,t[18]=T):T=t[18];let E=T,D;t[19]!==u||t[20]!==m||t[21]!==b||t[22]!==d||t[23]!==S||t[24]!==E||t[25]!==w?(D={isMobile:u,open:b,openMobile:d,mobileSheetMounted:m,setMobileSheetElement:_,setOpen:S,setOpenMobile:p,state:E,toggleSidebar:w},t[19]=u,t[20]=m,t[21]=b,t[22]=d,t[23]=S,t[24]=E,t[25]=w,t[26]=D):D=t[26];let O=D,k;t[27]===r?k=t[28]:(k=f(`group/sidebar-wrapper flex min-h-svh w-full`,J,r),t[27]=r,t[28]=k);let N;t[29]===s?N=t[30]:(N={"--sidebar-width":K,"--sidebar-width-icon":oe,"--workspace-titlebar-content-left":`calc(var(--workspace-controls-left) + var(--workspace-titlebar-control-size) + var(--workspace-titlebar-control-gap) + var(--workspace-history-controls-width, 0px))`,...s},t[29]=s,t[30]=N);let P=N,F;t[31]!==n||t[32]!==a||t[33]!==E||t[34]!==k||t[35]!==P?(F=(0,M.jsx)(`div`,{className:k,"data-sidebar-state":E,"data-slot":`sidebar-wrapper`,style:P,...a,children:n}),t[31]=n,t[32]=a,t[33]=E,t[34]=k,t[35]=P,t[36]=F):F=t[36];let I;return t[37]!==O||t[38]!==F?(I=(0,M.jsx)(Y,{value:O,children:F}),t[37]=O,t[38]=F,t[39]=I):I=t[39],I}function ue(e){return!e}function de(e){return!e}function fe(e){let t=(0,j.c)(80),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({side:a,variant:o,collapsible:s,resizable:c,separator:l,className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u=a===void 0?`left`:a,d=o===void 0?`sidebar`:o,p=s===void 0?`offcanvas`:s,m=c!==void 0&&c,h=l===void 0||l,{isMobile:g,state:_,openMobile:v,setOpenMobile:y,setMobileSheetElement:b}=Z(),x;bb0:{if(g||p===`none`||!m){x=null;break bb0}let e;t[9]===m?e=t[10]:(e=typeof m==`boolean`?{}:m,t[9]=m,t[10]=e);let n=e,r=n.maxWidth??1/0,i=n.minWidth??se,a=n.storageKey??null,o;t[11]===n.onResize?o=t[12]:(o=n.onResize?{onResize:n.onResize}:{},t[11]=n.onResize,t[12]=o);let s;t[13]===n.shouldAcceptWidth?s=t[14]:(s=n.shouldAcceptWidth?{shouldAcceptWidth:n.shouldAcceptWidth}:{},t[13]=n.shouldAcceptWidth,t[14]=s);let c;t[15]!==a||t[16]!==o||t[17]!==s||t[18]!==r||t[19]!==i?(c={maxWidth:r,minWidth:i,storageKey:a,...o,...s},t[15]=a,t[16]=o,t[17]=s,t[18]=r,t[19]=i,t[20]=c):c=t[20],x=c}let S=x,C;t[21]!==S||t[22]!==u?(C={side:u,resizable:S},t[21]=S,t[22]=u,t[23]=C):C=t[23];let w=C;if(p===`none`){let e;t[24]===r?e=t[25]:(e=f(`flex h-full w-(--sidebar-width) flex-col bg-sidebar surface-grain text-sidebar-foreground`,r),t[24]=r,t[25]=e);let a;t[26]!==n||t[27]!==i||t[28]!==e?(a=(0,M.jsx)(`div`,{className:e,"data-slot":`sidebar`,...i,children:n}),t[26]=n,t[27]=i,t[28]=e,t[29]=a):a=t[29];let o;return t[30]!==w||t[31]!==a?(o=(0,M.jsx)(X,{value:w,children:a}),t[30]=w,t[31]=a,t[32]=o):o=t[32],o}if(g){let e;t[33]===r?e=t[34]:(e=f(`w-(--sidebar-width) max-w-none bg-sidebar surface-grain p-0 text-sidebar-foreground`,r),t[33]=r,t[34]=e);let a;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(a={"--sidebar-width":q},t[35]=a):a=t[35];let o;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,M.jsxs)(R,{className:`sr-only`,children:[(0,M.jsx)(z,{children:`Sidebar`}),(0,M.jsx)(B,{children:`Displays the mobile sidebar.`})]}),t[36]=o):o=t[36];let s=u===`left`?`pl-safe`:`pr-safe`,c;t[37]===s?c=t[38]:(c=f(`flex h-full w-full flex-col pb-safe pt-safe`,J,s),t[37]=s,t[38]=c);let l;t[39]!==n||t[40]!==i||t[41]!==c?(l=(0,M.jsx)(`div`,{className:c,...i,children:n}),t[39]=n,t[40]=i,t[41]=c,t[42]=l):l=t[42];let d;t[43]!==b||t[44]!==u||t[45]!==l||t[46]!==e?(d=(0,M.jsxs)(L,{ref:b,className:e,"data-mobile":`true`,"data-sidebar":`sidebar`,"data-slot":`sidebar`,showCloseButton:!1,side:u,style:a,children:[o,l]}),t[43]=b,t[44]=u,t[45]=l,t[46]=e,t[47]=d):d=t[47];let p;t[48]!==v||t[49]!==y||t[50]!==d?(p=(0,M.jsx)(N,{onOpenChange:y,open:v,children:d}),t[48]=v,t[49]=y,t[50]=d,t[51]=p):p=t[51];let m;return t[52]!==w||t[53]!==p?(m=(0,M.jsx)(X,{value:w,children:p}),t[52]=w,t[53]=p,t[54]=m):m=t[54],m}let T=_===`collapsed`?p:``,E=d===`floating`||d===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,D;t[55]===E?D=t[56]:(D=f(`relative w-(--sidebar-width) bg-transparent`,`[[data-panel-animations=true]_&]:transition-[width] [[data-panel-animations=true]_&]:[transition-duration:var(--panel-animation-duration)] [[data-panel-animations=true]_&]:ease-out`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,E),t[55]=E,t[56]=D);let O;t[57]===D?O=t[58]:(O=(0,M.jsx)(`div`,{className:D,"data-slot":`sidebar-gap`}),t[57]=D,t[58]=O);let k=u===`left`?`left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]`:`right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]`,A;t[59]!==r||t[60]!==h||t[61]!==k||t[62]!==d?(A=f(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) md:flex`,`[[data-panel-animations=true]_&]:transition-[left,right,width] [[data-panel-animations=true]_&]:[transition-duration:var(--panel-animation-duration)] [[data-panel-animations=true]_&]:ease-out`,k,d===`floating`||d===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:f(`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,h&&`group-data-[side=left]:border-r group-data-[side=right]:border-l`),r),t[59]=r,t[60]=h,t[61]=k,t[62]=d,t[63]=A):A=t[63];let P;t[64]===n?P=t[65]:(P=(0,M.jsx)(`div`,{className:`flex h-full w-full flex-col bg-sidebar surface-grain group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow-sm/5`,"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,children:n}),t[64]=n,t[65]=P);let F;t[66]!==i||t[67]!==A||t[68]!==P?(F=(0,M.jsx)(`div`,{className:A,"data-slot":`sidebar-container`,...i,children:P}),t[66]=i,t[67]=A,t[68]=P,t[69]=F):F=t[69];let I;t[70]!==u||t[71]!==_||t[72]!==O||t[73]!==F||t[74]!==T||t[75]!==d?(I=(0,M.jsxs)(`div`,{className:`group peer hidden text-sidebar-foreground md:block`,"data-collapsible":T,"data-side":u,"data-slot":`sidebar`,"data-state":_,"data-variant":d,children:[O,F]}),t[70]=u,t[71]=_,t[72]=O,t[73]=F,t[74]=T,t[75]=d,t[76]=I):I=t[76];let V;return t[77]!==w||t[78]!==I?(V=(0,M.jsx)(X,{value:w,children:I}),t[77]=w,t[78]=I,t[79]=V):V=t[79],V}function pe(e){let t=(0,j.c)(18),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onClick:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{toggleSidebar:a}=Z(),o=ce(),c;t[4]===n?c=t[5]:(c=f(`size-[var(--workspace-titlebar-control-size)]! [-webkit-app-region:no-drag]`,n),t[4]=n,t[5]=c);let l;t[6]!==r||t[7]!==a?(l=e=>{r?.(e),a()},t[6]=r,t[7]=a,t[8]=l):l=t[8];let u=o?h:p,d;t[9]===u?d=t[10]:(d=(0,M.jsx)(m,{className:`size-4`,icon:u}),t[9]=u,t[10]=d);let g;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,M.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`}),t[11]=g):g=t[11];let _;return t[12]!==o||t[13]!==i||t[14]!==c||t[15]!==l||t[16]!==d?(_=(0,M.jsxs)(s,{className:c,"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,"aria-pressed":o,onClick:l,size:`icon`,variant:`ghost`,...i,children:[d,g]}),t[12]=o,t[13]=i,t[14]=c,t[15]=l,t[16]=d,t[17]=_):_=t[17],_}function Q(e,t){return Math.max(t.minWidth,Math.min(e,t.maxWidth))}function me(e){let t=(0,j.c)(53),n,r,i,a,s,c,d,p;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],s=t[5],c=t[6],d=t[7],p=t[8]):({className:n,onClick:r,onPointerCancel:a,onLostPointerCapture:i,onPointerDown:s,onPointerMove:c,onPointerUp:d,...p}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s,t[6]=c,t[7]=d,t[8]=p);let{open:m,toggleSidebar:h}=Z(),g=A.use(X),_=A.useRef(null),v=A.useRef(!1),y=g?.resizable??null,b=A.useRef(y),x=y!==null&&m?`Resize Sidebar`:`Toggle Sidebar`,S;t[9]!==m||t[10]!==y||t[11]!==g?.side?(S=e=>{if(!y||!m)return null;let t=e.currentTarget,n=t.closest(`[data-slot='sidebar-wrapper']`),r=t.closest(`[data-slot='sidebar']`),i=r?.querySelector(`[data-slot='sidebar-container']`);if(!n||!r||!i)return null;let a=g?.side??`left`,s=Q(i.getBoundingClientRect().width,y),c=[r.querySelector(`[data-slot='sidebar-gap']`),i].filter(_e),u=e=>{c.forEach(t=>{t.style.setProperty(`width`,`${e}px`)})};return c.forEach(ge),u(s),{width:s,edge:a===`left`?`right`:`left`,resize(e){let i=b.current;if(!i)return s;let o=Q(e,i);return(i.shouldAcceptWidth?.({currentWidth:s,nextWidth:o,rail:t,side:a,sidebarRoot:r,wrapper:n})??!0)&&(u(o),s=o),s},finish(e,t){n.style.setProperty(`--sidebar-width`,`${e}px`),v.current=t;let r=b.current;if(r?.storageKey)try{l(r.storageKey,e,o)}catch(e){console.error(`Could not persist sidebar width.`,e)}r?.onResize?.(e)},cleanup(){c.forEach(he)}}},t[9]=m,t[10]=y,t[11]=g?.side,t[12]=S):S=t[12];let C=k(S,String(m)),w;t[13]!==C||t[14]!==y?(w=()=>{b.current=y,C.refresh()},t[13]=C,t[14]=y,t[15]=w):w=t[15];let T;t[16]===y?T=t[17]:(T=[y],t[16]=y,t[17]=T),A.useLayoutEffect(w,T);let E;t[18]!==r||t[19]!==m||t[20]!==y||t[21]!==h?(E=e=>{r?.(e),!e.defaultPrevented&&(v.current?(v.current=!1,e.preventDefault()):y&&m?e.preventDefault():h())},t[18]=r,t[19]=m,t[20]=y,t[21]=h,t[22]=E):E=t[22];let D=E,O,N;t[23]===y?(O=t[24],N=t[25]):(O=()=>{if(!y?.storageKey||typeof window>`u`)return;let e=_.current;if(!e)return;let t=e.closest(`[data-slot='sidebar-wrapper']`);if(!t)return;let n;try{n=u(y.storageKey,o)}catch(e){console.error(`Could not restore persisted sidebar width.`,e);return}if(n===null)return;let r=Q(n,y);t.style.setProperty(`--sidebar-width`,`${r}px`),y.onResize?.(r)},N=[y],t[23]=y,t[24]=O,t[25]=N),A.useLayoutEffect(O,N);let P;t[26]===n?P=t[27]:(P=f(`-translate-x-1/2 group-data-[side=left]:-right-4 absolute inset-y-0 z-20 hidden w-4 after:absolute after:inset-y-0 after:left-1/2 after:w-px after:bg-sidebar-border group-data-[side=right]:left-0 sm:flex [[data-collapsible=offcanvas][data-state=collapsed]_&]:pointer-events-none`,`[[data-panel-animations=true]_&]:transition-all [[data-panel-animations=true]_&]:[transition-duration:var(--panel-animation-duration)] [[data-panel-animations=true]_&]:ease-out`,`in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:after:left-full`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,n),t[26]=n,t[27]=P);let F;t[28]!==i||t[29]!==C?(F=e=>{i?.(e),e.defaultPrevented||C.onLostPointerCapture(e)},t[28]=i,t[29]=C,t[30]=F):F=t[30];let I;t[31]!==a||t[32]!==C?(I=e=>{a?.(e),e.defaultPrevented||C.onPointerCancel(e)},t[31]=a,t[32]=C,t[33]=I):I=t[33];let L;t[34]!==s||t[35]!==C?(L=e=>{s?.(e),e.defaultPrevented||C.onPointerDown(e)},t[34]=s,t[35]=C,t[36]=L):L=t[36];let R;t[37]!==c||t[38]!==C?(R=e=>{c?.(e),e.defaultPrevented||C.onPointerMove(e)},t[37]=c,t[38]=C,t[39]=R):R=t[39];let z;t[40]!==d||t[41]!==C?(z=e=>{d?.(e),e.defaultPrevented||C.onPointerUp(e)},t[40]=d,t[41]=C,t[42]=z):z=t[42];let B;return t[43]!==D||t[44]!==p||t[45]!==x||t[46]!==L||t[47]!==R||t[48]!==z||t[49]!==P||t[50]!==F||t[51]!==I?(B=(0,M.jsx)(`button`,{"aria-label":x,className:P,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,onClick:D,onLostPointerCapture:F,onPointerCancel:I,onPointerDown:L,onPointerMove:R,onPointerUp:z,ref:_,tabIndex:-1,type:`button`,...p}),t[43]=D,t[44]=p,t[45]=x,t[46]=L,t[47]=R,t[48]=z,t[49]=P,t[50]=F,t[51]=I,t[52]=B):B=t[52],B}function he(e){e.style.removeProperty(`width`),e.style.removeProperty(`transition-duration`)}function ge(e){e.style.setProperty(`transition-duration`,`0ms`)}function _e(e){return e!==null}function ve(e){let t=(0,j.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=f(`[&_[data-slot=input]]:h-auto [&_[data-slot=input]]:p-0 [&_[data-slot=input]]:font-medium [&_[data-slot=input]]:text-sidebar-foreground [&_[data-slot=input]]:text-sm [&_[data-slot=input]]:leading-normal [&_[data-slot=input]]:placeholder:text-sidebar-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,M.jsx)(y,{className:i,unstyled:!0,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ye(e){let t=(0,j.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=f(`relative flex min-w-0 w-full flex-1 flex-col bg-background surface-grain`,`md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ms-2 md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ms-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm/5`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,M.jsx)(`main`,{className:i,"data-slot":`sidebar-inset`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function be(e){let t=(0,j.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=f(`flex flex-col gap-2 px-[var(--sidebar-content-inset)] py-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,M.jsx)(`div`,{className:i,"data-sidebar":`footer`,"data-slot":`sidebar-footer`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function $(e){let t=(0,j.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,fixedHeader:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=r?(0,M.jsx)(`div`,{className:`w-full shrink-0`,children:r}):null,t[4]=r,t[5]=a);let o=r&&`[&>[data-sidebar=group]:first-child]:pt-0`,s;t[6]!==n||t[7]!==o?(s=f(`flex w-full min-w-0 flex-col [overflow-anchor:none] group-data-[collapsible=icon]:overflow-hidden [&>[data-sidebar=group]+[data-sidebar=group]]:pt-0`,o,n),t[6]=n,t[7]=o,t[8]=s):s=t[8];let c;t[9]!==i||t[10]!==s?(c=(0,M.jsx)(b,{hideScrollbars:!0,scrollFade:!0,scrollFadePadding:!1,viewportTabIndex:-1,className:`h-auto min-h-0 flex-1 [&>[data-slot=scroll-area-viewport]]:[--fade-size:0.75rem]`,children:(0,M.jsx)(`div`,{className:s,"data-sidebar":`content`,"data-slot":`sidebar-content`,...i})}),t[9]=i,t[10]=s,t[11]=c):c=t[11];let l;return t[12]!==a||t[13]!==c?(l=(0,M.jsxs)(M.Fragment,{children:[a,c]}),t[12]=a,t[13]=c,t[14]=l):l=t[14],l}function xe(e){let t=(0,j.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=f(`relative flex w-full min-w-0 flex-col p-[var(--sidebar-content-inset)]`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,M.jsx)(`div`,{className:i,"data-sidebar":`group`,"data-slot":`sidebar-group`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Se(e){let t=(0,j.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=f(`flex w-full min-w-0 flex-col gap-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,M.jsx)(`ul`,{className:i,"data-sidebar":`menu`,"data-slot":`sidebar-menu`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ce(e){let t=(0,j.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=f(`group/menu-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,M.jsx)(`li`,{className:i,"data-sidebar":`menu-item`,"data-slot":`sidebar-menu-item`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var we=i(`peer/menu-button flex w-full cursor-pointer items-center gap-[var(--sidebar-control-gap)] overflow-hidden text-left outline-hidden ring-ring transition-[width,height,padding] hover:bg-sidebar-row-hover hover:text-sidebar-foreground [[data-sidebar-row]:hover>&]:bg-sidebar-row-hover [[data-sidebar-row]:hover>&]:text-sidebar-foreground [[data-sidebar-row]:hover>&>svg]:text-sidebar-foreground focus-visible:ring-2 focus-visible:ring-inset active:bg-sidebar-row-active active:text-sidebar-foreground disabled:pointer-events-none disabled:opacity-64 aria-disabled:pointer-events-none aria-disabled:opacity-64 data-[active=true]:bg-sidebar-row-selected data-[active=true]:font-medium data-[active=true]:text-sidebar-foreground data-[state=open]:hover:bg-sidebar-row-hover data-[state=open]:hover:text-sidebar-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-[var(--sidebar-content-inset)]! [&>span:last-child]:truncate [&>svg:not([class*='size-'])]:size-4 [&>svg]:shrink-0 [&>svg]:text-[var(--sidebar-icon-color)] hover:[&>svg]:text-sidebar-foreground active:[&>svg]:text-sidebar-foreground data-[active=true]:[&>svg]:text-sidebar-foreground`,{defaultVariants:{size:`default`,variant:`default`},variants:{size:{default:`h-8 rounded-[var(--control-radius)] px-[var(--sidebar-row-content-inset)] py-1.5 text-sm`,icon:`size-8 justify-center rounded-[var(--control-radius)] p-0`,lg:`h-12 rounded-lg p-2 text-sm group-data-[collapsible=icon]:p-0!`,sm:`h-7 rounded-lg p-2 text-xs`},variant:{default:`font-medium text-sidebar-foreground`,outline:`bg-sidebar-control-surface ring-1 ring-sidebar-border`,project:`font-normal text-sidebar-muted-foreground`,settings:`h-9 gap-2.5 rounded-xl px-3 font-normal text-sidebar-foreground data-[active=true]:font-normal [&>svg:not([class*='size-'])]:size-4.5 [&>svg]:text-sidebar-foreground`}}});function Te(e){let t=(0,j.c)(13),{isActive:n,variant:r,size:i,tooltip:o,className:s,render:c,...l}=e,u=n!==void 0&&n,p=r===void 0?`default`:r,m=i===void 0?`default`:i,{isMobile:h,state:y}=Z(),b={className:f(we({size:m,variant:p}),s),"data-active":u,"data-sidebar":`menu-button`,"data-size":m,"data-slot":`sidebar-menu-button`},x=a(b,l),S;t[0]!==x||t[1]!==c?(S={defaultTagName:`button`,props:x,render:c},t[0]=x,t[1]=c,t[2]=S):S=t[2];let C=d(S);if(!o)return C;if(typeof o==`string`){let e;t[3]===o?e=t[4]:(e={children:o},t[3]=o,t[4]=e),o=e}let w=C,T;t[5]===w?T=t[6]:(T=(0,M.jsx)(g,{render:w}),t[5]=w,t[6]=T);let E=y!==`collapsed`||h,D;t[7]!==E||t[8]!==o?(D=(0,M.jsx)(_,{align:`center`,hidden:E,side:`right`,...o}),t[7]=E,t[8]=o,t[9]=D):D=t[9];let O;return t[10]!==T||t[11]!==D?(O=(0,M.jsxs)(v,{children:[T,D]}),t[10]=T,t[11]=D,t[12]=O):O=t[12],O}function Ee(e){let t=(0,j.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=(i===void 0?`tree`:i)===`flat`?`gap-0.5`:`mx-3.5 translate-x-px gap-1 border-sidebar-border border-l px-2.5 py-0.5`,o;t[4]!==n||t[5]!==a?(o=f(`flex min-w-0 flex-col`,a,`group-data-[collapsible=icon]:hidden`,n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o?(s=(0,M.jsx)(`ul`,{className:o,"data-sidebar":`menu-sub`,"data-slot":`sidebar-menu-sub`,...r}),t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function De(e){let t=(0,j.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=f(`group/menu-sub-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,M.jsx)(`li`,{className:i,"data-sidebar":`menu-sub-item`,"data-slot":`sidebar-menu-sub-item`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Oe(e){let t=(0,j.c)(9),n,r,i,o;if(t[0]!==e){let{size:s,isActive:c,className:l,render:u,...p}=e;n=u;let m=s===void 0?`md`:s,h=c!==void 0&&c,g={className:f(`-translate-x-px flex h-7 min-w-0 cursor-pointer items-center gap-2 overflow-hidden rounded-lg px-2 text-sidebar-foreground outline-hidden ring-ring hover:bg-sidebar-row-hover hover:text-sidebar-foreground focus-visible:ring-2 focus-visible:ring-inset active:bg-sidebar-row-active active:text-sidebar-foreground disabled:pointer-events-none disabled:opacity-64 aria-disabled:pointer-events-none aria-disabled:opacity-64 [&>span:last-child]:truncate [&>svg:not([class*='size-'])]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-foreground`,`data-[active=true]:bg-sidebar-row-selected data-[active=true]:text-sidebar-foreground`,m===`sm`&&`text-xs`,m===`md`&&`text-sm`,`group-data-[collapsible=icon]:hidden`,l),"data-active":h,"data-sidebar":`menu-sub-button`,"data-size":m,"data-slot":`sidebar-menu-sub-button`};o=d,r=`a`,i=a(g,p),t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o}else n=t[1],r=t[2],i=t[3],o=t[4];let s;return t[5]!==n||t[6]!==r||t[7]!==i?(s={defaultTagName:r,props:i,render:n},t[5]=n,t[6]=r,t[7]=i,t[8]=s):s=t[8],o(s)}export{G as _,ve as a,L as b,Te as c,Oe as d,De as f,Z as g,pe as h,xe as i,Ce as l,me as m,$ as n,ye as o,le as p,be as r,Se as s,fe as t,Ee as u,W as v,N as y};
2
- //# sourceMappingURL=sidebar-C_Z-zEdU.js.map
1
+ import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{Qu as i,To as a,Zy as o,dr as s,ih as c,js as l,ks as u,mr as d,t as f}from"./utils-CxCThU1r.js";import{R as p,l as m,z as h}from"./TooltipViewport-MMBPNW3u.js";import{a as g,n as _,t as v}from"./tooltip-QdplMyeY.js";import{t as y}from"./input-DTnuNfU_.js";import{t as b}from"./scroll-area-D1ITiKsD.js";import{c as x,l as S,n as C,o as w,r as T,s as E,t as D,u as O}from"./DialogTitle-9BKGozK3.js";import{t as k}from"./useResizeDrag-CWrW8GV3.js";var A=e(t(),1),j=n(),M=e(r(),1),N=T,P=w;function F(e){let t=(0,j.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=f(`fixed inset-0 z-(--z-sheet) bg-background/60 backdrop-blur-xs transition-all duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,M.jsx)(O,{className:i,"data-slot":`sheet-backdrop`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function I(e){let t=(0,j.c)(15),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,side:i,variant:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s=i===`bottom`&&`grid grid-rows-[1fr_auto] pt-12`,c=i===`top`&&`grid grid-rows-[auto_1fr] pb-12`,l=i===`left`&&`flex justify-start`,u=i===`right`&&`flex justify-end`,d=o===`inset`&&`sm:p-4`,p;t[5]!==n||t[6]!==s||t[7]!==c||t[8]!==l||t[9]!==u||t[10]!==d?(p=f(`fixed inset-0 z-(--z-sheet) grid`,s,c,l,u,d,n),t[5]=n,t[6]=s,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=p):p=t[11];let m;return t[12]!==r||t[13]!==p?(m=(0,M.jsx)(C,{className:p,"data-slot":`sheet-viewport`,...r}),t[12]=r,t[13]=p,t[14]=m):m=t[14],m}function L(e){let t=(0,j.c)(42),n,r,i,a,o,l,u,d,p;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],l=t[6],u=t[7],d=t[8],p=t[9]):({className:r,children:n,showCloseButton:o,keepMounted:l,transitionDurationMs:p,side:u,variant:d,style:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=l,t[7]=u,t[8]=d,t[9]=p);let m=o===void 0||o,h=l!==void 0&&l,g=u===void 0?`right`:u,_=d===void 0?`default`:d,v;t[10]===p?v=t[11]:(v=p===void 0?void 0:{transitionDuration:`${p}ms`},t[10]=p,t[11]=v);let y=v,b=p===0,x=b?`transition-none! data-ending-style:opacity-100! data-starting-style:opacity-100!`:void 0,C;t[12]!==x||t[13]!==y?(C=(0,M.jsx)(F,{className:x,style:y}),t[12]=x,t[13]=y,t[14]=C):C=t[14];let w=g===`bottom`&&`row-start-2 border-t data-ending-style:translate-y-8 data-starting-style:translate-y-8`,T=g===`top`&&`data-ending-style:-translate-y-8 data-starting-style:-translate-y-8 border-b`,D=g===`left`&&`data-ending-style:-translate-x-8 data-starting-style:-translate-x-8 w-[calc(100%-(--spacing(12)))] max-w-md border-e`,O=g===`right`&&`col-start-2 w-[calc(100%-(--spacing(12)))] max-w-md border-s data-ending-style:translate-x-8 data-starting-style:translate-x-8`,k=_===`inset`&&`before:hidden sm:rounded-2xl sm:border sm:before:rounded-[calc(var(--radius-2xl)-1px)] sm:**:data-[slot=sheet-footer]:rounded-b-[calc(var(--radius-2xl)-1px)]`,A=b&&`transition-none! will-change-auto! data-ending-style:translate-x-0! data-starting-style:translate-x-0! data-ending-style:translate-y-0! data-starting-style:translate-y-0! data-ending-style:opacity-100! data-starting-style:opacity-100!`,N;t[15]!==r||t[16]!==D||t[17]!==O||t[18]!==k||t[19]!==A||t[20]!==w||t[21]!==T?(N=f(`relative flex max-h-full min-h-0 w-full min-w-0 flex-col bg-popover not-dark:bg-clip-padding text-popover-foreground shadow-lg/5 transition-[opacity,translate] duration-200 ease-in-out will-change-transform before:pointer-events-none before:absolute before:inset-0 before:shadow-[0_1px_--theme(--color-black/4%)] data-ending-style:opacity-0 data-starting-style:opacity-0 max-sm:before:hidden dark:before:shadow-[0_-1px_--theme(--color-white/6%)]`,w,T,D,O,k,A,r),t[15]=r,t[16]=D,t[17]=O,t[18]=k,t[19]=A,t[20]=w,t[21]=T,t[22]=N):N=t[22];let L;t[23]!==a||t[24]!==y?(L={...y,...a},t[23]=a,t[24]=y,t[25]=L):L=t[25];let R;t[26]===m?R=t[27]:(R=m&&(0,M.jsx)(S,{"aria-label":`Close`,className:`absolute end-2 top-2`,render:(0,M.jsx)(s,{size:`icon`,variant:`ghost`}),children:(0,M.jsx)(c,{})}),t[26]=m,t[27]=R);let z;t[28]!==n||t[29]!==i||t[30]!==N||t[31]!==L||t[32]!==R?(z=(0,M.jsxs)(E,{className:N,"data-slot":`sheet-popup`,style:L,...i,children:[n,R]}),t[28]=n,t[29]=i,t[30]=N,t[31]=L,t[32]=R,t[33]=z):z=t[33];let B;t[34]!==g||t[35]!==z||t[36]!==_?(B=(0,M.jsx)(I,{side:g,variant:_,children:z}),t[34]=g,t[35]=z,t[36]=_,t[37]=B):B=t[37];let V;return t[38]!==h||t[39]!==B||t[40]!==C?(V=(0,M.jsxs)(P,{keepMounted:h,children:[C,B]}),t[38]=h,t[39]=B,t[40]=C,t[41]=V):V=t[41],V}function R(e){let t=(0,j.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=f(`flex flex-col gap-2 p-6 in-[[data-slot=sheet-popup]:has([data-slot=sheet-panel])]:pb-3 max-sm:pb-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,M.jsx)(`div`,{className:i,"data-slot":`sheet-header`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function z(e){let t=(0,j.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=f(`font-semibold text-xl leading-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,M.jsx)(D,{className:i,"data-slot":`sheet-title`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function B(e){let t=(0,j.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=f(`text-muted-foreground text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,M.jsx)(x,{className:i,"data-slot":`sheet-description`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var V={"2xl":1536,"3xl":1600,"4xl":2e3,lg:1024,md:768,sm:640,xl:1280};function H(e){return`(min-width: ${typeof e==`number`?e:V[e]}px)`}function U(e){return`(max-width: ${(typeof e==`number`?e:V[e])-1}px)`}function ee(e){if(typeof e!=`string`){let t=[];return e.min!=null&&t.push(H(e.min)),e.max!=null&&t.push(U(e.max)),e.pointer===`coarse`&&t.push(`(pointer: coarse)`),e.pointer===`fine`&&t.push(`(pointer: fine)`),t.length===0?`(min-width: 0px)`:t.join(` and `)}if(e.startsWith(`(`))return e;let t=[];for(let n of e.split(`:`))if(n.startsWith(`max-`)){let e=n.slice(4);e in V&&t.push(U(e))}else n in V&&t.push(H(n));return t.length>0?t.join(` and `):e}function te(){return!1}function W(e){let t=(0,j.c)(6),n;t[0]===e?n=t[1]:(n=ee(e),t[0]=e,t[1]=n);let r=n,i;t[2]===r?i=t[3]:(i=e=>{if(typeof window>`u`)return ne;let t=window.matchMedia(r);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)},t[2]=r,t[3]=i);let a=i,o;return t[4]===r?o=t[5]:(o=()=>typeof window>`u`?!1:window.matchMedia(r).matches,t[4]=r,t[5]=o),(0,A.useSyncExternalStore)(a,o,te)}function ne(){}function G(){return W(`max-md`)}function re(e){return(e.isMobile?e.openMobile:e.open)?`expanded`:`collapsed`}var ie=`sidebar_state`,ae=604800,K=`16rem`,q=`calc(100vw - var(--spacing(3)))`,oe=`3rem`,se=256,J=`max-sm:[--workspace-titlebar-control-size:--spacing(8)]`,Y=A.createContext(null),X=A.createContext(null);function Z(){let e=A.use(Y);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function ce(){let{isMobile:e,open:t,openMobile:n}=Z();return e?n:t}function le(e){let t=(0,j.c)(40),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({defaultOpen:c,open:i,onOpenChange:o,className:r,style:s,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=c===void 0||c,u=G(),[d,p]=A.useState(!1),[m,h]=A.useState(!1),g;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>{h(e!==null)},t[8]=g):g=t[8];let _=g,[v,y]=A.useState(l),b=i??v,x;t[9]!==b||t[10]!==o?(x=async e=>{let t=typeof e==`function`?e(b):e;o?o(t):y(t),await cookieStore.set({expires:Date.now()+ae*1e3,name:ie,path:`/`,value:String(t)})},t[9]=b,t[10]=o,t[11]=x):x=t[11];let S=x,C;t[12]!==u||t[13]!==S?(C=()=>u?p(de):S(ue),t[12]=u,t[13]=S,t[14]=C):C=t[14];let w=C,T;t[15]!==u||t[16]!==b||t[17]!==d?(T=re({isMobile:u,open:b,openMobile:d}),t[15]=u,t[16]=b,t[17]=d,t[18]=T):T=t[18];let E=T,D;t[19]!==u||t[20]!==m||t[21]!==b||t[22]!==d||t[23]!==S||t[24]!==E||t[25]!==w?(D={isMobile:u,open:b,openMobile:d,mobileSheetMounted:m,setMobileSheetElement:_,setOpen:S,setOpenMobile:p,state:E,toggleSidebar:w},t[19]=u,t[20]=m,t[21]=b,t[22]=d,t[23]=S,t[24]=E,t[25]=w,t[26]=D):D=t[26];let O=D,k;t[27]===r?k=t[28]:(k=f(`group/sidebar-wrapper flex min-h-svh w-full`,J,r),t[27]=r,t[28]=k);let N;t[29]===s?N=t[30]:(N={"--sidebar-width":K,"--sidebar-width-icon":oe,"--workspace-titlebar-content-left":`calc(var(--workspace-controls-left) + var(--workspace-titlebar-control-size) + var(--workspace-titlebar-control-gap) + var(--workspace-history-controls-width, 0px))`,...s},t[29]=s,t[30]=N);let P=N,F;t[31]!==n||t[32]!==a||t[33]!==E||t[34]!==k||t[35]!==P?(F=(0,M.jsx)(`div`,{className:k,"data-sidebar-state":E,"data-slot":`sidebar-wrapper`,style:P,...a,children:n}),t[31]=n,t[32]=a,t[33]=E,t[34]=k,t[35]=P,t[36]=F):F=t[36];let I;return t[37]!==O||t[38]!==F?(I=(0,M.jsx)(Y,{value:O,children:F}),t[37]=O,t[38]=F,t[39]=I):I=t[39],I}function ue(e){return!e}function de(e){return!e}function fe(e){let t=(0,j.c)(80),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({side:a,variant:o,collapsible:s,resizable:c,separator:l,className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u=a===void 0?`left`:a,d=o===void 0?`sidebar`:o,p=s===void 0?`offcanvas`:s,m=c!==void 0&&c,h=l===void 0||l,{isMobile:g,state:_,openMobile:v,setOpenMobile:y,setMobileSheetElement:b}=Z(),x;bb0:{if(g||p===`none`||!m){x=null;break bb0}let e;t[9]===m?e=t[10]:(e=typeof m==`boolean`?{}:m,t[9]=m,t[10]=e);let n=e,r=n.maxWidth??1/0,i=n.minWidth??se,a=n.storageKey??null,o;t[11]===n.onResize?o=t[12]:(o=n.onResize?{onResize:n.onResize}:{},t[11]=n.onResize,t[12]=o);let s;t[13]===n.shouldAcceptWidth?s=t[14]:(s=n.shouldAcceptWidth?{shouldAcceptWidth:n.shouldAcceptWidth}:{},t[13]=n.shouldAcceptWidth,t[14]=s);let c;t[15]!==a||t[16]!==o||t[17]!==s||t[18]!==r||t[19]!==i?(c={maxWidth:r,minWidth:i,storageKey:a,...o,...s},t[15]=a,t[16]=o,t[17]=s,t[18]=r,t[19]=i,t[20]=c):c=t[20],x=c}let S=x,C;t[21]!==S||t[22]!==u?(C={side:u,resizable:S},t[21]=S,t[22]=u,t[23]=C):C=t[23];let w=C;if(p===`none`){let e;t[24]===r?e=t[25]:(e=f(`flex h-full w-(--sidebar-width) flex-col bg-sidebar surface-grain text-sidebar-foreground`,r),t[24]=r,t[25]=e);let a;t[26]!==n||t[27]!==i||t[28]!==e?(a=(0,M.jsx)(`div`,{className:e,"data-slot":`sidebar`,...i,children:n}),t[26]=n,t[27]=i,t[28]=e,t[29]=a):a=t[29];let o;return t[30]!==w||t[31]!==a?(o=(0,M.jsx)(X,{value:w,children:a}),t[30]=w,t[31]=a,t[32]=o):o=t[32],o}if(g){let e;t[33]===r?e=t[34]:(e=f(`w-(--sidebar-width) max-w-none bg-sidebar surface-grain p-0 text-sidebar-foreground`,r),t[33]=r,t[34]=e);let a;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(a={"--sidebar-width":q},t[35]=a):a=t[35];let o;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,M.jsxs)(R,{className:`sr-only`,children:[(0,M.jsx)(z,{children:`Sidebar`}),(0,M.jsx)(B,{children:`Displays the mobile sidebar.`})]}),t[36]=o):o=t[36];let s=u===`left`?`pl-safe`:`pr-safe`,c;t[37]===s?c=t[38]:(c=f(`flex h-full w-full flex-col pb-safe pt-safe`,J,s),t[37]=s,t[38]=c);let l;t[39]!==n||t[40]!==i||t[41]!==c?(l=(0,M.jsx)(`div`,{className:c,...i,children:n}),t[39]=n,t[40]=i,t[41]=c,t[42]=l):l=t[42];let d;t[43]!==b||t[44]!==u||t[45]!==l||t[46]!==e?(d=(0,M.jsxs)(L,{ref:b,className:e,"data-mobile":`true`,"data-sidebar":`sidebar`,"data-slot":`sidebar`,showCloseButton:!1,side:u,style:a,children:[o,l]}),t[43]=b,t[44]=u,t[45]=l,t[46]=e,t[47]=d):d=t[47];let p;t[48]!==v||t[49]!==y||t[50]!==d?(p=(0,M.jsx)(N,{onOpenChange:y,open:v,children:d}),t[48]=v,t[49]=y,t[50]=d,t[51]=p):p=t[51];let m;return t[52]!==w||t[53]!==p?(m=(0,M.jsx)(X,{value:w,children:p}),t[52]=w,t[53]=p,t[54]=m):m=t[54],m}let T=_===`collapsed`?p:``,E=d===`floating`||d===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,D;t[55]===E?D=t[56]:(D=f(`relative w-(--sidebar-width) bg-transparent`,`[[data-panel-animations=true]_&]:transition-[width] [[data-panel-animations=true]_&]:[transition-duration:var(--panel-animation-duration)] [[data-panel-animations=true]_&]:ease-out`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,E),t[55]=E,t[56]=D);let O;t[57]===D?O=t[58]:(O=(0,M.jsx)(`div`,{className:D,"data-slot":`sidebar-gap`}),t[57]=D,t[58]=O);let k=u===`left`?`left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]`:`right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]`,A;t[59]!==r||t[60]!==h||t[61]!==k||t[62]!==d?(A=f(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) md:flex`,`[[data-panel-animations=true]_&]:transition-[left,right,width] [[data-panel-animations=true]_&]:[transition-duration:var(--panel-animation-duration)] [[data-panel-animations=true]_&]:ease-out`,k,d===`floating`||d===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:f(`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,h&&`group-data-[side=left]:border-r group-data-[side=right]:border-l`),r),t[59]=r,t[60]=h,t[61]=k,t[62]=d,t[63]=A):A=t[63];let P;t[64]===n?P=t[65]:(P=(0,M.jsx)(`div`,{className:`flex h-full w-full flex-col bg-sidebar surface-grain group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow-sm/5`,"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,children:n}),t[64]=n,t[65]=P);let F;t[66]!==i||t[67]!==A||t[68]!==P?(F=(0,M.jsx)(`div`,{className:A,"data-slot":`sidebar-container`,...i,children:P}),t[66]=i,t[67]=A,t[68]=P,t[69]=F):F=t[69];let I;t[70]!==u||t[71]!==_||t[72]!==O||t[73]!==F||t[74]!==T||t[75]!==d?(I=(0,M.jsxs)(`div`,{className:`group peer hidden text-sidebar-foreground md:block`,"data-collapsible":T,"data-side":u,"data-slot":`sidebar`,"data-state":_,"data-variant":d,children:[O,F]}),t[70]=u,t[71]=_,t[72]=O,t[73]=F,t[74]=T,t[75]=d,t[76]=I):I=t[76];let V;return t[77]!==w||t[78]!==I?(V=(0,M.jsx)(X,{value:w,children:I}),t[77]=w,t[78]=I,t[79]=V):V=t[79],V}function pe(e){let t=(0,j.c)(18),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onClick:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{toggleSidebar:a}=Z(),o=ce(),c;t[4]===n?c=t[5]:(c=f(`size-[var(--workspace-titlebar-control-size)]! [-webkit-app-region:no-drag]`,n),t[4]=n,t[5]=c);let l;t[6]!==r||t[7]!==a?(l=e=>{r?.(e),a()},t[6]=r,t[7]=a,t[8]=l):l=t[8];let u=o?h:p,d;t[9]===u?d=t[10]:(d=(0,M.jsx)(m,{className:`size-4`,icon:u}),t[9]=u,t[10]=d);let g;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,M.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`}),t[11]=g):g=t[11];let _;return t[12]!==o||t[13]!==i||t[14]!==c||t[15]!==l||t[16]!==d?(_=(0,M.jsxs)(s,{className:c,"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,"aria-pressed":o,onClick:l,size:`icon`,variant:`ghost`,...i,children:[d,g]}),t[12]=o,t[13]=i,t[14]=c,t[15]=l,t[16]=d,t[17]=_):_=t[17],_}function Q(e,t){return Math.max(t.minWidth,Math.min(e,t.maxWidth))}function me(e){let t=(0,j.c)(53),n,r,i,a,s,c,d,p;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],s=t[5],c=t[6],d=t[7],p=t[8]):({className:n,onClick:r,onPointerCancel:a,onLostPointerCapture:i,onPointerDown:s,onPointerMove:c,onPointerUp:d,...p}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s,t[6]=c,t[7]=d,t[8]=p);let{open:m,toggleSidebar:h}=Z(),g=A.use(X),_=A.useRef(null),v=A.useRef(!1),y=g?.resizable??null,b=A.useRef(y),x=y!==null&&m?`Resize Sidebar`:`Toggle Sidebar`,S;t[9]!==m||t[10]!==y||t[11]!==g?.side?(S=e=>{if(!y||!m)return null;let t=e.currentTarget,n=t.closest(`[data-slot='sidebar-wrapper']`),r=t.closest(`[data-slot='sidebar']`),i=r?.querySelector(`[data-slot='sidebar-container']`);if(!n||!r||!i)return null;let a=g?.side??`left`,s=Q(i.getBoundingClientRect().width,y),c=[r.querySelector(`[data-slot='sidebar-gap']`),i].filter(_e),u=e=>{c.forEach(t=>{t.style.setProperty(`width`,`${e}px`)})};return c.forEach(ge),u(s),{width:s,edge:a===`left`?`right`:`left`,resize(e){let i=b.current;if(!i)return s;let o=Q(e,i);return(i.shouldAcceptWidth?.({currentWidth:s,nextWidth:o,rail:t,side:a,sidebarRoot:r,wrapper:n})??!0)&&(u(o),s=o),s},finish(e,t){n.style.setProperty(`--sidebar-width`,`${e}px`),v.current=t;let r=b.current;if(r?.storageKey)try{l(r.storageKey,e,o)}catch(e){console.error(`Could not persist sidebar width.`,e)}r?.onResize?.(e)},cleanup(){c.forEach(he)}}},t[9]=m,t[10]=y,t[11]=g?.side,t[12]=S):S=t[12];let C=k(S,String(m)),w;t[13]!==C||t[14]!==y?(w=()=>{b.current=y,C.refresh()},t[13]=C,t[14]=y,t[15]=w):w=t[15];let T;t[16]===y?T=t[17]:(T=[y],t[16]=y,t[17]=T),A.useLayoutEffect(w,T);let E;t[18]!==r||t[19]!==m||t[20]!==y||t[21]!==h?(E=e=>{r?.(e),!e.defaultPrevented&&(v.current?(v.current=!1,e.preventDefault()):y&&m?e.preventDefault():h())},t[18]=r,t[19]=m,t[20]=y,t[21]=h,t[22]=E):E=t[22];let D=E,O,N;t[23]===y?(O=t[24],N=t[25]):(O=()=>{if(!y?.storageKey||typeof window>`u`)return;let e=_.current;if(!e)return;let t=e.closest(`[data-slot='sidebar-wrapper']`);if(!t)return;let n;try{n=u(y.storageKey,o)}catch(e){console.error(`Could not restore persisted sidebar width.`,e);return}if(n===null)return;let r=Q(n,y);t.style.setProperty(`--sidebar-width`,`${r}px`),y.onResize?.(r)},N=[y],t[23]=y,t[24]=O,t[25]=N),A.useLayoutEffect(O,N);let P;t[26]===n?P=t[27]:(P=f(`-translate-x-1/2 group-data-[side=left]:-right-4 absolute inset-y-0 z-20 hidden w-4 after:absolute after:inset-y-0 after:left-1/2 after:w-px after:bg-sidebar-border group-data-[side=right]:left-0 sm:flex [[data-collapsible=offcanvas][data-state=collapsed]_&]:pointer-events-none`,`[[data-panel-animations=true]_&]:transition-all [[data-panel-animations=true]_&]:[transition-duration:var(--panel-animation-duration)] [[data-panel-animations=true]_&]:ease-out`,`in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:after:left-full`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,n),t[26]=n,t[27]=P);let F;t[28]!==i||t[29]!==C?(F=e=>{i?.(e),e.defaultPrevented||C.onLostPointerCapture(e)},t[28]=i,t[29]=C,t[30]=F):F=t[30];let I;t[31]!==a||t[32]!==C?(I=e=>{a?.(e),e.defaultPrevented||C.onPointerCancel(e)},t[31]=a,t[32]=C,t[33]=I):I=t[33];let L;t[34]!==s||t[35]!==C?(L=e=>{s?.(e),e.defaultPrevented||C.onPointerDown(e)},t[34]=s,t[35]=C,t[36]=L):L=t[36];let R;t[37]!==c||t[38]!==C?(R=e=>{c?.(e),e.defaultPrevented||C.onPointerMove(e)},t[37]=c,t[38]=C,t[39]=R):R=t[39];let z;t[40]!==d||t[41]!==C?(z=e=>{d?.(e),e.defaultPrevented||C.onPointerUp(e)},t[40]=d,t[41]=C,t[42]=z):z=t[42];let B;return t[43]!==D||t[44]!==p||t[45]!==x||t[46]!==L||t[47]!==R||t[48]!==z||t[49]!==P||t[50]!==F||t[51]!==I?(B=(0,M.jsx)(`button`,{"aria-label":x,className:P,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,onClick:D,onLostPointerCapture:F,onPointerCancel:I,onPointerDown:L,onPointerMove:R,onPointerUp:z,ref:_,tabIndex:-1,type:`button`,...p}),t[43]=D,t[44]=p,t[45]=x,t[46]=L,t[47]=R,t[48]=z,t[49]=P,t[50]=F,t[51]=I,t[52]=B):B=t[52],B}function he(e){e.style.removeProperty(`width`),e.style.removeProperty(`transition-duration`)}function ge(e){e.style.setProperty(`transition-duration`,`0ms`)}function _e(e){return e!==null}function ve(e){let t=(0,j.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=f(`[&_[data-slot=input]]:h-auto [&_[data-slot=input]]:p-0 [&_[data-slot=input]]:font-medium [&_[data-slot=input]]:text-sidebar-foreground [&_[data-slot=input]]:text-sm [&_[data-slot=input]]:leading-normal [&_[data-slot=input]]:placeholder:text-sidebar-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,M.jsx)(y,{className:i,unstyled:!0,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ye(e){let t=(0,j.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=f(`relative flex min-w-0 w-full flex-1 flex-col bg-background surface-grain`,`md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ms-2 md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ms-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm/5`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,M.jsx)(`main`,{className:i,"data-slot":`sidebar-inset`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function be(e){let t=(0,j.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=f(`flex flex-col gap-2 px-[var(--sidebar-content-inset)] py-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,M.jsx)(`div`,{className:i,"data-sidebar":`footer`,"data-slot":`sidebar-footer`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function $(e){let t=(0,j.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,fixedHeader:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=r?(0,M.jsx)(`div`,{className:`w-full shrink-0`,children:r}):null,t[4]=r,t[5]=a);let o=r&&`[&>[data-sidebar=group]:first-child]:pt-0`,s;t[6]!==n||t[7]!==o?(s=f(`flex w-full min-w-0 flex-col [overflow-anchor:none] group-data-[collapsible=icon]:overflow-hidden [&>[data-sidebar=group]+[data-sidebar=group]]:pt-0`,o,n),t[6]=n,t[7]=o,t[8]=s):s=t[8];let c;t[9]!==i||t[10]!==s?(c=(0,M.jsx)(b,{hideScrollbars:!0,scrollFade:!0,scrollFadePadding:!1,viewportTabIndex:-1,className:`h-auto min-h-0 flex-1 [&>[data-slot=scroll-area-viewport]]:[--fade-size:0.75rem]`,children:(0,M.jsx)(`div`,{className:s,"data-sidebar":`content`,"data-slot":`sidebar-content`,...i})}),t[9]=i,t[10]=s,t[11]=c):c=t[11];let l;return t[12]!==a||t[13]!==c?(l=(0,M.jsxs)(M.Fragment,{children:[a,c]}),t[12]=a,t[13]=c,t[14]=l):l=t[14],l}function xe(e){let t=(0,j.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=f(`relative flex w-full min-w-0 flex-col p-[var(--sidebar-content-inset)]`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,M.jsx)(`div`,{className:i,"data-sidebar":`group`,"data-slot":`sidebar-group`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Se(e){let t=(0,j.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=f(`flex w-full min-w-0 flex-col gap-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,M.jsx)(`ul`,{className:i,"data-sidebar":`menu`,"data-slot":`sidebar-menu`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ce(e){let t=(0,j.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=f(`group/menu-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,M.jsx)(`li`,{className:i,"data-sidebar":`menu-item`,"data-slot":`sidebar-menu-item`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var we=i(`peer/menu-button flex w-full cursor-pointer items-center gap-[var(--sidebar-control-gap)] overflow-hidden text-left outline-hidden ring-ring transition-[width,height,padding] hover:bg-sidebar-row-hover hover:text-sidebar-foreground [[data-sidebar-row]:hover>&]:bg-sidebar-row-hover [[data-sidebar-row]:hover>&]:text-sidebar-foreground [[data-sidebar-row]:hover>&>svg]:text-sidebar-foreground focus-visible:ring-2 focus-visible:ring-inset active:bg-sidebar-row-active active:text-sidebar-foreground disabled:pointer-events-none disabled:opacity-64 aria-disabled:pointer-events-none aria-disabled:opacity-64 data-[active=true]:bg-sidebar-row-selected data-[active=true]:font-medium data-[active=true]:text-sidebar-foreground data-[state=open]:hover:bg-sidebar-row-hover data-[state=open]:hover:text-sidebar-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-[var(--sidebar-content-inset)]! [&>span:last-child]:truncate [&>svg:not([class*='size-'])]:size-4 [&>svg]:shrink-0 [&>svg]:text-[var(--sidebar-icon-color)] hover:[&>svg]:text-sidebar-foreground active:[&>svg]:text-sidebar-foreground data-[active=true]:[&>svg]:text-sidebar-foreground`,{defaultVariants:{size:`default`,variant:`default`},variants:{size:{default:`h-8 rounded-[var(--control-radius)] px-[var(--sidebar-row-content-inset)] py-1.5 text-sm`,icon:`size-8 justify-center rounded-[var(--control-radius)] p-0`,lg:`h-12 rounded-lg p-2 text-sm group-data-[collapsible=icon]:p-0!`,sm:`h-7 rounded-lg p-2 text-xs`},variant:{default:`font-medium text-sidebar-foreground`,outline:`bg-sidebar-control-surface ring-1 ring-sidebar-border`,project:`font-normal text-sidebar-muted-foreground`,settings:`h-9 gap-2.5 rounded-xl px-3 font-normal text-sidebar-foreground data-[active=true]:font-normal [&>svg:not([class*='size-'])]:size-4.5 [&>svg]:text-sidebar-foreground`}}});function Te(e){let t=(0,j.c)(13),{isActive:n,variant:r,size:i,tooltip:o,className:s,render:c,...l}=e,u=n!==void 0&&n,p=r===void 0?`default`:r,m=i===void 0?`default`:i,{isMobile:h,state:y}=Z(),b={className:f(we({size:m,variant:p}),s),"data-active":u,"data-sidebar":`menu-button`,"data-size":m,"data-slot":`sidebar-menu-button`},x=a(b,l),S;t[0]!==x||t[1]!==c?(S={defaultTagName:`button`,props:x,render:c},t[0]=x,t[1]=c,t[2]=S):S=t[2];let C=d(S);if(!o)return C;if(typeof o==`string`){let e;t[3]===o?e=t[4]:(e={children:o},t[3]=o,t[4]=e),o=e}let w=C,T;t[5]===w?T=t[6]:(T=(0,M.jsx)(g,{render:w}),t[5]=w,t[6]=T);let E=y!==`collapsed`||h,D;t[7]!==E||t[8]!==o?(D=(0,M.jsx)(_,{align:`center`,hidden:E,side:`right`,...o}),t[7]=E,t[8]=o,t[9]=D):D=t[9];let O;return t[10]!==T||t[11]!==D?(O=(0,M.jsxs)(v,{children:[T,D]}),t[10]=T,t[11]=D,t[12]=O):O=t[12],O}function Ee(e){let t=(0,j.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=(i===void 0?`tree`:i)===`flat`?`gap-0.5`:`mx-3.5 translate-x-px gap-1 border-sidebar-border border-l px-2.5 py-0.5`,o;t[4]!==n||t[5]!==a?(o=f(`flex min-w-0 flex-col`,a,`group-data-[collapsible=icon]:hidden`,n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o?(s=(0,M.jsx)(`ul`,{className:o,"data-sidebar":`menu-sub`,"data-slot":`sidebar-menu-sub`,...r}),t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function De(e){let t=(0,j.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=f(`group/menu-sub-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,M.jsx)(`li`,{className:i,"data-sidebar":`menu-sub-item`,"data-slot":`sidebar-menu-sub-item`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Oe(e){let t=(0,j.c)(9),n,r,i,o;if(t[0]!==e){let{size:s,isActive:c,className:l,render:u,...p}=e;n=u;let m=s===void 0?`md`:s,h=c!==void 0&&c,g={className:f(`-translate-x-px flex h-7 min-w-0 cursor-pointer items-center gap-2 overflow-hidden rounded-lg px-2 text-sidebar-foreground outline-hidden ring-ring hover:bg-sidebar-row-hover hover:text-sidebar-foreground focus-visible:ring-2 focus-visible:ring-inset active:bg-sidebar-row-active active:text-sidebar-foreground disabled:pointer-events-none disabled:opacity-64 aria-disabled:pointer-events-none aria-disabled:opacity-64 [&>span:last-child]:truncate [&>svg:not([class*='size-'])]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-foreground`,`data-[active=true]:bg-sidebar-row-selected data-[active=true]:text-sidebar-foreground`,m===`sm`&&`text-xs`,m===`md`&&`text-sm`,`group-data-[collapsible=icon]:hidden`,l),"data-active":h,"data-sidebar":`menu-sub-button`,"data-size":m,"data-slot":`sidebar-menu-sub-button`};o=d,r=`a`,i=a(g,p),t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o}else n=t[1],r=t[2],i=t[3],o=t[4];let s;return t[5]!==n||t[6]!==r||t[7]!==i?(s={defaultTagName:r,props:i,render:n},t[5]=n,t[6]=r,t[7]=i,t[8]=s):s=t[8],o(s)}export{G as _,ve as a,L as b,Te as c,Oe as d,De as f,Z as g,pe as h,xe as i,Ce as l,me as m,$ as n,ye as o,le as p,be as r,Se as s,fe as t,Ee as u,W as v,N as y};
2
+ //# sourceMappingURL=sidebar-DRWJdn3r.js.map