@wrongstack/webui 0.310.0 → 0.313.0
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/assets/{AgentRosterView-D65_58jj.js → AgentRosterView-CoAI4zVY.js} +1 -1
- package/dist/assets/{AnalyticsDashboard-DOc43lwL.js → AnalyticsDashboard-BHKB7MA7.js} +1 -1
- package/dist/assets/{AudienceMemoryPanel-BLpp2tHi.js → AudienceMemoryPanel-B1Ddueaa.js} +1 -1
- package/dist/assets/{ChangesView-DgBKkM9W.js → ChangesView-DEsqwAdJ.js} +1 -1
- package/dist/assets/{ChronicleDashboard-DTQBK3sz.js → ChronicleDashboard-CCoGRIP2.js} +1 -1
- package/dist/assets/{CodeEditor-C_i1OpFY.js → CodeEditor-C8nAvIw1.js} +1 -1
- package/dist/assets/{CodeMap-DAiZc6KR.js → CodeMap-BvqQN6MG.js} +1 -1
- package/dist/assets/{ConfirmModal-e_pAJNXI.js → ConfirmModal-CRSE2t_c.js} +1 -1
- package/dist/assets/{CronJobsPanel-Bd9yYc54.js → CronJobsPanel-CUPHNDwl.js} +1 -1
- package/dist/assets/{DeadCodeScanPanel-DX6kTHMe.js → DeadCodeScanPanel-Dj-5SAEE.js} +1 -1
- package/dist/assets/{DebugDashboard-DzZ2VgUh.js → DebugDashboard-DmgHPeuw.js} +1 -1
- package/dist/assets/{DesignGalleryView-C6V81Ve6.js → DesignGalleryView-DHVayfgO.js} +1 -1
- package/dist/assets/{GoalView-D8IvL8gu.js → GoalView-BV0HgkVM.js} +1 -1
- package/dist/assets/{KanbanView-CgAYUWMt.js → KanbanView-_S_44j5W.js} +1 -1
- package/dist/assets/{MailboxDetailView-DVhX5QJL.js → MailboxDetailView-DS0INWjY.js} +1 -1
- package/dist/assets/{MemoryDrawer-8sFKIDFT.js → MemoryDrawer-CASOliWm.js} +1 -1
- package/dist/assets/{MemoryManager-UVJcZ8F1.js → MemoryManager-CHJccmRF.js} +1 -1
- package/dist/assets/{ModelPicker-BX3TyLGh.js → ModelPicker-BD-yKqK0.js} +1 -1
- package/dist/assets/{OfficeMapPanel-CGquZdpA.js → OfficeMapPanel-CeK44Zg_.js} +1 -1
- package/dist/assets/{ProcessMonitor-DWRyMBcK.js → ProcessMonitor-QErl6IY_.js} +1 -1
- package/dist/assets/{PromptJournalView-D7cxTV4b.js → PromptJournalView-CoLmLGEt.js} +1 -1
- package/dist/assets/{QueuePanel-BHC0oZuW.js → QueuePanel-rdZBX64y.js} +1 -1
- package/dist/assets/{RefreshDebugView-CYtfPKpz.js → RefreshDebugView-CzGncYqB.js} +1 -1
- package/dist/assets/RequirementIntakeView-exfkRXjK.js +1 -0
- package/dist/assets/{SageTabs-twWj7FY5.js → SageTabs-he_mI7tp.js} +2 -2
- package/dist/assets/{SddFlowGraph-DRoJjwE7.js → SddFlowGraph-C484p5L9.js} +1 -1
- package/dist/assets/{SddHub-GEtMx-VT.js → SddHub-Fv-cENSK.js} +1 -1
- package/dist/assets/{SessionInspectView-Bj3lSgGC.js → SessionInspectView--89Niv2G.js} +1 -1
- package/dist/assets/{SessionList-Q2e5-_66.js → SessionList-DLmayeUi.js} +1 -1
- package/dist/assets/{SessionsDashboard-zMKgGHVE.js → SessionsDashboard-DiGHUFnB.js} +1 -1
- package/dist/assets/{SetupScreen-OTuQXHs_.js → SetupScreen-DHa4BQF7.js} +1 -1
- package/dist/assets/{SkillDetailView-DOuDqdnT.js → SkillDetailView-CQ6luqj6.js} +1 -1
- package/dist/assets/{SpecsView-DCXc8NKW.js → SpecsView-Bkrq2hhM.js} +1 -1
- package/dist/assets/{TechStackView-DBYyTF6H.js → TechStackView-B4xMV0Z9.js} +1 -1
- package/dist/assets/{TerminalPanel-D8ZfgplP.js → TerminalPanel-D25-VKJU.js} +1 -1
- package/dist/assets/{Toaster-tBe1ZrKx.js → Toaster-CcgCyzaU.js} +1 -1
- package/dist/assets/i18n-BeHaHx3x.js +2 -0
- package/dist/assets/{index-Cyhuj8ku.js → index-CGMJmLO0.js} +55 -55
- package/dist/assets/settings-BNbqEBSr.js +1 -0
- package/dist/assets/settings-BV1_j8_-.js +1 -0
- package/dist/assets/settings-BsZgLIo2.js +1 -0
- package/dist/assets/settings-C3OnmFrY.js +1 -0
- package/dist/assets/settings-C3bNf1Bx.js +1 -0
- package/dist/assets/settings-C9FOpDBt.js +1 -0
- package/dist/assets/settings-oeXlO4HA.js +1 -0
- package/dist/assets/{stores-D9Ng0JyF.js → stores-CHaV9Mb9.js} +1 -1
- package/dist/assets/{useWebSocket-B2jKc_G4.js → useWebSocket-DJWEKY_A.js} +1 -1
- package/dist/components/SettingsPanel/ProviderHealthSection.d.ts +15 -0
- package/dist/index.html +8 -8
- package/dist/index.js +9049 -8284
- package/dist/stores/local-prefs.d.ts +14 -1
- package/package.json +9 -9
- package/dist/assets/RequirementIntakeView-CqK3EO7I.js +0 -1
- package/dist/assets/i18n-dLvHUYek.js +0 -2
- package/dist/assets/settings-B36QpLU8.js +0 -1
- package/dist/assets/settings-B8Hgh9_X.js +0 -1
- package/dist/assets/settings-B8uABeWU.js +0 -1
- package/dist/assets/settings-CSwU_zzD.js +0 -1
- package/dist/assets/settings-DfID_cS9.js +0 -1
- package/dist/assets/settings-FXJ8SsEh.js +0 -1
- package/dist/assets/settings-RQKnX4dA.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Ci as n,Ga as r,Gi as i,Ji as a,Jr as o,La as s,Ni as c,Pa as l,Ua as u,Xi as d,bn as f,hn as p,lt as m,mt as h,or as g,pt as _}from"./vendor-DZ9_OO6N.js";import"./i18n-dLvHUYek.js";import{t as v}from"./useWebSocket-B2jKc_G4.js";import{t as y}from"./utils-BecmXwgG.js";import{t as b}from"./session-store-CKpAwNIm.js";import{R as x,g as S}from"./stores-D9Ng0JyF.js";import{C,E as w,T,b as E,c as D,w as O}from"./index-Cyhuj8ku.js";import{t as k}from"./SessionList-Q2e5-_66.js";var A=e(r(),1),j=m(),M=12;async function N(e){try{let t=await e.clone().json(),n=typeof t.error==`string`?t.error:t.message;if(typeof n==`string`&&n.trim())return n}catch{try{let t=await e.text();if(t.trim())return t.trim()}catch{}}return e.statusText||`HTTP ${e.status}`}function P(e){switch(e){case`running`:return{icon:(0,j.jsx)(l,{className:`h-3.5 w-3.5`}),cls:`text-success`};case`streaming`:return{icon:(0,j.jsx)(f,{className:`h-3.5 w-3.5`}),cls:`text-primary`};case`waiting_user`:return{icon:(0,j.jsx)(c,{className:`h-3.5 w-3.5`}),cls:`text-warning`};case`error`:return{icon:(0,j.jsx)(d,{className:`h-3.5 w-3.5`}),cls:`text-destructive`};case`idle`:return{icon:(0,j.jsx)(i,{className:`h-3.5 w-3.5`}),cls:`text-muted-foreground`};default:return{icon:(0,j.jsx)(a,{className:`h-3.5 w-3.5`}),cls:`text-muted-foreground`}}}function F(e){switch(e){case`active`:return{icon:(0,j.jsx)(_,{className:`h-3.5 w-3.5`}),cls:`text-success`,badge:`border-success/25 bg-success/8 text-success`};case`idle`:return{icon:(0,j.jsx)(h,{className:`h-3.5 w-3.5`}),cls:`text-primary`,badge:`border-primary/25 bg-primary/10 text-primary`};case`closing`:return{icon:(0,j.jsx)(c,{className:`h-3.5 w-3.5`}),cls:`text-warning`,badge:`border-warning/25 bg-warning/10 text-warning`};case`lost`:return{icon:(0,j.jsx)(h,{className:`h-3.5 w-3.5`}),cls:`text-destructive/60`,badge:`border-destructive/15 bg-destructive/5 text-destructive/70`};default:return{icon:(0,j.jsx)(h,{className:`h-3.5 w-3.5`}),cls:`text-muted-foreground`,badge:`border-border bg-muted text-muted-foreground`}}}function I(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return`<1m`;if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d`}function L(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/1e3);if(n<10)return u.t(`common:time.justNow`);if(n<60)return u.t(`common:time.secondsAgo`,{count:n});let r=Math.floor(n/60);return r<60?u.t(`common:time.minutesAgo`,{count:r}):u.t(`common:time.hoursAgo`,{count:Math.floor(r/60)})}function R(){let e=x(e=>e.wsConnected),t=b(e=>e.session?.id),{entries:n,loading:r,error:i}=S(s(e=>({entries:e.entries,loading:e.loading,error:e.error}))),{listSessions:a,resumeSession:o,deleteSession:c,renameSession:l}=v(),[u,d]=(0,A.useState)(``);return(0,A.useEffect)(()=>{e&&a(200)},[t,a,e]),(0,j.jsx)(k,{historyQuery:u,setHistoryQuery:d,historyEntries:n,historyLoading:r,historyError:i,wsConnected:e,listSessions:a,resumeSession:o,deleteSession:c,renameSession:l,variant:`workspace`})}function z(){let{t:e}=t();return(0,j.jsxs)(C,{defaultValue:`history`,className:`flex h-full min-h-0 flex-col bg-background`,"data-testid":`sessions-workspace`,children:[(0,j.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-3 border-b border-border/75 bg-card px-4 py-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-[0.16em] text-primary`,children:e(`activity:sessions.workspaceEyebrow`,{defaultValue:`Conversation control`})}),(0,j.jsx)(`h1`,{className:`mt-0.5 text-lg font-semibold tracking-tight`,children:e(`activity:sessions.workspaceTitle`,{defaultValue:`Sessions`})})]}),(0,j.jsxs)(T,{className:`h-9 min-h-9 justify-start border-border/75 bg-background p-0 shadow-none`,children:[(0,j.jsxs)(w,{value:`history`,className:`h-9 gap-1.5 border-r border-border/75 px-3 text-xs shadow-none data-[state=active]:bg-foreground data-[state=active]:text-background data-[state=active]:ring-0`,children:[(0,j.jsx)(p,{className:`h-3.5 w-3.5`}),e(`activity:sessions.tabs.history`,{defaultValue:`History`})]}),(0,j.jsxs)(w,{value:`live`,className:`h-9 gap-1.5 px-3 text-xs shadow-none data-[state=active]:bg-foreground data-[state=active]:text-background data-[state=active]:ring-0`,children:[(0,j.jsx)(f,{className:`h-3.5 w-3.5`}),e(`activity:sessions.tabs.live`,{defaultValue:`Live sessions`})]})]})]}),(0,j.jsx)(O,{value:`history`,className:`mt-0 min-h-0 flex-1 overflow-hidden ring-0`,children:(0,j.jsx)(R,{})}),(0,j.jsx)(O,{value:`live`,className:`mt-0 min-h-0 flex-1 overflow-hidden ring-0`,children:(0,j.jsx)(B,{})})]})}function B(){let{t:e}=t(),[r,i]=(0,A.useState)([]),[a,s]=(0,A.useState)(!0),[l,u]=(0,A.useState)(null),[f,p]=(0,A.useState)(1),m=D(`sessions`,!a&&!l&&r.length>0),v=(0,A.useCallback)(async()=>{try{let e=await fetch(`/api/sessions`);if(!e.ok){if(e.status===404){u(null),i([]);return}throw Error(`HTTP ${e.status}: ${await N(e)}`)}if(!(e.headers.get(`content-type`)?.toLowerCase()??``).includes(`application/json`)){u(null),i([]);return}let t=await e.json();if(!Array.isArray(t)){u(null),i([]);return}i(e=>{let n=t;if(e.length===n.length){let t=!0;for(let r=0;r<n.length;r++){let i=n[r],a=e[r];if(i.sessionId!==a.sessionId||i.status!==a.status||i.agentCount!==a.agentCount||i.startedAt!==a.startedAt){t=!1;break}}if(t)return e}return n}),u(null)}catch(e){if(e instanceof SyntaxError){u(null),i([]);return}u(e instanceof Error?e.message:String(e))}finally{s(!1)}},[]);(0,A.useEffect)(()=>{v();let e=setInterval(v,5e3);return()=>clearInterval(e)},[v]);let b=r.filter(e=>e.status===`active`).length,x=r.reduce((e,t)=>e+t.agentCount,0),S=r.slice((f-1)*M,f*M);return(0,A.useEffect)(()=>{let e=Math.max(1,Math.ceil(r.length/M));f>e&&p(e)},[f,r.length]),a?(0,j.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)] p-4`,children:(0,j.jsxs)(`div`,{className:`ws-surface flex items-center gap-2 px-4 py-3 text-sm text-muted-foreground`,children:[(0,j.jsx)(g,{className:`h-4 w-4 animate-spin text-primary`}),e(`activity:liveSessions.loading`)]})}):l?(0,j.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)] p-4`,children:(0,j.jsxs)(`div`,{className:`ws-surface max-w-lg p-5 text-center`,children:[(0,j.jsx)(d,{className:`mx-auto h-8 w-8 text-warning`}),(0,j.jsx)(`p`,{className:`mt-3 text-sm font-medium`,children:e(`activity:liveSessions.apiUnavailable`)}),(0,j.jsx)(`p`,{className:`mt-1 break-words text-xs text-muted-foreground`,children:l})]})}):r.length===0?(0,j.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)] p-4`,children:(0,j.jsxs)(`div`,{className:`ws-surface max-w-md p-6 text-center text-muted-foreground`,children:[(0,j.jsx)(h,{className:`mx-auto h-9 w-9 opacity-50`}),(0,j.jsx)(`p`,{className:`mt-3 text-sm font-medium text-foreground`,children:e(`activity:liveSessions.empty`)}),(0,j.jsx)(`p`,{className:`mt-1 text-xs`,children:e(`activity:liveSessions.autoRefresh`)})]})}):(0,j.jsx)(`div`,{ref:m,className:`h-full min-h-0 overflow-y-auto overscroll-contain bg-[hsl(var(--surface-2)/0.45)] p-4 sm:p-6`,children:(0,j.jsxs)(`div`,{className:`mx-auto flex w-full max-w-6xl flex-col gap-4`,children:[(0,j.jsx)(`header`,{className:`border border-border/70 bg-card/75 p-4`,children:(0,j.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(_,{className:`h-4 w-4 text-primary`}),(0,j.jsx)(`h2`,{className:`text-base font-semibold`,children:e(`activity:liveSessions.heading`,{count:r.length})})]}),(0,j.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e(`activity:liveSessions.autoRefresh`)})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 text-center sm:min-w-[22rem]`,children:[(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/60 px-3 py-2`,children:[(0,j.jsx)(`div`,{className:`text-lg font-semibold tabular-nums`,children:r.length}),(0,j.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground`,children:e(`activity:sessionsDash.sessions`)})]}),(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/60 px-3 py-2`,children:[(0,j.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-success`,children:b}),(0,j.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground`,children:e(`activity:sessionsDash.active`)})]}),(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/60 px-3 py-2`,children:[(0,j.jsx)(`div`,{className:`text-lg font-semibold tabular-nums`,children:x}),(0,j.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground`,children:e(`activity:sessionsDash.agents`)})]})]})]})}),(0,j.jsx)(`div`,{className:`grid gap-3`,children:S.map(t=>{let r=F(t.status);return(0,j.jsxs)(`article`,{className:`border border-border/70 bg-card/75 p-3 sm:p-4`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 lg:flex-row lg:items-start lg:justify-between`,children:[(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,j.jsx)(`span`,{className:r.cls,children:r.icon}),(0,j.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold`,title:t.projectName,children:t.projectName}),(0,j.jsx)(`span`,{className:`bg-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground`,children:t.projectSlug}),(0,j.jsx)(`span`,{className:`inline-flex items-center border px-1.5 py-0.5 text-[10px] font-semibold uppercase ${r.badge}`,children:t.status})]}),(0,j.jsxs)(`div`,{className:`mt-2 grid gap-1.5 text-xs text-muted-foreground md:grid-cols-[minmax(0,1fr)_auto]`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,j.jsx)(n,{className:`h-3.5 w-3.5 shrink-0`}),(0,j.jsx)(`span`,{className:`min-w-0 truncate font-mono`,title:t.workingDir,children:t.workingDir})]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[t.gitBranch?(0,j.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1 text-primary`,children:[(0,j.jsx)(o,{className:`h-3.5 w-3.5 shrink-0`}),(0,j.jsx)(`span`,{className:`truncate font-mono`,children:t.gitBranch})]}):null,(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,j.jsx)(c,{className:`h-3.5 w-3.5`}),I(t.startedAt)]}),(0,j.jsx)(`span`,{className:`font-mono`,children:e(`activity:liveSessions.pidLabel`,{pid:t.pid})})]})]})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-xs sm:grid-cols-3 lg:w-64`,children:[(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/50 px-2 py-1.5`,children:[(0,j.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:e(`activity:sessionsDash.agents`)}),(0,j.jsx)(`div`,{className:`font-semibold tabular-nums`,children:t.agentCount})]}),(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/50 px-2 py-1.5`,children:[(0,j.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:e(`activity:sessionsDash.status`)}),(0,j.jsx)(`div`,{className:`truncate font-mono font-semibold`,children:t.status})]}),(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/50 px-2 py-1.5`,children:[(0,j.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:e(`activity:sessionsDash.runtime`)}),(0,j.jsx)(`div`,{className:`font-mono font-semibold`,children:I(t.startedAt)})]})]})]}),(0,j.jsxs)(`div`,{className:`mt-3 overflow-hidden border border-border/70 bg-background/45`,children:[t.agents.length===0?(0,j.jsx)(`div`,{className:`px-3 py-3 text-xs text-muted-foreground`,children:e(`activity:liveSessions.noAgents`)}):(0,j.jsx)(`div`,{className:`divide-y divide-border/60`,children:t.agents.slice(0,5).map(t=>{let n=P(t.status);return(0,j.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-1 px-3 py-2 text-xs sm:grid-cols-[auto_minmax(0,1fr)_minmax(0,14rem)_auto]`,children:[(0,j.jsx)(`span`,{className:y(`mt-0.5 shrink-0`,n.cls),children:n.icon}),(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`div`,{className:`truncate font-medium`,title:t.name,children:t.name}),(0,j.jsx)(`div`,{className:`font-mono text-[10px] text-muted-foreground`,children:e(`activity:liveSessions.agentMeta`,{iter:t.iterations,tools:t.toolCalls,ago:L(t.lastActivityAt)})})]}),(0,j.jsx)(`div`,{className:`min-w-0 font-mono text-[10px] text-muted-foreground sm:text-xs`,children:t.currentTool?(0,j.jsx)(`span`,{className:`block truncate`,title:t.currentTool,children:t.currentTool}):(0,j.jsx)(`span`,{className:`text-muted-foreground/75`,children:t.status})}),(0,j.jsx)(`span`,{className:`hidden font-mono text-[10px] text-muted-foreground sm:block`,children:L(t.lastActivityAt)})]},t.id)})}),t.agents.length>5?(0,j.jsx)(`div`,{className:`border-t border-border/60 px-3 py-2 text-xs text-muted-foreground`,children:e(`activity:liveSessions.andMore`,{count:t.agents.length-5})}):null]})]},t.sessionId)})}),(0,j.jsx)(E,{page:f,pageSize:M,totalItems:r.length,onPageChange:p,itemLabel:`sessions`})]})})}export{z as SessionsDashboard};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Ci as n,Ga as r,Gi as i,Ji as a,Jr as o,La as s,Ni as c,Pa as l,Ua as u,Xi as d,bn as f,hn as p,lt as m,mt as h,or as g,pt as _}from"./vendor-DZ9_OO6N.js";import"./i18n-BeHaHx3x.js";import{t as v}from"./useWebSocket-DJWEKY_A.js";import{t as y}from"./utils-BecmXwgG.js";import{t as b}from"./session-store-CKpAwNIm.js";import{R as x,g as S}from"./stores-CHaV9Mb9.js";import{C,E as w,T,b as E,c as D,w as O}from"./index-CGMJmLO0.js";import{t as k}from"./SessionList-DLmayeUi.js";var A=e(r(),1),j=m(),M=12;async function N(e){try{let t=await e.clone().json(),n=typeof t.error==`string`?t.error:t.message;if(typeof n==`string`&&n.trim())return n}catch{try{let t=await e.text();if(t.trim())return t.trim()}catch{}}return e.statusText||`HTTP ${e.status}`}function P(e){switch(e){case`running`:return{icon:(0,j.jsx)(l,{className:`h-3.5 w-3.5`}),cls:`text-success`};case`streaming`:return{icon:(0,j.jsx)(f,{className:`h-3.5 w-3.5`}),cls:`text-primary`};case`waiting_user`:return{icon:(0,j.jsx)(c,{className:`h-3.5 w-3.5`}),cls:`text-warning`};case`error`:return{icon:(0,j.jsx)(d,{className:`h-3.5 w-3.5`}),cls:`text-destructive`};case`idle`:return{icon:(0,j.jsx)(i,{className:`h-3.5 w-3.5`}),cls:`text-muted-foreground`};default:return{icon:(0,j.jsx)(a,{className:`h-3.5 w-3.5`}),cls:`text-muted-foreground`}}}function F(e){switch(e){case`active`:return{icon:(0,j.jsx)(_,{className:`h-3.5 w-3.5`}),cls:`text-success`,badge:`border-success/25 bg-success/8 text-success`};case`idle`:return{icon:(0,j.jsx)(h,{className:`h-3.5 w-3.5`}),cls:`text-primary`,badge:`border-primary/25 bg-primary/10 text-primary`};case`closing`:return{icon:(0,j.jsx)(c,{className:`h-3.5 w-3.5`}),cls:`text-warning`,badge:`border-warning/25 bg-warning/10 text-warning`};case`lost`:return{icon:(0,j.jsx)(h,{className:`h-3.5 w-3.5`}),cls:`text-destructive/60`,badge:`border-destructive/15 bg-destructive/5 text-destructive/70`};default:return{icon:(0,j.jsx)(h,{className:`h-3.5 w-3.5`}),cls:`text-muted-foreground`,badge:`border-border bg-muted text-muted-foreground`}}}function I(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return`<1m`;if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d`}function L(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/1e3);if(n<10)return u.t(`common:time.justNow`);if(n<60)return u.t(`common:time.secondsAgo`,{count:n});let r=Math.floor(n/60);return r<60?u.t(`common:time.minutesAgo`,{count:r}):u.t(`common:time.hoursAgo`,{count:Math.floor(r/60)})}function R(){let e=x(e=>e.wsConnected),t=b(e=>e.session?.id),{entries:n,loading:r,error:i}=S(s(e=>({entries:e.entries,loading:e.loading,error:e.error}))),{listSessions:a,resumeSession:o,deleteSession:c,renameSession:l}=v(),[u,d]=(0,A.useState)(``);return(0,A.useEffect)(()=>{e&&a(200)},[t,a,e]),(0,j.jsx)(k,{historyQuery:u,setHistoryQuery:d,historyEntries:n,historyLoading:r,historyError:i,wsConnected:e,listSessions:a,resumeSession:o,deleteSession:c,renameSession:l,variant:`workspace`})}function z(){let{t:e}=t();return(0,j.jsxs)(C,{defaultValue:`history`,className:`flex h-full min-h-0 flex-col bg-background`,"data-testid":`sessions-workspace`,children:[(0,j.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-3 border-b border-border/75 bg-card px-4 py-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-[0.16em] text-primary`,children:e(`activity:sessions.workspaceEyebrow`,{defaultValue:`Conversation control`})}),(0,j.jsx)(`h1`,{className:`mt-0.5 text-lg font-semibold tracking-tight`,children:e(`activity:sessions.workspaceTitle`,{defaultValue:`Sessions`})})]}),(0,j.jsxs)(T,{className:`h-9 min-h-9 justify-start border-border/75 bg-background p-0 shadow-none`,children:[(0,j.jsxs)(w,{value:`history`,className:`h-9 gap-1.5 border-r border-border/75 px-3 text-xs shadow-none data-[state=active]:bg-foreground data-[state=active]:text-background data-[state=active]:ring-0`,children:[(0,j.jsx)(p,{className:`h-3.5 w-3.5`}),e(`activity:sessions.tabs.history`,{defaultValue:`History`})]}),(0,j.jsxs)(w,{value:`live`,className:`h-9 gap-1.5 px-3 text-xs shadow-none data-[state=active]:bg-foreground data-[state=active]:text-background data-[state=active]:ring-0`,children:[(0,j.jsx)(f,{className:`h-3.5 w-3.5`}),e(`activity:sessions.tabs.live`,{defaultValue:`Live sessions`})]})]})]}),(0,j.jsx)(O,{value:`history`,className:`mt-0 min-h-0 flex-1 overflow-hidden ring-0`,children:(0,j.jsx)(R,{})}),(0,j.jsx)(O,{value:`live`,className:`mt-0 min-h-0 flex-1 overflow-hidden ring-0`,children:(0,j.jsx)(B,{})})]})}function B(){let{t:e}=t(),[r,i]=(0,A.useState)([]),[a,s]=(0,A.useState)(!0),[l,u]=(0,A.useState)(null),[f,p]=(0,A.useState)(1),m=D(`sessions`,!a&&!l&&r.length>0),v=(0,A.useCallback)(async()=>{try{let e=await fetch(`/api/sessions`);if(!e.ok){if(e.status===404){u(null),i([]);return}throw Error(`HTTP ${e.status}: ${await N(e)}`)}if(!(e.headers.get(`content-type`)?.toLowerCase()??``).includes(`application/json`)){u(null),i([]);return}let t=await e.json();if(!Array.isArray(t)){u(null),i([]);return}i(e=>{let n=t;if(e.length===n.length){let t=!0;for(let r=0;r<n.length;r++){let i=n[r],a=e[r];if(i.sessionId!==a.sessionId||i.status!==a.status||i.agentCount!==a.agentCount||i.startedAt!==a.startedAt){t=!1;break}}if(t)return e}return n}),u(null)}catch(e){if(e instanceof SyntaxError){u(null),i([]);return}u(e instanceof Error?e.message:String(e))}finally{s(!1)}},[]);(0,A.useEffect)(()=>{v();let e=setInterval(v,5e3);return()=>clearInterval(e)},[v]);let b=r.filter(e=>e.status===`active`).length,x=r.reduce((e,t)=>e+t.agentCount,0),S=r.slice((f-1)*M,f*M);return(0,A.useEffect)(()=>{let e=Math.max(1,Math.ceil(r.length/M));f>e&&p(e)},[f,r.length]),a?(0,j.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)] p-4`,children:(0,j.jsxs)(`div`,{className:`ws-surface flex items-center gap-2 px-4 py-3 text-sm text-muted-foreground`,children:[(0,j.jsx)(g,{className:`h-4 w-4 animate-spin text-primary`}),e(`activity:liveSessions.loading`)]})}):l?(0,j.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)] p-4`,children:(0,j.jsxs)(`div`,{className:`ws-surface max-w-lg p-5 text-center`,children:[(0,j.jsx)(d,{className:`mx-auto h-8 w-8 text-warning`}),(0,j.jsx)(`p`,{className:`mt-3 text-sm font-medium`,children:e(`activity:liveSessions.apiUnavailable`)}),(0,j.jsx)(`p`,{className:`mt-1 break-words text-xs text-muted-foreground`,children:l})]})}):r.length===0?(0,j.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)] p-4`,children:(0,j.jsxs)(`div`,{className:`ws-surface max-w-md p-6 text-center text-muted-foreground`,children:[(0,j.jsx)(h,{className:`mx-auto h-9 w-9 opacity-50`}),(0,j.jsx)(`p`,{className:`mt-3 text-sm font-medium text-foreground`,children:e(`activity:liveSessions.empty`)}),(0,j.jsx)(`p`,{className:`mt-1 text-xs`,children:e(`activity:liveSessions.autoRefresh`)})]})}):(0,j.jsx)(`div`,{ref:m,className:`h-full min-h-0 overflow-y-auto overscroll-contain bg-[hsl(var(--surface-2)/0.45)] p-4 sm:p-6`,children:(0,j.jsxs)(`div`,{className:`mx-auto flex w-full max-w-6xl flex-col gap-4`,children:[(0,j.jsx)(`header`,{className:`border border-border/70 bg-card/75 p-4`,children:(0,j.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(_,{className:`h-4 w-4 text-primary`}),(0,j.jsx)(`h2`,{className:`text-base font-semibold`,children:e(`activity:liveSessions.heading`,{count:r.length})})]}),(0,j.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e(`activity:liveSessions.autoRefresh`)})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 text-center sm:min-w-[22rem]`,children:[(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/60 px-3 py-2`,children:[(0,j.jsx)(`div`,{className:`text-lg font-semibold tabular-nums`,children:r.length}),(0,j.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground`,children:e(`activity:sessionsDash.sessions`)})]}),(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/60 px-3 py-2`,children:[(0,j.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-success`,children:b}),(0,j.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground`,children:e(`activity:sessionsDash.active`)})]}),(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/60 px-3 py-2`,children:[(0,j.jsx)(`div`,{className:`text-lg font-semibold tabular-nums`,children:x}),(0,j.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground`,children:e(`activity:sessionsDash.agents`)})]})]})]})}),(0,j.jsx)(`div`,{className:`grid gap-3`,children:S.map(t=>{let r=F(t.status);return(0,j.jsxs)(`article`,{className:`border border-border/70 bg-card/75 p-3 sm:p-4`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 lg:flex-row lg:items-start lg:justify-between`,children:[(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,j.jsx)(`span`,{className:r.cls,children:r.icon}),(0,j.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold`,title:t.projectName,children:t.projectName}),(0,j.jsx)(`span`,{className:`bg-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground`,children:t.projectSlug}),(0,j.jsx)(`span`,{className:`inline-flex items-center border px-1.5 py-0.5 text-[10px] font-semibold uppercase ${r.badge}`,children:t.status})]}),(0,j.jsxs)(`div`,{className:`mt-2 grid gap-1.5 text-xs text-muted-foreground md:grid-cols-[minmax(0,1fr)_auto]`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,j.jsx)(n,{className:`h-3.5 w-3.5 shrink-0`}),(0,j.jsx)(`span`,{className:`min-w-0 truncate font-mono`,title:t.workingDir,children:t.workingDir})]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[t.gitBranch?(0,j.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1 text-primary`,children:[(0,j.jsx)(o,{className:`h-3.5 w-3.5 shrink-0`}),(0,j.jsx)(`span`,{className:`truncate font-mono`,children:t.gitBranch})]}):null,(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,j.jsx)(c,{className:`h-3.5 w-3.5`}),I(t.startedAt)]}),(0,j.jsx)(`span`,{className:`font-mono`,children:e(`activity:liveSessions.pidLabel`,{pid:t.pid})})]})]})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-xs sm:grid-cols-3 lg:w-64`,children:[(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/50 px-2 py-1.5`,children:[(0,j.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:e(`activity:sessionsDash.agents`)}),(0,j.jsx)(`div`,{className:`font-semibold tabular-nums`,children:t.agentCount})]}),(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/50 px-2 py-1.5`,children:[(0,j.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:e(`activity:sessionsDash.status`)}),(0,j.jsx)(`div`,{className:`truncate font-mono font-semibold`,children:t.status})]}),(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/50 px-2 py-1.5`,children:[(0,j.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:e(`activity:sessionsDash.runtime`)}),(0,j.jsx)(`div`,{className:`font-mono font-semibold`,children:I(t.startedAt)})]})]})]}),(0,j.jsxs)(`div`,{className:`mt-3 overflow-hidden border border-border/70 bg-background/45`,children:[t.agents.length===0?(0,j.jsx)(`div`,{className:`px-3 py-3 text-xs text-muted-foreground`,children:e(`activity:liveSessions.noAgents`)}):(0,j.jsx)(`div`,{className:`divide-y divide-border/60`,children:t.agents.slice(0,5).map(t=>{let n=P(t.status);return(0,j.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-1 px-3 py-2 text-xs sm:grid-cols-[auto_minmax(0,1fr)_minmax(0,14rem)_auto]`,children:[(0,j.jsx)(`span`,{className:y(`mt-0.5 shrink-0`,n.cls),children:n.icon}),(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`div`,{className:`truncate font-medium`,title:t.name,children:t.name}),(0,j.jsx)(`div`,{className:`font-mono text-[10px] text-muted-foreground`,children:e(`activity:liveSessions.agentMeta`,{iter:t.iterations,tools:t.toolCalls,ago:L(t.lastActivityAt)})})]}),(0,j.jsx)(`div`,{className:`min-w-0 font-mono text-[10px] text-muted-foreground sm:text-xs`,children:t.currentTool?(0,j.jsx)(`span`,{className:`block truncate`,title:t.currentTool,children:t.currentTool}):(0,j.jsx)(`span`,{className:`text-muted-foreground/75`,children:t.status})}),(0,j.jsx)(`span`,{className:`hidden font-mono text-[10px] text-muted-foreground sm:block`,children:L(t.lastActivityAt)})]},t.id)})}),t.agents.length>5?(0,j.jsx)(`div`,{className:`border-t border-border/60 px-3 py-2 text-xs text-muted-foreground`,children:e(`activity:liveSessions.andMore`,{count:t.agents.length-5})}):null]})]},t.sessionId)})}),(0,j.jsx)(E,{page:f,pageSize:M,totalItems:r.length,onPageChange:p,itemLabel:`sessions`})]})})}export{z as SessionsDashboard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Fr as n,Ga as r,La as i,Ti as a,Tn as o,Ua as s,Wt as c,en as l,jr as u,lt as d,ma as f,mi as p,na as m,or as h,qt as g,ra as _,t as v,ta as y,wa as b,xr as x,yn as S}from"./vendor-DZ9_OO6N.js";import"./i18n-dLvHUYek.js";import{t as C}from"./useWebSocket-B2jKc_G4.js";import{t as w}from"./ws-client-DXT4gi-N.js";import{t as T}from"./utils-BecmXwgG.js";import{R as E}from"./stores-D9Ng0JyF.js";import{o as D}from"./view-navigation-C1UDTk5R.js";import{n as O}from"./Toaster-tBe1ZrKx.js";import{a as k,n as ee,o as te,r as A,t as ne}from"./dialog-DPl7DolS.js";import{t as j}from"./button-Dhmop_yM.js";import{t as M}from"./input-C3rIQ26u.js";import{D as N,a as P,b as F,i as I,n as L,r as R,x as z}from"./index-Cyhuj8ku.js";var B=e(r(),1);function V(e,t=8e3){return new Promise((n,r)=>{let i=setTimeout(()=>{a(),r(Error(`timeout`))},t),a=e.on(`key.operation_result`,e=>{clearTimeout(i),a(),n(e.payload)})})}var H=d();function re({onKeySaved:e}){let{t:n}=t(),[r,i]=(0,B.useState)(!1),[a,s]=(0,B.useState)(``),[c,l]=(0,B.useState)(`openai-compatible`),[u,d]=(0,B.useState)(``),[f,p]=(0,B.useState)(``),[m,g]=(0,B.useState)(!1),[_,v]=(0,B.useState)([]),{setFieldRef:b,handleKeyDown:x}=P(),S=async()=>{if(a.trim()){g(!0);try{let t=w(E.getState().wsUrl),r=V(t);t.send({type:`provider.add`,payload:{id:a.trim(),family:c,baseUrl:u.trim()||void 0,apiKey:f.trim()||void 0,models:_.length>0?_.map(e=>e.id):void 0,customModels:_.length>0?Object.fromEntries(_.filter(e=>e.name||e.maxOutput||e.capabilities).map(e=>[e.id,{...e.name&&e.name!==e.id?{name:e.name}:{},...e.maxOutput?{maxOutput:e.maxOutput}:{},...e.capabilities&&Object.values(e.capabilities).some(Boolean)?{capabilities:e.capabilities}:{}}])):void 0}});let o=await r;if(!o.success)throw Error(o.message);O.success(n(`setup:screen.toasts.providerAdded`,{id:a.trim()})),e(a.trim()),t.listSavedProviders(),t.probeProvider(a.trim()),s(``),d(``),p(``),v([]),i(!1)}catch(e){let t=e instanceof Error&&e.message&&e.message!==`timeout`?e.message:null;O.error(t??n(`setup:screen.toasts.providerAddFailed`))}finally{g(!1)}}};return(0,H.jsxs)(`div`,{className:`rounded-xl border border-dashed border-border/60 overflow-hidden`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>i(!r),className:`w-full flex items-center gap-3 p-4 text-left hover:bg-muted/30 transition-colors`,children:[(0,H.jsx)(`div`,{className:`w-10 h-10 rounded-lg bg-muted/50 flex items-center justify-center`,children:(0,H.jsx)(o,{className:`h-5 w-5 text-muted-foreground`})}),(0,H.jsxs)(`div`,{className:`flex-1`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-medium`,children:n(`setup:screen.custom.title`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`setup:screen.custom.description`)})]}),(0,H.jsx)(y,{className:T(`h-4 w-4 text-muted-foreground transition-transform`,r&&`rotate-90`)})]}),r&&(0,H.jsxs)(`div`,{className:`px-4 pb-4 space-y-3 border-t border-border/40`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5 pt-3`,children:[(0,H.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground block`,children:n(`setup:screen.custom.localServers`)}),(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:L.map(e=>(0,H.jsx)(j,{type:`button`,size:`sm`,variant:a===e.id?`default`:`outline`,onClick:()=>{s(e.id),l(`openai-compatible`),d(e.defaultBaseUrl),e.noAuth&&p(``),v([])},title:e.hint,children:e.label},e.id))})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:n(`setup:screen.custom.providerId`)}),(0,H.jsx)(M,{placeholder:n(`activity:customProviderSection.eGMyLlm`),value:a,onChange:e=>s(e.target.value),className:`text-sm`,ref:b(0),onKeyDown:e=>x(e,0)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:n(`setup:screen.custom.family`)}),(0,H.jsxs)(`select`,{value:c,onChange:e=>l(e.target.value),className:`flex h-9 w-full rounded-md border border-input bg-transparent px-3 text-sm`,ref:b(1),onKeyDown:e=>x(e,1),children:[(0,H.jsx)(`option`,{value:`openai-compatible`,children:n(`setup:screen.custom.familyOpenAiCompatible`)}),(0,H.jsx)(`option`,{value:`openai`,children:`OpenAI`}),(0,H.jsx)(`option`,{value:`anthropic`,children:`Anthropic`}),(0,H.jsx)(`option`,{value:`google`,children:`Google`})]})]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:n(`setup:screen.custom.baseUrl`)}),(0,H.jsx)(M,{placeholder:n(`activity:customProviderSection.eGHttpLocalhost11434V1`),value:u,onChange:e=>d(e.target.value),className:`text-sm font-mono`,ref:b(2),onKeyDown:e=>x(e,2)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:n(`setup:screen.custom.apiKey`)}),(0,H.jsx)(M,{type:`password`,placeholder:n(`setup:screen.custom.apiKeyPlaceholder`),value:f,onChange:e=>p(e.target.value),className:`text-sm font-mono`,ref:b(3),onKeyDown:e=>x(e,3)})]}),(0,H.jsx)(I,{models:_,onChange:v}),(0,H.jsxs)(j,{onClick:S,disabled:!a.trim()||m,size:`sm`,ref:b(4),onKeyDown:e=>x(e,4,S),children:[m?(0,H.jsx)(h,{className:`h-4 w-4 animate-spin mr-2`}):null,n(`setup:screen.custom.add`)]})]})]})}var U=R();async function ie(e,t){try{let n=await fetch(e,{signal:t});if(!n.ok)throw Error(`HTTP ${n.status}`);let r=await n.json();if(!Array.isArray(r))throw Error(`Expected JSON array`);let i=r.filter(e=>typeof e.id==`string`&&typeof e.name==`string`&&typeof e.family==`string`);return i.length>0?i:U}catch{return U}}function ae(e,t){let n=new Date().getTime()-e.getTime(),r=Math.floor(n/1e3);if(r<10)return t(`setup:screen.time.justNow`);if(r<60)return t(`setup:screen.time.secondsAgo`,{count:r});let i=Math.floor(r/60);if(i<60)return t(`setup:screen.time.minutesAgo`,{count:i});let a=Math.floor(i/60);return a<24?t(`setup:screen.time.hoursAgo`,{count:a}):t(`setup:screen.time.daysAgo`,{count:Math.floor(a/24)})}var oe=e(v(),1);function se({popular:e,catalogProvider:r,savedProvider:i,onKeySaved:o,probeResult:s}){let{t:c}=t(),[u,d]=(0,B.useState)(``),[f,g]=(0,B.useState)(!1),[v,b]=(0,B.useState)(!!i?.apiKeys.some(e=>e.isActive)),[x,S]=(0,B.useState)(!1),[C,D]=(0,B.useState)(!1),[N,P]=(0,B.useState)(!1),[F,I]=(0,B.useState)(null);(0,B.useEffect)(()=>{N&&e.referral&&oe.toDataURL(e.referral.url,{width:200,margin:2,color:{dark:`#000000`,light:`#ffffff`}}).then(e=>I(e)).catch(()=>I(null))},[N,e.referral]);let L=async()=>{if(u.trim()){g(!0);try{let t=w(E.getState().wsUrl),n=V(t);r?t.addKey(e.id,`default`,u.trim()):t.send({type:`provider.add`,payload:{id:e.id,family:e.family,apiKey:u.trim()}});let i=await n;if(!i.success)throw Error(i.message);b(!0),d(``),O.success(c(`setup:screen.toasts.keySaved`,{name:e.name})),o(e.id),t.listSavedProviders(),t.probeProvider(e.id)}catch(t){let n=t instanceof Error&&t.message&&t.message!==`timeout`?t.message:null;O.error(n??c(`setup:screen.toasts.keySaveFailed`,{name:e.name}))}finally{g(!1)}}},R=e=>{e.key===`Enter`&&u.trim()&&L()},z=async()=>{if(e.referral)try{await navigator.clipboard.writeText(e.referral.url),D(!0),O.success(c(`setup:screen.toasts.referralCopied`)),setTimeout(()=>D(!1),2e3)}catch{O.error(c(`setup:screen.toasts.referralCopyFailed`))}},re=r&&r.modelCount>0;return(0,H.jsxs)(`div`,{className:T(`rounded-xl border p-4 transition-all`,v?`border-success/30 bg-success/5`:`bg-gradient-to-br ${e.color}`),children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,H.jsx)(`span`,{className:`text-2xl shrink-0 mt-0.5`,children:e.icon}),(0,H.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold`,children:e.name}),v&&(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded-full bg-success/10 text-success border border-success/20`,children:[(0,H.jsx)(_,{className:`h-2.5 w-2.5`}),c(`setup:screen.card.keySaved`)]}),e.referral&&!v&&(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded-full bg-warning/10 text-warning border border-warning/20`,children:[(0,H.jsx)(n,{className:`h-2.5 w-2.5`}),c(`setup:screen.card.referral`)]})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e.description}),e.referral&&!v&&(0,H.jsxs)(`p`,{className:`text-[11px] text-warning/80 mt-1`,children:[`🎁 `,e.referral.reward]}),v?v?(0,H.jsxs)(`div`,{className:`mt-3 space-y-1`,children:[i?.baseUrl&&(0,H.jsxs)(`div`,{className:`text-[11px] text-muted-foreground/70 font-mono truncate`,title:i.baseUrl,children:[(0,H.jsxs)(`span`,{className:`text-muted-foreground/50`,children:[c(`activity:providerKey.url`),` `]}),i.baseUrl]}),i?.models&&i.models.length>0&&(0,H.jsxs)(`div`,{className:`text-[11px] text-muted-foreground/70`,children:[(0,H.jsxs)(`span`,{className:`text-muted-foreground/50`,children:[c(`activity:providerKey.models`),` `]}),i.pickedModelId??i.models[0],(0,H.jsxs)(`span`,{className:`text-muted-foreground/50`,children:[` (+`,i.models.length-1,` more)`]})]}),s===`probing`?(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-muted-foreground mt-1`,children:[(0,H.jsx)(h,{className:`h-3 w-3 animate-spin`}),c(`setup:screen.probe.checking`,`Checking connection…`)]}):s?.ok?(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-success mt-1`,children:[(0,H.jsx)(_,{className:`h-3 w-3`}),(0,H.jsxs)(`span`,{children:[c(`setup:screen.probe.connected`,`Connected`),s.modelCount!=null&&` · ${s.modelCount} ${c(`setup:screen.probe.models`,`models`)}`,s.elapsedMs!=null&&` · ${s.elapsedMs}ms`]})]}):s&&!s.ok?(0,H.jsxs)(`div`,{className:`flex items-start gap-1.5 text-[11px] text-destructive mt-1`,children:[(0,H.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:`✕`}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`span`,{className:`font-medium`,children:c(`setup:screen.probe.failed`,`Probe failed`)}),s.status===`no_base_url`&&(0,H.jsx)(`span`,{className:`block text-destructive/70`,children:c(`setup:screen.probe.noBaseUrl`,`No base URL configured`)}),s.status===`unreachable`&&(0,H.jsxs)(`span`,{className:`block text-destructive/70`,children:[c(`setup:screen.probe.unreachable`,`Could not connect`),s.detail?`: ${s.detail}`:``]}),s.status!==`no_base_url`&&s.status!==`unreachable`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`block text-destructive/70`,children:s.httpStatus==null?s.status:`${c(`setup:screen.probe.httpStatus`,`Status`)} ${s.httpStatus}`}),s.detail&&(0,H.jsx)(`span`,{className:`block text-destructive/70 truncate max-w-[250px]`,title:s.detail,children:s.detail})]})]})]}):null,re&&(0,H.jsxs)(`button`,{type:`button`,onClick:()=>S(!x),className:`text-[11px] text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1`,children:[c(`setup:screen.providers.modelsAvailable`,{count:r?.modelCount??0}),x?(0,H.jsx)(m,{className:`h-3 w-3`}):(0,H.jsx)(y,{className:`h-3 w-3`})]})]}):null:(0,H.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(M,{type:`password`,placeholder:e.keyPlaceholder,value:u,onChange:e=>d(e.target.value),onKeyDown:R,className:`font-mono text-sm`}),(0,H.jsx)(j,{onClick:L,disabled:!u.trim()||f,size:`sm`,className:`shrink-0`,children:f?(0,H.jsx)(h,{className:`h-4 w-4 animate-spin`}):c(`setup:screen.card.save`)})]}),e.docsUrl&&(0,H.jsxs)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors`,children:[c(`setup:screen.card.getKey`),` `,(0,H.jsx)(p,{className:`h-3 w-3`})]}),e.referral&&(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:z,className:`inline-flex items-center gap-1 text-[11px] text-warning/80 hover:text-warning transition-colors`,children:C?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(_,{className:`h-3 w-3`}),` `,c(`setup:screen.card.copied`)]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(a,{className:`h-3 w-3`}),` `,c(`setup:screen.card.copyReferral`)]})}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>P(!0),className:`inline-flex items-center gap-1 text-[11px] text-warning/80 hover:text-warning transition-colors`,children:[(0,H.jsx)(l,{className:`h-3 w-3`}),` `,c(`setup:screen.card.share`)]})]})]})]})]}),(0,H.jsx)(ne,{open:N,onOpenChange:P,children:(0,H.jsxs)(ee,{className:`sm:max-w-md`,children:[(0,H.jsxs)(k,{children:[(0,H.jsxs)(te,{className:`flex items-center gap-2`,children:[(0,H.jsx)(n,{className:`h-4 w-4 text-warning`}),c(`setup:screen.share.title`,{name:e.name})]}),(0,H.jsx)(A,{children:c(`setup:screen.share.description`)})]}),(0,H.jsx)(`div`,{className:`flex flex-col items-center gap-4 py-4`,children:e.referral&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`text-sm text-center`,children:(0,H.jsxs)(`p`,{className:`font-medium text-warning`,children:[`🎁 `,e.referral.reward]})}),F?(0,H.jsx)(`div`,{className:`rounded-lg border border-border p-2 bg-white`,children:(0,H.jsx)(`img`,{src:F,alt:c(`setup:screen.card.qrAlt`,{name:e.name}),className:`w-[200px] h-[200px]`})}):(0,H.jsx)(`div`,{className:`w-[200px] h-[200px] rounded-lg border border-border flex items-center justify-center bg-muted`,children:(0,H.jsx)(h,{className:`h-6 w-6 animate-spin text-muted-foreground`})}),(0,H.jsxs)(`div`,{className:`w-full space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-center gap-2`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`https://twitter.com/intent/tweet?text=${t}&url=${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:c(`setup:screen.share.twitter`),children:[(0,H.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,H.jsx)(`path`,{d:`M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z`})}),`X`]}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(e.referral.url),n=encodeURIComponent(`Check out ${e.name}! ${e.referral.reward}`);window.open(`https://www.linkedin.com/sharing/share-offsite/?url=${t}&summary=${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:c(`setup:screen.share.linkedin`),children:[(0,H.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,H.jsx)(`path`,{d:`M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z`})}),c(`activity:providerKey.linkedin`)]}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward} ${e.referral.url}`);window.open(`https://t.me/share/url?url=${t}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:c(`setup:screen.share.telegram`),children:[(0,H.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,H.jsx)(`path`,{d:`M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z`})}),c(`activity:providerKey.telegram`)]}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`https://wa.me/?text=${t}%20${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:c(`setup:screen.share.whatsapp`),children:[(0,H.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,H.jsx)(`path`,{d:`M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.134 1.585 5.934L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z`})}),c(`activity:providerKey.whatsapp`)]}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(e.referral.url),n=encodeURIComponent(`${e.name} - ${e.referral.reward}`);window.open(`https://www.reddit.com/submit?url=${t}&title=${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:c(`setup:screen.share.reddit`),children:[(0,H.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,H.jsx)(`path`,{d:`M12 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0zm5.01 4.744c.688 0 1.25.561 1.25 1.249a1.25 1.25 0 0 1-2.498.056l-2.597-.547-.8 3.747c1.824.07 3.48.632 4.674 1.488.308-.309.73-.491 1.207-.491.968 0 1.754.786 1.754 1.754 0 .716-.435 1.333-1.01 1.614a3.111 3.111 0 0 1 .042.52c0 2.694-3.13 4.87-7.004 4.87-3.874 0-7.004-2.176-7.004-4.87 0-.183.015-.366.043-.534A1.748 1.748 0 0 1 4.028 12c0-.968.786-1.754 1.754-1.754.463 0 .898.196 1.207.49 1.207-.883 2.878-1.43 4.744-1.487l.885-4.182a.342.342 0 0 1 .14-.197.35.35 0 0 1 .238-.042l2.906.617a1.214 1.214 0 0 0 1.108-.701 1.25 1.25 0 0 1 2.144.33zm-8.811 8.748c-.968 0-1.754.786-1.754 1.754 0 .968.786 1.754 1.754 1.754.968 0 1.754-.786 1.754-1.754 0-.968-.786-1.754-1.754-1.754zm7.944 0c-.968 0-1.754.786-1.754 1.754 0 .968.786 1.754 1.754 1.754.968 0 1.754-.786 1.754-1.754 0-.968-.786-1.754-1.754-1.754z`})}),c(`activity:providerKey.reddit`)]}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`https://www.facebook.com/sharer/sharer.php?u=${n}"e=${t}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:c(`setup:screen.share.facebook`),children:[(0,H.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,H.jsx)(`path`,{d:`M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z`})}),c(`activity:providerKey.facebook`)]}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`mailto:?subject=${t}&body=${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-muted text-muted-foreground text-xs hover:bg-muted/80 transition-colors`,title:c(`setup:screen.share.email`),children:[(0,H.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,viewBox:`0 0 24 24`,children:(0,H.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M21.75 6.75v10.5a2.25 2.25 0 01-2.25 2.25H4.5a2.25 2.25 0 01-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25m19.5 0v.243a2.25 2.25 0 01-1.07 1.916l-7.5 4.615a2.25 2.25 0 01-2.36 0L3.32 8.91a2.25 2.25 0 01-1.07-1.916V6.75`})}),c(`activity:providerKey.email`)]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(M,{value:e.referral.url,readOnly:!0,className:`font-mono text-xs flex-1`}),(0,H.jsx)(j,{size:`sm`,variant:`outline`,onClick:z,className:`shrink-0`,children:C?(0,H.jsx)(_,{className:`h-4 w-4`}):(0,H.jsx)(a,{className:`h-4 w-4`})})]}),(0,H.jsx)(`p`,{className:`text-[11px] text-muted-foreground text-center`,children:c(`setup:screen.share.hint`)})]})]})})]})})]})}function W(){let{t:e}=t(),{model:n,setProvider:r,setModel:a,wsConnected:o,wsUrl:l}=E(i(e=>({model:e.model,setProvider:e.setProvider,setModel:e.setModel,wsConnected:e.wsConnected,wsUrl:e.wsUrl})));C();let[d,p]=(0,B.useState)([]),[m,v]=(0,B.useState)({}),[k,ee]=(0,B.useState)([]),[te,A]=(0,B.useState)(!1),[ne,M]=(0,B.useState)(null),[P,I]=(0,B.useState)(0),[L,R]=(0,B.useState)(new Set),[V,oe]=(0,B.useState)({}),[W,ce]=(0,B.useState)(U),[G,K]=(0,B.useState)(!1),[le,ue]=(0,B.useState)(0),[de,fe]=(0,B.useState)(0),[q,pe]=(0,B.useState)(null),J=(0,B.useRef)(!0);(0,B.useEffect)(()=>{let e=new AbortController,t=`${window.location.origin}/providers.json`;return K(!0),ie(t,e.signal).then(t=>{if(t!==U){if(ce(t),K(!1),!J.current){let e=t.length-de;e>0?O.success(s.t(`setup:screen.toasts.providersLoadedNew`,{count:t.length,diff:e})):e<0?O.success(s.t(`setup:screen.toasts.providersLoadedRemoved`,{count:t.length,diff:Math.abs(e)})):O.success(s.t(`setup:screen.toasts.providersLoadedNoChanges`,{count:t.length})),fe(t.length)}pe(new Date);return}return ie(`https://raw.githubusercontent.com/WrongStack/WrongStack/main/packages/webui/public/providers.json`,e.signal)}).then(e=>{if(e){if(ce(e),!J.current){let t=e.length-de;t>0?O.success(s.t(`setup:screen.toasts.providersLoadedNew`,{count:e.length,diff:t})):t<0?O.success(s.t(`setup:screen.toasts.providersLoadedRemoved`,{count:e.length,diff:Math.abs(t)})):O.success(s.t(`setup:screen.toasts.providersLoadedNoChanges`,{count:e.length})),fe(e.length)}pe(new Date)}}).catch(()=>{J.current||O.error(s.t(`setup:screen.toasts.providersRefreshFailed`))}).finally(()=>{K(!1),J.current=!1}),()=>e.abort()},[le]);let[Y,me]=(0,B.useState)(null),[X,Z]=(0,B.useState)(null),[he,ge]=(0,B.useState)(!1);(0,B.useEffect)(()=>{if(!o)return;let e=w(l),t=setTimeout(()=>{t=null,A(!1),M(s.t(`setup:screen.errors.backendNotResponding`))},8e3),r=()=>{t&&=(clearTimeout(t),null)},i=e.on(`provider.catalog`,e=>{if(e.type===`provider.catalog`){r(),M(null);let t=e.payload.providers.sort((e,t)=>e.id.localeCompare(t.id));p(t),A(!1)}}),a=e.on(`provider.models`,e=>{if(e.type===`provider.models`){let t=e.payload;if(t.provider!==Y)return;v(e=>({...e,[t.provider]:t.models})),ge(!1),t.models.length===1?Z(t.models[0].id):n&&t.models.some(e=>e.id===n)&&Z(n)}}),c=e.on(`providers.saved`,e=>{if(e.type===`providers.saved`){let t=e.payload.providers.sort((e,t)=>e.id.localeCompare(t.id));ee(t);let n=new Set(t.filter(e=>e.apiKeys.some(e=>e.isActive)).map(e=>e.id));R(n)}}),u=e.on(`provider.probe`,e=>{if(e.type!==`provider.probe`)return;let t=e.payload;oe(e=>({...e,[t.providerId]:t}))});return M(null),A(!0),e.listProviders(),()=>{r(),i?.(),a?.(),c?.(),u?.()}},[o,l,n,P,Y]);let _e=(0,B.useCallback)(()=>{M(null),I(e=>e+1)},[]),ve=(0,B.useCallback)(()=>{ue(e=>e+1)},[]),ye=(0,B.useCallback)(t=>ae(t,e),[e]),be=(0,B.useCallback)(e=>{R(t=>new Set([...t,e])),me(e),Z(null)},[]),xe=L.size>0;(0,B.useEffect)(()=>{if(!Y||!o)return;let e=w(l);m[Y]||(ge(!0),e.listProviderModels(Y))},[Y,o,l,m]);let Se=Y?m[Y]??[]:[],Ce=(0,B.useCallback)(async()=>{if(!Y||!X)return;if(!L.has(Y)){O.error(`Please save the provider configuration before starting a session.`);return}r(Y),a(X);let e=w(l),t=await e.switchModel(Y,X,5e3);t.success?(e.newSession(),D(`chat`)):O.error(t.message||s.t(`setup:screen.errors.modelSwitchTimeout`))},[Y,X,r,a,l]),we=(0,B.useCallback)(async()=>{if(!Y||!X)return;r(Y),a(X);let e=await w(l).switchModel(Y,X,5e3);e.success?D(`chat`):O.error(e.message||s.t(`setup:screen.errors.modelSwitchTimeout`))},[Y,X,r,a,l]),Te=new Set(W.map(e=>e.id)),Ee=d.filter(e=>!Te.has(e.id)).sort((e,t)=>e.id.localeCompare(t.id)),Q=z(Ee,10);z(k,9);let $=z(Se,12,Y);return(0,H.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,H.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-3 border-b bg-card px-4 py-4 sm:flex-row sm:items-center sm:justify-between sm:px-6`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,H.jsx)(`img`,{src:`/wrongstack.svg`,alt:`WrongStack`,draggable:!1,className:`ws-brand-logo h-10 w-10 shrink-0 border border-border/70 shadow-sm`}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`h1`,{className:`truncate text-lg font-semibold`,children:e(`setup:screen.header.title`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground sm:truncate`,children:e(`setup:screen.header.subtitle`)})]})]}),xe&&Y?(0,H.jsxs)(`span`,{className:`text-xs text-success/80`,children:[(0,H.jsx)(_,{className:`h-3 w-3 inline-block mr-1`}),e(`setup:screen.header.continue`)]}):null]}),(0,H.jsx)(N,{className:`min-h-0 flex-1`,children:(0,H.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-8 p-4 pb-4 sm:p-6`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-sm`,children:[(0,H.jsxs)(`div`,{className:T(`flex min-w-0 items-center gap-1.5`,xe?`text-success`:`text-primary font-medium`),children:[(0,H.jsx)(x,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{children:e(`setup:screen.steps.addKeys`)})]}),(0,H.jsx)(y,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,H.jsxs)(`div`,{className:T(`flex min-w-0 items-center gap-1.5`,Y?`text-primary font-medium`:`text-muted-foreground`),children:[(0,H.jsx)(f,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{children:e(`setup:screen.steps.pickModel`)})]}),(0,H.jsx)(y,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,H.jsxs)(`div`,{className:T(`flex min-w-0 items-center gap-1.5`,Y&&X?`text-primary font-medium`:`text-muted-foreground`),children:[(0,H.jsx)(c,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{children:e(`setup:screen.steps.start`)})]})]}),(0,H.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-primary/20 bg-primary/5 p-4`,children:[(0,H.jsx)(g,{className:`h-5 w-5 text-primary shrink-0 mt-0.5`}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`text-sm font-medium`,children:e(`setup:screen.security.title`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e(`setup:screen.security.body`)})]})]}),ne?(0,H.jsxs)(`div`,{className:`flex flex-col items-center text-center gap-4 py-12 rounded-xl border border-destructive/30 bg-destructive/5 px-6`,children:[(0,H.jsx)(`div`,{className:`w-12 h-12 rounded-xl bg-destructive/10 border border-destructive/30 flex items-center justify-center`,children:(0,H.jsx)(u,{className:`h-6 w-6 text-destructive`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`text-sm font-medium text-destructive`,children:e(`setup:screen.errors.backendUnreachable`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1 max-w-sm`,children:ne})]}),(0,H.jsxs)(j,{onClick:_e,size:`sm`,variant:`outline`,children:[(0,H.jsx)(h,{className:`h-4 w-4 mr-2`}),e(`setup:screen.errors.retry`)]})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,H.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.popular`)}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[G&&(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground`,children:[(0,H.jsx)(h,{className:`h-3 w-3 animate-spin`}),e(`setup:screen.providers.updating`)]}),q&&!G&&(0,H.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,title:q.toLocaleString(),children:ye(q)}),(0,H.jsxs)(`button`,{type:`button`,onClick:ve,disabled:G,className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,title:e(`setup:screen.providers.refreshTitle`),children:[(0,H.jsx)(S,{className:T(`h-3 w-3`,G&&`animate-spin`)}),e(`setup:screen.providers.refresh`)]})]})]}),(0,H.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:W.map(e=>(0,H.jsx)(se,{popular:e,catalogProvider:d.find(t=>t.id===e.id),savedProvider:k.find(t=>t.id===e.id),onKeySaved:be,probeResult:V[e.id]},e.id))})]}),Ee.length>0&&(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.more`)}),(0,H.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:Q.pageItems.map(t=>(0,H.jsx)(se,{popular:{id:t.id,name:t.name,description:e(`setup:screen.providers.catalogDescription`,{family:t.family,count:t.modelCount}),icon:`🔗`,color:`from-muted/60 to-muted/20 border-border hover:border-primary/40`,keyPlaceholder:`API key`,family:t.family},catalogProvider:t,savedProvider:k.find(e=>e.id===t.id),onKeySaved:be,probeResult:V[t.id]},t.id))}),(0,H.jsx)(F,{page:Q.page,pageSize:Q.pageSize,totalItems:Q.totalItems,onPageChange:Q.setPage,itemLabel:`providers`})]}),(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.selfHosted`)}),(0,H.jsx)(re,{onKeySaved:be})]})]}),te&&(0,H.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,H.jsx)(h,{className:`h-6 w-6 animate-spin text-muted-foreground`})}),Y&&(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsxs)(`h2`,{className:`text-base font-semibold flex items-center gap-2`,children:[(0,H.jsx)(c,{className:`h-4 w-4 text-primary`}),e(`setup:screen.start.chooseModel`)]}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>{me(null),Z(null)},className:`text-xs text-muted-foreground hover:text-foreground transition-colors`,children:e(`setup:screen.start.addMoreKeys`)})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`setup:screen.start.modelsFor`,{provider:Y})}),he?(0,H.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,H.jsx)(h,{className:`h-6 w-6 animate-spin text-muted-foreground`})}):Se.length>0?(0,H.jsx)(`div`,{className:`grid grid-cols-1 gap-2`,children:$.pageItems.map(e=>{let t=e.contextWindow?`${(e.contextWindow/1e6).toFixed(0)}M ctx`:null;return(0,H.jsx)(`button`,{type:`button`,onClick:()=>Z(e.id),className:T(`w-full text-left rounded-xl border p-3 transition-all`,`hover:border-primary/40 hover:bg-primary/5`,X===e.id?`border-primary bg-primary/10 ring-1 ring-primary/30`:`border-border bg-card`),children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,H.jsx)(`span`,{className:`font-medium text-sm`,children:e.name}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 mt-1`,children:[t&&(0,H.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground`,children:t}),e.capabilities.slice(0,3).map(e=>(0,H.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-primary/10 text-primary border border-primary/20`,children:e},e))]})]}),X===e.id&&(0,H.jsx)(`div`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-primary`,children:(0,H.jsx)(_,{className:`h-3 w-3 text-primary-foreground`})})]})},e.id)})}):(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground py-8 text-center`,children:e(`setup:screen.errors.noModels`)}),(0,H.jsx)(F,{page:$.page,pageSize:$.pageSize,totalItems:$.totalItems,onPageChange:$.setPage,itemLabel:`models`})]}),Y&&X&&(0,H.jsxs)(`div`,{className:`sticky bottom-0 -mx-4 border-t bg-background/80 px-4 py-4 backdrop-blur-sm sm:-mx-6 sm:px-6`,children:[(0,H.jsx)(`div`,{className:`mb-3 flex min-w-0 items-center justify-between gap-2 text-sm text-muted-foreground`,children:(0,H.jsxs)(`span`,{className:`min-w-0 truncate`,children:[Y,` / `,X]})}),(0,H.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-2`,children:[(0,H.jsxs)(j,{onClick:Ce,className:`flex-1`,size:`lg`,children:[(0,H.jsx)(f,{className:`h-4 w-4 mr-2`}),e(`setup:screen.start.startSession`),(0,H.jsx)(b,{className:`h-4 w-4 ml-2`})]}),(0,H.jsxs)(j,{onClick:we,variant:`outline`,className:`flex-1`,size:`lg`,children:[(0,H.jsx)(_,{className:`h-4 w-4 mr-2`}),e(`setup:screen.start.saveConfig`)]})]}),(0,H.jsx)(`p`,{className:`text-[11px] text-muted-foreground/60 text-center mt-2`,children:e(`setup:screen.start.saveConfigHint`)})]})]})})]})}export{W as SetupScreen};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Fr as n,Ga as r,La as i,Ti as a,Tn as o,Ua as s,Wt as c,en as l,jr as u,lt as d,ma as f,mi as p,na as m,or as h,qt as g,ra as _,t as v,ta as y,wa as b,xr as x,yn as S}from"./vendor-DZ9_OO6N.js";import"./i18n-BeHaHx3x.js";import{t as C}from"./useWebSocket-DJWEKY_A.js";import{t as w}from"./ws-client-DXT4gi-N.js";import{t as T}from"./utils-BecmXwgG.js";import{R as E}from"./stores-CHaV9Mb9.js";import{o as D}from"./view-navigation-C1UDTk5R.js";import{n as O}from"./Toaster-CcgCyzaU.js";import{a as k,n as ee,o as te,r as A,t as ne}from"./dialog-DPl7DolS.js";import{t as j}from"./button-Dhmop_yM.js";import{t as M}from"./input-C3rIQ26u.js";import{D as N,a as P,b as F,i as I,n as L,r as R,x as z}from"./index-CGMJmLO0.js";var B=e(r(),1);function V(e,t=8e3){return new Promise((n,r)=>{let i=setTimeout(()=>{a(),r(Error(`timeout`))},t),a=e.on(`key.operation_result`,e=>{clearTimeout(i),a(),n(e.payload)})})}var H=d();function re({onKeySaved:e}){let{t:n}=t(),[r,i]=(0,B.useState)(!1),[a,s]=(0,B.useState)(``),[c,l]=(0,B.useState)(`openai-compatible`),[u,d]=(0,B.useState)(``),[f,p]=(0,B.useState)(``),[m,g]=(0,B.useState)(!1),[_,v]=(0,B.useState)([]),{setFieldRef:b,handleKeyDown:x}=P(),S=async()=>{if(a.trim()){g(!0);try{let t=w(E.getState().wsUrl),r=V(t);t.send({type:`provider.add`,payload:{id:a.trim(),family:c,baseUrl:u.trim()||void 0,apiKey:f.trim()||void 0,models:_.length>0?_.map(e=>e.id):void 0,customModels:_.length>0?Object.fromEntries(_.filter(e=>e.name||e.maxOutput||e.capabilities).map(e=>[e.id,{...e.name&&e.name!==e.id?{name:e.name}:{},...e.maxOutput?{maxOutput:e.maxOutput}:{},...e.capabilities&&Object.values(e.capabilities).some(Boolean)?{capabilities:e.capabilities}:{}}])):void 0}});let o=await r;if(!o.success)throw Error(o.message);O.success(n(`setup:screen.toasts.providerAdded`,{id:a.trim()})),e(a.trim()),t.listSavedProviders(),t.probeProvider(a.trim()),s(``),d(``),p(``),v([]),i(!1)}catch(e){let t=e instanceof Error&&e.message&&e.message!==`timeout`?e.message:null;O.error(t??n(`setup:screen.toasts.providerAddFailed`))}finally{g(!1)}}};return(0,H.jsxs)(`div`,{className:`rounded-xl border border-dashed border-border/60 overflow-hidden`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>i(!r),className:`w-full flex items-center gap-3 p-4 text-left hover:bg-muted/30 transition-colors`,children:[(0,H.jsx)(`div`,{className:`w-10 h-10 rounded-lg bg-muted/50 flex items-center justify-center`,children:(0,H.jsx)(o,{className:`h-5 w-5 text-muted-foreground`})}),(0,H.jsxs)(`div`,{className:`flex-1`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-medium`,children:n(`setup:screen.custom.title`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`setup:screen.custom.description`)})]}),(0,H.jsx)(y,{className:T(`h-4 w-4 text-muted-foreground transition-transform`,r&&`rotate-90`)})]}),r&&(0,H.jsxs)(`div`,{className:`px-4 pb-4 space-y-3 border-t border-border/40`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5 pt-3`,children:[(0,H.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground block`,children:n(`setup:screen.custom.localServers`)}),(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:L.map(e=>(0,H.jsx)(j,{type:`button`,size:`sm`,variant:a===e.id?`default`:`outline`,onClick:()=>{s(e.id),l(`openai-compatible`),d(e.defaultBaseUrl),e.noAuth&&p(``),v([])},title:e.hint,children:e.label},e.id))})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:n(`setup:screen.custom.providerId`)}),(0,H.jsx)(M,{placeholder:n(`activity:customProviderSection.eGMyLlm`),value:a,onChange:e=>s(e.target.value),className:`text-sm`,ref:b(0),onKeyDown:e=>x(e,0)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:n(`setup:screen.custom.family`)}),(0,H.jsxs)(`select`,{value:c,onChange:e=>l(e.target.value),className:`flex h-9 w-full rounded-md border border-input bg-transparent px-3 text-sm`,ref:b(1),onKeyDown:e=>x(e,1),children:[(0,H.jsx)(`option`,{value:`openai-compatible`,children:n(`setup:screen.custom.familyOpenAiCompatible`)}),(0,H.jsx)(`option`,{value:`openai`,children:`OpenAI`}),(0,H.jsx)(`option`,{value:`anthropic`,children:`Anthropic`}),(0,H.jsx)(`option`,{value:`google`,children:`Google`})]})]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:n(`setup:screen.custom.baseUrl`)}),(0,H.jsx)(M,{placeholder:n(`activity:customProviderSection.eGHttpLocalhost11434V1`),value:u,onChange:e=>d(e.target.value),className:`text-sm font-mono`,ref:b(2),onKeyDown:e=>x(e,2)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:n(`setup:screen.custom.apiKey`)}),(0,H.jsx)(M,{type:`password`,placeholder:n(`setup:screen.custom.apiKeyPlaceholder`),value:f,onChange:e=>p(e.target.value),className:`text-sm font-mono`,ref:b(3),onKeyDown:e=>x(e,3)})]}),(0,H.jsx)(I,{models:_,onChange:v}),(0,H.jsxs)(j,{onClick:S,disabled:!a.trim()||m,size:`sm`,ref:b(4),onKeyDown:e=>x(e,4,S),children:[m?(0,H.jsx)(h,{className:`h-4 w-4 animate-spin mr-2`}):null,n(`setup:screen.custom.add`)]})]})]})}var U=R();async function ie(e,t){try{let n=await fetch(e,{signal:t});if(!n.ok)throw Error(`HTTP ${n.status}`);let r=await n.json();if(!Array.isArray(r))throw Error(`Expected JSON array`);let i=r.filter(e=>typeof e.id==`string`&&typeof e.name==`string`&&typeof e.family==`string`);return i.length>0?i:U}catch{return U}}function ae(e,t){let n=new Date().getTime()-e.getTime(),r=Math.floor(n/1e3);if(r<10)return t(`setup:screen.time.justNow`);if(r<60)return t(`setup:screen.time.secondsAgo`,{count:r});let i=Math.floor(r/60);if(i<60)return t(`setup:screen.time.minutesAgo`,{count:i});let a=Math.floor(i/60);return a<24?t(`setup:screen.time.hoursAgo`,{count:a}):t(`setup:screen.time.daysAgo`,{count:Math.floor(a/24)})}var oe=e(v(),1);function se({popular:e,catalogProvider:r,savedProvider:i,onKeySaved:o,probeResult:s}){let{t:c}=t(),[u,d]=(0,B.useState)(``),[f,g]=(0,B.useState)(!1),[v,b]=(0,B.useState)(!!i?.apiKeys.some(e=>e.isActive)),[x,S]=(0,B.useState)(!1),[C,D]=(0,B.useState)(!1),[N,P]=(0,B.useState)(!1),[F,I]=(0,B.useState)(null);(0,B.useEffect)(()=>{N&&e.referral&&oe.toDataURL(e.referral.url,{width:200,margin:2,color:{dark:`#000000`,light:`#ffffff`}}).then(e=>I(e)).catch(()=>I(null))},[N,e.referral]);let L=async()=>{if(u.trim()){g(!0);try{let t=w(E.getState().wsUrl),n=V(t);r?t.addKey(e.id,`default`,u.trim()):t.send({type:`provider.add`,payload:{id:e.id,family:e.family,apiKey:u.trim()}});let i=await n;if(!i.success)throw Error(i.message);b(!0),d(``),O.success(c(`setup:screen.toasts.keySaved`,{name:e.name})),o(e.id),t.listSavedProviders(),t.probeProvider(e.id)}catch(t){let n=t instanceof Error&&t.message&&t.message!==`timeout`?t.message:null;O.error(n??c(`setup:screen.toasts.keySaveFailed`,{name:e.name}))}finally{g(!1)}}},R=e=>{e.key===`Enter`&&u.trim()&&L()},z=async()=>{if(e.referral)try{await navigator.clipboard.writeText(e.referral.url),D(!0),O.success(c(`setup:screen.toasts.referralCopied`)),setTimeout(()=>D(!1),2e3)}catch{O.error(c(`setup:screen.toasts.referralCopyFailed`))}},re=r&&r.modelCount>0;return(0,H.jsxs)(`div`,{className:T(`rounded-xl border p-4 transition-all`,v?`border-success/30 bg-success/5`:`bg-gradient-to-br ${e.color}`),children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,H.jsx)(`span`,{className:`text-2xl shrink-0 mt-0.5`,children:e.icon}),(0,H.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold`,children:e.name}),v&&(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded-full bg-success/10 text-success border border-success/20`,children:[(0,H.jsx)(_,{className:`h-2.5 w-2.5`}),c(`setup:screen.card.keySaved`)]}),e.referral&&!v&&(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded-full bg-warning/10 text-warning border border-warning/20`,children:[(0,H.jsx)(n,{className:`h-2.5 w-2.5`}),c(`setup:screen.card.referral`)]})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e.description}),e.referral&&!v&&(0,H.jsxs)(`p`,{className:`text-[11px] text-warning/80 mt-1`,children:[`🎁 `,e.referral.reward]}),v?v?(0,H.jsxs)(`div`,{className:`mt-3 space-y-1`,children:[i?.baseUrl&&(0,H.jsxs)(`div`,{className:`text-[11px] text-muted-foreground/70 font-mono truncate`,title:i.baseUrl,children:[(0,H.jsxs)(`span`,{className:`text-muted-foreground/50`,children:[c(`activity:providerKey.url`),` `]}),i.baseUrl]}),i?.models&&i.models.length>0&&(0,H.jsxs)(`div`,{className:`text-[11px] text-muted-foreground/70`,children:[(0,H.jsxs)(`span`,{className:`text-muted-foreground/50`,children:[c(`activity:providerKey.models`),` `]}),i.pickedModelId??i.models[0],(0,H.jsxs)(`span`,{className:`text-muted-foreground/50`,children:[` (+`,i.models.length-1,` more)`]})]}),s===`probing`?(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-muted-foreground mt-1`,children:[(0,H.jsx)(h,{className:`h-3 w-3 animate-spin`}),c(`setup:screen.probe.checking`,`Checking connection…`)]}):s?.ok?(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-success mt-1`,children:[(0,H.jsx)(_,{className:`h-3 w-3`}),(0,H.jsxs)(`span`,{children:[c(`setup:screen.probe.connected`,`Connected`),s.modelCount!=null&&` · ${s.modelCount} ${c(`setup:screen.probe.models`,`models`)}`,s.elapsedMs!=null&&` · ${s.elapsedMs}ms`]})]}):s&&!s.ok?(0,H.jsxs)(`div`,{className:`flex items-start gap-1.5 text-[11px] text-destructive mt-1`,children:[(0,H.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:`✕`}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`span`,{className:`font-medium`,children:c(`setup:screen.probe.failed`,`Probe failed`)}),s.status===`no_base_url`&&(0,H.jsx)(`span`,{className:`block text-destructive/70`,children:c(`setup:screen.probe.noBaseUrl`,`No base URL configured`)}),s.status===`unreachable`&&(0,H.jsxs)(`span`,{className:`block text-destructive/70`,children:[c(`setup:screen.probe.unreachable`,`Could not connect`),s.detail?`: ${s.detail}`:``]}),s.status!==`no_base_url`&&s.status!==`unreachable`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`block text-destructive/70`,children:s.httpStatus==null?s.status:`${c(`setup:screen.probe.httpStatus`,`Status`)} ${s.httpStatus}`}),s.detail&&(0,H.jsx)(`span`,{className:`block text-destructive/70 truncate max-w-[250px]`,title:s.detail,children:s.detail})]})]})]}):null,re&&(0,H.jsxs)(`button`,{type:`button`,onClick:()=>S(!x),className:`text-[11px] text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1`,children:[c(`setup:screen.providers.modelsAvailable`,{count:r?.modelCount??0}),x?(0,H.jsx)(m,{className:`h-3 w-3`}):(0,H.jsx)(y,{className:`h-3 w-3`})]})]}):null:(0,H.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(M,{type:`password`,placeholder:e.keyPlaceholder,value:u,onChange:e=>d(e.target.value),onKeyDown:R,className:`font-mono text-sm`}),(0,H.jsx)(j,{onClick:L,disabled:!u.trim()||f,size:`sm`,className:`shrink-0`,children:f?(0,H.jsx)(h,{className:`h-4 w-4 animate-spin`}):c(`setup:screen.card.save`)})]}),e.docsUrl&&(0,H.jsxs)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors`,children:[c(`setup:screen.card.getKey`),` `,(0,H.jsx)(p,{className:`h-3 w-3`})]}),e.referral&&(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:z,className:`inline-flex items-center gap-1 text-[11px] text-warning/80 hover:text-warning transition-colors`,children:C?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(_,{className:`h-3 w-3`}),` `,c(`setup:screen.card.copied`)]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(a,{className:`h-3 w-3`}),` `,c(`setup:screen.card.copyReferral`)]})}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>P(!0),className:`inline-flex items-center gap-1 text-[11px] text-warning/80 hover:text-warning transition-colors`,children:[(0,H.jsx)(l,{className:`h-3 w-3`}),` `,c(`setup:screen.card.share`)]})]})]})]})]}),(0,H.jsx)(ne,{open:N,onOpenChange:P,children:(0,H.jsxs)(ee,{className:`sm:max-w-md`,children:[(0,H.jsxs)(k,{children:[(0,H.jsxs)(te,{className:`flex items-center gap-2`,children:[(0,H.jsx)(n,{className:`h-4 w-4 text-warning`}),c(`setup:screen.share.title`,{name:e.name})]}),(0,H.jsx)(A,{children:c(`setup:screen.share.description`)})]}),(0,H.jsx)(`div`,{className:`flex flex-col items-center gap-4 py-4`,children:e.referral&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`text-sm text-center`,children:(0,H.jsxs)(`p`,{className:`font-medium text-warning`,children:[`🎁 `,e.referral.reward]})}),F?(0,H.jsx)(`div`,{className:`rounded-lg border border-border p-2 bg-white`,children:(0,H.jsx)(`img`,{src:F,alt:c(`setup:screen.card.qrAlt`,{name:e.name}),className:`w-[200px] h-[200px]`})}):(0,H.jsx)(`div`,{className:`w-[200px] h-[200px] rounded-lg border border-border flex items-center justify-center bg-muted`,children:(0,H.jsx)(h,{className:`h-6 w-6 animate-spin text-muted-foreground`})}),(0,H.jsxs)(`div`,{className:`w-full space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-center gap-2`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`https://twitter.com/intent/tweet?text=${t}&url=${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:c(`setup:screen.share.twitter`),children:[(0,H.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,H.jsx)(`path`,{d:`M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z`})}),`X`]}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(e.referral.url),n=encodeURIComponent(`Check out ${e.name}! ${e.referral.reward}`);window.open(`https://www.linkedin.com/sharing/share-offsite/?url=${t}&summary=${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:c(`setup:screen.share.linkedin`),children:[(0,H.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,H.jsx)(`path`,{d:`M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z`})}),c(`activity:providerKey.linkedin`)]}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward} ${e.referral.url}`);window.open(`https://t.me/share/url?url=${t}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:c(`setup:screen.share.telegram`),children:[(0,H.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,H.jsx)(`path`,{d:`M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z`})}),c(`activity:providerKey.telegram`)]}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`https://wa.me/?text=${t}%20${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:c(`setup:screen.share.whatsapp`),children:[(0,H.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,H.jsx)(`path`,{d:`M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.134 1.585 5.934L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z`})}),c(`activity:providerKey.whatsapp`)]}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(e.referral.url),n=encodeURIComponent(`${e.name} - ${e.referral.reward}`);window.open(`https://www.reddit.com/submit?url=${t}&title=${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:c(`setup:screen.share.reddit`),children:[(0,H.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,H.jsx)(`path`,{d:`M12 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0zm5.01 4.744c.688 0 1.25.561 1.25 1.249a1.25 1.25 0 0 1-2.498.056l-2.597-.547-.8 3.747c1.824.07 3.48.632 4.674 1.488.308-.309.73-.491 1.207-.491.968 0 1.754.786 1.754 1.754 0 .716-.435 1.333-1.01 1.614a3.111 3.111 0 0 1 .042.52c0 2.694-3.13 4.87-7.004 4.87-3.874 0-7.004-2.176-7.004-4.87 0-.183.015-.366.043-.534A1.748 1.748 0 0 1 4.028 12c0-.968.786-1.754 1.754-1.754.463 0 .898.196 1.207.49 1.207-.883 2.878-1.43 4.744-1.487l.885-4.182a.342.342 0 0 1 .14-.197.35.35 0 0 1 .238-.042l2.906.617a1.214 1.214 0 0 0 1.108-.701 1.25 1.25 0 0 1 2.144.33zm-8.811 8.748c-.968 0-1.754.786-1.754 1.754 0 .968.786 1.754 1.754 1.754.968 0 1.754-.786 1.754-1.754 0-.968-.786-1.754-1.754-1.754zm7.944 0c-.968 0-1.754.786-1.754 1.754 0 .968.786 1.754 1.754 1.754.968 0 1.754-.786 1.754-1.754 0-.968-.786-1.754-1.754-1.754z`})}),c(`activity:providerKey.reddit`)]}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`https://www.facebook.com/sharer/sharer.php?u=${n}"e=${t}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:c(`setup:screen.share.facebook`),children:[(0,H.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,H.jsx)(`path`,{d:`M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z`})}),c(`activity:providerKey.facebook`)]}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`mailto:?subject=${t}&body=${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-muted text-muted-foreground text-xs hover:bg-muted/80 transition-colors`,title:c(`setup:screen.share.email`),children:[(0,H.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,viewBox:`0 0 24 24`,children:(0,H.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M21.75 6.75v10.5a2.25 2.25 0 01-2.25 2.25H4.5a2.25 2.25 0 01-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25m19.5 0v.243a2.25 2.25 0 01-1.07 1.916l-7.5 4.615a2.25 2.25 0 01-2.36 0L3.32 8.91a2.25 2.25 0 01-1.07-1.916V6.75`})}),c(`activity:providerKey.email`)]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(M,{value:e.referral.url,readOnly:!0,className:`font-mono text-xs flex-1`}),(0,H.jsx)(j,{size:`sm`,variant:`outline`,onClick:z,className:`shrink-0`,children:C?(0,H.jsx)(_,{className:`h-4 w-4`}):(0,H.jsx)(a,{className:`h-4 w-4`})})]}),(0,H.jsx)(`p`,{className:`text-[11px] text-muted-foreground text-center`,children:c(`setup:screen.share.hint`)})]})]})})]})})]})}function W(){let{t:e}=t(),{model:n,setProvider:r,setModel:a,wsConnected:o,wsUrl:l}=E(i(e=>({model:e.model,setProvider:e.setProvider,setModel:e.setModel,wsConnected:e.wsConnected,wsUrl:e.wsUrl})));C();let[d,p]=(0,B.useState)([]),[m,v]=(0,B.useState)({}),[k,ee]=(0,B.useState)([]),[te,A]=(0,B.useState)(!1),[ne,M]=(0,B.useState)(null),[P,I]=(0,B.useState)(0),[L,R]=(0,B.useState)(new Set),[V,oe]=(0,B.useState)({}),[W,ce]=(0,B.useState)(U),[G,K]=(0,B.useState)(!1),[le,ue]=(0,B.useState)(0),[de,fe]=(0,B.useState)(0),[q,pe]=(0,B.useState)(null),J=(0,B.useRef)(!0);(0,B.useEffect)(()=>{let e=new AbortController,t=`${window.location.origin}/providers.json`;return K(!0),ie(t,e.signal).then(t=>{if(t!==U){if(ce(t),K(!1),!J.current){let e=t.length-de;e>0?O.success(s.t(`setup:screen.toasts.providersLoadedNew`,{count:t.length,diff:e})):e<0?O.success(s.t(`setup:screen.toasts.providersLoadedRemoved`,{count:t.length,diff:Math.abs(e)})):O.success(s.t(`setup:screen.toasts.providersLoadedNoChanges`,{count:t.length})),fe(t.length)}pe(new Date);return}return ie(`https://raw.githubusercontent.com/WrongStack/WrongStack/main/packages/webui/public/providers.json`,e.signal)}).then(e=>{if(e){if(ce(e),!J.current){let t=e.length-de;t>0?O.success(s.t(`setup:screen.toasts.providersLoadedNew`,{count:e.length,diff:t})):t<0?O.success(s.t(`setup:screen.toasts.providersLoadedRemoved`,{count:e.length,diff:Math.abs(t)})):O.success(s.t(`setup:screen.toasts.providersLoadedNoChanges`,{count:e.length})),fe(e.length)}pe(new Date)}}).catch(()=>{J.current||O.error(s.t(`setup:screen.toasts.providersRefreshFailed`))}).finally(()=>{K(!1),J.current=!1}),()=>e.abort()},[le]);let[Y,me]=(0,B.useState)(null),[X,Z]=(0,B.useState)(null),[he,ge]=(0,B.useState)(!1);(0,B.useEffect)(()=>{if(!o)return;let e=w(l),t=setTimeout(()=>{t=null,A(!1),M(s.t(`setup:screen.errors.backendNotResponding`))},8e3),r=()=>{t&&=(clearTimeout(t),null)},i=e.on(`provider.catalog`,e=>{if(e.type===`provider.catalog`){r(),M(null);let t=e.payload.providers.sort((e,t)=>e.id.localeCompare(t.id));p(t),A(!1)}}),a=e.on(`provider.models`,e=>{if(e.type===`provider.models`){let t=e.payload;if(t.provider!==Y)return;v(e=>({...e,[t.provider]:t.models})),ge(!1),t.models.length===1?Z(t.models[0].id):n&&t.models.some(e=>e.id===n)&&Z(n)}}),c=e.on(`providers.saved`,e=>{if(e.type===`providers.saved`){let t=e.payload.providers.sort((e,t)=>e.id.localeCompare(t.id));ee(t);let n=new Set(t.filter(e=>e.apiKeys.some(e=>e.isActive)).map(e=>e.id));R(n)}}),u=e.on(`provider.probe`,e=>{if(e.type!==`provider.probe`)return;let t=e.payload;oe(e=>({...e,[t.providerId]:t}))});return M(null),A(!0),e.listProviders(),()=>{r(),i?.(),a?.(),c?.(),u?.()}},[o,l,n,P,Y]);let _e=(0,B.useCallback)(()=>{M(null),I(e=>e+1)},[]),ve=(0,B.useCallback)(()=>{ue(e=>e+1)},[]),ye=(0,B.useCallback)(t=>ae(t,e),[e]),be=(0,B.useCallback)(e=>{R(t=>new Set([...t,e])),me(e),Z(null)},[]),xe=L.size>0;(0,B.useEffect)(()=>{if(!Y||!o)return;let e=w(l);m[Y]||(ge(!0),e.listProviderModels(Y))},[Y,o,l,m]);let Se=Y?m[Y]??[]:[],Ce=(0,B.useCallback)(async()=>{if(!Y||!X)return;if(!L.has(Y)){O.error(`Please save the provider configuration before starting a session.`);return}r(Y),a(X);let e=w(l),t=await e.switchModel(Y,X,5e3);t.success?(e.newSession(),D(`chat`)):O.error(t.message||s.t(`setup:screen.errors.modelSwitchTimeout`))},[Y,X,r,a,l]),we=(0,B.useCallback)(async()=>{if(!Y||!X)return;r(Y),a(X);let e=await w(l).switchModel(Y,X,5e3);e.success?D(`chat`):O.error(e.message||s.t(`setup:screen.errors.modelSwitchTimeout`))},[Y,X,r,a,l]),Te=new Set(W.map(e=>e.id)),Ee=d.filter(e=>!Te.has(e.id)).sort((e,t)=>e.id.localeCompare(t.id)),Q=z(Ee,10);z(k,9);let $=z(Se,12,Y);return(0,H.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,H.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-3 border-b bg-card px-4 py-4 sm:flex-row sm:items-center sm:justify-between sm:px-6`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,H.jsx)(`img`,{src:`/wrongstack.svg`,alt:`WrongStack`,draggable:!1,className:`ws-brand-logo h-10 w-10 shrink-0 border border-border/70 shadow-sm`}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`h1`,{className:`truncate text-lg font-semibold`,children:e(`setup:screen.header.title`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground sm:truncate`,children:e(`setup:screen.header.subtitle`)})]})]}),xe&&Y?(0,H.jsxs)(`span`,{className:`text-xs text-success/80`,children:[(0,H.jsx)(_,{className:`h-3 w-3 inline-block mr-1`}),e(`setup:screen.header.continue`)]}):null]}),(0,H.jsx)(N,{className:`min-h-0 flex-1`,children:(0,H.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-8 p-4 pb-4 sm:p-6`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-sm`,children:[(0,H.jsxs)(`div`,{className:T(`flex min-w-0 items-center gap-1.5`,xe?`text-success`:`text-primary font-medium`),children:[(0,H.jsx)(x,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{children:e(`setup:screen.steps.addKeys`)})]}),(0,H.jsx)(y,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,H.jsxs)(`div`,{className:T(`flex min-w-0 items-center gap-1.5`,Y?`text-primary font-medium`:`text-muted-foreground`),children:[(0,H.jsx)(f,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{children:e(`setup:screen.steps.pickModel`)})]}),(0,H.jsx)(y,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,H.jsxs)(`div`,{className:T(`flex min-w-0 items-center gap-1.5`,Y&&X?`text-primary font-medium`:`text-muted-foreground`),children:[(0,H.jsx)(c,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{children:e(`setup:screen.steps.start`)})]})]}),(0,H.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-primary/20 bg-primary/5 p-4`,children:[(0,H.jsx)(g,{className:`h-5 w-5 text-primary shrink-0 mt-0.5`}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`text-sm font-medium`,children:e(`setup:screen.security.title`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e(`setup:screen.security.body`)})]})]}),ne?(0,H.jsxs)(`div`,{className:`flex flex-col items-center text-center gap-4 py-12 rounded-xl border border-destructive/30 bg-destructive/5 px-6`,children:[(0,H.jsx)(`div`,{className:`w-12 h-12 rounded-xl bg-destructive/10 border border-destructive/30 flex items-center justify-center`,children:(0,H.jsx)(u,{className:`h-6 w-6 text-destructive`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`text-sm font-medium text-destructive`,children:e(`setup:screen.errors.backendUnreachable`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1 max-w-sm`,children:ne})]}),(0,H.jsxs)(j,{onClick:_e,size:`sm`,variant:`outline`,children:[(0,H.jsx)(h,{className:`h-4 w-4 mr-2`}),e(`setup:screen.errors.retry`)]})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,H.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.popular`)}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[G&&(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground`,children:[(0,H.jsx)(h,{className:`h-3 w-3 animate-spin`}),e(`setup:screen.providers.updating`)]}),q&&!G&&(0,H.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,title:q.toLocaleString(),children:ye(q)}),(0,H.jsxs)(`button`,{type:`button`,onClick:ve,disabled:G,className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,title:e(`setup:screen.providers.refreshTitle`),children:[(0,H.jsx)(S,{className:T(`h-3 w-3`,G&&`animate-spin`)}),e(`setup:screen.providers.refresh`)]})]})]}),(0,H.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:W.map(e=>(0,H.jsx)(se,{popular:e,catalogProvider:d.find(t=>t.id===e.id),savedProvider:k.find(t=>t.id===e.id),onKeySaved:be,probeResult:V[e.id]},e.id))})]}),Ee.length>0&&(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.more`)}),(0,H.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:Q.pageItems.map(t=>(0,H.jsx)(se,{popular:{id:t.id,name:t.name,description:e(`setup:screen.providers.catalogDescription`,{family:t.family,count:t.modelCount}),icon:`🔗`,color:`from-muted/60 to-muted/20 border-border hover:border-primary/40`,keyPlaceholder:`API key`,family:t.family},catalogProvider:t,savedProvider:k.find(e=>e.id===t.id),onKeySaved:be,probeResult:V[t.id]},t.id))}),(0,H.jsx)(F,{page:Q.page,pageSize:Q.pageSize,totalItems:Q.totalItems,onPageChange:Q.setPage,itemLabel:`providers`})]}),(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.selfHosted`)}),(0,H.jsx)(re,{onKeySaved:be})]})]}),te&&(0,H.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,H.jsx)(h,{className:`h-6 w-6 animate-spin text-muted-foreground`})}),Y&&(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsxs)(`h2`,{className:`text-base font-semibold flex items-center gap-2`,children:[(0,H.jsx)(c,{className:`h-4 w-4 text-primary`}),e(`setup:screen.start.chooseModel`)]}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>{me(null),Z(null)},className:`text-xs text-muted-foreground hover:text-foreground transition-colors`,children:e(`setup:screen.start.addMoreKeys`)})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`setup:screen.start.modelsFor`,{provider:Y})}),he?(0,H.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,H.jsx)(h,{className:`h-6 w-6 animate-spin text-muted-foreground`})}):Se.length>0?(0,H.jsx)(`div`,{className:`grid grid-cols-1 gap-2`,children:$.pageItems.map(e=>{let t=e.contextWindow?`${(e.contextWindow/1e6).toFixed(0)}M ctx`:null;return(0,H.jsx)(`button`,{type:`button`,onClick:()=>Z(e.id),className:T(`w-full text-left rounded-xl border p-3 transition-all`,`hover:border-primary/40 hover:bg-primary/5`,X===e.id?`border-primary bg-primary/10 ring-1 ring-primary/30`:`border-border bg-card`),children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,H.jsx)(`span`,{className:`font-medium text-sm`,children:e.name}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 mt-1`,children:[t&&(0,H.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground`,children:t}),e.capabilities.slice(0,3).map(e=>(0,H.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-primary/10 text-primary border border-primary/20`,children:e},e))]})]}),X===e.id&&(0,H.jsx)(`div`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-primary`,children:(0,H.jsx)(_,{className:`h-3 w-3 text-primary-foreground`})})]})},e.id)})}):(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground py-8 text-center`,children:e(`setup:screen.errors.noModels`)}),(0,H.jsx)(F,{page:$.page,pageSize:$.pageSize,totalItems:$.totalItems,onPageChange:$.setPage,itemLabel:`models`})]}),Y&&X&&(0,H.jsxs)(`div`,{className:`sticky bottom-0 -mx-4 border-t bg-background/80 px-4 py-4 backdrop-blur-sm sm:-mx-6 sm:px-6`,children:[(0,H.jsx)(`div`,{className:`mb-3 flex min-w-0 items-center justify-between gap-2 text-sm text-muted-foreground`,children:(0,H.jsxs)(`span`,{className:`min-w-0 truncate`,children:[Y,` / `,X]})}),(0,H.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-2`,children:[(0,H.jsxs)(j,{onClick:Ce,className:`flex-1`,size:`lg`,children:[(0,H.jsx)(f,{className:`h-4 w-4 mr-2`}),e(`setup:screen.start.startSession`),(0,H.jsx)(b,{className:`h-4 w-4 ml-2`})]}),(0,H.jsxs)(j,{onClick:we,variant:`outline`,className:`flex-1`,size:`lg`,children:[(0,H.jsx)(_,{className:`h-4 w-4 mr-2`}),e(`setup:screen.start.saveConfig`)]})]}),(0,H.jsx)(`p`,{className:`text-[11px] text-muted-foreground/60 text-center mt-2`,children:e(`setup:screen.start.saveConfigHint`)})]})]})})]})}export{W as SetupScreen};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-DZ9_OO6N.js","assets/rolldown-runtime-hePW80VL.js","assets/monaco-BCqJp2xW.js","assets/monaco-Bowa0-zp.css","assets/markdown-Kp5uSgOw.js","assets/vendor-BMdWcCR4.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Ga as n,Kr as r,Nn as ee,Qr as te,Ti as ne,Ua as i,Wt as re,dt as ie,ea as ae,ga as oe,jr as se,jt as a,kn as ce,lt as o,or as s,ra as le,ta as c,xa as l,yi as ue,yn as de}from"./vendor-DZ9_OO6N.js";import"./i18n-
|
|
2
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Ga as n,Kr as r,Nn as ee,Qr as te,Ti as ne,Ua as i,Wt as re,dt as ie,ea as ae,ga as oe,jr as se,jt as a,kn as ce,lt as o,or as s,ra as le,ta as c,xa as l,yi as ue,yn as de}from"./vendor-DZ9_OO6N.js";import"./i18n-BeHaHx3x.js";import{s as u}from"./monaco-BCqJp2xW.js";import{t as fe}from"./useWebSocket-DJWEKY_A.js";import{t as d}from"./utils-BecmXwgG.js";import{n as pe}from"./ui-store-3HoYrTu5.js";import{o as me}from"./view-navigation-C1UDTk5R.js";import{a as he,n as ge,o as _e,t as ve}from"./dialog-DPl7DolS.js";import{p as f}from"./markdown-Kp5uSgOw.js";import{c as ye,f as p,g as m}from"./index-CGMJmLO0.js";import{t as be}from"./empty-state-IT10GzRA.js";var h=e(n(),1),g=o(),xe=(0,h.lazy)(()=>u(()=>import(`./vendor-DZ9_OO6N.js`).then(e=>e.S),__vite__mapDeps([0,1,2,3,4,5])));function _(e){return e===`project`||e===`user`}function Se(e){let t=e.match(/^(.+?)\/SKILL(?:\.save)?\.md$/);return t?t[1]:null}function Ce({source:e}){let{t:n}=t(),r=e===`project`?`project`:e===`user`?`user`:`bundled`;return(0,g.jsx)(`span`,{className:d(`inline-flex items-center rounded-md border px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide`,r===`project`&&`border-success/25 bg-success/8 text-success`,r===`user`&&`border-primary/25 bg-primary/10 text-primary`,r===`bundled`&&`border-border/70 bg-muted/60 text-muted-foreground`),children:n(`activity:skillDetail.${{project:`scopeProject`,user:`scopeGlobal`,bundled:`scopeBundled`}[r]}`)})}function v({className:e}){let{t:n}=t(),{client:o}=fe(),u=pe(e=>e.skillsState),v=pe(e=>e.setSkillsState),y=u.selectedSkill,b=u.navHistory,x=u.historyIndex,[S,C]=(0,h.useState)(null),[we,w]=(0,h.useState)(!1),[T,E]=(0,h.useState)(null),Te=ye(`skill-detail`,!!S),[D,O]=(0,h.useState)(!1),[k,A]=(0,h.useState)(``),[j,M]=(0,h.useState)(!1),[N,P]=(0,h.useState)(null),[F,I]=(0,h.useState)(!1),[L,R]=(0,h.useState)(null),[z,B]=(0,h.useState)(!1),V=(0,h.useRef)(``),[Ee,De]=(0,h.useState)(!1),[H,U]=(0,h.useState)(null),[Oe,ke]=(0,h.useState)(!1),[W,G]=(0,h.useState)(null),[K,Ae]=(0,h.useState)(!1),[je,Me]=(0,h.useState)([]),q=(0,h.useRef)(u);q.current=u;let J=(0,h.useRef)(!1),Y=(0,h.useMemo)(()=>k?{lines:k.split(`
|
|
3
3
|
`).length,words:k.trim()?k.trim().split(/\s+/).length:0,chars:k.length}:{lines:0,words:0,chars:0},[k]),X=(0,h.useMemo)(()=>{if(!k)return null;let e=5242880,t=new Blob([k]).size;return t>=e?{level:`critical`,used:t,limit:e}:t>=4194304?{level:`warn`,used:t,limit:e}:null},[k]);(0,h.useEffect)(()=>{if(!L)return;let e=setTimeout(()=>R(null),2e3);return()=>clearTimeout(e)},[L]),(0,h.useEffect)(()=>{if(!D||!y)return;let e=setInterval(()=>{k&&k!==V.current&&(V.current=k,localStorage.setItem(`skills_draft_${y.name}`,JSON.stringify({content:k,savedAt:Date.now()})),R(Date.now()))},5e3);return()=>clearInterval(e)},[D,k,y]),(0,h.useEffect)(()=>{if(!y||!D)return;let e=localStorage.getItem(`skills_draft_${y.name}`);if(e)try{let{content:t}=JSON.parse(e);t&&t!==k&&t!==V.current&&(A(t),V.current=t,B(!0))}catch{}},[y?.name,D]),(0,h.useEffect)(()=>{if(!o||!y)return;w(!0),C(null),E(null);let e=setTimeout(()=>{w(!1),E(i.t(`activity:skillDetail.timeoutError`))},1e4),t=t=>{clearTimeout(e);let n=t;n.payload.error?E(n.payload.error):n.payload.name&&C(n.payload),w(!1)},n=e=>{let t=e;De(!1);let n=q.current;if(t.payload.success){let e={...n.knownRefs};for(let n of t.payload.updated??[])e[n.name]=n.newRef;v({...n,knownRefs:e,updateAvailableCount:0}),U({updated:t.payload.updated??[],unchanged:t.payload.unchanged??[],errors:t.payload.errors??[]}),o.send({type:`skills.list`},{echoToChat:!1})}else U({updated:[],unchanged:[],errors:[{name:``,error:t.payload.error??i.t(`activity:skillDetail.updateFailed`)}]})},r=e=>{let t=e;t.payload.skills&&Me(t.payload.skills)};return o.on(`skills.content`,t),o.on(`skills.updated`,n),o.on(`skills.list`,r),o.send({type:`skills.content`,payload:{name:y.name,source:y.source}}),()=>{clearTimeout(e),o.off(`skills.content`,t),o.off(`skills.updated`,n),o.off(`skills.list`,r)}},[o,y?.name,y?.source]),(0,h.useEffect)(()=>{D&&(O(!1),A(``),P(null))},[y?.name]);let Z=(0,h.useCallback)(e=>je.find(t=>t.name.toLowerCase()===e.toLowerCase()),[je]),Q=(0,h.useCallback)(e=>{let t=Z(e);if(t){J.current=!1;let e=b.slice(0,x+1);e.push(t),v({...q.current,selectedSkill:t,navHistory:e,historyIndex:e.length-1}),O(!1),A(``),U(null)}},[Z,b,x,v]),Ne=(0,h.useCallback)(()=>{if(x<=0)return;J.current=!0;let e=x-1,t=b[e];v({...q.current,selectedSkill:t,historyIndex:e}),O(!1),A(``),U(null)},[x,b,v]),Pe=(0,h.useCallback)(()=>{if(x>=b.length-1)return;J.current=!0;let e=x+1,t=b[e];v({...q.current,selectedSkill:t,historyIndex:e}),O(!1),A(``),U(null)},[x,b,v]),$=(0,h.useCallback)(()=>{me(`chat`)},[]),Fe=(0,h.useCallback)(()=>{S&&(A(S.body),V.current=S.body,B(!1),P(null),O(!0),I(!1))},[S]),Ie=(0,h.useCallback)(()=>{O(!1),A(``),P(null),I(!1),B(!1),y&&localStorage.removeItem(`skills_draft_${y.name}`)},[y]),Le=(0,h.useCallback)(()=>{!y||!S||(B(!1),A(S.body),V.current=S.body,y&&localStorage.removeItem(`skills_draft_${y.name}`))},[y,S]),Re=(0,h.useCallback)(()=>{if(!o||!y||!k.trim())return;M(!0),P(null);let e=t=>{let n=t;M(!1),n.payload.success?(V.current=``,localStorage.removeItem(`skills_draft_${y.name}`),B(!1),O(!1),o.send({type:`skills.content`,payload:{name:y.name,source:y.source}}),o.send({type:`skills.list`},{echoToChat:!1})):P(n.payload.error??i.t(`activity:skillDetail.saveFailed`)),o.off(`skills.edited`,e)};o.on(`skills.edited`,e),o.editSkill(y.name,k)},[o,y,k]),ze=(0,h.useCallback)(()=>{!o||!y||(De(!0),U(null),o.checkForUpdates(y.name,y.source===`user`))},[o,y]),Be=(0,h.useCallback)(()=>{y?.sourceUrl&&navigator.clipboard.writeText(y.sourceUrl).then(()=>{ke(!0),setTimeout(()=>ke(!1),2e3)})},[y]),Ve=(0,h.useCallback)(()=>{if(!S?.body)return;let e=new Blob([S.body],{type:`text/markdown`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${S.name.replace(/\//g,`_`)}-SKILL.md`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)},[S]),He=(0,h.useCallback)(async e=>{if(!o||!e)return;Ae(!0);let t=e=>{let n=e;Ae(!1),n.payload.success?(G(null),o.send({type:`skills.list`},{echoToChat:!1}),$()):P(n.payload.error??i.t(`activity:skillDetail.uninstallFailed`)),o.off(`skills.uninstalled`,t)};o.on(`skills.uninstalled`,t),o.uninstallSkill(e.name,e.source===`user`)},[o,$]);return y?(0,g.jsxs)(`div`,{className:d(`flex h-full min-h-0 min-w-0 flex-col gap-3 overflow-hidden bg-[hsl(var(--surface-2)/0.45)] p-3`,e),children:[(0,g.jsxs)(`div`,{className:`shrink-0 rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,g.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between`,children:[(0,g.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,g.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,g.jsx)(`span`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,g.jsx)(re,{className:`h-4 w-4`})}),(0,g.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold`,children:y.name}),y.version&&(0,g.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`v`,y.version]}),(0,g.jsx)(Ce,{source:y.source})]}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 line-clamp-2`,children:y.description||y.trigger}),y.sourceUrl&&(0,g.jsxs)(`div`,{className:`mt-2 flex min-w-0 items-center gap-1`,children:[(0,g.jsxs)(`a`,{href:`https://${y.sourceUrl.replace(`github:`,``)}`,target:`_blank`,rel:`noopener noreferrer`,className:`flex min-w-0 items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground`,title:n(`activity:skillDetail.openSourceRepo`),children:[(0,g.jsx)(se,{className:`h-3 w-3 shrink-0`}),(0,g.jsx)(`span`,{className:`truncate font-mono`,children:y.sourceUrl})]}),(0,g.jsx)(`button`,{type:`button`,onClick:Be,className:`flex shrink-0 items-center text-muted-foreground transition-colors hover:text-foreground`,title:n(`activity:skillDetail.copySourceUrl`),children:Oe?(0,g.jsx)(le,{className:`h-3 w-3 text-success`}):(0,g.jsx)(ne,{className:`h-3 w-3`})})]}),y.scope.length>0&&(0,g.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-2`,children:y.scope.map(e=>(0,g.jsx)(`span`,{className:`px-1.5 py-0.5 text-[10px] rounded bg-muted text-muted-foreground`,children:e},e))}),H&&(0,g.jsxs)(`div`,{className:`mt-2 text-xs space-y-1`,children:[H.updated.length>0&&(0,g.jsx)(`div`,{className:`text-success`,children:n(`activity:skillDetail.updatedLabel`,{list:H.updated.map(e=>`${e.name} (${e.oldRef} → ${e.newRef})`).join(`, `)})}),H.unchanged.length>0&&(0,g.jsx)(`div`,{className:`text-muted-foreground`,children:n(`activity:skillDetail.upToDateLabel`,{list:H.unchanged.join(`, `)})}),H.errors.length>0&&(0,g.jsx)(`div`,{className:`text-destructive`,children:n(`activity:skillDetail.errorsLabel`,{list:H.errors.map(e=>`${e.name?`${e.name}: `:``}${e.error}`).join(`; `)})})]})]}),(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 lg:ml-auto lg:shrink-0 lg:justify-end`,children:[_(y.source)&&y.sourceUrl&&(0,g.jsx)(`button`,{type:`button`,onClick:ze,disabled:Ee,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:opacity-50`,title:n(`activity:skillDetail.checkUpdatesTitle`),children:Ee?(0,g.jsx)(s,{className:`h-3.5 w-3.5 animate-spin`}):(0,g.jsx)(de,{className:`h-3.5 w-3.5`})}),y.source!==`bundled`&&!D&&(0,g.jsx)(`button`,{type:`button`,onClick:Ve,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:n(`activity:skillDetail.exportTitle`),children:(0,g.jsx)(ue,{className:`h-3.5 w-3.5`})}),_(y.source)&&!D&&(0,g.jsx)(`button`,{type:`button`,onClick:Fe,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:n(`activity:skillDetail.editTitle`),children:(0,g.jsx)(ce,{className:`h-3.5 w-3.5`})}),_(y.source)&&(0,g.jsx)(`button`,{type:`button`,onClick:()=>G(y),className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive`,title:n(`activity:skillDetail.uninstallTitle`),children:(0,g.jsx)(a,{className:`h-3.5 w-3.5`})}),(0,g.jsx)(`button`,{type:`button`,onClick:$,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,title:n(`activity:skillDetail.closeTitle`),children:(0,g.jsx)(ie,{className:`h-4 w-4`})})]})]}),b.length>1&&(0,g.jsxs)(`div`,{className:`mt-3 flex min-w-0 items-center gap-1 rounded-lg border border-border/60 bg-muted/35 px-2 py-1`,children:[(0,g.jsx)(`button`,{type:`button`,onClick:Ne,disabled:x<=0,className:d(`rounded p-1 transition-colors`,x<=0?`text-muted-foreground/65 cursor-not-allowed`:`hover:bg-accent text-muted-foreground cursor-pointer`),title:n(`activity:skillDetail.backTitle`),children:(0,g.jsx)(ae,{className:`h-4 w-4`})}),(0,g.jsx)(`button`,{type:`button`,onClick:Pe,disabled:x>=b.length-1,className:d(`rounded p-1 transition-colors`,x>=b.length-1?`text-muted-foreground/65 cursor-not-allowed`:`hover:bg-accent text-muted-foreground cursor-pointer`),title:n(`activity:skillDetail.forwardTitle`),children:(0,g.jsx)(c,{className:`h-4 w-4`})}),(0,g.jsx)(`div`,{className:`flex items-center gap-0.5 overflow-x-auto text-xs`,children:b.map((e,t)=>(0,g.jsxs)(`span`,{className:`flex items-center shrink-0`,children:[t>0&&(0,g.jsx)(c,{className:`h-3 w-3 text-muted-foreground/65 mx-0.5 shrink-0`}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>{t<x&&(J.current=!0,v({...q.current,selectedSkill:e,historyIndex:t}),O(!1),A(``),U(null))},className:d(`hover:text-primary cursor-pointer transition-colors`,t===x?`text-primary font-medium`:`text-muted-foreground`),children:e.name})]},e.name+t))})]})]}),S&&(S.relatedFiles.length>0||S.references.length>0)&&(0,g.jsxs)(`div`,{className:`shrink-0 space-y-2 rounded-xl border border-border/70 bg-card/70 px-4 py-3 shadow-sm`,children:[S.relatedFiles.length>0&&(0,g.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,g.jsx)(r,{className:`h-3 w-3`}),(0,g.jsx)(`span`,{className:`font-medium uppercase tracking-wide`,children:n(`activity:skillDetail.relatedFiles`)})]}),S.relatedFiles.map(e=>{let t=Se(e);return t&&Z(t)?(0,g.jsxs)(`button`,{type:`button`,onClick:()=>Q(t),className:`inline-flex min-w-0 items-center gap-1 rounded-md border border-border/70 bg-background/60 px-1.5 py-0.5 text-[10px] transition-colors hover:border-primary/40 hover:text-primary`,title:n(`activity:skillDetail.goToSkillTitle`,{name:t}),children:[(0,g.jsx)(l,{className:`h-2.5 w-2.5`}),e]},e):(0,g.jsx)(`span`,{className:`rounded-md border border-border/70 bg-background/60 px-1.5 py-0.5 text-[10px] text-muted-foreground`,children:e},e)})]}),S.references.length>0&&(0,g.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,g.jsx)(te,{className:`h-3 w-3`}),(0,g.jsx)(`span`,{className:`font-medium uppercase tracking-wide`,children:n(`activity:skillDetail.references`)})]}),S.references.map(e=>{let t=Se(e)??e.replace(/\.md$/,``);return Z(t)?(0,g.jsxs)(`button`,{type:`button`,onClick:()=>Q(t),className:`inline-flex min-w-0 items-center gap-1 rounded-md border border-primary/20 bg-primary/5 px-1.5 py-0.5 text-[10px] text-primary transition-colors hover:border-primary/30 hover:bg-primary/10`,title:n(`activity:skillDetail.goToSkillTitle`,{name:t}),children:[(0,g.jsx)(l,{className:`h-2.5 w-2.5`}),t]},e):(0,g.jsx)(`span`,{className:`rounded-md bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground`,children:t},e)})]})]}),(0,g.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-hidden rounded-xl border border-border/70 bg-card/70 shadow-sm`,children:we?(0,g.jsxs)(`div`,{className:`flex h-full min-h-[16rem] flex-col items-center justify-center p-8 text-center text-muted-foreground`,children:[(0,g.jsx)(s,{className:`mx-auto mb-2 h-6 w-6 animate-spin text-primary`}),(0,g.jsx)(`p`,{children:n(`activity:skillDetail.loadingContent`)})]}):D?(0,g.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,g.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-border/70 bg-muted/30 px-4 py-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`activity:skillDetail.editingLabel`,{name:y.name})}),(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:n(`activity:skillDetail.editStats`,{lines:Y.lines,words:Y.words,chars:Y.chars})}),X&&(0,g.jsx)(`span`,{className:`text-xs tabular-nums ${X.level===`critical`?`font-medium text-destructive`:`text-warning`}`,children:n(`activity:skillDetail.charsWarningFmt`,{used:(X.used/1048576).toFixed(1),limit:(X.limit/1048576).toFixed(0)})}),L&&(0,g.jsx)(`span`,{className:`text-xs text-success animate-pulse`,children:n(`activity:skillDetail.draftSaved`)}),z&&(0,g.jsx)(`span`,{className:`animate-pulse text-xs text-warning`,children:n(`activity:skillDetail.draftRestored`)})]}),(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[N&&(0,g.jsx)(`span`,{className:`text-xs text-destructive`,children:N}),z&&(0,g.jsx)(`button`,{type:`button`,onClick:Le,className:`rounded-md border border-warning/35 px-2 py-1 text-[10px] text-warning transition-colors hover:bg-warning/10`,children:n(`activity:skillDetail.discardDraft`)}),(0,g.jsx)(`button`,{type:`button`,onClick:Ie,className:`rounded-md border border-border/70 px-2 py-1 text-xs transition-colors hover:bg-accent`,children:n(`common:action.cancel`)}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>I(e=>!e),title:n(F?`activity:skillDetail.hidePreviewTitle`:`activity:skillDetail.splitViewTitle`),className:`rounded-md border px-2 py-1 text-xs transition-colors ${F?`border-primary/40 bg-primary/10 text-primary`:`border-border/70 text-muted-foreground hover:bg-accent`}`,children:(0,g.jsx)(ee,{className:`h-3 w-3 inline`})}),(0,g.jsx)(`button`,{type:`button`,onClick:Re,disabled:j||!k.trim(),className:`rounded-md bg-primary px-3 py-1 text-xs text-primary-foreground shadow-sm shadow-primary/15 transition-colors hover:bg-primary/90 disabled:opacity-50`,children:j?(0,g.jsx)(s,{className:`h-3 w-3 animate-spin inline`}):n(`common:action.save`)})]})]}),F?(0,g.jsxs)(`div`,{className:`flex flex-1 min-h-0 gap-0.5`,children:[(0,g.jsx)(`div`,{className:`flex-1 min-w-0 flex flex-col min-h-0`,children:(0,g.jsx)(h.Suspense,{fallback:null,children:(0,g.jsx)(xe,{value:k,onChange:e=>A(e.target.value??``),language:`markdown`,className:`flex-1`,style:{fontSize:12,backgroundColor:`transparent`,minHeight:0},placeholder:n(`activity:skillDetail.contentPlaceholder`)})})}),(0,g.jsx)(`div`,{className:`w-px bg-border flex-shrink-0`}),(0,g.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain bg-background/45 p-4 prose prose-sm dark:prose-invert max-w-none`,children:(0,g.jsx)(p,{rehypePlugins:[f],components:m,children:k})})]}):(0,g.jsx)(h.Suspense,{fallback:null,children:(0,g.jsx)(xe,{value:k,onChange:e=>A(e.target.value??``),language:`markdown`,className:`flex-1`,style:{fontSize:12,backgroundColor:`transparent`,minHeight:0},placeholder:n(`activity:skillDetail.contentPlaceholder`)})})]}):S?(0,g.jsx)(`div`,{ref:Te,className:`h-full min-h-0 overflow-y-auto overscroll-contain p-5 sm:p-6 prose prose-sm dark:prose-invert max-w-none`,children:(0,g.jsx)(p,{rehypePlugins:[f],components:m,children:S.body})}):T?(0,g.jsxs)(`div`,{className:`flex h-full min-h-[16rem] flex-col items-center justify-center p-8 text-center`,children:[(0,g.jsx)(`p`,{className:`text-destructive mb-2`,children:n(`activity:skillDetail.loadFailed`)}),(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:T}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>{o&&y&&(w(!0),E(null),o.send({type:`skills.content`,payload:{name:y.name,source:y.source}}))},className:`mt-4 rounded-md border border-border/70 px-3 py-1.5 text-xs transition-colors hover:bg-accent`,children:n(`common:action.retry`)})]}):(0,g.jsx)(`div`,{className:`flex h-full min-h-[16rem] items-center justify-center p-8 text-center text-muted-foreground`,children:n(`activity:skillDetail.noContent`)})}),(0,g.jsx)(ve,{open:!!W,onOpenChange:e=>{e||G(null)},children:(0,g.jsxs)(ge,{className:`flex max-h-[calc(100dvh-2rem)] w-[380px] max-w-[90vw] flex-col gap-0 overflow-hidden p-0`,showCloseButton:!1,children:[(0,g.jsxs)(he,{className:`flex shrink-0 items-center justify-between border-b border-border/70 p-4 sm:flex-row sm:justify-between sm:space-y-0`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(a,{className:`h-4 w-4 text-destructive`}),(0,g.jsx)(_e,{className:`font-semibold text-sm`,children:n(`activity:skillDetail.uninstallSkillHeading`)})]}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>G(null),"aria-label":n(`common:action.close`),className:`rounded p-1 text-muted-foreground hover:bg-accent hover:text-accent-foreground`,children:(0,g.jsx)(ie,{className:`h-4 w-4`})})]}),(0,g.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain p-4`,children:[(0,g.jsx)(`p`,{className:`text-sm`,children:W&&n(`activity:skillDetail.uninstallConfirm`,{name:W.name})}),(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:W&&n(`activity:skillDetail.uninstallRemovePath`,{path:W.path})})]}),(0,g.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-border/70 bg-muted/20 p-4`,children:[(0,g.jsx)(`button`,{type:`button`,onClick:()=>G(null),disabled:K,className:`rounded-md border border-border/70 px-3 py-1.5 text-xs transition-colors hover:bg-accent disabled:opacity-50`,children:n(`common:action.cancel`)}),(0,g.jsxs)(`button`,{type:`button`,onClick:()=>W&&He(W),disabled:K,className:`flex items-center gap-1.5 rounded-md bg-destructive px-3 py-1.5 text-xs text-destructive-foreground transition-colors hover:bg-destructive/90 disabled:cursor-not-allowed disabled:opacity-50`,children:[K&&(0,g.jsx)(s,{className:`h-3 w-3 animate-spin`}),n(`activity:skillDetail.uninstallAction`)]})]})]})})]}):(0,g.jsx)(be,{icon:(0,g.jsx)(oe,{className:`h-6 w-6`}),title:n(`activity:skillDetail.noSkillSelected`),description:n(`activity:skillDetail.selectSkillHint`),action:{label:n(`activity:skillDetail.goToChat`),onClick:$},className:e})}export{v as SkillDetailView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,En as n,Ga as r,Ji as i,Ni as a,Qr as o,Ri as s,Vn as c,dt as l,gr as u,ir as d,lt as f,mn as p,na as m,or as h,ta as g,ya as _,zi as v}from"./vendor-DZ9_OO6N.js";import"./i18n-dLvHUYek.js";import{t as y}from"./useWebSocket-B2jKc_G4.js";import{t as b}from"./utils-BecmXwgG.js";import{a as x}from"./stores-D9Ng0JyF.js";import{r as S}from"./view-navigation-C1UDTk5R.js";import{t as C}from"./button-Dhmop_yM.js";var w=e(r(),1),T=f(),E={completed:{icon:(0,T.jsx)(i,{className:`h-3.5 w-3.5`}),text:`text-success`,ring:`border-success/35`},in_progress:{icon:(0,T.jsx)(h,{className:`h-3.5 w-3.5 animate-spin`}),text:`text-primary`,ring:`border-primary/45`},queued:{icon:(0,T.jsx)(a,{className:`h-3.5 w-3.5`}),text:`text-warning`,ring:`border-warning/35`},blocked:{icon:(0,T.jsx)(d,{className:`h-3.5 w-3.5`}),text:`text-destructive`,ring:`border-destructive/30`},pending:{icon:(0,T.jsx)(s,{className:`h-3.5 w-3.5`}),text:`text-muted-foreground`,ring:`border-border/70`},review:{icon:(0,T.jsx)(p,{className:`h-3.5 w-3.5`}),text:`text-primary`,ring:`border-primary/35`},failed:{icon:(0,T.jsx)(v,{className:`h-3.5 w-3.5`}),text:`text-destructive`,ring:`border-destructive/45`},cancelled:{icon:(0,T.jsx)(_,{className:`h-3.5 w-3.5`}),text:`text-muted-foreground`,ring:`border-border/70`}},D=[`completed`,`in_progress`,`queued`,`blocked`,`pending`,`failed`],O={critical:{labelKey:`activity:depGraph.prioCrit`,cls:`bg-destructive/10 text-destructive`},high:{labelKey:`activity:depGraph.prioHigh`,cls:`bg-destructive/10 text-destructive`},medium:{labelKey:`activity:depGraph.prioMed`,cls:`bg-warning/12 text-warning`},low:{labelKey:`activity:depGraph.prioLow`,cls:`bg-success/12 text-success`}};function k({columns:e,onTaskClick:n}){let{t:r}=t();return e.length===0?(0,T.jsx)(`div`,{className:`flex h-40 items-center justify-center text-sm text-muted-foreground`,children:r(`activity:board.emptySpec`)}):(0,T.jsxs)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,T.jsx)(`h3`,{className:`mb-3 text-sm font-semibold text-foreground`,children:r(`activity:board.depGraphHeading`)}),(0,T.jsx)(`div`,{className:`mb-4 flex flex-wrap items-center gap-x-4 gap-y-1 text-xs`,children:D.map(e=>(0,T.jsxs)(`span`,{className:b(`inline-flex items-center gap-1.5`,E[e].text),children:[E[e].icon,(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:r(`activity:board.status.${e}`)})]},e))}),(0,T.jsx)(`div`,{className:`flex gap-3 overflow-x-auto pb-2`,children:e.map((t,r)=>(0,T.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,T.jsxs)(`div`,{className:`w-60 shrink-0`,children:[(0,T.jsx)(`div`,{className:`mb-2 border-b border-border/60 pb-1 text-center text-xs font-medium uppercase text-muted-foreground`,children:t.label}),(0,T.jsx)(`div`,{className:`space-y-2`,children:t.tasks.map(e=>(0,T.jsx)(A,{task:e,onClick:n},e.id))})]}),r<e.length-1&&(0,T.jsx)(`div`,{className:`flex h-full items-center pt-8 text-muted-foreground/75`,children:(0,T.jsx)(g,{className:`h-5 w-5`})})]},t.label))})]})}function A({task:e,onClick:n}){let r=E[e.displayStatus],i=O[e.priority],{t:a}=t();return(0,T.jsxs)(`button`,{type:`button`,onClick:()=>n?.(e.id),className:b(`w-full rounded-lg border bg-background/55 p-2.5 text-left shadow-sm transition-colors hover:border-primary/35 hover:bg-accent/35`,r.ring),children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,T.jsxs)(`span`,{className:b(`inline-flex items-center gap-1.5 text-xs font-medium`,r.text),children:[r.icon,(0,T.jsx)(`span`,{className:`font-mono text-foreground`,children:e.shortId})]}),(0,T.jsx)(`span`,{className:b(`rounded px-1.5 py-0.5 text-[10px] font-medium`,i.cls),children:a(i.labelKey)})]}),(0,T.jsx)(`p`,{className:`mt-1.5 text-xs text-foreground`,children:e.title}),e.deps.length>0&&(0,T.jsxs)(`p`,{className:`mt-1 font-mono text-[10px] text-muted-foreground`,children:[`← `,e.deps.join(`, `)]}),e.agentName&&(0,T.jsxs)(`div`,{className:b(`mt-1.5 inline-flex items-center gap-1 rounded-full px-1.5 py-0.5 text-[10px]`,e.displayStatus===`in_progress`?`bg-primary/10 text-primary`:`bg-muted text-muted-foreground`),title:e.worktreeBranch?a(`activity:board.worktreePrefix`,{branch:e.worktreeBranch}):void 0,children:[e.displayStatus===`in_progress`&&(0,T.jsx)(h,{className:`h-3 w-3 animate-spin`}),(0,T.jsx)(`span`,{children:e.agentName})]})]})}function j(e){return e.columns.map(e=>({name:e.label,description:``,priority:`medium`,estimateHours:e.tasks.length,parallelizable:!1,taskTemplates:e.tasks.map(e=>({title:e.title,description:e.description,type:e.type,priority:e.priority,estimateHours:1}))}))}function M({onClose:e,onRunStarted:r}){let{client:i}=y(),{t:a}=t(),s=x(e=>e.specs),d=x(e=>e.detail),f=x(e=>e.expandedSpecId),p=x(e=>e.setExpanded),[h,_]=(0,w.useState)(`graph`),v=(0,w.useCallback)(e=>{!d||d.specId!==e.id||(i?.send?.({type:`goal.start`,payload:{title:e.title,phases:j(d),autonomous:!0}}),S(`goal`))},[d,i]),E=(0,w.useCallback)(e=>{let t=e.graphId??(d?.specId===e.id?d.graphId:void 0);t?i?.send?.({type:`sdd.run.from_graph`,payload:{graphId:t,worktrees:!0}}):i?.send?.({type:`sdd.run.from_spec`,payload:{specId:e.id,worktrees:!0}}),r?.(),S(`sddhub`)},[d,i,r]);(0,w.useEffect)(()=>{i?.send?.({type:`specs.list`})},[i]);let D=(0,w.useCallback)(e=>{f===e.id?p(null):(p(e.id),i?.send?.({type:`specs.get`,payload:{specId:e.id}}))},[f,p,i]),O=d?.columns.flatMap(e=>e.tasks)??[],A={done:O.filter(e=>e.status===`completed`).length,running:O.filter(e=>e.status===`in_progress`).length,pending:O.filter(e=>e.status===`pending`||e.displayStatus===`queued`).length};return(0,T.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,T.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b bg-card px-4 py-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(o,{className:`h-5 w-5 text-warning`}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h1`,{className:`text-lg font-semibold`,children:a(`activity:specs.heading`)}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:a(`activity:specs.subtitle`)})]})]}),(0,T.jsx)(C,{variant:`ghost`,size:`icon`,onClick:e,children:(0,T.jsx)(l,{className:`h-4 w-4`})})]}),(0,T.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-4`,children:s.length===0?(0,T.jsx)(`div`,{className:`flex h-40 items-center justify-center text-sm text-muted-foreground`,children:a(`activity:specs.empty`,{command:`/sdd`})}):(0,T.jsx)(`div`,{className:`space-y-3`,children:s.map(e=>{let t=f===e.id,r=e.total>0?Math.round(e.completed/e.total*100):0;return(0,T.jsxs)(`div`,{className:`rounded-lg border border-border bg-card/60`,children:[(0,T.jsxs)(`button`,{type:`button`,onClick:()=>D(e),className:`flex w-full items-start gap-3 p-4 text-left`,children:[(0,T.jsx)(`span`,{className:`mt-1 text-muted-foreground`,children:t?(0,T.jsx)(m,{className:`h-4 w-4`}):(0,T.jsx)(g,{className:`h-4 w-4`})}),(0,T.jsx)(o,{className:`mt-0.5 h-4 w-4 text-muted-foreground`}),(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.displayId}),(0,T.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[10px] capitalize text-muted-foreground`,children:e.status})]}),(0,T.jsx)(`h2`,{className:`mt-1 text-base font-semibold`,children:e.title}),(0,T.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,T.jsx)(`div`,{className:`h-2 flex-1 overflow-hidden rounded-full bg-muted`,children:(0,T.jsx)(`div`,{className:`h-full rounded-full bg-success transition-all`,style:{width:`${r}%`}})}),(0,T.jsxs)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:[e.completed,`/`,e.total]})]})]})]}),t&&(0,T.jsxs)(`div`,{className:`border-t border-border p-4`,children:[(0,T.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,T.jsxs)(`div`,{className:`text-sm font-medium`,children:[a(`activity:specs.tasks`,{count:d?.total??e.total}),d&&(0,T.jsxs)(`span`,{className:`ml-3 text-xs font-normal text-muted-foreground`,children:[(0,T.jsx)(`span`,{className:`text-success`,children:a(`activity:specs.doneCount`,{count:A.done})}),` `,(0,T.jsx)(`span`,{className:`text-primary`,children:a(`activity:specs.runningCount`,{count:A.running})}),` `,(0,T.jsx)(`span`,{children:a(`activity:specs.pendingCount`,{count:A.pending})})]})]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsxs)(`button`,{type:`button`,onClick:()=>E(e),title:a(`activity:specs.runAsSddTitle`),className:`inline-flex items-center gap-1 rounded-md bg-success/15 px-2.5 py-1 text-xs font-medium text-success transition-colors hover:bg-success/25`,children:[(0,T.jsx)(n,{className:`h-3.5 w-3.5`}),` `,a(`activity:specs.runAsSdd`)]}),(0,T.jsxs)(`button`,{type:`button`,disabled:!d||d.specId!==e.id,onClick:()=>v(e),title:a(`activity:specs.runAsGoalTitle`),className:`inline-flex items-center gap-1 rounded-md bg-warning/15 px-2.5 py-1 text-xs font-medium text-warning transition-colors hover:bg-warning/25 disabled:opacity-40`,children:[(0,T.jsx)(n,{className:`h-3.5 w-3.5`}),` `,a(`activity:specs.runAsGoal`)]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-border p-0.5`,children:[(0,T.jsxs)(`button`,{type:`button`,onClick:()=>_(`list`),className:b(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs`,h===`list`?`bg-primary/15 text-primary`:`text-muted-foreground`),children:[(0,T.jsx)(u,{className:`h-3.5 w-3.5`}),` `,a(`activity:specs.list`)]}),(0,T.jsxs)(`button`,{type:`button`,onClick:()=>_(`graph`),className:b(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs`,h===`graph`?`bg-primary/15 text-primary`:`text-muted-foreground`),children:[(0,T.jsx)(c,{className:`h-3.5 w-3.5`}),` `,a(`activity:specs.graph`)]})]})]})]}),!d||d.specId!==e.id?(0,T.jsx)(`div`,{className:`flex h-24 items-center justify-center text-sm text-muted-foreground`,children:a(`activity:specs.loadingTasks`)}):h===`graph`?(0,T.jsx)(k,{columns:d.columns}):(0,T.jsx)(`div`,{className:`space-y-1.5`,children:O.map(e=>(0,T.jsxs)(`div`,{className:`flex items-center gap-3 rounded-md border border-border bg-card px-3 py-2`,children:[(0,T.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.shortId}),(0,T.jsx)(`span`,{className:`flex-1 text-sm`,children:e.title}),(0,T.jsx)(`span`,{className:`text-xs capitalize text-muted-foreground`,children:e.displayStatus.replace(`_`,` `)})]},e.id))})]})]},e.id)})})})]})}export{M as SpecsView};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,En as n,Ga as r,Ji as i,Ni as a,Qr as o,Ri as s,Vn as c,dt as l,gr as u,ir as d,lt as f,mn as p,na as m,or as h,ta as g,ya as _,zi as v}from"./vendor-DZ9_OO6N.js";import"./i18n-BeHaHx3x.js";import{t as y}from"./useWebSocket-DJWEKY_A.js";import{t as b}from"./utils-BecmXwgG.js";import{a as x}from"./stores-CHaV9Mb9.js";import{r as S}from"./view-navigation-C1UDTk5R.js";import{t as C}from"./button-Dhmop_yM.js";var w=e(r(),1),T=f(),E={completed:{icon:(0,T.jsx)(i,{className:`h-3.5 w-3.5`}),text:`text-success`,ring:`border-success/35`},in_progress:{icon:(0,T.jsx)(h,{className:`h-3.5 w-3.5 animate-spin`}),text:`text-primary`,ring:`border-primary/45`},queued:{icon:(0,T.jsx)(a,{className:`h-3.5 w-3.5`}),text:`text-warning`,ring:`border-warning/35`},blocked:{icon:(0,T.jsx)(d,{className:`h-3.5 w-3.5`}),text:`text-destructive`,ring:`border-destructive/30`},pending:{icon:(0,T.jsx)(s,{className:`h-3.5 w-3.5`}),text:`text-muted-foreground`,ring:`border-border/70`},review:{icon:(0,T.jsx)(p,{className:`h-3.5 w-3.5`}),text:`text-primary`,ring:`border-primary/35`},failed:{icon:(0,T.jsx)(v,{className:`h-3.5 w-3.5`}),text:`text-destructive`,ring:`border-destructive/45`},cancelled:{icon:(0,T.jsx)(_,{className:`h-3.5 w-3.5`}),text:`text-muted-foreground`,ring:`border-border/70`}},D=[`completed`,`in_progress`,`queued`,`blocked`,`pending`,`failed`],O={critical:{labelKey:`activity:depGraph.prioCrit`,cls:`bg-destructive/10 text-destructive`},high:{labelKey:`activity:depGraph.prioHigh`,cls:`bg-destructive/10 text-destructive`},medium:{labelKey:`activity:depGraph.prioMed`,cls:`bg-warning/12 text-warning`},low:{labelKey:`activity:depGraph.prioLow`,cls:`bg-success/12 text-success`}};function k({columns:e,onTaskClick:n}){let{t:r}=t();return e.length===0?(0,T.jsx)(`div`,{className:`flex h-40 items-center justify-center text-sm text-muted-foreground`,children:r(`activity:board.emptySpec`)}):(0,T.jsxs)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,T.jsx)(`h3`,{className:`mb-3 text-sm font-semibold text-foreground`,children:r(`activity:board.depGraphHeading`)}),(0,T.jsx)(`div`,{className:`mb-4 flex flex-wrap items-center gap-x-4 gap-y-1 text-xs`,children:D.map(e=>(0,T.jsxs)(`span`,{className:b(`inline-flex items-center gap-1.5`,E[e].text),children:[E[e].icon,(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:r(`activity:board.status.${e}`)})]},e))}),(0,T.jsx)(`div`,{className:`flex gap-3 overflow-x-auto pb-2`,children:e.map((t,r)=>(0,T.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,T.jsxs)(`div`,{className:`w-60 shrink-0`,children:[(0,T.jsx)(`div`,{className:`mb-2 border-b border-border/60 pb-1 text-center text-xs font-medium uppercase text-muted-foreground`,children:t.label}),(0,T.jsx)(`div`,{className:`space-y-2`,children:t.tasks.map(e=>(0,T.jsx)(A,{task:e,onClick:n},e.id))})]}),r<e.length-1&&(0,T.jsx)(`div`,{className:`flex h-full items-center pt-8 text-muted-foreground/75`,children:(0,T.jsx)(g,{className:`h-5 w-5`})})]},t.label))})]})}function A({task:e,onClick:n}){let r=E[e.displayStatus],i=O[e.priority],{t:a}=t();return(0,T.jsxs)(`button`,{type:`button`,onClick:()=>n?.(e.id),className:b(`w-full rounded-lg border bg-background/55 p-2.5 text-left shadow-sm transition-colors hover:border-primary/35 hover:bg-accent/35`,r.ring),children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,T.jsxs)(`span`,{className:b(`inline-flex items-center gap-1.5 text-xs font-medium`,r.text),children:[r.icon,(0,T.jsx)(`span`,{className:`font-mono text-foreground`,children:e.shortId})]}),(0,T.jsx)(`span`,{className:b(`rounded px-1.5 py-0.5 text-[10px] font-medium`,i.cls),children:a(i.labelKey)})]}),(0,T.jsx)(`p`,{className:`mt-1.5 text-xs text-foreground`,children:e.title}),e.deps.length>0&&(0,T.jsxs)(`p`,{className:`mt-1 font-mono text-[10px] text-muted-foreground`,children:[`← `,e.deps.join(`, `)]}),e.agentName&&(0,T.jsxs)(`div`,{className:b(`mt-1.5 inline-flex items-center gap-1 rounded-full px-1.5 py-0.5 text-[10px]`,e.displayStatus===`in_progress`?`bg-primary/10 text-primary`:`bg-muted text-muted-foreground`),title:e.worktreeBranch?a(`activity:board.worktreePrefix`,{branch:e.worktreeBranch}):void 0,children:[e.displayStatus===`in_progress`&&(0,T.jsx)(h,{className:`h-3 w-3 animate-spin`}),(0,T.jsx)(`span`,{children:e.agentName})]})]})}function j(e){return e.columns.map(e=>({name:e.label,description:``,priority:`medium`,estimateHours:e.tasks.length,parallelizable:!1,taskTemplates:e.tasks.map(e=>({title:e.title,description:e.description,type:e.type,priority:e.priority,estimateHours:1}))}))}function M({onClose:e,onRunStarted:r}){let{client:i}=y(),{t:a}=t(),s=x(e=>e.specs),d=x(e=>e.detail),f=x(e=>e.expandedSpecId),p=x(e=>e.setExpanded),[h,_]=(0,w.useState)(`graph`),v=(0,w.useCallback)(e=>{!d||d.specId!==e.id||(i?.send?.({type:`goal.start`,payload:{title:e.title,phases:j(d),autonomous:!0}}),S(`goal`))},[d,i]),E=(0,w.useCallback)(e=>{let t=e.graphId??(d?.specId===e.id?d.graphId:void 0);t?i?.send?.({type:`sdd.run.from_graph`,payload:{graphId:t,worktrees:!0}}):i?.send?.({type:`sdd.run.from_spec`,payload:{specId:e.id,worktrees:!0}}),r?.(),S(`sddhub`)},[d,i,r]);(0,w.useEffect)(()=>{i?.send?.({type:`specs.list`})},[i]);let D=(0,w.useCallback)(e=>{f===e.id?p(null):(p(e.id),i?.send?.({type:`specs.get`,payload:{specId:e.id}}))},[f,p,i]),O=d?.columns.flatMap(e=>e.tasks)??[],A={done:O.filter(e=>e.status===`completed`).length,running:O.filter(e=>e.status===`in_progress`).length,pending:O.filter(e=>e.status===`pending`||e.displayStatus===`queued`).length};return(0,T.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,T.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b bg-card px-4 py-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(o,{className:`h-5 w-5 text-warning`}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h1`,{className:`text-lg font-semibold`,children:a(`activity:specs.heading`)}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:a(`activity:specs.subtitle`)})]})]}),(0,T.jsx)(C,{variant:`ghost`,size:`icon`,onClick:e,children:(0,T.jsx)(l,{className:`h-4 w-4`})})]}),(0,T.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-4`,children:s.length===0?(0,T.jsx)(`div`,{className:`flex h-40 items-center justify-center text-sm text-muted-foreground`,children:a(`activity:specs.empty`,{command:`/sdd`})}):(0,T.jsx)(`div`,{className:`space-y-3`,children:s.map(e=>{let t=f===e.id,r=e.total>0?Math.round(e.completed/e.total*100):0;return(0,T.jsxs)(`div`,{className:`rounded-lg border border-border bg-card/60`,children:[(0,T.jsxs)(`button`,{type:`button`,onClick:()=>D(e),className:`flex w-full items-start gap-3 p-4 text-left`,children:[(0,T.jsx)(`span`,{className:`mt-1 text-muted-foreground`,children:t?(0,T.jsx)(m,{className:`h-4 w-4`}):(0,T.jsx)(g,{className:`h-4 w-4`})}),(0,T.jsx)(o,{className:`mt-0.5 h-4 w-4 text-muted-foreground`}),(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.displayId}),(0,T.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[10px] capitalize text-muted-foreground`,children:e.status})]}),(0,T.jsx)(`h2`,{className:`mt-1 text-base font-semibold`,children:e.title}),(0,T.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,T.jsx)(`div`,{className:`h-2 flex-1 overflow-hidden rounded-full bg-muted`,children:(0,T.jsx)(`div`,{className:`h-full rounded-full bg-success transition-all`,style:{width:`${r}%`}})}),(0,T.jsxs)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:[e.completed,`/`,e.total]})]})]})]}),t&&(0,T.jsxs)(`div`,{className:`border-t border-border p-4`,children:[(0,T.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,T.jsxs)(`div`,{className:`text-sm font-medium`,children:[a(`activity:specs.tasks`,{count:d?.total??e.total}),d&&(0,T.jsxs)(`span`,{className:`ml-3 text-xs font-normal text-muted-foreground`,children:[(0,T.jsx)(`span`,{className:`text-success`,children:a(`activity:specs.doneCount`,{count:A.done})}),` `,(0,T.jsx)(`span`,{className:`text-primary`,children:a(`activity:specs.runningCount`,{count:A.running})}),` `,(0,T.jsx)(`span`,{children:a(`activity:specs.pendingCount`,{count:A.pending})})]})]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsxs)(`button`,{type:`button`,onClick:()=>E(e),title:a(`activity:specs.runAsSddTitle`),className:`inline-flex items-center gap-1 rounded-md bg-success/15 px-2.5 py-1 text-xs font-medium text-success transition-colors hover:bg-success/25`,children:[(0,T.jsx)(n,{className:`h-3.5 w-3.5`}),` `,a(`activity:specs.runAsSdd`)]}),(0,T.jsxs)(`button`,{type:`button`,disabled:!d||d.specId!==e.id,onClick:()=>v(e),title:a(`activity:specs.runAsGoalTitle`),className:`inline-flex items-center gap-1 rounded-md bg-warning/15 px-2.5 py-1 text-xs font-medium text-warning transition-colors hover:bg-warning/25 disabled:opacity-40`,children:[(0,T.jsx)(n,{className:`h-3.5 w-3.5`}),` `,a(`activity:specs.runAsGoal`)]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-border p-0.5`,children:[(0,T.jsxs)(`button`,{type:`button`,onClick:()=>_(`list`),className:b(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs`,h===`list`?`bg-primary/15 text-primary`:`text-muted-foreground`),children:[(0,T.jsx)(u,{className:`h-3.5 w-3.5`}),` `,a(`activity:specs.list`)]}),(0,T.jsxs)(`button`,{type:`button`,onClick:()=>_(`graph`),className:b(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs`,h===`graph`?`bg-primary/15 text-primary`:`text-muted-foreground`),children:[(0,T.jsx)(c,{className:`h-3.5 w-3.5`}),` `,a(`activity:specs.graph`)]})]})]})]}),!d||d.specId!==e.id?(0,T.jsx)(`div`,{className:`flex h-24 items-center justify-center text-sm text-muted-foreground`,children:a(`activity:specs.loadingTasks`)}):h===`graph`?(0,T.jsx)(k,{columns:d.columns}):(0,T.jsx)(`div`,{className:`space-y-1.5`,children:O.map(e=>(0,T.jsxs)(`div`,{className:`flex items-center gap-3 rounded-md border border-border bg-card px-3 py-2`,children:[(0,T.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.shortId}),(0,T.jsx)(`span`,{className:`flex-1 text-sm`,children:e.title}),(0,T.jsx)(`span`,{className:`text-xs capitalize text-muted-foreground`,children:e.displayStatus.replace(`_`,` `)})]},e.id))})]})]},e.id)})})})]})}export{M as SpecsView};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Br as n,Ea as r,Ei as i,Ga as a,Gn as o,Ir as s,M as c,Ma as l,Mi as u,Nt as d,Qr as f,Wt as p,Zt as ee,an as m,dt as te,fa as h,gn as g,ji as _,li as v,lt as y,mi as b,or as x,pa as ne,qt as re,ut as S,yi as ie,yn as ae,zn as C}from"./vendor-DZ9_OO6N.js";import"./i18n-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Br as n,Ea as r,Ei as i,Ga as a,Gn as o,Ir as s,M as c,Ma as l,Mi as u,Nt as d,Qr as f,Wt as p,Zt as ee,an as m,dt as te,fa as h,gn as g,ji as _,li as v,lt as y,mi as b,or as x,pa as ne,qt as re,ut as S,yi as ie,yn as ae,zn as C}from"./vendor-DZ9_OO6N.js";import"./i18n-BeHaHx3x.js";import{t as w}from"./utils-BecmXwgG.js";import{i as T}from"./stores-CHaV9Mb9.js";import{t as E}from"./button-Dhmop_yM.js";import{t as D}from"./input-C3rIQ26u.js";import{A as oe,M as se,b as O,j as k,k as ce,x as A}from"./index-CGMJmLO0.js";var j=e(a(),1),M=y(),N={current:{labelKey:`activity:techStackStatus.current`,badge:`border-success/35 bg-success/10 text-success`,dot:`bg-success`,weight:0},update_available_safe:{labelKey:`activity:techStackStatus.update_available_safe`,badge:`border-info/35 bg-info/10 text-info`,dot:`bg-info`,weight:30},update_available_breaking:{labelKey:`activity:techStackStatus.update_available_breaking`,badge:`border-warning/35 bg-warning/10 text-warning`,dot:`bg-warning`,weight:50},vulnerable:{labelKey:`activity:techStackStatus.vulnerable`,badge:`border-destructive/45 bg-destructive/15 text-destructive`,dot:`bg-destructive`,weight:100},deprecated:{labelKey:`activity:techStackStatus.deprecated`,badge:`border-destructive/35 bg-destructive/10 text-destructive`,dot:`bg-destructive`,weight:70},yanked:{labelKey:`activity:techStackStatus.yanked`,badge:`border-destructive/45 bg-destructive/15 text-destructive`,dot:`bg-destructive`,weight:80},unmaintained_suspected:{labelKey:`activity:techStackStatus.unmaintained_suspected`,badge:`border-warning/35 bg-warning/10 text-warning`,dot:`bg-warning`,weight:60},blocked_by_constraints:{labelKey:`activity:techStackStatus.blocked_by_constraints`,badge:`border-warning/30 bg-warning/5 text-warning`,dot:`bg-warning`,weight:40},private_or_unresolved:{labelKey:`activity:techStackStatus.private_or_unresolved`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:10},local_path:{labelKey:`activity:techStackStatus.local_path`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:5},git_dependency:{labelKey:`activity:techStackStatus.git_dependency`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:5},unsupported:{labelKey:`activity:techStackStatus.unsupported`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:5},unknown:{labelKey:`activity:techStackStatus.unknown`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:20}},le={labelKey:`activity:techStackStatus.unknown`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:0};function P(e){return N[e]??le}var F={npm:{label:`npm / Node.js`,icon:C},python:{label:`Python`,icon:u},rust:{label:`Rust`,icon:re},go:{label:`Go`,icon:g},dotnet:{label:`.NET`,icon:o},php:{label:`PHP`,icon:d},dart:{label:`Dart / Flutter`,icon:i},maven:{label:`Maven`,icon:l},gradle:{label:`Gradle`,icon:ne},ruby:{label:`Ruby`,icon:s},swift:{label:`Swift`,icon:S},elixir:{label:`Elixir`,icon:d},cpp:{label:`C / C++`,icon:_}},ue={labelKey:`activity:techStackStatus.unknown`};function I(e,t){let n=L(e);return n.labelKey?t(n.labelKey):n.label??e}function L(e){return F[e]??ue}function R({ecosystem:e,className:t=`size-3.5 shrink-0`}){let n=L(e);if(!n.icon)return null;let r=n.icon;return(0,M.jsx)(r,{className:t})}function de(e){return P(e.status).weight>=50}var fe=[`critical`,`high`,`medium`,`low`,`info`],z={critical:{labelKey:`activity:techStackSeverity.critical`,badge:`border-destructive/45 bg-destructive/15 text-destructive`},high:{labelKey:`activity:techStackSeverity.high`,badge:`border-destructive/35 bg-destructive/10 text-destructive`},medium:{labelKey:`activity:techStackSeverity.medium`,badge:`border-warning/35 bg-warning/10 text-warning`},low:{labelKey:`activity:techStackSeverity.low`,badge:`border-info/35 bg-info/10 text-info`},info:{labelKey:`activity:techStackSeverity.info`,badge:`border-border/70 bg-muted text-muted-foreground`}},B={none:`activity:techStackAction.none`,upgrade_patch:`activity:techStackAction.upgrade_patch`,upgrade_minor:`activity:techStackAction.upgrade_minor`,upgrade_major:`activity:techStackAction.upgrade_major`,replace:`activity:techStackAction.replace`,remove:`activity:techStackAction.remove`,investigate:`activity:techStackAction.investigate`},V={full:{labelKey:`activity:techStackCoverage.full`,badge:`border-success/35 bg-success/10 text-success`,noteKey:void 0},partial:{labelKey:`activity:techStackCoverage.partial`,badge:`border-warning/35 bg-warning/10 text-warning`,noteKey:`activity:techStackCoverage.partialNote`},unsupported:{labelKey:`activity:techStackCoverage.unsupported`,badge:`border-border/70 bg-muted text-muted-foreground`,noteKey:`activity:techStackCoverage.unsupportedNote`}};function H(e){return V[e]??V.unsupported}function U(e){if(!e)return null;let t=/^\D*(\d+)/.exec(e);if(!t?.[1])return null;let n=Number(t[1]);return Number.isFinite(n)?n:null}function W(e){let t=U(e.locked??e.installed??e.requested),n=U(e.latestStable);if(t===null||n===null||n<=t)return{majorsBehind:0,label:null};let r=n-t;return{majorsBehind:r,label:`${r} major${r===1?``:`s`} behind`}}function G(e){return e.locked??e.installed??e.requested??null}function K(e){return e.confidence<1}function q({className:e,children:t}){return(0,M.jsx)(`span`,{className:w(`inline-flex shrink-0 items-center gap-1 border px-1.5 py-0.5 text-[10px] font-medium`,e),children:t})}function J({label:e,value:t,hint:n,tone:r=`default`}){let i={default:`text-foreground`,success:`text-success`,warning:`text-warning`,info:`text-info`,destructive:`text-destructive`}[r];return(0,M.jsxs)(`div`,{className:`border border-border/70 bg-card/55 px-3 py-2.5 shadow-[inset_0_1px_0_hsl(var(--foreground)/0.035)]`,children:[(0,M.jsx)(`p`,{className:`text-[9px] font-bold uppercase tracking-[0.16em] text-muted-foreground`,children:e}),(0,M.jsxs)(`div`,{className:`mt-1 flex items-end justify-between gap-2`,children:[(0,M.jsx)(`p`,{className:w(`font-mono text-xl font-bold tabular-nums`,i),children:t}),(0,M.jsx)(`p`,{className:`truncate text-[9px] text-muted-foreground`,children:n})]})]})}function Y(e,t){let n,r,i;if(t===`json`)n=JSON.stringify(e,null,2),r=`techstack.json`,i=`application/json`;else if(t===`spdx`){let t={spdxVersion:`SPDX-2.3`,dataLicense:`CC0-1.0`,SPDXID:`SPDXRef-DOCUMENT`,name:`TechStack-SBOM-${e.projectId}`,documentNamespace:`https://wrongstack.dev/spdx/${e.id}`,creationInfo:{created:e.createdAt,creators:[`Tool: WrongStack TechStack Engine`]},packages:e.dependencies.map((e,t)=>({name:e.name,SPDXID:`SPDXRef-Package-${t}`,versionInfo:e.locked??e.requested,downloadLocation:e.purl?`https://purl.io/${e.purl}`:`NOASSERTION`,licenseConcluded:e.license??`NOASSERTION`}))};n=JSON.stringify(t,null,2),r=`techstack-sbom-spdx.json`,i=`application/json`}else if(t===`cyclonedx`){let t={bomFormat:`CycloneDX`,specVersion:`1.5`,version:1,metadata:{timestamp:e.createdAt,tools:[{name:`WrongStack TechStack Engine`,version:e.adapterVersion}]},components:e.dependencies.map(e=>({type:`library`,name:e.name,version:e.locked??e.requested,...e.purl?{purl:e.purl}:{},...e.license?{licenses:[{license:{id:e.license}}]}:{}}))};n=JSON.stringify(t,null,2),r=`techstack-sbom-cyclonedx.json`,i=`application/json`}else{let t=[`# TechStack Report`,``,`**Generated:** ${e.createdAt}`,`**Target:** ${e.targetRoot}`,`**Fingerprint:** ${e.fingerprint}`,`**Workspaces:** ${e.workspaces.length}`,`**Dependencies:** ${e.dependencies.length}`,`**Findings:** ${e.findings.length}`,`**Coverage:** ${e.coverage}`,``];if(e.workspaces.length>0){t.push(`## Workspaces`,``,`| Workspace | Ecosystem | Coverage | Deps |`,`|---|---|---|---|`);for(let n of e.workspaces){let r=e.dependencies.filter(e=>e.workspaceId===n.id).length;t.push(`| ${n.relativeRoot} | ${n.ecosystem} | ${n.coverage} | ${r} |`)}t.push(``)}if(e.findings.length>0){t.push(`## Findings`,``);let n=new Map;for(let t of e.findings)n.set(t.severity,[...n.get(t.severity)??[],t]);for(let r of[`critical`,`high`,`medium`,`low`,`info`]){let i=n.get(r);if(i?.length){t.push(`### ${r.charAt(0).toUpperCase()+r.slice(1)} (${i.length})`,``);for(let n of i){let r=e.dependencies.find(e=>e.id===n.dependencyId);t.push(`- **${r?.name??n.dependencyId}** — ${n.type} — ${n.rationale}`)}t.push(``)}}}if(e.dependencies.length>0){t.push(`## Dependencies`,``,`| Name | Ecosystem | Status | Locked | Latest |`,`|---|---|---|---|---|`);for(let n of e.dependencies)t.push(`| ${n.name} | ${n.ecosystem} | ${n.status} | ${n.locked??`—`} | ${n.latestStable??`—`} |`)}n=t.join(`
|
|
2
2
|
`),r=`techstack-report.md`,i=`text/markdown`}let a=new Blob([n],{type:i}),o=URL.createObjectURL(a),s=document.createElement(`a`);s.href=o,s.download=r,s.click(),URL.revokeObjectURL(o)}function pe({dependency:e,findings:n,deepDive:i,onDeepDive:a,onBack:o,coverage:s}){let{t:c}=t(),l=P(e.status),u=G(e),d=W(e),f=s?H(s).noteKey:void 0;return(0,M.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,M.jsxs)(`header`,{className:`shrink-0 border-b border-border/70 bg-card/45 p-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,M.jsx)(E,{variant:`ghost`,size:`icon`,onClick:o,"aria-label":c(`activity:techStack.backToDependencyList`),className:`shrink-0 md:hidden`,children:(0,M.jsx)(r,{className:`size-4`})}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,M.jsx)(`h2`,{className:`min-w-0 truncate font-mono text-sm font-bold text-foreground`,children:e.name}),(0,M.jsx)(q,{className:l.badge,children:c(l.labelKey)})]}),(0,M.jsxs)(`p`,{className:`mt-0.5 truncate text-[10px] text-muted-foreground`,children:[I(e.ecosystem,c),` ·`,` `,e.direct?`direct`:`transitive`,` · `,e.scope,` ·`,` `,e.sourceType,f&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),(0,M.jsx)(`span`,{className:`text-warning`,children:c(f)})]})]})]})]}),(0,M.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-baseline gap-2 font-mono text-xs`,children:[(0,M.jsx)(`span`,{className:`text-foreground`,children:u??`—`}),e.latestStable&&e.latestStable!==u&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,M.jsx)(`span`,{className:`text-info`,children:e.latestStable})]}),d.label&&(0,M.jsxs)(`span`,{className:`text-[10px] text-warning`,children:[`(`,d.label,`)`]})]})]}),(0,M.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:[(0,M.jsxs)(`dl`,{className:`grid grid-cols-2 gap-px border border-border/70 bg-border/60`,children:[(0,M.jsx)(X,{label:c(`activity:techStack.constraint`),value:e.requested??`—`,mono:!0}),(0,M.jsx)(X,{label:c(`activity:techStack.locked`),value:e.locked??`—`,mono:!0}),(0,M.jsx)(X,{label:c(`activity:techStack.latestStable`),value:e.latestStable??`—`,mono:!0}),(0,M.jsx)(X,{label:c(`activity:techStack.license`),value:e.license??`—`}),e.wanted&&(0,M.jsx)(X,{label:c(`activity:techStack.wanted`),value:e.wanted,mono:!0}),e.resolvable&&(0,M.jsx)(X,{label:c(`activity:techStack.resolvable`),value:e.resolvable,mono:!0}),e.purl&&(0,M.jsx)(X,{label:c(`activity:techStack.purl`),value:e.purl,mono:!0}),(0,M.jsx)(X,{label:c(`activity:techStack.registryFlags`),value:[e.deprecated&&`deprecated`,e.yanked&&`yanked`].filter(Boolean).join(`, `)||`none`})]}),(0,M.jsxs)(`section`,{className:`mt-4`,children:[(0,M.jsxs)(`div`,{className:`mb-1.5 flex flex-wrap items-center justify-between gap-2`,children:[(0,M.jsx)(`h3`,{className:`text-[9px] font-bold uppercase tracking-[0.16em] text-muted-foreground`,children:c(`activity:techStack.findings`)}),(0,M.jsxs)(E,{variant:`outline`,size:`sm`,onClick:()=>a(e),disabled:i.status===`loading`,className:`h-7 text-[10px]`,children:[i.status===`loading`?(0,M.jsx)(x,{className:`size-3 animate-spin`}):(0,M.jsx)(p,{className:`size-3`}),i.status===`loading`?`Researching…`:`Deep dive`]})]}),i.status===`error`&&i.error&&(0,M.jsx)(`p`,{role:`alert`,className:`mb-1.5 text-[10px] text-destructive`,children:i.error}),n.length===0?(0,M.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:c(`activity:techStack.nothingFlaggedRunADeepDive`)}):(0,M.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:n.map(e=>(0,M.jsxs)(`div`,{className:`border border-border/70 bg-card/40 p-2`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,M.jsx)(q,{className:z[e.severity].badge,children:c(z[e.severity].labelKey)}),(0,M.jsx)(q,{className:`border-border/70 bg-muted text-muted-foreground`,children:B[e.action]?c(B[e.action]):e.action}),K(e)&&(0,M.jsxs)(q,{className:`border-info/35 bg-info/10 text-info`,children:[(0,M.jsx)(p,{className:`size-2.5`}),`AI · `,Math.round(e.confidence*100),`%`]})]}),(0,M.jsx)(`p`,{className:`mt-1 text-[11px] leading-relaxed text-muted-foreground`,children:e.rationale}),e.breakingRisk&&(0,M.jsx)(`p`,{className:`mt-1 border-l-2 border-warning/40 pl-2 text-[10px] leading-relaxed text-warning`,children:e.breakingRisk})]},e.id))})]}),(0,M.jsxs)(`section`,{className:`mt-4`,children:[(0,M.jsx)(`h3`,{className:`mb-1.5 text-[9px] font-bold uppercase tracking-[0.16em] text-muted-foreground`,children:c(`activity:techStack.evidence`)}),e.evidence.length===0?(0,M.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:c(`activity:techStack.noEvidenceRecorded`)}):(0,M.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.evidence.map((t,n)=>(0,M.jsxs)(`li`,{className:`border border-border/70 bg-card/40 p-2`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,M.jsx)(q,{className:`border-border/70 bg-muted text-muted-foreground`,children:t.kind}),(0,M.jsx)(`span`,{className:`font-mono text-[9px] text-muted-foreground`,children:new Date(t.retrievedAt).toLocaleString()})]}),t.source.startsWith(`http`)?(0,M.jsxs)(`a`,{href:t.source,target:`_blank`,rel:`noreferrer noopener`,className:`mt-1 flex min-w-0 items-center gap-1 truncate text-[10px] text-info underline-offset-2 hover:underline`,children:[(0,M.jsx)(`span`,{className:`truncate`,children:t.source}),(0,M.jsx)(b,{className:`size-2.5 shrink-0`})]}):(0,M.jsx)(`p`,{className:`mt-1 truncate font-mono text-[10px] text-muted-foreground`,children:t.source}),t.detail&&(0,M.jsx)(`p`,{className:`mt-0.5 text-[10px] leading-relaxed text-muted-foreground`,children:t.detail})]},`${e.id}-evidence-${n}`))})]})]})]})}function X({label:e,value:t,mono:n}){return(0,M.jsxs)(`div`,{className:`bg-card/55 px-2.5 py-1.5`,children:[(0,M.jsx)(`dt`,{className:`text-[9px] font-bold uppercase tracking-[0.14em] text-muted-foreground`,children:e}),(0,M.jsx)(`dd`,{className:w(`mt-0.5 truncate text-[11px] text-foreground`,n&&`font-mono`),children:t})]})}var me=`grid grid-cols-[minmax(0,2.2fr)_minmax(0,1.6fr)_minmax(0,1.1fr)] gap-2`;function he({dependencies:e,selectedId:n,hasDependencies:r,coverageByWorkspaceId:i,onSelect:a}){let{t:o}=t(),s=A(e,30);return e.length===0?(0,M.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 text-center`,children:(0,M.jsx)(`p`,{className:`max-w-xs text-xs text-muted-foreground`,children:r?`No dependencies match the current filters.`:`No dependencies inventoried yet. Run a scan to populate the inventory.`})}):(0,M.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,M.jsxs)(`div`,{className:w(me,`shrink-0 border-b border-border/70 bg-card/45 px-3 py-1.5 text-[9px] font-bold uppercase tracking-[0.14em] text-muted-foreground`),children:[(0,M.jsx)(`span`,{children:o(`activity:techStack.package`)}),(0,M.jsx)(`span`,{children:o(`activity:techStack.installedLatest`)}),(0,M.jsx)(`span`,{children:o(`activity:techStack.status`)})]}),(0,M.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,M.jsx)(c,{className:`h-full`,"aria-label":o(`activity:techStack.dependencies`),children:s.pageItems.map(e=>(0,M.jsx)(ge,{dependency:e,selected:e.id===n,coverage:i?.get(e.workspaceId),onSelect:a},e.id))})}),(0,M.jsx)(O,{page:s.page,pageSize:s.pageSize,totalItems:s.totalItems,onPageChange:s.setPage,itemLabel:`dependencies`})]})}function ge({dependency:e,selected:n,coverage:r,onSelect:i}){let{t:a}=t(),o=P(e.status),s=G(e),c=W(e),l=r?H(r).noteKey:void 0;return(0,M.jsxs)(`button`,{type:`button`,onClick:()=>i(e),"aria-current":n,className:w(me,`w-full items-center border-b border-border/40 px-3 py-2 text-left transition-colors hover:bg-accent/40`,n&&`bg-accent/60`),children:[(0,M.jsxs)(`div`,{className:`min-w-0`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,M.jsx)(`span`,{className:w(`size-1.5 shrink-0`,o.dot),"aria-hidden":`true`}),(0,M.jsx)(`span`,{className:`truncate font-mono text-xs text-foreground`,children:e.name})]}),(0,M.jsxs)(`p`,{className:`mt-0.5 truncate text-[10px] text-muted-foreground`,children:[(0,M.jsx)(R,{ecosystem:e.ecosystem,className:`mr-0.5 inline-block size-3 align-text-bottom`}),I(e.ecosystem,a),` · `,e.direct?`direct`:`transitive`,` · `,e.scope,l&&(0,M.jsxs)(M.Fragment,{children:[` · `,(0,M.jsx)(`span`,{className:`text-warning`,children:a(l)})]})]})]}),(0,M.jsxs)(`div`,{className:`min-w-0`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-1.5 font-mono text-[11px]`,children:[(0,M.jsx)(`span`,{className:`truncate text-foreground`,children:s??`—`}),e.latestStable&&e.latestStable!==s&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`→`}),(0,M.jsx)(`span`,{className:`truncate text-info`,children:e.latestStable})]})]}),c.label?(0,M.jsx)(`p`,{className:`mt-0.5 truncate text-[10px] text-warning`,children:c.label}):e.requested&&(0,M.jsx)(`p`,{className:`mt-0.5 truncate font-mono text-[10px] text-muted-foreground`,children:e.requested})]}),(0,M.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1`,children:[(0,M.jsx)(q,{className:o.badge,children:a(o.labelKey)}),e.deprecated&&(0,M.jsx)(q,{className:`border-destructive/35 bg-destructive/10 text-destructive`,children:`dep`}),e.yanked&&(0,M.jsx)(q,{className:`border-destructive/45 bg-destructive/15 text-destructive`,children:`yank`})]})]})}function _e({findings:e,dependenciesById:n,onSelectDependency:r}){let{t:i}=t(),a=A(e,20);if(e.length===0)return(0,M.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 text-center`,children:(0,M.jsxs)(`p`,{className:`max-w-sm text-xs text-muted-foreground`,children:[i(`activity:techStack.noFindingsRun`),` `,(0,M.jsx)(`span`,{className:`font-mono text-foreground`,children:i(`activity:techStack.analyze`)}),` `,i(`activity:techStack.toCheckVersionsAndAdvisoriesAgainst`)]})});let o=fe.map(e=>[e,a.pageItems.filter(t=>t.severity===e)]).filter(([,e])=>e.length>0);return(0,M.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,M.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:(0,M.jsx)(`div`,{className:`flex flex-col gap-4`,children:o.map(([e,t])=>(0,M.jsxs)(`section`,{children:[(0,M.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-2`,children:[(0,M.jsx)(q,{className:z[e].badge,children:i(z[e].labelKey)}),(0,M.jsx)(`span`,{className:`font-mono text-[10px] tabular-nums text-muted-foreground`,children:t.length})]}),(0,M.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:t.map(e=>(0,M.jsx)(ve,{finding:e,dependency:n.get(e.dependencyId),onSelectDependency:r},e.id))})]},e))})}),(0,M.jsx)(O,{page:a.page,pageSize:a.pageSize,totalItems:a.totalItems,onPageChange:a.setPage,itemLabel:`findings`})]})}function ve({finding:e,dependency:n,onSelectDependency:r}){let{t:i}=t(),a=K(e);return(0,M.jsxs)(`div`,{className:`border border-border/70 bg-card/40 p-2.5`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:()=>r(e.dependencyId),className:`min-w-0 truncate font-mono text-xs text-foreground underline-offset-2 hover:underline`,children:n?.name??e.dependencyId}),(0,M.jsx)(q,{className:`border-border/70 bg-muted text-muted-foreground`,children:B[e.action]?i(B[e.action]):e.action}),a&&(0,M.jsxs)(q,{className:`border-info/35 bg-info/10 text-info`,children:[(0,M.jsx)(p,{className:`size-2.5`}),`AI · `,Math.round(e.confidence*100),`%`]})]}),(0,M.jsx)(`p`,{className:`mt-1.5 text-[11px] leading-relaxed text-muted-foreground`,children:e.rationale}),e.breakingRisk&&(0,M.jsx)(`p`,{className:`mt-1 border-l-2 border-warning/40 pl-2 text-[10px] leading-relaxed text-warning`,children:e.breakingRisk}),e.evidence.length>0&&(0,M.jsx)(`ul`,{className:w(`mt-1.5 flex flex-col gap-0.5`),children:e.evidence.slice(0,4).map((t,n)=>(0,M.jsx)(`li`,{className:`min-w-0 truncate text-[10px]`,children:t.source.startsWith(`http`)?(0,M.jsx)(`a`,{href:t.source,target:`_blank`,rel:`noreferrer noopener`,className:`text-info underline-offset-2 hover:underline`,children:t.detail??t.source}):(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:t.detail??t.source})},`${e.id}-${n}`))})]})}function ye({searchQuery:e,ecosystemFilter:r,statusFilter:i,directOnly:a,sort:o,hasFilters:s,ecosystems:c,statuses:l,visibleCount:u,totalCount:d,onSearchChange:f,onEcosystemFilterChange:p,onStatusFilterChange:ee,onToggleDirectOnly:h,onSortChange:g,onClearFilters:_}){let{t:v}=t();return(0,M.jsxs)(`div`,{className:`shrink-0 space-y-2 border-b border-border/70 bg-card/45 p-3`,children:[(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[(0,M.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,M.jsx)(m,{className:`pointer-events-none absolute left-3 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,M.jsx)(D,{"aria-label":v(`activity:techStack.searchDependencies`),value:e,onChange:e=>f(e.target.value),placeholder:v(`activity:techStack.searchByPackageName`),className:`h-10 min-w-0 bg-background pl-9 pr-8 text-xs`}),e&&(0,M.jsx)(`button`,{type:`button`,"aria-label":v(`activity:techStack.clearSearch`),onClick:()=>f(``),className:`absolute right-2 top-1/2 -translate-y-1/2 p-1 text-muted-foreground hover:text-foreground`,children:(0,M.jsx)(te,{className:`size-3.5`})})]}),(0,M.jsx)(E,{variant:a?`default`:`outline`,size:`sm`,onClick:h,"aria-pressed":a,title:v(`activity:techStack.showOnlyDependenciesThisProjectDeclaresItself`),className:`shrink-0`,children:v(`activity:techStack.directOnly`)}),s&&(0,M.jsx)(E,{variant:`ghost`,size:`icon`,onClick:_,"aria-label":v(`activity:techStack.clearAllFilters`),title:v(`activity:techStack.clearAllFilters`),className:`shrink-0`,children:(0,M.jsx)(n,{className:`size-4`})})]}),(0,M.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`sr-only`,htmlFor:`techstack-ecosystem-filter`,children:v(`activity:techStack.filterByEcosystem`)}),(0,M.jsxs)(`select`,{id:`techstack-ecosystem-filter`,value:r,onChange:e=>p(e.target.value),className:`h-9 w-full min-w-0 border border-input bg-background px-2 text-xs`,children:[(0,M.jsx)(`option`,{value:`all`,children:v(`activity:techStack.allEcosystems`)}),c.map(([e,t])=>(0,M.jsxs)(`option`,{value:e,children:[I(e,v),` · `,t]},e))]})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`sr-only`,htmlFor:`techstack-status-filter`,children:v(`activity:techStack.filterByStatus`)}),(0,M.jsxs)(`select`,{id:`techstack-status-filter`,value:i,onChange:e=>ee(e.target.value),className:`h-9 w-full min-w-0 border border-input bg-background px-2 text-xs`,children:[(0,M.jsx)(`option`,{value:`all`,children:v(`activity:techStack.allStatuses`)}),l.map(([e,t])=>(0,M.jsxs)(`option`,{value:e,children:[v(P(e).labelKey),` · `,t]},e))]})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`sr-only`,htmlFor:`techstack-sort`,children:v(`activity:techStack.sortDependencies`)}),(0,M.jsxs)(`select`,{id:`techstack-sort`,value:o,onChange:e=>g(e.target.value),className:`h-9 w-full min-w-0 border border-input bg-background px-2 text-xs`,children:[(0,M.jsx)(`option`,{value:`attention`,children:v(`activity:techStack.sortNeedsAttention`)}),(0,M.jsx)(`option`,{value:`drift`,children:v(`activity:techStack.sortMostOutOfDate`)}),(0,M.jsx)(`option`,{value:`name`,children:v(`activity:techStack.sortName`)})]})]})]}),(0,M.jsx)(`p`,{className:w(`text-[10px] text-muted-foreground`,s&&`text-info`),children:u===d?`${d} dependencies`:`${u} of ${d} dependencies`})]})}var be=[{id:`dependencies`,labelKey:`activity:techStack.tabDependencies`},{id:`findings`,labelKey:`activity:techStack.tabFindings`},{id:`workspaces`,labelKey:`activity:techStack.tabWorkspaces`},{id:`trends`,labelKey:`activity:techStack.tabTrends`},{id:`remediation`,labelKey:`activity:techStack.tabRemediation`}],Z=new Set([`npm`,`python`,`rust`,`go`,`php`,`dotnet`]);function Q(){let{t:e}=t(),n=T(e=>e.snapshot),r=T(e=>e.stale),i=T(e=>e.loading),a=T(e=>e.error),o=T(e=>e.activeJob),[s,c]=(0,j.useState)(`dependencies`),[l,u]=(0,j.useState)(``),[d,m]=(0,j.useState)(`all`),[h,g]=(0,j.useState)(`all`),[_,y]=(0,j.useState)(!1),[b,ne]=(0,j.useState)(`attention`),[S,C]=(0,j.useState)(null),[D,O]=(0,j.useState)([]),[A,N]=(0,j.useState)({status:`idle`,error:null}),[le,F]=(0,j.useState)(null),[ue,I]=(0,j.useState)(null),[L,R]=(0,j.useState)(new Set),[fe,z]=(0,j.useState)(!1),B=(0,j.useCallback)(async()=>{let e=T.getState();e.setLoading(!0),e.setError(null);try{let t=await fetch(`/api/techstack/snapshot`);if(t.status===404){e.setSnapshot(null,!1);return}if(!t.ok)throw Error(`HTTP ${t.status}: ${t.statusText}`);let n=await t.json();e.setSnapshot(n.snapshot,n.stale)}catch(t){e.setError(t instanceof Error?t.message:String(t))}},[]),V=(0,j.useCallback)(async e=>{let t=T.getState();t.setLoading(!0),t.setError(null);try{let n=await fetch(`/api/techstack/${e}`,{method:`POST`}),r=await n.json();if(!n.ok||!r.jobId)throw Error(r.error??`HTTP ${n.status}: ${n.statusText}`);t.jobStarted(r.jobId,e)}catch(e){t.setError(e instanceof Error?e.message:String(e))}},[]),H=(0,j.useCallback)(async()=>{let e=T.getState().activeJob;if(e)try{let t=await fetch(`/api/techstack/jobs/${encodeURIComponent(e.id)}/cancel`,{method:`POST`});if(!t.ok)throw Error(`HTTP ${t.status}: ${t.statusText}`);T.getState().jobCancelled(e.id)}catch(e){T.getState().setError(e instanceof Error?e.message:String(e))}},[]),U=(0,j.useCallback)(async e=>{N({status:`loading`,error:null});try{let t=await fetch(`/api/techstack/deps/${encodeURIComponent(e.id)}/research`,{method:`POST`}),n=await t.json();if(!t.ok)throw Error(n.error??`HTTP ${t.status}`);O(n.findings??[]),N({status:`idle`,error:null})}catch(e){N({status:`error`,error:e instanceof Error?e.message:String(e)})}},[]);(0,j.useEffect)(()=>{B()},[B]),(0,j.useEffect)(()=>{(s===`trends`||s===`remediation`)&&fetch(`/api/techstack/${s===`trends`?`trends`:`remediation`}`).then(async e=>{let t=await e.json();if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);t.trend&&F(t.trend),t.plan&&I(t.plan)}).catch(e=>T.getState().setError(e instanceof Error?e.message:String(e)))},[s,n?.id]);let G=(0,j.useCallback)(async()=>{if(L.size!==0){z(!0);try{let e=await fetch(`/api/techstack/remediation/apply`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({approvedItems:[...L]})}),t=await e.json();if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);R(new Set),await V(`inventory`)}catch(e){T.getState().setError(e instanceof Error?e.message:String(e))}finally{z(!1)}}},[L,V]);(0,j.useEffect)(()=>{O([]),N({status:`idle`,error:null})},[n?.id]);let K=(0,j.useMemo)(()=>n?.dependencies??[],[n]),q=(0,j.useMemo)(()=>n?.findings??[],[n]),X=(0,j.useMemo)(()=>new Map(K.map(e=>[e.id,e])),[K]),me=(0,j.useMemo)(()=>Ee(K.map(e=>e.ecosystem)),[K]),ge=(0,j.useMemo)(()=>Ee(K.map(e=>e.status)),[K]),ve=(0,j.useMemo)(()=>new Map(n?.workspaces.map(e=>[e.id,e.coverage])??[]),[n]),Z=(0,j.useMemo)(()=>{let e=l.trim().toLowerCase(),t=[...K.filter(t=>!(e&&!t.name.toLowerCase().includes(e)||d!==`all`&&t.ecosystem!==d||h!==`all`&&t.status!==h||_&&!t.direct))];return b===`name`?t.sort((e,t)=>e.name.localeCompare(t.name)):b===`drift`?t.sort((e,t)=>W(t).majorsBehind-W(e).majorsBehind||e.name.localeCompare(t.name)):t.sort((e,t)=>P(t.status).weight-P(e.status).weight||Number(t.direct)-Number(e.direct)||e.name.localeCompare(t.name)),t},[K,l,d,h,_,b]),Q=S?X.get(S):void 0,De=(0,j.useMemo)(()=>Q?[...q.filter(e=>e.dependencyId===Q.id),...D.filter(e=>e.dependencyId===Q.id)]:[],[q,D,Q]),Oe=(0,j.useMemo)(()=>K.filter(de).length,[K]),ke=(0,j.useMemo)(()=>K.filter(e=>W(e).majorsBehind>0).length,[K]),Ae=(0,j.useMemo)(()=>K.filter(e=>e.status===`vulnerable`).length,[K]),je=l.trim()!==``||d!==`all`||h!==`all`||_,Me=(0,j.useCallback)(()=>{u(``),m(`all`),g(`all`),y(!1)},[]),$=!!(o&&![`completed`,`failed`,`cancelled`].includes(o.status)),Ne=(0,j.useCallback)(e=>{C(e),c(`dependencies`)},[]);return(0,M.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,M.jsx)(`header`,{className:`shrink-0 border-b border-border/70 px-4 py-3`,children:(0,M.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,M.jsx)(`h1`,{className:`text-base font-bold sm:text-lg`,children:e(`activity:techStack.techstack`)}),(0,M.jsx)(`span`,{className:`border border-info/35 bg-info/10 px-2 py-0.5 font-mono text-[9px] font-bold uppercase text-info`,children:n?`${n.workspaces.length} workspaces`:`no scan yet`}),r&&(0,M.jsx)(`span`,{className:`border border-warning/35 bg-warning/10 px-2 py-0.5 font-mono text-[9px] font-bold uppercase text-warning`,children:e(`activity:techStack.staleGt24h`)})]}),(0,M.jsx)(`p`,{className:`mt-0.5 truncate text-[10px] text-muted-foreground sm:text-xs`,children:n?`${n.targetRoot} · scanned ${new Date(n.createdAt).toLocaleString()}`:`Scan the open project to inventory its dependencies.`})]}),(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,M.jsxs)(E,{variant:`outline`,size:`sm`,onClick:()=>void V(`inventory`),disabled:$,title:e(`activity:techStack.offlineReReadManifestsAndLockfiles`),children:[(0,M.jsx)(ae,{className:w(`size-3.5`,$&&`animate-spin`)}),(0,M.jsx)(`span`,{className:`hidden sm:inline`,children:e(`activity:techStack.refresh`)})]}),(0,M.jsxs)(E,{size:`sm`,onClick:()=>void V(`analyze`),disabled:$,title:e(`activity:techStack.checkRegistriesAndAdvisoriesThenInterpretTheResultsWithTheModel`),children:[(0,M.jsx)(p,{className:`size-3.5`}),e(`activity:techStack.analyze`)]}),$&&(0,M.jsx)(E,{variant:`ghost`,size:`icon`,onClick:()=>void H(),"aria-label":e(`activity:techStack.cancelJob`),children:(0,M.jsx)(te,{className:`size-4`})}),(0,M.jsxs)(ce,{children:[(0,M.jsx)(se,{asChild:!0,children:(0,M.jsx)(E,{variant:`ghost`,size:`icon`,disabled:!n,"aria-label":e(`activity:techStack.exportOptions`),title:e(`activity:techStack.exportOptions`),children:(0,M.jsx)(ie,{className:`size-4`})})}),(0,M.jsxs)(oe,{align:`end`,className:`w-60`,children:[(0,M.jsxs)(k,{onClick:()=>n&&Y(n,`json`),children:[(0,M.jsx)(v,{className:`mr-2 size-4`}),e(`activity:techStack.exportSnapshotAsJson`)]}),(0,M.jsxs)(k,{onClick:()=>n&&Y(n,`spdx`),children:[(0,M.jsx)(re,{className:`mr-2 size-4`}),e(`activity:techStack.exportSbomSpdx`)]}),(0,M.jsxs)(k,{onClick:()=>n&&Y(n,`cyclonedx`),children:[(0,M.jsx)(ee,{className:`mr-2 size-4`}),e(`activity:techStack.exportSbomCycloneDx`)]}),(0,M.jsxs)(k,{onClick:()=>n&&Y(n,`md`),children:[(0,M.jsx)(f,{className:`mr-2 size-4`}),e(`activity:techStack.exportReportMd`)]})]})]})]})]})}),n&&(0,M.jsxs)(`div`,{className:`grid shrink-0 grid-cols-2 gap-px border-b border-border/70 bg-border/60 sm:grid-cols-4`,children:[(0,M.jsx)(J,{label:e(`activity:techStack.dependencies`),value:K.length,hint:`${Z.length} visible`}),(0,M.jsx)(J,{label:e(`activity:techStack.outdated`),value:ke,hint:e(`activity:techStack.majorsBehind`),tone:ke>0?`warning`:`success`}),(0,M.jsx)(J,{label:e(`activity:techStack.vulnerable`),value:Ae,hint:e(`activity:techStack.knownAdvisories`),tone:Ae>0?`destructive`:`success`}),(0,M.jsx)(J,{label:e(`activity:techStack.findings`),value:q.length,hint:`${Oe} need attention`,tone:q.length>0?`info`:`default`})]}),($||a)&&(0,M.jsxs)(`div`,{className:`shrink-0 border-b border-border/70 px-4 py-2`,"aria-live":`polite`,children:[$&&o&&(0,M.jsxs)(`div`,{role:`status`,className:`flex items-center gap-2 text-xs text-info`,children:[(0,M.jsx)(x,{className:`size-3.5 animate-spin`}),(0,M.jsx)(`span`,{className:`font-mono`,children:o.status}),o.progress&&(0,M.jsxs)(`span`,{className:`text-muted-foreground`,children:[o.progress.completed,`/`,o.progress.total]})]}),a&&(0,M.jsxs)(`div`,{role:`alert`,className:`flex items-center gap-2 text-xs text-destructive`,children:[(0,M.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:a}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>void B(),className:`underline`,children:e(`activity:techStack.retry`)})]})]}),i&&!n?(0,M.jsx)(we,{}):n?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`nav`,{className:`flex shrink-0 gap-1 border-b border-border/70 px-2`,children:be.map(t=>(0,M.jsxs)(`button`,{type:`button`,onClick:()=>c(t.id),"aria-current":s===t.id,className:w(`border-b-2 px-3 py-2 text-xs font-medium transition-colors`,s===t.id?`border-primary text-foreground`:`border-transparent text-muted-foreground hover:text-foreground`),children:[e(t.labelKey),t.id===`findings`&&q.length>0&&(0,M.jsx)(`span`,{className:`ml-1.5 font-mono text-[10px] tabular-nums text-muted-foreground`,children:q.length})]},t.id))}),s===`dependencies`&&(0,M.jsxs)(`div`,{className:`grid min-h-0 flex-1 md:grid-cols-[minmax(340px,1fr)_minmax(0,1.15fr)]`,children:[(0,M.jsxs)(`section`,{className:w(`min-h-0 border-r border-border/70`,Q?`hidden md:flex md:flex-col`:`flex flex-col`),"aria-label":e(`activity:techStack.dependencyList`),children:[(0,M.jsx)(ye,{searchQuery:l,ecosystemFilter:d,statusFilter:h,directOnly:_,sort:b,hasFilters:je,ecosystems:me,statuses:ge,visibleCount:Z.length,totalCount:K.length,onSearchChange:u,onEcosystemFilterChange:m,onStatusFilterChange:g,onToggleDirectOnly:()=>y(e=>!e),onSortChange:ne,onClearFilters:Me}),(0,M.jsx)(he,{dependencies:Z,selectedId:S,hasDependencies:K.length>0,coverageByWorkspaceId:ve,onSelect:e=>C(e.id)})]}),(0,M.jsx)(`section`,{className:w(`min-h-0`,Q?`flex flex-col`:`hidden md:flex md:flex-col`),"aria-label":e(`activity:techStack.dependencyDetail`),children:Q?(0,M.jsx)(pe,{dependency:Q,findings:De,deepDive:A,onDeepDive:U,onBack:()=>C(null),coverage:ve.get(Q.workspaceId)}):(0,M.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 text-center`,children:(0,M.jsx)(`p`,{className:`max-w-xs text-xs text-muted-foreground`,children:e(`activity:techStack.selectADependencyToSeeIts`)})})})]}),s===`findings`&&(0,M.jsx)(_e,{findings:q,dependenciesById:X,onSelectDependency:Ne}),s===`workspaces`&&(0,M.jsx)(Ce,{snapshot:n}),s===`trends`&&(0,M.jsx)(xe,{trend:le}),s===`remediation`&&(0,M.jsx)(Se,{plan:ue,approved:L,applying:fe,onToggle:e=>R(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),onApply:()=>void G()})]}):(0,M.jsx)(Te,{onScan:()=>void V(`inventory`),disabled:$})]})}function xe({trend:e}){return e?(0,M.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:[(0,M.jsxs)(`p`,{className:`mb-3 text-xs text-muted-foreground`,children:[e.snapshots,` snapshots`,e.vulnerabilityHalfLifeMs===void 0?``:` · vulnerability half-life ${(e.vulnerabilityHalfLifeMs/864e5).toFixed(1)} days`]}),(0,M.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:e.points.map(e=>(0,M.jsxs)(`div`,{className:`grid grid-cols-4 border border-border/70 bg-card/40 p-2 text-xs`,children:[(0,M.jsx)(`span`,{children:new Date(e.createdAt).toLocaleDateString()}),(0,M.jsxs)(`span`,{children:[e.dependencies,` deps`]}),(0,M.jsxs)(`span`,{className:`text-warning`,children:[e.outdated,` outdated`]}),(0,M.jsxs)(`span`,{className:`text-destructive`,children:[e.vulnerable,` vulnerable`]})]},e.snapshotId))})]}):(0,M.jsx)(we,{})}function Se({plan:e,approved:n,applying:r,onToggle:i,onApply:a}){let{t:o}=t();return e?(0,M.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:[(0,M.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.warning}),(0,M.jsxs)(E,{size:`sm`,disabled:n.size===0||r,onClick:a,children:[r&&(0,M.jsx)(x,{className:`size-3.5 animate-spin`}),`Apply `,n.size>0?n.size:``]})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e.items.map(e=>{let t=`${e.workspaceId}:${e.ecosystem}:${e.dependencyName}:${e.action}`,r=e.action===`replace`||e.action===`investigate`||!Z.has(e.ecosystem);return(0,M.jsxs)(`label`,{className:w(`flex gap-3 border border-border/70 bg-card/40 p-2.5`,r?`cursor-not-allowed opacity-65`:`cursor-pointer`),children:[(0,M.jsx)(`input`,{type:`checkbox`,disabled:r,checked:n.has(t),onChange:()=>i(t)}),(0,M.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,M.jsxs)(`span`,{className:`block font-mono text-xs`,children:[e.dependencyName,` · `,e.action]}),(0,M.jsxs)(`span`,{className:`block text-[10px] text-muted-foreground`,children:[e.currentVersion??`?`,` → `,e.targetVersion??`latest`,` · `,e.rationale]}),r&&(0,M.jsx)(`span`,{className:`block text-[10px] text-warning`,children:o(`activity:techStack.requiresAManualPackageChoice`)})]})]},t)}),e.items.length===0&&(0,M.jsx)(`p`,{className:`p-8 text-center text-xs text-muted-foreground`,children:o(`activity:techStack.noRemediationNeeded`)})]})]}):(0,M.jsx)(we,{})}function Ce({snapshot:e}){let{t:n}=t(),r=(0,j.useMemo)(()=>{let t=new Map;for(let n of e.dependencies)t.set(n.workspaceId,(t.get(n.workspaceId)??0)+1);return t},[e]);return e.workspaces.length===0?(0,M.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8`,children:(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`activity:techStack.noWorkspacesDetected`)})}):(0,M.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:(0,M.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:e.workspaces.map(e=>{let t=V[e.coverage];return(0,M.jsxs)(`div`,{className:`border border-border/70 bg-card/40 p-2.5`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,M.jsxs)(`div`,{className:`min-w-0`,children:[(0,M.jsx)(`p`,{className:`truncate font-mono text-xs text-foreground`,children:e.relativeRoot}),(0,M.jsxs)(`p`,{className:`mt-0.5 flex items-center gap-1 truncate text-[10px] text-muted-foreground`,children:[(0,M.jsx)(R,{ecosystem:e.ecosystem}),(0,M.jsx)(`span`,{children:I(e.ecosystem,n)}),e.packageManager?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,M.jsx)(`span`,{children:e.packageManager})]}):null,(0,M.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,M.jsxs)(`span`,{children:[r.get(e.id)??0,` deps`]})]})]}),(0,M.jsx)(`span`,{className:w(`shrink-0 border px-1.5 py-0.5 text-[10px] font-medium`,t.badge),children:n(t.labelKey)})]}),e.manifests.length>0&&(0,M.jsx)(`div`,{className:`mt-1.5 flex flex-wrap gap-1`,children:e.manifests.map(e=>(0,M.jsx)(`span`,{className:`border border-border/70 bg-background/45 px-1.5 py-0.5 font-mono text-[9px] text-muted-foreground`,children:e.split(/[/\\]/).pop()},e))})]},e.id)})})})}function we(){let{t:e}=t();return(0,M.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,M.jsx)(x,{className:`size-5 animate-spin text-muted-foreground`}),(0,M.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`activity:techStack.loadingSnapshot`)})]})})}function Te({onScan:e,disabled:n}){let{t:r}=t(),i=(0,j.useMemo)(()=>Object.values(F).map(e=>e.label??``).filter(Boolean).join(`, `),[]);return(0,M.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8`,children:(0,M.jsxs)(`div`,{className:`flex max-w-md flex-col items-center gap-3 text-center`,children:[(0,M.jsx)(`div`,{className:`flex size-14 items-center justify-center border border-info/25 bg-info/5 text-info`,children:(0,M.jsx)(h,{className:`size-6`})}),(0,M.jsx)(`h2`,{className:`text-sm font-semibold`,children:r(`activity:techStack.noInventoryYet`)}),(0,M.jsxs)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:[`TechStack reads every manifest and lockfile in the open project — `,i,` — and compares what you have against the upstream registries.`]}),(0,M.jsxs)(E,{size:`sm`,onClick:e,disabled:n,children:[(0,M.jsx)(ae,{className:w(`size-3.5`,n&&`animate-spin`)}),r(`activity:techStack.scanThisProject`)]})]})})}function Ee(e){let t=new Map;for(let n of e)t.set(n,(t.get(n)??0)+1);return[...t.entries()].sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0]))}export{Q as TechStackView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Ga as n,Tn as r,Ua as i,Vt as a,dt as o,jt as s,lt as c,mn as l}from"./vendor-DZ9_OO6N.js";import"./i18n-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Ga as n,Tn as r,Ua as i,Vt as a,dt as o,jt as s,lt as c,mn as l}from"./vendor-DZ9_OO6N.js";import"./i18n-BeHaHx3x.js";import{t as u}from"./ws-client-DXT4gi-N.js";import{n as d,t as f}from"./utils-BecmXwgG.js";import{t as p}from"./session-store-CKpAwNIm.js";import{R as m}from"./stores-CHaV9Mb9.js";import{n as h}from"./ui-store-3HoYrTu5.js";import{n as g,t as _}from"./xterm-BWzBEEhg.js";var v=e(n(),1),y=`wrongstack.terminalDockHeight`;function b(e){let t=typeof window>`u`?640:Math.max(140,Math.min(640,Math.floor(window.innerHeight*.55),window.innerHeight-260));return Math.min(Math.max(Math.round(e),140),t)}var x=c(),S={background:`#1e1e2e`,foreground:`#cdd6f4`,cursor:`#f5e0dc`,selectionBackground:`#585b70`,black:`#45475a`,red:`#f38ba8`,green:`#a6e3a1`,yellow:`#f9e2af`,blue:`#89b4fa`,magenta:`#f5c2e7`,cyan:`#94e2d5`,white:`#bac2de`,brightBlack:`#585b70`,brightRed:`#f38ba8`,brightGreen:`#a6e3a1`,brightYellow:`#f9e2af`,brightBlue:`#89b4fa`,brightMagenta:`#f5c2e7`,brightCyan:`#94e2d5`,brightWhite:`#a6adc8`},C=8;function w(e=!1){return typeof window>`u`?300:b(window.innerHeight*(e?.32:.4))}function T(e=!1){if(typeof window>`u`)return w(e);try{let t=window.localStorage.getItem(y),n=t?Number.parseInt(t,10):NaN;return Number.isFinite(n)?b(n):w(e)}catch{return w(e)}}function E(e){try{window.localStorage.setItem(y,String(b(e)))}catch{}}function D(){return d()}function O(e){return{id:D(),name:`Terminal ${e}`,status:`starting`}}function k({desktopShell:e=!1,onClose:n}){let i=(0,v.useRef)(null),{t:c}=t(),u=(0,v.useRef)(1),[d,m]=(0,v.useState)(()=>T(e)),[g,_]=(0,v.useState)(()=>[O(1)]),[y,S]=(0,v.useState)(()=>g[0]?.id??``),w=h(e=>e.terminalCreateNonce),k=(0,v.useRef)(w),j=p(e=>e.projectName),M=p(e=>e.cwd);(0,v.useEffect)(()=>{let e=()=>{m(e=>{let t=b(e);return E(t),t})};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let N=e=>{e.preventDefault(),i.current?.();let t=e.clientY,n=d,r=document.body.style.cursor,a=document.body.style.userSelect;document.body.style.cursor=`ns-resize`,document.body.style.userSelect=`none`;let o=e=>{let r=b(n+t-e.clientY);m(r),E(r)},s=()=>{document.body.style.cursor=r,document.body.style.userSelect=a,window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,s),i.current===s&&(i.current=null)};i.current=s,window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s,{once:!0}),window.addEventListener(`pointercancel`,s,{once:!0})};(0,v.useEffect)(()=>()=>i.current?.(),[]);let P=()=>{_(e=>{if(e.length>=C)return e;u.current+=1;let t=O(u.current);return S(t.id),[...e,t]})};(0,v.useEffect)(()=>{w!==k.current&&(k.current=w,P())},[w]);let F=e=>{_(t=>{let r=t.findIndex(t=>t.id===e);if(r===-1)return t;let i=t.filter(t=>t.id!==e);return i.length===0?(queueMicrotask(n),i):(y===e&&S(i[Math.max(0,r-1)]?.id??i[0]?.id??``),i)})},I=e=>{let t=D();_(n=>{let r=!1,i=n.map(n=>n.id===e?(r=!0,{...n,id:t,status:`starting`,exitCode:void 0}):n);return r&&S(t),i})},L=()=>{_([]),S(``),queueMicrotask(n)},R=(e,t)=>{_(n=>n.map(n=>n.id===e?{...n,...t}:n))},z=g.find(e=>e.id===y)??g[0]??null;return(0,x.jsxs)(`div`,{"data-terminal-dock":!0,style:{height:d},"data-shell":e?`desktop`:`browser`,className:f(`z-30 flex min-h-0 shrink-0 flex-col border-t border-border/70 bg-card shadow-2xl`,e&&`ws-terminal-desktop`),children:[(0,x.jsx)(`hr`,{"aria-orientation":`horizontal`,tabIndex:0,title:c(`activity:terminal.resize`),onPointerDown:N,className:`h-1.5 cursor-ns-resize bg-muted/70 transition-colors hover:bg-primary/35 border-0`}),(0,x.jsxs)(`div`,{className:f(`flex min-w-0 items-center justify-between gap-3 border-b border-border/70 bg-card/85`,e?`px-2 py-1`:`px-3 py-1.5`),children:[(0,x.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-xs text-foreground`,children:[(0,x.jsx)(a,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,x.jsx)(`span`,{className:`font-medium`,children:c(e?`activity:terminal.labelSingular`:`activity:terminal.labelPlural`)}),(0,x.jsx)(`span`,{className:`min-w-0 truncate text-muted-foreground`,children:j||M||c(`activity:terminal.projectShell`)})]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,x.jsx)(`button`,{type:`button`,onClick:P,disabled:g.length>=C,title:g.length>=C?c(`activity:terminal.maxTerminals`,{count:C}):c(`activity:terminal.newTerminal`),className:`inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40`,children:(0,x.jsx)(r,{className:`h-4 w-4`})}),(0,x.jsx)(`button`,{type:`button`,onClick:()=>z&&I(z.id),disabled:!z,title:c(`activity:terminal.restart`),className:`inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40`,children:(0,x.jsx)(l,{className:`h-3.5 w-3.5`})}),(0,x.jsx)(`button`,{type:`button`,onClick:L,disabled:g.length===0,title:c(`activity:terminal.closeAll`),className:`inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40`,children:(0,x.jsx)(s,{className:`h-3.5 w-3.5`})}),(0,x.jsx)(`button`,{type:`button`,onClick:n,title:c(`activity:terminal.closeDock`),className:`inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,children:(0,x.jsx)(o,{className:`h-4 w-4`})})]})]}),(0,x.jsx)(`div`,{className:f(`flex min-w-0 items-center gap-1 overflow-x-auto border-b border-border/70 bg-[hsl(var(--surface-2)/0.45)]`,e?`px-1.5 py-0.5`:`px-2 py-1`),children:g.map(t=>(0,x.jsxs)(`div`,{className:f(`group inline-flex items-center rounded border text-xs transition-colors`,e?`h-6 min-w-[92px] max-w-[148px]`:`h-7 min-w-[112px] max-w-[180px]`,y===t.id?`border-primary/35 bg-primary/10 text-primary`:`border-transparent bg-transparent text-muted-foreground hover:bg-accent hover:text-foreground`),children:[(0,x.jsxs)(`button`,{type:`button`,onClick:()=>S(t.id),title:t.status===`exited`?`${t.name} exited`:t.name,className:`inline-flex min-w-0 flex-1 items-center gap-2 px-2 text-left`,children:[(0,x.jsx)(`span`,{className:f(`h-1.5 w-1.5 shrink-0 rounded-full`,t.status===`running`&&`bg-success`,t.status===`starting`&&`bg-primary`,t.status===`exited`&&`bg-destructive`)}),(0,x.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[t.name,t.status===`exited`&&typeof t.exitCode==`number`?` (${t.exitCode})`:``]})]}),(0,x.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),F(t.id)},className:`mr-1 inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground opacity-70 hover:bg-accent hover:text-foreground hover:opacity-100`,title:c(`activity:terminal.closeTab`,{name:t.name}),children:(0,x.jsx)(o,{className:`h-3 w-3`})})]},t.id))}),M&&!e&&(0,x.jsx)(`div`,{className:`min-w-0 truncate border-b border-border/60 bg-muted/30 px-3 py-1 text-[11px] font-mono text-muted-foreground`,children:M}),(0,x.jsx)(`div`,{className:`relative min-h-0 min-w-0 flex-1 overflow-hidden`,children:g.map(e=>(0,x.jsx)(A,{id:e.id,active:e.id===y,onRunning:()=>R(e.id,{status:`running`}),onExit:t=>R(e.id,{status:`exited`,exitCode:t})},e.id))})]})}function A({id:e,active:t,onRunning:n,onExit:r}){let a=(0,v.useRef)(null),o=(0,v.useRef)(null),s=(0,v.useRef)(null),c=(0,v.useRef)(n),l=(0,v.useRef)(r),d=m(e=>e.wsConnected);return(0,v.useEffect)(()=>{c.current=n,l.current=r},[r,n]),(0,v.useEffect)(()=>{let t=a.current;if(!t)return;let n=new _({fontFamily:`"IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace`,fontSize:13,cursorBlink:!0,theme:S,scrollback:5e3}),r=new g;o.current=n,s.current=r,n.loadAddon(r),n.open(t);try{r.fit()}catch{}let d=u(m.getState().wsUrl);d.send({type:`terminal.create`,payload:{id:e,cols:n.cols,rows:n.rows}});let f=!1,p=d.on(`terminal.output`,t=>{t.type===`terminal.output`&&t.payload.id===e&&(f||(f=!0,c.current()),n.write(t.payload.data))}),h=d.on(`terminal.exit`,t=>{t.type===`terminal.exit`&&t.payload.id===e&&(n.write(`\r\n\x1b[2m${i.t(`activity:terminal.processExited`,{code:t.payload.exitCode})}\x1b[0m\r\n`),l.current(t.payload.exitCode))}),v=n.onData(t=>{d.send({type:`terminal.input`,payload:{id:e,data:t}})}),y=new ResizeObserver(()=>{if(t.offsetParent)try{r.fit(),d.send({type:`terminal.resize`,payload:{id:e,cols:n.cols,rows:n.rows}})}catch{}});return y.observe(t),()=>{p(),h(),v.dispose(),y.disconnect(),d.send({type:`terminal.close`,payload:{id:e}}),n.dispose(),o.current=null,s.current=null}},[e,d]),(0,v.useEffect)(()=>{t&&window.requestAnimationFrame(()=>{try{s.current?.fit();let t=o.current;t&&(u(m.getState().wsUrl).send({type:`terminal.resize`,payload:{id:e,cols:t.cols,rows:t.rows}}),t.focus())}catch{}})},[t,e]),(0,x.jsx)(`div`,{ref:a,className:f(`absolute inset-0 min-h-0 min-w-0 overflow-hidden px-2 py-1`,t?`block`:`hidden`)})}export{k as TerminalPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Ga as n,Ji as r,Ot as i,Sr as a,Ua as o,dt as s,lt as c,za as l,zi as u}from"./vendor-DZ9_OO6N.js";import"./i18n-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Ga as n,Ji as r,Ot as i,Sr as a,Ua as o,dt as s,lt as c,za as l,zi as u}from"./vendor-DZ9_OO6N.js";import"./i18n-BeHaHx3x.js";import{n as d,t as f}from"./utils-BecmXwgG.js";var p=e(n(),1),m=c();function h(){return`toast_${d()}`}var g=8e3,_=l(e=>({toasts:[],push:t=>{let n=h();return e(e=>({toasts:[...e.toasts,{...t,id:n}]})),n},dismiss:t=>e(e=>({toasts:e.toasts.filter(e=>e.id!==t)}))})),v={success:(e,t=3500)=>_.getState().push({message:e,variant:`success`,ttl:t}),error:(e,t=6e3)=>_.getState().push({message:e,variant:`error`,ttl:t}),warn:(e,t=4500)=>_.getState().push({message:e,variant:`warn`,ttl:t}),info:(e,t=3500)=>_.getState().push({message:e,variant:`info`,ttl:t}),undoable:(e,t,n=o.t(`common:action.undo`),r=g)=>_.getState().push({message:e,variant:`info`,ttl:r,action:{label:n,onClick:t}}),dismiss:e=>_.getState().dismiss(e)};function y({variant:e}){return e===`success`?(0,m.jsx)(r,{className:`h-4 w-4 text-success`}):e===`error`?(0,m.jsx)(u,{className:`h-4 w-4 text-destructive`}):e===`warn`?(0,m.jsx)(i,{className:`h-4 w-4 text-warning`}):(0,m.jsx)(a,{className:`h-4 w-4 text-info`})}function b({entry:e}){let{t:n}=t(),r=_(e=>e.dismiss);return(0,p.useEffect)(()=>{let t=setTimeout(()=>r(e.id),e.ttl);return()=>clearTimeout(t)},[e.id,e.ttl,r]),(0,m.jsxs)(`div`,{className:f(`flex items-start gap-2 rounded-lg border bg-popover shadow-lg px-3 py-2 text-sm max-w-sm`,`animate-message`,e.variant===`error`&&`border-destructive/40`,e.variant===`warn`&&`border-warning/40`,e.variant===`success`&&`border-success/40`),children:[(0,m.jsx)(y,{variant:e.variant}),(0,m.jsx)(`div`,{className:`flex-1 min-w-0 whitespace-pre-wrap break-words leading-snug`,children:e.message}),e.action&&(0,m.jsx)(`button`,{type:`button`,onClick:()=>{e.action?.onClick(),r(e.id)},className:`shrink-0 font-medium text-primary hover:underline`,children:e.action.label}),(0,m.jsx)(`button`,{type:`button`,onClick:()=>r(e.id),className:`text-muted-foreground hover:text-foreground`,title:n(`activity:toast.dismiss`),"aria-label":n(`activity:toast.dismiss`),children:(0,m.jsx)(s,{className:`h-3.5 w-3.5`})})]})}function x(){let{t:e}=t(),n=_(e=>e.toasts);return n.length===0?null:(0,m.jsx)(`section`,{className:`fixed bottom-4 right-4 z-[60] flex flex-col gap-2 pointer-events-auto`,"aria-label":e(`activity:toaster.notifications`),"aria-live":`polite`,children:n.map(e=>(0,m.jsx)(b,{entry:e},e.id))})}export{v as n,x as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/activity-COQ9xSFu.js","assets/rolldown-runtime-hePW80VL.js","assets/chat-CzaGXz_W.js","assets/commandPalette-BovBiPec.js","assets/common-BBHmIHQW.js","assets/settings-C9FOpDBt.js","assets/setup-DfcCCvUO.js","assets/toasts-DOfXc7Rt.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{Ha as e,Ra as t,Ua as n,Va as r,za as i}from"./vendor-DZ9_OO6N.js";import{t as a}from"./activity-COQ9xSFu.js";import{t as o}from"./chat-CzaGXz_W.js";import{t as s}from"./commandPalette-BovBiPec.js";import{t as c}from"./common-BBHmIHQW.js";import{t as l}from"./settings-C9FOpDBt.js";import{t as u}from"./setup-DfcCCvUO.js";import{t as d}from"./toasts-DOfXc7Rt.js";import{s as f}from"./monaco-BCqJp2xW.js";var p=(e,t,n)=>{let r=t.lastIndexOf(`?`),i=e[r===-1||r<t.lastIndexOf(`/`)?t:t.slice(0,r)];return i?typeof i==`function`?i():Promise.resolve(i):new Promise((e,r)=>{(typeof queueMicrotask==`function`?queueMicrotask:setTimeout)(r.bind(null,Error(`Unknown variable dynamic import: `+t+(t.split(`/`).length===n?``:`. Note that variables only represent file names one level deep.`))))})},m=[`en`,`tr`,`de`,`fr`,`it`,`es`,`pt-BR`],h=[{code:`en`,name:`English`},{code:`tr`,name:`Türkçe`},{code:`de`,name:`Deutsch`},{code:`fr`,name:`Français`},{code:`it`,name:`Italiano`},{code:`es`,name:`Español`},{code:`pt-BR`,name:`Português (Brasil)`}],g=new Set(m);function _(){return typeof navigator>`u`||!navigator.language?`en`:y(navigator.language)}function v(e){return!e||typeof e!=`string`?_():y(e)}function y(e){let t=e.trim().toLowerCase();if(!t)return`en`;if(g.has(t))return t;let n=t.split(`-`)[0];return n&&g.has(n)?n:n===`pt`?`pt-BR`:`en`}var b={autonomy:`auto`,autonomyDelayMs:45e3,autoProceedMaxIterations:50,yolo:!0,maxIterations:500,chime:!1,confirmExit:!0,fleetChatVerbosity:`off`,nextPrediction:!1,nextStepsTool:!1,fallbackModels:[],fallbackProfiles:{},favoriteModels:[],favoriteModelsOnly:!1,modelMatrix:{},fallbackAuto:!0,modelAvailabilitySchedule:[],featureMcp:!0,featurePlugins:!0,featureMemory:!0,featureSkills:!0,featureModelsRegistry:!0,indexOnStart:!0,contextAutoCompact:!0,contextStrategy:`hybrid`,contextMode:`balanced`,tokenSavingTier:`auto`,maxConcurrent:10,titleAnimation:!0,logLevel:`info`,auditLevel:`standard`,enhanceEnabled:!0,enhanceDelayMs:6e4,enhanceCountdownMs:3e3,enhanceLanguage:`original`,refinerProvider:``,refinerModel:``,refinerFallbackProfile:``,thinkingWord:`thinking`,statuslineMode:`minimum`,animationStyle:`rainbow`,showThinkingLogs:!0,groupToolCalls:!0,autoCollapseInput:!1,showModelReasoning:!0,showAgentSwarmPanel:`bottom`,allowOutsideProjectRoot:!0,reasoningMode:`auto`,reasoningEffort:`high`,reasoningPreserve:!1,cacheTtl:`default`,breakerEnabled:!1,breakerAutoKillResetMs:6e4,fsAccess:`unrestricted`,debugStream:!1,hqEnabled:!1,hqUrl:``,hqToken:``,hqRawContent:!1,tgConfigured:!1,tgSessionEnd:!1,tgDelegate:!0,tgLongToolMs:3e4,uiLocale:_(),chimeraAutoFix:`off`,readSymbols:!1,showSageMemoryInject:!1,sageMemoryInjectThreshold:.85,preRefineSeconds:3,multiDiffSummaryThreshold:5,chimeraEnabled:!0,chimeraProvider:``,chimeraModel:``,chimeraMaxFiles:15,autoReviewEnabled:!1,autoReviewProvider:``,autoReviewModel:``,autoReviewFallbackProfile:``,autoReviewModelSelection:`round-robin`,autoReviewFallbackModels:[],autoReviewDebounceMs:15e3,autoReviewMaxFilesPerBatch:15,autoReviewMaxConcurrentReviews:2,autoReviewCascadeOn:`off`,pluginsEnabled:{},wrongProxyEnabled:!1,wrongProxyUrl:`http://localhost:3444`},x=i()(t(e=>({...b,set:t=>e(t),reset:()=>e(b)}),{name:`wrongstack-local-prefs`,version:16,migrate:(e,t)=>{let n=e??{};return t<12&&n.autoReviewDebounceMs===5e3&&(n.autoReviewDebounceMs=15e3),typeof n.fleetChatVerbosity!=`string`&&(n.fleetChatVerbosity=n.streamFleet===!0?`full`:(n.streamFleet,`off`),delete n.streamFleet),n.fleetChatVerbosity!==`off`&&n.fleetChatVerbosity!==`full`&&(n.fleetChatVerbosity=`off`),[`hybrid`,`intelligent`,`selective`].includes(n.contextStrategy)||(n.contextStrategy=`hybrid`),n.auditLevel===`verbose`&&(n.auditLevel=`full`),[`minimal`,`standard`,`full`].includes(n.auditLevel)||(n.auditLevel=`standard`),typeof n.autoProceedMaxIterations!=`number`&&(n.autoProceedMaxIterations=50),(!n.fallbackProfiles||typeof n.fallbackProfiles!=`object`||Array.isArray(n.fallbackProfiles))&&(n.fallbackProfiles={}),Array.isArray(n.favoriteModels)||(n.favoriteModels=[]),typeof n.favoriteModelsOnly!=`boolean`&&(n.favoriteModelsOnly=!1),Array.isArray(n.modelAvailabilitySchedule)||(n.modelAvailabilitySchedule=[]),(!n.modelMatrix||typeof n.modelMatrix!=`object`||Array.isArray(n.modelMatrix))&&(n.modelMatrix={}),(typeof n.uiLocale!=`string`||!n.uiLocale)&&(n.uiLocale=_()),typeof n.breakerEnabled!=`boolean`&&(n.breakerEnabled=!1),typeof n.breakerAutoKillResetMs!=`number`&&(n.breakerAutoKillResetMs=6e4),n.fsAccess!==`unrestricted`&&n.fsAccess!==`project`&&(n.fsAccess=`unrestricted`),typeof n.debugStream!=`boolean`&&(n.debugStream=!1),typeof n.wrongProxyEnabled!=`boolean`&&(n.wrongProxyEnabled=!1),(typeof n.wrongProxyUrl!=`string`||n.wrongProxyUrl.trim().length===0)&&(n.wrongProxyUrl=`http://localhost:3444`),typeof n.chimeraEnabled!=`boolean`&&(n.chimeraEnabled=!0),typeof n.chimeraProvider!=`string`&&(n.chimeraProvider=``),typeof n.chimeraModel!=`string`&&(n.chimeraModel=``),n.chimeraAutoFix!==`off`&&n.chimeraAutoFix!==`ask`&&n.chimeraAutoFix!==`auto`&&(n.chimeraAutoFix=`off`),(typeof n.chimeraMaxFiles!=`number`||!Number.isFinite(n.chimeraMaxFiles)||n.chimeraMaxFiles<1)&&(n.chimeraMaxFiles=15),typeof n.autoReviewEnabled!=`boolean`&&(n.autoReviewEnabled=!1),typeof n.autoReviewProvider!=`string`&&(n.autoReviewProvider=``),typeof n.autoReviewModel!=`string`&&(n.autoReviewModel=``),typeof n.autoReviewFallbackProfile!=`string`&&(n.autoReviewFallbackProfile=``),n.autoReviewModelSelection!==`round-robin`&&n.autoReviewModelSelection!==`random`&&(n.autoReviewModelSelection=`round-robin`),Array.isArray(n.autoReviewFallbackModels)||(n.autoReviewFallbackModels=[]),(typeof n.autoReviewDebounceMs!=`number`||!Number.isFinite(n.autoReviewDebounceMs)||n.autoReviewDebounceMs<0)&&(n.autoReviewDebounceMs=15e3),(typeof n.autoReviewMaxFilesPerBatch!=`number`||!Number.isFinite(n.autoReviewMaxFilesPerBatch)||n.autoReviewMaxFilesPerBatch<1)&&(n.autoReviewMaxFilesPerBatch=15),(typeof n.autoReviewMaxConcurrentReviews!=`number`||!Number.isFinite(n.autoReviewMaxConcurrentReviews)||n.autoReviewMaxConcurrentReviews<1)&&(n.autoReviewMaxConcurrentReviews=2),n.autoReviewCascadeOn!==`off`&&n.autoReviewCascadeOn!==`critical`&&n.autoReviewCascadeOn!==`high`&&(n.autoReviewCascadeOn=`off`),typeof n.showModelReasoning!=`boolean`&&(n.showModelReasoning=!0),typeof n.autoCollapseInput!=`boolean`&&(n.autoCollapseInput=!1),typeof n.showAgentSwarmPanel==`boolean`?n.showAgentSwarmPanel=n.showAgentSwarmPanel?`bottom`:`off`:(typeof n.showAgentSwarmPanel!=`string`||![`bottom`,`sidebar`,`off`].includes(n.showAgentSwarmPanel))&&(n.showAgentSwarmPanel=`bottom`),typeof n.allowOutsideProjectRoot!=`boolean`&&(n.allowOutsideProjectRoot=!0),typeof n.readSymbols!=`boolean`&&(n.readSymbols=!1),typeof n.showSageMemoryInject!=`boolean`&&(n.showSageMemoryInject=!1),(typeof n.sageMemoryInjectThreshold!=`number`||!Number.isFinite(n.sageMemoryInjectThreshold)||n.sageMemoryInjectThreshold<0||n.sageMemoryInjectThreshold>1)&&(n.sageMemoryInjectThreshold=.85),(typeof n.preRefineSeconds!=`number`||!Number.isFinite(n.preRefineSeconds)||n.preRefineSeconds<0)&&(n.preRefineSeconds=3),(typeof n.multiDiffSummaryThreshold!=`number`||!Number.isFinite(n.multiDiffSummaryThreshold)||n.multiDiffSummaryThreshold<0)&&(n.multiDiffSummaryThreshold=5),n},partialize:e=>{let{hqToken:t,...n}=e;return n},merge:(e,t)=>{let{hqToken:n,...r}=e??{};return{...t,...r,hqToken:``}}})),S=[`common`,`activity`,`chat`,`commandPalette`,`settings`,`setup`,`toasts`];function C(){try{return v(x.getState().uiLocale)}catch{return`en`}}n.use(r).use(e((e,t)=>p(Object.assign({"./locales/de/activity.json":()=>f(()=>import(`./activity-D3ZccGOh.js`),[]),"./locales/de/chat.json":()=>f(()=>import(`./chat-BnkVCZ3Q.js`),[]),"./locales/de/commandPalette.json":()=>f(()=>import(`./commandPalette-aaAou3Tl.js`),[]),"./locales/de/common.json":()=>f(()=>import(`./common-C3PzxyXg.js`),[]),"./locales/de/settings.json":()=>f(()=>import(`./settings-BNbqEBSr.js`),[]),"./locales/de/setup.json":()=>f(()=>import(`./setup-DD8rKpQU.js`),[]),"./locales/de/toasts.json":()=>f(()=>import(`./toasts-CFzweRH5.js`),[]),"./locales/en/activity.json":()=>f(()=>import(`./activity-COQ9xSFu.js`).then(e=>e.n),__vite__mapDeps([0,1])),"./locales/en/chat.json":()=>f(()=>import(`./chat-CzaGXz_W.js`).then(e=>e.n),__vite__mapDeps([2,1])),"./locales/en/commandPalette.json":()=>f(()=>import(`./commandPalette-BovBiPec.js`).then(e=>e.n),__vite__mapDeps([3,1])),"./locales/en/common.json":()=>f(()=>import(`./common-BBHmIHQW.js`).then(e=>e.n),__vite__mapDeps([4,1])),"./locales/en/settings.json":()=>f(()=>import(`./settings-C9FOpDBt.js`).then(e=>e.n),__vite__mapDeps([5,1])),"./locales/en/setup.json":()=>f(()=>import(`./setup-DfcCCvUO.js`).then(e=>e.n),__vite__mapDeps([6,1])),"./locales/en/toasts.json":()=>f(()=>import(`./toasts-DOfXc7Rt.js`).then(e=>e.n),__vite__mapDeps([7,1])),"./locales/es/activity.json":()=>f(()=>import(`./activity-YMES6OPI.js`),[]),"./locales/es/chat.json":()=>f(()=>import(`./chat-BPuAsrkF.js`),[]),"./locales/es/commandPalette.json":()=>f(()=>import(`./commandPalette-Nlxs0V7J.js`),[]),"./locales/es/common.json":()=>f(()=>import(`./common-CUWL8eNX.js`),[]),"./locales/es/settings.json":()=>f(()=>import(`./settings-C3bNf1Bx.js`),[]),"./locales/es/setup.json":()=>f(()=>import(`./setup-COxU-AT_.js`),[]),"./locales/es/toasts.json":()=>f(()=>import(`./toasts-BwQJwYLe.js`),[]),"./locales/fr/activity.json":()=>f(()=>import(`./activity-zlMMaNE1.js`),[]),"./locales/fr/chat.json":()=>f(()=>import(`./chat-BfQBSiII.js`),[]),"./locales/fr/commandPalette.json":()=>f(()=>import(`./commandPalette-Dfk74u87.js`),[]),"./locales/fr/common.json":()=>f(()=>import(`./common-xPePelft.js`),[]),"./locales/fr/settings.json":()=>f(()=>import(`./settings-oeXlO4HA.js`),[]),"./locales/fr/setup.json":()=>f(()=>import(`./setup-CMteRkTs.js`),[]),"./locales/fr/toasts.json":()=>f(()=>import(`./toasts-BCDGDcyq.js`),[]),"./locales/it/activity.json":()=>f(()=>import(`./activity-BA8C9ueU.js`),[]),"./locales/it/chat.json":()=>f(()=>import(`./chat-CR2B97dj.js`),[]),"./locales/it/commandPalette.json":()=>f(()=>import(`./commandPalette-CUh_kgfp.js`),[]),"./locales/it/common.json":()=>f(()=>import(`./common-DuR5FTPN.js`),[]),"./locales/it/settings.json":()=>f(()=>import(`./settings-C3OnmFrY.js`),[]),"./locales/it/setup.json":()=>f(()=>import(`./setup-pPW1kVR_.js`),[]),"./locales/it/toasts.json":()=>f(()=>import(`./toasts-Dm12Nq8t.js`),[]),"./locales/pt-BR/activity.json":()=>f(()=>import(`./activity-CuJqhGz7.js`),[]),"./locales/pt-BR/chat.json":()=>f(()=>import(`./chat-DResBrkV.js`),[]),"./locales/pt-BR/commandPalette.json":()=>f(()=>import(`./commandPalette-tFxIIhvU.js`),[]),"./locales/pt-BR/common.json":()=>f(()=>import(`./common-CvSB5NM3.js`),[]),"./locales/pt-BR/settings.json":()=>f(()=>import(`./settings-BsZgLIo2.js`),[]),"./locales/pt-BR/setup.json":()=>f(()=>import(`./setup-BOYK0I6-.js`),[]),"./locales/pt-BR/toasts.json":()=>f(()=>import(`./toasts-frBt6fvE.js`),[]),"./locales/tr/activity.json":()=>f(()=>import(`./activity-BYnOci5N.js`),[]),"./locales/tr/chat.json":()=>f(()=>import(`./chat-Di8o0wDz.js`),[]),"./locales/tr/commandPalette.json":()=>f(()=>import(`./commandPalette-CGMq-qlP.js`),[]),"./locales/tr/common.json":()=>f(()=>import(`./common-DT2FL9xN.js`),[]),"./locales/tr/settings.json":()=>f(()=>import(`./settings-BV1_j8_-.js`),[]),"./locales/tr/setup.json":()=>f(()=>import(`./setup-Bd23KLtt.js`),[]),"./locales/tr/toasts.json":()=>f(()=>import(`./toasts-DDYQsJV8.js`),[])}),`./locales/${e}/${t}.json`,4))).init({lng:C(),fallbackLng:`en`,supportedLngs:[...m],ns:[...S],defaultNS:`common`,partialBundledLanguages:!0,resources:{en:{common:c,activity:a,chat:o,commandPalette:s,settings:l,setup:u,toasts:d}},interpolation:{escapeValue:!1},react:{useSuspense:!1},returnNull:!1});function w(e){typeof document<`u`&&(document.documentElement.lang=e)}w(n.language||`en`),x.subscribe((e,t)=>{let r=e.uiLocale;r&&r!==t.uiLocale&&r!==n.language&&n.changeLanguage(r).then(()=>w(r))});function T(){window.wrongstackDesktopHost?.onLocaleChanged?.(e=>{if(!e)return;let t=v(e);if(t===n.language)return;let r=x.getState();r.uiLocale!==t&&r.set({uiLocale:t}),n.changeLanguage(t).then(()=>w(t))})}try{T()}catch{}export{h as n,x as t};
|