@p4code/cli 0.8.7 → 0.8.8

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 (340) hide show
  1. package/dist/AcpMcpStdioBridge-BFonJkL3.mjs +4 -0
  2. package/dist/{AcpMcpStdioBridge-DHwGLtep.mjs → AcpMcpStdioBridge-WH45ZIFK.mjs} +78 -11
  3. package/dist/{Effect-BahT0mOQ.mjs → Effect-B-zvTJgX.mjs} +2 -2
  4. package/dist/bin.mjs +2 -2
  5. package/dist/{binCli-D_84b0CF.mjs → binCli-CnPGSVWN.mjs} +114408 -113097
  6. package/dist/claude-history-worker.mjs +1 -1
  7. package/dist/{claudeHistoryWorker-v_0uyLGp.mjs → claudeHistoryWorker-C1bTkcUr.mjs} +2 -2
  8. package/dist/client/.vite/manifest.json +2067 -2066
  9. package/dist/client/assets/{AnimatedHeight-DewGDSmN.js → AnimatedHeight-CeIqOXkD.js} +2 -2
  10. package/dist/client/assets/{AuthSurfaceShell-D29U36jB.js → AuthSurfaceShell-CeFbPegZ.js} +2 -2
  11. package/dist/client/assets/{CSPContext-CB4Jj3Uk.js → CSPContext-BLmE8rVK.js} +2 -2
  12. package/dist/client/assets/ChatGptUsageButton-gEF4N7W7.js +2 -0
  13. package/dist/client/assets/ChatMarkdown-DQ3uXQzt.js +65 -0
  14. package/dist/client/assets/{CodexSetupSection.logic-DQMTTenV.js → CodexSetupSection.logic-DobP-gmw.js} +2 -2
  15. package/dist/client/assets/ComboboxClear-fNH6Tj-4.js +2 -0
  16. package/dist/client/assets/{CommandBlock-VzUG411k.js → CommandBlock-X-DC1M4o.js} +2 -2
  17. package/dist/client/assets/{ComposerPromptEditor-lIFv0Iko.js → ComposerPromptEditor-DiF8eMQV.js} +56 -56
  18. package/dist/client/assets/CompositeRoot-Bu_9wjlN.js +2 -0
  19. package/dist/client/assets/{ConnectionStatusDot-B0ZKI-zI.js → ConnectionStatusDot-0G2DkC_D.js} +2 -2
  20. package/dist/client/assets/DevicePanel-BkS5Q-Y2.js +2 -0
  21. package/dist/client/assets/{DeviceSetup-Bg5OpWbo.js → DeviceSetup-C0iRuaPp.js} +2 -2
  22. package/dist/client/assets/{DialogTitle-BVkBTuS9.js → DialogTitle-B7ZsIcBO.js} +2 -2
  23. package/dist/client/assets/{DiffCommentAnnotation-BsI9yTe1.js → DiffCommentAnnotation-UyWIyKIO.js} +2 -2
  24. package/dist/client/assets/{DiffFileTree-Bg8GHn2r.js → DiffFileTree-LZwmN24l.js} +2 -2
  25. package/dist/client/assets/DiffPanel-DfD6emFU.js +2 -0
  26. package/dist/client/assets/{DiffWorkerPoolProvider-B9BXoLYM.js → DiffWorkerPoolProvider-BCslhrpA.js} +3 -3
  27. package/dist/client/assets/{EnvironmentMachineIcon-DX1wHHgS.js → EnvironmentMachineIcon-Bn0qgNMW.js} +2 -2
  28. package/dist/client/assets/{ExpandableText-DfTvwfDp.js → ExpandableText-DPFtEjPq.js} +2 -2
  29. package/dist/client/assets/{FieldControl-CrNWnPN_.js → FieldControl-Dcug7PQN.js} +2 -2
  30. package/dist/client/assets/{FileDiff-Ds-DSHzC.js → FileDiff-CztExdxl.js} +2 -2
  31. package/dist/client/assets/{FilePreviewPanel-CyR5pXUr.js → FilePreviewPanel-C_Q3mPlo.js} +4 -4
  32. package/dist/client/assets/{FoldedSettingsSection-DQesC0Ch.js → FoldedSettingsSection-MrezZXWL.js} +2 -2
  33. package/dist/client/assets/{FormContext-CUf-dYwe.js → FormContext-N50VWQHc.js} +2 -2
  34. package/dist/client/assets/{Icons-DMu3kCVA.js → Icons-CBnVp61L.js} +2 -2
  35. package/dist/client/assets/{KeybindingsSettings.logic-BB1oFV_W.js → KeybindingsSettings.logic-CCa_n5Wn.js} +2 -2
  36. package/dist/client/assets/{NoProjectsHero-D0SwrjYG.js → NoProjectsHero-sRJlYzCx.js} +2 -2
  37. package/dist/client/assets/PanelLayoutControls-bgJzxuTg.js +216 -0
  38. package/dist/client/assets/{PierreEntryIcon-BUl5qtCE.js → PierreEntryIcon-Bid6ECoT.js} +2 -2
  39. package/dist/client/assets/PreviewPanel-CQlsmVXf.js +2 -0
  40. package/dist/client/assets/ProjectDefaultsSettings-BaW9gkj0.js +2 -0
  41. package/dist/client/assets/ProjectFavicon-oQ8xOLai.js +3 -0
  42. package/dist/client/assets/{ProjectIconPickerDialog-C-KFxEg0.js → ProjectIconPickerDialog-D1QKDGMX.js} +2 -2
  43. package/dist/client/assets/{ProjectMonogram-B2dsNF6-.js → ProjectMonogram-wj_aiPmM.js} +2 -2
  44. package/dist/client/assets/{ProviderAuthTerminal-Cwr8Z1Ly.js → ProviderAuthTerminal-BXJZPbVk.js} +2 -2
  45. package/dist/client/assets/ProviderModelPicker-CQQUHTh0.js +2 -0
  46. package/dist/client/assets/{ProviderSettingsForm-DpmAB_Jq.js → ProviderSettingsForm-CX9Fb8_8.js} +2 -2
  47. package/dist/client/assets/PullRequestCodeTab-DLqbGyR7.js +6 -0
  48. package/dist/client/assets/{ReadOnlySourcePreview-C5y6ELAP.js → ReadOnlySourcePreview-B7C0GGAq.js} +2 -2
  49. package/dist/client/assets/{RenderErrorBoundary-CyH8UwmD.js → RenderErrorBoundary-DfL11xnF.js} +2 -2
  50. package/dist/client/assets/ScheduledTasksSettings-Di6Z2urM.js +4 -0
  51. package/dist/client/assets/{ScopedSwitch-pdvWIJp5.js → ScopedSwitch-DYM42LM4.js} +2 -2
  52. package/dist/client/assets/{SecretInput-C11F3Wuh.js → SecretInput-CpQgS_zs.js} +2 -2
  53. package/dist/client/assets/SettingsPanels-D-wcH1Qk.js +39 -0
  54. package/dist/client/assets/{SettingsPanels.logic-zUA6f3HT.js → SettingsPanels.logic-BQHrLt25.js} +2 -2
  55. package/dist/client/assets/{SettingsScopeNotice-N6bcXfto.js → SettingsScopeNotice-BbuY3OvE.js} +2 -2
  56. package/dist/client/assets/{T3ConnectAccountPages-uVnu-v4W.js → T3ConnectAccountPages-Bb49yKNe.js} +2 -2
  57. package/dist/client/assets/{T3ConnectSidebarSignIn-CZCWzt6C.js → T3ConnectSidebarSignIn-CjmtmsbE.js} +2 -2
  58. package/dist/client/assets/{ThemeEditorPanel-CjUB7HmU.js → ThemeEditorPanel-CeucoKK-.js} +3 -3
  59. package/dist/client/assets/{ThreadTerminalDrawer-CAh-h3eK.js → ThreadTerminalDrawer-Di41e66k.js} +4 -4
  60. package/dist/client/assets/{Virtualizer-CB4f0UTD.js → Virtualizer-YMJF6Rgn.js} +2 -2
  61. package/dist/client/assets/{WorkspaceBreadcrumb-3VgFkWcC.js → WorkspaceBreadcrumb-B4olYudc.js} +2 -2
  62. package/dist/client/assets/{WorkspacePageContainer-8jksqZGW.js → WorkspacePageContainer-D_NDP2pC.js} +2 -2
  63. package/dist/client/assets/{WorkspacePageHeader-IRvZnA0X.js → WorkspacePageHeader-CF_fkCJo.js} +2 -2
  64. package/dist/client/assets/_chat-BvSmDiLw.js +45 -0
  65. package/dist/client/assets/{_chat.index-DnYerwxz.js → _chat.index-B86aUAxh.js} +2 -2
  66. package/dist/client/assets/{_chat.new-XtBIcyRw.js → _chat.new-COnJvlNC.js} +3 -3
  67. package/dist/client/assets/_chat.pull-requests-CMa0EuoS.js +2 -0
  68. package/dist/client/assets/{abnfDiagram-VCTEODGH-DUPWAarL.js → abnfDiagram-VCTEODGH-GKlp-wAF.js} +2 -2
  69. package/dist/client/assets/{alert-DzxRsWWi.js → alert-BOSKZyDW.js} +2 -2
  70. package/dist/client/assets/architecture-7GRP2DOG-BTjma_hq.js +1 -0
  71. package/dist/client/assets/{architectureDiagram-5GKGNRK7-ipdl5Chl.js → architectureDiagram-5GKGNRK7-BbKUUHgQ.js} +2 -2
  72. package/dist/client/assets/assets-arnK8cZJ.js +2 -0
  73. package/dist/client/assets/{blockDiagram-I7D4REHJ-CCqcBoEP.js → blockDiagram-I7D4REHJ-BvV9OXgS.js} +2 -2
  74. package/dist/client/assets/{browserHistoryStore-TLJ0k3I1.js → browserHistoryStore-D3NmgwWz.js} +2 -2
  75. package/dist/client/assets/{browserLinkTarget-Du_qPFvd.js → browserLinkTarget-CTDv30-a.js} +2 -2
  76. package/dist/client/assets/{c4Diagram-7LVT6UL2-D0uMteR1.js → c4Diagram-7LVT6UL2-BT2fKwga.js} +2 -2
  77. package/dist/client/assets/channel-BbVwyPme.js +2 -0
  78. package/dist/client/assets/checkbox-B0Q9zWdp.js +2 -0
  79. package/dist/client/assets/{chunk-4HAMMTFA-B3SWgtem.js → chunk-4HAMMTFA-BPIUCP2N.js} +2 -2
  80. package/dist/client/assets/{chunk-75Z2AOVW-CXAakYxI.js → chunk-75Z2AOVW-BY1XFSYe.js} +2 -2
  81. package/dist/client/assets/{chunk-DU6HZSFF-B4qcstD9.js → chunk-DU6HZSFF-BhfbeXEz.js} +2 -2
  82. package/dist/client/assets/{chunk-F27PBJKO-DimzPDjs.js → chunk-F27PBJKO-CkPC4b2I.js} +2 -2
  83. package/dist/client/assets/{chunk-GMAD6QVW-BHA-Os4E.js → chunk-GMAD6QVW-D9bW2adv.js} +2 -2
  84. package/dist/client/assets/{chunk-GVQU2GXP-P9nMI_GJ.js → chunk-GVQU2GXP-C-gRpKGj.js} +2 -2
  85. package/dist/client/assets/{chunk-IMKFNOWR-RgWCceFN.js → chunk-IMKFNOWR-CGR_s6mQ.js} +2 -2
  86. package/dist/client/assets/{chunk-L3NEJ4N5-9p7zIkHC.js → chunk-L3NEJ4N5-BPN8qLtR.js} +2 -2
  87. package/dist/client/assets/{chunk-OSK3NFVY-C9IokqLY.js → chunk-OSK3NFVY-C83gEYhi.js} +2 -2
  88. package/dist/client/assets/{chunk-P2QGCYS3-Dwk8ORW_.js → chunk-P2QGCYS3-DoadH0FQ.js} +2 -2
  89. package/dist/client/assets/{chunk-POPQ4Y6H-BwYKYQwt.js → chunk-POPQ4Y6H-OENQdCtW.js} +2 -2
  90. package/dist/client/assets/{chunk-PWAF6VOD-BMw0rklB.js → chunk-PWAF6VOD-Bm9xwnBb.js} +2 -2
  91. package/dist/client/assets/{chunk-SHT3W25Y-D3ovSAoa.js → chunk-SHT3W25Y-CZdeFTa3.js} +2 -2
  92. package/dist/client/assets/{chunk-SVP7TREG-CpaRTznV.js → chunk-SVP7TREG-CWjZG-1G.js} +2 -2
  93. package/dist/client/assets/{chunk-TICWLB2K-CAtIccZJ.js → chunk-TICWLB2K-C6_3qr0T.js} +2 -2
  94. package/dist/client/assets/classDiagram-ZZMXUADV-BZN2DxkM.js +2 -0
  95. package/dist/client/assets/classDiagram-v2-VYDZK3BY-BZN2DxkM.js +2 -0
  96. package/dist/client/assets/{color-picker-DYoHU1P8.js → color-picker-B_vY4rCj.js} +2 -2
  97. package/dist/client/assets/{combobox-Ddag8Jom.js → combobox-CZ_uig0z.js} +2 -2
  98. package/dist/client/assets/{command-B35zAYVN.js → command-DGoFksB6.js} +2 -2
  99. package/dist/client/assets/{connect-XgeleCz9.js → connect-CuZjH_Pw.js} +2 -2
  100. package/dist/client/assets/{connect-agent-BRIcxQbo.js → connect-agent-BhcB_UCW.js} +2 -2
  101. package/dist/client/assets/{cynefin-OW5HDTMX-Br0UWz2p.js → cynefin-OW5HDTMX-BBaHuZtP.js} +1 -1
  102. package/dist/client/assets/{cynefinDiagram-5FMLGOSQ-Bz8AWXlE.js → cynefinDiagram-5FMLGOSQ-D0TOipYC.js} +2 -2
  103. package/dist/client/assets/{dagre-GXQ25YYZ-Kk1kLU-A.js → dagre-GXQ25YYZ-BqIStTWM.js} +2 -2
  104. package/dist/client/assets/{device-CJH4ixRH.js → device-Dy_6ukvt.js} +2 -2
  105. package/dist/client/assets/{diagram-S7CK7UJ4-Dogw5edZ.js → diagram-S7CK7UJ4-DtlY2HLu.js} +2 -2
  106. package/dist/client/assets/{diagram-UQ7AKVKN-kg5DSfbZ.js → diagram-UQ7AKVKN-AFvyPgaY.js} +2 -2
  107. package/dist/client/assets/{diagram-VSXAHHWV-DXdyRkdD.js → diagram-VSXAHHWV-BX0DQrOR.js} +2 -2
  108. package/dist/client/assets/{diagram-VX7I27RA-CNO5Z04I.js → diagram-VX7I27RA-RpuCJkmb.js} +2 -2
  109. package/dist/client/assets/{diagram-Z3DM3KII-7Pw0HXMg.js → diagram-Z3DM3KII-YDywc4a-.js} +2 -2
  110. package/dist/client/assets/{dialog-C9_Ef3sx.js → dialog-COvCzBu5.js} +2 -2
  111. package/dist/client/assets/{diffRendering-CAxImuLd.js → diffRendering-EBC4wPDV.js} +2 -2
  112. package/dist/client/assets/{discovery-list-DXE1P9pq.js → discovery-list-B1TD-soO.js} +2 -2
  113. package/dist/client/assets/{dist-DOyHkZUI.js → dist-Cg-eOU-v.js} +3 -3
  114. package/dist/client/assets/{draft-input-6dynCiw_.js → draft-input-DHW6QTyZ.js} +2 -2
  115. package/dist/client/assets/{duoViewer-BFeSS1Av.js → duoViewer-B9J_QozU.js} +2 -2
  116. package/dist/client/assets/{dynamic-BxCDxZLw.js → dynamic-CUevKA9_.js} +2 -2
  117. package/dist/client/assets/{ebnfDiagram-PWID7BFC-DD9UVmrJ.js → ebnfDiagram-PWID7BFC-CAfVAMWI.js} +2 -2
  118. package/dist/client/assets/{embeddedScripts-CIC2AYGL.js → embeddedScripts-Cvalo74G.js} +2 -2
  119. package/dist/client/assets/empty-Dmvz5ya5.js +2 -0
  120. package/dist/client/assets/entities-DPdxOTpx.js +2 -0
  121. package/dist/client/assets/{erDiagram-RLTQ6QDP-BJ--ph2e.js → erDiagram-RLTQ6QDP-B8I9HNiQ.js} +2 -2
  122. package/dist/client/assets/eventmodeling-NTZA5JFV-Cg0CFdkZ.js +1 -0
  123. package/dist/client/assets/{fileLinks-BZV-xG7Q.js → fileLinks-Cfgs6wOJ.js} +2 -2
  124. package/dist/client/assets/{fileTreeExpansion-SSkII8h0.js → fileTreeExpansion-BbO9lBJr.js} +2 -2
  125. package/dist/client/assets/flowDiagram-HODETNUW-RF9W51fq.js +1 -0
  126. package/dist/client/assets/{ganttDiagram-EL5Y4UJY-CAMkT1YN.js → ganttDiagram-EL5Y4UJY-G4XFicxk.js} +2 -2
  127. package/dist/client/assets/{getDiffFileInput-BbRHVLd8.js → getDiffFileInput-BhtRP4yl.js} +2 -2
  128. package/dist/client/assets/{gitGraph-4MIJSDKK-DsGem99u.js → gitGraph-4MIJSDKK-Dz9vbKwX.js} +1 -1
  129. package/dist/client/assets/{gitGraphDiagram-WWUBYQGX-BkbTIyDI.js → gitGraphDiagram-WWUBYQGX-BRPk5Iff.js} +2 -2
  130. package/dist/client/assets/{guideRunStore-CRgghh5M.js → guideRunStore-OyuNEz1_.js} +2 -2
  131. package/dist/client/assets/{htmlRender-DhaCAG_8.js → htmlRender-94mfYlmv.js} +2 -2
  132. package/dist/client/assets/{index-CyuShNwE.js → index-BGHZIIwm.js} +3 -3
  133. package/dist/client/assets/{info-A6RAGUB7-BBQkQpY8.js → info-A6RAGUB7-C2HElvlZ.js} +1 -1
  134. package/dist/client/assets/{infoDiagram-27XIBGKW-B-aRfZJ5.js → infoDiagram-27XIBGKW-IOOCD2gD.js} +2 -2
  135. package/dist/client/assets/{input-BZEAWLAC.js → input-OK9fSGsW.js} +2 -2
  136. package/dist/client/assets/{input-group-DQ0hiSJt.js → input-group-DLt_QDs-.js} +2 -2
  137. package/dist/client/assets/{ishikawaDiagram-5VMMS53U-BuQT0JFA.js → ishikawaDiagram-5VMMS53U-DVm2wQsr.js} +2 -2
  138. package/dist/client/assets/{journeyDiagram-3NMN7TZE-DvMkIp6_.js → journeyDiagram-3NMN7TZE-KFjVMjGh.js} +2 -2
  139. package/dist/client/assets/{kanban-definition-UXKFOSKX-BH-BleQp.js → kanban-definition-UXKFOSKX-DxT40hgP.js} +2 -2
  140. package/dist/client/assets/{kbd-B5U1dWuw.js → kbd-LyGbiGLS.js} +2 -2
  141. package/dist/client/assets/{keybindings-BOV97yVS.js → keybindings-BWCWrY_-.js} +2 -2
  142. package/dist/client/assets/{lazyRouteComponent-Cz9CWj20.js → lazyRouteComponent-Doka-Cpt.js} +2 -2
  143. package/dist/client/assets/{line-ldmXyAfR.js → line-BUx_Qlcs.js} +2 -2
  144. package/dist/client/assets/{link-GWWfOiYJ.js → link-DaswZEsz.js} +2 -2
  145. package/dist/client/assets/{linkedPrompt-CUOURNo0.js → linkedPrompt-3u_uoe6Y.js} +2 -2
  146. package/dist/client/assets/main-BEavB8iB.css +2 -0
  147. package/dist/client/assets/main-DB45P6Gd.js +30 -0
  148. package/dist/client/assets/{mediaReference-CHMrPLS_.js → mediaReference-T3SNj1En.js} +2 -2
  149. package/dist/client/assets/{mediaSource-C2DVrhoI.js → mediaSource-DAJ35Twr.js} +2 -2
  150. package/dist/client/assets/{mermaid-parser.core-CLu3jfMo.js → mermaid-parser.core-CuUxy4fc.js} +4 -4
  151. package/dist/client/assets/{mermaid.core-CcbjUEO9.js → mermaid.core-CV-2Hipl.js} +5 -5
  152. package/dist/client/assets/{mindmap-definition-YA3MSWOX-BgA-mHTZ.js → mindmap-definition-YA3MSWOX-B5gC6PY9.js} +2 -2
  153. package/dist/client/assets/number-field-CHOp4dMK.js +2 -0
  154. package/dist/client/assets/{observeResize-DRhwSBbU.js → observeResize-B7tl_Rye.js} +2 -2
  155. package/dist/client/assets/{onboarding-JdAo8zsA.js → onboarding-CFB4Wz5g.js} +2 -2
  156. package/dist/client/assets/{openFileInPreview-fPqhkMo9.js → openFileInPreview-D80asiJZ.js} +2 -2
  157. package/dist/client/assets/{p4ProjectFile-CvON4UbU.js → p4ProjectFile-BfBM2HoW.js} +2 -2
  158. package/dist/client/assets/{packet-AYTQ26CC-DApn8qRX.js → packet-AYTQ26CC-CJ0qzIIY.js} +1 -1
  159. package/dist/client/assets/{pair-BZFzlFlB.js → pair-CQbNFhjc.js} +2 -2
  160. package/dist/client/assets/{pegDiagram-XKGWAZYB-CXEiF-e_.js → pegDiagram-XKGWAZYB-BzvO80-H.js} +2 -2
  161. package/dist/client/assets/{phoneViewer-B2PYzUOK.js → phoneViewer-BghY79hZ.js} +2 -2
  162. package/dist/client/assets/{pie-WAS4IAKB-CYqWZV05.js → pie-WAS4IAKB-M62byk0f.js} +1 -1
  163. package/dist/client/assets/{pieDiagram-E7YTZNPT-DI-IJXNl.js → pieDiagram-E7YTZNPT-O5p8eSgL.js} +2 -2
  164. package/dist/client/assets/{pierre-icons-bBNX7pHG.js → pierre-icons-BweC0Ojp.js} +2 -2
  165. package/dist/client/assets/popover-DzOky6C0.js +2 -0
  166. package/dist/client/assets/{preview-CBNZZm4k.js → preview-CP02VJQW.js} +2 -2
  167. package/dist/client/assets/{preview-BVbvXV-T.js → preview-DLjmZv-h.js} +2 -2
  168. package/dist/client/assets/{previewMiniPlayerStore-C_DZeWb5.js → previewMiniPlayerStore-DnzLYNg5.js} +2 -2
  169. package/dist/client/assets/primary-z0kWcTid.js +2 -0
  170. package/dist/client/assets/primaryCloudLinkState-Bup2zk6b.js +2 -0
  171. package/dist/client/assets/projectFilesQueryState-BKJPj8kq.js +2 -0
  172. package/dist/client/assets/projectScriptEditor-C10v2IgV.js +2 -0
  173. package/dist/client/assets/{providerSkills-JMYzRM2N.js → providerSkills-DPGvsbQq.js} +2 -2
  174. package/dist/client/assets/{pullRequestDetail.logic-BVBxawC1.js → pullRequestDetail.logic-CQ1l2jWB.js} +5 -5
  175. package/dist/client/assets/{pullRequestIcons-CuqlEFYV.js → pullRequestIcons-Cwz6tomi.js} +2 -2
  176. package/dist/client/assets/{pullRequestReviewStore-DmxuV1dp.js → pullRequestReviewStore-DejvzSy2.js} +2 -2
  177. package/dist/client/assets/pullRequests-DmlU8TRv.js +2 -0
  178. package/dist/client/assets/{quadrantDiagram-AXDQQJYC-Os8jPhhw.js → quadrantDiagram-AXDQQJYC-DMpTBqB0.js} +2 -2
  179. package/dist/client/assets/queries-DUuhuhAL.js +2 -0
  180. package/dist/client/assets/query-BWYUB_iK.js +2 -0
  181. package/dist/client/assets/{radar-RG4KPBEZ-BwFp-k4W.js → radar-RG4KPBEZ-CRHj_0uz.js} +1 -1
  182. package/dist/client/assets/radio-group-8ftKbjDf.js +2 -0
  183. package/dist/client/assets/{railroad-74A4TZTK-BhaeCUUR.js → railroad-74A4TZTK-LCbjmT_s.js} +1 -1
  184. package/dist/client/assets/railroad-abnf-HS5TGJTU-DJLpez1j.js +1 -0
  185. package/dist/client/assets/railroad-ebnf-LZEXJU2U-FSaf-eSC.js +1 -0
  186. package/dist/client/assets/railroad-peg-WCYAUIDC-pIcyAgnc.js +1 -0
  187. package/dist/client/assets/{railroadDiagram-O6MQD6OU-BwEd4kBJ.js → railroadDiagram-O6MQD6OU-B1mHyPCC.js} +2 -2
  188. package/dist/client/assets/{renderScheduler-C031Kal5.js → renderScheduler-D3-fIVU2.js} +2 -2
  189. package/dist/client/assets/{requirementDiagram-BXWQKSXE-B3cJlOEK.js → requirementDiagram-BXWQKSXE-BH8vaSWt.js} +2 -2
  190. package/dist/client/assets/{rightPanelStore-JWjHC9l1.js → rightPanelStore-Dfw-4Ia_.js} +2 -2
  191. package/dist/client/assets/runtime-VHJoq9so.js +6 -0
  192. package/dist/client/assets/runtime-ivCTGH5C.js +2 -0
  193. package/dist/client/assets/runtimeModeConfig-JkwDqP4L.js +2 -0
  194. package/dist/client/assets/{sankeyDiagram-P5KCCOFB-C8CBmy9t.js → sankeyDiagram-P5KCCOFB-DqqzdGsV.js} +2 -2
  195. package/dist/client/assets/{scheduledTasksSettings.logic-CJBRz5bk.js → scheduledTasksSettings.logic-b-y7WIWN.js} +3 -3
  196. package/dist/client/assets/{scroll-area-D4H8QGpd.js → scroll-area-BtAqRLpC.js} +2 -2
  197. package/dist/client/assets/select-FY7psXk-.js +2 -0
  198. package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-IbrowOt4.js → sequenceDiagram-WJ2MYXX4-D6EXXu_o.js} +2 -2
  199. package/dist/client/assets/server-C-qtaHHG.js +2 -0
  200. package/dist/client/assets/session-KZUTmmZy.js +2 -0
  201. package/dist/client/assets/{session-logic-CiMoVF-V.js → session-logic-Dy9r5m2F.js} +5 -5
  202. package/dist/client/assets/{settings-mAdVdtYz.js → settings-xVK7Yt1y.js} +2 -2
  203. package/dist/client/assets/settings.appearance-BUsQj9AN.js +2 -0
  204. package/dist/client/assets/settings.archived-B-IVcn1Z.js +2 -0
  205. package/dist/client/assets/{settings.computer-use-IGLZXOs8.js → settings.computer-use-CvtFf-rW.js} +2 -2
  206. package/dist/client/assets/settings.connections-C90xtGng.js +2 -0
  207. package/dist/client/assets/{settings.data-controls-FiLy_ddv.js → settings.data-controls-DemQiCxT.js} +2 -2
  208. package/dist/client/assets/{settings.decisions-DZO8QWHd.js → settings.decisions-DtOP9oNq.js} +2 -2
  209. package/dist/client/assets/settings.diagnostics-DXaoukRP.js +2 -0
  210. package/dist/client/assets/settings.general-DkWee1YY.js +2 -0
  211. package/dist/client/assets/settings.integrations-BXlqBhz3.js +2 -0
  212. package/dist/client/assets/{settings.keybindings-BYwCM_iI.js → settings.keybindings-Br0uBlw0.js} +2 -2
  213. package/dist/client/assets/{settings.open-source-licenses-CZcWXiGu.js → settings.open-source-licenses-C7LrTwqH.js} +2 -2
  214. package/dist/client/assets/{settings.plugins-P_B4taFp.js → settings.plugins-BWko147F.js} +4 -4
  215. package/dist/client/assets/settings.projects-Hlmn9qBx.js +4 -0
  216. package/dist/client/assets/settings.providers-CUBhfBx1.js +3 -0
  217. package/dist/client/assets/settings.scheduled-tasks-CDDYe3d2.js +2 -0
  218. package/dist/client/assets/{settings.snap-shot-uj9CX5J6.js → settings.snap-shot-BlVwefsY.js} +2 -2
  219. package/dist/client/assets/{settings.source-control-H60mYM0m.js → settings.source-control-b4BRd-7w.js} +2 -2
  220. package/dist/client/assets/{settings.storage--Ghi4ySm.js → settings.storage-DHuqQ3GN.js} +2 -2
  221. package/dist/client/assets/settingsLayout-CthFz77S.js +3 -0
  222. package/dist/client/assets/{sidebar-7a8hvtAS.js → sidebar-BvjZQtR9.js} +2 -2
  223. package/dist/client/assets/{sidebarProjectGrouping-BGgp_M_h.js → sidebarProjectGrouping-CvY13nmg.js} +2 -2
  224. package/dist/client/assets/skeleton-p05dxp84.js +2 -0
  225. package/dist/client/assets/{sortable.esm-CG0AZByT.js → sortable.esm-BVaB8fBB.js} +2 -2
  226. package/dist/client/assets/{sourceControl-B8VqenU-.js → sourceControl-CtDr1raw.js} +2 -2
  227. package/dist/client/assets/{spinner-YUJ6Pwvq.js → spinner-CTNKP1wB.js} +2 -2
  228. package/dist/client/assets/{standalone-page-BxErOfZy.js → standalone-page-BmCMlz1u.js} +2 -2
  229. package/dist/client/assets/{stateDiagram-D77RDMKH-C0i1_7JQ.js → stateDiagram-D77RDMKH-CVk9L7UB.js} +2 -2
  230. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-DNtAQSJX.js +2 -0
  231. package/dist/client/assets/{swimlanes-42K2YHIH-DlWorw-a.js → swimlanes-42K2YHIH-eDs6vlYW.js} +2 -2
  232. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-CEvm2POs.js +9 -0
  233. package/dist/client/assets/{terminal-links-DnuUiEnP.js → terminal-links-MjQ9lNGX.js} +2 -2
  234. package/dist/client/assets/{terminalSessions-B89lkZlG.js → terminalSessions-BEOZlx0H.js} +2 -2
  235. package/dist/client/assets/{textarea-Br1ny3dw.js → textarea-_oDVfjxe.js} +2 -2
  236. package/dist/client/assets/{themePalette-B4vIs8Bi.js → themePalette-DtFR3xYu.js} +3 -3
  237. package/dist/client/assets/threadSort-BgwLDPpx.js +2 -0
  238. package/dist/client/assets/{timeline-definition-24CTP7MA-f1puoyJY.js → timeline-definition-24CTP7MA-nEI4h-Tk.js} +2 -2
  239. package/dist/client/assets/toast-CyScduZI.js +2 -0
  240. package/dist/client/assets/{toggle-DNxTFG4o.js → toggle-BBpi92mE.js} +2 -2
  241. package/dist/client/assets/{toggle-group-CQtXH1ph.js → toggle-group--QyJ7uYY.js} +2 -2
  242. package/dist/client/assets/tooltip-DcTdC2PH.js +2 -0
  243. package/dist/client/assets/{treeView-Q6P3EWNA-cachkR0K.js → treeView-Q6P3EWNA-BqkVgtYX.js} +1 -1
  244. package/dist/client/assets/{treemap-WGGIJYW6-5vI1Z8yq.js → treemap-WGGIJYW6-DT4jZxe1.js} +1 -1
  245. package/dist/client/assets/usage-BoakMkho.js +2 -0
  246. package/dist/client/assets/{usageAccess-BRuBlcgN.js → usageAccess-Tjotp_ad.js} +2 -2
  247. package/dist/client/assets/{usageFormat-B0V5dWS3.js → usageFormat-C1GJS5IW.js} +2 -2
  248. package/dist/client/assets/{usageShortcuts-CK0JjnNA.js → usageShortcuts-BmYIhNjb.js} +2 -2
  249. package/dist/client/assets/{use-atom-command-JNR1Jqwn.js → use-atom-command-CYY238HA.js} +2 -2
  250. package/dist/client/assets/{useAriaLabelledBy-BNA1QLXP.js → useAriaLabelledBy-_J6EHbv7.js} +2 -2
  251. package/dist/client/assets/{useHandleNewThread-vYbjmg4i.js → useHandleNewThread-BhaVM65m.js} +2 -2
  252. package/dist/client/assets/{useLocation-D91_HRP0.js → useLocation-Cfwex-wi.js} +2 -2
  253. package/dist/client/assets/useNavigate-B3U2CN2A.js +2 -0
  254. package/dist/client/assets/{useNavigateBack-DnwpvjrN.js → useNavigateBack-B0NrYlh8.js} +2 -2
  255. package/dist/client/assets/{useParams-CYkWvywV.js → useParams-U7vgc6nk.js} +2 -2
  256. package/dist/client/assets/{usePermissionStatus-CuzpUXth.js → usePermissionStatus-Urd4cbKv.js} +2 -2
  257. package/dist/client/assets/usePullRequestActions-DpAVW9io.js +3 -0
  258. package/dist/client/assets/{useRegisterFieldControl-C127nghN.js → useRegisterFieldControl-B-o6bvd-.js} +2 -2
  259. package/dist/client/assets/{useScopedModelAvailability-BsIJUZbS.js → useScopedModelAvailability-CIh6LpSK.js} +2 -2
  260. package/dist/client/assets/useSettings-gJURpIkJ.js +3 -0
  261. package/dist/client/assets/{useT3ConnectAuthPrompt-DlW3HUgA.js → useT3ConnectAuthPrompt-Np9NC6fS.js} +2 -2
  262. package/dist/client/assets/utils-BBRDx4UJ.js +37 -0
  263. package/dist/client/assets/vcsRefInvalidation-DwljOjdx.js +2 -0
  264. package/dist/client/assets/{vennDiagram-4TSXK5OY-HkY_FANS.js → vennDiagram-4TSXK5OY-kVbUFMzz.js} +2 -2
  265. package/dist/client/assets/{wardley-WFR3VGLG-B9HKXiPi.js → wardley-WFR3VGLG-B5JrY4hA.js} +1 -1
  266. package/dist/client/assets/{wardleyDiagram-VM6X3IG4-CJL7EyS8.js → wardleyDiagram-VM6X3IG4-kNz0Ytm1.js} +2 -2
  267. package/dist/client/assets/{welcome-BOXDf4R_.js → welcome-vYaNWLrj.js} +2 -2
  268. package/dist/client/assets/{xychartDiagram-S5SC5T6Z-Bsll1-pV.js → xychartDiagram-S5SC5T6Z-DGSU7PNa.js} +2 -2
  269. package/dist/client/index.html +1 -1
  270. package/package.json +1 -1
  271. package/dist/AcpMcpStdioBridge-CD9BQr2l.mjs +0 -4
  272. package/dist/client/assets/ChatGptUsageButton-CFN6c9Ue.js +0 -2
  273. package/dist/client/assets/ChatMarkdown-DTSMYNs8.js +0 -65
  274. package/dist/client/assets/ComboboxClear-D8WYxa7i.js +0 -2
  275. package/dist/client/assets/CompositeRoot-CLSWLNTl.js +0 -2
  276. package/dist/client/assets/DevicePanel-BQ6aWeSD.js +0 -2
  277. package/dist/client/assets/DiffPanel-D2TxWIFd.js +0 -2
  278. package/dist/client/assets/PanelLayoutControls-Bfgdx7QX.js +0 -215
  279. package/dist/client/assets/PreviewPanel-CbotCgGz.js +0 -2
  280. package/dist/client/assets/ProjectDefaultsSettings-GpUKCz2U.js +0 -2
  281. package/dist/client/assets/ProjectFavicon-BKEw0TrD.js +0 -3
  282. package/dist/client/assets/ProviderModelPicker-CIxbqWeL.js +0 -2
  283. package/dist/client/assets/PullRequestCodeTab-qEGBl5Kn.js +0 -6
  284. package/dist/client/assets/ScheduledTasksSettings-deUjWQ39.js +0 -4
  285. package/dist/client/assets/SettingsPanels-DExy67bz.js +0 -39
  286. package/dist/client/assets/_chat-BfQTKc_9.js +0 -45
  287. package/dist/client/assets/_chat.pull-requests-Dz-eLkAP.js +0 -2
  288. package/dist/client/assets/architecture-7GRP2DOG-DTyqnvkZ.js +0 -1
  289. package/dist/client/assets/assets-B7aY-rQd.js +0 -2
  290. package/dist/client/assets/channel-BO8pVrSI.js +0 -2
  291. package/dist/client/assets/checkbox-Gd1YCUIl.js +0 -2
  292. package/dist/client/assets/classDiagram-ZZMXUADV-Scmt9e5N.js +0 -2
  293. package/dist/client/assets/classDiagram-v2-VYDZK3BY-Scmt9e5N.js +0 -2
  294. package/dist/client/assets/empty-BvJSXK20.js +0 -2
  295. package/dist/client/assets/entities-Dzl1j2jY.js +0 -2
  296. package/dist/client/assets/eventmodeling-NTZA5JFV-DrPNirV-.js +0 -1
  297. package/dist/client/assets/flowDiagram-HODETNUW-D4bD8hue.js +0 -1
  298. package/dist/client/assets/main-DJbmaTSv.js +0 -30
  299. package/dist/client/assets/main-bt-A8VDR.css +0 -2
  300. package/dist/client/assets/number-field-BuLW4JjE.js +0 -2
  301. package/dist/client/assets/popover-O8JaXWO5.js +0 -2
  302. package/dist/client/assets/primary-fvERVyIG.js +0 -2
  303. package/dist/client/assets/primaryCloudLinkState-CT9FDATw.js +0 -2
  304. package/dist/client/assets/projectFilesQueryState-D-fWLsA3.js +0 -2
  305. package/dist/client/assets/projectScriptEditor-BqddH5Lr.js +0 -2
  306. package/dist/client/assets/pullRequests-CEpTVk5m.js +0 -2
  307. package/dist/client/assets/queries-BBd2XSpN.js +0 -2
  308. package/dist/client/assets/query-fboCqXXy.js +0 -2
  309. package/dist/client/assets/radio-group-B2ziR973.js +0 -2
  310. package/dist/client/assets/railroad-abnf-HS5TGJTU-D_PV710-.js +0 -1
  311. package/dist/client/assets/railroad-ebnf-LZEXJU2U-CmXdS8HA.js +0 -1
  312. package/dist/client/assets/railroad-peg-WCYAUIDC-BpmFZ4-g.js +0 -1
  313. package/dist/client/assets/runtime-B-UcwNuZ.js +0 -2
  314. package/dist/client/assets/runtime-BVzm9sLS.js +0 -6
  315. package/dist/client/assets/runtimeModeConfig-Ce0Dnm2_.js +0 -2
  316. package/dist/client/assets/select-D0wmEFXx.js +0 -2
  317. package/dist/client/assets/server-97u7Iupv.js +0 -2
  318. package/dist/client/assets/session-CPQQ27HG.js +0 -2
  319. package/dist/client/assets/settings.appearance-SUyLnEit.js +0 -2
  320. package/dist/client/assets/settings.archived-C-clMQMK.js +0 -2
  321. package/dist/client/assets/settings.connections-DhpKQ7ay.js +0 -2
  322. package/dist/client/assets/settings.diagnostics-CG2kVUBD.js +0 -2
  323. package/dist/client/assets/settings.general-jsS1Ydzs.js +0 -2
  324. package/dist/client/assets/settings.integrations-DDlR7Et9.js +0 -2
  325. package/dist/client/assets/settings.projects-DqNHL2Mx.js +0 -4
  326. package/dist/client/assets/settings.providers-olNQXPOc.js +0 -3
  327. package/dist/client/assets/settings.scheduled-tasks-Dwr1Iiu5.js +0 -2
  328. package/dist/client/assets/settingsLayout-BdqCokK9.js +0 -3
  329. package/dist/client/assets/skeleton-7wGNlCET.js +0 -2
  330. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-nFt0QPRs.js +0 -2
  331. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-Byr1T2AB.js +0 -9
  332. package/dist/client/assets/threadSort-BN7fK5qZ.js +0 -2
  333. package/dist/client/assets/toast-Bkc7xsho.js +0 -2
  334. package/dist/client/assets/tooltip-DH7_Fmka.js +0 -2
  335. package/dist/client/assets/usage-Cuwnw3mn.js +0 -2
  336. package/dist/client/assets/useNavigate-NmIi-1RV.js +0 -2
  337. package/dist/client/assets/usePullRequestActions-DqgBdoH5.js +0 -3
  338. package/dist/client/assets/useSettings-DYKTOdxY.js +0 -3
  339. package/dist/client/assets/utils-vKlT_s3D.js +0 -37
  340. package/dist/client/assets/vcsRefInvalidation-CC_2_Ufo.js +0 -2
@@ -1,2 +0,0 @@
1
- import{i as e,n as t}from"./rolldown-runtime-Dd_uD5pT.js";import{r as n}from"./Icon-l19w4AjM.js";import{$i as r,Aa as i,Cr as a,D as o,Da as s,Em as c,Er as l,Eu as u,Gi as d,HT as f,Jc as p,Ji as m,Ki as h,Mi as g,Ni as _,Oa as v,Qr as y,Rs as b,Ry as x,Ta as S,Xi as C,Zi as w,_o as T,br as E,bt as D,by as O,ca as ee,cd as k,dE as te,di as A,ea as j,gy as M,hd as N,hf as ne,ho as P,ja as F,ki as I,lm as re,lo as ie,lr as ae,ma as L,mo as oe,mu as se,na as R,oa as z,od as B,om as ce,pp as le,ry as ue,sa as de,sr as V,t as H,ta as U,ua as fe,uo as W,va as pe,vi as G,vo as me}from"./utils-vKlT_s3D.js";import{An as he}from"./runtime-BVzm9sLS.js";import{b as ge,c as _e,d as ve,l as ye,p as be,u as xe}from"./tooltip-DH7_Fmka.js";import{t as Se}from"./spinner-YUJ6Pwvq.js";import{t as Ce}from"./useParams-CYkWvywV.js";var we=x(p);function Te(e){return we(e)&&e.bootstrapThreadDisposition===`deleted`}function Ee(e){return we(e)&&e.bootstrapThreadDisposition===`not-created`}var De=[/\bSocketCloseError\b/i,/\bSocketOpenError\b/i,/\bSocket is not connected\b/i,/Unable to connect to the T3 server WebSocket\./i,RegExp(`\\b(?:is not connected|disconnected|stopped responding|could not establish a WebSocket connection)\\.(?: ${(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`))(he)})?$`,`i`),/\bClientProtocolError\b/i,/\bRpcClientError\b/i,/\bping timeout\b/i];function Oe(e){if(typeof e!=`string`)return!1;let t=e.trim();return t.length!==0&&De.some(e=>e.test(t))}function ke(e){return Oe(e)?null:e??null}var K=e(n()),Ae=K.createContext(void 0);function je(){let e=K.useContext(Ae);if(!e)throw Error(me(73));return e}var Me=0;function Ne(e){return Me+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${Me}`}function Pe(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 Fe(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 Ie=e=>e.toastMetadata,q={toasts:G(e=>e.toasts),isEmpty:G(e=>e.toasts.length===0),toast:G(Ie,(e,t)=>e.get(t)?.value),toastIndex:G(Ie,(e,t)=>e.get(t)?.domIndex??-1),toastOffsetY:G(Ie,(e,t)=>e.get(t)?.offsetY??0),toastVisibleIndex:G(Ie,(e,t)=>e.get(t)?.visibleIndex??-1),hovering:G(e=>e.hovering),focused:G(e=>e.focused),expanded:G(e=>e.hovering||e.focused),expandedOrOutOfFocus:G(e=>e.hovering||e.focused||!e.isWindowFocused),prevFocusElement:G(e=>e.prevFocusElement)},Le=class extends A{timers=new Map;areTimersPaused=!1;constructor(e){super({...e,toastMetadata:Fe(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||Ne(`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);return}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:Fe(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=Pe(t.loading),r=this.addToast({...n,type:`loading`}),i=e.then(e=>{let n=Pe(t.success,e);return this.updateToast(r,{...n,type:`success`,timeout:n.timeout}),e}).catch(e=>{let n=Pe(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??=z.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=R(e);U(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?z.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:Fe(e)};e.length===0&&(t.hovering=!1,t.focused=!1),this.update(t)}handleFocusManagement(e){let t=j(m(this.state.viewport));if(!this.state.viewport||!U(this.state.viewport,t)||!r(t))return;if(e===void 0){this.restoreFocusToPrevElement();return}let n=q.toasts(this.state),i=q.toastIndex(this.state,e),a=null,o=i+1;for(;o<n.length;){if(n[o].transitionStatus!==`ending`){a=n[o];break}o+=1}if(!a)for(o=i-1;o>=0;){if(n[o].transitionStatus!==`ending`){a=n[o];break}--o}a?a.ref?.current?.focus():this.restoreFocusToPrevElement()}},J=e(f()),Re=function(e){let{children:t,timeout:n=5e3,limit:r=3,toastManager:i}=e,a=T(()=>new Le({timeout:n,limit:r,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return L(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)(Ae.Provider,{value:a,children:t})},ze=function(e){return e.frontmostHeight=`--toast-frontmost-height`,e}({}),Be=K.forwardRef(function(e,t){let{render:n,className:a,style:o,children:s,...c}=e,l=je(),u=de(),f=K.useRef(!1),p=K.useRef(!1),g=K.useRef(!1),_=l.useState(`isEmpty`),v=l.useState(`toasts`),y=l.useState(`focused`),b=l.useState(`expanded`),x=l.useState(`prevFocusElement`),S=v[0]?.height??0,T=K.useMemo(()=>v.some(e=>e.transitionStatus===`ending`),[v]),E=K.useMemo(()=>v.filter(e=>e.priority===`high`),[v]);K.useEffect(()=>{let e=l.state.viewport;if(!e)return;function t(t){_||t.key===`F6`&&R(t)!==e&&(t.preventDefault(),l.setPrevFocusElement(j(m(e))),e?.focus({preventScroll:!0}),l.pauseTimers(),l.setFocused(!0))}let n=i(e);return w(n,`keydown`,t)},[l,_]),K.useEffect(()=>{let e=l.state.viewport;if(!e||_)return;let t=i(e);function n(e){R(e)===t&&(l.setIsWindowFocused(!1),l.pauseTimers())}function a(n){if(n.relatedTarget)return;let i=R(n),a=j(m(e));(i===t||!U(e,i)||!r(a))&&l.resumeTimers(),u.start(0,()=>l.setIsWindowFocused(!0))}return C(w(t,`blur`,n,!0),w(t,`focus`,a,!0))},[l,u,_]),K.useEffect(()=>{let e=l.state.viewport;if(!e||_)return;let t=m(e);return w(t,`pointerdown`,l.handleDocumentPointerDown,!0)},[_,l]);function D(e){let t=l.state.viewport;t&&(f.current=!0,e.relatedTarget===t?v[0]?.ref?.current?.focus():l.restoreFocusToPrevElement())}function O(e){e.key===`Tab`&&e.shiftKey&&R(e.nativeEvent)===l.state.viewport&&(e.preventDefault(),l.restoreFocusToPrevElement(),l.resumeTimers())}function ee(){let e=l.state.toasts.some(e=>e.transitionStatus===`ending`);l.state.isWindowFocused&&!e&&!g.current&&p.current&&(l.resumeTimers(),l.setHovering(!1),p.current=!1)}K.useEffect(ee,[T,l]);function k(){l.pauseTimers(),l.setHovering(!0),p.current=!1}function te(){T||g.current?p.current=!0:(l.resumeTimers(),l.setHovering(!1))}function A(e){e.pointerType===`touch`&&(g.current=!0)}function M(e){e.pointerType===`touch`&&(g.current=!1,ee())}function N(){if(f.current){f.current=!1;return}y||r(j(m(l.state.viewport)))&&(l.setFocused(!0),l.pauseTimers())}function ne(e){y&&!U(l.state.viewport,e.relatedTarget)&&(l.setFocused(!1),l.resumeTimers())}let P={tabIndex:-1,role:`region`,"aria-live":`polite`,"aria-atomic":!1,"aria-relevant":`additions text`,"aria-label":`Notifications`,onMouseEnter:k,onMouseMove:k,onMouseLeave:te,onFocus:N,onBlur:ne,onKeyDown:O,onClick:N,onPointerDown:A,onPointerUp:M,onPointerCancel:M},F={expanded:b},I=W(`div`,e,{ref:[t,l.setViewport],state:F,props:[P,{style:{[ze.frontmostHeight]:S?`${S}px`:void 0}},c,{children:(0,J.jsxs)(K.Fragment,{children:[!_&&x&&(0,J.jsx)(d,{onFocus:D}),s,!_&&x&&(0,J.jsx)(d,{onFocus:D})]})}]});return(0,J.jsxs)(K.Fragment,{children:[!_&&x&&(0,J.jsx)(d,{onFocus:D}),I,!y&&E.length>0&&(0,J.jsx)(`div`,{style:h,children:E.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))})]})}),Ve=e(fe()),He=K.createContext(void 0);function Ue(){let e=K.useContext(He);if(!e)throw Error(me(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 We(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 Ge(e){let t=i(e).getComputedStyle(e).transform,n=0,r=0,a=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],a=Math.sqrt(t[0]*t[0]+t[1]*t[1])):t.length===16&&(n=t[12],r=t[13],a=t[0])}}return{x:n,y:r,scale:a}}var Ke={...ie,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},qe=40,Je=10,X=.5,Ye=1,Xe=`${I},${g}`,Ze=K.forwardRef(function(e,t){let{toast:n,render:r,className:i,swipeDirection:a=[`down`,`right`],style:o,...c}=e,u=n.positionerProps?.anchor!==void 0,d=[];u||(d=Array.isArray(a)?a:[a]);let f=d.length>0,p=je(),[h,g]=K.useState(void 0),[_,y]=K.useState(!1),[b,x]=K.useState(!1),[S,C]=K.useState(!1),[T,E]=K.useState({x:0,y:0}),[D,O]=K.useState({x:0,y:0,scale:1}),[k,te]=K.useState(),[A,M]=K.useState(),[N,ne]=K.useState(null),P=K.useRef(null),F=K.useRef({x:0,y:0}),I=K.useRef({x:0,y:0,scale:1}),re=K.useRef(void 0),ie=K.useRef(0),ae=K.useRef(!1),L=K.useRef({x:0,y:0}),oe=K.useRef(!1),se=K.useRef({x:0,y:0}),z=K.useRef(null),B=K.useRef(null),ce=p.useState(`toastIndex`,n.id),le=p.useState(`toastVisibleIndex`,n.id),ue=p.useState(`toastOffsetY`,n.id),de=p.useState(`focused`),V=p.useState(`expanded`);ee({open:n.transitionStatus!==`ending`,ref:P,onComplete(){n.transitionStatus===`ending`&&p.removeToast(n.id)}});let H=v((e=!1)=>{let t=P.current;if(!t)return;let r=t.style.height;t.style.height=`auto`;let i=t.offsetHeight;t.style.height=r;function a(){p.updateToastInternal(n.id,{ref:P,height:i,...n.transitionStatus===`starting`?{transitionStatus:void 0}:{}})}e?Ve.flushSync(a):a()});s(H,[H]);function fe(e){se.current=e,E(e)}s(()=>()=>{B.current?.abort()},[]);function pe(e,t){let n=e,r=t;return!d.includes(`left`)&&!d.includes(`right`)?n=e>0?e**X:-(Math.abs(e)**X):(!d.includes(`right`)&&e>0&&(n=e**X),!d.includes(`left`)&&e<0&&(n=-(Math.abs(e)**X))),!d.includes(`up`)&&!d.includes(`down`)?r=t>0?t**X:-(Math.abs(t)**X):(!d.includes(`down`)&&t>0&&(r=t**X),!d.includes(`up`)&&t<0&&(r=-(Math.abs(t)**X))),{x:n,y:r}}let G=v(e=>{if(e.pointerId!==z.current)return;z.current=null,B.current?.abort(),B.current=null,y(!1),x(!1),ne(null);let t=I.current;if(e.type===`pointercancel`||ae.current){fe({x:t.x,y:t.y}),g(void 0);return}let r=!1,i=se.current,a=i.x-t.x,o=i.y-t.y,s;for(let e of d){switch(e){case`right`:a>qe&&(r=!0,s=`right`);break;case`left`:a<-40&&(r=!0,s=`left`);break;case`down`:o>qe&&(r=!0,s=`down`);break;case`up`:o<-40&&(r=!0,s=`up`)}if(r)break}r?(g(s),C(!0),p.closeToast(n.id)):(fe({x:t.x,y:t.y}),g(void 0))});function me(e){if(e.button!==0)return;e.pointerType===`touch`&&p.pauseTimers();let t=R(e.nativeEvent);if(t&&t.closest(`button,a,input,textarea,[role="button"],${Xe}`))return;if(ae.current=!1,re.current=void 0,ie.current=0,z.current=e.pointerId,F.current={x:e.clientX,y:e.clientY},L.current=F.current,P.current){let e=Ge(P.current);I.current=e,O(e),fe({x:e.x,y:e.y})}p.setHovering(!0),y(!0),x(!1),ne(null),oe.current=!0;let n=P.current;if(n){B.current?.abort();let t=new AbortController;B.current=t;let r=m(n);r.addEventListener(`pointerup`,G,{signal:t.signal}),r.addEventListener(`pointercancel`,G,{signal:t.signal}),n.setPointerCapture?.(e.pointerId)}}function he(e){if(e.pointerId!==z.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>L.current.y||i>0&&t<L.current.y)&&(L.current={x:L.current.x,y:t}),(r<0&&n>L.current.x||r>0&&n<L.current.x)&&(L.current={x:n,y:L.current.y});let a=n-F.current.x,o=t-F.current.y,s=t-L.current.y,c=n-L.current.x;if(!b&&Math.sqrt(a*a+o*o)>=Ye&&(x(!0),N===null)){let e=d.includes(`left`)||d.includes(`right`),t=d.includes(`up`)||d.includes(`down`);e&&t&&ne(Math.abs(a)>Math.abs(o)?`horizontal`:`vertical`)}let l;if(!re.current)N===`vertical`?o>0?l=`down`:o<0&&(l=`up`):N===`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&&d.includes(l)&&(re.current=l,ie.current=We(l,a,o),g(l));else{let e=re.current,t=We(e,c,s);t>qe?(ae.current=!1,g(e)):!(d.includes(`left`)&&d.includes(`right`))&&!(d.includes(`up`)&&d.includes(`down`))&&ie.current-t>=Je&&(ae.current=!0)}let u=pe(a,o),f=I.current.x,p=I.current.y;N===`horizontal`?(d.includes(`left`)||d.includes(`right`))&&(f+=u.x):(N===`vertical`||(d.includes(`left`)||d.includes(`right`))&&(f+=u.x),(d.includes(`up`)||d.includes(`down`))&&(p+=u.y)),fe({x:f,y:p})}function ge(e){if(e.key===`Escape`){if(!P.current||!U(P.current,j(m(P.current))))return;p.closeToast(n.id)}}K.useEffect(()=>{if(!f)return;let e=P.current;if(!e)return;function t(t){U(e,R(t))&&t.preventDefault()}return w(e,`touchmove`,t,{passive:!1})},[f]);function _e(){if(!_&&T.x===D.x&&T.y===D.y&&!S)return{[Y.swipeMovementX]:`0px`,[Y.swipeMovementY]:`0px`};let e=T.x-D.x,t=T.y-D.y;return{transition:_?`none`:void 0,transform:_?`translateX(${T.x}px) translateY(${T.y}px) scale(${D.scale})`:void 0,[Y.swipeMovementX]:`${e}px`,[Y.swipeMovementY]:`${t}px`}}let ve=n.priority===`high`,ye={role:ve?`alertdialog`:`dialog`,tabIndex:0,"aria-modal":!1,"aria-labelledby":k,"aria-describedby":A,"aria-hidden":ve&&!de?!0:void 0,onPointerDown:f?me:void 0,onPointerMove:f?he:void 0,onPointerUp:f?G:void 0,onPointerCancel:f?G:void 0,onKeyDown:ge,inert:l(n.limited),style:{..._e(),[Y.index]:n.transitionStatus===`ending`?ce:le,[Y.offsetY]:`${ue}px`,[Y.height]:n.height?`${n.height}px`:void 0}},be=K.useMemo(()=>({rootRef:P,toast:n,titleId:k,setTitleId:te,descriptionId:A,setDescriptionId:M,swiping:_,swipeDirection:h,recalculateHeight:H,index:ce,visibleIndex:le,expanded:V}),[n,k,A,_,h,H,ce,le,V]),xe={transitionStatus:n.transitionStatus,expanded:V,limited:n.limited||!1,type:n.type,swiping:be.swiping,swipeDirection:be.swipeDirection},Se=W(`div`,e,{ref:[t,be.rootRef],state:xe,stateAttributesMapping:Ke,props:[ye,c]});return(0,J.jsx)(He.Provider,{value:be,children:Se})}),Qe=K.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{visibleIndex:o,expanded:c,recalculateHeight:l}=Ue(),u=K.useRef(null);return s(()=>{let e=u.current;if(!e||(l(),typeof ResizeObserver!=`function`||typeof MutationObserver!=`function`))return;let t=new ResizeObserver(()=>l(!0)),n=new MutationObserver(()=>l(!0));return t.observe(e),n.observe(e,{childList:!0,subtree:!0,characterData:!0}),()=>{t.disconnect(),n.disconnect()}},[l]),W(`div`,e,{ref:[t,u],state:{expanded:c,behind:o>0},props:a})}),$e=K.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,children:o,...c}=e,{toast:l,setDescriptionId:u}=Ue(),d=o??l.description,f=!!d,p=pe(a);s(()=>{if(f)return u(p),()=>{u(void 0)}},[f,p,u]);let m={type:l.type},h=W(`p`,e,{ref:t,state:m,props:{...c,id:p,children:d}});return f?h:null}),et=K.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,children:o,...c}=e,{toast:l,setTitleId:u}=Ue(),d=o??l.title,f=!!d,p=pe(a);s(()=>{if(f)return u(p),()=>{u(void 0)}},[f,p,u]);let m={type:l.type},h=W(`h2`,e,{ref:t,state:m,props:{...c,id:p,children:d}});return f?h:null}),tt=K.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a,nativeButton:o=!0,...s}=e,c=je(),{toast:l}=Ue(),u=c.useState(`expanded`),[d,f]=K.useState(!1),{getButtonProps:p,buttonRef:m}=S({disabled:a,native:o}),h={type:l.type};return W(`button`,e,{ref:[t,m],state:h,props:[{"aria-hidden":!u&&!d,onClick(){c.closeToast(l.id)},onFocus(){f(!0)},onBlur(){f(!1)}},s,p]})}),nt=K.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a,nativeButton:o=!0,...s}=e,{toast:c}=Ue(),l=c.actionProps?.children??s.children,u=!!l,{getButtonProps:d,buttonRef:f}=S({disabled:a,native:o}),p={type:c.type},m=W(`button`,e,{ref:[t,f],state:p,props:[s,c.actionProps,d,{children:l}]});return u?m:null}),rt=ye,it=K.createContext(void 0);function at(){let e=K.useContext(it);if(e===void 0)throw Error(me(84));return e}var ot=K.forwardRef(function(e,t){let{toast:n,...r}=e,i=je(),o=n.positionerProps??oe,{render:s,className:c,anchor:l=o.anchor,positionMethod:u=o.positionMethod??`absolute`,side:d=o.side??`top`,align:f=o.align??`center`,sideOffset:p=o.sideOffset??0,alignOffset:m=o.alignOffset??0,collisionBoundary:h=o.collisionBoundary??`clipping-ancestors`,collisionPadding:g=o.collisionPadding??5,arrowPadding:v=o.arrowPadding??5,sticky:b=o.sticky??!1,disableAnchorTracking:x=o.disableAnchorTracking??!1,collisionAvoidance:S=o.collisionAvoidance??_,style:C,...w}=r,[T,D]=K.useState(null),O=i.useState(`toastIndex`,n.id),ee=i.useState(`toastVisibleIndex`,n.id),k=F(l)?l:null,te=y({open:!0,onOpenChange:P,elements:{floating:T,reference:k}}),A=a({anchor:k,positionMethod:u,floatingRootContext:te,mounted:!0,side:d,sideOffset:p,align:f,alignOffset:m,collisionBoundary:h,collisionPadding:g,sticky:b,arrowPadding:v,disableAnchorTracking:x,keepMounted:!0,collisionAvoidance:S}),j=K.useMemo(()=>({side:A.side,align:A.align,anchorHidden:A.anchorHidden}),[A.side,A.align,A.anchorHidden]),M=E(e,j,{styles:{...A.positionerStyles,[Y.index]:n.transitionStatus===`ending`?O:ee},transitionStatus:n.transitionStatus,props:w,refs:[t,D]});return(0,J.jsx)(it.Provider,{value:A,children:M})}),st=K.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,{arrowRef:o,side:s,align:c,arrowUncentered:l,arrowStyles:u}=at();return W(`div`,e,{state:{side:s,align:c,uncentered:l},ref:[t,o],props:[{style:u,"aria-hidden":!0},a]})});function ct(){let e=K.useContext(Ae);if(!e)throw Error(me(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 lt(){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||Ne(`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 ut=t({Action:()=>nt,Arrow:()=>st,Close:()=>tt,Content:()=>Qe,Description:()=>$e,Portal:()=>rt,Positioner:()=>ot,Provider:()=>Re,Root:()=>Ze,Title:()=>et,Viewport:()=>Be,createToastManager:()=>lt,useToastManager:()=>ct});function dt(){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=dt(),Q=te(),ft={archive:u,clock:N,pin:le,trash:ce};function pt(){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)(mt,t),null}function mt(){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`?ft[r.icon]:null,i=r.actions??[],a=i.find(gt),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)}:{},secondaryActionVariant:`soft`,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=ht;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 ht(){return Z.setPaused(`web-hidden`,document.hidden)}function gt(e){return e.primary}var _t=class extends O()(`ClipboardApiUnavailableError`,{target:M}){get message(){return`Clipboard API is unavailable while copying ${this.target}.`}},vt=class extends O()(`ClipboardWriteError`,{target:M,cause:ue()}){get message(){return`Failed to copy ${this.target} to the clipboard.`}},yt=class extends O()(`ClipboardReadUnavailableError`,{target:M}){get message(){return`Clipboard API is unavailable while reading ${this.target}.`}},bt=class extends O()(`ClipboardReadError`,{target:M,cause:ue()}){get message(){return`Failed to read ${this.target} from the clipboard.`}};function xt(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 St(e,t=`text`,n){if(typeof window>`u`)throw new _t({target:t});if(!e)return!1;n&&=Object.fromEntries(Object.entries(n).filter(([e])=>e!==`text/plain`));let r=n?.[se];if(r&&(n={...n,"text/html":D(e,r,n?.[`text/html`])}),typeof navigator>`u`||!navigator.clipboard?.writeText){if(xt(e,n))return!0;throw new _t({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 vt({target:t,cause:e})}}async function Ct(e=`text`){if(typeof window>`u`||typeof navigator>`u`||!navigator.clipboard?.readText)throw new yt({target:e});try{return await navigator.clipboard.readText()}catch(t){throw new bt({target:e,cause:t})}}function wt({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)=>{St(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 Tt(e){return e===`live`}function Et(e){return e.draftThreadExists||e.serverThreadExists&&!e.serverThreadDeleted?`ready`:e.bootstrapComplete?`missing`:`loading`}function Dt(e){return{environmentId:e.environmentId,threadId:e.threadId}}function Ot(e){return{draftId:e}}function kt(e){return!e.environmentId||!e.threadId?null:b(e.environmentId,e.threadId)}function At(e){return e.environmentId&&e.threadId?{kind:`server`,threadRef:b(e.environmentId,e.threadId)}:e.draftId?{kind:`draft`,draftId:e.draftId}:null}function jt(e,t){return e?.kind===`server`?e.threadRef:e?.kind!==`draft`||!t?.promotedTo?null:t.promotedTo}function Mt(e){if(typeof e!=`object`||!e||!(`children`in e))return!1;let t=e.children;return t!=null&&t!==!1&&t!==``}function Nt(e,t){return t<=1?!1:e>0}function Pt(e){let t=0,n=0,r=0,i=0,a=e.map(e=>{let a=Ft(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:Ft(e.find(e=>e.transitionStatus!==`ending`)?.height),items:a}}function Ft(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:0}function It(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 $=lt(),Lt=lt(),Rt=new Map,zt={error:B,info:ne,loading:Se,success:k,warning:re},Bt=180;function Vt(e,t){if(e===`error`&&typeof t==`string`&&!(t.length<Bt))return`line-clamp-4`}var Ht=`absolute z-20 -top-1.5 -right-1.5`,Ut=H(`inline-flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-full border border-border/60 bg-popover/92 text-muted-foreground shadow-sm outline-none backdrop-blur-sm`,`transition-[color,background-color,box-shadow] hover:bg-popover hover:text-foreground`,`focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background`);function Wt(e,t,n){n?.(),e.close(t)}function Gt(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}=wt(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=H(`size-3`,c),t[4]=c,t[5]=l);let u=a?xe:ge,d;t[6]!==l||t[7]!==u?(d=(0,J.jsx)(_e,{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)(V,{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 Kt=`mt-2 max-h-40 min-h-0 overflow-y-auto overscroll-contain pr-0.5 select-text`;function qt(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(Jt),t[0]=c):c=t[0];let l=i?be:ve,u;t[1]===l?u=t[2]:(u=(0,J.jsx)(_e,{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:Kt,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 Jt(e){return!e}function Yt(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=H(`min-w-0 select-text wrap-break-word text-muted-foreground`,Vt(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)($e,{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)($e,{className:u,"data-slot":`toast-description`}),t[7]=u,t[8]=e);let n;t[9]!==a||t[10]!==s?(n=(0,J.jsx)(qt,{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(Xt),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=H(`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=H(`min-w-0 select-none wrap-break-word text-muted-foreground`,Vt(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)($e,{className:x,"data-slot":`toast-description`})}),t[21]=x,t[22]=S);let C=d?be:ve,w;t[23]===C?w=t[24]:(w=(0,J.jsx)(_e,{"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:Kt,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 Xt(e){return!e}function Zt(e){let t=e.type?zt[e.type]:null,n=Mt(e.actionProps)&&e.data?.actionLayout===`stacked-end`,r=e.data?.actionVariant??`default`,i=e.data?.secondaryActionVariant??`outline`,a=e.type===`error`&&typeof e.description==`string`&&!e.data?.hideCopyButton?e.description:null,o=(e.data?.additionalActions?.length??0)>0,s=e.data?.secondaryActionProps!==void 0,c=a!==null||Mt(e.actionProps)||o||s;return{Icon:t,stackedActionLayout:n,actionVariant:r,secondaryActionVariant:i,copyErrorText:a,hasTrailingControls:c,inlineContentEndPad:c?`pr-6`:`pr-10`}}function Qt(e){let t=(0,Q.c)(38),{stackedActionLayout:n,Icon:r,copyErrorText:i,actionProps:a,actionVariant:o,secondaryActionVariant:s,hasTrailingControls:c,toastData:l,toastDescription:u,toastType:d}=e,f;t[0]===l?.additionalActions?f=t[1]:(f=l?.additionalActions??[],t[0]=l?.additionalActions,t[1]=f);let p=f,m=l?.secondaryActionProps,h=l?.leadingIcon,g;t[2]===m?g=t[3]:(g=m??{},t[2]=m,t[3]=g);let _,v;t[4]===g?(_=t[5],v=t[6]):({className:_,...v}=g,t[4]=g,t[5]=_,t[6]=v);let y=n?`pr-5`:`flex-1`,b;t[7]===y?b=t[8]:(b=H(`flex min-h-0 min-w-0 flex-col gap-0.5`,y),t[7]=y,t[8]=b);let x;t[9]!==r||t[10]!==h?(x=h?(0,J.jsx)(`div`,{className:`flex h-lh w-4 shrink-0 items-center justify-center`,"data-slot":`toast-icon`,children:h}):r?(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)(r,{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[9]=r,t[10]=h,t[11]=x):x=t[11];let S;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,J.jsx)(et,{className:`min-w-0 wrap-break-word font-medium`,"data-slot":`toast-title`}),t[12]=S):S=t[12];let C;t[13]===x?C=t[14]:(C=(0,J.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[x,S]}),t[13]=x,t[14]=C);let w;t[15]!==l||t[16]!==u||t[17]!==d?(w=(0,J.jsx)(Yt,{toastData:l,toastDescription:u,toastType:d}),t[15]=l,t[16]=u,t[17]=d,t[18]=w):w=t[18];let T;t[19]!==b||t[20]!==C||t[21]!==w?(T=(0,J.jsxs)(`div`,{className:b,children:[C,w]}),t[19]=b,t[20]=C,t[21]=w,t[22]=T):T=t[22];let E;t[23]!==a||t[24]!==o||t[25]!==p||t[26]!==i||t[27]!==c||t[28]!==_||t[29]!==m||t[30]!==v||t[31]!==s||t[32]!==n||t[33]!==l?.sharedToastId?(E=c?(0,J.jsxs)(`div`,{className:H(`flex items-center gap-1.5`,n?`w-full justify-end`:`shrink-0`),children:[i===null?null:(0,J.jsx)(Gt,{text:i}),p.map(e=>{let{id:t,props:n}=e,{className:r,...i}=n;return(0,K.createElement)(V,{...i,className:r,key:t,size:`xs`,type:`button`,variant:s})}),m?(0,J.jsx)(V,{...v,className:_,size:`xs`,type:`button`,variant:l?.sharedToastId?`solid-neutral`:s}):null,Mt(a)?(0,J.jsx)(nt,{className:H(ae({size:`xs`,variant:o}),`shrink-0`),"data-slot":`toast-action`,children:a?.children}):null]}):null,t[23]=a,t[24]=o,t[25]=p,t[26]=i,t[27]=c,t[28]=_,t[29]=m,t[30]=v,t[31]=s,t[32]=n,t[33]=l?.sharedToastId,t[34]=E):E=t[34];let D;return t[35]!==E||t[36]!==T?(D=(0,J.jsxs)(J.Fragment,{children:[T,E]}),t[35]=E,t[36]=T,t[37]=D):D=t[37],D}function $t(){let e=(0,Q.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={strict:!1,select:en},e[0]=t):t=e[0];let n=Ce(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=o(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 en(e){return At(e)}function tn(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=Rt.get(n)??r,t=null,i=null,a=!1,o=()=>{i!==null&&(window.clearTimeout(i),i=null)},s=()=>{a||(a=!0,Rt.delete(n),$.close(n))},c=()=>{t!==null&&(e=Math.max(0,e-(Date.now()-t)),t=null,o(),Rt.set(n,e))},l=()=>{if(!(a||t!==null)){if(e<=0){s();return}t=Date.now(),o(),i=window.setTimeout(()=>{e=0,t=null,s()},e)}},u=()=>{if(document.visibilityState===`visible`&&document.hasFocus()){l();return}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 nn(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)(pt,{}),t[4]=o):o=t[4];let s;t[5]===a?s=t[6]:(s=(0,J.jsx)(rn,{position:a}),t[5]=a,t[6]=s);let c;return t[7]!==n||t[8]!==r||t[9]!==s?(c=(0,J.jsxs)(Re,{toastManager:$,...r,children:[o,n,s]}),t[7]=n,t[8]=r,t[9]=s,t[10]=c):c=t[10],c}function rn(e){let t=(0,Q.c)(19),{position:n}=e,{toasts:r}=ct(),i=$t(),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=>It(e.data,i),t[2]=i,t[3]=s);let l=Pt(r.filter(s)),u,d;t[4]===r?(u=t[5],d=t[6]):(u=()=>{let e=new Set(r.map(an));for(let t of Rt.keys())e.has(t)||Rt.delete(t)},d=[r],t[4]=r,t[5]=u,t[6]=d),(0,K.useEffect)(u,d);let f=ut,p=ut,m;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(m=H(`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]=m):m=t[7];let h=`${l.frontmostHeight}px`,g;t[8]===h?g=t[9]:(g={"--toast-frontmost-height":h},t[8]=h,t[9]=g);let _=g,v=l.items.map(e=>{let{toast:t,visibleIndex:r,offsetY:i}=e,a=Nt(r,l.items.length),s=Zt(t),{stackedActionLayout:u,inlineContentEndPad:d}=s;return(0,J.jsxs)(Ze,{className:H(`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)(tn,{dismissAfterVisibleMs:t.data?.dismissAfterVisibleMs,toastId:t.id}),!t.data?.sharedToastId&&(0,J.jsx)(`div`,{className:Ht,children:(0,J.jsx)(`button`,{"aria-label":`Dismiss notification`,className:Ut,"data-slot":`toast-close`,onClick:()=>Wt($,t.id,t.data?.onClose),type:`button`,children:(0,J.jsx)(c,{className:`size-3`,strokeWidth:2.25})})}),(0,J.jsxs)(Qe,{className:H(`pointer-events-auto min-h-0 overflow-y-visible pl-3.5 text-sm transition-opacity duration-250 [overflow-x:clip] data-expanded:opacity-100`,u?`flex flex-col gap-2 py-2.5 pr-3.5`:H(`py-3`,`flex items-center justify-between gap-2`,t.data?.sharedToastId?`pr-2`:d),a&&`not-data-expanded:pointer-events-none not-data-expanded:opacity-0`),children:[(0,J.jsx)(Qt,{...s,actionProps:t.actionProps,toastData:t.data,toastDescription:t.description,toastType:t.type}),t.data?.sharedToastId&&(0,J.jsx)(V,{size:`icon-xs`,variant:`ghost`,"aria-label":`Dismiss notification`,onClick:()=>Z.dismiss(t.data.sharedToastId),children:(0,J.jsx)(c,{})})]})]},t.id)}),y;t[10]!==n||t[11]!==_||t[12]!==v||t[13]!==p.Viewport||t[14]!==m?(y=(0,J.jsx)(p.Viewport,{className:m,"data-position":n,"data-slot":`toast-viewport`,style:_,children:v}),t[10]=n,t[11]=_,t[12]=v,t[13]=p.Viewport,t[14]=m,t[15]=y):y=t[15];let b;return t[16]!==y||t[17]!==f.Portal?(b=(0,J.jsx)(f.Portal,{"data-slot":`toast-portal`,children:y}),t[16]=y,t[17]=f.Portal,t[18]=b):b=t[18],b}function an(e){return e.id}function on(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)(sn,{}),t[3]=i):i=t[3];let a;return t[4]!==n||t[5]!==r?(a=(0,J.jsxs)(Re,{toastManager:Lt,...r,children:[n,i]}),t[4]=n,t[5]=r,t[6]=a):a=t[6],a}function sn(){let e=(0,Q.c)(7),{toasts:t}=ct(),n=$t(),r;if(e[0]!==n||e[1]!==t){let i;e[3]===n?i=e[4]:(i=e=>It(e.data,n),e[3]=n,e[4]=i),r=t.filter(i).map(cn),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)(rt,{"data-slot":`toast-portal-anchored`,children:(0,J.jsx)(Be,{className:`outline-none`,"data-slot":`toast-viewport-anchored`,children:r})}),e[5]=r,e[6]=i),i}function cn(e){let t=e.data?.tooltipStyle??!1,n=e.positionerProps,r=Zt(e),{stackedActionLayout:i,inlineContentEndPad:a}=r;return n?.anchor?(0,J.jsx)(ot,{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)(Ze,{className:H(`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)(Qe,{className:`pointer-events-auto px-2 py-1`,children:(0,J.jsx)(et,{"data-slot":`toast-title`})}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:Ht,children:(0,J.jsx)(`button`,{"aria-label":`Dismiss notification`,className:Ut,"data-slot":`toast-close`,onClick:()=>Wt(Lt,e.id,e.data?.onClose),type:`button`,children:(0,J.jsx)(c,{className:`size-3`,strokeWidth:2.25})})}),(0,J.jsx)(Qe,{className:H(`pointer-events-auto min-h-0 overflow-y-visible pl-3.5 text-sm [overflow-x:clip]`,i?`flex flex-col gap-2 py-2.5 pr-3.5`:H(`py-3`,`flex items-center justify-between gap-1.5`,a)),children:(0,J.jsx)(Qt,{...r,actionProps:e.actionProps,toastData:e.data,toastDescription:e.description,toastType:e.type})})]})})},e.id):null}export{Te as _,Ot as a,jt as c,At as d,Ct as f,ke as g,Z as h,$ as i,kt as l,St as m,nn as n,Dt as o,wt as p,Lt as r,Tt as s,on as t,Et as u,Ee as v};
2
- //# sourceMappingURL=toast-Bkc7xsho.js.map
@@ -1,2 +0,0 @@
1
- import{i as e,t}from"./rolldown-runtime-Dd_uD5pT.js";import{r as n}from"./Icon-l19w4AjM.js";import{$T as r,$r as i,Aa as a,Am as o,Ba as s,Cr as c,Da as l,Dr as u,Er as d,GT as f,Gr as p,HT as m,JT as h,Ji as g,Jr as _,KT as v,La as y,Ma as b,Mm as x,Ni as S,Oa as C,Oi as w,QT as T,Qi as E,Tr as D,UT as O,WT as k,Wi as A,XT as j,Xa as M,Xr as ee,YT as N,Yi as P,Yr as F,ZT as I,Zi as L,Zr as te,_a as ne,_r as R,aE as z,ai as re,ao as ie,bi as ae,br as oe,cE as se,ca as ce,dE as le,di as ue,do as de,eE as fe,ei as pe,eo as me,ha as B,hi as he,ho as V,iE as ge,ii as _e,io as ve,ja as ye,ka as be,km as H,lE as xe,la as Se,li as Ce,lo as we,mi as Te,mo as Ee,nE as De,na as Oe,ni as ke,oE as Ae,oa as je,oi as Me,pa as Ne,qT as Pe,r as Fe,rE as Ie,ra as Le,ri as Re,sE as ze,sa as Be,si as Ve,so as He,t as Ue,tE as We,ta as Ge,ti as Ke,to as qe,uE as Je,ua as Ye,ui as Xe,uo as Ze,vc as Qe,vi as U,vo as $e,wr as et}from"./utils-vKlT_s3D.js";import{t as tt}from"./env-wK1YYxA8.js";var W=e(n()),G=e(m()),nt=W.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new je,currentIdRef:{current:null},currentContextRef:{current:null}});function rt(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=W.useRef(n),a=W.useRef(n),o=W.useRef(null),s=W.useRef(null),c=Be();return(0,G.jsx)(nt.Provider,{value:W.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function it(e,t={open:!1}){let{open:n}=t,r=`rootStore`in e?e.rootStore:e,i=r.useState(`floatingId`),{currentIdRef:a,delayRef:o,timeoutMs:s,initialDelayRef:c,currentContextRef:u,hasProvider:d,timeout:f}=W.useContext(nt),[p,m]=W.useState(!1);return l(()=>{function e(){m(!1),u.current?.setIsInstantPhase(!1),a.current=null,u.current=null,o.current=c.current}if(a.current&&!n&&a.current===i){if(m(!1),s){let t=i;return f.start(s,()=>{r.select(`open`)||a.current&&a.current!==t||e()}),()=>{f.clear()}}e()}},[n,i,a,o,s,c,u,f,r]),l(()=>{if(!n)return;let e=u.current,t=a.current;f.clear(),u.current={onOpenChange:r.setOpen,setIsInstantPhase:m},a.current=i,o.current={open:0,close:E(c.current,`close`)},t!==null&&t!==i?(m(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,B(M))):(m(!1),e?.setIsInstantPhase(!1))},[n,i,r,a,o,c,u,f]),l(()=>()=>{u.current=null},[u]),W.useMemo(()=>({hasProvider:d,delayRef:o,isInstantPhase:p}),[d,o,p])}function at(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function ot(e){return e!=null&&e.clientX!=null}function st(e,t={}){let{enabled:n=!0,axis:r=`both`}=t,i=`rootStore`in e?e.rootStore:e,o=i.useState(`open`),s=i.useState(`floatingElement`),c=i.useState(`domReferenceElement`),l=i.context.dataRef,u=W.useRef(!1),d=W.useRef(null),[f,p]=W.useState(),[m,h]=W.useState([]),g=C(e=>{i.set(`positionReference`,e)}),_=C((e,t,n)=>{u.current||(!l.current.openEvent||ot(l.current.openEvent))&&i.set(`positionReference`,at(n??c,{x:e,y:t,axis:r,dataRef:l,pointerType:f}))}),v=C(e=>{o?d.current||(_(e.clientX,e.clientY,e.currentTarget),h([])):_(e.clientX,e.clientY,e.currentTarget)}),y=Le(f)?s:o;W.useEffect(()=>{if(!n){g(c);return}if(!y)return;function e(){d.current?.(),d.current=null}let t=a(s);function r(t){let n=Oe(t);Ge(s,n)?e():_(t.clientX,t.clientY)}return!l.current.openEvent||ot(l.current.openEvent)?d.current=L(t,`mousemove`,r):g(c),e},[y,n,s,l,c,i,_,g,m]),W.useEffect(()=>()=>{i.set(`positionReference`,null)},[i]),W.useEffect(()=>{n&&!s&&(u.current=!1)},[n,s]),W.useEffect(()=>{!n&&o&&(u.current=!0)},[n,o]);let b=W.useMemo(()=>{function e(e){p(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:v,onMouseEnter:v}},[v]);return W.useMemo(()=>n?{reference:b,trigger:b}:{},[n,b])}var ct=le(),lt=e(Ye());function ut(e){let[t,n]=W.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}function dt(e){let t=be(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=b(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r;return(A(n)!==a||A(r)!==o)&&(n=a,r=o),{width:n,height:r}}var ft=()=>!0;function pt(e){let{popupElement:t,positionerElement:n,content:r,mounted:i,enabled:a=ft,onMeasureLayout:o,onMeasureLayoutComplete:s,side:c,direction:u}=e,d=Se(t,!0,!1),f=Ne(),p=W.useRef(null),m=W.useRef(null),h=W.useRef(!0),g=W.useRef(V),_=C(o),v=C(s),y=W.useMemo(()=>{let e=c===`top`,t=c===`left`;return u===`rtl`?(e||=c===`inline-end`,t||=c===`inline-end`):(e||=c===`inline-start`,t||=c===`inline-start`),e?{position:`absolute`,[c===`top`?`bottom`:`top`]:`0`,[t?`right`:`left`]:`0`}:Ee},[c,u]);l(()=>{if(!i||!a()||typeof ResizeObserver!=`function`){g.current=V,h.current=!0,p.current=null,m.current=null;return}if(!t||!n)return;g.current=ht(t,y);let e=new ResizeObserver(e=>{let t=e[0];t&&(m.current={width:Math.ceil(t.borderBoxSize[0].inlineSize),height:Math.ceil(t.borderBoxSize[0].blockSize)})});e.observe(t),gt(t,`auto`);let r=mt(t,`position`,`static`),o=mt(t,`transform`,`none`),s=mt(t,`scale`,`1`),c=ht(n,{"--available-width":`max-content`,"--available-height":`max-content`});function l(){r(),o(),c()}function u(){l(),s()}if(_?.(),h.current||p.current===null){_t(n,`max-content`);let r=dt(t);return p.current=r,_t(n,r),u(),v?.(null,r),h.current=!1,()=>{e.disconnect(),g.current(),g.current=V}}gt(t,`auto`),_t(n,`max-content`);let b=p.current??m.current,x=dt(t);if(p.current=x,!b)return _t(n,x),u(),v?.(null,x),()=>{e.disconnect(),f.cancel(),g.current(),g.current=V};gt(t,b),u(),v?.(b,x),_t(n,x);let S=new AbortController;return f.request(()=>{gt(t,x),d(()=>{t.style.setProperty(`--popup-width`,`auto`),t.style.setProperty(`--popup-height`,`auto`)},S.signal)}),()=>{e.disconnect(),S.abort(),f.cancel(),g.current(),g.current=V}},[r,t,n,d,f,a,i,_,v,y])}function mt(e,t,n){let r=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,r)}}function ht(e,t){let n=[];for(let[r,i]of Object.entries(t))n.push(mt(e,r,i));return n.length?()=>{n.forEach(e=>e())}:V}function gt(e,t){let n=t===`auto`?`auto`:`${t.width}px`,r=t===`auto`?`auto`:`${t.height}px`;e.style.setProperty(`--popup-width`,n),e.style.setProperty(`--popup-height`,r)}function _t(e,t){let n=t===`max-content`?`max-content`:`${t.width}px`,r=t===`max-content`?`max-content`:`${t.height}px`;e.style.setProperty(`--positioner-width`,n),e.style.setProperty(`--positioner-height`,r)}function vt(e){let{store:t,side:n,cssVars:r,children:i}=e,a=D(),o=t.useState(`activeTriggerElement`),s=t.useState(`activeTriggerId`),c=t.useState(`open`),u=t.useState(`payload`),f=t.useState(`mounted`),p=t.useState(`popupElement`),m=t.useState(`positionerElement`),h=ut(c?o:null),_=St(s,u),v=W.useRef(null),[y,b]=W.useState(null),[x,S]=W.useState(null),w=W.useRef(null),T=W.useRef(null),E=Se(w,!0,!1),O=Ne(),[k,A]=W.useState(null),[j,M]=W.useState(!1);l(()=>(t.set(`hasViewport`,!0),()=>{t.set(`hasViewport`,!1)}),[t]);let ee=C(()=>{w.current?.style.setProperty(`animation`,`none`),w.current?.style.setProperty(`transition`,`none`),T.current?.style.setProperty(`display`,`none`)}),N=C(e=>{w.current?.style.removeProperty(`animation`),w.current?.style.removeProperty(`transition`),T.current?.style.removeProperty(`display`),e&&A(e)}),P=W.useRef(null);l(()=>{if(o&&h&&o!==h&&P.current!==o&&v.current){b(v.current),M(!0);let e=xt(h,o);S(e),O.request(()=>{lt.flushSync(()=>{M(!1)}),E(()=>{b(null),A(null),v.current=null})}),P.current=o}},[o,h,y,E,O]),l(()=>{let e=w.current;if(!e)return;let t=g(e).createElement(`div`);for(let n of Array.from(e.childNodes))t.appendChild(n.cloneNode(!0));v.current=t});let F=y!=null,I;I=F?(0,G.jsxs)(W.Fragment,{children:[(0,G.jsx)(`div`,{"data-previous":!0,inert:d(!0),ref:T,style:{...k?{[r.popupWidth]:`${k.width}px`,[r.popupHeight]:`${k.height}px`}:null,position:`absolute`},"data-ending-style":j?void 0:``},`previous`),(0,G.jsx)(`div`,{"data-current":!0,ref:w,"data-starting-style":j?``:void 0,children:i},_)]}):(0,G.jsx)(`div`,{"data-current":!0,ref:w,children:i},_),l(()=>{let e=T.current;e&&y&&e.replaceChildren(...Array.from(y.childNodes))},[y]),pt({popupElement:p,positionerElement:m,mounted:f,content:u,onMeasureLayout:ee,onMeasureLayoutComplete:N,side:n,direction:a});let L={activationDirection:yt(x),transitioning:F};return{children:I,state:L}}function yt(e){if(e)return`${bt(e.horizontal,5,`right`,`left`)} ${bt(e.vertical,5,`down`,`up`)}`}function bt(e,t,n,r){return e>t?n:e<-t?r:``}function xt(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i={x:n.left+n.width/2,y:n.top+n.height/2},a={x:r.left+r.width/2,y:r.top+r.height/2};return{horizontal:a.x-i.x,vertical:a.y-i.y}}function St(e,t){let[n,r]=W.useState(0),i=W.useRef(e),a=W.useRef(t),o=W.useRef(!1);return l(()=>{let n=i.current,s=a.current,c=e!==n,l=t!==s;c?(r(e=>e+1),o.current=!l):o.current&&l&&(r(e=>e+1),o.current=!1),i.current=e,a.current=t},[e,t]),`${e??`current`}-${n}`}var K=e(t((e=>{e.Check=[[`path`,{d:`M20 6 9 17l-5-5`}]],e.ChevronDown=[[`path`,{d:`m6 9 6 6 6-6`}]],e.ChevronRight=[[`path`,{d:`m9 18 6-6-6-6`}]],e.ChevronUp=[[`path`,{d:`m18 15-6-6-6 6`}]],e.ChevronsDownUp=[[`path`,{d:`m7 20 5-5 5 5`}],[`path`,{d:`m7 4 5 5 5-5`}]],e.ChevronsUpDown=[[`path`,{d:`m7 15 5 5 5-5`}],[`path`,{d:`m7 9 5-5 5 5`}]],e.Circle=[[`circle`,{cx:`12`,cy:`12`,r:`10`}]],e.CircleAlert=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`}]],e.CircleCheck=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`m9 12 2 2 4-4`}]],e.Code2=[[`path`,{d:`m18 16 4-4-4-4`}],[`path`,{d:`m6 8-4 4 4 4`}],[`path`,{d:`m14.5 4-5 16`}]],e.Copy=[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`}]],e.CornerUpRight=[[`path`,{d:`m15 14 5-5-5-5`}],[`path`,{d:`M4 20v-7a4 4 0 0 1 4-4h12`}]],e.Eye=[[`path`,{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`}],[`circle`,{cx:`12`,cy:`12`,r:`3`}]],e.FoldVertical=[[`path`,{d:`M12 22v-6`}],[`path`,{d:`M12 8V2`}],[`path`,{d:`M4 12H2`}],[`path`,{d:`M10 12H8`}],[`path`,{d:`M16 12h-2`}],[`path`,{d:`M22 12h-2`}],[`path`,{d:`m15 19-3-3-3 3`}],[`path`,{d:`m15 5-3 3-3-3`}]],e.Folder=[[`path`,{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`}]],e.FolderClosed=[[`path`,{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`}],[`path`,{d:`M2 10h20`}]],e.Image=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`}],[`circle`,{cx:`9`,cy:`9`,r:`2`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`}]],e.Link=[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`}]],e.ListPlus=[[`path`,{d:`M16 5H3`}],[`path`,{d:`M11 12H3`}],[`path`,{d:`M16 19H3`}],[`path`,{d:`M18 9v6`}],[`path`,{d:`M21 12h-6`}]],e.Lock=[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`}]],e.LockOpen=[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`}],[`path`,{d:`M7 11V7a5 5 0 0 1 9.9-1`}]],e.Maximize2=[[`path`,{d:`M15 3h6v6`}],[`path`,{d:`m21 3-7 7`}],[`path`,{d:`m3 21 7-7`}],[`path`,{d:`M9 21H3v-6`}]],e.Minimize2=[[`path`,{d:`m14 10 7-7`}],[`path`,{d:`M20 10h-6V4`}],[`path`,{d:`m3 21 7-7`}],[`path`,{d:`M4 14h6v6`}]],e.Minus=[[`path`,{d:`M5 12h14`}]],e.Moon=[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`}]],e.PanelLeft=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}],[`path`,{d:`M9 3v18`}]],e.PanelLeftClose=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}],[`path`,{d:`M9 3v18`}],[`path`,{d:`m16 15-3-3 3-3`}]],e.Plus=[[`path`,{d:`M5 12h14`}],[`path`,{d:`M12 5v14`}]],e.Sun=[[`circle`,{cx:`12`,cy:`12`,r:`4`}],[`path`,{d:`M12 2v2`}],[`path`,{d:`M12 20v2`}],[`path`,{d:`m4.93 4.93 1.41 1.41`}],[`path`,{d:`m17.66 17.66 1.41 1.41`}],[`path`,{d:`M2 12h2`}],[`path`,{d:`M20 12h2`}],[`path`,{d:`m6.34 17.66-1.41 1.41`}],[`path`,{d:`m19.07 4.93-1.41 1.41`}]],e.Table2=[[`path`,{d:`M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18`}]],e.Text=[[`path`,{d:`M21 5H3`}],[`path`,{d:`M15 12H3`}],[`path`,{d:`M17 19H3`}]],e.UnfoldVertical=[[`path`,{d:`M12 22v-6`}],[`path`,{d:`M12 8V2`}],[`path`,{d:`M4 12H2`}],[`path`,{d:`M10 12H8`}],[`path`,{d:`M16 12h-2`}],[`path`,{d:`M22 12h-2`}],[`path`,{d:`m15 19-3 3-3-3`}],[`path`,{d:`m15 5-3-3-3 3`}]],e.Volume2=[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`}]],e.VolumeOff=[[`path`,{d:`M16 9a5 5 0 0 1 .95 2.293`}],[`path`,{d:`M19.364 5.636a9 9 0 0 1 1.889 9.96`}],[`path`,{d:`m2 2 20 20`}],[`path`,{d:`m7 7-.587.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298V11`}],[`path`,{d:`M9.828 4.172A.686.686 0 0 1 11 4.657v.686`}]]}))(),1),Ct=H(K.Check,f),wt=H(K.ChevronDown,v),Tt=H(K.ChevronRight,Pe),Et=H(K.ChevronUp,h),Dt=H(K.ChevronsDownUp,null),Ot=H(K.ChevronsUpDown,null),kt=H(K.Circle,N),At=H(K.CircleAlert,k),jt=H(K.CircleCheck,se),Mt=H(K.Code2,j),Nt=H(K.Copy,I),Pt=H(K.CornerUpRight,null),Ft=H(K.Eye,null),It=H(K.FoldVertical,null),Lt=H(K.Folder,T),Rt=H(K.FolderClosed,T),zt=H(K.Image,r),Bt=H(K.Link,fe),Vt=H(K.ListPlus,null),Ht=H(K.Lock,null),Ut=H(K.LockOpen,null),Wt=H(K.Maximize2,We),Gt=H(K.Minimize2,null),Kt=H(K.Minus,De),qt=H(K.Moon,Ie),Jt=H(K.PanelLeft,ge),Yt=H(K.PanelLeftClose,null),Xt=H(K.Plus,O),Zt=H(K.Sun,z),Qt=H(K.Table2,Ae),$t=H(K.Text,ze),en=H(K.UnfoldVertical,null),tn=H(K.Volume2,xe),nn=H(K.VolumeOff,Je),rn=W.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{portalNode:c,portalSubtree:l}=w({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,G.jsxs)(W.Fragment,{children:[l,c&&lt.createPortal(n,c)]})}),an=`MmLlHhVvCcSsQqTtAaZz`;function on(e){let t=[],n=e.length,r=0,i=0,a=0,o=0,s=0,c=null,l=``,u=0,d=0,f=``,p=!1,m=e=>{throw Error(`morphicons: ${e} at d[${r}]`)},h=e=>e>=48&&e<=57,g=()=>{for(;r<n;){let t=e.charCodeAt(r);if(t===32||t===9||t===10||t===13||t===12||t===44)r++;else break}},_=()=>{g();let t=r;r<n&&(e[r]===`+`||e[r]===`-`)&&r++;let i=!1;for(;r<n&&h(e.charCodeAt(r));)r++,i=!0;if(r<n&&e[r]===`.`)for(r++;r<n&&h(e.charCodeAt(r));)r++,i=!0;if(i||m(`expected number`),r<n&&(e[r]===`e`||e[r]===`E`)){let t=r;r++,r<n&&(e[r]===`+`||e[r]===`-`)&&r++;let i=!1;for(;r<n&&h(e.charCodeAt(r));)r++,i=!0;i||(r=t)}return Number(e.slice(t,r))},v=()=>{g();let t=e[r];return t===`0`||t===`1`?(r++,+(t===`1`)):m(`expected arc flag (0|1)`)},y=()=>(p||m(`path must start with M/m`),c||(c={x0:i,y0:a,segs:[],closed:!1},t.push(c)),c),b=!1,x=()=>_()+(b?i:0),S=()=>_()+(b?a:0);for(;g(),!(r>=n);){let n=e[r];switch(an.includes(n)?(l=n,r++):l===``?m(`path must start with M/m`):l===`M`?l=`L`:l===`m`?l=`l`:(l===`Z`||l===`z`)&&m(`stray data after Z`),b=l>=`a`,b?l.toUpperCase():l){case`M`:{p=!0;let e=x(),n=S();i=e,a=n,o=e,s=n,c={x0:e,y0:n,segs:[],closed:!1},t.push(c),f=``;break}case`L`:{let e=x(),t=S();y().segs.push([`L`,e,t]),i=e,a=t,f=``;break}case`H`:{let e=x();y().segs.push([`L`,e,a]),i=e,f=``;break}case`V`:{let e=S();y().segs.push([`L`,i,e]),a=e,f=``;break}case`C`:case`S`:{let e,t;l===`C`||l===`c`?(e=x(),t=S()):(e=f===`C`?2*i-u:i,t=f===`C`?2*a-d:a);let n=x(),r=S(),o=x(),s=S();y().segs.push([`C`,e,t,n,r,o,s]),u=n,d=r,i=o,a=s,f=`C`;break}case`Q`:case`T`:{let e,t;l===`Q`||l===`q`?(e=x(),t=S()):(e=f===`Q`?2*i-u:i,t=f===`Q`?2*a-d:a);let n=x(),r=S();y().segs.push([`Q`,e,t,n,r]),u=e,d=t,i=n,a=r,f=`Q`;break}case`A`:{let e=_(),t=_(),n=_(),r=v(),o=v(),s=x(),c=S();y().segs.push([`A`,e,t,n,r,o,s,c]),i=s,a=c,f=``;break}case`Z`:c&&=(c.closed=!0,null),i=o,a=s,f=``;break;default:m(`unsupported command "${l}"`)}}return t.filter(e=>e.segs.length>0)}function sn(e){return String(Math.round(e*100)/100)}function cn(e,t){let n=``;for(let r=0;r<e.length;r++){let i=e[r],a=i.length/2;n+=`M${sn(i[0])} ${sn(i[1])}`;for(let e=1;e<a;e++)n+=`L${sn(i[2*e])} ${sn(i[2*e+1])}`;t?.[r]&&(n+=`Z`)}return n}function q(e){return String(Math.round(e*1e4)/1e4)}function ln(e){let t=``;for(let{pts:n,closed:r}of e){t+=`M${q(n[0])} ${q(n[1])}`;for(let e=2;e<n.length;e+=6)t+=`C${q(n[e])} ${q(n[e+1])} ${q(n[e+2])} ${q(n[e+3])} ${q(n[e+4])} ${q(n[e+5])}`;r&&(t+=`Z`)}return t}var un=4/3*Math.tan(Math.PI/8),dn=2*Math.PI;function fn(e,t){let n=[e,t],r=e,i=t,a=(e,t,a,o,s,c)=>{n.push(e,t,a,o,s,c),r=s,i=c},o=(e,t)=>{Math.abs(e-r)<1e-12&&Math.abs(t-i)<1e-12||a(r+(e-r)/3,i+(t-i)/3,r+2*(e-r)/3,i+2*(t-i)/3,e,t)};return[a,o,(e,t,n,o)=>{a(r+2/3*(e-r),i+2/3*(t-i),n+2/3*(e-n),o+2/3*(t-o),n,o)},(e,t,n,s,c,l,u)=>{let d=r,f=i;if(Math.abs(l-d)<1e-12&&Math.abs(u-f)<1e-12)return;let p=Math.abs(e),m=Math.abs(t);if(p<1e-12||m<1e-12){o(l,u);return}let h=n*Math.PI/180,g=Math.cos(h),_=Math.sin(h),v=(d-l)/2,y=(f-u)/2,b=g*v+_*y,x=-_*v+g*y,S=b*b/(p*p)+x*x/(m*m);if(S>1){let e=Math.sqrt(S);p*=e,m*=e}let C=p*p,w=m*m,T=b*b,E=x*x,D=(C*w-C*E-w*T)/(C*E+w*T);D<0&&(D=0);let O=(s===c?-1:1)*Math.sqrt(D),k=O*p*x/m,A=-O*m*b/p,j=g*k-_*A+(d+l)/2,M=_*k+g*A+(f+u)/2,ee=Math.atan2((x-A)/m,(b-k)/p),N=Math.atan2((-x-A)/m,(-b-k)/p)-ee;c===0&&N>0?N-=dn:c===1&&N<0&&(N+=dn);let P=Math.max(1,Math.ceil(Math.abs(N)/(Math.PI/2)-1e-9)),F=N/P,I=4/3*Math.tan(F/4),L=e=>j+p*Math.cos(e)*g-m*Math.sin(e)*_,te=e=>M+p*Math.cos(e)*_+m*Math.sin(e)*g,ne=e=>-p*Math.sin(e)*g-m*Math.cos(e)*_,R=e=>-p*Math.sin(e)*_+m*Math.cos(e)*g,z=ee,re=d,ie=f;for(let e=1;e<=P;e++){let t=ee+F*e,n=e===P?l:L(t),r=e===P?u:te(t);a(re+I*ne(z),ie+I*R(z),n-I*ne(t),r-I*R(t),n,r),z=t,re=n,ie=r}},e=>(e&&o(n[0],n[1]),n.length<8?null:{pts:Float64Array.from(n),closed:e})]}function pn(e){let[t,n,r,i,a]=fn(e.x0,e.y0);for(let a of e.segs)switch(a[0]){case`L`:n(a[1],a[2]);break;case`C`:t(a[1],a[2],a[3],a[4],a[5],a[6]);break;case`Q`:r(a[1],a[2],a[3],a[4]);break;case`A`:i(a[1],a[2],a[3],a[4],a[5],a[6],a[7])}return a(e.closed)}function J(e,t,n=0){let r=e[t];if(r===void 0)return n;let i=typeof r==`number`?r:Number(r);return Number.isFinite(i)?i:n}function mn(e){let t=String(e??``).trim();if(!t)return[];let n=t.split(/[\s,]+/).map(Number);if(n.some(e=>!Number.isFinite(e)))throw Error(`morphicons: invalid points: "${t}"`);return n}function hn(e,t){if(e.length<4)return null;let[,n,,,r]=fn(e[0],e[1]);for(let t=2;t+1<e.length;t+=2)n(e[t],e[t+1]);return r(t)}function gn(e,t,n,r){if(n<1e-12||r<1e-12)return null;let i=un*n,a=un*r,o=e+n,s=e-n,c=t+r,l=t-r,[u,,,,d]=fn(o,t);return u(o,t+a,e+i,c,e,c),u(e-i,c,s,t+a,s,t),u(s,t-a,e-i,l,e,l),u(e+i,l,o,t-a,o,t),d(!0)}function _n(e){let t=J(e,`x`),n=J(e,`y`),r=J(e,`width`),i=J(e,`height`);if(r<1e-12||i<1e-12)return null;let a=J(e,`rx`,NaN),o=J(e,`ry`,NaN);if(Number.isNaN(a)&&(a=Number.isNaN(o)?0:o),Number.isNaN(o)&&(o=a),a=Math.min(Math.max(a,0),r/2),o=Math.min(Math.max(o,0),i/2),a<1e-12||o<1e-12)return hn([t,n,t+r,n,t+r,n+i,t,n+i],!0);let s=t+a,c=t+r-a,l=t+r,u=n+o,d=n+i-o,f=n+i,p=un*a,m=un*o,[h,g,,,_]=fn(s,n);return g(c,n),h(c+p,n,l,u-m,l,u),g(l,d),h(l,d+m,c+p,f,c,f),g(s,f),h(s-p,f,t,d+m,t,d),g(t,u),h(t,u-m,s-p,n,s,n),_(!0)}function vn(e){let t=[],n=e=>{e&&t.push(e)};if(typeof e==`string`){for(let t of on(e))n(pn(t));return t}for(let[t,r]of e)switch(t){case`path`:for(let e of on(String(r.d??``)))n(pn(e));break;case`line`:{let[,e,,,t]=fn(J(r,`x1`),J(r,`y1`));e(J(r,`x2`),J(r,`y2`)),n(t(!1));break}case`circle`:{let e=J(r,`r`);n(gn(J(r,`cx`),J(r,`cy`),e,e));break}case`ellipse`:n(gn(J(r,`cx`),J(r,`cy`),J(r,`rx`),J(r,`ry`)));break;case`rect`:n(_n(r));break;case`polyline`:n(hn(mn(r.points),!1));break;case`polygon`:n(hn(mn(r.points),!0));break;default:throw Error(`morphicons: unsupported tag <${t}>`)}return t}function yn(e){return e.items.map(()=>new Float64Array(2*e.n))}function bn(e,t,n){for(let r=0;r<e.items.length;r++){let i=e.items[r],a=n[r],o=e.n,s=Math.exp(i.lnSigma*t),c=i.theta*t,l=Math.cos(c)*s,u=Math.sin(c)*s,d,f;if(i.block){let[e,n]=i.block.off,[r,a]=i.block.drift;d=i.ca[0]+r*t+(e*l-n*u-e),f=i.ca[1]+a*t+(e*u+n*l-n)}else d=i.ca[0]+(i.cb[0]-i.ca[0])*t,f=i.ca[1]+(i.cb[1]-i.ca[1])*t;for(let e=0;e<o;e++){let n=i.aC[2*e]+(i.bT[2*e]-i.aC[2*e])*t,r=i.aC[2*e+1]+(i.bT[2*e+1]-i.aC[2*e+1])*t;a[2*e]=d+n*l-r*u,a[2*e+1]=f+n*u+r*l}}}var xn=.35,Sn=.05,Cn=.005,wn=8,Tn=1e5;function Y(e){let t=e.length/2,n=0,r=0;for(let i=0;i<t;i++)n+=e[2*i],r+=e[2*i+1];return[n/t,r/t]}function En(e){let t=e.length/2,n=0;for(let r=1;r<t;r++)n+=Math.hypot(e[2*r]-e[2*r-2],e[2*r+1]-e[2*r-1]);return n}function Dn(e){let t=e.length/2,n=new Float64Array(2*t);for(let r=0;r<t;r++)n[2*r]=e[2*(t-1-r)],n[2*r+1]=e[2*(t-1-r)+1];return n}function On(e,t){let n=e.length/2,r=new Float64Array(2*n);for(let i=0;i<n;i++){let a=(i+t)%n;r[2*i]=e[2*a],r[2*i+1]=e[2*a+1]}return r}function kn(e,t,n,r){let i=e.length/2,a=0,o=0,s=0,c=0,l=0,u=0;for(let d=0;d<i;d++){let i=e[2*d]-n[0],f=e[2*d+1]-n[1],p=t[2*d]-r[0],m=t[2*d+1]-r[1];a+=i*p,c+=f*m,o+=i*m,s+=f*p,l+=i*i+f*f,u+=p*p+m*m}let d=Math.atan2(o-s,a+c),f=Math.cos(d)*(a+c)+Math.sin(d)*(o-s),p=l>1e-12?f/l:1;p>1e-6||(p=1e-6);let m=Math.max(0,p*p*l-2*p*f+u),h=u>1e-12?Math.sqrt(m/u):0;return{theta:d,sigma:p,res:h}}function An(e,t,n=!1,r=!1){let i=Y(e),a=Y(t),o=n&&!r,s=o?e:t,c=n||r?s.length/2:1,l=1/0,u=s,d={theta:0,sigma:1,res:0};for(let n=0;n<2;n++){let r=n?Dn(s):s;for(let n=0;n<c;n++){let s=n?On(r,n):r,c=o?kn(s,t,i,a):kn(e,s,i,a),f=c.res+Sn*Math.abs(c.theta)/Math.PI;f<l&&(l=f,u=s,d=c)}}return o?{ca:i,cb:a,a:u,b:t,...d}:{ca:i,cb:a,a:e,b:u,...d}}function jn(e,t){let n=t.map(Y),r=t.map(En);return e.map(e=>{let t=Y(e),i=En(e);return n.map((e,n)=>Math.hypot(t[0]-e[0],t[1]-e[1])+xn*Math.abs(i-r[n]))})}function Mn(e){let t=e.length;if(t>wn){let n=[];for(let r=0;r<t;r++)for(let i=0;i<t;i++)n.push([e[r][i],r,i]);n.sort((e,t)=>e[0]-t[0]);let r=Array(t).fill(-1),i=Array(t).fill(!1);for(let[,e,t]of n)r[e]<0&&!i[t]&&(r[e]=t,i[t]=!0);return r}let n=Array.from({length:t},(e,t)=>t),r=n.slice(),i=1/0,a=(n,o,s)=>{if(!(s>=i)){if(o===t){i=s,r=n.slice();return}for(let r=o;r<t;r++)[n[o],n[r]]=[n[r],n[o]],a(n,o+1,s+e[o][n[o]]),[n[o],n[r]]=[n[r],n[o]]}};return a(n,0,0),r}function Nn(e){let t=e.length,n=e[0].length;if(n**t>Tn){let r=e.map(e=>{let t=0;for(let n=1;n<e.length;n++)e[n]<e[t]&&(t=n);return t}),i=Array(n).fill(0);for(let e of r)i[e]++;for(let a=0;a<n;a++){if(i[a]>0)continue;let n=-1,o=1/0;for(let s=0;s<t;s++){if(i[r[s]]<2)continue;let t=e[s][a]-e[s][r[s]];t<o&&(o=t,n=s)}i[r[n]]--,r[n]=a,i[a]++}return r}let r=null,i=1/0,a=Array(t),o=Array(n).fill(0),s=(c,l,u)=>{if(!(l>=i||n-u>t-c)){if(c===t){i=l,r=a.slice();return}for(let t=0;t<n;t++)a[c]=t,o[t]++,s(c+1,l+e[c][t],u+ +(o[t]===1)),o[t]--}};if(s(0,0,0),!r)throw Error(`morphicons: no valid surjection (B < S)`);return r}function Pn(e,t){let n=e.length*t,r=new Float64Array(2*n),i=new Float64Array(2*n);e.forEach((e,n)=>{r.set(e.a,2*t*n),i.set(e.bO,2*t*n)});let a=Y(r),o=kn(r,i,a,Y(i));if(o.res>=Cn)return;let s=Math.cos(-o.theta),c=Math.sin(-o.theta),l=Math.cos(o.theta),u=Math.sin(o.theta);for(let n of e){let e=0,r=0;for(let i=0;i<t;i++){let t=n.bO[2*i]-n.cb[0],a=n.bO[2*i+1]-n.cb[1];n.bT[2*i]=(t*s-a*c)/o.sigma,n.bT[2*i+1]=(t*c+a*s)/o.sigma;let d=o.sigma*(l*n.aC[2*i]-u*n.aC[2*i+1])-t,f=o.sigma*(u*n.aC[2*i]+l*n.aC[2*i+1])-a;e+=d*d+f*f,r+=t*t+a*a}n.theta=o.theta,n.lnSigma=Math.log(o.sigma),n.res=r>1e-12?Math.sqrt(e/r):0;let i=Math.exp(n.lnSigma),d=Math.cos(n.theta)*i,f=Math.sin(n.theta)*i,p=n.ca[0]-a[0],m=n.ca[1]-a[1],h=p*d-m*f-p,g=p*f+m*d-m;n.block={off:[p,m],drift:[n.cb[0]-n.ca[0]-h,n.cb[1]-n.ca[1]-g]}}}function Fn(e,t){let n=e.length,r=t.length;if(n===0||r===0)throw Error(`morphicons: icon has no subpaths`);let i=e.map(e=>e.pts),a=t.map(e=>e.pts),o=[];if(n===r){let e=Mn(jn(i,a));for(let t=0;t<n;t++)o.push([t,e[t]])}else if(n<r){let e=Nn(jn(a,i));for(let t=0;t<r;t++)o.push([e[t],t])}else{let e=Nn(jn(i,a));for(let t=0;t<n;t++)o.push([t,e[t]])}let s=i[0].length/2,c=o.map(([n,r])=>{let o=An(i[n],a[r],e[n].closed,t[r].closed),c=o.a,l=new Float64Array(2*s),u=new Float64Array(2*s),d=new Float64Array(2*s),f=Math.cos(-o.theta),p=Math.sin(-o.theta);for(let e=0;e<s;e++){l[2*e]=c[2*e]-o.ca[0],l[2*e+1]=c[2*e+1]-o.ca[1];let t=o.b[2*e]-o.cb[0],n=o.b[2*e+1]-o.cb[1];u[2*e]=(t*f-n*p)/o.sigma,u[2*e+1]=(t*p+n*f)/o.sigma,d[2*e]=o.b[2*e],d[2*e+1]=o.b[2*e+1]}return{a:c,aC:l,bT:u,bO:d,ca:o.ca,cb:o.cb,theta:o.theta,lnSigma:Math.log(o.sigma),res:o.res,closed:e[n].closed&&t[r].closed,block:null}});return c.length>1&&Pn(c,s),{items:c,n:s}}var In=Math.PI/8,Ln=[.18343464249564978,.525532409916329,.7966664774136267,.9602898564975363],Rn=[.362683783378362,.31370664587788727,.22238103445337448,.10122853629037626];function zn(e,t,n){let r=6*t,i=1-n,a=3*i*i,o=6*i*n,s=3*n*n,c=a*(e[r+2]-e[r])+o*(e[r+4]-e[r+2])+s*(e[r+6]-e[r+4]),l=a*(e[r+3]-e[r+1])+o*(e[r+5]-e[r+3])+s*(e[r+7]-e[r+5]);return Math.hypot(c,l)}function Bn(e,t,n=1){let r=n/2,i=0;for(let n=0;n<4;n++)i+=Rn[n]*(zn(e,t,r+r*Ln[n])+zn(e,t,r-r*Ln[n]));return i*r}function Vn(e,t,n,r,i){let a=6*t,o=1-n,s=o*o*o,c=3*o*o*n,l=3*o*n*n,u=n*n*n;r[i]=s*e[a]+c*e[a+2]+l*e[a+4]+u*e[a+6],r[i+1]=s*e[a+1]+c*e[a+3]+l*e[a+5]+u*e[a+7]}function Hn(e,t,n){let r=6*t,i=n?r+6:r,a=n?-1:1;for(let t of n?[4,2,0]:[2,4,6]){let n=a*(e[r+t]-e[i]),o=a*(e[r+t+1]-e[i+1]);if(n*n+o*o>1e-18)return[n,o]}return null}function Un(e,t=In){let n=e.pts,r=(n.length/2-1)/3,i=[];for(let e=0;e<r;e++)Bn(n,e)>1e-9&&i.push(e);if(i.length===0)return[];let a=new Set,o=(e,r)=>{let i=Hn(n,e,!0),o=Hn(n,r,!1);i&&o&&Math.abs(Math.atan2(i[0]*o[1]-i[1]*o[0],i[0]*o[0]+i[1]*o[1]))>t&&a.add(r)};for(let e=0;e+1<i.length;e++)o(i[e],i[e+1]);return e.closed&&i.length>1&&o(i[i.length-1],i[0]),[...a].sort((e,t)=>e-t)}function Wn(e,t,n,r){if(n<=0)return 0;if(n>=r)return 1;let i=0,a=1,o=n/r;for(let s=0;s<12;s++){let s=Bn(e,t,o)-n;if(Math.abs(s)<1e-10*r+1e-14)break;s>0?a=o:i=o;let c=zn(e,t,o),l=c>1e-12?o-s/c:(i+a)/2;l>i&&l<a||(l=(i+a)/2),o=l}return o}function Gn(e,t=64,n=In){let r=e.pts,i=(r.length/2-1)/3,a=new Float64Array(2*t),o=()=>{for(let e=0;e<t;e++)a[2*e]=r[0],a[2*e+1]=r[1];return a};if(i<1)return o();let s=Array(i),c=0;for(let e=0;e<i;e++)s[e]=Bn(r,e),c+=s[e];if(c<1e-12)return o();let l=Un(e,n),u=e.closed?l.length>0?l:[0]:[...new Set([0,...l,i])].sort((e,t)=>e-t),d=[];if(e.closed)for(let e=0;e<u.length;e++){let t=u[e],n=e+1<u.length?u[e+1]:u[0]+i;d.push([t,n])}else for(let e=0;e+1<u.length;e++)d.push([u[e],u[e+1]]);let f=d.map(([e,t])=>{let n=0;for(let r=e;r<t;r++)n+=s[r%i];return n}),p=e.closed?t:t-1;if(d.length>p)throw Error(`morphicons: N=${t} too small (${d.length} runs)`);let m=f.reduce((e,t)=>e+t,0)||1,h=f.map(e=>p*e/m),g=h.map(e=>Math.max(1,Math.floor(e))),_=p-g.reduce((e,t)=>e+t,0);if(_>0){let e=h.map((e,t)=>[Math.round((e-Math.floor(e))*1e9),t]).sort((e,t)=>t[0]-e[0]||e[1]-t[1]);for(let t=0;t<_;t++)g[e[t%g.length][1]]++}for(;_<0;){let e=0;for(let t=1;t<g.length;t++)g[t]>g[e]&&(e=t);if(g[e]<=1)break;g[e]--,_++}let v=0;for(let e=0;e<d.length;e++){let[t,n]=d[e],o=g[e],c=f[e],l=t%i*6;a[2*v]=r[l],a[2*v+1]=r[l+1],v++;let u=t,p=0;for(let e=1;e<o;e++){let t=c*e/o;for(;u<n-1&&p+s[u%i]<t;)p+=s[u%i],u++;let l=u%i,d=s[l];Vn(r,l,d>1e-12?Wn(r,l,t-p,d):0,a,2*v),v++}}if(!e.closed){let e=6*i;a[2*v]=r[e],a[2*v+1]=r[e+1]}return a}function Kn(e,t=64){return vn(e).map(e=>({pts:Gn(e,t),closed:e.closed}))}var qn=class{x=1;v=0;k=250;c=24;config(e,t){this.k=e,this.c=t}start(){this.x=0,this.v>14&&(this.v=14),this.v<-14&&(this.v=-14)}step(e){let t=Math.max(1,Math.min(16,Math.ceil(e/(1/240)))),n=e/t;for(let e=0;e<t;e++){let e=this.k*(1-this.x)-this.c*this.v;this.v+=e*n,this.x+=this.v*n}return Math.abs(1-this.x)<.001&&Math.abs(this.v)<.02}},Jn={smooth:{k:170,c:26},snappy:{k:420,c:30},bouncy:{k:300,c:14}},X=new Set,Z=0,Q=-1;function Yn(e){let t=Q<0?0:Math.min(Math.max((e-Q)/1e3,0),.1);Q=e;for(let e of[...X])e(t);X.size>0?Z=requestAnimationFrame(Yn):(Z=0,Q=-1)}function Xn(e){X.add(e),Z===0&&(Q=-1,Z=requestAnimationFrame(Yn))}function Zn(e){X.delete(e),X.size===0&&Z!==0&&(cancelAnimationFrame(Z),Z=0,Q=-1)}var Qn=new WeakMap,$n=new WeakMap,er=new WeakMap;function $(e){if(typeof e==`string`)return Kn(e);let t=Qn.get(e);return t||(t=Kn(e),Qn.set(e,t)),t}function tr(e){if(typeof e==`string`)return e;let t=$n.get(e);return t||(t=ln(vn(e)),$n.set(e,t)),t}function nr(e,t){if(typeof e==`string`||typeof t==`string`)return Fn($(e),$(t));let n=er.get(e);n||(n=new WeakMap,er.set(e,n));let r=n.get(t);return r||(r=Fn($(e),$(t)),n.set(t,r)),r}function rr(e){if(typeof e==`string`)return Jn[e];let t=Jn.snappy;return{k:e?.stiffness??t.k,c:e?.damping??t.c}}function ir(e,t,n){let r=new qn,i=n?.reducedMotion??`never`,a=t,o=!0,s=null,c=null,l=null,u=1,d=!1,f=!1;e.setAttribute(`d`,tr(t));let p=t=>{let n=s,r=c,i=l;n&&r&&i&&(u=t,bn(n,t,r),e.setAttribute(`d`,cn(r,i)))},m=()=>{d&&(d=!1,Zn(h))},h=e=>{let t=r.step(e);p(r.x),t&&(m(),g())},g=()=>{o=!0,s=null,c=null,l=null,u=1,r.x=1,r.v=0,e.setAttribute(`d`,tr(a))},_=()=>{let e=s,t=c;return o||!e||!t?$(a):t.map((t,n)=>({pts:Float64Array.from(t),closed:e.items[n].closed}))},v=e=>{s=o?nr(a,e):Fn(_(),$(e)),c=yn(s),l=s.items.map(e=>e.closed),a=e,o=!1},y=e=>{m(),a=e,g()},b=()=>i===`always`?!0:i!==`user`||typeof matchMedia>`u`?!1:matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1,x=(e,t)=>{if(f)return;let n=!o&&s!==null&&e===a;m(),r.v=0,n||v(e),p(t)};return{morphTo(e,t){if(f||e===a&&(o||d))return;if(b()){y(e);return}let{k:n,c:i}=rr(t);r.config(n,i),v(e),r.start(),d||(d=!0,Xn(h))},set(e){f||y(e)},seek:x,get progress(){return o?1:u},set progress(e){f||x(a,e)},get reducedMotion(){return i},set reducedMotion(e){i=e},destroy(){m(),f=!0,s=null,c=null,l=null}}}var ar=typeof document>`u`?W.useEffect:W.useLayoutEffect;function or(e,t,n){if(n<=0)return tr(e);if(n>=1)return tr(t);let r=Fn(Kn(e),Kn(t)),i=yn(r);return bn(r,n,i),cn(i,r.items.map(e=>e.closed))}var sr=(0,W.forwardRef)(function(e,t){let{icon:n,from:r,to:i,progress:a,spring:o,reducedMotion:s,size:c=24,color:l=`currentColor`,strokeWidth:u=2,absoluteStrokeWidth:d,label:f,...p}=e,m=r!==void 0&&i!==void 0,h=n??r??i,[g]=(0,W.useState)(()=>m?or(r,i,a??0):h===void 0?``:tr(h)),_=(0,W.useRef)(null),v=(0,W.useRef)(null),y=(0,W.useRef)(o);y.current=o;let b=(0,W.useRef)(s);b.current=s;let x=(0,W.useRef)(n),S=(0,W.useRef)(m),C=(0,W.useRef)(!1),w=(0,W.useRef)(!1),T=(0,W.useRef)(null),E=(0,W.useCallback)(e=>{if(v.current)return v.current;let t=_.current;return C.current||!t?null:(v.current=ir(t,e,{reducedMotion:b.current}),v.current)},[]);ar(()=>{C.current=!1;let e=_.current;if(e&&h!==void 0){let t=ir(e,m?r:h,{reducedMotion:b.current});if(v.current=t,m){T.current=[r,i];let e=a??0;e<=0?t.set(r):e>=1?t.set(i):(t.seek(i,e),w.current=!0)}}return()=>{C.current=!0,v.current?.destroy(),v.current=null,w.current=!1,T.current=null}},[]),(0,W.useEffect)(()=>{let e=v.current;e&&(e.reducedMotion=s??`never`)},[s]),(0,W.useEffect)(()=>{let e=S.current&&!m;S.current=m;let t=n!==x.current;if(x.current=n,m||n===void 0||!t&&!e)return;T.current=null,w.current=!1;let r=v.current;r?r.morphTo(n,y.current):E(n)},[n,m,E]),(0,W.useEffect)(()=>{if(!m)return;let e=v.current??E(r);if(!e)return;let t=a??0;(!T.current||T.current[0]!==r||T.current[1]!==i)&&(T.current=[r,i],w.current=!1),t<=0?(e.set(r),w.current=!1):t>=1?(e.set(i),w.current=!1):(w.current||=(e.set(r),!0),e.seek(i,t))},[m,r,i,a,E]),(0,W.useImperativeHandle)(t,()=>({morphTo:(e,t)=>{T.current=null,w.current=!1;let n=v.current;n?n.morphTo(e,t??y.current):E(e)},set:e=>{T.current=null,w.current=!1;let t=v.current;t?t.set(e):E(e)}}),[E]);let D=d?Number(u)*24/Number(c):u;return(0,G.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:c,height:c,viewBox:`0 0 24 24`,fill:`none`,stroke:l,strokeWidth:D,strokeLinecap:`round`,strokeLinejoin:`round`,role:f?`img`:void 0,"aria-hidden":!f||void 0,...p,children:[f?(0,G.jsx)(`title`,{children:f}):null,(0,G.jsx)(`path`,{ref:_,d:g})]})});function cr(e){return typeof e==`object`&&!!e&&`lucide`in e}function lr(e){let t=(0,ct.c)(17),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({reducedMotion:a,icon:n,strokeWidth:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let s=a===void 0?`user`:a,c=x(),l=cr(n)?c===`p4`?n.p4??n.lucide:n.lucide:n,u;t[5]!==c||t[6]!==i?(u=c===`p4`?o(i):i,t[5]=c,t[6]=i,t[7]=u):u=t[7];let d=u,f;t[8]===l?f=t[9]:(f=l===void 0?{}:{icon:l},t[8]=l,t[9]=f);let p;t[10]===d?p=t[11]:(p=d===void 0?{}:{strokeWidth:d},t[10]=d,t[11]=p);let m;return t[12]!==r||t[13]!==s||t[14]!==f||t[15]!==p?(m=(0,G.jsx)(sr,{reducedMotion:s,...f,...p,...r}),t[12]=r,t[13]=s,t[14]=f,t[15]=p,t[16]=m):m=t[16],m}var ur=W.createContext(void 0);function dr(e){let t=W.useContext(ur);if(t===void 0&&!e)throw Error($e(72));return t}var fr={...Ke,disabled:U(e=>e.disabled),instantType:U(e=>e.instantType),isInstantPhase:U(e=>e.isInstantPhase),trackCursorAxis:U(e=>e.trackCursorAxis),disableHoverablePopup:U(e=>e.disableHoverablePopup),lastOpenChangeReason:U(e=>e.openChangeReason),closeOnClick:U(e=>e.closeOnClick),closeDelay:U(e=>e.closeDelay),hasViewport:U(e=>e.hasViewport)},pr=class e extends ue{constructor(e,t,n=!1){let r=new ke,i={...mr(),...e};i.floatingRootContext=pe(r,t,n),super(i,{popupRef:W.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:r},fr)}setOpen=(e,t)=>{let n=t.reason,r=n===me,i=e&&n===`trigger-focus`,a=!e&&(n===`trigger-press`||n===`escape-key`);if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let o=()=>{let r={open:e,openChangeReason:n};i?r.instantType=`focus`:a?r.instantType=`dismiss`:n===`trigger-hover`&&(r.instantType=void 0),_e(r,e,t.trigger),this.update(r)};r?lt.flushSync(o):o()};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,B(qe,e))}static useStore(t,n){return Ce(t,(t,r)=>new e(n,t,r)).store}};function mr(){return{...i(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}var hr=Te(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:c,onOpenChangeComplete:u,handle:d,triggerId:f,defaultTriggerId:p=null,children:m}=e,h=pr.useStore(d?.store,{open:n,openProp:r,activeTriggerId:p,triggerIdProp:f});R(()=>{r===void 0&&h.state.open===!1&&n===!0&&h.update({open:!0,activeTriggerId:p})}),h.useControlledProp(`openProp`,r),h.useControlledProp(`triggerIdProp`,f),h.useContextCallback(`onOpenChange`,c),h.useContextCallback(`onOpenChangeComplete`,u);let g=h.useState(`open`),_=!t&&g,v=h.useState(`activeTriggerId`),b=h.useState(`mounted`),x=h.useState(`payload`);h.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i}),h.useSyncedValue(`disabled`,t),re(h);let{forceUnmount:S,transitionStatus:C}=Me(_,h),w=h.useState(`isInstantPhase`),T=h.useState(`instantType`),E=h.useState(`lastOpenChangeReason`),D=W.useRef(null);l(()=>{g&&t&&h.setOpen(!1,B(y))},[g,t,h]),l(()=>{C===`ending`&&E===`none`||C!==`ending`&&w?(T!==`delay`&&(D.current=T),h.set(`instantType`,`delay`)):D.current!==null&&(h.set(`instantType`,D.current),D.current=null)},[C,w,E,T,h]),l(()=>{_&&(v??h.set(`payload`,void 0))},[h,v,_]);let O=W.useCallback(()=>{h.setOpen(!1,B(s))},[h]);W.useImperativeHandle(o,()=>({unmount:S,close:O}),[S,O]);let k=_||b||!t&&a!==`none`;return(0,G.jsxs)(ur.Provider,{value:h,children:[k&&(0,G.jsx)(gr,{store:h,disabled:t,trackCursorAxis:a}),typeof m==`function`?m({payload:x}):m]})});function gr({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=ae(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=st(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n}),o=W.useMemo(()=>de(a.reference,i.reference),[a.reference,i.reference]),s=W.useMemo(()=>de(a.trigger,i.trigger),[a.trigger,i.trigger]),c=W.useMemo(()=>de(Re,a.floating,i.floating),[a.floating,i.floating]);return Ve(e,{activeTriggerProps:o,inactiveTriggerProps:s,popupProps:c}),null}var _r=W.createContext(void 0);function vr(){return W.useContext(_r)}var yr=function(e){return e[e.popupOpen=ve.popupOpen]=`popupOpen`,e.triggerDisabled=`data-trigger-disabled`,e}({}),br=`data-base-ui-tooltip-trigger`;function xr(e){if(`composedPath`in e){let t=e.composedPath();for(let e=0;e<t.length;e+=1){let n=t[e];if(ye(n))return n}}let t=e.target;return ye(t)?t:null}function Sr(e){let t=e;for(;t;){if(t.hasAttribute(br))return t;let e=t.parentElement;if(e){t=e;continue}let n=t.getRootNode();t=`host`in n&&ye(n.host)?n.host:null}return null}var Cr=he(function(e,t){let{render:n,className:r,style:i,handle:a,payload:o,disabled:s,delay:c,closeOnClick:l=!0,closeDelay:u,id:d,...f}=e,m=dr(!0),h=a?.store??m;if(!h)throw Error($e(82));let g=ne(d),v=h.useState(`isTriggerActive`,g),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`floatingRootContext`),x=W.useRef(null),S=c??600,C=u??0,{registerTrigger:w,isMountedByThisTrigger:T}=Xe(g,x,h,{payload:o,closeOnClick:l,closeDelay:C}),E=vr(),{delayRef:D,isInstantPhase:O,hasProvider:k}=it(b,{open:y}),A=ee(b);h.useSyncedValue(`isInstantPhase`,O);let j=h.useState(`disabled`),M=s??j,N=P(M),F=h.useState(`trackCursorAxis`),I=h.useState(`disableHoverablePopup`),L=W.useRef(!1),R=Be(),z=W.useRef(void 0);function re(){let e=E?.delay,t=typeof D.current==`object`?D.current.open:void 0,n=S;return k&&(n=t===0?0:c??e??S),n}function ie(e){let t=x.current;if(!t||!e)return!1;let n=Sr(e);return n!==null&&n!==t&&Ge(t,n)}function ae(e){let t=ie(e);return L.current=t,t&&(A.openChangeTimeout.clear(),A.restTimeout.clear(),A.restTimeoutPending=!1,R.clear()),t}let oe=_(b,{enabled:!M,mouseOnly:!0,move:!1,handleClose:!I&&F!==`both`?p():null,restMs:re,delay(){let e=typeof D.current==`object`?D.current.close:void 0,t=C;return u==null&&k&&(t=e),{close:t}},triggerElementRef:x,isActiveTrigger:v,isClosing:()=>h.select(`transitionStatus`)===`ending`,shouldOpen(){return!L.current}}),se=te(b,{enabled:!M}).reference,ce=e=>{let t=L.current,n=xr(e),r=ae(n),i=x.current,a=i&&n&&Ge(i,n);if(r&&h.select(`open`)&&h.select(`lastOpenChangeReason`)===`trigger-hover`){h.setOpen(!1,B(me,e));return}if(t&&!r&&a&&!N.current&&!h.select(`open`)&&i&&Le(z.current)){let t=()=>{!L.current&&!N.current&&!h.select(`open`)&&h.setOpen(!0,B(me,e,i))},n=re();n===0?(R.clear(),t()):R.start(n,t)}},le=h.useState(`triggerProps`,T);return Ze(`button`,e,{state:{open:y},ref:[t,w,x],props:[oe,se,T||F!==`none`?le:void 0,{onMouseOver(e){ce(e.nativeEvent)},onFocus(e){ie(xr(e.nativeEvent))&&e.preventBaseUIHandler()},onMouseLeave(){L.current=!1,R.clear(),z.current=void 0},onPointerEnter(e){z.current=e.pointerType},onPointerDown(e){z.current=e.pointerType,h.set(`closeOnClick`,l),l&&!h.select(`open`)&&h.cancelPendingOpen(e.nativeEvent)},onClick(e){l&&!h.select(`open`)&&h.cancelPendingOpen(e.nativeEvent)},id:g,[yr.triggerDisabled]:M?``:void 0,[br]:M?void 0:``},f],stateAttributesMapping:He})}),wr=W.createContext(void 0);function Tr(){let e=W.useContext(wr);if(e===void 0)throw Error($e(70));return e}var Er=W.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return dr().useState(`mounted`)||n?(0,G.jsx)(wr.Provider,{value:n,children:(0,G.jsx)(rn,{ref:t,...r})}):null}),Dr=W.createContext(void 0);function Or(){let e=W.useContext(Dr);if(e===void 0)throw Error($e(71));return e}var kr=W.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:l=0,alignOffset:u=0,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f=5,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:h=!1,collisionAvoidance:g=S,style:_,...v}=e,y=dr(),b=Tr(),x=y.useState(`open`),C=y.useState(`mounted`),w=y.useState(`trackCursorAxis`),T=y.useState(`disableHoverablePopup`),E=y.useState(`floatingRootContext`),D=y.useState(`instantType`),O=y.useState(`transitionStatus`),k=y.useState(`hasViewport`),A=c({anchor:i,positionMethod:a,floatingRootContext:E,mounted:C,side:o,sideOffset:l,align:s,alignOffset:u,collisionBoundary:d,collisionPadding:f,sticky:m,arrowPadding:p,disableAnchorTracking:h,keepMounted:b,collisionAvoidance:g,adaptiveOrigin:k?et:void 0}),j=W.useMemo(()=>({open:x,side:A.side,align:A.align,anchorHidden:A.anchorHidden,instant:w===`none`?D:`tracking-cursor`}),[x,A.side,A.align,A.anchorHidden,w,D]),M=oe(e,j,{styles:A.positionerStyles,transitionStatus:O,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!C,inert:!x||w===`both`||T});return(0,G.jsx)(Dr.Provider,{value:A,children:M})}),Ar={...ie,...we},jr=W.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=dr(),{side:s,align:c}=Or(),l=o.useState(`open`),d=o.useState(`instantType`),f=o.useState(`transitionStatus`),p=o.useState(`popupProps`),m=o.useState(`floatingRootContext`),h=o.useState(`disabled`),g=o.useState(`closeDelay`);ce({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),F(m,{enabled:!h,closeDelay:g});let _=o.useStateSetter(`popupElement`);return Ze(`div`,e,{state:{open:l,side:s,align:c,instant:d,transitionStatus:f},ref:[t,o.context.popupRef,_],props:[p,u(f),a],stateAttributesMapping:Ar})}),Mr=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=W.useMemo(()=>({delay:t,closeDelay:n}),[t,n]),a=W.useMemo(()=>({open:t,close:n}),[t,n]);return(0,G.jsx)(_r.Provider,{value:i,children:(0,G.jsx)(rt,{delay:a,timeoutMs:r,children:e.children})})},Nr=function(e){return e.popupWidth=`--popup-width`,e.popupHeight=`--popup-height`,e}({}),Pr={activationDirection:e=>e?{"data-activation-direction":e}:null},Fr=W.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,s=dr(),c=Or(),l=s.useState(`instantType`),{children:u,state:d}=vt({store:s,side:c.side,cssVars:Nr,children:a}),f={activationDirection:d.activationDirection,transitioning:d.transitioning,instant:l};return Ze(`div`,e,{state:f,ref:t,props:[o,{children:u}],stateAttributesMapping:Pr})}),Ir=`wco`,Lr=`electron`,Rr=`electron-windows`,zr=52;function Br(){return typeof navigator>`u`?null:navigator.windowControlsOverlay??null}function Vr(){if(typeof document>`u`)return()=>{};let e=Br(),t=()=>{document.documentElement.classList.toggle(Ir,e!==null&&e.visible)};return t(),e?(e.addEventListener(`geometrychange`,t),()=>{e.removeEventListener(`geometrychange`,t)}):()=>{}}function Hr(e){let t=Br();return t?.addEventListener(`geometrychange`,e),()=>t?.removeEventListener(`geometrychange`,e)}function Ur(){if(tt&&Qe(navigator.platform))return zr;let e=Br();return e?.visible?e.getTitlebarAreaRect().bottom:0}function Wr(){return(0,W.useSyncExternalStore)(Hr,Ur,Gr)}function Gr(){return 0}function Kr(e){return Fe(e)?[Lr,Rr]:[Lr]}function qr(e){if(typeof document>`u`)return()=>{};let t=Kr(e);return document.documentElement.classList.add(...t),()=>{document.documentElement.classList.remove(...t)}}var Jr=5,Yr=Mr,Xr=(0,W.createContext)(null),Zr=(0,W.createContext)(null);function Qr(e){let t=(0,ct.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({onScrollCapture:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i=(0,W.useRef)(null),a;t[3]===n?a=t[4]:(a=e=>{n?.(e);let t=i.current;t&&!t.trigger.contains(t.trigger.ownerDocument.activeElement)&&(i.current=null,t.actionsRef.current?.close())},t[3]=n,t[4]=a);let o;return t[5]!==r||t[6]!==a?(o=(0,G.jsx)(Zr,{value:i,children:(0,G.jsx)(`div`,{...r,onScrollCapture:a})}),t[5]=r,t[6]=a,t[7]=o):o=t[7],o}function $r(e){let t=(0,W.use)(Zr),n=(0,W.useRef)(null),r=e.actionsRef??n;return(0,W.useEffect)(()=>()=>{t?.current?.actionsRef===r&&(t.current=null)},[r,t]),t?(0,G.jsx)(Xr,{value:r,children:(0,G.jsx)(hr,{...e,actionsRef:r,onOpenChange:(n,i)=>{e.onOpenChange?.(n,i),!n&&!i.isCanceled&&t.current?.actionsRef===r&&(t.current=null)}})}):(0,G.jsx)(hr,{...e})}function ei(e){let t=(0,W.use)(Zr),n=(0,W.use)(Xr);return!t||!n?(0,G.jsx)(Cr,{"data-slot":`tooltip-trigger`,...e}):(0,G.jsx)(Cr,{"data-slot":`tooltip-trigger`,...e,onMouseEnter:r=>{e.onMouseEnter?.(r),t.current={trigger:r.currentTarget,actionsRef:n}}})}function ti(e){let t=(0,ct.c)(5),n=Jr+Wr(),r;t[0]===n?r=t[1]:(r={top:n,right:Jr,bottom:Jr,left:Jr},t[0]=n,t[1]=r);let i;return t[2]!==e||t[3]!==r?(i=(0,G.jsx)(kr,{className:`pointer-events-none z-[140] h-(--positioner-height) w-(--positioner-width) max-w-(--available-width) transition-[top,left,right,bottom,transform] data-instant:transition-none`,collisionPadding:r,"data-slot":`tooltip-positioner`,...e}),t[2]=e,t[3]=r,t[4]=i):i=t[4],i}function ni(e){let t=(0,ct.c)(25),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({className:i,align:o,sideOffset:s,side:c,variant:l,anchor:n,children:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u=o===void 0?`center`:o,d=s===void 0?4:s,f=c===void 0?`top`:c,p=l===void 0?`default`:l,m=p===`glass`?`dropdown-glass shadow-xl shadow-black/25 before:hidden`:p===`inverse`?`rounded-xl border border-foreground bg-foreground text-background shadow-md/10 before:hidden`:`border bg-popover not-dark:bg-clip-padding shadow-md/5`,h=p===`code`?`max-w-120 wrap-anywhere text-left font-mono text-[11px] leading-relaxed`:`max-w-80 wrap-anywhere whitespace-normal leading-snug`,g;t[9]!==i||t[10]!==m||t[11]!==h?(g=Ue(`relative flex h-(--popup-height,auto) w-(--popup-width,auto) origin-(--transform-origin) text-balance rounded-md text-popover-foreground text-xs transition-[width,height,scale,opacity] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-md)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0 data-instant:duration-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]`,m,h,i),t[9]=i,t[10]=m,t[11]=h,t[12]=g):g=t[12];let _;t[13]===r?_=t[14]:(_=(0,G.jsx)(Fr,{className:`relative size-full overflow-clip px-(--viewport-inline-padding) py-1 [--viewport-inline-padding:--spacing(2)] data-instant:transition-none **:data-current:data-ending-style:opacity-0 **:data-current:data-starting-style:opacity-0 **:data-previous:data-ending-style:opacity-0 **:data-previous:data-starting-style:opacity-0 **:data-current:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-previous:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-previous:truncate **:data-current:opacity-100 **:data-previous:opacity-100 **:data-current:transition-opacity **:data-previous:transition-opacity`,"data-slot":`tooltip-viewport`,children:r}),t[13]=r,t[14]=_);let v;t[15]!==a||t[16]!==g||t[17]!==_?(v=(0,G.jsx)(jr,{className:g,"data-slot":`tooltip-popup`,...a,children:_}),t[15]=a,t[16]=g,t[17]=_,t[18]=v):v=t[18];let y;return t[19]!==u||t[20]!==n||t[21]!==f||t[22]!==d||t[23]!==v?(y=(0,G.jsx)(Er,{children:(0,G.jsx)(ti,{align:u,anchor:n,side:f,sideOffset:d,children:v})}),t[19]=u,t[20]=n,t[21]=f,t[22]=d,t[23]=v,t[24]=y):y=t[24],y}export{Ut as A,$t as B,It as C,Bt as D,zt as E,Jt as F,ut as G,tn as H,Yt as I,Xt as L,Gt as M,Kt as N,Vt as O,qt as P,Zt as R,Ft as S,Rt as T,nn as U,en as V,vt as W,At as _,ei as a,Nt as b,lr as c,wt as d,Tt as f,kt as g,Ot as h,Qr as i,Wt as j,Ht as k,rn as l,Dt as m,ni as n,qr as o,Et as p,Yr as r,Vr as s,$r as t,Ct as u,jt as v,Lt as w,Pt as x,Mt as y,Qt as z};
2
- //# sourceMappingURL=tooltip-DH7_Fmka.js.map
@@ -1,2 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{$o as n,$u as r,Em as i,Ep as a,Gn as o,Go as s,Gy as c,HT as l,Ig as u,Kn as d,Lc as f,Lo as p,Ry as m,Uo as h,Vo as g,Yn as _,Zn as v,_p as y,_s as b,cr as x,cy as S,dE as C,d_ as w,ey as T,fT as E,hf as D,hs as O,ms as k,od as A,or as j,sr as M,t as N,tr as ee,vy as P,zp as F}from"./utils-vKlT_s3D.js";import{I,K as L,U as R,z}from"./runtime-BVzm9sLS.js";import{a as B,n as V,t as te}from"./tooltip-DH7_Fmka.js";import{a as ne,c as re,o as ie,s as ae,t as oe}from"./select-D0wmEFXx.js";import{t as se}from"./useNavigateBack-DnwpvjrN.js";import{rt as ce}from"./useSettings-DYKTOdxY.js";import{f as H,s as le}from"./server-97u7Iupv.js";import{n as ue,t as U}from"./session-CPQQ27HG.js";import{t as de}from"./use-atom-command-JNR1Jqwn.js";import{a as fe,c as pe,d as W,f as G,i as me,l as K,n as he,o as ge,r as q,s as J,t as Y,u as _e}from"./usageFormat-B0V5dWS3.js";import{t as ve}from"./env-wK1YYxA8.js";import{t as X}from"./skeleton-7wGNlCET.js";import{n as ye,t as be}from"./toggle-group-CQtXH1ph.js";import{t as xe}from"./input-BZEAWLAC.js";import{t as Se}from"./scroll-area-D4H8QGpd.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-C9_Ef3sx.js";import{o as Ae}from"./sidebar-7a8hvtAS.js";import{t as je}from"./observeResize-DRhwSBbU.js";import{y as Me}from"./keybindings-BOV97yVS.js";import{i as Ne,o as Pe,t as Fe}from"./popover-O8JaXWO5.js";import{S as Ie,n as Le,t as Re}from"./ChatGptUsageButton-CFN6c9Ue.js";import{t as ze}from"./WorkspacePageContainer-8jksqZGW.js";import{n as Be,r as Ve,t as He}from"./usageShortcuts-CK0JjnNA.js";import{Ni as Ue,Wi as We,cr as Ge,dr as Ke,lr as qe,qa as Je,qr as Ye,ur as Xe}from"./main-DJbmaTSv.js";import{t as Ze}from"./WorkspacePageHeader-IRvZnA0X.js";import{i as Qe,n as $e,r as et,t as tt}from"./WorkspaceBreadcrumb-3VgFkWcC.js";import{t as nt}from"./usageAccess-BRuBlcgN.js";var Z=e(t(),1),Q=C(),rt=m(L);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 z(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 I(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);if(t.has(s)){o.push(`${r.label}: ${i.fingerprint.resolvedHomePath}`);continue}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=h(e=>s(t=>{let n=JSON.parse(e),r=t(ce.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:E(k(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(H.usageSummary({environmentId:e,input:n})),l=E(k(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:l,needsCursorKeychainAccess:it(l,t(H.providersValueAtom(e)))})}return i}).pipe(n(`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=g(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 d=u,f;r[12]!==d||r[13]!==s?(f=e=>lt({registry:p,server:H,presentations:ce,environmentIds:d.filter(jt).map(At),input:e??JSON.parse(s)}),r[12]=d,r[13]=s,r[14]=f):f=r[14];let m=f,h;r[15]!==a||r[16]!==d?(h=wt(Et(d,a)),r[15]=a,r[16]=d,r[17]=h):h=r[17];let _=h,v;r[18]===d?v=r[19]:(v=d.filter(kt),r[18]=d,r[19]=v);let y=v.length,b;r[20]===d?b=r[21]:(b=d.filter(Ot),r[20]=d,r[21]=b);let x=b.length,S=y===0&&x>0,[C,w]=(0,Z.useState)(null);y>0&&(C?.merged!==_||C.window!==e||C.selection!==i||C.hidden!==a)&&w({window:e,merged:_,selection:i,hidden:a});let T=C?.selection===i&&C.hidden===a?C:null,E;r[22]!==y||r[23]!==e||r[24]!==S||r[25]!==T||r[26]!==_?(E=y>0?{window:e,merged:_}:T??(S?null:{window:e,merged:_}),r[22]=y,r[23]=e,r[24]=S,r[25]=T,r[26]=_,r[27]=E):E=r[27];let D=E,O=y>0&&x>0,k;return r[28]!==l||r[29]!==S||r[30]!==_||r[31]!==m||r[32]!==d||r[33]!==D||r[34]!==O?(k={merged:_,environments:l,selectedEnvironments:d,isPending:S,shown:D,isPartial:O,refresh:m},r[28]=l,r[29]=S,r[30]=_,r[31]=m,r[32]=d,r[33]=D,r[34]=O,r[35]=k):k=r[35],k}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&&ue(e.environmentId,`diagnostics:read`)}var $=e(l(),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=N(`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=N(`[&_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=N(`[&_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=N(`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=N(`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=N(`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=s(e=>[...e(ce.presentationsAtom)].map(([t,n])=>{let r=e(H.settingsValueAtom(t)),i=e(U.sessionStateAtom(t)),a=E(k(i)),o=i._tag===`Failure`?`denied`:a===null?i.waiting?`pending`:`denied`:w(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:s,initialModel:c,onOpenChange:l}=e,u=g(Yt),[f,p]=(0,Z.useState)(s),m;if(t[0]!==u||t[1]!==f){let e;t[3]===f?e=t[4]:(e=e=>f===null||f.has(e.environmentId),t[3]=f,t[4]=e),m=u.filter(e),t[0]=u,t[1]=f,t[2]=m}else m=t[2];let h=m,_;t[5]!==c||t[6]!==h?(_=()=>c===void 0||h.some(e=>Object.hasOwn(e.prices??{},c)||Object.hasOwn(e.aliases??{},c))?[]:[{id:`new:initial`,model:c,isNew:!0,values:{}}],t[5]=c,t[6]=h,t[7]=_):_=t[7];let[b,x]=(0,Z.useState)(_),[S,C]=(0,Z.useState)(!1),[w,T]=(0,Z.useState)(null),E=(0,Z.useRef)(null),D=(0,Z.useRef)(0),O;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(O={reportFailure:!1},t[8]=O):O=t[8];let k=de(H.updateSettings,O),A,P,F,I,L,R,z,ne,re,ie,ae,oe,se,ce,le;if(t[9]!==w||t[10]!==b||t[11]!==u||t[12]!==l||t[13]!==S||t[14]!==h||t[15]!==f||t[16]!==k||t[17]!==n){let e=[...new Set(h.flatMap(mn))].sort(),s;t[33]===h?s=t[34]:(s=e=>h.some(t=>t.environmentId===e.environmentId),t[33]=h,t[34]=s);let c=[...new Set([...e,...n.filter(s).flatMap(fn)])].sort(),m;t[35]===b?m=t[36]:(m=new Set(b.filter(dn).map(un)),t[35]=b,t[36]=m);let g=m,_;t[37]!==w||t[38]!==g?(_=e=>w===null||!g.has(e),t[37]=w,t[38]=g,t[39]=_):_=t[39];let O=[...e.filter(_).map(e=>b.find(t=>t.id===`model:${e}`)??{id:`model:${e}`,model:e,isNew:!1,values:{}}),...b.filter(ln)],H=b.filter(cn);R=qt(h,H);for(let t of H)t.isNew&&(t.model.trim()===``?R.set(t.id,`Enter a model ID.`):w===null&&(e.includes(t.model.trim())||b.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=w?.destinations.filter(e=>w.results.get(e.environmentId)?.status===`failed`)??[];let U=S||z.length>0;ne=H.length>0,I=h.length===1?h[0].label:`${h.length} environments`;let de=f===null?`All environments`:I,fe;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(fe=()=>{x([]),T(null)},t[40]=fe):fe=t[40],L=fe;let pe;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(pe=e=>{p(e),T(null)},t[41]=pe):pe=t[41];let W=pe,G;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(G=e=>{x(t=>t.some(t=>t.id===e.id)?t.map(t=>t.id===e.id?e:t):[...t,e]),T(null)},t[42]=G):G=t[42];let me=G,K=sn,he;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(he=e=>{!e.isNew&&Object.keys(e.values).length===0&&e.alias===void 0?x(t=>t.filter(t=>t.id!==e.id)):me(e)},t[43]=he):he=t[43];let ge=he,q;t[44]===h?q=t[45]:(q=(e,t,n)=>{let r={...e.values,[t]:n},i=Gt(h,e.model,t);K(e,i,n)&&delete r[t],ge({...e,values:r})},t[44]=h,t[45]=q);let J=q,Y;t[46]===h?Y=t[47]:(Y=(e,t)=>{let{alias:n,...r}=e,i=Wt(h,e.model);ge(K(e,i,t)?r:{...r,alias:t})},t[46]=h,t[47]=Y);let _e=Y;re=async e=>{let t=e!==void 0&&e;if(S)return;let n=t?z:h,r=t&&w?w.drafts:H;if(n.length===0||r.length===0)return;let i=n.map(e=>u.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)]));C(!0),T(e=>({drafts:r,destinations:t&&e?e.destinations:i,results:new Map([...t&&e?e.results:[],...i.map(on)])}));let o=!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=>ue(e.environmentId,`settings:write`)?k(e):{_tag:`Failure`},onResult:(e,t)=>{t.status===`failed`&&(o=!0),T(n=>n===null?null:{...n,results:new Map(n.results).set(e,t)})}}),C(!1),o||x([])},F=ke,ce=!0,t[48]!==l||t[49]!==S?(le=e=>{S||l(e)},t[48]=l,t[49]=S,t[50]=le):le=t[50],P=Oe,oe=`max-w-4xl`,t[51]===Symbol.for(`react.memo_cache_sentinel`)?(se=(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]=se):se=t[51],A=Ee;let ve;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,$.jsx)(Ue,{id:`usage-prices-apply-label`,className:`shrink-0`,children:`Apply to`}),t[52]=ve):ve=t[52];let X;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,$.jsx)(M,{variant:`outline`,size:`sm`,className:`min-w-0`}),t[53]=X):X=t[53];let ye=S||ne,be;t[54]===de?be=t[55]:(be=(0,$.jsx)(`span`,{id:`usage-prices-selection`,className:`truncate`,children:de}),t[54]=de,t[55]=be);let Se;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,$.jsx)(r,{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)(j,{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=f===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)(d,{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)(ee,{}),t[63]=Ne):Ne=t[63];let Pe;if(t[64]!==u||t[65]!==h||t[66]!==f){let e;t[68]!==u.length||t[69]!==h||t[70]!==f?(e=e=>(0,$.jsx)(d,{checked:f===null||f.has(e.environmentId),closeOnClick:!1,onCheckedChange:t=>{let n=new Set(h.map(rn));t?n.add(e.environmentId):n.delete(e.environmentId),W(n.size===u.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]=u.length,t[69]=h,t[70]=f,t[71]=e):e=t[71],Pe=u.map(e),t[64]=u,t[65]=h,t[66]=f,t[67]=Pe}else Pe=t[67];let Fe;t[72]!==Me||t[73]!==Pe?(Fe=(0,$.jsxs)(v,{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:[ve,(0,$.jsxs)(o,{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?ie=t[80]:(ie=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[Ie,Le]}),t[79]=Ie,t[80]=ie),ae=h.length===0?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:u.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)(M,{size:`icon-xs`,variant:`ghost`,"aria-label":`Add model price`,disabled:U,onClick:()=>{D.current+=1;let e=`new:${D.current}`;E.current=e,me({id:e,model:``,isNew:!0,values:{}})},children:(0,$.jsx)(y,{"aria-hidden":!0})})})]})}),(0,$.jsx)(Pt,{children:O.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:h.some(en)?`Some environment prices are unavailable.`:`No custom prices or mappings. Add a row to set one.`})})}):O.map(e=>{let t=Wt(h,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&&E.current===e.id&&(t.focus(),E.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=>me({...e,model:t.target.value})}):(0,$.jsx)(`span`,{className:N(`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=>_e(e,t.target.value)})}),e.removed?null:n===``?Rt.map(t=>{let n=Gt(h,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)(te,{children:[(0,$.jsx)(B,{render:(0,$.jsx)(M,{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?x(t=>t.filter(t=>t.id!==e.id)):e.removed?ge({...e,removed:!1}):me({...e,removed:!0})},children:e.isNew?(0,$.jsx)(i,{"aria-hidden":!0}):(0,$.jsx)(a,{"aria-hidden":!0})}),(0,$.jsx)(V,{children:e.removed?`Undo reset`:e.isNew?`Remove row`:`Reset to automatic`})]})})]},e.id)})})]})}),(0,$.jsx)(`datalist`,{id:`usage-price-models`,children:c.filter(t=>!e.includes(t)).map(Qt)}),(0,$.jsx)(`datalist`,{id:`usage-alias-models`,children:c.filter(e=>h.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.`,h.length>1?` Mixed cells keep each environment’s rate until you edit them.`:``]})]}),t[9]=w,t[10]=b,t[11]=u,t[12]=l,t[13]=S,t[14]=h,t[15]=f,t[16]=k,t[17]=n,t[18]=A,t[19]=P,t[20]=F,t[21]=I,t[22]=L,t[23]=R,t[24]=z,t[25]=ne,t[26]=re,t[27]=ie,t[28]=ae,t[29]=oe,t[30]=se,t[31]=ce,t[32]=le}else A=t[18],P=t[19],F=t[20],I=t[21],L=t[22],R=t[23],z=t[24],ne=t[25],re=t[26],ie=t[27],ae=t[28],oe=t[29],se=t[30],ce=t[31],le=t[32];let U;t[81]===w?U=t[82]:(U=w?(0,$.jsx)(`div`,{role:`status`,className:`grid gap-1 text-xs`,children:w.destinations.map(e=>{let t=w.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]=w,t[82]=U);let fe;t[83]!==A||t[84]!==U||t[85]!==ie||t[86]!==ae?(fe=(0,$.jsxs)(A,{children:[ie,ae,U]}),t[83]=A,t[84]=U,t[85]=ie,t[86]=ae,t[87]=fe):fe=t[87];let pe=ne?`Changes apply to ${I}`:``,W;t[88]===pe?W=t[89]:(W=(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:pe}),t[88]=pe,t[89]=W);let G;t[90]!==L||t[91]!==z.length||t[92]!==ne||t[93]!==S?(G=ne?(0,$.jsx)(M,{variant:`ghost`,disabled:S,onClick:L,children:z.length>0?`Discard pending changes`:`Discard changes`}):null,t[90]=L,t[91]=z.length,t[92]=ne,t[93]=S,t[94]=G):G=t[94];let me=S||!ne&&z.length===0||z.length===0&&(R.size>0||h.length===0),K;t[95]!==z.length||t[96]!==re?(K=()=>void re(z.length>0),t[95]=z.length,t[96]=re,t[97]=K):K=t[97];let he=S?`Saving…`:z.length>0?`Retry failed saves`:`Save changes`,ge;t[98]!==me||t[99]!==K||t[100]!==he?(ge=(0,$.jsx)(M,{disabled:me,onClick:K,children:he}),t[98]=me,t[99]=K,t[100]=he,t[101]=ge):ge=t[101];let q;t[102]!==G||t[103]!==ge?(q=(0,$.jsxs)(`div`,{className:`flex w-full flex-wrap justify-end gap-2 sm:w-auto`,children:[G,ge]}),t[102]=G,t[103]=ge,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]!==fe||t[110]!==J||t[111]!==oe||t[112]!==se?(Y=(0,$.jsxs)(P,{className:oe,children:[se,fe,J]}),t[108]=P,t[109]=fe,t[110]=J,t[111]=oe,t[112]=se,t[113]=Y):Y=t[113];let _e;return t[114]!==F||t[115]!==Y||t[116]!==ce||t[117]!==le?(_e=(0,$.jsx)(F,{open:ce,onOpenChange:le,children:Y}),t[114]=F,t[115]=Y,t[116]=ce,t[117]=le,t[118]=_e):_e=t[118],_e}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=qe.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=qe.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 j=A,M,ee;t[13]===g?(M=t[14],ee=t[15]):(M=()=>{if(g===null)return;j();let e=v.current,t=y.current;if(e!==null&&t!==null)return je([e,t],j)},ee=[g,j],t[13]=g,t[14]=M,t[15]=ee),(0,Z.useLayoutEffect)(M,ee);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},j(),_(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`?ge(e,d):fe(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?pe(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 ce;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:Xe[t].color,fillOpacity:.12},t)},t[46]=e):e=t[46],ce=w.map(e),t[44]=w,t[45]=ce}else ce=t[45];let H;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:Xe[t].color,strokeWidth:2,vectorEffect:`non-scaling-stroke`},t)},t[49]=e):e=t[49],H=w.map(e),t[47]=w,t[48]=H}else H=t[48];let le;t[50]!==g||t[51]!==T?(le=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]=le):le=t[52];let ue;t[53]!==oe||t[54]!==se||t[55]!==ce||t[56]!==H||t[57]!==le?(ue=(0,$.jsxs)(`svg`,{className:`h-full w-full`,viewBox:`0 0 ${hn} ${gn}`,preserveAspectRatio:`none`,role:`img`,"aria-label":oe,children:[se,ce,H,le]}),t[53]=oe,t[54]=se,t[55]=ce,t[56]=H,t[57]=le,t[58]=ue):ue=t[58];let U;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?(U=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}=Xe[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:N(`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:N(`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]=U):U=t[67];let de;t[68]!==F||t[69]!==ue||t[70]!==U?(de=(0,$.jsxs)(`div`,{ref:v,className:`relative h-56 flex-1`,onMouseMove:F,onMouseLeave:ae,children:[ue,U]}),t[68]=F,t[69]=ue,t[70]=U,t[71]=de):de=t[71];let G;t[72]!==ie||t[73]!==de?(G=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[ie,de]}),t[72]=ie,t[73]=de,t[74]=G):G=t[74];let me;t[75]!==V||t[76]!==p[0]?(me=p[0]===void 0?``:V(p[0]),t[75]=V,t[76]=p[0],t[77]=me):me=t[77];let he;t[78]===me?he=t[79]:(he=(0,$.jsx)(`span`,{children:me}),t[78]=me,t[79]=he);let q;t[80]!==V||t[81]!==p?(q=p[Math.floor(p.length/2)]===void 0?``:V(p[Math.floor(p.length/2)]??``),t[80]=V,t[81]=p,t[82]=q):q=t[82];let J;t[83]===q?J=t[84]:(J=(0,$.jsx)(`span`,{children:q}),t[83]=q,t[84]=J);let Y;t[85]!==V||t[86]!==p?(Y=p[p.length-1]===void 0?``:V(p[p.length-1]??``),t[85]=V,t[86]=p,t[87]=Y):Y=t[87];let _e;t[88]===Y?_e=t[89]:(_e=(0,$.jsx)(`span`,{children:Y}),t[88]=Y,t[89]=_e);let ve;t[90]!==he||t[91]!==J||t[92]!==_e?(ve=(0,$.jsxs)(`div`,{className:`flex justify-between pl-16 text-3xs text-muted-foreground uppercase`,children:[he,J,_e]}),t[90]=he,t[91]=J,t[92]=_e,t[93]=ve):ve=t[93];let X;return t[94]!==G||t[95]!==ve?(X=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[G,ve]}),t[94]=G,t[95]=ve,t[96]=X):X=t[96],X}function Mn(e){return N(`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)(te,{children:[(0,$.jsx)(B,{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)(V,{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=Xe[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 w;t[38]!==C||t[39]!==x?(w=(0,$.jsxs)(Ce,{children:[x,C]}),t[38]=C,t[39]=x,t[40]=w):w=t[40];let T;t[41]===_?T=t[42]:(T=(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]=T);let E=h?`tokens`:i,D;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]!==E||t[50]!==u.daily||t[51]!==u.hourly?(D=(0,$.jsx)(jn,{providers:f,days:a.days,daily:u.daily,hours:a.hours,hourly:u.hourly,metric:E,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]=E,t[50]=u.daily,t[51]=u.hourly,t[52]=D):D=t[52];let O;t[53]!==h||t[54]!==u.categoryCost?(O=h?null:(0,$.jsx)(Fn,{label:`Cost by type`,segments:Wn(u.categoryCost),format:W}),t[53]=h,t[54]=u.categoryCost,t[55]=O):O=t[55];let k;t[56]===n.tokens?k=t[57]:(k=Gn(n.tokens),t[56]=n.tokens,t[57]=k);let A;t[58]===k?A=t[59]:(A=(0,$.jsx)(Fn,{label:`Tokens by type`,segments:k,format:K}),t[58]=k,t[59]=A);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 N;t[62]!==O||t[63]!==A||t[64]!==j?(N=(0,$.jsxs)(`div`,{className:`grid gap-x-10 gap-y-8 sm:grid-cols-2`,children:[O,A,j]}),t[62]=O,t[63]=A,t[64]=j,t[65]=N):N=t[65];let ee;t[66]!==T||t[67]!==D||t[68]!==N?(ee=(0,$.jsx)(Ee,{children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[T,D,N]})}),t[66]=T,t[67]=D,t[68]=N,t[69]=ee):ee=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)(M,{onClick:o,children:`Set price`})]}):null,t[70]=n.unpricedTokens,t[71]=o,t[72]=P):P=t[72];let F;t[73]!==w||t[74]!==ee||t[75]!==P?(F=(0,$.jsxs)(Oe,{className:`max-w-3xl`,children:[w,ee,P]}),t[73]=w,t[74]=ee,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=`t3code:usage-page-preferences:v1`,Qn=P({metric:S([`cost`,`tokens`,`limits`]),windowDays:S([1,7,30,90]),hiddenProviders:c(T(f))}),$n={metric:`limits`,windowDays:30};function er(){try{return O(Zn,Qn)??$n}catch(e){return console.error(`Could not read Usage page preferences.`,e),$n}}function tr(e){try{b(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=>Xe[e].label;function ar(){let[e,t]=(0,Z.useState)(er);se();let n=g(le),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,_]=(0,Z.useState)(null),[v,y]=(0,Z.useState)(null),[b,S]=(0,Z.useState)(null),C=(0,Z.useMemo)(()=>new Set(e.hiddenProviders),[e.hiddenProviders]),{days:w,window:T}=i,E=w===1,{merged:O,environments:k,selectedEnvironments:A,shown:j,isPartial:ee,refresh:P}=Dt(T,b,C),F=j?.merged??O,I=j?.window??T,L=I.resolution===`hour`,R=c&&!s,z=j!==null&&j.window!==T,B=(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=>!C.has(e)));return{partial:e.everyProvider||t.size>0,everyProvider:e.everyProvider,providers:t}},[z,R,A,C]),V=e=>B.everyProvider||B.providers.has(e),te=g(ce.presentationsAtom),ue=C.has(`cursor`)?[]:at(A),U=[...new Set(A.flatMap(e=>e.summary?.sources.flatMap(e=>e.message&&!e.action&&!C.has(e.fingerprint.provider)&&(e.status===`partial`||e.status===`failed`||e.fingerprint.provider===`cursor`)?[e.message]:[])??[]))],pe=de(H.refreshProviders,{reportFailure:!1}),_e=A.some(e=>e.canReadDiagnostics),X=(0,Z.useMemo)(()=>Y(I.sinceDay,I.untilDay),[I.sinceDay,I.untilDay]),xe=(0,Z.useMemo)(()=>I.sinceTime===void 0||I.untilTime===void 0?[]:he(I.sinceTime,I.untilTime),[I.sinceTime,I.untilTime]),Ce=(0,Z.useMemo)(()=>(L?F.hourly:F.daily).toReversed(),[L,F.daily,F.hourly]),we=(0,Z.useMemo)(()=>p===`model`&&o===`tokens`?Rn(F.models):F.models,[p,F.models,o]),Te=(0,Z.useMemo)(()=>Ke(F.providers),[F.providers]),Ee=(0,Z.useMemo)(()=>qe.filter(e=>Te.includes(e)||B.providers.has(e)),[B.providers,Te]),De=(0,Z.useMemo)(()=>new Set(Ee.filter(e=>B.everyProvider||B.providers.has(e))),[Ee,B.everyProvider,B.providers]),Oe=v===null?void 0:F.models.find(e=>`${e.provider}:${e.model}`===v),ke=we.reduce((e,t)=>Math.max(e,o===`tokens`?t.totalTokens:t.costUsd),0),je=Ee.map(e=>({kind:`usage`,provider:e})),Le=Math.max(Ee.indexOf(`codex`),Ee.indexOf(`claude`))+1;je.splice(Le,0,...ue.map(e=>({kind:`enable`,environment:e})));let Ue=`${60/(Ee.length+2)}%`,Qe=n=>{let r={...e,...n};t(r),tr(r)},nt=e=>{rr(e)&&(Qe({windowDays:e}),a({days:e,window:G(e,void 0,e===1?`hour`:`day`)}))},Q=e=>{e===`limits`&&d(Date.now()),Qe({metric:e})},rt=async(e=!1,t=!1)=>{try{await Promise.all(Array.from(te,([n,r])=>{if((b===null||b.has(n))&&r.connection.phase===`connected`&&r.serverConfig!==null)return ct(n,()=>pe({environmentId:n,input:{}}),e,t)}))}finally{d(Date.now())}},it=(0,Z.useEffectEvent)(e=>{if(e.defaultPrevented||e.repeat||e.isComposing||Ye()||We())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&&Q(r.value),i&&!s&&nt(i.days))});(0,Z.useEffect)(()=>(globalThis.window.addEventListener(`keydown`,it,!0),()=>globalThis.window.removeEventListener(`keydown`,it,!0)),[]);let ot=()=>{if(f.current)return;if(s){f.current=!0,l(!0),rt().finally(()=>{f.current=!1,l(!1)});return}let e=G(w,void 0,E?`hour`:`day`);(e.sinceDay!==T.sinceDay||e.untilDay!==T.untilDay||e.sinceTime!==T.sinceTime||e.untilTime!==T.untilTime)&&a({days:w,window:e}),f.current=!0,l(!0),P(e).finally(()=>{f.current=!1,l(!1)})},st=[...te].filter(([e,t])=>t.connection.phase===`connected`&&t.serverConfig!==null&&(b===null||b.has(e))).map(([e])=>e).sort().join(`,`),lt=(0,Z.useEffectEvent)(()=>{rt(!0)});(0,Z.useEffect)(()=>{s&&st&&lt()},[s,st]);let ut=L&&I.sinceTime!==void 0&&I.untilTime!==void 0?`${me(I.sinceTime,I.timeZone)} to ${me(I.untilTime,I.timeZone)}`:`${fe(I.sinceDay)} to ${fe(I.untilDay)}`,dt=(0,$.jsxs)(`div`,{className:`grid w-full min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 py-2 xl: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:k,selectedEnvironments:A,selectedEnvironmentIds:b,onSelectionChange:S,showUsageStatus:!s,refreshing:R,isPartial:ee,duplicateSources:F.duplicateSources,contractMismatches:F.contractMismatches,onOpenModelPrices:()=>_({})})}),(0,$.jsx)(et,{}),(0,$.jsx)($e,{current:!0,className:`min-w-10`,children:(0,$.jsx)(xr,{hiddenProviders:C,onChange:e=>Qe({hiddenProviders:e})})})]}),s?null:(0,$.jsx)(`span`,{className:`hidden min-w-0 truncate text-xs text-muted-foreground 2xl:block`,children:ut}),(0,$.jsxs)(`div`,{className:`ms-auto hidden min-w-0 items-center justify-end gap-2 xl:flex`,children:[(0,$.jsx)(ye,{"aria-label":`Usage metric`,variant:`segmented`,value:[o],onValueChange:e=>{let t=e[0];nr(t)&&Q(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(w)],disabled:s,onValueChange:e=>{let t=e[0];t&&nt(Number(t))},children:Be.map(e=>(0,$.jsx)(be,{value:String(e.days),title:r(e),children:e.label},e.days))}),(0,$.jsx)(M,{onClick:ot,"aria-label":s?`Refresh limits`:`Refresh usage`,"aria-busy":c,disabled:c||!s&&!_e,size:`icon-sm`,variant:`ghost`,children:(0,$.jsx)(Je,{size:`sm`,refreshing:c})})]}),(0,$.jsxs)(`div`,{className:`ms-auto flex min-w-0 items-center justify-end gap-1 xl:hidden`,children:[(0,$.jsxs)(oe,{value:o,onValueChange:e=>{nr(e)&&Q(e)},children:[(0,$.jsx)(ae,{"aria-label":`Usage metric`,size:`compact`,variant:`ghost`,className:`w-auto min-w-0`,children:(0,$.jsx)(re,{children:He.find(e=>e.value===o)?.label})}),(0,$.jsx)(ie,{align:`end`,alignItemWithTrigger:!1,children:He.map(e=>(0,$.jsx)(ne,{value:e.value,title:r(e),children:e.label},e.value))})]}),(0,$.jsxs)(oe,{value:String(w),disabled:s,onValueChange:e=>nt(Number(e)),children:[(0,$.jsx)(ae,{"aria-label":`Usage period`,size:`compact`,variant:`ghost`,className:`w-auto min-w-0`,children:(0,$.jsx)(re,{children:Be.find(e=>e.days===w)?.label})}),(0,$.jsx)(ie,{align:`end`,alignItemWithTrigger:!1,children:Be.map(e=>(0,$.jsx)(ne,{value:String(e.days),title:r(e),children:e.label},e.days))})]}),(0,$.jsx)(M,{onClick:ot,"aria-label":s?`Refresh limits`:`Refresh usage`,"aria-busy":c,disabled:c||!s&&!_e,size:`icon-sm`,variant:`ghost`,children:(0,$.jsx)(Je,{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:ve,children:dt}),(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:k.length===0?`Connect an environment to see ${s?`limits`:`usage`}.`:`Select an environment to see ${s?`limits`:`usage`}.`}):s?(0,$.jsx)(Ge,{selectedEnvironmentIds:b,hiddenProviders:C,now:u,cursorPrompt:ue.length>0?(0,$.jsx)(lr,{environments:ue,onEnabled:()=>{P(),rt(!1,!0)}}):null}):j===null?(0,$.jsx)(Sr,{}):_e?(0,$.jsxs)(`div`,{"aria-busy":B.partial,className:`flex flex-col gap-6`,children:[U.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:N(`text-4xl font-semibold text-foreground tabular-nums`,dr(B.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(B.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)(x,{tone:`muted`}),"aria-label":`Unpriced usage details`,children:(0,$.jsx)(D,{className:`size-3`,"aria-hidden":!0})}),(0,$.jsxs)(Ne,{side:`top`,tooltipStyle:!0,children:[`API estimate excludes`,` `,J(F.costQuality.unpricedShare),` unpriced records.`]})]})]})]}),!C.has(`codex`)&&[...te].some(([e,t])=>(b===null||b.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,je.map(e=>{if(e.kind===`enable`)return(0,$.jsx)(cr,{environmentId:e.environment.environmentId,label:e.environment.label,showEnvironment:A.length>1,onEnabled:()=>{P(),rt(!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=V(t),c=s&&!Te.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:Xe[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:Xe[t].label}),(0,$.jsx)(`span`,{className:N(`shrink-0 whitespace-nowrap text-2xs text-muted-foreground tabular-nums`,dr(s),c&&`invisible`),children:a})]})]}),(0,$.jsx)(`span`,{className:N(`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:N(`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:Ee,loadingProviders:De,days:X,daily:F.daily,hours:xe,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:B.partial,label:`Processed tokens`,value:K(F.totalTokens)}),(0,$.jsx)(fr,{loading:B.partial,label:`Cached input`,value:K(F.cachedInputTokens)}),(0,$.jsx)(fr,{loading:B.partial,label:`Uncached input`,value:K(F.uncachedInputTokens)}),(0,$.jsx)(fr,{loading:B.partial,label:`Output`,value:K(F.outputTokens)}),(0,$.jsx)(fr,{loading:B.partial,label:`Cache savings`,value:W(F.costQuality.cacheSavingsUsd)})]})]}),F.totalTokens>0?(0,$.jsx)(`section`,{className:N(`grid gap-x-12 gap-y-8 lg:grid-cols-2`,dr(B.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:we.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.`})}):we.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(V(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:()=>y(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:N(`mt-1.5 h-0.5 max-w-48`,a),children:(0,$.jsx)(`div`,{className:`h-full rounded-full`,style:{width:r>0&&ke>0?`max(0.5rem, ${r/ke*100}%)`:0,backgroundColor:Xe[e.provider].color}})})]}),(0,$.jsx)(`td`,{className:N(`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:N(`hidden py-2.5 pl-6 sm:table-cell`,a),children:i===null?``:J(i)}),(0,$.jsx)(`td`,{className:N(`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`}),Ee.map(e=>(0,$.jsx)(`col`,{style:{width:Ue}},e)),(0,$.jsx)(`col`,{style:{width:Ue}}),(0,$.jsx)(`col`,{style:{width:Ue}})]}),(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`}),Ee.map(e=>(0,$.jsx)(`th`,{className:`py-2 text-right font-normal`,children:Xe[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:Ce.length===0?(0,$.jsx)(`tr`,{children:(0,$.jsx)(`td`,{colSpan:Ee.length+3,className:`py-6 text-center text-muted-foreground`,children:`No activity in this window.`})}):Ce.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?ge(e.hourStart,I.timeZone):fe(e.day)}),Ee.map(t=>(0,$.jsx)(`td`,{className:N(`py-2 text-right text-muted-foreground tabular-nums`,dr(V(t))),children:W(e.byProvider.get(t)?.costUsd??0)},t)),(0,$.jsx)(`td`,{className:N(`py-2 text-right text-foreground tabular-nums`,dr(B.partial)),children:W(e.costUsd)}),(0,$.jsx)(`td`,{className:N(`py-2 text-right text-muted-foreground tabular-nums`,dr(B.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))})})})]}),Oe!==void 0&&!s?(0,$.jsx)(qn,{model:Oe,environments:A,metric:o===`tokens`?`tokens`:`cost`,chartWindow:{days:X,hours:xe,resolution:L?`hour`:`day`,timeZone:I.timeZone,referenceTime:I.untilTime},onSetPrice:()=>{y(null),_({model:Oe.model})},onClose:()=>y(null)}):null,h?(0,$.jsx)(Xt,{usage:k,initialSelectedEnvironmentIds:b,initialModel:h.model,onOpenChange:e=>{e||_(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=de(H.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)(x,{disabled:o,"aria-busy":o,"aria-label":`Enable Cursor usage from ${t}`,onClick:()=>void c(),children:i}):(0,$.jsx)(M,{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)(te,{children:[(0,$.jsx)(B,{render:l}),(0,$.jsx)(V,{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:Xe.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:u.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 o;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],o=n.map(e),t[2]=n,t[3]=r,t[4]=o}else o=t[4];let s;return t[8]===o?s=t[9]:(s=(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:o})]})]}),t[8]=o,t[9]=s),s}function ur(e){let t=(0,Q.c)(4),{provider:n,className:r}=e,i=Xe[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 N(`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=N(`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:_e(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:i,selectedEnvironmentIds:a,onSelectionChange:s,showUsageStatus:c,refreshing:l,isPartial:u,duplicateSources:f,contractMismatches:p,onOpenModelPrices:m}=e,h=a===null,g=h?`All environments`:i.length===1?i[0].label:`${i.length} environments`,y;t[0]!==p||t[1]!==i?(y=i.some(br)||p.length>0,t[0]=p,t[1]=i,t[2]=y):y=t[2];let b=y,S;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(x,{}),t[3]=S):S=t[3];let C;t[4]===g?C=t[5]:(C=(0,$.jsx)(Qe,{children:g}),t[4]=g,t[5]=C);let w;t[6]!==b||t[7]!==c?(w=(0,$.jsx)(`span`,{className:`flex size-3.5 shrink-0 items-center justify-center text-muted-foreground`,children:c&&b?(0,$.jsx)(A,{className:`size-3.5 text-warning-foreground`,"aria-label":`Some environments could not report usage`}):(0,$.jsx)(r,{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]=b,t[7]=c,t[8]=w):w=t[8];let T;t[9]!==C||t[10]!==w?(T=(0,$.jsxs)(j,{render:S,className:`group/usage-environment min-w-0 max-w-full`,children:[C,w]}),t[9]=C,t[10]=w,t[11]=T):T=t[11];let E;t[12]===s?E=t[13]:(E=e=>s(e?null:new Set),t[12]=s,t[13]=E);let D;t[14]!==h||t[15]!==E?(D=(0,$.jsx)(d,{checked:h,closeOnClick:!1,onCheckedChange:E,children:`All environments`}),t[14]=h,t[15]=E,t[16]=D):D=t[16];let O;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(ee,{}),t[17]=O):O=t[17];let k;if(t[18]!==n||t[19]!==s||t[20]!==l||t[21]!==a||t[22]!==i||t[23]!==c){let e;t[25]!==n.length||t[26]!==s||t[27]!==l||t[28]!==a||t[29]!==i||t[30]!==c?(e=e=>{let t=a===null||a.has(e.environmentId),r=ut(e,l),o=e.error===null?e.summary!==null&&!bt(e.summary.contractVersion,6)?`Update required`:e.isConnected?r.phase===`loading`?`Scanning…`:r.phase===`stale`?`Refreshing…`:r.phase===`partway`?dt(r.providers,ir):`Ready`:`Connecting…`:`Unavailable`;return(0,$.jsx)(d,{checked:t,closeOnClick:!1,onCheckedChange:t=>{let r=new Set(i.map(yr));t?r.add(e.environmentId):r.delete(e.environmentId),s(r.size===n.length?null:r)},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}),c?(0,$.jsx)(`span`,{className:N(`shrink-0 text-xs text-muted-foreground`,e.error!==null&&`text-destructive`),children:o}):null]})},e.environmentId)},t[25]=n.length,t[26]=s,t[27]=l,t[28]=a,t[29]=i,t[30]=c,t[31]=e):e=t[31],k=n.map(e),t[18]=n,t[19]=s,t[20]=l,t[21]=a,t[22]=i,t[23]=c,t[24]=k}else k=t[24];let M;t[32]===n.length?M=t[33]:(M=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]=M);let P;t[34]!==u||t[35]!==c?(P=c&&u?(0,$.jsx)(`p`,{className:`px-2 py-2 text-xs text-muted-foreground`,children:`Totals are partial while selected environments scan.`}):null,t[34]=u,t[35]=c,t[36]=P):P=t[36];let I;t[37]!==p||t[38]!==f||t[39]!==i||t[40]!==c?(I=c?(0,$.jsx)(pr,{environments:i,duplicateSources:f,contractMismatches:p}):null,t[37]=p,t[38]=f,t[39]=i,t[40]=c,t[41]=I):I=t[41];let L;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(ee,{}),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]===m?z=t[45]:(z=(0,$.jsxs)(_,{onClick:m,children:[R,`Model prices`]}),t[44]=m,t[45]=z);let B;t[46]!==M||t[47]!==P||t[48]!==I||t[49]!==z||t[50]!==D||t[51]!==k?(B=(0,$.jsxs)(v,{align:`start`,children:[D,O,k,M,P,I,L,z]}),t[46]=M,t[47]=P,t[48]=I,t[49]=z,t[50]=D,t[51]=k,t[52]=B):B=t[52];let V;return t[53]!==B||t[54]!==T?(V=(0,$.jsxs)(o,{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:i}=e,a;t[0]===n?a=t[1]:(a=qe.filter(e=>!n.has(e)),t[0]=n,t[1]=a);let s=a,c=s.length===qe.length?`All providers`:s.length===0?`No providers`:s.length===1?Xe[s[0]].label:`${s.length} providers`,l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(x,{}),t[2]=l):l=t[2];let u;t[3]===c?u=t[4]:(u=(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:c}),t[3]=c,t[4]=u);let f;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(r,{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]=f):f=t[5];let p;t[6]===u?p=t[7]:(p=(0,$.jsxs)(j,{render:l,className:`group/usage-provider min-w-0 max-w-full`,children:[u,f]}),t[6]=u,t[7]=p);let m=n.size===0,h;t[8]===i?h=t[9]:(h=e=>i(e?[]:qe),t[8]=i,t[9]=h);let g;t[10]!==m||t[11]!==h?(g=(0,$.jsx)(d,{checked:m,closeOnClick:!1,onCheckedChange:h,children:`All providers`}),t[10]=m,t[11]=h,t[12]=g):g=t[12];let _;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(ee,{}),t[13]=_):_=t[13];let y;t[14]!==n||t[15]!==i?(y=qe.map(e=>(0,$.jsx)(d,{checked:!n.has(e),closeOnClick:!1,onCheckedChange:t=>i(qe.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:Xe[e].label})]})},e)),t[14]=n,t[15]=i,t[16]=y):y=t[16];let b;t[17]!==y||t[18]!==g?(b=(0,$.jsxs)(v,{align:`start`,children:[g,_,y]}),t[17]=y,t[18]=g,t[19]=b):b=t[19];let S;return t[20]!==b||t[21]!==p?(S=(0,$.jsxs)(o,{children:[p,b]}),t[20]=b,t[21]=p,t[22]=S):S=t[22],S}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`})]}),qe.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-Cuwnw3mn.js.map
@@ -1,2 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{a as n}from"./useParams-CYkWvywV.js";var r=e(t(),1);function i(e){let t=n();return r.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}export{i as t};
2
- //# sourceMappingURL=useNavigate-NmIi-1RV.js.map
@@ -1,3 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{D as n,KC as r,Lo as i,Ls as a,Oc as o,Vo as s,Zg as c,dE as l,ds as u,fT as d,i_ as f,l_ as p,ms as m,os as h}from"./utils-vKlT_s3D.js";import{M as g,U as _,j as v}from"./runtime-BVzm9sLS.js";import{a as y,i as b}from"./vcsRefInvalidation-CC_2_Ufo.js";import{C as ee}from"./entities-Dzl1j2jY.js";import{t as te}from"./runtime-B-UcwNuZ.js";import{i as x}from"./toast-Bkc7xsho.js";import{O as S,f as C,s as w}from"./useSettings-DYKTOdxY.js";import{i as T,n as E}from"./session-CPQQ27HG.js";import{n as D}from"./query-fboCqXXy.js";import{t as O}from"./use-atom-command-JNR1Jqwn.js";import{d as k,l as A,u as j}from"./queries-BBd2XSpN.js";import{t as M}from"./sourceControl-B8VqenU-.js";import{C as N,r as P}from"./pullRequests-CEpTVk5m.js";import{L as F,v as ne,y as re}from"./pullRequestDetail.logic-BVBxawC1.js";import{c as ie,f as ae,i as I,s as L}from"./p4ProjectFile-CvON4UbU.js";import{t as R}from"./sidebarProjectGrouping-BGgp_M_h.js";import{n as z}from"./useHandleNewThread-vYbjmg4i.js";var B=e(t(),1),V=l();function H(e){return{pullRequestResolution:g(e,{label:`environment-data:git:resolve-pull-request`,tag:o.gitResolvePullRequest}),preparePullRequestThread:v(e,{label:`environment-data:git:prepare-pull-request-thread`,tag:o.gitPreparePullRequestThread,scheduler:y,concurrency:b})}}var U=H(te),W={init:`init`,pull:`pull`,publishRepository:`publish_repository`,runStackedAction:`run_change_request`,preparePullRequestThread:`prepare_pull_request_thread`};function G(e){let t=T(e.scope.environmentId,f),n=W[e.kind],a=s(A.stateAtom(e.scope)),o=a.operation===n,c=(0,B.useCallback)(()=>{A.resetError(i,e.scope,n)},[e.scope,n]),l=(0,B.useCallback)(async(...t)=>{if(e.scope.environmentId===null||!E(e.scope.environmentId,`source-control:write`))return h(r(new p({requiredScope:f,message:`This connection cannot change source control.`})));let a=async()=>{let n=await e.action(...t);return u(n)&&e.onSuccess?.(),n};return e.managedExternally===!0?a():A.track(i,e.scope,{operation:n,label:e.label},a)},[e.action,e.label,e.managedExternally,e.onSuccess,e.scope,n]);return{isAllowed:t,error:o?a.error:null,isPending:o&&a.isRunning,resetError:c,run:l}}function K(e){return e.environmentId===null||e.cwd===null?null:{environmentId:e.environmentId,cwd:e.cwd}}function q(e,t){let n=(0,V.c)(6),r;n[0]===e?r=n[1]:(r=A.stateAtom(e),n[0]=e,n[1]=r);let i=s(r),a;return n[2]!==t||n[3]!==i.isRunning||n[4]!==i.operation?(a=i.isRunning&&i.operation!==null&&t.some(e=>W[e]===i.operation),n[2]=t,n[3]=i.isRunning,n[4]=i.operation,n[5]=a):a=n[5],a}function J(e){let t=(0,V.c)(7),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={reportFailure:!1},t[0]=n):n=t[0];let i=O(j.init,n),a;t[1]!==i||t[2]!==e?(a=async()=>{let t=K(e);return t===null?h(r(new k({operation:`init`,environmentId:e.environmentId,cwd:e.cwd}))):i({environmentId:t.environmentId,input:{cwd:t.cwd}})},t[1]=i,t[2]=e,t[3]=a):a=t[3];let o=a,s;return t[4]!==o||t[5]!==e?(s={kind:`init`,label:`Initializing repository`,scope:e,action:o},t[4]=o,t[5]=e,t[6]=s):s=t[6],G(s)}function oe(e){let t=(0,V.c)(11),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={reportFailure:!1},t[0]=n):n=t[0];let i=O(j.pull,n),a;t[1]!==e.cwd||t[2]!==e.environmentId?(a=e.environmentId!==null&&e.cwd!==null?j.status({environmentId:e.environmentId,input:{cwd:e.cwd}}):null,t[1]=e.cwd,t[2]=e.environmentId,t[3]=a):a=t[3];let o=D(a),s;t[4]!==i||t[5]!==e?(s=async()=>{let t=K(e);return t===null?h(r(new k({operation:`pull`,environmentId:e.environmentId,cwd:e.cwd}))):i({environmentId:t.environmentId,input:{cwd:t.cwd}})},t[4]=i,t[5]=e,t[6]=s):s=t[6];let c=s,l;return t[7]!==c||t[8]!==e||t[9]!==o.refresh?(l={kind:`pull`,label:`Pulling latest changes...`,scope:e,action:c,onSuccess:o.refresh},t[7]=c,t[8]=e,t[9]=o.refresh,t[10]=l):l=t[10],G(l)}function se(e){let t=(0,V.c)(13),n;t[0]===e?n=t[1]:(n=A.runStackedAction(e),t[0]=e,t[1]=n);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i={reportFailure:!1},t[2]=i):i=t[2];let a=O(n,i),o;t[3]!==e.cwd||t[4]!==e.environmentId?(o=e.environmentId!==null&&e.cwd!==null?j.status({environmentId:e.environmentId,input:{cwd:e.cwd}}):null,t[3]=e.cwd,t[4]=e.environmentId,t[5]=o):o=t[5];let s=D(o),c;t[6]!==a||t[7]!==e?(c=async t=>K(e)===null?h(r(new k({operation:`run_change_request`,environmentId:e.environmentId,cwd:e.cwd}))):a(t),t[6]=a,t[7]=e,t[8]=c):c=t[8];let l=c,u;return t[9]!==l||t[10]!==e||t[11]!==s.refresh?(u={kind:`runStackedAction`,label:`Running source control action`,scope:e,action:l,onSuccess:s.refresh,managedExternally:!0},t[9]=l,t[10]=e,t[11]=s.refresh,t[12]=u):u=t[12],G(u)}function ce(e){let t=(0,V.c)(11),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={reportFailure:!1},t[0]=n):n=t[0];let i=O(M.publishRepository,n),a;t[1]!==e.cwd||t[2]!==e.environmentId?(a=e.environmentId!==null&&e.cwd!==null?j.status({environmentId:e.environmentId,input:{cwd:e.cwd}}):null,t[1]=e.cwd,t[2]=e.environmentId,t[3]=a):a=t[3];let o=D(a),s;t[4]!==i||t[5]!==e?(s=async t=>{let n=K(e);return n===null?h(r(new k({operation:`publish_repository`,environmentId:e.environmentId,cwd:e.cwd}))):i({environmentId:n.environmentId,input:{cwd:n.cwd,...t}})},t[4]=i,t[5]=e,t[6]=s):s=t[6];let c=s,l;return t[7]!==c||t[8]!==e||t[9]!==o.refresh?(l={kind:`publishRepository`,label:`Publishing repository`,scope:e,action:c,onSuccess:o.refresh},t[7]=c,t[8]=e,t[9]=o.refresh,t[10]=l):l=t[10],G(l)}function Y(e){let t=(0,V.c)(7),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={reportFailure:!1},t[0]=n):n=t[0];let i=O(U.preparePullRequestThread,n),a;t[1]!==i||t[2]!==e?(a=async t=>{let n=K(e);return n===null?h(r(new k({operation:`prepare_pull_request_thread`,environmentId:e.environmentId,cwd:e.cwd}))):t.mode===`worktree`&&t.threadId!==void 0&&!E(n.environmentId,`orchestration:operate`)?h(r(new p({requiredScope:c,message:`This connection cannot change threads.`}))):i({environmentId:n.environmentId,input:{cwd:n.cwd,reference:t.reference,mode:t.mode,...t.threadId?{threadId:t.threadId}:{}}})},t[1]=i,t[2]=e,t[3]=a):a=t[3];let o=a,s;return t[4]!==o||t[5]!==e?(s={kind:`preparePullRequestThread`,label:`Preparing pull request thread`,scope:e,action:o},t[4]=o,t[5]=e,t[6]=s):s=t[6],G(s)}function X(e){return e.environmentId===null||e.cwd===null||e.reference===null?null:d(m(i.get(U.pullRequestResolution({environmentId:e.environmentId,input:{cwd:e.cwd,reference:e.reference}}))))}function le(e){let t=(0,V.c)(12),n;t[0]!==e.cwd||t[1]!==e.environmentId||t[2]!==e.reference?(n=e.environmentId!==null&&e.cwd!==null&&e.reference!==null?U.pullRequestResolution({environmentId:e.environmentId,input:{cwd:e.cwd,reference:e.reference}}):null,t[0]=e.cwd,t[1]=e.environmentId,t[2]=e.reference,t[3]=n):n=t[3];let r=D(n),i;t[4]===e?i=t[5]:(i=X(e),t[4]=e,t[5]=i);let a=i,o=r.data??a,s=r.isPending&&a===null,c;return t[6]!==r.error||t[7]!==r.isPending||t[8]!==r.refresh||t[9]!==o||t[10]!==s?(c={data:o,error:r.error,isPending:s,isFetching:r.isPending,refresh:r.refresh},t[6]=r.error,t[7]=r.isPending,t[8]=r.refresh,t[9]=o,t[10]=s,t[11]=c):c=t[11],c}function ue(e,t){let n=(0,V.c)(10),r;n[0]===t?r=n[1]:(r=e=>I(e,t).settings.pullRequestMergeMethod,n[0]=t,n[1]=r);let i=C(e,r),a=w(de),o=w(ae),s=ee(),c=S(),l;return n[2]!==e||n[3]!==o||n[4]!==a||n[5]!==c||n[6]!==i||n[7]!==t||n[8]!==s?(l=()=>{if(i!=null)return i;if(Object.keys(a).length===0)return;let n=s.find(n=>n.environmentId===e&&n.id===t);if(!n)return;let r=R({projects:s,settings:o,primaryEnvironmentId:c}).get(ie(n))??L(n,o);return a[r]},n[2]=e,n[3]=o,n[4]=a,n[5]=c,n[6]=i,n[7]=t,n[8]=s,n[9]=l):l=n[9],l}function de(e){return e.pullRequestMergeMethodOverrides}var fe={merge:`Merge requested`,ready:`Marked ready for review`,draft:`Converted to draft`,close:`Pull request closed`,reopen:`Pull request reopened`,"update-branch":`Branch updated with the base branch`,"enable-auto-merge":`Auto-merge enabled`,"disable-auto-merge":`Auto-merge disabled`,revert:`Revert pull request opened`,"approve-workflows":`Workflows approved`},pe={merge:`Could not merge this pull request`,ready:`Could not mark this ready for review`,draft:`Could not convert this to a draft`,close:`Could not close this pull request`,reopen:`Could not reopen this pull request`,"update-branch":`Could not update this branch`,"enable-auto-merge":`Could not enable auto-merge`,"disable-auto-merge":`Could not disable auto-merge`,revert:`Could not open a revert pull request`,"approve-workflows":`Could not approve workflows`},Z={merge:`The host refused the merge. Check that you have write access, that the checks it requires have passed, and that the branch is not conflicting.`,ready:`The host refused it. Check that you have write access to this repository.`,draft:`The host refused it. Check that you have write access to this repository.`,close:`The host refused it. Check that you have write access, or that you opened it.`,reopen:`The host refused it. Check that you have write access, and that the branch still exists.`,"update-branch":`The host refused it. Check that you have write access, and that the base branch has not diverged in a way the host cannot merge.`,"enable-auto-merge":`The host refused it. Check that auto-merge is enabled for this repository and that you have write access.`,"disable-auto-merge":`The host refused it. Check that you have write access to this repository.`,revert:`The host refused it. Check that you have write access and that this pull request was merged on the host.`,"approve-workflows":`The host refused it. Check that you have Actions write access and that these workflow runs are still awaiting approval.`};function me({environmentId:e,reference:t,onSuccess:n,resolveMergeMethod:r}){let i=O(P.runAction,{reportFailure:!1}),[a,o]=(0,B.useState)(!1),s=(0,B.useRef)(!1);return{actionPending:a,perform:async(a,c)=>{if(!(s.current||t===null)){s.current=!0,o(!0);try{let o=await i({environmentId:e,input:{...t,action:a,...c?{mergeMethod:c}:r?{resolveMergeMethod:r}:{}}});if(o._tag===`Failure`)throw _(o);x.add({type:`success`,title:fe[a]}),n?.(a)}catch(e){x.add({type:`error`,title:pe[a],description:F(e,Z[a])})}finally{s.current=!1,o(!1)}}}}}function Q(e){let t=O(P.runAction,{reportFailure:!1}),n=(0,B.useRef)(new Set),[r,i]=(0,B.useState)(()=>new Set);return{close:(0,B.useCallback)(async r=>{let a=r.filter(e=>{let t=N(e);return e.state!==`open`||n.current.has(t)?!1:(n.current.add(t),!0)});if(a.length===0)return;i(new Set(n.current));let o=0,s=[];await Promise.all(a.map(async r=>{try{let n=await t({environmentId:r.environmentId,input:{projectId:r.projectId,host:r.host,repository:r.repository,number:r.number,action:`close`}});if(n._tag===`Failure`)throw _(n);o++,e(r)}catch(e){s.push(`#${r.number}: ${F(e,Z.close)}`)}finally{n.current.delete(N(r)),i(new Set(n.current))}})),x.add({type:s.length>0?`error`:`success`,title:s.length>0?`Closed ${o} of ${a.length} pull requests`:`Closed ${o} pull request${o===1?``:`s`}`,...s.length>0?{description:s.slice(0,3).join(`
2
- `)}:{}})},[e,t]),closingKeys:r}}var $=new Map;function he(e){let t=(0,V.c)(21),{environmentId:r,detail:i}=e,o=z(),s=i?.workspaceRoot??null,c;t[0]!==r||t[1]!==s?(c={environmentId:r,cwd:s},t[0]=r,t[1]=s,t[2]=c):c=t[2];let l=Y(c),[u,d]=(0,B.useState)(null),f;t[3]===o?f=t[4]:(f=async(e,t,r)=>{let i=r??await o(e).then(xe,be);if(i===null)return null;let a=n.getState();if(t===null)return i;let s=a.getComposerDraft(i.draftId),c=s?.reviewComments??[],l=ne({prompt:s?.prompt??``,lastHandoffPrompt:$.get(i.draftId)},t.prompt);return $.set(i.draftId,t.prompt),a.setPrompt(i.draftId,l),a.setReviewComments(i.draftId,re(c,t.reviewComments??[])),i},t[3]=o,t[4]=f);let p=f,m;t[5]!==i||t[6]!==r||t[7]!==u||t[8]!==p?(m=async(e,t)=>{if(!i||u!==null)return;d(e);let n=a(r,i.projectId),o=await p(n,t);if(d(null),o===null){x.add({type:`error`,title:`Could not open a thread`,description:`Try again from the project, or open a thread first.`});return}x.add({type:`success`,title:`Asked in a thread`,description:t.prompt.length>0?`The question is in the composer — read it over, then send.`:`The pull request is in the composer — type your question, then send.`})},t[5]=i,t[6]=r,t[7]=u,t[8]=p,t[9]=m):m=t[9];let h=m,g;t[10]!==i||t[11]!==r||t[12]!==u||t[13]!==o||t[14]!==p||t[15]!==l?(g=async(e,t,n)=>{let s=n===void 0?`worktree`:n;if(!i||u!==null)return;d(e);let c=x.add({type:`loading`,title:`Preparing the pull request checkout...`}),f=a(r,i.projectId),m=await o(f).then(ye,ve);if(m===null){d(null),x.update(c,{type:`error`,title:`Could not open a thread for the checkout`,description:`Try again from the project, or open a thread first.`});return}let h=await l.run({reference:i.url,mode:s,threadId:m.threadId});if(h._tag===`Failure`){d(null);let e=l.error instanceof Error?l.error.message:null;x.update(c,{type:`error`,title:`Could not prepare the pull request checkout`,...e?{description:e}:{}});return}if(!await o(f,{branch:h.value.branch,worktreePath:h.value.worktreePath,envMode:h.value.worktreePath===null?`local`:`worktree`}).then(_e,ge)){d(null),x.update(c,{type:`error`,title:`Checked out, but the thread stayed where it was`,description:`The checkout is ready on \`${h.value.branch}\`. Point a thread at it from the branch picker, then ask again.`});return}d(null);let g={type:`warning`,title:`Checked out, but not on the latest commits`,description:`The checkout could not be moved onto the pull request's latest commits, so the code there is older than the pull request. Uncommitted work or local commits keep it where it is.`};if(t===null){x.update(c,h.value.isOnPullRequestHead?{type:`success`,title:s===`local`?`Checked out here`:`Checked out`,description:s===`local`?`This repository is on the pull request's branch, with a thread open on it.`:`The pull request is in its own worktree, with a thread open on it.`}:g);return}await p(f,t,m),x.update(c,h.value.isOnPullRequestHead?{type:`success`,title:`Checkout ready`,description:`The task is in the composer — read it over, then send.`}:g)},t[10]=i,t[11]=r,t[12]=u,t[13]=o,t[14]=p,t[15]=l,t[16]=g):g=t[16];let _=g,v;return t[17]!==u||t[18]!==h||t[19]!==_?(v={handoff:u,startAsk:h,startHandoff:_},t[17]=u,t[18]=h,t[19]=_,t[20]=v):v=t[20],v}function ge(){return!1}function _e(e){return e!==null}function ve(){return null}function ye(e){return e}function be(){return null}function xe(e){return e}export{X as a,le as c,J as d,oe as f,he as i,q as l,Q as n,se as o,ue as r,Y as s,me as t,ce as u};
3
- //# sourceMappingURL=usePullRequestActions-DqgBdoH5.js.map
@@ -1,3 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{$o as n,As as r,Aw as i,Bm as a,Dy as o,Fx as s,Go as c,Gy as l,Ho as u,Ig as d,Km as f,Lg as p,Lo as ee,Ly as te,Mw as m,Nx as ne,Ny as re,Ow as h,Rg as ie,Rm as ae,Ry as oe,Ty as se,Uo as ce,Vm as le,Vo as g,Wm as ue,Zm as de,_s as fe,ah as pe,by as me,cx as he,cy as ge,dE as _e,dT as ve,d_ as ye,db as be,ds as xe,fT as _,fb as Se,gT as Ce,gg as we,gy as Te,hb as Ee,hs as De,il as Oe,jy as ke,lb as Ae,lv as je,m_ as Me,mb as Ne,mg as Pe,ms as Fe,nb as Ie,nh as Le,oh as Re,ol as ze,qm as Be,r_ as Ve,rl as He,ry as Ue,sh as We,tb as Ge,vc as Ke}from"./utils-vKlT_s3D.js";import{F as qe,L as Je,T as Ye,U as Xe,gt as v,kt as Ze,w as Qe,xn as $e}from"./runtime-BVzm9sLS.js";import{Ct as et,T as tt,t as nt,yt as rt}from"./runtime-B-UcwNuZ.js";import{i as y}from"./toast-Bkc7xsho.js";import{f as b,h as x,m as it,u as at}from"./server-97u7Iupv.js";import{i as ot,n as st,s as ct,t as lt}from"./session-CPQQ27HG.js";import{t as ut}from"./use-atom-command-JNR1Jqwn.js";import{B as dt,C as ft,F as pt,N as mt,P as ht,V as gt,b as _t,c as vt,i as S,k as yt,l as bt,n as C,o as xt,r as St,v as Ct,w as wt,x as Tt}from"./themePalette-B4vIs8Bi.js";var w=e(t(),1),T=_e();function Et(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 Dt(e){let t=ce(t=>c(n=>{let r=n(e.catalogValueAtom).entries.get(t);if(r===void 0)return null;let i=ve(Fe(n(e.stateAtom(t))),()=>$e);return{entry:r,connection:r.unsupportedReason===void 0?et(i):{phase:`unsupported`,error:r.unsupportedReason,traceId:null},serverConfig:n(e.serverConfigValueAtom(t))}}).pipe(n(`environment-presentation:${t}`))),r=new Map;return{presentationAtom:t,presentationsAtom:c(n=>{let i=new Map;for(let r of n(e.catalogValueAtom).entries.keys()){let e=n(t(r));e!==null&&i.set(r,e)}return Et(r,i)||(r=i),r}).pipe(n(`environment-presentations`))}}function Ot(e,t){return{environmentId:e,environmentLabel:t.entry.target.label,displayUrl:rt(t.entry)??``,isRelayManaged:Ze(t.entry),isEnabled:t.entry.enabled,connectionState:t.connection.phase,connectionError:t.connection.error,connectionErrorTraceId:t.connection.traceId}}function kt(e){let t=c(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}),r=c(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}),i=ce(t=>c(n=>{let r=n(e.presentationAtom(t));if(r===null)return null;let i=Ot(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})),a=c(t=>{let n=[];for(let r of t(e.catalogValueAtom).entries.keys()){let e=t(i(r));e!==null&&n.push(e)}let r=_(t.self());return r!==null&&r.length===n.length&&n.every((e,t)=>e===r[t])?r:n}).pipe(n(`environment-connection-summaries`));return{environmentIdsAtom:t,connectedEnvironmentIdsAtom:c(e=>{let n=e(t).filter(t=>e(i(t))?.connectionState===`connected`),r=_(e.self());return r!==null&&r.length===n.length&&n.every((e,t)=>e===r[t])?r:n}),identitiesAtom:r,environmentsAtom:a,machineByIdAtom:c(n=>{let r=new Map(n(t).map(t=>[t,ze(n(e.presentationAtom(t))?.serverConfig??null)])),i=_(n.self());return i!==null&&Et(i,r)?i:r}),pullRequestsSupportedAtom:c(n=>n(t).some(t=>n(e.presentationAtom(t))?.serverConfig?.environment.capabilities.pullRequests===!0))}}var E=Dt({catalogValueAtom:x.catalogValueAtom,stateAtom:x.stateAtom,serverConfigValueAtom:b.configValueAtom}),At=kt({catalogValueAtom:x.catalogValueAtom,presentationAtom:E.presentationAtom}),jt=c(null).pipe(n(`web-environment-presentation:empty`));function Mt(e){let t=(0,T.c)(5),n=g(x.catalogValueAtom),r;t[0]===e?r=t[1]:(r=e===null?jt:E.presentationAtom(e),t[0]=e,t[1]=r);let i=g(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 Nt={status:`idle`},D=Nt,O=null,k=[],A=0,Pt=new Set;function j(e){D=e;for(let e of Pt)e()}function Ft(e){O?.resolve(e);for(let t of k)t.resolve(e);O=null,k=[]}function It(){return D}function Lt(e){return Pt.add(e),()=>{Pt.delete(e)}}function Rt(){A+=1;let e=!0;return()=>{e&&(e=!1,A=Math.max(0,A-1),A===0&&(Ft(!1),j(Nt)))}}function zt(e,t){if(A!==0)return new Promise(n=>{let r={message:e,variant:t?.variant??`default`,resolve:n};if(O||D.status===`closing`){k.push(r);return}O=r,j({status:`confirming`,message:e,variant:r.variant})})}function Bt(){return D.status!==`idle`||O!==null||k.length>0}function Vt(e){if(D.status!==`confirming`||!O)return;let t=O;O=null,t.resolve(e),j({status:`closing`,message:D.message,variant:D.variant})}function Ht(){if(D.status!==`closing`)return;let e=k.shift();if(!e){j(Nt);return}O=e,j({status:`confirming`,message:e.message,variant:e.variant})}var Ut={Ctrl:`⌃`,Alt:`⌥`,Shift:`⇧`,Super:`⌘`,CmdOrCtrl:`⌘`};function Wt(e,t=navigator.platform){let n=e.split(`+`),r=n.pop()??``;return Ke(t)?`${n.map(e=>Ut[e]??e).join(``)}${r}`:[...n.map(e=>e===`CmdOrCtrl`?`Ctrl`:e===`Super`?`Meta`:e),r].join(`+`)}var Gt=`http://www.w3.org/2000/svg`,Kt={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`}}],"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-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 qt(e,t){let n=Kt[e];if(!n||typeof document.createElementNS!=`function`)return null;let r=document.createElementNS(Gt,`svg`);r.setAttribute(`xmlns`,Gt),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(Gt,e.tag);for(let[n,r]of Object.entries(e.attrs))t.setAttribute(n,r);r.appendChild(t)}return r}function Jt(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 Yt(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 M=null;function Xt(){return M!==null}function Zt(){M?.(),M=null}function Qt(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,M===c&&(M=null),document.removeEventListener(`keydown`,u),document.removeEventListener(`pointerdown`,d,!0),document.removeEventListener(`contextmenu`,f,!0);let t=Yt(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&&!Yt(e.target,i)&&l(null)},f=e=>{s&&!Yt(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?qt(`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=qt(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=Wt(t.accelerator),e.setAttribute(`aria-hidden`,`true`),a.setAttribute(`aria-keyshortcuts`,t.accelerator.replace(`CmdOrCtrl`,Ke(navigator.platform)?`Meta`:`Control`)),a.appendChild(e)}if(e){a.setAttribute(`aria-haspopup`,`menu`),a.setAttribute(`aria-expanded`,`false`);let e=qt(`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&&Jt(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(()=>{Jt(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),M&&M(),M=c,requestAnimationFrame(()=>{s=!0})})}var $t=`t3code:client-settings:v1`;function en(){return typeof window<`u`}function tn(){return en()?De($t,ae):null}function nn(e){en()&&fe($t,e,ae)}var rn;function an(){return{dialogs:{pickFolder:async e=>window.desktopBridge?window.desktopBridge.pickFolder(e):null,confirm:async(e,t)=>zt(e,t)??!1},shell:{openExternal:async e=>{if(window.desktopBridge){if(!await window.desktopBridge.openExternal(e))throw Error(`Unable to open link.`);return}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):Qt(e,t),close:async()=>{window.desktopBridge||Zt()}},persistence:{getClientSettings:async()=>window.desktopBridge?window.desktopBridge.getClientSettings():tn(),setClientSettings:async e=>{if(window.desktopBridge)return window.desktopBridge.setClientSettings(e);nn(e)}}}}function on(){return an()}function sn(){if(typeof window<`u`)return rn||(rn=on(),rn)}function cn(){let e=sn();if(!e)throw Error(`Local API not found`);return e}var N=`t3code:theme`,ln=`(prefers-color-scheme: dark)`,P={theme:`system`,resolvedTheme:`light`,systemDark:!1,followSystem:!0,appearanceMode:`system`,themeHalves:null};function un(){return F()}function dn(){return typeof window>`u`?{}:fn()}function F(){if(typeof window>`u`)return null;try{return yt(window.localStorage.getItem(S))}catch{return null}}function fn(){try{let e=JSON.parse(window.localStorage.getItem(`t3code: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 I(e){return`${e?.light??``}|${e?.dark??``}`}var pn=`theme-color`,mn=`meta[name="${pn}"][data-dynamic-theme-color="true"]`,L=class extends me()(`ThemeStorageError`,{operation:ge([`read`,`write`]),storageKey:Te,theme:l(xt),cause:Ue()}){get message(){return`Failed to ${this.operation} theme preference for ${this.storageKey}.`}},hn=oe(L),gn=class extends me()(`DesktopThemeSyncError`,{theme:xt,cause:Ue()}){get message(){return`Failed to sync the ${this.theme} theme to the desktop shell.`}},_n=oe(gn),R=[],z=null,vn=!0,B=null,V=null,H=null;function U(){vn=!0;for(let e of R)e()}function yn(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(ln).matches}function bn(e){if(typeof window>`u`)return e===`system`;try{let e=window.localStorage.getItem(St);if(e===`true`)return!0;if(e===`false`)return!1}catch{}return e===`system`}function xn(e){return e===`light`||e===`dark`||e===`system`}function W(e){if(typeof window<`u`)try{let e=window.localStorage.getItem(C);if(xn(e))return e}catch{}return bn(e)?`system`:_t(e)??`light`}function Sn(e){if(typeof window<`u`)try{window.localStorage.setItem(C,e)}catch(e){throw new L({operation:`write`,storageKey:C,cause:e})}}function Cn(){if(typeof window>`u`)return P.theme;let e;try{e=window.localStorage.getItem(N)}catch(e){throw new L({operation:`read`,storageKey:N,cause:e})}return e!==null&&wt(e)?bt(e):P.theme}function wn(e){if(typeof window<`u`)try{window.localStorage.setItem(N,e),H=null}catch(t){throw new L({operation:`write`,storageKey:N,theme:e,cause:t})}}function G(){if(H!==null)return P.theme;try{return Cn()}catch(e){let t=hn(e)?e:new L({operation:`read`,storageKey:N,cause:e});return H=t,console.error(t.message,{operation:t.operation,storageKey:t.storageKey,...v(t)}),P.theme}}function Tn(){let e=document.querySelector(mn);return e||(e=document.createElement(`meta`),e.name=pn,e.setAttribute(`data-dynamic-theme-color`,`true`),document.head.append(e),e)}function En(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 Dn(){return document.querySelector(`main[data-slot='sidebar-inset']`)??document.querySelector(`[data-slot='sidebar-inner']`)??document.body}function On(){if(typeof document>`u`||typeof getComputedStyle>`u`)return;let e=getComputedStyle(document.documentElement),t=document.documentElement.dataset.themeId?En(e.getPropertyValue(`--app-chrome-background`)):null,n=En(getComputedStyle(Dn()).backgroundColor),r=En(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="${pn}"]`);if(a.length===0){Tn().setAttribute(`content`,i);return}for(let e of a)e.setAttribute(`content`,i)}function K(e,{suppressTransitions:t=!1,preservePreview:n=!0}={}){if(typeof document>`u`||typeof window>`u`||n&&document.documentElement.dataset?.themeId===`__preview`)return;let r=W(e),i=r===`system`,a=i?yn():!1,o=F();if(V?.theme===e&&V.systemDark===a&&V.followSystem===i&&V.appearanceMode===r&&I(V.themeHalves)===I(o)){An(e,i,r);return}t&&document.documentElement.classList.add(`no-transitions`);let s=ht(e,a,i,r,o);vt(pt(e,o,s),s),document.documentElement.classList.toggle(`dark`,s===`dark`),V={theme:e,systemDark:a,followSystem:i,appearanceMode:r,themeHalves:o},On(),An(e,i,r),t&&(document.documentElement.offsetHeight,requestAnimationFrame(()=>{document.documentElement.classList.remove(`no-transitions`)}))}async function kn(e,t,n,r,i=F()){try{await e.setTheme(mt(t,n,r,i))}catch(e){throw new gn({theme:t,cause:e})}}function An(e,t,n){if(typeof window>`u`)return;let r=window.desktopBridge,i=F(),a=mt(e,t,n,i);r&&typeof r.setTheme==`function`&&B!==a&&(B=a,kn(r,e,t,n,i).catch(t=>{let n=_n(t)?t:new gn({theme:e,cause:t});console.error(n.message,{theme:n.theme,...v(n)}),B===a&&(B=null)}))}typeof document<`u`&&typeof window<`u`&&K(G());function jn(){if(typeof window>`u`)return P;if(!vn&&z)return z;vn=!1;let e=G(),t=W(e),n=t===`system`,r=n?yn():!1,i=F(),a=ht(e,r,n,t,i);return z&&z.theme===e&&z.resolvedTheme===a&&z.systemDark===r&&z.followSystem===n&&z.appearanceMode===t&&I(z.themeHalves)===I(i)||(z={theme:e,resolvedTheme:a,systemDark:r,followSystem:n,appearanceMode:t,themeHalves:i}),z}function Mn(){return P}function Nn(){let e=G();W(e)===`system`&&K(e,{suppressTransitions:!0}),U()}function Pn(e){e.key===N?(H=null,K(G(),{suppressTransitions:!0}),U()):e.key===`t3code:theme-follow-system`||e.key===`t3code:theme-appearance-mode`||e.key===`t3code:theme-halves:v1`?(K(G(),{suppressTransitions:!0}),U()):(e.key===`t3code:themes:v1`||e.key===null)&&(e.key===null&&(H=null),ft(),V=null,K(G(),{suppressTransitions:!0}),U())}var Fn=null;function In(e){if(typeof window>`u`)return()=>{};if(R.push(e),!Fn){let e=typeof window.matchMedia==`function`?window.matchMedia(ln):null;e?.addEventListener(`change`,Nn),window.addEventListener(`storage`,Pn),Fn=()=>{e?.removeEventListener(`change`,Nn),window.removeEventListener(`storage`,Pn)}}return()=>{R=R.filter(t=>t!==e),R.length===0&&(Fn?.(),Fn=null)}}function Ln(){let e=(0,w.useSyncExternalStore)(In,jn,Mn),{theme:t,resolvedTheme:n}=e,r=(0,w.useCallback)(e=>{if(typeof window>`u`)return!1;try{Sn(W(G()));let t=window.localStorage.getItem(S);window.localStorage.removeItem(S);try{wn(e)}catch(e){if(t!==null)try{window.localStorage.setItem(S,t)}catch{}throw e}}catch(t){let n=hn(t)?t:new L({operation:`write`,storageKey:N,theme:e,cause:t});return console.error(n.message,{operation:n.operation,storageKey:n.storageKey,theme:e,...v(n)}),!1}return K(e,{suppressTransitions:!0}),U(),!0},[]),i=(0,w.useCallback)(e=>{if(typeof window>`u`)return!1;try{Sn(e)}catch(e){let t=hn(e)?e:new L({operation:`write`,storageKey:C,cause:e});return console.error(t.message,{operation:t.operation,storageKey:t.storageKey,...v(t)}),!1}return H=null,K(G(),{suppressTransitions:!0}),U(),!0},[]),a=(0,w.useCallback)(e=>{let n=W(t),r=e?`system`:n===`system`?_t(t)??`light`:n;return i(r)},[i,t]),o=(0,w.useCallback)((e,t)=>{if(typeof window>`u`)return!1;try{let n={...fn()};t===null?delete n[e]:n[e]=t,n.light===void 0&&n.dark===void 0?window.localStorage.removeItem(S):window.localStorage.setItem(S,JSON.stringify(n))}catch(e){let t=new L({operation:`write`,storageKey:S,cause:e});return console.error(t.message,{operation:t.operation,storageKey:t.storageKey,...v(t)}),!1}return K(G(),{suppressTransitions:!0}),U(),!0},[]),s=(0,w.useCallback)(()=>{if(typeof window>`u`)return!1;try{window.localStorage.removeItem(S)}catch(e){let t=new L({operation:`write`,storageKey:S,cause:e});return console.error(t.message,{operation:t.operation,storageKey:t.storageKey,...v(t)}),!1}return K(G(),{suppressTransitions:!0}),U(),!0},[]),c=(0,w.useCallback)(({preservePreview:e=!1}={})=>{typeof window<`u`&&(V=null,K(G(),{suppressTransitions:!0,preservePreview:e}),U())},[]);return(0,w.useEffect)(()=>{K(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 Rn=o(te(se)),zn=Ee(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??``),Rn(t).pipe(s(e=>e.issue))}),Bn=new Ae(zn,Ne());Se().pipe(be(Ne({space:2})));var Vn=e=>Te.pipe(ke(e,Bn)),Hn={performance:{profile:`performance`,automaticGitFetchInterval:i(15),providerHealthRefreshInterval:h(1),hostPowerMonitorActiveInterval:i(30),hostPowerMonitorIdleInterval:h(2),idleClientTtl:i(45),pauseWhenHostLocked:!0,pauseWhenHostLowPower:!1,pauseWhenClientLowPower:!1,pauseWhenOnBattery:!1},balanced:{profile:`balanced`,automaticGitFetchInterval:a,providerHealthRefreshInterval:f,hostPowerMonitorActiveInterval:i(30),hostPowerMonitorIdleInterval:h(5),idleClientTtl:i(45),pauseWhenHostLocked:!0,pauseWhenHostLowPower:!0,pauseWhenClientLowPower:!0,pauseWhenOnBattery:!1},"battery-saver":{profile:`battery-saver`,automaticGitFetchInterval:i(0),providerHealthRefreshInterval:h(15),hostPowerMonitorActiveInterval:h(1),hostPowerMonitorIdleInterval:h(10),idleClientTtl:i(45),pauseWhenHostLocked:!0,pauseWhenHostLowPower:!0,pauseWhenClientLowPower:!0,pauseWhenOnBattery:!0}};function q(e){return Hn[e]}function Un(e){return e.profile===`custom`?e.baseProfile??`balanced`:e.profile}function Wn(e){let t=Un(e),n=Hn[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 J(e,t){return m(e)===m(t)}function Gn(e,t){return J(e.automaticGitFetchInterval,t.automaticGitFetchInterval)&&J(e.providerHealthRefreshInterval,t.providerHealthRefreshInterval)&&J(e.hostPowerMonitorActiveInterval,t.hostPowerMonitorActiveInterval)&&J(e.hostPowerMonitorIdleInterval,t.hostPowerMonitorIdleInterval)&&J(e.idleClientTtl,t.idleClientTtl)&&e.pauseWhenHostLocked===t.pauseWhenHostLocked&&e.pauseWhenHostLowPower===t.pauseWhenHostLowPower&&e.pauseWhenClientLowPower===t.pauseWhenClientLowPower&&e.pauseWhenOnBattery===t.pauseWhenOnBattery}function Kn(e){if(e.profile!==`custom`)return{schemaVersion:1,profile:e.profile,overrides:{}};let t=Wn(e),n=[Un(e),`balanced`,`performance`,`battery-saver`];for(let e of n)if(Gn(t,Hn[e]))return{schemaVersion:1,profile:e,overrides:{}};let r=Un(e),i=Hn[r];return{schemaVersion:1,profile:`custom`,baseProfile:r,overrides:{...J(t.automaticGitFetchInterval,i.automaticGitFetchInterval)?{}:{automaticGitFetchInterval:t.automaticGitFetchInterval},...J(t.providerHealthRefreshInterval,i.providerHealthRefreshInterval)?{}:{providerHealthRefreshInterval:t.providerHealthRefreshInterval},...J(t.hostPowerMonitorActiveInterval,i.hostPowerMonitorActiveInterval)?{}:{hostPowerMonitorActiveInterval:t.hostPowerMonitorActiveInterval},...J(t.hostPowerMonitorIdleInterval,i.hostPowerMonitorIdleInterval)?{}:{hostPowerMonitorIdleInterval:t.hostPowerMonitorIdleInterval},...J(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 qn(e){let t={schemaVersion:1,profile:le,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`||m(e.automaticGitFetchInterval)!==m(a)||m(e.providerHealthRefreshInterval)!==m(f);return Wn(n&&i?{schemaVersion:1,profile:m(e.automaticGitFetchInterval)===m(q(r).automaticGitFetchInterval)&&m(e.providerHealthRefreshInterval)===m(q(r).providerHealthRefreshInterval)?r:`custom`,baseProfile:r,overrides:{...m(e.automaticGitFetchInterval)===m(q(r).automaticGitFetchInterval)?{}:{automaticGitFetchInterval:e.automaticGitFetchInterval},...m(e.providerHealthRefreshInterval)===m(q(r).providerHealthRefreshInterval)?{}:{providerHealthRefreshInterval:e.providerHealthRefreshInterval}}}:e.backgroundActivity)}function Jn(e){let t=qn(e);return Kn({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 Yn=Vn(de);re(Yn);function Xn(e,t){let n=e.providerInstances[t.instanceId];return n===void 0?Le(t.instanceId):We(n)}var Zn=[`codex`,`claudeAgent`,`cursor`,`grok`,`muse`,`pi`,`opencode`,`antigravity`].map(e=>d.make(e));function Qn(e,t,n){let i=[...Zn.map(e=>[ie(e),e]),...n?.includeConfiguredInstances===!0?Object.entries(e).flatMap(([e,t])=>Zn.includes(t.driver)?[[p.make(e),t.driver]]:[]):[]].find(([e,n])=>t(e,n));if(i===void 0)return null;let[a,o]=i,s=n?.defaultModelSelection,c=e[a]?.config;return s?.instanceId===a&&r(c?.customModels).some(e=>e.slug===s.model)?s:{instanceId:a,model:we[o]??Pe[o]??`gpt-6-luna`}}function $n(e,t,n){let r=e.sourceControlWriterModelSelection;if(!r||!Re(e,n,r.instanceId))return e.textGenerationModelSelection;if(t===void 0)return r;let i=t.find(e=>e.instanceId===r.instanceId);return i?.enabled===!0&&He(i)&&Oe(i)?r:e.textGenerationModelSelection}function er(e,t,n){let r=e.reviewGuideModelSelection;if(r&&Re(e,n,r.instanceId)){let e=t?.find(e=>e.instanceId===r.instanceId);if(t===void 0||e?.enabled===!0&&He(e)&&Oe(e))return r}return $n(e,t,n)}function tr(e,t={}){return{favorites:e.favorites??t.favorites??[],providerModelPreferences:e.providerModelPreferences??t.providerModelPreferences??{}}}function nr(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 rr=new Set([`continueThreadsAfterServerUpdate`,`sidebarAutoSettleAfterDays`,`sidebarAutoSettleOnMerge`,`autoResumeLimitedThreads`,`snoozeLimitedThreads`,`newWorktreesStartFromOrigin`,`sourceControlWritingStyle`,`textGenerationModelSelection`]);function ir(e){let t={},n={};for(let[r,i]of Object.entries(e))rr.has(r)?t[r]=i:n[r]=i;return{sharedPatch:t,localPatch:n}}function ar(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)||!Xn(n,{...n.textGenerationModelSelection,...e.textGenerationModelSelection}))&&(e=Ie(e,[`textGenerationModelSelection`])),t?.threadRestartContinuation===!0?e:Ie(e,[`continueThreadsAfterServerUpdate`])}function or(e){return e.connection.phase===`connected`&&e.serverConfig?.environment.capabilities.threadAutoSettlement===!0}function sr(e){let t=e.atom(je(Ye.pipe(ne(e=>Me(e.state)))),{initialValue:Qe});return{stateAtom:t,stateValueAtom:c(e=>ve(Fe(e(t)),()=>Qe)).pipe(n(`relay-environment-discovery-value`)),refresh:qe(e,{label:`relay-environment-discovery:refresh`,concurrency:{mode:`singleFlight`,key:()=>`refresh`},execute:e=>Ye.pipe(he(e=>e.refresh))})}}var cr=sr(nt);function lr(e,t){return{...t,environmentId:e,label:t.entry.target.label,displayUrl:rt(t.entry),relayManaged:Ze(t.entry)}}function ur(){let e=(0,T.c)(7),t=g(x.catalogValueAtom),n=g(x.networkStatusValueAtom),r=g(E.presentationsAtom),i;e[0]===r?i=e[1]:(i=[...r.entries()].map(dr),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 dr(e){let[t,n]=e;return lr(t,n)}function fr(){return g(it)}function pr(e){let t=(0,T.c)(3),{presentation:n}=Mt(e),r;return t[0]!==e||t[1]!==n?(r=e===null||n===null?null:lr(e,n),t[0]=e,t[1]=n,t[2]=r):r=t[2],r}function mr(){return pr(fr())}function hr(e){let t=(0,T.c)(2),n=ct(e),r;return t[0]===n?r=t[1]:(r=Ce(n)?n.value.httpBaseUrl:null,t[0]=n,t[1]=r),r}function gr(){return g(cr.stateValueAtom)}function _r(){return g(At.environmentIdsAtom)}function vr(){return g(At.identitiesAtom)}function yr(){return g(At.pullRequestsSupportedAtom)}var br=`[CLIENT_SETTINGS]`,xr=new Set,Sr=new Set,Cr=ue,Y=`pending`,X=null,wr=0,Tr=Promise.resolve(),Er=0;function Dr(){for(let e of xr)e()}function Or(){for(let e of Sr)e()}function Z(){return Cr}function kr(e){Cr=e,Dr()}function Ar(e){Y!==e&&(Y=e,Or())}function jr(e){return xr.add(e),Q().catch(()=>void 0),()=>{xr.delete(e)}}function Mr(){return Y===`ready`}function Nr(){return Y}function Pr(e){return Sr.add(e),Q().catch(()=>void 0),()=>{Sr.delete(e)}}async function Q(){if(Y===`ready`)return;if(X)return X;let e=wr;Ar(Y===`failed`||Y===`retrying`?`retrying`:`pending`);let t=(async()=>{try{let t=await cn().persistence.getClientSettings();if(e!==wr)return;t&&kr({...ue,...t}),Ar(`ready`)}catch(t){throw e===wr&&Ar(`failed`),console.error(`${br} hydrate failed`,{operation:`hydrate`,...v(t)}),t}})().finally(()=>{X===t&&(X=null)});return X=t,X}var Fr=e=>cn().persistence.setClientSettings(e);function Ir(e){let t=Tr.then(e);return Tr=t.then(()=>void 0,()=>void 0),t}function Lr(e,t=Fr){let n=Y!==`ready`||Er>0;return n?Er+=1:kr({...Z(),...e}),Ir(async()=>{if(n)try{Y!==`ready`&&await Q(),kr({...Z(),...e})}finally{--Er}await t(Z())}).catch(e=>{console.error(`${br} persist failed`,{operation:`persist`,...v(e)})})}async function Rr(e,t=Fr){return Ir(async()=>{for(Y!==`ready`&&await Q();;){let n=Z(),r=e(n);if(await t(r),Z()===n)return kr(r),r}})}var zr=new Set(Ge(de.fields));function Br(e){let t={},n={};for(let[r,i]of Object.entries(e))zr.has(r)?t[r]=i:n[r]=i;return{serverPatch:t,clientPatch:n}}function Vr(){return Z()}function Hr(){return Q()}function Ur(){return(0,w.useSyncExternalStore)(Pr,Mr,Wr)}function Wr(){return!1}function Gr(){return(0,w.useSyncExternalStore)(Pr,Nr,Kr)}function Kr(){return`pending`}function $(){return(0,w.useSyncExternalStore)(jr,Z,qr)}function qr(){return ue}function Jr(e,t){return{...t,...e,...tr(e,t)}}var Yr=new Set;function Xr(e,t){let n=(0,T.c)(8),r=$(),i=Ur(),a;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={reportFailure:!1},n[0]=a):a=n[0];let o=ut(b.updateSettings,a),s,c;n[1]!==r||n[2]!==e||n[3]!==i||n[4]!==o||n[5]!==t?(s=()=>{if(!e||!t||!i||Yr.has(e))return;let n=nr(t,r);n&&(Yr.add(e),o({environmentId:e,input:{patch:n}}).finally(()=>Yr.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,w.useEffect)(s,c)}function Zr(e,t){let n=(0,T.c)(6),r=$(),i;n[0]!==r||n[1]!==e?(i=Jr(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 Qr(e){let t=(0,T.c)(3),n=$(),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}function $r(e){return e.settingsHydrated?e.paletteThemeActive&&!e.paletteThemeAllowsArtwork&&e.mode===`artwork`?`pill`:e.mode:`none`}function ei(){let e=(0,T.c)(7),t=Ur(),n=$().environmentIdentificationMode,{resolvedTheme:r,theme:i,themeHalves:a}=Ln(),o=(0,w.useSyncExternalStore)(dt,Tt,ti),s;if(e[0]!==n||e[1]!==o||e[2]!==r||e[3]!==t||e[4]!==i||e[5]!==a){let c=pt(i,a,r),l=Ct(c);s=$r({mode:n,settingsHydrated:t,paletteThemeActive:o!==null||l!==null,paletteThemeAllowsArtwork:o??gt(c)}),e[0]=n,e[1]=o,e[2]=r,e[3]=t,e[4]=i,e[5]=a,e[6]=s}else s=e[6];return s}function ti(){return null}async function ni(e,t){return(e.favorites===null||e.providerModelPreferences===null)&&await Hr(),{...nr(e,Vr()),...t}}function ri(e){let t=(0,T.c)(6),n;t[0]===e?n=t[1]:(n=e?b.settingsValueAtom(e):ai,t[0]=e,t[1]=n);let r=g(n),i=ut(b.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 ni(r,t)}catch{y.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 ii(e){let t=(0,w.use)(u),n=(0,w.useRef)(new Map),r=ri(e);return(0,w.useCallback)(async(i,a)=>{if(!e)return;let o=b.settingsValueAtom(e),s=t.get(o);if(!s)return;if(s.favorites===null)try{await Hr()}catch{y.add({type:`error`,title:`Favorites not saved`,description:`Could not load saved model preferences. Try again.`});return}let c=t.get(o)??s,l=tr(c,Vr()).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&&xe(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 ai=c(null);function oi(e){let t=(0,T.c)(5),n;t[0]===e?n=t[1]:(n=e?b.settingsValueAtom(e):ai,t[0]=e,t[1]=n);let r=g(n),i=$();Xr(e,r);let a=r??Be,o;return t[2]!==i||t[3]!==a?(o=tr(a,i),t[2]=i,t[3]=a,t[4]=o):o=t[4],o}function si(e,t){let n=(0,T.c)(2),r;n[0]===e?r=n[1]:(r=b.settingsValueAtom(e),n[0]=e,n[1]=r);let i=g(r);return Xr(e,i),Zr(i??Be,t)}function ci(e){let t=(0,T.c)(4),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={reportFailure:!1},t[0]=n):n=t[0];let r=ut(b.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 li(e){let t=mr(),n=g(at);return Xr(t?.environmentId??null,t?.serverConfig?.settings??null),Zr(n,e)}var ui=`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 di(){let e=(0,T.c)(2),t=mr(),n;return e[0]===t?n=e[1]:(n=t!==null||!tt(),e[0]=t,e[1]=n),n}function fi(e){let t=(0,T.c)(3),n=e!==void 0&&e,{environments:r}=ur(),i;return t[0]!==r||t[1]!==n?(i=c(e=>r.filter(or).flatMap(t=>{let r=e(lt.sessionStateAtom(t.environmentId));if(n&&r._tag===`Initial`)return[t.environmentId];let i=r._tag===`Failure`?null:_(Fe(r));return i!==null&&ye(i,`settings:write`)?[t.environmentId]:[]})),t[0]=r,t[1]=n,t[2]=i):i=t[2],g(i)}function pi(e){let t=(0,T.c)(10);ot(e,Ve);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=ut(b.updateSettings,n),{environments:i}=ur(),a;t[1]!==i||t[2]!==r?(a=async e=>{let t=await r(e);if(t._tag===`Failure`&&!Je(t)){let n=i.find(t=>t.environmentId===e.environmentId)?.label??e.environmentId,r=Xe(t);y.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=fi(!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}=Br(t),c=e===null||pe(n).every(t=>st(e,t));if(Object.keys(n).length>0&&!c&&y.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}=ir(n),c=vi;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=ar(t,a?.serverConfig?.environment.capabilities,a?.serverConfig?.settings,n,r===e);if(Object.keys(s).length!==0){if(ee.get(lt.sessionStateAtom(r))._tag!==`Initial`&&!pe(t).every(e=>st(r,e))){l.push(a?.label??r);continue}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(mi)}}Object.keys(a).length>0&&Lr(a)},t[4]=e,t[5]=i,t[6]=r,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function mi(e){let t=e.flatMap(_i);if(t.length===0)return;let n=e.filter(gi).map(hi);y.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 hi(e){let{label:t}=e;return t}function gi(e){let{result:t}=e;return t._tag===`Success`}function _i(e){let{label:t,result:n}=e;if(n._tag!==`Failure`||Je(n))return[];let r=Xe(n);return[`Could not save on ${t}: ${r instanceof Error?r.message:`The save failed. Try reconnecting and saving again.`}`]}function vi(e){let t=e===void 0?ui:e;return y.add({type:`warning`,title:`Setting not saved`,description:t})}function yi(e){return pi(e)}function bi(){return pi(mr()?.environmentId??null)}function xi(){return Si}function Si(e){return Lr(e)}export{Rt as $,gr as A,Vn as B,hr as C,mr as D,ur as E,Un as F,On as G,un as H,q as I,sn as J,Ln as K,Kn as L,Qn as M,er as N,fr as O,$n as P,It as Q,Jn as R,pr as S,_r as T,dn as U,W as V,Cn as W,Ht as X,Xt as Y,Bt as Z,ii as _,Lr as a,yi as b,Ur as c,oi as d,zt as et,si as f,di as g,li as h,Jr as i,Mt as it,cr as j,yr as k,Gr as l,ci as m,Hr as n,Lt as nt,Rr as o,Xr as p,cn as q,Vr as r,E as rt,Qr as s,ui as t,Vt as tt,ei as u,xi as v,vr as w,bi as x,ri as y,qn as z};
3
- //# sourceMappingURL=useSettings-DYKTOdxY.js.map