@p4code/cli 0.9.12 → 0.9.14

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 (336) hide show
  1. package/dist/AcpMcpStdioBridge-BinVfs5k.mjs +3 -0
  2. package/dist/{AcpMcpStdioBridge-DGUY2q8q.mjs → AcpMcpStdioBridge-z_p02VlR.mjs} +3 -3
  3. package/dist/{Effect-Cus50zSB.mjs → Effect-Bwkv2ifD.mjs} +25 -2
  4. package/dist/{Schema-B1iWvOKX.mjs → Schema-CFgoTmE6.mjs} +2 -2
  5. package/dist/{Stream-XZd8srjf.mjs → Stream-B4Gds95A.mjs} +2 -2
  6. package/dist/bin.mjs +2 -2
  7. package/dist/{binCli-D9zhTalS.mjs → binCli-BGRfVnO9.mjs} +4969 -3690
  8. package/dist/claude-history-worker.mjs +1 -1
  9. package/dist/{claudeHistoryWorker-Ew_jxLJH.mjs → claudeHistoryWorker-DVpahhef.mjs} +2 -2
  10. package/dist/client/.vite/manifest.json +2136 -2095
  11. package/dist/client/assets/{2NI2N5EU-DOvURDwM.js → 2NI2N5EU-Bk2qNhha.js} +2 -2
  12. package/dist/client/assets/{4UO7MD6I-CArKQR6u.js → 4UO7MD6I-CPV9277r.js} +2 -2
  13. package/dist/client/assets/{5B3SVYGG-D3yJKYTq.js → 5B3SVYGG-LgRjxbnj.js} +2 -2
  14. package/dist/client/assets/{5GK6JWQ2-C7D6qJvm.js → 5GK6JWQ2-9ndiKpIs.js} +2 -2
  15. package/dist/client/assets/{5N7A7DKN-DDTV444t.js → 5N7A7DKN-DnUhiayz.js} +2 -2
  16. package/dist/client/assets/{5OC2THR4-CYaAiBA5.js → 5OC2THR4-DxmpZihk.js} +2 -2
  17. package/dist/client/assets/{5S6HY5KT-jYzQX9YI.js → 5S6HY5KT-C4cUz8RB.js} +2 -2
  18. package/dist/client/assets/{6IMQ5BUJ-CZSZgyOb.js → 6IMQ5BUJ-2G8Rrp9t.js} +2 -2
  19. package/dist/client/assets/{6OLKWJ4F-D_TpeHsd.js → 6OLKWJ4F-CW3F_AM6.js} +2 -2
  20. package/dist/client/assets/{74OO7NKP-VJq-BY7c.js → 74OO7NKP-z5ujM5KH.js} +2 -2
  21. package/dist/client/assets/{75O6YZUN-BCik3Y9V.js → 75O6YZUN-CSeaYNtt.js} +2 -2
  22. package/dist/client/assets/{77XECAW3-Ce_-nZaY.js → 77XECAW3-DxL0AHyZ.js} +2 -2
  23. package/dist/client/assets/{ABYRPUBD-C1hL61qL.js → ABYRPUBD-DvBcJj7G.js} +2 -2
  24. package/dist/client/assets/AlertDialogRoot-z7O2CaB2.js +2 -0
  25. package/dist/client/assets/{AnimatedHeight-DEeywxgS.js → AnimatedHeight-DChvigzz.js} +2 -2
  26. package/dist/client/assets/{AuthSurfaceShell-835o12nS.js → AuthSurfaceShell-29ykag3m.js} +2 -2
  27. package/dist/client/assets/{BB2UYUI2-DlIE2g50.js → BB2UYUI2-Cun87LIm.js} +2 -2
  28. package/dist/client/assets/{BUM34MOA-D9NQPxww.js → BUM34MOA-D6aIFnwf.js} +2 -2
  29. package/dist/client/assets/{CEQABKGZ-BsiY6pPC.js → CEQABKGZ-DYzEk-9p.js} +2 -2
  30. package/dist/client/assets/{CXAC5362-t7YfF0UQ.js → CXAC5362-CdQgNtpk.js} +2 -2
  31. package/dist/client/assets/ChatGptUsageButton-DQjnXjt6.js +2 -0
  32. package/dist/client/assets/ChatMarkdown-C7ocX514.js +48 -0
  33. package/dist/client/assets/{CheckboxIndicator-XdXpYxXy.js → CheckboxIndicator-D2jNOqVc.js} +2 -2
  34. package/dist/client/assets/{ClippedText-C-unQqBz.js → ClippedText-CDOkzr7r.js} +2 -2
  35. package/dist/client/assets/{CodexSetupSection.logic-Bl5OcEqH.js → CodexSetupSection.logic-BIpypa3y.js} +2 -2
  36. package/dist/client/assets/{ComboboxClear-CBRGIQSm.js → ComboboxClear-CPvB2whi.js} +2 -2
  37. package/dist/client/assets/{ComboboxGroupLabel-DVAwRoGV.js → ComboboxGroupLabel-DN75A_2f.js} +2 -2
  38. package/dist/client/assets/{CommandBlock-D6NTupaO.js → CommandBlock-DBGDwDRu.js} +2 -2
  39. package/dist/client/assets/{CompositeRoot-DBS-Yo_S.js → CompositeRoot-Jf3zEGLN.js} +2 -2
  40. package/dist/client/assets/{ConnectAgentSurface-TBgGDnVI.js → ConnectAgentSurface-Cv2oB5Cw.js} +2 -2
  41. package/dist/client/assets/{ConnectionStatusDot-CR_qWdCU.js → ConnectionStatusDot-C_9jtSee.js} +2 -2
  42. package/dist/client/assets/{DRLTVNUE-DkTzG_pM.js → DRLTVNUE-CftE6Aa3.js} +2 -2
  43. package/dist/client/assets/{DYY6UVD2-BBRUtn6A.js → DYY6UVD2-DezK9sBO.js} +2 -2
  44. package/dist/client/assets/DevicePanel-CKWUjHEE.js +2 -0
  45. package/dist/client/assets/DeviceSetup-BrOsu1Y4.js +2 -0
  46. package/dist/client/assets/{DialogTitle-DzoEjZ6h.js → DialogTitle-COHuuWBE.js} +2 -2
  47. package/dist/client/assets/{DiffCommentAnnotation-y1CrEDvy.js → DiffCommentAnnotation-QtrnUuSs.js} +2 -2
  48. package/dist/client/assets/{DiffFileTree-BM7RDTEn.js → DiffFileTree-B_4bn5J8.js} +2 -2
  49. package/dist/client/assets/DiffPanel-CGIIHSDI.js +2 -0
  50. package/dist/client/assets/{DiffWorkerPoolProvider-D2t5zRbN.js → DiffWorkerPoolProvider-CtpHksSf.js} +3 -3
  51. package/dist/client/assets/{EmbeddedDesign-_id3IQO6.js → EmbeddedDesign-BU5m6_ou.js} +5 -5
  52. package/dist/client/assets/{EnvironmentMachineIcon-oObSi9GI.js → EnvironmentMachineIcon-DTUBsEaI.js} +2 -2
  53. package/dist/client/assets/{ExpandableText-BLwIQ2BJ.js → ExpandableText-Wij8nL6W.js} +2 -2
  54. package/dist/client/assets/{FNOVOB4O-B469NSHv.js → FNOVOB4O-DHCmE6LN.js} +2 -2
  55. package/dist/client/assets/{FieldControl-Btl-j-6W.js → FieldControl-Yp1Yjlg7.js} +2 -2
  56. package/dist/client/assets/{FileDiff-CGLKzg3V.js → FileDiff-CAtJtUC5.js} +2 -2
  57. package/dist/client/assets/FilePreviewPanel-CjKP3Q7G.js +34 -0
  58. package/dist/client/assets/{FoldedSettingsSection-DPTJODig.js → FoldedSettingsSection-CAZumPht.js} +2 -2
  59. package/dist/client/assets/{FormContext-Be16jmaZ.js → FormContext-BEFZtJu9.js} +2 -2
  60. package/dist/client/assets/{HDGCDEEZ-BUMQl9WF.js → HDGCDEEZ-DNHIctoG.js} +2 -2
  61. package/dist/client/assets/{HSJLKHB7-C08sJAK2.js → HSJLKHB7-BfNhUjhw.js} +2 -2
  62. package/dist/client/assets/{Icons-2l7Ym4KO.js → Icons-DYaY7Otq.js} +2 -2
  63. package/dist/client/assets/Input-CVeLgfX4.js +2 -0
  64. package/dist/client/assets/JZOYTAAL-Bngs0npp.js +1 -0
  65. package/dist/client/assets/{K3MD6TGW-D4RWgVJJ.js → K3MD6TGW-D-q4Z_68.js} +2 -2
  66. package/dist/client/assets/{K7RP3OMA-B8UDebPA.js → K7RP3OMA-C5AEGeo9.js} +2 -2
  67. package/dist/client/assets/{KeybindingsSettings.logic-CCfOv-KZ.js → KeybindingsSettings.logic-A_266dBm.js} +2 -2
  68. package/dist/client/assets/{LHDIQX7Q-DwRY1EjH.js → LHDIQX7Q-CY4nmSyZ.js} +2 -2
  69. package/dist/client/assets/{LUXOKEGN-BTGUp3oJ.js → LUXOKEGN-BHmzrQMD.js} +2 -2
  70. package/dist/client/assets/{LinkMachineSelect-DoHeQGoj.js → LinkMachineSelect-tm04n5mK.js} +2 -2
  71. package/dist/client/assets/{MathTypeset-DZCUnfpK.js → MathTypeset-C1sAcsZE.js} +2 -2
  72. package/dist/client/assets/{N3JZAHOW-C-bkdj1S.js → N3JZAHOW-D1VvHXNc.js} +2 -2
  73. package/dist/client/assets/{NUIALGQ3-COfmKsf1.js → NUIALGQ3-DKQw5Xvm.js} +2 -2
  74. package/dist/client/assets/{NoProjectsHero-CbIPjHEJ.js → NoProjectsHero-DVJOMY01.js} +2 -2
  75. package/dist/client/assets/{O65XPQGZ-BPK2EL3_.js → O65XPQGZ-B7xlpxd0.js} +2 -2
  76. package/dist/client/assets/{O7XIQ6OM-qzVUZXbW.js → O7XIQ6OM-D_yohKEz.js} +2 -2
  77. package/dist/client/assets/{OFQON5FD-DJVnaZou.js → OFQON5FD-Eb1UafMJ.js} +2 -2
  78. package/dist/client/assets/{P4ConnectAccountPages-DwBbHN5Q.js → P4ConnectAccountPages-BkOCG7hq.js} +2 -2
  79. package/dist/client/assets/{P4ConnectSidebarSignIn-D7VczA30.js → P4ConnectSidebarSignIn-BarFXVdD.js} +2 -2
  80. package/dist/client/assets/{PJQHF43J-CTXALHLE.js → PJQHF43J-xu8MNrTl.js} +2 -2
  81. package/dist/client/assets/PanelLayoutControls-amKHUz1V.js +216 -0
  82. package/dist/client/assets/{PierreEntryIcon-CUoKY0yE.js → PierreEntryIcon-CbhCWTjd.js} +2 -2
  83. package/dist/client/assets/{PopoverHandle-tRSwNzqr.js → PopoverHandle-DbGxLy3d.js} +2 -2
  84. package/dist/client/assets/PreviewPanel-B1KmgL5R.js +2 -0
  85. package/dist/client/assets/ProjectDefaultsSettings-D_2ixmme.js +2 -0
  86. package/dist/client/assets/{ProjectFavicon-in-OyDkg.js → ProjectFavicon-BXd2O1Gh.js} +3 -3
  87. package/dist/client/assets/{ProjectIconPickerDialog-JCPOaZup.js → ProjectIconPickerDialog-Ccwf3eo1.js} +2 -2
  88. package/dist/client/assets/{ProjectMonogram-DdbScW3Y.js → ProjectMonogram-Bui44V7z.js} +2 -2
  89. package/dist/client/assets/{ProviderAuthTerminal-CCw2XmNz.js → ProviderAuthTerminal-DjIpg2-V.js} +2 -2
  90. package/dist/client/assets/ProviderModelPicker-DJl5IM1n.js +2 -0
  91. package/dist/client/assets/{ProviderSettingsForm-_viBEB9w.js → ProviderSettingsForm-sjzQFb8p.js} +2 -2
  92. package/dist/client/assets/PullRequestCodeTab-BcFFbURH.js +6 -0
  93. package/dist/client/assets/{RHNBAITX-BR5h8H8U.js → RHNBAITX-DWaFNhmX.js} +2 -2
  94. package/dist/client/assets/ReadOnlySourcePreview-DDDARz8g.js +2 -0
  95. package/dist/client/assets/{RedactedSensitiveText-DM7Kme26.js → RedactedSensitiveText-BFwVjGRJ.js} +2 -2
  96. package/dist/client/assets/{RenderErrorBoundary-BeYcnW7D.js → RenderErrorBoundary-DianZAsM.js} +4 -4
  97. package/dist/client/assets/RightPanelResizeHandle-DstJn39I.js +2 -0
  98. package/dist/client/assets/{SLD4V6NK-DfUtjUb_.js → SLD4V6NK-kuRIO20K.js} +2 -2
  99. package/dist/client/assets/ScheduledTasksSettings-BHT9WAFD.js +6 -0
  100. package/dist/client/assets/{ScopedSwitch-CD9C3Bhs.js → ScopedSwitch-B7HEwool.js} +2 -2
  101. package/dist/client/assets/{ScrollAreaCorner-D5JbJL5g.js → ScrollAreaCorner-DW6lxPPn.js} +2 -2
  102. package/dist/client/assets/{SecretInput-ttyiYbVY.js → SecretInput-CxRazSuj.js} +2 -2
  103. package/dist/client/assets/{SelectScrollUpArrow-BV1xykNQ.js → SelectScrollUpArrow-DZfqWvZD.js} +2 -2
  104. package/dist/client/assets/SelfImproveSettingsSection-BxPUr-AT.js +2 -0
  105. package/dist/client/assets/SettingsPanels-CrMsCqvq.js +46 -0
  106. package/dist/client/assets/{SettingsPanels.logic-DS-Semyc.js → SettingsPanels.logic-B406HX50.js} +2 -2
  107. package/dist/client/assets/{SettingsScopeNotice--a-aNSRR.js → SettingsScopeNotice-Dt7vuLO5.js} +2 -2
  108. package/dist/client/assets/{SidebarStageBackdrop-ntSLLOvm.js → SidebarStageBackdrop-BzsUCj2G.js} +2 -2
  109. package/dist/client/assets/{T3PCR2KE-C5JeZecU.js → T3PCR2KE-C14xVwSj.js} +2 -2
  110. package/dist/client/assets/{TKWO2OVW-B11aaxW8.js → TKWO2OVW-CC_4uZad.js} +2 -2
  111. package/dist/client/assets/{TSHNXIZL-2800Jt5F.js → TSHNXIZL-Kizqv5oh.js} +2 -2
  112. package/dist/client/assets/{ThemeEditorPanel-CTXEQSgi.js → ThemeEditorPanel-BuMI6s2A.js} +3 -3
  113. package/dist/client/assets/{ComposerPromptEditor-BqLNVkse.js → ThreadDetailsItemsMenu-CSCIFtTP.js} +60 -60
  114. package/dist/client/assets/ThreadTerminalDrawer-FZ0zyNm1.js +5 -0
  115. package/dist/client/assets/TooltipViewport-DjveMpIl.js +2 -0
  116. package/dist/client/assets/{UQJE5E4I-BG1U9EIM.js → UQJE5E4I-KUX5qtvS.js} +2 -2
  117. package/dist/client/assets/{USNYFO5S-d4iGw5HU.js → USNYFO5S-XMF6TRXj.js} +2 -2
  118. package/dist/client/assets/{Virtualizer-CzClYBap.js → Virtualizer-CqFZ9IgG.js} +2 -2
  119. package/dist/client/assets/{WEVWDWVA-V2MwjUCO.js → WEVWDWVA-BNUvxLQd.js} +2 -2
  120. package/dist/client/assets/{WorkspaceBreadcrumb-Dpau2BKr.js → WorkspaceBreadcrumb-DyZsM9TF.js} +2 -2
  121. package/dist/client/assets/{WorkspacePageContainer-C3u06BW-.js → WorkspacePageContainer-DFXSkFyh.js} +2 -2
  122. package/dist/client/assets/{WorkspacePageHeader-MBEFb20_.js → WorkspacePageHeader-FTc6UfB-.js} +2 -2
  123. package/dist/client/assets/{X5RFHQXM-D_mIa6o9.js → X5RFHQXM-BtifjFQb.js} +2 -2
  124. package/dist/client/assets/{X62E3GBT-Cwvyi_iR.js → X62E3GBT-DT_qCIPw.js} +2 -2
  125. package/dist/client/assets/{XBNEOJTC-sfA1U_fe.js → XBNEOJTC-7FdMX9IP.js} +2 -2
  126. package/dist/client/assets/{YHV2MVVZ-CZoP6AAo.js → YHV2MVVZ-D6KCo9Qp.js} +2 -2
  127. package/dist/client/assets/{YURCZMG2-DYo6rqon.js → YURCZMG2-D0_CST6F.js} +2 -2
  128. package/dist/client/assets/{YVG2LODB-D8sTsTwc.js → YVG2LODB-CRU4fKD2.js} +2 -2
  129. package/dist/client/assets/_chat-P2jEGe91.js +47 -0
  130. package/dist/client/assets/{_chat.design-Nh4vxHDS.js → _chat.design-k56_YrCY.js} +2 -2
  131. package/dist/client/assets/{_chat.index-YNITFXX3.js → _chat.index-CUR_1FMo.js} +2 -2
  132. package/dist/client/assets/{_chat.new-B16PAbQN.js → _chat.new-7EgBpaGD.js} +2 -2
  133. package/dist/client/assets/_chat.pull-requests-C97pdH91.js +2 -0
  134. package/dist/client/assets/{alert-UH7IbYie.js → alert-D0u2-4Zh.js} +2 -2
  135. package/dist/client/assets/{alert-dialog-D3mCT6Vy.js → alert-dialog-DK40IDMO.js} +2 -2
  136. package/dist/client/assets/{assetUrls-BNjjSBLP.js → assetUrls-ChygJppW.js} +2 -2
  137. package/dist/client/assets/assets-Cv1qxio9.js +2 -0
  138. package/dist/client/assets/{browserHistoryStore-CW_ylkPy.js → browserHistoryStore-PB9BBl0N.js} +2 -2
  139. package/dist/client/assets/{browserLinkTarget-Dlnk6CC2.js → browserLinkTarget-BOF3rlV5.js} +2 -2
  140. package/dist/client/assets/{checkbox-Bqcsvpsf.js → checkbox-bsJs8Zu-.js} +2 -2
  141. package/dist/client/assets/{color-picker-DAcpRn0k.js → color-picker-W4KTEgfL.js} +2 -2
  142. package/dist/client/assets/{combobox-CoLp0McG.js → combobox-UDn50qHb.js} +2 -2
  143. package/dist/client/assets/{command-cKnhWwdw.js → command-C7CgDZ25.js} +2 -2
  144. package/dist/client/assets/{connect-rbXRyqde.js → connect-CguaBRtJ.js} +2 -2
  145. package/dist/client/assets/connect-agent-BitywHYq.js +2 -0
  146. package/dist/client/assets/{design-BJbd-4a9.js → design-NrL4Xyzh.js} +2 -2
  147. package/dist/client/assets/device-DsIsK_g9.js +2 -0
  148. package/dist/client/assets/{dialog-CjB1WWbE.js → dialog-BEXthTAp.js} +2 -2
  149. package/dist/client/assets/{diffRendering-JsGpyVJ1.js → diffRendering-DosiBwUN.js} +2 -2
  150. package/dist/client/assets/{dist-D4GndTOF.js → dist-p5OtQFc9.js} +3 -3
  151. package/dist/client/assets/{draft-input-1ySc55QI.js → draft-input-Cp7zSsLs.js} +2 -2
  152. package/dist/client/assets/{duoViewer-DvlUJy5A.js → duoViewer-BcsodgGy.js} +2 -2
  153. package/dist/client/assets/{dynamic-B8PD-aHj.js → dynamic-XOmtS0-B.js} +3 -3
  154. package/dist/client/assets/{embeddedScripts-ByokzHX1.js → embeddedScripts-BQl_ld6u.js} +2 -2
  155. package/dist/client/assets/{empty-CMnFXg8W.js → empty-CTv2Unxd.js} +2 -2
  156. package/dist/client/assets/entities-Ci9sZwRJ.js +2 -0
  157. package/dist/client/assets/env-BfPir1X4.js +2 -0
  158. package/dist/client/assets/{fileLinks-lUzqPrjb.js → fileLinks-T2ko6Qmp.js} +2 -2
  159. package/dist/client/assets/{fileTreeExpansion-B6sjoSXU.js → fileTreeExpansion-BOutPxUH.js} +2 -2
  160. package/dist/client/assets/{getDiffFileInput-Bt5vSiss.js → getDiffFileInput-Do7OSxYn.js} +2 -2
  161. package/dist/client/assets/{guideRunStore-DFawhaj_.js → guideRunStore-DGAK_XSV.js} +2 -2
  162. package/dist/client/assets/{htmlRender-DJLbbd4O.js → htmlRender-DAhG7IlW.js} +2 -2
  163. package/dist/client/assets/index-4XHdM2Yx.js +3 -0
  164. package/dist/client/assets/{input-CSgYZgdv.js → input-BGKmQVHf.js} +2 -2
  165. package/dist/client/assets/{input-group-a-sGQMiV.js → input-group-BdgWY0OZ.js} +2 -2
  166. package/dist/client/assets/{kbd-D3uRVBMx.js → kbd-BIypvknl.js} +2 -2
  167. package/dist/client/assets/key-round-POn1aRXW.js +2 -0
  168. package/dist/client/assets/{keybindings-B9X0TLvu.js → keybindings-C0ntbKmL.js} +2 -2
  169. package/dist/client/assets/{lazy-C_hQh3dP.js → lazy-DudfZwDr.js} +4 -4
  170. package/dist/client/assets/{lazyRouteComponent-GMfIUG8o.js → lazyRouteComponent-VtherrNw.js} +2 -2
  171. package/dist/client/assets/{link-BmkuqfGQ.js → link--eZ8ZXuK.js} +2 -2
  172. package/dist/client/assets/{linkedPrompt-BNxBPorU.js → linkedPrompt-DRNVlalr.js} +2 -2
  173. package/dist/client/assets/main-CKOKCTSr.css +2 -0
  174. package/dist/client/assets/main-CRJyb41E.js +37 -0
  175. package/dist/client/assets/{mediaReference-CVS-Yvam.js → mediaReference-CMwg4kE3.js} +2 -2
  176. package/dist/client/assets/mediaSource-BQpgJ9hG.js +2 -0
  177. package/dist/client/assets/number-field-pjPmm2hH.js +2 -0
  178. package/dist/client/assets/{observeResize-Br7VOcTc.js → observeResize-CV41SgJr.js} +2 -2
  179. package/dist/client/assets/{onboarding-D6kvYnD1.js → onboarding-C7BynXti.js} +2 -2
  180. package/dist/client/assets/openFileInPreview-Cs7GoIEO.js +2 -0
  181. package/dist/client/assets/{p4ProjectFile-B1qTw64E.js → p4ProjectFile-DqqWNGdD.js} +2 -2
  182. package/dist/client/assets/{pair-Das8G2kV.js → pair-Wl7C9P9c.js} +2 -2
  183. package/dist/client/assets/{pendingSendStore-B1MXHU-Y.js → pendingSendStore-CFKdq-QP.js} +2 -2
  184. package/dist/client/assets/{phoneViewer-iWL9Ocv_.js → phoneViewer-C1sFfV5x.js} +2 -2
  185. package/dist/client/assets/{pierre-icons-CyZxWykW.js → pierre-icons-2mAt8csu.js} +2 -2
  186. package/dist/client/assets/{popover-Cpc0L75h.js → popover-oNrAhEOs.js} +2 -2
  187. package/dist/client/assets/{preview-DRZGCh-w.js → preview-CAzlFJXG.js} +2 -2
  188. package/dist/client/assets/{preview-CDQ5ceMi.js → preview-D8H2Itzr.js} +2 -2
  189. package/dist/client/assets/{previewMiniPlayerStore-Dd2KfilQ.js → previewMiniPlayerStore-DwJUVJAq.js} +2 -2
  190. package/dist/client/assets/primary-BdVzsWIK.js +2 -0
  191. package/dist/client/assets/primaryCloudLinkState-eu2avrjG.js +2 -0
  192. package/dist/client/assets/projectFilesQueryState-f8odJKc-.js +2 -0
  193. package/dist/client/assets/{projectScriptEditor-lOSI5meb.js → projectScriptEditor-D8Os7g21.js} +2 -2
  194. package/dist/client/assets/{providerSkills-CRmME5qO.js → providerSkills-B9Q5OmXk.js} +2 -2
  195. package/dist/client/assets/{pullRequestDetail.logic-CXEtJJcn.js → pullRequestDetail.logic-CVJbFct1.js} +4 -4
  196. package/dist/client/assets/{pullRequestIcons-D8Koo716.js → pullRequestIcons-ZE5MB0dW.js} +2 -2
  197. package/dist/client/assets/{pullRequestReviewStore-CpLjLBJR.js → pullRequestReviewStore-CF0UmQoG.js} +2 -2
  198. package/dist/client/assets/pullRequests-p7FMtHTx.js +2 -0
  199. package/dist/client/assets/queries-C1_RUJ-8.js +2 -0
  200. package/dist/client/assets/query-DszcgUku.js +2 -0
  201. package/dist/client/assets/{radio-group-DpxVKrML.js → radio-group-Cb2KobOI.js} +2 -2
  202. package/dist/client/assets/{renderScheduler-B1rJHKDM.js → renderScheduler-BLYWx2Dl.js} +2 -2
  203. package/dist/client/assets/rightPanelStore-BzpX6F8n.js +2 -0
  204. package/dist/client/assets/runtime-CcgzOADx.js +6 -0
  205. package/dist/client/assets/runtime-D2NRh41I.js +3 -0
  206. package/dist/client/assets/{runtimeModeConfig-CZCsG9b4.js → runtimeModeConfig-DTaQ5JjA.js} +2 -2
  207. package/dist/client/assets/{scheduledTasksSettings.logic-gN3n5v-e.js → scheduledTasksSettings.logic-FST8Bc6V.js} +3 -3
  208. package/dist/client/assets/{scroll-area-C9Jh_pl0.js → scroll-area-BN4-XX3T.js} +2 -2
  209. package/dist/client/assets/{select-oshTwPZM.js → select-CHOl11x1.js} +2 -2
  210. package/dist/client/assets/selfImproveFindings-BTdfhZ3z.js +2 -0
  211. package/dist/client/assets/server-C-cSQN_G.js +2 -0
  212. package/dist/client/assets/{session-Bb7JWdWO.js → session-D6BRf77P.js} +2 -2
  213. package/dist/client/assets/{session-logic-D0Wb0fc2.js → session-logic-BwAELIPU.js} +5 -5
  214. package/dist/client/assets/{settings-CQtFOh_t.js → settings-fuKhbSed.js} +2 -2
  215. package/dist/client/assets/{settings.appearance-CqHPJVJ2.js → settings.appearance-K-0McYk9.js} +2 -2
  216. package/dist/client/assets/settings.archived-CalSrYkZ.js +2 -0
  217. package/dist/client/assets/{settings.computer-use-CDrWkvkD.js → settings.computer-use-C8dDJqmo.js} +2 -2
  218. package/dist/client/assets/settings.connections-D_XSkcFH.js +2 -0
  219. package/dist/client/assets/{settings.data-controls-Bd79f82M.js → settings.data-controls-CTlXbRrO.js} +2 -2
  220. package/dist/client/assets/{settings.decisions-B-i781li.js → settings.decisions-C1RgAwXn.js} +2 -2
  221. package/dist/client/assets/{settings.designs-DpX9xXFH.js → settings.designs-BgEqEGXM.js} +2 -2
  222. package/dist/client/assets/settings.diagnostics-BxqI_9bx.js +2 -0
  223. package/dist/client/assets/{settings.general-6bgZAoM7.js → settings.general-BeLPMggF.js} +2 -2
  224. package/dist/client/assets/settings.integrations-4rKfTDFW.js +2 -0
  225. package/dist/client/assets/{settings.keybindings-DzB2I9OY.js → settings.keybindings-DSavoJxs.js} +2 -2
  226. package/dist/client/assets/{settings.open-source-licenses-C-RX63iR.js → settings.open-source-licenses-DWVgu9MJ.js} +2 -2
  227. package/dist/client/assets/{settings.plugins-CqpVlMrk.js → settings.plugins-DsfEfMST.js} +4 -4
  228. package/dist/client/assets/settings.projects-CJzRAMVM.js +4 -0
  229. package/dist/client/assets/settings.providers-BoTCdGuy.js +3 -0
  230. package/dist/client/assets/{settings.scheduled-tasks-Ca4XxyAg.js → settings.scheduled-tasks-BJMUub-y.js} +2 -2
  231. package/dist/client/assets/settings.secrets-Ch_XS6ak.js +2 -0
  232. package/dist/client/assets/{settings.snap-shot-BkSOnsJ3.js → settings.snap-shot-6aF3J4Zd.js} +2 -2
  233. package/dist/client/assets/{settings.source-control-uZ0ges0j.js → settings.source-control-B7PW3yi5.js} +2 -2
  234. package/dist/client/assets/{settings.storage-BkURtSS0.js → settings.storage-PmxiGFaE.js} +2 -2
  235. package/dist/client/assets/settingsLayout-fG812pJ2.js +3 -0
  236. package/dist/client/assets/{sidebar-PSpwc3Zu.js → sidebar-Dt9UYgk1.js} +2 -2
  237. package/dist/client/assets/{sidebarProjectGrouping-D02jVAL6.js → sidebarProjectGrouping-lpBYOlht.js} +2 -2
  238. package/dist/client/assets/{skeleton-DIPW_H7N.js → skeleton-BiqtjWsk.js} +2 -2
  239. package/dist/client/assets/{sourceControl-B9aMMjp2.js → sourceControl-BUEFlHbW.js} +2 -2
  240. package/dist/client/assets/{sourceControlClients-XtdH6kjx.js → sourceControlClients-Bcd4sqEi.js} +2 -2
  241. package/dist/client/assets/{spinner-BeAnBYcY.js → spinner-C64jtA3m.js} +2 -2
  242. package/dist/client/assets/{terminal-links-CYEBYRi6.js → terminal-links-DxE1mEi0.js} +2 -2
  243. package/dist/client/assets/{terminalSessions-C2k3TT8f.js → terminalSessions-Ceajv0BZ.js} +2 -2
  244. package/dist/client/assets/{textarea-DBTtAB2q.js → textarea-DtceyvOF.js} +2 -2
  245. package/dist/client/assets/{themePalette-Uk7bx8zb.js → themePalette-tZPF0oN0.js} +3 -3
  246. package/dist/client/assets/threadCheckpoints-BXz5LJLz.js +2 -0
  247. package/dist/client/assets/toast-BYGaCmZu.js +2 -0
  248. package/dist/client/assets/{toggle-DYYe3Gb8.js → toggle-Be7gb_vD.js} +2 -2
  249. package/dist/client/assets/{toggle-group-hQw0fxkT.js → toggle-group-Cz65VaLC.js} +2 -2
  250. package/dist/client/assets/{tooltip-BeHmtauD.js → tooltip-BYZIg_IY.js} +2 -2
  251. package/dist/client/assets/{uiStateStore-Cd96D_GT.js → uiStateStore-yyuUmO2M.js} +2 -2
  252. package/dist/client/assets/usage-B6rUsIoY.js +2 -0
  253. package/dist/client/assets/{usageAccess-DTKEwCKL.js → usageAccess-0MZ9DMCW.js} +2 -2
  254. package/dist/client/assets/{usageFormat-D1mf8I5d.js → usageFormat-4k8-70X2.js} +2 -2
  255. package/dist/client/assets/{usageShortcuts-C0jTsdR4.js → usageShortcuts-C4Dhwzkz.js} +2 -2
  256. package/dist/client/assets/{use-atom-command-D4TeQyNE.js → use-atom-command-DEluSG6k.js} +2 -2
  257. package/dist/client/assets/{useAriaLabelledBy-Cod6bMX5.js → useAriaLabelledBy-Ca8fkLAD.js} +2 -2
  258. package/dist/client/assets/{useHandleNewThread-CJ3yJ6tD.js → useHandleNewThread-BOej8pJq.js} +2 -2
  259. package/dist/client/assets/{useLocation-DNv7cb59.js → useLocation-_8If3LN3.js} +2 -2
  260. package/dist/client/assets/{useNavigate-PfhtEZbl.js → useNavigate-5WivMyAa.js} +2 -2
  261. package/dist/client/assets/{useNavigateBack-DUje4FcE.js → useNavigateBack-DXfbYF86.js} +2 -2
  262. package/dist/client/assets/{useP4ConnectAuthPrompt-evKe5nuS.js → useP4ConnectAuthPrompt-D0Equ6mY.js} +2 -2
  263. package/dist/client/assets/{useParams-CzC0HF0R.js → useParams-DV-Nw6Lj.js} +2 -2
  264. package/dist/client/assets/{usePermissionStatus-BUDWSxLm.js → usePermissionStatus-CIobAIHF.js} +2 -2
  265. package/dist/client/assets/{usePullRequestActions-Cxt5UQ0d.js → usePullRequestActions-Cf39XlVv.js} +3 -3
  266. package/dist/client/assets/{useRegisterFieldControl-B4MJ2axN.js → useRegisterFieldControl-Dmsxd6H8.js} +2 -2
  267. package/dist/client/assets/{useScopedModelAvailability-ujoqpGuE.js → useScopedModelAvailability-Cc-bmdqn.js} +2 -2
  268. package/dist/client/assets/useSettings-jZr_DfW0.js +3 -0
  269. package/dist/client/assets/utils-OWUgXvpr.js +37 -0
  270. package/dist/client/assets/vcsRefInvalidation-CRToBQE1.js +2 -0
  271. package/dist/client/assets/{welcome-DqtsIjdN.js → welcome-BcjbPbMq.js} +2 -2
  272. package/dist/client/index.html +1 -1
  273. package/dist/client/third-party-licenses.json +1 -1
  274. package/dist/pele-RvfyfJB5.mjs +29609 -0
  275. package/dist/{renderer-CmxAcIV2.mjs → renderer-D_KFqL06.mjs} +2 -2
  276. package/dist/resource-monitor/darwin-arm64/p4-resource-monitor +0 -0
  277. package/dist/{runtime-CAtWuL14.mjs → runtime-Tslhhp69.mjs} +106 -19
  278. package/package.json +1 -1
  279. package/dist/AcpMcpStdioBridge-BFMDWrrj.mjs +0 -3
  280. package/dist/client/assets/AlertDialogRoot-C6RQ4Ag-.js +0 -2
  281. package/dist/client/assets/ChatGptUsageButton-C3xHekTe.js +0 -2
  282. package/dist/client/assets/ChatMarkdown-Cw9bEYxG.js +0 -48
  283. package/dist/client/assets/DevicePanel-BS7y97f_.js +0 -2
  284. package/dist/client/assets/DeviceSetup-TIKLCkls.js +0 -2
  285. package/dist/client/assets/DiffPanel-CAK_DAYa.js +0 -2
  286. package/dist/client/assets/FilePreviewPanel-DJ-LkCJ7.js +0 -34
  287. package/dist/client/assets/Input--rtZ2Jji.js +0 -2
  288. package/dist/client/assets/JZOYTAAL-PmkwTnld.js +0 -1
  289. package/dist/client/assets/PanelLayoutControls-D8g6TJ8z.js +0 -216
  290. package/dist/client/assets/PreviewPanel-cYx50TF6.js +0 -2
  291. package/dist/client/assets/ProjectDefaultsSettings-G0FTRG0c.js +0 -2
  292. package/dist/client/assets/ProviderModelPicker-DWqfDVY9.js +0 -2
  293. package/dist/client/assets/PullRequestCodeTab-D3ntjIAg.js +0 -6
  294. package/dist/client/assets/ReadOnlySourcePreview-Bx9Jebzp.js +0 -2
  295. package/dist/client/assets/ScheduledTasksSettings-BcF7IiOl.js +0 -4
  296. package/dist/client/assets/SelfImproveSettingsSection-Dm8NhqV7.js +0 -2
  297. package/dist/client/assets/SettingsPanels-BsyJETg8.js +0 -46
  298. package/dist/client/assets/ThreadTerminalDrawer-DIUp50A3.js +0 -5
  299. package/dist/client/assets/TooltipViewport-rDmof6w5.js +0 -2
  300. package/dist/client/assets/_chat-DNoJniWX.js +0 -47
  301. package/dist/client/assets/_chat.pull-requests-DEHC0db5.js +0 -2
  302. package/dist/client/assets/assets-CrCgj2yM.js +0 -2
  303. package/dist/client/assets/connect-agent-CsvW078q.js +0 -2
  304. package/dist/client/assets/device-BqGYZxfg.js +0 -2
  305. package/dist/client/assets/entities-CTJ1ube2.js +0 -2
  306. package/dist/client/assets/env-wK1YYxA8.js +0 -2
  307. package/dist/client/assets/index-CxLeDuff.js +0 -3
  308. package/dist/client/assets/key-round-CoEmBzzZ.js +0 -2
  309. package/dist/client/assets/main-BD4pReCY.css +0 -2
  310. package/dist/client/assets/main-DIEsHSIy.js +0 -37
  311. package/dist/client/assets/mediaSource-DQsJoeCH.js +0 -2
  312. package/dist/client/assets/number-field-Bw2BDGyn.js +0 -2
  313. package/dist/client/assets/openFileInPreview-52PEk4wb.js +0 -2
  314. package/dist/client/assets/primary-YDhFfOF8.js +0 -2
  315. package/dist/client/assets/primaryCloudLinkState-kvnCGEBC.js +0 -2
  316. package/dist/client/assets/projectFilesQueryState-DvEcN38K.js +0 -2
  317. package/dist/client/assets/pullRequests-DKqH-UAm.js +0 -2
  318. package/dist/client/assets/queries-eqpX-CHf.js +0 -2
  319. package/dist/client/assets/query-D5Kb9u_z.js +0 -2
  320. package/dist/client/assets/rightPanelStore-DQ1c3-Lt.js +0 -2
  321. package/dist/client/assets/runtime-DCbEdU32.js +0 -3
  322. package/dist/client/assets/runtime-DeVKKxNz.js +0 -6
  323. package/dist/client/assets/selfImproveFindings-DUmfxmCO.js +0 -2
  324. package/dist/client/assets/server-Ct4-BCZx.js +0 -2
  325. package/dist/client/assets/settings.archived-DDtPGPcJ.js +0 -2
  326. package/dist/client/assets/settings.connections-CHXX5kH0.js +0 -2
  327. package/dist/client/assets/settings.diagnostics-Du6_cMwQ.js +0 -2
  328. package/dist/client/assets/settings.integrations-Ct8ruO3E.js +0 -2
  329. package/dist/client/assets/settings.projects-DosfFxrs.js +0 -4
  330. package/dist/client/assets/settings.providers-DKgzTRpw.js +0 -3
  331. package/dist/client/assets/settingsLayout-krWuVpsF.js +0 -3
  332. package/dist/client/assets/toast-Dkj3G-UM.js +0 -2
  333. package/dist/client/assets/usage-ChIGOn5O.js +0 -2
  334. package/dist/client/assets/useSettings-Cg0O7Ek7.js +0 -3
  335. package/dist/client/assets/utils-CcBaVOX5.js +0 -37
  336. package/dist/client/assets/vcsRefInvalidation-B5V_HlR9.js +0 -2
@@ -1,2 +0,0 @@
1
- import{a as e,r as t,t as n}from"./react-BUfh6y28.js";import{n as r,t as i}from"./jsx-runtime-DJeoFXNw.js";import{$d as a,Ao as o,Ba as s,Ca as c,D as l,Fr as u,Ga as d,Gd as f,Ha as p,Ka as m,Ki as h,Lb as g,Mi as _,Mo as v,Mr as y,Na as b,No as x,Qp as S,Rr as C,Sl as w,Ta as T,Ti as E,To as D,Tu as O,Ua as ee,Ud as te,Ui as k,Wm as A,Xu as j,aa as M,ba as N,ca as P,da as ne,ep as F,fi as re,fr as I,ga as L,ha as R,hb as z,ka as ie,ko as B,ma as ae,mr as oe,nb as se,nc as V,oa as H,pa as U,qi as ce,qm as le,t as W,ua as ue,ud as de,uh as fe,wo as pe,xa as me,xt as he,yb as ge}from"./utils-CcBaVOX5.js";import{jn as _e}from"./runtime-DeVKKxNz.js";import{S as ve,d as ye,f as be,l as G,m as xe,u as Se}from"./TooltipViewport-rDmof6w5.js";import{t as Ce}from"./spinner-BeAnBYcY.js";import{t as we}from"./useParams-CzC0HF0R.js";var Te=g(w),Ee=g(O);function De(e){return Ee(e)&&(e.reason===`thread_not_empty`||e.reason===`thread_not_side_chat`)}function Oe(e){return Te(e)&&e.bootstrapThreadDisposition===`deleted`}function ke(e){return Te(e)&&e.bootstrapThreadDisposition===`not-created`}var Ae=[/\bSocketCloseError\b/i,/\bSocketOpenError\b/i,/\bSocket is not connected\b/i,/Unable to connect to the P4 server WebSocket\./i,RegExp(`\\b(?:is not connected|disconnected|stopped responding|could not establish a WebSocket connection)\\.(?: ${(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`))(_e)})?$`,`i`),/\bClientProtocolError\b/i,/\bRpcClientError\b/i,/\bping timeout\b/i];function je(e){if(typeof e!=`string`)return!1;let t=e.trim();return t.length!==0&&Ae.some(e=>e.test(t))}function Me(e){return je(e)?null:e??null}var K=e(n()),Ne=K.createContext(void 0);function Pe(){let e=K.useContext(Ne);if(!e)throw Error(x(73));return e}var Fe=0;function Ie(e){return Fe+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${Fe}`}function Le(e,t){if(typeof e==`string`)return{description:e};if(typeof e==`function`){let n=e(t);return typeof n==`string`?{description:n}:n}return e}function Re(e){let t=new Map,n=0,r=0;return e.forEach((e,i)=>{let a=e.transitionStatus===`ending`;t.set(e.id,{value:e,domIndex:i,visibleIndex:a?-1:n,offsetY:r}),r+=e.height||0,a||(n+=1)}),t}var ze=e=>e.toastMetadata,q={toasts:_(e=>e.toasts),isEmpty:_(e=>e.toasts.length===0),toast:_(ze,(e,t)=>e.get(t)?.value),toastIndex:_(ze,(e,t)=>e.get(t)?.domIndex??-1),toastOffsetY:_(ze,(e,t)=>e.get(t)?.offsetY??0),toastVisibleIndex:_(ze,(e,t)=>e.get(t)?.visibleIndex??-1),hovering:_(e=>e.hovering),focused:_(e=>e.focused),expanded:_(e=>e.hovering||e.focused),expandedOrOutOfFocus:_(e=>e.hovering||e.focused||!e.isWindowFocused),prevFocusElement:_(e=>e.prevFocusElement)},Be=class extends E{timers=new Map;areTimersPaused=!1;constructor(e){super({...e,toastMetadata:Re(e.toasts)},{},q)}setFocused(e){this.set(`focused`,e)}setHovering(e){this.set(`hovering`,e)}setIsWindowFocused(e){this.set(`isWindowFocused`,e)}setPrevFocusElement(e){this.set(`prevFocusElement`,e)}setViewport=e=>{this.set(`viewport`,e)};disposeEffect=()=>()=>{this.timers.forEach(e=>{e.timeout?.clear()}),this.timers.clear()};removeToast(e,t={}){let n=q.toastIndex(this.state,e);if(n===-1)return;let r=this.state.toasts[n];t.skipOnRemove||r?.onRemove?.();let i=[...this.state.toasts];i.splice(n,1),this.setToasts(i)}addToast=e=>{let{timeout:t,limit:n}=this.state,r=e.id||Ie(`toast`);if(e.id){let t=q.toast(this.state,e.id);if(t){if(t.transitionStatus===`ending`)this.removeToast(e.id,{skipOnRemove:!0});else{let{id:t,transitionStatus:n,...r}=e;return this.updateToastInternal(e.id,r,{resetTimer:!0,markUpdated:!0}),e.id}}}let i={...e,id:r,updateKey:0,transitionStatus:`starting`},a=[i,...this.state.toasts],o=a.filter(e=>e.transitionStatus!==`ending`);if(o.length>n){let e=o.length-n,t=o.slice(-e),r=new Set(t.map(e=>e.id));this.setToasts(a.map(e=>{let t=r.has(e.id);return e.limited===t?e:{...e,limited:t}}))}else this.setToasts(a.map(e=>e.limited?{...e,limited:!1}:e));let s=i.timeout??t;return i.type!==`loading`&&s>0&&this.scheduleTimer(r,s,()=>this.closeToast(r)),q.expandedOrOutOfFocus(this.state)&&this.pauseTimers(),r};updateToast=(e,t)=>{this.updateToastInternal(e,t,{markUpdated:!0})};updateToastInternal=(e,t,n={})=>{let{timeout:r,toasts:i}=this.state,a=q.toast(this.state,e)??null;if(!a||a.transitionStatus===`ending`)return;let o={...a,...t,...n.markUpdated&&{updateKey:(a.updateKey??0)+1}};this.setToasts(i.map(t=>t.id===e?o:t));let s=o.timeout??r,c=a?.timeout??r,l=Object.hasOwn(t,`timeout`),u=o.transitionStatus!==`ending`&&o.type!==`loading`&&s>0,d=this.timers.has(e),f=c!==s,p=a?.type===`loading`;if(!u&&d)this.timers.get(e)?.timeout?.clear(),this.timers.delete(e);else if(u&&(!d||f||l||p||n.resetTimer)){let t=this.timers.get(e);t&&(t.timeout?.clear(),this.timers.delete(e)),this.scheduleTimer(e,s,()=>this.closeToast(e)),q.expandedOrOutOfFocus(this.state)&&this.pauseTimers()}};closeToast=e=>{let t=e===void 0,{limit:n,toasts:r}=this.state,i;if(t)i=r,this.timers.forEach(e=>{e.timeout?.clear()}),this.timers.clear();else{let t=q.toast(this.state,e);if(!t)return;i=[t];let n=this.timers.get(e);n?.timeout&&(n.timeout.clear(),this.timers.delete(e))}let a=0,o=r.map(r=>{if(t||r.id===e)return{...r,transitionStatus:`ending`,height:0};if(r.transitionStatus===`ending`)return r;let i=a>=n;return a+=1,r.limited===i?r:{...r,limited:i}}),s={toasts:o,toastMetadata:Re(o)};(t||r.length===1)&&(s.hovering=!1,s.focused=!1),this.update(s),i.forEach(e=>{e.transitionStatus!==`ending`&&e.onClose?.()}),this.handleFocusManagement(e)};promiseToast=(e,t)=>{let n=Le(t.loading),r=this.addToast({...n,type:`loading`}),i=e.then(e=>{let n=Le(t.success,e);return this.updateToast(r,{...n,type:`success`,timeout:n.timeout}),e}).catch(e=>{let n=Le(t.error,e);return this.updateToast(r,{...n,type:`error`,timeout:n.timeout}),Promise.reject(e)});return{}.hasOwnProperty.call(t,`setPromise`)&&t.setPromise(i),i};pauseTimers(){this.areTimersPaused||(this.areTimersPaused=!0,this.timers.forEach(e=>{if(e.timeout){e.timeout.clear();let t=Date.now()-e.start,n=e.delay-t;e.remaining=n>0?n:0}}))}resumeTimers(){this.areTimersPaused&&(this.areTimersPaused=!1,this.timers.forEach((e,t)=>{e.remaining=e.remaining>0?e.remaining:e.delay,e.timeout??=N.create(),e.timeout.start(e.remaining,()=>{this.timers.delete(t),e.callback()}),e.start=Date.now()}))}restoreFocusToPrevElement(){this.state.prevFocusElement?.focus({preventScroll:!0})}handleDocumentPointerDown=e=>{if(e.pointerType!==`touch`)return;let t=L(e);R(this.state.viewport,t)||(this.resumeTimers(),this.update({hovering:!1,focused:!1}))};scheduleTimer(e,t,n){let r=Date.now(),i=!q.expandedOrOutOfFocus(this.state),a=i?N.create():void 0;a?.start(t,()=>{this.timers.delete(e),n()}),this.timers.set(e,{timeout:a,start:i?r:0,delay:t,remaining:t,callback:n})}setToasts(e){let t={toasts:e,toastMetadata:Re(e)};e.length===0&&(t.hovering=!1,t.focused=!1),this.update(t)}handleFocusManagement(e){let t=ae(P(this.state.viewport));if(!this.state.viewport||!R(this.state.viewport,t)||!U(t))return;if(e===void 0){this.restoreFocusToPrevElement();return}let n=q.toasts(this.state),r=q.toastIndex(this.state,e),i=null,a=r+1;for(;a<n.length;){if(n[a].transitionStatus!==`ending`){i=n[a];break}a+=1}if(!i)for(a=r-1;a>=0;){if(n[a].transitionStatus!==`ending`){i=n[a];break}--a}i?i.ref?.current?.focus():this.restoreFocusToPrevElement()}},J=e(i()),Ve=function(e){let{children:t,timeout:n=5e3,limit:r=3,toastManager:i}=e,a=v(()=>new Be({timeout:n,limit:r,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return ie(a.disposeEffect),K.useEffect(function(){if(i)return i[` subscribe`](({action:e,options:t})=>{let n=t.id;e===`promise`&&t.promise?a.promiseToast(t.promise,t):e===`update`&&n?a.updateToast(n,t):e===`close`?a.closeToast(n):a.addToast(t)})},[a,i]),a.useSyncedValues({timeout:n,limit:r}),(0,J.jsx)(Ne.Provider,{value:a,children:t})},He=function(e){return e.frontmostHeight=`--toast-frontmost-height`,e}({}),Ue=K.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,s=Pe(),c=me(),l=K.useRef(!1),u=K.useRef(!1),f=K.useRef(!1),p=s.useState(`isEmpty`),m=s.useState(`toasts`),h=s.useState(`focused`),g=s.useState(`expanded`),_=s.useState(`prevFocusElement`),v=m[0]?.height??0,y=K.useMemo(()=>m.some(e=>e.transitionStatus===`ending`),[m]),b=K.useMemo(()=>m.filter(e=>e.priority===`high`),[m]);K.useEffect(()=>{let e=s.state.viewport;if(!e)return;function t(t){p||t.key===`F6`&&L(t)!==e&&(t.preventDefault(),s.setPrevFocusElement(ae(P(e))),e?.focus({preventScroll:!0}),s.pauseTimers(),s.setFocused(!0))}let n=d(e);return ne(n,`keydown`,t)},[s,p]),K.useEffect(()=>{let e=s.state.viewport;if(!e||p)return;let t=d(e);function n(e){L(e)===t&&(s.setIsWindowFocused(!1),s.pauseTimers())}function r(n){if(n.relatedTarget)return;let r=L(n),i=ae(P(e));r!==t&&R(e,r)&&U(i)||s.resumeTimers(),c.start(0,()=>s.setIsWindowFocused(!0))}return ue(ne(t,`blur`,n,!0),ne(t,`focus`,r,!0))},[s,c,p]),K.useEffect(()=>{let e=s.state.viewport;if(!e||p)return;let t=P(e);return ne(t,`pointerdown`,s.handleDocumentPointerDown,!0)},[p,s]);function x(e){let t=s.state.viewport;t&&(l.current=!0,e.relatedTarget===t?m[0]?.ref?.current?.focus():s.restoreFocusToPrevElement())}function S(e){e.key===`Tab`&&e.shiftKey&&L(e.nativeEvent)===s.state.viewport&&(e.preventDefault(),s.restoreFocusToPrevElement(),s.resumeTimers())}function C(){let e=s.state.toasts.some(e=>e.transitionStatus===`ending`);s.state.isWindowFocused&&!e&&!f.current&&u.current&&(s.resumeTimers(),s.setHovering(!1),u.current=!1)}K.useEffect(C,[y,s]);function w(){s.pauseTimers(),s.setHovering(!0),u.current=!1}function T(){y||f.current?u.current=!0:(s.resumeTimers(),s.setHovering(!1))}function E(e){e.pointerType===`touch`&&(f.current=!0)}function O(e){e.pointerType===`touch`&&(f.current=!1,C())}function ee(){l.current?l.current=!1:h||U(ae(P(s.state.viewport)))&&(s.setFocused(!0),s.pauseTimers())}function te(e){h&&!R(s.state.viewport,e.relatedTarget)&&(s.setFocused(!1),s.resumeTimers())}let k={tabIndex:-1,role:`region`,"aria-live":`polite`,"aria-atomic":!1,"aria-relevant":`additions text`,"aria-label":`Notifications`,onMouseEnter:w,onMouseMove:w,onMouseLeave:T,onFocus:ee,onBlur:te,onKeyDown:S,onClick:ee,onPointerDown:E,onPointerUp:O,onPointerCancel:O},A={expanded:g},j=D(`div`,e,{ref:[t,s.setViewport],state:A,props:[k,{style:{[He.frontmostHeight]:v?`${v}px`:void 0}},o,{children:(0,J.jsxs)(K.Fragment,{children:[!p&&_&&(0,J.jsx)(M,{onFocus:x}),a,!p&&_&&(0,J.jsx)(M,{onFocus:x})]})}]});return(0,J.jsxs)(K.Fragment,{children:[!p&&_&&(0,J.jsx)(M,{onFocus:x}),j,!h&&b.length>0&&(0,J.jsx)(`div`,{style:H,children:b.map(e=>(0,J.jsxs)(`div`,{role:`alert`,"aria-atomic":!0,children:[(0,J.jsx)(`div`,{children:e.title}),(0,J.jsx)(`div`,{children:e.description})]},e.id))})]})}),We=e(T()),Ge=K.createContext(void 0);function Ke(){let e=K.useContext(Ge);if(!e)throw Error(x(66));return e}var Y=function(e){return e.index=`--toast-index`,e.offsetY=`--toast-offset-y`,e.height=`--toast-height`,e.swipeMovementX=`--toast-swipe-movement-x`,e.swipeMovementY=`--toast-swipe-movement-y`,e}({});function qe(e,t,n){switch(e){case`up`:return-n;case`down`:return n;case`left`:return-t;case`right`:return t;default:return 0}}function Je(e){let t=d(e).getComputedStyle(e).transform,n=0,r=0,i=1;if(t&&t!==`none`){let e=t.match(/matrix(?:3d)?\(([^)]+)\)/);if(e){let t=e[1].split(`, `).map(parseFloat);t.length===6?(n=t[4],r=t[5],i=Math.sqrt(t[0]*t[0]+t[1]*t[1])):t.length===16&&(n=t[12],r=t[13],i=t[0])}}return{x:n,y:r,scale:i}}var Ye={...pe,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},Xe=40,Ze=10,X=.5,Qe=1,$e=`${k},${h}`,et=K.forwardRef(function(e,t){let{toast:n,render:r,className:i,swipeDirection:a=[`down`,`right`],style:o,...s}=e,l=n.positionerProps?.anchor!==void 0,u=[];l||(u=Array.isArray(a)?a:[a]);let d=u.length>0,f=Pe(),[m,h]=K.useState(void 0),[g,_]=K.useState(!1),[v,y]=K.useState(!1),[b,x]=K.useState(!1),[S,w]=K.useState({x:0,y:0}),[T,E]=K.useState({x:0,y:0,scale:1}),[O,te]=K.useState(),[k,A]=K.useState(),[j,M]=K.useState(null),N=K.useRef(null),F=K.useRef({x:0,y:0}),re=K.useRef({x:0,y:0,scale:1}),I=K.useRef(void 0),z=K.useRef(0),ie=K.useRef(!1),B=K.useRef({x:0,y:0}),oe=K.useRef(!1),se=K.useRef({x:0,y:0}),V=K.useRef(null),H=K.useRef(null),U=f.useState(`toastIndex`,n.id),ce=f.useState(`toastVisibleIndex`,n.id),le=f.useState(`toastOffsetY`,n.id),W=f.useState(`focused`),ue=f.useState(`expanded`);c({open:n.transitionStatus!==`ending`,ref:N,onComplete(){n.transitionStatus===`ending`&&f.removeToast(n.id)}});let de=ee((e=!1)=>{let t=N.current;if(!t)return;let r=t.style.height;t.style.height=`auto`;let i=t.offsetHeight;t.style.height=r;function a(){f.updateToastInternal(n.id,{ref:N,height:i,...n.transitionStatus===`starting`?{transitionStatus:void 0}:{}})}e?We.flushSync(a):a()});p(de,[de]);function fe(e){se.current=e,w(e)}p(()=>()=>{H.current?.abort()},[]);function pe(e,t){let n=e,r=t;return!u.includes(`left`)&&!u.includes(`right`)?n=e>0?e**X:-(Math.abs(e)**X):(!u.includes(`right`)&&e>0&&(n=e**X),!u.includes(`left`)&&e<0&&(n=-(Math.abs(e)**X))),!u.includes(`up`)&&!u.includes(`down`)?r=t>0?t**X:-(Math.abs(t)**X):(!u.includes(`down`)&&t>0&&(r=t**X),!u.includes(`up`)&&t<0&&(r=-(Math.abs(t)**X))),{x:n,y:r}}let me=ee(e=>{if(e.pointerId!==V.current)return;V.current=null,H.current?.abort(),H.current=null,_(!1),y(!1),M(null);let t=re.current;if(e.type===`pointercancel`||ie.current){fe({x:t.x,y:t.y}),h(void 0);return}let r=!1,i=se.current,a=i.x-t.x,o=i.y-t.y,s;for(let e of u){switch(e){case`right`:a>Xe&&(r=!0,s=`right`);break;case`left`:a<-40&&(r=!0,s=`left`);break;case`down`:o>Xe&&(r=!0,s=`down`);break;case`up`:o<-40&&(r=!0,s=`up`)}if(r)break}r?(h(s),x(!0),f.closeToast(n.id)):(fe({x:t.x,y:t.y}),h(void 0))});function he(e){if(e.button!==0)return;e.pointerType===`touch`&&f.pauseTimers();let t=L(e.nativeEvent);if(t&&t.closest(`button,a,input,textarea,[role="button"],${$e}`))return;if(ie.current=!1,I.current=void 0,z.current=0,V.current=e.pointerId,F.current={x:e.clientX,y:e.clientY},B.current=F.current,N.current){let e=Je(N.current);re.current=e,E(e),fe({x:e.x,y:e.y})}f.setHovering(!0),_(!0),y(!1),M(null),oe.current=!0;let n=N.current;if(n){H.current?.abort();let t=new AbortController;H.current=t;let r=P(n);r.addEventListener(`pointerup`,me,{signal:t.signal}),r.addEventListener(`pointercancel`,me,{signal:t.signal}),n.setPointerCapture?.(e.pointerId)}}function ge(e){if(e.pointerId!==V.current)return;e.preventDefault(),oe.current&&=(F.current={x:e.clientX,y:e.clientY},!1);let{clientY:t,clientX:n,movementX:r,movementY:i}=e;(i<0&&t>B.current.y||i>0&&t<B.current.y)&&(B.current={x:B.current.x,y:t}),(r<0&&n>B.current.x||r>0&&n<B.current.x)&&(B.current={x:n,y:B.current.y});let a=n-F.current.x,o=t-F.current.y,s=t-B.current.y,c=n-B.current.x;if(!v&&Math.sqrt(a*a+o*o)>=Qe&&(y(!0),j===null)){let e=u.includes(`left`)||u.includes(`right`),t=u.includes(`up`)||u.includes(`down`);e&&t&&M(Math.abs(a)>Math.abs(o)?`horizontal`:`vertical`)}let l;if(!I.current)j===`vertical`?o>0?l=`down`:o<0&&(l=`up`):j===`horizontal`?a>0?l=`right`:a<0&&(l=`left`):l=Math.abs(a)>=Math.abs(o)?a>0?`right`:`left`:o>0?`down`:`up`,l&&u.includes(l)&&(I.current=l,z.current=qe(l,a,o),h(l));else{let e=I.current,t=qe(e,c,s);t>Xe?(ie.current=!1,h(e)):!(u.includes(`left`)&&u.includes(`right`))&&!(u.includes(`up`)&&u.includes(`down`))&&z.current-t>=Ze&&(ie.current=!0)}let d=pe(a,o),f=re.current.x,p=re.current.y;j===`horizontal`?(u.includes(`left`)||u.includes(`right`))&&(f+=d.x):(j===`vertical`||(u.includes(`left`)||u.includes(`right`))&&(f+=d.x),(u.includes(`up`)||u.includes(`down`))&&(p+=d.y)),fe({x:f,y:p})}function _e(e){if(e.key===`Escape`){if(!N.current||!R(N.current,ae(P(N.current))))return;f.closeToast(n.id)}}K.useEffect(()=>{if(!d)return;let e=N.current;if(!e)return;function t(t){R(e,L(t))&&t.preventDefault()}return ne(e,`touchmove`,t,{passive:!1})},[d]);function ve(){if(!g&&S.x===T.x&&S.y===T.y&&!b)return{[Y.swipeMovementX]:`0px`,[Y.swipeMovementY]:`0px`};let e=S.x-T.x,t=S.y-T.y;return{transition:g?`none`:void 0,transform:g?`translateX(${S.x}px) translateY(${S.y}px) scale(${T.scale})`:void 0,[Y.swipeMovementX]:`${e}px`,[Y.swipeMovementY]:`${t}px`}}let ye=n.priority===`high`,be={role:ye?`alertdialog`:`dialog`,tabIndex:0,"aria-modal":!1,"aria-labelledby":O,"aria-describedby":k,"aria-hidden":ye&&!W?!0:void 0,onPointerDown:d?he:void 0,onPointerMove:d?ge:void 0,onPointerUp:d?me:void 0,onPointerCancel:d?me:void 0,onKeyDown:_e,inert:C(n.limited),style:{...ve(),[Y.index]:n.transitionStatus===`ending`?U:ce,[Y.offsetY]:`${le}px`,[Y.height]:n.height?`${n.height}px`:void 0}},G=K.useMemo(()=>({rootRef:N,toast:n,titleId:O,setTitleId:te,descriptionId:k,setDescriptionId:A,swiping:g,swipeDirection:m,recalculateHeight:de,index:U,visibleIndex:ce,expanded:ue}),[n,O,k,g,m,de,U,ce,ue]),xe={transitionStatus:n.transitionStatus,expanded:ue,limited:n.limited||!1,type:n.type,swiping:G.swiping,swipeDirection:G.swipeDirection},Se=D(`div`,e,{ref:[t,G.rootRef],state:xe,stateAttributesMapping:Ye,props:[be,s]});return(0,J.jsx)(Ge.Provider,{value:G,children:Se})}),tt=K.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{visibleIndex:o,expanded:s,recalculateHeight:c}=Ke(),l=K.useRef(null);return p(()=>{let e=l.current;if(!e||(c(),typeof ResizeObserver!=`function`||typeof MutationObserver!=`function`))return;let t=new ResizeObserver(()=>c(!0)),n=new MutationObserver(()=>c(!0));return t.observe(e),n.observe(e,{childList:!0,subtree:!0,characterData:!0}),()=>{t.disconnect(),n.disconnect()}},[c]),D(`div`,e,{ref:[t,l],state:{expanded:s,behind:o>0},props:a})}),nt=K.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,children:o,...s}=e,{toast:c,setDescriptionId:l}=Ke(),u=o??c.description,d=!!u,f=b(a);p(()=>{if(d)return l(f),()=>{l(void 0)}},[d,f,l]);let m={type:c.type},h=D(`p`,e,{ref:t,state:m,props:{...s,id:f,children:u}});return d?h:null}),rt=K.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,children:o,...s}=e,{toast:c,setTitleId:l}=Ke(),u=o??c.title,d=!!u,f=b(a);p(()=>{if(d)return l(f),()=>{l(void 0)}},[d,f,l]);let m={type:c.type},h=D(`h2`,e,{ref:t,state:m,props:{...s,id:f,children:u}});return d?h:null}),it=K.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a,nativeButton:o=!0,...c}=e,l=Pe(),{toast:u}=Ke(),d=l.useState(`expanded`),[f,p]=K.useState(!1),{getButtonProps:m,buttonRef:h}=s({disabled:a,native:o}),g={type:u.type};return D(`button`,e,{ref:[t,h],state:g,props:[{"aria-hidden":!d&&!f,onClick(){l.closeToast(u.id)},onFocus(){p(!0)},onBlur(){p(!1)}},c,m]})}),at=K.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a,nativeButton:o=!0,...c}=e,{toast:l}=Ke(),u=l.actionProps?.children??c.children,d=!!u,{getButtonProps:f,buttonRef:p}=s({disabled:a,native:o}),m={type:l.type},h=D(`button`,e,{ref:[t,p],state:m,props:[c,l.actionProps,f,{children:u}]});return d?h:null}),ot=Se,st=K.createContext(void 0);function ct(){let e=K.useContext(st);if(e===void 0)throw Error(x(84));return e}var lt=K.forwardRef(function(e,t){let{toast:n,...r}=e,i=Pe(),a=n.positionerProps??B,{render:s,className:c,anchor:l=a.anchor,positionMethod:d=a.positionMethod??`absolute`,side:f=a.side??`top`,align:p=a.align??`center`,sideOffset:h=a.sideOffset??0,alignOffset:g=a.alignOffset??0,collisionBoundary:_=a.collisionBoundary??`clipping-ancestors`,collisionPadding:v=a.collisionPadding??5,arrowPadding:b=a.arrowPadding??5,sticky:x=a.sticky??!1,disableAnchorTracking:S=a.disableAnchorTracking??!1,collisionAvoidance:C=a.collisionAvoidance??ce,style:w,...T}=r,[E,D]=K.useState(null),O=i.useState(`toastIndex`,n.id),ee=i.useState(`toastVisibleIndex`,n.id),te=m(l)?l:null,k=re({open:!0,onOpenChange:o,elements:{floating:E,reference:te}}),A=u({anchor:te,positionMethod:d,floatingRootContext:k,mounted:!0,side:f,sideOffset:h,align:p,alignOffset:g,collisionBoundary:_,collisionPadding:v,sticky:x,arrowPadding:b,disableAnchorTracking:S,keepMounted:!0,collisionAvoidance:C}),j=K.useMemo(()=>({side:A.side,align:A.align,anchorHidden:A.anchorHidden}),[A.side,A.align,A.anchorHidden]),M=y(e,j,{styles:{...A.positionerStyles,[Y.index]:n.transitionStatus===`ending`?O:ee},transitionStatus:n.transitionStatus,props:T,refs:[t,D]});return(0,J.jsx)(st.Provider,{value:A,children:M})}),ut=K.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,{arrowRef:o,side:s,align:c,arrowUncentered:l,arrowStyles:u}=ct();return D(`div`,e,{state:{side:s,align:c,uncentered:l},ref:[t,o],props:[{style:u,"aria-hidden":!0},a]})});function dt(){let e=K.useContext(Ne);if(!e)throw Error(x(73));let t=e.useState(`toasts`);return K.useMemo(()=>({toasts:t,add:e.addToast,close:e.closeToast,update:e.updateToast,promise:e.promiseToast}),[t,e])}function ft(){let e=new Set;function t(t){e.forEach(e=>e(t))}return{" subscribe":function(t){return e.add(t),()=>{e.delete(t)}},add(e){let n=e.id||Ie(`toast`);return t({action:`add`,options:{...e,id:n,transitionStatus:`starting`}}),n},close(e){t({action:`close`,options:{id:e}})},update(e,n){t({action:`update`,options:{...n,id:e}})},promise(e,n){let r=e;return t({action:`promise`,options:{...n,promise:e,setPromise(e){r=e}}}),r}}}var pt=t({Action:()=>at,Arrow:()=>ut,Close:()=>it,Content:()=>tt,Description:()=>nt,Portal:()=>ot,Positioner:()=>lt,Provider:()=>Ve,Root:()=>et,Title:()=>rt,Viewport:()=>Ue,createToastManager:()=>ft,useToastManager:()=>dt});function mt(){let e=[],t=0,n=new Set,r=new Map,i=new Map,a=new Map,o=new Map,s=new Set,c=()=>n.forEach(e=>e()),l=e=>{clearTimeout(r.get(e)),r.delete(e);let t=a.get(e);t!==void 0&&(i.set(e,Math.max(0,(i.get(e)??0)-(Date.now()-t))),a.delete(e))},u=t=>{let n=e.find(e=>e.id===t);n&&(l(t),i.delete(t),o.delete(t),e=e.filter(e=>e.id!==t),c(),n.onDismiss?.())},d=e=>{s.size||o.get(e)?.size||r.has(e)||!i.has(e)||(a.set(e,Date.now()),r.set(e,setTimeout(()=>u(e),i.get(e))))},f=n=>{let r=n.id??`notification-${++t}`;l(r);let a={...n,id:r};e=[...e.filter(e=>e.id!==r),a];let o=n.durationMs??8e3;return o>0?i.set(r,o):i.delete(r),d(r),c(),r},p=(e,t)=>{let n=o.get(e)??new Set;n.add(t),o.set(e,n),l(e)},m=(e,t)=>{o.get(e)?.delete(t),d(e)};return{show:f,dismiss:u,pause:p,resume:m,getSnapshot:()=>e,subscribe:e=>(n.add(e),()=>{n.delete(e)}),setPaused:(t,n)=>{n?s.add(t):s.delete(t);for(let t of e)s.size?l(t.id):d(t.id)},performAction:async(t,n)=>{let r=e.find(e=>e.id===t),i=r?.actions?.find(e=>e.id===n);if(!r||!i||r.pendingActionId)return;let a={...r,pendingActionId:n};p(t,`action`),e=e.map(e=>e===r?a:e),c();try{await i.run(),e.includes(a)&&u(t)}catch(t){e.includes(a)&&f({...r,title:i.failureTitle??`Could not complete action`,description:t instanceof Error?t.message:`Please try again.`,tone:`error`})}finally{m(t,`action`)}}}}var Z=mt(),Q=r(),ht={archive:de,clock:a,pin:S,trash:A};function gt(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,K.useEffect)(_t,t),null}function _t(){let e=!0,t=new Set,n=()=>{let n=Z.getSnapshot();for(let e of t)n.some(t=>t.id===e)||(t.delete(e),$.close(`shared:${e}`));for(let r of n){let n=r.icon&&r.tone!==`error`?ht[r.icon]:null,i=r.actions??[],a=i.find(yt),o=e=>({children:e.label,disabled:!!r.pendingActionId,onClick:()=>{Z.performAction(r.id,e.id)}}),s={title:r.title,description:r.description??null,type:r.tone??`info`,timeout:0,onClose:()=>{e&&Z.getSnapshot().includes(r)&&Z.dismiss(r.id)},actionProps:{children:null},data:{sharedToastId:r.id,leadingIcon:n?(0,J.jsx)(n,{className:`size-4`}):void 0,additionalActions:i.filter(e=>e!==a).map(e=>({id:e.id,props:o(e)})),...a?{secondaryActionProps:o(a)}:{},hideCopyButton:!0}};t.has(r.id)?$.update(`shared:${r.id}`,s):(t.add(r.id),$.add({...s,id:`shared:${r.id}`}))}},r=Z.subscribe(n),i=vt;return document.addEventListener(`visibilitychange`,i),i(),n(),()=>{e=!1,r(),document.removeEventListener(`visibilitychange`,i),Z.setPaused(`web-hidden`,!1);for(let e of t)$.close(`shared:${e}`)}}function vt(){return Z.setPaused(`web-hidden`,document.hidden)}function yt(e){return e.primary}var bt=class extends ge()(`ClipboardApiUnavailableError`,{target:z}){get message(){return`Clipboard API is unavailable while copying ${this.target}.`}},xt=class extends ge()(`ClipboardWriteError`,{target:z,cause:se()}){get message(){return`Failed to copy ${this.target} to the clipboard.`}},St=class extends ge()(`ClipboardReadUnavailableError`,{target:z}){get message(){return`Clipboard API is unavailable while reading ${this.target}.`}},Ct=class extends ge()(`ClipboardReadError`,{target:z,cause:se()}){get message(){return`Failed to read ${this.target} from the clipboard.`}};function wt(e,t){if(typeof document>`u`||typeof document.execCommand!=`function`)return!1;let n=document.createElement(`textarea`);n.value=e,n.setAttribute(`readonly`,``),n.setAttribute(`aria-hidden`,`true`),n.style.position=`fixed`,n.style.top=`0`,n.style.left=`0`,n.style.opacity=`0`,n.style.fontSize=`16px`;let r=document.activeElement,i=n=>{if(t&&n.clipboardData){n.clipboardData.setData(`text/plain`,e);for(let[e,r]of Object.entries(t))n.clipboardData.setData(e,r);n.preventDefault()}};document.body.appendChild(n),n.addEventListener(`copy`,i);try{return n.focus({preventScroll:!0}),n.select(),n.setSelectionRange(0,e.length),document.execCommand(`copy`)}catch{return!1}finally{n.removeEventListener(`copy`,i),n.remove();let e=r?.focus;typeof e==`function`&&e.call(r)}}async function Tt(e,t=`text`,n){if(typeof window>`u`)throw new bt({target:t});if(!e)return!1;n&&=Object.fromEntries(Object.entries(n).filter(([e])=>e!==`text/plain`));let r=n?.[j];if(r&&(n={...n,"text/html":he(e,r,n?.[`text/html`])}),typeof navigator>`u`||!navigator.clipboard?.writeText){if(wt(e,n))return!0;throw new bt({target:t})}try{if(n&&typeof ClipboardItem<`u`&&navigator.clipboard.write)try{return await navigator.clipboard.write([new ClipboardItem({"text/plain":new Blob([e],{type:`text/plain`}),...Object.fromEntries(Object.entries(n).map(([e,t])=>[e,new Blob([t],{type:e})]))})]),!0}catch{let t=n[`text/html`];if(t)try{return await navigator.clipboard.write([new ClipboardItem({"text/plain":new Blob([e],{type:`text/plain`}),"text/html":new Blob([t],{type:`text/html`})})]),!0}catch{}}return await navigator.clipboard.writeText(e),!0}catch(e){throw new xt({target:t,cause:e})}}async function Et(e=`text`){if(typeof window>`u`||typeof navigator>`u`||!navigator.clipboard?.readText)throw new St({target:e});try{return await navigator.clipboard.readText()}catch(t){throw new Ct({target:e,cause:t})}}function Dt({timeout:e=2e3,target:t=`text`,onCopy:n,onError:r,extraFlavors:i}={}){let[a,o]=K.useState(!1),s=K.useRef(null),c=K.useRef(n),l=K.useRef(r),u=K.useRef(t),d=K.useRef(e);c.current=n,l.current=r;let f=K.useRef(i);u.current=t,d.current=e,f.current=i;let p=K.useCallback((e,t)=>{Tt(e,u.current,f.current).then(e=>{e&&(s.current&&clearTimeout(s.current),o(!0),c.current?.(t),d.current!==0&&(s.current=setTimeout(()=>{o(!1),s.current=null},d.current)))},e=>{console.error(e),l.current?.(e,t)})},[]);return K.useEffect(()=>()=>{s.current&&clearTimeout(s.current)},[]),{copyToClipboard:p,isCopied:a}}function Ot(e){return e===`live`}function kt(e){return e.draftThreadExists||e.serverThreadExists&&!e.serverThreadDeleted?`ready`:e.bootstrapComplete?`missing`:`loading`}function At(e){return{environmentId:e.environmentId,threadId:e.threadId}}function jt(e){return{draftId:e}}function Mt(e){return!e.environmentId||!e.threadId?null:V(e.environmentId,e.threadId)}function Nt(e){return e.environmentId&&e.threadId?{kind:`server`,threadRef:V(e.environmentId,e.threadId)}:e.draftId?{kind:`draft`,draftId:e.draftId}:null}function Pt(e,t){return e?.kind===`server`?e.threadRef:e?.kind!==`draft`||!t?.promotedTo?null:t.promotedTo}function Ft(e){if(typeof e!=`object`||!e||!(`children`in e))return!1;let t=e.children;return t!=null&&t!==!1&&t!==``}function It(e,t){return t<=1?!1:e>0}function Lt(e){let t=0,n=0,r=0,i=0,a=e.map(e=>{let a=Rt(e.height);if(e.transitionStatus===`ending`){let r={toast:e,visibleIndex:t,offsetY:n};return n+=a,t+=1,r}let o={toast:e,visibleIndex:r,offsetY:i};return n+=a,t+=1,i+=a,r+=1,o});return{frontmostHeight:Rt(e.find(e=>e.transitionStatus!==`ending`)?.height),items:a}}function Rt(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:0}function zt(e,t){if(e?.threadRef)return t!==null&&e.threadRef.environmentId===t.environmentId&&e.threadRef.threadId===t.threadId;let n=e?.threadId;return!n||t?.threadId===n}var $=ft(),Bt=ft(),Vt=new Map,Ht={error:te,info:F,loading:Ce,success:f,warning:le},Ut=180;function Wt(e,t){if(e===`error`&&typeof t==`string`&&!(t.length<Ut))return`line-clamp-4`}function Gt(e,t,n){n?.(),e.close(t)}function Kt(e){let t=(0,Q.c)(3),{onClick:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,J.jsx)(fe,{}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,J.jsx)(I,{size:`icon-xs`,variant:`ghost`,"aria-label":`Dismiss notification`,"data-slot":`toast-close`,onClick:n,children:r}),t[1]=n,t[2]=i),i}function qt(e){let t=(0,Q.c)(13),{text:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={target:`error-message`},t[0]=r):r=t[0];let{copyToClipboard:i,isCopied:a}=Dt(r),o=a?`Copied error`:`Copy error`,s;t[1]!==i||t[2]!==n?(s=()=>i(n),t[1]=i,t[2]=n,t[3]=s):s=t[3];let c=a&&`text-success`,l;t[4]===c?l=t[5]:(l=W(`size-3`,c),t[4]=c,t[5]=l);let u=a?ye:ve,d;t[6]!==l||t[7]!==u?(d=(0,J.jsx)(G,{className:l,icon:u}),t[6]=l,t[7]=u,t[8]=d):d=t[8];let f;return t[9]!==o||t[10]!==s||t[11]!==d?(f=(0,J.jsx)(I,{size:`icon-micro`,variant:`ghost-muted`,"aria-label":o,className:`[--control-icon-color:currentColor] rounded-md text-muted-foreground/80 hover:bg-transparent hover:text-muted-foreground`,onClick:s,children:d}),t[9]=o,t[10]=s,t[11]=d,t[12]=f):f=t[12],f}var Jt=`mt-2 max-h-40 min-h-0 overflow-y-auto overscroll-contain pr-0.5 select-text`;function Yt(e){let t=(0,Q.c)(13),{children:n,labels:r}=e,[i,a]=(0,K.useState)(!1),o=r.expand??`Show details`,s=r.collapse??`Hide details`,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>a(Xt),t[0]=c):c=t[0];let l=i?xe:be,u;t[1]===l?u=t[2]:(u=(0,J.jsx)(G,{className:`size-3.5 shrink-0 opacity-80`,icon:l,strokeWidth:2.25}),t[1]=l,t[2]=u);let d=i?s:o,f;t[3]!==i||t[4]!==u||t[5]!==d?(f=(0,J.jsxs)(`button`,{"aria-expanded":i,className:`inline-flex cursor-pointer items-center gap-1 rounded-md py-0.5 text-left text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,onClick:c,type:`button`,children:[u,d]}),t[3]=i,t[4]=u,t[5]=d,t[6]=f):f=t[6];let p;t[7]!==n||t[8]!==i?(p=i?(0,J.jsx)(`div`,{className:Jt,children:n}):null,t[7]=n,t[8]=i,t[9]=p):p=t[9];let m;return t[10]!==f||t[11]!==p?(m=(0,J.jsxs)(`div`,{className:`min-w-0`,children:[f,p]}),t[10]=f,t[11]=p,t[12]=m):m=t[12],m}function Xt(e){return!e}function Zt(e){let t=(0,Q.c)(36),{toastData:n,toastDescription:r,toastType:i}=e,a=n?.expandableContent,o;t[0]===n?.expandableLabels?o=t[1]:(o=n?.expandableLabels??{},t[0]=n?.expandableLabels,t[1]=o);let s=o,c=n?.expandableDescriptionTrigger??!1,l;t[2]!==r||t[3]!==i?(l=W(`min-w-0 select-text wrap-break-word text-muted-foreground`,Wt(i,r)),t[2]=r,t[3]=i,t[4]=l):l=t[4];let u=l,[d,f]=(0,K.useState)(!1);if(!a){let e;return t[5]===u?e=t[6]:(e=(0,J.jsx)(nt,{className:u,"data-slot":`toast-description`}),t[5]=u,t[6]=e),e}if(!c){let e;t[7]===u?e=t[8]:(e=(0,J.jsx)(nt,{className:u,"data-slot":`toast-description`}),t[7]=u,t[8]=e);let n;t[9]!==a||t[10]!==s?(n=(0,J.jsx)(Yt,{labels:s,children:a}),t[9]=a,t[10]=s,t[11]=n):n=t[11];let r;return t[12]!==e||t[13]!==n?(r=(0,J.jsxs)(J.Fragment,{children:[e,n]}),t[12]=e,t[13]=n,t[14]=r):r=t[14],r}let p=s.expand??`Show details`,m=s.collapse??`Hide details`,h;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>f(Qt),t[15]=h):h=t[15];let g=h,_;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),g())},t[16]=_):_=t[16];let v=_,y=d?m:p,b;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(b=W(`group flex min-w-0 w-full cursor-pointer select-none items-start gap-1.5 rounded-sm text-left outline-none ring-offset-background`,`transition-colors hover:bg-muted/40`,`focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background`),t[17]=b):b=t[17];let x;t[18]!==r||t[19]!==i?(x=W(`min-w-0 select-none wrap-break-word text-muted-foreground`,Wt(i,r),`underline-offset-2 decoration-muted-foreground/60 group-hover:underline`),t[18]=r,t[19]=i,t[20]=x):x=t[20];let S;t[21]===x?S=t[22]:(S=(0,J.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,J.jsx)(nt,{className:x,"data-slot":`toast-description`})}),t[21]=x,t[22]=S);let C=d?xe:be,w;t[23]===C?w=t[24]:(w=(0,J.jsx)(G,{"aria-hidden":!0,className:`mt-0.5 size-3.5 shrink-0 text-muted-foreground opacity-80`,icon:C,strokeWidth:2.25}),t[23]=C,t[24]=w);let T;t[25]!==d||t[26]!==w||t[27]!==y||t[28]!==S?(T=(0,J.jsxs)(`div`,{"aria-label":y,"aria-expanded":d,className:b,onClick:g,onKeyDown:v,role:`button`,tabIndex:0,children:[S,w]}),t[25]=d,t[26]=w,t[27]=y,t[28]=S,t[29]=T):T=t[29];let E;t[30]!==a||t[31]!==d?(E=d?(0,J.jsx)(`div`,{className:Jt,children:a}):null,t[30]=a,t[31]=d,t[32]=E):E=t[32];let D;return t[33]!==T||t[34]!==E?(D=(0,J.jsxs)(J.Fragment,{children:[T,E]}),t[33]=T,t[34]=E,t[35]=D):D=t[35],D}function Qt(e){return!e}function $t(e){let t=e.type?Ht[e.type]:null,n=e.type===`error`&&typeof e.description==`string`&&!e.data?.hideCopyButton?e.description:null,r=(e.data?.additionalActions?.length??0)>0,i=e.data?.secondaryActionProps!==void 0;return{Icon:t,copyErrorText:n,hasTrailingControls:n!==null||Ft(e.actionProps)||r||i}}function en(e){let t=(0,Q.c)(32),{Icon:n,copyErrorText:r,actionProps:i,hasTrailingControls:a,toastData:o,toastDescription:s,toastType:c}=e,l;t[0]===o?.additionalActions?l=t[1]:(l=o?.additionalActions??[],t[0]=o?.additionalActions,t[1]=l);let u=l,d=o?.secondaryActionProps,f=o?.leadingIcon,p;t[2]===d?p=t[3]:(p=d??{},t[2]=d,t[3]=p);let m,h;t[4]===p?(m=t[5],h=t[6]):({className:m,...h}=p,t[4]=p,t[5]=m,t[6]=h);let g;t[7]!==n||t[8]!==f?(g=f?(0,J.jsx)(`div`,{className:`flex h-lh w-4 shrink-0 items-center justify-center`,"data-slot":`toast-icon`,children:f}):n?(0,J.jsx)(`div`,{className:`[&>svg]:h-lh [&>svg]:w-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,"data-slot":`toast-icon`,children:(0,J.jsx)(n,{className:`in-data-[type=error]:text-destructive in-data-[type=info]:text-info in-data-[type=success]:text-success in-data-[type=warning]:text-warning in-data-[type=loading]:opacity-80`})}):null,t[7]=n,t[8]=f,t[9]=g):g=t[9];let _;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,J.jsx)(rt,{className:`min-w-0 wrap-break-word font-medium`,"data-slot":`toast-title`}),t[10]=_):_=t[10];let v;t[11]===g?v=t[12]:(v=(0,J.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[g,_]}),t[11]=g,t[12]=v);let y;t[13]!==o||t[14]!==s||t[15]!==c?(y=(0,J.jsx)(Zt,{toastData:o,toastDescription:s,toastType:c}),t[13]=o,t[14]=s,t[15]=c,t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==y?(b=(0,J.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-0.5`,children:[v,y]}),t[17]=v,t[18]=y,t[19]=b):b=t[19];let x;t[20]!==i||t[21]!==u||t[22]!==r||t[23]!==a||t[24]!==m||t[25]!==d||t[26]!==h||t[27]!==o?.sharedToastId?(x=a?(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[r===null?null:(0,J.jsx)(qt,{text:r}),u.map(tn),d?(0,J.jsx)(I,{...h,className:m,size:`xs`,type:`button`,variant:o?.sharedToastId?`solid-neutral`:`soft`}):null,Ft(i)?(0,J.jsx)(at,{className:W(oe({size:`xs`,variant:`solid-neutral`}),`shrink-0`),"data-slot":`toast-action`,children:i?.children}):null]}):null,t[20]=i,t[21]=u,t[22]=r,t[23]=a,t[24]=m,t[25]=d,t[26]=h,t[27]=o?.sharedToastId,t[28]=x):x=t[28];let S;return t[29]!==b||t[30]!==x?(S=(0,J.jsxs)(J.Fragment,{children:[b,x]}),t[29]=b,t[30]=x,t[31]=S):S=t[31],S}function tn(e){let{id:t,props:n}=e,{className:r,...i}=n;return(0,K.createElement)(I,{...i,className:r,key:t,size:`xs`,type:`button`,variant:`soft`})}function nn(){let e=(0,Q.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={strict:!1,select:rn},e[0]=t):t=e[0];let n=we(t),r;e[1]===n?r=e[2]:(r=e=>n?.kind===`draft`?e.getDraftSession(n.draftId):null,e[1]=n,e[2]=r);let i=l(r),a;bb0:{if(n?.kind===`server`){a=n.threadRef;break bb0}if(n?.kind===`draft`&&i){let t;e[3]!==i.environmentId||e[4]!==i.threadId?(t={environmentId:i.environmentId,threadId:i.threadId},e[3]=i.environmentId,e[4]=i.threadId,e[5]=t):t=e[5],a=t;break bb0}a=null}return a}function rn(e){return Nt(e)}function an(e){let t=(0,Q.c)(4),{toastId:n,dismissAfterVisibleMs:r}=e,i,a;return t[0]!==r||t[1]!==n?(i=()=>{if(!r||r<=0||typeof window>`u`||typeof document>`u`)return;let e=Vt.get(n)??r,t=null,i=null,a=!1,o=()=>{i!==null&&(window.clearTimeout(i),i=null)},s=()=>{a||(a=!0,Vt.delete(n),$.close(n))},c=()=>{t!==null&&(e=Math.max(0,e-(Date.now()-t)),t=null,o(),Vt.set(n,e))},l=()=>{a||t!==null||(e<=0?s():(t=Date.now(),o(),i=window.setTimeout(()=>{e=0,t=null,s()},e)))},u=()=>{document.visibilityState===`visible`&&document.hasFocus()?l():c()};return u(),document.addEventListener(`visibilitychange`,u),window.addEventListener(`focus`,u),window.addEventListener(`blur`,u),()=>{document.removeEventListener(`visibilitychange`,u),window.removeEventListener(`focus`,u),window.removeEventListener(`blur`,u),c(),o()}},a=[r,n],t[0]=r,t[1]=n,t[2]=i,t[3]=a):(i=t[2],a=t[3]),(0,K.useEffect)(i,a),null}function on(e){let t=(0,Q.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({children:n,position:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`top-center`:i,o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,J.jsx)(gt,{}),t[4]=o):o=t[4];let s;t[5]===a?s=t[6]:(s=(0,J.jsx)(sn,{position:a}),t[5]=a,t[6]=s);let c;return t[7]!==n||t[8]!==r||t[9]!==s?(c=(0,J.jsxs)(Ve,{toastManager:$,...r,children:[o,n,s]}),t[7]=n,t[8]=r,t[9]=s,t[10]=c):c=t[10],c}function sn(e){let t=(0,Q.c)(19),{position:n}=e,{toasts:r}=dt(),i=nn(),a;t[0]===n?a=t[1]:(a=n.startsWith(`top`),t[0]=n,t[1]=a);let o=a,s;t[2]===i?s=t[3]:(s=e=>zt(e.data,i),t[2]=i,t[3]=s);let c=Lt(r.filter(s)),l,u;t[4]===r?(l=t[5],u=t[6]):(l=()=>{let e=new Set(r.map(cn));for(let t of Vt.keys())e.has(t)||Vt.delete(t)},u=[r],t[4]=r,t[5]=l,t[6]=u),(0,K.useEffect)(l,u);let d=pt,f=pt,p;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(p=W(`fixed z-100 mx-auto flex w-[calc(100%-var(--toast-inset)*2)] max-w-90 [--toast-header-offset:var(--workspace-topbar-height)] [--toast-inset:--spacing(4)] sm:[--toast-inset:--spacing(8)]`,`data-[position*=top]:top-[calc(var(--toast-inset)+var(--toast-header-offset))]`,`data-[position*=bottom]:bottom-(--toast-inset)`,`data-[position*=left]:left-(--toast-inset)`,`data-[position*=right]:right-(--toast-inset)`,`data-[position*=center]:-translate-x-1/2 data-[position*=center]:left-1/2`),t[7]=p):p=t[7];let m=`${c.frontmostHeight}px`,h;t[8]===m?h=t[9]:(h={"--toast-frontmost-height":m},t[8]=m,t[9]=h);let g=h,_=c.items.map(e=>{let{toast:t,visibleIndex:r,offsetY:i}=e,a=It(r,c.items.length),s=$t(t);return(0,J.jsxs)(et,{className:W(`dropdown-glass absolute z-[calc(9999-var(--toast-index))] w-full overflow-visible select-none rounded-xl text-popover-foreground shadow-lg shadow-black/10 [transition:transform_.5s_cubic-bezier(.22,1,.36,1),opacity_.5s,height_.15s] motion-reduce:transition-none`,`data-[position*=right]:right-0 data-[position*=right]:left-auto`,`data-[position*=left]:right-auto data-[position*=left]:left-0`,`data-[position*=center]:right-0 data-[position*=center]:left-0`,`data-[position*=top]:top-0 data-[position*=top]:bottom-auto data-[position*=top]:origin-top`,`data-[position*=bottom]:top-auto data-[position*=bottom]:bottom-0 data-[position*=bottom]:origin-bottom`,`after:absolute after:left-0 after:h-[calc(var(--toast-gap)+1px)] after:w-full`,`data-[position*=top]:after:top-full`,`data-[position*=bottom]:after:bottom-full`,r>0?`not-data-expanded:[--toast-calc-height:var(--toast-frontmost-height)] data-expanded:[--toast-calc-height:max(var(--toast-frontmost-height,var(--toast-height)),var(--toast-height))]`:`[--toast-calc-height:max(var(--toast-frontmost-height,var(--toast-height)),var(--toast-height))]`,`[--toast-gap:--spacing(3)] [--toast-peek:--spacing(3)] [--toast-scale:calc(max(0,1-(var(--toast-index)*.1)))] [--toast-shrink:calc(1-var(--toast-scale))]`,r>0?`not-data-expanded:h-(--toast-calc-height) data-expanded:h-auto`:`h-auto`,`data-[position*=top]:[--toast-calc-offset-y:calc(var(--toast-offset-y)+var(--toast-index)*var(--toast-gap)+var(--toast-swipe-movement-y))]`,`data-[position*=bottom]:[--toast-calc-offset-y:calc(var(--toast-offset-y)*-1+var(--toast-index)*var(--toast-gap)*-1+var(--toast-swipe-movement-y))]`,`data-[position*=top]:transform-[translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)+(var(--toast-index)*var(--toast-peek))+(var(--toast-shrink)*var(--toast-calc-height))))_scale(var(--toast-scale))]`,`data-[position*=bottom]:transform-[translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)-(var(--toast-index)*var(--toast-peek))-(var(--toast-shrink)*var(--toast-calc-height))))_scale(var(--toast-scale))]`,`data-limited:opacity-0`,`data-position:data-expanded:transform-[translateX(var(--toast-swipe-movement-x))_translateY(var(--toast-calc-offset-y))]`,`data-[position*=top]:data-starting-style:transform-[translateY(calc(-100%-var(--toast-inset)))]`,`data-[position*=bottom]:data-starting-style:transform-[translateY(calc(100%+var(--toast-inset)))]`,`data-[position*=top]:data-[position*=right]:data-starting-style:transform-[translateX(calc(100%+var(--toast-inset)))_translateY(var(--toast-calc-offset-y))]`,`data-ending-style:opacity-0`,`data-ending-style:not-data-limited:not-data-swipe-direction:transform-[translateY(calc(var(--toast-calc-offset-y)-100%-var(--toast-inset)))]`,`data-ending-style:data-[swipe-direction=left]:transform-[translateX(calc(var(--toast-swipe-movement-x)-100%-var(--toast-inset)))_translateY(var(--toast-calc-offset-y))]`,`data-ending-style:data-[swipe-direction=right]:transform-[translateX(calc(var(--toast-swipe-movement-x)+100%+var(--toast-inset)))_translateY(var(--toast-calc-offset-y))]`,`data-ending-style:data-[swipe-direction=up]:transform-[translateY(calc(var(--toast-swipe-movement-y)-100%-var(--toast-inset)))]`,`data-ending-style:data-[swipe-direction=down]:transform-[translateY(calc(var(--toast-swipe-movement-y)+100%+var(--toast-inset)))]`,`data-expanded:data-ending-style:data-[swipe-direction=left]:transform-[translateX(calc(var(--toast-swipe-movement-x)-100%-var(--toast-inset)))_translateY(var(--toast-calc-offset-y))]`,`data-expanded:data-ending-style:data-[swipe-direction=right]:transform-[translateX(calc(var(--toast-swipe-movement-x)+100%+var(--toast-inset)))_translateY(var(--toast-calc-offset-y))]`,`data-expanded:data-ending-style:data-[swipe-direction=up]:transform-[translateY(calc(var(--toast-swipe-movement-y)-100%-var(--toast-inset)))]`,`data-expanded:data-ending-style:data-[swipe-direction=down]:transform-[translateY(calc(var(--toast-swipe-movement-y)+100%+var(--toast-inset)))]`),"data-position":n,onPointerEnter:()=>{t.data?.sharedToastId&&Z.pause(t.data.sharedToastId,`pointer`)},onPointerLeave:()=>{t.data?.sharedToastId&&Z.resume(t.data.sharedToastId,`pointer`)},onFocusCapture:()=>{t.data?.sharedToastId&&Z.pause(t.data.sharedToastId,`focus`)},onBlurCapture:e=>{t.data?.sharedToastId&&!e.currentTarget.contains(e.relatedTarget)&&Z.resume(t.data.sharedToastId,`focus`)},style:{"--toast-index":r,"--toast-offset-y":`${i}px`},swipeDirection:n.includes(`center`)?[o?`up`:`down`]:n.includes(`left`)?[`left`,o?`up`:`down`]:[`right`,o?`up`:`down`],toast:t,children:[(0,J.jsx)(an,{dismissAfterVisibleMs:t.data?.dismissAfterVisibleMs,toastId:t.id}),(0,J.jsxs)(tt,{className:W(`pointer-events-auto flex min-h-0 items-center justify-between gap-2 overflow-y-visible py-3 pr-2 pl-3.5 text-sm transition-opacity duration-250 [overflow-x:clip] data-expanded:opacity-100`,a&&`not-data-expanded:pointer-events-none not-data-expanded:opacity-0`),children:[(0,J.jsx)(en,{...s,actionProps:t.actionProps,toastData:t.data,toastDescription:t.description,toastType:t.type}),(0,J.jsx)(Kt,{onClick:()=>{let e=t.data?.sharedToastId;e?Z.dismiss(e):Gt($,t.id,t.data?.onClose)}})]})]},t.id)}),v;t[10]!==n||t[11]!==g||t[12]!==_||t[13]!==f.Viewport||t[14]!==p?(v=(0,J.jsx)(f.Viewport,{className:p,"data-position":n,"data-slot":`toast-viewport`,style:g,children:_}),t[10]=n,t[11]=g,t[12]=_,t[13]=f.Viewport,t[14]=p,t[15]=v):v=t[15];let y;return t[16]!==v||t[17]!==d.Portal?(y=(0,J.jsx)(d.Portal,{"data-slot":`toast-portal`,children:v}),t[16]=v,t[17]=d.Portal,t[18]=y):y=t[18],y}function cn(e){return e.id}function ln(e){let t=(0,Q.c)(7),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;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,J.jsx)(un,{}),t[3]=i):i=t[3];let a;return t[4]!==n||t[5]!==r?(a=(0,J.jsxs)(Ve,{toastManager:Bt,...r,children:[n,i]}),t[4]=n,t[5]=r,t[6]=a):a=t[6],a}function un(){let e=(0,Q.c)(7),{toasts:t}=dt(),n=nn(),r;if(e[0]!==n||e[1]!==t){let i;e[3]===n?i=e[4]:(i=e=>zt(e.data,n),e[3]=n,e[4]=i),r=t.filter(i).map(dn),e[0]=n,e[1]=t,e[2]=r}else r=e[2];let i;return e[5]===r?i=e[6]:(i=(0,J.jsx)(ot,{"data-slot":`toast-portal-anchored`,children:(0,J.jsx)(Ue,{className:`outline-none`,"data-slot":`toast-viewport-anchored`,children:r})}),e[5]=r,e[6]=i),i}function dn(e){let t=e.data?.tooltipStyle??!1,n=e.positionerProps,r=$t(e);return n?.anchor?(0,J.jsx)(lt,{className:`z-100 max-w-[min(--spacing(64),var(--available-width))]`,"data-slot":`toast-positioner`,sideOffset:n.sideOffset??4,toast:e,children:(0,J.jsx)(et,{className:W(`dropdown-glass relative overflow-visible text-balance text-popover-foreground text-xs shadow-xl shadow-black/25 transition-[scale,opacity] data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0`,t?`rounded-md`:`rounded-lg`),"data-slot":`toast-popup`,toast:e,children:t?(0,J.jsx)(tt,{className:`pointer-events-auto px-2 py-1`,children:(0,J.jsx)(rt,{"data-slot":`toast-title`})}):(0,J.jsxs)(tt,{className:`pointer-events-auto flex min-h-0 items-center justify-between gap-1.5 overflow-y-visible py-3 pr-2 pl-3.5 text-sm [overflow-x:clip]`,children:[(0,J.jsx)(en,{...r,actionProps:e.actionProps,toastData:e.data,toastDescription:e.description,toastType:e.type}),(0,J.jsx)(Kt,{onClick:()=>Gt(Bt,e.id,e.data?.onClose)})]})})},e.id):null}export{Oe as _,jt as a,Pt as c,Nt as d,Et as f,Me as g,Z as h,$ as i,Mt as l,Tt as m,on as n,At as o,Dt as p,Bt as r,Ot as s,ln as t,kt as u,ke as v,De as y};
2
- //# sourceMappingURL=toast-Dkj3G-UM.js.map
@@ -1,2 +0,0 @@
1
- import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{$y as i,Fs as a,H_ as o,Id as s,Lb as c,Ms as l,Ns as u,Qo as d,Ud as f,Wb as p,Xn as m,Zn as h,_b as g,_s as _,as as v,cs as y,dm as b,dr as x,ep as S,er as C,fr as w,hE as T,ll as E,nm as D,nr as O,ns as k,or as A,pr as ee,sb as j,t as M,uh as N,vv as P,wm as F}from"./utils-CcBaVOX5.js";import{B as I,L,W as R,q as z}from"./runtime-DeVKKxNz.js";import{a as B,c as V,o as te,s as ne,t as re}from"./select-oshTwPZM.js";import{t as ie}from"./useNavigateBack-DUje4FcE.js";import{rt as ae}from"./useSettings-Cg0O7Ek7.js";import{f as oe,s as se}from"./server-Ct4-BCZx.js";import{n as H,t as U}from"./session-Bb7JWdWO.js";import{t as ce}from"./use-atom-command-D4TeQyNE.js";import{a as le,c as ue,d as W,f as G,i as de,l as K,n as fe,o as pe,r as q,s as J,t as Y,u as me}from"./usageFormat-D1mf8I5d.js";import{t as he}from"./env-wK1YYxA8.js";import{a as ge,n as _e,t as ve}from"./tooltip-BeHmtauD.js";import{t as X}from"./skeleton-DIPW_H7N.js";import{n as ye,t as be}from"./toggle-group-hQw0fxkT.js";import{t as xe}from"./input-CSgYZgdv.js";import{t as Se}from"./scroll-area-C9Jh_pl0.js";import{a as Ce,c as we,i as Te,o as Ee,r as De,s as Oe,t as ke}from"./dialog-CjB1WWbE.js";import{o as Ae}from"./sidebar-PSpwc3Zu.js";import{t as je}from"./observeResize-Br7VOcTc.js";import{y as Me}from"./keybindings-B9X0TLvu.js";import{i as Ne,o as Pe,t as Fe}from"./popover-Cpc0L75h.js";import{S as Ie,n as Le,t as Re}from"./ChatGptUsageButton-C3xHekTe.js";import{t as ze}from"./WorkspacePageContainer-C3u06BW-.js";import{n as Be,r as Ve,t as He}from"./usageShortcuts-C0jTsdR4.js";import{Eo as Ue,Fr as We,Ir as Ge,Lr as Ke,Pr as qe,Sa as Je,da as Ye,oi as Xe}from"./main-DIEsHSIy.js";import{t as Ze}from"./WorkspacePageHeader-MBEFb20_.js";import{i as Qe,n as $e,r as et,t as tt}from"./WorkspaceBreadcrumb-Dpau2BKr.js";import{t as nt}from"./usageAccess-DTKEwCKL.js";var Z=e(t(),1),Q=n(),rt=c(z);function it(e,t){return e?.sources.some(e=>e.action===`enableCursorKeychain`)===!0&&t?.some(e=>e.driver===`cursor`&&e.status===`ready`)===!0}function at(e){return e.some(e=>e.summary?.sources.some(e=>e.fingerprint.provider===`cursor`&&e.fingerprint.hostId===`cursor.com`))?[]:e.filter(e=>e.needsCursorKeychainAccess)}var ot=new Map,st=new Map;async function ct(e,t,n=!1,r=!1){let i=st.get(e);if(i!==void 0){if(r){try{await i}catch{}return ct(e,t,!1,!0)}return n?void 0:await i}let a=ot.get(e)??0;if(n&&Date.now()<a)return;let o=Promise.resolve().then(t).finally(()=>{st.delete(e),ot.set(e,Date.now()+3e5)});return st.set(e,o),await o}async function lt({registry:e,server:t,presentations:n,environmentIds:r,input:i}){await Promise.all(r.map(async r=>{let a=t.usageSummary({environmentId:r,input:i}),o=n.presentationAtom(r),s=new AbortController,c=()=>{e.get(o)?.connection.phase!==`connected`&&s.abort()},l=e.subscribe(o,c);c();try{let n=await I(e,t.refreshUsageRates,{environmentId:r,input:{}},{reportFailure:!1}),i=n._tag===`Failure`&&rt(R(n));if(e.refresh(a),i||s.signal.aborted)return;await L(e,a,{reportFailure:!1,signal:s.signal})}finally{l()}}))}function ut(e,t=!1){let{summary:n}=e;if(!e.isConnected||e.error!==null)return{phase:`inactive`};if(n===null)return{phase:`loading`};if(t)return{phase:`stale`};if(!e.isPending)return{phase:`ready`};let r=[...new Set(n.sources.flatMap(e=>e.refreshing?[e.fingerprint.provider]:[]))];return r.length>0?{phase:`partway`,providers:r}:{phase:`stale`}}function dt(e,t){return e.length===1?`Updating ${t(e[0])}…`:`Updating ${e.length} providers…`}function ft(e,t=!1){let n=new Set,r=!1;for(let i of e){let e=ut(i,t);if((e.phase===`loading`||e.phase===`stale`)&&(r=!0),e.phase===`partway`)for(let t of e.providers)n.add(t)}return{partial:r||n.size>0,everyProvider:r,providers:n}}function pt(e){return e.records>0&&e.unpricedRecords>=e.records}function mt(e){return[e.hostId,e.provider,e.resolvedHomePath,e.volumeId].join(` `)}function ht(e,t){let n=e.sources.filter(e=>e.fingerprint.provider===t.fingerprint.provider);return e.buckets.filter(e=>e.provider===t.fingerprint.provider&&(e.sourcePath===t.fingerprint.resolvedHomePath||e.sourcePath===void 0&&n.length===1))}function gt(e){return JSON.stringify([e.day,e.hourStart??null,e.provider,e.model])}function _t(e){let t=new Map,n=new Map,r=new Map,i=new Map,a=new Map,o=[],s=[...e].sort((e,t)=>(Date.parse(t.summary.readAt)||0)-(Date.parse(e.summary.readAt)||0)||e.environmentId.localeCompare(t.environmentId));for(let e of[`ok`,`partial`,`failed`])for(let r of s)for(let i of r.summary.sources){if(i.status!==e)continue;let s=mt(i.fingerprint);t.has(s)?o.push(`${r.label}: ${i.fingerprint.resolvedHomePath}`):(t.set(s,r.environmentId),n.set(s,{environment:r,source:i}),a.set(s,i.distinctSessions))}for(let e of s)for(let t of e.summary.sources){if(t.status!==`partial`)continue;let o=mt(t.fingerprint),s=n.get(o);if(s?.source.status!==`ok`||Date.parse(e.summary.readAt)<=Date.parse(s.environment.summary.readAt))continue;let c=r.get(o);c===void 0&&(c=new Set(ht(s.environment.summary,s.source).map(gt)),r.set(o,c));let l=i.get(e.environmentId)??new Set,u=!1;for(let n of ht(e.summary,t)){let e=gt(n);c.has(e)||(c.add(e),l.add(n),u=!0)}u&&(i.set(e.environmentId,l),a.set(o,Math.max(a.get(o)??0,t.distinctSessions)))}return{ownerByFingerprint:t,supplementalBucketsByEnvironment:i,sessionsByFingerprint:a,duplicates:o}}function vt(e,t,n,r){let i=new Set,a=new Set,o=new Map;for(let n of e.summary.sources){if(n.status===`missing`)continue;let s=mt(n.fingerprint);if(t.get(s)===e.environmentId){let e=n.fingerprint.provider;i.add(e),a.add(`${e}\u0000${n.fingerprint.resolvedHomePath}`),o.set(e,(o.get(e)??0)+(r.get(s)??n.distinctSessions))}}return{buckets:e.summary.buckets.filter(e=>n.has(e)||(e.sourcePath===void 0?i.has(e.provider):a.has(`${e.provider}\u0000${e.sourcePath}`))),sessionsByProvider:o}}function yt(e){return e.totals.uncachedInputTokens+e.totals.cachedInputTokens+e.totals.cacheCreationTokens+e.totals.outputTokens}function bt(e,t){return e>=4&&e<=t}var xt={costUsd:0,uncachedInputTokens:0,cachedInputTokens:0,cacheCreationTokens:0,outputTokens:0,reasoningTokens:0,totalTokens:0,records:0,sessions:0,providers:[],models:[],daily:[],hourly:[],costQuality:{providerReportedShare:0,modelPricedShare:0,unpricedShare:0,cacheSavingsUsd:0},categoryCost:{input:0,cacheRead:0,cacheWrite:0,output:0,unsplit:0},speedCost:{standard:0,fast:0,ultrafast:0,premium:0},duplicateSources:[],contributingEnvironments:[],contractMismatches:[]};function St(e,t){if(e.length===0)return xt;let n=[],r=[];for(let i of e)bt(i.summary.contractVersion,t)?n.push(i):r.push({environmentId:i.environmentId,direction:i.summary.contractVersion<t?`serverBehind`:`clientBehind`,contractVersion:i.summary.contractVersion});let{ownerByFingerprint:i,supplementalBucketsByEnvironment:a,sessionsByFingerprint:o,duplicates:s}=_t(n),c=0,l=0,u=0,d=0,f=0,p=0,m=0,h=0,g=0,_=0,v=0,y={input:0,cacheRead:0,cacheWrite:0,output:0},b={fast:0,ultrafast:0,premium:0},x=new Map,S=new Map,C=new Map,w=new Map,T=[];for(let e of n){let{buckets:t,sessionsByProvider:n}=vt(e,i,a.get(e.environmentId)??new Set,o);t.length>0&&T.push(e.environmentId);for(let[e,t]of n){if(h+=t,t===0)continue;let n=x.get(e)??{costUsd:0,totalTokens:0,records:0,sessions:0};n.sessions+=t,x.set(e,n)}for(let e of t){let t=yt(e);c+=e.costUsd,g+=e.cacheSavingsUsd,l+=e.totals.uncachedInputTokens,u+=e.totals.cachedInputTokens,d+=e.totals.cacheCreationTokens,f+=e.totals.outputTokens,p+=e.totals.reasoningTokens,m+=e.records,v+=e.unpricedRecords,e.costSource===`providerReported`&&(_+=e.records),e.categoryCostUsd!==void 0&&(y.input+=e.categoryCostUsd.input,y.cacheRead+=e.categoryCostUsd.cacheRead,y.cacheWrite+=e.categoryCostUsd.cacheWrite,y.output+=e.categoryCostUsd.output),b.fast+=e.fastCostUsd??0,b.ultrafast+=e.ultrafastCostUsd??0,b.premium+=e.speedPremiumUsd??0;let n=x.get(e.provider)??{costUsd:0,totalTokens:0,records:0,sessions:0};n.costUsd+=e.costUsd,n.totalTokens+=t,n.records+=e.records,x.set(e.provider,n);let r=`${e.provider} ${e.model}`,i=S.get(r)??{provider:e.provider,costUsd:0,totalTokens:0,tokens:{uncachedInputTokens:0,cachedInputTokens:0,cacheCreationTokens:0,outputTokens:0,reasoningTokens:0},records:0,unpricedRecords:0,unpricedTokens:0};i.costUsd+=e.costUsd,i.totalTokens+=t,i.tokens={uncachedInputTokens:i.tokens.uncachedInputTokens+e.totals.uncachedInputTokens,cachedInputTokens:i.tokens.cachedInputTokens+e.totals.cachedInputTokens,cacheCreationTokens:i.tokens.cacheCreationTokens+e.totals.cacheCreationTokens,outputTokens:i.tokens.outputTokens+e.totals.outputTokens,reasoningTokens:i.tokens.reasoningTokens+e.totals.reasoningTokens},i.records+=e.records,i.unpricedRecords+=e.unpricedRecords,e.records>0&&(i.unpricedTokens+=t*e.unpricedRecords/e.records),S.set(r,i);let a=C.get(e.day)??{costUsd:0,totalTokens:0,byProvider:new Map};a.costUsd+=e.costUsd,a.totalTokens+=t;let o=a.byProvider.get(e.provider)??{costUsd:0,totalTokens:0};if(o.costUsd+=e.costUsd,o.totalTokens+=t,a.byProvider.set(e.provider,o),C.set(e.day,a),e.hourStart!==void 0){let n=w.get(e.hourStart)??{day:e.day,hourStart:e.hourStart,costUsd:0,totalTokens:0,byProvider:new Map};n.costUsd+=e.costUsd,n.totalTokens+=t;let r=n.byProvider.get(e.provider)??{costUsd:0,totalTokens:0};r.costUsd+=e.costUsd,r.totalTokens+=t,n.byProvider.set(e.provider,r),w.set(e.hourStart,n)}}}let E=l+u+d+f,D=[...x.entries()].map(([e,t])=>({provider:e,costUsd:t.costUsd,totalTokens:t.totalTokens,records:t.records,sessions:t.sessions,costShare:c===0?0:t.costUsd/c,tokenShare:E===0?0:t.totalTokens/E})).sort((e,t)=>t.costUsd-e.costUsd),O=[...S.entries()].map(([e,t])=>({model:e.slice(e.indexOf(` `)+1),provider:t.provider,costUsd:t.costUsd,totalTokens:t.totalTokens,tokens:t.tokens,records:t.records,unpricedRecords:t.unpricedRecords,unpricedTokens:t.unpricedTokens,costShare:c===0?0:t.costUsd/c,tokenShare:E===0?0:t.totalTokens/E})).sort((e,t)=>t.costUsd-e.costUsd||t.totalTokens-e.totalTokens),k=[...C.entries()].map(([e,t])=>({day:e,costUsd:t.costUsd,totalTokens:t.totalTokens,byProvider:t.byProvider})).sort((e,t)=>e.day.localeCompare(t.day)),A=[...w.values()].sort((e,t)=>e.hourStart.localeCompare(t.hourStart));return{costUsd:c,uncachedInputTokens:l,cachedInputTokens:u,cacheCreationTokens:d,outputTokens:f,reasoningTokens:p,totalTokens:E,records:m,sessions:h,providers:D,models:O,daily:k,hourly:A,costQuality:{providerReportedShare:m===0?0:_/m,unpricedShare:m===0?0:v/m,modelPricedShare:m===0?0:(m-_-v)/m,cacheSavingsUsd:g},categoryCost:{...y,unsplit:Math.max(0,c-y.input-y.cacheRead-y.cacheWrite-y.output)},speedCost:{...b,standard:Math.max(0,c-b.fast-b.ultrafast)},duplicateSources:s,contributingEnvironments:T,contractMismatches:r}}var Ct=v(e=>y(t=>{let n=JSON.parse(e),r=t(ae.presentationsAtom),i=[];for(let[e,a]of r){let r=a.connection.phase===`connected`,o=t(U.sessionStateAtom(e)),s=nt({connectionPhase:a.connection.phase,session:T(l(o)),hasSessionError:o._tag===`Failure`});if(!s.canReadDiagnostics){i.push({environmentId:e,label:a.entry.target.label,isConnected:r,...s,summary:null,needsCursorKeychainAccess:!1});continue}let c=t(oe.usageSummary({environmentId:e,input:n})),u=T(l(c));i.push({environmentId:e,label:a.entry.target.label,isPending:c.waiting,canReadDiagnostics:!0,isConnected:r,error:c._tag===`Failure`?`This environment could not report usage.`:null,summary:u,needsCursorKeychainAccess:it(u,t(oe.providersValueAtom(e)))})}return i}).pipe(_(`web-usage:window:${e}`)));function wt(e,t){return St(e.flatMap(({environmentId:e,label:n,summary:r})=>r===null?[]:[{environmentId:e,label:n,summary:t===void 0?r:{...r,buckets:r.buckets.filter(t)}}]),6)}var Tt=new Set;function Et(e,t){return t.size===0?e:e.map(e=>e.summary===null?e:{...e,summary:{...e.summary,buckets:e.summary.buckets.filter(e=>!t.has(e.provider)),sources:e.summary.sources.filter(e=>!t.has(e.fingerprint.provider))}})}function Dt(e,t,n){let r=(0,Q.c)(36),i=t===void 0?null:t,a=n===void 0?Tt:n,o;r[0]!==e.resolution||r[1]!==e.sinceDay||r[2]!==e.sinceTime||r[3]!==e.timeZone||r[4]!==e.untilDay||r[5]!==e.untilTime?(o=JSON.stringify({sinceDay:e.sinceDay,untilDay:e.untilDay,timeZone:e.timeZone,resolution:e.resolution,sinceTime:e.sinceTime,untilTime:e.untilTime}),r[0]=e.resolution,r[1]=e.sinceDay,r[2]=e.sinceTime,r[3]=e.timeZone,r[4]=e.untilDay,r[5]=e.untilTime,r[6]=o):o=r[6];let s=o,c;r[7]===s?c=r[8]:(c=Ct(s),r[7]=s,r[8]=c);let l=k(c),u;r[9]!==l||r[10]!==i?(u=i===null?l:l.filter(e=>i.has(e.environmentId)),r[9]=l,r[10]=i,r[11]=u):u=r[11];let f=u,p;r[12]!==f||r[13]!==s?(p=e=>lt({registry:d,server:oe,presentations:ae,environmentIds:f.filter(jt).map(At),input:e??JSON.parse(s)}),r[12]=f,r[13]=s,r[14]=p):p=r[14];let m=p,h;r[15]!==a||r[16]!==f?(h=wt(Et(f,a)),r[15]=a,r[16]=f,r[17]=h):h=r[17];let g=h,_;r[18]===f?_=r[19]:(_=f.filter(kt),r[18]=f,r[19]=_);let v=_.length,y;r[20]===f?y=r[21]:(y=f.filter(Ot),r[20]=f,r[21]=y);let b=y.length,x=v===0&&b>0,[S,C]=(0,Z.useState)(null);v>0&&(S?.merged!==g||S.window!==e||S.selection!==i||S.hidden!==a)&&C({window:e,merged:g,selection:i,hidden:a});let w=S?.selection===i&&S.hidden===a?S:null,T;r[22]!==v||r[23]!==e||r[24]!==x||r[25]!==w||r[26]!==g?(T=v>0?{window:e,merged:g}:w??(x?null:{window:e,merged:g}),r[22]=v,r[23]=e,r[24]=x,r[25]=w,r[26]=g,r[27]=T):T=r[27];let E=T,D=v>0&&b>0,O;return r[28]!==l||r[29]!==x||r[30]!==g||r[31]!==m||r[32]!==f||r[33]!==E||r[34]!==D?(O={merged:g,environments:l,selectedEnvironments:f,isPending:x,shown:E,isPartial:D,refresh:m},r[28]=l,r[29]=x,r[30]=g,r[31]=m,r[32]=f,r[33]=E,r[34]=D,r[35]=O):O=r[35],O}function Ot(e){return e.summary===null&&e.error===null}function kt(e){return e.summary!==null}function At(e){let{environmentId:t}=e;return t}function jt(e){return e.canReadDiagnostics&&H(e.environmentId,`diagnostics:read`)}var $=e(r(),1);function Mt(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=M(`w-full caption-bottom text-xs`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,$.jsx)(`table`,{"data-slot":`table`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Nt(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=M(`[&_tr]:border-b`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`thead`,{"data-slot":`table-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Pt(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=M(`[&_tr:last-child]:border-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`tbody`,{"data-slot":`table-body`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ft(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=M(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`tr`,{"data-slot":`table-row`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function It(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=M(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`th`,{"data-slot":`table-head`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Lt(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=M(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`td`,{"data-slot":`table-cell`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Rt=[{key:`inputCostPerMillionTokens`,label:`Input`,optional:!1},{key:`outputCostPerMillionTokens`,label:`Output`,optional:!1},{key:`cacheReadCostPerMillionTokens`,label:`Cache read`,optional:!0},{key:`cacheWriteCostPerMillionTokens`,label:`Cache write`,optional:!0}];function zt(e=``,t){return{model:e,inputCostPerMillionTokens:t?.inputCostPerMillionTokens.toString()??``,outputCostPerMillionTokens:t?.outputCostPerMillionTokens.toString()??``,cacheReadCostPerMillionTokens:t?.cacheReadCostPerMillionTokens?.toString()??``,cacheWriteCostPerMillionTokens:t?.cacheWriteCostPerMillionTokens?.toString()??``}}function Bt(e){let t=e.model.trim();if(t.length===0)return null;let n={};for(let t of Rt){let r=e[t.key].trim();if(r===``){if(t.optional)continue;return null}if(!/^(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i.test(r))return null;let i=Number(r);if(!Number.isFinite(i)||i<0)return null;n[t.key]=i}return n.inputCostPerMillionTokens===void 0||n.outputCostPerMillionTokens===void 0?null:{model:t,price:{inputCostPerMillionTokens:n.inputCostPerMillionTokens,outputCostPerMillionTokens:n.outputCostPerMillionTokens,...n.cacheReadCostPerMillionTokens===void 0?{}:{cacheReadCostPerMillionTokens:n.cacheReadCostPerMillionTokens},...n.cacheWriteCostPerMillionTokens===void 0?{}:{cacheWriteCostPerMillionTokens:n.cacheWriteCostPerMillionTokens}}}}function Vt(e){return e.isNew&&e.model.trim()===``&&(e.alias??``).trim()===``&&Object.values(e.values).every(e=>e.trim()===``)}function Ht(e,t){return e.prices&&Object.hasOwn(e.prices,t)?e.prices[t]:void 0}function Ut(e,t){return e.aliases&&Object.hasOwn(e.aliases,t)?e.aliases[t]:void 0}function Wt(e,t){if(e.some(e=>e.aliases===null))return{value:``,placeholder:`Unavailable`};let n=e.map(e=>Ut(e,t)??``);return n.some(e=>e!==n[0])?{value:``,placeholder:`Mixed`}:{value:n[0]??``,placeholder:`None`}}function Gt(e,t,n){let r=Rt.find(e=>e.key===n).optional,i=e.map(e=>Ht(e,t)?zt(t,Ht(e,t))[n]:null);return e.some(e=>e.prices===null)?{value:``,placeholder:`Unavailable`}:i.some(e=>e!==i[0])?{value:``,placeholder:`Mixed`}:{value:i[0]??``,placeholder:i[0]===null?`Automatic`:r?`Input rate`:`0.00`}}function Kt(e,t){let n=[],r=new Map;for(let i of t){if(Vt(i))continue;let t=i.model.trim(),a=Ut(e,t);if(i.removed){Ht(e,t)&&n.push({model:t,price:null}),a!==void 0&&n.push({model:t,alias:null});continue}let o=(i.alias??a??``).trim();if(o!==``){t===``?r.set(i.id,`Enter a model ID.`):o===t?r.set(i.id,`Map to a different model.`):(o!==a&&n.push({model:t,alias:o}),Ht(e,t)&&n.push({model:t,price:null}));continue}if(a!==void 0&&(n.push({model:t,alias:null}),!Ht(e,t)&&Object.values(i.values).every(e=>e.trim()===``)))continue;let s=zt(t,Ht(e,t)),c={...s,...i.values},l=Bt(c);if(l===null){let n=Rt.find(e=>!e.optional&&c[e.key].trim()===``);r.set(i.id,t===``?`Enter a model ID.`:n?`${n.label} is required on ${e.label}.`:`Use non-negative numbers for prices.`);continue}let u=zt(t,l.price);Rt.some(e=>s[e.key]!==u[e.key])&&n.push(l)}return{changes:n,errors:r}}function qt(e,t){return new Map(e.filter(e=>e.unavailable===null&&e.prices!==null).flatMap(e=>[...Kt(e,t).errors]))}async function Jt(e){await Promise.all(e.targets.map(async t=>{let n,r=e.changes.get(t.environmentId)??[],i=r.flatMap(e=>`price`in e?[[e.model,e.price]]:[]),a=r.flatMap(e=>`alias`in e?[[e.model,e.alias]]:[]);if(t.unavailable!==null)n={status:`failed`,error:t.unavailable};else if(a.length>0&&t.aliases===null)n={status:`failed`,error:`Update server to map models`};else try{n=(r.length===0?{_tag:`Success`}:await e.write({environmentId:t.environmentId,input:{patch:{...i.length>0?{usagePriceOverrides:Object.fromEntries(i)}:{},...a.length>0?{usageModelAliases:Object.fromEntries(a)}:{}}}}))._tag===`Success`?{status:`saved`}:{status:`failed`,error:`Could not save. Try again.`}}catch{n={status:`failed`,error:`Could not save. Try again.`}}e.onResult(t.environmentId,n)}))}var Yt=y(e=>[...e(ae.presentationsAtom)].map(([t,n])=>{let r=e(oe.settingsValueAtom(t)),i=e(U.sessionStateAtom(t)),a=T(l(i)),o=i._tag===`Failure`?`denied`:a===null?i.waiting?`pending`:`denied`:P(a,`settings:write`)?`granted`:`denied`;return{environmentId:t,label:n.entry.target.label,prices:r?.usagePriceOverrides??null,aliases:n.serverConfig?.environment.capabilities.usageModelAliases===!0?r?.usageModelAliases??null:null,unavailable:n.connection.phase===`connected`?r===null?`Prices not loaded`:n.serverConfig?.environment.capabilities.usagePriceOverrides===!0?o===`pending`?`Checking permissions…`:o===`denied`?`Read-only access`:null:`Update server to edit prices`:`Offline`}}));function Xt(e){let t=(0,Q.c)(119),{usage:n,initialSelectedEnvironmentIds:r,initialModel:i,onOpenChange:a}=e,o=k(Yt),[c,l]=(0,Z.useState)(r),u;if(t[0]!==o||t[1]!==c){let e;t[3]===c?e=t[4]:(e=e=>c===null||c.has(e.environmentId),t[3]=c,t[4]=e),u=o.filter(e),t[0]=o,t[1]=c,t[2]=u}else u=t[2];let d=u,f;t[5]!==i||t[6]!==d?(f=()=>i===void 0||d.some(e=>Object.hasOwn(e.prices??{},i)||Object.hasOwn(e.aliases??{},i))?[]:[{id:`new:initial`,model:i,isNew:!0,values:{}}],t[5]=i,t[6]=d,t[7]=f):f=t[7];let[p,g]=(0,Z.useState)(f),[_,v]=(0,Z.useState)(!1),[y,S]=(0,Z.useState)(null),C=(0,Z.useRef)(null),T=(0,Z.useRef)(0),E;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(E={reportFailure:!1},t[8]=E):E=t[8];let ee=ce(oe.updateSettings,E),j,P,F,I,L,R,z,B,V,te,ne,re,ie,ae,se;if(t[9]!==y||t[10]!==p||t[11]!==o||t[12]!==a||t[13]!==_||t[14]!==d||t[15]!==c||t[16]!==ee||t[17]!==n){let e=[...new Set(d.flatMap(mn))].sort(),r;t[33]===d?r=t[34]:(r=e=>d.some(t=>t.environmentId===e.environmentId),t[33]=d,t[34]=r);let i=[...new Set([...e,...n.filter(r).flatMap(fn)])].sort(),u;t[35]===p?u=t[36]:(u=new Set(p.filter(dn).map(un)),t[35]=p,t[36]=u);let f=u,E;t[37]!==y||t[38]!==f?(E=e=>y===null||!f.has(e),t[37]=y,t[38]=f,t[39]=E):E=t[39];let k=[...e.filter(E).map(e=>p.find(t=>t.id===`model:${e}`)??{id:`model:${e}`,model:e,isNew:!1,values:{}}),...p.filter(ln)],oe=p.filter(cn);R=qt(d,oe);for(let t of oe)t.isNew&&(t.model.trim()===``?R.set(t.id,`Enter a model ID.`):y===null&&(e.includes(t.model.trim())||p.some(e=>e.id!==t.id&&e.model.trim()===t.model.trim()))&&R.set(t.id,`This model already has a row. Edit its prices there.`));z=y?.destinations.filter(e=>y.results.get(e.environmentId)?.status===`failed`)??[];let U=_||z.length>0;B=oe.length>0,I=d.length===1?d[0].label:`${d.length} environments`;let ce=c===null?`All environments`:I,le;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>{g([]),S(null)},t[40]=le):le=t[40],L=le;let ue;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(ue=e=>{l(e),S(null)},t[41]=ue):ue=t[41];let W=ue,G;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(G=e=>{g(t=>t.some(t=>t.id===e.id)?t.map(t=>t.id===e.id?e:t):[...t,e]),S(null)},t[42]=G):G=t[42];let de=G,K=sn,fe;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(fe=e=>{!e.isNew&&Object.keys(e.values).length===0&&e.alias===void 0?g(t=>t.filter(t=>t.id!==e.id)):de(e)},t[43]=fe):fe=t[43];let pe=fe,q;t[44]===d?q=t[45]:(q=(e,t,n)=>{let r={...e.values,[t]:n},i=Gt(d,e.model,t);K(e,i,n)&&delete r[t],pe({...e,values:r})},t[44]=d,t[45]=q);let J=q,Y;t[46]===d?Y=t[47]:(Y=(e,t)=>{let{alias:n,...r}=e,i=Wt(d,e.model);pe(K(e,i,t)?r:{...r,alias:t})},t[46]=d,t[47]=Y);let me=Y;V=async e=>{let t=e!==void 0&&e;if(_)return;let n=t?z:d,r=t&&y?y.drafts:oe;if(n.length===0||r.length===0)return;let i=n.map(e=>o.find(t=>t.environmentId===e.environmentId)??{...e,prices:null,aliases:null,unavailable:`Environment removed`}),a=new Map(i.map(e=>[e.environmentId,Kt(e,r)]));v(!0),S(e=>({drafts:r,destinations:t&&e?e.destinations:i,results:new Map([...t&&e?e.results:[],...i.map(on)])}));let s=!1;await Jt({targets:i.map(e=>({...e,unavailable:e.unavailable??[...a.get(e.environmentId).errors.values()][0]??null})),changes:new Map([...a].map(an)),write:async e=>H(e.environmentId,`settings:write`)?ee(e):{_tag:`Failure`},onResult:(e,t)=>{t.status===`failed`&&(s=!0),S(n=>n===null?null:{...n,results:new Map(n.results).set(e,t)})}}),v(!1),s||g([])},F=ke,ae=!0,t[48]!==a||t[49]!==_?(se=e=>{_||a(e)},t[48]=a,t[49]=_,t[50]=se):se=t[50],P=Oe,re=`max-w-4xl`,t[51]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsxs)(Ce,{children:[(0,$.jsx)(we,{children:`Custom model prices`}),(0,$.jsx)(De,{children:`Prices and mappings apply to all past and future usage on the environments you select.`})]}),t[51]=ie):ie=t[51],j=Ee;let he;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,$.jsx)(Ye,{id:`usage-prices-apply-label`,className:`shrink-0`,children:`Apply to`}),t[52]=he):he=t[52];let X;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,$.jsx)(w,{variant:`outline`,size:`sm`,className:`min-w-0`}),t[53]=X):X=t[53];let ye=_||B,be;t[54]===ce?be=t[55]:(be=(0,$.jsx)(`span`,{id:`usage-prices-selection`,className:`truncate`,children:ce}),t[54]=ce,t[55]=be);let Se;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,$.jsx)(s,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[56]=Se):Se=t[56];let Te;t[57]!==ye||t[58]!==be?(Te=(0,$.jsxs)(x,{render:X,"aria-labelledby":`usage-prices-apply-label usage-prices-selection`,disabled:ye,children:[be,Se]}),t[57]=ye,t[58]=be,t[59]=Te):Te=t[59];let Ae=c===null,je;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(je=e=>W(e?null:new Set),t[60]=je):je=t[60];let Me;t[61]===Ae?Me=t[62]:(Me=(0,$.jsx)(h,{checked:Ae,closeOnClick:!1,onCheckedChange:je,children:`All environments`}),t[61]=Ae,t[62]=Me);let Ne;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,$.jsx)(A,{}),t[63]=Ne):Ne=t[63];let Pe;if(t[64]!==o||t[65]!==d||t[66]!==c){let e;t[68]!==o.length||t[69]!==d||t[70]!==c?(e=e=>(0,$.jsx)(h,{checked:c===null||c.has(e.environmentId),closeOnClick:!1,onCheckedChange:t=>{let n=new Set(d.map(rn));t?n.add(e.environmentId):n.delete(e.environmentId),W(n.size===o.length?null:n)},children:(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.unavailable?(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.unavailable}):null]})},e.environmentId),t[68]=o.length,t[69]=d,t[70]=c,t[71]=e):e=t[71],Pe=o.map(e),t[64]=o,t[65]=d,t[66]=c,t[67]=Pe}else Pe=t[67];let Fe;t[72]!==Me||t[73]!==Pe?(Fe=(0,$.jsxs)(O,{align:`start`,children:[Me,Ne,Pe]}),t[72]=Me,t[73]=Pe,t[74]=Fe):Fe=t[74];let Ie;t[75]!==Te||t[76]!==Fe?(Ie=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[he,(0,$.jsxs)(m,{children:[Te,Fe]})]}),t[75]=Te,t[76]=Fe,t[77]=Ie):Ie=t[77];let Le;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(Le=(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`USD / million tokens`}),t[78]=Le):Le=t[78],t[79]===Ie?te=t[80]:(te=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[Ie,Le]}),t[79]=Ie,t[80]=te),ne=d.length===0?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o.length===0?`Connect an environment to set model prices.`:`Select an environment to see and change its model prices.`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`min-w-0 overflow-hidden rounded-lg border border-border`,children:(0,$.jsxs)(Mt,{className:`min-w-180 table-fixed`,"aria-label":`Custom model prices`,children:[(0,$.jsxs)(`colgroup`,{children:[(0,$.jsx)(`col`,{className:`w-[22%]`}),(0,$.jsx)(`col`,{className:`w-[18%]`}),Rt.map(nn),(0,$.jsx)(`col`,{className:`w-10`})]}),(0,$.jsx)(Nt,{children:(0,$.jsxs)(Ft,{children:[(0,$.jsx)(It,{children:`Model ID`}),(0,$.jsx)(It,{children:`Map to`}),Rt.map(tn),(0,$.jsx)(It,{children:(0,$.jsx)(w,{size:`icon-xs`,variant:`ghost`,"aria-label":`Add model price`,disabled:U,onClick:()=>{T.current+=1;let e=`new:${T.current}`;C.current=e,de({id:e,model:``,isNew:!0,values:{}})},children:(0,$.jsx)(D,{"aria-hidden":!0})})})]})}),(0,$.jsx)(Pt,{children:k.length===0?(0,$.jsx)(Ft,{children:(0,$.jsx)(Lt,{colSpan:7,className:`text-center whitespace-normal`,children:(0,$.jsx)(`p`,{className:`py-6 text-muted-foreground`,children:d.some(en)?`Some environment prices are unavailable.`:`No custom prices or mappings. Add a row to set one.`})})}):k.map(e=>{let t=Wt(d,e.model),n=(e.alias??t.value).trim();return(0,$.jsxs)(Ft,{"data-row-id":e.id,children:[(0,$.jsxs)(Lt,{className:`whitespace-normal`,children:[e.isNew?(0,$.jsx)(xe,{size:`compact`,value:e.model,ref:t=>{t&&C.current===e.id&&(t.focus(),C.current=null)},"aria-label":`New model ID`,"aria-invalid":e.model.trim()!==``&&R.has(e.id)||void 0,list:`usage-price-models`,placeholder:`Model ID`,autoComplete:`off`,spellCheck:!1,disabled:U,onChange:t=>de({...e,model:t.target.value})}):(0,$.jsx)(`span`,{className:M(`block break-all`,e.removed&&`text-muted-foreground line-through`),children:e.model}),R.has(e.id)&&(e.model.trim()!==``||Object.values(e.values).some($t))?(0,$.jsx)(`p`,{role:`alert`,className:`mt-1 text-xs text-destructive`,children:R.get(e.id)}):null]}),e.removed?(0,$.jsx)(Lt,{colSpan:5,children:(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`Automatic pricing after saving`})}):(0,$.jsx)(Lt,{children:(0,$.jsx)(xe,{size:`compact`,value:e.alias??t.value,"aria-label":`Map ${e.model||`new model`} to model`,list:`usage-alias-models`,placeholder:e.isNew?`Optional`:t.placeholder,autoComplete:`off`,spellCheck:!1,disabled:U,onChange:t=>me(e,t.target.value)})}),e.removed?null:n===``?Rt.map(t=>{let n=Gt(d,e.model,t.key);return(0,$.jsx)(Lt,{children:(0,$.jsx)(xe,{size:`compact`,inputMode:`decimal`,"aria-label":`${t.label} price for ${e.model||`new model`}`,value:e.values[t.key]??(e.isNew?``:n.value),placeholder:e.isNew?t.optional?`Input rate`:`0.00`:n.placeholder,autoComplete:`off`,disabled:U,font:`mono`,onChange:n=>J(e,t.key,n.target.value)})},t.key)}):(0,$.jsx)(Lt,{colSpan:4,className:`whitespace-normal`,children:(0,$.jsxs)(`span`,{className:`break-all text-muted-foreground`,children:[`Counted as `,n]})}),(0,$.jsx)(Lt,{children:(0,$.jsxs)(ve,{children:[(0,$.jsx)(ge,{render:(0,$.jsx)(w,{size:`icon-xs`,variant:`ghost`}),disabled:U,"aria-label":e.removed?`Undo reset for ${e.model}`:e.isNew?`Remove new model`:`Reset price for ${e.model} to automatic`,onClick:()=>{e.isNew?g(t=>t.filter(t=>t.id!==e.id)):e.removed?pe({...e,removed:!1}):de({...e,removed:!0})},children:e.isNew?(0,$.jsx)(N,{"aria-hidden":!0}):(0,$.jsx)(b,{"aria-hidden":!0})}),(0,$.jsx)(_e,{children:e.removed?`Undo reset`:e.isNew?`Remove row`:`Reset to automatic`})]})})]},e.id)})})]})}),(0,$.jsx)(`datalist`,{id:`usage-price-models`,children:i.filter(t=>!e.includes(t)).map(Qt)}),(0,$.jsx)(`datalist`,{id:`usage-alias-models`,children:i.filter(e=>d.every(t=>!Object.hasOwn(t.aliases??{},e))).map(Zt)}),(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Blank cache rates use the input price. Enter 0 for free tokens. A mapped model’s usage counts as the model it maps to.`,d.length>1?` Mixed cells keep each environment’s rate until you edit them.`:``]})]}),t[9]=y,t[10]=p,t[11]=o,t[12]=a,t[13]=_,t[14]=d,t[15]=c,t[16]=ee,t[17]=n,t[18]=j,t[19]=P,t[20]=F,t[21]=I,t[22]=L,t[23]=R,t[24]=z,t[25]=B,t[26]=V,t[27]=te,t[28]=ne,t[29]=re,t[30]=ie,t[31]=ae,t[32]=se}else j=t[18],P=t[19],F=t[20],I=t[21],L=t[22],R=t[23],z=t[24],B=t[25],V=t[26],te=t[27],ne=t[28],re=t[29],ie=t[30],ae=t[31],se=t[32];let U;t[81]===y?U=t[82]:(U=y?(0,$.jsx)(`div`,{role:`status`,className:`grid gap-1 text-xs`,children:y.destinations.map(e=>{let t=y.results.get(e.environmentId);return(0,$.jsxs)(`div`,{className:`flex justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`truncate text-muted-foreground`,children:e.label}),(0,$.jsx)(`span`,{className:t?.status===`failed`?`text-right text-destructive`:`text-muted-foreground`,children:t?.status===`failed`?`Not saved · ${t.error}`:t?.status===`saved`?`Saved`:`Saving…`})]},e.environmentId)})}):null,t[81]=y,t[82]=U);let le;t[83]!==j||t[84]!==U||t[85]!==te||t[86]!==ne?(le=(0,$.jsxs)(j,{children:[te,ne,U]}),t[83]=j,t[84]=U,t[85]=te,t[86]=ne,t[87]=le):le=t[87];let ue=B?`Changes apply to ${I}`:``,W;t[88]===ue?W=t[89]:(W=(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:ue}),t[88]=ue,t[89]=W);let G;t[90]!==L||t[91]!==z.length||t[92]!==B||t[93]!==_?(G=B?(0,$.jsx)(w,{variant:`ghost`,disabled:_,onClick:L,children:z.length>0?`Discard pending changes`:`Discard changes`}):null,t[90]=L,t[91]=z.length,t[92]=B,t[93]=_,t[94]=G):G=t[94];let de=_||!B&&z.length===0||z.length===0&&(R.size>0||d.length===0),K;t[95]!==z.length||t[96]!==V?(K=()=>void V(z.length>0),t[95]=z.length,t[96]=V,t[97]=K):K=t[97];let fe=_?`Saving…`:z.length>0?`Retry failed saves`:`Save changes`,pe;t[98]!==de||t[99]!==K||t[100]!==fe?(pe=(0,$.jsx)(w,{disabled:de,onClick:K,children:fe}),t[98]=de,t[99]=K,t[100]=fe,t[101]=pe):pe=t[101];let q;t[102]!==G||t[103]!==pe?(q=(0,$.jsxs)(`div`,{className:`flex w-full flex-wrap justify-end gap-2 sm:w-auto`,children:[G,pe]}),t[102]=G,t[103]=pe,t[104]=q):q=t[104];let J;t[105]!==W||t[106]!==q?(J=(0,$.jsxs)(Te,{variant:`bare`,className:`items-center sm:justify-between`,children:[W,q]}),t[105]=W,t[106]=q,t[107]=J):J=t[107];let Y;t[108]!==P||t[109]!==le||t[110]!==J||t[111]!==re||t[112]!==ie?(Y=(0,$.jsxs)(P,{className:re,children:[ie,le,J]}),t[108]=P,t[109]=le,t[110]=J,t[111]=re,t[112]=ie,t[113]=Y):Y=t[113];let me;return t[114]!==F||t[115]!==Y||t[116]!==ae||t[117]!==se?(me=(0,$.jsx)(F,{open:ae,onOpenChange:se,children:Y}),t[114]=F,t[115]=Y,t[116]=ae,t[117]=se,t[118]=me):me=t[118],me}function Zt(e){return(0,$.jsx)(`option`,{value:e},e)}function Qt(e){return(0,$.jsx)(`option`,{value:e},e)}function $t(e){return e!==``}function en(e){return e.prices===null}function tn(e){return(0,$.jsx)(It,{children:e.label},e.key)}function nn(e){return(0,$.jsx)(`col`,{},e.key)}function rn(e){return e.environmentId}function an(e){let[t,n]=e;return[t,n.changes]}function on(e){return[e.environmentId,{status:`saving`}]}function sn(e,t,n){return!e.isNew&&t.placeholder!==`Mixed`&&t.placeholder!==`Unavailable`&&n===t.value}function cn(e){return!Vt(e)}function ln(e){return e.isNew}function un(e){return e.model.trim()}function dn(e){return e.isNew}function fn(e){return e.summary?.buckets.map(pn)??[]}function pn(e){return e.model}function mn(e){return[...Object.keys(e.prices??{}),...Object.keys(e.aliases??{})]}var hn=960,gn=260,_n=4,vn=8,yn=new Set;function bn(e,t,n){let r=e?.byProvider.get(t);return r===void 0?0:n===`tokens`?r.totalTokens:r.costUsd}function xn(e,t,n){return e.map(e=>{let r=t.get(e),i=We.map(e=>({provider:e,value:bn(r,e,n)}));return{bands:i,total:i.reduce((e,t)=>e+t.value,0)}})}function Sn(e){let t=e.length;if(t<2)return[0];let n=[];for(let r=0;r<t-1;r+=1){let t=(e[r+1]?.x??0)-(e[r]?.x??0),i=(e[r+1]?.y??0)-(e[r]?.y??0);n.push(t===0?0:i/t)}let r=Array.from({length:t},()=>0);r[0]=n[0]??0,r[t-1]=n[t-2]??0;for(let e=1;e<t-1;e+=1){let t=n[e-1]??0,i=n[e]??0;r[e]=t*i<=0?0:(t+i)/2}for(let e=0;e<t-1;e+=1){let t=n[e]??0;if(t===0){r[e]=0,r[e+1]=0;continue}let i=(r[e]??0)/t,a=(r[e+1]??0)/t,o=i*i+a*a;if(o>9){let n=3/Math.sqrt(o);r[e]=n*i*t,r[e+1]=n*a*t}}return r}function Cn(e){if(e.length<2)return[];let t=Sn(e),n=[];for(let r=0;r<e.length-1;r+=1){let i=e[r],a=e[r+1];if(i===void 0||a===void 0)continue;let o=a.x-i.x;n.push({from:i,c1:{x:i.x+o/3,y:i.y+(t[r]??0)*o/3},c2:{x:a.x-o/3,y:a.y-(t[r+1]??0)*o/3},to:a})}return n}function wn(e){let t=e[0];if(t===void 0)return``;let n=`M${t.from.x.toFixed(2)},${t.from.y.toFixed(2)}`;for(let t of e)n+=` C${t.c1.x.toFixed(2)},${t.c1.y.toFixed(2)} ${t.c2.x.toFixed(2)},${t.c2.y.toFixed(2)} ${t.to.x.toFixed(2)},${t.to.y.toFixed(2)}`;return n}function Tn(e){return e===``?``:`${e} L${hn},${gn} L0,${gn} Z`}function En(e,t){if(e<=0)return{max:0,ticks:[0]};let n=e/t,r=10**Math.floor(Math.log10(n)),i=n/r,a=(i>5?10:i>2?5:i>1?2:1)*r,o=Math.ceil(e/a)*a,s=[];for(let e=0;e<=o+a*1e-6;e+=a)s.push(e);return{max:o,ticks:s}}var Dn=Array.from({length:5},(e,t)=>t);function On(e,t){let n=e.reduce((e,t)=>t.bands.reduce((e,t)=>Math.max(e,t.value),e),0);return n===0&&t.size>0?{max:_n,ticks:Dn,labeled:!1}:{...En(n,_n),labeled:!0}}function kn(e,t){return t===0?gn:gn-e/t*252}function An(e,t,n,r,i){let a=xn(e,t,n),o=On(a,i),s=e.length<2?0:hn/(e.length-1);return{columns:a,scale:o,stepX:s,paths:r.map(e=>{let t=We.indexOf(e),n=wn(Cn(a.map((e,n)=>({x:n*s,y:kn(e.bands[t]?.value??0,o.max)}))));return{provider:e,loading:i.has(e),total:a.reduce((e,n)=>e+(n.bands[t]?.value??0),0),line:n,area:Tn(n)}}).toSorted((e,t)=>t.total-e.total)}}function jn(e){let t=(0,Q.c)(97),{providers:n,loadingProviders:r,days:i,daily:a,hours:o,hourly:s,metric:c,referenceTime:l,resolution:u,timeZone:d}=e,f=r===void 0?yn:r,p=u===`hour`?o:i,m;t[0]!==a||t[1]!==s||t[2]!==u?(m=u===`hour`?new Map(s.map(Pn)):new Map(a.map(Nn)),t[0]=a,t[1]=s,t[2]=u,t[3]=m):m=t[3];let h=m,[g,_]=(0,Z.useState)(null),v=(0,Z.useRef)(null),y=(0,Z.useRef)(null),b=(0,Z.useRef)(null),x;t[4]!==h||t[5]!==f||t[6]!==c||t[7]!==p||t[8]!==n?(x=An(p,h,c,n,f),t[4]=h,t[5]=f,t[6]=c,t[7]=p,t[8]=n,t[9]=x):x=t[9];let{columns:S,scale:C,paths:w,stepX:T}=x,E;t[10]===C.max?E=t[11]:(E=e=>kn(e,C.max),t[10]=C.max,t[11]=E);let D=E,O=Mn,k=c===`tokens`?K:W,A;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>{let e=v.current,t=y.current,n=b.current;if(e===null||t===null||n===null)return;let r=t.offsetWidth,i=t.offsetHeight,a=e.clientWidth,o=e.clientHeight,s=n.x+12+r<=a?n.x+12:n.x-12-r,c=n.y+12+i<=o?n.y+12:n.y-12-i,l=Math.min(Math.max(0,s),Math.max(0,a-r)),u=Math.min(Math.max(0,c),Math.max(0,o-i));e.style.setProperty(`--usage-tooltip-left`,`${l}px`),e.style.setProperty(`--usage-tooltip-top`,`${u}px`)},t[12]=A):A=t[12];let ee=A,j,N;t[13]===g?(j=t[14],N=t[15]):(j=()=>{if(g===null)return;ee();let e=v.current,t=y.current;if(e!==null&&t!==null)return je([e,t],ee)},N=[g,ee],t[13]=g,t[14]=j,t[15]=N),(0,Z.useLayoutEffect)(j,N);let P;t[16]===p.length?P=t[17]:(P=e=>{let t=v.current;if(t===null||p.length===0)return;let n=t.getBoundingClientRect();if(n.width===0)return;let r=Math.min(n.width,Math.max(0,e.clientX-n.left)),i=Math.min(n.height,Math.max(0,e.clientY-n.top)),a=r/n.width,o=Math.round(a*(p.length-1));b.current={x:r,y:i},ee(),_(Math.min(p.length-1,Math.max(0,o)))},t[16]=p.length,t[17]=P);let F=P,I=g===null?void 0:p[g],L=g===null?void 0:S[g],R;if(t[18]!==f||t[19]!==n){let e;t[21]===f?e=t[22]:(e=e=>f.has(e),t[21]=f,t[22]=e),R=n.some(e),t[18]=f,t[19]=n,t[20]=R}else R=t[20];let z=R,B;t[23]!==u||t[24]!==d?(B=e=>u===`hour`?pe(e,d):le(e),t[23]=u,t[24]=d,t[25]=B):B=t[25];let V=B,te;t[26]!==V||t[27]!==l||t[28]!==u||t[29]!==d?(te=e=>u===`hour`&&l!==void 0?ue(e,l,d):V(e),t[26]=V,t[27]=l,t[28]=u,t[29]=d,t[30]=te):te=t[30];let ne=te,re;t[31]!==k||t[32]!==C.labeled||t[33]!==C.ticks||t[34]!==D?(re=C.labeled?C.ticks.map(e=>(0,$.jsx)(`span`,{className:`absolute right-0 -translate-y-1/2 text-3xs text-muted-foreground tabular-nums`,style:{top:`${D(e)/gn*100}%`},children:e===0?`0`:k(e)},e)):null,t[31]=k,t[32]=C.labeled,t[33]=C.ticks,t[34]=D,t[35]=re):re=t[35];let ie;t[36]===re?ie=t[37]:(ie=(0,$.jsx)(`div`,{className:`relative h-56 w-14 shrink-0`,children:re}),t[36]=re,t[37]=ie);let ae;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ae=()=>{b.current=null,_(null)},t[38]=ae):ae=t[38];let oe=`${u===`hour`?`Hourly`:`Daily`} ${c===`tokens`?`processed tokens`:`cost`} by provider`,se;if(t[39]!==C.ticks||t[40]!==D){let e;t[42]===D?e=t[43]:(e=e=>{let t=D(e);return(0,$.jsx)(`line`,{x1:0,x2:hn,y1:t,y2:t,stroke:`currentColor`,strokeWidth:1,className:`text-border`,vectorEffect:`non-scaling-stroke`},e)},t[42]=D,t[43]=e),se=C.ticks.map(e),t[39]=C.ticks,t[40]=D,t[41]=se}else se=t[41];let H;if(t[44]!==w){let e;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(e=e=>{let{provider:t,loading:n,area:r}=e;return(0,$.jsx)(`path`,{d:r,className:O(n),fill:Ge[t].color,fillOpacity:.12},t)},t[46]=e):e=t[46],H=w.map(e),t[44]=w,t[45]=H}else H=t[45];let U;if(t[47]!==w){let e;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(e=e=>{let{provider:t,loading:n,line:r}=e;return(0,$.jsx)(`path`,{d:r,className:O(n),fill:`none`,stroke:Ge[t].color,strokeWidth:2,vectorEffect:`non-scaling-stroke`},t)},t[49]=e):e=t[49],U=w.map(e),t[47]=w,t[48]=U}else U=t[48];let ce;t[50]!==g||t[51]!==T?(ce=g===null?null:(0,$.jsx)(`line`,{x1:g*T,x2:g*T,y1:vn,y2:gn,stroke:`currentColor`,strokeWidth:1,className:`text-muted-foreground`,vectorEffect:`non-scaling-stroke`}),t[50]=g,t[51]=T,t[52]=ce):ce=t[52];let G;t[53]!==oe||t[54]!==se||t[55]!==H||t[56]!==U||t[57]!==ce?(G=(0,$.jsxs)(`svg`,{className:`h-full w-full`,viewBox:`0 0 ${hn} ${gn}`,preserveAspectRatio:`none`,role:`img`,"aria-label":oe,children:[se,H,U,ce]}),t[53]=oe,t[54]=se,t[55]=H,t[56]=U,t[57]=ce,t[58]=G):G=t[58];let de;t[59]!==k||t[60]!==ne||t[61]!==L?.bands||t[62]!==L?.total||t[63]!==I||t[64]!==f||t[65]!==z||t[66]!==n?(de=I===void 0?null:(0,$.jsxs)(`div`,{ref:y,className:`surface-glass pointer-events-none absolute z-10 min-w-36 max-w-full rounded-xl border border-border/50 px-2.5 py-2 text-xs shadow-lg`,style:{left:`var(--usage-tooltip-left, 0px)`,top:`var(--usage-tooltip-top, 0px)`},children:[(0,$.jsx)(`div`,{className:`mb-1 text-muted-foreground`,children:ne(I)}),n.map(e=>{let{label:t,driverKind:n}=Ge[e];return(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,$.jsx)(Le,{driverKind:n,displayName:t,iconClassName:`size-3`}),t]}),(0,$.jsx)(`span`,{className:M(`tabular-nums`,f.has(e)?`text-muted-foreground`:`text-foreground`),children:k(L?.bands.find(t=>t.provider===e)?.value??0)})]},e)}),(0,$.jsxs)(`div`,{className:`mt-1 flex items-center justify-between gap-3 border-t border-border pt-1`,children:[(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`Total`}),(0,$.jsx)(`span`,{className:M(`tabular-nums`,z?`text-muted-foreground`:`text-foreground`),children:k(L?.total??0)})]})]}),t[59]=k,t[60]=ne,t[61]=L?.bands,t[62]=L?.total,t[63]=I,t[64]=f,t[65]=z,t[66]=n,t[67]=de):de=t[67];let fe;t[68]!==F||t[69]!==G||t[70]!==de?(fe=(0,$.jsxs)(`div`,{ref:v,className:`relative h-56 flex-1`,onMouseMove:F,onMouseLeave:ae,children:[G,de]}),t[68]=F,t[69]=G,t[70]=de,t[71]=fe):fe=t[71];let q;t[72]!==ie||t[73]!==fe?(q=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[ie,fe]}),t[72]=ie,t[73]=fe,t[74]=q):q=t[74];let J;t[75]!==V||t[76]!==p[0]?(J=p[0]===void 0?``:V(p[0]),t[75]=V,t[76]=p[0],t[77]=J):J=t[77];let Y;t[78]===J?Y=t[79]:(Y=(0,$.jsx)(`span`,{children:J}),t[78]=J,t[79]=Y);let me;t[80]!==V||t[81]!==p?(me=p[Math.floor(p.length/2)]===void 0?``:V(p[Math.floor(p.length/2)]??``),t[80]=V,t[81]=p,t[82]=me):me=t[82];let he;t[83]===me?he=t[84]:(he=(0,$.jsx)(`span`,{children:me}),t[83]=me,t[84]=he);let ge;t[85]!==V||t[86]!==p?(ge=p[p.length-1]===void 0?``:V(p[p.length-1]??``),t[85]=V,t[86]=p,t[87]=ge):ge=t[87];let _e;t[88]===ge?_e=t[89]:(_e=(0,$.jsx)(`span`,{children:ge}),t[88]=ge,t[89]=_e);let ve;t[90]!==Y||t[91]!==he||t[92]!==_e?(ve=(0,$.jsxs)(`div`,{className:`flex justify-between pl-16 text-3xs text-muted-foreground uppercase`,children:[Y,he,_e]}),t[90]=Y,t[91]=he,t[92]=_e,t[93]=ve):ve=t[93];let X;return t[94]!==q||t[95]!==ve?(X=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[q,ve]}),t[94]=q,t[95]=ve,t[96]=X):X=t[96],X}function Mn(e){return M(`transition-opacity`,e&&`opacity-40 delay-150`)}function Nn(e){return[e.day,e]}function Pn(e){return[e.hourStart,e]}function Fn(e){let t=(0,Q.c)(30),{label:n,segments:r,format:i,aside:a}=e,o,s,c,l,u,d;if(t[0]!==a||t[1]!==i||t[2]!==n||t[3]!==r){d=Symbol.for(`react.early_return_sentinel`);bb0:{let e=r.filter(Ln),f=e.reduce(In,0);if(f<=0){d=null;break bb0}c=`flex min-w-0 flex-col gap-2.5`;let p;t[10]===n?p=t[11]:(p=(0,$.jsx)(`h3`,{className:`text-sm font-medium text-foreground`,children:n}),t[10]=n,t[11]=p),t[12]!==a||t[13]!==p?(l=(0,$.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[p,a]}),t[12]=a,t[13]=p,t[14]=l):l=t[14];let m;t[15]===i?m=t[16]:(m=e=>`${e.label} ${i(e.value)}`,t[15]=i,t[16]=m);let h;t[17]!==i||t[18]!==f?(h=e=>(0,$.jsxs)(ve,{children:[(0,$.jsx)(ge,{render:(0,$.jsx)(`div`,{className:`h-full min-w-1 rounded-xs first:rounded-l-full last:rounded-r-full`,style:{flex:`${e.value} 1 0`,backgroundColor:e.color}})}),(0,$.jsxs)(_e,{children:[e.label,` · `,i(e.value),` · `,J(e.value/f)]})]},e.label),t[17]=i,t[18]=f,t[19]=h):h=t[19],u=(0,$.jsx)(`div`,{role:`img`,"aria-label":`${n}: ${e.map(m).join(`, `)}`,className:`flex h-2 gap-0.5`,children:e.map(h)}),o=`flex flex-wrap gap-x-4 gap-y-1 text-xs`;let g;t[20]===i?g=t[21]:(g=e=>(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`size-2 rounded-xs`,style:{backgroundColor:e.color}}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:e.label}),(0,$.jsx)(`span`,{className:`text-foreground tabular-nums`,children:i(e.value)})]},e.label),t[20]=i,t[21]=g),s=e.map(g)}t[0]=a,t[1]=i,t[2]=n,t[3]=r,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d}else o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9];if(d!==Symbol.for(`react.early_return_sentinel`))return d;let f;t[22]!==o||t[23]!==s?(f=(0,$.jsx)(`div`,{className:o,children:s}),t[22]=o,t[23]=s,t[24]=f):f=t[24];let p;return t[25]!==c||t[26]!==l||t[27]!==u||t[28]!==f?(p=(0,$.jsxs)(`div`,{className:c,children:[l,u,f]}),t[25]=c,t[26]=l,t[27]=u,t[28]=f,t[29]=p):p=t[29],p}function In(e,t){return e+t.value}function Ln(e){return e.value>0}function Rn(e){return e.toSorted((e,t)=>t.totalTokens-e.totalTokens||t.costUsd-e.costUsd)}function zn(e,t){return t===`tokens`?e.tokenShare:pt(e)?null:e.costShare}function Bn({tokens:e}){let t=e.uncachedInputTokens+e.cachedInputTokens+e.cacheCreationTokens;return t===0?null:e.cachedInputTokens/t}function Vn(e){let t=e.totalTokens-e.unpricedTokens;return t<=0||pt(e)?null:e.costUsd/t*1e6}var Hn=e=>`color-mix(in oklab, var(--foreground) ${e}%, var(--background))`,Un={input:Hn(60),cacheRead:Hn(30),cacheWrite:Hn(72),output:Hn(100),other:Hn(44)};function Wn(e){return[{label:`Input`,value:e.input,color:Un.input},{label:`Cache read`,value:e.cacheRead,color:Un.cacheRead},{label:`Cache write`,value:e.cacheWrite,color:Un.cacheWrite},{label:`Output`,value:e.output,color:Un.output},{label:`Other`,value:e.unsplit>=.005?e.unsplit:0,color:Un.other}]}function Gn(e){return[{label:`Input`,value:e.uncachedInputTokens,color:Un.input},{label:`Cache read`,value:e.cachedInputTokens,color:Un.cacheRead},{label:`Cache write`,value:e.cacheCreationTokens,color:Un.cacheWrite},{label:`Output`,value:e.outputTokens,color:Un.output}]}function Kn(e){return[{label:`Standard`,value:e.standard,color:Hn(34)},{label:`Fast`,value:e.fast,color:Hn(66)},{label:`Ultrafast`,value:e.ultrafast,color:Hn(100)}]}function qn(e){let t=(0,Q.c)(80),{model:n,environments:r,metric:i,chartWindow:a,onSetPrice:o,onClose:s}=e,c;t[0]!==n.model||t[1]!==n.provider?(c=e=>e.provider===n.provider&&e.model===n.model,t[0]=n.model,t[1]=n.provider,t[2]=c):c=t[2];let l;t[3]!==r||t[4]!==c?(l=wt(r,c),t[3]=r,t[4]=c,t[5]=l):l=t[5];let u=l,d;t[6]===n.provider?d=t[7]:(d=[n.provider],t[6]=n.provider,t[7]=d);let f=d,p=Ge[n.provider],m;t[8]===n?m=t[9]:(m=pt(n),t[8]=n,t[9]=m);let h=m,g;if(t[10]!==h||t[11]!==n){let e=Bn(n),r=Vn(n),i;t[13]!==h||t[14]!==n.costUsd?(i=h?`Unpriced`:W(n.costUsd),t[13]=h,t[14]=n.costUsd,t[15]=i):i=t[15];let a;t[16]===i?a=t[17]:(a={label:`Cost`,value:i},t[16]=i,t[17]=a);let o;t[18]===n.totalTokens?o=t[19]:(o=K(n.totalTokens),t[18]=n.totalTokens,t[19]=o);let s;t[20]===o?s=t[21]:(s={label:`Tokens`,value:o},t[20]=o,t[21]=s),g=[a,s,r===null?null:{label:`Per 1M tokens`,value:W(r)},e===null?null:{label:`Cache hit`,value:J(e)}].filter(Yn),t[10]=h,t[11]=n,t[12]=g}else g=t[12];let _=g,v;t[22]===s?v=t[23]:(v=e=>{e||s()},t[22]=s,t[23]=v);let y;t[24]!==p.driverKind||t[25]!==p.label?(y=(0,$.jsx)(Le,{driverKind:p.driverKind,displayName:p.label,iconClassName:`size-5`}),t[24]=p.driverKind,t[25]=p.label,t[26]=y):y=t[26];let b;t[27]===n.model?b=t[28]:(b=(0,$.jsx)(we,{children:n.model}),t[27]=n.model,t[28]=b);let x;t[29]!==y||t[30]!==b?(x=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[y,b]}),t[29]=y,t[30]=b,t[31]=x):x=t[31];let S;t[32]!==h||t[33]!==n.costShare?(S=h?``:` · ${J(n.costShare)} of cost`,t[32]=h,t[33]=n.costShare,t[34]=S):S=t[34];let C;t[35]!==p.label||t[36]!==S?(C=(0,$.jsxs)(De,{children:[p.label,S]}),t[35]=p.label,t[36]=S,t[37]=C):C=t[37];let T;t[38]!==C||t[39]!==x?(T=(0,$.jsxs)(Ce,{children:[x,C]}),t[38]=C,t[39]=x,t[40]=T):T=t[40];let E;t[41]===_?E=t[42]:(E=(0,$.jsx)(`div`,{className:`grid grid-cols-2 gap-x-6 gap-y-4 sm:grid-cols-4`,children:_.map(Jn)}),t[41]=_,t[42]=E);let D=h?`tokens`:i,O;t[43]!==a.days||t[44]!==a.hours||t[45]!==a.referenceTime||t[46]!==a.resolution||t[47]!==a.timeZone||t[48]!==f||t[49]!==D||t[50]!==u.daily||t[51]!==u.hourly?(O=(0,$.jsx)(jn,{providers:f,days:a.days,daily:u.daily,hours:a.hours,hourly:u.hourly,metric:D,referenceTime:a.referenceTime,resolution:a.resolution,timeZone:a.timeZone}),t[43]=a.days,t[44]=a.hours,t[45]=a.referenceTime,t[46]=a.resolution,t[47]=a.timeZone,t[48]=f,t[49]=D,t[50]=u.daily,t[51]=u.hourly,t[52]=O):O=t[52];let k;t[53]!==h||t[54]!==u.categoryCost?(k=h?null:(0,$.jsx)(Fn,{label:`Cost by type`,segments:Wn(u.categoryCost),format:W}),t[53]=h,t[54]=u.categoryCost,t[55]=k):k=t[55];let A;t[56]===n.tokens?A=t[57]:(A=Gn(n.tokens),t[56]=n.tokens,t[57]=A);let ee;t[58]===A?ee=t[59]:(ee=(0,$.jsx)(Fn,{label:`Tokens by type`,segments:A,format:K}),t[58]=A,t[59]=ee);let j;t[60]===u.speedCost?j=t[61]:(j=u.speedCost.fast+u.speedCost.ultrafast>0?(0,$.jsx)(Fn,{label:`Cost by speed`,segments:Kn(u.speedCost),format:W,aside:(0,$.jsx)(Xn,{premiumUsd:u.speedCost.premium})}):null,t[60]=u.speedCost,t[61]=j);let M;t[62]!==k||t[63]!==ee||t[64]!==j?(M=(0,$.jsxs)(`div`,{className:`grid gap-x-10 gap-y-8 sm:grid-cols-2`,children:[k,ee,j]}),t[62]=k,t[63]=ee,t[64]=j,t[65]=M):M=t[65];let N;t[66]!==E||t[67]!==O||t[68]!==M?(N=(0,$.jsx)(Ee,{children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[E,O,M]})}),t[66]=E,t[67]=O,t[68]=M,t[69]=N):N=t[69];let P;t[70]!==n.unpricedTokens||t[71]!==o?(P=n.unpricedTokens>0?(0,$.jsxs)(Te,{variant:`bare`,className:`items-center sm:justify-between`,children:[(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[K(n.unpricedTokens),` tokens have no known price`]}),(0,$.jsx)(w,{onClick:o,children:`Set price`})]}):null,t[70]=n.unpricedTokens,t[71]=o,t[72]=P):P=t[72];let F;t[73]!==T||t[74]!==N||t[75]!==P?(F=(0,$.jsxs)(Oe,{className:`max-w-3xl`,children:[T,N,P]}),t[73]=T,t[74]=N,t[75]=P,t[76]=F):F=t[76];let I;return t[77]!==F||t[78]!==v?(I=(0,$.jsx)(ke,{open:!0,onOpenChange:v,children:F}),t[77]=F,t[78]=v,t[79]=I):I=t[79],I}function Jn(e){return(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.label}),(0,$.jsx)(`span`,{className:`text-2xl font-semibold text-foreground`,children:e.value})]},e.label)}function Yn(e){return e!==null}function Xn(e){let t=(0,Q.c)(4),{premiumUsd:n}=e,r;t[0]===n?r=t[1]:(r=W(n),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Premium `,(0,$.jsx)(`span`,{className:`text-foreground tabular-nums`,children:r})]}),t[2]=r,t[3]=i),i}var Zn=`p4code:usage-page-preferences:v1`,Qn=g({metric:j([`cost`,`tokens`,`limits`]),windowDays:j([1,7,30,90]),hiddenProviders:p(i(E))}),$n={metric:`limits`,windowDays:30};function er(){try{return u(Zn,Qn)??$n}catch(e){return console.error(`Could not read Usage page preferences.`,e),$n}}function tr(e){try{a(Zn,e,Qn)}catch(e){console.error(`Could not save Usage page preferences.`,e)}}function nr(e){return He.some(t=>t.value===e)}function rr(e){return Be.some(t=>t.days===e)}var ir=e=>Ge[e].label;function ar(){let[e,t]=(0,Z.useState)(er);ie();let n=k(se),r=e=>{let t=Me(n,e.command,{context:{usagePageOpen:!0}});return t?`${e.label} (${t})`:e.label},[i,a]=(0,Z.useState)(()=>({days:e.windowDays,window:G(e.windowDays,void 0,e.windowDays===1?`hour`:`day`)})),o=e.metric,s=o===`limits`,[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(()=>Date.now()),f=(0,Z.useRef)(!1),[p,m]=(0,Z.useState)(`model`),[h,g]=(0,Z.useState)(null),[_,v]=(0,Z.useState)(null),[y,b]=(0,Z.useState)(null),x=(0,Z.useMemo)(()=>new Set(e.hiddenProviders),[e.hiddenProviders]),{days:C,window:T}=i,E=C===1,{merged:D,environments:O,selectedEnvironments:A,shown:j,isPartial:N,refresh:P}=Dt(T,y,x),F=j?.merged??D,I=j?.window??T,L=I.resolution===`hour`,R=c&&!s,z=j!==null&&j.window!==T,H=(0,Z.useMemo)(()=>{if(z)return{partial:!0,everyProvider:!0,providers:new Set};let e=ft(A,R),t=new Set([...e.providers].filter(e=>!x.has(e)));return{partial:e.everyProvider||t.size>0,everyProvider:e.everyProvider,providers:t}},[z,R,A,x]),U=e=>H.everyProvider||H.providers.has(e),ue=k(ae.presentationsAtom),me=(0,Z.useMemo)(()=>new Map([...ue].filter(([,e])=>e.entry.enabled&&e.entry.unsupportedReason===void 0)),[ue]),ge=x.has(`cursor`)?[]:at(A),_e=[...new Set(A.flatMap(e=>e.summary?.sources.flatMap(e=>e.message&&!e.action&&!x.has(e.fingerprint.provider)&&(e.status===`partial`||e.status===`failed`||e.fingerprint.provider===`cursor`)?[e.message]:[])??[]))],ve=ce(oe.refreshProviders,{reportFailure:!1}),X=A.some(e=>e.canReadDiagnostics),xe=(0,Z.useMemo)(()=>Y(I.sinceDay,I.untilDay),[I.sinceDay,I.untilDay]),Ce=(0,Z.useMemo)(()=>I.sinceTime===void 0||I.untilTime===void 0?[]:fe(I.sinceTime,I.untilTime),[I.sinceTime,I.untilTime]),we=(0,Z.useMemo)(()=>(L?F.hourly:F.daily).toReversed(),[L,F.daily,F.hourly]),Te=(0,Z.useMemo)(()=>p===`model`&&o===`tokens`?Rn(F.models):F.models,[p,F.models,o]),Ee=(0,Z.useMemo)(()=>Ke(F.providers),[F.providers]),De=(0,Z.useMemo)(()=>We.filter(e=>Ee.includes(e)||H.providers.has(e)),[H.providers,Ee]),Oe=(0,Z.useMemo)(()=>new Set(De.filter(e=>H.everyProvider||H.providers.has(e))),[De,H.everyProvider,H.providers]),ke=_===null?void 0:F.models.find(e=>`${e.provider}:${e.model}`===_),je=Te.reduce((e,t)=>Math.max(e,o===`tokens`?t.totalTokens:t.costUsd),0),Le=De.map(e=>({kind:`usage`,provider:e})),Ye=Math.max(De.indexOf(`codex`),De.indexOf(`claude`))+1;Le.splice(Ye,0,...ge.map(e=>({kind:`enable`,environment:e})));let Qe=`${60/(De.length+2)}%`,nt=n=>{let r={...e,...n};t(r),tr(r)},Q=e=>{rr(e)&&(nt({windowDays:e}),a({days:e,window:G(e,void 0,e===1?`hour`:`day`)}))},rt=e=>{e===`limits`&&d(Date.now()),nt({metric:e})},it=async(e=!1,t=!1)=>{try{await Promise.all(Array.from(me,([n,r])=>{if((y===null||y.has(n))&&r.connection.phase===`connected`&&r.serverConfig!==null)return ct(n,()=>ve({environmentId:n,input:{}}),e,t)}))}finally{d(Date.now())}},ot=(0,Z.useEffectEvent)(e=>{if(e.defaultPrevented||e.repeat||e.isComposing||Xe()||Je())return;let t=Ve(e,n),r=He.find(e=>e.command===t),i=Be.find(e=>e.command===t);(r||i)&&(e.preventDefault(),e.stopPropagation(),r&&rt(r.value),i&&!s&&Q(i.days))});(0,Z.useEffect)(()=>(globalThis.window.addEventListener(`keydown`,ot,!0),()=>globalThis.window.removeEventListener(`keydown`,ot,!0)),[]);let st=()=>{if(f.current)return;if(s){f.current=!0,l(!0),it().finally(()=>{f.current=!1,l(!1)});return}let e=G(C,void 0,E?`hour`:`day`);(e.sinceDay!==T.sinceDay||e.untilDay!==T.untilDay||e.sinceTime!==T.sinceTime||e.untilTime!==T.untilTime)&&a({days:C,window:e}),f.current=!0,l(!0),P(e).finally(()=>{f.current=!1,l(!1)})},lt=[...me].filter(([e,t])=>t.connection.phase===`connected`&&t.serverConfig!==null&&(y===null||y.has(e))).map(([e])=>e).sort().join(`,`),ut=(0,Z.useEffectEvent)(()=>{it(!0)});(0,Z.useEffect)(()=>{s&&lt&&ut()},[s,lt]);let dt=L&&I.sinceTime!==void 0&&I.untilTime!==void 0?`${de(I.sinceTime,I.timeZone)} to ${de(I.untilTime,I.timeZone)}`:`${le(I.sinceDay)} to ${le(I.untilDay)}`,mt=(0,$.jsxs)(`div`,{className:`grid w-full min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 py-2 @4xl/usage-header:flex`,children:[(0,$.jsxs)(tt,{ariaLabel:`Usage breadcrumb`,className:`min-w-0`,children:[(0,$.jsx)($e,{children:(0,$.jsx)(`h1`,{children:`Usage`})}),(0,$.jsx)(et,{}),(0,$.jsx)($e,{className:`min-w-10 shrink`,children:(0,$.jsx)(vr,{environments:O,selectedEnvironments:A,selectedEnvironmentIds:y,onSelectionChange:b,showUsageStatus:!s,refreshing:R,isPartial:N,duplicateSources:F.duplicateSources,contractMismatches:F.contractMismatches,onOpenModelPrices:()=>g({})})}),(0,$.jsx)(et,{}),(0,$.jsx)($e,{current:!0,className:`min-w-10`,children:(0,$.jsx)(xr,{hiddenProviders:x,onChange:e=>nt({hiddenProviders:e})})})]}),s?null:(0,$.jsx)(`span`,{className:`hidden min-w-0 truncate text-xs text-muted-foreground @7xl/usage-header:block`,children:dt}),(0,$.jsxs)(`div`,{className:`ms-auto hidden shrink-0 items-center justify-end gap-2 @4xl/usage-header:flex`,children:[(0,$.jsx)(ye,{"aria-label":`Usage metric`,variant:`segmented`,value:[o],onValueChange:e=>{let t=e[0];nr(t)&&rt(t)},children:He.map(e=>(0,$.jsx)(be,{value:e.value,title:r(e),children:e.label},e.value))}),(0,$.jsx)(ye,{"aria-label":`Usage period`,variant:`segmented`,value:[String(C)],disabled:s,onValueChange:e=>{let t=e[0];t&&Q(Number(t))},children:Be.map(e=>(0,$.jsx)(be,{value:String(e.days),title:r(e),children:e.label},e.days))}),(0,$.jsx)(w,{onClick:st,"aria-label":s?`Refresh limits`:`Refresh usage`,"aria-busy":c,disabled:c||!s&&!X,size:`icon-sm`,variant:`ghost`,children:(0,$.jsx)(Ue,{size:`sm`,refreshing:c})})]}),(0,$.jsxs)(`div`,{className:`ms-auto flex shrink-0 items-center justify-end gap-1 @4xl/usage-header:hidden`,children:[(0,$.jsxs)(re,{value:o,onValueChange:e=>{nr(e)&&rt(e)},children:[(0,$.jsx)(ne,{"aria-label":`Usage metric`,size:`compact`,variant:`ghost`,className:`w-auto min-w-0`,children:(0,$.jsx)(V,{children:He.find(e=>e.value===o)?.label})}),(0,$.jsx)(te,{align:`end`,alignItemWithTrigger:!1,children:He.map(e=>(0,$.jsx)(B,{value:e.value,title:r(e),children:e.label},e.value))})]}),(0,$.jsxs)(re,{value:String(C),disabled:s,onValueChange:e=>Q(Number(e)),children:[(0,$.jsx)(ne,{"aria-label":`Usage period`,size:`compact`,variant:`ghost`,className:`w-auto min-w-0`,children:(0,$.jsx)(V,{children:Be.find(e=>e.days===C)?.label})}),(0,$.jsx)(te,{align:`end`,alignItemWithTrigger:!1,children:Be.map(e=>(0,$.jsx)(B,{value:String(e.days),title:r(e),children:e.label},e.days))})]}),(0,$.jsx)(w,{onClick:st,"aria-label":s?`Refresh limits`:`Refresh usage`,"aria-busy":c,disabled:c||!s&&!X,size:`icon-sm`,variant:`ghost`,children:(0,$.jsx)(Ue,{size:`sm`,refreshing:c})})]})]});return(0,$.jsxs)(Ae,{className:`h-dvh min-h-0 overflow-hidden overscroll-y-none isolate`,children:[(0,$.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-background text-foreground`,children:[(0,$.jsx)(Ze,{electron:he,className:`@container/usage-header`,children:mt}),(0,$.jsx)(Se,{className:`min-h-0 flex-1`,children:(0,$.jsx)(ze,{width:`wide`,children:A.length===0?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:O.length===0?`Connect an environment to see ${s?`limits`:`usage`}.`:`Select an environment to see ${s?`limits`:`usage`}.`}):s?(0,$.jsx)(qe,{selectedEnvironmentIds:y,hiddenProviders:x,now:u,cursorPrompt:ge.length>0?(0,$.jsx)(lr,{environments:ge,onEnabled:()=>{P(),it(!1,!0)}}):null}):j===null?(0,$.jsx)(Sr,{}):X?(0,$.jsxs)(`div`,{"aria-busy":H.partial,className:`flex flex-col gap-6`,children:[_e.map(e=>(0,$.jsx)(`p`,{className:`mb-4 text-sm text-muted-foreground`,children:e},e)),(0,$.jsxs)(`section`,{className:`grid gap-6 lg:grid-cols-[minmax(0,18rem)_minmax(0,1fr)]`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:M(`text-4xl font-semibold text-foreground tabular-nums`,dr(H.partial)),children:o===`cost`?W(F.costUsd):K(F.totalTokens)}),(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,$.jsxs)(`span`,{children:[(0,$.jsxs)(`span`,{className:dr(H.partial),children:[q(F.sessions),` sessions`]}),o===`cost`&&` · API estimate`]}),o===`cost`&&F.costQuality.unpricedShare>0&&(0,$.jsxs)(Fe,{children:[(0,$.jsx)(Pe,{openOnHover:!0,render:(0,$.jsx)(ee,{tone:`muted`}),"aria-label":`Unpriced usage details`,children:(0,$.jsx)(S,{className:`size-3`,"aria-hidden":!0})}),(0,$.jsxs)(Ne,{side:`top`,tooltipStyle:!0,children:[`API estimate excludes`,` `,J(F.costQuality.unpricedShare),` unpriced records.`]})]})]})]}),!x.has(`codex`)&&[...me].some(([e,t])=>(y===null||y.has(e))&&t.serverConfig?.providers.some(Ie))?(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:`ChatGPT shared usage`}),(0,$.jsx)(Re,{size:`xs`})]}):null,Le.map(e=>{if(e.kind===`enable`)return(0,$.jsx)(cr,{environmentId:e.environment.environmentId,label:e.environment.label,showEnvironment:A.length>1,onEnabled:()=>{P(),it(!1,!0)}},`enable:${e.environment.environmentId}`);let t=e.provider,n=F.providers.find(e=>e.provider===t),r=o===`cost`?n?.costShare??0:n?.tokenShare??0,i=n?.sessions??0,a=`${q(i)} ${i===1?`session`:`sessions`}`,s=U(t),c=s&&!Ee.includes(t);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-sm text-foreground`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`size-2 shrink-0 rounded-full`,style:{backgroundColor:Ge[t].color}}),(0,$.jsx)(ur,{provider:t,className:`size-4`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-1.5`,children:[(0,$.jsx)(`span`,{className:`truncate`,children:Ge[t].label}),(0,$.jsx)(`span`,{className:M(`shrink-0 whitespace-nowrap text-2xs text-muted-foreground tabular-nums`,dr(s),c&&`invisible`),children:a})]})]}),(0,$.jsx)(`span`,{className:M(`shrink-0 text-sm font-medium text-foreground tabular-nums`,dr(s)),children:c?`—`:o===`cost`?W(n?.costUsd??0):K(n?.totalTokens??0)})]}),(0,$.jsx)(`span`,{className:M(`text-xs text-muted-foreground`,dr(s),c&&`invisible`),children:o===`cost`?`${J(r)} of cost · ${K(n?.totalTokens??0)} tokens`:`${J(r)} of tokens · ${W(n?.costUsd??0)}`})]},t)})]}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,$.jsxs)(`h2`,{className:`text-sm font-medium text-foreground`,children:[L?`Hourly`:`Daily`,` `,o===`tokens`?`processed tokens`:`cost`]}),(0,$.jsx)(jn,{providers:De,loadingProviders:Oe,days:xe,daily:F.daily,hours:Ce,hourly:F.hourly,metric:o,referenceTime:I.untilTime,resolution:L?`hour`:`day`,timeZone:I.timeZone})]})]}),(0,$.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-medium text-foreground`,children:`Totals`}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-6 gap-y-4 py-1 md:grid-cols-5`,children:[(0,$.jsx)(fr,{loading:H.partial,label:`Processed tokens`,value:K(F.totalTokens)}),(0,$.jsx)(fr,{loading:H.partial,label:`Cached input`,value:K(F.cachedInputTokens)}),(0,$.jsx)(fr,{loading:H.partial,label:`Uncached input`,value:K(F.uncachedInputTokens)}),(0,$.jsx)(fr,{loading:H.partial,label:`Output`,value:K(F.outputTokens)}),(0,$.jsx)(fr,{loading:H.partial,label:`Cache savings`,value:W(F.costQuality.cacheSavingsUsd)})]})]}),F.totalTokens>0?(0,$.jsx)(`section`,{className:M(`grid gap-x-12 gap-y-8 lg:grid-cols-2`,dr(H.partial)),children:o===`tokens`?(0,$.jsx)(Fn,{label:`Tokens by type`,segments:Gn(F),format:K}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Fn,{label:`Cost by type`,segments:Wn(F.categoryCost),format:W}),F.speedCost.fast+F.speedCost.ultrafast>0?(0,$.jsx)(Fn,{label:`Cost by speed`,segments:Kn(F.speedCost),format:W,aside:(0,$.jsx)(Xn,{premiumUsd:F.speedCost.premium})}):null]})}):null,(0,$.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-medium text-foreground`,children:`Breakdown`}),(0,$.jsx)(ye,{"aria-label":`Usage breakdown`,variant:`segmented`,value:[p],onValueChange:e=>{let t=e[0];(t===`model`||t===`time`)&&m(t)},children:[{value:`model`,label:`Model`},{value:`time`,label:L?`Hour`:`Day`}].map(e=>(0,$.jsx)(be,{value:e.value,children:e.label},e.value))})]}),p===`model`?(0,$.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{className:`border-b border-border text-right text-xs text-muted-foreground`,children:[(0,$.jsx)(`th`,{className:`py-2 pr-3 text-left font-normal`,children:`#`}),(0,$.jsx)(`th`,{className:`w-full py-2 text-left font-normal`,children:`Model`}),(0,$.jsx)(`th`,{className:`py-2 pl-6 font-normal`,children:`Cost`}),(0,$.jsx)(`th`,{className:`hidden py-2 pl-6 font-normal sm:table-cell`,children:`Share`}),(0,$.jsx)(`th`,{className:`py-2 pl-6 font-normal`,children:`Tokens`})]})}),(0,$.jsx)(`tbody`,{children:Te.length===0?(0,$.jsx)(`tr`,{children:(0,$.jsx)(`td`,{colSpan:5,className:`py-6 text-center text-muted-foreground`,children:`No activity in this window.`})}):Te.map((e,t)=>{let n=`${e.provider}:${e.model}`,r=o===`tokens`?e.totalTokens:e.costUsd,i=zn(e,o===`tokens`?`tokens`:`cost`),a=dr(U(e.provider));return(0,$.jsxs)(`tr`,{className:`relative border-b border-border/50 text-right whitespace-nowrap text-muted-foreground tabular-nums transition-colors hover:bg-muted/50 has-focus-visible:bg-muted/50`,children:[(0,$.jsx)(`td`,{className:`py-2.5 pr-3 text-left text-xs`,children:t+1}),(0,$.jsxs)(`td`,{className:`py-2.5 text-left whitespace-normal`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>v(n),className:`flex items-center gap-2 text-left text-foreground outline-none after:absolute after:inset-0`,children:[(0,$.jsx)(ur,{provider:e.provider,className:`size-3.5`}),e.model]}),(0,$.jsx)(`div`,{"aria-hidden":!0,className:M(`mt-1.5 h-0.5 max-w-48`,a),children:(0,$.jsx)(`div`,{className:`h-full rounded-full`,style:{width:r>0&&je>0?`max(0.5rem, ${r/je*100}%)`:0,backgroundColor:Ge[e.provider].color}})})]}),(0,$.jsx)(`td`,{className:M(`py-2.5 pl-6 text-foreground`,a),children:pt(e)?(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`Unpriced`}):W(e.costUsd)}),(0,$.jsx)(`td`,{className:M(`hidden py-2.5 pl-6 sm:table-cell`,a),children:i===null?``:J(i)}),(0,$.jsx)(`td`,{className:M(`py-2.5 pl-6`,a),children:K(e.totalTokens)})]},n)})})]}):(0,$.jsxs)(`table`,{className:`w-full table-fixed text-sm`,children:[(0,$.jsxs)(`colgroup`,{children:[(0,$.jsx)(`col`,{className:`w-2/5`}),De.map(e=>(0,$.jsx)(`col`,{style:{width:Qe}},e)),(0,$.jsx)(`col`,{style:{width:Qe}}),(0,$.jsx)(`col`,{style:{width:Qe}})]}),(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{className:`border-b border-border text-left text-xs text-muted-foreground`,children:[(0,$.jsx)(`th`,{className:`py-2 font-normal`,children:L?`Hour`:`Day`}),De.map(e=>(0,$.jsx)(`th`,{className:`py-2 text-right font-normal`,children:Ge[e].label},e)),(0,$.jsx)(`th`,{className:`py-2 text-right font-normal`,children:`Total`}),(0,$.jsx)(`th`,{className:`py-2 text-right font-normal`,children:`Tokens`})]})}),(0,$.jsx)(`tbody`,{children:we.length===0?(0,$.jsx)(`tr`,{children:(0,$.jsx)(`td`,{colSpan:De.length+3,className:`py-6 text-center text-muted-foreground`,children:`No activity in this window.`})}):we.map(e=>(0,$.jsxs)(`tr`,{className:`border-b border-border/50 transition-colors hover:bg-muted/50`,children:[(0,$.jsx)(`td`,{className:`py-2 text-foreground`,children:`hourStart`in e?pe(e.hourStart,I.timeZone):le(e.day)}),De.map(t=>(0,$.jsx)(`td`,{className:M(`py-2 text-right text-muted-foreground tabular-nums`,dr(U(t))),children:W(e.byProvider.get(t)?.costUsd??0)},t)),(0,$.jsx)(`td`,{className:M(`py-2 text-right text-foreground tabular-nums`,dr(H.partial)),children:W(e.costUsd)}),(0,$.jsx)(`td`,{className:M(`py-2 text-right text-muted-foreground tabular-nums`,dr(H.partial)),children:K(e.totalTokens)})]},`hourStart`in e?e.hourStart:e.day))})]})]})]}):(0,$.jsx)(`div`,{className:`space-y-2 py-12 text-center text-sm text-muted-foreground`,children:A.map(e=>(0,$.jsxs)(`p`,{children:[A.length>1?`${e.label}: `:null,e.error]},e.environmentId))})})})]}),ke!==void 0&&!s?(0,$.jsx)(qn,{model:ke,environments:A,metric:o===`tokens`?`tokens`:`cost`,chartWindow:{days:xe,hours:Ce,resolution:L?`hour`:`day`,timeZone:I.timeZone,referenceTime:I.untilTime},onSetPrice:()=>{v(null),g({model:ke.model})},onClose:()=>v(null)}):null,h?(0,$.jsx)(Xt,{usage:O,initialSelectedEnvironmentIds:y,initialModel:h.model,onOpenChange:e=>{e||g(null)}}):null]})}var or=`Requires access to your Cursor login in macOS Keychain.`;function sr({environmentId:e,label:t,onEnabled:n,tooltip:r,buttonText:i=`Enable`}){let a=ce(oe.updateSettings,{label:`enable Cursor account usage`}),[o,s]=(0,Z.useState)(!1),c=async()=>{s(!0);try{(await a({environmentId:e,input:{patch:{cursorKeychainUsageEnabled:!0}}}))._tag===`Success`&&n()}finally{s(!1)}},l=r?(0,$.jsx)(ee,{disabled:o,"aria-busy":o,"aria-label":`Enable Cursor usage from ${t}`,onClick:()=>void c(),children:i}):(0,$.jsx)(w,{size:`sm`,variant:`outline`,disabled:o,"aria-busy":o,"aria-label":`Enable Cursor usage from ${t}`,onClick:()=>void c(),children:i});return r?(0,$.jsxs)(ve,{children:[(0,$.jsx)(ge,{render:l}),(0,$.jsx)(_e,{children:or})]}):l}function cr(e){let t=(0,Q.c)(11),{environmentId:n,label:r,showEnvironment:i,onEnabled:a}=e,o,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(`span`,{"aria-hidden":!0,className:`size-2 shrink-0 rounded-full`,style:{backgroundColor:Ge.cursor.color}}),s=(0,$.jsx)(ur,{provider:`cursor`,className:`size-4`}),t[0]=o,t[1]=s):(o=t[0],s=t[1]);let c=i?` · ${r}`:``,l;t[2]===c?l=t[3]:(l=(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-sm text-foreground`,children:[o,s,(0,$.jsxs)(`span`,{className:`truncate`,children:[`Cursor`,c]})]}),t[2]=c,t[3]=l);let u;t[4]!==n||t[5]!==r||t[6]!==a?(u=(0,$.jsx)(sr,{environmentId:n,label:r,onEnabled:a,tooltip:!0}),t[4]=n,t[5]=r,t[6]=a,t[7]=u):u=t[7];let d;return t[8]!==l||t[9]!==u?(d=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-baseline justify-between gap-4 text-sm`,children:[l,u]}),t[8]=l,t[9]=u,t[10]=d):d=t[10],d}function lr(e){let t=(0,Q.c)(10),{environments:n,onEnabled:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-medium text-foreground`,children:[(0,$.jsx)(Le,{driverKind:o.make(`cursor`),displayName:`Cursor`,indicatorBackground:`var(--background)`,className:`size-5`,iconClassName:`size-4 text-foreground/80`}),`Cursor`]}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:or}),t[1]=a):a=t[1];let s;if(t[2]!==n||t[3]!==r){let e;t[5]!==n.length||t[6]!==r?(e=e=>(0,$.jsx)(sr,{environmentId:e.environmentId,label:e.label,buttonText:n.length>1?`Enable on ${e.label}`:`Enable`,onEnabled:r,tooltip:!1},e.environmentId),t[5]=n.length,t[6]=r,t[7]=e):e=t[7],s=n.map(e),t[2]=n,t[3]=r,t[4]=s}else s=t[4];let c;return t[8]===s?c=t[9]:(c=(0,$.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[i,(0,$.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-lg border border-border/60 p-4`,children:[a,(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:s})]})]}),t[8]=s,t[9]=c),c}function ur(e){let t=(0,Q.c)(4),{provider:n,className:r}=e,i=Ge[n],a;return t[0]!==r||t[1]!==i.driverKind||t[2]!==i.label?(a=(0,$.jsx)(Le,{driverKind:i.driverKind,displayName:i.label,iconClassName:r}),t[0]=r,t[1]=i.driverKind,t[2]=i.label,t[3]=a):a=t[3],a}function dr(e){return M(`transition-opacity`,e&&`opacity-40 delay-150`)}function fr(e){let t=(0,Q.c)(10),{label:n,value:r,loading:i}=e,a;t[0]===n?a=t[1]:(a=(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n}),t[0]=n,t[1]=a);let o;t[2]===i?o=t[3]:(o=M(`text-base font-medium text-foreground tabular-nums`,dr(i)),t[2]=i,t[3]=o);let s;t[4]!==o||t[5]!==r?(s=(0,$.jsx)(`span`,{className:o,children:r}),t[4]=o,t[5]=r,t[6]=s):s=t[6];let c;return t[7]!==a||t[8]!==s?(c=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[a,s]}),t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function pr(e){let t=(0,Q.c)(14),{environments:n,duplicateSources:r,contractMismatches:i}=e,a,o,s,c;if(t[0]!==i||t[1]!==r||t[2]!==n){c=Symbol.for(`react.early_return_sentinel`);bb0:{let e=n.filter(_r),t=new Map(i.map(gr)),l=n.flatMap(e=>{let n=t.get(e.environmentId);return n===void 0?[]:[{environment:e,mismatch:n}]});if(e.length===0&&l.length===0&&r.length===0){c=null;break bb0}a=`flex flex-col gap-1 border-t border-border px-2 py-2 text-xs text-muted-foreground`,o=e.map(hr),s=l.map(mr)}t[0]=i,t[1]=r,t[2]=n,t[3]=a,t[4]=o,t[5]=s,t[6]=c}else a=t[3],o=t[4],s=t[5],c=t[6];if(c!==Symbol.for(`react.early_return_sentinel`))return c;let l;t[7]===r?l=t[8]:(l=r.length>0?(0,$.jsxs)(`span`,{children:[`Counted once across environments sharing a transcript directory:`,` `,r.join(`, `)]}):null,t[7]=r,t[8]=l);let u;return t[9]!==a||t[10]!==o||t[11]!==s||t[12]!==l?(u=(0,$.jsxs)(`div`,{className:a,children:[o,s,l]}),t[9]=a,t[10]=o,t[11]=s,t[12]=l,t[13]=u):u=t[13],u}function mr(e){let{environment:t,mismatch:n}=e;return(0,$.jsx)(`span`,{children:me(t.label,n)},t.environmentId)}function hr(e){return(0,$.jsxs)(`span`,{children:[e.label,`: `,e.error]},e.label)}function gr(e){return[e.environmentId,e]}function _r(e){return e.error!==null}function vr(e){let t=(0,Q.c)(56),{environments:n,selectedEnvironments:r,selectedEnvironmentIds:i,onSelectionChange:a,showUsageStatus:o,refreshing:c,isPartial:l,duplicateSources:u,contractMismatches:d,onOpenModelPrices:p}=e,g=i===null,_=g?`All environments`:r.length===1?r[0].label:`${r.length} environments`,v;t[0]!==d||t[1]!==r?(v=r.some(br)||d.length>0,t[0]=d,t[1]=r,t[2]=v):v=t[2];let y=v,b;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(ee,{}),t[3]=b):b=t[3];let S;t[4]===_?S=t[5]:(S=(0,$.jsx)(Qe,{children:_}),t[4]=_,t[5]=S);let w;t[6]!==y||t[7]!==o?(w=(0,$.jsx)(`span`,{className:`flex size-3.5 shrink-0 items-center justify-center text-muted-foreground`,children:o&&y?(0,$.jsx)(f,{className:`size-3.5 text-warning-foreground`,"aria-label":`Some environments could not report usage`}):(0,$.jsx)(s,{className:`size-3.5 opacity-0 transition-opacity group-hover/usage-environment:opacity-100 group-focus-visible/usage-environment:opacity-100 group-data-popup-open/usage-environment:opacity-100`,"aria-hidden":!0})}),t[6]=y,t[7]=o,t[8]=w):w=t[8];let T;t[9]!==S||t[10]!==w?(T=(0,$.jsxs)(x,{render:b,className:`group/usage-environment min-w-0 max-w-full`,children:[S,w]}),t[9]=S,t[10]=w,t[11]=T):T=t[11];let E;t[12]===a?E=t[13]:(E=e=>a(e?null:new Set),t[12]=a,t[13]=E);let D;t[14]!==g||t[15]!==E?(D=(0,$.jsx)(h,{checked:g,closeOnClick:!1,onCheckedChange:E,children:`All environments`}),t[14]=g,t[15]=E,t[16]=D):D=t[16];let k;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(A,{}),t[17]=k):k=t[17];let j;if(t[18]!==n||t[19]!==a||t[20]!==c||t[21]!==i||t[22]!==r||t[23]!==o){let e;t[25]!==n.length||t[26]!==a||t[27]!==c||t[28]!==i||t[29]!==r||t[30]!==o?(e=e=>{let t=i===null||i.has(e.environmentId),s=ut(e,c),l=e.error===null?e.summary!==null&&!bt(e.summary.contractVersion,6)?`Update required`:e.isConnected?s.phase===`loading`?`Scanning…`:s.phase===`stale`?`Refreshing…`:s.phase===`partway`?dt(s.providers,ir):`Ready`:`Connecting…`:`Unavailable`;return(0,$.jsx)(h,{checked:t,closeOnClick:!1,onCheckedChange:t=>{let i=new Set(r.map(yr));t?i.add(e.environmentId):i.delete(e.environmentId),a(i.size===n.length?null:i)},children:(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),o?(0,$.jsx)(`span`,{className:M(`shrink-0 text-xs text-muted-foreground`,e.error!==null&&`text-destructive`),children:l}):null]})},e.environmentId)},t[25]=n.length,t[26]=a,t[27]=c,t[28]=i,t[29]=r,t[30]=o,t[31]=e):e=t[31],j=n.map(e),t[18]=n,t[19]=a,t[20]=c,t[21]=i,t[22]=r,t[23]=o,t[24]=j}else j=t[24];let N;t[32]===n.length?N=t[33]:(N=n.length===0?(0,$.jsx)(`p`,{className:`px-2 py-2 text-xs text-muted-foreground`,children:`No environments connected.`}):null,t[32]=n.length,t[33]=N);let P;t[34]!==l||t[35]!==o?(P=o&&l?(0,$.jsx)(`p`,{className:`px-2 py-2 text-xs text-muted-foreground`,children:`Totals are partial while selected environments scan.`}):null,t[34]=l,t[35]=o,t[36]=P):P=t[36];let I;t[37]!==d||t[38]!==u||t[39]!==r||t[40]!==o?(I=o?(0,$.jsx)(pr,{environments:r,duplicateSources:u,contractMismatches:d}):null,t[37]=d,t[38]=u,t[39]=r,t[40]=o,t[41]=I):I=t[41];let L;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(A,{}),t[42]=L):L=t[42];let R;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(F,{"aria-hidden":!0}),t[43]=R):R=t[43];let z;t[44]===p?z=t[45]:(z=(0,$.jsxs)(C,{onClick:p,children:[R,`Model prices`]}),t[44]=p,t[45]=z);let B;t[46]!==N||t[47]!==P||t[48]!==I||t[49]!==z||t[50]!==D||t[51]!==j?(B=(0,$.jsxs)(O,{align:`start`,children:[D,k,j,N,P,I,L,z]}),t[46]=N,t[47]=P,t[48]=I,t[49]=z,t[50]=D,t[51]=j,t[52]=B):B=t[52];let V;return t[53]!==B||t[54]!==T?(V=(0,$.jsxs)(m,{children:[T,B]}),t[53]=B,t[54]=T,t[55]=V):V=t[55],V}function yr(e){return e.environmentId}function br(e){return e.error!==null}function xr(e){let t=(0,Q.c)(23),{hiddenProviders:n,onChange:r}=e,i;t[0]===n?i=t[1]:(i=We.filter(e=>!n.has(e)),t[0]=n,t[1]=i);let a=i,o=a.length===We.length?`All providers`:a.length===0?`No providers`:a.length===1?Ge[a[0]].label:`${a.length} providers`,c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(ee,{}),t[2]=c):c=t[2];let l;t[3]===o?l=t[4]:(l=(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:o}),t[3]=o,t[4]=l);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(s,{className:`size-3.5 shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover/usage-provider:opacity-100 group-focus-visible/usage-provider:opacity-100 group-data-popup-open/usage-provider:opacity-100`,"aria-hidden":!0}),t[5]=u):u=t[5];let d;t[6]===l?d=t[7]:(d=(0,$.jsxs)(x,{render:c,className:`group/usage-provider min-w-0 max-w-full`,children:[l,u]}),t[6]=l,t[7]=d);let f=n.size===0,p;t[8]===r?p=t[9]:(p=e=>r(e?[]:We),t[8]=r,t[9]=p);let g;t[10]!==f||t[11]!==p?(g=(0,$.jsx)(h,{checked:f,closeOnClick:!1,onCheckedChange:p,children:`All providers`}),t[10]=f,t[11]=p,t[12]=g):g=t[12];let _;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(A,{}),t[13]=_):_=t[13];let v;t[14]!==n||t[15]!==r?(v=We.map(e=>(0,$.jsx)(h,{checked:!n.has(e),closeOnClick:!1,onCheckedChange:t=>r(We.filter(r=>r===e?!t:n.has(r))),children:(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(ur,{provider:e,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`truncate`,children:Ge[e].label})]})},e)),t[14]=n,t[15]=r,t[16]=v):v=t[16];let y;t[17]!==v||t[18]!==g?(y=(0,$.jsxs)(O,{align:`start`,children:[g,_,v]}),t[17]=v,t[18]=g,t[19]=y):y=t[19];let b;return t[20]!==y||t[21]!==d?(b=(0,$.jsxs)(m,{children:[d,y]}),t[20]=y,t[21]=d,t[22]=b):b=t[22],b}function Sr(){let e=(0,Q.c)(7),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(X,{className:`h-10 w-36`}),(0,$.jsx)(X,{className:`h-4 w-32`})]}),We.map(Cr)]}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(X,{className:`h-5 w-24`}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsxs)(`section`,{className:`grid gap-6 lg:grid-cols-[minmax(0,18rem)_minmax(0,1fr)]`,children:[t,(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[n,(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(X,{className:`ml-16 h-56`}),(0,$.jsx)(X,{className:`ml-16 h-4`})]})]})]}),e[2]=r):r=e[2];let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(`h2`,{className:`text-sm font-medium text-foreground`,children:`Totals`}),e[3]=i):i=e[3];let a;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[i,(0,$.jsx)(wr,{labels:[`Processed tokens`,`Cached input`,`Uncached input`,`Output`,`Cache savings`]})]}),e[4]=a):a=e[4];let o;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(`section`,{className:`grid gap-x-12 gap-y-8 lg:grid-cols-2`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,$.jsx)(X,{className:`h-5 w-28`}),(0,$.jsx)(X,{className:`h-2`}),(0,$.jsx)(X,{className:`h-4 w-72`})]})}),e[5]=o):o=e[5];let s;return e[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsxs)($.Fragment,{children:[r,a,o,(0,$.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-medium text-foreground`,children:`Breakdown`}),(0,$.jsx)(X,{shape:`card`,className:`h-7 w-28`})]}),(0,$.jsx)(X,{className:`h-44`})]})]}),e[6]=s):s=e[6],s}function Cr(e){return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`div`,{className:`flex min-h-5 items-center justify-between gap-4`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(X,{shape:`pill`,className:`size-2 shrink-0`}),(0,$.jsx)(X,{shape:`pill`,className:`size-4 shrink-0`}),(0,$.jsx)(X,{className:`h-3.5 w-20`})]}),(0,$.jsx)(X,{className:`h-3.5 w-14`})]}),(0,$.jsx)(X,{className:`h-4 w-36`})]},e)}function wr(e){let t=(0,Q.c)(4),{labels:n}=e,r;t[0]===n?r=t[1]:(r=n.map(Tr),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,$.jsx)(`div`,{className:`grid grid-cols-2 gap-x-6 gap-y-4 py-1 md:grid-cols-5`,children:r}),t[2]=r,t[3]=i),i}function Tr(e){return(0,$.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e}),(0,$.jsx)(X,{className:`h-6 w-16`})]},e)}var Er=ar;export{Er as component};
2
- //# sourceMappingURL=usage-ChIGOn5O.js.map
@@ -1,3 +0,0 @@
1
- import{a as e,t}from"./react-BUfh6y28.js";import{n}from"./jsx-runtime-DJeoFXNw.js";import{$h as r,AT as i,Ab as a,Bh as o,Dh as s,Eb as c,FT as l,Fh as u,Fs as d,H_ as f,IS as p,Ib as ee,Js as te,Lb as ne,MT as m,Mb as re,Mh as ie,Ml as ae,Ms as oe,Ns as se,Oh as ce,PS as le,Ph as ue,Pl as de,Qo as fe,U_ as pe,W_ as me,Wb as he,Zh as ge,_s as h,as as _e,cs as g,cx as ve,dx as ye,eg as be,ex as xe,hE as _,hb as Se,jl as Ce,ks as we,lS as Te,lv as Ee,mE as De,mx as Oe,nb as ke,ns as v,oy as Ae,px as je,qg as Me,qh as Ne,rs as Pe,sb as Fe,tx as Ie,ux as Le,vv as Re,wb as ze,wh as Be,x_ as Ve,yE as He,y_ as Ue,yb as We,zc as Ge}from"./utils-CcBaVOX5.js";import{At as Ke,E as qe,I as Je,R as Ye,Sn as Xe,T as Ze,W as Qe,_t as y}from"./runtime-DeVKKxNz.js";import{Mt as $e,Ot as et,T as tt,t as nt}from"./runtime-DCbEdU32.js";import{i as b}from"./toast-Dkj3G-UM.js";import{f as x,h as S,m as rt,u as it}from"./server-Ct4-BCZx.js";import{i as at,n as ot,s as st,t as ct}from"./session-Bb7JWdWO.js";import{t as C}from"./use-atom-command-D4TeQyNE.js";import{D as lt,M as ut,N as dt,P as ft,S as pt,c as mt,i as w,n as ht,o as gt,r as _t,x as vt,y as yt}from"./themePalette-Uk7bx8zb.js";var T=e(t(),1),E=n();function bt(e,t){if(e.size!==t.size)return!1;for(let[n,r]of e)if(t.get(n)!==r)return!1;return!0}function xt(e){let t=_e(t=>g(n=>{let r=n(e.catalogValueAtom).entries.get(t);if(r===void 0)return null;let i=De(oe(n(e.stateAtom(t))),()=>Xe);return{entry:r,connection:r.unsupportedReason===void 0?i===Xe&&r.enabled?{phase:`connecting`,error:null,traceId:null}:$e(i):{phase:`unsupported`,error:r.unsupportedReason,traceId:null},serverConfig:n(e.serverConfigValueAtom(t))}}).pipe(h(`environment-presentation:${t}`))),n=new Map;return{presentationAtom:t,presentationsAtom:g(r=>{let i=new Map;for(let n of r(e.catalogValueAtom).entries.keys()){let e=r(t(n));e!==null&&i.set(n,e)}return bt(n,i)||(n=i),n}).pipe(h(`environment-presentations`))}}function St(e,t){return{environmentId:e,environmentLabel:t.entry.target.label,displayUrl:et(t.entry)??``,isRelayManaged:Ke(t.entry),isEnabled:t.entry.enabled,connectionState:t.connection.phase,connectionError:t.connection.error,connectionErrorTraceId:t.connection.traceId}}function Ct(e){let t=g(t=>{let n=[...t(e.catalogValueAtom).entries.keys()],r=_(t.self());return r!==null&&r.length===n.length&&n.every((e,t)=>e===r[t])?r:n}),n=g(t=>{let n=[...t(e.catalogValueAtom).entries].map(([e,t])=>({environmentId:e,label:t.target.label})),r=_(t.self());return r!==null&&r.length===n.length&&n.every((e,t)=>e.environmentId===r[t]?.environmentId&&e.label===r[t]?.label)?r:n}),r=_e(t=>g(n=>{let r=n(e.presentationAtom(t));if(r===null)return null;let i=St(t,r),a=_(n.self());return a!==null&&a.environmentId===i.environmentId&&a.environmentLabel===i.environmentLabel&&a.displayUrl===i.displayUrl&&a.isRelayManaged===i.isRelayManaged&&a.isEnabled===i.isEnabled&&a.connectionState===i.connectionState&&a.connectionError===i.connectionError&&a.connectionErrorTraceId===i.connectionErrorTraceId?a:i})),i=g(t=>{let n=[];for(let i of t(e.catalogValueAtom).entries.keys()){let e=t(r(i));e!==null&&n.push(e)}let i=_(t.self());return i!==null&&i.length===n.length&&n.every((e,t)=>e===i[t])?i:n}).pipe(h(`environment-connection-summaries`));return{environmentIdsAtom:t,connectedEnvironmentIdsAtom:g(e=>{let n=e(t).filter(t=>e(r(t))?.connectionState===`connected`),i=_(e.self());return i!==null&&i.length===n.length&&n.every((e,t)=>e===i[t])?i:n}),identitiesAtom:n,environmentsAtom:i,machineByIdAtom:g(n=>{let r=new Map(n(t).map(t=>[t,de(n(e.presentationAtom(t))?.serverConfig??null)])),i=_(n.self());return i!==null&&bt(i,r)?i:r}),pullRequestsSupportedAtom:g(n=>n(t).some(t=>n(e.presentationAtom(t))?.serverConfig?.environment.capabilities.pullRequests===!0))}}var wt=xt({catalogValueAtom:S.catalogValueAtom,stateAtom:S.stateAtom,serverConfigValueAtom:x.configValueAtom}),D=Ct({catalogValueAtom:S.catalogValueAtom,presentationAtom:wt.presentationAtom}),Tt=g(null).pipe(h(`web-environment-presentation:empty`));function Et(e){let t=(0,E.c)(5),n=v(S.catalogValueAtom),r;t[0]===e?r=t[1]:(r=e===null?Tt:wt.presentationAtom(e),t[0]=e,t[1]=r);let i=v(r),a;return t[2]!==n.isReady||t[3]!==i?(a={isReady:n.isReady,presentation:i},t[2]=n.isReady,t[3]=i,t[4]=a):a=t[4],a}var Dt={status:`idle`},O=Dt,k=null,A=[],j=0,Ot=new Set;function M(e){O=e;for(let e of Ot)e()}function kt(e){k?.resolve(e);for(let t of A)t.resolve(e);k=null,A=[]}function At(){return O}function jt(e){return Ot.add(e),()=>{Ot.delete(e)}}function Mt(){j+=1;let e=!0;return()=>{e&&(e=!1,j=Math.max(0,j-1),j===0&&(kt(!1),M(Dt)))}}function Nt(e,t){if(j!==0)return new Promise(n=>{let r={message:e,variant:t?.variant??`default`,resolve:n};k||O.status===`closing`?A.push(r):(k=r,M({status:`confirming`,message:e,variant:r.variant}))})}function Pt(){return O.status!==`idle`||k!==null||A.length>0}function Ft(e){if(O.status!==`confirming`||!k)return;let t=k;k=null,t.resolve(e),M({status:`closing`,message:O.message,variant:O.variant})}function It(){if(O.status!==`closing`)return;let e=A.shift();e?(k=e,M({status:`confirming`,message:e.message,variant:e.variant})):M(Dt)}var Lt={Ctrl:`⌃`,Alt:`⌥`,Shift:`⇧`,Super:`⌘`,CmdOrCtrl:`⌘`};function Rt(e,t=navigator.platform){let n=e.split(`+`),r=n.pop()??``;return Ge(t)?`${n.map(e=>Lt[e]??e).join(``)}${r}`:[...n.map(e=>e===`CmdOrCtrl`?`Ctrl`:e===`Super`?`Meta`:e),r].join(`+`)}var zt=`http://www.w3.org/2000/svg`,Bt={archive:[{tag:`rect`,attrs:{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`}},{tag:`path`,attrs:{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`}},{tag:`path`,attrs:{d:`M10 12h4`}}],check:[{tag:`path`,attrs:{d:`M20 6 9 17l-5-5`}}],timer:[{tag:`line`,attrs:{x1:`10`,x2:`14`,y1:`2`,y2:`2`}},{tag:`line`,attrs:{x1:`12`,x2:`15`,y1:`14`,y2:`11`}},{tag:`circle`,attrs:{cx:`12`,cy:`14`,r:`8`}}],"chevron-right":[{tag:`path`,attrs:{d:`m9 19 7-7-7-7`}}],"circle-check":[{tag:`circle`,attrs:{cx:`12`,cy:`12`,r:`10`}},{tag:`path`,attrs:{d:`m9 12 2 2 4-4`}}],clock:[{tag:`path`,attrs:{d:`M12 6v6l4 2`}},{tag:`circle`,attrs:{cx:`12`,cy:`12`,r:`10`}}],pencil:[{tag:`path`,attrs:{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`}},{tag:`path`,attrs:{d:`m15 5 4 4`}}],copy:[{tag:`rect`,attrs:{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}},{tag:`path`,attrs:{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`}}],folder:[{tag:`path`,attrs:{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`}}],"git-branch":[{tag:`line`,attrs:{x1:`6`,x2:`6`,y1:`3`,y2:`15`}},{tag:`circle`,attrs:{cx:`18`,cy:`6`,r:`3`}},{tag:`circle`,attrs:{cx:`6`,cy:`18`,r:`3`}},{tag:`path`,attrs:{d:`M18 9a9 9 0 0 1-9 9`}}],eye:[{tag:`path`,attrs:{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`}},{tag:`circle`,attrs:{cx:`12`,cy:`12`,r:`3`}}],"eye-off":[{tag:`path`,attrs:{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`}},{tag:`path`,attrs:{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`}},{tag:`path`,attrs:{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`}},{tag:`path`,attrs:{d:`m2 2 20 20`}}],"app-window":[{tag:`rect`,attrs:{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`}},{tag:`path`,attrs:{d:`M10 4v4`}},{tag:`path`,attrs:{d:`M2 8h20`}},{tag:`path`,attrs:{d:`M6 4v4`}}],"arrow-up-right":[{tag:`path`,attrs:{d:`M7 7h10v10`}},{tag:`path`,attrs:{d:`M7 17 17 7`}}],"external-link":[{tag:`path`,attrs:{d:`M15 3h6v6`}},{tag:`path`,attrs:{d:`M10 14 21 3`}},{tag:`path`,attrs:{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`}}],link:[{tag:`path`,attrs:{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`}},{tag:`path`,attrs:{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`}}],list:[{tag:`path`,attrs:{d:`M3 5h.01`}},{tag:`path`,attrs:{d:`M3 12h.01`}},{tag:`path`,attrs:{d:`M3 19h.01`}},{tag:`path`,attrs:{d:`M8 5h13`}},{tag:`path`,attrs:{d:`M8 12h13`}},{tag:`path`,attrs:{d:`M8 19h13`}}],share:[{tag:`path`,attrs:{d:`M12 2v13`}},{tag:`path`,attrs:{d:`m16 6-4-4-4 4`}},{tag:`path`,attrs:{d:`M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8`}}],x:[{tag:`path`,attrs:{d:`M18 6 6 18`}},{tag:`path`,attrs:{d:`m6 6 12 12`}}],hash:[{tag:`line`,attrs:{x1:`4`,x2:`20`,y1:`9`,y2:`9`}},{tag:`line`,attrs:{x1:`4`,x2:`20`,y1:`15`,y2:`15`}},{tag:`line`,attrs:{x1:`10`,x2:`8`,y1:`3`,y2:`21`}},{tag:`line`,attrs:{x1:`16`,x2:`14`,y1:`3`,y2:`21`}}],"mail-open":[{tag:`path`,attrs:{d:`M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z`}},{tag:`path`,attrs:{d:`m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10`}}],"message-square":[{tag:`path`,attrs:{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`}}],"message-square-plus":[{tag:`path`,attrs:{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`}},{tag:`path`,attrs:{d:`M12 8v6`}},{tag:`path`,attrs:{d:`M9 11h6`}}],pin:[{tag:`path`,attrs:{d:`M12 17v5`}},{tag:`path`,attrs:{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`}}],"pin-off":[{tag:`path`,attrs:{d:`M12 17v5`}},{tag:`path`,attrs:{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`}},{tag:`path`,attrs:{d:`m2 2 20 20`}},{tag:`path`,attrs:{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`}}],"refresh-cw":[{tag:`path`,attrs:{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`}},{tag:`path`,attrs:{d:`M21 3v5h-5`}},{tag:`path`,attrs:{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`}},{tag:`path`,attrs:{d:`M8 16H3v5`}}],settings:[{tag:`path`,attrs:{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.38a2 2 0 0 0-.73-2.73l-.15-.09a2 2 0 0 1-1-1.74v-.51a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`}},{tag:`circle`,attrs:{cx:`12`,cy:`12`,r:`3`}}],"folder-tree":[{tag:`path`,attrs:{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`}},{tag:`path`,attrs:{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`}},{tag:`path`,attrs:{d:`M3 5a2 2 0 0 0 2 2h3`}},{tag:`path`,attrs:{d:`M3 3v13a2 2 0 0 0 2 2h3`}}],trash:[{tag:`path`,attrs:{d:`M3 6h18`}},{tag:`path`,attrs:{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`}},{tag:`path`,attrs:{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`}},{tag:`line`,attrs:{x1:`10`,x2:`10`,y1:`11`,y2:`17`}},{tag:`line`,attrs:{x1:`14`,x2:`14`,y1:`11`,y2:`17`}}]};function Vt(e,t){let n=Bt[e];if(!n||typeof document.createElementNS!=`function`)return null;let r=document.createElementNS(zt,`svg`);r.setAttribute(`xmlns`,zt),r.setAttribute(`viewBox`,`0 0 24 24`),r.setAttribute(`fill`,`none`),r.setAttribute(`stroke`,`currentColor`),r.setAttribute(`stroke-width`,`2`),r.setAttribute(`stroke-linecap`,`round`),r.setAttribute(`stroke-linejoin`,`round`),r.setAttribute(`class`,t===`destructive`?`size-4.5 shrink-0 sm:size-4`:`size-4.5 shrink-0 text-muted-foreground sm:size-4`);for(let e of n){let t=document.createElementNS(zt,e.tag);for(let[n,r]of Object.entries(e.attrs))t.setAttribute(n,r);r.appendChild(t)}return r}function Ht(e,t,n){let r=e.getBoundingClientRect(),i=Math.min(Math.max(4,t),Math.max(4,window.innerWidth-r.width-4)),a=Math.min(Math.max(4,n),Math.max(4,window.innerHeight-r.height-4));e.style.left=`${i}px`,e.style.top=`${a}px`}function Ut(e,t){if(typeof Node<`u`&&e instanceof Node)return t.some(t=>t.contains(e));if(!e||typeof e!=`object`)return!1;let n=e;for(;n&&typeof n==`object`;){if(t.includes(n))return!0;n=n.parent}return!1}var N=null;function Wt(){return N!==null}function Gt(){N?.(),N=null}function Kt(e,t){return new Promise(n=>{let r=document.activeElement instanceof HTMLElement?document.activeElement:null,i=[],a=[],o=!1,s=!1,c=()=>l(null),l=e=>{if(o)return;o=!0,N===c&&(N=null),document.removeEventListener(`keydown`,u),document.removeEventListener(`pointerdown`,d,!0),document.removeEventListener(`contextmenu`,f,!0);let t=Ut(document.activeElement,i);for(let e of i)e.remove();t&&r?.isConnected&&r.focus({preventScroll:!0}),n(e)},u=e=>{e.key===`Escape`&&(e.preventDefault(),l(null))},d=e=>{s&&!Ut(e.target,i)&&l(null)},f=e=>{s&&!Ut(e.target,i)&&(e.preventDefault(),l(null))},p=e=>{for(;i.length>e;)a.pop()?.setAttribute(`aria-expanded`,`false`),i.pop()?.remove()},ee=(e,t,n,r,o)=>{p(r);let c=document.createElement(`div`);c.className=`dropdown-glass fixed z-[10000] min-w-56 max-w-sm overflow-hidden rounded-lg bg-clip-padding text-popover-foreground outline-none`,c.style.cssText=`position:fixed;z-index:10000;min-width:14rem;max-width:24rem;overflow:hidden;border-radius:var(--radius-lg);background-clip:padding-box;color:var(--contrast-popover-foreground);outline:none;pointer-events:auto;`,c.style.left=`${t}px`,c.style.top=`${n}px`,c.dataset.level=String(r);let u=document.createElement(`div`);u.className=`max-h-[calc(100vh-0.5rem)] min-w-0 max-w-sm overflow-y-auto overflow-x-hidden p-1`,u.style.cssText=`max-height:calc(100vh - 0.5rem);min-width:0;max-width:24rem;overflow-x:hidden;overflow-y:auto;padding:0.25rem;`;for(let t of e){if(t.separatorBefore===!0&&u.children.length>0){let e=document.createElement(`div`);e.className=`mx-2 my-1 h-px bg-border`,e.style.cssText=`height:1px;margin:0.25rem 0.5rem;background:var(--contrast-border);`,e.dataset.contextMenuSeparator=`true`,e.setAttribute(`role`,`separator`),u.appendChild(e)}if(t.header===!0){let e=document.createElement(`div`);e.className=`px-2 py-1.5 font-medium text-muted-foreground text-xs`,e.textContent=t.label,u.appendChild(e);continue}let e=Array.isArray(t.children)&&t.children.length>0,n=!e&&(t.destructive===!0||t.id===`delete`),a=document.createElement(`button`);a.type=`button`;let o=t.disabled===!0;a.disabled=o;let c=`flex w-full cursor-default select-none items-center gap-2 rounded-sm px-2 py-1 text-left outline-none transition-colors sm:min-h-7 sm:text-sm min-h-8 text-base`;if(a.className=o?`${c} pointer-events-none cursor-not-allowed text-muted-foreground opacity-64`:n?`${c} text-destructive-foreground hover:bg-destructive/10 hover:text-destructive-foreground`:`${c} text-foreground hover:bg-accent hover:text-accent-foreground`,a.style.cssText=`display:flex;width:100%;min-height:1.75rem;align-items:center;gap:0.5rem;border:0;border-radius:var(--radius-sm);background:transparent;padding:0.25rem 0.5rem;color:var(--contrast-foreground);font-family:var(--font-sans,system-ui,sans-serif);font-size:0.875rem;line-height:1.25rem;text-align:left;cursor:default;`,n&&(a.style.color=`var(--destructive-foreground)`),o&&(a.style.color=`var(--contrast-muted-foreground)`,a.style.opacity=`0.64`,a.style.pointerEvents=`none`),typeof t.checked==`boolean`){a.setAttribute(`role`,`menuitemradio`),a.setAttribute(`aria-checked`,t.checked?`true`:`false`);let e=t.checked?Vt(`check`,`neutral`):null;if(e)a.appendChild(e);else{let e=document.createElement(`span`);e.className=`size-4.5 shrink-0 sm:size-4`,e.style.cssText=`display:inline-block;width:1rem;height:1rem;flex-shrink:0;`,e.setAttribute(`aria-hidden`,`true`),a.appendChild(e)}}else if(typeof t.icon==`string`){let e=Vt(t.icon,n?`destructive`:`neutral`);e&&a.appendChild(e)}let d=document.createElement(`span`);if(d.className=`min-w-0 flex-1 truncate`,d.textContent=t.label,a.appendChild(d),typeof t.accelerator==`string`){let e=document.createElement(`span`);e.className=`ms-6 shrink-0 text-muted-foreground text-xs tracking-widest`,e.style.cssText=`margin-inline-start:1.5rem;flex-shrink:0;color:var(--contrast-muted-foreground);font-size:0.75rem;letter-spacing:0.1em;`,e.textContent=Rt(t.accelerator),e.setAttribute(`aria-hidden`,`true`),a.setAttribute(`aria-keyshortcuts`,t.accelerator.replace(`CmdOrCtrl`,Ge(navigator.platform)?`Meta`:`Control`)),a.appendChild(e)}if(e){a.setAttribute(`aria-haspopup`,`menu`),a.setAttribute(`aria-expanded`,`false`);let e=Vt(`chevron-right`,`neutral`);e&&(e.setAttribute(`class`,`-me-0.5 ms-auto size-4.5 shrink-0 text-muted-foreground opacity-80 sm:size-4`),e.setAttribute(`aria-hidden`,`true`),e.dataset.contextMenuChevron=`true`,a.appendChild(e))}if(!o){let o=!1,c=!1,u=()=>{let e=o||c;a.style.background=e?n?`color-mix(in srgb, var(--destructive) 10%, transparent)`:`var(--accent)`:`transparent`,a.style.color=e?n?`var(--destructive-foreground)`:`var(--contrast-accent-foreground)`:n?`var(--destructive-foreground)`:`var(--contrast-foreground)`};if(a.addEventListener(`mouseenter`,()=>{a.focus({preventScroll:!0}),o=!0,u()}),a.addEventListener(`mouseleave`,()=>{o=!1,u()}),a.addEventListener(`focus`,()=>{c=!0,u()}),a.addEventListener(`blur`,()=>{c=!1,u()}),e){let e=(e=!1)=>{let n=a.getBoundingClientRect(),o=n.right+4,s=n.top;ee(t.children,o,s,r+1,a),a.setAttribute(`aria-expanded`,`true`);let c=i[r+1];if(!c)return;let l=c.getBoundingClientRect();l.right>window.innerWidth&&Ht(c,n.left-l.width-4,n.top),e&&[...c.querySelectorAll(`button`)].find(e=>!e.disabled)?.focus()};a.addEventListener(`mouseenter`,()=>{e()}),a.addEventListener(`click`,t=>{t.preventDefault(),e(!0)})}else a.addEventListener(`mouseenter`,()=>{p(r+1)}),a.addEventListener(`click`,()=>{s&&l(t.id)})}u.appendChild(a)}c.appendChild(u),c.addEventListener(`mouseenter`,()=>{p(r+1)}),document.body.appendChild(c),i[r]=c,a[r]=o,requestAnimationFrame(()=>{Ht(c,t,n)})};document.addEventListener(`keydown`,u),document.addEventListener(`pointerdown`,d,!0),document.addEventListener(`contextmenu`,f,!0),ee(e,t?.x??0,t?.y??0,0),N&&N(),N=c,requestAnimationFrame(()=>{s=!0})})}var qt=`p4code:client-settings:v1`;function Jt(){return typeof window<`u`}function Yt(){return Jt()?se(qt,Be):null}function Xt(e){Jt()&&d(qt,e,Be)}var Zt;function Qt(){return{dialogs:{pickFolder:async e=>window.desktopBridge?window.desktopBridge.pickFolder(e):null,confirm:async(e,t)=>Nt(e,t)??!1},shell:{openExternal:async e=>{if(window.desktopBridge){if(!await window.desktopBridge.openExternal(e))throw Error(`Unable to open link.`)}else window.open(e,`_blank`,`noopener,noreferrer`)},openSystemSettings:async e=>{if(!window.desktopBridge?.openSystemSettings||!await window.desktopBridge.openSystemSettings(e))throw Error(`Unable to open System Settings.`)}},contextMenu:{show:async(e,t)=>window.desktopBridge?window.desktopBridge.showContextMenu(e,t):Kt(e,t),close:async()=>{window.desktopBridge||Gt()}},persistence:{getClientSettings:async()=>window.desktopBridge?window.desktopBridge.getClientSettings():Yt(),setClientSettings:async e=>{if(window.desktopBridge)return window.desktopBridge.setClientSettings(e);Xt(e)}}}}function $t(){return Qt()}function en(){if(typeof window<`u`)return Zt||(Zt=$t(),Zt)}function tn(){let e=en();if(!e)throw Error(`Local API not found`);return e}var P=`p4code:theme`,nn=`(prefers-color-scheme: dark)`,F={theme:`system`,resolvedTheme:`light`,systemDark:!1,followSystem:!0,appearanceMode:`system`,themeHalves:null};function rn(){return I()}function an(){return typeof window>`u`?{}:on()}function I(){if(typeof window>`u`)return null;try{return lt(window.localStorage.getItem(w))}catch{return null}}function on(){try{let e=JSON.parse(window.localStorage.getItem(`p4code:theme-halves:v1`)??`null`);if(typeof e!=`object`||!e)return{};let t={};for(let n of[`light`,`dark`]){let r=e[n];typeof r==`string`&&(t[n]=r)}return t}catch{return{}}}function L(e){return`${e?.light??``}|${e?.dark??``}`}var sn=`theme-color`,cn=`meta[name="${sn}"][data-dynamic-theme-color="true"]`,R=class extends We()(`ThemeStorageError`,{operation:Fe([`read`,`write`]),storageKey:Se,theme:he(gt),cause:ke()}){get message(){return`Failed to ${this.operation} theme preference for ${this.storageKey}.`}},ln=ne(R),un=class extends We()(`DesktopThemeSyncError`,{theme:gt,cause:ke()}){get message(){return`Failed to sync the ${this.theme} theme to the desktop shell.`}},dn=ne(un),z=[],B=null,fn=!0,V=null,H=null,U=null;function W(){fn=!0;for(let e of z)e()}function pn(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(nn).matches}function mn(e){if(typeof window>`u`)return e===`system`;try{let e=window.localStorage.getItem(_t);if(e===`true`)return!0;if(e===`false`)return!1}catch{}return e===`system`}function hn(e){return e===`light`||e===`dark`||e===`system`}function G(e){if(typeof window<`u`)try{let e=window.localStorage.getItem(ht);if(hn(e))return e}catch{}return mn(e)?`system`:yt(e)??`light`}function gn(e){if(typeof window<`u`)try{window.localStorage.setItem(ht,e)}catch(e){throw new R({operation:`write`,storageKey:ht,cause:e})}}function _n(){if(typeof window>`u`)return F.theme;let e;try{e=window.localStorage.getItem(P)}catch(e){throw new R({operation:`read`,storageKey:P,cause:e})}return e!==null&&pt(e)?e:F.theme}function vn(e){if(typeof window<`u`)try{window.localStorage.setItem(P,e),U=null}catch(t){throw new R({operation:`write`,storageKey:P,theme:e,cause:t})}}function K(){if(U!==null)return F.theme;try{return _n()}catch(e){let t=ln(e)?e:new R({operation:`read`,storageKey:P,cause:e});return U=t,console.error(t.message,{operation:t.operation,storageKey:t.storageKey,...y(t)}),F.theme}}function yn(){let e=document.querySelector(cn);return e||(e=document.createElement(`meta`),e.name=sn,e.setAttribute(`data-dynamic-theme-color`,`true`),document.head.append(e),e)}function bn(e){let t=e?.trim().toLowerCase();return!t||t===`transparent`||t===`rgba(0, 0, 0, 0)`||t===`rgba(0 0 0 / 0)`?null:e?.trim()??null}function xn(){return document.querySelector(`main[data-slot='sidebar-inset']`)??document.querySelector(`[data-slot='sidebar-inner']`)??document.body}function Sn(){if(typeof document>`u`||typeof getComputedStyle>`u`)return;let e=getComputedStyle(document.documentElement),t=document.documentElement.dataset.themeId?bn(e.getPropertyValue(`--app-chrome-background`)):null,n=bn(getComputedStyle(xn()).backgroundColor),r=bn(getComputedStyle(document.body).backgroundColor),i=t??n??r;if(!i)return;document.documentElement.style.backgroundColor=i,document.body.style.backgroundColor=i;let a=document.querySelectorAll(`meta[name="${sn}"]`);if(a.length===0)yn().setAttribute(`content`,i);else for(let e of a)e.setAttribute(`content`,i)}function q(e,{suppressTransitions:t=!1,preservePreview:n=!0}={}){if(typeof document>`u`||typeof window>`u`||n&&document.documentElement.dataset?.themeId===`__preview`)return;let r=G(e),i=r===`system`,a=i?pn():!1,o=I();if(H?.theme===e&&H.systemDark===a&&H.followSystem===i&&H.appearanceMode===r&&L(H.themeHalves)===L(o)){wn(e,i,r);return}t&&document.documentElement.classList.add(`no-transitions`);let s=dt(e,a,i,r,o);mt(ft(e,o,s),s),document.documentElement.classList.toggle(`dark`,s===`dark`),H={theme:e,systemDark:a,followSystem:i,appearanceMode:r,themeHalves:o},Sn(),wn(e,i,r),t&&(document.documentElement.offsetHeight,requestAnimationFrame(()=>{document.documentElement.classList.remove(`no-transitions`)}))}async function Cn(e,t,n,r,i=I()){try{await e.setTheme(ut(t,n,r,i))}catch(e){throw new un({theme:t,cause:e})}}function wn(e,t,n){if(typeof window>`u`)return;let r=window.desktopBridge,i=I(),a=ut(e,t,n,i);r&&typeof r.setTheme==`function`&&V!==a&&(V=a,Cn(r,e,t,n,i).catch(t=>{let n=dn(t)?t:new un({theme:e,cause:t});console.error(n.message,{theme:n.theme,...y(n)}),V===a&&(V=null)}))}typeof document<`u`&&typeof window<`u`&&q(K());function Tn(){if(typeof window>`u`)return F;if(!fn&&B)return B;fn=!1;let e=K(),t=G(e),n=t===`system`,r=n?pn():!1,i=I(),a=dt(e,r,n,t,i);return B&&B.theme===e&&B.resolvedTheme===a&&B.systemDark===r&&B.followSystem===n&&B.appearanceMode===t&&L(B.themeHalves)===L(i)||(B={theme:e,resolvedTheme:a,systemDark:r,followSystem:n,appearanceMode:t,themeHalves:i}),B}function En(){return F}function Dn(){let e=K();G(e)===`system`&&q(e,{suppressTransitions:!0}),W()}function On(e){e.key===P?(U=null,q(K(),{suppressTransitions:!0}),W()):e.key===`p4code:theme-follow-system`||e.key===`p4code:theme-appearance-mode`||e.key===`p4code:theme-halves:v1`?(q(K(),{suppressTransitions:!0}),W()):(e.key===`p4code:themes:v1`||e.key===null)&&(e.key===null&&(U=null),vt(),H=null,q(K(),{suppressTransitions:!0}),W())}var kn=null;function An(e){if(typeof window>`u`)return()=>{};if(z.push(e),!kn){let e=typeof window.matchMedia==`function`?window.matchMedia(nn):null;e?.addEventListener(`change`,Dn),window.addEventListener(`storage`,On),kn=()=>{e?.removeEventListener(`change`,Dn),window.removeEventListener(`storage`,On)}}return()=>{z=z.filter(t=>t!==e),z.length===0&&(kn?.(),kn=null)}}function jn(){let e=(0,T.useSyncExternalStore)(An,Tn,En),{theme:t,resolvedTheme:n}=e,r=(0,T.useCallback)(e=>{if(typeof window>`u`)return!1;try{gn(G(K()));let t=window.localStorage.getItem(w);window.localStorage.removeItem(w);try{vn(e)}catch(e){if(t!==null)try{window.localStorage.setItem(w,t)}catch{}throw e}}catch(t){let n=ln(t)?t:new R({operation:`write`,storageKey:P,theme:e,cause:t});return console.error(n.message,{operation:n.operation,storageKey:n.storageKey,theme:e,...y(n)}),!1}return q(e,{suppressTransitions:!0}),W(),!0},[]),i=(0,T.useCallback)(e=>{if(typeof window>`u`)return!1;try{gn(e)}catch(e){let t=ln(e)?e:new R({operation:`write`,storageKey:ht,cause:e});return console.error(t.message,{operation:t.operation,storageKey:t.storageKey,...y(t)}),!1}return U=null,q(K(),{suppressTransitions:!0}),W(),!0},[]),a=(0,T.useCallback)(e=>{let n=G(t),r=e?`system`:n===`system`?yt(t)??`light`:n;return i(r)},[i,t]),o=(0,T.useCallback)((e,t)=>{if(typeof window>`u`)return!1;try{let n={...on()};t===null?delete n[e]:n[e]=t,n.light===void 0&&n.dark===void 0?window.localStorage.removeItem(w):window.localStorage.setItem(w,JSON.stringify(n))}catch(e){let t=new R({operation:`write`,storageKey:w,cause:e});return console.error(t.message,{operation:t.operation,storageKey:t.storageKey,...y(t)}),!1}return q(K(),{suppressTransitions:!0}),W(),!0},[]),s=(0,T.useCallback)(()=>{if(typeof window>`u`)return!1;try{window.localStorage.removeItem(w)}catch(e){let t=new R({operation:`write`,storageKey:w,cause:e});return console.error(t.message,{operation:t.operation,storageKey:t.storageKey,...y(t)}),!1}return q(K(),{suppressTransitions:!0}),W(),!0},[]),c=(0,T.useCallback)(({preservePreview:e=!1}={})=>{typeof window<`u`&&(H=null,q(K(),{suppressTransitions:!0,preservePreview:e}),W())},[]);return(0,T.useEffect)(()=>{q(t)},[e.appearanceMode,t]),{theme:t,setTheme:r,setAppearanceMode:i,setFollowSystem:a,setThemeHalf:o,clearThemeHalves:s,refreshTheme:c,followSystem:e.followSystem,appearanceMode:e.appearanceMode,resolvedTheme:n,themeHalves:e.themeHalves}}var Mn=c(ee(ze)),Nn=Oe(e=>{let t=e.replace(/("(?:[^"\\]|\\.)*")|\/\/[^\n]*/g,(e,t)=>t?e:``);return t=t.replace(/("(?:[^"\\]|\\.)*")|\/\*[\s\S]*?\*\//g,(e,t)=>t?e:``),t=t.replace(/("(?:[^"\\]|\\.)*")|,(\s*[}\]])/g,(e,t,n)=>t?e:n??``),Mn(t).pipe(p(e=>e.issue))}),Pn=new ve(Nn,je());ye().pipe(Le(je({space:2})));var Fn=e=>Se.pipe(a(e,Pn)),In={performance:{profile:`performance`,automaticGitFetchInterval:m(15),providerHealthRefreshInterval:i(1),hostPowerMonitorActiveInterval:m(30),hostPowerMonitorIdleInterval:i(2),idleClientTtl:m(45),pauseWhenHostLocked:!0,pauseWhenHostLowPower:!1,pauseWhenClientLowPower:!1,pauseWhenOnBattery:!1},balanced:{profile:`balanced`,automaticGitFetchInterval:s,providerHealthRefreshInterval:ue,hostPowerMonitorActiveInterval:m(30),hostPowerMonitorIdleInterval:i(5),idleClientTtl:m(45),pauseWhenHostLocked:!0,pauseWhenHostLowPower:!0,pauseWhenClientLowPower:!0,pauseWhenOnBattery:!1},"battery-saver":{profile:`battery-saver`,automaticGitFetchInterval:m(0),providerHealthRefreshInterval:i(15),hostPowerMonitorActiveInterval:i(1),hostPowerMonitorIdleInterval:i(10),idleClientTtl:m(45),pauseWhenHostLocked:!0,pauseWhenHostLowPower:!0,pauseWhenClientLowPower:!0,pauseWhenOnBattery:!0}};function J(e){return In[e]}function Ln(e){return e.profile===`custom`?e.baseProfile??`balanced`:e.profile}function Rn(e){let t=Ln(e),n=In[t],r=e.profile===`custom`?e.overrides:{};return{profile:t,automaticGitFetchInterval:r.automaticGitFetchInterval??n.automaticGitFetchInterval,providerHealthRefreshInterval:r.providerHealthRefreshInterval??n.providerHealthRefreshInterval,hostPowerMonitorActiveInterval:r.hostPowerMonitorActiveInterval??n.hostPowerMonitorActiveInterval,hostPowerMonitorIdleInterval:r.hostPowerMonitorIdleInterval??n.hostPowerMonitorIdleInterval,idleClientTtl:r.idleClientTtl??n.idleClientTtl,pauseWhenHostLocked:r.pauseWhenHostLocked??n.pauseWhenHostLocked,pauseWhenHostLowPower:r.pauseWhenHostLowPower??n.pauseWhenHostLowPower,pauseWhenClientLowPower:r.pauseWhenClientLowPower??n.pauseWhenClientLowPower,pauseWhenOnBattery:r.pauseWhenOnBattery??n.pauseWhenOnBattery}}function Y(e,t){return l(e)===l(t)}function zn(e,t){return Y(e.automaticGitFetchInterval,t.automaticGitFetchInterval)&&Y(e.providerHealthRefreshInterval,t.providerHealthRefreshInterval)&&Y(e.hostPowerMonitorActiveInterval,t.hostPowerMonitorActiveInterval)&&Y(e.hostPowerMonitorIdleInterval,t.hostPowerMonitorIdleInterval)&&Y(e.idleClientTtl,t.idleClientTtl)&&e.pauseWhenHostLocked===t.pauseWhenHostLocked&&e.pauseWhenHostLowPower===t.pauseWhenHostLowPower&&e.pauseWhenClientLowPower===t.pauseWhenClientLowPower&&e.pauseWhenOnBattery===t.pauseWhenOnBattery}function Bn(e){if(e.profile!==`custom`)return{schemaVersion:1,profile:e.profile,overrides:{}};let t=Rn(e),n=[Ln(e),`balanced`,`performance`,`battery-saver`];for(let e of n)if(zn(t,In[e]))return{schemaVersion:1,profile:e,overrides:{}};let r=Ln(e),i=In[r];return{schemaVersion:1,profile:`custom`,baseProfile:r,overrides:{...Y(t.automaticGitFetchInterval,i.automaticGitFetchInterval)?{}:{automaticGitFetchInterval:t.automaticGitFetchInterval},...Y(t.providerHealthRefreshInterval,i.providerHealthRefreshInterval)?{}:{providerHealthRefreshInterval:t.providerHealthRefreshInterval},...Y(t.hostPowerMonitorActiveInterval,i.hostPowerMonitorActiveInterval)?{}:{hostPowerMonitorActiveInterval:t.hostPowerMonitorActiveInterval},...Y(t.hostPowerMonitorIdleInterval,i.hostPowerMonitorIdleInterval)?{}:{hostPowerMonitorIdleInterval:t.hostPowerMonitorIdleInterval},...Y(t.idleClientTtl,i.idleClientTtl)?{}:{idleClientTtl:t.idleClientTtl},...t.pauseWhenHostLocked===i.pauseWhenHostLocked?{}:{pauseWhenHostLocked:t.pauseWhenHostLocked},...t.pauseWhenHostLowPower===i.pauseWhenHostLowPower?{}:{pauseWhenHostLowPower:t.pauseWhenHostLowPower},...t.pauseWhenClientLowPower===i.pauseWhenClientLowPower?{}:{pauseWhenClientLowPower:t.pauseWhenClientLowPower},...t.pauseWhenOnBattery===i.pauseWhenOnBattery?{}:{pauseWhenOnBattery:t.pauseWhenOnBattery}}}}function Vn(e){let t={schemaVersion:1,profile:ce,overrides:{}},n=e.backgroundActivity.profile===t.profile&&e.backgroundActivity.baseProfile===void 0&&Object.keys(e.backgroundActivity.overrides).length===0,r=e.backgroundActivityProfile,i=r!==`balanced`||l(e.automaticGitFetchInterval)!==l(s)||l(e.providerHealthRefreshInterval)!==l(ue);return Rn(n&&i?{schemaVersion:1,profile:l(e.automaticGitFetchInterval)===l(J(r).automaticGitFetchInterval)&&l(e.providerHealthRefreshInterval)===l(J(r).providerHealthRefreshInterval)?r:`custom`,baseProfile:r,overrides:{...l(e.automaticGitFetchInterval)===l(J(r).automaticGitFetchInterval)?{}:{automaticGitFetchInterval:e.automaticGitFetchInterval},...l(e.providerHealthRefreshInterval)===l(J(r).providerHealthRefreshInterval)?{}:{providerHealthRefreshInterval:e.providerHealthRefreshInterval}}}:e.backgroundActivity)}function Hn(e){let t=Vn(e);return Bn({schemaVersion:1,profile:`custom`,baseProfile:t.profile,overrides:{automaticGitFetchInterval:t.automaticGitFetchInterval,providerHealthRefreshInterval:t.providerHealthRefreshInterval,hostPowerMonitorActiveInterval:t.hostPowerMonitorActiveInterval,hostPowerMonitorIdleInterval:t.hostPowerMonitorIdleInterval,idleClientTtl:t.idleClientTtl,pauseWhenHostLocked:t.pauseWhenHostLocked,pauseWhenHostLowPower:t.pauseWhenHostLowPower,pauseWhenClientLowPower:t.pauseWhenClientLowPower,pauseWhenOnBattery:t.pauseWhenOnBattery}})}var Un=Fn(o);re(Un);function Wn(e,t){let n=e.providerInstances[t.instanceId];return n===void 0?Ne(t.instanceId):be(n)}var Gn=[`codex`,`claudeAgent`,`cursor`,`grok`,`muse`,`pi`,`opencode`,`antigravity`].map(e=>f.make(e));function Kn(e,t,n){let r=[...Gn.map(e=>[me(e),e]),...n?.includeConfiguredInstances===!0?Object.entries(e).flatMap(([e,t])=>Gn.includes(t.driver)?[[pe.make(e),t.driver]]:[]):[]].find(([e,n])=>t(e,n));if(r===void 0)return null;let[i,a]=r,o=n?.defaultModelSelection,s=e[i]?.config;return o?.instanceId===i&&te(s?.customModels).some(e=>e.slug===o.model)?o:{instanceId:i,model:Ve[a]??Ue[a]??`gpt-6-luna`}}function qn(e,t,n){let i=e.sourceControlWriterModelSelection;if(!i||!r(e,n,i.instanceId))return e.textGenerationModelSelection;if(t===void 0)return i;let a=t.find(e=>e.instanceId===i.instanceId);return a?.enabled===!0&&Ce(a)&&ae(a)?i:e.textGenerationModelSelection}function Jn(e,t,n){let i=e.reviewGuideModelSelection;if(i&&r(e,n,i.instanceId)){let e=t?.find(e=>e.instanceId===i.instanceId);if(t===void 0||e?.enabled===!0&&Ce(e)&&ae(e))return i}return qn(e,t,n)}function Yn(e,t={}){return{favorites:e.favorites??t.favorites??[],providerModelPreferences:e.providerModelPreferences??t.providerModelPreferences??{}}}function Xn(e,t){let n=e.favorites===null&&(t.favorites?.length??0)>0?t.favorites:void 0,r=e.providerModelPreferences===null&&Object.keys(t.providerModelPreferences??{}).length>0?t.providerModelPreferences:void 0;return n===void 0&&r===void 0?null:{migrateModelPreferences:{...n===void 0?{}:{favorites:n},...r===void 0?{}:{providerModelPreferences:r}}}}var Zn=new Set([`continueThreadsAfterServerUpdate`,`autoResumeLimitedThreads`,`snoozeLimitedThreads`,`newWorktreesStartFromOrigin`,`sourceControlWritingStyle`,`textGenerationModelSelection`]);function Qn(e){let t={},n={};for(let[r,i]of Object.entries(e))Zn.has(r)?t[r]=i:n[r]=i;return{sharedPatch:t,localPatch:n}}function $n(e,t,n,r=n,i=!1){let a=e.textGenerationModelSelection?.instanceId??r?.textGenerationModelSelection.instanceId;return!i&&e.textGenerationModelSelection&&(!n||a!==void 0&&(r?.providerInstances[a]?.driver??a)!==(n.providerInstances[a]?.driver??a)||!Wn(n,{...n.textGenerationModelSelection,...e.textGenerationModelSelection}))&&(e=Ie(e,[`textGenerationModelSelection`])),t?.threadRestartContinuation===!0?e:Ie(e,[`continueThreadsAfterServerUpdate`])}function er(e){return e.connection.phase===`connected`&&e.serverConfig!==null}function tr(e){let t=e.atom(Ae(qe.pipe(le(e=>Me(e.state)))),{initialValue:Ze});return{stateAtom:t,stateValueAtom:g(e=>De(oe(e(t)),()=>Ze)).pipe(h(`relay-environment-discovery-value`)),refresh:Je(e,{label:`relay-environment-discovery:refresh`,concurrency:{mode:`singleFlight`,key:()=>`refresh`},execute:e=>qe.pipe(Te(e=>e.refresh))})}}var nr=tr(nt);function rr(e,t){return{...t,environmentId:e,label:t.entry.target.label,displayUrl:et(t.entry),relayManaged:Ke(t.entry)}}function ir(){let e=(0,E.c)(7),t=v(S.catalogValueAtom),n=v(S.networkStatusValueAtom),r=v(wt.presentationsAtom),i;e[0]===r?i=e[1]:(i=[...r.entries()].map(ar),e[0]=r,e[1]=i);let a=i,o;return e[2]!==t.isReady||e[3]!==a||e[4]!==n||e[5]!==r?(o={isReady:t.isReady,networkStatus:n,environments:a,presentationById:r},e[2]=t.isReady,e[3]=a,e[4]=n,e[5]=r,e[6]=o):o=e[6],o}function ar(e){let[t,n]=e;return rr(t,n)}function or(){return v(rt)}function sr(e){let t=(0,E.c)(3),{presentation:n}=Et(e),r;return t[0]!==e||t[1]!==n?(r=e===null||n===null?null:rr(e,n),t[0]=e,t[1]=n,t[2]=r):r=t[2],r}function cr(){return sr(or())}function lr(e){let t=(0,E.c)(2),n=st(e),r;return t[0]===n?r=t[1]:(r=He(n)?n.value.httpBaseUrl:null,t[0]=n,t[1]=r),r}function ur(){return v(nr.stateValueAtom)}function dr(){return v(D.environmentIdsAtom)}function fr(){return v(D.identitiesAtom)}function pr(){return v(D.pullRequestsSupportedAtom)}function mr(){return v(D.machineByIdAtom)}var hr=`[CLIENT_SETTINGS]`,gr=new Set,_r=new Set,vr=ie,X=`pending`,Z=null,yr=0,br=Promise.resolve(),xr=0;function Sr(){for(let e of gr)e()}function Cr(){for(let e of _r)e()}function Q(){return vr}function wr(e){vr=e,Sr()}function Tr(e){X!==e&&(X=e,Cr())}function Er(e){return gr.add(e),$().catch(()=>void 0),()=>{gr.delete(e)}}function Dr(){return X===`ready`}function Or(){return X}function kr(e){return _r.add(e),$().catch(()=>void 0),()=>{_r.delete(e)}}async function $(){if(X===`ready`)return;if(Z)return Z;let e=yr;Tr(X===`failed`||X===`retrying`?`retrying`:`pending`);let t=(async()=>{try{let t=await tn().persistence.getClientSettings();if(e!==yr)return;t&&wr({...ie,...t}),Tr(`ready`)}catch(t){throw e===yr&&Tr(`failed`),console.error(`${hr} hydrate failed`,{operation:`hydrate`,...y(t)}),t}})().finally(()=>{Z===t&&(Z=null)});return Z=t,Z}var Ar=e=>tn().persistence.setClientSettings(e);function jr(e){let t=br.then(e);return br=t.then(()=>void 0,()=>void 0),t}function Mr(e,t=Ar){let n=X!==`ready`||xr>0;return n?xr+=1:wr({...Q(),...e}),jr(async()=>{if(n)try{X!==`ready`&&await $(),wr({...Q(),...e})}finally{--xr}await t(Q())}).catch(e=>{console.error(`${hr} persist failed`,{operation:`persist`,...y(e)})})}async function Nr(e,t=Ar){return jr(async()=>{for(X!==`ready`&&await $();;){let n=Q(),r=e(n);if(await t(r),Q()===n)return wr(r),r}})}var Pr=new Set(xe(o.fields));function Fr(e){let t={},n={};for(let[r,i]of Object.entries(e))Pr.has(r)?t[r]=i:n[r]=i;return{serverPatch:t,clientPatch:n}}function Ir(){return Q()}function Lr(){return $()}function Rr(){return(0,T.useSyncExternalStore)(kr,Dr,zr)}function zr(){return!1}function Br(){return(0,T.useSyncExternalStore)(kr,Or,Vr)}function Vr(){return`pending`}function Hr(){return(0,T.useSyncExternalStore)(Er,Q,Ur)}function Ur(){return ie}function Wr(e,t){return{...t,...e,...Yn(e,t)}}var Gr=new Set;function Kr(e,t){let n=(0,E.c)(8),r=Hr(),i=Rr(),a;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={reportFailure:!1},n[0]=a):a=n[0];let o=C(x.updateSettings,a),s,c;n[1]!==r||n[2]!==e||n[3]!==i||n[4]!==o||n[5]!==t?(s=()=>{if(!e||!t||!i||Gr.has(e))return;let n=Xn(t,r);n&&(Gr.add(e),o({environmentId:e,input:{patch:n}}).finally(()=>Gr.delete(e)))},c=[r,e,i,o,t],n[1]=r,n[2]=e,n[3]=i,n[4]=o,n[5]=t,n[6]=s,n[7]=c):(s=n[6],c=n[7]),(0,T.useEffect)(s,c)}function qr(e,t){let n=(0,E.c)(6),r=Hr(),i;n[0]!==r||n[1]!==e?(i=Wr(e,r),n[0]=r,n[1]=e,n[2]=i):i=n[2];let a=i,o;return n[3]!==a||n[4]!==t?(o=t?t(a):a,n[3]=a,n[4]=t,n[5]=o):o=n[5],o}function Jr(e){let t=(0,E.c)(3),n=Hr(),r;return t[0]!==e||t[1]!==n?(r=e?e(n):n,t[0]=e,t[1]=n,t[2]=r):r=t[2],r}async function Yr(e,t){return(e.favorites===null||e.providerModelPreferences===null)&&await Lr(),{...Xn(e,Ir()),...t}}function Xr(e){let t=(0,E.c)(6),n;t[0]===e?n=t[1]:(n=e?x.settingsValueAtom(e):Qr,t[0]=e,t[1]=n);let r=v(n),i=C(x.updateSettings,`model preferences update`),a;return t[2]!==e||t[3]!==i||t[4]!==r?(a=async t=>{if(!e||!r)return;let n;try{n=await Yr(r,t)}catch{b.add({type:`error`,title:`Model preferences not saved`,description:`Could not load saved model preferences. Try again.`});return}return i({environmentId:e,input:{patch:n}})},t[2]=e,t[3]=i,t[4]=r,t[5]=a):a=t[5],a}function Zr(e){let t=(0,T.use)(Pe),n=(0,T.useRef)(new Map),r=Xr(e);return(0,T.useCallback)(async(i,a)=>{if(!e)return;let o=x.settingsValueAtom(e),s=t.get(o);if(!s)return;if(s.favorites===null)try{await Lr()}catch{b.add({type:`error`,title:`Favorites not saved`,description:`Could not load saved model preferences. Try again.`});return}let c=t.get(o)??s,l=Yn(c,Ir()).favorites,u=JSON.stringify([e,i,a]),d=n.current.get(u),f={favorite:!(d&&(d.pending||d.settings.favorites===c.favorites)?d.favorite:l.some(e=>e.provider===i&&e.model===a)),settings:c,pending:!0};n.current.set(u,f);try{let e=await r({setModelFavorites:[{provider:i,model:a,favorite:f.favorite}]});e&&we(e)&&t.get(o)?.favorites===c.favorites&&(f.pending=!1)}finally{f.pending&&n.current.get(u)===f&&(d&&!d.pending&&t.get(o)?.favorites===d.settings.favorites?n.current.set(u,d):n.current.delete(u))}},[e,t,r])}var Qr=g(null);function $r(e){let t=(0,E.c)(5),n;t[0]===e?n=t[1]:(n=e?x.settingsValueAtom(e):Qr,t[0]=e,t[1]=n);let r=v(n),i=Hr();Kr(e,r);let a=r??u,o;return t[2]!==i||t[3]!==a?(o=Yn(a,i),t[2]=i,t[3]=a,t[4]=o):o=t[4],o}function ei(e,t){let n=(0,E.c)(2),r;n[0]===e?r=n[1]:(r=x.settingsValueAtom(e),n[0]=e,n[1]=r);let i=v(r);return Kr(e,i),qr(i??u,t)}function ti(e){let t=(0,E.c)(4),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={reportFailure:!1},t[0]=n):n=t[0];let r=C(x.mutateProviderInstance,n),i;return t[1]!==e||t[2]!==r?(i=(t,n)=>r({environmentId:e,input:{patch:n===void 0?{}:n,providerInstanceMutation:t}}),t[1]=e,t[2]=r,t[3]=i):i=t[3],i}function ni(e){let t=cr(),n=v(it);return Kr(t?.environmentId??null,t?.serverConfig?.settings??null),qr(n,e)}var ri=`This setting is saved on a server, and the hosted app is not anchored to one. Change it from the desktop app or from the server's own address.`;function ii(){let e=(0,E.c)(2),t=cr(),n;return e[0]===t?n=e[1]:(n=t!==null||!tt(),e[0]=t,e[1]=n),n}function ai(e){let t=(0,E.c)(3),n=e!==void 0&&e,{environments:r}=ir(),i;return t[0]!==r||t[1]!==n?(i=g(e=>r.filter(er).flatMap(t=>{let r=e(ct.sessionStateAtom(t.environmentId));if(n&&r._tag===`Initial`)return[t.environmentId];let i=r._tag===`Failure`?null:_(oe(r));return i!==null&&Re(i,`settings:write`)?[t.environmentId]:[]})),t[0]=r,t[1]=n,t[2]=i):i=t[2],v(i)}function oi(e){let t=(0,E.c)(10);at(e,Ee);let n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={label:`server settings update`,reportFailure:!1},t[0]=n):n=t[0];let r=C(x.updateSettings,n),{environments:i}=ir(),a;t[1]!==i||t[2]!==r?(a=async e=>{let t=await r(e);if(t._tag===`Failure`&&!Ye(t)){let n=i.find(t=>t.environmentId===e.environmentId)?.label??e.environmentId,r=Qe(t);b.add({type:`error`,title:`Setting not saved`,description:`Could not save on ${n}: ${r instanceof Error?r.message:`The save failed. Try reconnecting and saving again.`}`})}return t},t[1]=i,t[2]=r,t[3]=a):a=t[3];let o=a,s=ai(!0),c;return t[4]!==e||t[5]!==i||t[6]!==r||t[7]!==o||t[8]!==s?(c=t=>{let{serverPatch:n,clientPatch:a}=Fr(t),c=e===null||ge(n).every(t=>ot(e,t));if(Object.keys(n).length>0&&!c&&b.add({type:`warning`,title:`Setting not saved`,description:`This connection lacks permission to change settings on ${i.find(t=>t.environmentId===e)?.label??`the selected environment`}.`}),Object.keys(n).length>0&&c){let{sharedPatch:t,localPatch:a}=Qn(n),c=di;if(Object.keys(a).length>0&&(e?o({environmentId:e,input:{patch:a}}):c()),Object.keys(t).length>0){let n=i.find(t=>t.environmentId===e)?.serverConfig?.settings,a=new Set(s);e&&a.add(e);let o=[],l=[];for(let r of a){let a=i.find(e=>e.environmentId===r),s=$n(t,a?.serverConfig?.environment.capabilities,a?.serverConfig?.settings,n,r===e);Object.keys(s).length!==0&&(fe.get(ct.sessionStateAtom(r))._tag!==`Initial`&&!ge(t).every(e=>ot(r,e))?l.push(a?.label??r):o.push({environmentId:r,input:{patch:s}}))}o.length===0?c(l.length>0?`This connection lacks permission to change settings on ${l.join(`, `)}.`:a.size>0?`Update older servers to save this setting.`:void 0):Promise.all(o.map(async e=>({label:i.find(t=>t.environmentId===e.environmentId)?.label??e.environmentId,result:await r(e)}))).then(si)}}Object.keys(a).length>0&&Mr(a)},t[4]=e,t[5]=i,t[6]=r,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function si(e){let t=e.flatMap(ui);if(t.length===0)return;let n=e.filter(li).map(ci);b.add({type:`error`,title:n.length>0?`Setting saved on some environments`:`Setting not saved`,description:[...t,...n.length>0?[`Saved on ${n.join(`, `)}.`]:[]].join(`
2
- `)})}function ci(e){let{label:t}=e;return t}function li(e){let{result:t}=e;return t._tag===`Success`}function ui(e){let{label:t,result:n}=e;if(n._tag!==`Failure`||Ye(n))return[];let r=Qe(n);return[`Could not save on ${t}: ${r instanceof Error?r.message:`The save failed. Try reconnecting and saving again.`}`]}function di(e){let t=e===void 0?ri:e;return b.add({type:`warning`,title:`Setting not saved`,description:t})}function fi(e){return oi(e)}function pi(){return oi(cr()?.environmentId??null)}function mi(){return hi}function hi(e){return Mr(e)}export{Mt as $,ur as A,Fn as B,fr as C,cr as D,ir as E,Ln as F,Sn as G,rn as H,J as I,en as J,jn as K,Bn as L,Kn as M,Jn as N,or as O,qn as P,At as Q,Hn as R,lr as S,mr as T,an as U,G as V,_n as W,It as X,Wt as Y,Pt as Z,mi as _,Mr as a,Et as at,pi as b,Rr as c,ei as d,Nt as et,Kr as f,Zr as g,ii as h,Wr as i,D as it,nr as j,pr as k,Br as l,ni as m,Lr as n,jt as nt,Nr as o,ti as p,tn as q,Ir as r,wt as rt,Jr as s,ri as t,Ft as tt,$r as u,Xr as v,dr as w,sr as x,fi as y,Vn as z};
3
- //# sourceMappingURL=useSettings-Cg0O7Ek7.js.map