@p4code/cli 0.8.24 → 0.8.26
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.
- package/dist/bin.mjs +1 -1
- package/dist/{binCli-DNod5652.mjs → binCli-DgjAnX7K.mjs} +610 -480
- package/dist/client/.vite/manifest.json +2246 -2246
- package/dist/client/assets/AlertDialogRoot-uMQTdBRo.js +2 -0
- package/dist/client/assets/{AnimatedHeight-wZzihILs.js → AnimatedHeight-xpLZZo3s.js} +2 -2
- package/dist/client/assets/{AuthSurfaceShell-Wwq6fM9A.js → AuthSurfaceShell-B0GeuqGG.js} +2 -2
- package/dist/client/assets/{CSPContext-BjqtxKhA.js → CSPContext-BOMhNaNg.js} +2 -2
- package/dist/client/assets/{ChatGptUsageButton-8lmdyDiG.js → ChatGptUsageButton-BsRw7PIG.js} +2 -2
- package/dist/client/assets/ChatMarkdown-B_7CYt1t.js +65 -0
- package/dist/client/assets/{CheckboxIndicator-CuZi7Ixm.js → CheckboxIndicator-CtJqB7ns.js} +2 -2
- package/dist/client/assets/{ClippedText-DPgP0ObI.js → ClippedText-DoAq5p0h.js} +2 -2
- package/dist/client/assets/{CodexSetupSection.logic-oYzzgIWo.js → CodexSetupSection.logic-CAeeNfjx.js} +2 -2
- package/dist/client/assets/{ComboboxClear-zheEdyAa.js → ComboboxClear-gWUoU_9i.js} +2 -2
- package/dist/client/assets/{ComboboxGroupLabel-BxCdL7I3.js → ComboboxGroupLabel-PqwekxYO.js} +2 -2
- package/dist/client/assets/{CommandBlock-ByCjpPww.js → CommandBlock-a6FR0Qjq.js} +2 -2
- package/dist/client/assets/ComposerPromptEditor-JiLuF8sa.js +204 -0
- package/dist/client/assets/{CompositeRoot-Bg5KGYGp.js → CompositeRoot-DXqEvNI3.js} +2 -2
- package/dist/client/assets/{ConnectionStatusDot-Bx8Imvqc.js → ConnectionStatusDot-DsDhJub7.js} +2 -2
- package/dist/client/assets/{DesignPageTile-ClF5Va3g.js → DesignPageTile-6OCPIqLU.js} +2 -2
- package/dist/client/assets/DevicePanel-BCkjPnRB.js +2 -0
- package/dist/client/assets/{DeviceSetup-Dm9ZbkMC.js → DeviceSetup-jQhLCRQB.js} +2 -2
- package/dist/client/assets/{DialogTitle-CVP748Gv.js → DialogTitle-B_iSZXaO.js} +2 -2
- package/dist/client/assets/{DiffCommentAnnotation-Dx-VhoLU.js → DiffCommentAnnotation-Ce3fywCz.js} +3 -3
- package/dist/client/assets/{DiffFileTree-BgjyfH71.js → DiffFileTree-Ch8ghRNl.js} +2 -2
- package/dist/client/assets/DiffPanel-BYdDuPJL.js +2 -0
- package/dist/client/assets/{DiffWorkerPoolProvider-C_yNvh6o.js → DiffWorkerPoolProvider-CCTRrTde.js} +3 -3
- package/dist/client/assets/{EmbeddedDesign-DDApp-WI.js → EmbeddedDesign-BasGnrZc.js} +4 -4
- package/dist/client/assets/{EnvironmentMachineIcon-B2v_GWgB.js → EnvironmentMachineIcon-CmWYXtho.js} +2 -2
- package/dist/client/assets/{ExpandableText-fJVIbCvG.js → ExpandableText-BgfA9yOq.js} +2 -2
- package/dist/client/assets/{FieldControl-mq4xNgmP.js → FieldControl-D-HuGl-Y.js} +2 -2
- package/dist/client/assets/{FileDiff-B_422yEN.js → FileDiff-HO0wYuF-.js} +2 -2
- package/dist/client/assets/{FilePreviewPanel-B26lXYsA.js → FilePreviewPanel-BWAkLnOF.js} +9 -9
- package/dist/client/assets/{FoldedSettingsSection-TLqDB_1b.js → FoldedSettingsSection-itwybIpg.js} +2 -2
- package/dist/client/assets/{FormContext-Vtmj_mkP.js → FormContext-D41axClw.js} +2 -2
- package/dist/client/assets/{Icons-C0Zjws-3.js → Icons-bbJxtd49.js} +2 -2
- package/dist/client/assets/Input-BcEftKLM.js +2 -0
- package/dist/client/assets/{KeybindingsSettings.logic-D-GClV-c.js → KeybindingsSettings.logic-DbRWYCku.js} +2 -2
- package/dist/client/assets/{NoProjectsHero-Bx1X9Us-.js → NoProjectsHero-1ktyCaCR.js} +2 -2
- package/dist/client/assets/{P4ConnectAccountPages-BWvaLOY-.js → P4ConnectAccountPages-C8kjCH2i.js} +2 -2
- package/dist/client/assets/{P4ConnectSidebarSignIn-C8z-Gfq5.js → P4ConnectSidebarSignIn-De0TqOBv.js} +2 -2
- package/dist/client/assets/PanelLayoutControls-CRn29ViL.js +216 -0
- package/dist/client/assets/{PierreEntryIcon-Ddl-VPd4.js → PierreEntryIcon-DZSPzXnW.js} +2 -2
- package/dist/client/assets/{PopoverHandle-BT83XTq9.js → PopoverHandle-BUkWn6lX.js} +2 -2
- package/dist/client/assets/PreviewPanel-CPU0sstq.js +2 -0
- package/dist/client/assets/ProjectDefaultsSettings-Ibem_Z4L.js +2 -0
- package/dist/client/assets/{ProjectFavicon-BDaMxno-.js → ProjectFavicon-CE_urBAW.js} +3 -3
- package/dist/client/assets/{ProjectIconPickerDialog-Be5IQyyr.js → ProjectIconPickerDialog-D0OZSLq9.js} +2 -2
- package/dist/client/assets/{ProjectMonogram-BUy_N1of.js → ProjectMonogram-C1SBXbLc.js} +2 -2
- package/dist/client/assets/{ProviderAuthTerminal-BFGd236-.js → ProviderAuthTerminal-Ddl4fv02.js} +2 -2
- package/dist/client/assets/ProviderModelPicker-BTTJn7iC.js +2 -0
- package/dist/client/assets/{ProviderSettingsForm-D6u9dY73.js → ProviderSettingsForm-CGRf8WX5.js} +2 -2
- package/dist/client/assets/{PullRequestCodeTab-hXtKZAP9.js → PullRequestCodeTab-CWg3y2Hg.js} +3 -3
- package/dist/client/assets/{ReadOnlySourcePreview-CDLZaWo2.js → ReadOnlySourcePreview-B2RUv5et.js} +2 -2
- package/dist/client/assets/{RenderErrorBoundary-BkcvpgEh.js → RenderErrorBoundary-BE9pu802.js} +2 -2
- package/dist/client/assets/ScheduledTasksSettings-LlwIif-M.js +4 -0
- package/dist/client/assets/{ScopedSwitch-yznbaSh9.js → ScopedSwitch-DM7op4tT.js} +2 -2
- package/dist/client/assets/{ScrollAreaCorner-3gSiyg8H.js → ScrollAreaCorner-CpFtD7m1.js} +2 -2
- package/dist/client/assets/{SecretInput-itt3KL-b.js → SecretInput-aXfqfjLk.js} +2 -2
- package/dist/client/assets/{SelectScrollUpArrow-D_o_f6Fh.js → SelectScrollUpArrow-CMpd0Jm1.js} +2 -2
- package/dist/client/assets/{SettingsPanels-DdhZ2nXb.js → SettingsPanels-BJZmVkq6.js} +6 -6
- package/dist/client/assets/{SettingsPanels.logic-DIuWE5Xf.js → SettingsPanels.logic-DlcMmTBT.js} +2 -2
- package/dist/client/assets/{SettingsScopeNotice-D8K81IzP.js → SettingsScopeNotice-DvcB28n8.js} +2 -2
- package/dist/client/assets/{ThemeEditorPanel-ePX4nwaV.js → ThemeEditorPanel-Cv_FhYYJ.js} +3 -3
- package/dist/client/assets/{ThreadTerminalDrawer-5z4y3z0y.js → ThreadTerminalDrawer-B4Hx5Gtc.js} +4 -4
- package/dist/client/assets/TooltipViewport-BkvH9Kzg.js +2 -0
- package/dist/client/assets/{Virtualizer-DEM6HN7-.js → Virtualizer-Dka4WQhw.js} +2 -2
- package/dist/client/assets/{WorkspaceBreadcrumb-B5ZV6VNj.js → WorkspaceBreadcrumb-DnyZiGsn.js} +2 -2
- package/dist/client/assets/{WorkspacePageContainer-BTN44jG6.js → WorkspacePageContainer-OhHg0688.js} +2 -2
- package/dist/client/assets/{WorkspacePageHeader-BaCxaW-R.js → WorkspacePageHeader-BUVfTGMv.js} +2 -2
- package/dist/client/assets/_chat-71Bl4UTO.js +45 -0
- package/dist/client/assets/{_chat.design-CQ52N70I.js → _chat.design-L-wLlTQh.js} +2 -2
- package/dist/client/assets/{_chat.index-SFAYIX_P.js → _chat.index-Cqzn3tFu.js} +2 -2
- package/dist/client/assets/{_chat.new-BO6oEisx.js → _chat.new-CmqMNN1q.js} +3 -3
- package/dist/client/assets/_chat.pull-requests-Cv4Q6L5c.js +2 -0
- package/dist/client/assets/{abnfDiagram-VCTEODGH-DhiN6SMz.js → abnfDiagram-VCTEODGH-DGwfULSN.js} +2 -2
- package/dist/client/assets/{alert-CdZT7d18.js → alert-D4hu_q2y.js} +2 -2
- package/dist/client/assets/architecture-7GRP2DOG-BVmWArUl.js +1 -0
- package/dist/client/assets/{architectureDiagram-5GKGNRK7-bs37U5FM.js → architectureDiagram-5GKGNRK7-fZiBVATu.js} +2 -2
- package/dist/client/assets/{assets-BU-ex_t8.js → assets-Zca4LKSx.js} +2 -2
- package/dist/client/assets/{blockDiagram-I7D4REHJ-Bz9mN89n.js → blockDiagram-I7D4REHJ-Cs_imlrU.js} +2 -2
- package/dist/client/assets/{browserHistoryStore-KDG9Uz1t.js → browserHistoryStore-9YCQpJy9.js} +2 -2
- package/dist/client/assets/{browserLinkTarget-DmKK3HY0.js → browserLinkTarget-BnxzanaN.js} +2 -2
- package/dist/client/assets/{c4Diagram-7LVT6UL2-CtkHQd_E.js → c4Diagram-7LVT6UL2-jxRP5rAE.js} +2 -2
- package/dist/client/assets/channel-DyV-uKW8.js +2 -0
- package/dist/client/assets/{checkbox-Q0bv8RvC.js → checkbox-PYOAN-IL.js} +2 -2
- package/dist/client/assets/{chunk-4HAMMTFA-BtUnQAH6.js → chunk-4HAMMTFA-CD4tA6cX.js} +2 -2
- package/dist/client/assets/{chunk-75Z2AOVW-CwSe19lZ.js → chunk-75Z2AOVW-B4sXgwEx.js} +2 -2
- package/dist/client/assets/{chunk-DU6HZSFF-Bwy7A0TF.js → chunk-DU6HZSFF-DMXcgXT_.js} +2 -2
- package/dist/client/assets/{chunk-F27PBJKO-CVsi2uk3.js → chunk-F27PBJKO-CGf21cwH.js} +2 -2
- package/dist/client/assets/{chunk-GMAD6QVW-CVzXn5Hv.js → chunk-GMAD6QVW-mPVRZq9Z.js} +2 -2
- package/dist/client/assets/{chunk-GVQU2GXP-7pPJVhuz.js → chunk-GVQU2GXP-ChBHtvjy.js} +2 -2
- package/dist/client/assets/{chunk-IMKFNOWR-D-dmx49n.js → chunk-IMKFNOWR-BtgRygmA.js} +2 -2
- package/dist/client/assets/{chunk-L3NEJ4N5-DEJnMXSk.js → chunk-L3NEJ4N5-REmklvQl.js} +2 -2
- package/dist/client/assets/{chunk-OSK3NFVY-CBtNmbZ8.js → chunk-OSK3NFVY-m-QXUYaT.js} +2 -2
- package/dist/client/assets/{chunk-P2QGCYS3-TNHN3Sve.js → chunk-P2QGCYS3-CeefF5cA.js} +2 -2
- package/dist/client/assets/{chunk-POPQ4Y6H-1cq1nl-Z.js → chunk-POPQ4Y6H-C-_RXsmg.js} +2 -2
- package/dist/client/assets/{chunk-PWAF6VOD-B85KpsBk.js → chunk-PWAF6VOD-DflyqEaS.js} +2 -2
- package/dist/client/assets/{chunk-SHT3W25Y-3tA2UDk1.js → chunk-SHT3W25Y-R_Fg17nt.js} +2 -2
- package/dist/client/assets/{chunk-SVP7TREG-CHzBNDDY.js → chunk-SVP7TREG-BTfev3Yx.js} +2 -2
- package/dist/client/assets/{chunk-TICWLB2K-MeLbkhnz.js → chunk-TICWLB2K-C7WGvYp1.js} +2 -2
- package/dist/client/assets/classDiagram-ZZMXUADV-B0NhU5d_.js +2 -0
- package/dist/client/assets/classDiagram-v2-VYDZK3BY-B0NhU5d_.js +2 -0
- package/dist/client/assets/{color-picker-BWZhsiZJ.js → color-picker-D4_JMCD4.js} +2 -2
- package/dist/client/assets/{combobox-BdGKdc6i.js → combobox-CJgXDxx7.js} +2 -2
- package/dist/client/assets/{command-CIj8Rufv.js → command-Bdd9mlwd.js} +2 -2
- package/dist/client/assets/{composer-logic-DyIi6K9e.js → composer-logic-De298qJ8.js} +4 -4
- package/dist/client/assets/{composerDraftUploads-BEFyD-t4.js → composerDraftUploads-DojMN9dn.js} +2 -2
- package/dist/client/assets/{connect-BUAMGrjt.js → connect-DqGJc6Zq.js} +2 -2
- package/dist/client/assets/{connect-agent-BNwEsc4t.js → connect-agent-Dss1yfYI.js} +2 -2
- package/dist/client/assets/{cynefin-OW5HDTMX-DTUXnTov.js → cynefin-OW5HDTMX-DnGTy7Az.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-5FMLGOSQ-Cd9_EwZX.js → cynefinDiagram-5FMLGOSQ-va9nLZtf.js} +2 -2
- package/dist/client/assets/{dagre-GXQ25YYZ-D0hUgab8.js → dagre-GXQ25YYZ-D0QXSOGs.js} +2 -2
- package/dist/client/assets/{design-DaqMSnWJ.js → design-C9BU7qd7.js} +2 -2
- package/dist/client/assets/{device-DnfWBPpo.js → device-CtPu58XW.js} +2 -2
- package/dist/client/assets/{diagram-S7CK7UJ4-DY-wIVhL.js → diagram-S7CK7UJ4-cEFyiWjL.js} +2 -2
- package/dist/client/assets/{diagram-UQ7AKVKN-CmWAx8wR.js → diagram-UQ7AKVKN-CNgu8Xrb.js} +2 -2
- package/dist/client/assets/{diagram-VSXAHHWV-DvIYORJP.js → diagram-VSXAHHWV-BPPJ-FGp.js} +2 -2
- package/dist/client/assets/{diagram-VX7I27RA-Dj3l0KCm.js → diagram-VX7I27RA-DmmJR7mF.js} +2 -2
- package/dist/client/assets/{diagram-Z3DM3KII-ClP8dtWB.js → diagram-Z3DM3KII-B2E7hDLy.js} +2 -2
- package/dist/client/assets/{dialog-Cgb4jap2.js → dialog-Bdi4gsq5.js} +2 -2
- package/dist/client/assets/{diffRendering-BWY0g219.js → diffRendering-Dam20Pyq.js} +2 -2
- package/dist/client/assets/{discovery-list-DXkskf2A.js → discovery-list-CPLxz_C8.js} +2 -2
- package/dist/client/assets/{dist-C5JAYxip.js → dist-BDrj9x6z.js} +3 -3
- package/dist/client/assets/{draft-input-DQxVE9YJ.js → draft-input-CmGR2Zc1.js} +2 -2
- package/dist/client/assets/{duoViewer-fztyITHM.js → duoViewer-D-r4O9JA.js} +2 -2
- package/dist/client/assets/{dynamic-CnYAeR9T.js → dynamic-Cog_ioOk.js} +3 -3
- package/dist/client/assets/{ebnfDiagram-PWID7BFC-DtbBVfJO.js → ebnfDiagram-PWID7BFC-CdqWonW-.js} +2 -2
- package/dist/client/assets/{embeddedScripts-Bf2j7tmA.js → embeddedScripts-twbjTzvu.js} +2 -2
- package/dist/client/assets/{empty-DHl8_LXy.js → empty-DeLw5x6B.js} +2 -2
- package/dist/client/assets/{entities-BJgMc8pv.js → entities-BhpgabTo.js} +2 -2
- package/dist/client/assets/{erDiagram-RLTQ6QDP-Dm2mBAGp.js → erDiagram-RLTQ6QDP-Cj9VHvs2.js} +2 -2
- package/dist/client/assets/eventmodeling-NTZA5JFV-CkU6Du-F.js +1 -0
- package/dist/client/assets/{fileLinks-C9oYzhXv.js → fileLinks-CCxqMBvI.js} +2 -2
- package/dist/client/assets/{fileTreeExpansion-CpkONCrM.js → fileTreeExpansion-N_KS64dO.js} +2 -2
- package/dist/client/assets/flowDiagram-HODETNUW-BvniDpHa.js +1 -0
- package/dist/client/assets/{ganttDiagram-EL5Y4UJY-D4UHegQH.js → ganttDiagram-EL5Y4UJY--tZCMTKs.js} +2 -2
- package/dist/client/assets/{getDiffFileInput-BKRfCrth.js → getDiffFileInput-wQ-J_p6Q.js} +2 -2
- package/dist/client/assets/{gitGraph-4MIJSDKK-BUhEDO22.js → gitGraph-4MIJSDKK-Dw_fdYPs.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-WWUBYQGX-BwJT0OjN.js → gitGraphDiagram-WWUBYQGX-mCz7mnTd.js} +2 -2
- package/dist/client/assets/{guideRunStore-DkBR0CPU.js → guideRunStore-Dk9f0e_S.js} +2 -2
- package/dist/client/assets/hat-glasses-D7AuONMv.js +2 -0
- package/dist/client/assets/{htmlRender-BUb_wWp9.js → htmlRender-CSsSEPs1.js} +2 -2
- package/dist/client/assets/{index-BYQ1ybfT.js → index-B0OiR0Ol.js} +3 -3
- package/dist/client/assets/{info-A6RAGUB7-scwAD75p.js → info-A6RAGUB7-Dm2Q2YW8.js} +1 -1
- package/dist/client/assets/{infoDiagram-27XIBGKW-BgR5Wn6l.js → infoDiagram-27XIBGKW-CRahhr54.js} +2 -2
- package/dist/client/assets/{input-D_jxqXLR.js → input-CDBTiBJx.js} +2 -2
- package/dist/client/assets/{input-group-BM_USnbh.js → input-group-CHJvPXpi.js} +2 -2
- package/dist/client/assets/{ishikawaDiagram-5VMMS53U-BOnOvOet.js → ishikawaDiagram-5VMMS53U-B8BPPaoL.js} +2 -2
- package/dist/client/assets/{journeyDiagram-3NMN7TZE-B1wXWe62.js → journeyDiagram-3NMN7TZE-CyL0jLPT.js} +2 -2
- package/dist/client/assets/{kanban-definition-UXKFOSKX-DI-FwQ_D.js → kanban-definition-UXKFOSKX-cbdied2B.js} +2 -2
- package/dist/client/assets/{kbd-B2uytHus.js → kbd-BGpxKPhX.js} +2 -2
- package/dist/client/assets/{keybindings-CqjUKNRx.js → keybindings-4i_VvPsX.js} +2 -2
- package/dist/client/assets/{lazyRouteComponent-CByGrW41.js → lazyRouteComponent-DehCr3JG.js} +2 -2
- package/dist/client/assets/{line-c6BqGnEH.js → line-qgzYahVp.js} +2 -2
- package/dist/client/assets/{link-BjP3qTK9.js → link-DQSgeAPg.js} +2 -2
- package/dist/client/assets/{linkedPrompt-DjSidfRe.js → linkedPrompt-BZnl7hrP.js} +2 -2
- package/dist/client/assets/{main-4dRVuXx2.js → main-BgKiw-9f.js} +19 -19
- package/dist/client/assets/main-Dk22djvP.css +2 -0
- package/dist/client/assets/{mediaReference-CWzBBNFa.js → mediaReference-BhzLpYF9.js} +2 -2
- package/dist/client/assets/{mediaSource-CHfRwmOf.js → mediaSource-Bk_NKKP2.js} +2 -2
- package/dist/client/assets/{mermaid-parser.core-DOOH_cP_.js → mermaid-parser.core-Dbb1WTb8.js} +4 -4
- package/dist/client/assets/{mermaid.core-9Tao6ZdD.js → mermaid.core-Dtz8UzUI.js} +5 -5
- package/dist/client/assets/{mindmap-definition-YA3MSWOX-CqmRXnVH.js → mindmap-definition-YA3MSWOX-D7G9MbUQ.js} +2 -2
- package/dist/client/assets/number-field-j3MeOhOk.js +2 -0
- package/dist/client/assets/{observeResize-jHx61cGA.js → observeResize-3DufCT68.js} +2 -2
- package/dist/client/assets/{onboarding-BmDFkmWD.js → onboarding-CXb4LvSr.js} +2 -2
- package/dist/client/assets/{openFileInPreview-DF_vZEIK.js → openFileInPreview-B8KdOFV6.js} +2 -2
- package/dist/client/assets/{p4ProjectFile-YfIRB1xP.js → p4ProjectFile-BrXxii5J.js} +2 -2
- package/dist/client/assets/{packet-AYTQ26CC-B8LkZ5j3.js → packet-AYTQ26CC-3JoyTbIn.js} +1 -1
- package/dist/client/assets/{pair-DSE8uuft.js → pair-B6bpqsN5.js} +2 -2
- package/dist/client/assets/{pegDiagram-XKGWAZYB-CS17GwTP.js → pegDiagram-XKGWAZYB-7VJjFwNR.js} +2 -2
- package/dist/client/assets/{pendingSendStore-CaGsppQi.js → pendingSendStore-DWZwD8Qe.js} +2 -2
- package/dist/client/assets/{phoneViewer-CYzqv5af.js → phoneViewer-DDX1p0cN.js} +2 -2
- package/dist/client/assets/{pie-WAS4IAKB-B0WBcNHW.js → pie-WAS4IAKB-CXeLZCFV.js} +1 -1
- package/dist/client/assets/{pieDiagram-E7YTZNPT-Bk2IwUHp.js → pieDiagram-E7YTZNPT-BY1P4Uer.js} +2 -2
- package/dist/client/assets/{pierre-icons-CY4HbMoq.js → pierre-icons-CL-szz98.js} +2 -2
- package/dist/client/assets/{popover-2XJd3KEJ.js → popover-N-pn4OqA.js} +2 -2
- package/dist/client/assets/{preview-8bBtJM5H.js → preview-DL8QWLgw.js} +2 -2
- package/dist/client/assets/{preview-B5v36DP8.js → preview-HJcGsd2o.js} +2 -2
- package/dist/client/assets/{previewMiniPlayerStore-DMd0mA7a.js → previewMiniPlayerStore--CyDShCc.js} +2 -2
- package/dist/client/assets/primary-rJDv25B2.js +2 -0
- package/dist/client/assets/{primaryCloudLinkState-CJSCsrUH.js → primaryCloudLinkState-CzF2gmHs.js} +2 -2
- package/dist/client/assets/{projectFilesQueryState-DltGYM_H.js → projectFilesQueryState-DM9_vSRA.js} +2 -2
- package/dist/client/assets/{projectScriptEditor-CZb_iNq3.js → projectScriptEditor-Pml2NkVE.js} +2 -2
- package/dist/client/assets/{providerSkills-Ct4SZ-mY.js → providerSkills-waACvYAJ.js} +2 -2
- package/dist/client/assets/{pullRequestDetail.logic-COstpMB1.js → pullRequestDetail.logic-C-5flOlM.js} +2 -2
- package/dist/client/assets/{pullRequestIcons-e8EZW8_y.js → pullRequestIcons-B9gjoHK4.js} +2 -2
- package/dist/client/assets/{pullRequestReviewStore-DJx8EOVl.js → pullRequestReviewStore-DuoLLEGp.js} +2 -2
- package/dist/client/assets/{pullRequests-ClG7PJe0.js → pullRequests-Br_9L7m4.js} +2 -2
- package/dist/client/assets/{quadrantDiagram-AXDQQJYC-B0vWHjBG.js → quadrantDiagram-AXDQQJYC-DyZq_mGc.js} +2 -2
- package/dist/client/assets/queries-CuZx4Gi3.js +2 -0
- package/dist/client/assets/query-DrtB5w10.js +2 -0
- package/dist/client/assets/{radar-RG4KPBEZ-DmYBXYPt.js → radar-RG4KPBEZ-B21YfCpU.js} +1 -1
- package/dist/client/assets/{radio-group-BNV16qlg.js → radio-group-D5b1YnNe.js} +2 -2
- package/dist/client/assets/{railroad-74A4TZTK-D-4grcyc.js → railroad-74A4TZTK-CaiYAzxA.js} +1 -1
- package/dist/client/assets/railroad-abnf-HS5TGJTU-ZJmaNeUq.js +1 -0
- package/dist/client/assets/railroad-ebnf-LZEXJU2U-C27brj-I.js +1 -0
- package/dist/client/assets/railroad-peg-WCYAUIDC-CukzLv2P.js +1 -0
- package/dist/client/assets/{railroadDiagram-O6MQD6OU-C7n4Qist.js → railroadDiagram-O6MQD6OU-BZ0HuIrV.js} +2 -2
- package/dist/client/assets/{renderScheduler-DrstEe4y.js → renderScheduler-xdSjl5z7.js} +2 -2
- package/dist/client/assets/{requirementDiagram-BXWQKSXE-BYX3uen6.js → requirementDiagram-BXWQKSXE-C4OJUf9q.js} +2 -2
- package/dist/client/assets/{rightPanelStore-XfAJpUIA.js → rightPanelStore-BLSD3K6s.js} +2 -2
- package/dist/client/assets/{runtime-CArTL2GH.js → runtime-V62Oyi1q.js} +2 -2
- package/dist/client/assets/{runtime-Cj24N7je.js → runtime-mg6KxRIi.js} +3 -3
- package/dist/client/assets/runtimeModeConfig-CSStNUjU.js +2 -0
- package/dist/client/assets/{sankeyDiagram-P5KCCOFB-tAgp-_Ny.js → sankeyDiagram-P5KCCOFB-CDOw9Kul.js} +2 -2
- package/dist/client/assets/{scheduledTasksSettings.logic-zleH3iJ_.js → scheduledTasksSettings.logic-CrYg_vYi.js} +2 -2
- package/dist/client/assets/{scroll-area-DORwTFtw.js → scroll-area-CT3H0nmo.js} +2 -2
- package/dist/client/assets/{select-Bsag72zE.js → select-CqPGedM1.js} +2 -2
- package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-DlvnWAh_.js → sequenceDiagram-WJ2MYXX4-C9BMDi3Q.js} +2 -2
- package/dist/client/assets/{server-Vynm5NwP.js → server-C8OpoOTL.js} +2 -2
- package/dist/client/assets/{session-DyiiEN5g.js → session-BAH17FBJ.js} +2 -2
- package/dist/client/assets/{session-logic-B8t9Dfk3.js → session-logic-BKiIVDj0.js} +2 -2
- package/dist/client/assets/{settings-CjeBlT1I.js → settings-BiLwAn9B.js} +2 -2
- package/dist/client/assets/settings.appearance-DB8azH3Q.js +2 -0
- package/dist/client/assets/settings.archived-BgPgmE5p.js +2 -0
- package/dist/client/assets/{settings.computer-use-S7DPGiAx.js → settings.computer-use-DpcKtt2q.js} +2 -2
- package/dist/client/assets/settings.connections-RKFcKfpz.js +2 -0
- package/dist/client/assets/{settings.data-controls-Bj1pQ5cL.js → settings.data-controls-NjUH57Fr.js} +2 -2
- package/dist/client/assets/{settings.decisions-BufUBcem.js → settings.decisions-B-HjeKFr.js} +2 -2
- package/dist/client/assets/{settings.designs-bWCNQca4.js → settings.designs-DWbfEcuK.js} +2 -2
- package/dist/client/assets/{settings.diagnostics-Dx_NdxOm.js → settings.diagnostics-DY7e0sc8.js} +2 -2
- package/dist/client/assets/settings.general-dsLXGi9j.js +2 -0
- package/dist/client/assets/settings.integrations-BLYy6l0O.js +2 -0
- package/dist/client/assets/{settings.keybindings-DrBH8mlK.js → settings.keybindings-Bcl4KxN4.js} +2 -2
- package/dist/client/assets/{settings.open-source-licenses-B3CGE-JI.js → settings.open-source-licenses-ZP9ezdc4.js} +2 -2
- package/dist/client/assets/{settings.plugins-BGUgmDOY.js → settings.plugins-JjZ7Ptzj.js} +4 -4
- package/dist/client/assets/settings.projects-DhhMAw0F.js +4 -0
- package/dist/client/assets/settings.providers-sowFjazx.js +3 -0
- package/dist/client/assets/settings.scheduled-tasks-BIfprPPD.js +2 -0
- package/dist/client/assets/{settings.snap-shot-C2X5_E0H.js → settings.snap-shot-B1go--dA.js} +2 -2
- package/dist/client/assets/{settings.source-control-Dvac_5mZ.js → settings.source-control-BL1tH7qk.js} +2 -2
- package/dist/client/assets/{settings.storage-1JdpL3lo.js → settings.storage-Bt_7LmzS.js} +2 -2
- package/dist/client/assets/{settingsLayout-CuUCC6iL.js → settingsLayout-DaLF8Hfm.js} +3 -3
- package/dist/client/assets/{sidebar-CV_a9dPF.js → sidebar-BopQa8qy.js} +2 -2
- package/dist/client/assets/{sidebarProjectGrouping-r5ezKRMx.js → sidebarProjectGrouping-DQInVNnY.js} +2 -2
- package/dist/client/assets/{skeleton-Bq50sEah.js → skeleton-CzpSBxtu.js} +2 -2
- package/dist/client/assets/{sourceControl-b1QZpCro.js → sourceControl-B9T0IPlu.js} +2 -2
- package/dist/client/assets/{sourceControlClients-DUvOeR-2.js → sourceControlClients-BgBu2ayZ.js} +2 -2
- package/dist/client/assets/{spinner-Bzrp5oww.js → spinner-BkmZz-kc.js} +2 -2
- package/dist/client/assets/square-plus-B9j2jkOq.js +2 -0
- package/dist/client/assets/{standalone-page-BGqmgLmI.js → standalone-page-CpVawPkl.js} +2 -2
- package/dist/client/assets/{stateDiagram-D77RDMKH-BOgNCEU1.js → stateDiagram-D77RDMKH-B032MgyK.js} +2 -2
- package/dist/client/assets/stateDiagram-v2-MP3YSRHH-CEPamUoD.js +2 -0
- package/dist/client/assets/{swimlanes-42K2YHIH-BZG7hJb7.js → swimlanes-42K2YHIH-Bn6WbS8G.js} +2 -2
- package/dist/client/assets/swimlanesDiagram-VR7AAH4N-D1eJox12.js +9 -0
- package/dist/client/assets/{terminal-links-DHw7nXFF.js → terminal-links-D1lZWzBL.js} +2 -2
- package/dist/client/assets/{terminalSessions-BHzkH7av.js → terminalSessions-BjIB3wg1.js} +2 -2
- package/dist/client/assets/{textarea-wDfYVvpo.js → textarea-UGuOTqiM.js} +2 -2
- package/dist/client/assets/{themePalette-CLR_iiPi.js → themePalette-DELPwUM7.js} +2 -2
- package/dist/client/assets/{timeline-definition-24CTP7MA-B5YiUA25.js → timeline-definition-24CTP7MA-RGCq2eyK.js} +2 -2
- package/dist/client/assets/toast-B2B2ECBW.js +2 -0
- package/dist/client/assets/{toggle-ExdxBJoI.js → toggle-DTjg9Rvs.js} +2 -2
- package/dist/client/assets/{toggle-group-Clz6KDtW.js → toggle-group--s5MIuQv.js} +2 -2
- package/dist/client/assets/{tooltip-D-SzZpgJ.js → tooltip-CuJiZzK7.js} +2 -2
- package/dist/client/assets/{treeView-Q6P3EWNA-Cb4H3xoG.js → treeView-Q6P3EWNA-CkhQE3UU.js} +1 -1
- package/dist/client/assets/{treemap-WGGIJYW6-BdpTgSX1.js → treemap-WGGIJYW6-DjBfz9t-.js} +1 -1
- package/dist/client/assets/{uiStateStore-DoJ0IbwQ.js → uiStateStore-TZf81BHB.js} +2 -2
- package/dist/client/assets/usage-Dp-M0_Do.js +2 -0
- package/dist/client/assets/{usageAccess-ZgmQIiWk.js → usageAccess-CkJJNWUS.js} +2 -2
- package/dist/client/assets/{usageFormat-C54RJiV9.js → usageFormat-CUKLjyKC.js} +2 -2
- package/dist/client/assets/{usageShortcuts-B3af64g0.js → usageShortcuts-DMVEjVe8.js} +2 -2
- package/dist/client/assets/{use-atom-command-D34CFqu3.js → use-atom-command-BWLbyoVN.js} +2 -2
- package/dist/client/assets/{useAriaLabelledBy-BG5RCb1o.js → useAriaLabelledBy-B4zsIPk4.js} +2 -2
- package/dist/client/assets/{useHandleNewThread-DtUtwJAY.js → useHandleNewThread-DLupIP68.js} +2 -2
- package/dist/client/assets/{useLocation-7uJHNdPS.js → useLocation-XbiRdmmb.js} +2 -2
- package/dist/client/assets/useNavigate-CSxB1zLo.js +2 -0
- package/dist/client/assets/{useNavigateBack-DpCLZais.js → useNavigateBack-BDMTgSKu.js} +2 -2
- package/dist/client/assets/{useP4ConnectAuthPrompt-D4kHnZ3Q.js → useP4ConnectAuthPrompt-C18iYCzm.js} +2 -2
- package/dist/client/assets/{useParams-Br7l7qPU.js → useParams-DNmNCHjx.js} +2 -2
- package/dist/client/assets/{usePermissionStatus-SyBwmFSK.js → usePermissionStatus-DBybaxyT.js} +2 -2
- package/dist/client/assets/{usePullRequestActions-BypvA9CK.js → usePullRequestActions-CWCz_AQW.js} +3 -3
- package/dist/client/assets/{useRegisterFieldControl-qXOWsCr5.js → useRegisterFieldControl-Cuo8UAhZ.js} +2 -2
- package/dist/client/assets/useScopedModelAvailability-D1MGYLGR.js +2 -0
- package/dist/client/assets/useSettings-BEKkRzL1.js +3 -0
- package/dist/client/assets/utils-B0w8dSf5.js +37 -0
- package/dist/client/assets/{vcsRefInvalidation-hPKz3TmL.js → vcsRefInvalidation-Dx_cpFEA.js} +2 -2
- package/dist/client/assets/{vennDiagram-4TSXK5OY-D4zvlwrY.js → vennDiagram-4TSXK5OY-D0wsDnkf.js} +2 -2
- package/dist/client/assets/{wardley-WFR3VGLG-Cscy0eBS.js → wardley-WFR3VGLG-BT7dOBGA.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-VM6X3IG4-od5X9Ppf.js → wardleyDiagram-VM6X3IG4-CgbZOhZ-.js} +2 -2
- package/dist/client/assets/{welcome-7UQgfS5x.js → welcome-D3Kttsfe.js} +2 -2
- package/dist/client/assets/{xychartDiagram-S5SC5T6Z-KWfWaW4I.js → xychartDiagram-S5SC5T6Z-D3RW49u7.js} +2 -2
- package/dist/client/index.html +1 -1
- package/package.json +1 -1
- package/dist/client/assets/AlertDialogRoot-Cc8kVCUa.js +0 -2
- package/dist/client/assets/ChatMarkdown-Cd3yE4VU.js +0 -65
- package/dist/client/assets/ComposerPromptEditor-4EkkS1N5.js +0 -204
- package/dist/client/assets/DevicePanel-DWlHQcLW.js +0 -2
- package/dist/client/assets/DiffPanel-tZN29mdM.js +0 -2
- package/dist/client/assets/Input-B0ah2lnC.js +0 -2
- package/dist/client/assets/PanelLayoutControls-C2deQDB2.js +0 -216
- package/dist/client/assets/PreviewPanel-8NDLwOfI.js +0 -2
- package/dist/client/assets/ProjectDefaultsSettings-DN1GxlYC.js +0 -2
- package/dist/client/assets/ProviderModelPicker-DMtMvBKn.js +0 -2
- package/dist/client/assets/ScheduledTasksSettings-BJyFxVyR.js +0 -4
- package/dist/client/assets/TooltipViewport-DJ2VRKCt.js +0 -2
- package/dist/client/assets/_chat-C0vR23gu.js +0 -45
- package/dist/client/assets/_chat.pull-requests-BfyCJw7Q.js +0 -2
- package/dist/client/assets/architecture-7GRP2DOG-Yd6b7qRF.js +0 -1
- package/dist/client/assets/channel-DrCQqhMU.js +0 -2
- package/dist/client/assets/classDiagram-ZZMXUADV-MCjIu9oU.js +0 -2
- package/dist/client/assets/classDiagram-v2-VYDZK3BY-MCjIu9oU.js +0 -2
- package/dist/client/assets/eventmodeling-NTZA5JFV-rDo_pcJr.js +0 -1
- package/dist/client/assets/flowDiagram-HODETNUW-C55XBPww.js +0 -1
- package/dist/client/assets/hat-glasses-XqtwpGM5.js +0 -2
- package/dist/client/assets/main-Dwir4BoC.css +0 -2
- package/dist/client/assets/number-field-Dj0uYTJQ.js +0 -2
- package/dist/client/assets/primary-BKQnuXrW.js +0 -2
- package/dist/client/assets/queries-BWcz-n4a.js +0 -2
- package/dist/client/assets/query-BFP47tsD.js +0 -2
- package/dist/client/assets/railroad-abnf-HS5TGJTU-6H_zYY6R.js +0 -1
- package/dist/client/assets/railroad-ebnf-LZEXJU2U-DYahAqN_.js +0 -1
- package/dist/client/assets/railroad-peg-WCYAUIDC-CdcgHAXA.js +0 -1
- package/dist/client/assets/runtimeModeConfig-sQBlbgY3.js +0 -2
- package/dist/client/assets/settings.appearance-DUvYlE0y.js +0 -2
- package/dist/client/assets/settings.archived-B5WGVqfk.js +0 -2
- package/dist/client/assets/settings.connections-DJEqNVad.js +0 -2
- package/dist/client/assets/settings.general-BQ6775Hi.js +0 -2
- package/dist/client/assets/settings.integrations-CgxBXw6p.js +0 -2
- package/dist/client/assets/settings.projects-BJ1cpGGM.js +0 -4
- package/dist/client/assets/settings.providers-D2I5mNzk.js +0 -3
- package/dist/client/assets/settings.scheduled-tasks-D8hRaqp8.js +0 -2
- package/dist/client/assets/square-plus-CeFmBUPF.js +0 -2
- package/dist/client/assets/stateDiagram-v2-MP3YSRHH-D00LPIWv.js +0 -2
- package/dist/client/assets/swimlanesDiagram-VR7AAH4N-vkEAWikD.js +0 -9
- package/dist/client/assets/toast-B3hjhWRf.js +0 -2
- package/dist/client/assets/usage-C2lJ6qWL.js +0 -2
- package/dist/client/assets/useNavigate-DCj963r2.js +0 -2
- package/dist/client/assets/useScopedModelAvailability-YXOv7_8D.js +0 -2
- package/dist/client/assets/useSettings-BcmuuiTp.js +0 -3
- package/dist/client/assets/utils-hgbJ2TVM.js +0 -37
|
@@ -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{Aa as r,Ad as i,Ao as a,Ba as o,Bi as s,D as c,Do as l,Ea as u,Eo as d,Fp as f,Fr as p,Gy as m,Ha as h,Jm as g,Ju as _,La as v,Ld as y,Lf as b,Mr as x,Od as S,Om as C,Oy as w,Pu as T,RE as E,Sa as D,Si as O,So as k,Ua as ee,Ui as A,Vy as j,Wi as M,Xs as N,_a as P,aa as F,ba as te,bt as ne,ca as re,da as I,dr as ie,fa as L,jm as ae,ki as R,ko as oe,kr as se,lb as z,li as B,lr as V,lu as ce,mE as le,na as ue,pa as H,ra as de,sa as U,t as W,ua as fe,ul as pe,va as me,xo as he,za as ge}from"./utils-hgbJ2TVM.js";import{jn as _e}from"./runtime-Cj24N7je.js";import{d as ve,f as ye,l as be,m as G,u as xe,x as Se}from"./TooltipViewport-DJ2VRKCt.js";import{t as Ce}from"./spinner-Bzrp5oww.js";import{t as we}from"./useParams-Br7l7qPU.js";var Te=z(pe),Ee=z(ce);function De(e){return Ee(e)&&(e.reason===`thread_not_empty`||e.reason===`thread_not_side_chat`)}function Oe(e){return Te(e)&&e.bootstrapThreadDisposition===`deleted`}function ke(e){return Te(e)&&e.bootstrapThreadDisposition===`not-created`}var Ae=[/\bSocketCloseError\b/i,/\bSocketOpenError\b/i,/\bSocket is not connected\b/i,/Unable to connect to the P4 server WebSocket\./i,RegExp(`\\b(?:is not connected|disconnected|stopped responding|could not establish a WebSocket connection)\\.(?: ${(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`))(_e)})?$`,`i`),/\bClientProtocolError\b/i,/\bRpcClientError\b/i,/\bping timeout\b/i];function je(e){if(typeof e!=`string`)return!1;let t=e.trim();return t.length!==0&&Ae.some(e=>e.test(t))}function Me(e){return je(e)?null:e??null}var K=e(n()),Ne=K.createContext(void 0);function Pe(){let e=K.useContext(Ne);if(!e)throw Error(a(73));return e}var Fe=0;function Ie(e){return Fe+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${Fe}`}function Le(e,t){if(typeof e==`string`)return{description:e};if(typeof e==`function`){let n=e(t);return typeof n==`string`?{description:n}:n}return e}function Re(e){let t=new Map,n=0,r=0;return e.forEach((e,i)=>{let a=e.transitionStatus===`ending`;t.set(e.id,{value:e,domIndex:i,visibleIndex:a?-1:n,offsetY:r}),r+=e.height||0,a||(n+=1)}),t}var ze=e=>e.toastMetadata,q={toasts:R(e=>e.toasts),isEmpty:R(e=>e.toasts.length===0),toast:R(ze,(e,t)=>e.get(t)?.value),toastIndex:R(ze,(e,t)=>e.get(t)?.domIndex??-1),toastOffsetY:R(ze,(e,t)=>e.get(t)?.offsetY??0),toastVisibleIndex:R(ze,(e,t)=>e.get(t)?.visibleIndex??-1),hovering:R(e=>e.hovering),focused:R(e=>e.focused),expanded:R(e=>e.hovering||e.focused),expandedOrOutOfFocus:R(e=>e.hovering||e.focused||!e.isWindowFocused),prevFocusElement:R(e=>e.prevFocusElement)},Be=class extends O{timers=new Map;areTimersPaused=!1;constructor(e){super({...e,toastMetadata:Re(e.toasts)},{},q)}setFocused(e){this.set(`focused`,e)}setHovering(e){this.set(`hovering`,e)}setIsWindowFocused(e){this.set(`isWindowFocused`,e)}setPrevFocusElement(e){this.set(`prevFocusElement`,e)}setViewport=e=>{this.set(`viewport`,e)};disposeEffect=()=>()=>{this.timers.forEach(e=>{e.timeout?.clear()}),this.timers.clear()};removeToast(e,t={}){let n=q.toastIndex(this.state,e);if(n===-1)return;let r=this.state.toasts[n];t.skipOnRemove||r?.onRemove?.();let i=[...this.state.toasts];i.splice(n,1),this.setToasts(i)}addToast=e=>{let{timeout:t,limit:n}=this.state,r=e.id||Ie(`toast`);if(e.id){let t=q.toast(this.state,e.id);if(t){if(t.transitionStatus===`ending`)this.removeToast(e.id,{skipOnRemove:!0});else{let{id:t,transitionStatus:n,...r}=e;return this.updateToastInternal(e.id,r,{resetTimer:!0,markUpdated:!0}),e.id}}}let i={...e,id:r,updateKey:0,transitionStatus:`starting`},a=[i,...this.state.toasts],o=a.filter(e=>e.transitionStatus!==`ending`);if(o.length>n){let e=o.length-n,t=o.slice(-e),r=new Set(t.map(e=>e.id));this.setToasts(a.map(e=>{let t=r.has(e.id);return e.limited===t?e:{...e,limited:t}}))}else this.setToasts(a.map(e=>e.limited?{...e,limited:!1}:e));let s=i.timeout??t;return i.type!==`loading`&&s>0&&this.scheduleTimer(r,s,()=>this.closeToast(r)),q.expandedOrOutOfFocus(this.state)&&this.pauseTimers(),r};updateToast=(e,t)=>{this.updateToastInternal(e,t,{markUpdated:!0})};updateToastInternal=(e,t,n={})=>{let{timeout:r,toasts:i}=this.state,a=q.toast(this.state,e)??null;if(!a||a.transitionStatus===`ending`)return;let o={...a,...t,...n.markUpdated&&{updateKey:(a.updateKey??0)+1}};this.setToasts(i.map(t=>t.id===e?o:t));let s=o.timeout??r,c=a?.timeout??r,l=Object.hasOwn(t,`timeout`),u=o.transitionStatus!==`ending`&&o.type!==`loading`&&s>0,d=this.timers.has(e),f=c!==s,p=a?.type===`loading`;if(!u&&d){this.timers.get(e)?.timeout?.clear(),this.timers.delete(e);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:Re(o)};(t||r.length===1)&&(s.hovering=!1,s.focused=!1),this.update(s),i.forEach(e=>{e.transitionStatus!==`ending`&&e.onClose?.()}),this.handleFocusManagement(e)};promiseToast=(e,t)=>{let n=Le(t.loading),r=this.addToast({...n,type:`loading`}),i=e.then(e=>{let n=Le(t.success,e);return this.updateToast(r,{...n,type:`success`,timeout:n.timeout}),e}).catch(e=>{let n=Le(t.error,e);return this.updateToast(r,{...n,type:`error`,timeout:n.timeout}),Promise.reject(e)});return{}.hasOwnProperty.call(t,`setPromise`)&&t.setPromise(i),i};pauseTimers(){this.areTimersPaused||(this.areTimersPaused=!0,this.timers.forEach(e=>{if(e.timeout){e.timeout.clear();let t=Date.now()-e.start,n=e.delay-t;e.remaining=n>0?n:0}}))}resumeTimers(){this.areTimersPaused&&(this.areTimersPaused=!1,this.timers.forEach((e,t)=>{e.remaining=e.remaining>0?e.remaining:e.delay,e.timeout??=P.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=H(e);L(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?P.create():void 0;a?.start(t,()=>{this.timers.delete(e),n()}),this.timers.set(e,{timeout:a,start:i?r:0,delay:t,remaining:t,callback:n})}setToasts(e){let t={toasts:e,toastMetadata:Re(e)};e.length===0&&(t.hovering=!1,t.focused=!1),this.update(t)}handleFocusManagement(e){let t=I(F(this.state.viewport));if(!this.state.viewport||!L(this.state.viewport,t)||!fe(t))return;if(e===void 0){this.restoreFocusToPrevElement();return}let n=q.toasts(this.state),r=q.toastIndex(this.state,e),i=null,a=r+1;for(;a<n.length;){if(n[a].transitionStatus!==`ending`){i=n[a];break}a+=1}if(!i)for(a=r-1;a>=0;){if(n[a].transitionStatus!==`ending`){i=n[a];break}--a}i?i.ref?.current?.focus():this.restoreFocusToPrevElement()}},J=e(le()),Ve=function(e){let{children:t,timeout:n=5e3,limit:r=3,toastManager:i}=e,a=oe(()=>new Be({timeout:n,limit:r,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return u(a.disposeEffect),K.useEffect(function(){if(i)return i[` subscribe`](({action:e,options:t})=>{let n=t.id;e===`promise`&&t.promise?a.promiseToast(t.promise,t):e===`update`&&n?a.updateToast(n,t):e===`close`?a.closeToast(n):a.addToast(t)})},[a,i]),a.useSyncedValues({timeout:n,limit:r}),(0,J.jsx)(Ne.Provider,{value:a,children:t})},He=function(e){return e.frontmostHeight=`--toast-frontmost-height`,e}({}),Ue=K.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,s=Pe(),c=me(),l=K.useRef(!1),u=K.useRef(!1),d=K.useRef(!1),f=s.useState(`isEmpty`),p=s.useState(`toasts`),m=s.useState(`focused`),g=s.useState(`expanded`),_=s.useState(`prevFocusElement`),v=p[0]?.height??0,y=K.useMemo(()=>p.some(e=>e.transitionStatus===`ending`),[p]),b=K.useMemo(()=>p.filter(e=>e.priority===`high`),[p]);K.useEffect(()=>{let e=s.state.viewport;if(!e)return;function t(t){f||t.key===`F6`&&H(t)!==e&&(t.preventDefault(),s.setPrevFocusElement(I(F(e))),e?.focus({preventScroll:!0}),s.pauseTimers(),s.setFocused(!0))}let n=h(e);return re(n,`keydown`,t)},[s,f]),K.useEffect(()=>{let e=s.state.viewport;if(!e||f)return;let t=h(e);function n(e){H(e)===t&&(s.setIsWindowFocused(!1),s.pauseTimers())}function r(n){if(n.relatedTarget)return;let r=H(n),i=I(F(e));(r===t||!L(e,r)||!fe(i))&&s.resumeTimers(),c.start(0,()=>s.setIsWindowFocused(!0))}return U(re(t,`blur`,n,!0),re(t,`focus`,r,!0))},[s,c,f]),K.useEffect(()=>{let e=s.state.viewport;if(!e||f)return;let t=F(e);return re(t,`pointerdown`,s.handleDocumentPointerDown,!0)},[f,s]);function x(e){let t=s.state.viewport;t&&(l.current=!0,e.relatedTarget===t?p[0]?.ref?.current?.focus():s.restoreFocusToPrevElement())}function S(e){e.key===`Tab`&&e.shiftKey&&H(e.nativeEvent)===s.state.viewport&&(e.preventDefault(),s.restoreFocusToPrevElement(),s.resumeTimers())}function C(){let e=s.state.toasts.some(e=>e.transitionStatus===`ending`);s.state.isWindowFocused&&!e&&!d.current&&u.current&&(s.resumeTimers(),s.setHovering(!1),u.current=!1)}K.useEffect(C,[y,s]);function w(){s.pauseTimers(),s.setHovering(!0),u.current=!1}function T(){y||d.current?u.current=!0:(s.resumeTimers(),s.setHovering(!1))}function E(e){e.pointerType===`touch`&&(d.current=!0)}function D(e){e.pointerType===`touch`&&(d.current=!1,C())}function O(){if(l.current){l.current=!1;return}m||fe(I(F(s.state.viewport)))&&(s.setFocused(!0),s.pauseTimers())}function ee(e){m&&!L(s.state.viewport,e.relatedTarget)&&(s.setFocused(!1),s.resumeTimers())}let A={tabIndex:-1,role:`region`,"aria-live":`polite`,"aria-atomic":!1,"aria-relevant":`additions text`,"aria-label":`Notifications`,onMouseEnter:w,onMouseMove:w,onMouseLeave:T,onFocus:O,onBlur:ee,onKeyDown:S,onClick:O,onPointerDown:E,onPointerUp:D,onPointerCancel:D},j={expanded:g},M=k(`div`,e,{ref:[t,s.setViewport],state:j,props:[A,{style:{[He.frontmostHeight]:v?`${v}px`:void 0}},o,{children:(0,J.jsxs)(K.Fragment,{children:[!f&&_&&(0,J.jsx)(ue,{onFocus:x}),a,!f&&_&&(0,J.jsx)(ue,{onFocus:x})]})}]});return(0,J.jsxs)(K.Fragment,{children:[!f&&_&&(0,J.jsx)(ue,{onFocus:x}),M,!m&&b.length>0&&(0,J.jsx)(`div`,{style:de,children:b.map(e=>(0,J.jsxs)(`div`,{role:`alert`,"aria-atomic":!0,children:[(0,J.jsx)(`div`,{children:e.title}),(0,J.jsx)(`div`,{children:e.description})]},e.id))})]})}),We=e(D()),Ge=K.createContext(void 0);function Ke(){let e=K.useContext(Ge);if(!e)throw Error(a(66));return e}var Y=function(e){return e.index=`--toast-index`,e.offsetY=`--toast-offset-y`,e.height=`--toast-height`,e.swipeMovementX=`--toast-swipe-movement-x`,e.swipeMovementY=`--toast-swipe-movement-y`,e}({});function qe(e,t,n){switch(e){case`up`:return-n;case`down`:return n;case`left`:return-t;case`right`:return t;default:return 0}}function Je(e){let t=h(e).getComputedStyle(e).transform,n=0,r=0,i=1;if(t&&t!==`none`){let e=t.match(/matrix(?:3d)?\(([^)]+)\)/);if(e){let t=e[1].split(`, `).map(parseFloat);t.length===6?(n=t[4],r=t[5],i=Math.sqrt(t[0]*t[0]+t[1]*t[1])):t.length===16&&(n=t[12],r=t[13],i=t[0])}}return{x:n,y:r,scale:i}}var Ye={...he,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},Xe=40,Ze=10,X=.5,Qe=1,$e=`${s},${A}`,et=K.forwardRef(function(e,t){let{toast:n,render:r,className:i,swipeDirection:a=[`down`,`right`],style:s,...c}=e,l=n.positionerProps?.anchor!==void 0,u=[];l||(u=Array.isArray(a)?a:[a]);let d=u.length>0,f=Pe(),[m,h]=K.useState(void 0),[g,_]=K.useState(!1),[v,y]=K.useState(!1),[b,x]=K.useState(!1),[S,C]=K.useState({x:0,y:0}),[w,T]=K.useState({x:0,y:0,scale:1}),[E,D]=K.useState(),[O,ee]=K.useState(),[A,j]=K.useState(null),M=K.useRef(null),N=K.useRef({x:0,y:0}),P=K.useRef({x:0,y:0,scale:1}),ne=K.useRef(void 0),ie=K.useRef(0),ae=K.useRef(!1),R=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),V=f.useState(`toastIndex`,n.id),ce=f.useState(`toastVisibleIndex`,n.id),le=f.useState(`toastOffsetY`,n.id),ue=f.useState(`focused`),de=f.useState(`expanded`);te({open:n.transitionStatus!==`ending`,ref:M,onComplete(){n.transitionStatus===`ending`&&f.removeToast(n.id)}});let U=o((e=!1)=>{let t=M.current;if(!t)return;let r=t.style.height;t.style.height=`auto`;let i=t.offsetHeight;t.style.height=r;function a(){f.updateToastInternal(n.id,{ref:M,height:i,...n.transitionStatus===`starting`?{transitionStatus:void 0}:{}})}e?We.flushSync(a):a()});ge(U,[U]);function W(e){se.current=e,C(e)}ge(()=>()=>{B.current?.abort()},[]);function fe(e,t){let n=e,r=t;return!u.includes(`left`)&&!u.includes(`right`)?n=e>0?e**X:-(Math.abs(e)**X):(!u.includes(`right`)&&e>0&&(n=e**X),!u.includes(`left`)&&e<0&&(n=-(Math.abs(e)**X))),!u.includes(`up`)&&!u.includes(`down`)?r=t>0?t**X:-(Math.abs(t)**X):(!u.includes(`down`)&&t>0&&(r=t**X),!u.includes(`up`)&&t<0&&(r=-(Math.abs(t)**X))),{x:n,y:r}}let pe=o(e=>{if(e.pointerId!==z.current)return;z.current=null,B.current?.abort(),B.current=null,_(!1),y(!1),j(null);let t=P.current;if(e.type===`pointercancel`||ae.current){W({x:t.x,y:t.y}),h(void 0);return}let r=!1,i=se.current,a=i.x-t.x,o=i.y-t.y,s;for(let e of u){switch(e){case`right`:a>Xe&&(r=!0,s=`right`);break;case`left`:a<-40&&(r=!0,s=`left`);break;case`down`:o>Xe&&(r=!0,s=`down`);break;case`up`:o<-40&&(r=!0,s=`up`)}if(r)break}r?(h(s),x(!0),f.closeToast(n.id)):(W({x:t.x,y:t.y}),h(void 0))});function me(e){if(e.button!==0)return;e.pointerType===`touch`&&f.pauseTimers();let t=H(e.nativeEvent);if(t&&t.closest(`button,a,input,textarea,[role="button"],${$e}`))return;if(ae.current=!1,ne.current=void 0,ie.current=0,z.current=e.pointerId,N.current={x:e.clientX,y:e.clientY},R.current=N.current,M.current){let e=Je(M.current);P.current=e,T(e),W({x:e.x,y:e.y})}f.setHovering(!0),_(!0),y(!1),j(null),oe.current=!0;let n=M.current;if(n){B.current?.abort();let t=new AbortController;B.current=t;let r=F(n);r.addEventListener(`pointerup`,pe,{signal:t.signal}),r.addEventListener(`pointercancel`,pe,{signal:t.signal}),n.setPointerCapture?.(e.pointerId)}}function he(e){if(e.pointerId!==z.current)return;e.preventDefault(),oe.current&&=(N.current={x:e.clientX,y:e.clientY},!1);let{clientY:t,clientX:n,movementX:r,movementY:i}=e;(i<0&&t>R.current.y||i>0&&t<R.current.y)&&(R.current={x:R.current.x,y:t}),(r<0&&n>R.current.x||r>0&&n<R.current.x)&&(R.current={x:n,y:R.current.y});let a=n-N.current.x,o=t-N.current.y,s=t-R.current.y,c=n-R.current.x;if(!v&&Math.sqrt(a*a+o*o)>=Qe&&(y(!0),A===null)){let e=u.includes(`left`)||u.includes(`right`),t=u.includes(`up`)||u.includes(`down`);e&&t&&j(Math.abs(a)>Math.abs(o)?`horizontal`:`vertical`)}let l;if(!ne.current)A===`vertical`?o>0?l=`down`:o<0&&(l=`up`):A===`horizontal`?a>0?l=`right`:a<0&&(l=`left`):l=Math.abs(a)>=Math.abs(o)?a>0?`right`:`left`:o>0?`down`:`up`,l&&u.includes(l)&&(ne.current=l,ie.current=qe(l,a,o),h(l));else{let e=ne.current,t=qe(e,c,s);t>Xe?(ae.current=!1,h(e)):!(u.includes(`left`)&&u.includes(`right`))&&!(u.includes(`up`)&&u.includes(`down`))&&ie.current-t>=Ze&&(ae.current=!0)}let d=fe(a,o),f=P.current.x,p=P.current.y;A===`horizontal`?(u.includes(`left`)||u.includes(`right`))&&(f+=d.x):(A===`vertical`||(u.includes(`left`)||u.includes(`right`))&&(f+=d.x),(u.includes(`up`)||u.includes(`down`))&&(p+=d.y)),W({x:f,y:p})}function _e(e){if(e.key===`Escape`){if(!M.current||!L(M.current,I(F(M.current))))return;f.closeToast(n.id)}}K.useEffect(()=>{if(!d)return;let e=M.current;if(!e)return;function t(t){L(e,H(t))&&t.preventDefault()}return re(e,`touchmove`,t,{passive:!1})},[d]);function ve(){if(!g&&S.x===w.x&&S.y===w.y&&!b)return{[Y.swipeMovementX]:`0px`,[Y.swipeMovementY]:`0px`};let e=S.x-w.x,t=S.y-w.y;return{transition:g?`none`:void 0,transform:g?`translateX(${S.x}px) translateY(${S.y}px) scale(${w.scale})`:void 0,[Y.swipeMovementX]:`${e}px`,[Y.swipeMovementY]:`${t}px`}}let ye=n.priority===`high`,be={role:ye?`alertdialog`:`dialog`,tabIndex:0,"aria-modal":!1,"aria-labelledby":E,"aria-describedby":O,"aria-hidden":ye&&!ue?!0:void 0,onPointerDown:d?me:void 0,onPointerMove:d?he:void 0,onPointerUp:d?pe:void 0,onPointerCancel:d?pe:void 0,onKeyDown:_e,inert:p(n.limited),style:{...ve(),[Y.index]:n.transitionStatus===`ending`?V:ce,[Y.offsetY]:`${le}px`,[Y.height]:n.height?`${n.height}px`:void 0}},G=K.useMemo(()=>({rootRef:M,toast:n,titleId:E,setTitleId:D,descriptionId:O,setDescriptionId:ee,swiping:g,swipeDirection:m,recalculateHeight:U,index:V,visibleIndex:ce,expanded:de}),[n,E,O,g,m,U,V,ce,de]),xe={transitionStatus:n.transitionStatus,expanded:de,limited:n.limited||!1,type:n.type,swiping:G.swiping,swipeDirection:G.swipeDirection},Se=k(`div`,e,{ref:[t,G.rootRef],state:xe,stateAttributesMapping:Ye,props:[be,c]});return(0,J.jsx)(Ge.Provider,{value:G,children:Se})}),tt=K.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{visibleIndex:o,expanded:s,recalculateHeight:c}=Ke(),l=K.useRef(null);return ge(()=>{let e=l.current;if(!e||(c(),typeof ResizeObserver!=`function`||typeof MutationObserver!=`function`))return;let t=new ResizeObserver(()=>c(!0)),n=new MutationObserver(()=>c(!0));return t.observe(e),n.observe(e,{childList:!0,subtree:!0,characterData:!0}),()=>{t.disconnect(),n.disconnect()}},[c]),k(`div`,e,{ref:[t,l],state:{expanded:s,behind:o>0},props:a})}),nt=K.forwardRef(function(e,t){let{render:n,className:i,style:a,id:o,children:s,...c}=e,{toast:l,setDescriptionId:u}=Ke(),d=s??l.description,f=!!d,p=r(o);ge(()=>{if(f)return u(p),()=>{u(void 0)}},[f,p,u]);let m={type:l.type},h=k(`p`,e,{ref:t,state:m,props:{...c,id:p,children:d}});return f?h:null}),rt=K.forwardRef(function(e,t){let{render:n,className:i,style:a,id:o,children:s,...c}=e,{toast:l,setTitleId:u}=Ke(),d=s??l.title,f=!!d,p=r(o);ge(()=>{if(f)return u(p),()=>{u(void 0)}},[f,p,u]);let m={type:l.type},h=k(`h2`,e,{ref:t,state:m,props:{...c,id:p,children:d}});return f?h:null}),it=K.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a,nativeButton:o=!0,...s}=e,c=Pe(),{toast:l}=Ke(),u=c.useState(`expanded`),[d,f]=K.useState(!1),{getButtonProps:p,buttonRef:m}=v({disabled:a,native:o}),h={type:l.type};return k(`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]})}),at=K.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a,nativeButton:o=!0,...s}=e,{toast:c}=Ke(),l=c.actionProps?.children??s.children,u=!!l,{getButtonProps:d,buttonRef:f}=v({disabled:a,native:o}),p={type:c.type},m=k(`button`,e,{ref:[t,f],state:p,props:[s,c.actionProps,d,{children:l}]});return u?m:null}),ot=xe,st=K.createContext(void 0);function ct(){let e=K.useContext(st);if(e===void 0)throw Error(a(84));return e}var lt=K.forwardRef(function(e,t){let{toast:n,...r}=e,i=Pe(),a=n.positionerProps??d,{render:o,className:s,anchor:c=a.anchor,positionMethod:u=a.positionMethod??`absolute`,side:f=a.side??`top`,align:p=a.align??`center`,sideOffset:m=a.sideOffset??0,alignOffset:h=a.alignOffset??0,collisionBoundary:g=a.collisionBoundary??`clipping-ancestors`,collisionPadding:_=a.collisionPadding??5,arrowPadding:v=a.arrowPadding??5,sticky:y=a.sticky??!1,disableAnchorTracking:b=a.disableAnchorTracking??!1,collisionAvoidance:S=a.collisionAvoidance??M,style:C,...w}=r,[T,E]=K.useState(null),D=i.useState(`toastIndex`,n.id),O=i.useState(`toastVisibleIndex`,n.id),k=ee(c)?c:null,A=B({open:!0,onOpenChange:l,elements:{floating:T,reference:k}}),j=x({anchor:k,positionMethod:u,floatingRootContext:A,mounted:!0,side:f,sideOffset:m,align:p,alignOffset:h,collisionBoundary:g,collisionPadding:_,sticky:y,arrowPadding:v,disableAnchorTracking:b,keepMounted:!0,collisionAvoidance:S}),N=K.useMemo(()=>({side:j.side,align:j.align,anchorHidden:j.anchorHidden}),[j.side,j.align,j.anchorHidden]),P=se(e,N,{styles:{...j.positionerStyles,[Y.index]:n.transitionStatus===`ending`?D:O},transitionStatus:n.transitionStatus,props:w,refs:[t,E]});return(0,J.jsx)(st.Provider,{value:j,children:P})}),ut=K.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,{arrowRef:o,side:s,align:c,arrowUncentered:l,arrowStyles:u}=ct();return k(`div`,e,{state:{side:s,align:c,uncentered:l},ref:[t,o],props:[{style:u,"aria-hidden":!0},a]})});function dt(){let e=K.useContext(Ne);if(!e)throw Error(a(73));let t=e.useState(`toasts`);return K.useMemo(()=>({toasts:t,add:e.addToast,close:e.closeToast,update:e.updateToast,promise:e.promiseToast}),[t,e])}function ft(){let e=new Set;function t(t){e.forEach(e=>e(t))}return{" subscribe":function(t){return e.add(t),()=>{e.delete(t)}},add(e){let n=e.id||Ie(`toast`);return t({action:`add`,options:{...e,id:n,transitionStatus:`starting`}}),n},close(e){t({action:`close`,options:{id:e}})},update(e,n){t({action:`update`,options:{...n,id:e}})},promise(e,n){let r=e;return t({action:`promise`,options:{...n,promise:e,setPromise(e){r=e}}}),r}}}var pt=t({Action:()=>at,Arrow:()=>ut,Close:()=>it,Content:()=>tt,Description:()=>nt,Portal:()=>ot,Positioner:()=>lt,Provider:()=>Ve,Root:()=>et,Title:()=>rt,Viewport:()=>Ue,createToastManager:()=>ft,useToastManager:()=>dt});function mt(){let e=[],t=0,n=new Set,r=new Map,i=new Map,a=new Map,o=new Map,s=new Set,c=()=>n.forEach(e=>e()),l=e=>{clearTimeout(r.get(e)),r.delete(e);let t=a.get(e);t!==void 0&&(i.set(e,Math.max(0,(i.get(e)??0)-(Date.now()-t))),a.delete(e))},u=t=>{let n=e.find(e=>e.id===t);n&&(l(t),i.delete(t),o.delete(t),e=e.filter(e=>e.id!==t),c(),n.onDismiss?.())},d=e=>{s.size||o.get(e)?.size||r.has(e)||!i.has(e)||(a.set(e,Date.now()),r.set(e,setTimeout(()=>u(e),i.get(e))))},f=n=>{let r=n.id??`notification-${++t}`;l(r);let a={...n,id:r};e=[...e.filter(e=>e.id!==r),a];let o=n.durationMs??8e3;return o>0?i.set(r,o):i.delete(r),d(r),c(),r},p=(e,t)=>{let n=o.get(e)??new Set;n.add(t),o.set(e,n),l(e)},m=(e,t)=>{o.get(e)?.delete(t),d(e)};return{show:f,dismiss:u,pause:p,resume:m,getSnapshot:()=>e,subscribe:e=>(n.add(e),()=>{n.delete(e)}),setPaused:(t,n)=>{n?s.add(t):s.delete(t);for(let t of e)s.size?l(t.id):d(t.id)},performAction:async(t,n)=>{let r=e.find(e=>e.id===t),i=r?.actions?.find(e=>e.id===n);if(!r||!i||r.pendingActionId)return;let a={...r,pendingActionId:n};p(t,`action`),e=e.map(e=>e===r?a:e),c();try{await i.run(),e.includes(a)&&u(t)}catch(t){e.includes(a)&&f({...r,title:i.failureTitle??`Could not complete action`,description:t instanceof Error?t.message:`Please try again.`,tone:`error`})}finally{m(t,`action`)}}}}var Z=mt(),Q=E(),ht={archive:_,clock:y,pin:f,trash:C};function gt(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,K.useEffect)(_t,t),null}function _t(){let e=!0,t=new Set,n=()=>{let n=Z.getSnapshot();for(let e of t)n.some(t=>t.id===e)||(t.delete(e),$.close(`shared:${e}`));for(let r of n){let n=r.icon&&r.tone!==`error`?ht[r.icon]:null,i=r.actions??[],a=i.find(yt),o=e=>({children:e.label,disabled:!!r.pendingActionId,onClick:()=>{Z.performAction(r.id,e.id)}}),s={title:r.title,description:r.description??null,type:r.tone??`info`,timeout:0,onClose:()=>{e&&Z.getSnapshot().includes(r)&&Z.dismiss(r.id)},actionProps:{children:null},data:{sharedToastId:r.id,leadingIcon:n?(0,J.jsx)(n,{className:`size-4`}):void 0,additionalActions:i.filter(e=>e!==a).map(e=>({id:e.id,props:o(e)})),...a?{secondaryActionProps:o(a)}:{},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=vt;return document.addEventListener(`visibilitychange`,i),i(),n(),()=>{e=!1,r(),document.removeEventListener(`visibilitychange`,i),Z.setPaused(`web-hidden`,!1);for(let e of t)$.close(`shared:${e}`)}}function vt(){return Z.setPaused(`web-hidden`,document.hidden)}function yt(e){return e.primary}var bt=class extends m()(`ClipboardApiUnavailableError`,{target:j}){get message(){return`Clipboard API is unavailable while copying ${this.target}.`}},xt=class extends m()(`ClipboardWriteError`,{target:j,cause:w()}){get message(){return`Failed to copy ${this.target} to the clipboard.`}},St=class extends m()(`ClipboardReadUnavailableError`,{target:j}){get message(){return`Clipboard API is unavailable while reading ${this.target}.`}},Ct=class extends m()(`ClipboardReadError`,{target:j,cause:w()}){get message(){return`Failed to read ${this.target} from the clipboard.`}};function wt(e,t){if(typeof document>`u`||typeof document.execCommand!=`function`)return!1;let n=document.createElement(`textarea`);n.value=e,n.setAttribute(`readonly`,``),n.setAttribute(`aria-hidden`,`true`),n.style.position=`fixed`,n.style.top=`0`,n.style.left=`0`,n.style.opacity=`0`,n.style.fontSize=`16px`;let r=document.activeElement,i=n=>{if(t&&n.clipboardData){n.clipboardData.setData(`text/plain`,e);for(let[e,r]of Object.entries(t))n.clipboardData.setData(e,r);n.preventDefault()}};document.body.appendChild(n),n.addEventListener(`copy`,i);try{return n.focus({preventScroll:!0}),n.select(),n.setSelectionRange(0,e.length),document.execCommand(`copy`)}catch{return!1}finally{n.removeEventListener(`copy`,i),n.remove();let e=r?.focus;typeof e==`function`&&e.call(r)}}async function Tt(e,t=`text`,n){if(typeof window>`u`)throw new bt({target:t});if(!e)return!1;n&&=Object.fromEntries(Object.entries(n).filter(([e])=>e!==`text/plain`));let r=n?.[T];if(r&&(n={...n,"text/html":ne(e,r,n?.[`text/html`])}),typeof navigator>`u`||!navigator.clipboard?.writeText){if(wt(e,n))return!0;throw new bt({target:t})}try{if(n&&typeof ClipboardItem<`u`&&navigator.clipboard.write)try{return await navigator.clipboard.write([new ClipboardItem({"text/plain":new Blob([e],{type:`text/plain`}),...Object.fromEntries(Object.entries(n).map(([e,t])=>[e,new Blob([t],{type:e})]))})]),!0}catch{let t=n[`text/html`];if(t)try{return await navigator.clipboard.write([new ClipboardItem({"text/plain":new Blob([e],{type:`text/plain`}),"text/html":new Blob([t],{type:`text/html`})})]),!0}catch{}}return await navigator.clipboard.writeText(e),!0}catch(e){throw new xt({target:t,cause:e})}}async function Et(e=`text`){if(typeof window>`u`||typeof navigator>`u`||!navigator.clipboard?.readText)throw new St({target:e});try{return await navigator.clipboard.readText()}catch(t){throw new Ct({target:e,cause:t})}}function Dt({timeout:e=2e3,target:t=`text`,onCopy:n,onError:r,extraFlavors:i}={}){let[a,o]=K.useState(!1),s=K.useRef(null),c=K.useRef(n),l=K.useRef(r),u=K.useRef(t),d=K.useRef(e);c.current=n,l.current=r;let f=K.useRef(i);u.current=t,d.current=e,f.current=i;let p=K.useCallback((e,t)=>{Tt(e,u.current,f.current).then(e=>{e&&(s.current&&clearTimeout(s.current),o(!0),c.current?.(t),d.current!==0&&(s.current=setTimeout(()=>{o(!1),s.current=null},d.current)))},e=>{console.error(e),l.current?.(e,t)})},[]);return K.useEffect(()=>()=>{s.current&&clearTimeout(s.current)},[]),{copyToClipboard:p,isCopied:a}}function Ot(e){return e===`live`}function kt(e){return e.draftThreadExists||e.serverThreadExists&&!e.serverThreadDeleted?`ready`:e.bootstrapComplete?`missing`:`loading`}function At(e){return{environmentId:e.environmentId,threadId:e.threadId}}function jt(e){return{draftId:e}}function Mt(e){return!e.environmentId||!e.threadId?null:N(e.environmentId,e.threadId)}function Nt(e){return e.environmentId&&e.threadId?{kind:`server`,threadRef:N(e.environmentId,e.threadId)}:e.draftId?{kind:`draft`,draftId:e.draftId}:null}function Pt(e,t){return e?.kind===`server`?e.threadRef:e?.kind!==`draft`||!t?.promotedTo?null:t.promotedTo}function Ft(e){if(typeof e!=`object`||!e||!(`children`in e))return!1;let t=e.children;return t!=null&&t!==!1&&t!==``}function It(e,t){return t<=1?!1:e>0}function Lt(e){let t=0,n=0,r=0,i=0,a=e.map(e=>{let a=Rt(e.height);if(e.transitionStatus===`ending`){let r={toast:e,visibleIndex:t,offsetY:n};return n+=a,t+=1,r}let o={toast:e,visibleIndex:r,offsetY:i};return n+=a,t+=1,i+=a,r+=1,o});return{frontmostHeight:Rt(e.find(e=>e.transitionStatus!==`ending`)?.height),items:a}}function Rt(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:0}function zt(e,t){if(e?.threadRef)return t!==null&&e.threadRef.environmentId===t.environmentId&&e.threadRef.threadId===t.threadId;let n=e?.threadId;return!n||t?.threadId===n}var $=ft(),Bt=ft(),Vt=new Map,Ht={error:S,info:b,loading:Ce,success:i,warning:ae},Ut=180;function Wt(e,t){if(e===`error`&&typeof t==`string`&&!(t.length<Ut))return`line-clamp-4`}var Gt=`absolute z-20 -top-1.5 -right-1.5`,Kt=W(`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 qt(e,t,n){n?.(),e.close(t)}function Jt(e){let t=(0,Q.c)(13),{text:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={target:`error-message`},t[0]=r):r=t[0];let{copyToClipboard:i,isCopied:a}=Dt(r),o=a?`Copied error`:`Copy error`,s;t[1]!==i||t[2]!==n?(s=()=>i(n),t[1]=i,t[2]=n,t[3]=s):s=t[3];let c=a&&`text-success`,l;t[4]===c?l=t[5]:(l=W(`size-3`,c),t[4]=c,t[5]=l);let u=a?ve:Se,d;t[6]!==l||t[7]!==u?(d=(0,J.jsx)(be,{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 Yt=`mt-2 max-h-40 min-h-0 overflow-y-auto overscroll-contain pr-0.5 select-text`;function Xt(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(Zt),t[0]=c):c=t[0];let l=i?G:ye,u;t[1]===l?u=t[2]:(u=(0,J.jsx)(be,{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:Yt,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 Zt(e){return!e}function Qt(e){let t=(0,Q.c)(36),{toastData:n,toastDescription:r,toastType:i}=e,a=n?.expandableContent,o;t[0]===n?.expandableLabels?o=t[1]:(o=n?.expandableLabels??{},t[0]=n?.expandableLabels,t[1]=o);let s=o,c=n?.expandableDescriptionTrigger??!1,l;t[2]!==r||t[3]!==i?(l=W(`min-w-0 select-text wrap-break-word text-muted-foreground`,Wt(i,r)),t[2]=r,t[3]=i,t[4]=l):l=t[4];let u=l,[d,f]=(0,K.useState)(!1);if(!a){let e;return t[5]===u?e=t[6]:(e=(0,J.jsx)(nt,{className:u,"data-slot":`toast-description`}),t[5]=u,t[6]=e),e}if(!c){let e;t[7]===u?e=t[8]:(e=(0,J.jsx)(nt,{className:u,"data-slot":`toast-description`}),t[7]=u,t[8]=e);let n;t[9]!==a||t[10]!==s?(n=(0,J.jsx)(Xt,{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($t),t[15]=h):h=t[15];let g=h,_;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),g())},t[16]=_):_=t[16];let v=_,y=d?m:p,b;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(b=W(`group flex min-w-0 w-full cursor-pointer select-none items-start gap-1.5 rounded-sm text-left outline-none ring-offset-background`,`transition-colors hover:bg-muted/40`,`focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background`),t[17]=b):b=t[17];let x;t[18]!==r||t[19]!==i?(x=W(`min-w-0 select-none wrap-break-word text-muted-foreground`,Wt(i,r),`underline-offset-2 decoration-muted-foreground/60 group-hover:underline`),t[18]=r,t[19]=i,t[20]=x):x=t[20];let S;t[21]===x?S=t[22]:(S=(0,J.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,J.jsx)(nt,{className:x,"data-slot":`toast-description`})}),t[21]=x,t[22]=S);let C=d?G:ye,w;t[23]===C?w=t[24]:(w=(0,J.jsx)(be,{"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:Yt,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 $t(e){return!e}function en(e){let t=e.type?Ht[e.type]:null,n=Ft(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||Ft(e.actionProps)||o||s;return{Icon:t,stackedActionLayout:n,actionVariant:r,secondaryActionVariant:i,copyErrorText:a,hasTrailingControls:c,inlineContentEndPad:c?`pr-6`:`pr-10`}}function tn(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=W(`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)(rt,{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)(Qt,{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:W(`flex items-center gap-1.5`,n?`w-full justify-end`:`shrink-0`),children:[i===null?null:(0,J.jsx)(Jt,{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,Ft(a)?(0,J.jsx)(at,{className:W(ie({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 nn(){let e=(0,Q.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={strict:!1,select:rn},e[0]=t):t=e[0];let n=we(t),r;e[1]===n?r=e[2]:(r=e=>n?.kind===`draft`?e.getDraftSession(n.draftId):null,e[1]=n,e[2]=r);let i=c(r),a;bb0:{if(n?.kind===`server`){a=n.threadRef;break bb0}if(n?.kind===`draft`&&i){let t;e[3]!==i.environmentId||e[4]!==i.threadId?(t={environmentId:i.environmentId,threadId:i.threadId},e[3]=i.environmentId,e[4]=i.threadId,e[5]=t):t=e[5],a=t;break bb0}a=null}return a}function rn(e){return Nt(e)}function an(e){let t=(0,Q.c)(4),{toastId:n,dismissAfterVisibleMs:r}=e,i,a;return t[0]!==r||t[1]!==n?(i=()=>{if(!r||r<=0||typeof window>`u`||typeof document>`u`)return;let e=Vt.get(n)??r,t=null,i=null,a=!1,o=()=>{i!==null&&(window.clearTimeout(i),i=null)},s=()=>{a||(a=!0,Vt.delete(n),$.close(n))},c=()=>{t!==null&&(e=Math.max(0,e-(Date.now()-t)),t=null,o(),Vt.set(n,e))},l=()=>{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 on(e){let t=(0,Q.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({children:n,position:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`top-center`:i,o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,J.jsx)(gt,{}),t[4]=o):o=t[4];let s;t[5]===a?s=t[6]:(s=(0,J.jsx)(sn,{position:a}),t[5]=a,t[6]=s);let c;return t[7]!==n||t[8]!==r||t[9]!==s?(c=(0,J.jsxs)(Ve,{toastManager:$,...r,children:[o,n,s]}),t[7]=n,t[8]=r,t[9]=s,t[10]=c):c=t[10],c}function sn(e){let t=(0,Q.c)(19),{position:n}=e,{toasts:r}=dt(),i=nn(),a;t[0]===n?a=t[1]:(a=n.startsWith(`top`),t[0]=n,t[1]=a);let o=a,s;t[2]===i?s=t[3]:(s=e=>zt(e.data,i),t[2]=i,t[3]=s);let c=Lt(r.filter(s)),l,u;t[4]===r?(l=t[5],u=t[6]):(l=()=>{let e=new Set(r.map(cn));for(let t of Vt.keys())e.has(t)||Vt.delete(t)},u=[r],t[4]=r,t[5]=l,t[6]=u),(0,K.useEffect)(l,u);let d=pt,f=pt,p;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(p=W(`fixed z-100 mx-auto flex w-[calc(100%-var(--toast-inset)*2)] max-w-90 [--toast-header-offset:var(--workspace-topbar-height)] [--toast-inset:--spacing(4)] sm:[--toast-inset:--spacing(8)]`,`data-[position*=top]:top-[calc(var(--toast-inset)+var(--toast-header-offset))]`,`data-[position*=bottom]:bottom-(--toast-inset)`,`data-[position*=left]:left-(--toast-inset)`,`data-[position*=right]:right-(--toast-inset)`,`data-[position*=center]:-translate-x-1/2 data-[position*=center]:left-1/2`),t[7]=p):p=t[7];let m=`${c.frontmostHeight}px`,h;t[8]===m?h=t[9]:(h={"--toast-frontmost-height":m},t[8]=m,t[9]=h);let _=h,v=c.items.map(e=>{let{toast:t,visibleIndex:r,offsetY:i}=e,a=It(r,c.items.length),s=en(t),{stackedActionLayout:l,inlineContentEndPad:u}=s;return(0,J.jsxs)(et,{className:W(`dropdown-glass absolute z-[calc(9999-var(--toast-index))] w-full overflow-visible select-none rounded-xl text-popover-foreground shadow-lg shadow-black/10 [transition:transform_.5s_cubic-bezier(.22,1,.36,1),opacity_.5s,height_.15s] motion-reduce:transition-none`,`data-[position*=right]:right-0 data-[position*=right]:left-auto`,`data-[position*=left]:right-auto data-[position*=left]:left-0`,`data-[position*=center]:right-0 data-[position*=center]:left-0`,`data-[position*=top]:top-0 data-[position*=top]:bottom-auto data-[position*=top]:origin-top`,`data-[position*=bottom]:top-auto data-[position*=bottom]:bottom-0 data-[position*=bottom]:origin-bottom`,`after:absolute after:left-0 after:h-[calc(var(--toast-gap)+1px)] after:w-full`,`data-[position*=top]:after:top-full`,`data-[position*=bottom]:after:bottom-full`,r>0?`not-data-expanded:[--toast-calc-height:var(--toast-frontmost-height)] data-expanded:[--toast-calc-height:max(var(--toast-frontmost-height,var(--toast-height)),var(--toast-height))]`:`[--toast-calc-height:max(var(--toast-frontmost-height,var(--toast-height)),var(--toast-height))]`,`[--toast-gap:--spacing(3)] [--toast-peek:--spacing(3)] [--toast-scale:calc(max(0,1-(var(--toast-index)*.1)))] [--toast-shrink:calc(1-var(--toast-scale))]`,r>0?`not-data-expanded:h-(--toast-calc-height) data-expanded:h-auto`:`h-auto`,`data-[position*=top]:[--toast-calc-offset-y:calc(var(--toast-offset-y)+var(--toast-index)*var(--toast-gap)+var(--toast-swipe-movement-y))]`,`data-[position*=bottom]:[--toast-calc-offset-y:calc(var(--toast-offset-y)*-1+var(--toast-index)*var(--toast-gap)*-1+var(--toast-swipe-movement-y))]`,`data-[position*=top]:transform-[translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)+(var(--toast-index)*var(--toast-peek))+(var(--toast-shrink)*var(--toast-calc-height))))_scale(var(--toast-scale))]`,`data-[position*=bottom]:transform-[translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)-(var(--toast-index)*var(--toast-peek))-(var(--toast-shrink)*var(--toast-calc-height))))_scale(var(--toast-scale))]`,`data-limited:opacity-0`,`data-position:data-expanded:transform-[translateX(var(--toast-swipe-movement-x))_translateY(var(--toast-calc-offset-y))]`,`data-[position*=top]:data-starting-style:transform-[translateY(calc(-100%-var(--toast-inset)))]`,`data-[position*=bottom]:data-starting-style:transform-[translateY(calc(100%+var(--toast-inset)))]`,`data-[position*=top]:data-[position*=right]:data-starting-style:transform-[translateX(calc(100%+var(--toast-inset)))_translateY(var(--toast-calc-offset-y))]`,`data-ending-style:opacity-0`,`data-ending-style:not-data-limited:not-data-swipe-direction:transform-[translateY(calc(var(--toast-calc-offset-y)-100%-var(--toast-inset)))]`,`data-ending-style:data-[swipe-direction=left]:transform-[translateX(calc(var(--toast-swipe-movement-x)-100%-var(--toast-inset)))_translateY(var(--toast-calc-offset-y))]`,`data-ending-style:data-[swipe-direction=right]:transform-[translateX(calc(var(--toast-swipe-movement-x)+100%+var(--toast-inset)))_translateY(var(--toast-calc-offset-y))]`,`data-ending-style:data-[swipe-direction=up]:transform-[translateY(calc(var(--toast-swipe-movement-y)-100%-var(--toast-inset)))]`,`data-ending-style:data-[swipe-direction=down]:transform-[translateY(calc(var(--toast-swipe-movement-y)+100%+var(--toast-inset)))]`,`data-expanded:data-ending-style:data-[swipe-direction=left]:transform-[translateX(calc(var(--toast-swipe-movement-x)-100%-var(--toast-inset)))_translateY(var(--toast-calc-offset-y))]`,`data-expanded:data-ending-style:data-[swipe-direction=right]:transform-[translateX(calc(var(--toast-swipe-movement-x)+100%+var(--toast-inset)))_translateY(var(--toast-calc-offset-y))]`,`data-expanded:data-ending-style:data-[swipe-direction=up]:transform-[translateY(calc(var(--toast-swipe-movement-y)-100%-var(--toast-inset)))]`,`data-expanded:data-ending-style:data-[swipe-direction=down]:transform-[translateY(calc(var(--toast-swipe-movement-y)+100%+var(--toast-inset)))]`),"data-position":n,onPointerEnter:()=>{t.data?.sharedToastId&&Z.pause(t.data.sharedToastId,`pointer`)},onPointerLeave:()=>{t.data?.sharedToastId&&Z.resume(t.data.sharedToastId,`pointer`)},onFocusCapture:()=>{t.data?.sharedToastId&&Z.pause(t.data.sharedToastId,`focus`)},onBlurCapture:e=>{t.data?.sharedToastId&&!e.currentTarget.contains(e.relatedTarget)&&Z.resume(t.data.sharedToastId,`focus`)},style:{"--toast-index":r,"--toast-offset-y":`${i}px`},swipeDirection:n.includes(`center`)?[o?`up`:`down`]:n.includes(`left`)?[`left`,o?`up`:`down`]:[`right`,o?`up`:`down`],toast:t,children:[(0,J.jsx)(an,{dismissAfterVisibleMs:t.data?.dismissAfterVisibleMs,toastId:t.id}),!t.data?.sharedToastId&&(0,J.jsx)(`div`,{className:Gt,children:(0,J.jsx)(`button`,{"aria-label":`Dismiss notification`,className:Kt,"data-slot":`toast-close`,onClick:()=>qt($,t.id,t.data?.onClose),type:`button`,children:(0,J.jsx)(g,{className:`size-3`,strokeWidth:2.25})})}),(0,J.jsxs)(tt,{className:W(`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`,l?`flex flex-col gap-2 py-2.5 pr-3.5`:W(`py-3`,`flex items-center justify-between gap-2`,t.data?.sharedToastId?`pr-2`:u),a&&`not-data-expanded:pointer-events-none not-data-expanded:opacity-0`),children:[(0,J.jsx)(tn,{...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)(g,{})})]})]},t.id)}),y;t[10]!==n||t[11]!==_||t[12]!==v||t[13]!==f.Viewport||t[14]!==p?(y=(0,J.jsx)(f.Viewport,{className:p,"data-position":n,"data-slot":`toast-viewport`,style:_,children:v}),t[10]=n,t[11]=_,t[12]=v,t[13]=f.Viewport,t[14]=p,t[15]=y):y=t[15];let b;return t[16]!==y||t[17]!==d.Portal?(b=(0,J.jsx)(d.Portal,{"data-slot":`toast-portal`,children:y}),t[16]=y,t[17]=d.Portal,t[18]=b):b=t[18],b}function cn(e){return e.id}function ln(e){let t=(0,Q.c)(7),n,r;t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,J.jsx)(un,{}),t[3]=i):i=t[3];let a;return t[4]!==n||t[5]!==r?(a=(0,J.jsxs)(Ve,{toastManager:Bt,...r,children:[n,i]}),t[4]=n,t[5]=r,t[6]=a):a=t[6],a}function un(){let e=(0,Q.c)(7),{toasts:t}=dt(),n=nn(),r;if(e[0]!==n||e[1]!==t){let i;e[3]===n?i=e[4]:(i=e=>zt(e.data,n),e[3]=n,e[4]=i),r=t.filter(i).map(dn),e[0]=n,e[1]=t,e[2]=r}else r=e[2];let i;return e[5]===r?i=e[6]:(i=(0,J.jsx)(ot,{"data-slot":`toast-portal-anchored`,children:(0,J.jsx)(Ue,{className:`outline-none`,"data-slot":`toast-viewport-anchored`,children:r})}),e[5]=r,e[6]=i),i}function dn(e){let t=e.data?.tooltipStyle??!1,n=e.positionerProps,r=en(e),{stackedActionLayout:i,inlineContentEndPad:a}=r;return n?.anchor?(0,J.jsx)(lt,{className:`z-100 max-w-[min(--spacing(64),var(--available-width))]`,"data-slot":`toast-positioner`,sideOffset:n.sideOffset??4,toast:e,children:(0,J.jsx)(et,{className:W(`dropdown-glass relative overflow-visible text-balance text-popover-foreground text-xs shadow-xl shadow-black/25 transition-[scale,opacity] data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0`,t?`rounded-md`:`rounded-lg`),"data-slot":`toast-popup`,toast:e,children:t?(0,J.jsx)(tt,{className:`pointer-events-auto px-2 py-1`,children:(0,J.jsx)(rt,{"data-slot":`toast-title`})}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:Gt,children:(0,J.jsx)(`button`,{"aria-label":`Dismiss notification`,className:Kt,"data-slot":`toast-close`,onClick:()=>qt(Bt,e.id,e.data?.onClose),type:`button`,children:(0,J.jsx)(g,{className:`size-3`,strokeWidth:2.25})})}),(0,J.jsx)(tt,{className:W(`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`:W(`py-3`,`flex items-center justify-between gap-1.5`,a)),children:(0,J.jsx)(tn,{...r,actionProps:e.actionProps,toastData:e.data,toastDescription:e.description,toastType:e.type})})]})})},e.id):null}export{Oe as _,jt as a,Pt as c,Nt as d,Et as f,Me as g,Z as h,$ as i,Mt as l,Tt as m,on as n,At as o,Dt as p,Bt as r,Ot as s,ln as t,kt as u,ke as v,De as y};
|
|
2
|
-
//# sourceMappingURL=toast-B3hjhWRf.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{$n as n,$o as r,Ds as i,Es as a,I_ as o,Jm as s,Jn as c,Jp as l,Lf as u,Ny as d,Od as f,RE as p,RT as m,Ty as h,Uy as g,Yo as _,Zn as v,cr as y,ds as b,el as x,gb as S,ks as C,lb as w,lr as T,mE as E,qn as D,rr as O,rs as k,s_ as A,sm as j,t as M,ts as N,ur as P,xd as ee,zp as F}from"./utils-hgbJ2TVM.js";import{B as I,L,W as R,q as z}from"./runtime-Cj24N7je.js";import{a as B,c as V,o as te,s as ne,t as re}from"./select-Bsag72zE.js";import{t as ie}from"./useNavigateBack-DpCLZais.js";import{rt as ae}from"./useSettings-BcmuuiTp.js";import{f as oe,s as se}from"./server-Vynm5NwP.js";import{n as H,t as U}from"./session-DyiiEN5g.js";import{t as ce}from"./use-atom-command-D34CFqu3.js";import{a as le,c as ue,d as W,f as G,i as de,l as K,n as fe,o as pe,r as q,s as J,t as Y,u as me}from"./usageFormat-C54RJiV9.js";import{t as he}from"./env-wK1YYxA8.js";import{a as ge,n as _e,t as ve}from"./tooltip-D-SzZpgJ.js";import{t as X}from"./skeleton-Bq50sEah.js";import{n as ye,t as be}from"./toggle-group-Clz6KDtW.js";import{t as xe}from"./input-D_jxqXLR.js";import{t as Se}from"./scroll-area-DORwTFtw.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-Cgb4jap2.js";import{o as Ae}from"./sidebar-CV_a9dPF.js";import{t as je}from"./observeResize-jHx61cGA.js";import{y as Me}from"./keybindings-CqjUKNRx.js";import{i as Ne,o as Pe,t as Fe}from"./popover-2XJd3KEJ.js";import{S as Ie,n as Le,t as Re}from"./ChatGptUsageButton-8lmdyDiG.js";import{t as ze}from"./WorkspacePageContainer-BTN44jG6.js";import{n as Be,r as Ve,t as He}from"./usageShortcuts-B3af64g0.js";import{Ca as Ue,Wr as We,ar as Ge,bi as Ke,cr as qe,or as Je,pi as Ye,sr as Xe}from"./main-4dRVuXx2.js";import{t as Ze}from"./WorkspacePageHeader-BaCxaW-R.js";import{i as Qe,n as $e,r as et,t as tt}from"./WorkspaceBreadcrumb-B5ZV6VNj.js";import{t as nt}from"./usageAccess-ZgmQIiWk.js";var Z=e(t(),1),Q=p(),rt=w(z);function it(e,t){return e?.sources.some(e=>e.action===`enableCursorKeychain`)===!0&&t?.some(e=>e.driver===`cursor`&&e.status===`ready`)===!0}function at(e){return e.some(e=>e.summary?.sources.some(e=>e.fingerprint.provider===`cursor`&&e.fingerprint.hostId===`cursor.com`))?[]:e.filter(e=>e.needsCursorKeychainAccess)}var ot=new Map,st=new Map;async function ct(e,t,n=!1,r=!1){let i=st.get(e);if(i!==void 0){if(r){try{await i}catch{}return ct(e,t,!1,!0)}return n?void 0:await i}let a=ot.get(e)??0;if(n&&Date.now()<a)return;let o=Promise.resolve().then(t).finally(()=>{st.delete(e),ot.set(e,Date.now()+3e5)});return st.set(e,o),await o}async function lt({registry:e,server:t,presentations:n,environmentIds:r,input:i}){await Promise.all(r.map(async r=>{let a=t.usageSummary({environmentId:r,input:i}),o=n.presentationAtom(r),s=new AbortController,c=()=>{e.get(o)?.connection.phase!==`connected`&&s.abort()},l=e.subscribe(o,c);c();try{let n=await I(e,t.refreshUsageRates,{environmentId:r,input:{}},{reportFailure:!1}),i=n._tag===`Failure`&&rt(R(n));if(e.refresh(a),i||s.signal.aborted)return;await L(e,a,{reportFailure:!1,signal:s.signal})}finally{l()}}))}function ut(e,t=!1){let{summary:n}=e;if(!e.isConnected||e.error!==null)return{phase:`inactive`};if(n===null)return{phase:`loading`};if(t)return{phase:`stale`};if(!e.isPending)return{phase:`ready`};let r=[...new Set(n.sources.flatMap(e=>e.refreshing?[e.fingerprint.provider]:[]))];return r.length>0?{phase:`partway`,providers:r}:{phase:`stale`}}function dt(e,t){return e.length===1?`Updating ${t(e[0])}…`:`Updating ${e.length} providers…`}function ft(e,t=!1){let n=new Set,r=!1;for(let i of e){let e=ut(i,t);if((e.phase===`loading`||e.phase===`stale`)&&(r=!0),e.phase===`partway`)for(let t of e.providers)n.add(t)}return{partial:r||n.size>0,everyProvider:r,providers:n}}function pt(e){return e.records>0&&e.unpricedRecords>=e.records}function mt(e){return[e.hostId,e.provider,e.resolvedHomePath,e.volumeId].join(` `)}function ht(e,t){let n=e.sources.filter(e=>e.fingerprint.provider===t.fingerprint.provider);return e.buckets.filter(e=>e.provider===t.fingerprint.provider&&(e.sourcePath===t.fingerprint.resolvedHomePath||e.sourcePath===void 0&&n.length===1))}function gt(e){return JSON.stringify([e.day,e.hourStart??null,e.provider,e.model])}function _t(e){let t=new Map,n=new Map,r=new Map,i=new Map,a=new Map,o=[],s=[...e].sort((e,t)=>(Date.parse(t.summary.readAt)||0)-(Date.parse(e.summary.readAt)||0)||e.environmentId.localeCompare(t.environmentId));for(let e of[`ok`,`partial`,`failed`])for(let r of s)for(let i of r.summary.sources){if(i.status!==e)continue;let s=mt(i.fingerprint);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=N(e=>k(t=>{let n=JSON.parse(e),r=t(ae.presentationsAtom),i=[];for(let[e,o]of r){let r=o.connection.phase===`connected`,s=t(U.sessionStateAtom(e)),c=nt({connectionPhase:o.connection.phase,session:m(a(s)),hasSessionError:s._tag===`Failure`});if(!c.canReadDiagnostics){i.push({environmentId:e,label:o.entry.target.label,isConnected:r,...c,summary:null,needsCursorKeychainAccess:!1});continue}let l=t(oe.usageSummary({environmentId:e,input:n})),u=m(a(l));i.push({environmentId:e,label:o.entry.target.label,isPending:l.waiting,canReadDiagnostics:!0,isConnected:r,error:l._tag===`Failure`?`This environment could not report usage.`:null,summary:u,needsCursorKeychainAccess:it(u,t(oe.providersValueAtom(e)))})}return i}).pipe(b(`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 i=(0,Q.c)(36),a=t===void 0?null:t,o=n===void 0?Tt:n,s;i[0]!==e.resolution||i[1]!==e.sinceDay||i[2]!==e.sinceTime||i[3]!==e.timeZone||i[4]!==e.untilDay||i[5]!==e.untilTime?(s=JSON.stringify({sinceDay:e.sinceDay,untilDay:e.untilDay,timeZone:e.timeZone,resolution:e.resolution,sinceTime:e.sinceTime,untilTime:e.untilTime}),i[0]=e.resolution,i[1]=e.sinceDay,i[2]=e.sinceTime,i[3]=e.timeZone,i[4]=e.untilDay,i[5]=e.untilTime,i[6]=s):s=i[6];let c=s,l;i[7]===c?l=i[8]:(l=Ct(c),i[7]=c,i[8]=l);let u=r(l),d;i[9]!==u||i[10]!==a?(d=a===null?u:u.filter(e=>a.has(e.environmentId)),i[9]=u,i[10]=a,i[11]=d):d=i[11];let f=d,p;i[12]!==f||i[13]!==c?(p=e=>lt({registry:_,server:oe,presentations:ae,environmentIds:f.filter(jt).map(At),input:e??JSON.parse(c)}),i[12]=f,i[13]=c,i[14]=p):p=i[14];let m=p,h;i[15]!==o||i[16]!==f?(h=wt(Et(f,o)),i[15]=o,i[16]=f,i[17]=h):h=i[17];let g=h,v;i[18]===f?v=i[19]:(v=f.filter(kt),i[18]=f,i[19]=v);let y=v.length,b;i[20]===f?b=i[21]:(b=f.filter(Ot),i[20]=f,i[21]=b);let x=b.length,S=y===0&&x>0,[C,w]=(0,Z.useState)(null);y>0&&(C?.merged!==g||C.window!==e||C.selection!==a||C.hidden!==o)&&w({window:e,merged:g,selection:a,hidden:o});let T=C?.selection===a&&C.hidden===o?C:null,E;i[22]!==y||i[23]!==e||i[24]!==S||i[25]!==T||i[26]!==g?(E=y>0?{window:e,merged:g}:T??(S?null:{window:e,merged:g}),i[22]=y,i[23]=e,i[24]=S,i[25]=T,i[26]=g,i[27]=E):E=i[27];let D=E,O=y>0&&x>0,k;return i[28]!==u||i[29]!==S||i[30]!==g||i[31]!==m||i[32]!==f||i[33]!==D||i[34]!==O?(k={merged:g,environments:u,selectedEnvironments:f,isPending:S,shown:D,isPartial:O,refresh:m},i[28]=u,i[29]=S,i[30]=g,i[31]=m,i[32]=f,i[33]=D,i[34]=O,i[35]=k):k=i[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&&H(e.environmentId,`diagnostics:read`)}var $=e(E(),1);function Mt(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=M(`w-full caption-bottom text-xs`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,$.jsx)(`table`,{"data-slot":`table`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Nt(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=M(`[&_tr]:border-b`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`thead`,{"data-slot":`table-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Pt(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=M(`[&_tr:last-child]:border-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`tbody`,{"data-slot":`table-body`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ft(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=M(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`tr`,{"data-slot":`table-row`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function It(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=M(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`th`,{"data-slot":`table-head`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Lt(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=M(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`td`,{"data-slot":`table-cell`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Rt=[{key:`inputCostPerMillionTokens`,label:`Input`,optional:!1},{key:`outputCostPerMillionTokens`,label:`Output`,optional:!1},{key:`cacheReadCostPerMillionTokens`,label:`Cache read`,optional:!0},{key:`cacheWriteCostPerMillionTokens`,label:`Cache write`,optional:!0}];function zt(e=``,t){return{model:e,inputCostPerMillionTokens:t?.inputCostPerMillionTokens.toString()??``,outputCostPerMillionTokens:t?.outputCostPerMillionTokens.toString()??``,cacheReadCostPerMillionTokens:t?.cacheReadCostPerMillionTokens?.toString()??``,cacheWriteCostPerMillionTokens:t?.cacheWriteCostPerMillionTokens?.toString()??``}}function Bt(e){let t=e.model.trim();if(t.length===0)return null;let n={};for(let t of Rt){let r=e[t.key].trim();if(r===``){if(t.optional)continue;return null}if(!/^(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i.test(r))return null;let i=Number(r);if(!Number.isFinite(i)||i<0)return null;n[t.key]=i}return n.inputCostPerMillionTokens===void 0||n.outputCostPerMillionTokens===void 0?null:{model:t,price:{inputCostPerMillionTokens:n.inputCostPerMillionTokens,outputCostPerMillionTokens:n.outputCostPerMillionTokens,...n.cacheReadCostPerMillionTokens===void 0?{}:{cacheReadCostPerMillionTokens:n.cacheReadCostPerMillionTokens},...n.cacheWriteCostPerMillionTokens===void 0?{}:{cacheWriteCostPerMillionTokens:n.cacheWriteCostPerMillionTokens}}}}function Vt(e){return e.isNew&&e.model.trim()===``&&(e.alias??``).trim()===``&&Object.values(e.values).every(e=>e.trim()===``)}function Ht(e,t){return e.prices&&Object.hasOwn(e.prices,t)?e.prices[t]:void 0}function Ut(e,t){return e.aliases&&Object.hasOwn(e.aliases,t)?e.aliases[t]:void 0}function Wt(e,t){if(e.some(e=>e.aliases===null))return{value:``,placeholder:`Unavailable`};let n=e.map(e=>Ut(e,t)??``);return n.some(e=>e!==n[0])?{value:``,placeholder:`Mixed`}:{value:n[0]??``,placeholder:`None`}}function Gt(e,t,n){let r=Rt.find(e=>e.key===n).optional,i=e.map(e=>Ht(e,t)?zt(t,Ht(e,t))[n]:null);return e.some(e=>e.prices===null)?{value:``,placeholder:`Unavailable`}:i.some(e=>e!==i[0])?{value:``,placeholder:`Mixed`}:{value:i[0]??``,placeholder:i[0]===null?`Automatic`:r?`Input rate`:`0.00`}}function Kt(e,t){let n=[],r=new Map;for(let i of t){if(Vt(i))continue;let t=i.model.trim(),a=Ut(e,t);if(i.removed){Ht(e,t)&&n.push({model:t,price:null}),a!==void 0&&n.push({model:t,alias:null});continue}let o=(i.alias??a??``).trim();if(o!==``){t===``?r.set(i.id,`Enter a model ID.`):o===t?r.set(i.id,`Map to a different model.`):(o!==a&&n.push({model:t,alias:o}),Ht(e,t)&&n.push({model:t,price:null}));continue}if(a!==void 0&&(n.push({model:t,alias:null}),!Ht(e,t)&&Object.values(i.values).every(e=>e.trim()===``)))continue;let s=zt(t,Ht(e,t)),c={...s,...i.values},l=Bt(c);if(l===null){let n=Rt.find(e=>!e.optional&&c[e.key].trim()===``);r.set(i.id,t===``?`Enter a model ID.`:n?`${n.label} is required on ${e.label}.`:`Use non-negative numbers for prices.`);continue}let u=zt(t,l.price);Rt.some(e=>s[e.key]!==u[e.key])&&n.push(l)}return{changes:n,errors:r}}function qt(e,t){return new Map(e.filter(e=>e.unavailable===null&&e.prices!==null).flatMap(e=>[...Kt(e,t).errors]))}async function Jt(e){await Promise.all(e.targets.map(async t=>{let n,r=e.changes.get(t.environmentId)??[],i=r.flatMap(e=>`price`in e?[[e.model,e.price]]:[]),a=r.flatMap(e=>`alias`in e?[[e.model,e.alias]]:[]);if(t.unavailable!==null)n={status:`failed`,error:t.unavailable};else if(a.length>0&&t.aliases===null)n={status:`failed`,error:`Update server to map models`};else try{n=(r.length===0?{_tag:`Success`}:await e.write({environmentId:t.environmentId,input:{patch:{...i.length>0?{usagePriceOverrides:Object.fromEntries(i)}:{},...a.length>0?{usageModelAliases:Object.fromEntries(a)}:{}}}}))._tag===`Success`?{status:`saved`}:{status:`failed`,error:`Could not save. Try again.`}}catch{n={status:`failed`,error:`Could not save. Try again.`}}e.onResult(t.environmentId,n)}))}var Yt=k(e=>[...e(ae.presentationsAtom)].map(([t,n])=>{let r=e(oe.settingsValueAtom(t)),i=e(U.sessionStateAtom(t)),s=m(a(i)),c=i._tag===`Failure`?`denied`:s===null?i.waiting?`pending`:`denied`:o(s,`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?c===`pending`?`Checking permissions…`:c===`denied`?`Read-only access`:null:`Update server to edit prices`:`Offline`}}));function Xt(e){let t=(0,Q.c)(119),{usage:i,initialSelectedEnvironmentIds:a,initialModel:o,onOpenChange:u}=e,d=r(Yt),[f,p]=(0,Z.useState)(a),m;if(t[0]!==d||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=d.filter(e),t[0]=d,t[1]=f,t[2]=m}else m=t[2];let h=m,g;t[5]!==o||t[6]!==h?(g=()=>o===void 0||h.some(e=>Object.hasOwn(e.prices??{},o)||Object.hasOwn(e.aliases??{},o))?[]:[{id:`new:initial`,model:o,isNew:!0,values:{}}],t[5]=o,t[6]=h,t[7]=g):g=t[7];let[_,v]=(0,Z.useState)(g),[b,x]=(0,Z.useState)(!1),[S,C]=(0,Z.useState)(null),w=(0,Z.useRef)(null),E=(0,Z.useRef)(0),k;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(k={reportFailure:!1},t[8]=k):k=t[8];let A=ce(oe.updateSettings,k),j,N,P,I,L,R,z,B,V,te,ne,re,ie,ae,se;if(t[9]!==S||t[10]!==_||t[11]!==d||t[12]!==u||t[13]!==b||t[14]!==h||t[15]!==f||t[16]!==A||t[17]!==i){let e=[...new Set(h.flatMap(mn))].sort(),r;t[33]===h?r=t[34]:(r=e=>h.some(t=>t.environmentId===e.environmentId),t[33]=h,t[34]=r);let a=[...new Set([...e,...i.filter(r).flatMap(fn)])].sort(),o;t[35]===_?o=t[36]:(o=new Set(_.filter(dn).map(un)),t[35]=_,t[36]=o);let m=o,g;t[37]!==S||t[38]!==m?(g=e=>S===null||!m.has(e),t[37]=S,t[38]=m,t[39]=g):g=t[39];let k=[...e.filter(g).map(e=>_.find(t=>t.id===`model:${e}`)??{id:`model:${e}`,model:e,isNew:!1,values:{}}),..._.filter(ln)],oe=_.filter(cn);R=qt(h,oe);for(let t of oe)t.isNew&&(t.model.trim()===``?R.set(t.id,`Enter a model ID.`):S===null&&(e.includes(t.model.trim())||_.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=S?.destinations.filter(e=>S.results.get(e.environmentId)?.status===`failed`)??[];let U=b||z.length>0;B=oe.length>0,I=h.length===1?h[0].label:`${h.length} environments`;let ce=f===null?`All environments`:I,le;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>{v([]),C(null)},t[40]=le):le=t[40],L=le;let ue;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(ue=e=>{p(e),C(null)},t[41]=ue):ue=t[41];let W=ue,G;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(G=e=>{v(t=>t.some(t=>t.id===e.id)?t.map(t=>t.id===e.id?e:t):[...t,e]),C(null)},t[42]=G):G=t[42];let de=G,K=sn,fe;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(fe=e=>{!e.isNew&&Object.keys(e.values).length===0&&e.alias===void 0?v(t=>t.filter(t=>t.id!==e.id)):de(e)},t[43]=fe):fe=t[43];let pe=fe,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],pe({...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);pe(K(e,i,t)?r:{...r,alias:t})},t[46]=h,t[47]=Y);let me=Y;V=async e=>{let t=e!==void 0&&e;if(b)return;let n=t?z:h,r=t&&S?S.drafts:oe;if(n.length===0||r.length===0)return;let i=n.map(e=>d.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)]));x(!0),C(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=>H(e.environmentId,`settings:write`)?A(e):{_tag:`Failure`},onResult:(e,t)=>{t.status===`failed`&&(o=!0),C(n=>n===null?null:{...n,results:new Map(n.results).set(e,t)})}}),x(!1),o||v([])},P=ke,ae=!0,t[48]!==u||t[49]!==b?(se=e=>{b||u(e)},t[48]=u,t[49]=b,t[50]=se):se=t[50],N=Oe,re=`max-w-4xl`,t[51]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsxs)(Ce,{children:[(0,$.jsx)(we,{children:`Custom model prices`}),(0,$.jsx)(De,{children:`Prices and mappings apply to all past and future usage on the environments you select.`})]}),t[51]=ie):ie=t[51],j=Ee;let he;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,$.jsx)(Ye,{id:`usage-prices-apply-label`,className:`shrink-0`,children:`Apply to`}),t[52]=he):he=t[52];let X;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,$.jsx)(T,{variant:`outline`,size:`sm`,className:`min-w-0`}),t[53]=X):X=t[53];let ye=b||B,be;t[54]===ce?be=t[55]:(be=(0,$.jsx)(`span`,{id:`usage-prices-selection`,className:`truncate`,children:ce}),t[54]=ce,t[55]=be);let Se;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,$.jsx)(ee,{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)(y,{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)(c,{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)(O,{}),t[63]=Ne):Ne=t[63];let Pe;if(t[64]!==d||t[65]!==h||t[66]!==f){let e;t[68]!==d.length||t[69]!==h||t[70]!==f?(e=e=>(0,$.jsx)(c,{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===d.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]=d.length,t[69]=h,t[70]=f,t[71]=e):e=t[71],Pe=d.map(e),t[64]=d,t[65]=h,t[66]=f,t[67]=Pe}else Pe=t[67];let Fe;t[72]!==Me||t[73]!==Pe?(Fe=(0,$.jsxs)(n,{align:`start`,children:[Me,Ne,Pe]}),t[72]=Me,t[73]=Pe,t[74]=Fe):Fe=t[74];let Ie;t[75]!==Te||t[76]!==Fe?(Ie=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[he,(0,$.jsxs)(D,{children:[Te,Fe]})]}),t[75]=Te,t[76]=Fe,t[77]=Ie):Ie=t[77];let Le;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(Le=(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`USD / million tokens`}),t[78]=Le):Le=t[78],t[79]===Ie?te=t[80]:(te=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[Ie,Le]}),t[79]=Ie,t[80]=te),ne=h.length===0?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:d.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)(T,{size:`icon-xs`,variant:`ghost`,"aria-label":`Add model price`,disabled:U,onClick:()=>{E.current+=1;let e=`new:${E.current}`;w.current=e,de({id:e,model:``,isNew:!0,values:{}})},children:(0,$.jsx)(F,{"aria-hidden":!0})})})]})}),(0,$.jsx)(Pt,{children:k.length===0?(0,$.jsx)(Ft,{children:(0,$.jsx)(Lt,{colSpan:7,className:`text-center whitespace-normal`,children:(0,$.jsx)(`p`,{className:`py-6 text-muted-foreground`,children:h.some(en)?`Some environment prices are unavailable.`:`No custom prices or mappings. Add a row to set one.`})})}):k.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&&w.current===e.id&&(t.focus(),w.current=null)},"aria-label":`New model ID`,"aria-invalid":e.model.trim()!==``&&R.has(e.id)||void 0,list:`usage-price-models`,placeholder:`Model ID`,autoComplete:`off`,spellCheck:!1,disabled:U,onChange:t=>de({...e,model:t.target.value})}):(0,$.jsx)(`span`,{className:M(`block break-all`,e.removed&&`text-muted-foreground line-through`),children:e.model}),R.has(e.id)&&(e.model.trim()!==``||Object.values(e.values).some($t))?(0,$.jsx)(`p`,{role:`alert`,className:`mt-1 text-xs text-destructive`,children:R.get(e.id)}):null]}),e.removed?(0,$.jsx)(Lt,{colSpan:5,children:(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`Automatic pricing after saving`})}):(0,$.jsx)(Lt,{children:(0,$.jsx)(xe,{size:`compact`,value:e.alias??t.value,"aria-label":`Map ${e.model||`new model`} to model`,list:`usage-alias-models`,placeholder:e.isNew?`Optional`:t.placeholder,autoComplete:`off`,spellCheck:!1,disabled:U,onChange:t=>me(e,t.target.value)})}),e.removed?null:n===``?Rt.map(t=>{let n=Gt(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)(ve,{children:[(0,$.jsx)(ge,{render:(0,$.jsx)(T,{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?v(t=>t.filter(t=>t.id!==e.id)):e.removed?pe({...e,removed:!1}):de({...e,removed:!0})},children:e.isNew?(0,$.jsx)(s,{"aria-hidden":!0}):(0,$.jsx)(l,{"aria-hidden":!0})}),(0,$.jsx)(_e,{children:e.removed?`Undo reset`:e.isNew?`Remove row`:`Reset to automatic`})]})})]},e.id)})})]})}),(0,$.jsx)(`datalist`,{id:`usage-price-models`,children:a.filter(t=>!e.includes(t)).map(Qt)}),(0,$.jsx)(`datalist`,{id:`usage-alias-models`,children:a.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]=S,t[10]=_,t[11]=d,t[12]=u,t[13]=b,t[14]=h,t[15]=f,t[16]=A,t[17]=i,t[18]=j,t[19]=N,t[20]=P,t[21]=I,t[22]=L,t[23]=R,t[24]=z,t[25]=B,t[26]=V,t[27]=te,t[28]=ne,t[29]=re,t[30]=ie,t[31]=ae,t[32]=se}else j=t[18],N=t[19],P=t[20],I=t[21],L=t[22],R=t[23],z=t[24],B=t[25],V=t[26],te=t[27],ne=t[28],re=t[29],ie=t[30],ae=t[31],se=t[32];let U;t[81]===S?U=t[82]:(U=S?(0,$.jsx)(`div`,{role:`status`,className:`grid gap-1 text-xs`,children:S.destinations.map(e=>{let t=S.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]=S,t[82]=U);let le;t[83]!==j||t[84]!==U||t[85]!==te||t[86]!==ne?(le=(0,$.jsxs)(j,{children:[te,ne,U]}),t[83]=j,t[84]=U,t[85]=te,t[86]=ne,t[87]=le):le=t[87];let ue=B?`Changes apply to ${I}`:``,W;t[88]===ue?W=t[89]:(W=(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:ue}),t[88]=ue,t[89]=W);let G;t[90]!==L||t[91]!==z.length||t[92]!==B||t[93]!==b?(G=B?(0,$.jsx)(T,{variant:`ghost`,disabled:b,onClick:L,children:z.length>0?`Discard pending changes`:`Discard changes`}):null,t[90]=L,t[91]=z.length,t[92]=B,t[93]=b,t[94]=G):G=t[94];let de=b||!B&&z.length===0||z.length===0&&(R.size>0||h.length===0),K;t[95]!==z.length||t[96]!==V?(K=()=>void V(z.length>0),t[95]=z.length,t[96]=V,t[97]=K):K=t[97];let fe=b?`Saving…`:z.length>0?`Retry failed saves`:`Save changes`,pe;t[98]!==de||t[99]!==K||t[100]!==fe?(pe=(0,$.jsx)(T,{disabled:de,onClick:K,children:fe}),t[98]=de,t[99]=K,t[100]=fe,t[101]=pe):pe=t[101];let q;t[102]!==G||t[103]!==pe?(q=(0,$.jsxs)(`div`,{className:`flex w-full flex-wrap justify-end gap-2 sm:w-auto`,children:[G,pe]}),t[102]=G,t[103]=pe,t[104]=q):q=t[104];let J;t[105]!==W||t[106]!==q?(J=(0,$.jsxs)(Te,{variant:`bare`,className:`items-center sm:justify-between`,children:[W,q]}),t[105]=W,t[106]=q,t[107]=J):J=t[107];let Y;t[108]!==N||t[109]!==le||t[110]!==J||t[111]!==re||t[112]!==ie?(Y=(0,$.jsxs)(N,{className:re,children:[ie,le,J]}),t[108]=N,t[109]=le,t[110]=J,t[111]=re,t[112]=ie,t[113]=Y):Y=t[113];let me;return t[114]!==P||t[115]!==Y||t[116]!==ae||t[117]!==se?(me=(0,$.jsx)(P,{open:ae,onOpenChange:se,children:Y}),t[114]=P,t[115]=Y,t[116]=ae,t[117]=se,t[118]=me):me=t[118],me}function Zt(e){return(0,$.jsx)(`option`,{value:e},e)}function Qt(e){return(0,$.jsx)(`option`,{value:e},e)}function $t(e){return e!==``}function en(e){return e.prices===null}function tn(e){return(0,$.jsx)(It,{children:e.label},e.key)}function nn(e){return(0,$.jsx)(`col`,{},e.key)}function rn(e){return e.environmentId}function an(e){let[t,n]=e;return[t,n.changes]}function on(e){return[e.environmentId,{status:`saving`}]}function sn(e,t,n){return!e.isNew&&t.placeholder!==`Mixed`&&t.placeholder!==`Unavailable`&&n===t.value}function cn(e){return!Vt(e)}function ln(e){return e.isNew}function un(e){return e.model.trim()}function dn(e){return e.isNew}function fn(e){return e.summary?.buckets.map(pn)??[]}function pn(e){return e.model}function mn(e){return[...Object.keys(e.prices??{}),...Object.keys(e.aliases??{})]}var hn=960,gn=260,_n=4,vn=8,yn=new Set;function bn(e,t,n){let r=e?.byProvider.get(t);return r===void 0?0:n===`tokens`?r.totalTokens:r.costUsd}function xn(e,t,n){return e.map(e=>{let r=t.get(e),i=Je.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=Je.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,N,P;t[13]===g?(N=t[14],P=t[15]):(N=()=>{if(g===null)return;j();let e=v.current,t=y.current;if(e!==null&&t!==null)return je([e,t],j)},P=[g,j],t[13]=g,t[14]=N,t[15]=P),(0,Z.useLayoutEffect)(N,P);let ee;t[16]===p.length?ee=t[17]:(ee=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]=ee);let F=ee,I=g===null?void 0:p[g],L=g===null?void 0:S[g],R;if(t[18]!==f||t[19]!==n){let e;t[21]===f?e=t[22]:(e=e=>f.has(e),t[21]=f,t[22]=e),R=n.some(e),t[18]=f,t[19]=n,t[20]=R}else R=t[20];let z=R,B;t[23]!==u||t[24]!==d?(B=e=>u===`hour`?pe(e,d):le(e),t[23]=u,t[24]=d,t[25]=B):B=t[25];let V=B,te;t[26]!==V||t[27]!==l||t[28]!==u||t[29]!==d?(te=e=>u===`hour`&&l!==void 0?ue(e,l,d):V(e),t[26]=V,t[27]=l,t[28]=u,t[29]=d,t[30]=te):te=t[30];let ne=te,re;t[31]!==k||t[32]!==C.labeled||t[33]!==C.ticks||t[34]!==D?(re=C.labeled?C.ticks.map(e=>(0,$.jsx)(`span`,{className:`absolute right-0 -translate-y-1/2 text-3xs text-muted-foreground tabular-nums`,style:{top:`${D(e)/gn*100}%`},children:e===0?`0`:k(e)},e)):null,t[31]=k,t[32]=C.labeled,t[33]=C.ticks,t[34]=D,t[35]=re):re=t[35];let ie;t[36]===re?ie=t[37]:(ie=(0,$.jsx)(`div`,{className:`relative h-56 w-14 shrink-0`,children:re}),t[36]=re,t[37]=ie);let ae;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ae=()=>{b.current=null,_(null)},t[38]=ae):ae=t[38];let oe=`${u===`hour`?`Hourly`:`Daily`} ${c===`tokens`?`processed tokens`:`cost`} by provider`,se;if(t[39]!==C.ticks||t[40]!==D){let e;t[42]===D?e=t[43]:(e=e=>{let t=D(e);return(0,$.jsx)(`line`,{x1:0,x2:hn,y1:t,y2:t,stroke:`currentColor`,strokeWidth:1,className:`text-border`,vectorEffect:`non-scaling-stroke`},e)},t[42]=D,t[43]=e),se=C.ticks.map(e),t[39]=C.ticks,t[40]=D,t[41]=se}else se=t[41];let H;if(t[44]!==w){let e;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(e=e=>{let{provider:t,loading:n,area:r}=e;return(0,$.jsx)(`path`,{d:r,className:O(n),fill:Xe[t].color,fillOpacity:.12},t)},t[46]=e):e=t[46],H=w.map(e),t[44]=w,t[45]=H}else H=t[45];let U;if(t[47]!==w){let e;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(e=e=>{let{provider:t,loading:n,line:r}=e;return(0,$.jsx)(`path`,{d:r,className:O(n),fill:`none`,stroke:Xe[t].color,strokeWidth:2,vectorEffect:`non-scaling-stroke`},t)},t[49]=e):e=t[49],U=w.map(e),t[47]=w,t[48]=U}else U=t[48];let ce;t[50]!==g||t[51]!==T?(ce=g===null?null:(0,$.jsx)(`line`,{x1:g*T,x2:g*T,y1:vn,y2:gn,stroke:`currentColor`,strokeWidth:1,className:`text-muted-foreground`,vectorEffect:`non-scaling-stroke`}),t[50]=g,t[51]=T,t[52]=ce):ce=t[52];let G;t[53]!==oe||t[54]!==se||t[55]!==H||t[56]!==U||t[57]!==ce?(G=(0,$.jsxs)(`svg`,{className:`h-full w-full`,viewBox:`0 0 ${hn} ${gn}`,preserveAspectRatio:`none`,role:`img`,"aria-label":oe,children:[se,H,U,ce]}),t[53]=oe,t[54]=se,t[55]=H,t[56]=U,t[57]=ce,t[58]=G):G=t[58];let de;t[59]!==k||t[60]!==ne||t[61]!==L?.bands||t[62]!==L?.total||t[63]!==I||t[64]!==f||t[65]!==z||t[66]!==n?(de=I===void 0?null:(0,$.jsxs)(`div`,{ref:y,className:`surface-glass pointer-events-none absolute z-10 min-w-36 max-w-full rounded-xl border border-border/50 px-2.5 py-2 text-xs shadow-lg`,style:{left:`var(--usage-tooltip-left, 0px)`,top:`var(--usage-tooltip-top, 0px)`},children:[(0,$.jsx)(`div`,{className:`mb-1 text-muted-foreground`,children:ne(I)}),n.map(e=>{let{label:t,driverKind:n}=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:M(`tabular-nums`,f.has(e)?`text-muted-foreground`:`text-foreground`),children:k(L?.bands.find(t=>t.provider===e)?.value??0)})]},e)}),(0,$.jsxs)(`div`,{className:`mt-1 flex items-center justify-between gap-3 border-t border-border pt-1`,children:[(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`Total`}),(0,$.jsx)(`span`,{className:M(`tabular-nums`,z?`text-muted-foreground`:`text-foreground`),children:k(L?.total??0)})]})]}),t[59]=k,t[60]=ne,t[61]=L?.bands,t[62]=L?.total,t[63]=I,t[64]=f,t[65]=z,t[66]=n,t[67]=de):de=t[67];let fe;t[68]!==F||t[69]!==G||t[70]!==de?(fe=(0,$.jsxs)(`div`,{ref:v,className:`relative h-56 flex-1`,onMouseMove:F,onMouseLeave:ae,children:[G,de]}),t[68]=F,t[69]=G,t[70]=de,t[71]=fe):fe=t[71];let q;t[72]!==ie||t[73]!==fe?(q=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[ie,fe]}),t[72]=ie,t[73]=fe,t[74]=q):q=t[74];let J;t[75]!==V||t[76]!==p[0]?(J=p[0]===void 0?``:V(p[0]),t[75]=V,t[76]=p[0],t[77]=J):J=t[77];let Y;t[78]===J?Y=t[79]:(Y=(0,$.jsx)(`span`,{children:J}),t[78]=J,t[79]=Y);let me;t[80]!==V||t[81]!==p?(me=p[Math.floor(p.length/2)]===void 0?``:V(p[Math.floor(p.length/2)]??``),t[80]=V,t[81]=p,t[82]=me):me=t[82];let he;t[83]===me?he=t[84]:(he=(0,$.jsx)(`span`,{children:me}),t[83]=me,t[84]=he);let ge;t[85]!==V||t[86]!==p?(ge=p[p.length-1]===void 0?``:V(p[p.length-1]??``),t[85]=V,t[86]=p,t[87]=ge):ge=t[87];let _e;t[88]===ge?_e=t[89]:(_e=(0,$.jsx)(`span`,{children:ge}),t[88]=ge,t[89]=_e);let ve;t[90]!==Y||t[91]!==he||t[92]!==_e?(ve=(0,$.jsxs)(`div`,{className:`flex justify-between pl-16 text-3xs text-muted-foreground uppercase`,children:[Y,he,_e]}),t[90]=Y,t[91]=he,t[92]=_e,t[93]=ve):ve=t[93];let X;return t[94]!==q||t[95]!==ve?(X=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[q,ve]}),t[94]=q,t[95]=ve,t[96]=X):X=t[96],X}function Mn(e){return M(`transition-opacity`,e&&`opacity-40 delay-150`)}function Nn(e){return[e.day,e]}function Pn(e){return[e.hourStart,e]}function Fn(e){let t=(0,Q.c)(30),{label:n,segments:r,format:i,aside:a}=e,o,s,c,l,u,d;if(t[0]!==a||t[1]!==i||t[2]!==n||t[3]!==r){d=Symbol.for(`react.early_return_sentinel`);bb0:{let e=r.filter(Ln),f=e.reduce(In,0);if(f<=0){d=null;break bb0}c=`flex min-w-0 flex-col gap-2.5`;let p;t[10]===n?p=t[11]:(p=(0,$.jsx)(`h3`,{className:`text-sm font-medium text-foreground`,children:n}),t[10]=n,t[11]=p),t[12]!==a||t[13]!==p?(l=(0,$.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[p,a]}),t[12]=a,t[13]=p,t[14]=l):l=t[14];let m;t[15]===i?m=t[16]:(m=e=>`${e.label} ${i(e.value)}`,t[15]=i,t[16]=m);let h;t[17]!==i||t[18]!==f?(h=e=>(0,$.jsxs)(ve,{children:[(0,$.jsx)(ge,{render:(0,$.jsx)(`div`,{className:`h-full min-w-1 rounded-xs first:rounded-l-full last:rounded-r-full`,style:{flex:`${e.value} 1 0`,backgroundColor:e.color}})}),(0,$.jsxs)(_e,{children:[e.label,` · `,i(e.value),` · `,J(e.value/f)]})]},e.label),t[17]=i,t[18]=f,t[19]=h):h=t[19],u=(0,$.jsx)(`div`,{role:`img`,"aria-label":`${n}: ${e.map(m).join(`, `)}`,className:`flex h-2 gap-0.5`,children:e.map(h)}),o=`flex flex-wrap gap-x-4 gap-y-1 text-xs`;let g;t[20]===i?g=t[21]:(g=e=>(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`size-2 rounded-xs`,style:{backgroundColor:e.color}}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:e.label}),(0,$.jsx)(`span`,{className:`text-foreground tabular-nums`,children:i(e.value)})]},e.label),t[20]=i,t[21]=g),s=e.map(g)}t[0]=a,t[1]=i,t[2]=n,t[3]=r,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d}else o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9];if(d!==Symbol.for(`react.early_return_sentinel`))return d;let f;t[22]!==o||t[23]!==s?(f=(0,$.jsx)(`div`,{className:o,children:s}),t[22]=o,t[23]=s,t[24]=f):f=t[24];let p;return t[25]!==c||t[26]!==l||t[27]!==u||t[28]!==f?(p=(0,$.jsxs)(`div`,{className:c,children:[l,u,f]}),t[25]=c,t[26]=l,t[27]=u,t[28]=f,t[29]=p):p=t[29],p}function In(e,t){return e+t.value}function Ln(e){return e.value>0}function Rn(e){return e.toSorted((e,t)=>t.totalTokens-e.totalTokens||t.costUsd-e.costUsd)}function zn(e,t){return t===`tokens`?e.tokenShare:pt(e)?null:e.costShare}function Bn({tokens:e}){let t=e.uncachedInputTokens+e.cachedInputTokens+e.cacheCreationTokens;return t===0?null:e.cachedInputTokens/t}function Vn(e){let t=e.totalTokens-e.unpricedTokens;return t<=0||pt(e)?null:e.costUsd/t*1e6}var Hn=e=>`color-mix(in oklab, var(--foreground) ${e}%, var(--background))`,Un={input:Hn(60),cacheRead:Hn(30),cacheWrite:Hn(72),output:Hn(100),other:Hn(44)};function Wn(e){return[{label:`Input`,value:e.input,color:Un.input},{label:`Cache read`,value:e.cacheRead,color:Un.cacheRead},{label:`Cache write`,value:e.cacheWrite,color:Un.cacheWrite},{label:`Output`,value:e.output,color:Un.output},{label:`Other`,value:e.unsplit>=.005?e.unsplit:0,color:Un.other}]}function Gn(e){return[{label:`Input`,value:e.uncachedInputTokens,color:Un.input},{label:`Cache read`,value:e.cachedInputTokens,color:Un.cacheRead},{label:`Cache write`,value:e.cacheCreationTokens,color:Un.cacheWrite},{label:`Output`,value:e.outputTokens,color:Un.output}]}function Kn(e){return[{label:`Standard`,value:e.standard,color:Hn(34)},{label:`Fast`,value:e.fast,color:Hn(66)},{label:`Ultrafast`,value:e.ultrafast,color:Hn(100)}]}function qn(e){let t=(0,Q.c)(80),{model:n,environments:r,metric:i,chartWindow:a,onSetPrice:o,onClose:s}=e,c;t[0]!==n.model||t[1]!==n.provider?(c=e=>e.provider===n.provider&&e.model===n.model,t[0]=n.model,t[1]=n.provider,t[2]=c):c=t[2];let l;t[3]!==r||t[4]!==c?(l=wt(r,c),t[3]=r,t[4]=c,t[5]=l):l=t[5];let u=l,d;t[6]===n.provider?d=t[7]:(d=[n.provider],t[6]=n.provider,t[7]=d);let f=d,p=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 E;t[41]===_?E=t[42]:(E=(0,$.jsx)(`div`,{className:`grid grid-cols-2 gap-x-6 gap-y-4 sm:grid-cols-4`,children:_.map(Jn)}),t[41]=_,t[42]=E);let D=h?`tokens`:i,O;t[43]!==a.days||t[44]!==a.hours||t[45]!==a.referenceTime||t[46]!==a.resolution||t[47]!==a.timeZone||t[48]!==f||t[49]!==D||t[50]!==u.daily||t[51]!==u.hourly?(O=(0,$.jsx)(jn,{providers:f,days:a.days,daily:u.daily,hours:a.hours,hourly:u.hourly,metric:D,referenceTime:a.referenceTime,resolution:a.resolution,timeZone:a.timeZone}),t[43]=a.days,t[44]=a.hours,t[45]=a.referenceTime,t[46]=a.resolution,t[47]=a.timeZone,t[48]=f,t[49]=D,t[50]=u.daily,t[51]=u.hourly,t[52]=O):O=t[52];let k;t[53]!==h||t[54]!==u.categoryCost?(k=h?null:(0,$.jsx)(Fn,{label:`Cost by type`,segments:Wn(u.categoryCost),format:W}),t[53]=h,t[54]=u.categoryCost,t[55]=k):k=t[55];let A;t[56]===n.tokens?A=t[57]:(A=Gn(n.tokens),t[56]=n.tokens,t[57]=A);let j;t[58]===A?j=t[59]:(j=(0,$.jsx)(Fn,{label:`Tokens by type`,segments:A,format:K}),t[58]=A,t[59]=j);let M;t[60]===u.speedCost?M=t[61]:(M=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]=M);let N;t[62]!==k||t[63]!==j||t[64]!==M?(N=(0,$.jsxs)(`div`,{className:`grid gap-x-10 gap-y-8 sm:grid-cols-2`,children:[k,j,M]}),t[62]=k,t[63]=j,t[64]=M,t[65]=N):N=t[65];let P;t[66]!==E||t[67]!==O||t[68]!==N?(P=(0,$.jsx)(Ee,{children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[E,O,N]})}),t[66]=E,t[67]=O,t[68]=N,t[69]=P):P=t[69];let ee;t[70]!==n.unpricedTokens||t[71]!==o?(ee=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)(T,{onClick:o,children:`Set price`})]}):null,t[70]=n.unpricedTokens,t[71]=o,t[72]=ee):ee=t[72];let F;t[73]!==w||t[74]!==P||t[75]!==ee?(F=(0,$.jsxs)(Oe,{className:`max-w-3xl`,children:[w,P,ee]}),t[73]=w,t[74]=P,t[75]=ee,t[76]=F):F=t[76];let I;return t[77]!==F||t[78]!==v?(I=(0,$.jsx)(ke,{open:!0,onOpenChange:v,children:F}),t[77]=F,t[78]=v,t[79]=I):I=t[79],I}function Jn(e){return(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.label}),(0,$.jsx)(`span`,{className:`text-2xl font-semibold text-foreground`,children:e.value})]},e.label)}function Yn(e){return e!==null}function Xn(e){let t=(0,Q.c)(4),{premiumUsd:n}=e,r;t[0]===n?r=t[1]:(r=W(n),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Premium `,(0,$.jsx)(`span`,{className:`text-foreground tabular-nums`,children:r})]}),t[2]=r,t[3]=i),i}var Zn=`p4code:usage-page-preferences:v1`,Qn=g({metric:d([`cost`,`tokens`,`limits`]),windowDays:d([1,7,30,90]),hiddenProviders:S(h(x))}),$n={metric:`limits`,windowDays:30};function er(){try{return i(Zn,Qn)??$n}catch(e){return console.error(`Could not read Usage page preferences.`,e),$n}}function tr(e){try{C(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);ie();let n=r(se),i=e=>{let t=Me(n,e.command,{context:{usagePageOpen:!0}});return t?`${e.label} (${t})`:e.label},[a,o]=(0,Z.useState)(()=>({days:e.windowDays,window:G(e.windowDays,void 0,e.windowDays===1?`hour`:`day`)})),s=e.metric,c=s===`limits`,[l,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(()=>Date.now()),m=(0,Z.useRef)(!1),[h,g]=(0,Z.useState)(`model`),[_,v]=(0,Z.useState)(null),[y,b]=(0,Z.useState)(null),[x,S]=(0,Z.useState)(null),C=(0,Z.useMemo)(()=>new Set(e.hiddenProviders),[e.hiddenProviders]),{days:w,window:E}=a,D=w===1,{merged:O,environments:k,selectedEnvironments:A,shown:j,isPartial:N,refresh:ee}=Dt(E,x,C),F=j?.merged??O,I=j?.window??E,L=I.resolution===`hour`,R=l&&!c,z=j!==null&&j.window!==E,H=(0,Z.useMemo)(()=>{if(z)return{partial:!0,everyProvider:!0,providers:new Set};let e=ft(A,R),t=new Set([...e.providers].filter(e=>!C.has(e)));return{partial:e.everyProvider||t.size>0,everyProvider:e.everyProvider,providers:t}},[z,R,A,C]),U=e=>H.everyProvider||H.providers.has(e),ue=r(ae.presentationsAtom),me=C.has(`cursor`)?[]:at(A),ge=[...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]:[])??[]))],_e=ce(oe.refreshProviders,{reportFailure:!1}),ve=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?[]:fe(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)(()=>h===`model`&&s===`tokens`?Rn(F.models):F.models,[h,F.models,s]),Te=(0,Z.useMemo)(()=>qe(F.providers),[F.providers]),Ee=(0,Z.useMemo)(()=>Je.filter(e=>Te.includes(e)||H.providers.has(e)),[H.providers,Te]),De=(0,Z.useMemo)(()=>new Set(Ee.filter(e=>H.everyProvider||H.providers.has(e))),[Ee,H.everyProvider,H.providers]),Oe=y===null?void 0:F.models.find(e=>`${e.provider}:${e.model}`===y),ke=we.reduce((e,t)=>Math.max(e,s===`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,...me.map(e=>({kind:`enable`,environment:e})));let Ye=`${60/(Ee.length+2)}%`,Qe=n=>{let r={...e,...n};t(r),tr(r)},nt=e=>{rr(e)&&(Qe({windowDays:e}),o({days:e,window:G(e,void 0,e===1?`hour`:`day`)}))},Q=e=>{e===`limits`&&p(Date.now()),Qe({metric:e})},rt=async(e=!1,t=!1)=>{try{await Promise.all(Array.from(ue,([n,r])=>{if((x===null||x.has(n))&&r.connection.phase===`connected`&&r.serverConfig!==null)return ct(n,()=>_e({environmentId:n,input:{}}),e,t)}))}finally{p(Date.now())}},it=(0,Z.useEffectEvent)(e=>{if(e.defaultPrevented||e.repeat||e.isComposing||We()||Ke())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&&!c&&nt(i.days))});(0,Z.useEffect)(()=>(globalThis.window.addEventListener(`keydown`,it,!0),()=>globalThis.window.removeEventListener(`keydown`,it,!0)),[]);let ot=()=>{if(m.current)return;if(c){m.current=!0,d(!0),rt().finally(()=>{m.current=!1,d(!1)});return}let e=G(w,void 0,D?`hour`:`day`);(e.sinceDay!==E.sinceDay||e.untilDay!==E.untilDay||e.sinceTime!==E.sinceTime||e.untilTime!==E.untilTime)&&o({days:w,window:e}),m.current=!0,d(!0),ee(e).finally(()=>{m.current=!1,d(!1)})},st=[...ue].filter(([e,t])=>t.connection.phase===`connected`&&t.serverConfig!==null&&(x===null||x.has(e))).map(([e])=>e).sort().join(`,`),lt=(0,Z.useEffectEvent)(()=>{rt(!0)});(0,Z.useEffect)(()=>{c&&st&<()},[c,st]);let ut=L&&I.sinceTime!==void 0&&I.untilTime!==void 0?`${de(I.sinceTime,I.timeZone)} to ${de(I.untilTime,I.timeZone)}`:`${le(I.sinceDay)} to ${le(I.untilDay)}`,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:x,onSelectionChange:S,showUsageStatus:!c,refreshing:R,isPartial:N,duplicateSources:F.duplicateSources,contractMismatches:F.contractMismatches,onOpenModelPrices:()=>v({})})}),(0,$.jsx)(et,{}),(0,$.jsx)($e,{current:!0,className:`min-w-10`,children:(0,$.jsx)(xr,{hiddenProviders:C,onChange:e=>Qe({hiddenProviders:e})})})]}),c?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:[s],onValueChange:e=>{let t=e[0];nr(t)&&Q(t)},children:He.map(e=>(0,$.jsx)(be,{value:e.value,title:i(e),children:e.label},e.value))}),(0,$.jsx)(ye,{"aria-label":`Usage period`,variant:`segmented`,value:[String(w)],disabled:c,onValueChange:e=>{let t=e[0];t&&nt(Number(t))},children:Be.map(e=>(0,$.jsx)(be,{value:String(e.days),title:i(e),children:e.label},e.days))}),(0,$.jsx)(T,{onClick:ot,"aria-label":c?`Refresh limits`:`Refresh usage`,"aria-busy":l,disabled:l||!c&&!ve,size:`icon-sm`,variant:`ghost`,children:(0,$.jsx)(Ue,{size:`sm`,refreshing:l})})]}),(0,$.jsxs)(`div`,{className:`ms-auto flex min-w-0 items-center justify-end gap-1 xl:hidden`,children:[(0,$.jsxs)(re,{value:s,onValueChange:e=>{nr(e)&&Q(e)},children:[(0,$.jsx)(ne,{"aria-label":`Usage metric`,size:`compact`,variant:`ghost`,className:`w-auto min-w-0`,children:(0,$.jsx)(V,{children:He.find(e=>e.value===s)?.label})}),(0,$.jsx)(te,{align:`end`,alignItemWithTrigger:!1,children:He.map(e=>(0,$.jsx)(B,{value:e.value,title:i(e),children:e.label},e.value))})]}),(0,$.jsxs)(re,{value:String(w),disabled:c,onValueChange:e=>nt(Number(e)),children:[(0,$.jsx)(ne,{"aria-label":`Usage period`,size:`compact`,variant:`ghost`,className:`w-auto min-w-0`,children:(0,$.jsx)(V,{children:Be.find(e=>e.days===w)?.label})}),(0,$.jsx)(te,{align:`end`,alignItemWithTrigger:!1,children:Be.map(e=>(0,$.jsx)(B,{value:String(e.days),title:i(e),children:e.label},e.days))})]}),(0,$.jsx)(T,{onClick:ot,"aria-label":c?`Refresh limits`:`Refresh usage`,"aria-busy":l,disabled:l||!c&&!ve,size:`icon-sm`,variant:`ghost`,children:(0,$.jsx)(Ue,{size:`sm`,refreshing:l})})]})]});return(0,$.jsxs)(Ae,{className:`h-dvh min-h-0 overflow-hidden overscroll-y-none isolate`,children:[(0,$.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-background text-foreground`,children:[(0,$.jsx)(Ze,{electron:he,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 ${c?`limits`:`usage`}.`:`Select an environment to see ${c?`limits`:`usage`}.`}):c?(0,$.jsx)(Ge,{selectedEnvironmentIds:x,hiddenProviders:C,now:f,cursorPrompt:me.length>0?(0,$.jsx)(lr,{environments:me,onEnabled:()=>{ee(),rt(!1,!0)}}):null}):j===null?(0,$.jsx)(Sr,{}):ve?(0,$.jsxs)(`div`,{"aria-busy":H.partial,className:`flex flex-col gap-6`,children:[ge.map(e=>(0,$.jsx)(`p`,{className:`mb-4 text-sm text-muted-foreground`,children:e},e)),(0,$.jsxs)(`section`,{className:`grid gap-6 lg:grid-cols-[minmax(0,18rem)_minmax(0,1fr)]`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:M(`text-4xl font-semibold text-foreground tabular-nums`,dr(H.partial)),children:s===`cost`?W(F.costUsd):K(F.totalTokens)}),(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,$.jsxs)(`span`,{children:[(0,$.jsxs)(`span`,{className:dr(H.partial),children:[q(F.sessions),` sessions`]}),s===`cost`&&` · API estimate`]}),s===`cost`&&F.costQuality.unpricedShare>0&&(0,$.jsxs)(Fe,{children:[(0,$.jsx)(Pe,{openOnHover:!0,render:(0,$.jsx)(P,{tone:`muted`}),"aria-label":`Unpriced usage details`,children:(0,$.jsx)(u,{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`)&&[...ue].some(([e,t])=>(x===null||x.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:()=>{ee(),rt(!1,!0)}},`enable:${e.environment.environmentId}`);let t=e.provider,n=F.providers.find(e=>e.provider===t),r=s===`cost`?n?.costShare??0:n?.tokenShare??0,i=n?.sessions??0,a=`${q(i)} ${i===1?`session`:`sessions`}`,o=U(t),c=o&&!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:M(`shrink-0 whitespace-nowrap text-2xs text-muted-foreground tabular-nums`,dr(o),c&&`invisible`),children:a})]})]}),(0,$.jsx)(`span`,{className:M(`shrink-0 text-sm font-medium text-foreground tabular-nums`,dr(o)),children:c?`—`:s===`cost`?W(n?.costUsd??0):K(n?.totalTokens??0)})]}),(0,$.jsx)(`span`,{className:M(`text-xs text-muted-foreground`,dr(o),c&&`invisible`),children:s===`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`,` `,s===`tokens`?`processed tokens`:`cost`]}),(0,$.jsx)(jn,{providers:Ee,loadingProviders:De,days:X,daily:F.daily,hours:xe,hourly:F.hourly,metric:s,referenceTime:I.untilTime,resolution:L?`hour`:`day`,timeZone:I.timeZone})]})]}),(0,$.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-medium text-foreground`,children:`Totals`}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-6 gap-y-4 py-1 md:grid-cols-5`,children:[(0,$.jsx)(fr,{loading:H.partial,label:`Processed tokens`,value:K(F.totalTokens)}),(0,$.jsx)(fr,{loading:H.partial,label:`Cached input`,value:K(F.cachedInputTokens)}),(0,$.jsx)(fr,{loading:H.partial,label:`Uncached input`,value:K(F.uncachedInputTokens)}),(0,$.jsx)(fr,{loading:H.partial,label:`Output`,value:K(F.outputTokens)}),(0,$.jsx)(fr,{loading:H.partial,label:`Cache savings`,value:W(F.costQuality.cacheSavingsUsd)})]})]}),F.totalTokens>0?(0,$.jsx)(`section`,{className:M(`grid gap-x-12 gap-y-8 lg:grid-cols-2`,dr(H.partial)),children:s===`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:[h],onValueChange:e=>{let t=e[0];(t===`model`||t===`time`)&&g(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))})]}),h===`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=s===`tokens`?e.totalTokens:e.costUsd,i=zn(e,s===`tokens`?`tokens`:`cost`),a=dr(U(e.provider));return(0,$.jsxs)(`tr`,{className:`relative border-b border-border/50 text-right whitespace-nowrap text-muted-foreground tabular-nums transition-colors hover:bg-muted/50 has-focus-visible:bg-muted/50`,children:[(0,$.jsx)(`td`,{className:`py-2.5 pr-3 text-left text-xs`,children:t+1}),(0,$.jsxs)(`td`,{className:`py-2.5 text-left whitespace-normal`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>b(n),className:`flex items-center gap-2 text-left text-foreground outline-none after:absolute after:inset-0`,children:[(0,$.jsx)(ur,{provider:e.provider,className:`size-3.5`}),e.model]}),(0,$.jsx)(`div`,{"aria-hidden":!0,className:M(`mt-1.5 h-0.5 max-w-48`,a),children:(0,$.jsx)(`div`,{className:`h-full rounded-full`,style:{width:r>0&&ke>0?`max(0.5rem, ${r/ke*100}%)`:0,backgroundColor:Xe[e.provider].color}})})]}),(0,$.jsx)(`td`,{className:M(`py-2.5 pl-6 text-foreground`,a),children:pt(e)?(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`Unpriced`}):W(e.costUsd)}),(0,$.jsx)(`td`,{className:M(`hidden py-2.5 pl-6 sm:table-cell`,a),children:i===null?``:J(i)}),(0,$.jsx)(`td`,{className:M(`py-2.5 pl-6`,a),children:K(e.totalTokens)})]},n)})})]}):(0,$.jsxs)(`table`,{className:`w-full table-fixed text-sm`,children:[(0,$.jsxs)(`colgroup`,{children:[(0,$.jsx)(`col`,{className:`w-2/5`}),Ee.map(e=>(0,$.jsx)(`col`,{style:{width:Ye}},e)),(0,$.jsx)(`col`,{style:{width:Ye}}),(0,$.jsx)(`col`,{style:{width:Ye}})]}),(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?pe(e.hourStart,I.timeZone):le(e.day)}),Ee.map(t=>(0,$.jsx)(`td`,{className:M(`py-2 text-right text-muted-foreground tabular-nums`,dr(U(t))),children:W(e.byProvider.get(t)?.costUsd??0)},t)),(0,$.jsx)(`td`,{className:M(`py-2 text-right text-foreground tabular-nums`,dr(H.partial)),children:W(e.costUsd)}),(0,$.jsx)(`td`,{className:M(`py-2 text-right text-muted-foreground tabular-nums`,dr(H.partial)),children:K(e.totalTokens)})]},`hourStart`in e?e.hourStart:e.day))})]})]})]}):(0,$.jsx)(`div`,{className:`space-y-2 py-12 text-center text-sm text-muted-foreground`,children:A.map(e=>(0,$.jsxs)(`p`,{children:[A.length>1?`${e.label}: `:null,e.error]},e.environmentId))})})})]}),Oe!==void 0&&!c?(0,$.jsx)(qn,{model:Oe,environments:A,metric:s===`tokens`?`tokens`:`cost`,chartWindow:{days:X,hours:xe,resolution:L?`hour`:`day`,timeZone:I.timeZone,referenceTime:I.untilTime},onSetPrice:()=>{b(null),v({model:Oe.model})},onClose:()=>b(null)}):null,_?(0,$.jsx)(Xt,{usage:k,initialSelectedEnvironmentIds:x,initialModel:_.model,onOpenChange:e=>{e||v(null)}}):null]})}var or=`Requires access to your Cursor login in macOS Keychain.`;function sr({environmentId:e,label:t,onEnabled:n,tooltip:r,buttonText:i=`Enable`}){let a=ce(oe.updateSettings,{label:`enable Cursor account usage`}),[o,s]=(0,Z.useState)(!1),c=async()=>{s(!0);try{(await a({environmentId:e,input:{patch:{cursorKeychainUsageEnabled:!0}}}))._tag===`Success`&&n()}finally{s(!1)}},l=r?(0,$.jsx)(P,{disabled:o,"aria-busy":o,"aria-label":`Enable Cursor usage from ${t}`,onClick:()=>void c(),children:i}):(0,$.jsx)(T,{size:`sm`,variant:`outline`,disabled:o,"aria-busy":o,"aria-label":`Enable Cursor usage from ${t}`,onClick:()=>void c(),children:i});return r?(0,$.jsxs)(ve,{children:[(0,$.jsx)(ge,{render:l}),(0,$.jsx)(_e,{children:or})]}):l}function cr(e){let t=(0,Q.c)(11),{environmentId:n,label:r,showEnvironment:i,onEnabled:a}=e,o,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(`span`,{"aria-hidden":!0,className:`size-2 shrink-0 rounded-full`,style:{backgroundColor: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:A.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 M(`transition-opacity`,e&&`opacity-40 delay-150`)}function fr(e){let t=(0,Q.c)(10),{label:n,value:r,loading:i}=e,a;t[0]===n?a=t[1]:(a=(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n}),t[0]=n,t[1]=a);let o;t[2]===i?o=t[3]:(o=M(`text-base font-medium text-foreground tabular-nums`,dr(i)),t[2]=i,t[3]=o);let s;t[4]!==o||t[5]!==r?(s=(0,$.jsx)(`span`,{className:o,children:r}),t[4]=o,t[5]=r,t[6]=s):s=t[6];let c;return t[7]!==a||t[8]!==s?(c=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[a,s]}),t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function pr(e){let t=(0,Q.c)(14),{environments:n,duplicateSources:r,contractMismatches:i}=e,a,o,s,c;if(t[0]!==i||t[1]!==r||t[2]!==n){c=Symbol.for(`react.early_return_sentinel`);bb0:{let e=n.filter(_r),t=new Map(i.map(gr)),l=n.flatMap(e=>{let n=t.get(e.environmentId);return n===void 0?[]:[{environment:e,mismatch:n}]});if(e.length===0&&l.length===0&&r.length===0){c=null;break bb0}a=`flex flex-col gap-1 border-t border-border px-2 py-2 text-xs text-muted-foreground`,o=e.map(hr),s=l.map(mr)}t[0]=i,t[1]=r,t[2]=n,t[3]=a,t[4]=o,t[5]=s,t[6]=c}else a=t[3],o=t[4],s=t[5],c=t[6];if(c!==Symbol.for(`react.early_return_sentinel`))return c;let l;t[7]===r?l=t[8]:(l=r.length>0?(0,$.jsxs)(`span`,{children:[`Counted once across environments sharing a transcript directory:`,` `,r.join(`, `)]}):null,t[7]=r,t[8]=l);let u;return t[9]!==a||t[10]!==o||t[11]!==s||t[12]!==l?(u=(0,$.jsxs)(`div`,{className:a,children:[o,s,l]}),t[9]=a,t[10]=o,t[11]=s,t[12]=l,t[13]=u):u=t[13],u}function mr(e){let{environment:t,mismatch:n}=e;return(0,$.jsx)(`span`,{children:me(t.label,n)},t.environmentId)}function hr(e){return(0,$.jsxs)(`span`,{children:[e.label,`: `,e.error]},e.label)}function gr(e){return[e.environmentId,e]}function _r(e){return e.error!==null}function vr(e){let t=(0,Q.c)(56),{environments:r,selectedEnvironments:i,selectedEnvironmentIds:a,onSelectionChange:o,showUsageStatus:s,refreshing:l,isPartial:u,duplicateSources:d,contractMismatches:p,onOpenModelPrices:m}=e,h=a===null,g=h?`All environments`:i.length===1?i[0].label:`${i.length} environments`,_;t[0]!==p||t[1]!==i?(_=i.some(br)||p.length>0,t[0]=p,t[1]=i,t[2]=_):_=t[2];let b=_,x;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(P,{}),t[3]=x):x=t[3];let S;t[4]===g?S=t[5]:(S=(0,$.jsx)(Qe,{children:g}),t[4]=g,t[5]=S);let C;t[6]!==b||t[7]!==s?(C=(0,$.jsx)(`span`,{className:`flex size-3.5 shrink-0 items-center justify-center text-muted-foreground`,children:s&&b?(0,$.jsx)(f,{className:`size-3.5 text-warning-foreground`,"aria-label":`Some environments could not report usage`}):(0,$.jsx)(ee,{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]=s,t[8]=C):C=t[8];let w;t[9]!==S||t[10]!==C?(w=(0,$.jsxs)(y,{render:x,className:`group/usage-environment min-w-0 max-w-full`,children:[S,C]}),t[9]=S,t[10]=C,t[11]=w):w=t[11];let T;t[12]===o?T=t[13]:(T=e=>o(e?null:new Set),t[12]=o,t[13]=T);let E;t[14]!==h||t[15]!==T?(E=(0,$.jsx)(c,{checked:h,closeOnClick:!1,onCheckedChange:T,children:`All environments`}),t[14]=h,t[15]=T,t[16]=E):E=t[16];let k;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(O,{}),t[17]=k):k=t[17];let A;if(t[18]!==r||t[19]!==o||t[20]!==l||t[21]!==a||t[22]!==i||t[23]!==s){let e;t[25]!==r.length||t[26]!==o||t[27]!==l||t[28]!==a||t[29]!==i||t[30]!==s?(e=e=>{let t=a===null||a.has(e.environmentId),n=ut(e,l),u=e.error===null?e.summary!==null&&!bt(e.summary.contractVersion,6)?`Update required`:e.isConnected?n.phase===`loading`?`Scanning…`:n.phase===`stale`?`Refreshing…`:n.phase===`partway`?dt(n.providers,ir):`Ready`:`Connecting…`:`Unavailable`;return(0,$.jsx)(c,{checked:t,closeOnClick:!1,onCheckedChange:t=>{let n=new Set(i.map(yr));t?n.add(e.environmentId):n.delete(e.environmentId),o(n.size===r.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}),s?(0,$.jsx)(`span`,{className:M(`shrink-0 text-xs text-muted-foreground`,e.error!==null&&`text-destructive`),children:u}):null]})},e.environmentId)},t[25]=r.length,t[26]=o,t[27]=l,t[28]=a,t[29]=i,t[30]=s,t[31]=e):e=t[31],A=r.map(e),t[18]=r,t[19]=o,t[20]=l,t[21]=a,t[22]=i,t[23]=s,t[24]=A}else A=t[24];let N;t[32]===r.length?N=t[33]:(N=r.length===0?(0,$.jsx)(`p`,{className:`px-2 py-2 text-xs text-muted-foreground`,children:`No environments connected.`}):null,t[32]=r.length,t[33]=N);let F;t[34]!==u||t[35]!==s?(F=s&&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]=s,t[36]=F):F=t[36];let I;t[37]!==p||t[38]!==d||t[39]!==i||t[40]!==s?(I=s?(0,$.jsx)(pr,{environments:i,duplicateSources:d,contractMismatches:p}):null,t[37]=p,t[38]=d,t[39]=i,t[40]=s,t[41]=I):I=t[41];let L;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(O,{}),t[42]=L):L=t[42];let R;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(j,{"aria-hidden":!0}),t[43]=R):R=t[43];let z;t[44]===m?z=t[45]:(z=(0,$.jsxs)(v,{onClick:m,children:[R,`Model prices`]}),t[44]=m,t[45]=z);let B;t[46]!==N||t[47]!==F||t[48]!==I||t[49]!==z||t[50]!==E||t[51]!==A?(B=(0,$.jsxs)(n,{align:`start`,children:[E,k,A,N,F,I,L,z]}),t[46]=N,t[47]=F,t[48]=I,t[49]=z,t[50]=E,t[51]=A,t[52]=B):B=t[52];let V;return t[53]!==B||t[54]!==w?(V=(0,$.jsxs)(D,{children:[w,B]}),t[53]=B,t[54]=w,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:r,onChange:i}=e,a;t[0]===r?a=t[1]:(a=Je.filter(e=>!r.has(e)),t[0]=r,t[1]=a);let o=a,s=o.length===Je.length?`All providers`:o.length===0?`No providers`:o.length===1?Xe[o[0]].label:`${o.length} providers`,l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(P,{}),t[2]=l):l=t[2];let u;t[3]===s?u=t[4]:(u=(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:s}),t[3]=s,t[4]=u);let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(ee,{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]=d):d=t[5];let f;t[6]===u?f=t[7]:(f=(0,$.jsxs)(y,{render:l,className:`group/usage-provider min-w-0 max-w-full`,children:[u,d]}),t[6]=u,t[7]=f);let p=r.size===0,m;t[8]===i?m=t[9]:(m=e=>i(e?[]:Je),t[8]=i,t[9]=m);let h;t[10]!==p||t[11]!==m?(h=(0,$.jsx)(c,{checked:p,closeOnClick:!1,onCheckedChange:m,children:`All providers`}),t[10]=p,t[11]=m,t[12]=h):h=t[12];let g;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(O,{}),t[13]=g):g=t[13];let _;t[14]!==r||t[15]!==i?(_=Je.map(e=>(0,$.jsx)(c,{checked:!r.has(e),closeOnClick:!1,onCheckedChange:t=>i(Je.filter(n=>n===e?!t:r.has(n))),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]=r,t[15]=i,t[16]=_):_=t[16];let v;t[17]!==_||t[18]!==h?(v=(0,$.jsxs)(n,{align:`start`,children:[h,g,_]}),t[17]=_,t[18]=h,t[19]=v):v=t[19];let b;return t[20]!==v||t[21]!==f?(b=(0,$.jsxs)(D,{children:[f,v]}),t[20]=v,t[21]=f,t[22]=b):b=t[22],b}function Sr(){let e=(0,Q.c)(7),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(X,{className:`h-10 w-36`}),(0,$.jsx)(X,{className:`h-4 w-32`})]}),Je.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-C2lJ6qWL.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-Br7l7qPU.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-DCj963r2.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{Ht as e,Nt as t,RE as n,Vt as r}from"./utils-hgbJ2TVM.js";import{E as i,i as a}from"./useSettings-BcmuuiTp.js";import{B as o}from"./settingsLayout-CuUCC6iL.js";var s=n();function c(n,c){let l=(0,s.c)(5),{targets:u}=o(),{environments:d}=i(),f;return l[0]!==c||l[1]!==d||l[2]!==n||l[3]!==u?(f=(i,o)=>{let s=c.find(e=>e.instanceId===i);for(let c of u){let l=d.find(e=>e.environmentId===c.environmentId),u=l?.serverConfig;if(!u)continue;let f=r(e(u.providers),c.settings,c.projectId).find(e=>e.instanceId===i),p=t(a(c.settings,n),u.providers).get(i);if(!f?.enabled||!f.isAvailable||f.driverKind!==s?.driverKind||!p?.some(e=>e.slug===o&&!e.isUnavailable))return`This model is unavailable on ${l?.label??`a selected environment`}. Select that environment to choose its model separately.`}return null},l[0]=c,l[1]=d,l[2]=n,l[3]=u,l[4]=f):f=l[4],f}export{c as t};
|
|
2
|
-
//# sourceMappingURL=useScopedModelAvailability-YXOv7_8D.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,Ah as r,Bb as i,Bg as a,Cs as o,Db as s,Ds as c,Eb as l,Es as u,Gy as d,HT as f,Hs as p,I_ as ee,Ib as te,LT as ne,Lb as re,Nx as ie,Ny as ae,O_ as oe,Oh as se,Oy as ce,Pb as le,Pv as ue,Qy as de,RE as fe,RT as m,Rg as pe,Sl as me,Th as he,Vy as ge,Xy as _e,Yo as ve,bh as ye,bl as be,c_ as xe,cb as Se,ds as h,eT as g,es as Ce,gb as we,gh as Te,hh as Ee,iS as De,iT as _,ib as Oe,jc as ke,kh as Ae,ks as je,l_ as Me,lb as Ne,lh as Pe,nT as v,nb as Fe,oS as Ie,oh as Le,ph as Re,rs as y,s_ as ze,ts as Be,uh as Ve,yl as He,z_ as Ue,zb as We}from"./utils-hgbJ2TVM.js";import{At as Ge,E as Ke,I as qe,R as Je,Sn as Ye,T as Xe,W as Ze,_t as b}from"./runtime-Cj24N7je.js";import{Et as Qe,St as $e,T as et,t as tt}from"./runtime-CArTL2GH.js";import{i as x}from"./toast-B3hjhWRf.js";import{f as S,h as C,m as nt,u as rt}from"./server-Vynm5NwP.js";import{i as it,n as at,s as ot,t as st}from"./session-DyiiEN5g.js";import{t as ct}from"./use-atom-command-D34CFqu3.js";import{B as lt,C as ut,M as dt,N as ft,O as pt,P as mt,S as ht,_ as gt,b as _t,c as vt,i as w,n as T,o as yt,r as bt,y as xt,z as St}from"./themePalette-CLR_iiPi.js";var E=e(t(),1),D=fe();function Ct(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 wt(e){let t=Be(t=>y(n=>{let r=n(e.catalogValueAtom).entries.get(t);if(r===void 0)return null;let i=ne(u(n(e.stateAtom(t))),()=>Ye);return{entry:r,connection:r.unsupportedReason===void 0?Qe(i):{phase:`unsupported`,error:r.unsupportedReason,traceId:null},serverConfig:n(e.serverConfigValueAtom(t))}}).pipe(h(`environment-presentation:${t}`))),n=new Map;return{presentationAtom:t,presentationsAtom:y(r=>{let i=new Map;for(let n of r(e.catalogValueAtom).entries.keys()){let e=r(t(n));e!==null&&i.set(n,e)}return Ct(n,i)||(n=i),n}).pipe(h(`environment-presentations`))}}function Tt(e,t){return{environmentId:e,environmentLabel:t.entry.target.label,displayUrl:$e(t.entry)??``,isRelayManaged:Ge(t.entry),isEnabled:t.entry.enabled,connectionState:t.connection.phase,connectionError:t.connection.error,connectionErrorTraceId:t.connection.traceId}}function Et(e){let t=y(t=>{let n=[...t(e.catalogValueAtom).entries.keys()],r=m(t.self());return r!==null&&r.length===n.length&&n.every((e,t)=>e===r[t])?r:n}),n=y(t=>{let n=[...t(e.catalogValueAtom).entries].map(([e,t])=>({environmentId:e,label:t.target.label})),r=m(t.self());return r!==null&&r.length===n.length&&n.every((e,t)=>e.environmentId===r[t]?.environmentId&&e.label===r[t]?.label)?r:n}),r=Be(t=>y(n=>{let r=n(e.presentationAtom(t));if(r===null)return null;let i=Tt(t,r),a=m(n.self());return a!==null&&a.environmentId===i.environmentId&&a.environmentLabel===i.environmentLabel&&a.displayUrl===i.displayUrl&&a.isRelayManaged===i.isRelayManaged&&a.isEnabled===i.isEnabled&&a.connectionState===i.connectionState&&a.connectionError===i.connectionError&&a.connectionErrorTraceId===i.connectionErrorTraceId?a:i})),i=y(t=>{let n=[];for(let i of t(e.catalogValueAtom).entries.keys()){let e=t(r(i));e!==null&&n.push(e)}let i=m(t.self());return i!==null&&i.length===n.length&&n.every((e,t)=>e===i[t])?i:n}).pipe(h(`environment-connection-summaries`));return{environmentIdsAtom:t,connectedEnvironmentIdsAtom:y(e=>{let n=e(t).filter(t=>e(r(t))?.connectionState===`connected`),i=m(e.self());return i!==null&&i.length===n.length&&n.every((e,t)=>e===i[t])?i:n}),identitiesAtom:n,environmentsAtom:i,machineByIdAtom:y(n=>{let r=new Map(n(t).map(t=>[t,me(n(e.presentationAtom(t))?.serverConfig??null)])),i=m(n.self());return i!==null&&Ct(i,r)?i:r}),pullRequestsSupportedAtom:y(n=>n(t).some(t=>n(e.presentationAtom(t))?.serverConfig?.environment.capabilities.pullRequests===!0))}}var Dt=wt({catalogValueAtom:C.catalogValueAtom,stateAtom:C.stateAtom,serverConfigValueAtom:S.configValueAtom}),Ot=Et({catalogValueAtom:C.catalogValueAtom,presentationAtom:Dt.presentationAtom}),kt=y(null).pipe(h(`web-environment-presentation:empty`));function At(e){let t=(0,D.c)(5),r=n(C.catalogValueAtom),i;t[0]===e?i=t[1]:(i=e===null?kt:Dt.presentationAtom(e),t[0]=e,t[1]=i);let a=n(i),o;return t[2]!==r.isReady||t[3]!==a?(o={isReady:r.isReady,presentation:a},t[2]=r.isReady,t[3]=a,t[4]=o):o=t[4],o}var jt={status:`idle`},O=jt,k=null,A=[],j=0,Mt=new Set;function M(e){O=e;for(let e of Mt)e()}function Nt(e){k?.resolve(e);for(let t of A)t.resolve(e);k=null,A=[]}function Pt(){return O}function Ft(e){return Mt.add(e),()=>{Mt.delete(e)}}function It(){j+=1;let e=!0;return()=>{e&&(e=!1,j=Math.max(0,j-1),j===0&&(Nt(!1),M(jt)))}}function Lt(e,t){if(j!==0)return new Promise(n=>{let r={message:e,variant:t?.variant??`default`,resolve:n};if(k||O.status===`closing`){A.push(r);return}k=r,M({status:`confirming`,message:e,variant:r.variant})})}function Rt(){return O.status!==`idle`||k!==null||A.length>0}function zt(e){if(O.status!==`confirming`||!k)return;let t=k;k=null,t.resolve(e),M({status:`closing`,message:O.message,variant:O.variant})}function Bt(){if(O.status!==`closing`)return;let e=A.shift();if(!e){M(jt);return}k=e,M({status:`confirming`,message:e.message,variant:e.variant})}var Vt={Ctrl:`⌃`,Alt:`⌥`,Shift:`⇧`,Super:`⌘`,CmdOrCtrl:`⌘`};function Ht(e,t=navigator.platform){let n=e.split(`+`),r=n.pop()??``;return ke(t)?`${n.map(e=>Vt[e]??e).join(``)}${r}`:[...n.map(e=>e===`CmdOrCtrl`?`Ctrl`:e===`Super`?`Meta`:e),r].join(`+`)}var Ut=`http://www.w3.org/2000/svg`,Wt={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 Gt(e,t){let n=Wt[e];if(!n||typeof document.createElementNS!=`function`)return null;let r=document.createElementNS(Ut,`svg`);r.setAttribute(`xmlns`,Ut),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(Ut,e.tag);for(let[n,r]of Object.entries(e.attrs))t.setAttribute(n,r);r.appendChild(t)}return r}function Kt(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 qt(e,t){if(typeof Node<`u`&&e instanceof Node)return t.some(t=>t.contains(e));if(!e||typeof e!=`object`)return!1;let n=e;for(;n&&typeof n==`object`;){if(t.includes(n))return!0;n=n.parent}return!1}var N=null;function Jt(){return N!==null}function Yt(){N?.(),N=null}function Xt(e,t){return new Promise(n=>{let r=document.activeElement instanceof HTMLElement?document.activeElement:null,i=[],a=[],o=!1,s=!1,c=()=>l(null),l=e=>{if(o)return;o=!0,N===c&&(N=null),document.removeEventListener(`keydown`,u),document.removeEventListener(`pointerdown`,d,!0),document.removeEventListener(`contextmenu`,f,!0);let t=qt(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&&!qt(e.target,i)&&l(null)},f=e=>{s&&!qt(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?Gt(`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=Gt(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=Ht(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=Gt(`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&&Kt(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(()=>{Kt(c,t,n)})};document.addEventListener(`keydown`,u),document.addEventListener(`pointerdown`,d,!0),document.addEventListener(`contextmenu`,f,!0),ee(e,t?.x??0,t?.y??0,0),N&&N(),N=c,requestAnimationFrame(()=>{s=!0})})}var Zt=`p4code:client-settings:v1`;function Qt(){return typeof window<`u`}function $t(){return Qt()?c(Zt,Le):null}function en(e){Qt()&&je(Zt,e,Le)}var tn;function nn(){return{dialogs:{pickFolder:async e=>window.desktopBridge?window.desktopBridge.pickFolder(e):null,confirm:async(e,t)=>Lt(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):Xt(e,t),close:async()=>{window.desktopBridge||Yt()}},persistence:{getClientSettings:async()=>window.desktopBridge?window.desktopBridge.getClientSettings():$t(),setClientSettings:async e=>{if(window.desktopBridge)return window.desktopBridge.setClientSettings(e);en(e)}}}}function rn(){return nn()}function an(){if(typeof window<`u`)return tn||(tn=rn(),tn)}function on(){let e=an();if(!e)throw Error(`Local API not found`);return e}var P=`p4code:theme`,sn=`(prefers-color-scheme: dark)`,F={theme:`system`,resolvedTheme:`light`,systemDark:!1,followSystem:!0,appearanceMode:`system`,themeHalves:null};function cn(){return I()}function ln(){return typeof window>`u`?{}:un()}function I(){if(typeof window>`u`)return null;try{return pt(window.localStorage.getItem(w))}catch{return null}}function un(){try{let e=JSON.parse(window.localStorage.getItem(`p4code:theme-halves:v1`)??`null`);if(typeof e!=`object`||!e)return{};let t={};for(let n of[`light`,`dark`]){let r=e[n];typeof r==`string`&&(t[n]=r)}return t}catch{return{}}}function dn(e){return`${e?.light??``}|${e?.dark??``}`}var fn=`theme-color`,pn=`meta[name="${fn}"][data-dynamic-theme-color="true"]`,L=class extends d()(`ThemeStorageError`,{operation:ae([`read`,`write`]),storageKey:ge,theme:we(yt),cause:ce()}){get message(){return`Failed to ${this.operation} theme preference for ${this.storageKey}.`}},mn=Ne(L),hn=class extends d()(`DesktopThemeSyncError`,{theme:yt,cause:ce()}){get message(){return`Failed to sync the ${this.theme} theme to the desktop shell.`}},gn=Ne(hn),R=[],z=null,_n=!0,vn=null,B=null,V=null;function H(){_n=!0;for(let e of R)e()}function yn(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(sn).matches}function bn(e){if(typeof window>`u`)return e===`system`;try{let e=window.localStorage.getItem(bt);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 U(e){if(typeof window<`u`)try{let e=window.localStorage.getItem(T);if(xn(e))return e}catch{}return bn(e)?`system`:xt(e)??`light`}function Sn(e){if(typeof window<`u`)try{window.localStorage.setItem(T,e)}catch(e){throw new L({operation:`write`,storageKey:T,cause:e})}}function Cn(){if(typeof window>`u`)return F.theme;let e;try{e=window.localStorage.getItem(P)}catch(e){throw new L({operation:`read`,storageKey:P,cause:e})}return e!==null&&ut(e)?e:F.theme}function wn(e){if(typeof window<`u`)try{window.localStorage.setItem(P,e),V=null}catch(t){throw new L({operation:`write`,storageKey:P,theme:e,cause:t})}}function W(){if(V!==null)return F.theme;try{return Cn()}catch(e){let t=mn(e)?e:new L({operation:`read`,storageKey:P,cause:e});return V=t,console.error(t.message,{operation:t.operation,storageKey:t.storageKey,...b(t)}),F.theme}}function Tn(){let e=document.querySelector(pn);return e||(e=document.createElement(`meta`),e.name=fn,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="${fn}"]`);if(a.length===0){Tn().setAttribute(`content`,i);return}for(let e of a)e.setAttribute(`content`,i)}function G(e,{suppressTransitions:t=!1,preservePreview:n=!0}={}){if(typeof document>`u`||typeof window>`u`||n&&document.documentElement.dataset?.themeId===`__preview`)return;let r=U(e),i=r===`system`,a=i?yn():!1,o=I();if(B?.theme===e&&B.systemDark===a&&B.followSystem===i&&B.appearanceMode===r&&dn(B.themeHalves)===dn(o)){An(e,i,r);return}t&&document.documentElement.classList.add(`no-transitions`);let s=ft(e,a,i,r,o);vt(mt(e,o,s),s),document.documentElement.classList.toggle(`dark`,s===`dark`),B={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=I()){try{await e.setTheme(dt(t,n,r,i))}catch(e){throw new hn({theme:t,cause:e})}}function An(e,t,n){if(typeof window>`u`)return;let r=window.desktopBridge,i=I(),a=dt(e,t,n,i);r&&typeof r.setTheme==`function`&&vn!==a&&(vn=a,kn(r,e,t,n,i).catch(t=>{let n=gn(t)?t:new hn({theme:e,cause:t});console.error(n.message,{theme:n.theme,...b(n)}),vn===a&&(vn=null)}))}typeof document<`u`&&typeof window<`u`&&G(W());function jn(){if(typeof window>`u`)return F;if(!_n&&z)return z;_n=!1;let e=W(),t=U(e),n=t===`system`,r=n?yn():!1,i=I(),a=ft(e,r,n,t,i);return z&&z.theme===e&&z.resolvedTheme===a&&z.systemDark===r&&z.followSystem===n&&z.appearanceMode===t&&dn(z.themeHalves)===dn(i)||(z={theme:e,resolvedTheme:a,systemDark:r,followSystem:n,appearanceMode:t,themeHalves:i}),z}function Mn(){return F}function Nn(){let e=W();U(e)===`system`&&G(e,{suppressTransitions:!0}),H()}function Pn(e){e.key===P?(V=null,G(W(),{suppressTransitions:!0}),H()):e.key===`p4code:theme-follow-system`||e.key===`p4code:theme-appearance-mode`||e.key===`p4code:theme-halves:v1`?(G(W(),{suppressTransitions:!0}),H()):(e.key===`p4code:themes:v1`||e.key===null)&&(e.key===null&&(V=null),ht(),B=null,G(W(),{suppressTransitions:!0}),H())}var Fn=null;function In(e){if(typeof window>`u`)return()=>{};if(R.push(e),!Fn){let e=typeof window.matchMedia==`function`?window.matchMedia(sn):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,E.useSyncExternalStore)(In,jn,Mn),{theme:t,resolvedTheme:n}=e,r=(0,E.useCallback)(e=>{if(typeof window>`u`)return!1;try{Sn(U(W()));let t=window.localStorage.getItem(w);window.localStorage.removeItem(w);try{wn(e)}catch(e){if(t!==null)try{window.localStorage.setItem(w,t)}catch{}throw e}}catch(t){let n=mn(t)?t:new L({operation:`write`,storageKey:P,theme:e,cause:t});return console.error(n.message,{operation:n.operation,storageKey:n.storageKey,theme:e,...b(n)}),!1}return G(e,{suppressTransitions:!0}),H(),!0},[]),i=(0,E.useCallback)(e=>{if(typeof window>`u`)return!1;try{Sn(e)}catch(e){let t=mn(e)?e:new L({operation:`write`,storageKey:T,cause:e});return console.error(t.message,{operation:t.operation,storageKey:t.storageKey,...b(t)}),!1}return V=null,G(W(),{suppressTransitions:!0}),H(),!0},[]),a=(0,E.useCallback)(e=>{let n=U(t),r=e?`system`:n===`system`?xt(t)??`light`:n;return i(r)},[i,t]),o=(0,E.useCallback)((e,t)=>{if(typeof window>`u`)return!1;try{let n={...un()};t===null?delete n[e]:n[e]=t,n.light===void 0&&n.dark===void 0?window.localStorage.removeItem(w):window.localStorage.setItem(w,JSON.stringify(n))}catch(e){let t=new L({operation:`write`,storageKey:w,cause:e});return console.error(t.message,{operation:t.operation,storageKey:t.storageKey,...b(t)}),!1}return G(W(),{suppressTransitions:!0}),H(),!0},[]),s=(0,E.useCallback)(()=>{if(typeof window>`u`)return!1;try{window.localStorage.removeItem(w)}catch(e){let t=new L({operation:`write`,storageKey:w,cause:e});return console.error(t.message,{operation:t.operation,storageKey:t.storageKey,...b(t)}),!1}return G(W(),{suppressTransitions:!0}),H(),!0},[]),c=(0,E.useCallback)(({preservePreview:e=!1}={})=>{typeof window<`u`&&(B=null,G(W(),{suppressTransitions:!0,preservePreview:e}),H())},[]);return(0,E.useEffect)(()=>{G(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=de(Se(_e)),zn=i(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(Ie(e=>e.issue))}),Bn=new le(zn,We());re().pipe(te(We({space:2})));var Vn=e=>ge.pipe(Fe(e,Bn)),Hn={performance:{profile:`performance`,automaticGitFetchInterval:v(15),providerHealthRefreshInterval:g(1),hostPowerMonitorActiveInterval:v(30),hostPowerMonitorIdleInterval:g(2),idleClientTtl:v(45),pauseWhenHostLocked:!0,pauseWhenHostLowPower:!1,pauseWhenClientLowPower:!1,pauseWhenOnBattery:!1},balanced:{profile:`balanced`,automaticGitFetchInterval:Pe,providerHealthRefreshInterval:Ee,hostPowerMonitorActiveInterval:v(30),hostPowerMonitorIdleInterval:g(5),idleClientTtl:v(45),pauseWhenHostLocked:!0,pauseWhenHostLowPower:!0,pauseWhenClientLowPower:!0,pauseWhenOnBattery:!1},"battery-saver":{profile:`battery-saver`,automaticGitFetchInterval:v(0),providerHealthRefreshInterval:g(15),hostPowerMonitorActiveInterval:g(1),hostPowerMonitorIdleInterval:g(10),idleClientTtl:v(45),pauseWhenHostLocked:!0,pauseWhenHostLowPower:!0,pauseWhenClientLowPower:!0,pauseWhenOnBattery:!0}};function K(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 q(e,t){return _(e)===_(t)}function Gn(e,t){return q(e.automaticGitFetchInterval,t.automaticGitFetchInterval)&&q(e.providerHealthRefreshInterval,t.providerHealthRefreshInterval)&&q(e.hostPowerMonitorActiveInterval,t.hostPowerMonitorActiveInterval)&&q(e.hostPowerMonitorIdleInterval,t.hostPowerMonitorIdleInterval)&&q(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:{...q(t.automaticGitFetchInterval,i.automaticGitFetchInterval)?{}:{automaticGitFetchInterval:t.automaticGitFetchInterval},...q(t.providerHealthRefreshInterval,i.providerHealthRefreshInterval)?{}:{providerHealthRefreshInterval:t.providerHealthRefreshInterval},...q(t.hostPowerMonitorActiveInterval,i.hostPowerMonitorActiveInterval)?{}:{hostPowerMonitorActiveInterval:t.hostPowerMonitorActiveInterval},...q(t.hostPowerMonitorIdleInterval,i.hostPowerMonitorIdleInterval)?{}:{hostPowerMonitorIdleInterval:t.hostPowerMonitorIdleInterval},...q(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:Ve,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`||_(e.automaticGitFetchInterval)!==_(Pe)||_(e.providerHealthRefreshInterval)!==_(Ee);return Wn(n&&i?{schemaVersion:1,profile:_(e.automaticGitFetchInterval)===_(K(r).automaticGitFetchInterval)&&_(e.providerHealthRefreshInterval)===_(K(r).providerHealthRefreshInterval)?r:`custom`,baseProfile:r,overrides:{..._(e.automaticGitFetchInterval)===_(K(r).automaticGitFetchInterval)?{}:{automaticGitFetchInterval:e.automaticGitFetchInterval},..._(e.providerHealthRefreshInterval)===_(K(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(ye);Oe(Yn);function Xn(e,t){let n=e.providerInstances[t.instanceId];return n===void 0?he(t.instanceId):r(n)}var Zn=[`codex`,`claudeAgent`,`cursor`,`grok`,`muse`,`pi`,`opencode`,`antigravity`].map(e=>ze.make(e));function Qn(e,t,n){let r=[...Zn.map(e=>[Me(e),e]),...n?.includeConfiguredInstances===!0?Object.entries(e).flatMap(([e,t])=>Zn.includes(t.driver)?[[xe.make(e),t.driver]]:[]):[]].find(([e,n])=>t(e,n));if(r===void 0)return null;let[i,o]=r,s=n?.defaultModelSelection,c=e[i]?.config;return s?.instanceId===i&&p(c?.customModels).some(e=>e.slug===s.model)?s:{instanceId:i,model:a[o]??pe[o]??`gpt-6-luna`}}function $n(e,t,n){let r=e.sourceControlWriterModelSelection;if(!r||!Ae(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)&&be(i)?r:e.textGenerationModelSelection}function er(e,t,n){let r=e.reviewGuideModelSelection;if(r&&Ae(e,n,r.instanceId)){let e=t?.find(e=>e.instanceId===r.instanceId);if(t===void 0||e?.enabled===!0&&He(e)&&be(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=s(e,[`textGenerationModelSelection`])),t?.threadRestartContinuation===!0?e:s(e,[`continueThreadsAfterServerUpdate`])}function or(e){return e.connection.phase===`connected`&&e.serverConfig?.environment.capabilities.threadAutoSettlement===!0}function sr(e){let t=e.atom(ue(Ke.pipe(De(e=>Ue(e.state)))),{initialValue:Xe});return{stateAtom:t,stateValueAtom:y(e=>ne(u(e(t)),()=>Xe)).pipe(h(`relay-environment-discovery-value`)),refresh:qe(e,{label:`relay-environment-discovery:refresh`,concurrency:{mode:`singleFlight`,key:()=>`refresh`},execute:e=>Ke.pipe(ie(e=>e.refresh))})}}var cr=sr(tt);function lr(e,t){return{...t,environmentId:e,label:t.entry.target.label,displayUrl:$e(t.entry),relayManaged:Ge(t.entry)}}function ur(){let e=(0,D.c)(7),t=n(C.catalogValueAtom),r=n(C.networkStatusValueAtom),i=n(Dt.presentationsAtom),a;e[0]===i?a=e[1]:(a=[...i.entries()].map(dr),e[0]=i,e[1]=a);let o=a,s;return e[2]!==t.isReady||e[3]!==o||e[4]!==r||e[5]!==i?(s={isReady:t.isReady,networkStatus:r,environments:o,presentationById:i},e[2]=t.isReady,e[3]=o,e[4]=r,e[5]=i,e[6]=s):s=e[6],s}function dr(e){let[t,n]=e;return lr(t,n)}function fr(){return n(nt)}function pr(e){let t=(0,D.c)(3),{presentation:n}=At(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,D.c)(2),n=ot(e),r;return t[0]===n?r=t[1]:(r=f(n)?n.value.httpBaseUrl:null,t[0]=n,t[1]=r),r}function gr(){return n(cr.stateValueAtom)}function _r(){return n(Ot.environmentIdsAtom)}function vr(){return n(Ot.identitiesAtom)}function yr(){return n(Ot.pullRequestsSupportedAtom)}var br=`[CLIENT_SETTINGS]`,xr=new Set,Sr=new Set,Cr=Re,J=`pending`,Y=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 X(){return Cr}function kr(e){Cr=e,Dr()}function Ar(e){J!==e&&(J=e,Or())}function jr(e){return xr.add(e),Z().catch(()=>void 0),()=>{xr.delete(e)}}function Mr(){return J===`ready`}function Nr(){return J}function Pr(e){return Sr.add(e),Z().catch(()=>void 0),()=>{Sr.delete(e)}}async function Z(){if(J===`ready`)return;if(Y)return Y;let e=wr;Ar(J===`failed`||J===`retrying`?`retrying`:`pending`);let t=(async()=>{try{let t=await on().persistence.getClientSettings();if(e!==wr)return;t&&kr({...Re,...t}),Ar(`ready`)}catch(t){throw e===wr&&Ar(`failed`),console.error(`${br} hydrate failed`,{operation:`hydrate`,...b(t)}),t}})().finally(()=>{Y===t&&(Y=null)});return Y=t,Y}var Fr=e=>on().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=J!==`ready`||Er>0;return n?Er+=1:kr({...X(),...e}),Ir(async()=>{if(n)try{J!==`ready`&&await Z(),kr({...X(),...e})}finally{--Er}await t(X())}).catch(e=>{console.error(`${br} persist failed`,{operation:`persist`,...b(e)})})}async function Rr(e,t=Fr){return Ir(async()=>{for(J!==`ready`&&await Z();;){let n=X(),r=e(n);if(await t(r),X()===n)return kr(r),r}})}var zr=new Set(l(ye.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 X()}function Hr(){return Z()}function Ur(){return(0,E.useSyncExternalStore)(Pr,Mr,Wr)}function Wr(){return!1}function Gr(){return(0,E.useSyncExternalStore)(Pr,Nr,Kr)}function Kr(){return`pending`}function Q(){return(0,E.useSyncExternalStore)(jr,X,qr)}function qr(){return Re}function Jr(e,t){return{...t,...e,...tr(e,t)}}var Yr=new Set;function $(e,t){let n=(0,D.c)(8),r=Q(),i=Ur(),a;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={reportFailure:!1},n[0]=a):a=n[0];let o=ct(S.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,E.useEffect)(s,c)}function Xr(e,t){let n=(0,D.c)(6),r=Q(),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 Zr(e){let t=(0,D.c)(3),n=Q(),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 Qr(e){return e.settingsHydrated?e.paletteThemeActive&&!e.paletteThemeAllowsArtwork&&e.mode===`artwork`?`pill`:e.mode:`none`}function $r(){let e=(0,D.c)(7),t=Ur(),n=Q().environmentIdentificationMode,{resolvedTheme:r,theme:i,themeHalves:a}=Ln(),o=(0,E.useSyncExternalStore)(St,_t,ei),s;if(e[0]!==n||e[1]!==o||e[2]!==r||e[3]!==t||e[4]!==i||e[5]!==a){let c=mt(i,a,r),l=gt(c);s=Qr({mode:n,settingsHydrated:t,paletteThemeActive:o!==null||l!==null,paletteThemeAllowsArtwork:o??lt(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 ei(){return null}async function ti(e,t){return(e.favorites===null||e.providerModelPreferences===null)&&await Hr(),{...nr(e,Vr()),...t}}function ni(e){let t=(0,D.c)(6),r;t[0]===e?r=t[1]:(r=e?S.settingsValueAtom(e):ii,t[0]=e,t[1]=r);let i=n(r),a=ct(S.updateSettings,`model preferences update`),o;return t[2]!==e||t[3]!==a||t[4]!==i?(o=async t=>{if(!e||!i)return;let n;try{n=await ti(i,t)}catch{x.add({type:`error`,title:`Model preferences not saved`,description:`Could not load saved model preferences. Try again.`});return}return a({environmentId:e,input:{patch:n}})},t[2]=e,t[3]=a,t[4]=i,t[5]=o):o=t[5],o}function ri(e){let t=(0,E.use)(Ce),n=(0,E.useRef)(new Map),r=ni(e);return(0,E.useCallback)(async(i,a)=>{if(!e)return;let s=S.settingsValueAtom(e),c=t.get(s);if(!c)return;if(c.favorites===null)try{await Hr()}catch{x.add({type:`error`,title:`Favorites not saved`,description:`Could not load saved model preferences. Try again.`});return}let l=t.get(s)??c,u=tr(l,Vr()).favorites,d=JSON.stringify([e,i,a]),f=n.current.get(d),p={favorite:!(f&&(f.pending||f.settings.favorites===l.favorites)?f.favorite:u.some(e=>e.provider===i&&e.model===a)),settings:l,pending:!0};n.current.set(d,p);try{let e=await r({setModelFavorites:[{provider:i,model:a,favorite:p.favorite}]});e&&o(e)&&t.get(s)?.favorites===l.favorites&&(p.pending=!1)}finally{p.pending&&n.current.get(d)===p&&(f&&!f.pending&&t.get(s)?.favorites===f.settings.favorites?n.current.set(d,f):n.current.delete(d))}},[e,t,r])}var ii=y(null);function ai(e){let t=(0,D.c)(5),r;t[0]===e?r=t[1]:(r=e?S.settingsValueAtom(e):ii,t[0]=e,t[1]=r);let i=n(r),a=Q();$(e,i);let o=i??Te,s;return t[2]!==a||t[3]!==o?(s=tr(o,a),t[2]=a,t[3]=o,t[4]=s):s=t[4],s}function oi(e,t){let r=(0,D.c)(2),i;r[0]===e?i=r[1]:(i=S.settingsValueAtom(e),r[0]=e,r[1]=i);let a=n(i);return $(e,a),Xr(a??Te,t)}function si(e){let t=(0,D.c)(4),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={reportFailure:!1},t[0]=n):n=t[0];let r=ct(S.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 ci(e){let t=mr(),r=n(rt);return $(t?.environmentId??null,t?.serverConfig?.settings??null),Xr(r,e)}var li=`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 ui(){let e=(0,D.c)(2),t=mr(),n;return e[0]===t?n=e[1]:(n=t!==null||!et(),e[0]=t,e[1]=n),n}function di(e){let t=(0,D.c)(3),r=e!==void 0&&e,{environments:i}=ur(),a;return t[0]!==i||t[1]!==r?(a=y(e=>i.filter(or).flatMap(t=>{let n=e(st.sessionStateAtom(t.environmentId));if(r&&n._tag===`Initial`)return[t.environmentId];let i=n._tag===`Failure`?null:m(u(n));return i!==null&&ee(i,`settings:write`)?[t.environmentId]:[]})),t[0]=i,t[1]=r,t[2]=a):a=t[2],n(a)}function fi(e){let t=(0,D.c)(10);it(e,oe);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=ct(S.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=Ze(t);x.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=di(!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||se(n).every(t=>at(e,t));if(Object.keys(n).length>0&&!c&&x.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=_i;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(ve.get(st.sessionStateAtom(r))._tag!==`Initial`&&!se(t).every(e=>at(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(pi)}}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 pi(e){let t=e.flatMap(gi);if(t.length===0)return;let n=e.filter(hi).map(mi);x.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 mi(e){let{label:t}=e;return t}function hi(e){let{result:t}=e;return t._tag===`Success`}function gi(e){let{label:t,result:n}=e;if(n._tag!==`Failure`||Je(n))return[];let r=Ze(n);return[`Could not save on ${t}: ${r instanceof Error?r.message:`The save failed. Try reconnecting and saving again.`}`]}function _i(e){let t=e===void 0?li:e;return x.add({type:`warning`,title:`Setting not saved`,description:t})}function vi(e){return fi(e)}function yi(){return fi(mr()?.environmentId??null)}function bi(){return xi}function xi(e){return Lr(e)}export{It as $,gr as A,Vn as B,hr as C,mr as D,ur as E,Un as F,On as G,cn as H,K as I,an as J,Ln as K,Kn as L,Qn as M,er as N,fr as O,$n as P,Pt as Q,Jn as R,pr as S,_r as T,ln as U,U as V,Cn as W,Bt as X,Jt as Y,Rt as Z,ri as _,Lr as a,vi as b,Ur as c,ai as d,Lt as et,oi as f,ui as g,ci as h,Jr as i,At as it,cr as j,yr as k,Gr as l,si as m,Hr as n,Ft as nt,Rr as o,$ as p,on as q,Vr as r,Dt as rt,Zr as s,li as t,zt as tt,$r as u,bi as v,vr as w,yi as x,ni as y,qn as z};
|
|
3
|
-
//# sourceMappingURL=useSettings-BcmuuiTp.js.map
|