ryco-cli 0.1.11 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.cjs +1 -1
- package/dist/bin.mjs +1 -1
- package/dist/client/assets/{AccountSettings-BUoiS8x1.js → AccountSettings-Be5_48k0.js} +1 -1
- package/dist/client/assets/{AiFocusSettings-Cz1Uqn7a.js → AiFocusSettings-DIpQXLW2.js} +1 -1
- package/dist/client/assets/{BranchToolbar.logic-LIanCEVr.js → BranchToolbar.logic-D7slG_zJ.js} +1 -1
- package/dist/client/assets/{ChatRightPanel-CKEjpQ_x.js → ChatRightPanel-BIS1DPGa.js} +3 -3
- package/dist/client/assets/{ChatThreadRouteView-D50onHY2.js → ChatThreadRouteView-CocRstME.js} +1 -1
- package/dist/client/assets/{CommandPaletteDialog-DdRKgZ8m.js → CommandPaletteDialog-C5xAo65V.js} +1 -1
- package/dist/client/assets/ConnectionsSettings-CXabxSaH.js +7 -0
- package/dist/client/assets/{DiagnosticsSettings-C74u3ce5.js → DiagnosticsSettings-CZ3vY43G.js} +1 -1
- package/dist/client/assets/{DraftChatThreadRouteView-RTmLGTl0.js → DraftChatThreadRouteView-D8Bt3Qnq.js} +1 -1
- package/dist/client/assets/{HostedConnectionControls-CKiC01ju.js → HostedConnectionControls-DxAXv0Hd.js} +1 -1
- package/dist/client/assets/{HostedHubRoot-BS3rAYTy.js → HostedHubRoot-Cc8GYcK6.js} +1 -1
- package/dist/client/assets/{HostedNativeAuthorizationRoute-BFTDyh4N.js → HostedNativeAuthorizationRoute-CTQe7Vjt.js} +1 -1
- package/dist/client/assets/{HostedRelayTrustNotice-eEOPKsBg.js → HostedRelayTrustNotice-BldMySVi.js} +1 -1
- package/dist/client/assets/{IntegrationsSettingsPanel-Cg4eRHm_.js → IntegrationsSettingsPanel-D6f3KoqM.js} +1 -1
- package/dist/client/assets/{KeybindingsSettings-CYj67N2D.js → KeybindingsSettings-D2bNQPI-.js} +1 -1
- package/dist/client/assets/{McpServersSettings-Bc61hRUY.js → McpServersSettings-B7YqVvV4.js} +1 -1
- package/dist/client/assets/{NewWorktreeDialog-CTlFjKa4.js → NewWorktreeDialog-CKr2ioue.js} +1 -1
- package/dist/client/assets/{NoActiveThreadState-Dw9aoU2J.js → NoActiveThreadState-BD-eNmfn.js} +1 -1
- package/dist/client/assets/{NodeSecuritySettings-DMkkTgfg.js → NodeSecuritySettings-FWM_SeDi.js} +1 -1
- package/dist/client/assets/{OpinionatedPluginsSettings-CeoSmZ90.js → OpinionatedPluginsSettings-BtZQF4Ze.js} +1 -1
- package/dist/client/assets/{PhoneGetAppInterstitial-7ZxxVbUB.js → PhoneGetAppInterstitial-CooQgpSw.js} +1 -1
- package/dist/client/assets/{PhoneHome-DRRoCd_y.js → PhoneHome-BtPE7bQn.js} +1 -1
- package/dist/client/assets/{PhoneSettingsSurface-LNEaPHQC.js → PhoneSettingsSurface-tcFCccEL.js} +1 -1
- package/dist/client/assets/{ProjectFavicon-BIMdZxK6.js → ProjectFavicon-qZGdjYCM.js} +1 -1
- package/dist/client/assets/{ProviderModelPicker-jd6GjQkO.js → ProviderModelPicker-D0w23uWo.js} +1 -1
- package/dist/client/assets/{ProvidersSettingsPanel-v2SvoEGx.js → ProvidersSettingsPanel-B3aBKY--.js} +1 -1
- package/dist/client/assets/{RootAppShell-CFjrYjtn.js → RootAppShell-C-0ChFVJ.js} +2 -2
- package/dist/client/assets/SettingsDialog-Bbuoh793.js +1 -0
- package/dist/client/assets/{SettingsPanels-BmhZ8u4B.js → SettingsPanels-Dr4f2y9l.js} +1 -1
- package/dist/client/assets/{SourceControlSettings-DvPydmxX.js → SourceControlSettings-CkiYR4lR.js} +1 -1
- package/dist/client/assets/{StatisticsPage-Duk2cHVH.js → StatisticsPage-Bjouapmf.js} +1 -1
- package/dist/client/assets/{StatisticsPanel-D-uNJcdj.js → StatisticsPanel-D_khPph6.js} +1 -1
- package/dist/client/assets/{ThreadStatusIndicators-D0xoATCw.js → ThreadStatusIndicators-ZImeLExQ.js} +0 -0
- package/dist/client/assets/{ThreadTerminalDrawer-DjX8p7IH.js → ThreadTerminalDrawer-DDHEuRGB.js} +1 -1
- package/dist/client/assets/{ThreadWorkspacePanel-DI0GXPBf.js → ThreadWorkspacePanel-QF3KwbGm.js} +1 -1
- package/dist/client/assets/{WorkItemsTab-ow45makA.js → WorkItemsTab-AOVwVvb7.js} +1 -1
- package/dist/client/assets/{branding-C8SLy6Af.js → branding-BDfN6Spd.js} +1 -1
- package/dist/client/assets/{capabilities-BQuqC7jg.js → capabilities-3zgirmmI.js} +1 -1
- package/dist/client/assets/{desktopUpdateAtoms-C82GmR67.js → desktopUpdateAtoms-CyfPW2jg.js} +1 -1
- package/dist/client/assets/{desktopWorkspace-G5Z_JRbm.js → desktopWorkspace-DHUZEpfy.js} +1 -1
- package/dist/client/assets/{device-B56cBWWt.js → device-B_qvyvtW.js} +1 -1
- package/dist/client/assets/{editorPreferences-CTDEj79K.js → editorPreferences-DHIJntKF.js} +1 -1
- package/dist/client/assets/{index-Bbz4fkK_.js → index-CQmEMMQH.js} +1 -1
- package/dist/client/assets/{main-Dwu2cT6v.js → main-BKS5Nf2_.js} +2 -2
- package/dist/client/assets/primary-BzLEg2w1.js +2 -0
- package/dist/client/assets/{projectPaths-lDhAE9o_.js → projectPaths-BAd6NFcE.js} +1 -1
- package/dist/client/assets/{providerIconUtils-DnSYUN9l.js → providerIconUtils-X0Z3EK-Q.js} +1 -1
- package/dist/client/assets/runtime-CXut_g4p.js +1 -0
- package/dist/client/assets/{session-logic-DElAta-Z.js → session-logic-GZix7S2I.js} +1 -1
- package/dist/client/assets/{sidebarProjectFolders-Cs13ZUN8.js → sidebarProjectFolders-cnmz3B_-.js} +1 -1
- package/dist/client/assets/storeSelectors-DYekgeHu.js +1 -0
- package/dist/client/assets/{threadPriorityRefreshRuntime-DJF5drVD.js → threadPriorityRefreshRuntime-Ct5pnIbX.js} +1 -1
- package/dist/client/assets/types-DYekgeHu.js +1 -0
- package/dist/client/assets/{useAtlassian-Bx2ua3JV.js → useAtlassian-9-hy2f8z.js} +0 -0
- package/dist/client/assets/{useHandleNewThread-DHO0PWGZ.js → useHandleNewThread-DX2FtXcP.js} +1 -1
- package/dist/client/assets/{usePhoneThreadActions-OTf7yIbN.js → usePhoneThreadActions-BEa3VzGG.js} +1 -1
- package/dist/client/assets/{useStatistics-DEtKeVPP.js → useStatistics-CtunoTE-.js} +1 -1
- package/dist/client/assets/{useThreadActions-DLxhOMkz.js → useThreadActions-fN-Al13y.js} +1 -1
- package/dist/client/index.html +1 -1
- package/package.json +1 -1
- package/dist/client/assets/ConnectionsSettings--CbTzkTn.js +0 -7
- package/dist/client/assets/SettingsDialog-CvGTsSV0.js +0 -1
- package/dist/client/assets/primary-OskAInOO.js +0 -2
- package/dist/client/assets/runtime-DKwoXpJv.js +0 -1
- package/dist/client/assets/storeSelectors-Cq_JKyiF.js +0 -1
- package/dist/client/assets/types-Cq_JKyiF.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,t}from"./react-SIfiwpqq.js";import{t as n}from"./index-CQmEMMQH.js";import{t as r}from"./compiler-runtime-qmuS0Svy.js";import{n as i,t as a}from"./env-B4arEvJg.js";import{Jn as o,Jt as s,N as c,Vn as l,Yn as u,bn as d,yn as f}from"./runtime-CXut_g4p.js";import{i as p}from"./primary-BzLEg2w1.js";import{It as m}from"./composerDraftStore-CdJJZe42.js";import{d as h,l as g}from"./useSwipeDismiss-CbgDJvw1.js";import{t as _}from"./useNavigate-2tVq4iZ2.js";import{t as v}from"./settingsDialogStore-ygYoScKe.js";import{o as y}from"./desktopWorkspace-DHUZEpfy.js";import{t as ee}from"./activity-1CkdQG5u.js";import{a as te,i as b,n as x,o as ne,r as S,t as C}from"./SettingsPanels-Dr4f2y9l.js";import{m as w,p as re}from"./desktopUpdateAtoms-CyfPW2jg.js";import{t as T}from"./chart-column-Dw6ACmXM.js";import{t as E}from"./git-branch-BKr-Ij4u.js";import{t as D}from"./keyboard-BqeRMHfL.js";import{t as O}from"./palette-BSD_aJZg.js";import{t as ie}from"./search-BGQsenCM.js";import{t as ae}from"./settings-2-CZQg_KUQ.js";import{t as k}from"./server-JApJpgLa.js";import{t as oe}from"./shield-IZEIJ8r7.js";import{t as A}from"./sparkles-CAf3oJ5S.js";import{t as j}from"./user-round-Cpzx8pSw.js";import{t as se}from"./utils-BofFIn5Y.js";import{t as ce}from"./scroll-area-Drsa8bNB.js";import{t as M}from"./button-BAbJxRzt.js";import{c as le,s as ue,t as de}from"./dialog-DQsYchqu.js";import{i as fe,n as pe,o as me,s as he,t as ge}from"./settingsSections.logic-F8RXVmAq.js";var N=e(t(),1),P=r(),_e=[{section:`inbox`,title:`AI Focus`,description:`Prioritize the Inbox with bounded, environment-local model ranking.`,keywords:`priority sort active threads model ranking focus refresh`},{section:`inbox`,title:`AI Focus models`,description:`Choose or inherit the ranking model for each connected environment.`,keywords:`provider node disclosure privacy data`},{section:`general`,title:`Time format`,description:`System default, 12-hour or 24-hour clock.`,keywords:`clock hours`},{section:`general`,title:`Default editor`,description:`Pin which editor opens directories and files.`,keywords:`vscode cursor open in`},{section:`general`,title:`Diff line wrapping`,description:`Default wrap state when the diff panel opens.`,keywords:`word wrap`},{section:`general`,title:`Hide whitespace changes`,description:`Whether the diff panel ignores whitespace-only edits.`,keywords:`diff`},{section:`general`,title:`Remote Git status`,description:`Refresh remote branch and pull request metadata.`,keywords:`git polling refresh remote`},{section:`general`,title:`PR & workflow updates`,description:`Choose automatic, reduced, or manual pull request and workflow refreshes.`,keywords:`github actions checks ci polling refresh`},{section:`general`,title:`Stream token by token (legacy)`,description:`Compatibility mode for token-by-token assistant output.`,keywords:`token streaming assistant output streaming tokens buffered`,targetId:`legacy-token-streaming`},{section:`general`,title:`Provider update checks`,description:`Check installed provider CLIs for newer versions.`,keywords:`upgrade cli`},{section:`general`,title:`Auto-open overview`,description:`Open the overview when plans or progress appear.`,keywords:`panel plan`},{section:`general`,title:`New threads`,description:`Default workspace mode for newly created drafts.`,keywords:`local worktree draft`},{section:`general`,title:`Add project starts in`,description:`Starting directory for the Add Project browser.`,keywords:`folder path`},{section:`general`,title:`Archive confirmation`,description:`Ask before archiving a thread.`,keywords:`confirm`},{section:`general`,title:`Delete confirmation`,description:`Ask before deleting a thread.`,keywords:`confirm remove`},{section:`general`,title:`Update track`,description:`Which release channel the app follows.`,keywords:`beta stable release channel`},{section:`appearance`,title:`Interface font`,description:`Normal app text, navigation, dialogs, and controls.`,keywords:`typeface dm sans inter geist`},{section:`appearance`,title:`Code font`,description:`Code blocks, diffs, file paths, and terminal surfaces.`,keywords:`monospace jetbrains fira`},{section:`appearance`,title:`Text size`,description:`Scale the interface independently from the theme.`,keywords:`zoom font size compact`},{section:`appearance`,title:`Corner radius`,description:`Rounding for panels, buttons, inputs, and menus.`,keywords:`round square`},{section:`appearance`,title:`Primary color`,description:`Accent color for links, focus rings, and actions.`,keywords:`accent custom violet amber`},{section:`appearance`,title:`Transparency`,description:`Glass and floating surfaces like dialogs, menus, popups.`,keywords:`glass blur liquid material solid`},{section:`appearance`,title:`Panel layout`,description:`How the overview panel arranges its sections.`,keywords:`stack hybrid status board`},{section:`appearance`,title:`Theme palette`,description:`Built-in and custom color themes; import and export.`,keywords:`dark midnight graphite nord dracula catppuccin`},{section:`appearance`,title:`Auto-collapse wide composer labels`,description:`Show long composer mode labels only on hover or focus.`,keywords:`chips`},{section:`appearance`,title:`Always use Build mode`,description:`Hide the mode selector and send every turn in Build mode.`,keywords:`composer`},{section:`appearance`,title:`Theme variant`,description:`Light, dark, or follow the system preference.`,keywords:`color mode dark light`},{section:`providers`,title:`Provider instances`,description:`Configure Codex, Claude, Copilot, OpenCode, and Cursor.`,keywords:`api model driver accent`},{section:`mcp-servers`,title:`External integrations`,description:`Pair local Codex or Claude MCP clients with scoped, revocable access.`,keywords:`model context protocol tools pairing codex claude approval agent control`},{section:`mcp-servers`,title:`MCP Servers`,description:`Manage Codex, Claude, and other provider-native MCP servers.`,keywords:`model context protocol tools add server oauth profiles providers`},{section:`keybindings`,title:`Keybindings file`,description:`Customize shortcuts via the keybindings configuration file.`,keywords:`shortcuts hotkeys keyboard`},{section:`source-control`,title:`Version Control`,description:`Git behavior and defaults.`,keywords:`git commit`},{section:`source-control`,title:`Source Control Providers`,description:`GitHub and other source control provider connections.`,keywords:`github pr pull request`},{section:`connections`,title:`Network access`,description:`Expose the local backend on your network.`,keywords:`lan host remote`},{section:`connections`,title:`Pairing link`,description:`Scan to open this backend on another device.`,keywords:`qr code phone mobile`},{section:`connections`,title:`Tailscale HTTPS`,description:`Serve over your tailnet with HTTPS.`,keywords:`vpn remote`},{section:`connections`,title:`Authorized clients`,description:`Devices and sessions allowed to connect.`,keywords:`revoke tokens`},{section:`security`,title:`Session code`,description:`Compare this browser's channel against the one your node's CLI shows.`,keywords:`security verification websas e2ee compare short authentication string`},{section:`security`,title:`Enrollment fingerprint`,description:`This node's identity, and the prekey and continuity behind it.`,keywords:`security e2ee key fingerprint rotate lineage`},{section:`security`,title:`Authorized client keys`,description:`Approve, reduce, revoke, or delete a client key, and open a pairing window.`,keywords:`security e2ee pairing fingerprint refused attempts`},{section:`security`,title:`Admission policy`,description:`Require E2EE, require approved clients, and advance the policy generation.`,keywords:`security e2ee strict fallback plaintext`},{section:`diagnostics`,title:`Diagnostics`,description:`Logs, tracing, resource history, and live activity.`,keywords:`debug performance slow`},{section:`diagnostics`,title:`Test notification`,description:`Fire sample notifications to preview the toast design and stacking.`,keywords:`toast notifications preview trigger sample`},{section:`statistics`,title:`Statistics`,description:`Usage activity and history.`,keywords:`heatmap usage tokens`},{section:`archived`,title:`Archive`,description:`Archived threads; restore or delete permanently.`,keywords:`trash restore`}],F=m(),ve=[{id:`account`,label:`Account`,icon:j},{id:`general`,label:`General`,icon:ae},{id:`inbox`,label:`Inbox`,icon:A},{id:`providers`,label:`Providers`,icon:ne},{id:`opinionated-plugins`,label:`Plugins`,icon:b},{id:`mcp-servers`,label:`Integrations`,icon:k},{id:`appearance`,label:`Appearance`,icon:O},{id:`keybindings`,label:`Keybindings`,icon:D},{id:`source-control`,label:`Source Control`,icon:E},{id:`connections`,label:`Connections`,icon:te},{id:`security`,label:`Security`,icon:oe},{id:`diagnostics`,label:`Diagnostics`,icon:ee},{id:`statistics`,label:`Statistics`,icon:T},{id:`archived`,label:`Archive`,icon:w}];ve.map(e=>e.id),new Map(ve.map(e=>[e.id,e.label]));var ye=new Set([`general`,`providers`,`appearance`]),I=(0,N.lazy)(()=>n(()=>import(`./AccountSettings-Be5_48k0.js`).then(e=>({default:e.AccountSettingsPanel})),[])),be=(0,N.lazy)(()=>n(()=>import(`./ProvidersSettingsPanel-B3aBKY--.js`).then(e=>({default:e.ProvidersSettingsPanel})),[])),L=(0,N.lazy)(()=>n(()=>import(`./AiFocusSettings-DIpQXLW2.js`).then(e=>({default:e.AiFocusSettings})),[])),R=(0,N.lazy)(()=>n(()=>import(`./OpinionatedPluginsSettings-BtZQF4Ze.js`).then(e=>({default:e.OpinionatedPluginsSettingsPanel})),[])),xe=(0,N.lazy)(()=>n(()=>import(`./IntegrationsSettingsPanel-D6f3KoqM.js`).then(e=>({default:e.IntegrationsSettingsPanel})),[])),Se=(0,N.lazy)(()=>n(()=>import(`./AppearanceSettings-CYbSApl4.js`).then(e=>({default:e.AppearanceSettingsPanel})),[])),z=(0,N.lazy)(()=>n(()=>import(`./KeybindingsSettings-D2bNQPI-.js`).then(e=>({default:e.KeybindingsSettingsPanel})),[])),B=(0,N.lazy)(()=>n(()=>import(`./SourceControlSettings-CkiYR4lR.js`).then(e=>({default:e.SourceControlSettingsPanel})),[])),Ce=(0,N.lazy)(()=>n(()=>import(`./ConnectionsSettings-CXabxSaH.js`).then(e=>({default:e.ConnectionsSettings})),[])),V=(0,N.lazy)(()=>n(()=>import(`./NodeSecuritySettings-FWM_SeDi.js`).then(e=>({default:e.NodeSecuritySettings})),[])),H=(0,N.lazy)(()=>n(()=>import(`./DiagnosticsSettings-CZ3vY43G.js`).then(e=>({default:e.DiagnosticsSettings})),[])),U=(0,N.lazy)(()=>n(()=>import(`./StatisticsSettingsLink-Cx43bOeo.js`).then(e=>({default:e.StatisticsSettingsLink})),[]));function we(e){let t=(0,P.c)(6),{onRestored:n}=e,{changedSettingLabels:r,restoreDefaults:i}=S(n),a=r.length===0,o;t[0]===i?o=t[1]:(o=()=>void i(),t[0]=i,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,F.jsx)(re,{className:`size-3.5`}),t[2]=s):s=t[2];let c;return t[3]!==a||t[4]!==o?(c=(0,F.jsxs)(M,{size:`xs`,variant:`outline`,disabled:a,onClick:o,children:[s,`Restore defaults`]}),t[3]=a,t[4]=o,t[5]=c):c=t[5],c}function Te(e){let t=(0,P.c)(45),{section:n,searchTargetId:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,F.jsx)(`div`,{className:`flex min-h-80 items-center justify-center text-muted-foreground text-sm`,children:`Loading settings...`}),t[0]=i):i=t[0];let a;t[1]===n?a=t[2]:(a=n===`account`?(0,F.jsx)(I,{}):null,t[1]=n,t[2]=a);let o;t[3]!==r||t[4]!==n?(o=n===`general`?(0,F.jsx)(x,{searchTargetId:r}):null,t[3]=r,t[4]=n,t[5]=o):o=t[5];let s;t[6]===n?s=t[7]:(s=n===`inbox`?(0,F.jsx)(L,{}):null,t[6]=n,t[7]=s);let c;t[8]===n?c=t[9]:(c=n===`providers`?(0,F.jsx)(be,{}):null,t[8]=n,t[9]=c);let l;t[10]===n?l=t[11]:(l=n===`opinionated-plugins`?(0,F.jsx)(R,{}):null,t[10]=n,t[11]=l);let u;t[12]===n?u=t[13]:(u=n===`mcp-servers`?(0,F.jsx)(xe,{}):null,t[12]=n,t[13]=u);let d;t[14]===n?d=t[15]:(d=n===`appearance`?(0,F.jsx)(Se,{}):null,t[14]=n,t[15]=d);let f;t[16]===n?f=t[17]:(f=n===`keybindings`?(0,F.jsx)(z,{}):null,t[16]=n,t[17]=f);let p;t[18]===n?p=t[19]:(p=n===`source-control`?(0,F.jsx)(B,{}):null,t[18]=n,t[19]=p);let m;t[20]===n?m=t[21]:(m=n===`connections`?(0,F.jsx)(Ce,{}):null,t[20]=n,t[21]=m);let h;t[22]===n?h=t[23]:(h=n===`security`?(0,F.jsx)(V,{}):null,t[22]=n,t[23]=h);let g;t[24]===n?g=t[25]:(g=n===`diagnostics`?(0,F.jsx)(H,{}):null,t[24]=n,t[25]=g);let _;t[26]===n?_=t[27]:(_=n===`statistics`?(0,F.jsx)(U,{}):null,t[26]=n,t[27]=_);let v;t[28]===n?v=t[29]:(v=n===`archived`?(0,F.jsx)(C,{}):null,t[28]=n,t[29]=v);let y;return t[30]!==p||t[31]!==m||t[32]!==h||t[33]!==g||t[34]!==_||t[35]!==v||t[36]!==a||t[37]!==o||t[38]!==s||t[39]!==c||t[40]!==l||t[41]!==u||t[42]!==d||t[43]!==f?(y=(0,F.jsxs)(N.Suspense,{fallback:i,children:[a,o,s,c,l,u,d,f,p,m,h,g,_,v]}),t[30]=p,t[31]=m,t[32]=h,t[33]=g,t[34]=_,t[35]=v,t[36]=a,t[37]=o,t[38]=s,t[39]=c,t[40]=l,t[41]=u,t[42]=d,t[43]=f,t[44]=y):y=t[44],y}function Ee(){let e=(0,P.c)(19),t=_(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={strict:!1,select:Re},e[0]=n):n=e[0];let r=h(n),m=p(),g=l(),ee=s(Le),te=y(),b=v(Ie),x=v(Fe),ne=v(Pe),S=v(Ne),C=v(Me),w=u({requestedEnvironmentId:ne,routedEnvironmentId:r,activeEnvironmentId:ee,primaryEnvironmentId:m?.environmentId??null}),re=f(e=>w?e.byId[w]??null:null),T=d(e=>w?e.byId[w]??null:null),E=w!==null&&w===m?.environmentId,D=w?te.machines.find(e=>e.environmentId===w)??null:null,O=E?g:T?.serverConfig??null,ae=E?m?.label??O?.environment.label??`Current node`:T?.descriptor?.label??O?.environment.label??re?.label??D?.label??`Selected node`,k=w?{environmentId:w,nodeLabel:ae,serverConfig:O,primary:E,connected:E?O!==null:T?.connectionState===`connected`||D?.connectionState===`connected`}:null,oe=c(je),A=c(Ae),j=c(ke),M=i(),I=ge(A,j),be=pe(oe,A,j),L=ve.filter(e=>me(e.id,{hosted:M,role:be})),R=L.some(e=>e.id===x)?x:L[0]?.id??`appearance`,xe=he(R),Se=fe(xe,{nativeClient:a,nodeLabel:k?.nodeLabel??null});(0,N.useEffect)(()=>{M&&!I||b&&x!==R&&C(R)},[R,M,b,I,x,C]);let[z,B]=(0,N.useState)(``),[Ce,V]=(0,N.useState)(null),H,U;e[1]===b?(H=e[2],U=e[3]):(H=()=>{b||(B(``),V(null))},U=[b],e[1]=b,e[2]=H,e[3]=U),(0,N.useEffect)(H,U);let Ee=new Set(L.map(Oe)),W=z.trim().toLowerCase(),ze=W.length===0?[]:_e.filter(e=>Ee.has(e.section)&&`${e.title} ${e.description} ${e.keywords??``}`.toLowerCase().includes(W)),[Be,Ve]=(0,N.useState)(0),G;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(G=()=>{Ve(De)},e[4]=G):G=e[4];let He=G,Ue=ye.has(R),We=Math.max(0,L.findIndex(e=>e.id===R)),K;e[5]===S?K=e[6]:(K=e=>{e||S()},e[5]=S,e[6]=K);let q;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,F.jsx)(le,{className:`text-base font-semibold`,children:`Settings`}),e[7]=q):q=e[7];let J;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,F.jsx)(ie,{"aria-hidden":!0,className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-muted-foreground/60`}),e[8]=J):J=e[8];let Y;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(Y=e=>{V(null),B(e.target.value)},e[9]=Y):Y=e[9];let X;e[10]===z?X=e[11]:(X=(0,F.jsxs)(`div`,{className:`relative w-72 max-w-[40vw]`,children:[J,(0,F.jsx)(`input`,{type:`search`,value:z,onChange:Y,placeholder:`Search settings…`,"aria-label":`Search settings`,className:`h-8 w-full rounded-md border border-input bg-muted/40 pr-3 pl-8 text-[13px] outline-none transition-colors placeholder:text-muted-foreground/60 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/40`})]}),e[10]=z,e[11]=X);let Ge=Ue?(0,F.jsx)(we,{onRestored:He}):null,Z;e[12]===Ge?Z=e[13]:(Z=(0,F.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 pr-9`,children:Ge}),e[12]=Ge,e[13]=Z);let Ke=`translateY(${We*2.5}rem)`,Q;e[14]===Ke?Q=e[15]:(Q=(0,F.jsx)(`span`,{className:`pointer-events-none absolute top-2 right-2 left-2 z-0 h-9 rounded-md bg-accent transition-transform duration-[240ms] ease-out`,style:{transform:Ke},"aria-hidden":!0}),e[14]=Ke,e[15]=Q);let qe=ce,Je=W.length>0?(0,F.jsx)(`div`,{className:`p-4`,children:(0,F.jsx)(`div`,{className:`flex flex-col gap-0.5 rounded-xl border border-border bg-card p-1.5 shadow-sm/4`,children:ze.length===0?(0,F.jsxs)(`p`,{className:`px-2 py-8 text-center text-sm text-muted-foreground`,children:[`No settings match “`,z.trim(),`”.`]}):ze.map(e=>{let n=L.find(t=>t.id===e.section)?.label;return(0,F.jsxs)(`button`,{type:`button`,onClick:()=>{if(e.section===`statistics`){S(),t({to:`/statistics`});return}V(e.targetId??null),C(e.section),B(``)},className:`flex flex-col gap-0.5 rounded-md px-3 py-2.5 text-left outline-hidden ring-ring transition-colors hover:bg-accent focus-visible:ring-2`,children:[(0,F.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,F.jsx)(`span`,{className:`text-sm font-medium`,children:e.title}),n?(0,F.jsx)(`span`,{className:`text-[11px] text-muted-foreground/70`,children:n}):null]}),(0,F.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.description})]},`${e.section}:${e.title}`)})})}):(0,F.jsx)(`div`,{className:`flex flex-col`,children:(0,F.jsx)(Te,{section:R,searchTargetId:Ce})},Be),$;return e[16]!==qe||e[17]!==Je?($=(0,F.jsx)(qe,{className:`min-h-0 min-w-0 flex-1`,children:Je}),e[16]=qe,e[17]=Je,e[18]=$):$=e[18],(0,F.jsx)(de,{open:b,onOpenChange:K,children:(0,F.jsx)(o,{value:k,children:(0,F.jsxs)(ue,{className:`project-glass-surface h-[min(88dvh,880px)] max-w-[1180px] overflow-hidden p-0`,bottomStickOnMobile:!1,showCloseButton:!0,surface:`glass`,children:[(0,F.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center justify-between border-b border-border px-5`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-4`,children:[(0,F.jsxs)(`div`,{className:`flex shrink-0 items-baseline gap-2`,children:[q,(0,F.jsx)(`span`,{"data-testid":`settings-scope-label`,className:`max-w-48 truncate text-xs text-muted-foreground`,children:Se})]}),X]}),Z]}),(0,F.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-row`,children:[(0,F.jsxs)(`nav`,{className:`relative isolate flex w-12 shrink-0 flex-col gap-1 border-r border-border p-2 sm:w-48`,children:[Q,L.map(e=>{let t=e.icon,n=R===e.id;return(0,F.jsxs)(`button`,{type:`button`,onClick:()=>{V(null),C(e.id)},className:se(`relative z-10 flex h-9 items-center gap-2.5 rounded-md px-2 text-left text-[13px] outline-hidden ring-ring transition-colors duration-150 focus-visible:ring-2`,n?`font-medium text-foreground`:`text-muted-foreground/70 hover:text-foreground/80`),"aria-label":e.label,"aria-current":n?`page`:void 0,children:[(0,F.jsx)(t,{className:se(`size-4 shrink-0`,n?`text-foreground`:`text-muted-foreground/60`)}),(0,F.jsx)(`span`,{className:`hidden truncate sm:inline`,children:e.label})]},e.id)})]}),$]})]})})})}function De(e){return e+1}function Oe(e){return e.id}function ke(e){return e.transportStatus}function Ae(e){return e.directoryStatus}function je(e){return e.effectiveRole}function Me(e){return e.setSection}function Ne(e){return e.closeSettings}function Pe(e){return e.targetEnvironmentId}function Fe(e){return e.section}function Ie(e){return e.open}function Le(e){return e.activeEnvironmentId}function Re(e){return g(e)?.environmentId??null}export{Ee as SettingsDialog};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{i as e,t}from"./react-SIfiwpqq.js";import{t as n}from"./compiler-runtime-qmuS0Svy.js";import{_ as r,t as i}from"./env-B4arEvJg.js";import{T as a,V as o,ct as s,vl as c}from"./src-Vf4LVnMX.js";import{Bn as l,Ft as u,Gn as d,Gt as f,Jt as p,Rn as m,Sn as h,Xn as g,xn as _,zn as v}from"./runtime-DKwoXpJv.js";import{It as y}from"./composerDraftStore-CdJJZe42.js";import{i as b,t as x}from"./branding-C8SLy6Af.js";import{f as S}from"./useRenderElement-DchFnsR8.js";import{c as C,l as w,m as T,n as E,o as D,r as O,s as k,t as A}from"./desktopUpdateAtoms-C82GmR67.js";import{t as j}from"./chevron-right-BWYGybX9.js";import{i as M}from"./toast-CcSCAm4B.js";import{t as N}from"./shallow-DWZCFNun.js";import{i as P}from"./timestampFormat-8uPXS812.js";import{i as ee,n as te,t as ne}from"./tooltip-C8sAONBj.js";import{t as F}from"./switch-BTGo9Yip.js";import{t as I}from"./ProjectFavicon-BIMdZxK6.js";import{t as re}from"./button-BAbJxRzt.js";import{t as L}from"./toastHelpers-CSQRKo4F.js";import{t as ie}from"./capabilities-BQuqC7jg.js";import{t as R}from"./useThreadActions-DLxhOMkz.js";import{t as z}from"./usePresentationTier-B_SCFvN7.js";import{a as ae,i as B,o as oe,s as se,t as ce}from"./select-BYbVr-yg.js";import{r as le,t as V}from"./editorPreferences-CTDEj79K.js";import{t as H}from"./RycoLetterMark-Bk0kvGJ_.js";import{t as U}from"./useLongPress-OGlhYKlH.js";import{t as W}from"./useTheme-DiC-5xCb.js";import{a as ue,i as G,o as K,r as de,t as q}from"./empty-DwzqNgCP.js";import{i as fe,n as pe,r as J,t as Y}from"./settingsLayout-D8glO7f1.js";import{i as me}from"./settingsSections.logic-F8RXVmAq.js";import{n as he,t as ge}from"./SettingsPanels.editor-B2x4U4rW.js";import{n as _e,r as ve,t as ye}from"./collapsible-dxy6kc2k.js";import{t as be}from"./draft-input-CkzOk8BY.js";var xe=S(`archive-x`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`m9.5 17 5-5`,key:`nakeu6`}],[`path`,{d:`m9.5 12 5 5`,key:`1hccrj`}]]),Se=S(`blocks`,[[`path`,{d:`M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2`,key:`1ah6g2`}],[`rect`,{x:`14`,y:`2`,width:`8`,height:`8`,rx:`1`,key:`88lufb`}]]),Ce=S(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),we=S(`plug-zap`,[[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m18 3-4 4h6l-4 4`,key:`16psg9`}]]),X=n(),Te=e(t(),1),Z=y(),Ee={locale:`System default`,"12-hour":`12-hour`,"24-hour":`24-hour`},De={0:`Off`,1e4:`10 seconds`,3e4:`30 seconds`,6e4:`1 minute`,3e5:`5 minutes`},Oe=[0,1e4,3e4,6e4,3e5],ke={automatic:`Automatic`,reduced:`Reduced`,manual:`Manual`},Ae=[`automatic`,`reduced`,`manual`];function je(e){if(e===null)return null;let t=Number.parseInt(e,10);return Oe.includes(t)?t:null}function Me(e){return Ae.find(t=>t===e)??null}function Ne(e){let t=(0,X.c)(2),{editor:n}=e,r=ge[n];if(!r)return null;let i;return t[0]===r?i=t[1]:(i=(0,Z.jsx)(r,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}),t[0]=r,t[1]=i),i}function Pe(){let e=(0,X.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{children:`Version`}),(0,Z.jsx)(`code`,{className:`text-[11px] font-medium text-muted-foreground`,children:b})]}),e[0]=t):t=e[0],t}var Fe=`https://github.com/sak0a/ryco`;function Q(e){_().shell.openExternal(e).catch(e=>{M.add(L({type:`error`,title:`Could not open link`,description:e instanceof Error?e.message:`Failed to open external link.`}))})}function Ie(){let e=(0,X.c)(3),t,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(H,{className:`h-14 text-foreground`}),n=(0,Z.jsx)(`h3`,{className:`text-base font-semibold tracking-tight text-foreground`,children:x}),e[0]=t,e[1]=n):(t=e[0],n=e[1]);let r;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-4 pt-6 pb-5 text-center sm:px-5`,children:[t,n,(0,Z.jsx)(`div`,{className:`space-y-0.5 text-[11px] text-muted-foreground`,children:(0,Z.jsx)(`p`,{children:(0,Z.jsx)(`button`,{type:`button`,onClick:Le,className:`underline-offset-2 hover:text-foreground hover:underline`,children:`github.com/sak0a/ryco`})})})]}),e[2]=r):r=e[2],r}function Le(){return Q(Fe)}function Re(e){let t=(0,X.c)(46),{scopeLabel:n}=e,r=E(),[i,a]=(0,Te.useState)(!1),o=typeof window<`u`&&!!window.desktopBridge,s=r?.channel??`latest`,c;t[0]===s?c=t[1]:(c=e=>{let t=window.desktopBridge;!t||typeof t.setUpdateChannel!=`function`||e===s||(a(!0),t.setUpdateChannel(e).then(Ke).catch(Ge).finally(()=>{a(!1)}))},t[0]=s,t[1]=c);let l=c,u;t[2]===r?u=t[3]:(u=()=>{let e=window.desktopBridge;if(!e)return;let t=r?w(r):`none`;if(t===`download`){e.downloadUpdate().then(We).catch(Ue);return}if(t===`install`){if(!window.confirm(k(r??{availableVersion:null,downloadedVersion:null})))return;e.installUpdate().then(He).catch(Ve);return}typeof e.checkForUpdate==`function`&&e.checkForUpdate().then(Be).catch(ze)},t[2]=r,t[3]=u);let d=u,f;t[4]===r?f=t[5]:(f=r?w(r):`none`,t[4]=r,t[5]=f);let p=f,m;t[6]===r?m=t[7]:(m=r?D(r):null,t[6]=r,t[7]=m);let h=m,g;t[8]!==p||t[9]!==r?(g=p===`none`?!O(r):C(r),t[8]=p,t[9]=r,t[10]=g):g=t[10];let _=g,v;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(v={download:`Download`,install:`Install`},t[11]=v):v=t[11];let y=v,b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b={checking:`Checking…`,downloading:`Downloading…`,"up-to-date":`Up to Date`},t[12]=b):b=t[12];let x=b,S=y[p]??x[r?.status??``]??`Check for Updates`,T=p===`download`||p===`install`?`Update available.`:`Current version of the application.`,A;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(Pe,{}),t[13]=A):A=t[13];let j=p===`install`?`default`:`outline`,M;t[14]!==_||t[15]!==S||t[16]!==d||t[17]!==j?(M=(0,Z.jsx)(ee,{render:(0,Z.jsx)(re,{size:`xs`,variant:j,disabled:_,onClick:d,children:S})}),t[14]=_,t[15]=S,t[16]=d,t[17]=j,t[18]=M):M=t[18];let N;t[19]===h?N=t[20]:(N=h?(0,Z.jsx)(te,{children:h}):null,t[19]=h,t[20]=N);let P;t[21]!==M||t[22]!==N?(P=(0,Z.jsxs)(ne,{children:[M,N]}),t[21]=M,t[22]=N,t[23]=P):P=t[23];let F;t[24]!==T||t[25]!==n||t[26]!==P?(F=(0,Z.jsx)(J,{title:A,description:T,scope:n,control:P}),t[24]=T,t[25]=n,t[26]=P,t[27]=F):F=t[27];let I;t[28]===l?I=t[29]:(I=e=>{l(e)},t[28]=l,t[29]=I);let L=!o||i,ie=s===`nightly`?`Nightly`:`Stable`,R;t[30]===ie?R=t[31]:(R=(0,Z.jsx)(se,{children:ie}),t[30]=ie,t[31]=R);let z;t[32]!==L||t[33]!==R?(z=(0,Z.jsx)(oe,{className:`w-full sm:w-40`,"aria-label":`Update track`,disabled:L,children:R}),t[32]=L,t[33]=R,t[34]=z):z=t[34];let le;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsxs)(ae,{align:`end`,alignItemWithTrigger:!1,children:[(0,Z.jsx)(B,{hideIndicator:!0,value:`latest`,children:`Stable`}),(0,Z.jsx)(B,{hideIndicator:!0,value:`nightly`,children:`Nightly`})]}),t[35]=le):le=t[35];let V;t[36]!==s||t[37]!==I||t[38]!==z?(V=(0,Z.jsxs)(ce,{value:s,onValueChange:I,children:[z,le]}),t[36]=s,t[37]=I,t[38]=z,t[39]=V):V=t[39];let H;t[40]!==n||t[41]!==V?(H=(0,Z.jsx)(J,{title:`Update track`,description:`Stable follows full releases. Nightly follows the nightly desktop channel and can switch back to stable immediately.`,scope:n,control:V}),t[40]=n,t[41]=V,t[42]=H):H=t[42];let U;return t[43]!==F||t[44]!==H?(U=(0,Z.jsxs)(Z.Fragment,{children:[F,H]}),t[43]=F,t[44]=H,t[45]=U):U=t[45],U}function ze(e){M.add(L({type:`error`,title:`Could not check for updates`,description:e instanceof Error?e.message:`Update check failed.`}))}function Be(e){A(e.state),e.checked||M.add(L({type:`error`,title:`Could not check for updates`,description:e.state.message??`Automatic updates are not available in this build.`}))}function Ve(e){M.add(L({type:`error`,title:`Could not install update`,description:e instanceof Error?e.message:`Install failed.`}))}function He(e){A(e.state)}function Ue(e){M.add(L({type:`error`,title:`Could not download update`,description:e instanceof Error?e.message:`Download failed.`}))}function We(e){A(e.state)}function Ge(e){M.add(L({type:`error`,title:`Could not change update track`,description:e instanceof Error?e.message:`Update track change failed.`}))}function Ke(e){A(e)}function qe(e){let t=(0,X.c)(53),{theme:n,setTheme:r}=W(),i=m(),{updateSettings:o}=v(),s;t[0]===i.textGenerationModelSelection?s=t[1]:(s=c(i.textGenerationModelSelection??null,a.textGenerationModelSelection??null),t[0]=i.textGenerationModelSelection,t[1]=s);let l=!s,u;t[2]===n?u=t[3]:(u=n===`system`?[]:[`Theme`],t[2]=n,t[3]=u);let d;t[4]===i.timestampFormat?d=t[5]:(d=i.timestampFormat===a.timestampFormat?[]:[`Time format`],t[4]=i.timestampFormat,t[5]=d);let f;t[6]===i.diffWordWrap?f=t[7]:(f=i.diffWordWrap===a.diffWordWrap?[]:[`Diff line wrapping`],t[6]=i.diffWordWrap,t[7]=f);let p;t[8]===i.diffIgnoreWhitespace?p=t[9]:(p=i.diffIgnoreWhitespace===a.diffIgnoreWhitespace?[]:[`Diff whitespace changes`],t[8]=i.diffIgnoreWhitespace,t[9]=p);let g;t[10]===i.gitStatusPollIntervalMs?g=t[11]:(g=i.gitStatusPollIntervalMs===a.gitStatusPollIntervalMs?[]:[`Remote Git status`],t[10]=i.gitStatusPollIntervalMs,t[11]=g);let y;t[12]===i.sourceControlRefreshMode?y=t[13]:(y=i.sourceControlRefreshMode===a.sourceControlRefreshMode?[]:[`PR & workflow updates`],t[12]=i.sourceControlRefreshMode,t[13]=y);let b;t[14]===i.autoOpenPlanSidebar?b=t[15]:(b=i.autoOpenPlanSidebar===a.autoOpenPlanSidebar?[]:[`Auto-open overview`],t[14]=i.autoOpenPlanSidebar,t[15]=b);let x;t[16]===i.enableLegacyTokenStreaming?x=t[17]:(x=i.enableLegacyTokenStreaming===a.enableLegacyTokenStreaming?[]:[`Stream token by token`],t[16]=i.enableLegacyTokenStreaming,t[17]=x);let S;t[18]===i.enableProviderUpdateChecks?S=t[19]:(S=i.enableProviderUpdateChecks===a.enableProviderUpdateChecks?[]:[`Provider update checks`],t[18]=i.enableProviderUpdateChecks,t[19]=S);let C;t[20]===i.defaultThreadEnvMode?C=t[21]:(C=i.defaultThreadEnvMode===a.defaultThreadEnvMode?[]:[`New thread mode`],t[20]=i.defaultThreadEnvMode,t[21]=C);let w;t[22]===i.addProjectBaseDirectory?w=t[23]:(w=i.addProjectBaseDirectory===a.addProjectBaseDirectory?[]:[`Add project base directory`],t[22]=i.addProjectBaseDirectory,t[23]=w);let T;t[24]===i.confirmThreadArchive?T=t[25]:(T=i.confirmThreadArchive===a.confirmThreadArchive?[]:[`Archive confirmation`],t[24]=i.confirmThreadArchive,t[25]=T);let E;t[26]===i.confirmThreadDelete?E=t[27]:(E=i.confirmThreadDelete===a.confirmThreadDelete?[]:[`Delete confirmation`],t[26]=i.confirmThreadDelete,t[27]=E);let D;t[28]===l?D=t[29]:(D=l?[`Git writing model`]:[],t[28]=l,t[29]=D);let O;t[30]!==u||t[31]!==C||t[32]!==w||t[33]!==T||t[34]!==E||t[35]!==D||t[36]!==d||t[37]!==f||t[38]!==p||t[39]!==g||t[40]!==y||t[41]!==b||t[42]!==x||t[43]!==S?(O=[...u,...d,...f,...p,...g,...y,...b,...x,...S,...C,...w,...T,...E,...D],t[30]=u,t[31]=C,t[32]=w,t[33]=T,t[34]=E,t[35]=D,t[36]=d,t[37]=f,t[38]=p,t[39]=g,t[40]=y,t[41]=b,t[42]=x,t[43]=S,t[44]=O):O=t[44];let k=O,A;t[45]!==k||t[46]!==e||t[47]!==r||t[48]!==o?(A=async()=>{k.length!==0&&await(h()??_()).dialogs.confirm([`Restore default settings?`,`This will reset: ${k.join(`, `)}.`].join(`
|
|
1
|
+
import{i as e,t}from"./react-SIfiwpqq.js";import{t as n}from"./compiler-runtime-qmuS0Svy.js";import{_ as r,t as i}from"./env-B4arEvJg.js";import{T as a,V as o,ct as s,vl as c}from"./src-Vf4LVnMX.js";import{Bn as l,Ft as u,Gn as d,Gt as f,Jt as p,Rn as m,Sn as h,Xn as g,xn as _,zn as v}from"./runtime-CXut_g4p.js";import{It as y}from"./composerDraftStore-CdJJZe42.js";import{i as b,t as x}from"./branding-BDfN6Spd.js";import{f as S}from"./useRenderElement-DchFnsR8.js";import{c as C,l as w,m as T,n as E,o as D,r as O,s as k,t as A}from"./desktopUpdateAtoms-CyfPW2jg.js";import{t as j}from"./chevron-right-BWYGybX9.js";import{i as M}from"./toast-CcSCAm4B.js";import{t as N}from"./shallow-DWZCFNun.js";import{i as P}from"./timestampFormat-8uPXS812.js";import{i as ee,n as te,t as ne}from"./tooltip-C8sAONBj.js";import{t as F}from"./switch-BTGo9Yip.js";import{t as I}from"./ProjectFavicon-qZGdjYCM.js";import{t as re}from"./button-BAbJxRzt.js";import{t as L}from"./toastHelpers-CSQRKo4F.js";import{t as ie}from"./capabilities-3zgirmmI.js";import{t as R}from"./useThreadActions-fN-Al13y.js";import{t as z}from"./usePresentationTier-B_SCFvN7.js";import{a as ae,i as B,o as oe,s as se,t as ce}from"./select-BYbVr-yg.js";import{r as le,t as V}from"./editorPreferences-DHIJntKF.js";import{t as H}from"./RycoLetterMark-Bk0kvGJ_.js";import{t as U}from"./useLongPress-OGlhYKlH.js";import{t as W}from"./useTheme-DiC-5xCb.js";import{a as ue,i as G,o as K,r as de,t as q}from"./empty-DwzqNgCP.js";import{i as fe,n as pe,r as J,t as Y}from"./settingsLayout-D8glO7f1.js";import{i as me}from"./settingsSections.logic-F8RXVmAq.js";import{n as he,t as ge}from"./SettingsPanels.editor-B2x4U4rW.js";import{n as _e,r as ve,t as ye}from"./collapsible-dxy6kc2k.js";import{t as be}from"./draft-input-CkzOk8BY.js";var xe=S(`archive-x`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`m9.5 17 5-5`,key:`nakeu6`}],[`path`,{d:`m9.5 12 5 5`,key:`1hccrj`}]]),Se=S(`blocks`,[[`path`,{d:`M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2`,key:`1ah6g2`}],[`rect`,{x:`14`,y:`2`,width:`8`,height:`8`,rx:`1`,key:`88lufb`}]]),Ce=S(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),we=S(`plug-zap`,[[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m18 3-4 4h6l-4 4`,key:`16psg9`}]]),X=n(),Te=e(t(),1),Z=y(),Ee={locale:`System default`,"12-hour":`12-hour`,"24-hour":`24-hour`},De={0:`Off`,1e4:`10 seconds`,3e4:`30 seconds`,6e4:`1 minute`,3e5:`5 minutes`},Oe=[0,1e4,3e4,6e4,3e5],ke={automatic:`Automatic`,reduced:`Reduced`,manual:`Manual`},Ae=[`automatic`,`reduced`,`manual`];function je(e){if(e===null)return null;let t=Number.parseInt(e,10);return Oe.includes(t)?t:null}function Me(e){return Ae.find(t=>t===e)??null}function Ne(e){let t=(0,X.c)(2),{editor:n}=e,r=ge[n];if(!r)return null;let i;return t[0]===r?i=t[1]:(i=(0,Z.jsx)(r,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}),t[0]=r,t[1]=i),i}function Pe(){let e=(0,X.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{children:`Version`}),(0,Z.jsx)(`code`,{className:`text-[11px] font-medium text-muted-foreground`,children:b})]}),e[0]=t):t=e[0],t}var Fe=`https://github.com/sak0a/ryco`;function Q(e){_().shell.openExternal(e).catch(e=>{M.add(L({type:`error`,title:`Could not open link`,description:e instanceof Error?e.message:`Failed to open external link.`}))})}function Ie(){let e=(0,X.c)(3),t,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(H,{className:`h-14 text-foreground`}),n=(0,Z.jsx)(`h3`,{className:`text-base font-semibold tracking-tight text-foreground`,children:x}),e[0]=t,e[1]=n):(t=e[0],n=e[1]);let r;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-4 pt-6 pb-5 text-center sm:px-5`,children:[t,n,(0,Z.jsx)(`div`,{className:`space-y-0.5 text-[11px] text-muted-foreground`,children:(0,Z.jsx)(`p`,{children:(0,Z.jsx)(`button`,{type:`button`,onClick:Le,className:`underline-offset-2 hover:text-foreground hover:underline`,children:`github.com/sak0a/ryco`})})})]}),e[2]=r):r=e[2],r}function Le(){return Q(Fe)}function Re(e){let t=(0,X.c)(46),{scopeLabel:n}=e,r=E(),[i,a]=(0,Te.useState)(!1),o=typeof window<`u`&&!!window.desktopBridge,s=r?.channel??`latest`,c;t[0]===s?c=t[1]:(c=e=>{let t=window.desktopBridge;!t||typeof t.setUpdateChannel!=`function`||e===s||(a(!0),t.setUpdateChannel(e).then(Ke).catch(Ge).finally(()=>{a(!1)}))},t[0]=s,t[1]=c);let l=c,u;t[2]===r?u=t[3]:(u=()=>{let e=window.desktopBridge;if(!e)return;let t=r?w(r):`none`;if(t===`download`){e.downloadUpdate().then(We).catch(Ue);return}if(t===`install`){if(!window.confirm(k(r??{availableVersion:null,downloadedVersion:null})))return;e.installUpdate().then(He).catch(Ve);return}typeof e.checkForUpdate==`function`&&e.checkForUpdate().then(Be).catch(ze)},t[2]=r,t[3]=u);let d=u,f;t[4]===r?f=t[5]:(f=r?w(r):`none`,t[4]=r,t[5]=f);let p=f,m;t[6]===r?m=t[7]:(m=r?D(r):null,t[6]=r,t[7]=m);let h=m,g;t[8]!==p||t[9]!==r?(g=p===`none`?!O(r):C(r),t[8]=p,t[9]=r,t[10]=g):g=t[10];let _=g,v;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(v={download:`Download`,install:`Install`},t[11]=v):v=t[11];let y=v,b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b={checking:`Checking…`,downloading:`Downloading…`,"up-to-date":`Up to Date`},t[12]=b):b=t[12];let x=b,S=y[p]??x[r?.status??``]??`Check for Updates`,T=p===`download`||p===`install`?`Update available.`:`Current version of the application.`,A;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(Pe,{}),t[13]=A):A=t[13];let j=p===`install`?`default`:`outline`,M;t[14]!==_||t[15]!==S||t[16]!==d||t[17]!==j?(M=(0,Z.jsx)(ee,{render:(0,Z.jsx)(re,{size:`xs`,variant:j,disabled:_,onClick:d,children:S})}),t[14]=_,t[15]=S,t[16]=d,t[17]=j,t[18]=M):M=t[18];let N;t[19]===h?N=t[20]:(N=h?(0,Z.jsx)(te,{children:h}):null,t[19]=h,t[20]=N);let P;t[21]!==M||t[22]!==N?(P=(0,Z.jsxs)(ne,{children:[M,N]}),t[21]=M,t[22]=N,t[23]=P):P=t[23];let F;t[24]!==T||t[25]!==n||t[26]!==P?(F=(0,Z.jsx)(J,{title:A,description:T,scope:n,control:P}),t[24]=T,t[25]=n,t[26]=P,t[27]=F):F=t[27];let I;t[28]===l?I=t[29]:(I=e=>{l(e)},t[28]=l,t[29]=I);let L=!o||i,ie=s===`nightly`?`Nightly`:`Stable`,R;t[30]===ie?R=t[31]:(R=(0,Z.jsx)(se,{children:ie}),t[30]=ie,t[31]=R);let z;t[32]!==L||t[33]!==R?(z=(0,Z.jsx)(oe,{className:`w-full sm:w-40`,"aria-label":`Update track`,disabled:L,children:R}),t[32]=L,t[33]=R,t[34]=z):z=t[34];let le;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsxs)(ae,{align:`end`,alignItemWithTrigger:!1,children:[(0,Z.jsx)(B,{hideIndicator:!0,value:`latest`,children:`Stable`}),(0,Z.jsx)(B,{hideIndicator:!0,value:`nightly`,children:`Nightly`})]}),t[35]=le):le=t[35];let V;t[36]!==s||t[37]!==I||t[38]!==z?(V=(0,Z.jsxs)(ce,{value:s,onValueChange:I,children:[z,le]}),t[36]=s,t[37]=I,t[38]=z,t[39]=V):V=t[39];let H;t[40]!==n||t[41]!==V?(H=(0,Z.jsx)(J,{title:`Update track`,description:`Stable follows full releases. Nightly follows the nightly desktop channel and can switch back to stable immediately.`,scope:n,control:V}),t[40]=n,t[41]=V,t[42]=H):H=t[42];let U;return t[43]!==F||t[44]!==H?(U=(0,Z.jsxs)(Z.Fragment,{children:[F,H]}),t[43]=F,t[44]=H,t[45]=U):U=t[45],U}function ze(e){M.add(L({type:`error`,title:`Could not check for updates`,description:e instanceof Error?e.message:`Update check failed.`}))}function Be(e){A(e.state),e.checked||M.add(L({type:`error`,title:`Could not check for updates`,description:e.state.message??`Automatic updates are not available in this build.`}))}function Ve(e){M.add(L({type:`error`,title:`Could not install update`,description:e instanceof Error?e.message:`Install failed.`}))}function He(e){A(e.state)}function Ue(e){M.add(L({type:`error`,title:`Could not download update`,description:e instanceof Error?e.message:`Download failed.`}))}function We(e){A(e.state)}function Ge(e){M.add(L({type:`error`,title:`Could not change update track`,description:e instanceof Error?e.message:`Update track change failed.`}))}function Ke(e){A(e)}function qe(e){let t=(0,X.c)(53),{theme:n,setTheme:r}=W(),i=m(),{updateSettings:o}=v(),s;t[0]===i.textGenerationModelSelection?s=t[1]:(s=c(i.textGenerationModelSelection??null,a.textGenerationModelSelection??null),t[0]=i.textGenerationModelSelection,t[1]=s);let l=!s,u;t[2]===n?u=t[3]:(u=n===`system`?[]:[`Theme`],t[2]=n,t[3]=u);let d;t[4]===i.timestampFormat?d=t[5]:(d=i.timestampFormat===a.timestampFormat?[]:[`Time format`],t[4]=i.timestampFormat,t[5]=d);let f;t[6]===i.diffWordWrap?f=t[7]:(f=i.diffWordWrap===a.diffWordWrap?[]:[`Diff line wrapping`],t[6]=i.diffWordWrap,t[7]=f);let p;t[8]===i.diffIgnoreWhitespace?p=t[9]:(p=i.diffIgnoreWhitespace===a.diffIgnoreWhitespace?[]:[`Diff whitespace changes`],t[8]=i.diffIgnoreWhitespace,t[9]=p);let g;t[10]===i.gitStatusPollIntervalMs?g=t[11]:(g=i.gitStatusPollIntervalMs===a.gitStatusPollIntervalMs?[]:[`Remote Git status`],t[10]=i.gitStatusPollIntervalMs,t[11]=g);let y;t[12]===i.sourceControlRefreshMode?y=t[13]:(y=i.sourceControlRefreshMode===a.sourceControlRefreshMode?[]:[`PR & workflow updates`],t[12]=i.sourceControlRefreshMode,t[13]=y);let b;t[14]===i.autoOpenPlanSidebar?b=t[15]:(b=i.autoOpenPlanSidebar===a.autoOpenPlanSidebar?[]:[`Auto-open overview`],t[14]=i.autoOpenPlanSidebar,t[15]=b);let x;t[16]===i.enableLegacyTokenStreaming?x=t[17]:(x=i.enableLegacyTokenStreaming===a.enableLegacyTokenStreaming?[]:[`Stream token by token`],t[16]=i.enableLegacyTokenStreaming,t[17]=x);let S;t[18]===i.enableProviderUpdateChecks?S=t[19]:(S=i.enableProviderUpdateChecks===a.enableProviderUpdateChecks?[]:[`Provider update checks`],t[18]=i.enableProviderUpdateChecks,t[19]=S);let C;t[20]===i.defaultThreadEnvMode?C=t[21]:(C=i.defaultThreadEnvMode===a.defaultThreadEnvMode?[]:[`New thread mode`],t[20]=i.defaultThreadEnvMode,t[21]=C);let w;t[22]===i.addProjectBaseDirectory?w=t[23]:(w=i.addProjectBaseDirectory===a.addProjectBaseDirectory?[]:[`Add project base directory`],t[22]=i.addProjectBaseDirectory,t[23]=w);let T;t[24]===i.confirmThreadArchive?T=t[25]:(T=i.confirmThreadArchive===a.confirmThreadArchive?[]:[`Archive confirmation`],t[24]=i.confirmThreadArchive,t[25]=T);let E;t[26]===i.confirmThreadDelete?E=t[27]:(E=i.confirmThreadDelete===a.confirmThreadDelete?[]:[`Delete confirmation`],t[26]=i.confirmThreadDelete,t[27]=E);let D;t[28]===l?D=t[29]:(D=l?[`Git writing model`]:[],t[28]=l,t[29]=D);let O;t[30]!==u||t[31]!==C||t[32]!==w||t[33]!==T||t[34]!==E||t[35]!==D||t[36]!==d||t[37]!==f||t[38]!==p||t[39]!==g||t[40]!==y||t[41]!==b||t[42]!==x||t[43]!==S?(O=[...u,...d,...f,...p,...g,...y,...b,...x,...S,...C,...w,...T,...E,...D],t[30]=u,t[31]=C,t[32]=w,t[33]=T,t[34]=E,t[35]=D,t[36]=d,t[37]=f,t[38]=p,t[39]=g,t[40]=y,t[41]=b,t[42]=x,t[43]=S,t[44]=O):O=t[44];let k=O,A;t[45]!==k||t[46]!==e||t[47]!==r||t[48]!==o?(A=async()=>{k.length!==0&&await(h()??_()).dialogs.confirm([`Restore default settings?`,`This will reset: ${k.join(`, `)}.`].join(`
|
|
2
2
|
`))&&(r(`system`),o({timestampFormat:a.timestampFormat,diffWordWrap:a.diffWordWrap,diffIgnoreWhitespace:a.diffIgnoreWhitespace,gitStatusPollIntervalMs:a.gitStatusPollIntervalMs,sourceControlRefreshMode:a.sourceControlRefreshMode,autoOpenPlanSidebar:a.autoOpenPlanSidebar,enableLegacyTokenStreaming:a.enableLegacyTokenStreaming,enableProviderUpdateChecks:a.enableProviderUpdateChecks,defaultThreadEnvMode:a.defaultThreadEnvMode,addProjectBaseDirectory:a.addProjectBaseDirectory,confirmThreadArchive:a.confirmThreadArchive,confirmThreadDelete:a.confirmThreadDelete,textGenerationModelSelection:a.textGenerationModelSelection}),e?.())},t[45]=k,t[46]=e,t[47]=r,t[48]=o,t[49]=A):A=t[49];let j=A,M;return t[50]!==k||t[51]!==j?(M={changedSettingLabels:k,restoreDefaults:j},t[50]=k,t[51]=j,t[52]=M):M=t[52],M}function Je(e){let t=(0,X.c)(19),{searchTargetId:n,nodeScopeLabel:r}=e,i=m(),{updateSettings:o}=v(),s=n===`legacy-token-streaming`,[c,l]=(0,Te.useState)(s),u=(0,Te.useRef)(null),d,f;t[0]===s?(d=t[1],f=t[2]):(d=()=>{if(!s)return;l(!0);let e=requestAnimationFrame(()=>{u.current?.scrollIntoView({block:`center`}),u.current?.querySelector(`[role=switch]`)?.focus()});return()=>cancelAnimationFrame(e)},f=[s],t[0]=s,t[1]=d,t[2]=f),(0,Te.useEffect)(d,f);let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsxs)(ve,{className:`group flex w-full items-center justify-between rounded-lg px-1 py-1 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`inline-block h-px w-3 bg-border`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-[0.08em] text-foreground/50 transition-colors group-hover:text-foreground/70`,children:`Legacy features`}),(0,Z.jsx)(`span`,{className:`hidden text-[11px] text-muted-foreground/55 sm:inline`,children:`Compatibility controls`})]}),(0,Z.jsx)(j,{"aria-hidden":!0,className:`size-3.5 text-muted-foreground/60 transition-transform duration-200 group-data-panel-open:rotate-90`})]}),t[3]=p):p=t[3];let g;t[4]!==i.enableLegacyTokenStreaming||t[5]!==o?(g=i.enableLegacyTokenStreaming===a.enableLegacyTokenStreaming?null:(0,Z.jsx)(Y,{label:`legacy token streaming`,onClick:()=>o({enableLegacyTokenStreaming:a.enableLegacyTokenStreaming})}),t[4]=i.enableLegacyTokenStreaming,t[5]=o,t[6]=g):g=t[6];let y;t[7]===o?y=t[8]:(y=e=>{if(!e){o({enableLegacyTokenStreaming:!1});return}(async()=>{await(h()??_()).dialogs.confirm([`Turn on token-by-token output?`,`It is significantly slower than buffered output and makes long responses harder to follow. This switch exists only for backwards compatibility.`].join(`
|
|
3
3
|
`))&&o({enableLegacyTokenStreaming:!0})})()},t[7]=o,t[8]=y);let b;t[9]!==i.enableLegacyTokenStreaming||t[10]!==y?(b=(0,Z.jsx)(F,{checked:i.enableLegacyTokenStreaming,onCheckedChange:y,"aria-label":`Stream token by token (legacy)`}),t[9]=i.enableLegacyTokenStreaming,t[10]=y,t[11]=b):b=t[11];let x;t[12]!==r||t[13]!==g||t[14]!==b?(x=(0,Z.jsx)(_e,{children:(0,Z.jsx)(`div`,{className:`pt-2`,children:(0,Z.jsx)(`div`,{className:`relative overflow-hidden rounded-2xl border border-border/80 bg-card text-card-foreground shadow-sm/4 dark:shadow-none`,children:(0,Z.jsx)(`div`,{ref:u,id:`legacy-token-streaming`,children:(0,Z.jsx)(J,{title:`Stream token by token (legacy)`,description:`Paint assistant output token by token instead of in complete chunks. This legacy mode is significantly slower and makes long responses harder to follow.`,scope:r,resetAction:g,control:b})})})})}),t[12]=r,t[13]=g,t[14]=b,t[15]=x):x=t[15];let S;return t[16]!==c||t[17]!==x?(S=(0,Z.jsx)(`section`,{className:`space-y-2.5`,children:(0,Z.jsxs)(ye,{open:c,onOpenChange:l,children:[p,x]})}),t[16]=c,t[17]=x,t[18]=S):S=t[18],S}function Ye(e){let t=(0,X.c)(241),{searchTargetId:n}=e,r=n===void 0?null:n,o=m(),{updateSettings:c}=v(),u=z()===`phone`,f=g(),p=f?.nodeLabel??null,h,y,b;if(t[0]!==p){let e={nativeClient:i,nodeLabel:p};y=me(`browser`,e),h=me(`device`,e),b=me(`node`,e),t[0]=p,t[1]=h,t[2]=y,t[3]=b}else h=t[1],y=t[2],b=t[3];let x=b,S;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(S={logsDirectory:!1},t[4]=S):S=t[4];let[C,w]=(0,Te.useState)(S),T;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(T={},t[5]=T):T=t[5];let[E,D]=(0,Te.useState)(T),O=l(),k=d(),A=k?.logsDirectoryPath??null,j=!f||f.primary,M;t[6]===k?M=t[7]:(M=[],k?.otlpTracesEnabled&&k.otlpTracesUrl&&M.push(`traces to ${k.otlpTracesUrl}`),k?.otlpMetricsEnabled&&k.otlpMetricsUrl&&M.push(`metrics to ${k.otlpMetricsUrl}`),t[6]=k,t[7]=M);let N=k?.localTracingEnabled?`Local trace file`:`Terminal logs only`,P=M.length>0?`${N}. OTLP exporting ${M.join(` and `)}.`:`${N}.`,ee;t[8]===O?ee=t[9]:(ee=(e,t,n)=>{if(!t)return;D(t=>({...t,[e]:null})),w(t=>({...t,[e]:!0}));let r=le(O??[]);if(!r){D(t=>({...t,[e]:`No available editors found.`})),w(t=>({...t,[e]:!1}));return}_().shell.openInEditor(t,r).catch(t=>{D(r=>({...r,[e]:t instanceof Error?t.message:n}))}).finally(()=>{w(t=>({...t,[e]:!1}))})},t[8]=O,t[9]=ee);let te=ee,ne;t[10]!==A||t[11]!==te?(ne=()=>{te(`logsDirectory`,A,`Unable to open logs folder.`)},t[10]=A,t[11]=te,t[12]=ne):ne=t[12];let I=ne,L=E.logsDirectory??null,ie=C.logsDirectory,R;t[13]!==o.timestampFormat||t[14]!==c?(R=o.timestampFormat===a.timestampFormat?null:(0,Z.jsx)(Y,{label:`time format`,onClick:()=>c({timestampFormat:a.timestampFormat})}),t[13]=o.timestampFormat,t[14]=c,t[15]=R):R=t[15];let H;t[16]===c?H=t[17]:(H=e=>{(e===`locale`||e===`12-hour`||e===`24-hour`)&&c({timestampFormat:e})},t[16]=c,t[17]=H);let U=Ee[o.timestampFormat],W;t[18]===U?W=t[19]:(W=(0,Z.jsx)(oe,{className:`w-full sm:w-40`,"aria-label":`Timestamp format`,children:(0,Z.jsx)(se,{children:U})}),t[18]=U,t[19]=W);let ue;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,Z.jsxs)(ae,{align:`end`,alignItemWithTrigger:!1,children:[(0,Z.jsx)(B,{hideIndicator:!0,value:`locale`,children:Ee.locale}),(0,Z.jsx)(B,{hideIndicator:!0,value:`12-hour`,children:Ee[`12-hour`]}),(0,Z.jsx)(B,{hideIndicator:!0,value:`24-hour`,children:Ee[`24-hour`]})]}),t[20]=ue):ue=t[20];let G;t[21]!==o.timestampFormat||t[22]!==W||t[23]!==H?(G=(0,Z.jsxs)(ce,{value:o.timestampFormat,onValueChange:H,children:[W,ue]}),t[21]=o.timestampFormat,t[22]=W,t[23]=H,t[24]=G):G=t[24];let K;t[25]!==y||t[26]!==G||t[27]!==R?(K=(0,Z.jsx)(J,{title:`Time format`,description:`System default follows your browser or OS clock preference.`,scope:y,resetAction:R,control:G}),t[25]=y,t[26]=G,t[27]=R,t[28]=K):K=t[28];let de=(O??[]).length>0?`Pin which editor opens directories and files. Auto uses your last selection from the Open menu.`:`No installed editors detected. Install a supported IDE to pick a default.`,q;t[29]!==o.preferredEditor||t[30]!==c?(q=o.preferredEditor===a.preferredEditor?null:(0,Z.jsx)(Y,{label:`default editor`,onClick:()=>c({preferredEditor:a.preferredEditor})}),t[29]=o.preferredEditor,t[30]=c,t[31]=q):q=t[31];let ge=o.preferredEditor??`__auto__`,_e;t[32]===c?_e=t[33]:(_e=e=>{if(e===`__auto__`){c({preferredEditor:null});return}let t=s.find(t=>t.id===e);t&&c({preferredEditor:t.id})},t[32]=c,t[33]=_e);let ve;t[34]===o.preferredEditor?ve=t[35]:(ve=o.preferredEditor?(0,Z.jsx)(Ne,{editor:o.preferredEditor}):null,t[34]=o.preferredEditor,t[35]=ve);let ye;t[36]===o.preferredEditor?ye=t[37]:(ye=o.preferredEditor?he(o.preferredEditor,navigator.platform):`Auto (last used)`,t[36]=o.preferredEditor,t[37]=ye);let xe;t[38]===ye?xe=t[39]:(xe=(0,Z.jsx)(se,{children:ye}),t[38]=ye,t[39]=xe);let Se;t[40]!==ve||t[41]!==xe?(Se=(0,Z.jsxs)(oe,{className:`w-full sm:w-56`,"aria-label":`Default editor`,children:[ve,xe]}),t[40]=ve,t[41]=xe,t[42]=Se):Se=t[42];let Ce;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(B,{hideIndicator:!0,value:`__auto__`,children:(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`size-4`}),`Auto (last used)`]})}),t[43]=Ce):Ce=t[43];let we;t[44]===O?we=t[45]:(we=s.filter(e=>(O??[]).includes(e.id)&&V(e.id)).map(Qe),t[44]=O,t[45]=we);let Fe;t[46]===we?Fe=t[47]:(Fe=(0,Z.jsxs)(ae,{align:`end`,alignItemWithTrigger:!1,children:[Ce,we]}),t[46]=we,t[47]=Fe);let Q;t[48]!==ge||t[49]!==_e||t[50]!==Se||t[51]!==Fe?(Q=(0,Z.jsxs)(ce,{value:ge,onValueChange:_e,children:[Se,Fe]}),t[48]=ge,t[49]=_e,t[50]=Se,t[51]=Fe,t[52]=Q):Q=t[52];let Le;t[53]!==y||t[54]!==de||t[55]!==q||t[56]!==Q?(Le=(0,Z.jsx)(J,{title:`Default editor`,description:de,scope:y,resetAction:q,control:Q}),t[53]=y,t[54]=de,t[55]=q,t[56]=Q,t[57]=Le):Le=t[57];let ze;t[58]!==o.diffWordWrap||t[59]!==c?(ze=o.diffWordWrap===a.diffWordWrap?null:(0,Z.jsx)(Y,{label:`diff line wrapping`,onClick:()=>c({diffWordWrap:a.diffWordWrap})}),t[58]=o.diffWordWrap,t[59]=c,t[60]=ze):ze=t[60];let Be;t[61]===c?Be=t[62]:(Be=e=>c({diffWordWrap:!!e}),t[61]=c,t[62]=Be);let Ve;t[63]!==o.diffWordWrap||t[64]!==Be?(Ve=(0,Z.jsx)(F,{checked:o.diffWordWrap,onCheckedChange:Be,"aria-label":`Wrap diff lines by default`}),t[63]=o.diffWordWrap,t[64]=Be,t[65]=Ve):Ve=t[65];let He;t[66]!==y||t[67]!==ze||t[68]!==Ve?(He=(0,Z.jsx)(J,{title:`Diff line wrapping`,description:`Set the default wrap state when the diff panel opens.`,scope:y,resetAction:ze,control:Ve}),t[66]=y,t[67]=ze,t[68]=Ve,t[69]=He):He=t[69];let Ue;t[70]!==o.diffIgnoreWhitespace||t[71]!==c?(Ue=o.diffIgnoreWhitespace===a.diffIgnoreWhitespace?null:(0,Z.jsx)(Y,{label:`diff whitespace changes`,onClick:()=>c({diffIgnoreWhitespace:a.diffIgnoreWhitespace})}),t[70]=o.diffIgnoreWhitespace,t[71]=c,t[72]=Ue):Ue=t[72];let We;t[73]===c?We=t[74]:(We=e=>c({diffIgnoreWhitespace:!!e}),t[73]=c,t[74]=We);let Ge;t[75]!==o.diffIgnoreWhitespace||t[76]!==We?(Ge=(0,Z.jsx)(F,{checked:o.diffIgnoreWhitespace,onCheckedChange:We,"aria-label":`Hide whitespace changes by default`}),t[75]=o.diffIgnoreWhitespace,t[76]=We,t[77]=Ge):Ge=t[77];let Ke;t[78]!==y||t[79]!==Ue||t[80]!==Ge?(Ke=(0,Z.jsx)(J,{title:`Hide whitespace changes`,description:`Set whether the diff panel ignores whitespace-only edits by default.`,scope:y,resetAction:Ue,control:Ge}),t[78]=y,t[79]=Ue,t[80]=Ge,t[81]=Ke):Ke=t[81];let qe;t[82]!==o.gitStatusPollIntervalMs||t[83]!==c?(qe=o.gitStatusPollIntervalMs===a.gitStatusPollIntervalMs?null:(0,Z.jsx)(Y,{label:`git status polling`,onClick:()=>c({gitStatusPollIntervalMs:a.gitStatusPollIntervalMs})}),t[82]=o.gitStatusPollIntervalMs,t[83]=c,t[84]=qe):qe=t[84];let Ye=String(o.gitStatusPollIntervalMs),$e;t[85]===c?$e=t[86]:($e=e=>{let t=je(e);t!==null&&c({gitStatusPollIntervalMs:t})},t[85]=c,t[86]=$e);let et=De[o.gitStatusPollIntervalMs],tt;t[87]===et?tt=t[88]:(tt=(0,Z.jsx)(oe,{className:`w-full sm:w-40`,"aria-label":`Git status polling interval`,children:(0,Z.jsx)(se,{children:et})}),t[87]=et,t[88]=tt);let nt;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(nt=(0,Z.jsx)(ae,{align:`end`,alignItemWithTrigger:!1,children:Oe.map(Ze)}),t[89]=nt):nt=t[89];let $;t[90]!==Ye||t[91]!==$e||t[92]!==tt?($=(0,Z.jsxs)(ce,{value:Ye,onValueChange:$e,children:[tt,nt]}),t[90]=Ye,t[91]=$e,t[92]=tt,t[93]=$):$=t[93];let rt;t[94]!==y||t[95]!==qe||t[96]!==$?(rt=(0,Z.jsx)(J,{title:`Remote Git status`,description:`Refresh remote branch and pull request metadata while a repository is open.`,scope:y,resetAction:qe,control:$}),t[94]=y,t[95]=qe,t[96]=$,t[97]=rt):rt=t[97];let it;t[98]!==o.sourceControlRefreshMode||t[99]!==c?(it=o.sourceControlRefreshMode===a.sourceControlRefreshMode?null:(0,Z.jsx)(Y,{label:`PR and workflow updates`,onClick:()=>c({sourceControlRefreshMode:a.sourceControlRefreshMode})}),t[98]=o.sourceControlRefreshMode,t[99]=c,t[100]=it):it=t[100];let at;t[101]===c?at=t[102]:(at=e=>{let t=Me(e);t!==null&&c({sourceControlRefreshMode:t})},t[101]=c,t[102]=at);let ot=ke[o.sourceControlRefreshMode],st;t[103]===ot?st=t[104]:(st=(0,Z.jsx)(oe,{className:`w-full sm:w-40`,"aria-label":`PR and workflow update mode`,children:(0,Z.jsx)(se,{children:ot})}),t[103]=ot,t[104]=st);let ct;t[105]===Symbol.for(`react.memo_cache_sentinel`)?(ct=(0,Z.jsx)(ae,{align:`end`,alignItemWithTrigger:!1,children:Ae.map(Xe)}),t[105]=ct):ct=t[105];let lt;t[106]!==o.sourceControlRefreshMode||t[107]!==at||t[108]!==st?(lt=(0,Z.jsxs)(ce,{value:o.sourceControlRefreshMode,onValueChange:at,children:[st,ct]}),t[106]=o.sourceControlRefreshMode,t[107]=at,t[108]=st,t[109]=lt):lt=t[109];let ut;t[110]!==y||t[111]!==it||t[112]!==lt?(ut=(0,Z.jsx)(J,{title:`PR & workflow updates`,description:`Control automatic pull request and workflow refreshes. Automatic is fast after pushes and stops when checks settle.`,scope:y,resetAction:it,control:lt}),t[110]=y,t[111]=it,t[112]=lt,t[113]=ut):ut=t[113];let dt;t[114]!==o.enableProviderUpdateChecks||t[115]!==c?(dt=o.enableProviderUpdateChecks===a.enableProviderUpdateChecks?null:(0,Z.jsx)(Y,{label:`provider update checks`,onClick:()=>c({enableProviderUpdateChecks:a.enableProviderUpdateChecks})}),t[114]=o.enableProviderUpdateChecks,t[115]=c,t[116]=dt):dt=t[116];let ft;t[117]===c?ft=t[118]:(ft=e=>c({enableProviderUpdateChecks:!!e}),t[117]=c,t[118]=ft);let pt;t[119]!==o.enableProviderUpdateChecks||t[120]!==ft?(pt=(0,Z.jsx)(F,{checked:o.enableProviderUpdateChecks,onCheckedChange:ft,"aria-label":`Check providers for updates`}),t[119]=o.enableProviderUpdateChecks,t[120]=ft,t[121]=pt):pt=t[121];let mt;t[122]!==x||t[123]!==dt||t[124]!==pt?(mt=(0,Z.jsx)(J,{title:`Provider update checks`,description:`Check installed provider CLIs for newer versions. Disable if you install providers with Nix or another package manager.`,scope:x,resetAction:dt,control:pt}),t[122]=x,t[123]=dt,t[124]=pt,t[125]=mt):mt=t[125];let ht;t[126]!==o.autoOpenPlanSidebar||t[127]!==c?(ht=o.autoOpenPlanSidebar===a.autoOpenPlanSidebar?null:(0,Z.jsx)(Y,{label:`auto-open overview`,onClick:()=>c({autoOpenPlanSidebar:a.autoOpenPlanSidebar})}),t[126]=o.autoOpenPlanSidebar,t[127]=c,t[128]=ht):ht=t[128];let gt;t[129]===c?gt=t[130]:(gt=e=>c({autoOpenPlanSidebar:!!e}),t[129]=c,t[130]=gt);let _t;t[131]!==o.autoOpenPlanSidebar||t[132]!==gt?(_t=(0,Z.jsx)(F,{checked:o.autoOpenPlanSidebar,onCheckedChange:gt,"aria-label":`Open the overview automatically`}),t[131]=o.autoOpenPlanSidebar,t[132]=gt,t[133]=_t):_t=t[133];let vt;t[134]!==y||t[135]!==ht||t[136]!==_t?(vt=(0,Z.jsx)(J,{title:`Auto-open overview`,description:`Open the overview automatically when plans, progress, or implementation steps appear.`,scope:y,resetAction:ht,control:_t}),t[134]=y,t[135]=ht,t[136]=_t,t[137]=vt):vt=t[137];let yt;t[138]!==o.defaultThreadEnvMode||t[139]!==c?(yt=o.defaultThreadEnvMode===a.defaultThreadEnvMode?null:(0,Z.jsx)(Y,{label:`new threads`,onClick:()=>c({defaultThreadEnvMode:a.defaultThreadEnvMode})}),t[138]=o.defaultThreadEnvMode,t[139]=c,t[140]=yt):yt=t[140];let bt;t[141]===c?bt=t[142]:(bt=e=>{(e===`local`||e===`worktree`)&&c({defaultThreadEnvMode:e})},t[141]=c,t[142]=bt);let xt=o.defaultThreadEnvMode===`worktree`?`New worktree`:`Local`,St;t[143]===xt?St=t[144]:(St=(0,Z.jsx)(oe,{className:`w-full sm:w-44`,"aria-label":`Default thread mode`,children:(0,Z.jsx)(se,{children:xt})}),t[143]=xt,t[144]=St);let Ct;t[145]===Symbol.for(`react.memo_cache_sentinel`)?(Ct=(0,Z.jsxs)(ae,{align:`end`,alignItemWithTrigger:!1,children:[(0,Z.jsx)(B,{hideIndicator:!0,value:`local`,children:`Local`}),(0,Z.jsx)(B,{hideIndicator:!0,value:`worktree`,children:`New worktree`})]}),t[145]=Ct):Ct=t[145];let wt;t[146]!==o.defaultThreadEnvMode||t[147]!==bt||t[148]!==St?(wt=(0,Z.jsxs)(ce,{value:o.defaultThreadEnvMode,onValueChange:bt,children:[St,Ct]}),t[146]=o.defaultThreadEnvMode,t[147]=bt,t[148]=St,t[149]=wt):wt=t[149];let Tt;t[150]!==x||t[151]!==yt||t[152]!==wt?(Tt=(0,Z.jsx)(J,{title:`New threads`,description:`Pick the default workspace mode for newly created draft threads.`,scope:x,resetAction:yt,control:wt}),t[150]=x,t[151]=yt,t[152]=wt,t[153]=Tt):Tt=t[153];let Et;t[154]!==o.addProjectBaseDirectory||t[155]!==c?(Et=o.addProjectBaseDirectory===a.addProjectBaseDirectory?null:(0,Z.jsx)(Y,{label:`add project base directory`,onClick:()=>c({addProjectBaseDirectory:a.addProjectBaseDirectory})}),t[154]=o.addProjectBaseDirectory,t[155]=c,t[156]=Et):Et=t[156];let Dt;t[157]===c?Dt=t[158]:(Dt=e=>c({addProjectBaseDirectory:e}),t[157]=c,t[158]=Dt);let Ot;t[159]!==o.addProjectBaseDirectory||t[160]!==Dt?(Ot=(0,Z.jsx)(be,{className:`w-full sm:w-72`,value:o.addProjectBaseDirectory,onCommit:Dt,placeholder:`~/`,spellCheck:!1,"aria-label":`Add project base directory`}),t[159]=o.addProjectBaseDirectory,t[160]=Dt,t[161]=Ot):Ot=t[161];let kt;t[162]!==x||t[163]!==Et||t[164]!==Ot?(kt=(0,Z.jsx)(J,{title:`Add project starts in`,description:`Leave empty to use "~/" when the Add Project browser opens.`,scope:x,resetAction:Et,control:Ot}),t[162]=x,t[163]=Et,t[164]=Ot,t[165]=kt):kt=t[165];let At;t[166]!==o.confirmThreadArchive||t[167]!==c?(At=o.confirmThreadArchive===a.confirmThreadArchive?null:(0,Z.jsx)(Y,{label:`archive confirmation`,onClick:()=>c({confirmThreadArchive:a.confirmThreadArchive})}),t[166]=o.confirmThreadArchive,t[167]=c,t[168]=At):At=t[168];let jt;t[169]===c?jt=t[170]:(jt=e=>c({confirmThreadArchive:!!e}),t[169]=c,t[170]=jt);let Mt;t[171]!==o.confirmThreadArchive||t[172]!==jt?(Mt=(0,Z.jsx)(F,{checked:o.confirmThreadArchive,onCheckedChange:jt,"aria-label":`Confirm thread archiving`}),t[171]=o.confirmThreadArchive,t[172]=jt,t[173]=Mt):Mt=t[173];let Nt;t[174]!==y||t[175]!==At||t[176]!==Mt?(Nt=(0,Z.jsx)(J,{title:`Archive confirmation`,description:`Require a second click on the inline archive action before a thread is archived.`,scope:y,resetAction:At,control:Mt}),t[174]=y,t[175]=At,t[176]=Mt,t[177]=Nt):Nt=t[177];let Pt;t[178]!==o.confirmThreadDelete||t[179]!==c?(Pt=o.confirmThreadDelete===a.confirmThreadDelete?null:(0,Z.jsx)(Y,{label:`delete confirmation`,onClick:()=>c({confirmThreadDelete:a.confirmThreadDelete})}),t[178]=o.confirmThreadDelete,t[179]=c,t[180]=Pt):Pt=t[180];let Ft;t[181]===c?Ft=t[182]:(Ft=e=>c({confirmThreadDelete:!!e}),t[181]=c,t[182]=Ft);let It;t[183]!==o.confirmThreadDelete||t[184]!==Ft?(It=(0,Z.jsx)(F,{checked:o.confirmThreadDelete,onCheckedChange:Ft,"aria-label":`Confirm thread deletion`}),t[183]=o.confirmThreadDelete,t[184]=Ft,t[185]=It):It=t[185];let Lt;t[186]!==y||t[187]!==Pt||t[188]!==It?(Lt=(0,Z.jsx)(J,{title:`Delete confirmation`,description:`Ask before deleting a thread and its chat history.`,scope:y,resetAction:Pt,control:It}),t[186]=y,t[187]=Pt,t[188]=It,t[189]=Lt):Lt=t[189];let Rt;t[190]!==h||t[191]!==o.notifyOnTurnCompleteWhenUnfocused||t[192]!==c?(Rt=i?(0,Z.jsx)(J,{title:`Turn-complete notifications`,description:`Show a desktop notification when an agent finishes a turn while the Ryco window is unfocused.`,scope:h,resetAction:o.notifyOnTurnCompleteWhenUnfocused===a.notifyOnTurnCompleteWhenUnfocused?null:(0,Z.jsx)(Y,{label:`turn-complete notifications`,onClick:()=>c({notifyOnTurnCompleteWhenUnfocused:a.notifyOnTurnCompleteWhenUnfocused})}),control:(0,Z.jsx)(F,{checked:o.notifyOnTurnCompleteWhenUnfocused,onCheckedChange:e=>c({notifyOnTurnCompleteWhenUnfocused:!!e}),"aria-label":`Notify when a turn completes while unfocused`})}):null,t[190]=h,t[191]=o.notifyOnTurnCompleteWhenUnfocused,t[192]=c,t[193]=Rt):Rt=t[193];let zt;t[194]!==K||t[195]!==Le||t[196]!==He||t[197]!==Ke||t[198]!==rt||t[199]!==ut||t[200]!==mt||t[201]!==vt||t[202]!==Tt||t[203]!==kt||t[204]!==Nt||t[205]!==Lt||t[206]!==Rt?(zt=(0,Z.jsxs)(fe,{title:`General`,children:[K,Le,He,Ke,rt,ut,mt,vt,Tt,kt,Nt,Lt,Rt]}),t[194]=K,t[195]=Le,t[196]=He,t[197]=Ke,t[198]=rt,t[199]=ut,t[200]=mt,t[201]=vt,t[202]=Tt,t[203]=kt,t[204]=Nt,t[205]=Lt,t[206]=Rt,t[207]=zt):zt=t[207];let Bt;t[208]!==u||t[209]!==x||t[210]!==r?(Bt=u?null:(0,Z.jsx)(Je,{searchTargetId:r,nodeScopeLabel:x}),t[208]=u,t[209]=x,t[210]=r,t[211]=Bt):Bt=t[211];let Vt;t[212]===Symbol.for(`react.memo_cache_sentinel`)?(Vt=(0,Z.jsx)(Ie,{}),t[212]=Vt):Vt=t[212];let Ht;t[213]!==h||t[214]!==y?(Ht=i?(0,Z.jsx)(Re,{scopeLabel:h}):(0,Z.jsx)(J,{title:(0,Z.jsx)(Pe,{}),description:`Current version of the application.`,scope:y}),t[213]=h,t[214]=y,t[215]=Ht):Ht=t[215];let Ut=A??`Resolving logs directory...`,Wt;t[216]===Ut?Wt=t[217]:(Wt=(0,Z.jsx)(`span`,{className:`block break-all font-mono text-[11px] text-foreground`,children:Ut}),t[216]=Ut,t[217]=Wt);let Gt;t[218]!==j||t[219]!==L||t[220]!==f?.nodeLabel?(Gt=L?(0,Z.jsx)(`span`,{className:`mt-1 block text-destructive`,children:L}):j?null:(0,Z.jsxs)(`span`,{className:`mt-1 block`,children:[`This path is on `,f?.nodeLabel,`; open it from that machine.`]}),t[218]=j,t[219]=L,t[220]=f?.nodeLabel,t[221]=Gt):Gt=t[221];let Kt;t[222]!==Wt||t[223]!==Gt?(Kt=(0,Z.jsxs)(Z.Fragment,{children:[Wt,Gt]}),t[222]=Wt,t[223]=Gt,t[224]=Kt):Kt=t[224];let qt=!j||!A||ie,Jt=ie?`Opening...`:`Open logs folder`,Yt;t[225]!==I||t[226]!==qt||t[227]!==Jt?(Yt=(0,Z.jsx)(re,{size:`xs`,variant:`outline`,disabled:qt,onClick:I,children:Jt}),t[225]=I,t[226]=qt,t[227]=Jt,t[228]=Yt):Yt=t[228];let Xt;t[229]!==P||t[230]!==x||t[231]!==Kt||t[232]!==Yt?(Xt=(0,Z.jsx)(J,{title:`Diagnostics`,description:P,scope:x,status:Kt,control:Yt}),t[229]=P,t[230]=x,t[231]=Kt,t[232]=Yt,t[233]=Xt):Xt=t[233];let Zt;t[234]!==Ht||t[235]!==Xt?(Zt=(0,Z.jsxs)(fe,{title:`About`,children:[Vt,Ht,Xt]}),t[234]=Ht,t[235]=Xt,t[236]=Zt):Zt=t[236];let Qt;return t[237]!==zt||t[238]!==Bt||t[239]!==Zt?(Qt=(0,Z.jsxs)(pe,{children:[zt,Bt,Zt]}),t[237]=zt,t[238]=Bt,t[239]=Zt,t[240]=Qt):Qt=t[240],Qt}function Xe(e){return(0,Z.jsx)(B,{hideIndicator:!0,value:e,children:ke[e]},e)}function Ze(e){return(0,Z.jsx)(B,{hideIndicator:!0,value:String(e),children:De[e]},e)}function Qe(e){return(0,Z.jsx)(B,{hideIndicator:!0,value:e.id,children:(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Z.jsx)(Ne,{editor:e.id}),he(e.id,navigator.platform)]})},e.id)}function $e(){let e=(0,X.c)(18),t=ie(o.dispatchCommand),n=p(N(u)),r=p(N(f)),{unarchiveThread:i,confirmAndDeleteThread:a}=R(),s;if(e[0]!==n||e[1]!==r){let t;e[3]===r?t=e[4]:(t=e=>({project:e,threads:r.filter(t=>t.projectId===e.id&&t.archivedAt!==null).toSorted(tt)}),e[3]=r,e[4]=t),s=n.map(t).filter(et),e[0]=n,e[1]=r,e[2]=s}else s=e[2];let c=s,l;e[5]!==a||e[6]!==t.allowed||e[7]!==t.reason||e[8]!==i?(l=async(e,n)=>{if(!t.allowed){M.add(L({type:`warning`,title:`Archived thread is read-only`,description:t.reason??`This action is unavailable.`}));return}let r=h();if(!r)return;let o=await r.contextMenu.show([{id:`unarchive`,label:`Unarchive`},{id:`delete`,label:`Delete`,destructive:!0}],n);if(o===`unarchive`){try{await i(e)}catch(e){let t=e;M.add(L({type:`error`,title:`Failed to unarchive thread`,description:t instanceof Error?t.message:`An error occurred.`}))}return}o===`delete`&&await a(e)},e[5]=a,e[6]=t.allowed,e[7]=t.reason,e[8]=i,e[9]=l):l=e[9];let d=l,m;e[10]!==c||e[11]!==d||e[12]!==t.allowed||e[13]!==t.reason||e[14]!==i?(m=c.length===0?(0,Z.jsx)(fe,{title:`Archived threads`,children:(0,Z.jsxs)(q,{className:`min-h-88`,children:[(0,Z.jsx)(ue,{variant:`icon`,children:(0,Z.jsx)(T,{})}),(0,Z.jsxs)(G,{children:[(0,Z.jsx)(K,{children:`No archived threads`}),(0,Z.jsx)(de,{children:`Archived threads will appear here.`})]})]})}):c.map(e=>{let{project:n,threads:r}=e;return(0,Z.jsx)(fe,{title:n.name,icon:(0,Z.jsx)(I,{environmentId:n.environmentId,cwd:n.cwd,projectId:n.id,customAvatarContentHash:n.customAvatarContentHash??null}),children:r.map(e=>(0,Z.jsx)(nt,{thread:e,mutationAllowed:t.allowed,mutationReason:t.reason??null,onOpenMenu:d,onUnarchive:i},e.id))},n.id)}),e[10]=c,e[11]=d,e[12]=t.allowed,e[13]=t.reason,e[14]=i,e[15]=m):m=e[15];let g;return e[16]===m?g=e[17]:(g=(0,Z.jsx)(pe,{children:m}),e[16]=m,e[17]=g),g}function et(e){return e.threads.length>0}function tt(e,t){let n=e.archivedAt??e.createdAt;return(t.archivedAt??t.createdAt).localeCompare(n)||t.id.localeCompare(e.id)}function nt(e){let t=(0,X.c)(38),{thread:n,mutationAllowed:i,mutationReason:a,onOpenMenu:o,onUnarchive:s}=e,c=z()===`phone`,l;t[0]!==o||t[1]!==n.environmentId||t[2]!==n.id?(l=e=>{o(r(n.environmentId,n.id),e)},t[0]=o,t[1]=n.environmentId,t[2]=n.id,t[3]=l):l=t[3];let u=!c,d;t[4]===u?d=t[5]:(d={disabled:u},t[4]=u,t[5]=d);let f=U(l,d),p;t[6]!==f||t[7]!==o||t[8]!==n.environmentId||t[9]!==n.id?(p=e=>{f.onContextMenu(e),!e.defaultPrevented&&(e.preventDefault(),o(r(n.environmentId,n.id),{x:e.clientX,y:e.clientY}))},t[6]=f,t[7]=o,t[8]=n.environmentId,t[9]=n.id,t[10]=p):p=t[10];let m;t[11]===n.title?m=t[12]:(m=(0,Z.jsx)(`h3`,{className:`truncate text-sm font-medium text-foreground`,children:n.title}),t[11]=n.title,t[12]=m);let h=n.archivedAt??n.createdAt,g;t[13]===h?g=t[14]:(g=P(h),t[13]=h,t[14]=g);let _;t[15]===n.createdAt?_=t[16]:(_=P(n.createdAt),t[15]=n.createdAt,t[16]=_);let v;t[17]!==g||t[18]!==_?(v=(0,Z.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Archived `,g,` · Created `,_]}),t[17]=g,t[18]=_,t[19]=v):v=t[19];let y;t[20]!==m||t[21]!==v?(y=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[m,v]}),t[20]=m,t[21]=v,t[22]=y):y=t[22];let b=!i,x=a??void 0,S;t[23]!==s||t[24]!==n.environmentId||t[25]!==n.id?(S=()=>void s(r(n.environmentId,n.id)).catch($),t[23]=s,t[24]=n.environmentId,t[25]=n.id,t[26]=S):S=t[26];let C,w;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(xe,{className:`size-3.5`}),w=(0,Z.jsx)(`span`,{children:`Unarchive`}),t[27]=C,t[28]=w):(C=t[27],w=t[28]);let T;t[29]!==b||t[30]!==x||t[31]!==S?(T=(0,Z.jsxs)(re,{type:`button`,variant:`outline`,size:`sm`,className:`h-7 shrink-0 cursor-pointer gap-1.5 px-2.5`,disabled:b,title:x,onClick:S,children:[C,w]}),t[29]=b,t[30]=x,t[31]=S,t[32]=T):T=t[32];let E;return t[33]!==f||t[34]!==T||t[35]!==p||t[36]!==y?(E=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-t border-border px-4 py-3 first:border-t-0 sm:px-5`,...f,onContextMenu:p,children:[y,T]}),t[33]=f,t[34]=T,t[35]=p,t[36]=y,t[37]=E):E=t[37],E}function $(e){M.add(L({type:`error`,title:`Failed to unarchive thread`,description:e instanceof Error?e.message:`An error occurred.`}))}export{Ce as a,we as i,Ye as n,Se as o,qe as r,$e as t};
|
package/dist/client/assets/{SourceControlSettings-DvPydmxX.js → SourceControlSettings-CkiYR4lR.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,t}from"./react-SIfiwpqq.js";import{t as n}from"./compiler-runtime-qmuS0Svy.js";import{Kc as r}from"./src-Vf4LVnMX.js";import{H as i,Nn as a,Pn as o,W as s,Xn as c,f as l}from"./runtime-DKwoXpJv.js";import{a as u}from"./primary-OskAInOO.js";import{It as d}from"./composerDraftStore-CdJJZe42.js";import{i as f}from"./toast-CcSCAm4B.js";import{t as p}from"./key-round-CacMputS.js";import{t as m}from"./refresh-cw-DopCMrtR.js";import{t as h}from"./trash-2-CM1zXPGb.js";import{t as g}from"./utils-BofFIn5Y.js";import{i as _,n as v,t as y}from"./tooltip-C8sAONBj.js";import{t as b}from"./switch-BTGo9Yip.js";import{t as x}from"./input-CHEwW3oH.js";import{a as S,c as C,d as w,f as T,h as E,i as D,r as O,u as k}from"./Icons-CT3nd2MA.js";import{t as ee}from"./button-BAbJxRzt.js";import{t as A}from"./toastHelpers-CSQRKo4F.js";import{t as j}from"./skeleton-CvQSeJbw.js";import{t as M}from"./spinner-ClF0jOcX.js";import{o as N,t as te}from"./useAtlassian-Bx2ua3JV.js";import{t as ne}from"./badge-CXw6fWrB.js";import{t as P}from"./label-CVFHsLFO.js";import{a as F,i as I,n as re,o as L,r as R,t as z}from"./empty-DwzqNgCP.js";import{i as B,n as V}from"./settingsLayout-D8glO7f1.js";import{t as H}from"./RedactedSensitiveText-CxtaUiKH.js";var U=n(),W=e(t(),1),G=d(),K={versionControlSystems:[],sourceControlProviders:[]},ie={github:k,gitlab:T,forgejo:C,"azure-devops":D,bitbucket:S},ae={git:w,jj:E},oe=[`primary`,`secondary`],se=[`atlassian`,`connections`];function q(e){return r(e)}function J(e){return`auth`in e}function Y(e){return!J(e)&&!e.implemented}function ce(e){return e.status===`authenticated`?{label:`Authenticated`,badge:null}:e.status===`unauthenticated`?{label:`Not authenticated`,badge:`warning`}:{label:`Status unknown`,badge:null}}function le(e){let t=(0,U.c)(2),n;return t[0]===e.account?n=t[1]:(n=(0,G.jsx)(H,{value:e.account,ariaLabel:`Toggle source control account visibility`,revealTooltip:`Click to reveal account`,hideTooltip:`Click to hide account`}),t[0]=e.account,t[1]=n),n}function ue(e){return Y(e)?`bg-muted-foreground/35`:e.status!==`available`||J(e)&&e.auth.status!==`authenticated`?`bg-warning`:`bg-success`}function de(e){let t=(0,U.c)(13),{item:n}=e,r,i,a,o;if(t[0]!==n){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=ue(n),s=J(n)?ie[n.kind]:ae[n.kind];if(!s){o=(0,G.jsx)(`span`,{className:g(`size-2 shrink-0 rounded-full`,e),"aria-hidden":!0});break bb0}i=`relative inline-flex size-5 shrink-0 items-center justify-center`,t[5]===s?a=t[6]:(a=(0,G.jsx)(s,{className:`size-4.5 text-foreground/80`,"aria-hidden":!0}),t[5]=s,t[6]=a),r=g(`pointer-events-none absolute -left-0.5 -top-0.5 size-2 rounded-full ring-2 ring-background`,e)}t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o}else r=t[1],i=t[2],a=t[3],o=t[4];if(o!==Symbol.for(`react.early_return_sentinel`))return o;let s;t[7]===r?s=t[8]:(s=(0,G.jsx)(`span`,{className:r,"aria-hidden":!0}),t[7]=r,t[8]=s);let c;return t[9]!==i||t[10]!==a||t[11]!==s?(c=(0,G.jsxs)(`span`,{className:i,children:[a,s]}),t[9]=i,t[10]=a,t[11]=s,t[12]=c):c=t[12],c}function fe({item:e,auth:t,authAccount:n,authHost:r}){return Y(e)?(0,G.jsxs)(`span`,{children:[`Support for `,e.label,` is coming soon.`]}):e.status===`available`?t?t.status===`authenticated`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{children:`Authenticated`}),n?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{"aria-hidden":!0,children:`as`}),(0,G.jsx)(le,{account:n})]}):null,r?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{"aria-hidden":!0,children:`on`}),(0,G.jsx)(`code`,{className:`rounded bg-muted px-1 py-px text-[11px] text-muted-foreground`,children:r})]}):null]}):e.executable?t.status===`unauthenticated`?(0,G.jsxs)(`span`,{children:[e.label,` is not authenticated on this server. Sign in or configure credentials using the `,(0,G.jsx)(`code`,{className:`rounded bg-muted px-1 py-px text-[11px]`,children:e.executable}),` `,`tool on the server host to enable pull request features.`]}):(0,G.jsxs)(`span`,{children:[`Could not verify `,e.label,`. `,q(t.detail)??e.installHint]}):(0,G.jsx)(`span`,{children:e.installHint}):(0,G.jsx)(`span`,{children:`Available`}):(0,G.jsxs)(`span`,{children:[`Not available on this server — `,e.installHint]})}function X(e){let t=(0,U.c)(57),{item:n}=e,r;t[0]===n.version?r=t[1]:(r=q(n.version),t[0]=n.version,t[1]=r);let i=r,a;t[2]===n?a=t[3]:(a=n.status===`available`&&(J(n)||n.implemented),t[2]=n,t[3]=a);let o=a,s=J(n)?n.auth:null,c;t[4]===s?c=t[5]:(c=s?ce(s):null,t[4]=s,t[5]=c);let l=c,u,d,f,p,m,h,_;if(t[6]!==s||t[7]!==l||t[8]!==n||t[9]!==i){let e=s?q(s.account):null,r=s?q(s.host):null;t[17]===n?u=t[18]:(u=g(`border-t border-border/60 first:border-t-0`,Y(n)&&`opacity-80`),t[17]=n,t[18]=u),_=`px-4 py-3.5 sm:px-5`,h=`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,p=`min-w-0 flex-1 space-y-1`;let a;t[19]===n?a=t[20]:(a=(0,G.jsx)(de,{item:n}),t[19]=n,t[20]=a);let o;t[21]===n.label?o=t[22]:(o=(0,G.jsx)(`h3`,{className:`truncate text-[13px] font-semibold tracking-[-0.01em] text-foreground`,children:n.label}),t[21]=n.label,t[22]=o);let c;t[23]===i?c=t[24]:(c=i?(0,G.jsx)(`code`,{className:`text-xs text-muted-foreground`,children:i}):null,t[23]=i,t[24]=c);let v;t[25]===n?v=t[26]:(v=Y(n)?(0,G.jsx)(ne,{variant:`warning`,size:`sm`,children:`Coming Soon`}):null,t[25]=n,t[26]=v);let y;t[27]===l?y=t[28]:(y=l?.badge?(0,G.jsx)(ne,{variant:l.badge,size:`sm`,children:l.label}):null,t[27]=l,t[28]=y),t[29]!==a||t[30]!==o||t[31]!==c||t[32]!==v||t[33]!==y?(m=(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[a,o,c,v,y]}),t[29]=a,t[30]=o,t[31]=c,t[32]=v,t[33]=y,t[34]=m):m=t[34],d=`flex min-w-0 flex-wrap items-center gap-x-1 text-xs text-muted-foreground`,f=fe({item:n,auth:s,authAccount:e,authHost:r}),t[6]=s,t[7]=l,t[8]=n,t[9]=i,t[10]=u,t[11]=d,t[12]=f,t[13]=p,t[14]=m,t[15]=h,t[16]=_}else u=t[10],d=t[11],f=t[12],p=t[13],m=t[14],h=t[15],_=t[16];let v;t[35]!==d||t[36]!==f?(v=(0,G.jsx)(`p`,{className:d,children:f}),t[35]=d,t[36]=f,t[37]=v):v=t[37];let y;t[38]!==v||t[39]!==p||t[40]!==m?(y=(0,G.jsxs)(`div`,{className:p,children:[m,v]}),t[38]=v,t[39]=p,t[40]=m,t[41]=y):y=t[41];let x;t[42]!==o||t[43]!==n?(x=Y(n)?null:(0,G.jsx)(b,{checked:o,disabled:!0,"aria-label":`${n.label} availability`}),t[42]=o,t[43]=n,t[44]=x):x=t[44];let S;t[45]===x?S=t[46]:(S=(0,G.jsx)(`div`,{className:`flex w-full shrink-0 items-center gap-2 sm:w-auto sm:justify-end`,children:x}),t[45]=x,t[46]=S);let C;t[47]!==y||t[48]!==S||t[49]!==h?(C=(0,G.jsxs)(`div`,{className:h,children:[y,S]}),t[47]=y,t[48]=S,t[49]=h,t[50]=C):C=t[50];let w;t[51]!==C||t[52]!==_?(w=(0,G.jsx)(`div`,{className:_,children:C}),t[51]=C,t[52]=_,t[53]=w):w=t[53];let T;return t[54]!==u||t[55]!==w?(T=(0,G.jsx)(`div`,{className:u,children:w}),t[54]=u,t[55]=w,t[56]=T):T=t[56],T}function pe(e){let t=(0,U.c)(4),{title:n,headerAction:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=oe.map(me),t[0]=i):i=t[0];let a;return t[1]!==r||t[2]!==n?(a=(0,G.jsx)(B,{title:n,headerAction:r,children:i}),t[1]=r,t[2]=n,t[3]=a):a=t[3],a}function me(e){return(0,G.jsx)(`div`,{className:`border-t border-border/60 px-4 py-3.5 first:border-t-0 sm:px-5`,children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`span`,{className:`relative inline-flex size-5 shrink-0 items-center justify-center`,children:[(0,G.jsx)(j,{className:`size-4.5 rounded-md`}),(0,G.jsx)(j,{className:`pointer-events-none absolute -left-0.5 -top-0.5 size-2 rounded-full ring-2 ring-background`,"aria-hidden":!0})]}),(0,G.jsx)(j,{className:`h-4 w-28 rounded-full`}),(0,G.jsx)(j,{className:`h-5 w-14 rounded-full`})]}),(0,G.jsx)(j,{className:`h-3 w-full max-w-xs rounded-full`})]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,G.jsx)(j,{className:`size-7 rounded-md`}),(0,G.jsx)(j,{className:`h-5 w-9 rounded-full`})]})]})},e)}function he(e){switch(e){case`connected`:return`success`;case`needs_reauth`:return`warning`;case`invalid`:return`error`;case`revoked`:return`outline`}}function ge(e){switch(e){case`oauth_3lo`:return`OAuth`;case`bitbucket_token`:return`Bitbucket token`;case`jira_token`:return`Jira token`;case`env_fallback`:return`Environment`}}function _e(e){let t=(0,U.c)(4);if(e.products.includes(`bitbucket`)){let n;return t[0]===e.className?n=t[1]:(n=(0,G.jsx)(S,{className:e.className,"aria-hidden":!0}),t[0]=e.className,t[1]=n),n}let n;return t[2]===e.className?n=t[3]:(n=(0,G.jsx)(O,{className:e.className,"aria-hidden":!0}),t[2]=e.className,t[3]=n),n}function ve(e){let t=(0,U.c)(123),{environmentId:n}=e,r=s(),[o,c]=(0,W.useState)(`Bitbucket`),[u,d]=(0,W.useState)(``),[m,g]=(0,W.useState)(``),[_,v]=(0,W.useState)(`Jira`),[y,b]=(0,W.useState)(``),[S,C]=(0,W.useState)(``),[w,T]=(0,W.useState)(``),E;t[0]===n?E=t[1]:(E=n?l(n):null,t[0]=n,t[1]=E);let D=E?.client??null,O=D!==null,k;t[2]!==n||t[3]!==O?(k={environmentId:n,enabled:O},t[2]=n,t[3]=O,t[4]=k):k=t[4];let j=te(k),F;t[5]!==u||t[6]!==o||t[7]!==m||t[8]!==D?(F=async()=>{if(!D)throw Error(`No server connection is available.`);return D.atlassian.saveManualBitbucketToken({label:o.trim(),email:u.trim(),token:m.trim(),isDefault:!0})},t[5]=u,t[6]=o,t[7]=m,t[8]=D,t[9]=F):F=t[9];let I;t[10]!==n||t[11]!==r?(I=()=>{c(`Bitbucket`),d(``),g(``),N({environmentId:n}),r.invalidateQueries({queryKey:se}),a({environmentId:n}),f.add(A({type:`success`,title:`Bitbucket token saved`,description:`Ryco can now use this Atlassian connection for Bitbucket workflows.`}))},t[10]=n,t[11]=r,t[12]=I):I=t[12];let re;t[13]!==F||t[14]!==I?(re={mutationFn:F,onSuccess:I,onError:xe},t[13]=F,t[14]=I,t[15]=re):re=t[15];let L=i(re),R;t[16]!==D||t[17]!==y||t[18]!==_||t[19]!==S||t[20]!==w?(R=async()=>{if(!D)throw Error(`No server connection is available.`);return D.atlassian.saveManualJiraToken({label:_.trim(),email:y.trim(),siteUrl:S.trim(),token:w.trim(),isDefault:!0})},t[16]=D,t[17]=y,t[18]=_,t[19]=S,t[20]=w,t[21]=R):R=t[21];let z;t[22]!==n||t[23]!==r?(z=()=>{v(`Jira`),b(``),C(``),T(``),N({environmentId:n}),r.invalidateQueries({queryKey:se}),f.add(A({type:`success`,title:`Jira token saved`,description:`Ryco can now load Jira work items for linked projects.`}))},t[22]=n,t[23]=r,t[24]=z):z=t[24];let B;t[25]!==R||t[26]!==z?(B={mutationFn:R,onSuccess:z,onError:be},t[25]=R,t[26]=z,t[27]=B):B=t[27];let V=i(B),H;t[28]===D?H=t[29]:(H=async e=>{if(!D)throw Error(`No server connection is available.`);return D.atlassian.disconnect({connectionId:e.connectionId})},t[28]=D,t[29]=H);let K;t[30]!==n||t[31]!==r?(K=()=>{N({environmentId:n}),r.invalidateQueries({queryKey:se}),a({environmentId:n})},t[30]=n,t[31]=r,t[32]=K):K=t[32];let ie;t[33]!==H||t[34]!==K?(ie={mutationFn:H,onSuccess:K,onError:ye},t[33]=H,t[34]=K,t[35]=ie):ie=t[35];let ae=i(ie),oe;t[36]!==u||t[37]!==o||t[38]!==m||t[39]!==D||t[40]!==L.isPending?(oe=D!==null&&o.trim().length>0&&u.trim().length>0&&m.trim().length>0&&!L.isPending,t[36]=u,t[37]=o,t[38]=m,t[39]=D,t[40]=L.isPending,t[41]=oe):oe=t[41];let q=oe,J;t[42]!==D||t[43]!==y||t[44]!==_||t[45]!==S||t[46]!==w||t[47]!==V.isPending?(J=D!==null&&_.trim().length>0&&y.trim().length>0&&S.trim().length>0&&w.trim().length>0&&!V.isPending,t[42]=D,t[43]=y,t[44]=_,t[45]=S,t[46]=w,t[47]=V.isPending,t[48]=J):J=t[48];let Y=J,ce;t[49]!==q||t[50]!==L?(ce=e=>{e.preventDefault(),q&&L.mutate()},t[49]=q,t[50]=L,t[51]=ce):ce=t[51];let ue=ce,de;t[52]!==Y||t[53]!==V?(de=e=>{e.preventDefault(),Y&&V.mutate()},t[52]=Y,t[53]=V,t[54]=de):de=t[54];let fe=de,X;t[55]===j.data?X=t[56]:(X=j.data??[],t[55]=j.data,t[56]=X);let pe=X,me=j.data===null&&!j.isError,ve;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,G.jsx)(`div`,{className:`border-t border-border/60 bg-muted/20 px-4 py-2.5 sm:px-5`,children:(0,G.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground/70`,children:[(0,G.jsx)(p,{className:`size-3`,"aria-hidden":!0}),`Atlassian`]})}),t[57]=ve):ve=t[57];let Se;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,G.jsx)(P,{htmlFor:`bitbucket-token-label`,className:`text-xs`,children:`Label`}),t[58]=Se):Se=t[58];let Ce;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=e=>c(e.currentTarget.value),t[59]=Ce):Ce=t[59];let Z;t[60]===o?Z=t[61]:(Z=(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[Se,(0,G.jsx)(x,{id:`bitbucket-token-label`,size:`sm`,value:o,autoComplete:`organization`,onChange:Ce,placeholder:`Bitbucket`})]}),t[60]=o,t[61]=Z);let we;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,G.jsx)(P,{htmlFor:`bitbucket-token-email`,className:`text-xs`,children:`Email`}),t[62]=we):we=t[62];let Te;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Te=e=>d(e.currentTarget.value),t[63]=Te):Te=t[63];let Ee;t[64]===u?Ee=t[65]:(Ee=(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[we,(0,G.jsx)(x,{id:`bitbucket-token-email`,size:`sm`,type:`email`,value:u,autoComplete:`username`,onChange:Te,placeholder:`you@example.com`})]}),t[64]=u,t[65]=Ee);let De;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,G.jsx)(P,{htmlFor:`bitbucket-token-secret`,className:`text-xs`,children:`Bitbucket app password`}),t[66]=De):De=t[66];let Oe;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=e=>g(e.currentTarget.value),t[67]=Oe):Oe=t[67];let ke;t[68]===m?ke=t[69]:(ke=(0,G.jsx)(x,{id:`bitbucket-token-secret`,size:`sm`,type:`password`,value:m,autoComplete:`current-password`,onChange:Oe,placeholder:`Stored locally in the server secret store`}),t[68]=m,t[69]=ke);let Ae=!q,je;t[70]===L.isPending?je=t[71]:(je=L.isPending?(0,G.jsx)(M,{className:`size-3`}):null,t[70]=L.isPending,t[71]=je);let Me;t[72]!==Ae||t[73]!==je?(Me=(0,G.jsxs)(ee,{type:`submit`,size:`sm`,className:`h-7.5 shrink-0 gap-1.5 px-3 text-xs`,disabled:Ae,children:[je,`Save Token`]}),t[72]=Ae,t[73]=je,t[74]=Me):Me=t[74];let Ne;t[75]!==ke||t[76]!==Me?(Ne=(0,G.jsxs)(`div`,{className:`space-y-1.5 sm:col-span-2`,children:[De,(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[ke,Me]})]}),t[75]=ke,t[76]=Me,t[77]=Ne):Ne=t[77];let Pe;t[78]!==ue||t[79]!==Z||t[80]!==Ee||t[81]!==Ne?(Pe=(0,G.jsx)(`div`,{className:`border-t border-border/60 px-4 py-4 sm:px-5`,children:(0,G.jsxs)(`form`,{className:`grid gap-3 sm:grid-cols-[1fr_1fr] sm:items-end`,onSubmit:ue,children:[Z,Ee,Ne]})}),t[78]=ue,t[79]=Z,t[80]=Ee,t[81]=Ne,t[82]=Pe):Pe=t[82];let Fe;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=(0,G.jsx)(P,{htmlFor:`jira-token-label`,className:`text-xs`,children:`Label`}),t[83]=Fe):Fe=t[83];let Ie;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=e=>v(e.currentTarget.value),t[84]=Ie):Ie=t[84];let Le;t[85]===_?Le=t[86]:(Le=(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[Fe,(0,G.jsx)(x,{id:`jira-token-label`,size:`sm`,value:_,autoComplete:`organization`,onChange:Ie,placeholder:`Jira`})]}),t[85]=_,t[86]=Le);let Re;t[87]===Symbol.for(`react.memo_cache_sentinel`)?(Re=(0,G.jsx)(P,{htmlFor:`jira-token-email`,className:`text-xs`,children:`Email`}),t[87]=Re):Re=t[87];let ze;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(ze=e=>b(e.currentTarget.value),t[88]=ze):ze=t[88];let Be;t[89]===y?Be=t[90]:(Be=(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[Re,(0,G.jsx)(x,{id:`jira-token-email`,size:`sm`,type:`email`,value:y,autoComplete:`username`,onChange:ze,placeholder:`you@example.com`})]}),t[89]=y,t[90]=Be);let Ve;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=(0,G.jsx)(P,{htmlFor:`jira-site-url`,className:`text-xs`,children:`Jira site URL`}),t[91]=Ve):Ve=t[91];let He;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(He=e=>C(e.currentTarget.value),t[92]=He):He=t[92];let Q;t[93]===S?Q=t[94]:(Q=(0,G.jsxs)(`div`,{className:`space-y-1.5 sm:col-span-2`,children:[Ve,(0,G.jsx)(x,{id:`jira-site-url`,size:`sm`,value:S,inputMode:`url`,autoComplete:`url`,onChange:He,placeholder:`https://your-team.atlassian.net`})]}),t[93]=S,t[94]=Q);let Ue;t[95]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=(0,G.jsx)(P,{htmlFor:`jira-token-secret`,className:`text-xs`,children:`Jira API token`}),t[95]=Ue):Ue=t[95];let We;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(We=e=>T(e.currentTarget.value),t[96]=We):We=t[96];let Ge;t[97]===w?Ge=t[98]:(Ge=(0,G.jsx)(x,{id:`jira-token-secret`,size:`sm`,type:`password`,value:w,autoComplete:`current-password`,onChange:We,placeholder:`Stored locally in the server secret store`}),t[97]=w,t[98]=Ge);let Ke=!Y,qe;t[99]===V.isPending?qe=t[100]:(qe=V.isPending?(0,G.jsx)(M,{className:`size-3`}):null,t[99]=V.isPending,t[100]=qe);let Je;t[101]!==Ke||t[102]!==qe?(Je=(0,G.jsxs)(ee,{type:`submit`,size:`sm`,className:`h-7.5 shrink-0 gap-1.5 px-3 text-xs`,disabled:Ke,children:[qe,`Save Jira`]}),t[101]=Ke,t[102]=qe,t[103]=Je):Je=t[103];let Ye;t[104]!==Ge||t[105]!==Je?(Ye=(0,G.jsxs)(`div`,{className:`space-y-1.5 sm:col-span-2`,children:[Ue,(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[Ge,Je]})]}),t[104]=Ge,t[105]=Je,t[106]=Ye):Ye=t[106];let Xe;t[107]!==fe||t[108]!==Le||t[109]!==Be||t[110]!==Q||t[111]!==Ye?(Xe=(0,G.jsx)(`div`,{className:`border-t border-border/60 px-4 py-4 sm:px-5`,children:(0,G.jsxs)(`form`,{className:`grid gap-3 sm:grid-cols-[1fr_1fr] sm:items-end`,onSubmit:fe,children:[Le,Be,Q,Ye]})}),t[107]=fe,t[108]=Le,t[109]=Be,t[110]=Q,t[111]=Ye,t[112]=Xe):Xe=t[112];let Ze;t[113]!==me||t[114]!==ae||t[115]!==pe?(Ze=me?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-4 text-xs text-muted-foreground sm:px-5`,children:[(0,G.jsx)(M,{className:`size-3.5`}),`Loading Atlassian connections`]}):pe.length===0?(0,G.jsx)(`div`,{className:`px-4 py-4 text-xs leading-relaxed text-muted-foreground sm:px-5`,children:`No Atlassian connections are stored yet. Add Bitbucket and Jira tokens to enable repository PRs, diffs, and work-item links.`}):pe.map(e=>(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 border-t border-border/60 px-4 py-3.5 first:border-t-0 sm:flex-row sm:items-center sm:justify-between sm:px-5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,G.jsx)(_e,{products:e.products,className:`size-4 text-foreground/80`}),(0,G.jsx)(`h3`,{className:`truncate text-[13px] font-semibold text-foreground`,children:e.label}),(0,G.jsx)(ne,{variant:he(e.status),size:`sm`,children:e.status.replace(`_`,` `)}),(0,G.jsx)(ne,{variant:`outline`,size:`sm`,children:ge(e.kind)})]}),(0,G.jsxs)(`p`,{className:`flex min-w-0 flex-wrap gap-x-1 text-xs text-muted-foreground`,children:[e.accountEmail?(0,G.jsx)(le,{account:e.accountEmail}):(0,G.jsx)(`span`,{children:`No account email saved`}),(0,G.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,G.jsx)(`span`,{children:e.capabilities.join(`, `)})]})]}),(0,G.jsx)(ee,{type:`button`,size:`icon-xs`,variant:`ghost`,className:`size-7 self-start text-muted-foreground hover:text-destructive sm:self-auto`,"aria-label":`Delete ${e.label}`,disabled:ae.isPending||e.readonly,onClick:()=>ae.mutate(e),children:(0,G.jsx)(h,{className:`size-3.5`})})]},e.connectionId)),t[113]=me,t[114]=ae,t[115]=pe,t[116]=Ze):Ze=t[116];let $;t[117]===Ze?$=t[118]:($=(0,G.jsx)(`div`,{className:`border-t border-border/60`,children:Ze}),t[117]=Ze,t[118]=$);let Qe;return t[119]!==Pe||t[120]!==Xe||t[121]!==$?(Qe=(0,G.jsxs)(G.Fragment,{children:[ve,Pe,Xe,$]}),t[119]=Pe,t[120]=Xe,t[121]=$,t[122]=Qe):Qe=t[122],Qe}function ye(e){f.add(A({type:`error`,title:`Could not delete Atlassian connection`,description:e instanceof Error?e.message:`The connection was not changed.`}))}function be(e){f.add(A({type:`error`,title:`Could not save Jira token`,description:e instanceof Error?e.message:`The token could not be saved.`}))}function xe(e){f.add(A({type:`error`,title:`Could not save Bitbucket token`,description:e instanceof Error?e.message:`The token could not be saved.`}))}function Se(){let e=(0,U.c)(41),t=c(),n=u(),r=t?.environmentId??n,i;e[0]===r?i=e[1]:(i={environmentId:r},e[0]=r,e[1]=i);let s=o(i),l=s.data??K,d=s.isPending&&s.data===null,f;e[2]===r?f=e[3]:(f=()=>{a({environmentId:r})},e[2]=r,e[3]=f);let p=f,h=s.isPending,b=s.isPending&&`animate-spin`,x;e[4]===b?x=e[5]:(x=g(`size-3`,b),e[4]=b,e[5]=x);let S;e[6]===x?S=e[7]:(S=(0,G.jsx)(m,{className:x}),e[6]=x,e[7]=S);let C;e[8]!==s.isPending||e[9]!==p||e[10]!==S?(C=(0,G.jsx)(_,{render:(0,G.jsx)(ee,{size:`icon-xs`,variant:`ghost`,className:`size-5 rounded-sm p-0 text-muted-foreground hover:text-foreground`,onClick:p,disabled:h,"aria-label":`Rescan server environment`,children:S})}),e[8]=s.isPending,e[9]=p,e[10]=S,e[11]=C):C=e[11];let T;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,G.jsx)(v,{side:`top`,children:`Rescan Git and hosting integrations`}),e[12]=T):T=e[12];let E;e[13]===C?E=e[14]:(E=(0,G.jsxs)(y,{children:[C,T]}),e[13]=C,e[14]=E);let D=E;if(d){let t;e[15]===D?t=e[16]:(t=(0,G.jsx)(pe,{title:`Version Control`,headerAction:D}),e[15]=D,e[16]=t);let n;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,G.jsx)(pe,{title:`Source Control Providers`}),e[17]=n):n=e[17];let r;return e[18]===t?r=e[19]:(r=(0,G.jsxs)(V,{children:[t,n]}),e[18]=t,e[19]=r),r}let O=l.versionControlSystems.length>0,k=l.sourceControlProviders.length>0,A=O||k,j;e[20]!==s.isPending||e[21]!==r||e[22]!==p||e[23]!==A?(j=A?null:(0,G.jsxs)(B,{title:`Source Control Providers`,children:[(0,G.jsxs)(z,{className:`min-h-56 border-t border-border/60 first:border-t-0`,children:[(0,G.jsxs)(I,{children:[(0,G.jsx)(F,{variant:`icon`,children:(0,G.jsx)(w,{className:`size-4`})}),(0,G.jsx)(L,{children:`Nothing detected yet`}),(0,G.jsx)(R,{children:`Install Git on the server, add optional hosting integrations or credentials your workspace needs, then rescan.`})]}),(0,G.jsx)(re,{children:(0,G.jsxs)(ee,{type:`button`,size:`xs`,onClick:p,disabled:s.isPending,children:[(0,G.jsx)(m,{className:g(`size-3`,s.isPending&&`animate-spin`)}),`Scan`]})})]}),(0,G.jsx)(ve,{environmentId:r})]}),e[20]=s.isPending,e[21]=r,e[22]=p,e[23]=A,e[24]=j):j=e[24];let M;e[25]!==O||e[26]!==l.versionControlSystems||e[27]!==D?(M=O?(0,G.jsx)(B,{title:`Version Control`,headerAction:D,children:l.versionControlSystems.map(Z)}):null,e[25]=O,e[26]=l.versionControlSystems,e[27]=D,e[28]=M):M=e[28];let N;e[29]!==s.error||e[30]!==r||e[31]!==A||e[32]!==k||e[33]!==O||e[34]!==l.sourceControlProviders||e[35]!==D?(N=A?(0,G.jsxs)(B,{title:`Source Control Providers`,headerAction:O?null:D,children:[k?l.sourceControlProviders.map(Ce):(0,G.jsx)(`div`,{className:`border-t border-border/60 px-4 py-3.5 first:border-t-0 sm:px-5`,children:(0,G.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:s.error??`No source control providers were detected on the server. Install a CLI like git, gh, glab, or az on the server host, then rescan.`})}),(0,G.jsx)(ve,{environmentId:r})]}):null,e[29]=s.error,e[30]=r,e[31]=A,e[32]=k,e[33]=O,e[34]=l.sourceControlProviders,e[35]=D,e[36]=N):N=e[36];let te;return e[37]!==M||e[38]!==N||e[39]!==j?(te=(0,G.jsxs)(V,{children:[j,M,N]}),e[37]=M,e[38]=N,e[39]=j,e[40]=te):te=e[40],te}function Ce(e){return(0,G.jsx)(X,{item:e},`provider:${e.kind}`)}function Z(e){return(0,G.jsx)(X,{item:e},`vcs:${e.kind}`)}export{Se as SourceControlSettingsPanel};
|
|
1
|
+
import{i as e,t}from"./react-SIfiwpqq.js";import{t as n}from"./compiler-runtime-qmuS0Svy.js";import{Kc as r}from"./src-Vf4LVnMX.js";import{H as i,Nn as a,Pn as o,W as s,Xn as c,f as l}from"./runtime-CXut_g4p.js";import{a as u}from"./primary-BzLEg2w1.js";import{It as d}from"./composerDraftStore-CdJJZe42.js";import{i as f}from"./toast-CcSCAm4B.js";import{t as p}from"./key-round-CacMputS.js";import{t as m}from"./refresh-cw-DopCMrtR.js";import{t as h}from"./trash-2-CM1zXPGb.js";import{t as g}from"./utils-BofFIn5Y.js";import{i as _,n as v,t as y}from"./tooltip-C8sAONBj.js";import{t as b}from"./switch-BTGo9Yip.js";import{t as x}from"./input-CHEwW3oH.js";import{a as S,c as C,d as w,f as T,h as E,i as D,r as O,u as k}from"./Icons-CT3nd2MA.js";import{t as ee}from"./button-BAbJxRzt.js";import{t as A}from"./toastHelpers-CSQRKo4F.js";import{t as j}from"./skeleton-CvQSeJbw.js";import{t as M}from"./spinner-ClF0jOcX.js";import{o as N,t as te}from"./useAtlassian-9-hy2f8z.js";import{t as ne}from"./badge-CXw6fWrB.js";import{t as P}from"./label-CVFHsLFO.js";import{a as F,i as I,n as re,o as L,r as R,t as z}from"./empty-DwzqNgCP.js";import{i as B,n as V}from"./settingsLayout-D8glO7f1.js";import{t as H}from"./RedactedSensitiveText-CxtaUiKH.js";var U=n(),W=e(t(),1),G=d(),K={versionControlSystems:[],sourceControlProviders:[]},ie={github:k,gitlab:T,forgejo:C,"azure-devops":D,bitbucket:S},ae={git:w,jj:E},oe=[`primary`,`secondary`],se=[`atlassian`,`connections`];function q(e){return r(e)}function J(e){return`auth`in e}function Y(e){return!J(e)&&!e.implemented}function ce(e){return e.status===`authenticated`?{label:`Authenticated`,badge:null}:e.status===`unauthenticated`?{label:`Not authenticated`,badge:`warning`}:{label:`Status unknown`,badge:null}}function le(e){let t=(0,U.c)(2),n;return t[0]===e.account?n=t[1]:(n=(0,G.jsx)(H,{value:e.account,ariaLabel:`Toggle source control account visibility`,revealTooltip:`Click to reveal account`,hideTooltip:`Click to hide account`}),t[0]=e.account,t[1]=n),n}function ue(e){return Y(e)?`bg-muted-foreground/35`:e.status!==`available`||J(e)&&e.auth.status!==`authenticated`?`bg-warning`:`bg-success`}function de(e){let t=(0,U.c)(13),{item:n}=e,r,i,a,o;if(t[0]!==n){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=ue(n),s=J(n)?ie[n.kind]:ae[n.kind];if(!s){o=(0,G.jsx)(`span`,{className:g(`size-2 shrink-0 rounded-full`,e),"aria-hidden":!0});break bb0}i=`relative inline-flex size-5 shrink-0 items-center justify-center`,t[5]===s?a=t[6]:(a=(0,G.jsx)(s,{className:`size-4.5 text-foreground/80`,"aria-hidden":!0}),t[5]=s,t[6]=a),r=g(`pointer-events-none absolute -left-0.5 -top-0.5 size-2 rounded-full ring-2 ring-background`,e)}t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o}else r=t[1],i=t[2],a=t[3],o=t[4];if(o!==Symbol.for(`react.early_return_sentinel`))return o;let s;t[7]===r?s=t[8]:(s=(0,G.jsx)(`span`,{className:r,"aria-hidden":!0}),t[7]=r,t[8]=s);let c;return t[9]!==i||t[10]!==a||t[11]!==s?(c=(0,G.jsxs)(`span`,{className:i,children:[a,s]}),t[9]=i,t[10]=a,t[11]=s,t[12]=c):c=t[12],c}function fe({item:e,auth:t,authAccount:n,authHost:r}){return Y(e)?(0,G.jsxs)(`span`,{children:[`Support for `,e.label,` is coming soon.`]}):e.status===`available`?t?t.status===`authenticated`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{children:`Authenticated`}),n?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{"aria-hidden":!0,children:`as`}),(0,G.jsx)(le,{account:n})]}):null,r?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{"aria-hidden":!0,children:`on`}),(0,G.jsx)(`code`,{className:`rounded bg-muted px-1 py-px text-[11px] text-muted-foreground`,children:r})]}):null]}):e.executable?t.status===`unauthenticated`?(0,G.jsxs)(`span`,{children:[e.label,` is not authenticated on this server. Sign in or configure credentials using the `,(0,G.jsx)(`code`,{className:`rounded bg-muted px-1 py-px text-[11px]`,children:e.executable}),` `,`tool on the server host to enable pull request features.`]}):(0,G.jsxs)(`span`,{children:[`Could not verify `,e.label,`. `,q(t.detail)??e.installHint]}):(0,G.jsx)(`span`,{children:e.installHint}):(0,G.jsx)(`span`,{children:`Available`}):(0,G.jsxs)(`span`,{children:[`Not available on this server — `,e.installHint]})}function X(e){let t=(0,U.c)(57),{item:n}=e,r;t[0]===n.version?r=t[1]:(r=q(n.version),t[0]=n.version,t[1]=r);let i=r,a;t[2]===n?a=t[3]:(a=n.status===`available`&&(J(n)||n.implemented),t[2]=n,t[3]=a);let o=a,s=J(n)?n.auth:null,c;t[4]===s?c=t[5]:(c=s?ce(s):null,t[4]=s,t[5]=c);let l=c,u,d,f,p,m,h,_;if(t[6]!==s||t[7]!==l||t[8]!==n||t[9]!==i){let e=s?q(s.account):null,r=s?q(s.host):null;t[17]===n?u=t[18]:(u=g(`border-t border-border/60 first:border-t-0`,Y(n)&&`opacity-80`),t[17]=n,t[18]=u),_=`px-4 py-3.5 sm:px-5`,h=`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,p=`min-w-0 flex-1 space-y-1`;let a;t[19]===n?a=t[20]:(a=(0,G.jsx)(de,{item:n}),t[19]=n,t[20]=a);let o;t[21]===n.label?o=t[22]:(o=(0,G.jsx)(`h3`,{className:`truncate text-[13px] font-semibold tracking-[-0.01em] text-foreground`,children:n.label}),t[21]=n.label,t[22]=o);let c;t[23]===i?c=t[24]:(c=i?(0,G.jsx)(`code`,{className:`text-xs text-muted-foreground`,children:i}):null,t[23]=i,t[24]=c);let v;t[25]===n?v=t[26]:(v=Y(n)?(0,G.jsx)(ne,{variant:`warning`,size:`sm`,children:`Coming Soon`}):null,t[25]=n,t[26]=v);let y;t[27]===l?y=t[28]:(y=l?.badge?(0,G.jsx)(ne,{variant:l.badge,size:`sm`,children:l.label}):null,t[27]=l,t[28]=y),t[29]!==a||t[30]!==o||t[31]!==c||t[32]!==v||t[33]!==y?(m=(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[a,o,c,v,y]}),t[29]=a,t[30]=o,t[31]=c,t[32]=v,t[33]=y,t[34]=m):m=t[34],d=`flex min-w-0 flex-wrap items-center gap-x-1 text-xs text-muted-foreground`,f=fe({item:n,auth:s,authAccount:e,authHost:r}),t[6]=s,t[7]=l,t[8]=n,t[9]=i,t[10]=u,t[11]=d,t[12]=f,t[13]=p,t[14]=m,t[15]=h,t[16]=_}else u=t[10],d=t[11],f=t[12],p=t[13],m=t[14],h=t[15],_=t[16];let v;t[35]!==d||t[36]!==f?(v=(0,G.jsx)(`p`,{className:d,children:f}),t[35]=d,t[36]=f,t[37]=v):v=t[37];let y;t[38]!==v||t[39]!==p||t[40]!==m?(y=(0,G.jsxs)(`div`,{className:p,children:[m,v]}),t[38]=v,t[39]=p,t[40]=m,t[41]=y):y=t[41];let x;t[42]!==o||t[43]!==n?(x=Y(n)?null:(0,G.jsx)(b,{checked:o,disabled:!0,"aria-label":`${n.label} availability`}),t[42]=o,t[43]=n,t[44]=x):x=t[44];let S;t[45]===x?S=t[46]:(S=(0,G.jsx)(`div`,{className:`flex w-full shrink-0 items-center gap-2 sm:w-auto sm:justify-end`,children:x}),t[45]=x,t[46]=S);let C;t[47]!==y||t[48]!==S||t[49]!==h?(C=(0,G.jsxs)(`div`,{className:h,children:[y,S]}),t[47]=y,t[48]=S,t[49]=h,t[50]=C):C=t[50];let w;t[51]!==C||t[52]!==_?(w=(0,G.jsx)(`div`,{className:_,children:C}),t[51]=C,t[52]=_,t[53]=w):w=t[53];let T;return t[54]!==u||t[55]!==w?(T=(0,G.jsx)(`div`,{className:u,children:w}),t[54]=u,t[55]=w,t[56]=T):T=t[56],T}function pe(e){let t=(0,U.c)(4),{title:n,headerAction:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=oe.map(me),t[0]=i):i=t[0];let a;return t[1]!==r||t[2]!==n?(a=(0,G.jsx)(B,{title:n,headerAction:r,children:i}),t[1]=r,t[2]=n,t[3]=a):a=t[3],a}function me(e){return(0,G.jsx)(`div`,{className:`border-t border-border/60 px-4 py-3.5 first:border-t-0 sm:px-5`,children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`span`,{className:`relative inline-flex size-5 shrink-0 items-center justify-center`,children:[(0,G.jsx)(j,{className:`size-4.5 rounded-md`}),(0,G.jsx)(j,{className:`pointer-events-none absolute -left-0.5 -top-0.5 size-2 rounded-full ring-2 ring-background`,"aria-hidden":!0})]}),(0,G.jsx)(j,{className:`h-4 w-28 rounded-full`}),(0,G.jsx)(j,{className:`h-5 w-14 rounded-full`})]}),(0,G.jsx)(j,{className:`h-3 w-full max-w-xs rounded-full`})]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,G.jsx)(j,{className:`size-7 rounded-md`}),(0,G.jsx)(j,{className:`h-5 w-9 rounded-full`})]})]})},e)}function he(e){switch(e){case`connected`:return`success`;case`needs_reauth`:return`warning`;case`invalid`:return`error`;case`revoked`:return`outline`}}function ge(e){switch(e){case`oauth_3lo`:return`OAuth`;case`bitbucket_token`:return`Bitbucket token`;case`jira_token`:return`Jira token`;case`env_fallback`:return`Environment`}}function _e(e){let t=(0,U.c)(4);if(e.products.includes(`bitbucket`)){let n;return t[0]===e.className?n=t[1]:(n=(0,G.jsx)(S,{className:e.className,"aria-hidden":!0}),t[0]=e.className,t[1]=n),n}let n;return t[2]===e.className?n=t[3]:(n=(0,G.jsx)(O,{className:e.className,"aria-hidden":!0}),t[2]=e.className,t[3]=n),n}function ve(e){let t=(0,U.c)(123),{environmentId:n}=e,r=s(),[o,c]=(0,W.useState)(`Bitbucket`),[u,d]=(0,W.useState)(``),[m,g]=(0,W.useState)(``),[_,v]=(0,W.useState)(`Jira`),[y,b]=(0,W.useState)(``),[S,C]=(0,W.useState)(``),[w,T]=(0,W.useState)(``),E;t[0]===n?E=t[1]:(E=n?l(n):null,t[0]=n,t[1]=E);let D=E?.client??null,O=D!==null,k;t[2]!==n||t[3]!==O?(k={environmentId:n,enabled:O},t[2]=n,t[3]=O,t[4]=k):k=t[4];let j=te(k),F;t[5]!==u||t[6]!==o||t[7]!==m||t[8]!==D?(F=async()=>{if(!D)throw Error(`No server connection is available.`);return D.atlassian.saveManualBitbucketToken({label:o.trim(),email:u.trim(),token:m.trim(),isDefault:!0})},t[5]=u,t[6]=o,t[7]=m,t[8]=D,t[9]=F):F=t[9];let I;t[10]!==n||t[11]!==r?(I=()=>{c(`Bitbucket`),d(``),g(``),N({environmentId:n}),r.invalidateQueries({queryKey:se}),a({environmentId:n}),f.add(A({type:`success`,title:`Bitbucket token saved`,description:`Ryco can now use this Atlassian connection for Bitbucket workflows.`}))},t[10]=n,t[11]=r,t[12]=I):I=t[12];let re;t[13]!==F||t[14]!==I?(re={mutationFn:F,onSuccess:I,onError:xe},t[13]=F,t[14]=I,t[15]=re):re=t[15];let L=i(re),R;t[16]!==D||t[17]!==y||t[18]!==_||t[19]!==S||t[20]!==w?(R=async()=>{if(!D)throw Error(`No server connection is available.`);return D.atlassian.saveManualJiraToken({label:_.trim(),email:y.trim(),siteUrl:S.trim(),token:w.trim(),isDefault:!0})},t[16]=D,t[17]=y,t[18]=_,t[19]=S,t[20]=w,t[21]=R):R=t[21];let z;t[22]!==n||t[23]!==r?(z=()=>{v(`Jira`),b(``),C(``),T(``),N({environmentId:n}),r.invalidateQueries({queryKey:se}),f.add(A({type:`success`,title:`Jira token saved`,description:`Ryco can now load Jira work items for linked projects.`}))},t[22]=n,t[23]=r,t[24]=z):z=t[24];let B;t[25]!==R||t[26]!==z?(B={mutationFn:R,onSuccess:z,onError:be},t[25]=R,t[26]=z,t[27]=B):B=t[27];let V=i(B),H;t[28]===D?H=t[29]:(H=async e=>{if(!D)throw Error(`No server connection is available.`);return D.atlassian.disconnect({connectionId:e.connectionId})},t[28]=D,t[29]=H);let K;t[30]!==n||t[31]!==r?(K=()=>{N({environmentId:n}),r.invalidateQueries({queryKey:se}),a({environmentId:n})},t[30]=n,t[31]=r,t[32]=K):K=t[32];let ie;t[33]!==H||t[34]!==K?(ie={mutationFn:H,onSuccess:K,onError:ye},t[33]=H,t[34]=K,t[35]=ie):ie=t[35];let ae=i(ie),oe;t[36]!==u||t[37]!==o||t[38]!==m||t[39]!==D||t[40]!==L.isPending?(oe=D!==null&&o.trim().length>0&&u.trim().length>0&&m.trim().length>0&&!L.isPending,t[36]=u,t[37]=o,t[38]=m,t[39]=D,t[40]=L.isPending,t[41]=oe):oe=t[41];let q=oe,J;t[42]!==D||t[43]!==y||t[44]!==_||t[45]!==S||t[46]!==w||t[47]!==V.isPending?(J=D!==null&&_.trim().length>0&&y.trim().length>0&&S.trim().length>0&&w.trim().length>0&&!V.isPending,t[42]=D,t[43]=y,t[44]=_,t[45]=S,t[46]=w,t[47]=V.isPending,t[48]=J):J=t[48];let Y=J,ce;t[49]!==q||t[50]!==L?(ce=e=>{e.preventDefault(),q&&L.mutate()},t[49]=q,t[50]=L,t[51]=ce):ce=t[51];let ue=ce,de;t[52]!==Y||t[53]!==V?(de=e=>{e.preventDefault(),Y&&V.mutate()},t[52]=Y,t[53]=V,t[54]=de):de=t[54];let fe=de,X;t[55]===j.data?X=t[56]:(X=j.data??[],t[55]=j.data,t[56]=X);let pe=X,me=j.data===null&&!j.isError,ve;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,G.jsx)(`div`,{className:`border-t border-border/60 bg-muted/20 px-4 py-2.5 sm:px-5`,children:(0,G.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground/70`,children:[(0,G.jsx)(p,{className:`size-3`,"aria-hidden":!0}),`Atlassian`]})}),t[57]=ve):ve=t[57];let Se;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,G.jsx)(P,{htmlFor:`bitbucket-token-label`,className:`text-xs`,children:`Label`}),t[58]=Se):Se=t[58];let Ce;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=e=>c(e.currentTarget.value),t[59]=Ce):Ce=t[59];let Z;t[60]===o?Z=t[61]:(Z=(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[Se,(0,G.jsx)(x,{id:`bitbucket-token-label`,size:`sm`,value:o,autoComplete:`organization`,onChange:Ce,placeholder:`Bitbucket`})]}),t[60]=o,t[61]=Z);let we;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,G.jsx)(P,{htmlFor:`bitbucket-token-email`,className:`text-xs`,children:`Email`}),t[62]=we):we=t[62];let Te;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Te=e=>d(e.currentTarget.value),t[63]=Te):Te=t[63];let Ee;t[64]===u?Ee=t[65]:(Ee=(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[we,(0,G.jsx)(x,{id:`bitbucket-token-email`,size:`sm`,type:`email`,value:u,autoComplete:`username`,onChange:Te,placeholder:`you@example.com`})]}),t[64]=u,t[65]=Ee);let De;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,G.jsx)(P,{htmlFor:`bitbucket-token-secret`,className:`text-xs`,children:`Bitbucket app password`}),t[66]=De):De=t[66];let Oe;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=e=>g(e.currentTarget.value),t[67]=Oe):Oe=t[67];let ke;t[68]===m?ke=t[69]:(ke=(0,G.jsx)(x,{id:`bitbucket-token-secret`,size:`sm`,type:`password`,value:m,autoComplete:`current-password`,onChange:Oe,placeholder:`Stored locally in the server secret store`}),t[68]=m,t[69]=ke);let Ae=!q,je;t[70]===L.isPending?je=t[71]:(je=L.isPending?(0,G.jsx)(M,{className:`size-3`}):null,t[70]=L.isPending,t[71]=je);let Me;t[72]!==Ae||t[73]!==je?(Me=(0,G.jsxs)(ee,{type:`submit`,size:`sm`,className:`h-7.5 shrink-0 gap-1.5 px-3 text-xs`,disabled:Ae,children:[je,`Save Token`]}),t[72]=Ae,t[73]=je,t[74]=Me):Me=t[74];let Ne;t[75]!==ke||t[76]!==Me?(Ne=(0,G.jsxs)(`div`,{className:`space-y-1.5 sm:col-span-2`,children:[De,(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[ke,Me]})]}),t[75]=ke,t[76]=Me,t[77]=Ne):Ne=t[77];let Pe;t[78]!==ue||t[79]!==Z||t[80]!==Ee||t[81]!==Ne?(Pe=(0,G.jsx)(`div`,{className:`border-t border-border/60 px-4 py-4 sm:px-5`,children:(0,G.jsxs)(`form`,{className:`grid gap-3 sm:grid-cols-[1fr_1fr] sm:items-end`,onSubmit:ue,children:[Z,Ee,Ne]})}),t[78]=ue,t[79]=Z,t[80]=Ee,t[81]=Ne,t[82]=Pe):Pe=t[82];let Fe;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=(0,G.jsx)(P,{htmlFor:`jira-token-label`,className:`text-xs`,children:`Label`}),t[83]=Fe):Fe=t[83];let Ie;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=e=>v(e.currentTarget.value),t[84]=Ie):Ie=t[84];let Le;t[85]===_?Le=t[86]:(Le=(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[Fe,(0,G.jsx)(x,{id:`jira-token-label`,size:`sm`,value:_,autoComplete:`organization`,onChange:Ie,placeholder:`Jira`})]}),t[85]=_,t[86]=Le);let Re;t[87]===Symbol.for(`react.memo_cache_sentinel`)?(Re=(0,G.jsx)(P,{htmlFor:`jira-token-email`,className:`text-xs`,children:`Email`}),t[87]=Re):Re=t[87];let ze;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(ze=e=>b(e.currentTarget.value),t[88]=ze):ze=t[88];let Be;t[89]===y?Be=t[90]:(Be=(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[Re,(0,G.jsx)(x,{id:`jira-token-email`,size:`sm`,type:`email`,value:y,autoComplete:`username`,onChange:ze,placeholder:`you@example.com`})]}),t[89]=y,t[90]=Be);let Ve;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=(0,G.jsx)(P,{htmlFor:`jira-site-url`,className:`text-xs`,children:`Jira site URL`}),t[91]=Ve):Ve=t[91];let He;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(He=e=>C(e.currentTarget.value),t[92]=He):He=t[92];let Q;t[93]===S?Q=t[94]:(Q=(0,G.jsxs)(`div`,{className:`space-y-1.5 sm:col-span-2`,children:[Ve,(0,G.jsx)(x,{id:`jira-site-url`,size:`sm`,value:S,inputMode:`url`,autoComplete:`url`,onChange:He,placeholder:`https://your-team.atlassian.net`})]}),t[93]=S,t[94]=Q);let Ue;t[95]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=(0,G.jsx)(P,{htmlFor:`jira-token-secret`,className:`text-xs`,children:`Jira API token`}),t[95]=Ue):Ue=t[95];let We;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(We=e=>T(e.currentTarget.value),t[96]=We):We=t[96];let Ge;t[97]===w?Ge=t[98]:(Ge=(0,G.jsx)(x,{id:`jira-token-secret`,size:`sm`,type:`password`,value:w,autoComplete:`current-password`,onChange:We,placeholder:`Stored locally in the server secret store`}),t[97]=w,t[98]=Ge);let Ke=!Y,qe;t[99]===V.isPending?qe=t[100]:(qe=V.isPending?(0,G.jsx)(M,{className:`size-3`}):null,t[99]=V.isPending,t[100]=qe);let Je;t[101]!==Ke||t[102]!==qe?(Je=(0,G.jsxs)(ee,{type:`submit`,size:`sm`,className:`h-7.5 shrink-0 gap-1.5 px-3 text-xs`,disabled:Ke,children:[qe,`Save Jira`]}),t[101]=Ke,t[102]=qe,t[103]=Je):Je=t[103];let Ye;t[104]!==Ge||t[105]!==Je?(Ye=(0,G.jsxs)(`div`,{className:`space-y-1.5 sm:col-span-2`,children:[Ue,(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[Ge,Je]})]}),t[104]=Ge,t[105]=Je,t[106]=Ye):Ye=t[106];let Xe;t[107]!==fe||t[108]!==Le||t[109]!==Be||t[110]!==Q||t[111]!==Ye?(Xe=(0,G.jsx)(`div`,{className:`border-t border-border/60 px-4 py-4 sm:px-5`,children:(0,G.jsxs)(`form`,{className:`grid gap-3 sm:grid-cols-[1fr_1fr] sm:items-end`,onSubmit:fe,children:[Le,Be,Q,Ye]})}),t[107]=fe,t[108]=Le,t[109]=Be,t[110]=Q,t[111]=Ye,t[112]=Xe):Xe=t[112];let Ze;t[113]!==me||t[114]!==ae||t[115]!==pe?(Ze=me?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-4 text-xs text-muted-foreground sm:px-5`,children:[(0,G.jsx)(M,{className:`size-3.5`}),`Loading Atlassian connections`]}):pe.length===0?(0,G.jsx)(`div`,{className:`px-4 py-4 text-xs leading-relaxed text-muted-foreground sm:px-5`,children:`No Atlassian connections are stored yet. Add Bitbucket and Jira tokens to enable repository PRs, diffs, and work-item links.`}):pe.map(e=>(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 border-t border-border/60 px-4 py-3.5 first:border-t-0 sm:flex-row sm:items-center sm:justify-between sm:px-5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,G.jsx)(_e,{products:e.products,className:`size-4 text-foreground/80`}),(0,G.jsx)(`h3`,{className:`truncate text-[13px] font-semibold text-foreground`,children:e.label}),(0,G.jsx)(ne,{variant:he(e.status),size:`sm`,children:e.status.replace(`_`,` `)}),(0,G.jsx)(ne,{variant:`outline`,size:`sm`,children:ge(e.kind)})]}),(0,G.jsxs)(`p`,{className:`flex min-w-0 flex-wrap gap-x-1 text-xs text-muted-foreground`,children:[e.accountEmail?(0,G.jsx)(le,{account:e.accountEmail}):(0,G.jsx)(`span`,{children:`No account email saved`}),(0,G.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,G.jsx)(`span`,{children:e.capabilities.join(`, `)})]})]}),(0,G.jsx)(ee,{type:`button`,size:`icon-xs`,variant:`ghost`,className:`size-7 self-start text-muted-foreground hover:text-destructive sm:self-auto`,"aria-label":`Delete ${e.label}`,disabled:ae.isPending||e.readonly,onClick:()=>ae.mutate(e),children:(0,G.jsx)(h,{className:`size-3.5`})})]},e.connectionId)),t[113]=me,t[114]=ae,t[115]=pe,t[116]=Ze):Ze=t[116];let $;t[117]===Ze?$=t[118]:($=(0,G.jsx)(`div`,{className:`border-t border-border/60`,children:Ze}),t[117]=Ze,t[118]=$);let Qe;return t[119]!==Pe||t[120]!==Xe||t[121]!==$?(Qe=(0,G.jsxs)(G.Fragment,{children:[ve,Pe,Xe,$]}),t[119]=Pe,t[120]=Xe,t[121]=$,t[122]=Qe):Qe=t[122],Qe}function ye(e){f.add(A({type:`error`,title:`Could not delete Atlassian connection`,description:e instanceof Error?e.message:`The connection was not changed.`}))}function be(e){f.add(A({type:`error`,title:`Could not save Jira token`,description:e instanceof Error?e.message:`The token could not be saved.`}))}function xe(e){f.add(A({type:`error`,title:`Could not save Bitbucket token`,description:e instanceof Error?e.message:`The token could not be saved.`}))}function Se(){let e=(0,U.c)(41),t=c(),n=u(),r=t?.environmentId??n,i;e[0]===r?i=e[1]:(i={environmentId:r},e[0]=r,e[1]=i);let s=o(i),l=s.data??K,d=s.isPending&&s.data===null,f;e[2]===r?f=e[3]:(f=()=>{a({environmentId:r})},e[2]=r,e[3]=f);let p=f,h=s.isPending,b=s.isPending&&`animate-spin`,x;e[4]===b?x=e[5]:(x=g(`size-3`,b),e[4]=b,e[5]=x);let S;e[6]===x?S=e[7]:(S=(0,G.jsx)(m,{className:x}),e[6]=x,e[7]=S);let C;e[8]!==s.isPending||e[9]!==p||e[10]!==S?(C=(0,G.jsx)(_,{render:(0,G.jsx)(ee,{size:`icon-xs`,variant:`ghost`,className:`size-5 rounded-sm p-0 text-muted-foreground hover:text-foreground`,onClick:p,disabled:h,"aria-label":`Rescan server environment`,children:S})}),e[8]=s.isPending,e[9]=p,e[10]=S,e[11]=C):C=e[11];let T;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,G.jsx)(v,{side:`top`,children:`Rescan Git and hosting integrations`}),e[12]=T):T=e[12];let E;e[13]===C?E=e[14]:(E=(0,G.jsxs)(y,{children:[C,T]}),e[13]=C,e[14]=E);let D=E;if(d){let t;e[15]===D?t=e[16]:(t=(0,G.jsx)(pe,{title:`Version Control`,headerAction:D}),e[15]=D,e[16]=t);let n;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,G.jsx)(pe,{title:`Source Control Providers`}),e[17]=n):n=e[17];let r;return e[18]===t?r=e[19]:(r=(0,G.jsxs)(V,{children:[t,n]}),e[18]=t,e[19]=r),r}let O=l.versionControlSystems.length>0,k=l.sourceControlProviders.length>0,A=O||k,j;e[20]!==s.isPending||e[21]!==r||e[22]!==p||e[23]!==A?(j=A?null:(0,G.jsxs)(B,{title:`Source Control Providers`,children:[(0,G.jsxs)(z,{className:`min-h-56 border-t border-border/60 first:border-t-0`,children:[(0,G.jsxs)(I,{children:[(0,G.jsx)(F,{variant:`icon`,children:(0,G.jsx)(w,{className:`size-4`})}),(0,G.jsx)(L,{children:`Nothing detected yet`}),(0,G.jsx)(R,{children:`Install Git on the server, add optional hosting integrations or credentials your workspace needs, then rescan.`})]}),(0,G.jsx)(re,{children:(0,G.jsxs)(ee,{type:`button`,size:`xs`,onClick:p,disabled:s.isPending,children:[(0,G.jsx)(m,{className:g(`size-3`,s.isPending&&`animate-spin`)}),`Scan`]})})]}),(0,G.jsx)(ve,{environmentId:r})]}),e[20]=s.isPending,e[21]=r,e[22]=p,e[23]=A,e[24]=j):j=e[24];let M;e[25]!==O||e[26]!==l.versionControlSystems||e[27]!==D?(M=O?(0,G.jsx)(B,{title:`Version Control`,headerAction:D,children:l.versionControlSystems.map(Z)}):null,e[25]=O,e[26]=l.versionControlSystems,e[27]=D,e[28]=M):M=e[28];let N;e[29]!==s.error||e[30]!==r||e[31]!==A||e[32]!==k||e[33]!==O||e[34]!==l.sourceControlProviders||e[35]!==D?(N=A?(0,G.jsxs)(B,{title:`Source Control Providers`,headerAction:O?null:D,children:[k?l.sourceControlProviders.map(Ce):(0,G.jsx)(`div`,{className:`border-t border-border/60 px-4 py-3.5 first:border-t-0 sm:px-5`,children:(0,G.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:s.error??`No source control providers were detected on the server. Install a CLI like git, gh, glab, or az on the server host, then rescan.`})}),(0,G.jsx)(ve,{environmentId:r})]}):null,e[29]=s.error,e[30]=r,e[31]=A,e[32]=k,e[33]=O,e[34]=l.sourceControlProviders,e[35]=D,e[36]=N):N=e[36];let te;return e[37]!==M||e[38]!==N||e[39]!==j?(te=(0,G.jsxs)(V,{children:[j,M,N]}),e[37]=M,e[38]=N,e[39]=j,e[40]=te):te=e[40],te}function Ce(e){return(0,G.jsx)(X,{item:e},`provider:${e.kind}`)}function Z(e){return(0,G.jsx)(X,{item:e},`vcs:${e.kind}`)}export{Se as SourceControlSettingsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,t}from"./react-SIfiwpqq.js";import{t as n}from"./compiler-runtime-qmuS0Svy.js";import{t as r}from"./src-Vf4LVnMX.js";import{l as i,v as a}from"./runtime-DKwoXpJv.js";import{n as o}from"./primary-OskAInOO.js";import{It as s}from"./composerDraftStore-CdJJZe42.js";import{f as c}from"./useRenderElement-DchFnsR8.js";import{t as l}from"./activity-1CkdQG5u.js";import{A as u,C as d,D as f,E as p,F as m,I as h,L as g,M as _,O as v,P as y,R as b,S as x,T as S,_ as C,c as w,d as T,f as E,g as D,h as ee,j as O,m as k,o as A,p as j,r as M,s as N,t as P,v as F,w as I,x as L}from"./useStatistics-DEtKeVPP.js";import{t as R}from"./chart-column-Dw6ACmXM.js";import{t as z}from"./circle-alert-BWvs6IOn.js";import{t as B}from"./clock-3-r12DkpRj.js";import{n as V,t as te}from"./layers-BYi0v17h.js";import{t as H}from"./git-pull-request-DIYyPsg5.js";import{t as ne}from"./messages-square-DiMgWzoq.js";import{t as U}from"./refresh-cw-DopCMrtR.js";import{t as re}from"./shield-alert-DY9uVP5G.js";import{t as ie}from"./sparkles-CAf3oJ5S.js";import{t as ae}from"./triangle-alert-RL_T3KLo.js";import{t as oe}from"./wrench-D0IetWa1.js";import{t as W}from"./utils-BofFIn5Y.js";import{t as se}from"./scroll-area-Drsa8bNB.js";import{t as G}from"./button-BAbJxRzt.js";import{t as ce}from"./capabilities-BQuqC7jg.js";import{o as le}from"./sidebar-Dm6l2GA6.js";import{a as ue,i as de,o as fe,s as pe,t as me}from"./select-BYbVr-yg.js";import{t as he}from"./badge-CXw6fWrB.js";var ge=c(`brain-circuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),_e=c(`circle-dollar-sign`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8`,key:`1h4pet`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}]]),ve=c(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),K=n(),q=s();function ye(e){let t=(0,K.c)(56),{search:n,onSearchChange:r}=e,{snapshot:i,loading:a,error:s,refresh:c,refreshing:u}=P(),f=n.projectId??null,p=n.model??null,m=n.modelProvider??null,h;t[0]!==n.range||t[1]!==f||t[2]!==p||t[3]!==m?(h={range:n.range,projectId:f,model:p,provider:m},t[0]=n.range,t[1]=f,t[2]=p,t[3]=m,t[4]=h):h=t[4];let g=h,_;bb0:{if(!i){_=null;break bb0}let e,n,r,a;if(t[5]!==g||t[6]!==i){let o=w(i,g),s=T(o);e=o,n=s,r=N(i,o,g.range),a=M(o,A(i)),t[5]=g,t[6]=i,t[7]=e,t[8]=n,t[9]=r,t[10]=a}else e=t[7],n=t[8],r=t[9],a=t[10];let o;t[11]!==e||t[12]!==n||t[13]!==r||t[14]!==a?(o={buckets:e,totals:n,days:r,projects:a},t[11]=e,t[12]=n,t[13]=r,t[14]=a,t[15]=o):o=t[15],_=o}let y=_;if(a&&!i){let e;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,q.jsx)(ee,{}),t[16]=e):e=t[16],e}if(s&&!i){let e;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,q.jsx)(U,{}),t[17]=e):e=t[17];let n;t[18]===c?n=t[19]:(n=(0,q.jsxs)(G,{size:`sm`,variant:`outline`,onClick:c,children:[e,` Try again`]}),t[18]=c,t[19]=n);let r;return t[20]!==s||t[21]!==n?(r=(0,q.jsx)(D,{icon:ae,title:`Couldn’t load Ryco activity`,description:s,action:n}),t[20]=s,t[21]=n,t[22]=r):r=t[22],r}if(!i||!y)return null;let{totals:b,days:x,projects:S}=y,O=o()?.label??`Current environment`,R;if(t[23]!==x||t[24]!==g||t[25]!==r||t[26]!==S||t[27]!==c||t[28]!==u||t[29]!==n||t[30]!==i.dailyBuckets.length||t[31]!==i.models||t[32]!==i.projects||t[33]!==i.recentPullRequests||t[34]!==i.worktrees||t[35]!==b){let e=xe(x,n.activityMetric),a;t[37]!==r||t[38]!==n?(a=e=>r({...n,range:e.range,projectId:e.projectId??void 0,model:e.model??void 0,modelProvider:e.provider??void 0}),t[37]=r,t[38]=n,t[39]=a):a=t[39];let o;t[40]!==g||t[41]!==i.models||t[42]!==i.projects||t[43]!==a?(o=(0,q.jsx)(E,{filter:g,projects:i.projects,models:i.models,onChange:a}),t[40]=g,t[41]=i.models,t[42]=i.projects,t[43]=a,t[44]=o):o=t[44];let s=u?`animate-spin`:void 0,f;t[45]===s?f=t[46]:(f=(0,q.jsx)(U,{className:s}),t[45]=s,t[46]=f);let p=u?`Refreshing`:`Refresh`,m;t[47]!==c||t[48]!==u||t[49]!==f||t[50]!==p?(m=(0,q.jsxs)(G,{size:`sm`,variant:`outline`,onClick:c,disabled:u,children:[f,p]}),t[47]=c,t[48]=u,t[49]=f,t[50]=p,t[51]=m):m=t[51];let h;t[52]!==m||t[53]!==o?(h=(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[o,m]}),t[52]=m,t[53]=o,t[54]=h):h=t[54];let _;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,q.jsxs)(`p`,{className:`max-w-4xl text-sm leading-relaxed text-muted-foreground`,children:[`Activity includes work observed by Ryco on`,` `,(0,q.jsx)(`span`,{className:`font-medium text-foreground`,children:O}),`. Usage from other CLI sessions appears in the Usage tab and is not assigned to projects.`]}),t[55]=_):_=t[55],R=(0,q.jsxs)(`div`,{className:`space-y-8`,children:[h,_,i.dailyBuckets.length===0?(0,q.jsx)(D,{icon:l,title:`No Ryco activity yet`,description:`Project and agent activity will appear here after your first completed turns.`}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-3 xl:grid-cols-5`,children:[(0,q.jsx)(k,{label:`Active time`,icon:B,value:d(b.activeMs),sub:`${v(b.totalTokens)} observed tokens`}),(0,q.jsx)(k,{label:`Turns`,icon:l,value:I(b.turns),sub:`Completed agent turns`}),(0,q.jsx)(k,{label:`Chats`,icon:ne,value:I(b.threadsCreated),sub:`Conversations started`}),(0,q.jsx)(k,{label:`Tool uses`,icon:oe,value:I(b.toolUses),sub:`Observed invocations`}),(0,q.jsx)(k,{label:`Files changed`,icon:V,value:I(b.filesChanged),sub:`+${I(b.additions)} / −${I(b.deletions)} lines`})]}),(0,q.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[1.2fr_0.8fr]`,children:[(0,q.jsxs)(j,{title:`Activity rhythm`,icon:l,bodyClassName:`p-5`,action:(0,q.jsx)(Se,{search:n,onSearchChange:r}),children:[(0,q.jsx)(L,{points:x,metric:n.activityMetric}),(0,q.jsxs)(`div`,{className:`mt-5 grid grid-cols-3 gap-3 border-t border-border/60 pt-4`,children:[(0,q.jsx)(Y,{label:`Active days`,value:I(e.activeDays)}),(0,q.jsx)(Y,{label:`Current streak`,value:`${I(e.currentStreak)}d`}),(0,q.jsx)(Y,{label:`Busiest UTC day`,value:e.busiestLabel})]})]}),(0,q.jsx)(j,{title:`Projects`,icon:l,bodyClassName:`p-4`,children:(0,q.jsx)(F,{data:S,metric:n.activityMetric})})]}),(0,q.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,q.jsxs)(j,{title:`Code changes`,icon:V,bodyClassName:`p-4`,children:[(0,q.jsxs)(`div`,{className:`mb-4 flex gap-6 text-sm`,children:[(0,q.jsx)(Y,{label:`Files`,value:I(b.filesChanged)}),(0,q.jsx)(Y,{label:`Added`,value:`+${I(b.additions)}`,tone:`positive`}),(0,q.jsx)(Y,{label:`Removed`,value:`−${I(b.deletions)}`,tone:`negative`})]}),(0,q.jsx)(C,{data:x})]}),(0,q.jsxs)(j,{title:`Source control · all time`,icon:H,bodyClassName:`overflow-hidden`,children:[(0,q.jsxs)(`div`,{className:`grid grid-cols-4 gap-3 border-b border-border/60 px-4 py-4`,children:[(0,q.jsx)(Y,{label:`Active`,value:I(i.worktrees.active)}),(0,q.jsx)(Y,{label:`Created`,value:I(i.worktrees.created)}),(0,q.jsx)(Y,{label:`Archived`,value:I(i.worktrees.archived)}),(0,q.jsx)(Y,{label:`Open PRs`,value:I(i.worktrees.openPrs)})]}),i.recentPullRequests.length===0?(0,q.jsx)(`div`,{className:`flex h-[260px] items-center justify-center px-6 text-center text-xs text-muted-foreground`,children:`No projected pull requests yet.`}):(0,q.jsx)(`div`,{className:`divide-y divide-border/60`,children:i.recentPullRequests.slice(0,6).map(be)})]})]})]})]}),t[23]=x,t[24]=g,t[25]=r,t[26]=S,t[27]=c,t[28]=u,t[29]=n,t[30]=i.dailyBuckets.length,t[31]=i.models,t[32]=i.projects,t[33]=i.recentPullRequests,t[34]=i.worktrees,t[35]=b,t[36]=R}else R=t[36];return R}function be(e){return(0,q.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3.5`,children:[(0,q.jsx)(`div`,{className:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground`,children:(0,q.jsx)(H,{className:`size-4`})}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`p`,{className:`truncate text-sm font-medium`,children:e.prTitle||e.worktreeTitle||e.branch}),(0,q.jsxs)(`p`,{className:`mt-0.5 truncate text-[11px] text-muted-foreground`,children:[e.projectTitle,` · #`,e.prNumber,` ·`,` `,f(e.updatedAt)]})]}),(0,q.jsx)(he,{variant:e.prState===`merged`?`success`:e.active?`info`:`secondary`,children:e.prIsDraft?`Draft`:e.prState??(e.active?`Open`:`Archived`)})]},e.worktreeId)}function J(e,t){return t===`turns`?e.turns:t===`activeMs`?e.activeMs:e.filesChanged}function xe(e,t){let n=0,r=0,i=null;for(let r of e){let e=J(r,t);e>0&&(n+=1),(i===null||e>J(i,t))&&(i=r)}for(let n=e.length-1;n>=0;--n){let i=e[n];if(i===void 0||J(i,t)<=0)break;r+=1}if(i===null||J(i,t)<=0)return{activeDays:n,currentStreak:r,busiestLabel:`—`};let a=J(i,t),o=t===`activeMs`?d(a):I(a);return{activeDays:n,currentStreak:r,busiestLabel:`${i.date.slice(5)} · ${o}`}}function Se(e){let t=(0,K.c)(4),{search:n,onSearchChange:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=[`turns`,`activeMs`,`files`],t[0]=i):i=t[0];let a;return t[1]!==r||t[2]!==n?(a=(0,q.jsx)(`div`,{className:`inline-flex rounded-md bg-muted p-0.5`,children:i.map(e=>(0,q.jsx)(`button`,{type:`button`,onClick:()=>r({...n,activityMetric:e}),className:W(`h-6 rounded-sm px-2 text-[11px]`,n.activityMetric===e?`bg-background text-foreground shadow-xs`:`text-muted-foreground`),children:e===`activeMs`?`Time`:e===`files`?`Files`:`Turns`},e))}),t[1]=r,t[2]=n,t[3]=a):a=t[3],a}function Y(e){let t=(0,K.c)(10),{label:n,value:r,tone:i}=e,a;t[0]===n?a=t[1]:(a=(0,q.jsx)(`p`,{className:`text-[10px] tracking-[0.08em] text-muted-foreground uppercase`,children:n}),t[0]=n,t[1]=a);let o=i===`positive`?`text-success-foreground`:i===`negative`?`text-destructive`:`text-foreground`,s;t[2]===o?s=t[3]:(s=W(`mt-1 font-semibold tabular-nums`,o),t[2]=o,t[3]=s);let c;t[4]!==s||t[5]!==r?(c=(0,q.jsx)(`p`,{className:s,children:r}),t[4]=s,t[5]=r,t[6]=c):c=t[6];let l;return t[7]!==a||t[8]!==c?(l=(0,q.jsxs)(`div`,{children:[a,c]}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function Ce(e){switch(e){case`complete`:return 4;case`partial`:return 3;case`not-found`:return 2;case`failed`:return 1}}function we(e,t){return Ce(t.source.status)-Ce(e.source.status)||t.source.scanFinishedAt.localeCompare(e.source.scanFinishedAt)||t.environment.summary.generatedAt.localeCompare(e.environment.summary.generatedAt)||e.environment.environmentId.localeCompare(t.environment.environmentId)}function Te(e,t){return{uncachedInputTokens:e.uncachedInputTokens+t.uncachedInputTokens,cachedInputTokens:e.cachedInputTokens+t.cachedInputTokens,cacheCreationInputTokens:e.cacheCreationInputTokens+t.cacheCreationInputTokens,outputTokens:e.outputTokens+t.outputTokens,reasoningTokens:e.reasoningTokens+t.reasoningTokens,totalTokens:e.totalTokens+t.totalTokens}}function Ee(e,t){if(e.size===0||e.size===1&&e.has(`unpriced`))return`unpriced`;let n=new Set([...e].filter(e=>e!==`unpriced`));return t>0||n.size!==1||e.has(`mixed`)?`mixed`:n.values().next().value??`unpriced`}function De(e){let t=e.filter(e=>e.summary!==void 0&&e.summary.contractVersion===1&&(e.status===`complete`||e.status===`partial`));if(t.length===0)return null;let n=t.flatMap(e=>e.summary.sources.map(t=>({environment:e,source:t}))).toSorted(we),r=new Set,i=new Set,a=[],o=0,s=!1;for(let e of n){let t=`${e.environment.environmentId}\0${e.source.sourceId}`,n=e.source.deduplicationKind===`physical`,c=n&&r.has(e.source.sourceId);n&&!c&&r.add(e.source.sourceId),n||(s=!0),c?o+=1:i.add(t),a.push({...e.source,environmentId:e.environment.environmentId,environmentLabel:e.environment.label,included:!c,...c?{exclusionReason:`duplicate`}:{}})}let c=new Map;for(let e of t)for(let t of e.summary.buckets){let n=`${e.environmentId}\0${t.sourceId}`;if(!i.has(n))continue;let r=`${t.date}\0${t.provider}\0${t.model}`,a=c.get(r);a===void 0&&(a={date:t.date,provider:t.provider,model:t.model,...t.rawModel===void 0?{}:{rawModel:t.rawModel},tokens:{uncachedInputTokens:0,cachedInputTokens:0,cacheCreationInputTokens:0,outputTokens:0,reasoningTokens:0,totalTokens:0},responseCount:0,sessionCount:0,estimatedCostUsd:0,estimatedCacheSavingsUsd:0,hasCost:!1,hasCacheSavings:!1,pricedTokenCount:0,unpricedTokenCount:0,costSources:new Set,sourceIds:new Set},c.set(r,a)),a.tokens=Te(a.tokens,t.tokens),a.responseCount+=t.responseCount,a.sessionCount+=t.sessionCount,t.estimatedCostUsd!==void 0&&(a.estimatedCostUsd+=t.estimatedCostUsd,a.hasCost=!0),t.estimatedCacheSavingsUsd!==void 0&&(a.estimatedCacheSavingsUsd+=t.estimatedCacheSavingsUsd,a.hasCacheSavings=!0),a.pricedTokenCount+=t.pricedTokenCount,a.unpricedTokenCount+=t.unpricedTokenCount,a.costSources.add(t.costSource),a.sourceIds.add(t.sourceId)}let l=[...c.values()].map(e=>Object.assign({date:e.date,provider:e.provider,model:e.model,tokens:e.tokens,responseCount:e.responseCount,sessionCount:e.sessionCount,pricedTokenCount:e.pricedTokenCount,unpricedTokenCount:e.unpricedTokenCount,costSource:Ee(e.costSources,e.unpricedTokenCount),sourceIds:[...e.sourceIds].toSorted()},e.rawModel===void 0?{}:{rawModel:e.rawModel},e.hasCost?{estimatedCostUsd:e.estimatedCostUsd}:{},e.hasCacheSavings?{estimatedCacheSavingsUsd:e.estimatedCacheSavingsUsd}:{})).toSorted((e,t)=>e.date.localeCompare(t.date)||e.provider.localeCompare(t.provider)||e.model.localeCompare(t.model)),u=t[0]?.summary;return u?{...u.startDate===void 0?{}:{startDate:u.startDate},endDate:u.endDate,timeZone:u.timeZone,buckets:l,sources:a.toSorted((e,t)=>Number(t.included)-Number(e.included)||e.provider.localeCompare(t.provider)||e.environmentLabel.localeCompare(t.environmentLabel)),environments:e,duplicateSourceCount:o,environmentOnlyDeduplicationWarning:s}:null}var Oe=class{#e=0;next(){return this.#e+=1,this.#e}isCurrent(e){return e===this.#e}},X=e(t(),1),ke={"7d":7,"30d":30,"90d":90,all:null};function Ae(e,t){return new Intl.DateTimeFormat(`en-CA`,{timeZone:t,year:`numeric`,month:`2-digit`,day:`2-digit`}).format(new Date(e))}function je(e,t,n=Date.now()){let r=Ae(n,t),i=ke[e];return i===null?{endDate:r,timeZone:t,contractVersion:1}:{startDate:Ae(Date.parse(`${r}T12:00:00.000Z`)-(i-1)*864e5,`UTC`),endDate:r,timeZone:t,contractVersion:1}}function Me(){let e=(0,K.c)(3),[t,n]=(0,X.useState)(0),r,o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>a(()=>n(Ne)),o=[],e[0]=r,e[1]=o):(r=e[0],o=e[1]),(0,X.useEffect)(r,o);let s;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=i(),e[2]=s):s=e[2],s}function Ne(e){return e+1}function Pe(e){let t=Me(),n=(0,X.useMemo)(()=>t.map(e=>({environmentId:e.environmentId,label:e.knownEnvironment.label})).toSorted((e,t)=>e.label.localeCompare(t.label)),[t]),r=(0,X.useMemo)(()=>{if(e.environmentIds===void 0||e.environmentIds.length===0)return t;let n=new Set(e.environmentIds);return t.filter(e=>n.has(e.environmentId))},[t,e.environmentIds]),i=Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`,[a,o]=(0,X.useState)(0),[s,c]=(0,X.useState)(null),[l,u]=(0,X.useState)([]),[d,f]=(0,X.useState)(!0),p=(0,X.useRef)(new Oe),m=r.map(e=>e.environmentId).toSorted().join(`\0`);(0,X.useEffect)(()=>{let t=p.current.next(),n=je(e.range,i);f(!0),Promise.all(r.map(async e=>{try{let t=await e.client.server.getUsageSummary(n);if(t.contractVersion!==1)return{environmentId:e.environmentId,label:e.knownEnvironment.label,status:`stale-contract`,message:`This environment uses an incompatible usage contract.`};let r=t.sources.some(e=>e.status===`partial`||e.status===`failed`);return{environmentId:e.environmentId,label:e.knownEnvironment.label,status:r?`partial`:`complete`,summary:t}}catch(t){return{environmentId:e.environmentId,label:e.knownEnvironment.label,status:`failed`,message:t instanceof Error?t.message:String(t)}}})).then(e=>{p.current.isCurrent(t)&&(u(e),c(De(e)),f(!1))})},[e.range,a,r,m,i]);let h=(0,X.useCallback)(()=>o(e=>e+1),[]);return{merged:s,environments:l,availableEnvironments:n,loading:d,refreshing:d&&s!==null,refresh:h}}function Fe(e,t){if(t===void 0||t.length===0)return e.buckets;let n=new Set(t);return e.buckets.filter(e=>n.has(e.provider))}function Ie(e,t){let n=0,r=0,i=0,a=0,o=0,s=0,c=0,l=0,u=0,d=!1,f=!1,p=0,m=0;for(let e of t)n+=e.tokens.totalTokens,r+=e.tokens.uncachedInputTokens,i+=e.tokens.cachedInputTokens,a+=e.tokens.cacheCreationInputTokens,o+=e.tokens.outputTokens,s+=e.tokens.reasoningTokens,c+=e.responseCount,p+=e.pricedTokenCount,m+=e.unpricedTokenCount,e.estimatedCostUsd!==void 0&&(l+=e.estimatedCostUsd,d=!0),e.estimatedCacheSavingsUsd!==void 0&&(u+=e.estimatedCacheSavingsUsd,f=!0);let h=new Set(t.map(e=>e.provider)),g=e.sources.filter(e=>e.included&&h.has(e.provider)&&e.status!==`not-found`&&e.status!==`failed`).reduce((e,t)=>e+t.distinctSessionCount,0);return{totalTokens:n,uncachedInputTokens:r,cachedInputTokens:i,cacheCreationInputTokens:a,outputTokens:o,reasoningTokens:s,responseCount:c,distinctSessionCount:g,estimatedCostUsd:d?l:null,estimatedCacheSavingsUsd:f?u:null,pricedTokenCount:p,unpricedTokenCount:m}}function Le(e,t){return new Date(Date.parse(`${e}T12:00:00.000Z`)+t*864e5).toISOString().slice(0,10)}function Re(e,t){let n=new Map;for(let e of t){let t=n.get(e.date)??{date:e.date,claudeCost:0,codexCost:0,claudeTokens:0,codexTokens:0};n.set(e.date,{...t,...e.provider===`claude`?{claudeCost:t.claudeCost+(e.estimatedCostUsd??0),claudeTokens:t.claudeTokens+e.tokens.totalTokens}:{codexCost:t.codexCost+(e.estimatedCostUsd??0),codexTokens:t.codexTokens+e.tokens.totalTokens}})}let r=e.startDate??[...n.keys()].toSorted((e,t)=>e.localeCompare(t))[0];if(r===void 0)return[];let i=[];for(let t=r;t<=e.endDate;t=Le(t,1))i.push(n.get(t)??{date:t,claudeCost:0,codexCost:0,claudeTokens:0,codexTokens:0});return i}function ze(e,t){let n=new Map;for(let r of e){let e=t===`model`?`${r.provider}\0${r.model}`:r.date,i=n.get(e)??{key:e,label:t===`model`?r.model:r.date,...t===`model`?{provider:r.provider}:{},tokens:0,costUsd:null,unpricedTokens:0,responses:0};n.set(e,{...i,tokens:i.tokens+r.tokens.totalTokens,costUsd:r.estimatedCostUsd===void 0?i.costUsd:(i.costUsd??0)+r.estimatedCostUsd,unpricedTokens:i.unpricedTokens+r.unpricedTokenCount,responses:i.responses+r.responseCount})}let r=[...n.values()].some(e=>e.costUsd!==null);return[...n.values()].toSorted((e,t)=>r&&(t.costUsd??-1)-(e.costUsd??-1)||t.tokens-e.tokens)}var Be=new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:2}),Z={claude:`#d97757`,codex:`var(--foreground)`};function Ve(e){return e===null?`Unavailable`:Be.format(e)}function He(e){let t=(0,K.c)(90),{search:n,onSearchChange:r}=e,i;t[0]!==n.environmentIds||t[1]!==n.range?(i={range:n.range,environmentIds:n.environmentIds},t[0]=n.environmentIds,t[1]=n.range,t[2]=i):i=t[2];let a=Pe(i),{merged:o}=a,s;bb0:{if(!o){s=null;break bb0}let e,r,i,a;if(t[3]!==o||t[4]!==n.providers||t[5]!==n.usageBreakdown){let s=Fe(o,n.providers);e=s,r=Ie(o,s),i=Re(o,s),a=ze(s,n.usageBreakdown),t[3]=o,t[4]=n.providers,t[5]=n.usageBreakdown,t[6]=e,t[7]=r,t[8]=i,t[9]=a}else e=t[6],r=t[7],i=t[8],a=t[9];let c;t[10]!==e||t[11]!==r||t[12]!==i||t[13]!==a?(c={buckets:e,totals:r,days:i,breakdown:a},t[10]=e,t[11]=r,t[12]=i,t[13]=a,t[14]=c):c=t[14],s=c}let c=s;if(a.loading&&!o){let e;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,q.jsx)(ee,{}),t[15]=e):e=t[15],e}if(!o||!c){let e,n,r,i;if(t[16]!==a.environments){let o=a.environments.filter(Ke);e=D,n=o.length>0?z:ve,r=o.length>0?`Couldn’t load usage`:`No usage environments are connected`,i=o.length>0?`Usage failed for ${o.map(Ge).join(`, `)}. ${o[0]?.message??`Retry after checking the environment connection.`}`:`Connect an environment with Claude Code or Codex transcripts, then refresh this view.`,t[16]=a.environments,t[17]=e,t[18]=n,t[19]=r,t[20]=i}else e=t[17],n=t[18],r=t[19],i=t[20];let o;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,q.jsx)(U,{}),t[21]=o):o=t[21];let s;t[22]===a.refresh?s=t[23]:(s=(0,q.jsxs)(G,{size:`sm`,variant:`outline`,onClick:a.refresh,children:[o,` Refresh`]}),t[22]=a.refresh,t[23]=s);let c;return t[24]!==e||t[25]!==n||t[26]!==r||t[27]!==i||t[28]!==s?(c=(0,q.jsx)(e,{icon:n,title:r,description:i,action:s}),t[24]=e,t[25]=n,t[26]=r,t[27]=i,t[28]=s,t[29]=c):c=t[29],c}let{totals:l,days:u,breakdown:d}=c,f=l.pricedTokenCount+l.unpricedTokenCount>0?l.pricedTokenCount/(l.pricedTokenCount+l.unpricedTokenCount):0,m=l.uncachedInputTokens+l.cachedInputTokens+l.cacheCreationInputTokens>0?l.cachedInputTokens/(l.uncachedInputTokens+l.cachedInputTokens+l.cacheCreationInputTokens):0,h=n.environmentIds===void 0||n.environmentIds?.length!==1?`all`:n.environmentIds[0],g;t[30]===o.sources?g=t[31]:(g=o.sources.some(We),t[30]=o.sources,t[31]=g);let _=g,y;t[32]!==r||t[33]!==n?(y=(0,q.jsx)(qe,{search:n,onSearchChange:r}),t[32]=r,t[33]=n,t[34]=y):y=t[34];let b;t[35]!==r||t[36]!==n?(b=e=>r({...n,...e===null||e===`all`?{environmentIds:void 0}:{environmentIds:[e]}}),t[35]=r,t[36]=n,t[37]=b):b=t[37];let C;t[38]!==a.availableEnvironments||t[39]!==h?(C=h===`all`?`All environments (${a.availableEnvironments.length})`:a.availableEnvironments.find(e=>e.environmentId===h)?.label??`Environment`,t[38]=a.availableEnvironments,t[39]=h,t[40]=C):C=t[40];let w;t[41]===C?w=t[42]:(w=(0,q.jsx)(fe,{size:`sm`,className:`w-48`,"aria-label":`Usage environment`,children:(0,q.jsx)(pe,{children:C})}),t[41]=C,t[42]=w);let T;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,q.jsx)(de,{value:`all`,children:`All environments`}),t[43]=T):T=t[43];let E;t[44]===a.availableEnvironments?E=t[45]:(E=a.availableEnvironments.map(Ue),t[44]=a.availableEnvironments,t[45]=E);let O;t[46]===E?O=t[47]:(O=(0,q.jsxs)(ue,{alignItemWithTrigger:!1,children:[T,E]}),t[46]=E,t[47]=O);let k;t[48]!==h||t[49]!==O||t[50]!==b||t[51]!==w?(k=(0,q.jsxs)(me,{value:h,onValueChange:b,children:[w,O]}),t[48]=h,t[49]=O,t[50]=b,t[51]=w,t[52]=k):k=t[52];let A;t[53]!==r||t[54]!==n?(A=(0,q.jsx)(Je,{search:n,onSearchChange:r}),t[53]=r,t[54]=n,t[55]=A):A=t[55];let M;t[56]!==k||t[57]!==A||t[58]!==y?(M=(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[y,k,A]}),t[56]=k,t[57]=A,t[58]=y,t[59]=M):M=t[59];let N=a.refreshing?`animate-spin`:void 0,P;t[60]===N?P=t[61]:(P=(0,q.jsx)(U,{className:N}),t[60]=N,t[61]=P);let F=a.refreshing?`Refreshing`:`Refresh`,L;t[62]!==a.refresh||t[63]!==a.refreshing||t[64]!==P||t[65]!==F?(L=(0,q.jsxs)(G,{size:`sm`,variant:`outline`,onClick:a.refresh,disabled:a.refreshing,children:[P,F]}),t[62]=a.refresh,t[63]=a.refreshing,t[64]=P,t[65]=F,t[66]=L):L=t[66];let R;t[67]!==M||t[68]!==L?(R=(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[M,L]}),t[67]=M,t[68]=L,t[69]=R):R=t[69];let B;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,q.jsx)(`p`,{className:`max-w-3xl text-sm leading-relaxed text-muted-foreground`,children:`Provider-recorded usage from Claude Code and Codex transcripts on the selected machines. This includes sessions run outside Ryco and is intentionally not attributed to projects.`}),t[70]=B):B=t[70];let V;t[71]!==d||t[72]!==m||t[73]!==u||t[74]!==c.buckets.length||t[75]!==_||t[76]!==o||t[77]!==r||t[78]!==f||t[79]!==n||t[80]!==l.distinctSessionCount||t[81]!==l.estimatedCacheSavingsUsd||t[82]!==l.estimatedCostUsd||t[83]!==l.reasoningTokens||t[84]!==l.responseCount||t[85]!==l.totalTokens?(V=c.buckets.length===0?(0,q.jsx)(D,{icon:te,title:_?`No usage in this range`:`No transcript sources found`,description:_?`The transcript sources were found, but no provider-recorded usage matched these filters.`:`Claude Code and Codex transcript directories were not found on the selected environments.`}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`section`,{className:`grid overflow-hidden rounded-2xl border border-border/75 bg-card shadow-sm/5 lg:grid-cols-[minmax(18rem,0.72fr)_minmax(0,1.55fr)]`,children:[(0,q.jsxs)(`div`,{className:`flex min-h-80 flex-col justify-between border-b border-border/70 p-6 lg:border-r lg:border-b-0 lg:p-8`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold tracking-[0.12em] text-muted-foreground uppercase`,children:[(0,q.jsx)(_e,{className:`size-3.5`}),` Raw API-equivalent cost`]}),(0,q.jsx)(`div`,{className:`mt-5 text-4xl font-semibold tracking-[-0.045em] tabular-nums sm:text-5xl`,children:Ve(l.estimatedCostUsd)}),(0,q.jsx)(`p`,{className:`mt-3 max-w-sm text-xs leading-relaxed text-muted-foreground`,children:`Estimate based on base API rates. Subscription, credits, batch, negotiated, and provider billing may differ.`})]}),(0,q.jsxs)(`div`,{className:`space-y-4 border-t border-border/65 pt-5`,children:[(0,q.jsx)(et,{label:`Priced coverage`,value:`${Math.round(f*100)}% of tokens`}),(0,q.jsx)(et,{label:`Estimated cache savings`,value:Ve(l.estimatedCacheSavingsUsd)}),(0,q.jsx)(et,{label:`Provider-recorded tokens`,value:I(l.totalTokens)})]})]}),(0,q.jsxs)(`div`,{className:`min-w-0 p-4 sm:p-6`,children:[(0,q.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3 px-1`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Usage over time`}),(0,q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Daily values in `,o.timeZone]})]}),(0,q.jsx)(Ye,{search:n,onSearchChange:r})]}),(0,q.jsx)(Ze,{data:u,metric:n.usageMetric}),(0,q.jsxs)(`div`,{className:`flex items-center justify-end gap-4 px-2 text-[11px] text-muted-foreground`,children:[(0,q.jsx)(tt,{color:Z.claude,label:`Claude`}),(0,q.jsx)(tt,{color:Z.codex,label:`Codex`})]})]})]}),(0,q.jsxs)(`div`,{className:`grid grid-cols-2 border-y border-border/65 md:grid-cols-5`,children:[(0,q.jsx)(Q,{label:`Total tokens`,value:v(l.totalTokens)}),(0,q.jsx)(Q,{label:`Sessions`,value:I(l.distinctSessionCount)}),(0,q.jsx)(Q,{label:`Responses`,value:I(l.responseCount)}),(0,q.jsx)(Q,{label:`Cache read`,value:`${Math.round(m*100)}%`}),(0,q.jsx)(Q,{label:`Reasoning`,value:v(l.reasoningTokens),detail:`included in output`})]}),(0,q.jsx)(j,{title:`Breakdown`,icon:te,action:(0,q.jsx)(Xe,{search:n,onSearchChange:r}),bodyClassName:`overflow-hidden`,children:(0,q.jsx)(`div`,{className:`divide-y divide-border/60`,children:d.slice(0,20).map(e=>(0,q.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-5 px-4 py-3.5 sm:px-5`,children:[(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`p`,{className:`truncate text-sm font-medium`,children:n.usageBreakdown===`model`?S(e.label):x(e.label)}),(0,q.jsx)(`p`,{className:`mt-0.5 text-[11px] text-muted-foreground`,children:e.provider?p(e.provider):`${e.responses} responses`})]}),(0,q.jsxs)(`div`,{className:`text-right`,children:[(0,q.jsx)(`p`,{className:`text-sm font-medium tabular-nums`,children:v(e.tokens)}),(0,q.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`tokens`})]}),(0,q.jsxs)(`div`,{className:`w-24 text-right`,children:[(0,q.jsx)(`p`,{className:`text-sm font-medium tabular-nums`,children:Ve(e.costUsd)}),(0,q.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:e.unpricedTokens>0?`${v(e.unpricedTokens)} unpriced`:`estimated`})]})]},e.key))})}),(0,q.jsx)(nt,{summary:o})]}),t[71]=d,t[72]=m,t[73]=u,t[74]=c.buckets.length,t[75]=_,t[76]=o,t[77]=r,t[78]=f,t[79]=n,t[80]=l.distinctSessionCount,t[81]=l.estimatedCacheSavingsUsd,t[82]=l.estimatedCostUsd,t[83]=l.reasoningTokens,t[84]=l.responseCount,t[85]=l.totalTokens,t[86]=V):V=t[86];let H;return t[87]!==R||t[88]!==V?(H=(0,q.jsxs)(`div`,{className:`space-y-8`,children:[R,B,V]}),t[87]=R,t[88]=V,t[89]=H):H=t[89],H}function Ue(e){return(0,q.jsx)(de,{value:e.environmentId,children:e.label},e.environmentId)}function We(e){return e.included&&e.status!==`not-found`}function Ge(e){return e.label}function Ke(e){return e.status===`failed`||e.status===`unavailable`||e.status===`stale-contract`}function qe(e){let t=(0,K.c)(3),{search:n,onSearchChange:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,q.jsx)(`div`,{className:`inline-flex rounded-lg border bg-card p-0.5`,children:[`7d`,`30d`,`90d`,`all`].map(e=>(0,q.jsx)(`button`,{type:`button`,onClick:()=>r({...n,range:e}),className:W(`h-7 rounded-md px-2.5 text-xs font-medium transition-colors`,n.range===e?`bg-accent text-foreground`:`text-muted-foreground hover:text-foreground`),children:e===`all`?`All`:e.toUpperCase()},e))}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function Je(e){let t=(0,K.c)(3),{search:n,onSearchChange:r}=e,i;if(t[0]!==r||t[1]!==n){let e=new Set(n.providers??[`claude`,`codex`]);i=(0,q.jsx)(`div`,{className:`inline-flex rounded-lg border bg-card p-0.5`,children:[`claude`,`codex`].map(t=>(0,q.jsxs)(`button`,{type:`button`,"aria-pressed":e.has(t),onClick:()=>{let i=new Set(e);i.has(t)&&i.size>1?i.delete(t):i.add(t);let a=[...i].toSorted();r({...n,...a.length===2?{providers:void 0}:{providers:a}})},className:W(`inline-flex h-7 items-center rounded-md px-2.5 text-xs font-medium capitalize transition-colors`,e.has(t)?`bg-accent text-foreground`:`text-muted-foreground hover:text-foreground`),children:[(0,q.jsx)(`span`,{"aria-hidden":!0,className:`mr-1.5 inline-block size-1.5 rounded-full`,style:{backgroundColor:Z[t]}}),t]},t))}),t[0]=r,t[1]=n,t[2]=i}else i=t[2];return i}function Ye(e){let t=(0,K.c)(4),{search:n,onSearchChange:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=[`cost`,`tokens`],t[0]=i):i=t[0];let a;return t[1]!==r||t[2]!==n?(a=(0,q.jsx)(`div`,{className:`inline-flex rounded-md bg-muted p-0.5`,children:i.map(e=>(0,q.jsx)(`button`,{type:`button`,onClick:()=>r({...n,usageMetric:e}),className:W(`h-6 rounded-sm px-2 text-[11px] font-medium capitalize`,n.usageMetric===e?`bg-background text-foreground shadow-xs`:`text-muted-foreground`),children:e},e))}),t[1]=r,t[2]=n,t[3]=a):a=t[3],a}function Xe(e){let t=(0,K.c)(4),{search:n,onSearchChange:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=[`model`,`day`],t[0]=i):i=t[0];let a;return t[1]!==r||t[2]!==n?(a=(0,q.jsx)(`div`,{className:`inline-flex items-center gap-1 text-[11px]`,children:i.map(e=>(0,q.jsx)(`button`,{type:`button`,onClick:()=>r({...n,usageBreakdown:e}),className:W(`rounded-md px-2 py-1 capitalize`,n.usageBreakdown===e?`bg-accent text-foreground`:`text-muted-foreground`),children:e},e))}),t[1]=r,t[2]=n,t[3]=a):a=t[3],a}function Ze(e){let t=(0,K.c)(21),{data:n,metric:r}=e,i=r===`cost`?`Cost`:`Tokens`,a;t[0]===n?a=t[1]:(a=[...n],t[0]=n,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o={left:4,right:10,top:18,bottom:0},t[2]=o):o=t[2];let s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,q.jsxs)(`linearGradient`,{id:`usageClaude`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,q.jsx)(`stop`,{offset:`5%`,stopColor:Z.claude,stopOpacity:.3}),(0,q.jsx)(`stop`,{offset:`95%`,stopColor:Z.claude,stopOpacity:.02})]}),t[3]=s):s=t[3];let c,l,d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,q.jsxs)(`defs`,{children:[s,(0,q.jsxs)(`linearGradient`,{id:`usageCodex`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,q.jsx)(`stop`,{offset:`5%`,stopColor:Z.codex,stopOpacity:.18}),(0,q.jsx)(`stop`,{offset:`95%`,stopColor:Z.codex,stopOpacity:.01})]})]}),l=(0,q.jsx)(b,{vertical:!1,strokeDasharray:`3 5`}),d=(0,q.jsx)(h,{dataKey:`date`,tickLine:!1,axisLine:!1,minTickGap:30,tickFormatter:$e}),t[4]=c,t[5]=l,t[6]=d):(c=t[4],l=t[5],d=t[6]);let f;t[7]===r?f=t[8]:(f=(0,q.jsx)(m,{tickLine:!1,axisLine:!1,width:44,tickFormatter:e=>r===`cost`?`$${Number(e).toFixed(+(Number(e)<10))}`:v(Number(e))}),t[7]=r,t[8]=f);let p;t[9]===r?p=t[10]:(p=(0,q.jsx)(O,{content:(0,q.jsx)(_,{labelFormatter:Qe,formatter:e=>r===`cost`?Be.format(Number(e)||0):I(Number(e)||0)})}),t[9]=r,t[10]=p);let x=`claude${i}`,S;t[11]===x?S=t[12]:(S=(0,q.jsx)(g,{dataKey:x,name:`Claude`,type:`monotone`,stroke:Z.claude,fill:`url(#usageClaude)`,strokeWidth:1.75}),t[11]=x,t[12]=S);let C=`codex${i}`,w;t[13]===C?w=t[14]:(w=(0,q.jsx)(g,{dataKey:C,name:`Codex`,type:`monotone`,stroke:Z.codex,fill:`url(#usageCodex)`,strokeWidth:1.75}),t[13]=C,t[14]=w);let T;return t[15]!==a||t[16]!==S||t[17]!==w||t[18]!==f||t[19]!==p?(T=(0,q.jsx)(u,{className:`h-[300px]`,children:(0,q.jsxs)(y,{data:a,margin:o,children:[c,l,d,f,p,S,w]})}),t[15]=a,t[16]=S,t[17]=w,t[18]=f,t[19]=p,t[20]=T):T=t[20],T}function Qe(e){return x(String(e))}function $e(e){return x(String(e))}function et(e){let t=(0,K.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,q.jsx)(`span`,{className:`font-medium tabular-nums`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-4 text-xs`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Q(e){let t=(0,K.c)(10),{label:n,value:r,detail:i}=e,a;t[0]===n?a=t[1]:(a=(0,q.jsx)(`p`,{className:`text-[10px] font-semibold tracking-[0.1em] text-muted-foreground uppercase`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,q.jsx)(`p`,{className:`mt-2 text-xl font-semibold tracking-tight tabular-nums`,children:r}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=i?(0,q.jsx)(`p`,{className:`mt-1 text-[10px] text-muted-foreground`,children:i}):null,t[4]=i,t[5]=s);let c;return t[6]!==a||t[7]!==o||t[8]!==s?(c=(0,q.jsxs)(`div`,{className:`border-r border-border/60 px-4 py-5 last:border-r-0`,children:[a,o,s]}),t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function tt(e){let t=(0,K.c)(5),{color:n,label:r}=e,i;t[0]===n?i=t[1]:(i=(0,q.jsx)(`span`,{className:`size-2 rounded-sm`,style:{backgroundColor:n}}),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[i,r]}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function nt(e){let t=(0,K.c)(43),{summary:n}=e,r,i,a,o,s,c,l,u,d,p,m,h,g,_;if(t[0]!==n.duplicateSourceCount||t[1]!==n.environmentOnlyDeduplicationWarning||t[2]!==n.environments||t[3]!==n.sources){let e=n.sources.filter(mt),v=e.filter(pt),y=n.environments.filter(ft),b=n.environments.flatMap(dt),x=b.length===0?`Unavailable`:b.every(ut)?`Live`:b.every(lt)?`Cached`:b.every(ct)?`Unavailable`:`Mixed`,S=n.environments.flatMap(st).toSorted().at(-1),C=e.map(ot).toSorted().at(-1);i=j,_=`Coverage & estimates`,o=ge,s=`p-5`,c=y.length>0?(0,q.jsxs)(`div`,{className:`mb-5 flex gap-2 rounded-lg border border-warning/30 bg-warning/8 px-3 py-2.5 text-xs text-muted-foreground`,children:[(0,q.jsx)(z,{className:`mt-0.5 size-3.5 shrink-0 text-warning`}),(0,q.jsxs)(`span`,{children:[`No usage was included from`,` `,y.map(at).join(`, `),`.`]})]}):null,p=`grid gap-5 md:grid-cols-2 xl:grid-cols-4`;let w=`${e.length} included`,T=n.duplicateSourceCount>0?`${n.duplicateSourceCount} duplicate source excluded`:`No physical duplicates detected`;t[18]!==w||t[19]!==T?(m=(0,q.jsx)($,{icon:ve,label:`Transcript sources`,value:w,detail:T}),t[18]=w,t[19]=T,t[20]=m):m=t[20],h=(0,q.jsx)($,{icon:ie,label:`Last scan`,value:C?f(C):`Not scanned`,detail:`${e.reduce(it,0)} cached files reused`});let E=S?`Rates fetched ${f(S)}`:`Token totals remain available without rates`;t[21]!==x||t[22]!==E?(g=(0,q.jsx)($,{icon:_e,label:`Pricing`,value:x,detail:E}),t[21]=x,t[22]=E,t[23]=g):g=t[23],r=$,a=z,l=`Coverage state`,u=v.length===0?`Complete`:`${v.length} source notice${v.length===1?``:`s`}`,d=n.environmentOnlyDeduplicationWarning?`Some sources could only be scoped per environment`:`${e.reduce(rt,0)} malformed lines skipped`,t[0]=n.duplicateSourceCount,t[1]=n.environmentOnlyDeduplicationWarning,t[2]=n.environments,t[3]=n.sources,t[4]=r,t[5]=i,t[6]=a,t[7]=o,t[8]=s,t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=p,t[14]=m,t[15]=h,t[16]=g,t[17]=_}else r=t[4],i=t[5],a=t[6],o=t[7],s=t[8],c=t[9],l=t[10],u=t[11],d=t[12],p=t[13],m=t[14],h=t[15],g=t[16],_=t[17];let v;t[24]!==r||t[25]!==a||t[26]!==l||t[27]!==u||t[28]!==d?(v=(0,q.jsx)(r,{icon:a,label:l,value:u,detail:d}),t[24]=r,t[25]=a,t[26]=l,t[27]=u,t[28]=d,t[29]=v):v=t[29];let y;t[30]!==v||t[31]!==p||t[32]!==m||t[33]!==h||t[34]!==g?(y=(0,q.jsxs)(`div`,{className:p,children:[m,h,g,v]}),t[30]=v,t[31]=p,t[32]=m,t[33]=h,t[34]=g,t[35]=y):y=t[35];let b;return t[36]!==i||t[37]!==o||t[38]!==s||t[39]!==c||t[40]!==y||t[41]!==_?(b=(0,q.jsxs)(i,{title:_,icon:o,bodyClassName:s,children:[c,y]}),t[36]=i,t[37]=o,t[38]=s,t[39]=c,t[40]=y,t[41]=_,t[42]=b):b=t[42],b}function rt(e,t){return e+t.malformedLineCount}function it(e,t){return e+t.reusedCacheFileCount}function at(e){return e.label}function ot(e){return e.scanFinishedAt}function st(e){let t=e.summary?.pricing.fetchedAt;return t===void 0?[]:[t]}function ct(e){return e===`unavailable`}function lt(e){return e===`cached`}function ut(e){return e===`live`}function dt(e){return e.summary===void 0?[]:[e.summary.pricing.state]}function ft(e){return e.status===`failed`||e.status===`unavailable`||e.status===`stale-contract`}function pt(e){return e.status!==`complete`}function mt(e){return e.included}function $(e){let t=(0,K.c)(15),{icon:n,label:r,value:i,detail:a}=e,o;t[0]===n?o=t[1]:(o=(0,q.jsx)(`div`,{className:`mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground`,children:(0,q.jsx)(n,{className:`size-4`})}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r}),t[2]=r,t[3]=s);let c;t[4]===i?c=t[5]:(c=(0,q.jsx)(`p`,{className:`mt-1 text-sm font-medium`,children:i}),t[4]=i,t[5]=c);let l;t[6]===a?l=t[7]:(l=(0,q.jsx)(`p`,{className:`mt-1 text-[11px] leading-relaxed text-muted-foreground`,children:a}),t[6]=a,t[7]=l);let u;t[8]!==s||t[9]!==c||t[10]!==l?(u=(0,q.jsxs)(`div`,{children:[s,c,l]}),t[8]=s,t[9]=c,t[10]=l,t[11]=u):u=t[11];let d;return t[12]!==o||t[13]!==u?(d=(0,q.jsxs)(`div`,{className:`flex gap-3`,children:[o,u]}),t[12]=o,t[13]=u,t[14]=d):d=t[14],d}function ht(e){let t=(0,K.c)(25),{search:n,onSearchChange:i}=e,a=n.view===`usage`?r.serverGetUsageSummary:r.serverGetStatistics,o=ce(a),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`h1`,{className:`truncate text-sm font-semibold tracking-tight`,children:`Statistics`}),(0,q.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Usage and work signals`})]}),t[0]=s):s=t[0];let c;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=[`usage`,`activity`],t[1]=c):c=t[1];let u;t[2]!==i||t[3]!==n?(u=(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-5`,children:[s,(0,q.jsx)(`div`,{className:`inline-flex rounded-lg bg-muted/75 p-0.5`,children:c.map(e=>{let t=e===`usage`?R:l;return(0,q.jsxs)(`button`,{type:`button`,onClick:()=>i({...n,view:e}),className:W(`inline-flex h-8 items-center gap-1.5 rounded-md px-3 text-xs font-medium capitalize transition-colors`,n.view===e?`bg-background text-foreground shadow-xs`:`text-muted-foreground hover:text-foreground`),children:[(0,q.jsx)(t,{className:`size-3.5`}),` `,e]},e)})})]}),t[2]=i,t[3]=n,t[4]=u):u=t[4];let d;t[5]===n.range?d=t[6]:(d=n.range===`all`?`All available history`:`Last ${n.range.slice(0,-1)} days`,t[5]=n.range,t[6]=d);let f;t[7]===d?f=t[8]:(f=(0,q.jsx)(`p`,{className:`text-xs font-medium`,children:d}),t[7]=d,t[8]=f);let p=n.view===`usage`?`Local calendar window`:`UTC activity window`,m;t[9]===p?m=t[10]:(m=(0,q.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:p}),t[9]=p,t[10]=m);let h;t[11]!==f||t[12]!==m?(h=(0,q.jsxs)(`div`,{className:`hidden text-right sm:block`,children:[f,m]}),t[11]=f,t[12]=m,t[13]=h):h=t[13];let g;t[14]!==u||t[15]!==h?(g=(0,q.jsxs)(`header`,{className:`flex min-h-14 shrink-0 items-center border-b border-border/75 bg-background/90 px-5 backdrop-blur-sm sm:px-7`,children:[u,h]}),t[14]=u,t[15]=h,t[16]=g):g=t[16];let _;t[17]!==o.allowed||t[18]!==o.reason||t[19]!==i||t[20]!==n?(_=(0,q.jsx)(se,{className:`min-h-0 flex-1`,children:(0,q.jsx)(`div`,{className:`mx-auto w-full max-w-[1480px] px-5 py-7 sm:px-8 sm:py-9 lg:px-10`,children:o.allowed?n.view===`usage`?(0,q.jsx)(He,{search:n,onSearchChange:i}):(0,q.jsx)(ye,{search:n,onSearchChange:i}):(0,q.jsx)(D,{icon:re,title:`Statistics aren’t available for this session`,description:o.reason??`Owner access is required.`})})}),t[17]=o.allowed,t[18]=o.reason,t[19]=i,t[20]=n,t[21]=_):_=t[21];let v;return t[22]!==_||t[23]!==g?(v=(0,q.jsx)(le,{className:`h-dvh min-h-0 overflow-hidden overscroll-y-none bg-background text-foreground`,children:(0,q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[g,_]})}),t[22]=_,t[23]=g,t[24]=v):v=t[24],v}export{ht as StatisticsPage};
|
|
1
|
+
import{i as e,t}from"./react-SIfiwpqq.js";import{t as n}from"./compiler-runtime-qmuS0Svy.js";import{t as r}from"./src-Vf4LVnMX.js";import{l as i,v as a}from"./runtime-CXut_g4p.js";import{n as o}from"./primary-BzLEg2w1.js";import{It as s}from"./composerDraftStore-CdJJZe42.js";import{f as c}from"./useRenderElement-DchFnsR8.js";import{t as l}from"./activity-1CkdQG5u.js";import{A as u,C as d,D as f,E as p,F as m,I as h,L as g,M as _,O as v,P as y,R as b,S as x,T as S,_ as C,c as w,d as T,f as E,g as D,h as ee,j as O,m as k,o as A,p as j,r as M,s as N,t as P,v as F,w as I,x as L}from"./useStatistics-CtunoTE-.js";import{t as R}from"./chart-column-Dw6ACmXM.js";import{t as z}from"./circle-alert-BWvs6IOn.js";import{t as B}from"./clock-3-r12DkpRj.js";import{n as V,t as te}from"./layers-BYi0v17h.js";import{t as H}from"./git-pull-request-DIYyPsg5.js";import{t as ne}from"./messages-square-DiMgWzoq.js";import{t as U}from"./refresh-cw-DopCMrtR.js";import{t as re}from"./shield-alert-DY9uVP5G.js";import{t as ie}from"./sparkles-CAf3oJ5S.js";import{t as ae}from"./triangle-alert-RL_T3KLo.js";import{t as oe}from"./wrench-D0IetWa1.js";import{t as W}from"./utils-BofFIn5Y.js";import{t as se}from"./scroll-area-Drsa8bNB.js";import{t as G}from"./button-BAbJxRzt.js";import{t as ce}from"./capabilities-3zgirmmI.js";import{o as le}from"./sidebar-Dm6l2GA6.js";import{a as ue,i as de,o as fe,s as pe,t as me}from"./select-BYbVr-yg.js";import{t as he}from"./badge-CXw6fWrB.js";var ge=c(`brain-circuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),_e=c(`circle-dollar-sign`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8`,key:`1h4pet`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}]]),ve=c(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),K=n(),q=s();function ye(e){let t=(0,K.c)(56),{search:n,onSearchChange:r}=e,{snapshot:i,loading:a,error:s,refresh:c,refreshing:u}=P(),f=n.projectId??null,p=n.model??null,m=n.modelProvider??null,h;t[0]!==n.range||t[1]!==f||t[2]!==p||t[3]!==m?(h={range:n.range,projectId:f,model:p,provider:m},t[0]=n.range,t[1]=f,t[2]=p,t[3]=m,t[4]=h):h=t[4];let g=h,_;bb0:{if(!i){_=null;break bb0}let e,n,r,a;if(t[5]!==g||t[6]!==i){let o=w(i,g),s=T(o);e=o,n=s,r=N(i,o,g.range),a=M(o,A(i)),t[5]=g,t[6]=i,t[7]=e,t[8]=n,t[9]=r,t[10]=a}else e=t[7],n=t[8],r=t[9],a=t[10];let o;t[11]!==e||t[12]!==n||t[13]!==r||t[14]!==a?(o={buckets:e,totals:n,days:r,projects:a},t[11]=e,t[12]=n,t[13]=r,t[14]=a,t[15]=o):o=t[15],_=o}let y=_;if(a&&!i){let e;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,q.jsx)(ee,{}),t[16]=e):e=t[16],e}if(s&&!i){let e;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,q.jsx)(U,{}),t[17]=e):e=t[17];let n;t[18]===c?n=t[19]:(n=(0,q.jsxs)(G,{size:`sm`,variant:`outline`,onClick:c,children:[e,` Try again`]}),t[18]=c,t[19]=n);let r;return t[20]!==s||t[21]!==n?(r=(0,q.jsx)(D,{icon:ae,title:`Couldn’t load Ryco activity`,description:s,action:n}),t[20]=s,t[21]=n,t[22]=r):r=t[22],r}if(!i||!y)return null;let{totals:b,days:x,projects:S}=y,O=o()?.label??`Current environment`,R;if(t[23]!==x||t[24]!==g||t[25]!==r||t[26]!==S||t[27]!==c||t[28]!==u||t[29]!==n||t[30]!==i.dailyBuckets.length||t[31]!==i.models||t[32]!==i.projects||t[33]!==i.recentPullRequests||t[34]!==i.worktrees||t[35]!==b){let e=xe(x,n.activityMetric),a;t[37]!==r||t[38]!==n?(a=e=>r({...n,range:e.range,projectId:e.projectId??void 0,model:e.model??void 0,modelProvider:e.provider??void 0}),t[37]=r,t[38]=n,t[39]=a):a=t[39];let o;t[40]!==g||t[41]!==i.models||t[42]!==i.projects||t[43]!==a?(o=(0,q.jsx)(E,{filter:g,projects:i.projects,models:i.models,onChange:a}),t[40]=g,t[41]=i.models,t[42]=i.projects,t[43]=a,t[44]=o):o=t[44];let s=u?`animate-spin`:void 0,f;t[45]===s?f=t[46]:(f=(0,q.jsx)(U,{className:s}),t[45]=s,t[46]=f);let p=u?`Refreshing`:`Refresh`,m;t[47]!==c||t[48]!==u||t[49]!==f||t[50]!==p?(m=(0,q.jsxs)(G,{size:`sm`,variant:`outline`,onClick:c,disabled:u,children:[f,p]}),t[47]=c,t[48]=u,t[49]=f,t[50]=p,t[51]=m):m=t[51];let h;t[52]!==m||t[53]!==o?(h=(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[o,m]}),t[52]=m,t[53]=o,t[54]=h):h=t[54];let _;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,q.jsxs)(`p`,{className:`max-w-4xl text-sm leading-relaxed text-muted-foreground`,children:[`Activity includes work observed by Ryco on`,` `,(0,q.jsx)(`span`,{className:`font-medium text-foreground`,children:O}),`. Usage from other CLI sessions appears in the Usage tab and is not assigned to projects.`]}),t[55]=_):_=t[55],R=(0,q.jsxs)(`div`,{className:`space-y-8`,children:[h,_,i.dailyBuckets.length===0?(0,q.jsx)(D,{icon:l,title:`No Ryco activity yet`,description:`Project and agent activity will appear here after your first completed turns.`}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-3 xl:grid-cols-5`,children:[(0,q.jsx)(k,{label:`Active time`,icon:B,value:d(b.activeMs),sub:`${v(b.totalTokens)} observed tokens`}),(0,q.jsx)(k,{label:`Turns`,icon:l,value:I(b.turns),sub:`Completed agent turns`}),(0,q.jsx)(k,{label:`Chats`,icon:ne,value:I(b.threadsCreated),sub:`Conversations started`}),(0,q.jsx)(k,{label:`Tool uses`,icon:oe,value:I(b.toolUses),sub:`Observed invocations`}),(0,q.jsx)(k,{label:`Files changed`,icon:V,value:I(b.filesChanged),sub:`+${I(b.additions)} / −${I(b.deletions)} lines`})]}),(0,q.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[1.2fr_0.8fr]`,children:[(0,q.jsxs)(j,{title:`Activity rhythm`,icon:l,bodyClassName:`p-5`,action:(0,q.jsx)(Se,{search:n,onSearchChange:r}),children:[(0,q.jsx)(L,{points:x,metric:n.activityMetric}),(0,q.jsxs)(`div`,{className:`mt-5 grid grid-cols-3 gap-3 border-t border-border/60 pt-4`,children:[(0,q.jsx)(Y,{label:`Active days`,value:I(e.activeDays)}),(0,q.jsx)(Y,{label:`Current streak`,value:`${I(e.currentStreak)}d`}),(0,q.jsx)(Y,{label:`Busiest UTC day`,value:e.busiestLabel})]})]}),(0,q.jsx)(j,{title:`Projects`,icon:l,bodyClassName:`p-4`,children:(0,q.jsx)(F,{data:S,metric:n.activityMetric})})]}),(0,q.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,q.jsxs)(j,{title:`Code changes`,icon:V,bodyClassName:`p-4`,children:[(0,q.jsxs)(`div`,{className:`mb-4 flex gap-6 text-sm`,children:[(0,q.jsx)(Y,{label:`Files`,value:I(b.filesChanged)}),(0,q.jsx)(Y,{label:`Added`,value:`+${I(b.additions)}`,tone:`positive`}),(0,q.jsx)(Y,{label:`Removed`,value:`−${I(b.deletions)}`,tone:`negative`})]}),(0,q.jsx)(C,{data:x})]}),(0,q.jsxs)(j,{title:`Source control · all time`,icon:H,bodyClassName:`overflow-hidden`,children:[(0,q.jsxs)(`div`,{className:`grid grid-cols-4 gap-3 border-b border-border/60 px-4 py-4`,children:[(0,q.jsx)(Y,{label:`Active`,value:I(i.worktrees.active)}),(0,q.jsx)(Y,{label:`Created`,value:I(i.worktrees.created)}),(0,q.jsx)(Y,{label:`Archived`,value:I(i.worktrees.archived)}),(0,q.jsx)(Y,{label:`Open PRs`,value:I(i.worktrees.openPrs)})]}),i.recentPullRequests.length===0?(0,q.jsx)(`div`,{className:`flex h-[260px] items-center justify-center px-6 text-center text-xs text-muted-foreground`,children:`No projected pull requests yet.`}):(0,q.jsx)(`div`,{className:`divide-y divide-border/60`,children:i.recentPullRequests.slice(0,6).map(be)})]})]})]})]}),t[23]=x,t[24]=g,t[25]=r,t[26]=S,t[27]=c,t[28]=u,t[29]=n,t[30]=i.dailyBuckets.length,t[31]=i.models,t[32]=i.projects,t[33]=i.recentPullRequests,t[34]=i.worktrees,t[35]=b,t[36]=R}else R=t[36];return R}function be(e){return(0,q.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3.5`,children:[(0,q.jsx)(`div`,{className:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground`,children:(0,q.jsx)(H,{className:`size-4`})}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`p`,{className:`truncate text-sm font-medium`,children:e.prTitle||e.worktreeTitle||e.branch}),(0,q.jsxs)(`p`,{className:`mt-0.5 truncate text-[11px] text-muted-foreground`,children:[e.projectTitle,` · #`,e.prNumber,` ·`,` `,f(e.updatedAt)]})]}),(0,q.jsx)(he,{variant:e.prState===`merged`?`success`:e.active?`info`:`secondary`,children:e.prIsDraft?`Draft`:e.prState??(e.active?`Open`:`Archived`)})]},e.worktreeId)}function J(e,t){return t===`turns`?e.turns:t===`activeMs`?e.activeMs:e.filesChanged}function xe(e,t){let n=0,r=0,i=null;for(let r of e){let e=J(r,t);e>0&&(n+=1),(i===null||e>J(i,t))&&(i=r)}for(let n=e.length-1;n>=0;--n){let i=e[n];if(i===void 0||J(i,t)<=0)break;r+=1}if(i===null||J(i,t)<=0)return{activeDays:n,currentStreak:r,busiestLabel:`—`};let a=J(i,t),o=t===`activeMs`?d(a):I(a);return{activeDays:n,currentStreak:r,busiestLabel:`${i.date.slice(5)} · ${o}`}}function Se(e){let t=(0,K.c)(4),{search:n,onSearchChange:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=[`turns`,`activeMs`,`files`],t[0]=i):i=t[0];let a;return t[1]!==r||t[2]!==n?(a=(0,q.jsx)(`div`,{className:`inline-flex rounded-md bg-muted p-0.5`,children:i.map(e=>(0,q.jsx)(`button`,{type:`button`,onClick:()=>r({...n,activityMetric:e}),className:W(`h-6 rounded-sm px-2 text-[11px]`,n.activityMetric===e?`bg-background text-foreground shadow-xs`:`text-muted-foreground`),children:e===`activeMs`?`Time`:e===`files`?`Files`:`Turns`},e))}),t[1]=r,t[2]=n,t[3]=a):a=t[3],a}function Y(e){let t=(0,K.c)(10),{label:n,value:r,tone:i}=e,a;t[0]===n?a=t[1]:(a=(0,q.jsx)(`p`,{className:`text-[10px] tracking-[0.08em] text-muted-foreground uppercase`,children:n}),t[0]=n,t[1]=a);let o=i===`positive`?`text-success-foreground`:i===`negative`?`text-destructive`:`text-foreground`,s;t[2]===o?s=t[3]:(s=W(`mt-1 font-semibold tabular-nums`,o),t[2]=o,t[3]=s);let c;t[4]!==s||t[5]!==r?(c=(0,q.jsx)(`p`,{className:s,children:r}),t[4]=s,t[5]=r,t[6]=c):c=t[6];let l;return t[7]!==a||t[8]!==c?(l=(0,q.jsxs)(`div`,{children:[a,c]}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function Ce(e){switch(e){case`complete`:return 4;case`partial`:return 3;case`not-found`:return 2;case`failed`:return 1}}function we(e,t){return Ce(t.source.status)-Ce(e.source.status)||t.source.scanFinishedAt.localeCompare(e.source.scanFinishedAt)||t.environment.summary.generatedAt.localeCompare(e.environment.summary.generatedAt)||e.environment.environmentId.localeCompare(t.environment.environmentId)}function Te(e,t){return{uncachedInputTokens:e.uncachedInputTokens+t.uncachedInputTokens,cachedInputTokens:e.cachedInputTokens+t.cachedInputTokens,cacheCreationInputTokens:e.cacheCreationInputTokens+t.cacheCreationInputTokens,outputTokens:e.outputTokens+t.outputTokens,reasoningTokens:e.reasoningTokens+t.reasoningTokens,totalTokens:e.totalTokens+t.totalTokens}}function Ee(e,t){if(e.size===0||e.size===1&&e.has(`unpriced`))return`unpriced`;let n=new Set([...e].filter(e=>e!==`unpriced`));return t>0||n.size!==1||e.has(`mixed`)?`mixed`:n.values().next().value??`unpriced`}function De(e){let t=e.filter(e=>e.summary!==void 0&&e.summary.contractVersion===1&&(e.status===`complete`||e.status===`partial`));if(t.length===0)return null;let n=t.flatMap(e=>e.summary.sources.map(t=>({environment:e,source:t}))).toSorted(we),r=new Set,i=new Set,a=[],o=0,s=!1;for(let e of n){let t=`${e.environment.environmentId}\0${e.source.sourceId}`,n=e.source.deduplicationKind===`physical`,c=n&&r.has(e.source.sourceId);n&&!c&&r.add(e.source.sourceId),n||(s=!0),c?o+=1:i.add(t),a.push({...e.source,environmentId:e.environment.environmentId,environmentLabel:e.environment.label,included:!c,...c?{exclusionReason:`duplicate`}:{}})}let c=new Map;for(let e of t)for(let t of e.summary.buckets){let n=`${e.environmentId}\0${t.sourceId}`;if(!i.has(n))continue;let r=`${t.date}\0${t.provider}\0${t.model}`,a=c.get(r);a===void 0&&(a={date:t.date,provider:t.provider,model:t.model,...t.rawModel===void 0?{}:{rawModel:t.rawModel},tokens:{uncachedInputTokens:0,cachedInputTokens:0,cacheCreationInputTokens:0,outputTokens:0,reasoningTokens:0,totalTokens:0},responseCount:0,sessionCount:0,estimatedCostUsd:0,estimatedCacheSavingsUsd:0,hasCost:!1,hasCacheSavings:!1,pricedTokenCount:0,unpricedTokenCount:0,costSources:new Set,sourceIds:new Set},c.set(r,a)),a.tokens=Te(a.tokens,t.tokens),a.responseCount+=t.responseCount,a.sessionCount+=t.sessionCount,t.estimatedCostUsd!==void 0&&(a.estimatedCostUsd+=t.estimatedCostUsd,a.hasCost=!0),t.estimatedCacheSavingsUsd!==void 0&&(a.estimatedCacheSavingsUsd+=t.estimatedCacheSavingsUsd,a.hasCacheSavings=!0),a.pricedTokenCount+=t.pricedTokenCount,a.unpricedTokenCount+=t.unpricedTokenCount,a.costSources.add(t.costSource),a.sourceIds.add(t.sourceId)}let l=[...c.values()].map(e=>Object.assign({date:e.date,provider:e.provider,model:e.model,tokens:e.tokens,responseCount:e.responseCount,sessionCount:e.sessionCount,pricedTokenCount:e.pricedTokenCount,unpricedTokenCount:e.unpricedTokenCount,costSource:Ee(e.costSources,e.unpricedTokenCount),sourceIds:[...e.sourceIds].toSorted()},e.rawModel===void 0?{}:{rawModel:e.rawModel},e.hasCost?{estimatedCostUsd:e.estimatedCostUsd}:{},e.hasCacheSavings?{estimatedCacheSavingsUsd:e.estimatedCacheSavingsUsd}:{})).toSorted((e,t)=>e.date.localeCompare(t.date)||e.provider.localeCompare(t.provider)||e.model.localeCompare(t.model)),u=t[0]?.summary;return u?{...u.startDate===void 0?{}:{startDate:u.startDate},endDate:u.endDate,timeZone:u.timeZone,buckets:l,sources:a.toSorted((e,t)=>Number(t.included)-Number(e.included)||e.provider.localeCompare(t.provider)||e.environmentLabel.localeCompare(t.environmentLabel)),environments:e,duplicateSourceCount:o,environmentOnlyDeduplicationWarning:s}:null}var Oe=class{#e=0;next(){return this.#e+=1,this.#e}isCurrent(e){return e===this.#e}},X=e(t(),1),ke={"7d":7,"30d":30,"90d":90,all:null};function Ae(e,t){return new Intl.DateTimeFormat(`en-CA`,{timeZone:t,year:`numeric`,month:`2-digit`,day:`2-digit`}).format(new Date(e))}function je(e,t,n=Date.now()){let r=Ae(n,t),i=ke[e];return i===null?{endDate:r,timeZone:t,contractVersion:1}:{startDate:Ae(Date.parse(`${r}T12:00:00.000Z`)-(i-1)*864e5,`UTC`),endDate:r,timeZone:t,contractVersion:1}}function Me(){let e=(0,K.c)(3),[t,n]=(0,X.useState)(0),r,o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>a(()=>n(Ne)),o=[],e[0]=r,e[1]=o):(r=e[0],o=e[1]),(0,X.useEffect)(r,o);let s;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=i(),e[2]=s):s=e[2],s}function Ne(e){return e+1}function Pe(e){let t=Me(),n=(0,X.useMemo)(()=>t.map(e=>({environmentId:e.environmentId,label:e.knownEnvironment.label})).toSorted((e,t)=>e.label.localeCompare(t.label)),[t]),r=(0,X.useMemo)(()=>{if(e.environmentIds===void 0||e.environmentIds.length===0)return t;let n=new Set(e.environmentIds);return t.filter(e=>n.has(e.environmentId))},[t,e.environmentIds]),i=Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`,[a,o]=(0,X.useState)(0),[s,c]=(0,X.useState)(null),[l,u]=(0,X.useState)([]),[d,f]=(0,X.useState)(!0),p=(0,X.useRef)(new Oe),m=r.map(e=>e.environmentId).toSorted().join(`\0`);(0,X.useEffect)(()=>{let t=p.current.next(),n=je(e.range,i);f(!0),Promise.all(r.map(async e=>{try{let t=await e.client.server.getUsageSummary(n);if(t.contractVersion!==1)return{environmentId:e.environmentId,label:e.knownEnvironment.label,status:`stale-contract`,message:`This environment uses an incompatible usage contract.`};let r=t.sources.some(e=>e.status===`partial`||e.status===`failed`);return{environmentId:e.environmentId,label:e.knownEnvironment.label,status:r?`partial`:`complete`,summary:t}}catch(t){return{environmentId:e.environmentId,label:e.knownEnvironment.label,status:`failed`,message:t instanceof Error?t.message:String(t)}}})).then(e=>{p.current.isCurrent(t)&&(u(e),c(De(e)),f(!1))})},[e.range,a,r,m,i]);let h=(0,X.useCallback)(()=>o(e=>e+1),[]);return{merged:s,environments:l,availableEnvironments:n,loading:d,refreshing:d&&s!==null,refresh:h}}function Fe(e,t){if(t===void 0||t.length===0)return e.buckets;let n=new Set(t);return e.buckets.filter(e=>n.has(e.provider))}function Ie(e,t){let n=0,r=0,i=0,a=0,o=0,s=0,c=0,l=0,u=0,d=!1,f=!1,p=0,m=0;for(let e of t)n+=e.tokens.totalTokens,r+=e.tokens.uncachedInputTokens,i+=e.tokens.cachedInputTokens,a+=e.tokens.cacheCreationInputTokens,o+=e.tokens.outputTokens,s+=e.tokens.reasoningTokens,c+=e.responseCount,p+=e.pricedTokenCount,m+=e.unpricedTokenCount,e.estimatedCostUsd!==void 0&&(l+=e.estimatedCostUsd,d=!0),e.estimatedCacheSavingsUsd!==void 0&&(u+=e.estimatedCacheSavingsUsd,f=!0);let h=new Set(t.map(e=>e.provider)),g=e.sources.filter(e=>e.included&&h.has(e.provider)&&e.status!==`not-found`&&e.status!==`failed`).reduce((e,t)=>e+t.distinctSessionCount,0);return{totalTokens:n,uncachedInputTokens:r,cachedInputTokens:i,cacheCreationInputTokens:a,outputTokens:o,reasoningTokens:s,responseCount:c,distinctSessionCount:g,estimatedCostUsd:d?l:null,estimatedCacheSavingsUsd:f?u:null,pricedTokenCount:p,unpricedTokenCount:m}}function Le(e,t){return new Date(Date.parse(`${e}T12:00:00.000Z`)+t*864e5).toISOString().slice(0,10)}function Re(e,t){let n=new Map;for(let e of t){let t=n.get(e.date)??{date:e.date,claudeCost:0,codexCost:0,claudeTokens:0,codexTokens:0};n.set(e.date,{...t,...e.provider===`claude`?{claudeCost:t.claudeCost+(e.estimatedCostUsd??0),claudeTokens:t.claudeTokens+e.tokens.totalTokens}:{codexCost:t.codexCost+(e.estimatedCostUsd??0),codexTokens:t.codexTokens+e.tokens.totalTokens}})}let r=e.startDate??[...n.keys()].toSorted((e,t)=>e.localeCompare(t))[0];if(r===void 0)return[];let i=[];for(let t=r;t<=e.endDate;t=Le(t,1))i.push(n.get(t)??{date:t,claudeCost:0,codexCost:0,claudeTokens:0,codexTokens:0});return i}function ze(e,t){let n=new Map;for(let r of e){let e=t===`model`?`${r.provider}\0${r.model}`:r.date,i=n.get(e)??{key:e,label:t===`model`?r.model:r.date,...t===`model`?{provider:r.provider}:{},tokens:0,costUsd:null,unpricedTokens:0,responses:0};n.set(e,{...i,tokens:i.tokens+r.tokens.totalTokens,costUsd:r.estimatedCostUsd===void 0?i.costUsd:(i.costUsd??0)+r.estimatedCostUsd,unpricedTokens:i.unpricedTokens+r.unpricedTokenCount,responses:i.responses+r.responseCount})}let r=[...n.values()].some(e=>e.costUsd!==null);return[...n.values()].toSorted((e,t)=>r&&(t.costUsd??-1)-(e.costUsd??-1)||t.tokens-e.tokens)}var Be=new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:2}),Z={claude:`#d97757`,codex:`var(--foreground)`};function Ve(e){return e===null?`Unavailable`:Be.format(e)}function He(e){let t=(0,K.c)(90),{search:n,onSearchChange:r}=e,i;t[0]!==n.environmentIds||t[1]!==n.range?(i={range:n.range,environmentIds:n.environmentIds},t[0]=n.environmentIds,t[1]=n.range,t[2]=i):i=t[2];let a=Pe(i),{merged:o}=a,s;bb0:{if(!o){s=null;break bb0}let e,r,i,a;if(t[3]!==o||t[4]!==n.providers||t[5]!==n.usageBreakdown){let s=Fe(o,n.providers);e=s,r=Ie(o,s),i=Re(o,s),a=ze(s,n.usageBreakdown),t[3]=o,t[4]=n.providers,t[5]=n.usageBreakdown,t[6]=e,t[7]=r,t[8]=i,t[9]=a}else e=t[6],r=t[7],i=t[8],a=t[9];let c;t[10]!==e||t[11]!==r||t[12]!==i||t[13]!==a?(c={buckets:e,totals:r,days:i,breakdown:a},t[10]=e,t[11]=r,t[12]=i,t[13]=a,t[14]=c):c=t[14],s=c}let c=s;if(a.loading&&!o){let e;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,q.jsx)(ee,{}),t[15]=e):e=t[15],e}if(!o||!c){let e,n,r,i;if(t[16]!==a.environments){let o=a.environments.filter(Ke);e=D,n=o.length>0?z:ve,r=o.length>0?`Couldn’t load usage`:`No usage environments are connected`,i=o.length>0?`Usage failed for ${o.map(Ge).join(`, `)}. ${o[0]?.message??`Retry after checking the environment connection.`}`:`Connect an environment with Claude Code or Codex transcripts, then refresh this view.`,t[16]=a.environments,t[17]=e,t[18]=n,t[19]=r,t[20]=i}else e=t[17],n=t[18],r=t[19],i=t[20];let o;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,q.jsx)(U,{}),t[21]=o):o=t[21];let s;t[22]===a.refresh?s=t[23]:(s=(0,q.jsxs)(G,{size:`sm`,variant:`outline`,onClick:a.refresh,children:[o,` Refresh`]}),t[22]=a.refresh,t[23]=s);let c;return t[24]!==e||t[25]!==n||t[26]!==r||t[27]!==i||t[28]!==s?(c=(0,q.jsx)(e,{icon:n,title:r,description:i,action:s}),t[24]=e,t[25]=n,t[26]=r,t[27]=i,t[28]=s,t[29]=c):c=t[29],c}let{totals:l,days:u,breakdown:d}=c,f=l.pricedTokenCount+l.unpricedTokenCount>0?l.pricedTokenCount/(l.pricedTokenCount+l.unpricedTokenCount):0,m=l.uncachedInputTokens+l.cachedInputTokens+l.cacheCreationInputTokens>0?l.cachedInputTokens/(l.uncachedInputTokens+l.cachedInputTokens+l.cacheCreationInputTokens):0,h=n.environmentIds===void 0||n.environmentIds?.length!==1?`all`:n.environmentIds[0],g;t[30]===o.sources?g=t[31]:(g=o.sources.some(We),t[30]=o.sources,t[31]=g);let _=g,y;t[32]!==r||t[33]!==n?(y=(0,q.jsx)(qe,{search:n,onSearchChange:r}),t[32]=r,t[33]=n,t[34]=y):y=t[34];let b;t[35]!==r||t[36]!==n?(b=e=>r({...n,...e===null||e===`all`?{environmentIds:void 0}:{environmentIds:[e]}}),t[35]=r,t[36]=n,t[37]=b):b=t[37];let C;t[38]!==a.availableEnvironments||t[39]!==h?(C=h===`all`?`All environments (${a.availableEnvironments.length})`:a.availableEnvironments.find(e=>e.environmentId===h)?.label??`Environment`,t[38]=a.availableEnvironments,t[39]=h,t[40]=C):C=t[40];let w;t[41]===C?w=t[42]:(w=(0,q.jsx)(fe,{size:`sm`,className:`w-48`,"aria-label":`Usage environment`,children:(0,q.jsx)(pe,{children:C})}),t[41]=C,t[42]=w);let T;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,q.jsx)(de,{value:`all`,children:`All environments`}),t[43]=T):T=t[43];let E;t[44]===a.availableEnvironments?E=t[45]:(E=a.availableEnvironments.map(Ue),t[44]=a.availableEnvironments,t[45]=E);let O;t[46]===E?O=t[47]:(O=(0,q.jsxs)(ue,{alignItemWithTrigger:!1,children:[T,E]}),t[46]=E,t[47]=O);let k;t[48]!==h||t[49]!==O||t[50]!==b||t[51]!==w?(k=(0,q.jsxs)(me,{value:h,onValueChange:b,children:[w,O]}),t[48]=h,t[49]=O,t[50]=b,t[51]=w,t[52]=k):k=t[52];let A;t[53]!==r||t[54]!==n?(A=(0,q.jsx)(Je,{search:n,onSearchChange:r}),t[53]=r,t[54]=n,t[55]=A):A=t[55];let M;t[56]!==k||t[57]!==A||t[58]!==y?(M=(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[y,k,A]}),t[56]=k,t[57]=A,t[58]=y,t[59]=M):M=t[59];let N=a.refreshing?`animate-spin`:void 0,P;t[60]===N?P=t[61]:(P=(0,q.jsx)(U,{className:N}),t[60]=N,t[61]=P);let F=a.refreshing?`Refreshing`:`Refresh`,L;t[62]!==a.refresh||t[63]!==a.refreshing||t[64]!==P||t[65]!==F?(L=(0,q.jsxs)(G,{size:`sm`,variant:`outline`,onClick:a.refresh,disabled:a.refreshing,children:[P,F]}),t[62]=a.refresh,t[63]=a.refreshing,t[64]=P,t[65]=F,t[66]=L):L=t[66];let R;t[67]!==M||t[68]!==L?(R=(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[M,L]}),t[67]=M,t[68]=L,t[69]=R):R=t[69];let B;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,q.jsx)(`p`,{className:`max-w-3xl text-sm leading-relaxed text-muted-foreground`,children:`Provider-recorded usage from Claude Code and Codex transcripts on the selected machines. This includes sessions run outside Ryco and is intentionally not attributed to projects.`}),t[70]=B):B=t[70];let V;t[71]!==d||t[72]!==m||t[73]!==u||t[74]!==c.buckets.length||t[75]!==_||t[76]!==o||t[77]!==r||t[78]!==f||t[79]!==n||t[80]!==l.distinctSessionCount||t[81]!==l.estimatedCacheSavingsUsd||t[82]!==l.estimatedCostUsd||t[83]!==l.reasoningTokens||t[84]!==l.responseCount||t[85]!==l.totalTokens?(V=c.buckets.length===0?(0,q.jsx)(D,{icon:te,title:_?`No usage in this range`:`No transcript sources found`,description:_?`The transcript sources were found, but no provider-recorded usage matched these filters.`:`Claude Code and Codex transcript directories were not found on the selected environments.`}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`section`,{className:`grid overflow-hidden rounded-2xl border border-border/75 bg-card shadow-sm/5 lg:grid-cols-[minmax(18rem,0.72fr)_minmax(0,1.55fr)]`,children:[(0,q.jsxs)(`div`,{className:`flex min-h-80 flex-col justify-between border-b border-border/70 p-6 lg:border-r lg:border-b-0 lg:p-8`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold tracking-[0.12em] text-muted-foreground uppercase`,children:[(0,q.jsx)(_e,{className:`size-3.5`}),` Raw API-equivalent cost`]}),(0,q.jsx)(`div`,{className:`mt-5 text-4xl font-semibold tracking-[-0.045em] tabular-nums sm:text-5xl`,children:Ve(l.estimatedCostUsd)}),(0,q.jsx)(`p`,{className:`mt-3 max-w-sm text-xs leading-relaxed text-muted-foreground`,children:`Estimate based on base API rates. Subscription, credits, batch, negotiated, and provider billing may differ.`})]}),(0,q.jsxs)(`div`,{className:`space-y-4 border-t border-border/65 pt-5`,children:[(0,q.jsx)(et,{label:`Priced coverage`,value:`${Math.round(f*100)}% of tokens`}),(0,q.jsx)(et,{label:`Estimated cache savings`,value:Ve(l.estimatedCacheSavingsUsd)}),(0,q.jsx)(et,{label:`Provider-recorded tokens`,value:I(l.totalTokens)})]})]}),(0,q.jsxs)(`div`,{className:`min-w-0 p-4 sm:p-6`,children:[(0,q.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3 px-1`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Usage over time`}),(0,q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Daily values in `,o.timeZone]})]}),(0,q.jsx)(Ye,{search:n,onSearchChange:r})]}),(0,q.jsx)(Ze,{data:u,metric:n.usageMetric}),(0,q.jsxs)(`div`,{className:`flex items-center justify-end gap-4 px-2 text-[11px] text-muted-foreground`,children:[(0,q.jsx)(tt,{color:Z.claude,label:`Claude`}),(0,q.jsx)(tt,{color:Z.codex,label:`Codex`})]})]})]}),(0,q.jsxs)(`div`,{className:`grid grid-cols-2 border-y border-border/65 md:grid-cols-5`,children:[(0,q.jsx)(Q,{label:`Total tokens`,value:v(l.totalTokens)}),(0,q.jsx)(Q,{label:`Sessions`,value:I(l.distinctSessionCount)}),(0,q.jsx)(Q,{label:`Responses`,value:I(l.responseCount)}),(0,q.jsx)(Q,{label:`Cache read`,value:`${Math.round(m*100)}%`}),(0,q.jsx)(Q,{label:`Reasoning`,value:v(l.reasoningTokens),detail:`included in output`})]}),(0,q.jsx)(j,{title:`Breakdown`,icon:te,action:(0,q.jsx)(Xe,{search:n,onSearchChange:r}),bodyClassName:`overflow-hidden`,children:(0,q.jsx)(`div`,{className:`divide-y divide-border/60`,children:d.slice(0,20).map(e=>(0,q.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-5 px-4 py-3.5 sm:px-5`,children:[(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`p`,{className:`truncate text-sm font-medium`,children:n.usageBreakdown===`model`?S(e.label):x(e.label)}),(0,q.jsx)(`p`,{className:`mt-0.5 text-[11px] text-muted-foreground`,children:e.provider?p(e.provider):`${e.responses} responses`})]}),(0,q.jsxs)(`div`,{className:`text-right`,children:[(0,q.jsx)(`p`,{className:`text-sm font-medium tabular-nums`,children:v(e.tokens)}),(0,q.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`tokens`})]}),(0,q.jsxs)(`div`,{className:`w-24 text-right`,children:[(0,q.jsx)(`p`,{className:`text-sm font-medium tabular-nums`,children:Ve(e.costUsd)}),(0,q.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:e.unpricedTokens>0?`${v(e.unpricedTokens)} unpriced`:`estimated`})]})]},e.key))})}),(0,q.jsx)(nt,{summary:o})]}),t[71]=d,t[72]=m,t[73]=u,t[74]=c.buckets.length,t[75]=_,t[76]=o,t[77]=r,t[78]=f,t[79]=n,t[80]=l.distinctSessionCount,t[81]=l.estimatedCacheSavingsUsd,t[82]=l.estimatedCostUsd,t[83]=l.reasoningTokens,t[84]=l.responseCount,t[85]=l.totalTokens,t[86]=V):V=t[86];let H;return t[87]!==R||t[88]!==V?(H=(0,q.jsxs)(`div`,{className:`space-y-8`,children:[R,B,V]}),t[87]=R,t[88]=V,t[89]=H):H=t[89],H}function Ue(e){return(0,q.jsx)(de,{value:e.environmentId,children:e.label},e.environmentId)}function We(e){return e.included&&e.status!==`not-found`}function Ge(e){return e.label}function Ke(e){return e.status===`failed`||e.status===`unavailable`||e.status===`stale-contract`}function qe(e){let t=(0,K.c)(3),{search:n,onSearchChange:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,q.jsx)(`div`,{className:`inline-flex rounded-lg border bg-card p-0.5`,children:[`7d`,`30d`,`90d`,`all`].map(e=>(0,q.jsx)(`button`,{type:`button`,onClick:()=>r({...n,range:e}),className:W(`h-7 rounded-md px-2.5 text-xs font-medium transition-colors`,n.range===e?`bg-accent text-foreground`:`text-muted-foreground hover:text-foreground`),children:e===`all`?`All`:e.toUpperCase()},e))}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function Je(e){let t=(0,K.c)(3),{search:n,onSearchChange:r}=e,i;if(t[0]!==r||t[1]!==n){let e=new Set(n.providers??[`claude`,`codex`]);i=(0,q.jsx)(`div`,{className:`inline-flex rounded-lg border bg-card p-0.5`,children:[`claude`,`codex`].map(t=>(0,q.jsxs)(`button`,{type:`button`,"aria-pressed":e.has(t),onClick:()=>{let i=new Set(e);i.has(t)&&i.size>1?i.delete(t):i.add(t);let a=[...i].toSorted();r({...n,...a.length===2?{providers:void 0}:{providers:a}})},className:W(`inline-flex h-7 items-center rounded-md px-2.5 text-xs font-medium capitalize transition-colors`,e.has(t)?`bg-accent text-foreground`:`text-muted-foreground hover:text-foreground`),children:[(0,q.jsx)(`span`,{"aria-hidden":!0,className:`mr-1.5 inline-block size-1.5 rounded-full`,style:{backgroundColor:Z[t]}}),t]},t))}),t[0]=r,t[1]=n,t[2]=i}else i=t[2];return i}function Ye(e){let t=(0,K.c)(4),{search:n,onSearchChange:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=[`cost`,`tokens`],t[0]=i):i=t[0];let a;return t[1]!==r||t[2]!==n?(a=(0,q.jsx)(`div`,{className:`inline-flex rounded-md bg-muted p-0.5`,children:i.map(e=>(0,q.jsx)(`button`,{type:`button`,onClick:()=>r({...n,usageMetric:e}),className:W(`h-6 rounded-sm px-2 text-[11px] font-medium capitalize`,n.usageMetric===e?`bg-background text-foreground shadow-xs`:`text-muted-foreground`),children:e},e))}),t[1]=r,t[2]=n,t[3]=a):a=t[3],a}function Xe(e){let t=(0,K.c)(4),{search:n,onSearchChange:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=[`model`,`day`],t[0]=i):i=t[0];let a;return t[1]!==r||t[2]!==n?(a=(0,q.jsx)(`div`,{className:`inline-flex items-center gap-1 text-[11px]`,children:i.map(e=>(0,q.jsx)(`button`,{type:`button`,onClick:()=>r({...n,usageBreakdown:e}),className:W(`rounded-md px-2 py-1 capitalize`,n.usageBreakdown===e?`bg-accent text-foreground`:`text-muted-foreground`),children:e},e))}),t[1]=r,t[2]=n,t[3]=a):a=t[3],a}function Ze(e){let t=(0,K.c)(21),{data:n,metric:r}=e,i=r===`cost`?`Cost`:`Tokens`,a;t[0]===n?a=t[1]:(a=[...n],t[0]=n,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o={left:4,right:10,top:18,bottom:0},t[2]=o):o=t[2];let s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,q.jsxs)(`linearGradient`,{id:`usageClaude`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,q.jsx)(`stop`,{offset:`5%`,stopColor:Z.claude,stopOpacity:.3}),(0,q.jsx)(`stop`,{offset:`95%`,stopColor:Z.claude,stopOpacity:.02})]}),t[3]=s):s=t[3];let c,l,d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,q.jsxs)(`defs`,{children:[s,(0,q.jsxs)(`linearGradient`,{id:`usageCodex`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,q.jsx)(`stop`,{offset:`5%`,stopColor:Z.codex,stopOpacity:.18}),(0,q.jsx)(`stop`,{offset:`95%`,stopColor:Z.codex,stopOpacity:.01})]})]}),l=(0,q.jsx)(b,{vertical:!1,strokeDasharray:`3 5`}),d=(0,q.jsx)(h,{dataKey:`date`,tickLine:!1,axisLine:!1,minTickGap:30,tickFormatter:$e}),t[4]=c,t[5]=l,t[6]=d):(c=t[4],l=t[5],d=t[6]);let f;t[7]===r?f=t[8]:(f=(0,q.jsx)(m,{tickLine:!1,axisLine:!1,width:44,tickFormatter:e=>r===`cost`?`$${Number(e).toFixed(+(Number(e)<10))}`:v(Number(e))}),t[7]=r,t[8]=f);let p;t[9]===r?p=t[10]:(p=(0,q.jsx)(O,{content:(0,q.jsx)(_,{labelFormatter:Qe,formatter:e=>r===`cost`?Be.format(Number(e)||0):I(Number(e)||0)})}),t[9]=r,t[10]=p);let x=`claude${i}`,S;t[11]===x?S=t[12]:(S=(0,q.jsx)(g,{dataKey:x,name:`Claude`,type:`monotone`,stroke:Z.claude,fill:`url(#usageClaude)`,strokeWidth:1.75}),t[11]=x,t[12]=S);let C=`codex${i}`,w;t[13]===C?w=t[14]:(w=(0,q.jsx)(g,{dataKey:C,name:`Codex`,type:`monotone`,stroke:Z.codex,fill:`url(#usageCodex)`,strokeWidth:1.75}),t[13]=C,t[14]=w);let T;return t[15]!==a||t[16]!==S||t[17]!==w||t[18]!==f||t[19]!==p?(T=(0,q.jsx)(u,{className:`h-[300px]`,children:(0,q.jsxs)(y,{data:a,margin:o,children:[c,l,d,f,p,S,w]})}),t[15]=a,t[16]=S,t[17]=w,t[18]=f,t[19]=p,t[20]=T):T=t[20],T}function Qe(e){return x(String(e))}function $e(e){return x(String(e))}function et(e){let t=(0,K.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,q.jsx)(`span`,{className:`font-medium tabular-nums`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-4 text-xs`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Q(e){let t=(0,K.c)(10),{label:n,value:r,detail:i}=e,a;t[0]===n?a=t[1]:(a=(0,q.jsx)(`p`,{className:`text-[10px] font-semibold tracking-[0.1em] text-muted-foreground uppercase`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,q.jsx)(`p`,{className:`mt-2 text-xl font-semibold tracking-tight tabular-nums`,children:r}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=i?(0,q.jsx)(`p`,{className:`mt-1 text-[10px] text-muted-foreground`,children:i}):null,t[4]=i,t[5]=s);let c;return t[6]!==a||t[7]!==o||t[8]!==s?(c=(0,q.jsxs)(`div`,{className:`border-r border-border/60 px-4 py-5 last:border-r-0`,children:[a,o,s]}),t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function tt(e){let t=(0,K.c)(5),{color:n,label:r}=e,i;t[0]===n?i=t[1]:(i=(0,q.jsx)(`span`,{className:`size-2 rounded-sm`,style:{backgroundColor:n}}),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[i,r]}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function nt(e){let t=(0,K.c)(43),{summary:n}=e,r,i,a,o,s,c,l,u,d,p,m,h,g,_;if(t[0]!==n.duplicateSourceCount||t[1]!==n.environmentOnlyDeduplicationWarning||t[2]!==n.environments||t[3]!==n.sources){let e=n.sources.filter(mt),v=e.filter(pt),y=n.environments.filter(ft),b=n.environments.flatMap(dt),x=b.length===0?`Unavailable`:b.every(ut)?`Live`:b.every(lt)?`Cached`:b.every(ct)?`Unavailable`:`Mixed`,S=n.environments.flatMap(st).toSorted().at(-1),C=e.map(ot).toSorted().at(-1);i=j,_=`Coverage & estimates`,o=ge,s=`p-5`,c=y.length>0?(0,q.jsxs)(`div`,{className:`mb-5 flex gap-2 rounded-lg border border-warning/30 bg-warning/8 px-3 py-2.5 text-xs text-muted-foreground`,children:[(0,q.jsx)(z,{className:`mt-0.5 size-3.5 shrink-0 text-warning`}),(0,q.jsxs)(`span`,{children:[`No usage was included from`,` `,y.map(at).join(`, `),`.`]})]}):null,p=`grid gap-5 md:grid-cols-2 xl:grid-cols-4`;let w=`${e.length} included`,T=n.duplicateSourceCount>0?`${n.duplicateSourceCount} duplicate source excluded`:`No physical duplicates detected`;t[18]!==w||t[19]!==T?(m=(0,q.jsx)($,{icon:ve,label:`Transcript sources`,value:w,detail:T}),t[18]=w,t[19]=T,t[20]=m):m=t[20],h=(0,q.jsx)($,{icon:ie,label:`Last scan`,value:C?f(C):`Not scanned`,detail:`${e.reduce(it,0)} cached files reused`});let E=S?`Rates fetched ${f(S)}`:`Token totals remain available without rates`;t[21]!==x||t[22]!==E?(g=(0,q.jsx)($,{icon:_e,label:`Pricing`,value:x,detail:E}),t[21]=x,t[22]=E,t[23]=g):g=t[23],r=$,a=z,l=`Coverage state`,u=v.length===0?`Complete`:`${v.length} source notice${v.length===1?``:`s`}`,d=n.environmentOnlyDeduplicationWarning?`Some sources could only be scoped per environment`:`${e.reduce(rt,0)} malformed lines skipped`,t[0]=n.duplicateSourceCount,t[1]=n.environmentOnlyDeduplicationWarning,t[2]=n.environments,t[3]=n.sources,t[4]=r,t[5]=i,t[6]=a,t[7]=o,t[8]=s,t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=p,t[14]=m,t[15]=h,t[16]=g,t[17]=_}else r=t[4],i=t[5],a=t[6],o=t[7],s=t[8],c=t[9],l=t[10],u=t[11],d=t[12],p=t[13],m=t[14],h=t[15],g=t[16],_=t[17];let v;t[24]!==r||t[25]!==a||t[26]!==l||t[27]!==u||t[28]!==d?(v=(0,q.jsx)(r,{icon:a,label:l,value:u,detail:d}),t[24]=r,t[25]=a,t[26]=l,t[27]=u,t[28]=d,t[29]=v):v=t[29];let y;t[30]!==v||t[31]!==p||t[32]!==m||t[33]!==h||t[34]!==g?(y=(0,q.jsxs)(`div`,{className:p,children:[m,h,g,v]}),t[30]=v,t[31]=p,t[32]=m,t[33]=h,t[34]=g,t[35]=y):y=t[35];let b;return t[36]!==i||t[37]!==o||t[38]!==s||t[39]!==c||t[40]!==y||t[41]!==_?(b=(0,q.jsxs)(i,{title:_,icon:o,bodyClassName:s,children:[c,y]}),t[36]=i,t[37]=o,t[38]=s,t[39]=c,t[40]=y,t[41]=_,t[42]=b):b=t[42],b}function rt(e,t){return e+t.malformedLineCount}function it(e,t){return e+t.reusedCacheFileCount}function at(e){return e.label}function ot(e){return e.scanFinishedAt}function st(e){let t=e.summary?.pricing.fetchedAt;return t===void 0?[]:[t]}function ct(e){return e===`unavailable`}function lt(e){return e===`cached`}function ut(e){return e===`live`}function dt(e){return e.summary===void 0?[]:[e.summary.pricing.state]}function ft(e){return e.status===`failed`||e.status===`unavailable`||e.status===`stale-contract`}function pt(e){return e.status!==`complete`}function mt(e){return e.included}function $(e){let t=(0,K.c)(15),{icon:n,label:r,value:i,detail:a}=e,o;t[0]===n?o=t[1]:(o=(0,q.jsx)(`div`,{className:`mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground`,children:(0,q.jsx)(n,{className:`size-4`})}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r}),t[2]=r,t[3]=s);let c;t[4]===i?c=t[5]:(c=(0,q.jsx)(`p`,{className:`mt-1 text-sm font-medium`,children:i}),t[4]=i,t[5]=c);let l;t[6]===a?l=t[7]:(l=(0,q.jsx)(`p`,{className:`mt-1 text-[11px] leading-relaxed text-muted-foreground`,children:a}),t[6]=a,t[7]=l);let u;t[8]!==s||t[9]!==c||t[10]!==l?(u=(0,q.jsxs)(`div`,{children:[s,c,l]}),t[8]=s,t[9]=c,t[10]=l,t[11]=u):u=t[11];let d;return t[12]!==o||t[13]!==u?(d=(0,q.jsxs)(`div`,{className:`flex gap-3`,children:[o,u]}),t[12]=o,t[13]=u,t[14]=d):d=t[14],d}function ht(e){let t=(0,K.c)(25),{search:n,onSearchChange:i}=e,a=n.view===`usage`?r.serverGetUsageSummary:r.serverGetStatistics,o=ce(a),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`h1`,{className:`truncate text-sm font-semibold tracking-tight`,children:`Statistics`}),(0,q.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Usage and work signals`})]}),t[0]=s):s=t[0];let c;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=[`usage`,`activity`],t[1]=c):c=t[1];let u;t[2]!==i||t[3]!==n?(u=(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-5`,children:[s,(0,q.jsx)(`div`,{className:`inline-flex rounded-lg bg-muted/75 p-0.5`,children:c.map(e=>{let t=e===`usage`?R:l;return(0,q.jsxs)(`button`,{type:`button`,onClick:()=>i({...n,view:e}),className:W(`inline-flex h-8 items-center gap-1.5 rounded-md px-3 text-xs font-medium capitalize transition-colors`,n.view===e?`bg-background text-foreground shadow-xs`:`text-muted-foreground hover:text-foreground`),children:[(0,q.jsx)(t,{className:`size-3.5`}),` `,e]},e)})})]}),t[2]=i,t[3]=n,t[4]=u):u=t[4];let d;t[5]===n.range?d=t[6]:(d=n.range===`all`?`All available history`:`Last ${n.range.slice(0,-1)} days`,t[5]=n.range,t[6]=d);let f;t[7]===d?f=t[8]:(f=(0,q.jsx)(`p`,{className:`text-xs font-medium`,children:d}),t[7]=d,t[8]=f);let p=n.view===`usage`?`Local calendar window`:`UTC activity window`,m;t[9]===p?m=t[10]:(m=(0,q.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:p}),t[9]=p,t[10]=m);let h;t[11]!==f||t[12]!==m?(h=(0,q.jsxs)(`div`,{className:`hidden text-right sm:block`,children:[f,m]}),t[11]=f,t[12]=m,t[13]=h):h=t[13];let g;t[14]!==u||t[15]!==h?(g=(0,q.jsxs)(`header`,{className:`flex min-h-14 shrink-0 items-center border-b border-border/75 bg-background/90 px-5 backdrop-blur-sm sm:px-7`,children:[u,h]}),t[14]=u,t[15]=h,t[16]=g):g=t[16];let _;t[17]!==o.allowed||t[18]!==o.reason||t[19]!==i||t[20]!==n?(_=(0,q.jsx)(se,{className:`min-h-0 flex-1`,children:(0,q.jsx)(`div`,{className:`mx-auto w-full max-w-[1480px] px-5 py-7 sm:px-8 sm:py-9 lg:px-10`,children:o.allowed?n.view===`usage`?(0,q.jsx)(He,{search:n,onSearchChange:i}):(0,q.jsx)(ye,{search:n,onSearchChange:i}):(0,q.jsx)(D,{icon:re,title:`Statistics aren’t available for this session`,description:o.reason??`Owner access is required.`})})}),t[17]=o.allowed,t[18]=o.reason,t[19]=i,t[20]=n,t[21]=_):_=t[21];let v;return t[22]!==_||t[23]!==g?(v=(0,q.jsx)(le,{className:`h-dvh min-h-0 overflow-hidden overscroll-y-none bg-background text-foreground`,children:(0,q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[g,_]})}),t[22]=_,t[23]=g,t[24]=v):v=t[24],v}export{ht as StatisticsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,t}from"./react-SIfiwpqq.js";import{t as n}from"./compiler-runtime-qmuS0Svy.js";import{It as r}from"./composerDraftStore-CdJJZe42.js";import{f as i}from"./useRenderElement-DchFnsR8.js";import{t as a}from"./activity-1CkdQG5u.js";import{C as o,D as s,E as c,N as l,O as u,T as d,_ as f,a as ee,b as te,c as ne,d as re,f as ie,g as ae,h as oe,i as se,k as ce,l as p,m,n as le,o as ue,p as h,r as de,s as fe,t as pe,u as me,v as he,w as g,x as ge,y as _e}from"./useStatistics-DEtKeVPP.js";import{t as ve}from"./chart-column-Dw6ACmXM.js";import{t as ye}from"./clock-nNA05brA.js";import{n as be,t as xe}from"./layers-BYi0v17h.js";import{t as Se}from"./git-branch-BKr-Ij4u.js";import{t as Ce}from"./messages-square-DiMgWzoq.js";import{t as we}from"./refresh-cw-DopCMrtR.js";import{t as Te}from"./triangle-alert-RL_T3KLo.js";import{t as Ee}from"./button-BAbJxRzt.js";import{n as _}from"./settingsLayout-D8glO7f1.js";var De=i(`chart-pie`,[[`path`,{d:`M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z`,key:`pzmjnu`}],[`path`,{d:`M21.21 15.89A10 10 0 1 1 8 2.83`,key:`k2fpak`}]]),Oe=i(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),ke=i(`dollar-sign`,[[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`22`,key:`7eqyqh`}],[`path`,{d:`M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6`,key:`1b0p4s`}]]),Ae=e(t(),1),v=n(),y=r();function je(e){let t=(0,v.c)(10),{models:n}=e;if(n.length===0){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,y.jsx)(`div`,{className:`px-4 py-8 text-center text-muted-foreground text-xs`,children:`No model usage yet.`}),t[0]=e):e=t[0],e}let r;t[1]===n?r=t[2]:(r=n.reduce(b,0)||1,t[1]=n,t[2]=r);let i=r,a;if(t[3]!==i||t[4]!==n){let e;t[6]===i?e=t[7]:(e=(e,t)=>{let n=l(t),r=Math.max(2,e.totalTokens/i*100);return(0,y.jsxs)(`li`,{className:`flex items-center gap-3 px-4 py-3`,children:[(0,y.jsx)(`span`,{className:`w-4 text-center font-medium text-[11px] text-muted-foreground tabular-nums`,children:t+1}),(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:`truncate font-medium text-[13px] text-foreground`,children:d(e.model)}),(0,y.jsx)(`span`,{className:`shrink-0 font-medium text-foreground text-xs tabular-nums`,children:u(e.totalTokens)})]}),(0,y.jsx)(`div`,{className:`mt-1.5 h-1.5 w-full overflow-hidden rounded-full bg-muted`,children:(0,y.jsx)(`div`,{className:`h-full rounded-full transition-[width] duration-500`,style:{width:`${r}%`,backgroundColor:n}})}),(0,y.jsxs)(`div`,{className:`mt-1 flex items-center justify-between text-[11px] text-muted-foreground`,children:[(0,y.jsx)(`span`,{className:`truncate`,children:c(e.provider)}),(0,y.jsx)(`span`,{className:`shrink-0 tabular-nums`,children:e.costUsd===null?`—`:`~${ce(e.costUsd)}`})]})]})]},`${e.provider??`unknown`}:${e.model}`)},t[6]=i,t[7]=e),a=n.map(e),t[3]=i,t[4]=n,t[5]=a}else a=t[5];let o;return t[8]===a?o=t[9]:(o=(0,y.jsx)(`ol`,{className:`divide-y divide-border/50`,children:a}),t[8]=a,t[9]=o),o}function b(e,t){return Math.max(e,t.totalTokens)}function x(){let e=(0,v.c)(92),{snapshot:t,loading:n,error:r,refresh:i,refreshing:l}=pe(),b;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(b={range:`30d`,projectId:null,model:null,provider:null},e[0]=b):b=e[0];let[x,Ie]=(0,Ae.useState)(b),w;bb0:{if(!t){w=null;break bb0}let n,r,i,a,o,s,c,l;if(e[1]!==x||e[2]!==t){let u=ne(t,x),d=ue(t),f=le(u),te=f.reduce(Fe,0);n=re(u),r=me(t,x),i=f,a=te,o=se(u),s=de(u,d),c=fe(t,u,x.range),l=ee(f),e[1]=x,e[2]=t,e[3]=n,e[4]=r,e[5]=i,e[6]=a,e[7]=o,e[8]=s,e[9]=c,e[10]=l}else n=e[3],r=e[4],i=e[5],a=e[6],o=e[7],s=e[8],c=e[9],l=e[10];let u;e[11]!==n||e[12]!==r||e[13]!==i||e[14]!==a||e[15]!==o||e[16]!==s||e[17]!==c||e[18]!==l?(u={totals:n,previous:r,models:i,totalsAllModels:a,providers:o,projects:s,series:c,cost:l},e[11]=n,e[12]=r,e[13]=i,e[14]=a,e[15]=o,e[16]=s,e[17]=c,e[18]=l,e[19]=u):u=e[19],w=u}let Le=w;if(n&&!t){let t;return e[20]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,y.jsx)(_,{children:(0,y.jsx)(oe,{})}),e[20]=t):t=e[20],t}if(r&&!t){let t;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,y.jsx)(we,{}),e[21]=t):t=e[21];let n;e[22]===i?n=e[23]:(n=(0,y.jsxs)(Ee,{size:`sm`,variant:`outline`,onClick:i,children:[t,` Try again`]}),e[22]=i,e[23]=n);let a;return e[24]!==r||e[25]!==n?(a=(0,y.jsx)(_,{children:(0,y.jsx)(ae,{icon:Te,title:`Couldn’t load statistics`,description:r,action:n})}),e[24]=r,e[25]=n,e[26]=a):a=e[26],a}if(!t||!Le)return null;let T=t.dailyBuckets.length>0,{totals:E,previous:D,models:O,totalsAllModels:k,providers:A,projects:j,series:M,cost:N}=Le,P=O[0],F;e[27]!==P||e[28]!==k?(F=P&&k>0?Math.round(P.totalTokens/k*100):0,e[27]=P,e[28]=k,e[29]=F):F=e[29];let I=F,L;e[30]===M?L=e[31]:(L=M.map(Pe),e[30]=M,e[31]=L);let R=L,z;e[32]===M?z=e[33]:(z=M.map(Ne),e[32]=M,e[33]=z);let Re=z,B=Math.max(0,E.totalTokens-E.inputTokens-E.outputTokens),V;e[34]!==E.inputTokens||e[35]!==E.outputTokens||e[36]!==B?(V=B>0?`${u(E.inputTokens)} in · ${u(E.outputTokens)} out · ${u(B)} other`:`${u(E.inputTokens)} in · ${u(E.outputTokens)} out`,e[34]=E.inputTokens,e[35]=E.outputTokens,e[36]=B,e[37]=V):V=e[37];let ze=V,H;e[38]===M?H=e[39]:(H=M.some(Me),e[38]=M,e[39]=H);let Be=H,Ve=t.tokenAttribution===`thread-cumulative`?`Token figures use cumulative thread snapshots when providers or older sessions do not expose per-turn deltas.`:t.tokenAttribution===`mixed`?`Token figures combine exact per-turn deltas where available with cumulative snapshots for older or provider-limited sessions.`:`Token figures use exact per-turn deltas where providers report them.`,U;e[40]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,y.jsx)(`h1`,{className:`font-semibold text-foreground text-lg`,children:`Statistics`}),e[40]=U):U=e[40];let W;e[41]===t.generatedAt?W=e[42]:(W=s(t.generatedAt),e[41]=t.generatedAt,e[42]=W);let G;e[43]===W?G=e[44]:(G=(0,y.jsxs)(`div`,{className:`space-y-0.5`,children:[U,(0,y.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Usage across your projects · as of `,W]})]}),e[43]=W,e[44]=G);let K=l?`animate-spin`:void 0,q;e[45]===K?q=e[46]:(q=(0,y.jsx)(we,{className:K}),e[45]=K,e[46]=q);let J;e[47]!==i||e[48]!==l||e[49]!==q?(J=(0,y.jsxs)(Ee,{size:`xs`,variant:`outline`,onClick:i,disabled:l,"aria-label":`Refresh statistics`,children:[q,`Refresh`]}),e[47]=i,e[48]=l,e[49]=q,e[50]=J):J=e[50];let Y;e[51]!==J||e[52]!==G?(Y=(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[G,J]}),e[51]=J,e[52]=G,e[53]=Y):Y=e[53];let X;e[54]!==x||e[55]!==t.models||e[56]!==t.projects?(X=(0,y.jsx)(ie,{filter:x,onChange:Ie,projects:t.projects,models:t.models}),e[54]=x,e[55]=t.models,e[56]=t.projects,e[57]=X):X=e[57];let Z;e[58]!==Y||e[59]!==X?(Z=(0,y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[Y,X]}),e[58]=Y,e[59]=X,e[60]=Z):Z=e[60];let Q;e[61]!==Re||e[62]!==Ve||e[63]!==N||e[64]!==T||e[65]!==Be||e[66]!==O||e[67]!==D?.activeMs||e[68]!==D?.threadsCreated||e[69]!==D?.totalTokens||e[70]!==j||e[71]!==A||e[72]!==M||e[73]!==t.worktrees||e[74]!==R||e[75]!==ze||e[76]!==P||e[77]!==I||e[78]!==E.activeMs||e[79]!==E.additions||e[80]!==E.commits||e[81]!==E.deletions||e[82]!==E.filesChanged||e[83]!==E.pushes||e[84]!==E.threadsCreated||e[85]!==E.toolUses||e[86]!==E.totalTokens||e[87]!==E.turns?(Q=T?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-5`,children:[(0,y.jsx)(m,{label:`Total tokens`,icon:Oe,value:u(E.totalTokens),sub:ze,delta:p(E.totalTokens,D?.totalTokens),sparkline:R}),(0,y.jsx)(m,{label:`Est. cost`,icon:ke,value:`~${ce(N.usd)}`,sub:N.hasUnpriced?`excludes unpriced models`:`estimated spend`}),(0,y.jsx)(m,{label:`Most used model`,icon:xe,value:(0,y.jsx)(`span`,{className:`block max-w-full truncate text-lg`,title:P?d(P.model):void 0,children:P?d(P.model):`—`}),sub:P?`${c(P.provider)} · ${I}% of tokens`:`no usage in range`}),(0,y.jsx)(m,{label:`Chats`,icon:Ce,value:g(E.threadsCreated),sub:`threads started`,delta:p(E.threadsCreated,D?.threadsCreated)}),(0,y.jsx)(m,{label:`Active time`,icon:ye,value:o(E.activeMs),sub:`${g(E.turns)} turns`,delta:p(E.activeMs,D?.activeMs),sparkline:Re})]}),(0,y.jsxs)(h,{title:`Token usage over time`,icon:ve,bodyClassName:`p-4`,children:[(0,y.jsx)(te,{data:M}),(0,y.jsxs)(`div`,{className:`mt-2 flex items-center gap-4 px-1 text-[11px] text-muted-foreground`,children:[(0,y.jsx)(S,{colorIndex:0,label:`Input`}),(0,y.jsx)(S,{colorIndex:1,label:`Output`}),Be?(0,y.jsx)(S,{colorIndex:2,label:`Other`}):null]})]}),(0,y.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,y.jsx)(h,{title:`Models`,icon:xe,bodyClassName:`overflow-hidden`,action:(0,y.jsxs)(`span`,{className:`text-[11px] text-muted-foreground`,children:[O.length,` total`]}),children:(0,y.jsx)(je,{models:O})}),(0,y.jsx)(h,{title:`Tokens by provider`,icon:De,bodyClassName:`p-4`,children:(0,y.jsx)(_e,{data:A})})]}),(0,y.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,y.jsx)(h,{title:`Tokens by project`,icon:ve,bodyClassName:`p-4`,children:(0,y.jsx)(he,{data:j})}),(0,y.jsxs)(h,{title:`Activity`,icon:a,bodyClassName:`p-4`,children:[(0,y.jsx)(ge,{points:M,metric:`turns`}),(0,y.jsx)(`p`,{className:`mt-3 text-[11px] text-muted-foreground`,children:`Turns per day`})]})]}),(0,y.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,y.jsxs)(h,{title:`Code changes`,icon:be,bodyClassName:`p-4`,children:[(0,y.jsxs)(`div`,{className:`mb-3 flex items-center gap-4 text-sm`,children:[(0,y.jsx)(C,{label:`Files`,value:g(E.filesChanged)}),(0,y.jsx)(C,{label:`Added`,value:`+${g(E.additions)}`,tone:`success`}),(0,y.jsx)(C,{label:`Removed`,value:`−${g(E.deletions)}`,tone:`destructive`})]}),(0,y.jsx)(f,{data:M})]}),(0,y.jsxs)(h,{title:`Source control`,icon:Se,bodyClassName:`p-4`,children:[(0,y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,y.jsx)(C,{label:`Worktrees`,value:g(t.worktrees.created)}),(0,y.jsx)(C,{label:`Active`,value:g(t.worktrees.active)}),(0,y.jsx)(C,{label:`Open PRs`,value:g(t.worktrees.openPrs)}),(0,y.jsx)(C,{label:`Tool uses`,value:g(E.toolUses)})]}),E.commits+E.pushes>0?(0,y.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-3 border-border/60 border-t pt-3`,children:[(0,y.jsx)(C,{label:`Commits`,value:g(E.commits)}),(0,y.jsx)(C,{label:`Pushes`,value:g(E.pushes)})]}):(0,y.jsx)(`p`,{className:`mt-3 border-border/60 border-t pt-3 text-[11px] text-muted-foreground`,children:`Commit & push counts aren’t recorded yet.`})]})]}),(0,y.jsxs)(`p`,{className:`px-1 text-[11px] text-muted-foreground/80`,children:[Ve,` Costs are rough estimates from a built-in price table and exclude subscription-billed or breakdown-less usage.`]})]}):(0,y.jsx)(ae,{icon:ve,title:`No activity yet`,description:`Once you start chatting with agents, your token usage, models, and code changes will show up here.`}),e[61]=Re,e[62]=Ve,e[63]=N,e[64]=T,e[65]=Be,e[66]=O,e[67]=D?.activeMs,e[68]=D?.threadsCreated,e[69]=D?.totalTokens,e[70]=j,e[71]=A,e[72]=M,e[73]=t.worktrees,e[74]=R,e[75]=ze,e[76]=P,e[77]=I,e[78]=E.activeMs,e[79]=E.additions,e[80]=E.commits,e[81]=E.deletions,e[82]=E.filesChanged,e[83]=E.pushes,e[84]=E.threadsCreated,e[85]=E.toolUses,e[86]=E.totalTokens,e[87]=E.turns,e[88]=Q):Q=e[88];let $;return e[89]!==Z||e[90]!==Q?($=(0,y.jsxs)(_,{children:[Z,Q]}),e[89]=Z,e[90]=Q,e[91]=$):$=e[91],$}function Me(e){return e.uncategorizedTokens>0}function Ne(e){return e.activeMs}function Pe(e){return e.totalTokens}function Fe(e,t){return e+t.totalTokens}function S(e){let t=(0,v.c)(7),{colorIndex:n,label:r}=e,i;t[0]===n?i=t[1]:(i=l(n),t[0]=n,t[1]=i);let a;t[2]===i?a=t[3]:(a=(0,y.jsx)(`span`,{className:`size-2.5 rounded-[3px]`,style:{backgroundColor:i}}),t[2]=i,t[3]=a);let o;return t[4]!==r||t[5]!==a?(o=(0,y.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[a,r]}),t[4]=r,t[5]=a,t[6]=o):o=t[6],o}function C(e){let t=(0,v.c)(8),{label:n,value:r,tone:i}=e,a;t[0]===n?a=t[1]:(a=(0,y.jsx)(`span`,{className:`text-[11px] text-muted-foreground uppercase tracking-[0.06em]`,children:n}),t[0]=n,t[1]=a);let o=i===`success`?`font-semibold text-base text-success-foreground tabular-nums`:i===`destructive`?`font-semibold text-base text-destructive tabular-nums`:`font-semibold text-base text-foreground tabular-nums`,s;t[2]!==o||t[3]!==r?(s=(0,y.jsx)(`span`,{className:o,children:r}),t[2]=o,t[3]=r,t[4]=s):s=t[4];let c;return t[5]!==a||t[6]!==s?(c=(0,y.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[a,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}export{x as StatisticsPanel};
|
|
1
|
+
import{i as e,t}from"./react-SIfiwpqq.js";import{t as n}from"./compiler-runtime-qmuS0Svy.js";import{It as r}from"./composerDraftStore-CdJJZe42.js";import{f as i}from"./useRenderElement-DchFnsR8.js";import{t as a}from"./activity-1CkdQG5u.js";import{C as o,D as s,E as c,N as l,O as u,T as d,_ as f,a as ee,b as te,c as ne,d as re,f as ie,g as ae,h as oe,i as se,k as ce,l as p,m,n as le,o as ue,p as h,r as de,s as fe,t as pe,u as me,v as he,w as g,x as ge,y as _e}from"./useStatistics-CtunoTE-.js";import{t as ve}from"./chart-column-Dw6ACmXM.js";import{t as ye}from"./clock-nNA05brA.js";import{n as be,t as xe}from"./layers-BYi0v17h.js";import{t as Se}from"./git-branch-BKr-Ij4u.js";import{t as Ce}from"./messages-square-DiMgWzoq.js";import{t as we}from"./refresh-cw-DopCMrtR.js";import{t as Te}from"./triangle-alert-RL_T3KLo.js";import{t as Ee}from"./button-BAbJxRzt.js";import{n as _}from"./settingsLayout-D8glO7f1.js";var De=i(`chart-pie`,[[`path`,{d:`M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z`,key:`pzmjnu`}],[`path`,{d:`M21.21 15.89A10 10 0 1 1 8 2.83`,key:`k2fpak`}]]),Oe=i(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),ke=i(`dollar-sign`,[[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`22`,key:`7eqyqh`}],[`path`,{d:`M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6`,key:`1b0p4s`}]]),Ae=e(t(),1),v=n(),y=r();function je(e){let t=(0,v.c)(10),{models:n}=e;if(n.length===0){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,y.jsx)(`div`,{className:`px-4 py-8 text-center text-muted-foreground text-xs`,children:`No model usage yet.`}),t[0]=e):e=t[0],e}let r;t[1]===n?r=t[2]:(r=n.reduce(b,0)||1,t[1]=n,t[2]=r);let i=r,a;if(t[3]!==i||t[4]!==n){let e;t[6]===i?e=t[7]:(e=(e,t)=>{let n=l(t),r=Math.max(2,e.totalTokens/i*100);return(0,y.jsxs)(`li`,{className:`flex items-center gap-3 px-4 py-3`,children:[(0,y.jsx)(`span`,{className:`w-4 text-center font-medium text-[11px] text-muted-foreground tabular-nums`,children:t+1}),(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:`truncate font-medium text-[13px] text-foreground`,children:d(e.model)}),(0,y.jsx)(`span`,{className:`shrink-0 font-medium text-foreground text-xs tabular-nums`,children:u(e.totalTokens)})]}),(0,y.jsx)(`div`,{className:`mt-1.5 h-1.5 w-full overflow-hidden rounded-full bg-muted`,children:(0,y.jsx)(`div`,{className:`h-full rounded-full transition-[width] duration-500`,style:{width:`${r}%`,backgroundColor:n}})}),(0,y.jsxs)(`div`,{className:`mt-1 flex items-center justify-between text-[11px] text-muted-foreground`,children:[(0,y.jsx)(`span`,{className:`truncate`,children:c(e.provider)}),(0,y.jsx)(`span`,{className:`shrink-0 tabular-nums`,children:e.costUsd===null?`—`:`~${ce(e.costUsd)}`})]})]})]},`${e.provider??`unknown`}:${e.model}`)},t[6]=i,t[7]=e),a=n.map(e),t[3]=i,t[4]=n,t[5]=a}else a=t[5];let o;return t[8]===a?o=t[9]:(o=(0,y.jsx)(`ol`,{className:`divide-y divide-border/50`,children:a}),t[8]=a,t[9]=o),o}function b(e,t){return Math.max(e,t.totalTokens)}function x(){let e=(0,v.c)(92),{snapshot:t,loading:n,error:r,refresh:i,refreshing:l}=pe(),b;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(b={range:`30d`,projectId:null,model:null,provider:null},e[0]=b):b=e[0];let[x,Ie]=(0,Ae.useState)(b),w;bb0:{if(!t){w=null;break bb0}let n,r,i,a,o,s,c,l;if(e[1]!==x||e[2]!==t){let u=ne(t,x),d=ue(t),f=le(u),te=f.reduce(Fe,0);n=re(u),r=me(t,x),i=f,a=te,o=se(u),s=de(u,d),c=fe(t,u,x.range),l=ee(f),e[1]=x,e[2]=t,e[3]=n,e[4]=r,e[5]=i,e[6]=a,e[7]=o,e[8]=s,e[9]=c,e[10]=l}else n=e[3],r=e[4],i=e[5],a=e[6],o=e[7],s=e[8],c=e[9],l=e[10];let u;e[11]!==n||e[12]!==r||e[13]!==i||e[14]!==a||e[15]!==o||e[16]!==s||e[17]!==c||e[18]!==l?(u={totals:n,previous:r,models:i,totalsAllModels:a,providers:o,projects:s,series:c,cost:l},e[11]=n,e[12]=r,e[13]=i,e[14]=a,e[15]=o,e[16]=s,e[17]=c,e[18]=l,e[19]=u):u=e[19],w=u}let Le=w;if(n&&!t){let t;return e[20]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,y.jsx)(_,{children:(0,y.jsx)(oe,{})}),e[20]=t):t=e[20],t}if(r&&!t){let t;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,y.jsx)(we,{}),e[21]=t):t=e[21];let n;e[22]===i?n=e[23]:(n=(0,y.jsxs)(Ee,{size:`sm`,variant:`outline`,onClick:i,children:[t,` Try again`]}),e[22]=i,e[23]=n);let a;return e[24]!==r||e[25]!==n?(a=(0,y.jsx)(_,{children:(0,y.jsx)(ae,{icon:Te,title:`Couldn’t load statistics`,description:r,action:n})}),e[24]=r,e[25]=n,e[26]=a):a=e[26],a}if(!t||!Le)return null;let T=t.dailyBuckets.length>0,{totals:E,previous:D,models:O,totalsAllModels:k,providers:A,projects:j,series:M,cost:N}=Le,P=O[0],F;e[27]!==P||e[28]!==k?(F=P&&k>0?Math.round(P.totalTokens/k*100):0,e[27]=P,e[28]=k,e[29]=F):F=e[29];let I=F,L;e[30]===M?L=e[31]:(L=M.map(Pe),e[30]=M,e[31]=L);let R=L,z;e[32]===M?z=e[33]:(z=M.map(Ne),e[32]=M,e[33]=z);let Re=z,B=Math.max(0,E.totalTokens-E.inputTokens-E.outputTokens),V;e[34]!==E.inputTokens||e[35]!==E.outputTokens||e[36]!==B?(V=B>0?`${u(E.inputTokens)} in · ${u(E.outputTokens)} out · ${u(B)} other`:`${u(E.inputTokens)} in · ${u(E.outputTokens)} out`,e[34]=E.inputTokens,e[35]=E.outputTokens,e[36]=B,e[37]=V):V=e[37];let ze=V,H;e[38]===M?H=e[39]:(H=M.some(Me),e[38]=M,e[39]=H);let Be=H,Ve=t.tokenAttribution===`thread-cumulative`?`Token figures use cumulative thread snapshots when providers or older sessions do not expose per-turn deltas.`:t.tokenAttribution===`mixed`?`Token figures combine exact per-turn deltas where available with cumulative snapshots for older or provider-limited sessions.`:`Token figures use exact per-turn deltas where providers report them.`,U;e[40]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,y.jsx)(`h1`,{className:`font-semibold text-foreground text-lg`,children:`Statistics`}),e[40]=U):U=e[40];let W;e[41]===t.generatedAt?W=e[42]:(W=s(t.generatedAt),e[41]=t.generatedAt,e[42]=W);let G;e[43]===W?G=e[44]:(G=(0,y.jsxs)(`div`,{className:`space-y-0.5`,children:[U,(0,y.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Usage across your projects · as of `,W]})]}),e[43]=W,e[44]=G);let K=l?`animate-spin`:void 0,q;e[45]===K?q=e[46]:(q=(0,y.jsx)(we,{className:K}),e[45]=K,e[46]=q);let J;e[47]!==i||e[48]!==l||e[49]!==q?(J=(0,y.jsxs)(Ee,{size:`xs`,variant:`outline`,onClick:i,disabled:l,"aria-label":`Refresh statistics`,children:[q,`Refresh`]}),e[47]=i,e[48]=l,e[49]=q,e[50]=J):J=e[50];let Y;e[51]!==J||e[52]!==G?(Y=(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[G,J]}),e[51]=J,e[52]=G,e[53]=Y):Y=e[53];let X;e[54]!==x||e[55]!==t.models||e[56]!==t.projects?(X=(0,y.jsx)(ie,{filter:x,onChange:Ie,projects:t.projects,models:t.models}),e[54]=x,e[55]=t.models,e[56]=t.projects,e[57]=X):X=e[57];let Z;e[58]!==Y||e[59]!==X?(Z=(0,y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[Y,X]}),e[58]=Y,e[59]=X,e[60]=Z):Z=e[60];let Q;e[61]!==Re||e[62]!==Ve||e[63]!==N||e[64]!==T||e[65]!==Be||e[66]!==O||e[67]!==D?.activeMs||e[68]!==D?.threadsCreated||e[69]!==D?.totalTokens||e[70]!==j||e[71]!==A||e[72]!==M||e[73]!==t.worktrees||e[74]!==R||e[75]!==ze||e[76]!==P||e[77]!==I||e[78]!==E.activeMs||e[79]!==E.additions||e[80]!==E.commits||e[81]!==E.deletions||e[82]!==E.filesChanged||e[83]!==E.pushes||e[84]!==E.threadsCreated||e[85]!==E.toolUses||e[86]!==E.totalTokens||e[87]!==E.turns?(Q=T?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-5`,children:[(0,y.jsx)(m,{label:`Total tokens`,icon:Oe,value:u(E.totalTokens),sub:ze,delta:p(E.totalTokens,D?.totalTokens),sparkline:R}),(0,y.jsx)(m,{label:`Est. cost`,icon:ke,value:`~${ce(N.usd)}`,sub:N.hasUnpriced?`excludes unpriced models`:`estimated spend`}),(0,y.jsx)(m,{label:`Most used model`,icon:xe,value:(0,y.jsx)(`span`,{className:`block max-w-full truncate text-lg`,title:P?d(P.model):void 0,children:P?d(P.model):`—`}),sub:P?`${c(P.provider)} · ${I}% of tokens`:`no usage in range`}),(0,y.jsx)(m,{label:`Chats`,icon:Ce,value:g(E.threadsCreated),sub:`threads started`,delta:p(E.threadsCreated,D?.threadsCreated)}),(0,y.jsx)(m,{label:`Active time`,icon:ye,value:o(E.activeMs),sub:`${g(E.turns)} turns`,delta:p(E.activeMs,D?.activeMs),sparkline:Re})]}),(0,y.jsxs)(h,{title:`Token usage over time`,icon:ve,bodyClassName:`p-4`,children:[(0,y.jsx)(te,{data:M}),(0,y.jsxs)(`div`,{className:`mt-2 flex items-center gap-4 px-1 text-[11px] text-muted-foreground`,children:[(0,y.jsx)(S,{colorIndex:0,label:`Input`}),(0,y.jsx)(S,{colorIndex:1,label:`Output`}),Be?(0,y.jsx)(S,{colorIndex:2,label:`Other`}):null]})]}),(0,y.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,y.jsx)(h,{title:`Models`,icon:xe,bodyClassName:`overflow-hidden`,action:(0,y.jsxs)(`span`,{className:`text-[11px] text-muted-foreground`,children:[O.length,` total`]}),children:(0,y.jsx)(je,{models:O})}),(0,y.jsx)(h,{title:`Tokens by provider`,icon:De,bodyClassName:`p-4`,children:(0,y.jsx)(_e,{data:A})})]}),(0,y.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,y.jsx)(h,{title:`Tokens by project`,icon:ve,bodyClassName:`p-4`,children:(0,y.jsx)(he,{data:j})}),(0,y.jsxs)(h,{title:`Activity`,icon:a,bodyClassName:`p-4`,children:[(0,y.jsx)(ge,{points:M,metric:`turns`}),(0,y.jsx)(`p`,{className:`mt-3 text-[11px] text-muted-foreground`,children:`Turns per day`})]})]}),(0,y.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,y.jsxs)(h,{title:`Code changes`,icon:be,bodyClassName:`p-4`,children:[(0,y.jsxs)(`div`,{className:`mb-3 flex items-center gap-4 text-sm`,children:[(0,y.jsx)(C,{label:`Files`,value:g(E.filesChanged)}),(0,y.jsx)(C,{label:`Added`,value:`+${g(E.additions)}`,tone:`success`}),(0,y.jsx)(C,{label:`Removed`,value:`−${g(E.deletions)}`,tone:`destructive`})]}),(0,y.jsx)(f,{data:M})]}),(0,y.jsxs)(h,{title:`Source control`,icon:Se,bodyClassName:`p-4`,children:[(0,y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,y.jsx)(C,{label:`Worktrees`,value:g(t.worktrees.created)}),(0,y.jsx)(C,{label:`Active`,value:g(t.worktrees.active)}),(0,y.jsx)(C,{label:`Open PRs`,value:g(t.worktrees.openPrs)}),(0,y.jsx)(C,{label:`Tool uses`,value:g(E.toolUses)})]}),E.commits+E.pushes>0?(0,y.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-3 border-border/60 border-t pt-3`,children:[(0,y.jsx)(C,{label:`Commits`,value:g(E.commits)}),(0,y.jsx)(C,{label:`Pushes`,value:g(E.pushes)})]}):(0,y.jsx)(`p`,{className:`mt-3 border-border/60 border-t pt-3 text-[11px] text-muted-foreground`,children:`Commit & push counts aren’t recorded yet.`})]})]}),(0,y.jsxs)(`p`,{className:`px-1 text-[11px] text-muted-foreground/80`,children:[Ve,` Costs are rough estimates from a built-in price table and exclude subscription-billed or breakdown-less usage.`]})]}):(0,y.jsx)(ae,{icon:ve,title:`No activity yet`,description:`Once you start chatting with agents, your token usage, models, and code changes will show up here.`}),e[61]=Re,e[62]=Ve,e[63]=N,e[64]=T,e[65]=Be,e[66]=O,e[67]=D?.activeMs,e[68]=D?.threadsCreated,e[69]=D?.totalTokens,e[70]=j,e[71]=A,e[72]=M,e[73]=t.worktrees,e[74]=R,e[75]=ze,e[76]=P,e[77]=I,e[78]=E.activeMs,e[79]=E.additions,e[80]=E.commits,e[81]=E.deletions,e[82]=E.filesChanged,e[83]=E.pushes,e[84]=E.threadsCreated,e[85]=E.toolUses,e[86]=E.totalTokens,e[87]=E.turns,e[88]=Q):Q=e[88];let $;return e[89]!==Z||e[90]!==Q?($=(0,y.jsxs)(_,{children:[Z,Q]}),e[89]=Z,e[90]=Q,e[91]=$):$=e[91],$}function Me(e){return e.uncategorizedTokens>0}function Ne(e){return e.activeMs}function Pe(e){return e.totalTokens}function Fe(e,t){return e+t.totalTokens}function S(e){let t=(0,v.c)(7),{colorIndex:n,label:r}=e,i;t[0]===n?i=t[1]:(i=l(n),t[0]=n,t[1]=i);let a;t[2]===i?a=t[3]:(a=(0,y.jsx)(`span`,{className:`size-2.5 rounded-[3px]`,style:{backgroundColor:i}}),t[2]=i,t[3]=a);let o;return t[4]!==r||t[5]!==a?(o=(0,y.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[a,r]}),t[4]=r,t[5]=a,t[6]=o):o=t[6],o}function C(e){let t=(0,v.c)(8),{label:n,value:r,tone:i}=e,a;t[0]===n?a=t[1]:(a=(0,y.jsx)(`span`,{className:`text-[11px] text-muted-foreground uppercase tracking-[0.06em]`,children:n}),t[0]=n,t[1]=a);let o=i===`success`?`font-semibold text-base text-success-foreground tabular-nums`:i===`destructive`?`font-semibold text-base text-destructive tabular-nums`:`font-semibold text-base text-foreground tabular-nums`,s;t[2]!==o||t[3]!==r?(s=(0,y.jsx)(`span`,{className:o,children:r}),t[2]=o,t[3]=r,t[4]=s):s=t[4];let c;return t[5]!==a||t[6]!==s?(c=(0,y.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[a,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}export{x as StatisticsPanel};
|