@p4code/cli 0.9.15 → 0.9.17
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/AcpMcpStdioBridge-Bv41U5Ym.mjs +3 -0
- package/dist/{AcpMcpStdioBridge-BPNHFfTr.mjs → AcpMcpStdioBridge-CvhQaaYj.mjs} +3 -3
- package/dist/{Effect-COOccdaU.mjs → Effect-_Rz7VLdg.mjs} +33 -2
- package/dist/{Schema-BXiVImR2.mjs → Schema-APnY3Ozr.mjs} +2 -2
- package/dist/{Stream-D2XZdzH6.mjs → Stream-CJtpwu3-.mjs} +2 -2
- package/dist/bin.mjs +2 -2
- package/dist/{binCli-06acKUH_.mjs → binCli-B298WI-F.mjs} +6254 -4331
- package/dist/claude-history-worker.mjs +1 -1
- package/dist/{claudeHistoryWorker-BJKXFgWC.mjs → claudeHistoryWorker-Dgk6e0nY.mjs} +2 -2
- package/dist/client/.vite/manifest.json +2296 -2067
- package/dist/client/assets/{2NI2N5EU-CzVcbH89.js → 2NI2N5EU-D4f5i1y_.js} +2 -2
- package/dist/client/assets/{4UO7MD6I-DS3UFSUE.js → 4UO7MD6I-RrpAQ0X1.js} +2 -2
- package/dist/client/assets/{5B3SVYGG-lbor_c4_.js → 5B3SVYGG-ClZSmzf_.js} +2 -2
- package/dist/client/assets/{5GK6JWQ2-DufacBFC.js → 5GK6JWQ2-B1md9I9Z.js} +2 -2
- package/dist/client/assets/{5N7A7DKN-B3iWX-TC.js → 5N7A7DKN-BQIARO23.js} +2 -2
- package/dist/client/assets/{5OC2THR4-DoDDWXtD.js → 5OC2THR4-351ZCzKk.js} +2 -2
- package/dist/client/assets/{5S6HY5KT-7n94quvm.js → 5S6HY5KT-DmJkK7tt.js} +2 -2
- package/dist/client/assets/{6IMQ5BUJ-CqcR9lZq.js → 6IMQ5BUJ-BpvNx_p4.js} +2 -2
- package/dist/client/assets/{6OLKWJ4F-BeCI6be_.js → 6OLKWJ4F-C2xPWRsp.js} +2 -2
- package/dist/client/assets/{74OO7NKP-XWvi4Kgp.js → 74OO7NKP--xC0IYpN.js} +2 -2
- package/dist/client/assets/{75O6YZUN-BbbGiqdI.js → 75O6YZUN-CK0ONIHW.js} +2 -2
- package/dist/client/assets/{77XECAW3-BVGMXOi_.js → 77XECAW3-BcsWkjLy.js} +2 -2
- package/dist/client/assets/{ABYRPUBD-D4oehH5y.js → ABYRPUBD-D3uBdyxY.js} +2 -2
- package/dist/client/assets/AlertDialogRoot-CPanDrss.js +2 -0
- package/dist/client/assets/{AnimatedHeight-DT585xP0.js → AnimatedHeight-CVfEvZ5q.js} +2 -2
- package/dist/client/assets/{AuthSurfaceShell-C312CXz7.js → AuthSurfaceShell-Cfzl0v4C.js} +2 -2
- package/dist/client/assets/{BB2UYUI2-BkFcdWkE.js → BB2UYUI2-BOnjWgZo.js} +2 -2
- package/dist/client/assets/{BUM34MOA-DK6xDbTB.js → BUM34MOA-B7RHMom2.js} +2 -2
- package/dist/client/assets/{CEQABKGZ-rLn9wSBN.js → CEQABKGZ-Cc9Oxare.js} +2 -2
- package/dist/client/assets/{CXAC5362-C1eQCQMX.js → CXAC5362-BNdOJTpr.js} +2 -2
- package/dist/client/assets/ChatGptUsageButton-xIp-6pmC.js +2 -0
- package/dist/client/assets/{ChatMarkdown-BUoR67CT.js → ChatMarkdown-Bueup3X5.js} +24 -24
- package/dist/client/assets/CheckboxIndicator-Bx7Oi3gX.js +2 -0
- package/dist/client/assets/ClippedText-CIorIVl7.js +2 -0
- package/dist/client/assets/CodexSetupSection.logic-C7e1n48R.js +2 -0
- package/dist/client/assets/ComboboxClear-HZ-hIKnq.js +2 -0
- package/dist/client/assets/ComboboxGroupLabel-DUYNaL5F.js +2 -0
- package/dist/client/assets/{CommandBlock-40eSIrOe.js → CommandBlock-4iMcWKQI.js} +2 -2
- package/dist/client/assets/CompositeRoot-BBK88_pH.js +2 -0
- package/dist/client/assets/ConnectAgentSurface-BWOV2eWU.js +2 -0
- package/dist/client/assets/{ConnectionStatusDot-7Tjfknn6.js → ConnectionStatusDot-ChSEZVFH.js} +2 -2
- package/dist/client/assets/DRACOLoader-DluumOSd.js +3 -0
- package/dist/client/assets/{DRLTVNUE-BPoomdQn.js → DRLTVNUE-DFsymRUq.js} +2 -2
- package/dist/client/assets/{DYY6UVD2-BVvdA84B.js → DYY6UVD2-CBGlYjYj.js} +2 -2
- package/dist/client/assets/DevicePanel-DbUlYPs5.js +2 -0
- package/dist/client/assets/DeviceSetup-DwoJ9gYG.js +2 -0
- package/dist/client/assets/DialogTitle-CZ-x-t6r.js +2 -0
- package/dist/client/assets/{DiffCommentAnnotation-C28NAT6f.js → DiffCommentAnnotation-I1NLNQ4a.js} +3 -3
- package/dist/client/assets/{DiffFileTree-DNP9E3To.js → DiffFileTree-D2Less6B.js} +2 -2
- package/dist/client/assets/DiffPanel-CbeaPGl7.js +2 -0
- package/dist/client/assets/{DiffWorkerPoolProvider-TgqbZJCv.js → DiffWorkerPoolProvider-Ed_Eu_5j.js} +3 -3
- package/dist/client/assets/{EmbeddedDesign-B4RMmwTG.css → EmbeddedDesign-2h_Gl1nY.css} +1 -1
- package/dist/client/assets/EmbeddedDesign-cg069GMG.js +22 -0
- package/dist/client/assets/{EnvironmentMachineIcon-B81Bujkx.js → EnvironmentMachineIcon-DX1kvIxN.js} +2 -2
- package/dist/client/assets/{ExpandableText-CViqRFUp.js → ExpandableText-DjawxN-Z.js} +2 -2
- package/dist/client/assets/{FNOVOB4O-CmMgcKnc.js → FNOVOB4O-CyUhwNfJ.js} +2 -2
- package/dist/client/assets/FieldControl-HtKPFtzy.js +2 -0
- package/dist/client/assets/{FileDiff-BnZVGRTP.js → FileDiff-B-y5La4j.js} +2 -2
- package/dist/client/assets/{FilePreviewPanel-BUTTBdpa.js → FilePreviewPanel-c9WvfrZ_.js} +6 -6
- package/dist/client/assets/{FoldedSettingsSection-CioXtXIT.js → FoldedSettingsSection-BJZLAjOM.js} +2 -2
- package/dist/client/assets/FormContext-CXpUoAJn.js +2 -0
- package/dist/client/assets/GLTFLoader-DL026JyV.js +3833 -0
- package/dist/client/assets/{HDGCDEEZ-BsN0BbNt.js → HDGCDEEZ-Bl6z86eT.js} +2 -2
- package/dist/client/assets/{HSJLKHB7-Bn8VFRt5.js → HSJLKHB7-Cfn1dqKq.js} +2 -2
- package/dist/client/assets/{Icons-D_LFMxsj.js → Icons-CnCqDzcX.js} +2 -2
- package/dist/client/assets/Input-DivTTwcy.js +2 -0
- package/dist/client/assets/IntervalSecondsField-BEYqyqtO.js +2 -0
- package/dist/client/assets/JZOYTAAL-5Iy_ls5m.js +1 -0
- package/dist/client/assets/{K3MD6TGW-BEaTend7.js → K3MD6TGW-DbKn4Q-g.js} +2 -2
- package/dist/client/assets/{K7RP3OMA-Ca837W6z.js → K7RP3OMA-C2LcLP3I.js} +2 -2
- package/dist/client/assets/KeybindingsSettings.logic-BBUqSPsh.js +2 -0
- package/dist/client/assets/{LHDIQX7Q-kLYZmy22.js → LHDIQX7Q-D15jphae.js} +2 -2
- package/dist/client/assets/{LUXOKEGN-C6-9ARpy.js → LUXOKEGN-a5epevQp.js} +2 -2
- package/dist/client/assets/LinkMachineSelect-BeDb1a2o.js +2 -0
- package/dist/client/assets/{MathTypeset-CO0wlzDm.js → MathTypeset-wh9NB-6n.js} +2 -2
- package/dist/client/assets/ModelLiveLayer-vM3B8fTs.js +3 -0
- package/dist/client/assets/{N3JZAHOW-BFAKVTw8.js → N3JZAHOW-CnXyo2Xv.js} +2 -2
- package/dist/client/assets/{NUIALGQ3-DJg3tvBl.js → NUIALGQ3-Be5ePBJU.js} +2 -2
- package/dist/client/assets/{NoProjectsHero-ClDVFY0-.js → NoProjectsHero-D-hOorzE.js} +2 -2
- package/dist/client/assets/{O65XPQGZ-C5dkxqix.js → O65XPQGZ-B6ecTWo6.js} +2 -2
- package/dist/client/assets/{O7XIQ6OM-BUT403yQ.js → O7XIQ6OM-DvY9hhop.js} +2 -2
- package/dist/client/assets/{OFQON5FD-BPK3FXUG.js → OFQON5FD-Csir9i2q.js} +2 -2
- package/dist/client/assets/P4ConnectAccountPages-0UQXNoHX.js +2 -0
- package/dist/client/assets/{P4ConnectSidebarSignIn-D7BBbl_u.js → P4ConnectSidebarSignIn-DNS-Ar_U.js} +2 -2
- package/dist/client/assets/{PJQHF43J-DrfICuu-.js → PJQHF43J-DDRN0fWF.js} +2 -2
- package/dist/client/assets/PanelLayoutControls-1wZHYpgc.js +216 -0
- package/dist/client/assets/PierreEntryIcon-C-UBRZGs.js +2 -0
- package/dist/client/assets/PopoverHandle-AuBayEmY.js +2 -0
- package/dist/client/assets/PreviewPanel-5UQIDtjs.js +2 -0
- package/dist/client/assets/ProjectDefaultsSettings-BuSgjMGJ.js +2 -0
- package/dist/client/assets/{ProjectFavicon-BbtNdeB8.js → ProjectFavicon-Rj7LmbUX.js} +3 -3
- package/dist/client/assets/ProjectIconPickerDialog-75VZboJk.js +2 -0
- package/dist/client/assets/{ProjectMonogram-CjAGnMXr.js → ProjectMonogram-o7ZBa1RK.js} +2 -2
- package/dist/client/assets/{ProviderAuthTerminal-83vDClUK.js → ProviderAuthTerminal-884jYkPg.js} +2 -2
- package/dist/client/assets/ProviderModelPicker-446NiacH.js +2 -0
- package/dist/client/assets/ProviderSettingsForm-CBS1Dlfm.js +2 -0
- package/dist/client/assets/PullRequestCodeTab-DQzL88wU.js +6 -0
- package/dist/client/assets/{RHNBAITX-CzAdLNMd.js → RHNBAITX-DkWE42El.js} +2 -2
- package/dist/client/assets/{ReadOnlySourcePreview-CRy5hHfx.js → ReadOnlySourcePreview-DwfiVQrm.js} +2 -2
- package/dist/client/assets/{RedactedSensitiveText-B-u4PB3I.js → RedactedSensitiveText-DCu9USVF.js} +2 -2
- package/dist/client/assets/{RenderErrorBoundary-BbxLD-66.js → RenderErrorBoundary-ZQ6mGx7s.js} +3 -3
- package/dist/client/assets/RightPanelResizeHandle-8oJQkwcU.js +2 -0
- package/dist/client/assets/RoomEnvironment-Iz7-KYrN.js +2 -0
- package/dist/client/assets/{SLD4V6NK-DIFaAadw.js → SLD4V6NK-DTdKN7s4.js} +2 -2
- package/dist/client/assets/ScheduledTasksSettings-BFBxrkf4.js +6 -0
- package/dist/client/assets/{ScopedSwitch-sSIKDf2q.js → ScopedSwitch-BC1gPotW.js} +2 -2
- package/dist/client/assets/ScrollAreaCorner-C2BGnFEt.js +2 -0
- package/dist/client/assets/{SecretInput-DxjaAnSE.js → SecretInput-CTGlsesz.js} +2 -2
- package/dist/client/assets/SelectScrollUpArrow-BCdPJCNh.js +2 -0
- package/dist/client/assets/SelfImproveSettingsSection-DrWeWHZ3.js +2 -0
- package/dist/client/assets/SettingsPanels-dLjfE4mE.js +46 -0
- package/dist/client/assets/SettingsPanels.logic-DmWR8tPG.js +2 -0
- package/dist/client/assets/{SettingsScopeNotice-B1JDmqM6.js → SettingsScopeNotice-C3QzVYEB.js} +2 -2
- package/dist/client/assets/{SidebarStageBackdrop-Bbv3JBlJ.js → SidebarStageBackdrop-B1pFHa1_.js} +2 -2
- package/dist/client/assets/{T3PCR2KE-CACWvOHn.js → T3PCR2KE-17rNrwIa.js} +2 -2
- package/dist/client/assets/{TKWO2OVW-DpiGaVko.js → TKWO2OVW-duPpJj5d.js} +2 -2
- package/dist/client/assets/{TSHNXIZL-Cs6g4gXN.js → TSHNXIZL-DU0_NvP6.js} +2 -2
- package/dist/client/assets/{ThemeEditorPanel-w-RJEK3t.js → ThemeEditorPanel-75j9OkFZ.js} +3 -3
- package/dist/client/assets/{ThreadDetailsItemsMenu-DEwUOoLt.js → ThreadDetailsItemsMenu-D9bVwLRx.js} +45 -45
- package/dist/client/assets/ThreadTerminalDrawer-CdfREoC-.js +5 -0
- package/dist/client/assets/TooltipProvider-BUHMH_xT.js +2 -0
- package/dist/client/assets/{UQJE5E4I-C2gKDRv_.js → UQJE5E4I-B6R9z_Jl.js} +2 -2
- package/dist/client/assets/{USNYFO5S-CQ8LfY6F.js → USNYFO5S-CoqkxDVj.js} +2 -2
- package/dist/client/assets/{Virtualizer-DsEq6qUF.js → Virtualizer-CmU5Fo0Z.js} +2 -2
- package/dist/client/assets/{WEVWDWVA-DK2GTAKk.js → WEVWDWVA-C_7PWsV9.js} +2 -2
- package/dist/client/assets/{WorkspaceBreadcrumb-BImJJpuo.js → WorkspaceBreadcrumb-wSY6JpgP.js} +2 -2
- package/dist/client/assets/{WorkspacePageContainer-BlYFBUKE.js → WorkspacePageContainer-Bv3Si0zJ.js} +2 -2
- package/dist/client/assets/{WorkspacePageHeader-B7O16593.js → WorkspacePageHeader-D35ZiFO-.js} +2 -2
- package/dist/client/assets/{X5RFHQXM-sPxDCIwv.js → X5RFHQXM-BUhlFLY4.js} +2 -2
- package/dist/client/assets/{X62E3GBT-DVWr270S.js → X62E3GBT-BpMRLXKj.js} +2 -2
- package/dist/client/assets/{XBNEOJTC-C4ZNtSrU.js → XBNEOJTC-BRtSarTS.js} +2 -2
- package/dist/client/assets/{YHV2MVVZ-aSYUfq9n.js → YHV2MVVZ-Csy6jL8n.js} +2 -2
- package/dist/client/assets/{YURCZMG2-fnxZxUja.js → YURCZMG2-BWgVyhae.js} +2 -2
- package/dist/client/assets/{YVG2LODB-DxaZKaXT.js → YVG2LODB-BaRjN-Cm.js} +2 -2
- package/dist/client/assets/_chat-3NFUtZzk.js +47 -0
- package/dist/client/assets/_chat.design-CPUGyCaX.js +2 -0
- package/dist/client/assets/{_chat.index-D1csjyRQ.js → _chat.index-BMWR9-dz.js} +2 -2
- package/dist/client/assets/_chat.new-CFxwzp_c.js +4 -0
- package/dist/client/assets/_chat.pull-requests-BeA7vnLo.js +2 -0
- package/dist/client/assets/alert-DNQ3Wqlu.js +2 -0
- package/dist/client/assets/{alert-dialog-BCq0Qme9.js → alert-dialog-BRZulAlJ.js} +2 -2
- package/dist/client/assets/{assetUrls-CpRsTTqn.js → assetUrls-C1PZWceM.js} +2 -2
- package/dist/client/assets/assets-DPxWpbK1.js +2 -0
- package/dist/client/assets/browserHistoryStore-or0m8nek.js +2 -0
- package/dist/client/assets/{browserLinkTarget-IOprEiHF.js → browserLinkTarget-DE8VZ118.js} +2 -2
- package/dist/client/assets/{checkbox-CGhJug34.js → checkbox-Cz3A131i.js} +2 -2
- package/dist/client/assets/{color-picker-CRaqqL5F.js → color-picker-BqJjpRIx.js} +2 -2
- package/dist/client/assets/combobox-D28ATySv.js +2 -0
- package/dist/client/assets/{command-06bu9QoQ.js → command-BjQ8TOGE.js} +2 -2
- package/dist/client/assets/{connect-7OV1IEwO.js → connect-CpfP9Azm.js} +2 -2
- package/dist/client/assets/connect-agent-19TQkO9t.js +2 -0
- package/dist/client/assets/design-Bz1IpqHZ.js +2 -0
- package/dist/client/assets/device-DuASmK9r.js +2 -0
- package/dist/client/assets/dialog-BJ3R7bWN.js +2 -0
- package/dist/client/assets/diffPanelStore-Yh6lox6N.js +2 -0
- package/dist/client/assets/{diffRendering-DAzPanqh.js → diffRendering-CeqwU9XS.js} +2 -2
- package/dist/client/assets/{dist-BuxsAlG0.js → dist-C2W3DEZU.js} +3 -3
- package/dist/client/assets/draco_decoder-DZ63_CFx.js +2 -0
- package/dist/client/assets/draco_decoder-Z1_iN-Ht.wasm +0 -0
- package/dist/client/assets/draco_wasm_wrapper-9cRAE0qV.js +2 -0
- package/dist/client/assets/draco_wasm_wrapper-fZCQGLGb.js +116 -0
- package/dist/client/assets/draft-input-D7yqLT1A.js +2 -0
- package/dist/client/assets/duoViewer-DQzDc4Z4.js +2 -0
- package/dist/client/assets/{dynamic-wBSCLNxy.js → dynamic-Dz4eLTaa.js} +3 -3
- package/dist/client/assets/{embeddedScripts-ZebptRJ0.js → embeddedScripts-DZ2Ii9dE.js} +2 -2
- package/dist/client/assets/empty-BwsFVBxJ.js +2 -0
- package/dist/client/assets/entities-CNmVqAZs.js +2 -0
- package/dist/client/assets/{fileLinks-BfcK2bJU.js → fileLinks-E3IIVHgM.js} +2 -2
- package/dist/client/assets/{fileTreeExpansion-DjiK1m5s.js → fileTreeExpansion-gTas243c.js} +2 -2
- package/dist/client/assets/{getDiffFileInput-XE3jyXxK.js → getDiffFileInput-CUXcOkYa.js} +2 -2
- package/dist/client/assets/{htmlRender-DGe3WaPg.js → htmlRender-DSw3CY7L.js} +2 -2
- package/dist/client/assets/hubAccess-CsZ8CNmg.js +2 -0
- package/dist/client/assets/image-up-f7X837EZ.js +2 -0
- package/dist/client/assets/{index-CurDuwfz.js → index-Bxj8VaXa.js} +3 -3
- package/dist/client/assets/{input-CQaedaQh.js → input-BwujRX3Y.js} +2 -2
- package/dist/client/assets/input-group-euoW8Z7h.js +2 -0
- package/dist/client/assets/{kbd-DQRicdHu.js → kbd-GiLKf_On.js} +2 -2
- package/dist/client/assets/keybindings-CCmLKtII.js +2 -0
- package/dist/client/assets/{lazy-DmPH_lNd.js → lazy-JsFnphfP.js} +4 -4
- package/dist/client/assets/{lazyRouteComponent-CE6uW_5p.js → lazyRouteComponent-DZOLCSfI.js} +2 -2
- package/dist/client/assets/{link-CKfckeju.js → link-ByE5ZkNW.js} +2 -2
- package/dist/client/assets/{linkedPrompt-68_t5vwh.js → linkedPrompt-Dv_ZP8G8.js} +2 -2
- package/dist/client/assets/main-D8lKEPYS.js +37 -0
- package/dist/client/assets/main-DIHqY9YX.css +2 -0
- package/dist/client/assets/{mediaReference-DQ6GIZY7.js → mediaReference-DKsJ-9R8.js} +2 -2
- package/dist/client/assets/mediaSource-CF8tZyds.js +2 -0
- package/dist/client/assets/meshopt_decoder.module-BE7cuDBs.js +2 -0
- package/dist/client/assets/modelScene-DxcxMNRA.js +3 -0
- package/dist/client/assets/number-field-CWsDuEfo.js +2 -0
- package/dist/client/assets/{observeResize-BbXolq6K.js → observeResize-BxfFu2qN.js} +2 -2
- package/dist/client/assets/onboarding-DbYQeYSX.js +2 -0
- package/dist/client/assets/openFileInPreview-BiuuqQ-l.js +2 -0
- package/dist/client/assets/orbit-CTbdaXs-.js +2 -0
- package/dist/client/assets/p4ProjectFile-CZQao9GZ.js +2 -0
- package/dist/client/assets/{pair-BpCo33SH.js → pair-JgOCPd7m.js} +2 -2
- package/dist/client/assets/pause-5XtmSS7L.js +2 -0
- package/dist/client/assets/{pendingSendStore-Ba--K6cH.js → pendingSendStore-Bf499-Oy.js} +2 -2
- package/dist/client/assets/phoneViewer-Bqeu_y-d.js +2 -0
- package/dist/client/assets/{pierre-icons-BdcegjLq.js → pierre-icons-tmWDDsbZ.js} +2 -2
- package/dist/client/assets/popover-D2KZg7__.js +2 -0
- package/dist/client/assets/preview-eatXH_DC.js +2 -0
- package/dist/client/assets/preview-rGycedjV.js +2 -0
- package/dist/client/assets/previewMiniPlayerStore-7pQoYbpL.js +2 -0
- package/dist/client/assets/primary-C0adlG4a.js +2 -0
- package/dist/client/assets/primaryCloudLinkState-DStOgXZ7.js +2 -0
- package/dist/client/assets/projectFilesQueryState-CXzO_JXd.js +2 -0
- package/dist/client/assets/projectScriptEditor-B9Q_BBbL.js +2 -0
- package/dist/client/assets/providerSkills-BYU6vU9U.js +2 -0
- package/dist/client/assets/pullRequestDetail.logic-CAA5BrcO.js +10 -0
- package/dist/client/assets/{pullRequestIcons-CbDg0o8q.js → pullRequestIcons-D0TNfVUp.js} +2 -2
- package/dist/client/assets/{pullRequestReviewStore-0WIH92NQ.js → pullRequestReviewStore-szmuenZj.js} +2 -2
- package/dist/client/assets/pullRequests-tu-Mn-gv.js +2 -0
- package/dist/client/assets/queries-BhrI_odm.js +2 -0
- package/dist/client/assets/query-DmYgeaGK.js +2 -0
- package/dist/client/assets/radio-group-YcYZQjQu.js +2 -0
- package/dist/client/assets/relay-DcCuBtiq.js +2 -0
- package/dist/client/assets/renderScheduler-BgdSr0UC.js +2 -0
- package/dist/client/assets/rightPanelStore-BpUwMEU6.js +2 -0
- package/dist/client/assets/runtime-DciS6GP9.js +7 -0
- package/dist/client/assets/{runtimeModeConfig-CRXk0H6e.js → runtimeModeConfig-B8OcO6E5.js} +2 -2
- package/dist/client/assets/{scheduledTasksSettings.logic-Dw_swg_M.js → scheduledTasksSettings.logic-Cnm8G_wO.js} +3 -3
- package/dist/client/assets/{scroll-area-Cm9XZdHp.js → scroll-area-D7wKdOM7.js} +2 -2
- package/dist/client/assets/select--26O8gr7.js +2 -0
- package/dist/client/assets/selfImproveFindings-CQHbA_SP.js +2 -0
- package/dist/client/assets/server-DKB_3xTN.js +2 -0
- package/dist/client/assets/session-D_OiLzln.js +2 -0
- package/dist/client/assets/session-logic-lUPcTQRy.js +26 -0
- package/dist/client/assets/{settings-Yvo1RMvg.js → settings-BDigjNQr.js} +2 -2
- package/dist/client/assets/{settings.appearance-ONDNW-gc.js → settings.appearance-pv_RhojI.js} +2 -2
- package/dist/client/assets/settings.archived-UHO0BqSp.js +2 -0
- package/dist/client/assets/settings.computer-use-C7FCVkB8.js +2 -0
- package/dist/client/assets/settings.connections-MCKul-Qb.js +2 -0
- package/dist/client/assets/settings.data-controls-DHSiH1XK.js +2 -0
- package/dist/client/assets/settings.decisions-DVAZFuiP.js +2 -0
- package/dist/client/assets/settings.designs-Cq_57Bul.js +2 -0
- package/dist/client/assets/settings.diagnostics-D3vvP_U2.js +2 -0
- package/dist/client/assets/{settings.general-Cf_bIbyH.js → settings.general-BVlKme_0.js} +2 -2
- package/dist/client/assets/settings.integrations-CfX639cu.js +2 -0
- package/dist/client/assets/settings.keybindings-C4ufqFiE.js +2 -0
- package/dist/client/assets/{settings.open-source-licenses-DlqO6HBa.js → settings.open-source-licenses-C7SQX7_o.js} +2 -2
- package/dist/client/assets/settings.plugins-JB-_3lB3.js +5 -0
- package/dist/client/assets/settings.projects-HbUqS8EQ.js +4 -0
- package/dist/client/assets/settings.providers-DDaicTRG.js +3 -0
- package/dist/client/assets/{settings.scheduled-tasks-BIaHEXVF.js → settings.scheduled-tasks-CsfZkMNc.js} +2 -2
- package/dist/client/assets/settings.secrets-DmkUTUBC.js +2 -0
- package/dist/client/assets/settings.snap-shot-CxBBb3GG.js +2 -0
- package/dist/client/assets/settings.source-control-Buh1svx1.js +2 -0
- package/dist/client/assets/settings.storage-BoCdHcfz.js +2 -0
- package/dist/client/assets/settingsLayout-EWRSNE9F.js +3 -0
- package/dist/client/assets/sidebar-B2McbSnM.js +2 -0
- package/dist/client/assets/{sidebarProjectGrouping-Cy06FqQF.js → sidebarProjectGrouping-ManvShfB.js} +2 -2
- package/dist/client/assets/skeleton-CfxEpnM8.js +2 -0
- package/dist/client/assets/sourceControl-2E-torWB.js +2 -0
- package/dist/client/assets/sourceControlClients-DTwwk4H6.js +2 -0
- package/dist/client/assets/spinner-DiQtYQvU.js +2 -0
- package/dist/client/assets/src-aYUfWMsw.js +15 -0
- package/dist/client/assets/{terminal-links-DkNuyYrs.js → terminal-links-DalIS_T6.js} +2 -2
- package/dist/client/assets/terminalSessions-BXRGhdwO.js +2 -0
- package/dist/client/assets/textarea-CgJxMEC6.js +2 -0
- package/dist/client/assets/{themePalette-1UQmJk98.js → themePalette-BAJL8JDR.js} +3 -3
- package/dist/client/assets/threadCheckpoints-A01VyLzN.js +2 -0
- package/dist/client/assets/toggle-fVPE0kyD.js +2 -0
- package/dist/client/assets/toggle-group-BQBgK4Fh.js +2 -0
- package/dist/client/assets/{tooltip-C7NAkYG3.js → tooltip-DDv-MvO4.js} +2 -2
- package/dist/client/assets/{uiStateStore-FYiLqqos.js → uiStateStore-Cyle2Grh.js} +2 -2
- package/dist/client/assets/usage-DfkVwFPy.js +2 -0
- package/dist/client/assets/usageAccess-DGGNF6kP.js +2 -0
- package/dist/client/assets/usageFormat-DvpnUmwI.js +2 -0
- package/dist/client/assets/{usageShortcuts-BJyp1xT6.js → usageShortcuts-BefcatkO.js} +2 -2
- package/dist/client/assets/{use-atom-command-BbFDhw_c.js → use-atom-command-Bfi4daMj.js} +2 -2
- package/dist/client/assets/{useAriaLabelledBy-BJnK5b5h.js → useAriaLabelledBy-DjrGw7Iw.js} +2 -2
- package/dist/client/assets/useHandleNewThread-idXLHXR7.js +2 -0
- package/dist/client/assets/{useLocation-NTw9A5XQ.js → useLocation-fNQqSFar.js} +2 -2
- package/dist/client/assets/{useNavigate-DV9bXnWr.js → useNavigate-DwXZ6yA7.js} +2 -2
- package/dist/client/assets/{useNavigateBack-D62rsj_4.js → useNavigateBack-mLGu4w8K.js} +2 -2
- package/dist/client/assets/{useP4ConnectAuthPrompt-Bj5GIxgy.js → useP4ConnectAuthPrompt-BXgvqiOd.js} +2 -2
- package/dist/client/assets/{useParams-jklHVL7l.js → useParams-qFbmBdAa.js} +2 -2
- package/dist/client/assets/{usePermissionStatus-DaCu90iN.js → usePermissionStatus-CTyZ03Js.js} +2 -2
- package/dist/client/assets/usePopupViewport-Dc46kF33.js +2 -0
- package/dist/client/assets/usePullRequestActions-DJ1WiiLA.js +3 -0
- package/dist/client/assets/useRegisterFieldControl-BL6Ml_ar.js +2 -0
- package/dist/client/assets/useRender-BP5vR6yH.js +2 -0
- package/dist/client/assets/{useScopedModelAvailability-hsJL85Tg.js → useScopedModelAvailability-CLTKL2Jf.js} +2 -2
- package/dist/client/assets/useSettings-CnHpxSBo.js +3 -0
- package/dist/client/assets/utils-CtzgibkN.js +24 -0
- package/dist/client/assets/vcsRefInvalidation-BewBnMos.js +2 -0
- package/dist/client/assets/welcome-BkJ7M2_8.js +2 -0
- package/dist/client/index.html +1 -1
- package/dist/{renderer-D9dDeERN.mjs → renderer-7PhJbGDm.mjs} +19 -4
- package/dist/{runtime-C3UJDGLb.mjs → runtime-Dbm6Vqjj.mjs} +511 -233
- package/package.json +1 -1
- package/dist/AcpMcpStdioBridge-CtXfvrFO.mjs +0 -3
- package/dist/client/assets/AlertDialogRoot-BI19p1Pb.js +0 -2
- package/dist/client/assets/ChatGptUsageButton-BldpBXxU.js +0 -2
- package/dist/client/assets/CheckboxIndicator-C4iAbUMh.js +0 -2
- package/dist/client/assets/ClippedText-TtLeyAVc.js +0 -2
- package/dist/client/assets/CodexSetupSection.logic-BO6ZAijp.js +0 -2
- package/dist/client/assets/ComboboxClear-CtNsa8Al.js +0 -2
- package/dist/client/assets/ComboboxGroupLabel-vQ7y8c50.js +0 -2
- package/dist/client/assets/CompositeRoot-CL7X20MU.js +0 -2
- package/dist/client/assets/ConnectAgentSurface-B_AYPHWs.js +0 -2
- package/dist/client/assets/DevicePanel-Cqexcbm2.js +0 -2
- package/dist/client/assets/DeviceSetup-Cdyw5Z9a.js +0 -2
- package/dist/client/assets/DialogTitle-CFYK6V6-.js +0 -2
- package/dist/client/assets/DiffPanel-CrswOKS6.js +0 -2
- package/dist/client/assets/EmbeddedDesign-Bdq5oAfI.js +0 -21
- package/dist/client/assets/FieldControl-95mCsa0m.js +0 -2
- package/dist/client/assets/FormContext-BcA1kdFD.js +0 -2
- package/dist/client/assets/Input-C9KIhPlP.js +0 -2
- package/dist/client/assets/JZOYTAAL-B8H2VC7A.js +0 -1
- package/dist/client/assets/KeybindingsSettings.logic-DwMUZYvv.js +0 -2
- package/dist/client/assets/LinkMachineSelect-BVNnYUBb.js +0 -2
- package/dist/client/assets/P4ConnectAccountPages-ChT866qO.js +0 -2
- package/dist/client/assets/PanelLayoutControls-DMUv135M.js +0 -216
- package/dist/client/assets/PierreEntryIcon-DLXDEcqA.js +0 -2
- package/dist/client/assets/PopoverHandle-D8JhsX32.js +0 -2
- package/dist/client/assets/PreviewPanel-D7YWnWZS.js +0 -2
- package/dist/client/assets/ProjectDefaultsSettings-BZSw74tU.js +0 -2
- package/dist/client/assets/ProjectIconPickerDialog-7vur_TCX.js +0 -2
- package/dist/client/assets/ProviderModelPicker-af7MWLPO.js +0 -2
- package/dist/client/assets/ProviderSettingsForm-B4N4tsxv.js +0 -2
- package/dist/client/assets/PullRequestCodeTab-B07M_QW4.js +0 -6
- package/dist/client/assets/RightPanelResizeHandle-BODMyZa6.js +0 -2
- package/dist/client/assets/ScheduledTasksSettings-BTi69FRq.js +0 -6
- package/dist/client/assets/ScrollAreaCorner-CsKGemsf.js +0 -2
- package/dist/client/assets/SelectScrollUpArrow-BMZtcPXM.js +0 -2
- package/dist/client/assets/SelfImproveSettingsSection-Dx6spJXh.js +0 -2
- package/dist/client/assets/SettingsPanels-DhuEF0_Y.js +0 -46
- package/dist/client/assets/SettingsPanels.logic-D5Fnq4gS.js +0 -2
- package/dist/client/assets/ThreadTerminalDrawer-CY2qHldP.js +0 -5
- package/dist/client/assets/TooltipProvider-Czzm7ro-.js +0 -2
- package/dist/client/assets/_chat-BeJoXsdK.js +0 -47
- package/dist/client/assets/_chat.design-AJz30uXq.js +0 -2
- package/dist/client/assets/_chat.new-IhhWgwNo.js +0 -4
- package/dist/client/assets/_chat.pull-requests-B84LUHIv.js +0 -2
- package/dist/client/assets/alert-D6MFRWZv.js +0 -2
- package/dist/client/assets/assets-Dh1LFwqL.js +0 -2
- package/dist/client/assets/browserHistoryStore-BVEWgOnh.js +0 -2
- package/dist/client/assets/combobox-5RzytEjd.js +0 -2
- package/dist/client/assets/connect-agent-B6pgZuy8.js +0 -2
- package/dist/client/assets/design-DSoix9e1.js +0 -2
- package/dist/client/assets/device-DQmQm4GC.js +0 -2
- package/dist/client/assets/dialog-DTVhbEqi.js +0 -2
- package/dist/client/assets/draft-input-BTetoXSt.js +0 -2
- package/dist/client/assets/duoViewer-DxmaOmHS.js +0 -2
- package/dist/client/assets/empty-B4h5DyMQ.js +0 -2
- package/dist/client/assets/entities-CWtNgawi.js +0 -2
- package/dist/client/assets/guideRunStore-CzF0q6A8.js +0 -2
- package/dist/client/assets/image-up-BN-uYqtM.js +0 -2
- package/dist/client/assets/input-group-BQ_2ox-w.js +0 -2
- package/dist/client/assets/keybindings-tgj8XFFz.js +0 -2
- package/dist/client/assets/main-B1sXOjZZ.js +0 -37
- package/dist/client/assets/main-CbkvDRKP.css +0 -2
- package/dist/client/assets/mediaSource-DfTsMdqm.js +0 -2
- package/dist/client/assets/number-field-xEi5ylvp.js +0 -2
- package/dist/client/assets/onboarding-CkdZxdNL.js +0 -2
- package/dist/client/assets/openFileInPreview-BHhDd-id.js +0 -2
- package/dist/client/assets/orbit-aOr6_vTe.js +0 -2
- package/dist/client/assets/p4ProjectFile-5VDI-yAx.js +0 -2
- package/dist/client/assets/pause-C-5l1Ug3.js +0 -2
- package/dist/client/assets/phoneViewer-C1aGY-h1.js +0 -2
- package/dist/client/assets/popover-BB2K1---.js +0 -2
- package/dist/client/assets/preview-B4_sjsUX.js +0 -2
- package/dist/client/assets/preview-DgXn94k5.js +0 -2
- package/dist/client/assets/previewMiniPlayerStore-DguWdL1f.js +0 -2
- package/dist/client/assets/primary-BDoRkJqU.js +0 -2
- package/dist/client/assets/primaryCloudLinkState-Cc0Xobh6.js +0 -2
- package/dist/client/assets/projectFilesQueryState-BdfD5cZ2.js +0 -2
- package/dist/client/assets/projectScriptEditor-faOsFlds.js +0 -2
- package/dist/client/assets/providerSkills-C8PrnHb-.js +0 -2
- package/dist/client/assets/pullRequestDetail.logic-kOhR5jr9.js +0 -10
- package/dist/client/assets/pullRequests-Cf9E2kW-.js +0 -2
- package/dist/client/assets/queries-Cl508kPw.js +0 -2
- package/dist/client/assets/query-D3KVoW9G.js +0 -2
- package/dist/client/assets/radio-group-BnZVD-CO.js +0 -2
- package/dist/client/assets/relay-Do9UB5iT.js +0 -2
- package/dist/client/assets/renderScheduler-DsjkE3rh.js +0 -3833
- package/dist/client/assets/rightPanelStore-DB1OP4MT.js +0 -2
- package/dist/client/assets/runtime-BBYIQ0f-.js +0 -7
- package/dist/client/assets/select-Cz_1ByI4.js +0 -2
- package/dist/client/assets/selfImproveFindings-DtoTFNL_.js +0 -2
- package/dist/client/assets/server-Dkj4NeYG.js +0 -2
- package/dist/client/assets/session-CBEVNHld.js +0 -2
- package/dist/client/assets/session-logic-DB_ei-pn.js +0 -26
- package/dist/client/assets/settings.archived-CjdyCMyi.js +0 -2
- package/dist/client/assets/settings.computer-use-97ffp9C_.js +0 -2
- package/dist/client/assets/settings.connections-w3qKRKGa.js +0 -2
- package/dist/client/assets/settings.data-controls-C8ozSexu.js +0 -2
- package/dist/client/assets/settings.decisions-BvR3_OTv.js +0 -2
- package/dist/client/assets/settings.designs-CB8PWHwW.js +0 -2
- package/dist/client/assets/settings.diagnostics-DdInPrq0.js +0 -2
- package/dist/client/assets/settings.integrations-pj9KVvtd.js +0 -2
- package/dist/client/assets/settings.keybindings-3diGciV1.js +0 -2
- package/dist/client/assets/settings.plugins-DpaJJH_J.js +0 -5
- package/dist/client/assets/settings.projects-Bfh3CJ1a.js +0 -4
- package/dist/client/assets/settings.providers-DNiEeQYT.js +0 -3
- package/dist/client/assets/settings.secrets-BSNXem5A.js +0 -2
- package/dist/client/assets/settings.snap-shot-Ds0ywKhE.js +0 -2
- package/dist/client/assets/settings.source-control-C41AVNSm.js +0 -2
- package/dist/client/assets/settings.storage-B-Hm5vEC.js +0 -2
- package/dist/client/assets/settingsLayout-BbEwQ6Fy.js +0 -3
- package/dist/client/assets/sidebar-B70J7v16.js +0 -2
- package/dist/client/assets/skeleton-BavPX8IL.js +0 -2
- package/dist/client/assets/sourceControl-De64nxc-.js +0 -2
- package/dist/client/assets/sourceControlClients-BofXnV5S.js +0 -2
- package/dist/client/assets/spinner-BiCpg0TU.js +0 -2
- package/dist/client/assets/terminalSessions-BLnAzTpE.js +0 -2
- package/dist/client/assets/textarea-DPWqoJRQ.js +0 -2
- package/dist/client/assets/threadCheckpoints-C5aLz9nv.js +0 -2
- package/dist/client/assets/toggle-DERKSGyC.js +0 -2
- package/dist/client/assets/toggle-group-DYSJFIn3.js +0 -2
- package/dist/client/assets/usage-CtcqAwlu.js +0 -2
- package/dist/client/assets/usageAccess-2Wks5kIN.js +0 -2
- package/dist/client/assets/usageFormat-BZJ9qCn4.js +0 -2
- package/dist/client/assets/useHandleNewThread-C6MtV3AM.js +0 -2
- package/dist/client/assets/usePopupViewport-D1lXH2SQ.js +0 -2
- package/dist/client/assets/usePullRequestActions-WFmep5Tm.js +0 -3
- package/dist/client/assets/useRegisterFieldControl-BtJcyaxh.js +0 -2
- package/dist/client/assets/useSettings-EYJbJzT3.js +0 -3
- package/dist/client/assets/utils-DjbLtxuo.js +0 -37
- package/dist/client/assets/vcsRefInvalidation-DkXoQApH.js +0 -2
- package/dist/client/assets/welcome-uKSqaFeK.js +0 -2
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{$_ as i,Am as a,Fs as o,Jd as s,Ls as c,OE as l,Ob as u,Ps as d,Qn as f,Vd as p,Yb as m,Zn as h,_m as g,ap as _,cm as v,es as y,fr as b,gh as x,hr as S,is as C,kv as w,ml as T,mr as E,nx as D,rr as ee,sr as O,ss as k,t as A,tr as j,ub as M,us as N,vb as P,ys as F}from"./utils-DjbLtxuo.js";import{Er as I,Sr as L,Tr as R,yr as z}from"./runtime-BBYIQ0f-.js";import{a as B,c as V,o as te,s as ne,t as re}from"./select-Cz_1ByI4.js";import{t as ie}from"./useNavigateBack-D62rsj_4.js";import{rt as ae}from"./useSettings-EYJbJzT3.js";import{f as oe,s as se}from"./server-Dkj4NeYG.js";import{n as H,t as U}from"./session-CBEVNHld.js";import{t as ce}from"./use-atom-command-BbFDhw_c.js";import{a as le,c as ue,d as W,f as G,i as de,l as K,n as fe,o as pe,r as q,s as J,t as Y,u as me}from"./usageFormat-BZJ9qCn4.js";import{t as he}from"./env-BfPir1X4.js";import{a as ge,n as _e,t as ve}from"./tooltip-C7NAkYG3.js";import{t as X}from"./skeleton-BavPX8IL.js";import{n as ye,t as be}from"./toggle-group-DYSJFIn3.js";import{t as xe}from"./input-CQaedaQh.js";import{t as Se}from"./scroll-area-Cm9XZdHp.js";import{a as Ce,c as we,i as Te,o as Ee,r as De,s as Oe,t as ke}from"./dialog-DTVhbEqi.js";import{o as Ae}from"./sidebar-B70J7v16.js";import{t as je}from"./observeResize-BbXolq6K.js";import{y as Me}from"./keybindings-tgj8XFFz.js";import{i as Ne,o as Pe,t as Fe}from"./popover-BB2K1---.js";import{S as Ie,n as Le,t as Re}from"./ChatGptUsageButton-BldpBXxU.js";import{t as ze}from"./WorkspacePageContainer-BlYFBUKE.js";import{n as Be,r as Ve,t as He}from"./usageShortcuts-BJyp1xT6.js";import{Ao as Ue,Ir as We,Lr as Ge,Rr as Ke,ci as qe,pa as Je,wa as Ye,zr as Xe}from"./main-B1sXOjZZ.js";import{t as Ze}from"./WorkspacePageHeader-B7O16593.js";import{i as Qe,n as $e,r as et,t as tt}from"./WorkspaceBreadcrumb-BImJJpuo.js";import{t as nt}from"./usageAccess-2Wks5kIN.js";var Z=e(t(),1),Q=n(),rt=m(I);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 L(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 z(e,a,{reportFailure:!1,signal:s.signal})}finally{l()}}))}function ut(e,t=!1){let{summary:n}=e;if(!e.isConnected||e.error!==null)return{phase:`inactive`};if(n===null)return{phase:`loading`};if(t)return{phase:`stale`};if(!e.isPending)return{phase:`ready`};let r=[...new Set(n.sources.flatMap(e=>e.refreshing?[e.fingerprint.provider]:[]))];return r.length>0?{phase:`partway`,providers:r}:{phase:`stale`}}function dt(e,t){return e.length===1?`Updating ${t(e[0])}…`:`Updating ${e.length} providers…`}function ft(e,t=!1){let n=new Set,r=!1;for(let i of e){let e=ut(i,t);if((e.phase===`loading`||e.phase===`stale`)&&(r=!0),e.phase===`partway`)for(let t of e.providers)n.add(t)}return{partial:r||n.size>0,everyProvider:r,providers:n}}function pt(e){return e.records>0&&e.unpricedRecords>=e.records}function mt(e){return[e.hostId,e.provider,e.resolvedHomePath,e.volumeId].join(` `)}function ht(e,t){let n=e.sources.filter(e=>e.fingerprint.provider===t.fingerprint.provider);return e.buckets.filter(e=>e.provider===t.fingerprint.provider&&(e.sourcePath===t.fingerprint.resolvedHomePath||e.sourcePath===void 0&&n.length===1))}function gt(e){return JSON.stringify([e.day,e.hourStart??null,e.provider,e.model])}function _t(e){let t=new Map,n=new Map,r=new Map,i=new Map,a=new Map,o=[],s=[...e].sort((e,t)=>(Date.parse(t.summary.readAt)||0)-(Date.parse(e.summary.readAt)||0)||e.environmentId.localeCompare(t.environmentId));for(let e of[`ok`,`partial`,`failed`])for(let r of s)for(let i of r.summary.sources){if(i.status!==e)continue;let s=mt(i.fingerprint);t.has(s)?o.push(`${r.label}: ${i.fingerprint.resolvedHomePath}`):(t.set(s,r.environmentId),n.set(s,{environment:r,source:i}),a.set(s,i.distinctSessions))}for(let e of s)for(let t of e.summary.sources){if(t.status!==`partial`)continue;let o=mt(t.fingerprint),s=n.get(o);if(s?.source.status!==`ok`||Date.parse(e.summary.readAt)<=Date.parse(s.environment.summary.readAt))continue;let c=r.get(o);c===void 0&&(c=new Set(ht(s.environment.summary,s.source).map(gt)),r.set(o,c));let l=i.get(e.environmentId)??new Set,u=!1;for(let n of ht(e.summary,t)){let e=gt(n);c.has(e)||(c.add(e),l.add(n),u=!0)}u&&(i.set(e.environmentId,l),a.set(o,Math.max(a.get(o)??0,t.distinctSessions)))}return{ownerByFingerprint:t,supplementalBucketsByEnvironment:i,sessionsByFingerprint:a,duplicates:o}}function vt(e,t,n,r){let i=new Set,a=new Set,o=new Map;for(let n of e.summary.sources){if(n.status===`missing`)continue;let s=mt(n.fingerprint);if(t.get(s)===e.environmentId){let e=n.fingerprint.provider;i.add(e),a.add(`${e}\u0000${n.fingerprint.resolvedHomePath}`),o.set(e,(o.get(e)??0)+(r.get(s)??n.distinctSessions))}}return{buckets:e.summary.buckets.filter(e=>n.has(e)||(e.sourcePath===void 0?i.has(e.provider):a.has(`${e.provider}\u0000${e.sourcePath}`))),sessionsByProvider:o}}function yt(e){return e.totals.uncachedInputTokens+e.totals.cachedInputTokens+e.totals.cacheCreationTokens+e.totals.outputTokens}function bt(e,t){return e>=4&&e<=t}var xt={costUsd:0,uncachedInputTokens:0,cachedInputTokens:0,cacheCreationTokens:0,outputTokens:0,reasoningTokens:0,totalTokens:0,records:0,sessions:0,providers:[],models:[],daily:[],hourly:[],costQuality:{providerReportedShare:0,modelPricedShare:0,unpricedShare:0,cacheSavingsUsd:0},categoryCost:{input:0,cacheRead:0,cacheWrite:0,output:0,unsplit:0},speedCost:{standard:0,fast:0,ultrafast:0,premium:0},duplicateSources:[],contributingEnvironments:[],contractMismatches:[]};function St(e,t){if(e.length===0)return xt;let n=[],r=[];for(let i of e)bt(i.summary.contractVersion,t)?n.push(i):r.push({environmentId:i.environmentId,direction:i.summary.contractVersion<t?`serverBehind`:`clientBehind`,contractVersion:i.summary.contractVersion});let{ownerByFingerprint:i,supplementalBucketsByEnvironment:a,sessionsByFingerprint:o,duplicates:s}=_t(n),c=0,l=0,u=0,d=0,f=0,p=0,m=0,h=0,g=0,_=0,v=0,y={input:0,cacheRead:0,cacheWrite:0,output:0},b={fast:0,ultrafast:0,premium:0},x=new Map,S=new Map,C=new Map,w=new Map,T=[];for(let e of n){let{buckets:t,sessionsByProvider:n}=vt(e,i,a.get(e.environmentId)??new Set,o);t.length>0&&T.push(e.environmentId);for(let[e,t]of n){if(h+=t,t===0)continue;let n=x.get(e)??{costUsd:0,totalTokens:0,records:0,sessions:0};n.sessions+=t,x.set(e,n)}for(let e of t){let t=yt(e);c+=e.costUsd,g+=e.cacheSavingsUsd,l+=e.totals.uncachedInputTokens,u+=e.totals.cachedInputTokens,d+=e.totals.cacheCreationTokens,f+=e.totals.outputTokens,p+=e.totals.reasoningTokens,m+=e.records,v+=e.unpricedRecords,e.costSource===`providerReported`&&(_+=e.records),e.categoryCostUsd!==void 0&&(y.input+=e.categoryCostUsd.input,y.cacheRead+=e.categoryCostUsd.cacheRead,y.cacheWrite+=e.categoryCostUsd.cacheWrite,y.output+=e.categoryCostUsd.output),b.fast+=e.fastCostUsd??0,b.ultrafast+=e.ultrafastCostUsd??0,b.premium+=e.speedPremiumUsd??0;let n=x.get(e.provider)??{costUsd:0,totalTokens:0,records:0,sessions:0};n.costUsd+=e.costUsd,n.totalTokens+=t,n.records+=e.records,x.set(e.provider,n);let r=`${e.provider} ${e.model}`,i=S.get(r)??{provider:e.provider,costUsd:0,totalTokens:0,tokens:{uncachedInputTokens:0,cachedInputTokens:0,cacheCreationTokens:0,outputTokens:0,reasoningTokens:0},records:0,unpricedRecords:0,unpricedTokens:0};i.costUsd+=e.costUsd,i.totalTokens+=t,i.tokens={uncachedInputTokens:i.tokens.uncachedInputTokens+e.totals.uncachedInputTokens,cachedInputTokens:i.tokens.cachedInputTokens+e.totals.cachedInputTokens,cacheCreationTokens:i.tokens.cacheCreationTokens+e.totals.cacheCreationTokens,outputTokens:i.tokens.outputTokens+e.totals.outputTokens,reasoningTokens:i.tokens.reasoningTokens+e.totals.reasoningTokens},i.records+=e.records,i.unpricedRecords+=e.unpricedRecords,e.records>0&&(i.unpricedTokens+=t*e.unpricedRecords/e.records),S.set(r,i);let a=C.get(e.day)??{costUsd:0,totalTokens:0,byProvider:new Map};a.costUsd+=e.costUsd,a.totalTokens+=t;let o=a.byProvider.get(e.provider)??{costUsd:0,totalTokens:0};if(o.costUsd+=e.costUsd,o.totalTokens+=t,a.byProvider.set(e.provider,o),C.set(e.day,a),e.hourStart!==void 0){let n=w.get(e.hourStart)??{day:e.day,hourStart:e.hourStart,costUsd:0,totalTokens:0,byProvider:new Map};n.costUsd+=e.costUsd,n.totalTokens+=t;let r=n.byProvider.get(e.provider)??{costUsd:0,totalTokens:0};r.costUsd+=e.costUsd,r.totalTokens+=t,n.byProvider.set(e.provider,r),w.set(e.hourStart,n)}}}let E=l+u+d+f,D=[...x.entries()].map(([e,t])=>({provider:e,costUsd:t.costUsd,totalTokens:t.totalTokens,records:t.records,sessions:t.sessions,costShare:c===0?0:t.costUsd/c,tokenShare:E===0?0:t.totalTokens/E})).sort((e,t)=>t.costUsd-e.costUsd),ee=[...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),O=[...C.entries()].map(([e,t])=>({day:e,costUsd:t.costUsd,totalTokens:t.totalTokens,byProvider:t.byProvider})).sort((e,t)=>e.day.localeCompare(t.day)),k=[...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:ee,daily:O,hourly:k,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=k(e=>N(t=>{let n=JSON.parse(e),r=t(ae.presentationsAtom),i=[];for(let[e,a]of r){let r=a.connection.phase===`connected`,o=t(U.sessionStateAtom(e)),s=nt({connectionPhase:a.connection.phase,session:l(d(o)),hasSessionError:o._tag===`Failure`});if(!s.canReadDiagnostics){i.push({environmentId:e,label:a.entry.target.label,isConnected:r,...s,summary:null,needsCursorKeychainAccess:!1});continue}let c=t(oe.usageSummary({environmentId:e,input:n})),u=l(d(c));i.push({environmentId:e,label:a.entry.target.label,isPending:c.waiting,canReadDiagnostics:!0,isConnected:r,error:c._tag===`Failure`?`This environment could not report usage.`:null,summary:u,needsCursorKeychainAccess:it(u,t(oe.providersValueAtom(e)))})}return i}).pipe(F(`web-usage:window:${e}`)));function wt(e,t){return St(e.flatMap(({environmentId:e,label:n,summary:r})=>r===null?[]:[{environmentId:e,label:n,summary:t===void 0?r:{...r,buckets:r.buckets.filter(t)}}]),6)}var Tt=new Set;function Et(e,t){return t.size===0?e:e.map(e=>e.summary===null?e:{...e,summary:{...e.summary,buckets:e.summary.buckets.filter(e=>!t.has(e.provider)),sources:e.summary.sources.filter(e=>!t.has(e.fingerprint.provider))}})}function Dt(e,t,n){let r=(0,Q.c)(36),i=t===void 0?null:t,a=n===void 0?Tt:n,o;r[0]!==e.resolution||r[1]!==e.sinceDay||r[2]!==e.sinceTime||r[3]!==e.timeZone||r[4]!==e.untilDay||r[5]!==e.untilTime?(o=JSON.stringify({sinceDay:e.sinceDay,untilDay:e.untilDay,timeZone:e.timeZone,resolution:e.resolution,sinceTime:e.sinceTime,untilTime:e.untilTime}),r[0]=e.resolution,r[1]=e.sinceDay,r[2]=e.sinceTime,r[3]=e.timeZone,r[4]=e.untilDay,r[5]=e.untilTime,r[6]=o):o=r[6];let s=o,c;r[7]===s?c=r[8]:(c=Ct(s),r[7]=s,r[8]=c);let l=C(c),u;r[9]!==l||r[10]!==i?(u=i===null?l:l.filter(e=>i.has(e.environmentId)),r[9]=l,r[10]=i,r[11]=u):u=r[11];let d=u,f;r[12]!==d||r[13]!==s?(f=e=>lt({registry:y,server:oe,presentations:ae,environmentIds:d.filter(jt).map(At),input:e??JSON.parse(s)}),r[12]=d,r[13]=s,r[14]=f):f=r[14];let p=f,m;r[15]!==a||r[16]!==d?(m=wt(Et(d,a)),r[15]=a,r[16]=d,r[17]=m):m=r[17];let h=m,g;r[18]===d?g=r[19]:(g=d.filter(kt),r[18]=d,r[19]=g);let _=g.length,v;r[20]===d?v=r[21]:(v=d.filter(Ot),r[20]=d,r[21]=v);let b=v.length,x=_===0&&b>0,[S,w]=(0,Z.useState)(null);_>0&&(S?.merged!==h||S.window!==e||S.selection!==i||S.hidden!==a)&&w({window:e,merged:h,selection:i,hidden:a});let T=S?.selection===i&&S.hidden===a?S:null,E;r[22]!==_||r[23]!==e||r[24]!==x||r[25]!==T||r[26]!==h?(E=_>0?{window:e,merged:h}:T??(x?null:{window:e,merged:h}),r[22]=_,r[23]=e,r[24]=x,r[25]=T,r[26]=h,r[27]=E):E=r[27];let D=E,ee=_>0&&b>0,O;return r[28]!==l||r[29]!==x||r[30]!==h||r[31]!==p||r[32]!==d||r[33]!==D||r[34]!==ee?(O={merged:h,environments:l,selectedEnvironments:d,isPending:x,shown:D,isPartial:ee,refresh:p},r[28]=l,r[29]=x,r[30]=h,r[31]=p,r[32]=d,r[33]=D,r[34]=ee,r[35]=O):O=r[35],O}function Ot(e){return e.summary===null&&e.error===null}function kt(e){return e.summary!==null}function At(e){let{environmentId:t}=e;return t}function jt(e){return e.canReadDiagnostics&&H(e.environmentId,`diagnostics:read`)}var $=e(r(),1);function Mt(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=A(`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=A(`[&_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=A(`[&_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=A(`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=A(`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=A(`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().replace(`,`,`.`);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!==``){if(i.alias===void 0&&Object.keys(i.values).length>0){r.set(i.id,`${e.label} maps this model. Remove it from "Apply to" or clear its mapping first.`);continue}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)}let i=new Map(Object.entries(e.aliases??{}));for(let e of n)`alias`in e&&(e.alias===null?i.delete(e.model):i.set(e.model,e.alias));for(let n of t){if(n.removed||r.has(n.id))continue;let t=n.model.trim(),a=new Set;for(;i.has(t);){if(a.has(t)){r.set(n.id,`Model mappings cannot form a cycle on ${e.label}.`);break}a.add(t),t=i.get(t)}}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=N(e=>[...e(ae.presentationsAtom)].map(([t,n])=>{let r=e(oe.settingsValueAtom(t)),i=e(U.sessionStateAtom(t)),a=l(d(i)),o=i._tag===`Failure`?`denied`:a===null?i.waiting?`pending`:`denied`:w(a,`settings:write`)?`granted`:`denied`;return{environmentId:t,label:n.entry.target.label,prices:r?.usagePriceOverrides??null,aliases:n.serverConfig?.environment.capabilities.usageModelAliases===!0?r?.usageModelAliases??null:null,unavailable:n.connection.phase===`connected`?r===null?`Prices not loaded`:n.serverConfig?.environment.capabilities.usagePriceOverrides===!0?o===`pending`?`Checking permissions…`:o===`denied`?`Read-only access`:null:`Update server to edit prices`:`Offline`}}));function Xt(e){let t=(0,Q.c)(119),{usage:n,initialSelectedEnvironmentIds:r,initialModel:i,onOpenChange:a}=e,o=C(Yt),[s,c]=(0,Z.useState)(r),l;if(t[0]!==o||t[1]!==s){let e;t[3]===s?e=t[4]:(e=e=>s===null||s.has(e.environmentId),t[3]=s,t[4]=e),l=o.filter(e),t[0]=o,t[1]=s,t[2]=l}else l=t[2];let u=l,d;t[5]!==i||t[6]!==u?(d=()=>i===void 0||u.some(e=>Object.hasOwn(e.prices??{},i)||Object.hasOwn(e.aliases??{},i))?[]:[{id:`new:initial`,model:i,isNew:!0,values:{}}],t[5]=i,t[6]=u,t[7]=d):d=t[7];let[m,_]=(0,Z.useState)(d),[y,S]=(0,Z.useState)(!1),[w,T]=(0,Z.useState)(null),D=(0,Z.useRef)(null),k=(0,Z.useRef)(0),j;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(j={reportFailure:!1},t[8]=j):j=t[8];let M=ce(oe.updateSettings,j),N,P,F,I,L,R,z,B,V,te,ne,re,ie,ae,se;if(t[9]!==w||t[10]!==m||t[11]!==o||t[12]!==a||t[13]!==y||t[14]!==u||t[15]!==s||t[16]!==M||t[17]!==n){let e=[...new Set(u.flatMap(mn))].sort(),r;t[33]===u?r=t[34]:(r=e=>u.some(t=>t.environmentId===e.environmentId),t[33]=u,t[34]=r);let i=[...new Set([...e,...n.filter(r).flatMap(fn)])].sort(),l;t[35]===m?l=t[36]:(l=new Set(m.filter(dn).map(un)),t[35]=m,t[36]=l);let d=l,C;t[37]!==w||t[38]!==d?(C=e=>w===null||!d.has(e),t[37]=w,t[38]=d,t[39]=C):C=t[39];let j=[...e.filter(C).map(e=>m.find(t=>t.id===`model:${e}`)??{id:`model:${e}`,model:e,isNew:!1,values:{}}),...m.filter(ln)],oe=m.filter(cn);R=qt(u,oe);for(let t of oe)t.isNew&&(t.model.trim()===``?R.set(t.id,`Enter a model ID.`):w===null&&(e.includes(t.model.trim())||m.some(e=>e.id!==t.id&&e.model.trim()===t.model.trim()))&&R.set(t.id,`This model already has a row. Edit its prices there.`));z=w?.destinations.filter(e=>w.results.get(e.environmentId)?.status===`failed`)??[];let U=y||z.length>0;B=oe.length>0,I=u.length===1?u[0].label:`${u.length} environments`;let ce=s===null?`All environments`:I,le;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>{_([]),T(null)},t[40]=le):le=t[40],L=le;let ue;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(ue=e=>{c(e),T(null)},t[41]=ue):ue=t[41];let W=ue,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]),T(null)},t[42]=G):G=t[42];let de=G,K=sn,fe;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(fe=e=>{!e.isNew&&Object.keys(e.values).length===0&&e.alias===void 0?_(t=>t.filter(t=>t.id!==e.id)):de(e)},t[43]=fe):fe=t[43];let pe=fe,q;t[44]===u?q=t[45]:(q=(e,t,n)=>{let r={...e.values,[t]:n},i=Gt(u,e.model,t);K(e,i,n)&&delete r[t],pe({...e,values:r})},t[44]=u,t[45]=q);let J=q,Y;t[46]===u?Y=t[47]:(Y=(e,t)=>{let{alias:n,...r}=e,i=Wt(u,e.model);pe(K(e,i,t)?r:{...r,alias:t})},t[46]=u,t[47]=Y);let me=Y;V=async e=>{let t=e!==void 0&&e;if(y)return;let n=t?z:u,r=t&&w?w.drafts:oe;if(n.length===0||r.length===0)return;let i=n.map(e=>o.find(t=>t.environmentId===e.environmentId)??{...e,prices:null,aliases:null,unavailable:`Environment removed`}),a=new Map(i.map(e=>[e.environmentId,Kt(e,r)]));S(!0),T(e=>({drafts:r,destinations:t&&e?e.destinations:i,results:new Map([...t&&e?e.results:[],...i.map(on)])}));let s=!1;await Jt({targets:i.map(e=>({...e,unavailable:e.unavailable??[...a.get(e.environmentId).errors.values()][0]??null})),changes:new Map([...a].map(an)),write:async e=>H(e.environmentId,`settings:write`)?M(e):{_tag:`Failure`},onResult:(e,t)=>{t.status===`failed`&&(s=!0),T(n=>n===null?null:{...n,results:new Map(n.results).set(e,t)})}}),S(!1),s||_([])},F=ke,ae=!0,t[48]!==a||t[49]!==y?(se=e=>{y||a(e)},t[48]=a,t[49]=y,t[50]=se):se=t[50],P=Oe,re=`max-w-4xl`,t[51]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsxs)(Ce,{children:[(0,$.jsx)(we,{children:`Custom model prices`}),(0,$.jsx)(De,{children:`Prices and mappings apply to all past and future usage on the environments you select.`})]}),t[51]=ie):ie=t[51],N=Ee;let he;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,$.jsx)(Je,{id:`usage-prices-apply-label`,className:`shrink-0`,children:`Apply to`}),t[52]=he):he=t[52];let X;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,$.jsx)(E,{variant:`outline`,size:`sm`,className:`min-w-0`}),t[53]=X):X=t[53];let ye=y||B,be;t[54]===ce?be=t[55]:(be=(0,$.jsx)(`span`,{id:`usage-prices-selection`,className:`truncate`,children:ce}),t[54]=ce,t[55]=be);let Se;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,$.jsx)(p,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[56]=Se):Se=t[56];let Te;t[57]!==ye||t[58]!==be?(Te=(0,$.jsxs)(b,{render:X,"aria-labelledby":`usage-prices-apply-label usage-prices-selection`,disabled:ye,children:[be,Se]}),t[57]=ye,t[58]=be,t[59]=Te):Te=t[59];let Ae=s===null,je;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(je=e=>W(e?null:new Set),t[60]=je):je=t[60];let Me;t[61]===Ae?Me=t[62]:(Me=(0,$.jsx)(f,{checked:Ae,closeOnClick:!1,onCheckedChange:je,children:`All environments`}),t[61]=Ae,t[62]=Me);let Ne;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,$.jsx)(O,{}),t[63]=Ne):Ne=t[63];let Pe;if(t[64]!==o||t[65]!==u||t[66]!==s){let e;t[68]!==o.length||t[69]!==u||t[70]!==s?(e=e=>(0,$.jsx)(f,{checked:s===null||s.has(e.environmentId),closeOnClick:!1,onCheckedChange:t=>{let n=new Set(u.map(rn));t?n.add(e.environmentId):n.delete(e.environmentId),W(n.size===o.length?null:n)},children:(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.unavailable?(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.unavailable}):null]})},e.environmentId),t[68]=o.length,t[69]=u,t[70]=s,t[71]=e):e=t[71],Pe=o.map(e),t[64]=o,t[65]=u,t[66]=s,t[67]=Pe}else Pe=t[67];let Fe;t[72]!==Me||t[73]!==Pe?(Fe=(0,$.jsxs)(ee,{align:`start`,children:[Me,Ne,Pe]}),t[72]=Me,t[73]=Pe,t[74]=Fe):Fe=t[74];let Ie;t[75]!==Te||t[76]!==Fe?(Ie=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[he,(0,$.jsxs)(h,{children:[Te,Fe]})]}),t[75]=Te,t[76]=Fe,t[77]=Ie):Ie=t[77];let Le;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(Le=(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`USD / million tokens`}),t[78]=Le):Le=t[78],t[79]===Ie?te=t[80]:(te=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[Ie,Le]}),t[79]=Ie,t[80]=te),ne=u.length===0?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o.length===0?`Connect an environment to set model prices.`:`Select an environment to see and change its model prices.`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`min-w-0 overflow-hidden rounded-lg border border-border`,children:(0,$.jsxs)(Mt,{className:`min-w-180 table-fixed`,"aria-label":`Custom model prices`,children:[(0,$.jsxs)(`colgroup`,{children:[(0,$.jsx)(`col`,{className:`w-[22%]`}),(0,$.jsx)(`col`,{className:`w-[18%]`}),Rt.map(nn),(0,$.jsx)(`col`,{className:`w-10`})]}),(0,$.jsx)(Nt,{children:(0,$.jsxs)(Ft,{children:[(0,$.jsx)(It,{children:`Model ID`}),(0,$.jsx)(It,{children:`Map to`}),Rt.map(tn),(0,$.jsx)(It,{children:(0,$.jsx)(E,{size:`icon-xs`,variant:`ghost`,"aria-label":`Add model price`,disabled:U,onClick:()=>{k.current+=1;let e=`new:${k.current}`;D.current=e,de({id:e,model:``,isNew:!0,values:{}})},children:(0,$.jsx)(v,{"aria-hidden":!0})})})]})}),(0,$.jsx)(Pt,{children:j.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:u.some(en)?`Some environment prices are unavailable.`:`No custom prices or mappings. Add a row to set one.`})})}):j.map(e=>{let t=Wt(u,e.model),n=(e.alias??t.value).trim();return(0,$.jsxs)(Ft,{"data-row-id":e.id,children:[(0,$.jsxs)(Lt,{className:`whitespace-normal`,children:[e.isNew?(0,$.jsx)(xe,{size:`compact`,value:e.model,ref:t=>{t&&D.current===e.id&&(t.focus(),D.current=null)},"aria-label":`New model ID`,"aria-invalid":e.model.trim()!==``&&R.has(e.id)||void 0,list:`usage-price-models`,placeholder:`Model ID`,autoComplete:`off`,spellCheck:!1,disabled:U,onChange:t=>de({...e,model:t.target.value})}):(0,$.jsx)(`span`,{className:A(`block break-all`,e.removed&&`text-muted-foreground line-through`),children:e.model}),R.has(e.id)&&(e.model.trim()!==``||Object.values(e.values).some($t))?(0,$.jsx)(`p`,{role:`alert`,className:`mt-1 text-xs text-destructive`,children:R.get(e.id)}):null]}),e.removed?(0,$.jsx)(Lt,{colSpan:5,children:(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`Automatic pricing after saving`})}):(0,$.jsx)(Lt,{children:(0,$.jsx)(xe,{size:`compact`,value:e.alias??t.value,"aria-label":`Map ${e.model||`new model`} to model`,list:`usage-alias-models`,placeholder:e.isNew?`Optional`:t.placeholder,autoComplete:`off`,spellCheck:!1,disabled:U,onChange:t=>me(e,t.target.value)})}),e.removed?null:n===``?Rt.map(t=>{let n=Gt(u,e.model,t.key);return(0,$.jsx)(Lt,{children:(0,$.jsx)(xe,{size:`compact`,inputMode:`decimal`,"aria-label":`${t.label} price for ${e.model||`new model`}`,value:e.values[t.key]??(e.isNew?``:n.value),placeholder:e.isNew?t.optional?`Input rate`:`0.00`:n.placeholder,autoComplete:`off`,disabled:U,font:`mono`,onChange:n=>J(e,t.key,n.target.value)})},t.key)}):(0,$.jsx)(Lt,{colSpan:4,className:`whitespace-normal`,children:(0,$.jsxs)(`span`,{className:`break-all text-muted-foreground`,children:[`Counted as `,n]})}),(0,$.jsx)(Lt,{children:(0,$.jsxs)(ve,{children:[(0,$.jsx)(ge,{render:(0,$.jsx)(E,{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?pe({...e,removed:!1}):de({...e,removed:!0})},children:e.isNew?(0,$.jsx)(x,{"aria-hidden":!0}):(0,$.jsx)(g,{"aria-hidden":!0})}),(0,$.jsx)(_e,{children:e.removed?`Undo reset`:e.isNew?`Remove row`:`Reset to automatic`})]})})]},e.id)})})]})}),(0,$.jsx)(`datalist`,{id:`usage-price-models`,children:i.filter(t=>!e.includes(t)).map(Qt)}),(0,$.jsx)(`datalist`,{id:`usage-alias-models`,children:i.filter(e=>u.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.`,u.length>1?` Mixed cells keep each environment’s rate until you edit them.`:``]})]}),t[9]=w,t[10]=m,t[11]=o,t[12]=a,t[13]=y,t[14]=u,t[15]=s,t[16]=M,t[17]=n,t[18]=N,t[19]=P,t[20]=F,t[21]=I,t[22]=L,t[23]=R,t[24]=z,t[25]=B,t[26]=V,t[27]=te,t[28]=ne,t[29]=re,t[30]=ie,t[31]=ae,t[32]=se}else N=t[18],P=t[19],F=t[20],I=t[21],L=t[22],R=t[23],z=t[24],B=t[25],V=t[26],te=t[27],ne=t[28],re=t[29],ie=t[30],ae=t[31],se=t[32];let U;t[81]===w?U=t[82]:(U=w?(0,$.jsx)(`div`,{role:`status`,className:`grid gap-1 text-xs`,children:w.destinations.map(e=>{let t=w.results.get(e.environmentId);return(0,$.jsxs)(`div`,{className:`flex justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`truncate text-muted-foreground`,children:e.label}),(0,$.jsx)(`span`,{className:t?.status===`failed`?`text-right text-destructive`:`text-muted-foreground`,children:t?.status===`failed`?`Not saved · ${t.error}`:t?.status===`saved`?`Saved`:`Saving…`})]},e.environmentId)})}):null,t[81]=w,t[82]=U);let le;t[83]!==N||t[84]!==U||t[85]!==te||t[86]!==ne?(le=(0,$.jsxs)(N,{children:[te,ne,U]}),t[83]=N,t[84]=U,t[85]=te,t[86]=ne,t[87]=le):le=t[87];let ue=B?`Changes apply to ${I}`:``,W;t[88]===ue?W=t[89]:(W=(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:ue}),t[88]=ue,t[89]=W);let G;t[90]!==L||t[91]!==z.length||t[92]!==B||t[93]!==y?(G=B?(0,$.jsx)(E,{variant:`ghost`,disabled:y,onClick:L,children:z.length>0?`Discard pending changes`:`Discard changes`}):null,t[90]=L,t[91]=z.length,t[92]=B,t[93]=y,t[94]=G):G=t[94];let de=y||!B&&z.length===0||z.length===0&&(R.size>0||u.length===0),K;t[95]!==z.length||t[96]!==V?(K=()=>void V(z.length>0),t[95]=z.length,t[96]=V,t[97]=K):K=t[97];let fe=y?`Saving…`:z.length>0?`Retry failed saves`:`Save changes`,pe;t[98]!==de||t[99]!==K||t[100]!==fe?(pe=(0,$.jsx)(E,{disabled:de,onClick:K,children:fe}),t[98]=de,t[99]=K,t[100]=fe,t[101]=pe):pe=t[101];let q;t[102]!==G||t[103]!==pe?(q=(0,$.jsxs)(`div`,{className:`flex w-full flex-wrap justify-end gap-2 sm:w-auto`,children:[G,pe]}),t[102]=G,t[103]=pe,t[104]=q):q=t[104];let J;t[105]!==W||t[106]!==q?(J=(0,$.jsxs)(Te,{variant:`bare`,className:`items-center sm:justify-between`,children:[W,q]}),t[105]=W,t[106]=q,t[107]=J):J=t[107];let Y;t[108]!==P||t[109]!==le||t[110]!==J||t[111]!==re||t[112]!==ie?(Y=(0,$.jsxs)(P,{className:re,children:[ie,le,J]}),t[108]=P,t[109]=le,t[110]=J,t[111]=re,t[112]=ie,t[113]=Y):Y=t[113];let me;return t[114]!==F||t[115]!==Y||t[116]!==ae||t[117]!==se?(me=(0,$.jsx)(F,{open:ae,onOpenChange:se,children:Y}),t[114]=F,t[115]=Y,t[116]=ae,t[117]=se,t[118]=me):me=t[118],me}function Zt(e){return(0,$.jsx)(`option`,{value:e},e)}function Qt(e){return(0,$.jsx)(`option`,{value:e},e)}function $t(e){return e!==``}function en(e){return e.prices===null}function tn(e){return(0,$.jsx)(It,{children:e.label},e.key)}function nn(e){return(0,$.jsx)(`col`,{},e.key)}function rn(e){return e.environmentId}function an(e){let[t,n]=e;return[t,n.changes]}function on(e){return[e.environmentId,{status:`saving`}]}function sn(e,t,n){return!e.isNew&&t.placeholder!==`Mixed`&&t.placeholder!==`Unavailable`&&n===t.value}function cn(e){return!Vt(e)}function ln(e){return e.isNew}function un(e){return e.model.trim()}function dn(e){return e.isNew}function fn(e){return e.summary?.buckets.map(pn)??[]}function pn(e){return e.model}function mn(e){return[...Object.keys(e.prices??{}),...Object.keys(e.aliases??{})]}var hn=960,gn=260,_n=4,vn=8,yn=new Set;function bn(e,t,n){let r=e?.byProvider.get(t);return r===void 0?0:n===`tokens`?r.totalTokens:r.costUsd}function xn(e,t,n){return e.map(e=>{let r=t.get(e),i=Ge.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=Ge.indexOf(e),n=wn(Cn(a.map((e,n)=>({x:n*s,y:kn(e.bands[t]?.value??0,o.max)}))));return{provider:e,loading:i.has(e),total:a.reduce((e,n)=>e+(n.bands[t]?.value??0),0),line:n,area:Tn(n)}}).toSorted((e,t)=>t.total-e.total)}}function jn(e){let t=(0,Q.c)(97),{providers:n,loadingProviders:r,days:i,daily:a,hours:o,hourly:s,metric:c,referenceTime:l,resolution:u,timeZone:d}=e,f=r===void 0?yn:r,p=u===`hour`?o:i,m;t[0]!==a||t[1]!==s||t[2]!==u?(m=u===`hour`?new Map(s.map(Pn)):new Map(a.map(Nn)),t[0]=a,t[1]=s,t[2]=u,t[3]=m):m=t[3];let h=m,[g,_]=(0,Z.useState)(null),v=(0,Z.useRef)(null),y=(0,Z.useRef)(null),b=(0,Z.useRef)(null),x;t[4]!==h||t[5]!==f||t[6]!==c||t[7]!==p||t[8]!==n?(x=An(p,h,c,n,f),t[4]=h,t[5]=f,t[6]=c,t[7]=p,t[8]=n,t[9]=x):x=t[9];let{columns:S,scale:C,paths:w,stepX:T}=x,E;t[10]===C.max?E=t[11]:(E=e=>kn(e,C.max),t[10]=C.max,t[11]=E);let D=E,ee=Mn,O=c===`tokens`?K:W,k;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>{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]=k):k=t[12];let j=k,M,N;t[13]===g?(M=t[14],N=t[15]):(M=()=>{if(g===null)return;j();let e=v.current,t=y.current;if(e!==null&&t!==null)return je([e,t],j)},N=[g,j],t[13]=g,t[14]=M,t[15]=N),(0,Z.useLayoutEffect)(M,N);let P;t[16]===p.length?P=t[17]:(P=e=>{let t=v.current;if(t===null||p.length===0)return;let n=t.getBoundingClientRect();if(n.width===0)return;let r=Math.min(n.width,Math.max(0,e.clientX-n.left)),i=Math.min(n.height,Math.max(0,e.clientY-n.top)),a=r/n.width,o=Math.round(a*(p.length-1));b.current={x:r,y:i},j(),_(Math.min(p.length-1,Math.max(0,o)))},t[16]=p.length,t[17]=P);let F=P,I=g===null?void 0:p[g],L=g===null?void 0:S[g],R;if(t[18]!==f||t[19]!==n){let e;t[21]===f?e=t[22]:(e=e=>f.has(e),t[21]=f,t[22]=e),R=n.some(e),t[18]=f,t[19]=n,t[20]=R}else R=t[20];let z=R,B;t[23]!==u||t[24]!==d?(B=e=>u===`hour`?pe(e,d):le(e),t[23]=u,t[24]=d,t[25]=B):B=t[25];let V=B,te;t[26]!==V||t[27]!==l||t[28]!==u||t[29]!==d?(te=e=>u===`hour`&&l!==void 0?ue(e,l,d):V(e),t[26]=V,t[27]=l,t[28]=u,t[29]=d,t[30]=te):te=t[30];let ne=te,re;t[31]!==O||t[32]!==C.labeled||t[33]!==C.ticks||t[34]!==D?(re=C.labeled?C.ticks.map(e=>(0,$.jsx)(`span`,{className:`absolute right-0 -translate-y-1/2 text-3xs text-muted-foreground tabular-nums`,style:{top:`${D(e)/gn*100}%`},children:e===0?`0`:O(e)},e)):null,t[31]=O,t[32]=C.labeled,t[33]=C.ticks,t[34]=D,t[35]=re):re=t[35];let ie;t[36]===re?ie=t[37]:(ie=(0,$.jsx)(`div`,{className:`relative h-56 w-14 shrink-0`,children:re}),t[36]=re,t[37]=ie);let ae;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ae=()=>{b.current=null,_(null)},t[38]=ae):ae=t[38];let oe=`${u===`hour`?`Hourly`:`Daily`} ${c===`tokens`?`processed tokens`:`cost`} by provider`,se;if(t[39]!==C.ticks||t[40]!==D){let e;t[42]===D?e=t[43]:(e=e=>{let t=D(e);return(0,$.jsx)(`line`,{x1:0,x2:hn,y1:t,y2:t,stroke:`currentColor`,strokeWidth:1,className:`text-border`,vectorEffect:`non-scaling-stroke`},e)},t[42]=D,t[43]=e),se=C.ticks.map(e),t[39]=C.ticks,t[40]=D,t[41]=se}else se=t[41];let H;if(t[44]!==w){let e;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(e=e=>{let{provider:t,loading:n,area:r}=e;return(0,$.jsx)(`path`,{d:r,className:ee(n),fill:Ke[t].color,fillOpacity:.12},t)},t[46]=e):e=t[46],H=w.map(e),t[44]=w,t[45]=H}else H=t[45];let U;if(t[47]!==w){let e;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(e=e=>{let{provider:t,loading:n,line:r}=e;return(0,$.jsx)(`path`,{d:r,className:ee(n),fill:`none`,stroke:Ke[t].color,strokeWidth:2,vectorEffect:`non-scaling-stroke`},t)},t[49]=e):e=t[49],U=w.map(e),t[47]=w,t[48]=U}else U=t[48];let ce;t[50]!==g||t[51]!==T?(ce=g===null?null:(0,$.jsx)(`line`,{x1:g*T,x2:g*T,y1:vn,y2:gn,stroke:`currentColor`,strokeWidth:1,className:`text-muted-foreground`,vectorEffect:`non-scaling-stroke`}),t[50]=g,t[51]=T,t[52]=ce):ce=t[52];let G;t[53]!==oe||t[54]!==se||t[55]!==H||t[56]!==U||t[57]!==ce?(G=(0,$.jsxs)(`svg`,{className:`h-full w-full`,viewBox:`0 0 ${hn} ${gn}`,preserveAspectRatio:`none`,role:`img`,"aria-label":oe,children:[se,H,U,ce]}),t[53]=oe,t[54]=se,t[55]=H,t[56]=U,t[57]=ce,t[58]=G):G=t[58];let de;t[59]!==O||t[60]!==ne||t[61]!==L?.bands||t[62]!==L?.total||t[63]!==I||t[64]!==f||t[65]!==z||t[66]!==n?(de=I===void 0?null:(0,$.jsxs)(`div`,{ref:y,className:`surface-glass pointer-events-none absolute z-10 min-w-36 max-w-full rounded-xl border border-border/50 px-2.5 py-2 text-xs shadow-lg`,style:{left:`var(--usage-tooltip-left, 0px)`,top:`var(--usage-tooltip-top, 0px)`},children:[(0,$.jsx)(`div`,{className:`mb-1 text-muted-foreground`,children:ne(I)}),n.map(e=>{let{label:t,driverKind:n}=Ke[e];return(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,$.jsx)(Le,{driverKind:n,displayName:t,iconClassName:`size-3`}),t]}),(0,$.jsx)(`span`,{className:A(`tabular-nums`,f.has(e)?`text-muted-foreground`:`text-foreground`),children:O(L?.bands.find(t=>t.provider===e)?.value??0)})]},e)}),(0,$.jsxs)(`div`,{className:`mt-1 flex items-center justify-between gap-3 border-t border-border pt-1`,children:[(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`Total`}),(0,$.jsx)(`span`,{className:A(`tabular-nums`,z?`text-muted-foreground`:`text-foreground`),children:O(L?.total??0)})]})]}),t[59]=O,t[60]=ne,t[61]=L?.bands,t[62]=L?.total,t[63]=I,t[64]=f,t[65]=z,t[66]=n,t[67]=de):de=t[67];let fe;t[68]!==F||t[69]!==G||t[70]!==de?(fe=(0,$.jsxs)(`div`,{ref:v,className:`relative h-56 flex-1`,onMouseMove:F,onMouseLeave:ae,children:[G,de]}),t[68]=F,t[69]=G,t[70]=de,t[71]=fe):fe=t[71];let q;t[72]!==ie||t[73]!==fe?(q=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[ie,fe]}),t[72]=ie,t[73]=fe,t[74]=q):q=t[74];let J;t[75]!==V||t[76]!==p[0]?(J=p[0]===void 0?``:V(p[0]),t[75]=V,t[76]=p[0],t[77]=J):J=t[77];let Y;t[78]===J?Y=t[79]:(Y=(0,$.jsx)(`span`,{children:J}),t[78]=J,t[79]=Y);let me;t[80]!==V||t[81]!==p?(me=p[Math.floor(p.length/2)]===void 0?``:V(p[Math.floor(p.length/2)]??``),t[80]=V,t[81]=p,t[82]=me):me=t[82];let he;t[83]===me?he=t[84]:(he=(0,$.jsx)(`span`,{children:me}),t[83]=me,t[84]=he);let ge;t[85]!==V||t[86]!==p?(ge=p[p.length-1]===void 0?``:V(p[p.length-1]??``),t[85]=V,t[86]=p,t[87]=ge):ge=t[87];let _e;t[88]===ge?_e=t[89]:(_e=(0,$.jsx)(`span`,{children:ge}),t[88]=ge,t[89]=_e);let ve;t[90]!==Y||t[91]!==he||t[92]!==_e?(ve=(0,$.jsxs)(`div`,{className:`flex justify-between pl-16 text-3xs text-muted-foreground uppercase`,children:[Y,he,_e]}),t[90]=Y,t[91]=he,t[92]=_e,t[93]=ve):ve=t[93];let X;return t[94]!==q||t[95]!==ve?(X=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[q,ve]}),t[94]=q,t[95]=ve,t[96]=X):X=t[96],X}function Mn(e){return A(`transition-opacity`,e&&`opacity-40 delay-150`)}function Nn(e){return[e.day,e]}function Pn(e){return[e.hourStart,e]}function Fn(e){let t=(0,Q.c)(30),{label:n,segments:r,format:i,aside:a}=e,o,s,c,l,u,d;if(t[0]!==a||t[1]!==i||t[2]!==n||t[3]!==r){d=Symbol.for(`react.early_return_sentinel`);bb0:{let e=r.filter(Ln),f=e.reduce(In,0);if(f<=0){d=null;break bb0}c=`flex min-w-0 flex-col gap-2.5`;let p;t[10]===n?p=t[11]:(p=(0,$.jsx)(`h3`,{className:`text-sm font-medium text-foreground`,children:n}),t[10]=n,t[11]=p),t[12]!==a||t[13]!==p?(l=(0,$.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[p,a]}),t[12]=a,t[13]=p,t[14]=l):l=t[14];let m;t[15]===i?m=t[16]:(m=e=>`${e.label} ${i(e.value)}`,t[15]=i,t[16]=m);let h;t[17]!==i||t[18]!==f?(h=e=>(0,$.jsxs)(ve,{children:[(0,$.jsx)(ge,{render:(0,$.jsx)(`div`,{className:`h-full min-w-1 rounded-xs first:rounded-l-full last:rounded-r-full`,style:{flex:`${e.value} 1 0`,backgroundColor:e.color}})}),(0,$.jsxs)(_e,{children:[e.label,` · `,i(e.value),` · `,J(e.value/f)]})]},e.label),t[17]=i,t[18]=f,t[19]=h):h=t[19],u=(0,$.jsx)(`div`,{role:`img`,"aria-label":`${n}: ${e.map(m).join(`, `)}`,className:`flex h-2 gap-0.5`,children:e.map(h)}),o=`flex flex-wrap gap-x-4 gap-y-1 text-xs`;let g;t[20]===i?g=t[21]:(g=e=>(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`size-2 rounded-xs`,style:{backgroundColor:e.color}}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:e.label}),(0,$.jsx)(`span`,{className:`text-foreground tabular-nums`,children:i(e.value)})]},e.label),t[20]=i,t[21]=g),s=e.map(g)}t[0]=a,t[1]=i,t[2]=n,t[3]=r,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d}else o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9];if(d!==Symbol.for(`react.early_return_sentinel`))return d;let f;t[22]!==o||t[23]!==s?(f=(0,$.jsx)(`div`,{className:o,children:s}),t[22]=o,t[23]=s,t[24]=f):f=t[24];let p;return t[25]!==c||t[26]!==l||t[27]!==u||t[28]!==f?(p=(0,$.jsxs)(`div`,{className:c,children:[l,u,f]}),t[25]=c,t[26]=l,t[27]=u,t[28]=f,t[29]=p):p=t[29],p}function In(e,t){return e+t.value}function Ln(e){return e.value>0}function Rn(e){return e.toSorted((e,t)=>t.totalTokens-e.totalTokens||t.costUsd-e.costUsd)}function zn(e,t){return t===`tokens`?e.tokenShare:pt(e)?null:e.costShare}function Bn({tokens:e}){let t=e.uncachedInputTokens+e.cachedInputTokens+e.cacheCreationTokens;return t===0?null:e.cachedInputTokens/t}function Vn(e){let t=e.totalTokens-e.unpricedTokens;return t<=0||pt(e)?null:e.costUsd/t*1e6}var Hn=e=>`color-mix(in oklab, var(--foreground) ${e}%, var(--background))`,Un={input:Hn(60),cacheRead:Hn(30),cacheWrite:Hn(72),output:Hn(100),other:Hn(44)};function Wn(e){return[{label:`Input`,value:e.input,color:Un.input},{label:`Cache read`,value:e.cacheRead,color:Un.cacheRead},{label:`Cache write`,value:e.cacheWrite,color:Un.cacheWrite},{label:`Output`,value:e.output,color:Un.output},{label:`Other`,value:e.unsplit>=.005?e.unsplit:0,color:Un.other}]}function Gn(e){return[{label:`Input`,value:e.uncachedInputTokens,color:Un.input},{label:`Cache read`,value:e.cachedInputTokens,color:Un.cacheRead},{label:`Cache write`,value:e.cacheCreationTokens,color:Un.cacheWrite},{label:`Output`,value:e.outputTokens,color:Un.output}]}function Kn(e){return[{label:`Standard`,value:e.standard,color:Hn(34)},{label:`Fast`,value:e.fast,color:Hn(66)},{label:`Ultrafast`,value:e.ultrafast,color:Hn(100)}]}function qn(e){let t=(0,Q.c)(80),{model:n,environments:r,metric:i,chartWindow:a,onSetPrice:o,onClose:s}=e,c;t[0]!==n.model||t[1]!==n.provider?(c=e=>e.provider===n.provider&&e.model===n.model,t[0]=n.model,t[1]=n.provider,t[2]=c):c=t[2];let l;t[3]!==r||t[4]!==c?(l=wt(r,c),t[3]=r,t[4]=c,t[5]=l):l=t[5];let u=l,d;t[6]===n.provider?d=t[7]:(d=[n.provider],t[6]=n.provider,t[7]=d);let f=d,p=Ke[n.provider],m;t[8]===n?m=t[9]:(m=pt(n),t[8]=n,t[9]=m);let h=m,g;if(t[10]!==h||t[11]!==n){let e=Bn(n),r=Vn(n),i;t[13]!==h||t[14]!==n.costUsd?(i=h?`Unpriced`:W(n.costUsd),t[13]=h,t[14]=n.costUsd,t[15]=i):i=t[15];let a;t[16]===i?a=t[17]:(a={label:`Cost`,value:i},t[16]=i,t[17]=a);let o;t[18]===n.totalTokens?o=t[19]:(o=K(n.totalTokens),t[18]=n.totalTokens,t[19]=o);let s;t[20]===o?s=t[21]:(s={label:`Tokens`,value:o},t[20]=o,t[21]=s),g=[a,s,r===null?null:{label:`Per 1M tokens`,value:W(r)},e===null?null:{label:`Cache hit`,value:J(e)}].filter(Yn),t[10]=h,t[11]=n,t[12]=g}else g=t[12];let _=g,v;t[22]===s?v=t[23]:(v=e=>{e||s()},t[22]=s,t[23]=v);let y;t[24]!==p.driverKind||t[25]!==p.label?(y=(0,$.jsx)(Le,{driverKind:p.driverKind,displayName:p.label,iconClassName:`size-5`}),t[24]=p.driverKind,t[25]=p.label,t[26]=y):y=t[26];let b;t[27]===n.model?b=t[28]:(b=(0,$.jsx)(we,{children:n.model}),t[27]=n.model,t[28]=b);let x;t[29]!==y||t[30]!==b?(x=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[y,b]}),t[29]=y,t[30]=b,t[31]=x):x=t[31];let S;t[32]!==h||t[33]!==n.costShare?(S=h?``:` · ${J(n.costShare)} of cost`,t[32]=h,t[33]=n.costShare,t[34]=S):S=t[34];let C;t[35]!==p.label||t[36]!==S?(C=(0,$.jsxs)(De,{children:[p.label,S]}),t[35]=p.label,t[36]=S,t[37]=C):C=t[37];let w;t[38]!==C||t[39]!==x?(w=(0,$.jsxs)(Ce,{children:[x,C]}),t[38]=C,t[39]=x,t[40]=w):w=t[40];let T;t[41]===_?T=t[42]:(T=(0,$.jsx)(`div`,{className:`grid grid-cols-2 gap-x-6 gap-y-4 sm:grid-cols-4`,children:_.map(Jn)}),t[41]=_,t[42]=T);let D=h?`tokens`:i,ee;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?(ee=(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]=ee):ee=t[52];let O;t[53]!==h||t[54]!==u.categoryCost?(O=h?null:(0,$.jsx)(Fn,{label:`Cost by type`,segments:Wn(u.categoryCost),format:W}),t[53]=h,t[54]=u.categoryCost,t[55]=O):O=t[55];let k;t[56]===n.tokens?k=t[57]:(k=Gn(n.tokens),t[56]=n.tokens,t[57]=k);let A;t[58]===k?A=t[59]:(A=(0,$.jsx)(Fn,{label:`Tokens by type`,segments:k,format:K}),t[58]=k,t[59]=A);let j;t[60]===u.speedCost?j=t[61]:(j=u.speedCost.fast+u.speedCost.ultrafast>0?(0,$.jsx)(Fn,{label:`Cost by speed`,segments:Kn(u.speedCost),format:W,aside:(0,$.jsx)(Xn,{premiumUsd:u.speedCost.premium})}):null,t[60]=u.speedCost,t[61]=j);let M;t[62]!==O||t[63]!==A||t[64]!==j?(M=(0,$.jsxs)(`div`,{className:`grid gap-x-10 gap-y-8 sm:grid-cols-2`,children:[O,A,j]}),t[62]=O,t[63]=A,t[64]=j,t[65]=M):M=t[65];let N;t[66]!==T||t[67]!==ee||t[68]!==M?(N=(0,$.jsx)(Ee,{children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[T,ee,M]})}),t[66]=T,t[67]=ee,t[68]=M,t[69]=N):N=t[69];let P;t[70]!==n.unpricedTokens||t[71]!==o?(P=n.unpricedTokens>0?(0,$.jsxs)(Te,{variant:`bare`,className:`items-center sm:justify-between`,children:[(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[K(n.unpricedTokens),` tokens have no known price`]}),(0,$.jsx)(E,{onClick:o,children:`Set price`})]}):null,t[70]=n.unpricedTokens,t[71]=o,t[72]=P):P=t[72];let F;t[73]!==w||t[74]!==N||t[75]!==P?(F=(0,$.jsxs)(Oe,{className:`max-w-3xl`,children:[w,N,P]}),t[73]=w,t[74]=N,t[75]=P,t[76]=F):F=t[76];let I;return t[77]!==F||t[78]!==v?(I=(0,$.jsx)(ke,{open:!0,onOpenChange:v,children:F}),t[77]=F,t[78]=v,t[79]=I):I=t[79],I}function Jn(e){return(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.label}),(0,$.jsx)(`span`,{className:`text-2xl font-semibold text-foreground`,children:e.value})]},e.label)}function Yn(e){return e!==null}function Xn(e){let t=(0,Q.c)(4),{premiumUsd:n}=e,r;t[0]===n?r=t[1]:(r=W(n),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Premium `,(0,$.jsx)(`span`,{className:`text-foreground tabular-nums`,children:r})]}),t[2]=r,t[3]=i),i}var Zn=`p4code:usage-page-preferences:v1`,Qn=u({metric:P([`cost`,`tokens`,`limits`]),windowDays:P([1,7,30,90]),hiddenProviders:D(M(T))}),$n={metric:`limits`,windowDays:30};function er(){try{return o(Zn,Qn)??$n}catch(e){return console.error(`Could not read Usage page preferences.`,e),$n}}function tr(e){try{c(Zn,e,Qn)}catch(e){console.error(`Could not save Usage page preferences.`,e)}}function nr(e){return He.some(t=>t.value===e)}function rr(e){return Be.some(t=>t.days===e)}var ir=e=>Ke[e].label;function ar(){let[e,t]=(0,Z.useState)(er);ie();let n=C(se),r=e=>{let t=Me(n,e.command,{context:{usagePageOpen:!0}});return t?`${e.label} (${t})`:e.label},[i,a]=(0,Z.useState)(()=>({days:e.windowDays,window:G(e.windowDays,void 0,e.windowDays===1?`hour`:`day`)})),o=e.metric,s=o===`limits`,[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(()=>Date.now()),f=(0,Z.useRef)(!1),[p,m]=(0,Z.useState)(`model`),[h,g]=(0,Z.useState)(null),[v,y]=(0,Z.useState)(null),[b,x]=(0,Z.useState)(null),w=(0,Z.useMemo)(()=>new Set(e.hiddenProviders),[e.hiddenProviders]),{days:T,window:D}=i,ee=T===1,{merged:O,environments:k,selectedEnvironments:j,shown:M,isPartial:N,refresh:P}=Dt(D,b,w),F=M?.merged??O,I=M?.window??D,L=I.resolution===`hour`,R=c&&!s,z=M!==null&&M.window!==D,H=(0,Z.useMemo)(()=>{if(z)return{partial:!0,everyProvider:!0,providers:new Set};let e=ft(j,R),t=new Set([...e.providers].filter(e=>!w.has(e)));return{partial:e.everyProvider||t.size>0,everyProvider:e.everyProvider,providers:t}},[z,R,j,w]),U=e=>H.everyProvider||H.providers.has(e),ue=C(ae.presentationsAtom),me=(0,Z.useMemo)(()=>new Map([...ue].filter(([,e])=>e.entry.enabled&&e.entry.unsupportedReason===void 0)),[ue]),ge=w.has(`cursor`)?[]:at(j),_e=[...new Set(j.flatMap(e=>e.summary?.sources.flatMap(e=>e.message&&!e.action&&!w.has(e.fingerprint.provider)&&(e.status===`partial`||e.status===`failed`||e.fingerprint.provider===`cursor`)?[e.message]:[])??[]))],ve=ce(oe.refreshProviders,{reportFailure:!1}),X=j.some(e=>e.canReadDiagnostics),xe=(0,Z.useMemo)(()=>Y(I.sinceDay,I.untilDay),[I.sinceDay,I.untilDay]),Ce=(0,Z.useMemo)(()=>I.sinceTime===void 0||I.untilTime===void 0?[]:fe(I.sinceTime,I.untilTime),[I.sinceTime,I.untilTime]),we=(0,Z.useMemo)(()=>(L?F.hourly:F.daily).toReversed(),[L,F.daily,F.hourly]),Te=(0,Z.useMemo)(()=>p===`model`&&o===`tokens`?Rn(F.models):F.models,[p,F.models,o]),Ee=(0,Z.useMemo)(()=>Xe(F.providers),[F.providers]),De=(0,Z.useMemo)(()=>Ge.filter(e=>Ee.includes(e)||H.providers.has(e)),[H.providers,Ee]),Oe=(0,Z.useMemo)(()=>new Set(De.filter(e=>H.everyProvider||H.providers.has(e))),[De,H.everyProvider,H.providers]),ke=v===null?void 0:F.models.find(e=>`${e.provider}:${e.model}`===v),je=Te.reduce((e,t)=>Math.max(e,o===`tokens`?t.totalTokens:t.costUsd),0),Le=De.map(e=>({kind:`usage`,provider:e})),Je=Math.max(De.indexOf(`codex`),De.indexOf(`claude`))+1;Le.splice(Je,0,...ge.map(e=>({kind:`enable`,environment:e})));let Qe=`${60/(De.length+2)}%`,nt=n=>{let r={...e,...n};t(r),tr(r)},Q=e=>{rr(e)&&(nt({windowDays:e}),a({days:e,window:G(e,void 0,e===1?`hour`:`day`)}))},rt=e=>{e===`limits`&&d(Date.now()),nt({metric:e})},it=async(e=!1,t=!1)=>{try{await Promise.all(Array.from(me,([n,r])=>{if((b===null||b.has(n))&&r.connection.phase===`connected`&&r.serverConfig!==null)return ct(n,()=>ve({environmentId:n,input:{}}),e,t)}))}finally{d(Date.now())}},ot=(0,Z.useEffectEvent)(e=>{if(e.defaultPrevented||e.repeat||e.isComposing||qe()||Ye())return;let t=Ve(e,n),r=He.find(e=>e.command===t),i=Be.find(e=>e.command===t);(r||i)&&(e.preventDefault(),e.stopPropagation(),r&&rt(r.value),i&&!s&&Q(i.days))});(0,Z.useEffect)(()=>(globalThis.window.addEventListener(`keydown`,ot,!0),()=>globalThis.window.removeEventListener(`keydown`,ot,!0)),[]);let st=()=>{if(f.current)return;if(s){f.current=!0,l(!0),it().finally(()=>{f.current=!1,l(!1)});return}let e=G(T,void 0,ee?`hour`:`day`);(e.sinceDay!==D.sinceDay||e.untilDay!==D.untilDay||e.sinceTime!==D.sinceTime||e.untilTime!==D.untilTime)&&a({days:T,window:e}),f.current=!0,l(!0),P(e).finally(()=>{f.current=!1,l(!1)})},lt=[...me].filter(([e,t])=>t.connection.phase===`connected`&&t.serverConfig!==null&&(b===null||b.has(e))).map(([e])=>e).sort().join(`,`),ut=(0,Z.useEffectEvent)(()=>{it(!0)});(0,Z.useEffect)(()=>{s&<&&ut()},[s,lt]);let dt=L&&I.sinceTime!==void 0&&I.untilTime!==void 0?`${de(I.sinceTime,I.timeZone)} to ${de(I.untilTime,I.timeZone)}`:`${le(I.sinceDay)} to ${le(I.untilDay)}`,mt=(0,$.jsxs)(`div`,{className:`grid w-full min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 py-2 @4xl/usage-header:flex`,children:[(0,$.jsxs)(tt,{ariaLabel:`Usage breadcrumb`,className:`min-w-0`,children:[(0,$.jsx)($e,{children:(0,$.jsx)(`h1`,{children:`Usage`})}),(0,$.jsx)(et,{}),(0,$.jsx)($e,{className:`min-w-10 shrink`,children:(0,$.jsx)(vr,{environments:k,selectedEnvironments:j,selectedEnvironmentIds:b,onSelectionChange:x,showUsageStatus:!s,refreshing:R,isPartial:N,duplicateSources:F.duplicateSources,contractMismatches:F.contractMismatches,onOpenModelPrices:()=>g({})})}),(0,$.jsx)(et,{}),(0,$.jsx)($e,{current:!0,className:`min-w-10`,children:(0,$.jsx)(xr,{hiddenProviders:w,onChange:e=>nt({hiddenProviders:e})})})]}),s?null:(0,$.jsx)(`span`,{className:`hidden min-w-0 truncate text-xs text-muted-foreground @7xl/usage-header:block`,children:dt}),(0,$.jsxs)(`div`,{className:`ms-auto hidden shrink-0 items-center justify-end gap-2 @4xl/usage-header:flex`,children:[(0,$.jsx)(ye,{"aria-label":`Usage metric`,variant:`segmented`,value:[o],onValueChange:e=>{let t=e[0];nr(t)&&rt(t)},children:He.map(e=>(0,$.jsx)(be,{value:e.value,title:r(e),children:e.label},e.value))}),(0,$.jsx)(ye,{"aria-label":`Usage period`,variant:`segmented`,value:[String(T)],disabled:s,onValueChange:e=>{let t=e[0];t&&Q(Number(t))},children:Be.map(e=>(0,$.jsx)(be,{value:String(e.days),title:r(e),children:e.label},e.days))}),(0,$.jsx)(E,{onClick:st,"aria-label":s?`Refresh limits`:`Refresh usage`,"aria-busy":c,disabled:c||!s&&!X,size:`icon-sm`,variant:`ghost`,children:(0,$.jsx)(Ue,{size:`sm`,refreshing:c})})]}),(0,$.jsxs)(`div`,{className:`ms-auto flex shrink-0 items-center justify-end gap-1 @4xl/usage-header:hidden`,children:[(0,$.jsxs)(re,{value:o,onValueChange:e=>{nr(e)&&rt(e)},children:[(0,$.jsx)(ne,{"aria-label":`Usage metric`,size:`compact`,variant:`ghost`,className:`w-auto min-w-0`,children:(0,$.jsx)(V,{children:He.find(e=>e.value===o)?.label})}),(0,$.jsx)(te,{align:`end`,alignItemWithTrigger:!1,children:He.map(e=>(0,$.jsx)(B,{value:e.value,title:r(e),children:e.label},e.value))})]}),(0,$.jsxs)(re,{value:String(T),disabled:s,onValueChange:e=>Q(Number(e)),children:[(0,$.jsx)(ne,{"aria-label":`Usage period`,size:`compact`,variant:`ghost`,className:`w-auto min-w-0`,children:(0,$.jsx)(V,{children:Be.find(e=>e.days===T)?.label})}),(0,$.jsx)(te,{align:`end`,alignItemWithTrigger:!1,children:Be.map(e=>(0,$.jsx)(B,{value:String(e.days),title:r(e),children:e.label},e.days))})]}),(0,$.jsx)(E,{onClick:st,"aria-label":s?`Refresh limits`:`Refresh usage`,"aria-busy":c,disabled:c||!s&&!X,size:`icon-sm`,variant:`ghost`,children:(0,$.jsx)(Ue,{size:`sm`,refreshing:c})})]})]});return(0,$.jsxs)(Ae,{className:`h-dvh min-h-0 overflow-hidden overscroll-y-none isolate`,children:[(0,$.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-background text-foreground`,children:[(0,$.jsx)(Ze,{electron:he,className:`@container/usage-header`,children:mt}),(0,$.jsx)(Se,{className:`min-h-0 flex-1`,children:(0,$.jsx)(ze,{width:`wide`,children:j.length===0?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:k.length===0?`Connect an environment to see ${s?`limits`:`usage`}.`:`Select an environment to see ${s?`limits`:`usage`}.`}):s?(0,$.jsx)(We,{selectedEnvironmentIds:b,hiddenProviders:w,now:u,cursorPrompt:ge.length>0?(0,$.jsx)(lr,{environments:ge,onEnabled:()=>{P(),it(!1,!0)}}):null}):M===null?(0,$.jsx)(Sr,{}):X?(0,$.jsxs)(`div`,{"aria-busy":H.partial,className:`flex flex-col gap-6`,children:[_e.map(e=>(0,$.jsx)(`p`,{className:`mb-4 text-sm text-muted-foreground`,children:e},e)),(0,$.jsxs)(`section`,{className:`grid gap-6 lg:grid-cols-[minmax(0,18rem)_minmax(0,1fr)]`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:A(`text-4xl font-semibold text-foreground tabular-nums`,dr(H.partial)),children:o===`cost`?W(F.costUsd):K(F.totalTokens)}),(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,$.jsxs)(`span`,{children:[(0,$.jsxs)(`span`,{className:dr(H.partial),children:[q(F.sessions),` sessions`]}),o===`cost`&&` · API estimate`]}),o===`cost`&&F.costQuality.unpricedShare>0&&(0,$.jsxs)(Fe,{children:[(0,$.jsx)(Pe,{openOnHover:!0,render:(0,$.jsx)(S,{tone:`muted`}),"aria-label":`Unpriced usage details`,children:(0,$.jsx)(_,{className:`size-3`,"aria-hidden":!0})}),(0,$.jsxs)(Ne,{side:`top`,tooltipStyle:!0,children:[`API estimate excludes`,` `,J(F.costQuality.unpricedShare),` unpriced records.`]})]})]})]}),!w.has(`codex`)&&[...me].some(([e,t])=>(b===null||b.has(e))&&t.serverConfig?.providers.some(Ie))?(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:`ChatGPT shared usage`}),(0,$.jsx)(Re,{size:`xs`})]}):null,Le.map(e=>{if(e.kind===`enable`)return(0,$.jsx)(cr,{environmentId:e.environment.environmentId,label:e.environment.label,showEnvironment:j.length>1,onEnabled:()=>{P(),it(!1,!0)}},`enable:${e.environment.environmentId}`);let t=e.provider,n=F.providers.find(e=>e.provider===t),r=o===`cost`?n?.costShare??0:n?.tokenShare??0,i=n?.sessions??0,a=`${q(i)} ${i===1?`session`:`sessions`}`,s=U(t),c=s&&!Ee.includes(t);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-sm text-foreground`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`size-2 shrink-0 rounded-full`,style:{backgroundColor:Ke[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:Ke[t].label}),(0,$.jsx)(`span`,{className:A(`shrink-0 whitespace-nowrap text-2xs text-muted-foreground tabular-nums`,dr(s),c&&`invisible`),children:a})]})]}),(0,$.jsx)(`span`,{className:A(`shrink-0 text-sm font-medium text-foreground tabular-nums`,dr(s)),children:c?`—`:o===`cost`?W(n?.costUsd??0):K(n?.totalTokens??0)})]}),(0,$.jsx)(`span`,{className:A(`text-xs text-muted-foreground`,dr(s),c&&`invisible`),children:o===`cost`?`${J(r)} of cost · ${K(n?.totalTokens??0)} tokens`:`${J(r)} of tokens · ${W(n?.costUsd??0)}`})]},t)})]}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,$.jsxs)(`h2`,{className:`text-sm font-medium text-foreground`,children:[L?`Hourly`:`Daily`,` `,o===`tokens`?`processed tokens`:`cost`]}),(0,$.jsx)(jn,{providers:De,loadingProviders:Oe,days:xe,daily:F.daily,hours:Ce,hourly:F.hourly,metric:o,referenceTime:I.untilTime,resolution:L?`hour`:`day`,timeZone:I.timeZone})]})]}),(0,$.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-medium text-foreground`,children:`Totals`}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-6 gap-y-4 py-1 md:grid-cols-5`,children:[(0,$.jsx)(fr,{loading:H.partial,label:`Processed tokens`,value:K(F.totalTokens)}),(0,$.jsx)(fr,{loading:H.partial,label:`Cached input`,value:K(F.cachedInputTokens)}),(0,$.jsx)(fr,{loading:H.partial,label:`Uncached input`,value:K(F.uncachedInputTokens)}),(0,$.jsx)(fr,{loading:H.partial,label:`Output`,value:K(F.outputTokens)}),(0,$.jsx)(fr,{loading:H.partial,label:`Cache savings`,value:W(F.costQuality.cacheSavingsUsd)})]})]}),F.totalTokens>0?(0,$.jsx)(`section`,{className:A(`grid gap-x-12 gap-y-8 lg:grid-cols-2`,dr(H.partial)),children:o===`tokens`?(0,$.jsx)(Fn,{label:`Tokens by type`,segments:Gn(F),format:K}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Fn,{label:`Cost by type`,segments:Wn(F.categoryCost),format:W}),F.speedCost.fast+F.speedCost.ultrafast>0?(0,$.jsx)(Fn,{label:`Cost by speed`,segments:Kn(F.speedCost),format:W,aside:(0,$.jsx)(Xn,{premiumUsd:F.speedCost.premium})}):null]})}):null,(0,$.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-medium text-foreground`,children:`Breakdown`}),(0,$.jsx)(ye,{"aria-label":`Usage breakdown`,variant:`segmented`,value:[p],onValueChange:e=>{let t=e[0];(t===`model`||t===`time`)&&m(t)},children:[{value:`model`,label:`Model`},{value:`time`,label:L?`Hour`:`Day`}].map(e=>(0,$.jsx)(be,{value:e.value,children:e.label},e.value))})]}),p===`model`?(0,$.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{className:`border-b border-border text-right text-xs text-muted-foreground`,children:[(0,$.jsx)(`th`,{className:`py-2 pr-3 text-left font-normal`,children:`#`}),(0,$.jsx)(`th`,{className:`w-full py-2 text-left font-normal`,children:`Model`}),(0,$.jsx)(`th`,{className:`py-2 pl-6 font-normal`,children:`Cost`}),(0,$.jsx)(`th`,{className:`hidden py-2 pl-6 font-normal sm:table-cell`,children:`Share`}),(0,$.jsx)(`th`,{className:`py-2 pl-6 font-normal`,children:`Tokens`})]})}),(0,$.jsx)(`tbody`,{children:Te.length===0?(0,$.jsx)(`tr`,{children:(0,$.jsx)(`td`,{colSpan:5,className:`py-6 text-center text-muted-foreground`,children:`No activity in this window.`})}):Te.map((e,t)=>{let n=`${e.provider}:${e.model}`,r=o===`tokens`?e.totalTokens:e.costUsd,i=zn(e,o===`tokens`?`tokens`:`cost`),a=dr(U(e.provider));return(0,$.jsxs)(`tr`,{className:`relative border-b border-border/50 text-right whitespace-nowrap text-muted-foreground tabular-nums transition-colors hover:bg-muted/50 has-focus-visible:bg-muted/50`,children:[(0,$.jsx)(`td`,{className:`py-2.5 pr-3 text-left text-xs`,children:t+1}),(0,$.jsxs)(`td`,{className:`py-2.5 text-left whitespace-normal`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>y(n),className:`flex items-center gap-2 text-left text-foreground outline-none after:absolute after:inset-0`,children:[(0,$.jsx)(ur,{provider:e.provider,className:`size-3.5`}),e.model]}),(0,$.jsx)(`div`,{"aria-hidden":!0,className:A(`mt-1.5 h-0.5 max-w-48`,a),children:(0,$.jsx)(`div`,{className:`h-full rounded-full`,style:{width:r>0&&je>0?`max(0.5rem, ${r/je*100}%)`:0,backgroundColor:Ke[e.provider].color}})})]}),(0,$.jsx)(`td`,{className:A(`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:A(`hidden py-2.5 pl-6 sm:table-cell`,a),children:i===null?``:J(i)}),(0,$.jsx)(`td`,{className:A(`py-2.5 pl-6`,a),children:K(e.totalTokens)})]},n)})})]}):(0,$.jsxs)(`table`,{className:`w-full table-fixed text-sm`,children:[(0,$.jsxs)(`colgroup`,{children:[(0,$.jsx)(`col`,{className:`w-2/5`}),De.map(e=>(0,$.jsx)(`col`,{style:{width:Qe}},e)),(0,$.jsx)(`col`,{style:{width:Qe}}),(0,$.jsx)(`col`,{style:{width:Qe}})]}),(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{className:`border-b border-border text-left text-xs text-muted-foreground`,children:[(0,$.jsx)(`th`,{className:`py-2 font-normal`,children:L?`Hour`:`Day`}),De.map(e=>(0,$.jsx)(`th`,{className:`py-2 text-right font-normal`,children:Ke[e].label},e)),(0,$.jsx)(`th`,{className:`py-2 text-right font-normal`,children:`Total`}),(0,$.jsx)(`th`,{className:`py-2 text-right font-normal`,children:`Tokens`})]})}),(0,$.jsx)(`tbody`,{children:we.length===0?(0,$.jsx)(`tr`,{children:(0,$.jsx)(`td`,{colSpan:De.length+3,className:`py-6 text-center text-muted-foreground`,children:`No activity in this window.`})}):we.map(e=>(0,$.jsxs)(`tr`,{className:`border-b border-border/50 transition-colors hover:bg-muted/50`,children:[(0,$.jsx)(`td`,{className:`py-2 text-foreground`,children:`hourStart`in e?pe(e.hourStart,I.timeZone):le(e.day)}),De.map(t=>(0,$.jsx)(`td`,{className:A(`py-2 text-right text-muted-foreground tabular-nums`,dr(U(t))),children:W(e.byProvider.get(t)?.costUsd??0)},t)),(0,$.jsx)(`td`,{className:A(`py-2 text-right text-foreground tabular-nums`,dr(H.partial)),children:W(e.costUsd)}),(0,$.jsx)(`td`,{className:A(`py-2 text-right text-muted-foreground tabular-nums`,dr(H.partial)),children:K(e.totalTokens)})]},`hourStart`in e?e.hourStart:e.day))})]})]})]}):(0,$.jsx)(`div`,{className:`space-y-2 py-12 text-center text-sm text-muted-foreground`,children:j.map(e=>(0,$.jsxs)(`p`,{children:[j.length>1?`${e.label}: `:null,e.error]},e.environmentId))})})})]}),ke!==void 0&&!s?(0,$.jsx)(qn,{model:ke,environments:j,metric:o===`tokens`?`tokens`:`cost`,chartWindow:{days:xe,hours:Ce,resolution:L?`hour`:`day`,timeZone:I.timeZone,referenceTime:I.untilTime},onSetPrice:()=>{y(null),g({model:ke.model})},onClose:()=>y(null)}):null,h?(0,$.jsx)(Xt,{usage:k,initialSelectedEnvironmentIds:b,initialModel:h.model,onOpenChange:e=>{e||g(null)}}):null]})}var or=`Requires access to your Cursor login in macOS Keychain.`;function sr({environmentId:e,label:t,onEnabled:n,tooltip:r,buttonText:i=`Enable`}){let a=ce(oe.updateSettings,{label:`enable Cursor account usage`}),[o,s]=(0,Z.useState)(!1),c=async()=>{s(!0);try{(await a({environmentId:e,input:{patch:{cursorKeychainUsageEnabled:!0}}}))._tag===`Success`&&n()}finally{s(!1)}},l=r?(0,$.jsx)(S,{disabled:o,"aria-busy":o,"aria-label":`Enable Cursor usage from ${t}`,onClick:()=>void c(),children:i}):(0,$.jsx)(E,{size:`sm`,variant:`outline`,disabled:o,"aria-busy":o,"aria-label":`Enable Cursor usage from ${t}`,onClick:()=>void c(),children:i});return r?(0,$.jsxs)(ve,{children:[(0,$.jsx)(ge,{render:l}),(0,$.jsx)(_e,{children:or})]}):l}function cr(e){let t=(0,Q.c)(11),{environmentId:n,label:r,showEnvironment:i,onEnabled:a}=e,o,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(`span`,{"aria-hidden":!0,className:`size-2 shrink-0 rounded-full`,style:{backgroundColor:Ke.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,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-medium text-foreground`,children:[(0,$.jsx)(Le,{driverKind:i.make(`cursor`),displayName:`Cursor`,indicatorBackground:`var(--background)`,className:`size-5`,iconClassName:`size-4 text-foreground/80`}),`Cursor`]}),t[0]=a):a=t[0];let o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:or}),t[1]=o):o=t[1];let s;if(t[2]!==n||t[3]!==r){let e;t[5]!==n.length||t[6]!==r?(e=e=>(0,$.jsx)(sr,{environmentId:e.environmentId,label:e.label,buttonText:n.length>1?`Enable on ${e.label}`:`Enable`,onEnabled:r,tooltip:!1},e.environmentId),t[5]=n.length,t[6]=r,t[7]=e):e=t[7],s=n.map(e),t[2]=n,t[3]=r,t[4]=s}else s=t[4];let c;return t[8]===s?c=t[9]:(c=(0,$.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[a,(0,$.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-lg border border-border/60 p-4`,children:[o,(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:s})]})]}),t[8]=s,t[9]=c),c}function ur(e){let t=(0,Q.c)(4),{provider:n,className:r}=e,i=Ke[n],a;return t[0]!==r||t[1]!==i.driverKind||t[2]!==i.label?(a=(0,$.jsx)(Le,{driverKind:i.driverKind,displayName:i.label,iconClassName:r}),t[0]=r,t[1]=i.driverKind,t[2]=i.label,t[3]=a):a=t[3],a}function dr(e){return A(`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=A(`text-base font-medium text-foreground tabular-nums`,dr(i)),t[2]=i,t[3]=o);let s;t[4]!==o||t[5]!==r?(s=(0,$.jsx)(`span`,{className:o,children:r}),t[4]=o,t[5]=r,t[6]=s):s=t[6];let c;return t[7]!==a||t[8]!==s?(c=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[a,s]}),t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function pr(e){let t=(0,Q.c)(14),{environments:n,duplicateSources:r,contractMismatches:i}=e,a,o,s,c;if(t[0]!==i||t[1]!==r||t[2]!==n){c=Symbol.for(`react.early_return_sentinel`);bb0:{let e=n.filter(_r),t=new Map(i.map(gr)),l=n.flatMap(e=>{let n=t.get(e.environmentId);return n===void 0?[]:[{environment:e,mismatch:n}]});if(e.length===0&&l.length===0&&r.length===0){c=null;break bb0}a=`flex flex-col gap-1 border-t border-border px-2 py-2 text-xs text-muted-foreground`,o=e.map(hr),s=l.map(mr)}t[0]=i,t[1]=r,t[2]=n,t[3]=a,t[4]=o,t[5]=s,t[6]=c}else a=t[3],o=t[4],s=t[5],c=t[6];if(c!==Symbol.for(`react.early_return_sentinel`))return c;let l;t[7]===r?l=t[8]:(l=r.length>0?(0,$.jsxs)(`span`,{children:[`Counted once across environments sharing a transcript directory:`,` `,r.join(`, `)]}):null,t[7]=r,t[8]=l);let u;return t[9]!==a||t[10]!==o||t[11]!==s||t[12]!==l?(u=(0,$.jsxs)(`div`,{className:a,children:[o,s,l]}),t[9]=a,t[10]=o,t[11]=s,t[12]=l,t[13]=u):u=t[13],u}function mr(e){let{environment:t,mismatch:n}=e;return(0,$.jsx)(`span`,{children:me(t.label,n)},t.environmentId)}function hr(e){return(0,$.jsxs)(`span`,{children:[e.label,`: `,e.error]},e.label)}function gr(e){return[e.environmentId,e]}function _r(e){return e.error!==null}function vr(e){let t=(0,Q.c)(56),{environments:n,selectedEnvironments:r,selectedEnvironmentIds:i,onSelectionChange:o,showUsageStatus:c,refreshing:l,isPartial:u,duplicateSources:d,contractMismatches:m,onOpenModelPrices:g}=e,_=i===null,v=_?`All environments`:r.length===1?r[0].label:`${r.length} environments`,y;t[0]!==m||t[1]!==r?(y=r.some(br)||m.length>0,t[0]=m,t[1]=r,t[2]=y):y=t[2];let x=y,C;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(S,{}),t[3]=C):C=t[3];let w;t[4]===v?w=t[5]:(w=(0,$.jsx)(Qe,{children:v}),t[4]=v,t[5]=w);let T;t[6]!==x||t[7]!==c?(T=(0,$.jsx)(`span`,{className:`flex size-3.5 shrink-0 items-center justify-center text-muted-foreground`,children:c&&x?(0,$.jsx)(s,{className:`size-3.5 text-warning-foreground`,"aria-label":`Some environments could not report usage`}):(0,$.jsx)(p,{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]=x,t[7]=c,t[8]=T):T=t[8];let E;t[9]!==w||t[10]!==T?(E=(0,$.jsxs)(b,{render:C,className:`group/usage-environment min-w-0 max-w-full`,children:[w,T]}),t[9]=w,t[10]=T,t[11]=E):E=t[11];let D;t[12]===o?D=t[13]:(D=e=>o(e?null:new Set),t[12]=o,t[13]=D);let k;t[14]!==_||t[15]!==D?(k=(0,$.jsx)(f,{checked:_,closeOnClick:!1,onCheckedChange:D,children:`All environments`}),t[14]=_,t[15]=D,t[16]=k):k=t[16];let M;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(O,{}),t[17]=M):M=t[17];let N;if(t[18]!==n||t[19]!==o||t[20]!==l||t[21]!==i||t[22]!==r||t[23]!==c){let e;t[25]!==n.length||t[26]!==o||t[27]!==l||t[28]!==i||t[29]!==r||t[30]!==c?(e=e=>{let t=i===null||i.has(e.environmentId),a=ut(e,l),s=e.error===null?e.summary!==null&&!bt(e.summary.contractVersion,6)?`Update required`:e.isConnected?a.phase===`loading`?`Scanning…`:a.phase===`stale`?`Refreshing…`:a.phase===`partway`?dt(a.providers,ir):`Ready`:`Connecting…`:`Unavailable`;return(0,$.jsx)(f,{checked:t,closeOnClick:!1,onCheckedChange:t=>{let i=new Set(r.map(yr));t?i.add(e.environmentId):i.delete(e.environmentId),o(i.size===n.length?null:i)},children:(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),c?(0,$.jsx)(`span`,{className:A(`shrink-0 text-xs text-muted-foreground`,e.error!==null&&`text-destructive`),children:s}):null]})},e.environmentId)},t[25]=n.length,t[26]=o,t[27]=l,t[28]=i,t[29]=r,t[30]=c,t[31]=e):e=t[31],N=n.map(e),t[18]=n,t[19]=o,t[20]=l,t[21]=i,t[22]=r,t[23]=c,t[24]=N}else N=t[24];let P;t[32]===n.length?P=t[33]:(P=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]=P);let F;t[34]!==u||t[35]!==c?(F=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]=F):F=t[36];let I;t[37]!==m||t[38]!==d||t[39]!==r||t[40]!==c?(I=c?(0,$.jsx)(pr,{environments:r,duplicateSources:d,contractMismatches:m}):null,t[37]=m,t[38]=d,t[39]=r,t[40]=c,t[41]=I):I=t[41];let L;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(O,{}),t[42]=L):L=t[42];let R;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(a,{"aria-hidden":!0}),t[43]=R):R=t[43];let z;t[44]===g?z=t[45]:(z=(0,$.jsxs)(j,{onClick:g,children:[R,`Model prices`]}),t[44]=g,t[45]=z);let B;t[46]!==P||t[47]!==F||t[48]!==I||t[49]!==z||t[50]!==k||t[51]!==N?(B=(0,$.jsxs)(ee,{align:`start`,children:[k,M,N,P,F,I,L,z]}),t[46]=P,t[47]=F,t[48]=I,t[49]=z,t[50]=k,t[51]=N,t[52]=B):B=t[52];let V;return t[53]!==B||t[54]!==E?(V=(0,$.jsxs)(h,{children:[E,B]}),t[53]=B,t[54]=E,t[55]=V):V=t[55],V}function yr(e){return e.environmentId}function br(e){return e.error!==null}function xr(e){let t=(0,Q.c)(23),{hiddenProviders:n,onChange:r}=e,i;t[0]===n?i=t[1]:(i=Ge.filter(e=>!n.has(e)),t[0]=n,t[1]=i);let a=i,o=a.length===Ge.length?`All providers`:a.length===0?`No providers`:a.length===1?Ke[a[0]].label:`${a.length} providers`,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(S,{}),t[2]=s):s=t[2];let c;t[3]===o?c=t[4]:(c=(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:o}),t[3]=o,t[4]=c);let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(p,{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]=l):l=t[5];let u;t[6]===c?u=t[7]:(u=(0,$.jsxs)(b,{render:s,className:`group/usage-provider min-w-0 max-w-full`,children:[c,l]}),t[6]=c,t[7]=u);let d=n.size===0,m;t[8]===r?m=t[9]:(m=e=>r(e?[]:Ge),t[8]=r,t[9]=m);let g;t[10]!==d||t[11]!==m?(g=(0,$.jsx)(f,{checked:d,closeOnClick:!1,onCheckedChange:m,children:`All providers`}),t[10]=d,t[11]=m,t[12]=g):g=t[12];let _;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(O,{}),t[13]=_):_=t[13];let v;t[14]!==n||t[15]!==r?(v=Ge.map(e=>(0,$.jsx)(f,{checked:!n.has(e),closeOnClick:!1,onCheckedChange:t=>r(Ge.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:Ke[e].label})]})},e)),t[14]=n,t[15]=r,t[16]=v):v=t[16];let y;t[17]!==v||t[18]!==g?(y=(0,$.jsxs)(ee,{align:`start`,children:[g,_,v]}),t[17]=v,t[18]=g,t[19]=y):y=t[19];let x;return t[20]!==y||t[21]!==u?(x=(0,$.jsxs)(h,{children:[u,y]}),t[20]=y,t[21]=u,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`})]}),Ge.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-CtcqAwlu.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{kv as e,sv as t}from"./utils-DjbLtxuo.js";function n(n){if(n.hasSessionError)return{canReadDiagnostics:!1,isPending:!1,error:`Could not check this connection's access to diagnostics and usage.`};if(n.session===null){let e=n.connectionPhase===`connected`||n.connectionPhase===`connecting`||n.connectionPhase===`reconnecting`;return{canReadDiagnostics:!1,isPending:e,error:e?null:`This environment is not connected.`}}let r=e(n.session,t);return{canReadDiagnostics:r,isPending:!1,error:r?null:`This connection does not have access to diagnostics and usage.`}}export{n as t};
|
|
2
|
-
//# sourceMappingURL=usageAccess-2Wks5kIN.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{pl as e}from"./utils-DjbLtxuo.js";var t=new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:2}),n=new Intl.NumberFormat(`en-US`);function r(e){return t.format(e)}function i(e){return n.format(Math.round(e))}function a(e){let t=Math.abs(e);return t>=0xe8d4a51000?`${o(e/0xe8d4a51000)}T`:t>=1e9?`${o(e/1e9)}B`:t>=1e6?`${o(e/1e6)}M`:t>=1e3?`${o(e/1e3)}K`:n.format(Math.round(e))}function o(e){let t=Math.abs(e),n=t>=100?0:t>=10?1:2;return e.toFixed(n).replace(/\.0+$/,``)}function s(e,t=1){let n=e*100,r=10**-t;return n>0&&n<r?`<${r.toFixed(t)}%`:`${n.toFixed(t)}%`}function c(e,t){return t.direction===`serverBehind`?`${e} runs an older server version and is excluded from totals.`:`This client is older than the server on ${e}; its usage is excluded from totals.`}function l(e){let[t,n,r]=e.split(`-`).map(e=>Number(e));return t===void 0||n===void 0||r===void 0?e:`${[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`][n-1]??``} ${r}`}function u(e,t){let n=[],r=Date.parse(`${e}T00:00:00Z`),i=Date.parse(`${t}T00:00:00Z`);if(Number.isNaN(r)||Number.isNaN(i)||i<r)return n;for(let e=r;e<=i;e+=864e5)n.push(new Date(e).toISOString().slice(0,10));return n}var d=36e5,f=new Map;function p(e,t){if(t.timeZone===void 0)return new Intl.DateTimeFormat(e,t);let n=JSON.stringify([e,t]),r=f.get(n);return r===void 0&&(r=new Intl.DateTimeFormat(e,t),f.size>=16&&f.clear(),f.set(n,r)),r}function m(e,t){let n=[],r=Date.parse(e),i=Date.parse(t);if(Number.isNaN(r)||Number.isNaN(i)||i<=r)return n;for(let e=r;e<i;e+=d)n.push(new Date(e).toISOString());return n}function h(e,t){let n=new Date(e);if(Number.isNaN(n.getTime()))return e;let r=t===void 0?{}:{timeZone:t},i=p(`en-US`,{...r,hour:`numeric`}),a=p(`en-CA`,{...r,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,hourCycle:`h23`}),o=a.format(n);return[-36e5,d].some(e=>a.format(new Date(n.getTime()+e))===o)?p(`en-US`,{...t===void 0?{}:{timeZone:t},hour:`numeric`,timeZoneName:`short`}).format(n):i.format(n)}function g(e,t){let n=new Date(e);return Number.isNaN(n.getTime())?e:p(`en-US`,{...t===void 0?{}:{timeZone:t},month:`short`,day:`numeric`,hour:`numeric`}).format(n)}function _(e,t,n){let r=new Date(e),i=new Date(t);if(Number.isNaN(r.getTime())||Number.isNaN(i.getTime()))return g(e,n);let a=p(`en-CA`,{...n===void 0?{}:{timeZone:n},year:`numeric`,month:`2-digit`,day:`2-digit`}),o=Date.parse(`${a.format(r)}T00:00:00Z`),s=Date.parse(`${a.format(i)}T00:00:00Z`),c=Math.round((s-o)/(24*d)),l=h(e,n);return c===0?`${l} today`:c===1?`${l} yesterday`:g(e,n)}function v(t,n=new Date,r=`day`){let i=Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`,a;try{a=new Intl.DateTimeFormat(`en-CA`,{timeZone:i,year:`numeric`,month:`2-digit`,day:`2-digit`})}catch{i=`UTC`,a=new Intl.DateTimeFormat(`en-CA`,{timeZone:`UTC`,year:`numeric`,month:`2-digit`,day:`2-digit`})}let o=a.format(n);if(r===`hour`){let t=Math.floor(n.getTime()/6e4)*6e4,o=t-24*d,s=new Date(o),c=new Date(t);return{sinceDay:e.make(a.format(s)),untilDay:e.make(a.format(c)),timeZone:i,resolution:r,sinceTime:s.toISOString(),untilTime:c.toISOString()}}let[s=0,c=1,l=1]=o.split(`-`).map(e=>Number.parseInt(e,10)),u=new Date(Date.UTC(s,c-1,l-(t-1)));return{sinceDay:e.make(u.toISOString().slice(0,10)),untilDay:e.make(o),timeZone:i,resolution:r}}export{l as a,_ as c,r as d,v as f,g as i,a as l,m as n,h as o,i as r,s,u as t,c as u};
|
|
2
|
-
//# sourceMappingURL=usageFormat-BZJ9qCn4.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as e,t}from"./react-BUfh6y28.js";import{n}from"./jsx-runtime-DJeoFXNw.js";import{C as r,D as i,Vh as a,ac as o,c as s,es as c,g as l,i as u,ic as d,is as f,rc as p,s as m,yl as h}from"./utils-DjbLtxuo.js";import{Bn as g,br as _,bt as v,jn as ee,pt as y,yr as b}from"./runtime-BBYIQ0f-.js";import{C as x,O as S,d as C,f as te,l as ne,u as re}from"./entities-CWtNgawi.js";import{a as ie,t as ae}from"./useParams-jklHVL7l.js";import{f as w}from"./relay-Do9UB5iT.js";import{s as T}from"./useSettings-EYJbJzT3.js";import{n as oe}from"./server-Dkj4NeYG.js";import{p as E}from"./session-logic-DB_ei-pn.js";import{a as D,i as O,n as k,o as A}from"./threadSort-Bd2rijEy.js";import{c as j,r as M}from"./projectFilesQueryState-BdfD5cZ2.js";import{d as N,f as P,i as F,r as se,s as ce,t as I}from"./p4ProjectFile-5VDI-yAx.js";import{r as L,t as R}from"./uiStateStore-FYiLqqos.js";var z=e(t(),1),B=n(),V=`[data-thread-item], [data-thread-selection-safe]`,H=3,U=160;function W(e){let t=(0,B.c)(6),[n,r]=z.useState(null),[i,a]=z.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:`${U}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]),z.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 G(e,t){let n=z.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 K(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 q(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}else t.add(r.threadKey)}}return{deletedThreadKeys:t,firstFailure:n}}async function J(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);else return{archivedThreadKeys:t,mutationFailure:o,followupFailures:n}}return{archivedThreadKeys:t,mutationFailure:null,followupFailures:n}}function Y(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 le(e,t,n){let r=v(e);return e.filter(e=>e.archivedAt===null&&!y({environmentId:e.environmentId,threadId:e.id},e.lineage,n)&&r(e)&&(t===null||t.has(`${e.environmentId}:${e.projectId}`)))}var ue={"Pending Approval":5,"Awaiting Input":4,Working:3,Connecting:3,Waiting:2.5,"Plan Ready":2,Completed:1};function de(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=>{n?r||i!==null||(i=t(()=>{i=null,r=!0,e.onVisibilityChange(!0)},e.delayMs)):(a(),r&&(r=!1,e.onVisibilityChange(!1)))},dispose:()=>{a()}}}function fe(){let e=(0,B.c)(5),[t,n]=z.useState(!1),r=z.useRef(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=de({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]),z.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 pe(e,t){return e===void 0?t:e??void 0}function me(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 he(e){return e===null||!e.closest(V)}function ge(e){return e>1}function _e(e,t){return e===null||!(`closest`in e)||typeof e.closest!=`function`?null:e.closest(t)}function ve(e){return typeof e!=`object`||!e?!1:_e(e,`a[href]`)!==null||_e(`parentElement`in e&&e.parentElement!==null&&typeof e.parentElement==`object`?e.parentElement:null,`a[href]`)!==null}function ye(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 be(e,t=H){return e.slice(0,Math.max(0,t))}function xe(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 Se(e){return e.button===2||e.isMac&&e.button===0&&e.ctrlKey}function Ce(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 we(e,t){let n=D(e,t),r=n.filter(e=>e.pinnedAt!=null);return r.length===0?n:[...O(r),...n.filter(e=>e.pinnedAt==null)]}function Te(e,t){let n=s(t);if(n.length===0)return!1;let r=s(g(e).join(` `));return n.split(` `).every(e=>r.includes(e))}function Ee(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}:ee(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}:me(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 De(e){let t=null;for(let n of e)n!==null&&(t===null||ue[n.label]>ue[t.label])&&(t=n);return t}function Oe(e,t){return t.projectExpanded?t.isThreadListExpanded||e.length<=t.previewCount?e:e.slice(0,t.previewCount):[]}function ke(e){let{deletedThreadId:t,deletedThreadIds:n,sortOrder:r,threads:i}=e,a=i.find(e=>e.id===t);return a?D(i.filter(e=>e.projectId===a.projectId&&e.id!==t&&!n?.has(e.id)),r)[0]?.id??null:null}function Ae(e,t,n){return t.length>0?t.reduce((e,t)=>Math.max(e,k(t,n)),-1/0):n===`created_at`?A(e.createdAt)??-1/0:A(e.updatedAt??e.createdAt)??-1/0}function X(e,t,n,r){return t===`manual`?[...e]:e.map(e=>({project:e,timestamp:Ae(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 je(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 Me(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 Ne(e,t,n,r){return Me(e,le(t,null,r),n)}function Pe(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 Fe(e){return e.projectDefaultSelection??(e.carrySourceDraftId===e.destinationDraftId?null:e.carrySelection)}function Ie(e){let t=e?.activeProvider;return e?.modelSelectionExplicit===!0&&t!=null&&e.modelSelectionByProvider[t]!==void 0}function Le(e){return e.activeThread?p(e.activeThread.environmentId,e.activeThread.projectId):e.activeDraftThread?p(e.activeDraftThread.environmentId,e.activeDraftThread.projectId):e.defaultProjectRef}async function Re(e){let t=Le(e);return t?(await e.handleNewThread(t),!0):!1}async function ze(e,t){let n=await b(c,M(e,t,h),{reportDefect:!1,reportFailure:!1}),r=j(e,t,h,j(e,t,n._tag===`Success`?n.value.relativePath:h,n._tag===`Success`?n.value:null));return r===null||r.truncated?null:I(r.contents)}function Q(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 $(){let e=(0,B.c)(7),t=f(oe),n=T(P),s=ie(),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 p=c,h;return e[2]!==t||e[3]!==p||e[4]!==n||e[5]!==s?(h=(e,c)=>{let f=re(),h=t.get(e.environmentId)?.settings??a,{getComposerDraft:g,getDraftSessionByLogicalProjectKey:_,getDraftSession:v,getDraftThread:ee,applyStickyState:y,setDraftThreadContext:b,setLogicalProjectDraftThreadId:x,setModelSelection:S}=i.getState(),ie=s.state.location.href,ae=()=>s.state.location.href!==ie,w=p(),T=w?.kind===`server`?C(w.threadRef):null,oe=w?.kind===`draft`?v(w.draftId):null,E=w?g(w.kind===`server`?w.threadRef:w.draftId):null,D=E?.activeProvider??null,O=(D?E?.modelSelectionByProvider[D]??null:null)??T?.modelSelection??null,k=E?.interactionMode??T?.interactionMode??oe?.interactionMode??null,A=f.find(t=>t.id===e.projectId&&t.environmentId===e.environmentId),j=()=>ae()||A!==void 0&&ne(e)===null,M=F(h,A?.id??null,A),N=M.settings.defaultModelSelection,P=M.settings.defaultRuntimeMode,I=e=>Fe({projectDefaultSelection:N??null,carrySelection:O,carrySourceDraftId:w?.kind===`draft`?w.draftId:null,destinationDraftId:e}),L=async()=>{let n=A!==void 0&&M.settings.defaultThreadEnvMode===null?await ze(A.environmentId,A.workspaceRoot):null;return se({projectSettings:F(h,A?.id??null,A,n),workspaceRoot:A?.workspaceRoot??null,newProjectsRoot:t.get(e.environmentId)?.newProjectsRoot,projectHasThreads:te().some(t=>t.environmentId===e.environmentId&&t.projectId===e.projectId)})},R=A?ce(A,n):o(e),z=c?.branch!==void 0,B=c?.worktreePath!==void 0,V=c?.envMode!==void 0,H=c?.startFromOrigin!==void 0,U=_(R),W=U?d(U.environmentId,U.threadId):null,G=U!==null&&U.promotedTo==null&&W!==null&&C(W)===null?U:null;W&&G===null&&r(W);let K=G&&!l(g(G.draftId))?G:null,q=w?w.kind===`server`?ee(w.threadRef):v(w.draftId):null;if(K)return(async()=>{let t=w?.kind===`draft`&&w.draftId===K.draftId,n=z||B||V||H,r=null;if(n)r=Q(c);else if(!t){let e=await L();if(j())return null;let t=p(),n=t?.kind===`draft`&&t.draftId===K.draftId,i=W!==null&&C(W)!==null,a=_(R)?.draftId!==K.draftId,o=l(g(K.draftId));if(n||i||a||o)return null;r={branch:null,worktreePath:null,envMode:e,startFromOrigin:Z({envMode:e,newWorktreesStartFromOrigin:M.settings.newWorktreesStartFromOrigin})}}if(r&&b(K.draftId,{...r,...t?{}:{runtimeMode:P},...k?{interactionMode:k}:{}}),!Ie(g(K.draftId))){y(K.draftId);let e=I(K.draftId);e&&S(K.draftId,e,{replaceOptions:!0})}x(R,e,K.draftId,{threadId:K.threadId,...r,...t?{}:{runtimeMode:P},...k?{interactionMode:k}:{}});let i={draftId:K.draftId,threadId:K.threadId},a=p();return a?.kind===`draft`&&a.draftId===K.draftId||await s.navigate({to:`/draft/$draftId`,params:{draftId:K.draftId},replace:c?.replace??!1}),i})();if(q&&w?.kind===`draft`&&q.logicalProjectKey===R&&q.promotedTo==null&&!l(g(w.draftId)))return(z||B||V||H)&&b(w.draftId,Q(c)),x(R,e,w.draftId,{threadId:q.threadId,createdAt:q.createdAt,runtimeMode:q.runtimeMode,interactionMode:q.interactionMode,...Q(c)}),Promise.resolve({draftId:w.draftId,threadId:q.threadId});let J=u(),Y=m(),le=new Date().toISOString();return(async()=>{let t=c?.envMode??await L();if(j())return null;let n=_(R);if(n&&n.draftId!==U?.draftId&&C(d(n.environmentId,n.threadId))===null)return x(R,e,n.draftId,{threadId:n.threadId,createdAt:n.createdAt,runtimeMode:n.runtimeMode,interactionMode:n.interactionMode,...Q(c)}),await s.navigate({to:`/draft/$draftId`,params:{draftId:n.draftId},replace:c?.replace??!1}),{draftId:n.draftId,threadId:n.threadId};x(R,e,J,{threadId:Y,createdAt:le,branch:c?.branch??null,worktreePath:c?.worktreePath??null,envMode:t,startFromOrigin:c?.startFromOrigin??Z({envMode:t,newWorktreesStartFromOrigin:M.settings.newWorktreesStartFromOrigin}),runtimeMode:P,...k?{interactionMode:k}:{}}),y(J);let r=I(J);return r&&S(J,r,{replaceOptions:!0}),await s.navigate({to:`/draft/$draftId`,params:{draftId:J},replace:c?.replace??!1}),{draftId:J,threadId:Y}})()},e[2]=t,e[3]=p,e[4]=n,e[5]=s,e[6]=h):h=e[6],h}function Be(){let e=(0,B.c)(16),t=L(We),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={strict:!1,select:Ue},e[0]=n):n=e[0];let r=ae(n),a=r?.kind===`server`?r.threadRef:null,o=r?.kind===`draft`?r.draftId:null,s=S(a),c=i(He),l;e[1]!==c||e[2]!==r?(l=()=>r?r.kind===`server`?c(r.threadRef):i.getState().getDraftSession(r.draftId):null,e[1]=c,e[2]=r,e[3]=l):l=e[3];let u=i(l),d=x(),f;e[4]!==t||e[5]!==d?(f=ye({items:d,preferredIds:t,getId:N,getPreferenceIds:Ve}),e[4]=t,e[5]=d,e[6]=f):f=e[6];let m=f,h=$(),g;e[7]===m[0]?g=e[8]:(g=m[0]?p(m[0].environmentId,m[0].id):null,e[7]=m[0],e[8]=g);let _;return e[9]!==u||e[10]!==s||e[11]!==h||e[12]!==o||e[13]!==a||e[14]!==g?(_={activeDraftThread:u,activeThread:s,defaultProjectRef:g,handleNewThread:h,routeDraftId:o,routeThreadRef:a},e[9]=u,e[10]=s,e[11]=h,e[12]=o,e[13]=a,e[14]=g,e[15]=_):_=e[15],_}function Ve(e){return[N(e),R(e.workspaceRoot)]}function He(e){return e.getDraftThread}function Ue(e){return w(e)}function We(e){return e.projectOrder}export{G as A,Ee as C,Pe as D,je as E,fe as M,Ne as O,pe as S,Me as T,xe as _,Le as a,K as b,Y as c,be as d,Se as f,Te as g,ye as h,Z as i,W as j,we as k,q as l,ge as m,$ as n,Re as o,ve as p,Ie as r,J as s,Be as t,ke as u,De as v,he as w,Ce as x,Oe as y};
|
|
2
|
-
//# sourceMappingURL=useHandleNewThread-C6MtV3AM.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as e,t}from"./react-BUfh6y28.js";import{t as n}from"./jsx-runtime-DJeoFXNw.js";import{Aa as r,Br as i,Da as a,Ea as o,Ga as s,Ka as c,Mo as l,Wa as u,Ya as d,jo as f,oa as p,ua as m,zr as h}from"./utils-DjbLtxuo.js";import{t as g}from"./usePreviousValue-Dx4Nv0v8.js";var _=e(t()),v=e(a());function y(e){let t=c(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=d(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r;return(p(n)!==a||p(r)!==o)&&(n=a,r=o),{width:n,height:r}}var b=()=>!0;function x(e){let{popupElement:t,positionerElement:n,content:i,mounted:a,enabled:c=b,onMeasureLayout:d,onMeasureLayoutComplete:p,side:m,direction:h}=e,g=o(t,!0,!1),v=r(),x=_.useRef(null),E=_.useRef(null),D=_.useRef(!0),O=_.useRef(l),k=s(d),A=s(p),j=_.useMemo(()=>{let e=m===`top`,t=m===`left`;return h===`rtl`?(e||=m===`inline-end`,t||=m===`inline-end`):(e||=m===`inline-start`,t||=m===`inline-start`),e?{position:`absolute`,[m===`top`?`bottom`:`top`]:`0`,[t?`right`:`left`]:`0`}:f},[m,h]);u(()=>{if(!a||!c()||typeof ResizeObserver!=`function`){O.current=l,D.current=!0,x.current=null,E.current=null;return}if(!t||!n)return;O.current=C(t,j);let e=new ResizeObserver(e=>{let t=e[0];t&&(E.current={width:Math.ceil(t.borderBoxSize[0].inlineSize),height:Math.ceil(t.borderBoxSize[0].blockSize)})});e.observe(t),w(t,`auto`);let r=S(t,`position`,`static`),i=S(t,`transform`,`none`),o=S(t,`scale`,`1`),s=C(n,{"--available-width":`max-content`,"--available-height":`max-content`});function u(){r(),i(),s()}function d(){u(),o()}if(k?.(),D.current||x.current===null){T(n,`max-content`);let r=y(t);return x.current=r,T(n,r),d(),A?.(null,r),D.current=!1,()=>{e.disconnect(),O.current(),O.current=l}}w(t,`auto`),T(n,`max-content`);let f=x.current??E.current,p=y(t);if(x.current=p,!f)return T(n,p),d(),A?.(null,p),()=>{e.disconnect(),v.cancel(),O.current(),O.current=l};w(t,f),d(),A?.(f,p),T(n,p);let m=new AbortController;return v.request(()=>{w(t,p),g(()=>{t.style.setProperty(`--popup-width`,`auto`),t.style.setProperty(`--popup-height`,`auto`)},m.signal)}),()=>{e.disconnect(),m.abort(),v.cancel(),O.current(),O.current=l}},[i,t,n,g,v,c,a,k,A,j])}function S(e,t,n){let r=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,r)}}function C(e,t){let n=[];for(let[r,i]of Object.entries(t))n.push(S(e,r,i));return n.length?()=>{n.forEach(e=>e())}:l}function w(e,t){let n=t===`auto`?`auto`:`${t.width}px`,r=t===`auto`?`auto`:`${t.height}px`;e.style.setProperty(`--popup-width`,n),e.style.setProperty(`--popup-height`,r)}function T(e,t){let n=t===`max-content`?`max-content`:`${t.width}px`,r=t===`max-content`?`max-content`:`${t.height}px`;e.style.setProperty(`--positioner-width`,n),e.style.setProperty(`--positioner-height`,r)}var E=e(n());function D(e){let{store:t,side:n,cssVars:a,children:c}=e,l=h(),d=t.useState(`activeTriggerElement`),f=t.useState(`activeTriggerId`),p=t.useState(`open`),y=t.useState(`payload`),b=t.useState(`mounted`),S=t.useState(`popupElement`),C=t.useState(`positionerElement`),w=g(p?d:null),T=j(f,y),D=_.useRef(null),[k,M]=_.useState(null),[N,P]=_.useState(null),F=_.useRef(null),I=_.useRef(null),L=o(F,!0,!1),R=r(),[z,B]=_.useState(null),[V,H]=_.useState(!1);u(()=>(t.set(`hasViewport`,!0),()=>{t.set(`hasViewport`,!1)}),[t]);let U=s(()=>{F.current?.style.setProperty(`animation`,`none`),F.current?.style.setProperty(`transition`,`none`),I.current?.style.setProperty(`display`,`none`)}),W=s(e=>{F.current?.style.removeProperty(`animation`),F.current?.style.removeProperty(`transition`),I.current?.style.removeProperty(`display`),e&&B(e)}),G=_.useRef(null);u(()=>{if(d&&w&&d!==w&&G.current!==d&&D.current){M(D.current),H(!0);let e=A(w,d);P(e),R.request(()=>{v.flushSync(()=>{H(!1)}),L(()=>{M(null),B(null),D.current=null})}),G.current=d}},[d,w,k,L,R]),u(()=>{let e=F.current;if(!e)return;let t=m(e).createElement(`div`);for(let n of Array.from(e.childNodes))t.appendChild(n.cloneNode(!0));D.current=t});let K=k!=null,q;q=K?(0,E.jsxs)(_.Fragment,{children:[(0,E.jsx)(`div`,{"data-previous":!0,inert:i(!0),ref:I,style:{...z?{[a.popupWidth]:`${z.width}px`,[a.popupHeight]:`${z.height}px`}:null,position:`absolute`},"data-ending-style":V?void 0:``},`previous`),(0,E.jsx)(`div`,{"data-current":!0,ref:F,"data-starting-style":V?``:void 0,children:c},T)]}):(0,E.jsx)(`div`,{"data-current":!0,ref:F,children:c},T),u(()=>{let e=I.current;e&&k&&e.replaceChildren(...Array.from(k.childNodes))},[k]),x({popupElement:S,positionerElement:C,mounted:b,content:y,onMeasureLayout:U,onMeasureLayoutComplete:W,side:n,direction:l});let J={activationDirection:O(N),transitioning:K};return{children:q,state:J}}function O(e){if(e)return`${k(e.horizontal,5,`right`,`left`)} ${k(e.vertical,5,`down`,`up`)}`}function k(e,t,n,r){return e>t?n:e<-t?r:``}function A(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i={x:n.left+n.width/2,y:n.top+n.height/2},a={x:r.left+r.width/2,y:r.top+r.height/2};return{horizontal:a.x-i.x,vertical:a.y-i.y}}function j(e,t){let[n,r]=_.useState(0),i=_.useRef(e),a=_.useRef(t),o=_.useRef(!1);return u(()=>{let n=i.current,s=a.current,c=e!==n,l=t!==s;c?(r(e=>e+1),o.current=!l):o.current&&l&&(r(e=>e+1),o.current=!1),i.current=e,a.current=t},[e,t]),`${e??`current`}-${n}`}export{D as t};
|
|
2
|
-
//# sourceMappingURL=usePopupViewport-D1lXH2SQ.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as e,t}from"./react-BUfh6y28.js";import{n}from"./jsx-runtime-DJeoFXNw.js";import{D as r,Es as i,Ev as a,OE as o,Ps as s,aT as c,el as l,es as u,is as d,js as f,mv as p,rc as m,xv as h}from"./utils-DjbLtxuo.js";import{Tr as g,hr as _,mr as v,t as y}from"./runtime-BBYIQ0f-.js";import{a as b,i as ee}from"./vcsRefInvalidation-DkXoQApH.js";import{C as te}from"./entities-CWtNgawi.js";import{a as x}from"./relay-Do9UB5iT.js";import{f as S,k as C,s as w}from"./useSettings-EYJbJzT3.js";import{i as T,n as E}from"./session-CBEVNHld.js";import{n as D}from"./query-D3KVoW9G.js";import{t as O}from"./use-atom-command-BbFDhw_c.js";import{d as k,l as A,u as j}from"./queries-Cl508kPw.js";import{t as M}from"./sourceControl-De64nxc-.js";import{C as N,r as P}from"./pullRequests-Cf9E2kW-.js";import{R as F,b as ne,y as re}from"./pullRequestDetail.logic-kOhR5jr9.js";import{n as ie}from"./useHandleNewThread-C6MtV3AM.js";import{c as ae,f as I,i as L,s as R}from"./p4ProjectFile-5VDI-yAx.js";import{t as z}from"./sidebarProjectGrouping-Cy06FqQF.js";var B=e(t(),1),V=n();function H(e){return{pullRequestResolution:_(e,{label:`environment-data:git:resolve-pull-request`,tag:l.gitResolvePullRequest}),preparePullRequestThread:v(e,{label:`environment-data:git:prepare-pull-request-thread`,tag:l.gitPreparePullRequestThread,scheduler:b,concurrency:ee})}}var U=H(y),W={init:`init`,pull:`pull`,publishRepository:`publish_repository`,runStackedAction:`run_change_request`,preparePullRequestThread:`prepare_pull_request_thread`};function G(e){let t=T(e.scope.environmentId,h),n=W[e.kind],r=d(A.stateAtom(e.scope)),o=r.operation===n,s=(0,B.useCallback)(()=>{A.resetError(u,e.scope,n)},[e.scope,n]),l=(0,B.useCallback)(async(...t)=>{if(e.scope.environmentId===null||!E(e.scope.environmentId,`source-control:write`))return i(c(new a({requiredScope:h,message:`This connection cannot change source control.`})));let r=async()=>{let n=await e.action(...t);return f(n)&&e.onSuccess?.(),n};return e.managedExternally===!0?r():A.track(u,e.scope,{operation:n,label:e.label},r)},[e.action,e.label,e.managedExternally,e.onSuccess,e.scope,n]);return{isAllowed:t,error:o?r.error:null,isPending:o&&r.isRunning,resetError:s,run:l}}function K(e){return e.environmentId===null||e.cwd===null?null:{environmentId:e.environmentId,cwd:e.cwd}}function q(e,t){let n=(0,V.c)(6),r;n[0]===e?r=n[1]:(r=A.stateAtom(e),n[0]=e,n[1]=r);let i=d(r),a;return n[2]!==t||n[3]!==i.isRunning||n[4]!==i.operation?(a=i.isRunning&&i.operation!==null&&t.some(e=>W[e]===i.operation),n[2]=t,n[3]=i.isRunning,n[4]=i.operation,n[5]=a):a=n[5],a}function J(e){let t=(0,V.c)(7),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={reportFailure:!1},t[0]=n):n=t[0];let r=O(j.init,n),a;t[1]!==r||t[2]!==e?(a=async()=>{let t=K(e);return t===null?i(c(new k({operation:`init`,environmentId:e.environmentId,cwd:e.cwd}))):r({environmentId:t.environmentId,input:{cwd:t.cwd}})},t[1]=r,t[2]=e,t[3]=a):a=t[3];let o=a,s;return t[4]!==o||t[5]!==e?(s={kind:`init`,label:`Initializing repository`,scope:e,action:o},t[4]=o,t[5]=e,t[6]=s):s=t[6],G(s)}function oe(e){let t=(0,V.c)(11),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={reportFailure:!1},t[0]=n):n=t[0];let r=O(j.pull,n),a;t[1]!==e.cwd||t[2]!==e.environmentId?(a=e.environmentId!==null&&e.cwd!==null?j.status({environmentId:e.environmentId,input:{cwd:e.cwd}}):null,t[1]=e.cwd,t[2]=e.environmentId,t[3]=a):a=t[3];let o=D(a),s;t[4]!==r||t[5]!==e?(s=async()=>{let t=K(e);return t===null?i(c(new k({operation:`pull`,environmentId:e.environmentId,cwd:e.cwd}))):r({environmentId:t.environmentId,input:{cwd:t.cwd}})},t[4]=r,t[5]=e,t[6]=s):s=t[6];let l=s,u;return t[7]!==l||t[8]!==e||t[9]!==o.refresh?(u={kind:`pull`,label:`Pulling latest changes...`,scope:e,action:l,onSuccess:o.refresh},t[7]=l,t[8]=e,t[9]=o.refresh,t[10]=u):u=t[10],G(u)}function se(e){let t=(0,V.c)(13),n;t[0]===e?n=t[1]:(n=A.runStackedAction(e),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r={reportFailure:!1},t[2]=r):r=t[2];let a=O(n,r),o;t[3]!==e.cwd||t[4]!==e.environmentId?(o=e.environmentId!==null&&e.cwd!==null?j.status({environmentId:e.environmentId,input:{cwd:e.cwd}}):null,t[3]=e.cwd,t[4]=e.environmentId,t[5]=o):o=t[5];let s=D(o),l;t[6]!==a||t[7]!==e?(l=async t=>K(e)===null?i(c(new k({operation:`run_change_request`,environmentId:e.environmentId,cwd:e.cwd}))):a(t),t[6]=a,t[7]=e,t[8]=l):l=t[8];let u=l,d;return t[9]!==u||t[10]!==e||t[11]!==s.refresh?(d={kind:`runStackedAction`,label:`Running source control action`,scope:e,action:u,onSuccess:s.refresh,managedExternally:!0},t[9]=u,t[10]=e,t[11]=s.refresh,t[12]=d):d=t[12],G(d)}function ce(e){let t=(0,V.c)(11),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={reportFailure:!1},t[0]=n):n=t[0];let r=O(M.publishRepository,n),a;t[1]!==e.cwd||t[2]!==e.environmentId?(a=e.environmentId!==null&&e.cwd!==null?j.status({environmentId:e.environmentId,input:{cwd:e.cwd}}):null,t[1]=e.cwd,t[2]=e.environmentId,t[3]=a):a=t[3];let o=D(a),s;t[4]!==r||t[5]!==e?(s=async t=>{let n=K(e);return n===null?i(c(new k({operation:`publish_repository`,environmentId:e.environmentId,cwd:e.cwd}))):r({environmentId:n.environmentId,input:{cwd:n.cwd,...t}})},t[4]=r,t[5]=e,t[6]=s):s=t[6];let l=s,u;return t[7]!==l||t[8]!==e||t[9]!==o.refresh?(u={kind:`publishRepository`,label:`Publishing repository`,scope:e,action:l,onSuccess:o.refresh},t[7]=l,t[8]=e,t[9]=o.refresh,t[10]=u):u=t[10],G(u)}function Y(e){let t=(0,V.c)(7),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={reportFailure:!1},t[0]=n):n=t[0];let r=O(U.preparePullRequestThread,n),o;t[1]!==r||t[2]!==e?(o=async t=>{let n=K(e);return n===null?i(c(new k({operation:`prepare_pull_request_thread`,environmentId:e.environmentId,cwd:e.cwd}))):t.mode===`worktree`&&t.threadId!==void 0&&!E(n.environmentId,`orchestration:operate`)?i(c(new a({requiredScope:p,message:`This connection cannot change threads.`}))):r({environmentId:n.environmentId,input:{cwd:n.cwd,reference:t.reference,mode:t.mode,...t.threadId?{threadId:t.threadId}:{}}})},t[1]=r,t[2]=e,t[3]=o):o=t[3];let s=o,l;return t[4]!==s||t[5]!==e?(l={kind:`preparePullRequestThread`,label:`Preparing pull request thread`,scope:e,action:s},t[4]=s,t[5]=e,t[6]=l):l=t[6],G(l)}function X(e){return e.environmentId===null||e.cwd===null||e.reference===null?null:o(s(u.get(U.pullRequestResolution({environmentId:e.environmentId,input:{cwd:e.cwd,reference:e.reference}}))))}function le(e){let t=(0,V.c)(12),n;t[0]!==e.cwd||t[1]!==e.environmentId||t[2]!==e.reference?(n=e.environmentId!==null&&e.cwd!==null&&e.reference!==null?U.pullRequestResolution({environmentId:e.environmentId,input:{cwd:e.cwd,reference:e.reference}}):null,t[0]=e.cwd,t[1]=e.environmentId,t[2]=e.reference,t[3]=n):n=t[3];let r=D(n),i;t[4]===e?i=t[5]:(i=X(e),t[4]=e,t[5]=i);let a=i,o=r.data??a,s=r.isPending&&a===null,c;return t[6]!==r.error||t[7]!==r.isPending||t[8]!==r.refresh||t[9]!==o||t[10]!==s?(c={data:o,error:r.error,isPending:s,isFetching:r.isPending,refresh:r.refresh},t[6]=r.error,t[7]=r.isPending,t[8]=r.refresh,t[9]=o,t[10]=s,t[11]=c):c=t[11],c}function ue(e,t){let n=(0,V.c)(10),r;n[0]===t?r=n[1]:(r=e=>L(e,t).settings.pullRequestMergeMethod,n[0]=t,n[1]=r);let i=S(e,r),a=w(de),o=w(I),s=te(),c=C(),l;return n[2]!==e||n[3]!==o||n[4]!==a||n[5]!==c||n[6]!==i||n[7]!==t||n[8]!==s?(l=()=>{if(i!=null)return i;if(Object.keys(a).length===0)return;let n=s.find(n=>n.environmentId===e&&n.id===t);if(!n)return;let r=z({projects:s,settings:o,primaryEnvironmentId:c}).get(ae(n))??R(n,o);return a[r]},n[2]=e,n[3]=o,n[4]=a,n[5]=c,n[6]=i,n[7]=t,n[8]=s,n[9]=l):l=n[9],l}function de(e){return e.pullRequestMergeMethodOverrides}var fe={merge:`Merge requested`,ready:`Marked ready for review`,draft:`Converted to draft`,close:`Pull request closed`,reopen:`Pull request reopened`,"update-branch":`Branch updated with the base branch`,"enable-auto-merge":`Auto-merge enabled`,"disable-auto-merge":`Auto-merge disabled`,revert:`Revert pull request opened`,"delete-branch":`Branch deleted`,"approve-workflows":`Workflows approved`},pe={merge:`Could not merge this pull request`,ready:`Could not mark this ready for review`,draft:`Could not convert this to a draft`,close:`Could not close this pull request`,reopen:`Could not reopen this pull request`,"update-branch":`Could not update this branch`,"enable-auto-merge":`Could not enable auto-merge`,"disable-auto-merge":`Could not disable auto-merge`,revert:`Could not open a revert pull request`,"delete-branch":`Could not delete this branch`,"approve-workflows":`Could not approve workflows`},Z={merge:`The host refused the merge. Check that you have write access, that the checks it requires have passed, and that the branch is not conflicting.`,ready:`The host refused it. Check that you have write access to this repository.`,draft:`The host refused it. Check that you have write access to this repository.`,close:`The host refused it. Check that you have write access, or that you opened it.`,reopen:`The host refused it. Check that you have write access, and that the branch still exists.`,"update-branch":`The host refused it. Check that you have write access, and that the base branch has not diverged in a way the host cannot merge.`,"enable-auto-merge":`The host refused it. Check that auto-merge is enabled for this repository and that you have write access.`,"disable-auto-merge":`The host refused it. Check that you have write access to this repository.`,revert:`The host refused it. Check that you have write access and that this pull request was merged on the host.`,"delete-branch":`The host refused it. Check that you have write access to the source repository and that the branch has not moved since this page loaded.`,"approve-workflows":`The host refused it. Check that you have Actions write access and that these workflow runs are still awaiting approval.`};function me({environmentId:e,reference:t,onSuccess:n,resolveMergeMethod:r}){let i=O(P.runAction,{reportFailure:!1}),[a,o]=(0,B.useState)(!1),s=(0,B.useRef)(!1);return{actionPending:a,perform:async(a,c)=>{if(!(s.current||t===null)){s.current=!0,o(!0);try{let o=await i({environmentId:e,input:{...t,action:a,...c?{mergeMethod:c}:r?{resolveMergeMethod:r}:{}}});if(o._tag===`Failure`)throw g(o);x.add({type:`success`,title:fe[a]}),n?.(a)}catch(e){x.add({type:`error`,title:pe[a],description:F(e,Z[a])})}finally{s.current=!1,o(!1)}}}}}function Q(e){let t=O(P.runAction,{reportFailure:!1}),n=(0,B.useRef)(new Set),[r,i]=(0,B.useState)(()=>new Set);return{close:(0,B.useCallback)(async r=>{let a=r.filter(e=>{let t=N(e);return e.state!==`open`||n.current.has(t)?!1:(n.current.add(t),!0)});if(a.length===0)return;i(new Set(n.current));let o=0,s=[];await Promise.all(a.map(async r=>{try{let n=await t({environmentId:r.environmentId,input:{projectId:r.projectId,host:r.host,repository:r.repository,number:r.number,action:`close`}});if(n._tag===`Failure`)throw g(n);o++,e(r)}catch(e){s.push(`#${r.number}: ${F(e,Z.close)}`)}finally{n.current.delete(N(r)),i(new Set(n.current))}})),x.add({type:s.length>0?`error`:`success`,title:s.length>0?`Closed ${o} of ${a.length} pull requests`:`Closed ${o} pull request${o===1?``:`s`}`,...s.length>0?{description:s.slice(0,3).join(`
|
|
2
|
-
`)}:{}})},[e,t]),closingKeys:r}}var $=new Map;function he(e){let t=(0,V.c)(21),{environmentId:n,detail:i}=e,a=ie(),o=i?.workspaceRoot??null,s;t[0]!==n||t[1]!==o?(s={environmentId:n,cwd:o},t[0]=n,t[1]=o,t[2]=s):s=t[2];let c=Y(s),[l,u]=(0,B.useState)(null),d;t[3]===a?d=t[4]:(d=async(e,t,n)=>{let i=n??await a(e).then(xe,be);if(i===null)return null;let o=r.getState();if(t===null)return i;let s=o.getComposerDraft(i.draftId),c=s?.reviewComments??[],l=re({prompt:s?.prompt??``,lastHandoffPrompt:$.get(i.draftId)},t.prompt);return $.set(i.draftId,t.prompt),o.setPrompt(i.draftId,l),o.setReviewComments(i.draftId,ne(c,t.reviewComments??[])),i},t[3]=a,t[4]=d);let f=d,p;t[5]!==i||t[6]!==n||t[7]!==l||t[8]!==f?(p=async(e,t)=>{if(!i||l!==null)return;u(e);let r=m(n,i.projectId),a=await f(r,t);u(null),a===null?x.add({type:`error`,title:`Could not open a thread`,description:`Try again from the project, or open a thread first.`}):x.add({type:`success`,title:`Asked in a thread`,description:t.prompt.length>0?`The question is in the composer — read it over, then send.`:`The pull request is in the composer — type your question, then send.`})},t[5]=i,t[6]=n,t[7]=l,t[8]=f,t[9]=p):p=t[9];let h=p,g;t[10]!==i||t[11]!==n||t[12]!==l||t[13]!==a||t[14]!==f||t[15]!==c?(g=async(e,t,r)=>{let o=r===void 0?`worktree`:r;if(!i||l!==null)return;u(e);let s=x.add({type:`loading`,title:`Preparing the pull request checkout...`}),d=m(n,i.projectId),p=await a(d).then(ye,ve);if(p===null){u(null),x.update(s,{type:`error`,title:`Could not open a thread for the checkout`,description:`Try again from the project, or open a thread first.`});return}let h=await c.run({reference:i.url,mode:o,threadId:p.threadId});if(h._tag===`Failure`){u(null);let e=c.error instanceof Error?c.error.message:null;x.update(s,{type:`error`,title:`Could not prepare the pull request checkout`,...e?{description:e}:{}});return}if(!await a(d,{branch:h.value.branch,worktreePath:h.value.worktreePath,envMode:h.value.worktreePath===null?`local`:`worktree`}).then(_e,ge)){u(null),x.update(s,{type:`error`,title:`Checked out, but the thread stayed where it was`,description:`The checkout is ready on \`${h.value.branch}\`. Point a thread at it from the branch picker, then ask again.`});return}u(null);let g={type:`warning`,title:`Checked out, but not on the latest commits`,description:`The checkout could not be moved onto the pull request's latest commits, so the code there is older than the pull request. Uncommitted work or local commits keep it where it is.`};t===null?x.update(s,h.value.isOnPullRequestHead?{type:`success`,title:o===`local`?`Checked out here`:`Checked out`,description:o===`local`?`This repository is on the pull request's branch, with a thread open on it.`:`The pull request is in its own worktree, with a thread open on it.`}:g):(await f(d,t,p),x.update(s,h.value.isOnPullRequestHead?{type:`success`,title:`Checkout ready`,description:`The task is in the composer — read it over, then send.`}:g))},t[10]=i,t[11]=n,t[12]=l,t[13]=a,t[14]=f,t[15]=c,t[16]=g):g=t[16];let _=g,v;return t[17]!==l||t[18]!==h||t[19]!==_?(v={handoff:l,startAsk:h,startHandoff:_},t[17]=l,t[18]=h,t[19]=_,t[20]=v):v=t[20],v}function ge(){return!1}function _e(e){return e!==null}function ve(){return null}function ye(e){return e}function be(){return null}function xe(e){return e}export{X as a,le as c,J as d,oe as f,he as i,q as l,Q as n,se as o,ue as r,Y as s,me as t,ce as u};
|
|
3
|
-
//# sourceMappingURL=usePullRequestActions-WFmep5Tm.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as e,t}from"./react-BUfh6y28.js";import{Un as n,Wa as r}from"./utils-DjbLtxuo.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-BtJcyaxh.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as e,t}from"./react-BUfh6y28.js";import{n}from"./jsx-runtime-DJeoFXNw.js";import{$_ as r,A_ as i,Ab as a,Ah as o,Bh as s,Cx as c,DE as l,Eb as u,Ex as d,Fb as f,Fs as ee,HT as p,Hb as te,Il as ne,JS as re,Jb as ie,Lb as ae,Ll as oe,Ls as se,ME as ce,M_ as le,Nh as ue,OE as m,Ph as de,Ps as fe,Rh as pe,Sx as me,Tx as he,Vh as ge,WT as h,Wb as _e,Wc as ve,Xs as ye,Yb as be,Zh as xe,as as Se,bv as Ce,bx as we,cg as Te,dg as Ee,es as De,ev as Oe,fx as ke,ig as Ae,is as g,js as je,kv as Me,nx as Ne,pb as Pe,px as Fe,qT as _,qh as Ie,ss as Le,tv as Re,ug as ze,us as v,vb as Be,ys as Ve,zl as He}from"./utils-DjbLtxuo.js";import{Jt as Ue,Kr as We,Qt as Ge,T as Ke,Tr as qe,Vr as y,br as Je,ci as Ye}from"./runtime-BBYIQ0f-.js";import{a as b,t as Xe}from"./relay-Do9UB5iT.js";import{f as x,h as S,m as Ze,u as Qe}from"./server-Dkj4NeYG.js";import{i as $e,n as et,s as tt,t as nt}from"./session-CBEVNHld.js";import{t as rt}from"./use-atom-command-BbFDhw_c.js";import{B as it,C as at,F as ot,N as st,O as ct,P as lt,S as ut,V as dt,_ as ft,b as pt,c as mt,i as C,n as w,o as ht,r as gt,y as _t}from"./themePalette-1UQmJk98.js";var T=e(t(),1),E=n();function vt(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 yt(e){let t=Le(t=>v(n=>{let r=n(e.catalogValueAtom).entries.get(t);if(r===void 0)return null;let i=l(fe(n(e.stateAtom(t))),()=>Ye);return{entry:r,connection:r.unsupportedReason===void 0?i===Ye&&r.enabled?{phase:`connecting`,error:null,traceId:null}:Ge(i):{phase:`unsupported`,error:r.unsupportedReason,traceId:null},serverConfig:n(e.serverConfigValueAtom(t))}}).pipe(Ve(`environment-presentation:${t}`))),n=new Map;return{presentationAtom:t,presentationsAtom:v(r=>{let i=new Map;for(let n of r(e.catalogValueAtom).entries.keys()){let e=r(t(n));e!==null&&i.set(n,e)}return vt(n,i)||(n=i),n}).pipe(Ve(`environment-presentations`))}}function bt(e,t){return{environmentId:e,environmentLabel:t.entry.target.label,displayUrl:Ue(t.entry)??``,isRelayManaged:We(t.entry),isEnabled:t.entry.enabled,connectionState:t.connection.phase,connectionError:t.connection.error,connectionErrorTraceId:t.connection.traceId}}function xt(e){let t=v(t=>{let n=[...t(e.catalogValueAtom).entries.keys()],r=m(t.self());return r!==null&&r.length===n.length&&n.every((e,t)=>e===r[t])?r:n}),n=v(t=>{let n=[...t(e.catalogValueAtom).entries].map(([e,t])=>({environmentId:e,label:t.target.label})),r=m(t.self());return r!==null&&r.length===n.length&&n.every((e,t)=>e.environmentId===r[t]?.environmentId&&e.label===r[t]?.label)?r:n}),r=Le(t=>v(n=>{let r=n(e.presentationAtom(t));if(r===null)return null;let i=bt(t,r),a=m(n.self());return a!==null&&a.environmentId===i.environmentId&&a.environmentLabel===i.environmentLabel&&a.displayUrl===i.displayUrl&&a.isRelayManaged===i.isRelayManaged&&a.isEnabled===i.isEnabled&&a.connectionState===i.connectionState&&a.connectionError===i.connectionError&&a.connectionErrorTraceId===i.connectionErrorTraceId?a:i})),i=v(t=>{let n=[];for(let i of t(e.catalogValueAtom).entries.keys()){let e=t(r(i));e!==null&&n.push(e)}let i=m(t.self());return i!==null&&i.length===n.length&&n.every((e,t)=>e===i[t])?i:n}).pipe(Ve(`environment-connection-summaries`));return{environmentIdsAtom:t,connectedEnvironmentIdsAtom:v(e=>{let n=e(t).filter(t=>e(r(t))?.connectionState===`connected`),i=m(e.self());return i!==null&&i.length===n.length&&n.every((e,t)=>e===i[t])?i:n}),identitiesAtom:n,environmentsAtom:i,machineByIdAtom:v(n=>{let r=new Map(n(t).map(t=>[t,He(n(e.presentationAtom(t))?.serverConfig??null)])),i=m(n.self());return i!==null&&vt(i,r)?i:r}),pullRequestsSupportedAtom:v(n=>n(t).some(t=>n(e.presentationAtom(t))?.serverConfig?.environment.capabilities.pullRequests===!0))}}var St=yt({catalogValueAtom:S.catalogValueAtom,stateAtom:S.stateAtom,serverConfigValueAtom:x.configValueAtom}),D=xt({catalogValueAtom:S.catalogValueAtom,presentationAtom:St.presentationAtom}),Ct=v(null).pipe(Ve(`web-environment-presentation:empty`));function wt(e){let t=(0,E.c)(5),n=g(S.catalogValueAtom),r;t[0]===e?r=t[1]:(r=e===null?Ct:St.presentationAtom(e),t[0]=e,t[1]=r);let i=g(r),a;return t[2]!==n.isReady||t[3]!==i?(a={isReady:n.isReady,presentation:i},t[2]=n.isReady,t[3]=i,t[4]=a):a=t[4],a}var Tt={status:`idle`},O=Tt,k=null,A=[],j=0,Et=new Set;function M(e){O=e;for(let e of Et)e()}function Dt(e){k?.resolve(e);for(let t of A)t.resolve(e);k=null,A=[]}function Ot(){return O}function kt(e){return Et.add(e),()=>{Et.delete(e)}}function At(){j+=1;let e=!0;return()=>{e&&(e=!1,j=Math.max(0,j-1),j===0&&(Dt(!1),M(Tt)))}}function jt(e,t){if(j!==0)return new Promise(n=>{let r={message:e,variant:t?.variant??`default`,resolve:n};k||O.status===`closing`?A.push(r):(k=r,M({status:`confirming`,message:e,variant:r.variant}))})}function Mt(){return O.status!==`idle`||k!==null||A.length>0}function Nt(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 Pt(){if(O.status!==`closing`)return;let e=A.shift();e?(k=e,M({status:`confirming`,message:e.message,variant:e.variant})):M(Tt)}var Ft={Ctrl:`⌃`,Alt:`⌥`,Shift:`⇧`,Super:`⌘`,CmdOrCtrl:`⌘`};function It(e,t=navigator.platform){let n=e.split(`+`),r=n.pop()??``;return ve(t)?`${n.map(e=>Ft[e]??e).join(``)}${r}`:[...n.map(e=>e===`CmdOrCtrl`?`Ctrl`:e===`Super`?`Meta`:e),r].join(`+`)}var Lt=`http://www.w3.org/2000/svg`,Rt={archive:[{tag:`rect`,attrs:{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`}},{tag:`path`,attrs:{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`}},{tag:`path`,attrs:{d:`M10 12h4`}}],check:[{tag:`path`,attrs:{d:`M20 6 9 17l-5-5`}}],timer:[{tag:`line`,attrs:{x1:`10`,x2:`14`,y1:`2`,y2:`2`}},{tag:`line`,attrs:{x1:`12`,x2:`15`,y1:`14`,y2:`11`}},{tag:`circle`,attrs:{cx:`12`,cy:`14`,r:`8`}}],"chevron-right":[{tag:`path`,attrs:{d:`m9 19 7-7-7-7`}}],"circle-check":[{tag:`circle`,attrs:{cx:`12`,cy:`12`,r:`10`}},{tag:`path`,attrs:{d:`m9 12 2 2 4-4`}}],clock:[{tag:`path`,attrs:{d:`M12 6v6l4 2`}},{tag:`circle`,attrs:{cx:`12`,cy:`12`,r:`10`}}],pencil:[{tag:`path`,attrs:{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`}},{tag:`path`,attrs:{d:`m15 5 4 4`}}],copy:[{tag:`rect`,attrs:{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}},{tag:`path`,attrs:{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`}}],folder:[{tag:`path`,attrs:{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`}}],"git-branch":[{tag:`line`,attrs:{x1:`6`,x2:`6`,y1:`3`,y2:`15`}},{tag:`circle`,attrs:{cx:`18`,cy:`6`,r:`3`}},{tag:`circle`,attrs:{cx:`6`,cy:`18`,r:`3`}},{tag:`path`,attrs:{d:`M18 9a9 9 0 0 1-9 9`}}],eye:[{tag:`path`,attrs:{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`}},{tag:`circle`,attrs:{cx:`12`,cy:`12`,r:`3`}}],"eye-off":[{tag:`path`,attrs:{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`}},{tag:`path`,attrs:{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`}},{tag:`path`,attrs:{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`}},{tag:`path`,attrs:{d:`m2 2 20 20`}}],"app-window":[{tag:`rect`,attrs:{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`}},{tag:`path`,attrs:{d:`M10 4v4`}},{tag:`path`,attrs:{d:`M2 8h20`}},{tag:`path`,attrs:{d:`M6 4v4`}}],"arrow-up-right":[{tag:`path`,attrs:{d:`M7 7h10v10`}},{tag:`path`,attrs:{d:`M7 17 17 7`}}],"external-link":[{tag:`path`,attrs:{d:`M15 3h6v6`}},{tag:`path`,attrs:{d:`M10 14 21 3`}},{tag:`path`,attrs:{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`}}],link:[{tag:`path`,attrs:{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`}},{tag:`path`,attrs:{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`}}],list:[{tag:`path`,attrs:{d:`M3 5h.01`}},{tag:`path`,attrs:{d:`M3 12h.01`}},{tag:`path`,attrs:{d:`M3 19h.01`}},{tag:`path`,attrs:{d:`M8 5h13`}},{tag:`path`,attrs:{d:`M8 12h13`}},{tag:`path`,attrs:{d:`M8 19h13`}}],share:[{tag:`path`,attrs:{d:`M12 2v13`}},{tag:`path`,attrs:{d:`m16 6-4-4-4 4`}},{tag:`path`,attrs:{d:`M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8`}}],x:[{tag:`path`,attrs:{d:`M18 6 6 18`}},{tag:`path`,attrs:{d:`m6 6 12 12`}}],hash:[{tag:`line`,attrs:{x1:`4`,x2:`20`,y1:`9`,y2:`9`}},{tag:`line`,attrs:{x1:`4`,x2:`20`,y1:`15`,y2:`15`}},{tag:`line`,attrs:{x1:`10`,x2:`8`,y1:`3`,y2:`21`}},{tag:`line`,attrs:{x1:`16`,x2:`14`,y1:`3`,y2:`21`}}],"mail-open":[{tag:`path`,attrs:{d:`M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z`}},{tag:`path`,attrs:{d:`m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10`}}],"message-square":[{tag:`path`,attrs:{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`}}],"message-square-plus":[{tag:`path`,attrs:{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`}},{tag:`path`,attrs:{d:`M12 8v6`}},{tag:`path`,attrs:{d:`M9 11h6`}}],pin:[{tag:`path`,attrs:{d:`M12 17v5`}},{tag:`path`,attrs:{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`}}],"pin-off":[{tag:`path`,attrs:{d:`M12 17v5`}},{tag:`path`,attrs:{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`}},{tag:`path`,attrs:{d:`m2 2 20 20`}},{tag:`path`,attrs:{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`}}],"refresh-cw":[{tag:`path`,attrs:{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`}},{tag:`path`,attrs:{d:`M21 3v5h-5`}},{tag:`path`,attrs:{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`}},{tag:`path`,attrs:{d:`M8 16H3v5`}}],settings:[{tag:`path`,attrs:{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.38a2 2 0 0 0-.73-2.73l-.15-.09a2 2 0 0 1-1-1.74v-.51a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`}},{tag:`circle`,attrs:{cx:`12`,cy:`12`,r:`3`}}],"folder-plus":[{tag:`path`,attrs:{d:`M12 10v6`}},{tag:`path`,attrs:{d:`M9 13h6`}},{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`}}],"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`}}],"text-search":[{tag:`path`,attrs:{d:`M21 5H3`}},{tag:`path`,attrs:{d:`M10 12H3`}},{tag:`path`,attrs:{d:`M10 19H3`}},{tag:`circle`,attrs:{cx:`17`,cy:`15`,r:`3`}},{tag:`path`,attrs:{d:`m21 19-1.9-1.9`}}],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 zt(e,t){let n=Rt[e];if(!n||typeof document.createElementNS!=`function`)return null;let r=document.createElementNS(Lt,`svg`);r.setAttribute(`xmlns`,Lt),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(Lt,e.tag);for(let[n,r]of Object.entries(e.attrs))t.setAttribute(n,r);r.appendChild(t)}return r}function Bt(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 Vt(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 Ht(){return N!==null}function Ut(){N?.(),N=null}function Wt(e,t){return new Promise(n=>{let r=document.activeElement;for(;r?.shadowRoot?.activeElement;)r=r.shadowRoot.activeElement;let i=r instanceof HTMLElement?r:null,a=[],o=[],s=!1,c=!1,l=()=>u(null),u=e=>{if(s)return;s=!0,N===l&&(N=null),document.removeEventListener(`keydown`,d),document.removeEventListener(`pointerdown`,f,!0),document.removeEventListener(`contextmenu`,ee,!0);let t=Vt(document.activeElement,a);for(let e of a)e.remove();t&&i?.isConnected&&i.focus({preventScroll:!0}),n(e)},d=e=>{e.key===`Escape`&&(e.preventDefault(),u(null))},f=e=>{c&&!Vt(e.target,a)&&u(null)},ee=e=>{c&&!Vt(e.target,a)&&(e.preventDefault(),u(null))},p=e=>{for(;a.length>e;)o.pop()?.setAttribute(`aria-expanded`,`false`),a.pop()?.remove()},te=(e,t,n,r,i)=>{p(r);let s=document.createElement(`div`);s.className=`dropdown-glass fixed z-[10000] min-w-56 max-w-sm overflow-hidden rounded-lg bg-clip-padding text-popover-foreground outline-none`,s.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;`,s.style.left=`${t}px`,s.style.top=`${n}px`,s.dataset.level=String(r);let l=document.createElement(`div`);l.className=`max-h-[calc(100vh-0.5rem)] min-w-0 max-w-sm overflow-y-auto overflow-x-hidden p-1`,l.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&&l.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`),l.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,l.appendChild(e);continue}let e=Array.isArray(t.children)&&t.children.length>0,n=!e&&(t.destructive===!0||t.id===`delete`),i=document.createElement(`button`);i.type=`button`;let o=t.disabled===!0;i.disabled=o;let s=`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(i.className=o?`${s} pointer-events-none cursor-not-allowed text-muted-foreground opacity-64`:n?`${s} text-destructive-foreground hover:bg-destructive/10 hover:text-destructive-foreground`:`${s} text-foreground hover:bg-accent hover:text-accent-foreground`,i.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&&(i.style.color=`var(--destructive-foreground)`),o&&(i.style.color=`var(--contrast-muted-foreground)`,i.style.opacity=`0.64`,i.style.pointerEvents=`none`),typeof t.checked==`boolean`){i.setAttribute(`role`,`menuitemradio`),i.setAttribute(`aria-checked`,t.checked?`true`:`false`);let e=t.checked?zt(`check`,`neutral`):null;if(e)i.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`),i.appendChild(e)}}else if(typeof t.icon==`string`){let e=zt(t.icon,n?`destructive`:`neutral`);e&&i.appendChild(e)}let d=document.createElement(`span`);if(d.className=`min-w-0 flex-1 truncate`,d.textContent=t.label,i.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=It(t.accelerator),e.setAttribute(`aria-hidden`,`true`),i.setAttribute(`aria-keyshortcuts`,t.accelerator.replace(`CmdOrCtrl`,ve(navigator.platform)?`Meta`:`Control`)),i.appendChild(e)}if(e){i.setAttribute(`aria-haspopup`,`menu`),i.setAttribute(`aria-expanded`,`false`);let e=zt(`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`,i.appendChild(e))}if(!o){let o=!1,s=!1,l=()=>{let e=o||s;i.style.background=e?n?`color-mix(in srgb, var(--destructive) 10%, transparent)`:`var(--accent)`:`transparent`,i.style.color=e?n?`var(--destructive-foreground)`:`var(--contrast-accent-foreground)`:n?`var(--destructive-foreground)`:`var(--contrast-foreground)`};if(i.addEventListener(`mouseenter`,()=>{i.focus({preventScroll:!0}),o=!0,l()}),i.addEventListener(`mouseleave`,()=>{o=!1,l()}),i.addEventListener(`focus`,()=>{s=!0,l()}),i.addEventListener(`blur`,()=>{s=!1,l()}),e){let e=(e=!1)=>{let n=i.getBoundingClientRect(),o=n.right+4,s=n.top;te(t.children,o,s,r+1,i),i.setAttribute(`aria-expanded`,`true`);let c=a[r+1];if(!c)return;let l=c.getBoundingClientRect();l.right>window.innerWidth&&Bt(c,n.left-l.width-4,n.top),e&&[...c.querySelectorAll(`button`)].find(e=>!e.disabled)?.focus()};i.addEventListener(`mouseenter`,()=>{e()}),i.addEventListener(`click`,t=>{t.preventDefault(),e(!0)})}else i.addEventListener(`mouseenter`,()=>{p(r+1)}),i.addEventListener(`click`,()=>{c&&u(t.id)})}l.appendChild(i)}s.appendChild(l),s.addEventListener(`mouseenter`,()=>{p(r+1)}),document.body.appendChild(s),a[r]=s,o[r]=i,requestAnimationFrame(()=>{Bt(s,t,n)})};document.addEventListener(`keydown`,d),document.addEventListener(`pointerdown`,f,!0),document.addEventListener(`contextmenu`,ee,!0),te(e,t?.x??0,t?.y??0,0),N&&N(),N=l,requestAnimationFrame(()=>{c=!0})})}var Gt=`p4code:client-settings:v1`;function Kt(){return typeof window<`u`}function qt(){return Kt()?ee(Gt,o):null}function Jt(e){Kt()&&se(Gt,e,o)}var Yt;function Xt(){return{dialogs:{pickFolder:async e=>window.desktopBridge?window.desktopBridge.pickFolder(e):null,confirm:async(e,t)=>jt(e,t)??!1},shell:{openExternal:async e=>{if(window.desktopBridge){if(!await window.desktopBridge.openExternal(e))throw Error(`Unable to open link.`)}else window.open(e,`_blank`,`noopener,noreferrer`)},openSystemSettings:async e=>{if(!window.desktopBridge?.openSystemSettings||!await window.desktopBridge.openSystemSettings(e))throw Error(`Unable to open System Settings.`)}},contextMenu:{show:async(e,t)=>window.desktopBridge?window.desktopBridge.showContextMenu(e,t):Wt(e,t),close:async()=>{window.desktopBridge||Ut()}},persistence:{getClientSettings:async()=>window.desktopBridge?window.desktopBridge.getClientSettings():qt(),setClientSettings:async e=>{if(window.desktopBridge)return window.desktopBridge.setClientSettings(e);Jt(e)}}}}function Zt(){return Xt()}function Qt(){if(typeof window<`u`)return Yt||(Yt=Zt(),Yt)}function $t(){let e=Qt();if(!e)throw Error(`Local API not found`);return e}var P=`p4code:theme`,en=`(prefers-color-scheme: dark)`,F={theme:`system`,resolvedTheme:`light`,systemDark:!1,followSystem:!0,appearanceMode:`system`,themeHalves:null};function tn(){return I()}function nn(){return typeof window>`u`?{}:rn()}function I(){if(typeof window>`u`)return null;try{return ct(window.localStorage.getItem(C))}catch{return null}}function rn(){try{let e=JSON.parse(window.localStorage.getItem(`p4code:theme-halves:v1`)??`null`);if(typeof e!=`object`||!e)return{};let t={};for(let n of[`light`,`dark`]){let r=e[n];typeof r==`string`&&(t[n]=r)}return t}catch{return{}}}function an(e){return`${e?.light??``}|${e?.dark??``}`}var on=`theme-color`,sn=`meta[name="${on}"][data-dynamic-theme-color="true"]`,L=class extends a()(`ThemeStorageError`,{operation:Be([`read`,`write`]),storageKey:u,theme:Ne(ht),cause:Pe()}){get message(){return`Failed to ${this.operation} theme preference for ${this.storageKey}.`}},cn=be(L),ln=class extends a()(`DesktopThemeSyncError`,{theme:ht,cause:Pe()}){get message(){return`Failed to sync the ${this.theme} theme to the desktop shell.`}},un=be(ln),R=[],z=null,dn=!0,fn=null,B=null,V=null;function H(){dn=!0;for(let e of R)e()}function pn(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(en).matches}function mn(e){if(typeof window>`u`)return e===`system`;try{let e=window.localStorage.getItem(gt);if(e===`true`)return!0;if(e===`false`)return!1}catch{}return e===`system`}function hn(e){return e===`light`||e===`dark`||e===`system`}function U(e){if(typeof window<`u`)try{let e=window.localStorage.getItem(w);if(hn(e))return e}catch{}return mn(e)?`system`:_t(e)??`light`}function gn(e){if(typeof window<`u`)try{window.localStorage.setItem(w,e)}catch(e){throw new L({operation:`write`,storageKey:w,cause:e})}}function _n(){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&&at(e)?e:F.theme}function vn(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 _n()}catch(e){let t=cn(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 yn(){let e=document.querySelector(sn);return e||(e=document.createElement(`meta`),e.name=on,e.setAttribute(`data-dynamic-theme-color`,`true`),document.head.append(e),e)}function bn(e){let t=e?.trim().toLowerCase();return!t||t===`transparent`||t===`rgba(0, 0, 0, 0)`||t===`rgba(0 0 0 / 0)`?null:e?.trim()??null}function xn(){return document.querySelector(`main[data-slot='sidebar-inset']`)??document.querySelector(`[data-slot='sidebar-inner']`)??document.body}function Sn(){if(typeof document>`u`||typeof getComputedStyle>`u`)return;let e=getComputedStyle(document.documentElement),t=document.documentElement.dataset.themeId?bn(e.getPropertyValue(`--app-chrome-background`)):null,n=bn(getComputedStyle(xn()).backgroundColor),r=bn(getComputedStyle(document.body).backgroundColor),i=t??n??r;if(!i)return;document.documentElement.style.backgroundColor=i,document.body.style.backgroundColor=i;let a=document.querySelectorAll(`meta[name="${on}"]`);if(a.length===0)yn().setAttribute(`content`,i);else 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?pn():!1,o=I();if(B?.theme===e&&B.systemDark===a&&B.followSystem===i&&B.appearanceMode===r&&an(B.themeHalves)===an(o)){wn(e,i,r);return}t&&document.documentElement.classList.add(`no-transitions`);let s=lt(e,a,i,r,o);mt(ot(e,o,s),s),document.documentElement.classList.toggle(`dark`,s===`dark`),B={theme:e,systemDark:a,followSystem:i,appearanceMode:r,themeHalves:o},Sn(),wn(e,i,r),t&&(document.documentElement.offsetHeight,requestAnimationFrame(()=>{document.documentElement.classList.remove(`no-transitions`)}))}async function Cn(e,t,n,r,i=I()){try{await e.setTheme(st(t,n,r,i))}catch(e){throw new ln({theme:t,cause:e})}}function wn(e,t,n){if(typeof window>`u`)return;let r=window.desktopBridge,i=I(),a=st(e,t,n,i);r&&typeof r.setTheme==`function`&&fn!==a&&(fn=a,Cn(r,e,t,n,i).catch(t=>{let n=un(t)?t:new ln({theme:e,cause:t});console.error(n.message,{theme:n.theme,...y(n)}),fn===a&&(fn=null)}))}typeof document<`u`&&typeof window<`u`&&G(W());function Tn(){if(typeof window>`u`)return F;if(!dn&&z)return z;dn=!1;let e=W(),t=U(e),n=t===`system`,r=n?pn():!1,i=I(),a=lt(e,r,n,t,i);return z&&z.theme===e&&z.resolvedTheme===a&&z.systemDark===r&&z.followSystem===n&&z.appearanceMode===t&&an(z.themeHalves)===an(i)||(z={theme:e,resolvedTheme:a,systemDark:r,followSystem:n,appearanceMode:t,themeHalves:i}),z}function En(){return F}function Dn(){let e=W();U(e)===`system`&&G(e,{suppressTransitions:!0}),H()}function On(e){e.key===P?(V=null,G(W(),{suppressTransitions:!0}),H()):e.key===`p4code:theme-follow-system`||e.key===`p4code:theme-appearance-mode`||e.key===`p4code:theme-halves:v1`?(G(W(),{suppressTransitions:!0}),H()):(e.key===`p4code:themes:v1`||e.key===null)&&(e.key===null&&(V=null),ut(),B=null,G(W(),{suppressTransitions:!0}),H())}var kn=null;function An(e){if(typeof window>`u`)return()=>{};if(R.push(e),!kn){let e=typeof window.matchMedia==`function`?window.matchMedia(en):null;e?.addEventListener(`change`,Dn),window.addEventListener(`storage`,On),kn=()=>{e?.removeEventListener(`change`,Dn),window.removeEventListener(`storage`,On)}}return()=>{R=R.filter(t=>t!==e),R.length===0&&(kn?.(),kn=null)}}function jn(){let e=(0,T.useSyncExternalStore)(An,Tn,En),{theme:t,resolvedTheme:n}=e,r=(0,T.useCallback)(e=>{if(typeof window>`u`)return!1;try{gn(U(W()));let t=window.localStorage.getItem(C);window.localStorage.removeItem(C);try{vn(e)}catch(e){if(t!==null)try{window.localStorage.setItem(C,t)}catch{}throw e}}catch(t){let n=cn(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{gn(e)}catch(e){let t=cn(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`?_t(t)??`light`:n;return i(r)},[i,t]),o=(0,T.useCallback)((e,t)=>{if(typeof window>`u`)return!1;try{let n={...rn()};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 Mn=ae(ie(f)),Nn=d(e=>{let t=e.replace(/("(?:[^"\\]|\\.)*")|\/\/[^\r\n]*/g,(e,t)=>t?e:``);return t=t.replace(/("(?:[^"\\]|\\.)*")|\/\*[\s\S]*?\*\//g,(e,t)=>t?e:``),t=t.replace(/("(?:[^"\\]|\\.)*")|,(\s*[}\]])/g,(e,t,n)=>t?e:n??``),Mn(t).pipe(re(e=>e.issue))}),Pn=new we(Nn,he());c().pipe(me(he({space:2})));var Fn=e=>u.pipe(te(e,Pn)),In={performance:{profile:`performance`,automaticGitFetchInterval:h(15),providerHealthRefreshInterval:p(1),hostPowerMonitorActiveInterval:h(30),hostPowerMonitorIdleInterval:p(2),idleClientTtl:h(45),pauseWhenHostLocked:!0,pauseWhenHostLowPower:!1,pauseWhenClientLowPower:!1,pauseWhenOnBattery:!1},balanced:{profile:`balanced`,automaticGitFetchInterval:ue,providerHealthRefreshInterval:s,hostPowerMonitorActiveInterval:h(30),hostPowerMonitorIdleInterval:p(5),idleClientTtl:h(45),pauseWhenHostLocked:!0,pauseWhenHostLowPower:!0,pauseWhenClientLowPower:!0,pauseWhenOnBattery:!1},"battery-saver":{profile:`battery-saver`,automaticGitFetchInterval:h(0),providerHealthRefreshInterval:p(15),hostPowerMonitorActiveInterval:p(1),hostPowerMonitorIdleInterval:p(10),idleClientTtl:h(45),pauseWhenHostLocked:!0,pauseWhenHostLowPower:!0,pauseWhenClientLowPower:!0,pauseWhenOnBattery:!0}};function K(e){return In[e]}function Ln(e){return e.profile===`custom`?e.baseProfile??`balanced`:e.profile}function Rn(e){let t=Ln(e),n=In[t],r=e.profile===`custom`?e.overrides:{};return{profile:t,automaticGitFetchInterval:r.automaticGitFetchInterval??n.automaticGitFetchInterval,providerHealthRefreshInterval:r.providerHealthRefreshInterval??n.providerHealthRefreshInterval,hostPowerMonitorActiveInterval:r.hostPowerMonitorActiveInterval??n.hostPowerMonitorActiveInterval,hostPowerMonitorIdleInterval:r.hostPowerMonitorIdleInterval??n.hostPowerMonitorIdleInterval,idleClientTtl:r.idleClientTtl??n.idleClientTtl,pauseWhenHostLocked:r.pauseWhenHostLocked??n.pauseWhenHostLocked,pauseWhenHostLowPower:r.pauseWhenHostLowPower??n.pauseWhenHostLowPower,pauseWhenClientLowPower:r.pauseWhenClientLowPower??n.pauseWhenClientLowPower,pauseWhenOnBattery:r.pauseWhenOnBattery??n.pauseWhenOnBattery}}function q(e,t){return _(e)===_(t)}function zn(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 Bn(e){if(e.profile!==`custom`)return{schemaVersion:1,profile:e.profile,overrides:{}};let t=Rn(e),n=[Ln(e),`balanced`,`performance`,`battery-saver`];for(let e of n)if(zn(t,In[e]))return{schemaVersion:1,profile:e,overrides:{}};let r=Ln(e),i=In[r];return{schemaVersion:1,profile:`custom`,baseProfile:r,overrides:{...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 Vn(e){let t={schemaVersion:1,profile:de,overrides:{}},n=e.backgroundActivity.profile===t.profile&&e.backgroundActivity.baseProfile===void 0&&Object.keys(e.backgroundActivity.overrides).length===0,r=e.backgroundActivityProfile,i=r!==`balanced`||_(e.automaticGitFetchInterval)!==_(ue)||_(e.providerHealthRefreshInterval)!==_(s);return Rn(n&&i?{schemaVersion:1,profile:_(e.automaticGitFetchInterval)===_(K(r).automaticGitFetchInterval)&&_(e.providerHealthRefreshInterval)===_(K(r).providerHealthRefreshInterval)?r:`custom`,baseProfile:r,overrides:{..._(e.automaticGitFetchInterval)===_(K(r).automaticGitFetchInterval)?{}:{automaticGitFetchInterval:e.automaticGitFetchInterval},..._(e.providerHealthRefreshInterval)===_(K(r).providerHealthRefreshInterval)?{}:{providerHealthRefreshInterval:e.providerHealthRefreshInterval}}}:e.backgroundActivity)}function Hn(e){let t=Vn(e);return Bn({schemaVersion:1,profile:`custom`,baseProfile:t.profile,overrides:{automaticGitFetchInterval:t.automaticGitFetchInterval,providerHealthRefreshInterval:t.providerHealthRefreshInterval,hostPowerMonitorActiveInterval:t.hostPowerMonitorActiveInterval,hostPowerMonitorIdleInterval:t.hostPowerMonitorIdleInterval,idleClientTtl:t.idleClientTtl,pauseWhenHostLocked:t.pauseWhenHostLocked,pauseWhenHostLowPower:t.pauseWhenHostLowPower,pauseWhenClientLowPower:t.pauseWhenClientLowPower,pauseWhenOnBattery:t.pauseWhenOnBattery}})}var Un=Fn(xe);_e(Un);function Wn(e,t){let n=e.providerInstances[t.instanceId];return n===void 0?Ae(t.instanceId):Ee(n)}var Gn=[`codex`,`claudeAgent`,`cursor`,`grok`,`muse`,`pi`,`opencode`,`antigravity`].map(e=>r.make(e));function Kn(e,t,n){let r=[...Gn.map(e=>[Re(e),e]),...n?.includeConfiguredInstances===!0?Object.entries(e).flatMap(([e,t])=>Gn.includes(t.driver)?[[Oe.make(e),t.driver]]:[]):[]].find(([e,n])=>t(e,n));if(r===void 0)return null;let[a,o]=r,s=n?.defaultModelSelection,c=e[a]?.config;return s?.instanceId===a&&ye(c?.customModels).some(e=>e.slug===s.model)?s:{instanceId:a,model:le[o]??i[o]??`gpt-6-luna`}}function qn(e,t,n){let r=e.sourceControlWriterModelSelection;if(!r||!ze(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&&ne(i)&&oe(i)?r:e.textGenerationModelSelection}function Jn(e,t,n){let r=e.reviewGuideModelSelection;if(r&&ze(e,n,r.instanceId)){let e=t?.find(e=>e.instanceId===r.instanceId);if(t===void 0||e?.enabled===!0&&ne(e)&&oe(e))return r}return qn(e,t,n)}new Set(Object.keys(Ie.fields));function Yn(e,t={}){return{favorites:e.favorites??t.favorites??[],providerModelPreferences:e.providerModelPreferences??t.providerModelPreferences??{}}}function Xn(e,t){let n=e.favorites===null&&(t.favorites?.length??0)>0?t.favorites:void 0,r=e.providerModelPreferences===null&&Object.keys(t.providerModelPreferences??{}).length>0?t.providerModelPreferences:void 0;return n===void 0&&r===void 0?null:{migrateModelPreferences:{...n===void 0?{}:{favorites:n},...r===void 0?{}:{providerModelPreferences:r}}}}var Zn=new Set([`continueThreadsAfterServerUpdate`,`autoResumeLimitedThreads`,`snoozeLimitedThreads`,`newWorktreesStartFromOrigin`,`sourceControlWritingStyle`,`textGenerationModelSelection`]);function Qn(e){let t={},n={};for(let[r,i]of Object.entries(e))Zn.has(r)?t[r]=i:n[r]=i;return{sharedPatch:t,localPatch:n}}function $n(e,t,n,r=n,i=!1){let a=e.textGenerationModelSelection?.instanceId??r?.textGenerationModelSelection.instanceId;return!i&&e.textGenerationModelSelection&&(!n||a!==void 0&&(r?.providerInstances[a]?.driver??a)!==(n.providerInstances[a]?.driver??a)||!Wn(n,{...n.textGenerationModelSelection,...e.textGenerationModelSelection}))&&(e=Fe(e,[`textGenerationModelSelection`])),t?.threadRestartContinuation===!0?e:Fe(e,[`continueThreadsAfterServerUpdate`])}function er(e){return e.connection.phase===`connected`&&e.serverConfig!==null}function tr(e,t){return{...t,environmentId:e,label:t.entry.target.label,displayUrl:Ue(t.entry),relayManaged:We(t.entry)}}function nr(){let e=(0,E.c)(7),t=g(S.catalogValueAtom),n=g(S.networkStatusValueAtom),r=g(St.presentationsAtom),i;e[0]===r?i=e[1]:(i=[...r.entries()].map(rr),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 rr(e){let[t,n]=e;return tr(t,n)}function ir(){return g(Ze)}function ar(e){let t=(0,E.c)(3),{presentation:n}=wt(e),r;return t[0]!==e||t[1]!==n?(r=e===null||n===null?null:tr(e,n),t[0]=e,t[1]=n,t[2]=r):r=t[2],r}function or(){return ar(ir())}function sr(e){let t=(0,E.c)(2),n=tt(e),r;return t[0]===n?r=t[1]:(r=ce(n)?n.value.httpBaseUrl:null,t[0]=n,t[1]=r),r}function cr(){return g(Xe.stateValueAtom)}function lr(){return g(D.environmentIdsAtom)}function ur(){return g(D.identitiesAtom)}function dr(){return g(D.pullRequestsSupportedAtom)}function fr(){return g(D.machineByIdAtom)}var pr=`[CLIENT_SETTINGS]`,mr=new Set,hr=new Set,gr=pe,J=`pending`,Y=null,_r=0,vr=Promise.resolve(),yr=0;function br(){for(let e of mr)e()}function xr(){for(let e of hr)e()}function X(){return gr}function Sr(e){gr=e,br()}function Cr(e){J!==e&&(J=e,xr())}function wr(e){return mr.add(e),Z().catch(()=>void 0),()=>{mr.delete(e)}}function Tr(){return J===`ready`}function Er(){return J}function Dr(e){return hr.add(e),Z().catch(()=>void 0),()=>{hr.delete(e)}}async function Z(){if(J===`ready`)return;if(Y)return Y;let e=_r;Cr(J===`failed`||J===`retrying`?`retrying`:`pending`);let t=(async()=>{try{let t=await $t().persistence.getClientSettings();if(e!==_r)return;t&&Sr({...pe,...t}),Cr(`ready`)}catch(t){throw e===_r&&Cr(`failed`),console.error(`${pr} hydrate failed`,{operation:`hydrate`,...y(t)}),t}})().finally(()=>{Y===t&&(Y=null)});return Y=t,Y}var Or=e=>$t().persistence.setClientSettings(e);function kr(e){let t=vr.then(e);return vr=t.then(()=>void 0,()=>void 0),t}function Ar(e,t=Or){let n=J!==`ready`||yr>0;return n?yr+=1:Sr({...X(),...e}),kr(async()=>{if(n)try{J!==`ready`&&await Z(),Sr({...X(),...e})}finally{--yr}await t(X())}).catch(e=>{console.error(`${pr} persist failed`,{operation:`persist`,...y(e)})})}async function jr(e,t=Or){return kr(async()=>{for(J!==`ready`&&await Z();;){let n=X(),r=e(n);if(await t(r),X()===n)return Sr(r),r}})}var Mr=new Set(ke(xe.fields));function Nr(e){let t={},n={};for(let[r,i]of Object.entries(e))Mr.has(r)?t[r]=i:n[r]=i;return{serverPatch:t,clientPatch:n}}function Pr(){return X()}function Fr(){return Z()}function Ir(){return(0,T.useSyncExternalStore)(Dr,Tr,Lr)}function Lr(){return!1}function Rr(){return(0,T.useSyncExternalStore)(Dr,Er,zr)}function zr(){return`pending`}function Q(){return(0,T.useSyncExternalStore)(wr,X,Br)}function Br(){return pe}function Vr(e,t){return{...t,...e,...Yn(e,t)}}var Hr=new Set;function $(e,t){let n=(0,E.c)(8),r=Q(),i=Ir(),a;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={reportFailure:!1},n[0]=a):a=n[0];let o=rt(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||Hr.has(e))return;let n=Xn(t,r);n&&(Hr.add(e),o({environmentId:e,input:{patch:n}}).finally(()=>Hr.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 Ur(e,t){let n=(0,E.c)(6),r=Q(),i;n[0]!==r||n[1]!==e?(i=Vr(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 Wr(e){let t=(0,E.c)(3),n=Q(),r;return t[0]!==e||t[1]!==n?(r=e?e(n):n,t[0]=e,t[1]=n,t[2]=r):r=t[2],r}function Gr(e){return e.settingsHydrated?e.paletteThemeActive&&!e.paletteThemeAllowsArtwork&&e.mode===`artwork`?`pill`:e.mode:`none`}function Kr(){let e=(0,E.c)(7),t=Ir(),n=Q().environmentIdentificationMode,{resolvedTheme:r,theme:i,themeHalves:a}=jn(),o=(0,T.useSyncExternalStore)(it,pt,qr),s;if(e[0]!==n||e[1]!==o||e[2]!==r||e[3]!==t||e[4]!==i||e[5]!==a){let c=ot(i,a,r),l=ft(c);s=Gr({mode:n,settingsHydrated:t,paletteThemeActive:o!==null||l!==null,paletteThemeAllowsArtwork:o??dt(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 qr(){return null}async function Jr(e,t){return(e.favorites===null||e.providerModelPreferences===null)&&await Fr(),{...Xn(e,Pr()),...t}}function Yr(e){let t=(0,E.c)(6),n;t[0]===e?n=t[1]:(n=e?x.settingsValueAtom(e):Zr,t[0]=e,t[1]=n);let r=g(n),i=rt(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 Jr(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 Xr(e){let t=(0,T.use)(Se),n=(0,T.useRef)(new Map),r=Yr(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 Fr()}catch{b.add({type:`error`,title:`Favorites not saved`,description:`Could not load saved model preferences. Try again.`});return}let c=t.get(o)??s,l=Yn(c,Pr()).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&&je(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 Zr=v(null);function Qr(e){let t=(0,E.c)(5),n;t[0]===e?n=t[1]:(n=e?x.settingsValueAtom(e):Zr,t[0]=e,t[1]=n);let r=g(n),i=Q();$(e,r);let a=r??ge,o;return t[2]!==i||t[3]!==a?(o=Yn(a,i),t[2]=i,t[3]=a,t[4]=o):o=t[4],o}function $r(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=g(r);return $(e,i),Ur(i??ge,t)}function ei(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=rt(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 ti(e){let t=or(),n=g(Qe);return $(t?.environmentId??null,t?.serverConfig?.settings??null),Ur(n,e)}var ni=`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 ri(){let e=(0,E.c)(2),t=or(),n;return e[0]===t?n=e[1]:(n=t!==null||!Ke(),e[0]=t,e[1]=n),n}function ii(e){let t=(0,E.c)(3),n=e!==void 0&&e,{environments:r}=nr(),i;return t[0]!==r||t[1]!==n?(i=v(e=>r.filter(er).flatMap(t=>{let r=e(nt.sessionStateAtom(t.environmentId));if(n&&r._tag===`Initial`)return[t.environmentId];let i=r._tag===`Failure`?null:m(fe(r));return i!==null&&Me(i,`settings:write`)?[t.environmentId]:[]})),t[0]=r,t[1]=n,t[2]=i):i=t[2],g(i)}function ai(e){let t=(0,E.c)(10);$e(e,Ce);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=rt(x.updateSettings,n),{environments:i}=nr(),a;t[1]!==i||t[2]!==r?(a=async e=>{let t=await r(e);if(t._tag===`Failure`&&!Je(t)){let n=i.find(t=>t.environmentId===e.environmentId)?.label??e.environmentId,r=qe(t);b.add({type:`error`,title:`Setting not saved`,description:`Could not save on ${n}: ${r instanceof Error?r.message:`The save failed. Try reconnecting and saving again.`}`})}return t},t[1]=i,t[2]=r,t[3]=a):a=t[3];let o=a,s=ii(!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}=Nr(t),c=e===null||Te(n).every(t=>et(e,t));if(Object.keys(n).length>0&&!c&&b.add({type:`warning`,title:`Setting not saved`,description:`This connection lacks permission to change settings on ${i.find(t=>t.environmentId===e)?.label??`the selected environment`}.`}),Object.keys(n).length>0&&c){let{sharedPatch:t,localPatch:a}=Qn(n),c=ui;if(Object.keys(a).length>0&&(e?o({environmentId:e,input:{patch:a}}):c()),Object.keys(t).length>0){let n=i.find(t=>t.environmentId===e)?.serverConfig?.settings,a=new Set(s);e&&a.add(e);let o=[],l=[];for(let r of a){let a=i.find(e=>e.environmentId===r),s=$n(t,a?.serverConfig?.environment.capabilities,a?.serverConfig?.settings,n,r===e);Object.keys(s).length!==0&&(De.get(nt.sessionStateAtom(r))._tag!==`Initial`&&!Te(t).every(e=>et(r,e))?l.push(a?.label??r):o.push({environmentId:r,input:{patch:s}}))}o.length===0?c(l.length>0?`This connection lacks permission to change settings on ${l.join(`, `)}.`:a.size>0?`Update older servers to save this setting.`:void 0):Promise.all(o.map(async e=>({label:i.find(t=>t.environmentId===e.environmentId)?.label??e.environmentId,result:await r(e)}))).then(oi)}}Object.keys(a).length>0&&Ar(a)},t[4]=e,t[5]=i,t[6]=r,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function oi(e){let t=e.flatMap(li);if(t.length===0)return;let n=e.filter(ci).map(si);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 si(e){let{label:t}=e;return t}function ci(e){let{result:t}=e;return t._tag===`Success`}function li(e){let{label:t,result:n}=e;if(n._tag!==`Failure`||Je(n))return[];let r=qe(n);return[`Could not save on ${t}: ${r instanceof Error?r.message:`The save failed. Try reconnecting and saving again.`}`]}function ui(e){let t=e===void 0?ni:e;return b.add({type:`warning`,title:`Setting not saved`,description:t})}function di(e){return ai(e)}function fi(){return ai(or()?.environmentId??null)}function pi(){return mi}function mi(e){return Ar(e)}export{At as $,dr as A,Fn as B,sr as C,nr as D,fr as E,Ln as F,Sn as G,tn as H,K as I,Qt as J,jn as K,Bn as L,Kn as M,Jn as N,or as O,qn as P,Ot as Q,Hn as R,ar as S,lr as T,nn as U,U as V,_n as W,Pt as X,Ht as Y,Mt as Z,Xr as _,Ar as a,wt as at,di as b,Ir as c,Qr as d,jt as et,$r as f,ri as g,ti as h,Vr as i,D as it,cr as j,ir as k,Rr as l,ei as m,Fr as n,kt as nt,jr as o,$ as p,$t as q,Pr as r,St as rt,Wr as s,ni as t,Nt as tt,Kr as u,pi as v,ur as w,fi as x,Yr as y,Vn as z};
|
|
3
|
-
//# sourceMappingURL=useSettings-EYJbJzT3.js.map
|