@p4code/cli 0.8.5 → 0.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.mjs +1 -1
- package/dist/{binCli-D9Qk_k5i.mjs → binCli-D_84b0CF.mjs} +155 -47
- package/dist/client/.vite/manifest.json +2715 -2986
- package/dist/client/assets/{AnimatedHeight-DKdClmyw.js → AnimatedHeight-DewGDSmN.js} +2 -2
- package/dist/client/assets/{AuthSurfaceShell-UJgufrYU.js → AuthSurfaceShell-D29U36jB.js} +2 -2
- package/dist/client/assets/{CSPContext-CTpTfAqS.js → CSPContext-CB4Jj3Uk.js} +2 -2
- package/dist/client/assets/ChatGptUsageButton-CFN6c9Ue.js +2 -0
- package/dist/client/assets/ChatMarkdown-DTSMYNs8.js +65 -0
- package/dist/client/assets/CodexSetupSection.logic-DQMTTenV.js +2 -0
- package/dist/client/assets/ComboboxClear-D8WYxa7i.js +2 -0
- package/dist/client/assets/CommandBlock-VzUG411k.js +2 -0
- package/dist/client/assets/{ComposerPromptEditor-BpT2majW.js → ComposerPromptEditor-lIFv0Iko.js} +61 -61
- package/dist/client/assets/CompositeRoot-CLSWLNTl.js +2 -0
- package/dist/client/assets/{ConnectionStatusDot-BX6msmak.js → ConnectionStatusDot-B0ZKI-zI.js} +2 -2
- package/dist/client/assets/DevicePanel-BQ6aWeSD.js +2 -0
- package/dist/client/assets/DeviceSetup-Bg5OpWbo.js +2 -0
- package/dist/client/assets/{DialogTitle-CLcXbJRs.js → DialogTitle-BVkBTuS9.js} +2 -2
- package/dist/client/assets/{DiffCommentAnnotation-B21n3tGU.js → DiffCommentAnnotation-BsI9yTe1.js} +3 -3
- package/dist/client/assets/DiffFileTree-Bg8GHn2r.js +2 -0
- package/dist/client/assets/DiffPanel-D2TxWIFd.js +2 -0
- package/dist/client/assets/{DiffWorkerPoolProvider-Cxzr_uYq.js → DiffWorkerPoolProvider-B9BXoLYM.js} +3 -3
- package/dist/client/assets/EnvironmentMachineIcon-DX1wHHgS.js +2 -0
- package/dist/client/assets/{ExpandableText-D1ewr-yU.js → ExpandableText-DfTvwfDp.js} +2 -2
- package/dist/client/assets/{FieldControl-BVq7aDv3.js → FieldControl-CrNWnPN_.js} +2 -2
- package/dist/client/assets/{FileDiff-C0ZCBwBc.js → FileDiff-Ds-DSHzC.js} +2 -2
- package/dist/client/assets/FilePreviewPanel-CyR5pXUr.js +34 -0
- package/dist/client/assets/FoldedSettingsSection-DQesC0Ch.js +2 -0
- package/dist/client/assets/{FormContext-CObkgUvS.js → FormContext-CUf-dYwe.js} +2 -2
- package/dist/client/assets/{Icons-CSHLGz_M.js → Icons-DMu3kCVA.js} +2 -2
- package/dist/client/assets/{KeybindingsSettings.logic-D9eYCeK5.js → KeybindingsSettings.logic-BB1oFV_W.js} +2 -2
- package/dist/client/assets/NoProjectsHero-D0SwrjYG.js +2 -0
- package/dist/client/assets/PanelLayoutControls-Bfgdx7QX.js +215 -0
- package/dist/client/assets/{PierreEntryIcon-D0PlfaRc.js → PierreEntryIcon-BUl5qtCE.js} +2 -2
- package/dist/client/assets/PreviewPanel-CbotCgGz.js +2 -0
- package/dist/client/assets/ProjectDefaultsSettings-GpUKCz2U.js +2 -0
- package/dist/client/assets/ProjectFavicon-BKEw0TrD.js +3 -0
- package/dist/client/assets/ProjectIconPickerDialog-C-KFxEg0.js +2 -0
- package/dist/client/assets/ProjectMonogram-B2dsNF6-.js +2 -0
- package/dist/client/assets/{ProviderAuthTerminal-rBb4SeQd.js → ProviderAuthTerminal-Cwr8Z1Ly.js} +2 -2
- package/dist/client/assets/ProviderModelPicker-CIxbqWeL.js +2 -0
- package/dist/client/assets/ProviderSettingsForm-DpmAB_Jq.js +2 -0
- package/dist/client/assets/PullRequestCodeTab-qEGBl5Kn.js +6 -0
- package/dist/client/assets/{ReadOnlySourcePreview-BvUk75g2.js → ReadOnlySourcePreview-C5y6ELAP.js} +2 -2
- package/dist/client/assets/RenderErrorBoundary-CyH8UwmD.js +2 -0
- package/dist/client/assets/ScheduledTasksSettings-deUjWQ39.js +4 -0
- package/dist/client/assets/ScopedSwitch-pdvWIJp5.js +2 -0
- package/dist/client/assets/{SecretInput-SiHUbFCV.js → SecretInput-C11F3Wuh.js} +2 -2
- package/dist/client/assets/SettingsPanels-DExy67bz.js +39 -0
- package/dist/client/assets/{SettingsPanels.logic-B3IqBMv7.js → SettingsPanels.logic-zUA6f3HT.js} +2 -2
- package/dist/client/assets/{SettingsScopeNotice-B_awMQPw.js → SettingsScopeNotice-N6bcXfto.js} +2 -2
- package/dist/client/assets/T3ConnectAccountPages-uVnu-v4W.js +2 -0
- package/dist/client/assets/T3ConnectSidebarSignIn-CZCWzt6C.js +2 -0
- package/dist/client/assets/ThemeEditorPanel-CjUB7HmU.js +5 -0
- package/dist/client/assets/ThreadTerminalDrawer-CAh-h3eK.js +5 -0
- package/dist/client/assets/{Virtualizer-DWmIp9HB.js → Virtualizer-CB4f0UTD.js} +2 -2
- package/dist/client/assets/{WorkspaceBreadcrumb-Dx7xMwQd.js → WorkspaceBreadcrumb-3VgFkWcC.js} +2 -2
- package/dist/client/assets/{WorkspacePageContainer-sM_H3DH4.js → WorkspacePageContainer-8jksqZGW.js} +2 -2
- package/dist/client/assets/{WorkspacePageHeader-C_J7FxVt.js → WorkspacePageHeader-IRvZnA0X.js} +2 -2
- package/dist/client/assets/_chat-BfQTKc_9.js +45 -0
- package/dist/client/assets/_chat.index-DnYerwxz.js +2 -0
- package/dist/client/assets/_chat.new-XtBIcyRw.js +4 -0
- package/dist/client/assets/_chat.pull-requests-Dz-eLkAP.js +2 -0
- package/dist/client/assets/{abnfDiagram-VCTEODGH-D2OflHz4.js → abnfDiagram-VCTEODGH-DUPWAarL.js} +2 -2
- package/dist/client/assets/{alert-8IFNkYPw.js → alert-DzxRsWWi.js} +2 -2
- package/dist/client/assets/architecture-7GRP2DOG-DTyqnvkZ.js +1 -0
- package/dist/client/assets/{architectureDiagram-5GKGNRK7-Cz7fFw7N.js → architectureDiagram-5GKGNRK7-ipdl5Chl.js} +2 -2
- package/dist/client/assets/arrow-left-BLE461db.js +2 -0
- package/dist/client/assets/arrow-right-CoV5ameY.js +2 -0
- package/dist/client/assets/arrow-up-down-ibtVnemT.js +2 -0
- package/dist/client/assets/assets-B7aY-rQd.js +2 -0
- package/dist/client/assets/bell-CLuvLMth.js +2 -0
- package/dist/client/assets/{blockDiagram-I7D4REHJ-BcqcXQ0x.js → blockDiagram-I7D4REHJ-CCqcBoEP.js} +2 -2
- package/dist/client/assets/blocks-B-VfW07Q.js +2 -0
- package/dist/client/assets/bot-DpQzHyXo.js +2 -0
- package/dist/client/assets/{browserHistoryStore-CuO1erOb.js → browserHistoryStore-TLJ0k3I1.js} +2 -2
- package/dist/client/assets/{browserLinkTarget-B5-9Pt65.js → browserLinkTarget-Du_qPFvd.js} +2 -2
- package/dist/client/assets/{c4Diagram-7LVT6UL2-DDiDhcli.js → c4Diagram-7LVT6UL2-D0uMteR1.js} +2 -2
- package/dist/client/assets/calendar-clock-DTUOomkO.js +2 -0
- package/dist/client/assets/channel-BO8pVrSI.js +2 -0
- package/dist/client/assets/chart-no-axes-column-DKbSsm0y.js +2 -0
- package/dist/client/assets/checkbox-Gd1YCUIl.js +2 -0
- package/dist/client/assets/{chunk-4HAMMTFA-_7K6yngz.js → chunk-4HAMMTFA-B3SWgtem.js} +2 -2
- package/dist/client/assets/{chunk-75Z2AOVW-CUqo_4ua.js → chunk-75Z2AOVW-CXAakYxI.js} +2 -2
- package/dist/client/assets/{chunk-DU6HZSFF-C3RStRBi.js → chunk-DU6HZSFF-B4qcstD9.js} +2 -2
- package/dist/client/assets/{chunk-F27PBJKO-BOr5cbtz.js → chunk-F27PBJKO-DimzPDjs.js} +2 -2
- package/dist/client/assets/{chunk-GMAD6QVW-qBcSdTWV.js → chunk-GMAD6QVW-BHA-Os4E.js} +2 -2
- package/dist/client/assets/{chunk-GVQU2GXP-D8rhGQK_.js → chunk-GVQU2GXP-P9nMI_GJ.js} +2 -2
- package/dist/client/assets/{chunk-IMKFNOWR-BjTZFMrm.js → chunk-IMKFNOWR-RgWCceFN.js} +2 -2
- package/dist/client/assets/{chunk-L3NEJ4N5-DnCelWBi.js → chunk-L3NEJ4N5-9p7zIkHC.js} +2 -2
- package/dist/client/assets/{chunk-OSK3NFVY-BEgD3sGZ.js → chunk-OSK3NFVY-C9IokqLY.js} +2 -2
- package/dist/client/assets/{chunk-P2QGCYS3-DDmmXS6G.js → chunk-P2QGCYS3-Dwk8ORW_.js} +2 -2
- package/dist/client/assets/{chunk-POPQ4Y6H-CefHvRtI.js → chunk-POPQ4Y6H-BwYKYQwt.js} +2 -2
- package/dist/client/assets/{chunk-PWAF6VOD-BPIKFLCK.js → chunk-PWAF6VOD-BMw0rklB.js} +2 -2
- package/dist/client/assets/{chunk-SHT3W25Y-B_pDi6kv.js → chunk-SHT3W25Y-D3ovSAoa.js} +2 -2
- package/dist/client/assets/{chunk-SVP7TREG-BD15vJFs.js → chunk-SVP7TREG-CpaRTznV.js} +2 -2
- package/dist/client/assets/{chunk-TICWLB2K-B2yA6VhZ.js → chunk-TICWLB2K-CAtIccZJ.js} +2 -2
- package/dist/client/assets/classDiagram-ZZMXUADV-Scmt9e5N.js +2 -0
- package/dist/client/assets/classDiagram-v2-VYDZK3BY-Scmt9e5N.js +2 -0
- package/dist/client/assets/{color-picker-Dqvd0njw.js → color-picker-DYoHU1P8.js} +2 -2
- package/dist/client/assets/combobox-Ddag8Jom.js +2 -0
- package/dist/client/assets/command-B35zAYVN.js +2 -0
- package/dist/client/assets/{connect-D8LGiBSX.js → connect-XgeleCz9.js} +2 -2
- package/dist/client/assets/connect-agent-BRIcxQbo.js +2 -0
- package/dist/client/assets/corner-left-up-BCqW4dF8.js +2 -0
- package/dist/client/assets/{cynefin-OW5HDTMX-D-j3kzkd.js → cynefin-OW5HDTMX-Br0UWz2p.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-5FMLGOSQ-CVEhj0G_.js → cynefinDiagram-5FMLGOSQ-Bz8AWXlE.js} +2 -2
- package/dist/client/assets/{dagre-GXQ25YYZ-opF-kR2J.js → dagre-GXQ25YYZ-Kk1kLU-A.js} +2 -2
- package/dist/client/assets/device-CJH4ixRH.js +2 -0
- package/dist/client/assets/{diagram-S7CK7UJ4-Y1OUf_Uf.js → diagram-S7CK7UJ4-Dogw5edZ.js} +2 -2
- package/dist/client/assets/{diagram-UQ7AKVKN-BMAkQiYU.js → diagram-UQ7AKVKN-kg5DSfbZ.js} +2 -2
- package/dist/client/assets/{diagram-VSXAHHWV-YWI6689v.js → diagram-VSXAHHWV-DXdyRkdD.js} +2 -2
- package/dist/client/assets/{diagram-VX7I27RA-DVxQ1Tyn.js → diagram-VX7I27RA-CNO5Z04I.js} +2 -2
- package/dist/client/assets/{diagram-Z3DM3KII-DzaunCE7.js → diagram-Z3DM3KII-7Pw0HXMg.js} +2 -2
- package/dist/client/assets/dialog-C9_Ef3sx.js +2 -0
- package/dist/client/assets/{diffRendering-TJ6NEHef.js → diffRendering-CAxImuLd.js} +2 -2
- package/dist/client/assets/{discovery-list-2jVj88oX.js → discovery-list-DXE1P9pq.js} +2 -2
- package/dist/client/assets/{dist-Dc07DWZJ.js → dist-DOyHkZUI.js} +3 -3
- package/dist/client/assets/download-BAp4p4A-.js +2 -0
- package/dist/client/assets/{draft-input-CAOyi5vd.js → draft-input-6dynCiw_.js} +2 -2
- package/dist/client/assets/{duoViewer-CkI16mDl.js → duoViewer-BFeSS1Av.js} +2 -2
- package/dist/client/assets/dynamic-BxCDxZLw.js +3 -0
- package/dist/client/assets/earth-CTY23Bx1.js +2 -0
- package/dist/client/assets/{ebnfDiagram-PWID7BFC-CLu3StxL.js → ebnfDiagram-PWID7BFC-DD9UVmrJ.js} +2 -2
- package/dist/client/assets/ellipsis-6x3R4_IB.js +2 -0
- package/dist/client/assets/{embeddedScripts-C0cHj-rX.js → embeddedScripts-CIC2AYGL.js} +2 -2
- package/dist/client/assets/empty-BvJSXK20.js +2 -0
- package/dist/client/assets/entities-Dzl1j2jY.js +2 -0
- package/dist/client/assets/{erDiagram-RLTQ6QDP-CMztaIAH.js → erDiagram-RLTQ6QDP-BJ--ph2e.js} +2 -2
- package/dist/client/assets/eventmodeling-NTZA5JFV-DrPNirV-.js +1 -0
- package/dist/client/assets/eye-Dh5UEUs_.js +2 -0
- package/dist/client/assets/file-search-DotMSEoS.js +2 -0
- package/dist/client/assets/{fileLinks-3CrgspkN.js → fileLinks-BZV-xG7Q.js} +2 -2
- package/dist/client/assets/{fileTreeExpansion-CYkjiRdT.js → fileTreeExpansion-SSkII8h0.js} +2 -2
- package/dist/client/assets/flowDiagram-HODETNUW-D4bD8hue.js +1 -0
- package/dist/client/assets/folder-git-2-BxqGR5ht.js +2 -0
- package/dist/client/assets/folder-open-BqgCWh1y.js +2 -0
- package/dist/client/assets/folder-plus-BHa3aD6W.js +2 -0
- package/dist/client/assets/{ganttDiagram-EL5Y4UJY-G_L0ijf2.js → ganttDiagram-EL5Y4UJY-CAMkT1YN.js} +2 -2
- package/dist/client/assets/{getDiffFileInput-Kc1w64Y-.js → getDiffFileInput-BbRHVLd8.js} +2 -2
- package/dist/client/assets/git-branch-CAP5iwh8.js +2 -0
- package/dist/client/assets/{gitGraph-4MIJSDKK-BmuEuxsx.js → gitGraph-4MIJSDKK-DsGem99u.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-WWUBYQGX-C6A4msS5.js → gitGraphDiagram-WWUBYQGX-BkbTIyDI.js} +2 -2
- package/dist/client/assets/grip-vertical-B8ERFH5y.js +2 -0
- package/dist/client/assets/{guideRunStore-sdfoC8zb.js → guideRunStore-CRgghh5M.js} +2 -2
- package/dist/client/assets/hard-drive-CVWUL95f.js +2 -0
- package/dist/client/assets/history-B22_6xEN.js +2 -0
- package/dist/client/assets/house-D_gjXlRt.js +2 -0
- package/dist/client/assets/{htmlRender-BPiW3VQi.js → htmlRender-DhaCAG_8.js} +2 -2
- package/dist/client/assets/index-CyuShNwE.js +3 -0
- package/dist/client/assets/{info-A6RAGUB7-CwFLPSUe.js → info-A6RAGUB7-BBQkQpY8.js} +1 -1
- package/dist/client/assets/{infoDiagram-27XIBGKW-bjIIr1Q4.js → infoDiagram-27XIBGKW-B-aRfZJ5.js} +2 -2
- package/dist/client/assets/{input-w_nbMVAd.js → input-BZEAWLAC.js} +2 -2
- package/dist/client/assets/{input-group-DM7QvN7X.js → input-group-DQ0hiSJt.js} +2 -2
- package/dist/client/assets/{ishikawaDiagram-5VMMS53U-ymImqXAG.js → ishikawaDiagram-5VMMS53U-BuQT0JFA.js} +2 -2
- package/dist/client/assets/{journeyDiagram-3NMN7TZE-TJpDU0em.js → journeyDiagram-3NMN7TZE-DvMkIp6_.js} +2 -2
- package/dist/client/assets/{kanban-definition-UXKFOSKX-Bhm6s1x1.js → kanban-definition-UXKFOSKX-BH-BleQp.js} +2 -2
- package/dist/client/assets/{kbd-CTZhqOH9.js → kbd-B5U1dWuw.js} +2 -2
- package/dist/client/assets/{keybindings-CJFu-Dyg.js → keybindings-BOV97yVS.js} +2 -2
- package/dist/client/assets/keyboard-9HUE6Zs7.js +2 -0
- package/dist/client/assets/{lazyRouteComponent-WxKijHdU.js → lazyRouteComponent-Cz9CWj20.js} +2 -2
- package/dist/client/assets/{line-C24Qe7Rj.js → line-ldmXyAfR.js} +2 -2
- package/dist/client/assets/{link-DnBUR2mx.js → link-GWWfOiYJ.js} +2 -2
- package/dist/client/assets/link-zAXVcUwk.js +2 -0
- package/dist/client/assets/{linkedPrompt-CNv-bVSs.js → linkedPrompt-CUOURNo0.js} +2 -2
- package/dist/client/assets/list-BAEaXVbr.js +2 -0
- package/dist/client/assets/loader-CRsWQXUs.js +2 -0
- package/dist/client/assets/main-DJbmaTSv.js +30 -0
- package/dist/client/assets/main-bt-A8VDR.css +2 -0
- package/dist/client/assets/{mediaReference-vtwfoFLK.js → mediaReference-CHMrPLS_.js} +2 -2
- package/dist/client/assets/{mediaSource-BDkqXaxs.js → mediaSource-C2DVrhoI.js} +2 -2
- package/dist/client/assets/{mermaid-parser.core-D2hAGRv3.js → mermaid-parser.core-CLu3jfMo.js} +4 -4
- package/dist/client/assets/{mermaid.core-DWtHy2iz.js → mermaid.core-CcbjUEO9.js} +5 -5
- package/dist/client/assets/message-circle-question-mark-Blboafqi.js +2 -0
- package/dist/client/assets/message-square-DLzUyuIE.js +2 -0
- package/dist/client/assets/message-square-dashed-DrEYZ6F3.js +2 -0
- package/dist/client/assets/{mindmap-definition-YA3MSWOX-DCzTD1Gd.js → mindmap-definition-YA3MSWOX-BgA-mHTZ.js} +2 -2
- package/dist/client/assets/mouse-pointer-2-DbBU41il.js +2 -0
- package/dist/client/assets/number-field-BuLW4JjE.js +2 -0
- package/dist/client/assets/{observeResize-wFdsooQ8.js → observeResize-DRhwSBbU.js} +2 -2
- package/dist/client/assets/{onboarding-Buk_SNIp.js → onboarding-JdAo8zsA.js} +2 -2
- package/dist/client/assets/openFileInPreview-fPqhkMo9.js +2 -0
- package/dist/client/assets/p4ProjectFile-CvON4UbU.js +2 -0
- package/dist/client/assets/{packet-AYTQ26CC-CSklBRjj.js → packet-AYTQ26CC-DApn8qRX.js} +1 -1
- package/dist/client/assets/{pair-DYnW2Jz0.js → pair-BZFzlFlB.js} +2 -2
- package/dist/client/assets/palette-Xj4s0pmv.js +2 -0
- package/dist/client/assets/panel-left-DzXd97so.js +2 -0
- package/dist/client/assets/panels-top-left-C5lf6BGD.js +2 -0
- package/dist/client/assets/{pegDiagram-XKGWAZYB-Cgo_C_YQ.js → pegDiagram-XKGWAZYB-CXEiF-e_.js} +2 -2
- package/dist/client/assets/{phoneViewer-CVOLU68D.js → phoneViewer-B2PYzUOK.js} +2 -2
- package/dist/client/assets/{pie-WAS4IAKB-y0cNnmhp.js → pie-WAS4IAKB-CYqWZV05.js} +1 -1
- package/dist/client/assets/{pieDiagram-E7YTZNPT-CR9uQOKX.js → pieDiagram-E7YTZNPT-DI-IJXNl.js} +2 -2
- package/dist/client/assets/{pierre-icons-YFKnGmUq.js → pierre-icons-bBNX7pHG.js} +2 -2
- package/dist/client/assets/popover-O8JaXWO5.js +2 -0
- package/dist/client/assets/{preview-DT6Qi-Q0.js → preview-BVbvXV-T.js} +2 -2
- package/dist/client/assets/{preview-C7hqmFHN.js → preview-CBNZZm4k.js} +2 -2
- package/dist/client/assets/{previewMiniPlayerStore-Dmvk7kfx.js → previewMiniPlayerStore-C_DZeWb5.js} +2 -2
- package/dist/client/assets/primary-fvERVyIG.js +2 -0
- package/dist/client/assets/primaryCloudLinkState-CT9FDATw.js +2 -0
- package/dist/client/assets/projectFilesQueryState-D-fWLsA3.js +2 -0
- package/dist/client/assets/projectScriptEditor-BqddH5Lr.js +2 -0
- package/dist/client/assets/{providerSkills-Bd9FOodA.js → providerSkills-JMYzRM2N.js} +2 -2
- package/dist/client/assets/{pullRequestDetail.logic-BHCv2eTg.js → pullRequestDetail.logic-BVBxawC1.js} +4 -4
- package/dist/client/assets/pullRequestIcons-CuqlEFYV.js +2 -0
- package/dist/client/assets/{pullRequestReviewStore-DNDBmRdQ.js → pullRequestReviewStore-DmxuV1dp.js} +2 -2
- package/dist/client/assets/pullRequests-CEpTVk5m.js +2 -0
- package/dist/client/assets/puzzle-Bv9mngwk.js +2 -0
- package/dist/client/assets/{quadrantDiagram-AXDQQJYC-B2RnhUBb.js → quadrantDiagram-AXDQQJYC-Os8jPhhw.js} +2 -2
- package/dist/client/assets/queries-BBd2XSpN.js +2 -0
- package/dist/client/assets/query-fboCqXXy.js +2 -0
- package/dist/client/assets/{radar-RG4KPBEZ-Dygcuho2.js → radar-RG4KPBEZ-BwFp-k4W.js} +1 -1
- package/dist/client/assets/radio-group-B2ziR973.js +2 -0
- package/dist/client/assets/{railroad-74A4TZTK-CK7b6dqk.js → railroad-74A4TZTK-BhaeCUUR.js} +1 -1
- package/dist/client/assets/railroad-abnf-HS5TGJTU-D_PV710-.js +1 -0
- package/dist/client/assets/railroad-ebnf-LZEXJU2U-CmXdS8HA.js +1 -0
- package/dist/client/assets/railroad-peg-WCYAUIDC-BpmFZ4-g.js +1 -0
- package/dist/client/assets/{railroadDiagram-O6MQD6OU-DsiQNHoT.js → railroadDiagram-O6MQD6OU-BwEd4kBJ.js} +2 -2
- package/dist/client/assets/{renderScheduler-DwOi4uKZ.js → renderScheduler-C031Kal5.js} +2 -2
- package/dist/client/assets/{requirementDiagram-BXWQKSXE-DUEtMGYN.js → requirementDiagram-BXWQKSXE-B3cJlOEK.js} +2 -2
- package/dist/client/assets/{rightPanelStore-BWYBRVeP.js → rightPanelStore-JWjHC9l1.js} +2 -2
- package/dist/client/assets/rotate-ccw-Dr4MwDMq.js +2 -0
- package/dist/client/assets/rotate-cw-10CQA0Ej.js +2 -0
- package/dist/client/assets/runtime-B-UcwNuZ.js +2 -0
- package/dist/client/assets/runtime-BVzm9sLS.js +6 -0
- package/dist/client/assets/runtimeModeConfig-Ce0Dnm2_.js +2 -0
- package/dist/client/assets/{sankeyDiagram-P5KCCOFB-Bnb7-uIo.js → sankeyDiagram-P5KCCOFB-C8CBmy9t.js} +2 -2
- package/dist/client/assets/{scheduledTasksSettings.logic-CFyLLJ0-.js → scheduledTasksSettings.logic-CJBRz5bk.js} +3 -3
- package/dist/client/assets/{scroll-area-iMm_YXqJ.js → scroll-area-D4H8QGpd.js} +2 -2
- package/dist/client/assets/select-D0wmEFXx.js +2 -0
- package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-BKHWFnq6.js → sequenceDiagram-WJ2MYXX4-IbrowOt4.js} +2 -2
- package/dist/client/assets/server-97u7Iupv.js +2 -0
- package/dist/client/assets/session-CPQQ27HG.js +2 -0
- package/dist/client/assets/{session-logic-DVvClfzW.js → session-logic-CiMoVF-V.js} +5 -5
- package/dist/client/assets/settings-2-XzWAl_8P.js +2 -0
- package/dist/client/assets/settings-CTjEqsg3.js +2 -0
- package/dist/client/assets/settings-mAdVdtYz.js +2 -0
- package/dist/client/assets/settings.appearance-SUyLnEit.js +2 -0
- package/dist/client/assets/settings.archived-C-clMQMK.js +2 -0
- package/dist/client/assets/settings.computer-use-IGLZXOs8.js +2 -0
- package/dist/client/assets/settings.connections-DhpKQ7ay.js +2 -0
- package/dist/client/assets/{settings.data-controls-CmJZj_HT.js → settings.data-controls-FiLy_ddv.js} +2 -2
- package/dist/client/assets/{settings.decisions-Bm-M9k3t.js → settings.decisions-DZO8QWHd.js} +2 -2
- package/dist/client/assets/settings.diagnostics-CG2kVUBD.js +2 -0
- package/dist/client/assets/settings.general-jsS1Ydzs.js +2 -0
- package/dist/client/assets/settings.integrations-DDlR7Et9.js +2 -0
- package/dist/client/assets/settings.keybindings-BYwCM_iI.js +2 -0
- package/dist/client/assets/settings.open-source-licenses-CZcWXiGu.js +2 -0
- package/dist/client/assets/settings.plugins-P_B4taFp.js +5 -0
- package/dist/client/assets/settings.projects-DqNHL2Mx.js +4 -0
- package/dist/client/assets/settings.providers-olNQXPOc.js +3 -0
- package/dist/client/assets/settings.scheduled-tasks-Dwr1Iiu5.js +2 -0
- package/dist/client/assets/settings.snap-shot-uj9CX5J6.js +2 -0
- package/dist/client/assets/settings.source-control-H60mYM0m.js +2 -0
- package/dist/client/assets/{settings.storage-e3yKBYeM.js → settings.storage--Ghi4ySm.js} +2 -2
- package/dist/client/assets/settingsLayout-BdqCokK9.js +3 -0
- package/dist/client/assets/shield-check-k2SY7zjx.js +2 -0
- package/dist/client/assets/shield-question-mark-pgYZYoSI.js +2 -0
- package/dist/client/assets/sidebar-7a8hvtAS.js +2 -0
- package/dist/client/assets/{sidebarProjectGrouping-BmTLes3y.js → sidebarProjectGrouping-BGgp_M_h.js} +2 -2
- package/dist/client/assets/skeleton-7wGNlCET.js +2 -0
- package/dist/client/assets/{sortable.esm-Df_JB8i3.js → sortable.esm-CG0AZByT.js} +2 -2
- package/dist/client/assets/{sourceControl-BfGzu06x.js → sourceControl-B8VqenU-.js} +2 -2
- package/dist/client/assets/spinner-YUJ6Pwvq.js +2 -0
- package/dist/client/assets/square-pen-DIW48FdK.js +2 -0
- package/dist/client/assets/{standalone-page-Bsaqnigq.js → standalone-page-BxErOfZy.js} +2 -2
- package/dist/client/assets/{stateDiagram-D77RDMKH-BhdX_IDZ.js → stateDiagram-D77RDMKH-C0i1_7JQ.js} +2 -2
- package/dist/client/assets/stateDiagram-v2-MP3YSRHH-nFt0QPRs.js +2 -0
- package/dist/client/assets/{swimlanes-42K2YHIH-T7QLMavY.js → swimlanes-42K2YHIH-DlWorw-a.js} +2 -2
- package/dist/client/assets/swimlanesDiagram-VR7AAH4N-Byr1T2AB.js +9 -0
- package/dist/client/assets/{terminal-links-B9s8s-tz.js → terminal-links-DnuUiEnP.js} +2 -2
- package/dist/client/assets/{terminalSessions-BmqpP0Ss.js → terminalSessions-B89lkZlG.js} +2 -2
- package/dist/client/assets/text-search-BsqmpFYh.js +2 -0
- package/dist/client/assets/{textarea-C9YeXMVc.js → textarea-Br1ny3dw.js} +2 -2
- package/dist/client/assets/{themePalette-C1oD3Oeg.js → themePalette-B4vIs8Bi.js} +3 -3
- package/dist/client/assets/threadSort-BN7fK5qZ.js +2 -0
- package/dist/client/assets/{timeline-definition-24CTP7MA-Dnja29q2.js → timeline-definition-24CTP7MA-f1puoyJY.js} +2 -2
- package/dist/client/assets/toast-Bkc7xsho.js +2 -0
- package/dist/client/assets/{toggle-CNbzG8Ec.js → toggle-DNxTFG4o.js} +2 -2
- package/dist/client/assets/{toggle-group-DIqmqqKQ.js → toggle-group-CQtXH1ph.js} +2 -2
- package/dist/client/assets/tooltip-DH7_Fmka.js +2 -0
- package/dist/client/assets/{treeView-Q6P3EWNA-KHtw7wMC.js → treeView-Q6P3EWNA-cachkR0K.js} +1 -1
- package/dist/client/assets/{treemap-WGGIJYW6-BZN3U17E.js → treemap-WGGIJYW6-5vI1Z8yq.js} +1 -1
- package/dist/client/assets/usage-Cuwnw3mn.js +2 -0
- package/dist/client/assets/{usageAccess-Dwz13Eun.js → usageAccess-BRuBlcgN.js} +2 -2
- package/dist/client/assets/{usageFormat-Z0lz-RCF.js → usageFormat-B0V5dWS3.js} +2 -2
- package/dist/client/assets/{usageShortcuts-cwv5i-oF.js → usageShortcuts-CK0JjnNA.js} +2 -2
- package/dist/client/assets/use-atom-command-JNR1Jqwn.js +2 -0
- package/dist/client/assets/{useAriaLabelledBy-z3tVAFR_.js → useAriaLabelledBy-BNA1QLXP.js} +2 -2
- package/dist/client/assets/useHandleNewThread-vYbjmg4i.js +2 -0
- package/dist/client/assets/{useLocation-CxFbcar1.js → useLocation-D91_HRP0.js} +2 -2
- package/dist/client/assets/useNavigate-NmIi-1RV.js +2 -0
- package/dist/client/assets/{useNavigateBack-91jfuRCn.js → useNavigateBack-DnwpvjrN.js} +2 -2
- package/dist/client/assets/{useParams-nxAoxVO6.js → useParams-CYkWvywV.js} +2 -2
- package/dist/client/assets/usePermissionStatus-CuzpUXth.js +2 -0
- package/dist/client/assets/{usePullRequestActions-Cp-f2-rS.js → usePullRequestActions-DqgBdoH5.js} +3 -3
- package/dist/client/assets/useRegisterFieldControl-C127nghN.js +2 -0
- package/dist/client/assets/useScopedModelAvailability-BsIJUZbS.js +2 -0
- package/dist/client/assets/useSettings-DYKTOdxY.js +3 -0
- package/dist/client/assets/{useT3ConnectAuthPrompt-B1AHMyDF.js → useT3ConnectAuthPrompt-DlW3HUgA.js} +2 -2
- package/dist/client/assets/utils-vKlT_s3D.js +37 -0
- package/dist/client/assets/vcsRefInvalidation-CC_2_Ufo.js +2 -0
- package/dist/client/assets/{vennDiagram-4TSXK5OY-B4KHYxz_.js → vennDiagram-4TSXK5OY-HkY_FANS.js} +2 -2
- package/dist/client/assets/{wardley-WFR3VGLG-EUhzOM0w.js → wardley-WFR3VGLG-B9HKXiPi.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-VM6X3IG4-25okiPRC.js → wardleyDiagram-VM6X3IG4-CJL7EyS8.js} +2 -2
- package/dist/client/assets/welcome-BOXDf4R_.js +2 -0
- package/dist/client/assets/{xychartDiagram-S5SC5T6Z-Dyo2i7yf.js → xychartDiagram-S5SC5T6Z-Bsll1-pV.js} +2 -2
- package/dist/client/index.html +1 -1
- package/package.json +1 -1
- package/dist/client/assets/ChatGptUsageButton-9B_WUPVm.js +0 -2
- package/dist/client/assets/ChatMarkdown-B9_nJM54.js +0 -65
- package/dist/client/assets/CodexSetupSection.logic-YSEDjbLd.js +0 -2
- package/dist/client/assets/ComboboxClear-TEL6MsPn.js +0 -2
- package/dist/client/assets/CommandBlock-C6bCrWJ5.js +0 -2
- package/dist/client/assets/CompositeRoot-CZuZX6hs.js +0 -2
- package/dist/client/assets/DevicePanel-DavxmX2w.js +0 -2
- package/dist/client/assets/DeviceSetup-CZX8TKF_.js +0 -2
- package/dist/client/assets/DiffFileTree--L--vp02.js +0 -2
- package/dist/client/assets/DiffPanel-T4lIPUlN.js +0 -2
- package/dist/client/assets/EnvironmentMachineIcon-CGINHXnT.js +0 -2
- package/dist/client/assets/FilePreviewPanel-CxOIUI0_.js +0 -34
- package/dist/client/assets/FoldedSettingsSection-DmcJrCZO.js +0 -2
- package/dist/client/assets/NoProjectsHero-C0RwYoYq.js +0 -2
- package/dist/client/assets/PanelLayoutControls-CcE6oZUh.js +0 -215
- package/dist/client/assets/PreviewPanel-DgRCZ-80.js +0 -2
- package/dist/client/assets/ProjectDefaultsSettings-DOXJKuJ7.js +0 -2
- package/dist/client/assets/ProjectFavicon-CFPeQQsG.js +0 -3
- package/dist/client/assets/ProjectIconPickerDialog-B5iXalFo.js +0 -2
- package/dist/client/assets/ProjectMonogram-HCgoNxPJ.js +0 -2
- package/dist/client/assets/ProviderModelPicker-CHfA6QfR.js +0 -2
- package/dist/client/assets/ProviderSettingsForm-cr5QEWx_.js +0 -2
- package/dist/client/assets/PullRequestCodeTab-CyJ0_1HE.js +0 -6
- package/dist/client/assets/RenderErrorBoundary-h3g72sj0.js +0 -2
- package/dist/client/assets/ScheduledTasksSettings-CpUearCU.js +0 -4
- package/dist/client/assets/ScopedSwitch-D1QVfZHR.js +0 -2
- package/dist/client/assets/SettingsPanels-B9t76y-c.js +0 -39
- package/dist/client/assets/T3ConnectAccountPages-DOpj673A.js +0 -2
- package/dist/client/assets/T3ConnectSidebarSignIn-zrB8y6DQ.js +0 -2
- package/dist/client/assets/ThemeEditorPanel-Cx7KulxB.js +0 -5
- package/dist/client/assets/ThreadTerminalDrawer-ChcqArNC.js +0 -5
- package/dist/client/assets/_chat-Du_FC4wO.js +0 -45
- package/dist/client/assets/_chat.index-DUyKTtkh.js +0 -2
- package/dist/client/assets/_chat.new-CMoB99iV.js +0 -4
- package/dist/client/assets/_chat.pull-requests-BuTKumeN.js +0 -2
- package/dist/client/assets/architecture-7GRP2DOG-BMsijJGx.js +0 -1
- package/dist/client/assets/arrow-left-DjrJekQJ.js +0 -1
- package/dist/client/assets/arrow-right-DNQ3322O.js +0 -1
- package/dist/client/assets/arrow-up-down-DpVszLOH.js +0 -1
- package/dist/client/assets/assets-DJce0KBy.js +0 -2
- package/dist/client/assets/bell-ehBYv81q.js +0 -1
- package/dist/client/assets/blocks-CF1Wdm4Y.js +0 -1
- package/dist/client/assets/bot-Dj9hYg2w.js +0 -1
- package/dist/client/assets/calendar-clock-BaXgPf_7.js +0 -1
- package/dist/client/assets/channel-pJ5lNF0h.js +0 -2
- package/dist/client/assets/chart-no-axes-column-BzuvLLND.js +0 -1
- package/dist/client/assets/checkbox-BUOikrm3.js +0 -2
- package/dist/client/assets/classDiagram-ZZMXUADV-D4Ed7oKu.js +0 -2
- package/dist/client/assets/classDiagram-v2-VYDZK3BY-D4Ed7oKu.js +0 -2
- package/dist/client/assets/combobox-BPRK10Il.js +0 -2
- package/dist/client/assets/command-B-SWHWbd.js +0 -2
- package/dist/client/assets/connect-agent-B3TvHBIV.js +0 -2
- package/dist/client/assets/corner-left-up-8yNxlIpO.js +0 -1
- package/dist/client/assets/device-DARKbqyG.js +0 -2
- package/dist/client/assets/dialog-ChNU2rSW.js +0 -2
- package/dist/client/assets/download-KOf4APex.js +0 -1
- package/dist/client/assets/dynamic-B6ssT_6R.js +0 -3
- package/dist/client/assets/earth-Gh21ySR9.js +0 -1
- package/dist/client/assets/ellipsis-Dd1lpp1y.js +0 -1
- package/dist/client/assets/empty-DJMr9MZU.js +0 -2
- package/dist/client/assets/entities-HApogVCu.js +0 -2
- package/dist/client/assets/eventmodeling-NTZA5JFV-D1FYr7Uj.js +0 -1
- package/dist/client/assets/eye-CQCt8uGE.js +0 -1
- package/dist/client/assets/file-search-BXNWZ1nV.js +0 -1
- package/dist/client/assets/flowDiagram-HODETNUW-leGOLc6K.js +0 -1
- package/dist/client/assets/folder-git-2-BIZ4K8z0.js +0 -1
- package/dist/client/assets/folder-open-BI7lMTSr.js +0 -1
- package/dist/client/assets/folder-plus-B91hg6qR.js +0 -1
- package/dist/client/assets/git-branch-Yqn0BBlE.js +0 -1
- package/dist/client/assets/grip-vertical-DbE6Bv-r.js +0 -1
- package/dist/client/assets/hard-drive--FvDwcA1.js +0 -1
- package/dist/client/assets/history-D-6p2svD.js +0 -1
- package/dist/client/assets/house-6Nj_TaKT.js +0 -1
- package/dist/client/assets/index-EKWtrZNr.js +0 -3
- package/dist/client/assets/keyboard-Bf3n2zS8.js +0 -1
- package/dist/client/assets/link-BVjRZ3mh.js +0 -1
- package/dist/client/assets/list-DrTK4zhP.js +0 -1
- package/dist/client/assets/loader-Bc9xbkPa.js +0 -2
- package/dist/client/assets/main-D1oD2GPo.js +0 -30
- package/dist/client/assets/main-hjb9WdQ8.css +0 -2
- package/dist/client/assets/message-circle-question-mark-D2JAzS9x.js +0 -1
- package/dist/client/assets/message-square-DNTOkKRN.js +0 -1
- package/dist/client/assets/message-square-dashed-NGYZLQqB.js +0 -1
- package/dist/client/assets/mouse-pointer-2-CgUWLVBh.js +0 -1
- package/dist/client/assets/number-field-yRjM_PYx.js +0 -2
- package/dist/client/assets/openFileInPreview-CxrjOX7D.js +0 -2
- package/dist/client/assets/p4ProjectFile-DNlgD3LH.js +0 -2
- package/dist/client/assets/palette-DCF6iKZY.js +0 -1
- package/dist/client/assets/panel-left-BObCZ482.js +0 -1
- package/dist/client/assets/panels-top-left-4ditdjHS.js +0 -1
- package/dist/client/assets/popover-D-VzRDzk.js +0 -2
- package/dist/client/assets/primary-bBvWt8wp.js +0 -2
- package/dist/client/assets/primaryCloudLinkState-DDmxU43H.js +0 -2
- package/dist/client/assets/projectFilesQueryState-C9bparJ7.js +0 -2
- package/dist/client/assets/projectScriptEditor-2klDgdXc.js +0 -2
- package/dist/client/assets/pullRequestIcons-BWiN_14V.js +0 -2
- package/dist/client/assets/pullRequests-NQiU1cvE.js +0 -2
- package/dist/client/assets/puzzle-DC6izfkI.js +0 -1
- package/dist/client/assets/queries-DrIiv9gC.js +0 -2
- package/dist/client/assets/query-B_BcLKlb.js +0 -2
- package/dist/client/assets/radio-group-ESEwcJva.js +0 -2
- package/dist/client/assets/railroad-abnf-HS5TGJTU-Bn3ASlRb.js +0 -1
- package/dist/client/assets/railroad-ebnf-LZEXJU2U-DpIqYG5o.js +0 -1
- package/dist/client/assets/railroad-peg-WCYAUIDC-9vGlAMJk.js +0 -1
- package/dist/client/assets/rotate-ccw-BSwk8mHM.js +0 -1
- package/dist/client/assets/rotate-cw-BsgLwrfv.js +0 -1
- package/dist/client/assets/runtime-CBB2It1x.js +0 -6
- package/dist/client/assets/runtime-Dydpcwo9.js +0 -2
- package/dist/client/assets/runtimeModeConfig-DKj6PlUP.js +0 -2
- package/dist/client/assets/select-cvR_zMkG.js +0 -2
- package/dist/client/assets/server-FMafPUns.js +0 -2
- package/dist/client/assets/session-BI6WO3-p.js +0 -2
- package/dist/client/assets/settings-2-BbyXH0uI.js +0 -1
- package/dist/client/assets/settings-DRKdVCbB.js +0 -1
- package/dist/client/assets/settings-Dzr6EHna.js +0 -2
- package/dist/client/assets/settings.appearance-Dcbf4cgV.js +0 -2
- package/dist/client/assets/settings.archived-BI9u9Y07.js +0 -2
- package/dist/client/assets/settings.computer-use-CE8rpPYM.js +0 -2
- package/dist/client/assets/settings.connections-BWLCI5Zi.js +0 -2
- package/dist/client/assets/settings.diagnostics-ao6ZzXXw.js +0 -2
- package/dist/client/assets/settings.general-BoU897Dm.js +0 -2
- package/dist/client/assets/settings.integrations-ChLDKsIY.js +0 -2
- package/dist/client/assets/settings.keybindings-BSg3FHQZ.js +0 -2
- package/dist/client/assets/settings.open-source-licenses-B4sC68Ud.js +0 -2
- package/dist/client/assets/settings.plugins-CGUFRhFY.js +0 -5
- package/dist/client/assets/settings.projects-V3nNBIzc.js +0 -4
- package/dist/client/assets/settings.providers-D1BgocCC.js +0 -3
- package/dist/client/assets/settings.scheduled-tasks-C-I22teI.js +0 -2
- package/dist/client/assets/settings.snap-shot-aum1tmsR.js +0 -2
- package/dist/client/assets/settings.source-control-8YMYuva4.js +0 -2
- package/dist/client/assets/settingsLayout-BUbXPq57.js +0 -3
- package/dist/client/assets/shield-check-CG2tOYd1.js +0 -1
- package/dist/client/assets/shield-question-mark-Mk3rAYhm.js +0 -1
- package/dist/client/assets/sidebar-CjtIIYSY.js +0 -2
- package/dist/client/assets/skeleton-DzaiJbx8.js +0 -2
- package/dist/client/assets/spinner-RAU9Cg6j.js +0 -2
- package/dist/client/assets/square-pen-BuwM-DT0.js +0 -1
- package/dist/client/assets/stateDiagram-v2-MP3YSRHH-Ba0Qofsh.js +0 -2
- package/dist/client/assets/swimlanesDiagram-VR7AAH4N-C9WqWw-N.js +0 -9
- package/dist/client/assets/text-search-DyMq-QgY.js +0 -1
- package/dist/client/assets/threadSort-C4CtIL5v.js +0 -2
- package/dist/client/assets/toast-DEgXlTR7.js +0 -2
- package/dist/client/assets/tooltip-DyiHlEs0.js +0 -2
- package/dist/client/assets/usage--nsoWaqi.js +0 -2
- package/dist/client/assets/use-atom-command-BVrZ0hTO.js +0 -2
- package/dist/client/assets/useHandleNewThread-lAV5NpwQ.js +0 -2
- package/dist/client/assets/useNavigate-CLQYZa7I.js +0 -2
- package/dist/client/assets/usePermissionStatus-CVCguZPP.js +0 -2
- package/dist/client/assets/useRegisterFieldControl-hMeYQdpT.js +0 -2
- package/dist/client/assets/useScopedModelAvailability-1rkaoEPh.js +0 -2
- package/dist/client/assets/useSettings-BCUX_14n.js +0 -3
- package/dist/client/assets/utils-Cbsb1ks0.js +0 -37
- package/dist/client/assets/vcsRefInvalidation-DMlloB2h.js +0 -2
- package/dist/client/assets/welcome-pBX3QtZq.js +0 -2
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{Dh as n,Gn as r,Ho as i,Kf as a,Kn as o,Ko as s,Mx as c,Ph as l,Rc as u,Ro as d,Um as f,Wo as p,Yn as m,Zm as h,Zn as g,cr as _,es as v,ex as y,gs as b,ha as x,hs as S,or as C,sh as w,sr as T,t as E,tr as D,vs as O,ym as k}from"./utils-Cbsb1ks0.js";import{t as A}from"./chevron-down-DHV04o66.js";import{t as j}from"./circle-alert-B83jEPoh.js";import{t as M}from"./info-BHB-83EA.js";import{t as N}from"./plus-Cr075-cy.js";import{t as P}from"./sliders-horizontal-lg5XUMZM.js";import{t as F}from"./x-CSwbgjBe.js";import{I,K as L,U as R,z}from"./runtime-CBB2It1x.js";import{a as ee,n as B,t as V}from"./tooltip-DyiHlEs0.js";import{a as te,c as ne,o as re,s as ie,t as ae}from"./select-cvR_zMkG.js";import{t as oe}from"./useNavigateBack-91jfuRCn.js";import{rt as se}from"./useSettings-BCUX_14n.js";import{f as H,s as ce}from"./server-FMafPUns.js";import{n as le,t as U}from"./session-BI6WO3-p.js";import{t as ue}from"./use-atom-command-BVrZ0hTO.js";import{a as de,c as fe,d as W,f as G,i as pe,l as K,n as me,o as he,r as q,s as J,t as Y,u as ge}from"./usageFormat-Z0lz-RCF.js";import{t as _e}from"./env-wK1YYxA8.js";import{t as X}from"./skeleton-DzaiJbx8.js";import{n as ve,t as ye}from"./toggle-group-DIqmqqKQ.js";import{t as be}from"./input-w_nbMVAd.js";import{t as xe}from"./scroll-area-iMm_YXqJ.js";import{a as Se,c as Ce,i as we,o as Te,r as Ee,s as De,t as Oe}from"./dialog-ChNU2rSW.js";import{o as ke}from"./sidebar-CjtIIYSY.js";import{t as Ae}from"./observeResize-wFdsooQ8.js";import{y as je}from"./keybindings-CJFu-Dyg.js";import{i as Me,o as Ne,t as Pe}from"./popover-D-VzRDzk.js";import{S as Fe,n as Ie,t as Le}from"./ChatGptUsageButton-9B_WUPVm.js";import{t as Re}from"./WorkspacePageContainer-sM_H3DH4.js";import{n as ze,r as Be,t as Ve}from"./usageShortcuts-cwv5i-oF.js";import{Ni as He,Wi as Ue,co as We,cr as Ge,dr as Ke,lr as qe,qa as Je,qr as Ye,ur as Xe}from"./main-D1oD2GPo.js";import{t as Ze}from"./WorkspacePageHeader-C_J7FxVt.js";import{i as Qe,n as $e,r as et,t as tt}from"./WorkspaceBreadcrumb-Dx7xMwQd.js";import{t as nt}from"./usageAccess-Dwz13Eun.js";var Z=e(t(),1),Q=c(),rt=n(L);function it(e,t){return e?.sources.some(e=>e.action===`enableCursorKeychain`)===!0&&t?.some(e=>e.driver===`cursor`&&e.status===`ready`)===!0}function at(e){return e.some(e=>e.summary?.sources.some(e=>e.fingerprint.provider===`cursor`&&e.fingerprint.hostId===`cursor.com`))?[]:e.filter(e=>e.needsCursorKeychainAccess)}var ot=new Map,st=new Map;async function ct(e,t,n=!1,r=!1){let i=st.get(e);if(i!==void 0){if(r){try{await i}catch{}return ct(e,t,!1,!0)}return n?void 0:await i}let a=ot.get(e)??0;if(n&&Date.now()<a)return;let o=Promise.resolve().then(t).finally(()=>{st.delete(e),ot.set(e,Date.now()+3e5)});return st.set(e,o),await o}async function lt({registry:e,server:t,presentations:n,environmentIds:r,input:i}){await Promise.all(r.map(async r=>{let a=t.usageSummary({environmentId:r,input:i}),o=n.presentationAtom(r),s=new AbortController,c=()=>{e.get(o)?.connection.phase!==`connected`&&s.abort()},l=e.subscribe(o,c);c();try{let n=await z(e,t.refreshUsageRates,{environmentId:r,input:{}},{reportFailure:!1}),i=n._tag===`Failure`&&rt(R(n));if(e.refresh(a),i||s.signal.aborted)return;await I(e,a,{reportFailure:!1,signal:s.signal})}finally{l()}}))}function ut(e,t=!1){let{summary:n}=e;if(!e.isConnected||e.error!==null)return{phase:`inactive`};if(n===null)return{phase:`loading`};if(t)return{phase:`stale`};if(!e.isPending)return{phase:`ready`};let r=[...new Set(n.sources.flatMap(e=>e.refreshing?[e.fingerprint.provider]:[]))];return r.length>0?{phase:`partway`,providers:r}:{phase:`stale`}}function dt(e,t){return e.length===1?`Updating ${t(e[0])}…`:`Updating ${e.length} providers…`}function ft(e,t=!1){let n=new Set,r=!1;for(let i of e){let e=ut(i,t);if((e.phase===`loading`||e.phase===`stale`)&&(r=!0),e.phase===`partway`)for(let t of e.providers)n.add(t)}return{partial:r||n.size>0,everyProvider:r,providers:n}}function pt(e){return e.records>0&&e.unpricedRecords>=e.records}function mt(e){return[e.hostId,e.provider,e.resolvedHomePath,e.volumeId].join(` `)}function ht(e,t){let n=e.sources.filter(e=>e.fingerprint.provider===t.fingerprint.provider);return e.buckets.filter(e=>e.provider===t.fingerprint.provider&&(e.sourcePath===t.fingerprint.resolvedHomePath||e.sourcePath===void 0&&n.length===1))}function gt(e){return JSON.stringify([e.day,e.hourStart??null,e.provider,e.model])}function _t(e){let t=new Map,n=new Map,r=new Map,i=new Map,a=new Map,o=[],s=[...e].sort((e,t)=>(Date.parse(t.summary.readAt)||0)-(Date.parse(e.summary.readAt)||0)||e.environmentId.localeCompare(t.environmentId));for(let e of[`ok`,`partial`,`failed`])for(let r of s)for(let i of r.summary.sources){if(i.status!==e)continue;let s=mt(i.fingerprint);if(t.has(s)){o.push(`${r.label}: ${i.fingerprint.resolvedHomePath}`);continue}t.set(s,r.environmentId),n.set(s,{environment:r,source:i}),a.set(s,i.distinctSessions)}for(let e of s)for(let t of e.summary.sources){if(t.status!==`partial`)continue;let o=mt(t.fingerprint),s=n.get(o);if(s?.source.status!==`ok`||Date.parse(e.summary.readAt)<=Date.parse(s.environment.summary.readAt))continue;let c=r.get(o);c===void 0&&(c=new Set(ht(s.environment.summary,s.source).map(gt)),r.set(o,c));let l=i.get(e.environmentId)??new Set,u=!1;for(let n of ht(e.summary,t)){let e=gt(n);c.has(e)||(c.add(e),l.add(n),u=!0)}u&&(i.set(e.environmentId,l),a.set(o,Math.max(a.get(o)??0,t.distinctSessions)))}return{ownerByFingerprint:t,supplementalBucketsByEnvironment:i,sessionsByFingerprint:a,duplicates:o}}function vt(e,t,n,r){let i=new Set,a=new Set,o=new Map;for(let n of e.summary.sources){if(n.status===`missing`)continue;let s=mt(n.fingerprint);if(t.get(s)===e.environmentId){let e=n.fingerprint.provider;i.add(e),a.add(`${e}\u0000${n.fingerprint.resolvedHomePath}`),o.set(e,(o.get(e)??0)+(r.get(s)??n.distinctSessions))}}return{buckets:e.summary.buckets.filter(e=>n.has(e)||(e.sourcePath===void 0?i.has(e.provider):a.has(`${e.provider}\u0000${e.sourcePath}`))),sessionsByProvider:o}}function yt(e){return e.totals.uncachedInputTokens+e.totals.cachedInputTokens+e.totals.cacheCreationTokens+e.totals.outputTokens}function bt(e,t){return e>=4&&e<=t}var xt={costUsd:0,uncachedInputTokens:0,cachedInputTokens:0,cacheCreationTokens:0,outputTokens:0,reasoningTokens:0,totalTokens:0,records:0,sessions:0,providers:[],models:[],daily:[],hourly:[],costQuality:{providerReportedShare:0,modelPricedShare:0,unpricedShare:0,cacheSavingsUsd:0},categoryCost:{input:0,cacheRead:0,cacheWrite:0,output:0,unsplit:0},speedCost:{standard:0,fast:0,ultrafast:0,premium:0},duplicateSources:[],contributingEnvironments:[],contractMismatches:[]};function St(e,t){if(e.length===0)return xt;let n=[],r=[];for(let i of e)bt(i.summary.contractVersion,t)?n.push(i):r.push({environmentId:i.environmentId,direction:i.summary.contractVersion<t?`serverBehind`:`clientBehind`,contractVersion:i.summary.contractVersion});let{ownerByFingerprint:i,supplementalBucketsByEnvironment:a,sessionsByFingerprint:o,duplicates:s}=_t(n),c=0,l=0,u=0,d=0,f=0,p=0,m=0,h=0,g=0,_=0,v=0,y={input:0,cacheRead:0,cacheWrite:0,output:0},b={fast:0,ultrafast:0,premium:0},x=new Map,S=new Map,C=new Map,w=new Map,T=[];for(let e of n){let{buckets:t,sessionsByProvider:n}=vt(e,i,a.get(e.environmentId)??new Set,o);t.length>0&&T.push(e.environmentId);for(let[e,t]of n){if(h+=t,t===0)continue;let n=x.get(e)??{costUsd:0,totalTokens:0,records:0,sessions:0};n.sessions+=t,x.set(e,n)}for(let e of t){let t=yt(e);c+=e.costUsd,g+=e.cacheSavingsUsd,l+=e.totals.uncachedInputTokens,u+=e.totals.cachedInputTokens,d+=e.totals.cacheCreationTokens,f+=e.totals.outputTokens,p+=e.totals.reasoningTokens,m+=e.records,v+=e.unpricedRecords,e.costSource===`providerReported`&&(_+=e.records),e.categoryCostUsd!==void 0&&(y.input+=e.categoryCostUsd.input,y.cacheRead+=e.categoryCostUsd.cacheRead,y.cacheWrite+=e.categoryCostUsd.cacheWrite,y.output+=e.categoryCostUsd.output),b.fast+=e.fastCostUsd??0,b.ultrafast+=e.ultrafastCostUsd??0,b.premium+=e.speedPremiumUsd??0;let n=x.get(e.provider)??{costUsd:0,totalTokens:0,records:0,sessions:0};n.costUsd+=e.costUsd,n.totalTokens+=t,n.records+=e.records,x.set(e.provider,n);let r=`${e.provider} ${e.model}`,i=S.get(r)??{provider:e.provider,costUsd:0,totalTokens:0,tokens:{uncachedInputTokens:0,cachedInputTokens:0,cacheCreationTokens:0,outputTokens:0,reasoningTokens:0},records:0,unpricedRecords:0,unpricedTokens:0};i.costUsd+=e.costUsd,i.totalTokens+=t,i.tokens={uncachedInputTokens:i.tokens.uncachedInputTokens+e.totals.uncachedInputTokens,cachedInputTokens:i.tokens.cachedInputTokens+e.totals.cachedInputTokens,cacheCreationTokens:i.tokens.cacheCreationTokens+e.totals.cacheCreationTokens,outputTokens:i.tokens.outputTokens+e.totals.outputTokens,reasoningTokens:i.tokens.reasoningTokens+e.totals.reasoningTokens},i.records+=e.records,i.unpricedRecords+=e.unpricedRecords,e.records>0&&(i.unpricedTokens+=t*e.unpricedRecords/e.records),S.set(r,i);let a=C.get(e.day)??{costUsd:0,totalTokens:0,byProvider:new Map};a.costUsd+=e.costUsd,a.totalTokens+=t;let o=a.byProvider.get(e.provider)??{costUsd:0,totalTokens:0};if(o.costUsd+=e.costUsd,o.totalTokens+=t,a.byProvider.set(e.provider,o),C.set(e.day,a),e.hourStart!==void 0){let n=w.get(e.hourStart)??{day:e.day,hourStart:e.hourStart,costUsd:0,totalTokens:0,byProvider:new Map};n.costUsd+=e.costUsd,n.totalTokens+=t;let r=n.byProvider.get(e.provider)??{costUsd:0,totalTokens:0};r.costUsd+=e.costUsd,r.totalTokens+=t,n.byProvider.set(e.provider,r),w.set(e.hourStart,n)}}}let E=l+u+d+f,D=[...x.entries()].map(([e,t])=>({provider:e,costUsd:t.costUsd,totalTokens:t.totalTokens,records:t.records,sessions:t.sessions,costShare:c===0?0:t.costUsd/c,tokenShare:E===0?0:t.totalTokens/E})).sort((e,t)=>t.costUsd-e.costUsd),O=[...S.entries()].map(([e,t])=>({model:e.slice(e.indexOf(` `)+1),provider:t.provider,costUsd:t.costUsd,totalTokens:t.totalTokens,tokens:t.tokens,records:t.records,unpricedRecords:t.unpricedRecords,unpricedTokens:t.unpricedTokens,costShare:c===0?0:t.costUsd/c,tokenShare:E===0?0:t.totalTokens/E})).sort((e,t)=>t.costUsd-e.costUsd||t.totalTokens-e.totalTokens),k=[...C.entries()].map(([e,t])=>({day:e,costUsd:t.costUsd,totalTokens:t.totalTokens,byProvider:t.byProvider})).sort((e,t)=>e.day.localeCompare(t.day)),A=[...w.values()].sort((e,t)=>e.hourStart.localeCompare(t.hourStart));return{costUsd:c,uncachedInputTokens:l,cachedInputTokens:u,cacheCreationTokens:d,outputTokens:f,reasoningTokens:p,totalTokens:E,records:m,sessions:h,providers:D,models:O,daily:k,hourly:A,costQuality:{providerReportedShare:m===0?0:_/m,unpricedShare:m===0?0:v/m,modelPricedShare:m===0?0:(m-_-v)/m,cacheSavingsUsd:g},categoryCost:{...y,unsplit:Math.max(0,c-y.input-y.cacheRead-y.cacheWrite-y.output)},speedCost:{...b,standard:Math.max(0,c-b.fast-b.ultrafast)},duplicateSources:s,contributingEnvironments:T,contractMismatches:r}}var Ct=p(e=>s(t=>{let n=JSON.parse(e),r=t(se.presentationsAtom),i=[];for(let[e,a]of r){let r=a.connection.phase===`connected`,o=t(U.sessionStateAtom(e)),s=nt({connectionPhase:a.connection.phase,session:y(S(o)),hasSessionError:o._tag===`Failure`});if(!s.canReadDiagnostics){i.push({environmentId:e,label:a.entry.target.label,isConnected:r,...s,summary:null,needsCursorKeychainAccess:!1});continue}let c=t(H.usageSummary({environmentId:e,input:n})),l=y(S(c));i.push({environmentId:e,label:a.entry.target.label,isPending:c.waiting,canReadDiagnostics:!0,isConnected:r,error:c._tag===`Failure`?`This environment could not report usage.`:null,summary:l,needsCursorKeychainAccess:it(l,t(H.providersValueAtom(e)))})}return i}).pipe(v(`web-usage:window:${e}`)));function wt(e,t){return St(e.flatMap(({environmentId:e,label:n,summary:r})=>r===null?[]:[{environmentId:e,label:n,summary:t===void 0?r:{...r,buckets:r.buckets.filter(t)}}]),6)}var Tt=new Set;function Et(e,t){return t.size===0?e:e.map(e=>e.summary===null?e:{...e,summary:{...e.summary,buckets:e.summary.buckets.filter(e=>!t.has(e.provider)),sources:e.summary.sources.filter(e=>!t.has(e.fingerprint.provider))}})}function Dt(e,t,n){let r=(0,Q.c)(36),a=t===void 0?null:t,o=n===void 0?Tt:n,s;r[0]!==e.resolution||r[1]!==e.sinceDay||r[2]!==e.sinceTime||r[3]!==e.timeZone||r[4]!==e.untilDay||r[5]!==e.untilTime?(s=JSON.stringify({sinceDay:e.sinceDay,untilDay:e.untilDay,timeZone:e.timeZone,resolution:e.resolution,sinceTime:e.sinceTime,untilTime:e.untilTime}),r[0]=e.resolution,r[1]=e.sinceDay,r[2]=e.sinceTime,r[3]=e.timeZone,r[4]=e.untilDay,r[5]=e.untilTime,r[6]=s):s=r[6];let c=s,l;r[7]===c?l=r[8]:(l=Ct(c),r[7]=c,r[8]=l);let u=i(l),f;r[9]!==u||r[10]!==a?(f=a===null?u:u.filter(e=>a.has(e.environmentId)),r[9]=u,r[10]=a,r[11]=f):f=r[11];let p=f,m;r[12]!==p||r[13]!==c?(m=e=>lt({registry:d,server:H,presentations:se,environmentIds:p.filter(jt).map(At),input:e??JSON.parse(c)}),r[12]=p,r[13]=c,r[14]=m):m=r[14];let h=m,g;r[15]!==o||r[16]!==p?(g=wt(Et(p,o)),r[15]=o,r[16]=p,r[17]=g):g=r[17];let _=g,v;r[18]===p?v=r[19]:(v=p.filter(kt),r[18]=p,r[19]=v);let y=v.length,b;r[20]===p?b=r[21]:(b=p.filter(Ot),r[20]=p,r[21]=b);let x=b.length,S=y===0&&x>0,[C,w]=(0,Z.useState)(null);y>0&&(C?.merged!==_||C.window!==e||C.selection!==a||C.hidden!==o)&&w({window:e,merged:_,selection:a,hidden:o});let T=C?.selection===a&&C.hidden===o?C:null,E;r[22]!==y||r[23]!==e||r[24]!==S||r[25]!==T||r[26]!==_?(E=y>0?{window:e,merged:_}:T??(S?null:{window:e,merged:_}),r[22]=y,r[23]=e,r[24]=S,r[25]=T,r[26]=_,r[27]=E):E=r[27];let D=E,O=y>0&&x>0,k;return r[28]!==u||r[29]!==S||r[30]!==_||r[31]!==h||r[32]!==p||r[33]!==D||r[34]!==O?(k={merged:_,environments:u,selectedEnvironments:p,isPending:S,shown:D,isPartial:O,refresh:h},r[28]=u,r[29]=S,r[30]=_,r[31]=h,r[32]=p,r[33]=D,r[34]=O,r[35]=k):k=r[35],k}function Ot(e){return e.summary===null&&e.error===null}function kt(e){return e.summary!==null}function At(e){let{environmentId:t}=e;return t}function jt(e){return e.canReadDiagnostics&&le(e.environmentId,`diagnostics:read`)}var $=e(x(),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=E(`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=E(`[&_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=E(`[&_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=E(`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=E(`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=E(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`td`,{"data-slot":`table-cell`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Rt=[{key:`inputCostPerMillionTokens`,label:`Input`,optional:!1},{key:`outputCostPerMillionTokens`,label:`Output`,optional:!1},{key:`cacheReadCostPerMillionTokens`,label:`Cache read`,optional:!0},{key:`cacheWriteCostPerMillionTokens`,label:`Cache write`,optional:!0}];function zt(e=``,t){return{model:e,inputCostPerMillionTokens:t?.inputCostPerMillionTokens.toString()??``,outputCostPerMillionTokens:t?.outputCostPerMillionTokens.toString()??``,cacheReadCostPerMillionTokens:t?.cacheReadCostPerMillionTokens?.toString()??``,cacheWriteCostPerMillionTokens:t?.cacheWriteCostPerMillionTokens?.toString()??``}}function Bt(e){let t=e.model.trim();if(t.length===0)return null;let n={};for(let t of Rt){let r=e[t.key].trim();if(r===``){if(t.optional)continue;return null}if(!/^(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i.test(r))return null;let i=Number(r);if(!Number.isFinite(i)||i<0)return null;n[t.key]=i}return n.inputCostPerMillionTokens===void 0||n.outputCostPerMillionTokens===void 0?null:{model:t,price:{inputCostPerMillionTokens:n.inputCostPerMillionTokens,outputCostPerMillionTokens:n.outputCostPerMillionTokens,...n.cacheReadCostPerMillionTokens===void 0?{}:{cacheReadCostPerMillionTokens:n.cacheReadCostPerMillionTokens},...n.cacheWriteCostPerMillionTokens===void 0?{}:{cacheWriteCostPerMillionTokens:n.cacheWriteCostPerMillionTokens}}}}function Vt(e){return e.isNew&&e.model.trim()===``&&(e.alias??``).trim()===``&&Object.values(e.values).every(e=>e.trim()===``)}function Ht(e,t){return e.prices&&Object.hasOwn(e.prices,t)?e.prices[t]:void 0}function Ut(e,t){return e.aliases&&Object.hasOwn(e.aliases,t)?e.aliases[t]:void 0}function Wt(e,t){if(e.some(e=>e.aliases===null))return{value:``,placeholder:`Unavailable`};let n=e.map(e=>Ut(e,t)??``);return n.some(e=>e!==n[0])?{value:``,placeholder:`Mixed`}:{value:n[0]??``,placeholder:`None`}}function Gt(e,t,n){let r=Rt.find(e=>e.key===n).optional,i=e.map(e=>Ht(e,t)?zt(t,Ht(e,t))[n]:null);return e.some(e=>e.prices===null)?{value:``,placeholder:`Unavailable`}:i.some(e=>e!==i[0])?{value:``,placeholder:`Mixed`}:{value:i[0]??``,placeholder:i[0]===null?`Automatic`:r?`Input rate`:`0.00`}}function Kt(e,t){let n=[],r=new Map;for(let i of t){if(Vt(i))continue;let t=i.model.trim(),a=Ut(e,t);if(i.removed){Ht(e,t)&&n.push({model:t,price:null}),a!==void 0&&n.push({model:t,alias:null});continue}let o=(i.alias??a??``).trim();if(o!==``){t===``?r.set(i.id,`Enter a model ID.`):o===t?r.set(i.id,`Map to a different model.`):(o!==a&&n.push({model:t,alias:o}),Ht(e,t)&&n.push({model:t,price:null}));continue}if(a!==void 0&&(n.push({model:t,alias:null}),!Ht(e,t)&&Object.values(i.values).every(e=>e.trim()===``)))continue;let s=zt(t,Ht(e,t)),c={...s,...i.values},l=Bt(c);if(l===null){let n=Rt.find(e=>!e.optional&&c[e.key].trim()===``);r.set(i.id,t===``?`Enter a model ID.`:n?`${n.label} is required on ${e.label}.`:`Use non-negative numbers for prices.`);continue}let u=zt(t,l.price);Rt.some(e=>s[e.key]!==u[e.key])&&n.push(l)}return{changes:n,errors:r}}function qt(e,t){return new Map(e.filter(e=>e.unavailable===null&&e.prices!==null).flatMap(e=>[...Kt(e,t).errors]))}async function Jt(e){await Promise.all(e.targets.map(async t=>{let n,r=e.changes.get(t.environmentId)??[],i=r.flatMap(e=>`price`in e?[[e.model,e.price]]:[]),a=r.flatMap(e=>`alias`in e?[[e.model,e.alias]]:[]);if(t.unavailable!==null)n={status:`failed`,error:t.unavailable};else if(a.length>0&&t.aliases===null)n={status:`failed`,error:`Update server to map models`};else try{n=(r.length===0?{_tag:`Success`}:await e.write({environmentId:t.environmentId,input:{patch:{...i.length>0?{usagePriceOverrides:Object.fromEntries(i)}:{},...a.length>0?{usageModelAliases:Object.fromEntries(a)}:{}}}}))._tag===`Success`?{status:`saved`}:{status:`failed`,error:`Could not save. Try again.`}}catch{n={status:`failed`,error:`Could not save. Try again.`}}e.onResult(t.environmentId,n)}))}var Yt=s(e=>[...e(se.presentationsAtom)].map(([t,n])=>{let r=e(H.settingsValueAtom(t)),i=e(U.sessionStateAtom(t)),o=y(S(i)),s=i._tag===`Failure`?`denied`:o===null?i.waiting?`pending`:`denied`:a(o,`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?s===`pending`?`Checking permissions…`:s===`denied`?`Read-only access`:null:`Update server to edit prices`:`Offline`}}));function Xt(e){let t=(0,Q.c)(119),{usage:n,initialSelectedEnvironmentIds:a,initialModel:s,onOpenChange:c}=e,l=i(Yt),[u,d]=(0,Z.useState)(a),f;if(t[0]!==l||t[1]!==u){let e;t[3]===u?e=t[4]:(e=e=>u===null||u.has(e.environmentId),t[3]=u,t[4]=e),f=l.filter(e),t[0]=l,t[1]=u,t[2]=f}else f=t[2];let p=f,m;t[5]!==s||t[6]!==p?(m=()=>s===void 0||p.some(e=>Object.hasOwn(e.prices??{},s)||Object.hasOwn(e.aliases??{},s))?[]:[{id:`new:initial`,model:s,isNew:!0,values:{}}],t[5]=s,t[6]=p,t[7]=m):m=t[7];let[h,_]=(0,Z.useState)(m),[v,y]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(null),S=(0,Z.useRef)(null),w=(0,Z.useRef)(0),O;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(O={reportFailure:!1},t[8]=O):O=t[8];let k=ue(H.updateSettings,O),j,M,P,I,L,R,z,te,ne,re,ie,ae,oe,se,ce;if(t[9]!==b||t[10]!==h||t[11]!==l||t[12]!==c||t[13]!==v||t[14]!==p||t[15]!==u||t[16]!==k||t[17]!==n){let e=[...new Set(p.flatMap(mn))].sort(),i;t[33]===p?i=t[34]:(i=e=>p.some(t=>t.environmentId===e.environmentId),t[33]=p,t[34]=i);let a=[...new Set([...e,...n.filter(i).flatMap(fn)])].sort(),s;t[35]===h?s=t[36]:(s=new Set(h.filter(dn).map(un)),t[35]=h,t[36]=s);let f=s,m;t[37]!==b||t[38]!==f?(m=e=>b===null||!f.has(e),t[37]=b,t[38]=f,t[39]=m):m=t[39];let O=[...e.filter(m).map(e=>h.find(t=>t.id===`model:${e}`)??{id:`model:${e}`,model:e,isNew:!1,values:{}}),...h.filter(ln)],H=h.filter(cn);R=qt(p,H);for(let t of H)t.isNew&&(t.model.trim()===``?R.set(t.id,`Enter a model ID.`):b===null&&(e.includes(t.model.trim())||h.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=b?.destinations.filter(e=>b.results.get(e.environmentId)?.status===`failed`)??[];let U=v||z.length>0;te=H.length>0,I=p.length===1?p[0].label:`${p.length} environments`;let ue=u===null?`All environments`:I,de;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(de=()=>{_([]),x(null)},t[40]=de):de=t[40],L=de;let fe;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(fe=e=>{d(e),x(null)},t[41]=fe):fe=t[41];let W=fe,G;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(G=e=>{_(t=>t.some(t=>t.id===e.id)?t.map(t=>t.id===e.id?e:t):[...t,e]),x(null)},t[42]=G):G=t[42];let pe=G,K=sn,me;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(me=e=>{!e.isNew&&Object.keys(e.values).length===0&&e.alias===void 0?_(t=>t.filter(t=>t.id!==e.id)):pe(e)},t[43]=me):me=t[43];let he=me,q;t[44]===p?q=t[45]:(q=(e,t,n)=>{let r={...e.values,[t]:n},i=Gt(p,e.model,t);K(e,i,n)&&delete r[t],he({...e,values:r})},t[44]=p,t[45]=q);let J=q,Y;t[46]===p?Y=t[47]:(Y=(e,t)=>{let{alias:n,...r}=e,i=Wt(p,e.model);he(K(e,i,t)?r:{...r,alias:t})},t[46]=p,t[47]=Y);let ge=Y;ne=async e=>{let t=e!==void 0&&e;if(v)return;let n=t?z:p,r=t&&b?b.drafts:H;if(n.length===0||r.length===0)return;let i=n.map(e=>l.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)]));y(!0),x(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=>le(e.environmentId,`settings:write`)?k(e):{_tag:`Failure`},onResult:(e,t)=>{t.status===`failed`&&(o=!0),x(n=>n===null?null:{...n,results:new Map(n.results).set(e,t)})}}),y(!1),o||_([])},P=Oe,se=!0,t[48]!==c||t[49]!==v?(ce=e=>{v||c(e)},t[48]=c,t[49]=v,t[50]=ce):ce=t[50],M=De,ae=`max-w-4xl`,t[51]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsxs)(Se,{children:[(0,$.jsx)(Ce,{children:`Custom model prices`}),(0,$.jsx)(Ee,{children:`Prices and mappings apply to all past and future usage on the environments you select.`})]}),t[51]=oe):oe=t[51],j=Te;let _e;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,$.jsx)(He,{id:`usage-prices-apply-label`,className:`shrink-0`,children:`Apply to`}),t[52]=_e):_e=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 ve=v||te,ye;t[54]===ue?ye=t[55]:(ye=(0,$.jsx)(`span`,{id:`usage-prices-selection`,className:`truncate`,children:ue}),t[54]=ue,t[55]=ye);let xe;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,$.jsx)(A,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[56]=xe):xe=t[56];let we;t[57]!==ve||t[58]!==ye?(we=(0,$.jsxs)(C,{render:X,"aria-labelledby":`usage-prices-apply-label usage-prices-selection`,disabled:ve,children:[ye,xe]}),t[57]=ve,t[58]=ye,t[59]=we):we=t[59];let ke=u===null,Ae;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=e=>W(e?null:new Set),t[60]=Ae):Ae=t[60];let je;t[61]===ke?je=t[62]:(je=(0,$.jsx)(o,{checked:ke,closeOnClick:!1,onCheckedChange:Ae,children:`All environments`}),t[61]=ke,t[62]=je);let Me;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Me=(0,$.jsx)(D,{}),t[63]=Me):Me=t[63];let Ne;if(t[64]!==l||t[65]!==p||t[66]!==u){let e;t[68]!==l.length||t[69]!==p||t[70]!==u?(e=e=>(0,$.jsx)(o,{checked:u===null||u.has(e.environmentId),closeOnClick:!1,onCheckedChange:t=>{let n=new Set(p.map(rn));t?n.add(e.environmentId):n.delete(e.environmentId),W(n.size===l.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]=l.length,t[69]=p,t[70]=u,t[71]=e):e=t[71],Ne=l.map(e),t[64]=l,t[65]=p,t[66]=u,t[67]=Ne}else Ne=t[67];let Pe;t[72]!==je||t[73]!==Ne?(Pe=(0,$.jsxs)(g,{align:`start`,children:[je,Me,Ne]}),t[72]=je,t[73]=Ne,t[74]=Pe):Pe=t[74];let Fe;t[75]!==we||t[76]!==Pe?(Fe=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[_e,(0,$.jsxs)(r,{children:[we,Pe]})]}),t[75]=we,t[76]=Pe,t[77]=Fe):Fe=t[77];let Ie;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`USD / million tokens`}),t[78]=Ie):Ie=t[78],t[79]===Fe?re=t[80]:(re=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[Fe,Ie]}),t[79]=Fe,t[80]=re),ie=p.length===0?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:l.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:()=>{w.current+=1;let e=`new:${w.current}`;S.current=e,pe({id:e,model:``,isNew:!0,values:{}})},children:(0,$.jsx)(N,{"aria-hidden":!0})})})]})}),(0,$.jsx)(Pt,{children:O.length===0?(0,$.jsx)(Ft,{children:(0,$.jsx)(Lt,{colSpan:7,className:`text-center whitespace-normal`,children:(0,$.jsx)(`p`,{className:`py-6 text-muted-foreground`,children:p.some(en)?`Some environment prices are unavailable.`:`No custom prices or mappings. Add a row to set one.`})})}):O.map(e=>{let t=Wt(p,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)(be,{size:`compact`,value:e.model,ref:t=>{t&&S.current===e.id&&(t.focus(),S.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=>pe({...e,model:t.target.value})}):(0,$.jsx)(`span`,{className:E(`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)(be,{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=>ge(e,t.target.value)})}),e.removed?null:n===``?Rt.map(t=>{let n=Gt(p,e.model,t.key);return(0,$.jsx)(Lt,{children:(0,$.jsx)(be,{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)(V,{children:[(0,$.jsx)(ee,{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?_(t=>t.filter(t=>t.id!==e.id)):e.removed?he({...e,removed:!1}):pe({...e,removed:!0})},children:e.isNew?(0,$.jsx)(F,{"aria-hidden":!0}):(0,$.jsx)(We,{"aria-hidden":!0})}),(0,$.jsx)(B,{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=>p.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.`,p.length>1?` Mixed cells keep each environment’s rate until you edit them.`:``]})]}),t[9]=b,t[10]=h,t[11]=l,t[12]=c,t[13]=v,t[14]=p,t[15]=u,t[16]=k,t[17]=n,t[18]=j,t[19]=M,t[20]=P,t[21]=I,t[22]=L,t[23]=R,t[24]=z,t[25]=te,t[26]=ne,t[27]=re,t[28]=ie,t[29]=ae,t[30]=oe,t[31]=se,t[32]=ce}else j=t[18],M=t[19],P=t[20],I=t[21],L=t[22],R=t[23],z=t[24],te=t[25],ne=t[26],re=t[27],ie=t[28],ae=t[29],oe=t[30],se=t[31],ce=t[32];let U;t[81]===b?U=t[82]:(U=b?(0,$.jsx)(`div`,{role:`status`,className:`grid gap-1 text-xs`,children:b.destinations.map(e=>{let t=b.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]=b,t[82]=U);let de;t[83]!==j||t[84]!==U||t[85]!==re||t[86]!==ie?(de=(0,$.jsxs)(j,{children:[re,ie,U]}),t[83]=j,t[84]=U,t[85]=re,t[86]=ie,t[87]=de):de=t[87];let fe=te?`Changes apply to ${I}`:``,W;t[88]===fe?W=t[89]:(W=(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:fe}),t[88]=fe,t[89]=W);let G;t[90]!==L||t[91]!==z.length||t[92]!==te||t[93]!==v?(G=te?(0,$.jsx)(T,{variant:`ghost`,disabled:v,onClick:L,children:z.length>0?`Discard pending changes`:`Discard changes`}):null,t[90]=L,t[91]=z.length,t[92]=te,t[93]=v,t[94]=G):G=t[94];let pe=v||!te&&z.length===0||z.length===0&&(R.size>0||p.length===0),K;t[95]!==z.length||t[96]!==ne?(K=()=>void ne(z.length>0),t[95]=z.length,t[96]=ne,t[97]=K):K=t[97];let me=v?`Saving…`:z.length>0?`Retry failed saves`:`Save changes`,he;t[98]!==pe||t[99]!==K||t[100]!==me?(he=(0,$.jsx)(T,{disabled:pe,onClick:K,children:me}),t[98]=pe,t[99]=K,t[100]=me,t[101]=he):he=t[101];let q;t[102]!==G||t[103]!==he?(q=(0,$.jsxs)(`div`,{className:`flex w-full flex-wrap justify-end gap-2 sm:w-auto`,children:[G,he]}),t[102]=G,t[103]=he,t[104]=q):q=t[104];let J;t[105]!==W||t[106]!==q?(J=(0,$.jsxs)(we,{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]!==M||t[109]!==de||t[110]!==J||t[111]!==ae||t[112]!==oe?(Y=(0,$.jsxs)(M,{className:ae,children:[oe,de,J]}),t[108]=M,t[109]=de,t[110]=J,t[111]=ae,t[112]=oe,t[113]=Y):Y=t[113];let ge;return t[114]!==P||t[115]!==Y||t[116]!==se||t[117]!==ce?(ge=(0,$.jsx)(P,{open:se,onOpenChange:ce,children:Y}),t[114]=P,t[115]=Y,t[116]=se,t[117]=ce,t[118]=ge):ge=t[118],ge}function Zt(e){return(0,$.jsx)(`option`,{value:e},e)}function Qt(e){return(0,$.jsx)(`option`,{value:e},e)}function $t(e){return e!==``}function en(e){return e.prices===null}function tn(e){return(0,$.jsx)(It,{children:e.label},e.key)}function nn(e){return(0,$.jsx)(`col`,{},e.key)}function rn(e){return e.environmentId}function an(e){let[t,n]=e;return[t,n.changes]}function on(e){return[e.environmentId,{status:`saving`}]}function sn(e,t,n){return!e.isNew&&t.placeholder!==`Mixed`&&t.placeholder!==`Unavailable`&&n===t.value}function cn(e){return!Vt(e)}function ln(e){return e.isNew}function un(e){return e.model.trim()}function dn(e){return e.isNew}function fn(e){return e.summary?.buckets.map(pn)??[]}function pn(e){return e.model}function mn(e){return[...Object.keys(e.prices??{}),...Object.keys(e.aliases??{})]}var hn=960,gn=260,_n=4,vn=8,yn=new Set;function bn(e,t,n){let r=e?.byProvider.get(t);return r===void 0?0:n===`tokens`?r.totalTokens:r.costUsd}function xn(e,t,n){return e.map(e=>{let r=t.get(e),i=qe.map(e=>({provider:e,value:bn(r,e,n)}));return{bands:i,total:i.reduce((e,t)=>e+t.value,0)}})}function Sn(e){let t=e.length;if(t<2)return[0];let n=[];for(let r=0;r<t-1;r+=1){let t=(e[r+1]?.x??0)-(e[r]?.x??0),i=(e[r+1]?.y??0)-(e[r]?.y??0);n.push(t===0?0:i/t)}let r=Array.from({length:t},()=>0);r[0]=n[0]??0,r[t-1]=n[t-2]??0;for(let e=1;e<t-1;e+=1){let t=n[e-1]??0,i=n[e]??0;r[e]=t*i<=0?0:(t+i)/2}for(let e=0;e<t-1;e+=1){let t=n[e]??0;if(t===0){r[e]=0,r[e+1]=0;continue}let i=(r[e]??0)/t,a=(r[e+1]??0)/t,o=i*i+a*a;if(o>9){let n=3/Math.sqrt(o);r[e]=n*i*t,r[e+1]=n*a*t}}return r}function Cn(e){if(e.length<2)return[];let t=Sn(e),n=[];for(let r=0;r<e.length-1;r+=1){let i=e[r],a=e[r+1];if(i===void 0||a===void 0)continue;let o=a.x-i.x;n.push({from:i,c1:{x:i.x+o/3,y:i.y+(t[r]??0)*o/3},c2:{x:a.x-o/3,y:a.y-(t[r+1]??0)*o/3},to:a})}return n}function wn(e){let t=e[0];if(t===void 0)return``;let n=`M${t.from.x.toFixed(2)},${t.from.y.toFixed(2)}`;for(let t of e)n+=` C${t.c1.x.toFixed(2)},${t.c1.y.toFixed(2)} ${t.c2.x.toFixed(2)},${t.c2.y.toFixed(2)} ${t.to.x.toFixed(2)},${t.to.y.toFixed(2)}`;return n}function Tn(e){return e===``?``:`${e} L${hn},${gn} L0,${gn} Z`}function En(e,t){if(e<=0)return{max:0,ticks:[0]};let n=e/t,r=10**Math.floor(Math.log10(n)),i=n/r,a=(i>5?10:i>2?5:i>1?2:1)*r,o=Math.ceil(e/a)*a,s=[];for(let e=0;e<=o+a*1e-6;e+=a)s.push(e);return{max:o,ticks:s}}var Dn=Array.from({length:5},(e,t)=>t);function On(e,t){let n=e.reduce((e,t)=>t.bands.reduce((e,t)=>Math.max(e,t.value),e),0);return n===0&&t.size>0?{max:_n,ticks:Dn,labeled:!1}:{...En(n,_n),labeled:!0}}function kn(e,t){return t===0?gn:gn-e/t*252}function An(e,t,n,r,i){let a=xn(e,t,n),o=On(a,i),s=e.length<2?0:hn/(e.length-1);return{columns:a,scale:o,stepX:s,paths:r.map(e=>{let t=qe.indexOf(e),n=wn(Cn(a.map((e,n)=>({x:n*s,y:kn(e.bands[t]?.value??0,o.max)}))));return{provider:e,loading:i.has(e),total:a.reduce((e,n)=>e+(n.bands[t]?.value??0),0),line:n,area:Tn(n)}}).toSorted((e,t)=>t.total-e.total)}}function jn(e){let t=(0,Q.c)(97),{providers:n,loadingProviders:r,days:i,daily:a,hours:o,hourly:s,metric:c,referenceTime:l,resolution:u,timeZone:d}=e,f=r===void 0?yn:r,p=u===`hour`?o:i,m;t[0]!==a||t[1]!==s||t[2]!==u?(m=u===`hour`?new Map(s.map(Pn)):new Map(a.map(Nn)),t[0]=a,t[1]=s,t[2]=u,t[3]=m):m=t[3];let h=m,[g,_]=(0,Z.useState)(null),v=(0,Z.useRef)(null),y=(0,Z.useRef)(null),b=(0,Z.useRef)(null),x;t[4]!==h||t[5]!==f||t[6]!==c||t[7]!==p||t[8]!==n?(x=An(p,h,c,n,f),t[4]=h,t[5]=f,t[6]=c,t[7]=p,t[8]=n,t[9]=x):x=t[9];let{columns:S,scale:C,paths:w,stepX:T}=x,D;t[10]===C.max?D=t[11]:(D=e=>kn(e,C.max),t[10]=C.max,t[11]=D);let O=D,k=Mn,A=c===`tokens`?K:W,j;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>{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]=j):j=t[12];let M=j,N,P;t[13]===g?(N=t[14],P=t[15]):(N=()=>{if(g===null)return;M();let e=v.current,t=y.current;if(e!==null&&t!==null)return Ae([e,t],M)},P=[g,M],t[13]=g,t[14]=N,t[15]=P),(0,Z.useLayoutEffect)(N,P);let F;t[16]===p.length?F=t[17]:(F=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},M(),_(Math.min(p.length-1,Math.max(0,o)))},t[16]=p.length,t[17]=F);let I=F,L=g===null?void 0:p[g],R=g===null?void 0:S[g],z;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),z=n.some(e),t[18]=f,t[19]=n,t[20]=z}else z=t[20];let ee=z,B;t[23]!==u||t[24]!==d?(B=e=>u===`hour`?he(e,d):de(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?fe(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]!==A||t[32]!==C.labeled||t[33]!==C.ticks||t[34]!==O?(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:`${O(e)/gn*100}%`},children:e===0?`0`:A(e)},e)):null,t[31]=A,t[32]=C.labeled,t[33]=C.ticks,t[34]=O,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]!==O){let e;t[42]===O?e=t[43]:(e=e=>{let t=O(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]=O,t[43]=e),se=C.ticks.map(e),t[39]=C.ticks,t[40]=O,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:k(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 ce;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:k(n),fill:`none`,stroke:Xe[t].color,strokeWidth:2,vectorEffect:`non-scaling-stroke`},t)},t[49]=e):e=t[49],ce=w.map(e),t[47]=w,t[48]=ce}else ce=t[48];let le;t[50]!==g||t[51]!==T?(le=g===null?null:(0,$.jsx)(`line`,{x1:g*T,x2:g*T,y1:vn,y2:gn,stroke:`currentColor`,strokeWidth:1,className:`text-muted-foreground`,vectorEffect:`non-scaling-stroke`}),t[50]=g,t[51]=T,t[52]=le):le=t[52];let U;t[53]!==oe||t[54]!==se||t[55]!==H||t[56]!==ce||t[57]!==le?(U=(0,$.jsxs)(`svg`,{className:`h-full w-full`,viewBox:`0 0 ${hn} ${gn}`,preserveAspectRatio:`none`,role:`img`,"aria-label":oe,children:[se,H,ce,le]}),t[53]=oe,t[54]=se,t[55]=H,t[56]=ce,t[57]=le,t[58]=U):U=t[58];let ue;t[59]!==A||t[60]!==ne||t[61]!==R?.bands||t[62]!==R?.total||t[63]!==L||t[64]!==f||t[65]!==ee||t[66]!==n?(ue=L===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(L)}),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)(Ie,{driverKind:n,displayName:t,iconClassName:`size-3`}),t]}),(0,$.jsx)(`span`,{className:E(`tabular-nums`,f.has(e)?`text-muted-foreground`:`text-foreground`),children:A(R?.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:E(`tabular-nums`,ee?`text-muted-foreground`:`text-foreground`),children:A(R?.total??0)})]})]}),t[59]=A,t[60]=ne,t[61]=R?.bands,t[62]=R?.total,t[63]=L,t[64]=f,t[65]=ee,t[66]=n,t[67]=ue):ue=t[67];let G;t[68]!==I||t[69]!==U||t[70]!==ue?(G=(0,$.jsxs)(`div`,{ref:v,className:`relative h-56 flex-1`,onMouseMove:I,onMouseLeave:ae,children:[U,ue]}),t[68]=I,t[69]=U,t[70]=ue,t[71]=G):G=t[71];let pe;t[72]!==ie||t[73]!==G?(pe=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[ie,G]}),t[72]=ie,t[73]=G,t[74]=pe):pe=t[74];let me;t[75]!==V||t[76]!==p[0]?(me=p[0]===void 0?``:V(p[0]),t[75]=V,t[76]=p[0],t[77]=me):me=t[77];let q;t[78]===me?q=t[79]:(q=(0,$.jsx)(`span`,{children:me}),t[78]=me,t[79]=q);let J;t[80]!==V||t[81]!==p?(J=p[Math.floor(p.length/2)]===void 0?``:V(p[Math.floor(p.length/2)]??``),t[80]=V,t[81]=p,t[82]=J):J=t[82];let Y;t[83]===J?Y=t[84]:(Y=(0,$.jsx)(`span`,{children:J}),t[83]=J,t[84]=Y);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 X;t[90]!==q||t[91]!==Y||t[92]!==_e?(X=(0,$.jsxs)(`div`,{className:`flex justify-between pl-16 text-3xs text-muted-foreground uppercase`,children:[q,Y,_e]}),t[90]=q,t[91]=Y,t[92]=_e,t[93]=X):X=t[93];let ve;return t[94]!==pe||t[95]!==X?(ve=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[pe,X]}),t[94]=pe,t[95]=X,t[96]=ve):ve=t[96],ve}function Mn(e){return E(`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)(V,{children:[(0,$.jsx)(ee,{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)(B,{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)(Ie,{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)(Ce,{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)(Ee,{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)(Se,{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)(Te,{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 F;t[70]!==n.unpricedTokens||t[71]!==o?(F=n.unpricedTokens>0?(0,$.jsxs)(we,{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]=F):F=t[72];let I;t[73]!==w||t[74]!==P||t[75]!==F?(I=(0,$.jsxs)(De,{className:`max-w-3xl`,children:[w,P,F]}),t[73]=w,t[74]=P,t[75]=F,t[76]=I):I=t[76];let L;return t[77]!==I||t[78]!==v?(L=(0,$.jsx)(Oe,{open:!0,onOpenChange:v,children:I}),t[77]=I,t[78]=v,t[79]=L):L=t[79],L}function Jn(e){return(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.label}),(0,$.jsx)(`span`,{className:`text-2xl font-semibold text-foreground`,children:e.value})]},e.label)}function Yn(e){return e!==null}function Xn(e){let t=(0,Q.c)(4),{premiumUsd:n}=e,r;t[0]===n?r=t[1]:(r=W(n),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Premium `,(0,$.jsx)(`span`,{className:`text-foreground tabular-nums`,children:r})]}),t[2]=r,t[3]=i),i}var Zn=`t3code:usage-page-preferences:v1`,Qn=w({metric:h([`cost`,`tokens`,`limits`]),windowDays:h([1,7,30,90]),hiddenProviders:l(f(u))}),$n={metric:`limits`,windowDays:30};function er(){try{return b(Zn,Qn)??$n}catch(e){return console.error(`Could not read Usage page preferences.`,e),$n}}function tr(e){try{O(Zn,e,Qn)}catch(e){console.error(`Could not save Usage page preferences.`,e)}}function nr(e){return Ve.some(t=>t.value===e)}function rr(e){return ze.some(t=>t.days===e)}var ir=e=>Xe[e].label;function ar(){let[e,t]=(0,Z.useState)(er);oe();let n=i(ce),r=e=>{let t=je(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,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(()=>Date.now()),p=(0,Z.useRef)(!1),[m,h]=(0,Z.useState)(`model`),[g,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:D}=a,O=w===1,{merged:k,environments:A,selectedEnvironments:j,shown:N,isPartial:P,refresh:F}=Dt(D,x,C),I=N?.merged??k,L=N?.window??D,R=L.resolution===`hour`,z=l&&!c,ee=N!==null&&N.window!==D,B=(0,Z.useMemo)(()=>{if(ee)return{partial:!0,everyProvider:!0,providers:new Set};let e=ft(j,z),t=new Set([...e.providers].filter(e=>!C.has(e)));return{partial:e.everyProvider||t.size>0,everyProvider:e.everyProvider,providers:t}},[ee,z,j,C]),V=e=>B.everyProvider||B.providers.has(e),le=i(se.presentationsAtom),U=C.has(`cursor`)?[]:at(j),fe=[...new Set(j.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]:[])??[]))],ge=ue(H.refreshProviders,{reportFailure:!1}),X=j.some(e=>e.canReadDiagnostics),be=(0,Z.useMemo)(()=>Y(L.sinceDay,L.untilDay),[L.sinceDay,L.untilDay]),Se=(0,Z.useMemo)(()=>L.sinceTime===void 0||L.untilTime===void 0?[]:me(L.sinceTime,L.untilTime),[L.sinceTime,L.untilTime]),Ce=(0,Z.useMemo)(()=>(R?I.hourly:I.daily).toReversed(),[R,I.daily,I.hourly]),we=(0,Z.useMemo)(()=>m===`model`&&s===`tokens`?Rn(I.models):I.models,[m,I.models,s]),Te=(0,Z.useMemo)(()=>Ke(I.providers),[I.providers]),Ee=(0,Z.useMemo)(()=>qe.filter(e=>Te.includes(e)||B.providers.has(e)),[B.providers,Te]),De=(0,Z.useMemo)(()=>new Set(Ee.filter(e=>B.everyProvider||B.providers.has(e))),[Ee,B.everyProvider,B.providers]),Oe=y===null?void 0:I.models.find(e=>`${e.provider}:${e.model}`===y),Ae=we.reduce((e,t)=>Math.max(e,s===`tokens`?t.totalTokens:t.costUsd),0),Ie=Ee.map(e=>({kind:`usage`,provider:e})),He=Math.max(Ee.indexOf(`codex`),Ee.indexOf(`claude`))+1;Ie.splice(He,0,...U.map(e=>({kind:`enable`,environment:e})));let We=`${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`&&f(Date.now()),Qe({metric:e})},rt=async(e=!1,t=!1)=>{try{await Promise.all(Array.from(le,([n,r])=>{if((x===null||x.has(n))&&r.connection.phase===`connected`&&r.serverConfig!==null)return ct(n,()=>ge({environmentId:n,input:{}}),e,t)}))}finally{f(Date.now())}},it=(0,Z.useEffectEvent)(e=>{if(e.defaultPrevented||e.repeat||e.isComposing||Ye()||Ue())return;let t=Be(e,n),r=Ve.find(e=>e.command===t),i=ze.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(p.current)return;if(c){p.current=!0,u(!0),rt().finally(()=>{p.current=!1,u(!1)});return}let e=G(w,void 0,O?`hour`:`day`);(e.sinceDay!==D.sinceDay||e.untilDay!==D.untilDay||e.sinceTime!==D.sinceTime||e.untilTime!==D.untilTime)&&o({days:w,window:e}),p.current=!0,u(!0),F(e).finally(()=>{p.current=!1,u(!1)})},st=[...le].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=R&&L.sinceTime!==void 0&&L.untilTime!==void 0?`${pe(L.sinceTime,L.timeZone)} to ${pe(L.untilTime,L.timeZone)}`:`${de(L.sinceDay)} to ${de(L.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:A,selectedEnvironments:j,selectedEnvironmentIds:x,onSelectionChange:S,showUsageStatus:!c,refreshing:z,isPartial:P,duplicateSources:I.duplicateSources,contractMismatches:I.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)(ve,{"aria-label":`Usage metric`,variant:`segmented`,value:[s],onValueChange:e=>{let t=e[0];nr(t)&&Q(t)},children:Ve.map(e=>(0,$.jsx)(ye,{value:e.value,title:r(e),children:e.label},e.value))}),(0,$.jsx)(ve,{"aria-label":`Usage period`,variant:`segmented`,value:[String(w)],disabled:c,onValueChange:e=>{let t=e[0];t&&nt(Number(t))},children:ze.map(e=>(0,$.jsx)(ye,{value:String(e.days),title:r(e),children:e.label},e.days))}),(0,$.jsx)(T,{onClick:ot,"aria-label":c?`Refresh limits`:`Refresh usage`,"aria-busy":l,disabled:l||!c&&!X,size:`icon-sm`,variant:`ghost`,children:(0,$.jsx)(Je,{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)(ae,{value:s,onValueChange:e=>{nr(e)&&Q(e)},children:[(0,$.jsx)(ie,{"aria-label":`Usage metric`,size:`compact`,variant:`ghost`,className:`w-auto min-w-0`,children:(0,$.jsx)(ne,{children:Ve.find(e=>e.value===s)?.label})}),(0,$.jsx)(re,{align:`end`,alignItemWithTrigger:!1,children:Ve.map(e=>(0,$.jsx)(te,{value:e.value,title:r(e),children:e.label},e.value))})]}),(0,$.jsxs)(ae,{value:String(w),disabled:c,onValueChange:e=>nt(Number(e)),children:[(0,$.jsx)(ie,{"aria-label":`Usage period`,size:`compact`,variant:`ghost`,className:`w-auto min-w-0`,children:(0,$.jsx)(ne,{children:ze.find(e=>e.days===w)?.label})}),(0,$.jsx)(re,{align:`end`,alignItemWithTrigger:!1,children:ze.map(e=>(0,$.jsx)(te,{value:String(e.days),title:r(e),children:e.label},e.days))})]}),(0,$.jsx)(T,{onClick:ot,"aria-label":c?`Refresh limits`:`Refresh usage`,"aria-busy":l,disabled:l||!c&&!X,size:`icon-sm`,variant:`ghost`,children:(0,$.jsx)(Je,{size:`sm`,refreshing:l})})]})]});return(0,$.jsxs)(ke,{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:_e,children:dt}),(0,$.jsx)(xe,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Re,{width:`wide`,children:j.length===0?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:A.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:d,cursorPrompt:U.length>0?(0,$.jsx)(lr,{environments:U,onEnabled:()=>{F(),rt(!1,!0)}}):null}):N===null?(0,$.jsx)(Sr,{}):X?(0,$.jsxs)(`div`,{"aria-busy":B.partial,className:`flex flex-col gap-6`,children:[fe.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:E(`text-4xl font-semibold text-foreground tabular-nums`,dr(B.partial)),children:s===`cost`?W(I.costUsd):K(I.totalTokens)}),(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,$.jsxs)(`span`,{children:[(0,$.jsxs)(`span`,{className:dr(B.partial),children:[q(I.sessions),` sessions`]}),s===`cost`&&` · API estimate`]}),s===`cost`&&I.costQuality.unpricedShare>0&&(0,$.jsxs)(Pe,{children:[(0,$.jsx)(Ne,{openOnHover:!0,render:(0,$.jsx)(_,{tone:`muted`}),"aria-label":`Unpriced usage details`,children:(0,$.jsx)(M,{className:`size-3`,"aria-hidden":!0})}),(0,$.jsxs)(Me,{side:`top`,tooltipStyle:!0,children:[`API estimate excludes`,` `,J(I.costQuality.unpricedShare),` unpriced records.`]})]})]})]}),!C.has(`codex`)&&[...le].some(([e,t])=>(x===null||x.has(e))&&t.serverConfig?.providers.some(Fe))?(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)(Le,{size:`xs`})]}):null,Ie.map(e=>{if(e.kind===`enable`)return(0,$.jsx)(cr,{environmentId:e.environment.environmentId,label:e.environment.label,showEnvironment:j.length>1,onEnabled:()=>{F(),rt(!1,!0)}},`enable:${e.environment.environmentId}`);let t=e.provider,n=I.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=V(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:E(`shrink-0 whitespace-nowrap text-2xs text-muted-foreground tabular-nums`,dr(o),c&&`invisible`),children:a})]})]}),(0,$.jsx)(`span`,{className:E(`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:E(`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:[R?`Hourly`:`Daily`,` `,s===`tokens`?`processed tokens`:`cost`]}),(0,$.jsx)(jn,{providers:Ee,loadingProviders:De,days:be,daily:I.daily,hours:Se,hourly:I.hourly,metric:s,referenceTime:L.untilTime,resolution:R?`hour`:`day`,timeZone:L.timeZone})]})]}),(0,$.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-medium text-foreground`,children:`Totals`}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-6 gap-y-4 py-1 md:grid-cols-5`,children:[(0,$.jsx)(fr,{loading:B.partial,label:`Processed tokens`,value:K(I.totalTokens)}),(0,$.jsx)(fr,{loading:B.partial,label:`Cached input`,value:K(I.cachedInputTokens)}),(0,$.jsx)(fr,{loading:B.partial,label:`Uncached input`,value:K(I.uncachedInputTokens)}),(0,$.jsx)(fr,{loading:B.partial,label:`Output`,value:K(I.outputTokens)}),(0,$.jsx)(fr,{loading:B.partial,label:`Cache savings`,value:W(I.costQuality.cacheSavingsUsd)})]})]}),I.totalTokens>0?(0,$.jsx)(`section`,{className:E(`grid gap-x-12 gap-y-8 lg:grid-cols-2`,dr(B.partial)),children:s===`tokens`?(0,$.jsx)(Fn,{label:`Tokens by type`,segments:Gn(I),format:K}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Fn,{label:`Cost by type`,segments:Wn(I.categoryCost),format:W}),I.speedCost.fast+I.speedCost.ultrafast>0?(0,$.jsx)(Fn,{label:`Cost by speed`,segments:Kn(I.speedCost),format:W,aside:(0,$.jsx)(Xn,{premiumUsd:I.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)(ve,{"aria-label":`Usage breakdown`,variant:`segmented`,value:[m],onValueChange:e=>{let t=e[0];(t===`model`||t===`time`)&&h(t)},children:[{value:`model`,label:`Model`},{value:`time`,label:R?`Hour`:`Day`}].map(e=>(0,$.jsx)(ye,{value:e.value,children:e.label},e.value))})]}),m===`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(V(e.provider));return(0,$.jsxs)(`tr`,{className:`relative border-b border-border/50 text-right whitespace-nowrap text-muted-foreground tabular-nums transition-colors hover:bg-muted/50 has-focus-visible:bg-muted/50`,children:[(0,$.jsx)(`td`,{className:`py-2.5 pr-3 text-left text-xs`,children:t+1}),(0,$.jsxs)(`td`,{className:`py-2.5 text-left whitespace-normal`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>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:E(`mt-1.5 h-0.5 max-w-48`,a),children:(0,$.jsx)(`div`,{className:`h-full rounded-full`,style:{width:r>0&&Ae>0?`max(0.5rem, ${r/Ae*100}%)`:0,backgroundColor:Xe[e.provider].color}})})]}),(0,$.jsx)(`td`,{className:E(`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:E(`hidden py-2.5 pl-6 sm:table-cell`,a),children:i===null?``:J(i)}),(0,$.jsx)(`td`,{className:E(`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:We}},e)),(0,$.jsx)(`col`,{style:{width:We}}),(0,$.jsx)(`col`,{style:{width:We}})]}),(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:R?`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?he(e.hourStart,L.timeZone):de(e.day)}),Ee.map(t=>(0,$.jsx)(`td`,{className:E(`py-2 text-right text-muted-foreground tabular-nums`,dr(V(t))),children:W(e.byProvider.get(t)?.costUsd??0)},t)),(0,$.jsx)(`td`,{className:E(`py-2 text-right text-foreground tabular-nums`,dr(B.partial)),children:W(e.costUsd)}),(0,$.jsx)(`td`,{className:E(`py-2 text-right text-muted-foreground tabular-nums`,dr(B.partial)),children:K(e.totalTokens)})]},`hourStart`in e?e.hourStart:e.day))})]})]})]}):(0,$.jsx)(`div`,{className:`space-y-2 py-12 text-center text-sm text-muted-foreground`,children:j.map(e=>(0,$.jsxs)(`p`,{children:[j.length>1?`${e.label}: `:null,e.error]},e.environmentId))})})})]}),Oe!==void 0&&!c?(0,$.jsx)(qn,{model:Oe,environments:j,metric:s===`tokens`?`tokens`:`cost`,chartWindow:{days:be,hours:Se,resolution:R?`hour`:`day`,timeZone:L.timeZone,referenceTime:L.untilTime},onSetPrice:()=>{b(null),v({model:Oe.model})},onClose:()=>b(null)}):null,g?(0,$.jsx)(Xt,{usage:A,initialSelectedEnvironmentIds:x,initialModel:g.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=ue(H.updateSettings,{label:`enable Cursor account usage`}),[o,s]=(0,Z.useState)(!1),c=async()=>{s(!0);try{(await a({environmentId:e,input:{patch:{cursorKeychainUsageEnabled:!0}}}))._tag===`Success`&&n()}finally{s(!1)}},l=r?(0,$.jsx)(_,{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)(V,{children:[(0,$.jsx)(ee,{render:l}),(0,$.jsx)(B,{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)(Ie,{driverKind:k.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)(Ie,{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 E(`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=E(`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:ge(t.label,n)},t.environmentId)}function hr(e){return(0,$.jsxs)(`span`,{children:[e.label,`: `,e.error]},e.label)}function gr(e){return[e.environmentId,e]}function _r(e){return e.error!==null}function vr(e){let t=(0,Q.c)(56),{environments:n,selectedEnvironments:i,selectedEnvironmentIds:a,onSelectionChange:s,showUsageStatus:c,refreshing:l,isPartial:u,duplicateSources:d,contractMismatches:f,onOpenModelPrices:p}=e,h=a===null,v=h?`All environments`:i.length===1?i[0].label:`${i.length} environments`,y;t[0]!==f||t[1]!==i?(y=i.some(br)||f.length>0,t[0]=f,t[1]=i,t[2]=y):y=t[2];let b=y,x;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(_,{}),t[3]=x):x=t[3];let S;t[4]===v?S=t[5]:(S=(0,$.jsx)(Qe,{children:v}),t[4]=v,t[5]=S);let w;t[6]!==b||t[7]!==c?(w=(0,$.jsx)(`span`,{className:`flex size-3.5 shrink-0 items-center justify-center text-muted-foreground`,children:c&&b?(0,$.jsx)(j,{className:`size-3.5 text-warning-foreground`,"aria-label":`Some environments could not report usage`}):(0,$.jsx)(A,{className:`size-3.5 opacity-0 transition-opacity group-hover/usage-environment:opacity-100 group-focus-visible/usage-environment:opacity-100 group-data-popup-open/usage-environment:opacity-100`,"aria-hidden":!0})}),t[6]=b,t[7]=c,t[8]=w):w=t[8];let T;t[9]!==S||t[10]!==w?(T=(0,$.jsxs)(C,{render:x,className:`group/usage-environment min-w-0 max-w-full`,children:[S,w]}),t[9]=S,t[10]=w,t[11]=T):T=t[11];let O;t[12]===s?O=t[13]:(O=e=>s(e?null:new Set),t[12]=s,t[13]=O);let k;t[14]!==h||t[15]!==O?(k=(0,$.jsx)(o,{checked:h,closeOnClick:!1,onCheckedChange:O,children:`All environments`}),t[14]=h,t[15]=O,t[16]=k):k=t[16];let M;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(D,{}),t[17]=M):M=t[17];let N;if(t[18]!==n||t[19]!==s||t[20]!==l||t[21]!==a||t[22]!==i||t[23]!==c){let e;t[25]!==n.length||t[26]!==s||t[27]!==l||t[28]!==a||t[29]!==i||t[30]!==c?(e=e=>{let t=a===null||a.has(e.environmentId),r=ut(e,l),u=e.error===null?e.summary!==null&&!bt(e.summary.contractVersion,6)?`Update required`:e.isConnected?r.phase===`loading`?`Scanning…`:r.phase===`stale`?`Refreshing…`:r.phase===`partway`?dt(r.providers,ir):`Ready`:`Connecting…`:`Unavailable`;return(0,$.jsx)(o,{checked:t,closeOnClick:!1,onCheckedChange:t=>{let r=new Set(i.map(yr));t?r.add(e.environmentId):r.delete(e.environmentId),s(r.size===n.length?null:r)},children:(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),c?(0,$.jsx)(`span`,{className:E(`shrink-0 text-xs text-muted-foreground`,e.error!==null&&`text-destructive`),children:u}):null]})},e.environmentId)},t[25]=n.length,t[26]=s,t[27]=l,t[28]=a,t[29]=i,t[30]=c,t[31]=e):e=t[31],N=n.map(e),t[18]=n,t[19]=s,t[20]=l,t[21]=a,t[22]=i,t[23]=c,t[24]=N}else N=t[24];let F;t[32]===n.length?F=t[33]:(F=n.length===0?(0,$.jsx)(`p`,{className:`px-2 py-2 text-xs text-muted-foreground`,children:`No environments connected.`}):null,t[32]=n.length,t[33]=F);let I;t[34]!==u||t[35]!==c?(I=c&&u?(0,$.jsx)(`p`,{className:`px-2 py-2 text-xs text-muted-foreground`,children:`Totals are partial while selected environments scan.`}):null,t[34]=u,t[35]=c,t[36]=I):I=t[36];let L;t[37]!==f||t[38]!==d||t[39]!==i||t[40]!==c?(L=c?(0,$.jsx)(pr,{environments:i,duplicateSources:d,contractMismatches:f}):null,t[37]=f,t[38]=d,t[39]=i,t[40]=c,t[41]=L):L=t[41];let R;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(D,{}),t[42]=R):R=t[42];let z;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(P,{"aria-hidden":!0}),t[43]=z):z=t[43];let ee;t[44]===p?ee=t[45]:(ee=(0,$.jsxs)(m,{onClick:p,children:[z,`Model prices`]}),t[44]=p,t[45]=ee);let B;t[46]!==F||t[47]!==I||t[48]!==L||t[49]!==ee||t[50]!==k||t[51]!==N?(B=(0,$.jsxs)(g,{align:`start`,children:[k,M,N,F,I,L,R,ee]}),t[46]=F,t[47]=I,t[48]=L,t[49]=ee,t[50]=k,t[51]=N,t[52]=B):B=t[52];let V;return t[53]!==B||t[54]!==T?(V=(0,$.jsxs)(r,{children:[T,B]}),t[53]=B,t[54]=T,t[55]=V):V=t[55],V}function yr(e){return e.environmentId}function br(e){return e.error!==null}function xr(e){let t=(0,Q.c)(23),{hiddenProviders:n,onChange:i}=e,a;t[0]===n?a=t[1]:(a=qe.filter(e=>!n.has(e)),t[0]=n,t[1]=a);let s=a,c=s.length===qe.length?`All providers`:s.length===0?`No providers`:s.length===1?Xe[s[0]].label:`${s.length} providers`,l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(_,{}),t[2]=l):l=t[2];let u;t[3]===c?u=t[4]:(u=(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:c}),t[3]=c,t[4]=u);let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(A,{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)(C,{render:l,className:`group/usage-provider min-w-0 max-w-full`,children:[u,d]}),t[6]=u,t[7]=f);let p=n.size===0,m;t[8]===i?m=t[9]:(m=e=>i(e?[]:qe),t[8]=i,t[9]=m);let h;t[10]!==p||t[11]!==m?(h=(0,$.jsx)(o,{checked:p,closeOnClick:!1,onCheckedChange:m,children:`All providers`}),t[10]=p,t[11]=m,t[12]=h):h=t[12];let v;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(D,{}),t[13]=v):v=t[13];let y;t[14]!==n||t[15]!==i?(y=qe.map(e=>(0,$.jsx)(o,{checked:!n.has(e),closeOnClick:!1,onCheckedChange:t=>i(qe.filter(r=>r===e?!t:n.has(r))),children:(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(ur,{provider:e,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`truncate`,children:Xe[e].label})]})},e)),t[14]=n,t[15]=i,t[16]=y):y=t[16];let b;t[17]!==y||t[18]!==h?(b=(0,$.jsxs)(g,{align:`start`,children:[h,v,y]}),t[17]=y,t[18]=h,t[19]=b):b=t[19];let x;return t[20]!==b||t[21]!==f?(x=(0,$.jsxs)(r,{children:[f,b]}),t[20]=b,t[21]=f,t[22]=x):x=t[22],x}function Sr(){let e=(0,Q.c)(7),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(X,{className:`h-10 w-36`}),(0,$.jsx)(X,{className:`h-4 w-32`})]}),qe.map(Cr)]}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(X,{className:`h-5 w-24`}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsxs)(`section`,{className:`grid gap-6 lg:grid-cols-[minmax(0,18rem)_minmax(0,1fr)]`,children:[t,(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[n,(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(X,{className:`ml-16 h-56`}),(0,$.jsx)(X,{className:`ml-16 h-4`})]})]})]}),e[2]=r):r=e[2];let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(`h2`,{className:`text-sm font-medium text-foreground`,children:`Totals`}),e[3]=i):i=e[3];let a;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[i,(0,$.jsx)(wr,{labels:[`Processed tokens`,`Cached input`,`Uncached input`,`Output`,`Cache savings`]})]}),e[4]=a):a=e[4];let o;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(`section`,{className:`grid gap-x-12 gap-y-8 lg:grid-cols-2`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,$.jsx)(X,{className:`h-5 w-28`}),(0,$.jsx)(X,{className:`h-2`}),(0,$.jsx)(X,{className:`h-4 w-72`})]})}),e[5]=o):o=e[5];let s;return e[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsxs)($.Fragment,{children:[r,a,o,(0,$.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-medium text-foreground`,children:`Breakdown`}),(0,$.jsx)(X,{shape:`card`,className:`h-7 w-28`})]}),(0,$.jsx)(X,{className:`h-44`})]})]}),e[6]=s):s=e[6],s}function Cr(e){return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`div`,{className:`flex min-h-5 items-center justify-between gap-4`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(X,{shape:`pill`,className:`size-2 shrink-0`}),(0,$.jsx)(X,{shape:`pill`,className:`size-4 shrink-0`}),(0,$.jsx)(X,{className:`h-3.5 w-20`})]}),(0,$.jsx)(X,{className:`h-3.5 w-14`})]}),(0,$.jsx)(X,{className:`h-4 w-36`})]},e)}function wr(e){let t=(0,Q.c)(4),{labels:n}=e,r;t[0]===n?r=t[1]:(r=n.map(Tr),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,$.jsx)(`div`,{className:`grid grid-cols-2 gap-x-6 gap-y-4 py-1 md:grid-cols-5`,children:r}),t[2]=r,t[3]=i),i}function Tr(e){return(0,$.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e}),(0,$.jsx)(X,{className:`h-6 w-16`})]},e)}var Er=ar;export{Er as component};
|
|
2
|
-
//# sourceMappingURL=usage--nsoWaqi.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{Mx as n,Uo as r}from"./utils-Cbsb1ks0.js";import{z as i}from"./runtime-CBB2It1x.js";var a=n(),o=e(t(),1);function s(e,t){let n=(0,a.c)(6),s=(0,o.useContext)(r),c=typeof t==`string`?t:t?.label??e.label,l=typeof t==`string`?!0:t?.reportFailure??!0,u=typeof t==`string`?!0:t?.reportDefect??!0,d;return n[0]!==e||n[1]!==c||n[2]!==s||n[3]!==u||n[4]!==l?(d=t=>i(s,e,t,{label:c,reportFailure:l,reportDefect:u}),n[0]=e,n[1]=c,n[2]=s,n[3]=u,n[4]=l,n[5]=d):d=n[5],d}export{s as t};
|
|
2
|
-
//# sourceMappingURL=use-atom-command-BVrZ0hTO.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{Bs as n,C as r,D as i,Ho as a,Mx as o,Ro as s,Rs as c,Wc as l,c as u,g as d,i as f,jl as p,s as m,zs as h}from"./utils-Cbsb1ks0.js";import{I as g,L as _}from"./runtime-CBB2It1x.js";import{C as v,O as ee,d as te,f as ne,m as re,p as y}from"./entities-HApogVCu.js";import{Xt as b,an as x}from"./runtime-Dydpcwo9.js";import{a as S,t as C}from"./useParams-nxAoxVO6.js";import{d as w}from"./toast-DEgXlTR7.js";import{s as ie}from"./useSettings-BCUX_14n.js";import{n as T}from"./server-FMafPUns.js";import"./queries-DrIiv9gC.js";import{p as E}from"./session-logic-DVvClfzW.js";import{a as D,i as O,n as k}from"./threadSort-C4CtIL5v.js";import{c as A,r as j}from"./projectFilesQueryState-C9bparJ7.js";import{b as M,v as N}from"./sortable.esm-Df_JB8i3.js";import{d as P,f as ae,i as oe,r as se,s as ce,t as F}from"./p4ProjectFile-DNlgD3LH.js";var I=e(t(),1),L=o(),R=`[data-thread-item], [data-thread-selection-safe]`,z=3,B=160;function V(e){let t=(0,L.c)(6),[n,r]=I.useState(null),[i,a]=I.useState(e),o,s;t[0]!==e||t[1]!==n?(o=()=>{if(e){a(!0);return}if(n===null)return;if(typeof IntersectionObserver>`u`){a(!0);return}let t=n.closest(`[data-slot="scroll-area-viewport"]`),r=new IntersectionObserver(e=>{let[t]=e;return a(t?.isIntersecting===!0)},{root:t,rootMargin:`${B}px 0px`});return r.observe(n),()=>r.disconnect()},s=[e,n],t[0]=e,t[1]=n,t[2]=o,t[3]=s):(o=t[2],s=t[3]),I.useEffect(o,s);let c=e||i,l;return t[4]===c?l=t[5]:(l={leaseLiveStatus:c,rowRef:r},t[4]=c,t[5]=l),l}function H(e,t){let n=I.useRef(null);return e!==null&&t!==null&&(n.current={key:e,value:t}),t===null?e!==null&&n.current?.key===e?n.current.value:null:t}function U(e,t,n,r){let i=e.indexOf(t),a=e.indexOf(n);return i===-1||a===-1?[]:e.slice(Math.min(i,a),Math.max(i,a)+1).filter(r)}async function W(e){let t=new Set,n=null;for(let r of e.entries){let i=await e.delete(r,t);if(i!==null){if(i._tag===`Failure`){if(_(i))break;n??=i;continue}t.add(r.threadKey)}}return{deletedThreadKeys:t,firstFailure:n}}async function G(e){let t=[],n=[];for(let r of e.entries){let i=!1,a=await e.archive(r,()=>{i=!0});if((i||a._tag===`Success`)&&t.push(r.threadKey),a._tag===`Success`)continue;let o=a;if(i){n.push(o);continue}return{archivedThreadKeys:t,mutationFailure:o,followupFailures:n}}return{archivedThreadKeys:t,mutationFailure:null,followupFailures:n}}function K(e){return[{id:`mark-unread`,label:`Mark unread (${e.count})`},{id:`archive`,label:`Archive (${e.count})`,disabled:e.hasRunningThread},{id:`delete`,label:`Delete (${e.count})`,destructive:!0}]}function q(e){return e.lineage.relationshipToParent===`subagent`}function J(e,t){return e.filter(e=>e.archivedAt===null&&!q(e)&&(t===null||t.has(`${e.environmentId}:${e.projectId}`)))}var Y={"Pending Approval":5,"Awaiting Input":4,Working:3,Connecting:3,Waiting:2.5,"Plan Ready":2,Completed:1};function le(e){let t=e.setTimeoutFn??globalThis.setTimeout,n=e.clearTimeoutFn??globalThis.clearTimeout,r=!1,i=null,a=()=>{i!==null&&(n(i),i=null)};return{sync:n=>{if(!n){a(),r&&(r=!1,e.onVisibilityChange(!1));return}r||i!==null||(i=t(()=>{i=null,r=!0,e.onVisibilityChange(!0)},e.delayMs))},dispose:()=>{a()}}}function ue(){let e=(0,L.c)(5),[t,n]=I.useState(!1),r=I.useRef(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=le({delayMs:200,onVisibilityChange:e=>{n(e)},setTimeoutFn:window.setTimeout.bind(window),clearTimeoutFn:window.clearTimeout.bind(window)});return r.current=e,()=>{e.dispose(),r.current=null}},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),I.useEffect(i,a);let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=e=>{r.current?.sync(e)},e[2]=o):o=e[2];let s=o,c;return e[3]===t?c=e[4]:(c={showThreadJumpHints:t,updateThreadJumpHintsVisibility:s},e[3]=t,e[4]=c),c}function de(e,t){return e===void 0?t:e??void 0}function fe(e){if(!e.latestRun?.completedAt)return!1;let t=Date.parse(e.latestRun.completedAt);if(Number.isNaN(t)||!e.lastVisitedAt)return!1;let n=Date.parse(e.lastVisitedAt);return Number.isNaN(n)?!0:t>n}function pe(e){return e===null||!e.closest(R)}function me(e){return e>1}function he(e,t){return e===null||!(`closest`in e)||typeof e.closest!=`function`?null:e.closest(t)}function ge(e){return typeof e!=`object`||!e?!1:he(e,`a[href]`)!==null||he(`parentElement`in e&&e.parentElement!==null&&typeof e.parentElement==`object`?e.parentElement:null,`a[href]`)!==null}function _e(e){let{getId:t,getPreferenceIds:n,items:r,preferredIds:i}=e;if(i.length===0)return[...r];let a=new Map;for(let[e,i]of r.entries()){let r=n?.(i)??[t(i)];for(let t of new Set(r)){let n=a.get(t);n?n.push(e):a.set(t,[e])}}let o=new Set,s=i.flatMap(e=>{let t=a.get(e)?.find(e=>!o.has(e));return t===void 0?[]:(o.add(t),[r[t]])}),c=r.filter((e,t)=>!o.has(t));return[...s,...c]}function ve(e,t=z){return e.slice(0,Math.max(0,t))}function ye(e){let{currentThreadId:t,direction:n,threadIds:r}=e;if(r.length===0)return null;if(t===null)return n===`previous`?r.at(-1)??null:r[0]??null;let i=r.indexOf(t);return i===-1?null:n===`previous`?i>0?r[i-1]??null:null:i<r.length-1?r[i+1]??null:null}function be(e){return e.button===2||e.isMac&&e.button===0&&e.ctrlKey}function xe(e){return e.hasPendingApprovals||e.pendingSubagentRequest===`approval`?`approval`:e.hasPendingUserInput||e.pendingSubagentRequest===`user_input`?`input`:e.runtime!==null&&[`preparing`,`queued`,`starting`,`running`,`waiting`].includes(e.runtime.status)?`working`:e.runtime?.status===`idle`?`waiting`:e.runtime?.status===`failed`?e.runtime.lastErrorClass===`usage_limit`?`limited`:`failed`:`ready`}function Se(e,t){let n=u(t);if(n.length===0)return!1;let r=u(x(e).join(` `));return n.split(` `).every(e=>r.includes(e))}function Ce(e){let{thread:t}=e;return t.hasPendingApprovals||t.pendingSubagentRequest===`approval`?{label:`Pending Approval`,colorClass:`text-amber-600 dark:text-amber-300/90`,dotClass:`bg-amber-500 dark:bg-amber-300/90`,pulse:!1}:t.hasPendingUserInput||t.pendingSubagentRequest===`user_input`?{label:`Awaiting Input`,colorClass:`text-indigo-600 dark:text-indigo-300/90`,dotClass:`bg-indigo-500 dark:bg-indigo-300/90`,pulse:!1}:t.runtime?.status===`running`||t.runtime?.status===`waiting`?{label:`Working`,colorClass:`text-sky-600 dark:text-sky-300/80`,dotClass:`bg-sky-500 dark:bg-sky-300/80`,pulse:!0}:t.runtime?.status===`preparing`||t.runtime?.status===`starting`||t.runtime?.status===`queued`?{label:`Connecting`,colorClass:`text-sky-600 dark:text-sky-300/80`,dotClass:`bg-sky-500 dark:bg-sky-300/80`,pulse:!0}:b(t.pendingBackgroundTasks??[])?{label:`Waiting`,colorClass:`text-sidebar-muted-foreground`,dotClass:`bg-sidebar-muted-foreground`,pulse:!1}:!t.hasPendingUserInput&&t.interactionMode===`plan`&&E(t.latestRun,t.runtime)&&t.hasActionableProposedPlan?{label:`Plan Ready`,colorClass:`text-violet-600 dark:text-violet-300/90`,dotClass:`bg-violet-500 dark:bg-violet-300/90`,pulse:!1}:fe(t)?{label:`Completed`,colorClass:`text-emerald-600 dark:text-emerald-300/90`,dotClass:`bg-emerald-500 dark:bg-emerald-300/90`,pulse:!1}:null}function we(e){let t=null;for(let n of e)n!==null&&(t===null||Y[n.label]>Y[t.label])&&(t=n);return t}function Te(e,t){return t.projectExpanded?t.isThreadListExpanded||e.length<=t.previewCount?e:e.slice(0,t.previewCount):[]}function Ee(e){let{deletedThreadId:t,deletedThreadIds:n,sortOrder:r,threads:i}=e,a=i.find(e=>e.id===t);return a?O(i.filter(e=>e.projectId===a.projectId&&e.id!==t&&!n?.has(e.id)),r)[0]?.id??null:null}function De(e,t,n){return t.length>0?t.reduce((e,t)=>Math.max(e,k(t,n)),-1/0):n===`created_at`?D(e.createdAt)??-1/0:D(e.updatedAt??e.createdAt)??-1/0}function X(e,t,n,r){return t===`manual`?[...e]:e.map(e=>({project:e,timestamp:De(e,n(e),t)})).sort((e,t)=>(t.timestamp===e.timestamp?0:t.timestamp>e.timestamp?1:-1)||r(e.project,t.project)).map(({project:e})=>e)}function Oe(e,t,n){let r=new Map;for(let e of t){let t=r.get(e.projectId)??[];t.push(e),r.set(e.projectId,t)}return X(e,n,e=>r.get(e.id)??[],(e,t)=>e.title.localeCompare(t.title)||e.id.localeCompare(t.id))}function ke(e,t,n){let r=new Map(e.flatMap(e=>e.memberProjectRefs.map(t=>[`${t.environmentId}\0${t.projectId}`,e.projectKey]))),i=new Map;for(let e of t){if(e.archivedAt!==null)continue;let t=r.get(`${e.environmentId}\0${e.projectId}`);if(!t)continue;let n=i.get(t);n?n.push(e):i.set(t,[e])}return X(e,n,e=>i.get(e.projectKey)??[],(e,t)=>e.title.localeCompare(t.title)||e.projectKey.localeCompare(t.projectKey))}function Ae(e,t,n){return ke(e,J(t,null),n)}function je(e,t,n){let r=(e,t)=>`${e}\u0000${t}`,i=new Map;for(let e of t){if(e.archivedAt!==null)continue;let t=r(e.environmentId,e.projectId),n=i.get(t)??[];n.push(e),i.set(t,n)}return X(e,n,e=>i.get(r(e.environmentId,e.id))??[],(e,t)=>e.title.localeCompare(t.title)||e.environmentId.localeCompare(t.environmentId)||e.id.localeCompare(t.id))}function Z(e){return e.envMode!==`local`&&e.newWorktreesStartFromOrigin}function Me(e){return e.projectDefaultSelection??(e.carrySourceDraftId===e.destinationDraftId?null:e.carrySelection)}function Ne(e){let t=e?.activeProvider;return e?.modelSelectionExplicit===!0&&t!=null&&e.modelSelectionByProvider[t]!==void 0}function Q(e){return e.activeThread?c(e.activeThread.environmentId,e.activeThread.projectId):e.activeDraftThread?c(e.activeDraftThread.environmentId,e.activeDraftThread.projectId):e.defaultProjectRef}async function Pe(e){let t=Q(e);return t?(await e.handleNewThread(t),!0):!1}async function Fe(e,t){let n=await g(s,j(e,t,l),{reportDefect:!1,reportFailure:!1}),r=A(e,t,l,A(e,t,n._tag===`Success`?n.value.relativePath:l,n._tag===`Success`?n.value:null));return r===null||r.truncated?null:F(r.contents)}function $(e){return{...e?.branch===void 0?{}:{branch:e.branch},...e?.worktreePath===void 0?{}:{worktreePath:e.worktreePath},...e?.envMode===void 0?{}:{envMode:e.envMode},...e?.startFromOrigin===void 0?{}:{startFromOrigin:e.startFromOrigin}}}function Ie(){let e=(0,L.c)(7),t=a(T),o=ie(ae),s=S(),c;e[0]===s.state.matches?c=e[1]:(c=()=>{let e=s.state.matches[s.state.matches.length-1]?.params??{};return w(e)},e[0]=s.state.matches,e[1]=c);let l=c,u;return e[2]!==t||e[3]!==l||e[4]!==o||e[5]!==s?(u=(e,a)=>{let c=ne(),u=t.get(e.environmentId)?.settings??p,{getComposerDraft:g,getDraftSessionByLogicalProjectKey:_,getDraftSession:v,getDraftThread:ee,applyStickyState:b,setDraftThreadContext:x,setLogicalProjectDraftThreadId:S,setModelSelection:C}=i.getState(),w=s.state.location.href,ie=()=>s.state.location.href!==w,T=l(),E=T?.kind===`server`?y(T.threadRef):null,D=T?.kind===`draft`?v(T.draftId):null,O=T?g(T.kind===`server`?T.threadRef:T.draftId):null,k=O?.activeProvider??null,A=(k?O?.modelSelectionByProvider[k]??null:null)??E?.modelSelection??null,j=O?.interactionMode??E?.interactionMode??D?.interactionMode??null,M=c.find(t=>t.id===e.projectId&&t.environmentId===e.environmentId),N=()=>ie()||M!==void 0&&te(e)===null,P=oe(u,M?.id??null,M),ae=P.settings.defaultModelSelection,F=P.settings.defaultRuntimeMode,I=e=>Me({projectDefaultSelection:ae??null,carrySelection:A,carrySourceDraftId:T?.kind===`draft`?T.draftId:null,destinationDraftId:e}),L=async()=>{let n=M!==void 0&&P.settings.defaultThreadEnvMode===null?await Fe(M.environmentId,M.workspaceRoot):null;return se({projectSettings:oe(u,M?.id??null,M,n),workspaceRoot:M?.workspaceRoot??null,newProjectsRoot:t.get(e.environmentId)?.newProjectsRoot,projectHasThreads:re().some(t=>t.environmentId===e.environmentId&&t.projectId===e.projectId)})},R=M?ce(M,o):n(e),z=a?.branch!==void 0,B=a?.worktreePath!==void 0,V=a?.envMode!==void 0,H=a?.startFromOrigin!==void 0,U=_(R),W=U?h(U.environmentId,U.threadId):null,G=U!==null&&U.promotedTo==null&&W!==null&&y(W)===null?U:null;W&&G===null&&r(W);let K=G&&!d(g(G.draftId))?G:null,q=T?T.kind===`server`?ee(T.threadRef):v(T.draftId):null;if(K)return(async()=>{let t=T?.kind===`draft`&&T.draftId===K.draftId,n=z||B||V||H,r=null;if(n)r=$(a);else if(!t){let e=await L();if(N())return null;let t=l(),n=t?.kind===`draft`&&t.draftId===K.draftId,i=W!==null&&y(W)!==null,a=_(R)?.draftId!==K.draftId,o=d(g(K.draftId));if(n||i||a||o)return null;r={branch:null,worktreePath:null,envMode:e,startFromOrigin:Z({envMode:e,newWorktreesStartFromOrigin:P.settings.newWorktreesStartFromOrigin})}}if(r&&x(K.draftId,{...r,...t?{}:{runtimeMode:F},...j?{interactionMode:j}:{}}),!Ne(g(K.draftId))){b(K.draftId);let e=I(K.draftId);e&&C(K.draftId,e,{replaceOptions:!0})}S(R,e,K.draftId,{threadId:K.threadId,...r,...t?{}:{runtimeMode:F},...j?{interactionMode:j}:{}});let i={draftId:K.draftId,threadId:K.threadId},o=l();return o?.kind===`draft`&&o.draftId===K.draftId||await s.navigate({to:`/draft/$draftId`,params:{draftId:K.draftId},replace:a?.replace??!1}),i})();if(q&&T?.kind===`draft`&&q.logicalProjectKey===R&&q.promotedTo==null&&!d(g(T.draftId)))return(z||B||V||H)&&x(T.draftId,$(a)),S(R,e,T.draftId,{threadId:q.threadId,createdAt:q.createdAt,runtimeMode:q.runtimeMode,interactionMode:q.interactionMode,...$(a)}),Promise.resolve({draftId:T.draftId,threadId:q.threadId});let J=f(),Y=m(),le=new Date().toISOString();return(async()=>{let t=a?.envMode??await L();if(N())return null;let n=_(R);if(n&&n.draftId!==U?.draftId&&y(h(n.environmentId,n.threadId))===null)return S(R,e,n.draftId,{threadId:n.threadId,createdAt:n.createdAt,runtimeMode:n.runtimeMode,interactionMode:n.interactionMode,...$(a)}),await s.navigate({to:`/draft/$draftId`,params:{draftId:n.draftId},replace:a?.replace??!1}),{draftId:n.draftId,threadId:n.threadId};S(R,e,J,{threadId:Y,createdAt:le,branch:a?.branch??null,worktreePath:a?.worktreePath??null,envMode:t,startFromOrigin:a?.startFromOrigin??Z({envMode:t,newWorktreesStartFromOrigin:P.settings.newWorktreesStartFromOrigin}),runtimeMode:F,...j?{interactionMode:j}:{}}),b(J);let r=I(J);return r&&C(J,r,{replaceOptions:!0}),await s.navigate({to:`/draft/$draftId`,params:{draftId:J},replace:a?.replace??!1}),{draftId:J,threadId:Y}})()},e[2]=t,e[3]=l,e[4]=o,e[5]=s,e[6]=u):u=e[6],u}function Le(){let e=(0,L.c)(16),t=M(Ve),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={strict:!1,select:Be},e[0]=n):n=e[0];let r=C(n),a=r?.kind===`server`?r.threadRef:null,o=r?.kind===`draft`?r.draftId:null,s=ee(a),l=i(ze),u;e[1]!==l||e[2]!==r?(u=()=>r?r.kind===`server`?l(r.threadRef):i.getState().getDraftSession(r.draftId):null,e[1]=l,e[2]=r,e[3]=u):u=e[3];let d=i(u),f=v(),p;e[4]!==t||e[5]!==f?(p=_e({items:f,preferredIds:t,getId:P,getPreferenceIds:Re}),e[4]=t,e[5]=f,e[6]=p):p=e[6];let m=p,h=Ie(),g;e[7]===m[0]?g=e[8]:(g=m[0]?c(m[0].environmentId,m[0].id):null,e[7]=m[0],e[8]=g);let _;return e[9]!==d||e[10]!==s||e[11]!==h||e[12]!==o||e[13]!==a||e[14]!==g?(_={activeDraftThread:d,activeThread:s,defaultProjectRef:g,handleNewThread:h,routeDraftId:o,routeThreadRef:a},e[9]=d,e[10]=s,e[11]=h,e[12]=o,e[13]=a,e[14]=g,e[15]=_):_=e[15],_}function Re(e){return[P(e),N(e.workspaceRoot)]}function ze(e){return e.getDraftThread}function Be(e){return w(e)}function Ve(e){return e.projectOrder}export{V as A,Ce as C,je as D,Oe as E,Ae as O,de as S,ke as T,ye as _,Q as a,U as b,K as c,ve as d,be as f,Se as g,_e as h,Z as i,ue as j,H as k,W as l,me as m,Ie as n,Pe as o,ge as p,Ne as r,G as s,Le as t,Ee as u,we as v,pe as w,xe as x,Te as y};
|
|
2
|
-
//# sourceMappingURL=useHandleNewThread-lAV5NpwQ.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-nxAoxVO6.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-CLQYZa7I.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{Mx as n,ha as r,sr as i}from"./utils-Cbsb1ks0.js";import{t as a}from"./circle-check-Y1T60J9X.js";var o=n(),s=e(r(),1);function c(e){let t=(0,o.c)(7),{permissions:n,busy:r}=e,c=r!==void 0&&r,l;if(t[0]!==c||t[1]!==n){let e;t[3]===c?e=t[4]:(e=e=>(0,s.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border px-3 py-2`,children:[e.icon,(0,s.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,s.jsx)(`p`,{className:`font-medium`,children:e.title}),(0,s.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.description})]}),e.granted?(0,s.jsxs)(`span`,{role:`status`,className:`flex items-center gap-1 text-xs text-success`,children:[(0,s.jsx)(a,{className:`size-4`,"aria-hidden":`true`}),`Allowed`]}):(0,s.jsx)(i,{size:`xs`,variant:`outline`,disabled:c,onClick:e.onAllow,children:`Allow`})]},e.id),t[3]=c,t[4]=e),l=n.map(e),t[0]=c,t[1]=n,t[2]=l}else l=t[2];let u;return t[5]===l?u=t[6]:(u=(0,s.jsx)(`div`,{className:`space-y-2`,children:l}),t[5]=l,t[6]=u),u}function l(e){let t=(0,o.c)(9),n,r,a,c;t[0]===e?(n=t[1],r=t[2],a=t[3],c=t[4]):({ready:r,busy:a,children:c,...n}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=c);let l=a!==void 0&&a,u=c===void 0?`Continue`:c,d=!r||l,f;return t[5]!==u||t[6]!==n||t[7]!==d?(f=(0,s.jsx)(i,{...n,disabled:d,children:u}),t[5]=u,t[6]=n,t[7]=d,t[8]=f):f=t[8],f}var u=e(t(),1);function d(e,t,n){let r=(0,o.c)(12),i=n===void 0||n,[a,s]=(0,u.useState)(t),[c,l]=(0,u.useState)(null),d=(0,u.useEffectEvent)(e),f;r[0]!==d||r[1]!==i?(f=()=>{if(!i)return;let e=!1,t=!1,n=async()=>{if(!(e||t||document.visibilityState===`hidden`)){t=!0;try{let t=await d();e||(s(t),l(null))}catch{e||l(`Could not check permissions. We'll try again automatically.`)}t=!1}};n();let r=window.setInterval(()=>void n(),1500);return window.addEventListener(`focus`,n),document.addEventListener(`visibilitychange`,n),()=>{e=!0,window.clearInterval(r),window.removeEventListener(`focus`,n),document.removeEventListener(`visibilitychange`,n)}},r[0]=d,r[1]=i,r[2]=f):f=r[2];let p;r[3]===i?p=r[4]:(p=[i],r[3]=i,r[4]=p),(0,u.useEffect)(f,p);let m;r[5]!==c||r[6]!==a?(m=e=>c===null&&e.every(e=>a[e]),r[5]=c,r[6]=a,r[7]=m):m=r[7];let h;return r[8]!==c||r[9]!==a||r[10]!==m?(h={status:a,error:c,isReady:m},r[8]=c,r[9]=a,r[10]=m,r[11]=h):h=r[11],h}export{c as n,l as r,d as t};
|
|
2
|
-
//# sourceMappingURL=usePermissionStatus-CVCguZPP.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{Ln as n,Oa as r}from"./utils-Cbsb1ks0.js";var i=e(t());function a(e,t,a,o,s=!0){let{registerFieldControl:c}=n(),l=i.useRef(null);l.current||=Symbol(),r(()=>{let n=l.current;if(n&&s)return c(n,{controlRef:e,getValue:o,id:t,value:a}),()=>{c(n,void 0)}},[e,s,o,t,c,a])}export{a as t};
|
|
2
|
-
//# sourceMappingURL=useRegisterFieldControl-hMeYQdpT.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{Ht as e,Mx as t,Nt as n,Vt as r}from"./utils-Cbsb1ks0.js";import{E as i,i as a}from"./useSettings-BCUX_14n.js";import{B as o}from"./settingsLayout-BUbXPq57.js";var s=t();function c(t,c){let l=(0,s.c)(5),{targets:u}=o(),{environments:d}=i(),f;return l[0]!==c||l[1]!==d||l[2]!==t||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=n(a(c.settings,t),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]=t,l[3]=u,l[4]=f):f=l[4],f}export{c as t};
|
|
2
|
-
//# sourceMappingURL=useScopedModelAvailability-1rkaoEPh.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{$b as n,Al as r,Bl as i,Dh as a,Eh as o,Fb as s,Fl as c,Gh as l,Gl as u,Ho as d,Kf as f,Km as p,Ko as m,Mx as ee,Nb as h,Ol as te,Ph as ne,Pp as re,Qh as ie,Rf as ae,Ro as oe,S_ as se,Sh as ce,Sl as le,Tl as ue,Ul as de,Uo as fe,Wh as pe,Wl as me,Wo as he,Zg as ge,Zm as _e,_m as ve,ah as ye,al as be,bh as xe,bm as Se,eg as Ce,es as g,ex as _,fs as we,gh as Te,gs as Ee,gu as De,hm as Oe,hs as ke,ig as Ae,il as je,ix as Me,jb as v,jl as Ne,js as Pe,lh as Fe,mh as Ie,rg as Le,sl as Re,tg as ze,vs as Be,w_ as Ve,wl as He,xm as Ue,yc as We,ym as Ge}from"./utils-Cbsb1ks0.js";import{F as Ke,L as qe,T as Je,U as Ye,gt as y,kt as Xe,w as Ze,xn as Qe}from"./runtime-CBB2It1x.js";import{Ct as $e,T as et,t as tt,yt as nt}from"./runtime-Dydpcwo9.js";import{i as b}from"./toast-DEgXlTR7.js";import{f as x,h as S,m as rt,u as it}from"./server-FMafPUns.js";import{i as at,n as ot,s as st,t as ct}from"./session-BI6WO3-p.js";import{t as lt}from"./use-atom-command-BVrZ0hTO.js";import{B as ut,C as dt,F as ft,N as pt,P as mt,V as ht,b as gt,c as _t,i as C,k as vt,l as yt,n as w,o as bt,r as xt,v as St,w as Ct,x as wt}from"./themePalette-C1oD3Oeg.js";var T=e(t(),1),E=ee();function Tt(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 Et(e){let t=he(t=>m(r=>{let i=r(e.catalogValueAtom).entries.get(t);if(i===void 0)return null;let a=n(ke(r(e.stateAtom(t))),()=>Qe);return{entry:i,connection:i.unsupportedReason===void 0?$e(a):{phase:`unsupported`,error:i.unsupportedReason,traceId:null},serverConfig:r(e.serverConfigValueAtom(t))}}).pipe(g(`environment-presentation:${t}`))),r=new Map;return{presentationAtom:t,presentationsAtom:m(n=>{let i=new Map;for(let r of n(e.catalogValueAtom).entries.keys()){let e=n(t(r));e!==null&&i.set(r,e)}return Tt(r,i)||(r=i),r}).pipe(g(`environment-presentations`))}}function Dt(e,t){return{environmentId:e,environmentLabel:t.entry.target.label,displayUrl:nt(t.entry)??``,isRelayManaged:Xe(t.entry),isEnabled:t.entry.enabled,connectionState:t.connection.phase,connectionError:t.connection.error,connectionErrorTraceId:t.connection.traceId}}function Ot(e){let t=m(t=>{let n=[...t(e.catalogValueAtom).entries.keys()],r=_(t.self());return r!==null&&r.length===n.length&&n.every((e,t)=>e===r[t])?r:n}),n=m(t=>{let n=[...t(e.catalogValueAtom).entries].map(([e,t])=>({environmentId:e,label:t.target.label})),r=_(t.self());return r!==null&&r.length===n.length&&n.every((e,t)=>e.environmentId===r[t]?.environmentId&&e.label===r[t]?.label)?r:n}),r=he(t=>m(n=>{let r=n(e.presentationAtom(t));if(r===null)return null;let i=Dt(t,r),a=_(n.self());return a!==null&&a.environmentId===i.environmentId&&a.environmentLabel===i.environmentLabel&&a.displayUrl===i.displayUrl&&a.isRelayManaged===i.isRelayManaged&&a.isEnabled===i.isEnabled&&a.connectionState===i.connectionState&&a.connectionError===i.connectionError&&a.connectionErrorTraceId===i.connectionErrorTraceId?a:i})),i=m(t=>{let n=[];for(let i of t(e.catalogValueAtom).entries.keys()){let e=t(r(i));e!==null&&n.push(e)}let i=_(t.self());return i!==null&&i.length===n.length&&n.every((e,t)=>e===i[t])?i:n}).pipe(g(`environment-connection-summaries`));return{environmentIdsAtom:t,connectedEnvironmentIdsAtom:m(e=>{let n=e(t).filter(t=>e(r(t))?.connectionState===`connected`),i=_(e.self());return i!==null&&i.length===n.length&&n.every((e,t)=>e===i[t])?i:n}),identitiesAtom:n,environmentsAtom:i,machineByIdAtom:m(n=>{let r=new Map(n(t).map(t=>[t,Re(n(e.presentationAtom(t))?.serverConfig??null)])),i=_(n.self());return i!==null&&Tt(i,r)?i:r}),pullRequestsSupportedAtom:m(n=>n(t).some(t=>n(e.presentationAtom(t))?.serverConfig?.environment.capabilities.pullRequests===!0))}}var D=Et({catalogValueAtom:S.catalogValueAtom,stateAtom:S.stateAtom,serverConfigValueAtom:x.configValueAtom}),kt=Ot({catalogValueAtom:S.catalogValueAtom,presentationAtom:D.presentationAtom}),At=m(null).pipe(g(`web-environment-presentation:empty`));function jt(e){let t=(0,E.c)(5),n=d(S.catalogValueAtom),r;t[0]===e?r=t[1]:(r=e===null?At:D.presentationAtom(e),t[0]=e,t[1]=r);let i=d(r),a;return t[2]!==n.isReady||t[3]!==i?(a={isReady:n.isReady,presentation:i},t[2]=n.isReady,t[3]=i,t[4]=a):a=t[4],a}var Mt={status:`idle`},O=Mt,k=null,A=[],j=0,Nt=new Set;function M(e){O=e;for(let e of Nt)e()}function Pt(e){k?.resolve(e);for(let t of A)t.resolve(e);k=null,A=[]}function Ft(){return O}function It(e){return Nt.add(e),()=>{Nt.delete(e)}}function Lt(){j+=1;let e=!0;return()=>{e&&(e=!1,j=Math.max(0,j-1),j===0&&(Pt(!1),M(Mt)))}}function Rt(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 zt(){return O.status!==`idle`||k!==null||A.length>0}function Bt(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 Vt(){if(O.status!==`closing`)return;let e=A.shift();if(!e){M(Mt);return}k=e,M({status:`confirming`,message:e.message,variant:e.variant})}var Ht={Ctrl:`⌃`,Alt:`⌥`,Shift:`⇧`,Super:`⌘`,CmdOrCtrl:`⌘`};function Ut(e,t=navigator.platform){let n=e.split(`+`),r=n.pop()??``;return We(t)?`${n.map(e=>Ht[e]??e).join(``)}${r}`:[...n.map(e=>e===`CmdOrCtrl`?`Ctrl`:e===`Super`?`Meta`:e),r].join(`+`)}var Wt=`http://www.w3.org/2000/svg`,Gt={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 Kt(e,t){let n=Gt[e];if(!n||typeof document.createElementNS!=`function`)return null;let r=document.createElementNS(Wt,`svg`);r.setAttribute(`xmlns`,Wt),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(Wt,e.tag);for(let[n,r]of Object.entries(e.attrs))t.setAttribute(n,r);r.appendChild(t)}return r}function qt(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 Jt(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 Yt(){return N!==null}function Xt(){N?.(),N=null}function Zt(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=Jt(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&&!Jt(e.target,i)&&l(null)},f=e=>{s&&!Jt(e.target,i)&&(e.preventDefault(),l(null))},p=e=>{for(;i.length>e;)a.pop()?.setAttribute(`aria-expanded`,`false`),i.pop()?.remove()},m=(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?Kt(`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=Kt(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=Ut(t.accelerator),e.setAttribute(`aria-hidden`,`true`),a.setAttribute(`aria-keyshortcuts`,t.accelerator.replace(`CmdOrCtrl`,We(navigator.platform)?`Meta`:`Control`)),a.appendChild(e)}if(e){a.setAttribute(`aria-haspopup`,`menu`),a.setAttribute(`aria-expanded`,`false`);let e=Kt(`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;m(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&&qt(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(()=>{qt(c,t,n)})};document.addEventListener(`keydown`,u),document.addEventListener(`pointerdown`,d,!0),document.addEventListener(`contextmenu`,f,!0),m(e,t?.x??0,t?.y??0,0),N&&N(),N=c,requestAnimationFrame(()=>{s=!0})})}var Qt=`t3code:client-settings:v1`;function $t(){return typeof window<`u`}function en(){return $t()?Ee(Qt,le):null}function tn(e){$t()&&Be(Qt,e,le)}var nn;function rn(){return{dialogs:{pickFolder:async e=>window.desktopBridge?window.desktopBridge.pickFolder(e):null,confirm:async(e,t)=>Rt(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):Zt(e,t),close:async()=>{window.desktopBridge||Xt()}},persistence:{getClientSettings:async()=>window.desktopBridge?window.desktopBridge.getClientSettings():en(),setClientSettings:async e=>{if(window.desktopBridge)return window.desktopBridge.setClientSettings(e);tn(e)}}}}function an(){return rn()}function on(){if(typeof window<`u`)return nn||(nn=an(),nn)}function sn(){let e=on();if(!e)throw Error(`Local API not found`);return e}var P=`t3code:theme`,cn=`(prefers-color-scheme: dark)`,F={theme:`system`,resolvedTheme:`light`,systemDark:!1,followSystem:!0,appearanceMode:`system`,themeHalves:null};function ln(){return I()}function un(){return typeof window>`u`?{}:dn()}function I(){if(typeof window>`u`)return null;try{return vt(window.localStorage.getItem(C))}catch{return null}}function dn(){try{let e=JSON.parse(window.localStorage.getItem(`t3code:theme-halves:v1`)??`null`);if(typeof e!=`object`||!e)return{};let t={};for(let n of[`light`,`dark`]){let r=e[n];typeof r==`string`&&(t[n]=r)}return t}catch{return{}}}function fn(e){return`${e?.light??``}|${e?.dark??``}`}var pn=`theme-color`,mn=`meta[name="${pn}"][data-dynamic-theme-color="true"]`,L=class extends Fe()(`ThemeStorageError`,{operation:_e([`read`,`write`]),storageKey:ye,theme:ne(bt),cause:p()}){get message(){return`Failed to ${this.operation} theme preference for ${this.storageKey}.`}},hn=a(L),gn=class extends Fe()(`DesktopThemeSyncError`,{theme:bt,cause:p()}){get message(){return`Failed to sync the ${this.theme} theme to the desktop shell.`}},_n=a(gn),R=[],z=null,vn=!0,yn=null,B=null,V=null;function H(){vn=!0;for(let e of R)e()}function bn(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(cn).matches}function xn(e){if(typeof window>`u`)return e===`system`;try{let e=window.localStorage.getItem(xt);if(e===`true`)return!0;if(e===`false`)return!1}catch{}return e===`system`}function Sn(e){return e===`light`||e===`dark`||e===`system`}function U(e){if(typeof window<`u`)try{let e=window.localStorage.getItem(w);if(Sn(e))return e}catch{}return xn(e)?`system`:gt(e)??`light`}function Cn(e){if(typeof window<`u`)try{window.localStorage.setItem(w,e)}catch(e){throw new L({operation:`write`,storageKey:w,cause:e})}}function wn(){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&&Ct(e)?yt(e):F.theme}function Tn(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 wn()}catch(e){let t=hn(e)?e:new L({operation:`read`,storageKey:P,cause:e});return V=t,console.error(t.message,{operation:t.operation,storageKey:t.storageKey,...y(t)}),F.theme}}function En(){let e=document.querySelector(mn);return e||(e=document.createElement(`meta`),e.name=pn,e.setAttribute(`data-dynamic-theme-color`,`true`),document.head.append(e),e)}function Dn(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 On(){return document.querySelector(`main[data-slot='sidebar-inset']`)??document.querySelector(`[data-slot='sidebar-inner']`)??document.body}function kn(){if(typeof document>`u`||typeof getComputedStyle>`u`)return;let e=getComputedStyle(document.documentElement),t=document.documentElement.dataset.themeId?Dn(e.getPropertyValue(`--app-chrome-background`)):null,n=Dn(getComputedStyle(On()).backgroundColor),r=Dn(getComputedStyle(document.body).backgroundColor),i=t??n??r;if(!i)return;document.documentElement.style.backgroundColor=i,document.body.style.backgroundColor=i;let a=document.querySelectorAll(`meta[name="${pn}"]`);if(a.length===0){En().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?bn():!1,o=I();if(B?.theme===e&&B.systemDark===a&&B.followSystem===i&&B.appearanceMode===r&&fn(B.themeHalves)===fn(o)){jn(e,i,r);return}t&&document.documentElement.classList.add(`no-transitions`);let s=mt(e,a,i,r,o);_t(ft(e,o,s),s),document.documentElement.classList.toggle(`dark`,s===`dark`),B={theme:e,systemDark:a,followSystem:i,appearanceMode:r,themeHalves:o},kn(),jn(e,i,r),t&&(document.documentElement.offsetHeight,requestAnimationFrame(()=>{document.documentElement.classList.remove(`no-transitions`)}))}async function An(e,t,n,r,i=I()){try{await e.setTheme(pt(t,n,r,i))}catch(e){throw new gn({theme:t,cause:e})}}function jn(e,t,n){if(typeof window>`u`)return;let r=window.desktopBridge,i=I(),a=pt(e,t,n,i);r&&typeof r.setTheme==`function`&&yn!==a&&(yn=a,An(r,e,t,n,i).catch(t=>{let n=_n(t)?t:new gn({theme:e,cause:t});console.error(n.message,{theme:n.theme,...y(n)}),yn===a&&(yn=null)}))}typeof document<`u`&&typeof window<`u`&&G(W());function Mn(){if(typeof window>`u`)return F;if(!vn&&z)return z;vn=!1;let e=W(),t=U(e),n=t===`system`,r=n?bn():!1,i=I(),a=mt(e,r,n,t,i);return z&&z.theme===e&&z.resolvedTheme===a&&z.systemDark===r&&z.followSystem===n&&z.appearanceMode===t&&fn(z.themeHalves)===fn(i)||(z={theme:e,resolvedTheme:a,systemDark:r,followSystem:n,appearanceMode:t,themeHalves:i}),z}function Nn(){return F}function Pn(){let e=W();U(e)===`system`&&G(e,{suppressTransitions:!0}),H()}function Fn(e){e.key===P?(V=null,G(W(),{suppressTransitions:!0}),H()):e.key===`t3code:theme-follow-system`||e.key===`t3code:theme-appearance-mode`||e.key===`t3code:theme-halves:v1`?(G(W(),{suppressTransitions:!0}),H()):(e.key===`t3code:themes:v1`||e.key===null)&&(e.key===null&&(V=null),dt(),B=null,G(W(),{suppressTransitions:!0}),H())}var In=null;function Ln(e){if(typeof window>`u`)return()=>{};if(R.push(e),!In){let e=typeof window.matchMedia==`function`?window.matchMedia(cn):null;e?.addEventListener(`change`,Pn),window.addEventListener(`storage`,Fn),In=()=>{e?.removeEventListener(`change`,Pn),window.removeEventListener(`storage`,Fn)}}return()=>{R=R.filter(t=>t!==e),R.length===0&&(In?.(),In=null)}}function Rn(){let e=(0,T.useSyncExternalStore)(Ln,Mn,Nn),{theme:t,resolvedTheme:n}=e,r=(0,T.useCallback)(e=>{if(typeof window>`u`)return!1;try{Cn(U(W()));let t=window.localStorage.getItem(C);window.localStorage.removeItem(C);try{Tn(e)}catch(e){if(t!==null)try{window.localStorage.setItem(C,t)}catch{}throw e}}catch(t){let n=hn(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,...y(n)}),!1}return G(e,{suppressTransitions:!0}),H(),!0},[]),i=(0,T.useCallback)(e=>{if(typeof window>`u`)return!1;try{Cn(e)}catch(e){let t=hn(e)?e:new L({operation:`write`,storageKey:w,cause:e});return console.error(t.message,{operation:t.operation,storageKey:t.storageKey,...y(t)}),!1}return V=null,G(W(),{suppressTransitions:!0}),H(),!0},[]),a=(0,T.useCallback)(e=>{let n=U(t),r=e?`system`:n===`system`?gt(t)??`light`:n;return i(r)},[i,t]),o=(0,T.useCallback)((e,t)=>{if(typeof window>`u`)return!1;try{let n={...dn()};t===null?delete n[e]:n[e]=t,n.light===void 0&&n.dark===void 0?window.localStorage.removeItem(C):window.localStorage.setItem(C,JSON.stringify(n))}catch(e){let t=new L({operation:`write`,storageKey:C,cause:e});return console.error(t.message,{operation:t.operation,storageKey:t.storageKey,...y(t)}),!1}return G(W(),{suppressTransitions:!0}),H(),!0},[]),s=(0,T.useCallback)(()=>{if(typeof window>`u`)return!1;try{window.localStorage.removeItem(C)}catch(e){let t=new L({operation:`write`,storageKey:C,cause:e});return console.error(t.message,{operation:t.operation,storageKey:t.storageKey,...y(t)}),!1}return G(W(),{suppressTransitions:!0}),H(),!0},[]),c=(0,T.useCallback)(({preservePreview:e=!1}={})=>{typeof window<`u`&&(B=null,G(W(),{suppressTransitions:!0,preservePreview:e}),H())},[]);return(0,T.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 zn=Te(o(Ie)),Bn=Ae(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??``),zn(t).pipe(Ve(e=>e.issue))}),Vn=new ie(Bn,Le());ze().pipe(Ce(Le({space:2})));var Hn=e=>ye.pipe(xe(e,Vn)),Un={performance:{profile:`performance`,automaticGitFetchInterval:h(15),providerHealthRefreshInterval:v(1),hostPowerMonitorActiveInterval:h(30),hostPowerMonitorIdleInterval:v(2),idleClientTtl:h(45),pauseWhenHostLocked:!0,pauseWhenHostLowPower:!1,pauseWhenClientLowPower:!1,pauseWhenOnBattery:!1},balanced:{profile:`balanced`,automaticGitFetchInterval:He,providerHealthRefreshInterval:r,hostPowerMonitorActiveInterval:h(30),hostPowerMonitorIdleInterval:v(5),idleClientTtl:h(45),pauseWhenHostLocked:!0,pauseWhenHostLowPower:!0,pauseWhenClientLowPower:!0,pauseWhenOnBattery:!1},"battery-saver":{profile:`battery-saver`,automaticGitFetchInterval:h(0),providerHealthRefreshInterval:v(15),hostPowerMonitorActiveInterval:v(1),hostPowerMonitorIdleInterval:v(10),idleClientTtl:h(45),pauseWhenHostLocked:!0,pauseWhenHostLowPower:!0,pauseWhenClientLowPower:!0,pauseWhenOnBattery:!0}};function K(e){return Un[e]}function Wn(e){return e.profile===`custom`?e.baseProfile??`balanced`:e.profile}function Gn(e){let t=Wn(e),n=Un[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 s(e)===s(t)}function Kn(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 qn(e){if(e.profile!==`custom`)return{schemaVersion:1,profile:e.profile,overrides:{}};let t=Gn(e),n=[Wn(e),`balanced`,`performance`,`battery-saver`];for(let e of n)if(Kn(t,Un[e]))return{schemaVersion:1,profile:e,overrides:{}};let r=Wn(e),i=Un[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 Jn(e){let t={schemaVersion:1,profile:ue,overrides:{}},n=e.backgroundActivity.profile===t.profile&&e.backgroundActivity.baseProfile===void 0&&Object.keys(e.backgroundActivity.overrides).length===0,i=e.backgroundActivityProfile,a=i!==`balanced`||s(e.automaticGitFetchInterval)!==s(He)||s(e.providerHealthRefreshInterval)!==s(r);return Gn(n&&a?{schemaVersion:1,profile:s(e.automaticGitFetchInterval)===s(K(i).automaticGitFetchInterval)&&s(e.providerHealthRefreshInterval)===s(K(i).providerHealthRefreshInterval)?i:`custom`,baseProfile:i,overrides:{...s(e.automaticGitFetchInterval)===s(K(i).automaticGitFetchInterval)?{}:{automaticGitFetchInterval:e.automaticGitFetchInterval},...s(e.providerHealthRefreshInterval)===s(K(i).providerHealthRefreshInterval)?{}:{providerHealthRefreshInterval:e.providerHealthRefreshInterval}}}:e.backgroundActivity)}function Yn(e){let t=Jn(e);return qn({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 Xn=Hn(c);ce(Xn);function Zn(e,t){let n=e.providerInstances[t.instanceId];return n===void 0?i(t.instanceId):u(n)}var Qn=[`codex`,`claudeAgent`,`cursor`,`grok`,`muse`,`pi`,`opencode`,`antigravity`].map(e=>Ge.make(e));function $n(e,t,n){let r=[...Qn.map(e=>[Ue(e),e]),...n?.includeConfiguredInstances===!0?Object.entries(e).flatMap(([e,t])=>Qn.includes(t.driver)?[[Se.make(e),t.driver]]:[]):[]].find(([e,n])=>t(e,n));if(r===void 0)return null;let[i,a]=r,o=n?.defaultModelSelection,s=e[i]?.config;return o?.instanceId===i&&Pe(s?.customModels).some(e=>e.slug===o.model)?o:{instanceId:i,model:ve[a]??Oe[a]??`gpt-6-luna`}}function er(e,t,n){let r=e.sourceControlWriterModelSelection;if(!r||!me(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&&je(i)&&be(i)?r:e.textGenerationModelSelection}function tr(e,t,n){let r=e.reviewGuideModelSelection;if(r&&me(e,n,r.instanceId)){let e=t?.find(e=>e.instanceId===r.instanceId);if(t===void 0||e?.enabled===!0&&je(e)&&be(e))return r}return er(e,t,n)}function nr(e,t={}){return{favorites:e.favorites??t.favorites??[],providerModelPreferences:e.providerModelPreferences??t.providerModelPreferences??{}}}function rr(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 ir=new Set([`continueThreadsAfterServerUpdate`,`sidebarAutoSettleAfterDays`,`sidebarAutoSettleOnMerge`,`autoResumeLimitedThreads`,`snoozeLimitedThreads`,`newWorktreesStartFromOrigin`,`sourceControlWritingStyle`,`textGenerationModelSelection`]);function ar(e){let t={},n={};for(let[r,i]of Object.entries(e))ir.has(r)?t[r]=i:n[r]=i;return{sharedPatch:t,localPatch:n}}function or(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)||!Zn(n,{...n.textGenerationModelSelection,...e.textGenerationModelSelection}))&&(e=l(e,[`textGenerationModelSelection`])),t?.threadRestartContinuation===!0?e:l(e,[`continueThreadsAfterServerUpdate`])}function sr(e){return e.connection.phase===`connected`&&e.serverConfig?.environment.capabilities.threadAutoSettlement===!0}function cr(e){let t=e.atom(re(Je.pipe(se(e=>De(e.state)))),{initialValue:Ze});return{stateAtom:t,stateValueAtom:m(e=>n(ke(e(t)),()=>Ze)).pipe(g(`relay-environment-discovery-value`)),refresh:Ke(e,{label:`relay-environment-discovery:refresh`,concurrency:{mode:`singleFlight`,key:()=>`refresh`},execute:e=>Je.pipe(ge(e=>e.refresh))})}}var lr=cr(tt);function ur(e,t){return{...t,environmentId:e,label:t.entry.target.label,displayUrl:nt(t.entry),relayManaged:Xe(t.entry)}}function dr(){let e=(0,E.c)(7),t=d(S.catalogValueAtom),n=d(S.networkStatusValueAtom),r=d(D.presentationsAtom),i;e[0]===r?i=e[1]:(i=[...r.entries()].map(fr),e[0]=r,e[1]=i);let a=i,o;return e[2]!==t.isReady||e[3]!==a||e[4]!==n||e[5]!==r?(o={isReady:t.isReady,networkStatus:n,environments:a,presentationById:r},e[2]=t.isReady,e[3]=a,e[4]=n,e[5]=r,e[6]=o):o=e[6],o}function fr(e){let[t,n]=e;return ur(t,n)}function pr(){return d(rt)}function mr(e){let t=(0,E.c)(3),{presentation:n}=jt(e),r;return t[0]!==e||t[1]!==n?(r=e===null||n===null?null:ur(e,n),t[0]=e,t[1]=n,t[2]=r):r=t[2],r}function J(){return mr(pr())}function hr(e){let t=(0,E.c)(2),n=st(e),r;return t[0]===n?r=t[1]:(r=Me(n)?n.value.httpBaseUrl:null,t[0]=n,t[1]=r),r}function gr(){return d(lr.stateValueAtom)}function _r(){return d(kt.environmentIdsAtom)}function vr(){return d(kt.identitiesAtom)}function yr(){return d(kt.pullRequestsSupportedAtom)}var br=`[CLIENT_SETTINGS]`,xr=new Set,Sr=new Set,Cr=te,Y=`pending`,X=null,wr=0,Tr=Promise.resolve(),Er=0;function Dr(){for(let e of xr)e()}function Or(){for(let e of Sr)e()}function Z(){return Cr}function kr(e){Cr=e,Dr()}function Ar(e){Y!==e&&(Y=e,Or())}function jr(e){return xr.add(e),Q().catch(()=>void 0),()=>{xr.delete(e)}}function Mr(){return Y===`ready`}function Nr(){return Y}function Pr(e){return Sr.add(e),Q().catch(()=>void 0),()=>{Sr.delete(e)}}async function Q(){if(Y===`ready`)return;if(X)return X;let e=wr;Ar(Y===`failed`||Y===`retrying`?`retrying`:`pending`);let t=(async()=>{try{let t=await sn().persistence.getClientSettings();if(e!==wr)return;t&&kr({...te,...t}),Ar(`ready`)}catch(t){throw e===wr&&Ar(`failed`),console.error(`${br} hydrate failed`,{operation:`hydrate`,...y(t)}),t}})().finally(()=>{X===t&&(X=null)});return X=t,X}var Fr=e=>sn().persistence.setClientSettings(e);function Ir(e){let t=Tr.then(e);return Tr=t.then(()=>void 0,()=>void 0),t}function Lr(e,t=Fr){let n=Y!==`ready`||Er>0;return n?Er+=1:kr({...Z(),...e}),Ir(async()=>{if(n)try{Y!==`ready`&&await Q(),kr({...Z(),...e})}finally{--Er}await t(Z())}).catch(e=>{console.error(`${br} persist failed`,{operation:`persist`,...y(e)})})}async function Rr(e,t=Fr){return Ir(async()=>{for(Y!==`ready`&&await Q();;){let n=Z(),r=e(n);if(await t(r),Z()===n)return kr(r),r}})}var zr=new Set(pe(c.fields));function Br(e){let t={},n={};for(let[r,i]of Object.entries(e))zr.has(r)?t[r]=i:n[r]=i;return{serverPatch:t,clientPatch:n}}function Vr(){return Z()}function Hr(){return Q()}function Ur(){return(0,T.useSyncExternalStore)(Pr,Mr,Wr)}function Wr(){return!1}function Gr(){return(0,T.useSyncExternalStore)(Pr,Nr,Kr)}function Kr(){return`pending`}function $(){return(0,T.useSyncExternalStore)(jr,Z,qr)}function qr(){return te}function Jr(e,t){return{...t,...e,...nr(e,t)}}var Yr=new Set;function Xr(e,t){let n=(0,E.c)(8),r=$(),i=Ur(),a;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={reportFailure:!1},n[0]=a):a=n[0];let o=lt(x.updateSettings,a),s,c;n[1]!==r||n[2]!==e||n[3]!==i||n[4]!==o||n[5]!==t?(s=()=>{if(!e||!t||!i||Yr.has(e))return;let n=rr(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,T.useEffect)(s,c)}function Zr(e,t){let n=(0,E.c)(6),r=$(),i;n[0]!==r||n[1]!==e?(i=Jr(e,r),n[0]=r,n[1]=e,n[2]=i):i=n[2];let a=i,o;return n[3]!==a||n[4]!==t?(o=t?t(a):a,n[3]=a,n[4]=t,n[5]=o):o=n[5],o}function Qr(e){let t=(0,E.c)(3),n=$(),r;return t[0]!==e||t[1]!==n?(r=e?e(n):n,t[0]=e,t[1]=n,t[2]=r):r=t[2],r}function $r(e){return e.settingsHydrated?e.paletteThemeActive&&!e.paletteThemeAllowsArtwork&&e.mode===`artwork`?`pill`:e.mode:`none`}function ei(){let e=(0,E.c)(7),t=Ur(),n=$().environmentIdentificationMode,{resolvedTheme:r,theme:i,themeHalves:a}=Rn(),o=(0,T.useSyncExternalStore)(ut,wt,ti),s;if(e[0]!==n||e[1]!==o||e[2]!==r||e[3]!==t||e[4]!==i||e[5]!==a){let c=ft(i,a,r),l=St(c);s=$r({mode:n,settingsHydrated:t,paletteThemeActive:o!==null||l!==null,paletteThemeAllowsArtwork:o??ht(c)}),e[0]=n,e[1]=o,e[2]=r,e[3]=t,e[4]=i,e[5]=a,e[6]=s}else s=e[6];return s}function ti(){return null}async function ni(e,t){return(e.favorites===null||e.providerModelPreferences===null)&&await Hr(),{...rr(e,Vr()),...t}}function ri(e){let t=(0,E.c)(6),n;t[0]===e?n=t[1]:(n=e?x.settingsValueAtom(e):ai,t[0]=e,t[1]=n);let r=d(n),i=lt(x.updateSettings,`model preferences update`),a;return t[2]!==e||t[3]!==i||t[4]!==r?(a=async t=>{if(!e||!r)return;let n;try{n=await ni(r,t)}catch{b.add({type:`error`,title:`Model preferences not saved`,description:`Could not load saved model preferences. Try again.`});return}return i({environmentId:e,input:{patch:n}})},t[2]=e,t[3]=i,t[4]=r,t[5]=a):a=t[5],a}function ii(e){let t=(0,T.use)(fe),n=(0,T.useRef)(new Map),r=ri(e);return(0,T.useCallback)(async(i,a)=>{if(!e)return;let o=x.settingsValueAtom(e),s=t.get(o);if(!s)return;if(s.favorites===null)try{await Hr()}catch{b.add({type:`error`,title:`Favorites not saved`,description:`Could not load saved model preferences. Try again.`});return}let c=t.get(o)??s,l=nr(c,Vr()).favorites,u=JSON.stringify([e,i,a]),d=n.current.get(u),f={favorite:!(d&&(d.pending||d.settings.favorites===c.favorites)?d.favorite:l.some(e=>e.provider===i&&e.model===a)),settings:c,pending:!0};n.current.set(u,f);try{let e=await r({setModelFavorites:[{provider:i,model:a,favorite:f.favorite}]});e&&we(e)&&t.get(o)?.favorites===c.favorites&&(f.pending=!1)}finally{f.pending&&n.current.get(u)===f&&(d&&!d.pending&&t.get(o)?.favorites===d.settings.favorites?n.current.set(u,d):n.current.delete(u))}},[e,t,r])}var ai=m(null);function oi(e){let t=(0,E.c)(5),n;t[0]===e?n=t[1]:(n=e?x.settingsValueAtom(e):ai,t[0]=e,t[1]=n);let r=d(n),i=$();Xr(e,r);let a=r??Ne,o;return t[2]!==i||t[3]!==a?(o=nr(a,i),t[2]=i,t[3]=a,t[4]=o):o=t[4],o}function si(e,t){let n=(0,E.c)(2),r;n[0]===e?r=n[1]:(r=x.settingsValueAtom(e),n[0]=e,n[1]=r);let i=d(r);return Xr(e,i),Zr(i??Ne,t)}function ci(e){let t=(0,E.c)(4),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={reportFailure:!1},t[0]=n):n=t[0];let r=lt(x.mutateProviderInstance,n),i;return t[1]!==e||t[2]!==r?(i=(t,n)=>r({environmentId:e,input:{patch:n===void 0?{}:n,providerInstanceMutation:t}}),t[1]=e,t[2]=r,t[3]=i):i=t[3],i}function li(e){let t=J(),n=d(it);return Xr(t?.environmentId??null,t?.serverConfig?.settings??null),Zr(n,e)}var ui=`This setting is saved on a server, and the hosted app is not anchored to one. Change it from the desktop app or from the server's own address.`;function di(){let e=(0,E.c)(2),t=J(),n;return e[0]===t?n=e[1]:(n=t!==null||!et(),e[0]=t,e[1]=n),n}function fi(e){let t=(0,E.c)(3),n=e!==void 0&&e,{environments:r}=dr(),i;return t[0]!==r||t[1]!==n?(i=m(e=>r.filter(sr).flatMap(t=>{let r=e(ct.sessionStateAtom(t.environmentId));if(n&&r._tag===`Initial`)return[t.environmentId];let i=r._tag===`Failure`?null:_(ke(r));return i!==null&&f(i,`settings:write`)?[t.environmentId]:[]})),t[0]=r,t[1]=n,t[2]=i):i=t[2],d(i)}function pi(e){let t=(0,E.c)(10);at(e,ae);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=lt(x.updateSettings,n),{environments:i}=dr(),a;t[1]!==i||t[2]!==r?(a=async e=>{let t=await r(e);if(t._tag===`Failure`&&!qe(t)){let n=i.find(t=>t.environmentId===e.environmentId)?.label??e.environmentId,r=Ye(t);b.add({type:`error`,title:`Setting not saved`,description:`Could not save on ${n}: ${r instanceof Error?r.message:`The save failed. Try reconnecting and saving again.`}`})}return t},t[1]=i,t[2]=r,t[3]=a):a=t[3];let o=a,s=fi(!0),c;return t[4]!==e||t[5]!==i||t[6]!==r||t[7]!==o||t[8]!==s?(c=t=>{let{serverPatch:n,clientPatch:a}=Br(t),c=e===null||de(n).every(t=>ot(e,t));if(Object.keys(n).length>0&&!c&&b.add({type:`warning`,title:`Setting not saved`,description:`This connection lacks permission to change settings on ${i.find(t=>t.environmentId===e)?.label??`the selected environment`}.`}),Object.keys(n).length>0&&c){let{sharedPatch:t,localPatch:a}=ar(n),c=vi;if(Object.keys(a).length>0&&(e?o({environmentId:e,input:{patch:a}}):c()),Object.keys(t).length>0){let n=i.find(t=>t.environmentId===e)?.serverConfig?.settings,a=new Set(s);e&&a.add(e);let o=[],l=[];for(let r of a){let a=i.find(e=>e.environmentId===r),s=or(t,a?.serverConfig?.environment.capabilities,a?.serverConfig?.settings,n,r===e);if(Object.keys(s).length!==0){if(oe.get(ct.sessionStateAtom(r))._tag!==`Initial`&&!de(t).every(e=>ot(r,e))){l.push(a?.label??r);continue}o.push({environmentId:r,input:{patch:s}})}}o.length===0?c(l.length>0?`This connection lacks permission to change settings on ${l.join(`, `)}.`:a.size>0?`Update older servers to save this setting.`:void 0):Promise.all(o.map(async e=>({label:i.find(t=>t.environmentId===e.environmentId)?.label??e.environmentId,result:await r(e)}))).then(mi)}}Object.keys(a).length>0&&Lr(a)},t[4]=e,t[5]=i,t[6]=r,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function mi(e){let t=e.flatMap(_i);if(t.length===0)return;let n=e.filter(gi).map(hi);b.add({type:`error`,title:n.length>0?`Setting saved on some environments`:`Setting not saved`,description:[...t,...n.length>0?[`Saved on ${n.join(`, `)}.`]:[]].join(`
|
|
2
|
-
`)})}function hi(e){let{label:t}=e;return t}function gi(e){let{result:t}=e;return t._tag===`Success`}function _i(e){let{label:t,result:n}=e;if(n._tag!==`Failure`||qe(n))return[];let r=Ye(n);return[`Could not save on ${t}: ${r instanceof Error?r.message:`The save failed. Try reconnecting and saving again.`}`]}function vi(e){let t=e===void 0?ui:e;return b.add({type:`warning`,title:`Setting not saved`,description:t})}function yi(e){return pi(e)}function bi(){return pi(J()?.environmentId??null)}function xi(){return Si}function Si(e){return Lr(e)}export{Lt as $,gr as A,Hn as B,hr as C,J as D,dr as E,Wn as F,kn as G,ln as H,K as I,on as J,Rn as K,qn as L,$n as M,tr as N,pr as O,er as P,Ft as Q,Yn as R,mr as S,_r as T,un as U,U as V,wn as W,Vt as X,Yt as Y,zt as Z,ii as _,Lr as a,yi as b,Ur as c,oi as d,Rt as et,si as f,di as g,li as h,Jr as i,jt as it,lr as j,yr as k,Gr as l,ci as m,Hr as n,It as nt,Rr as o,Xr as p,sn as q,Vr as r,D as rt,Qr as s,ui as t,Bt as tt,ei as u,xi as v,vr as w,bi as x,ri as y,Jn as z};
|
|
3
|
-
//# sourceMappingURL=useSettings-BCUX_14n.js.map
|