@wrongstack/webui 0.308.1 → 0.308.2
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-BTbwL6nH.js → AgentRosterView-BRsiLkYT.js} +1 -1
- package/dist/assets/{AnalyticsDashboard-ETUD_m7R.js → AnalyticsDashboard-wgm1_jI-.js} +1 -1
- package/dist/assets/{AudienceMemoryPanel-BosVQjIW.js → AudienceMemoryPanel-Dj2zRV6l.js} +1 -1
- package/dist/assets/{ChangesView-DQK4FtLh.js → ChangesView-Cc7SriFS.js} +1 -1
- package/dist/assets/{ChronicleDashboard-By8HsUSe.js → ChronicleDashboard-CyqJjnDP.js} +1 -1
- package/dist/assets/{CodeEditor-CbdYsnzn.js → CodeEditor-CrQxq-34.js} +1 -1
- package/dist/assets/{CodeMap-BXgrpv5t.js → CodeMap-CAhE44jp.js} +1 -1
- package/dist/assets/{ConfirmModal-lPWvstcy.js → ConfirmModal-gREeWWsa.js} +1 -1
- package/dist/assets/{CronJobsPanel-CScZrguV.js → CronJobsPanel-D6AfSxD8.js} +1 -1
- package/dist/assets/{DeadCodeScanPanel-DYJRfj4d.js → DeadCodeScanPanel-LOzt0Z1Z.js} +1 -1
- package/dist/assets/{DebugDashboard-b9gkedN0.js → DebugDashboard-CNdS9FFO.js} +1 -1
- package/dist/assets/{DesignGalleryView-Bxqluim4.js → DesignGalleryView-CDDM4pDl.js} +1 -1
- package/dist/assets/{GoalView-CD0amyz6.js → GoalView-mzLqil_K.js} +1 -1
- package/dist/assets/{KanbanView-D2ZkvBAt.js → KanbanView-Dlsji4r2.js} +1 -1
- package/dist/assets/{MailboxDetailView-DvZk7zUu.js → MailboxDetailView-Cxx74zQn.js} +1 -1
- package/dist/assets/{MemoryDrawer-Bx3dEdNU.js → MemoryDrawer-BnT2jWmE.js} +1 -1
- package/dist/assets/{MemoryManager-CN4Hywz0.js → MemoryManager-DlVmZ-0S.js} +1 -1
- package/dist/assets/{ModelPicker-CBOKANNP.js → ModelPicker-CsaLCgdi.js} +1 -1
- package/dist/assets/{OfficeMapPanel-bpCNnMzk.js → OfficeMapPanel-B_95mXEy.js} +1 -1
- package/dist/assets/{ProcessMonitor-BDV0vAQh.js → ProcessMonitor-Dmmbx4lh.js} +1 -1
- package/dist/assets/{PromptJournalView-Bb5ot9Ty.js → PromptJournalView-DBCw7oeQ.js} +1 -1
- package/dist/assets/{QueuePanel-w5a4slQa.js → QueuePanel-CKAGgWxS.js} +1 -1
- package/dist/assets/{RefreshDebugView-DUleI5Wz.js → RefreshDebugView-CKPQ_tKX.js} +1 -1
- package/dist/assets/{RequirementIntakeView-BxY6z83Q.js → RequirementIntakeView-B5JKkW9E.js} +1 -1
- package/dist/assets/{SageTabs-CimVRiPq.js → SageTabs-D04tfLki.js} +2 -2
- package/dist/assets/{SddFlowGraph-CwrPsUbP.js → SddFlowGraph-BCgIDw11.js} +1 -1
- package/dist/assets/{SddHub-DMCa8gys.js → SddHub-CkH8Kv7V.js} +1 -1
- package/dist/assets/{SessionInspectView-CccHo_-4.js → SessionInspectView-PA6jl9bt.js} +1 -1
- package/dist/assets/{SessionList-CXzEUHkx.js → SessionList-vOuy4gzk.js} +1 -1
- package/dist/assets/{SessionsDashboard-DZp3WVEz.js → SessionsDashboard-DXt34ZON.js} +1 -1
- package/dist/assets/{SetupScreen-Bo_XAjrP.js → SetupScreen-Cm50YBwk.js} +1 -1
- package/dist/assets/{SkillDetailView-DVAlzbDj.js → SkillDetailView-BBu6DBBh.js} +1 -1
- package/dist/assets/{SpecsView-CctUPWlo.js → SpecsView-DeHi6LWP.js} +1 -1
- package/dist/assets/{TechStackView-DlWg2aCJ.js → TechStackView-cARkf3Ep.js} +1 -1
- package/dist/assets/{TerminalPanel-Yb-lQFDz.js → TerminalPanel-HWOYFCGa.js} +1 -1
- package/dist/assets/{Toaster-BB1yPhku.js → Toaster-CQLQAp7y.js} +1 -1
- package/dist/assets/{i18n-DxZ0s97D.js → i18n-CcHSmDoO.js} +2 -2
- package/dist/assets/{index-CWC2RBlq.js → index-Bj3blCRO.js} +6 -6
- package/dist/assets/{roster-ws-C_u0NB5k.js → roster-ws-XgkT9mo8.js} +1 -1
- package/dist/assets/settings-50uwXQIW.js +1 -0
- package/dist/assets/settings-BPT8LWkU.js +1 -0
- package/dist/assets/settings-BmJI-gam.js +1 -0
- package/dist/assets/settings-CqFe8Jtz.js +1 -0
- package/dist/assets/settings-DeM0wvCG.js +1 -0
- package/dist/assets/settings-DijFr-kZ.js +1 -0
- package/dist/assets/settings-L9mLQIIP.js +1 -0
- package/dist/assets/{stores-JAIPqBZz.js → stores-kaIFQfXo.js} +1 -1
- package/dist/assets/{useWebSocket-BepkW6iB.js → useWebSocket-DjrFK4tQ.js} +1 -1
- package/dist/assets/ws-client-BVq0hf0a.js +1 -0
- package/dist/index.html +9 -9
- package/dist/index.js +246 -149
- package/dist/lib/ws-client-utils.d.ts +7 -6
- package/dist/types/connections.d.ts +10 -0
- package/dist/types/server-message.d.ts +4 -1
- package/package.json +8 -8
- package/dist/assets/settings-CcZ8Byag.js +0 -1
- package/dist/assets/settings-DmEF3l3H.js +0 -1
- package/dist/assets/settings-Evj_2PTQ.js +0 -1
- package/dist/assets/settings-ZtdXzV5f.js +0 -1
- package/dist/assets/settings-fv8qo7sz.js +0 -1
- package/dist/assets/settings-xB2OG18R.js +0 -1
- package/dist/assets/settings-xIdfpBZZ.js +0 -1
- package/dist/assets/ws-client-BWKbZ1w0.js +0 -1
|
@@ -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,ea as l,en as u,jr as d,lt as f,ma as p,mi as m,na as h,or as g,qt as _,ra as v,t as y,wa as b,xr as x,yn as S}from"./vendor-C_zEzV4N.js";import"./i18n-DxZ0s97D.js";import{t as ee}from"./useWebSocket-BepkW6iB.js";import{t as C}from"./ws-client-BWKbZ1w0.js";import{t as w}from"./utils-tsZEnrBH.js";import{I as te}from"./stores-JAIPqBZz.js";import{o as T}from"./view-navigation-CZKugncK.js";import{n as E}from"./Toaster-BB1yPhku.js";import{a as D,n as ne,o as re,r as O,t as k}from"./dialog-BJjDUqb3.js";import{t as A}from"./button-DvpRpKkt.js";import{t as j}from"./input-BtoHcCl9.js";import{D as M,a as N,b as P,i as F,r as I,t as L,x as R}from"./index-CWC2RBlq.js";var z=e(r(),1);function B(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 V=f();function ie({onKeySaved:e}){let{t:n}=t(),[r,i]=(0,z.useState)(!1),[a,s]=(0,z.useState)(``),[c,u]=(0,z.useState)(`openai-compatible`),[d,f]=(0,z.useState)(``),[p,m]=(0,z.useState)(``),[h,_]=(0,z.useState)(!1),[v,y]=(0,z.useState)([]),{setFieldRef:b,handleKeyDown:x}=N(),S=async()=>{if(a.trim()){_(!0);try{let t=C(te.getState().wsUrl),r=B(t);t.send({type:`provider.add`,payload:{id:a.trim(),family:c,baseUrl:d.trim()||void 0,apiKey:p.trim()||void 0,models:v.length>0?v.map(e=>e.id):void 0,customModels:v.length>0?Object.fromEntries(v.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);E.success(n(`setup:screen.toasts.providerAdded`,{id:a.trim()})),e(a.trim()),t.listSavedProviders(),t.probeProvider(a.trim()),s(``),f(``),m(``),y([]),i(!1)}catch(e){let t=e instanceof Error&&e.message&&e.message!==`timeout`?e.message:null;E.error(t??n(`setup:screen.toasts.providerAddFailed`))}finally{_(!1)}}};return(0,V.jsxs)(`div`,{className:`rounded-xl border border-dashed border-border/60 overflow-hidden`,children:[(0,V.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,V.jsx)(`div`,{className:`w-10 h-10 rounded-lg bg-muted/50 flex items-center justify-center`,children:(0,V.jsx)(o,{className:`h-5 w-5 text-muted-foreground`})}),(0,V.jsxs)(`div`,{className:`flex-1`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-medium`,children:n(`setup:screen.custom.title`)}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`setup:screen.custom.description`)})]}),(0,V.jsx)(l,{className:w(`h-4 w-4 text-muted-foreground transition-transform`,r&&`rotate-90`)})]}),r&&(0,V.jsxs)(`div`,{className:`px-4 pb-4 space-y-3 border-t border-border/40`,children:[(0,V.jsxs)(`div`,{className:`space-y-1.5 pt-3`,children:[(0,V.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground block`,children:n(`setup:screen.custom.localServers`)}),(0,V.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:I.map(e=>(0,V.jsx)(A,{type:`button`,size:`sm`,variant:a===e.id?`default`:`outline`,onClick:()=>{s(e.id),u(`openai-compatible`),f(e.defaultBaseUrl),e.noAuth&&m(``),y([])},title:e.hint,children:e.label},e.id))})]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:n(`setup:screen.custom.providerId`)}),(0,V.jsx)(j,{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,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:n(`setup:screen.custom.family`)}),(0,V.jsxs)(`select`,{value:c,onChange:e=>u(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,V.jsx)(`option`,{value:`openai-compatible`,children:n(`setup:screen.custom.familyOpenAiCompatible`)}),(0,V.jsx)(`option`,{value:`openai`,children:`OpenAI`}),(0,V.jsx)(`option`,{value:`anthropic`,children:`Anthropic`}),(0,V.jsx)(`option`,{value:`google`,children:`Google`})]})]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:n(`setup:screen.custom.baseUrl`)}),(0,V.jsx)(j,{placeholder:n(`activity:customProviderSection.eGHttpLocalhost11434V1`),value:d,onChange:e=>f(e.target.value),className:`text-sm font-mono`,ref:b(2),onKeyDown:e=>x(e,2)})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:n(`setup:screen.custom.apiKey`)}),(0,V.jsx)(j,{type:`password`,placeholder:n(`setup:screen.custom.apiKeyPlaceholder`),value:p,onChange:e=>m(e.target.value),className:`text-sm font-mono`,ref:b(3),onKeyDown:e=>x(e,3)})]}),(0,V.jsx)(L,{models:v,onChange:y}),(0,V.jsxs)(A,{onClick:S,disabled:!a.trim()||h,size:`sm`,ref:b(4),onKeyDown:e=>x(e,4,S),children:[h?(0,V.jsx)(g,{className:`h-4 w-4 animate-spin mr-2`}):null,n(`setup:screen.custom.add`)]})]})]})}var H=F();async function ae(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:H}catch{return H}}function oe(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 se=e(y(),1);function ce({popular:e,catalogProvider:r,savedProvider:i,onKeySaved:o,probeResult:s}){let{t:c}=t(),[d,f]=(0,z.useState)(``),[p,_]=(0,z.useState)(!1),[y,b]=(0,z.useState)(!!i?.apiKeys.some(e=>e.isActive)),[x,S]=(0,z.useState)(!1),[ee,T]=(0,z.useState)(!1),[M,N]=(0,z.useState)(!1),[P,F]=(0,z.useState)(null);(0,z.useEffect)(()=>{M&&e.referral&&se.toDataURL(e.referral.url,{width:200,margin:2,color:{dark:`#000000`,light:`#ffffff`}}).then(e=>F(e)).catch(()=>F(null))},[M,e.referral]);let I=async()=>{if(d.trim()){_(!0);try{let t=C(te.getState().wsUrl),n=B(t);r?t.addKey(e.id,`default`,d.trim()):t.send({type:`provider.add`,payload:{id:e.id,family:e.family,apiKey:d.trim()}});let i=await n;if(!i.success)throw Error(i.message);b(!0),f(``),E.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;E.error(n??c(`setup:screen.toasts.keySaveFailed`,{name:e.name}))}finally{_(!1)}}},L=e=>{e.key===`Enter`&&d.trim()&&I()},R=async()=>{if(e.referral)try{await navigator.clipboard.writeText(e.referral.url),T(!0),E.success(c(`setup:screen.toasts.referralCopied`)),setTimeout(()=>T(!1),2e3)}catch{E.error(c(`setup:screen.toasts.referralCopyFailed`))}},ie=r&&r.modelCount>0;return(0,V.jsxs)(`div`,{className:w(`rounded-xl border p-4 transition-all`,y?`border-success/30 bg-success/5`:`bg-gradient-to-br ${e.color}`),children:[(0,V.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,V.jsx)(`span`,{className:`text-2xl shrink-0 mt-0.5`,children:e.icon}),(0,V.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-semibold`,children:e.name}),y&&(0,V.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,V.jsx)(v,{className:`h-2.5 w-2.5`}),c(`setup:screen.card.keySaved`)]}),e.referral&&!y&&(0,V.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,V.jsx)(n,{className:`h-2.5 w-2.5`}),c(`setup:screen.card.referral`)]})]}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e.description}),e.referral&&!y&&(0,V.jsxs)(`p`,{className:`text-[11px] text-warning/80 mt-1`,children:[`🎁 `,e.referral.reward]}),y?y?(0,V.jsxs)(`div`,{className:`mt-3 space-y-1`,children:[i?.baseUrl&&(0,V.jsxs)(`div`,{className:`text-[11px] text-muted-foreground/70 font-mono truncate`,title:i.baseUrl,children:[(0,V.jsxs)(`span`,{className:`text-muted-foreground/50`,children:[c(`activity:providerKey.url`),` `]}),i.baseUrl]}),i?.models&&i.models.length>0&&(0,V.jsxs)(`div`,{className:`text-[11px] text-muted-foreground/70`,children:[(0,V.jsxs)(`span`,{className:`text-muted-foreground/50`,children:[c(`activity:providerKey.models`),` `]}),i.pickedModelId??i.models[0],(0,V.jsxs)(`span`,{className:`text-muted-foreground/50`,children:[` (+`,i.models.length-1,` more)`]})]}),s===`probing`?(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-muted-foreground mt-1`,children:[(0,V.jsx)(g,{className:`h-3 w-3 animate-spin`}),c(`setup:screen.probe.checking`,`Checking connection…`)]}):s?.ok?(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-success mt-1`,children:[(0,V.jsx)(v,{className:`h-3 w-3`}),(0,V.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,V.jsxs)(`div`,{className:`flex items-start gap-1.5 text-[11px] text-destructive mt-1`,children:[(0,V.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:`✕`}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:c(`setup:screen.probe.failed`,`Probe failed`)}),s.status===`no_base_url`&&(0,V.jsx)(`span`,{className:`block text-destructive/70`,children:c(`setup:screen.probe.noBaseUrl`,`No base URL configured`)}),s.status===`unreachable`&&(0,V.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,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`block text-destructive/70`,children:s.httpStatus==null?s.status:`${c(`setup:screen.probe.httpStatus`,`Status`)} ${s.httpStatus}`}),s.detail&&(0,V.jsx)(`span`,{className:`block text-destructive/70 truncate max-w-[250px]`,title:s.detail,children:s.detail})]})]})]}):null,ie&&(0,V.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,V.jsx)(h,{className:`h-3 w-3`}):(0,V.jsx)(l,{className:`h-3 w-3`})]})]}):null:(0,V.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsx)(j,{type:`password`,placeholder:e.keyPlaceholder,value:d,onChange:e=>f(e.target.value),onKeyDown:L,className:`font-mono text-sm`}),(0,V.jsx)(A,{onClick:I,disabled:!d.trim()||p,size:`sm`,className:`shrink-0`,children:p?(0,V.jsx)(g,{className:`h-4 w-4 animate-spin`}):c(`setup:screen.card.save`)})]}),e.docsUrl&&(0,V.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,V.jsx)(m,{className:`h-3 w-3`})]}),e.referral&&(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:R,className:`inline-flex items-center gap-1 text-[11px] text-warning/80 hover:text-warning transition-colors`,children:ee?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(v,{className:`h-3 w-3`}),` `,c(`setup:screen.card.copied`)]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(a,{className:`h-3 w-3`}),` `,c(`setup:screen.card.copyReferral`)]})}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>N(!0),className:`inline-flex items-center gap-1 text-[11px] text-warning/80 hover:text-warning transition-colors`,children:[(0,V.jsx)(u,{className:`h-3 w-3`}),` `,c(`setup:screen.card.share`)]})]})]})]})]}),(0,V.jsx)(k,{open:M,onOpenChange:N,children:(0,V.jsxs)(ne,{className:`sm:max-w-md`,children:[(0,V.jsxs)(D,{children:[(0,V.jsxs)(re,{className:`flex items-center gap-2`,children:[(0,V.jsx)(n,{className:`h-4 w-4 text-warning`}),c(`setup:screen.share.title`,{name:e.name})]}),(0,V.jsx)(O,{children:c(`setup:screen.share.description`)})]}),(0,V.jsx)(`div`,{className:`flex flex-col items-center gap-4 py-4`,children:e.referral&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`text-sm text-center`,children:(0,V.jsxs)(`p`,{className:`font-medium text-warning`,children:[`🎁 `,e.referral.reward]})}),P?(0,V.jsx)(`div`,{className:`rounded-lg border border-border p-2 bg-white`,children:(0,V.jsx)(`img`,{src:P,alt:c(`setup:screen.card.qrAlt`,{name:e.name}),className:`w-[200px] h-[200px]`})}):(0,V.jsx)(`div`,{className:`w-[200px] h-[200px] rounded-lg border border-border flex items-center justify-center bg-muted`,children:(0,V.jsx)(g,{className:`h-6 w-6 animate-spin text-muted-foreground`})}),(0,V.jsxs)(`div`,{className:`w-full space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-center gap-2`,children:[(0,V.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,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.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,V.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,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.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,V.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,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.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,V.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,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.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,V.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,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.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,V.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,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.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,V.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,V.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,V.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,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(j,{value:e.referral.url,readOnly:!0,className:`font-mono text-xs flex-1`}),(0,V.jsx)(A,{size:`sm`,variant:`outline`,onClick:R,className:`shrink-0`,children:ee?(0,V.jsx)(v,{className:`h-4 w-4`}):(0,V.jsx)(a,{className:`h-4 w-4`})})]}),(0,V.jsx)(`p`,{className:`text-[11px] text-muted-foreground text-center`,children:c(`setup:screen.share.hint`)})]})]})})]})})]})}function U(){let{t:e}=t(),{model:n,setProvider:r,setModel:a,wsConnected:o,wsUrl:u}=te(i(e=>({model:e.model,setProvider:e.setProvider,setModel:e.setModel,wsConnected:e.wsConnected,wsUrl:e.wsUrl})));ee();let[f,m]=(0,z.useState)([]),[h,y]=(0,z.useState)({}),[D,ne]=(0,z.useState)([]),[re,O]=(0,z.useState)(!1),[k,j]=(0,z.useState)(null),[N,F]=(0,z.useState)(0),[I,L]=(0,z.useState)(new Set),[B,se]=(0,z.useState)({}),[U,le]=(0,z.useState)(H),[W,G]=(0,z.useState)(!1),[ue,de]=(0,z.useState)(0),[fe,pe]=(0,z.useState)(0),[K,me]=(0,z.useState)(null),q=(0,z.useRef)(!0);(0,z.useEffect)(()=>{let e=new AbortController,t=`${window.location.origin}/providers.json`;return G(!0),ae(t,e.signal).then(t=>{if(t!==H){if(le(t),G(!1),!q.current){let e=t.length-fe;e>0?E.success(s.t(`setup:screen.toasts.providersLoadedNew`,{count:t.length,diff:e})):e<0?E.success(s.t(`setup:screen.toasts.providersLoadedRemoved`,{count:t.length,diff:Math.abs(e)})):E.success(s.t(`setup:screen.toasts.providersLoadedNoChanges`,{count:t.length})),pe(t.length)}me(new Date);return}return ae(`https://raw.githubusercontent.com/WrongStack/WrongStack/main/packages/webui/public/providers.json`,e.signal)}).then(e=>{if(e){if(le(e),!q.current){let t=e.length-fe;t>0?E.success(s.t(`setup:screen.toasts.providersLoadedNew`,{count:e.length,diff:t})):t<0?E.success(s.t(`setup:screen.toasts.providersLoadedRemoved`,{count:e.length,diff:Math.abs(t)})):E.success(s.t(`setup:screen.toasts.providersLoadedNoChanges`,{count:e.length})),pe(e.length)}me(new Date)}}).catch(()=>{q.current||E.error(s.t(`setup:screen.toasts.providersRefreshFailed`))}).finally(()=>{G(!1),q.current=!1}),()=>e.abort()},[ue]);let[J,he]=(0,z.useState)(null),[Y,X]=(0,z.useState)(null),[ge,_e]=(0,z.useState)(!1);(0,z.useEffect)(()=>{if(!o)return;let e=C(u),t=setTimeout(()=>{t=null,O(!1),j(s.t(`setup:screen.errors.backendNotResponding`))},8e3),r=()=>{t&&=(clearTimeout(t),null)},i=e.on(`provider.catalog`,e=>{if(e.type===`provider.catalog`){r(),j(null);let t=e.payload.providers.sort((e,t)=>e.id.localeCompare(t.id));m(t),O(!1)}}),a=e.on(`provider.models`,e=>{if(e.type===`provider.models`){let t=e.payload;if(t.provider!==J)return;y(e=>({...e,[t.provider]:t.models})),_e(!1),t.models.length===1?X(t.models[0].id):n&&t.models.some(e=>e.id===n)&&X(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));ne(t);let n=new Set(t.filter(e=>e.apiKeys.some(e=>e.isActive)).map(e=>e.id));L(n)}}),l=e.on(`provider.probe`,e=>{if(e.type!==`provider.probe`)return;let t=e.payload;se(e=>({...e,[t.providerId]:t}))});return j(null),O(!0),e.listProviders(),()=>{r(),i?.(),a?.(),c?.(),l?.()}},[o,u,n,N,J]);let ve=(0,z.useCallback)(()=>{j(null),F(e=>e+1)},[]),ye=(0,z.useCallback)(()=>{de(e=>e+1)},[]),be=(0,z.useCallback)(t=>oe(t,e),[e]),Z=(0,z.useCallback)(e=>{L(t=>new Set([...t,e])),he(e),X(null)},[]),xe=I.size>0;(0,z.useEffect)(()=>{if(!J||!o)return;let e=C(u);h[J]||(_e(!0),e.listProviderModels(J))},[J,o,u,h]);let Se=J?h[J]??[]:[],Ce=(0,z.useCallback)(async()=>{if(!J||!Y)return;if(!I.has(J)){E.error(`Please save the provider configuration before starting a session.`);return}r(J),a(Y);let e=C(u),t=await e.switchModel(J,Y,5e3);t.success?(e.newSession(),T(`chat`)):E.error(t.message||s.t(`setup:screen.errors.modelSwitchTimeout`))},[J,Y,r,a,u]),we=(0,z.useCallback)(async()=>{if(!J||!Y)return;r(J),a(Y);let e=await C(u).switchModel(J,Y,5e3);e.success?T(`chat`):E.error(e.message||s.t(`setup:screen.errors.modelSwitchTimeout`))},[J,Y,r,a,u]),Te=new Set(U.map(e=>e.id)),Ee=f.filter(e=>!Te.has(e.id)).sort((e,t)=>e.id.localeCompare(t.id)),Q=R(Ee,10);R(D,9);let $=R(Se,12,J);return(0,V.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,V.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,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,V.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,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`h1`,{className:`truncate text-lg font-semibold`,children:e(`setup:screen.header.title`)}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground sm:truncate`,children:e(`setup:screen.header.subtitle`)})]})]}),xe&&J?(0,V.jsxs)(`span`,{className:`text-xs text-success/80`,children:[(0,V.jsx)(v,{className:`h-3 w-3 inline-block mr-1`}),e(`setup:screen.header.continue`)]}):null]}),(0,V.jsx)(M,{className:`min-h-0 flex-1`,children:(0,V.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-8 p-4 pb-4 sm:p-6`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-sm`,children:[(0,V.jsxs)(`div`,{className:w(`flex min-w-0 items-center gap-1.5`,xe?`text-success`:`text-primary font-medium`),children:[(0,V.jsx)(x,{className:`h-4 w-4`}),(0,V.jsx)(`span`,{children:e(`setup:screen.steps.addKeys`)})]}),(0,V.jsx)(l,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,V.jsxs)(`div`,{className:w(`flex min-w-0 items-center gap-1.5`,J?`text-primary font-medium`:`text-muted-foreground`),children:[(0,V.jsx)(p,{className:`h-4 w-4`}),(0,V.jsx)(`span`,{children:e(`setup:screen.steps.pickModel`)})]}),(0,V.jsx)(l,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,V.jsxs)(`div`,{className:w(`flex min-w-0 items-center gap-1.5`,J&&Y?`text-primary font-medium`:`text-muted-foreground`),children:[(0,V.jsx)(c,{className:`h-4 w-4`}),(0,V.jsx)(`span`,{children:e(`setup:screen.steps.start`)})]})]}),(0,V.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-primary/20 bg-primary/5 p-4`,children:[(0,V.jsx)(_,{className:`h-5 w-5 text-primary shrink-0 mt-0.5`}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-sm font-medium`,children:e(`setup:screen.security.title`)}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e(`setup:screen.security.body`)})]})]}),k?(0,V.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,V.jsx)(`div`,{className:`w-12 h-12 rounded-xl bg-destructive/10 border border-destructive/30 flex items-center justify-center`,children:(0,V.jsx)(d,{className:`h-6 w-6 text-destructive`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-sm font-medium text-destructive`,children:e(`setup:screen.errors.backendUnreachable`)}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1 max-w-sm`,children:k})]}),(0,V.jsxs)(A,{onClick:ve,size:`sm`,variant:`outline`,children:[(0,V.jsx)(g,{className:`h-4 w-4 mr-2`}),e(`setup:screen.errors.retry`)]})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.popular`)}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[W&&(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground`,children:[(0,V.jsx)(g,{className:`h-3 w-3 animate-spin`}),e(`setup:screen.providers.updating`)]}),K&&!W&&(0,V.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,title:K.toLocaleString(),children:be(K)}),(0,V.jsxs)(`button`,{type:`button`,onClick:ye,disabled:W,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,V.jsx)(S,{className:w(`h-3 w-3`,W&&`animate-spin`)}),e(`setup:screen.providers.refresh`)]})]})]}),(0,V.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:U.map(e=>(0,V.jsx)(ce,{popular:e,catalogProvider:f.find(t=>t.id===e.id),savedProvider:D.find(t=>t.id===e.id),onKeySaved:Z,probeResult:B[e.id]},e.id))})]}),Ee.length>0&&(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.more`)}),(0,V.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:Q.pageItems.map(t=>(0,V.jsx)(ce,{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:D.find(e=>e.id===t.id),onKeySaved:Z,probeResult:B[t.id]},t.id))}),(0,V.jsx)(P,{page:Q.page,pageSize:Q.pageSize,totalItems:Q.totalItems,onPageChange:Q.setPage,itemLabel:`providers`})]}),(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.selfHosted`)}),(0,V.jsx)(ie,{onKeySaved:Z})]})]}),re&&(0,V.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,V.jsx)(g,{className:`h-6 w-6 animate-spin text-muted-foreground`})}),J&&(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsxs)(`h2`,{className:`text-base font-semibold flex items-center gap-2`,children:[(0,V.jsx)(c,{className:`h-4 w-4 text-primary`}),e(`setup:screen.start.chooseModel`)]}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>{he(null),X(null)},className:`text-xs text-muted-foreground hover:text-foreground transition-colors`,children:e(`setup:screen.start.addMoreKeys`)})]}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`setup:screen.start.modelsFor`,{provider:J})}),ge?(0,V.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,V.jsx)(g,{className:`h-6 w-6 animate-spin text-muted-foreground`})}):Se.length>0?(0,V.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,V.jsx)(`button`,{type:`button`,onClick:()=>X(e.id),className:w(`w-full text-left rounded-xl border p-3 transition-all`,`hover:border-primary/40 hover:bg-primary/5`,Y===e.id?`border-primary bg-primary/10 ring-1 ring-primary/30`:`border-border bg-card`),children:(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,V.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,V.jsx)(`span`,{className:`font-medium text-sm`,children:e.name}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 mt-1`,children:[t&&(0,V.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,V.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-primary/10 text-primary border border-primary/20`,children:e},e))]})]}),Y===e.id&&(0,V.jsx)(`div`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-primary`,children:(0,V.jsx)(v,{className:`h-3 w-3 text-primary-foreground`})})]})},e.id)})}):(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground py-8 text-center`,children:e(`setup:screen.errors.noModels`)}),(0,V.jsx)(P,{page:$.page,pageSize:$.pageSize,totalItems:$.totalItems,onPageChange:$.setPage,itemLabel:`models`})]}),J&&Y&&(0,V.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,V.jsx)(`div`,{className:`mb-3 flex min-w-0 items-center justify-between gap-2 text-sm text-muted-foreground`,children:(0,V.jsxs)(`span`,{className:`min-w-0 truncate`,children:[J,` / `,Y]})}),(0,V.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-2`,children:[(0,V.jsxs)(A,{onClick:Ce,className:`flex-1`,size:`lg`,children:[(0,V.jsx)(p,{className:`h-4 w-4 mr-2`}),e(`setup:screen.start.startSession`),(0,V.jsx)(b,{className:`h-4 w-4 ml-2`})]}),(0,V.jsxs)(A,{onClick:we,variant:`outline`,className:`flex-1`,size:`lg`,children:[(0,V.jsx)(v,{className:`h-4 w-4 mr-2`}),e(`setup:screen.start.saveConfig`)]})]}),(0,V.jsx)(`p`,{className:`text-[11px] text-muted-foreground/60 text-center mt-2`,children:e(`setup:screen.start.saveConfigHint`)})]})]})})]})}export{U 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,ea as l,en as u,jr as d,lt as f,ma as p,mi as m,na as h,or as g,qt as _,ra as v,t as y,wa as b,xr as x,yn as S}from"./vendor-C_zEzV4N.js";import"./i18n-CcHSmDoO.js";import{t as ee}from"./useWebSocket-DjrFK4tQ.js";import{t as C}from"./ws-client-BVq0hf0a.js";import{t as w}from"./utils-tsZEnrBH.js";import{I as te}from"./stores-kaIFQfXo.js";import{o as T}from"./view-navigation-CZKugncK.js";import{n as E}from"./Toaster-CQLQAp7y.js";import{a as D,n as ne,o as re,r as O,t as k}from"./dialog-BJjDUqb3.js";import{t as A}from"./button-DvpRpKkt.js";import{t as j}from"./input-BtoHcCl9.js";import{D as M,a as N,b as P,i as F,r as I,t as L,x as R}from"./index-Bj3blCRO.js";var z=e(r(),1);function B(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 V=f();function ie({onKeySaved:e}){let{t:n}=t(),[r,i]=(0,z.useState)(!1),[a,s]=(0,z.useState)(``),[c,u]=(0,z.useState)(`openai-compatible`),[d,f]=(0,z.useState)(``),[p,m]=(0,z.useState)(``),[h,_]=(0,z.useState)(!1),[v,y]=(0,z.useState)([]),{setFieldRef:b,handleKeyDown:x}=N(),S=async()=>{if(a.trim()){_(!0);try{let t=C(te.getState().wsUrl),r=B(t);t.send({type:`provider.add`,payload:{id:a.trim(),family:c,baseUrl:d.trim()||void 0,apiKey:p.trim()||void 0,models:v.length>0?v.map(e=>e.id):void 0,customModels:v.length>0?Object.fromEntries(v.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);E.success(n(`setup:screen.toasts.providerAdded`,{id:a.trim()})),e(a.trim()),t.listSavedProviders(),t.probeProvider(a.trim()),s(``),f(``),m(``),y([]),i(!1)}catch(e){let t=e instanceof Error&&e.message&&e.message!==`timeout`?e.message:null;E.error(t??n(`setup:screen.toasts.providerAddFailed`))}finally{_(!1)}}};return(0,V.jsxs)(`div`,{className:`rounded-xl border border-dashed border-border/60 overflow-hidden`,children:[(0,V.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,V.jsx)(`div`,{className:`w-10 h-10 rounded-lg bg-muted/50 flex items-center justify-center`,children:(0,V.jsx)(o,{className:`h-5 w-5 text-muted-foreground`})}),(0,V.jsxs)(`div`,{className:`flex-1`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-medium`,children:n(`setup:screen.custom.title`)}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`setup:screen.custom.description`)})]}),(0,V.jsx)(l,{className:w(`h-4 w-4 text-muted-foreground transition-transform`,r&&`rotate-90`)})]}),r&&(0,V.jsxs)(`div`,{className:`px-4 pb-4 space-y-3 border-t border-border/40`,children:[(0,V.jsxs)(`div`,{className:`space-y-1.5 pt-3`,children:[(0,V.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground block`,children:n(`setup:screen.custom.localServers`)}),(0,V.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:I.map(e=>(0,V.jsx)(A,{type:`button`,size:`sm`,variant:a===e.id?`default`:`outline`,onClick:()=>{s(e.id),u(`openai-compatible`),f(e.defaultBaseUrl),e.noAuth&&m(``),y([])},title:e.hint,children:e.label},e.id))})]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:n(`setup:screen.custom.providerId`)}),(0,V.jsx)(j,{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,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:n(`setup:screen.custom.family`)}),(0,V.jsxs)(`select`,{value:c,onChange:e=>u(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,V.jsx)(`option`,{value:`openai-compatible`,children:n(`setup:screen.custom.familyOpenAiCompatible`)}),(0,V.jsx)(`option`,{value:`openai`,children:`OpenAI`}),(0,V.jsx)(`option`,{value:`anthropic`,children:`Anthropic`}),(0,V.jsx)(`option`,{value:`google`,children:`Google`})]})]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:n(`setup:screen.custom.baseUrl`)}),(0,V.jsx)(j,{placeholder:n(`activity:customProviderSection.eGHttpLocalhost11434V1`),value:d,onChange:e=>f(e.target.value),className:`text-sm font-mono`,ref:b(2),onKeyDown:e=>x(e,2)})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:n(`setup:screen.custom.apiKey`)}),(0,V.jsx)(j,{type:`password`,placeholder:n(`setup:screen.custom.apiKeyPlaceholder`),value:p,onChange:e=>m(e.target.value),className:`text-sm font-mono`,ref:b(3),onKeyDown:e=>x(e,3)})]}),(0,V.jsx)(L,{models:v,onChange:y}),(0,V.jsxs)(A,{onClick:S,disabled:!a.trim()||h,size:`sm`,ref:b(4),onKeyDown:e=>x(e,4,S),children:[h?(0,V.jsx)(g,{className:`h-4 w-4 animate-spin mr-2`}):null,n(`setup:screen.custom.add`)]})]})]})}var H=F();async function ae(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:H}catch{return H}}function oe(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 se=e(y(),1);function ce({popular:e,catalogProvider:r,savedProvider:i,onKeySaved:o,probeResult:s}){let{t:c}=t(),[d,f]=(0,z.useState)(``),[p,_]=(0,z.useState)(!1),[y,b]=(0,z.useState)(!!i?.apiKeys.some(e=>e.isActive)),[x,S]=(0,z.useState)(!1),[ee,T]=(0,z.useState)(!1),[M,N]=(0,z.useState)(!1),[P,F]=(0,z.useState)(null);(0,z.useEffect)(()=>{M&&e.referral&&se.toDataURL(e.referral.url,{width:200,margin:2,color:{dark:`#000000`,light:`#ffffff`}}).then(e=>F(e)).catch(()=>F(null))},[M,e.referral]);let I=async()=>{if(d.trim()){_(!0);try{let t=C(te.getState().wsUrl),n=B(t);r?t.addKey(e.id,`default`,d.trim()):t.send({type:`provider.add`,payload:{id:e.id,family:e.family,apiKey:d.trim()}});let i=await n;if(!i.success)throw Error(i.message);b(!0),f(``),E.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;E.error(n??c(`setup:screen.toasts.keySaveFailed`,{name:e.name}))}finally{_(!1)}}},L=e=>{e.key===`Enter`&&d.trim()&&I()},R=async()=>{if(e.referral)try{await navigator.clipboard.writeText(e.referral.url),T(!0),E.success(c(`setup:screen.toasts.referralCopied`)),setTimeout(()=>T(!1),2e3)}catch{E.error(c(`setup:screen.toasts.referralCopyFailed`))}},ie=r&&r.modelCount>0;return(0,V.jsxs)(`div`,{className:w(`rounded-xl border p-4 transition-all`,y?`border-success/30 bg-success/5`:`bg-gradient-to-br ${e.color}`),children:[(0,V.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,V.jsx)(`span`,{className:`text-2xl shrink-0 mt-0.5`,children:e.icon}),(0,V.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-semibold`,children:e.name}),y&&(0,V.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,V.jsx)(v,{className:`h-2.5 w-2.5`}),c(`setup:screen.card.keySaved`)]}),e.referral&&!y&&(0,V.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,V.jsx)(n,{className:`h-2.5 w-2.5`}),c(`setup:screen.card.referral`)]})]}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e.description}),e.referral&&!y&&(0,V.jsxs)(`p`,{className:`text-[11px] text-warning/80 mt-1`,children:[`🎁 `,e.referral.reward]}),y?y?(0,V.jsxs)(`div`,{className:`mt-3 space-y-1`,children:[i?.baseUrl&&(0,V.jsxs)(`div`,{className:`text-[11px] text-muted-foreground/70 font-mono truncate`,title:i.baseUrl,children:[(0,V.jsxs)(`span`,{className:`text-muted-foreground/50`,children:[c(`activity:providerKey.url`),` `]}),i.baseUrl]}),i?.models&&i.models.length>0&&(0,V.jsxs)(`div`,{className:`text-[11px] text-muted-foreground/70`,children:[(0,V.jsxs)(`span`,{className:`text-muted-foreground/50`,children:[c(`activity:providerKey.models`),` `]}),i.pickedModelId??i.models[0],(0,V.jsxs)(`span`,{className:`text-muted-foreground/50`,children:[` (+`,i.models.length-1,` more)`]})]}),s===`probing`?(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-muted-foreground mt-1`,children:[(0,V.jsx)(g,{className:`h-3 w-3 animate-spin`}),c(`setup:screen.probe.checking`,`Checking connection…`)]}):s?.ok?(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-success mt-1`,children:[(0,V.jsx)(v,{className:`h-3 w-3`}),(0,V.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,V.jsxs)(`div`,{className:`flex items-start gap-1.5 text-[11px] text-destructive mt-1`,children:[(0,V.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:`✕`}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:c(`setup:screen.probe.failed`,`Probe failed`)}),s.status===`no_base_url`&&(0,V.jsx)(`span`,{className:`block text-destructive/70`,children:c(`setup:screen.probe.noBaseUrl`,`No base URL configured`)}),s.status===`unreachable`&&(0,V.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,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`block text-destructive/70`,children:s.httpStatus==null?s.status:`${c(`setup:screen.probe.httpStatus`,`Status`)} ${s.httpStatus}`}),s.detail&&(0,V.jsx)(`span`,{className:`block text-destructive/70 truncate max-w-[250px]`,title:s.detail,children:s.detail})]})]})]}):null,ie&&(0,V.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,V.jsx)(h,{className:`h-3 w-3`}):(0,V.jsx)(l,{className:`h-3 w-3`})]})]}):null:(0,V.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsx)(j,{type:`password`,placeholder:e.keyPlaceholder,value:d,onChange:e=>f(e.target.value),onKeyDown:L,className:`font-mono text-sm`}),(0,V.jsx)(A,{onClick:I,disabled:!d.trim()||p,size:`sm`,className:`shrink-0`,children:p?(0,V.jsx)(g,{className:`h-4 w-4 animate-spin`}):c(`setup:screen.card.save`)})]}),e.docsUrl&&(0,V.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,V.jsx)(m,{className:`h-3 w-3`})]}),e.referral&&(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:R,className:`inline-flex items-center gap-1 text-[11px] text-warning/80 hover:text-warning transition-colors`,children:ee?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(v,{className:`h-3 w-3`}),` `,c(`setup:screen.card.copied`)]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(a,{className:`h-3 w-3`}),` `,c(`setup:screen.card.copyReferral`)]})}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>N(!0),className:`inline-flex items-center gap-1 text-[11px] text-warning/80 hover:text-warning transition-colors`,children:[(0,V.jsx)(u,{className:`h-3 w-3`}),` `,c(`setup:screen.card.share`)]})]})]})]})]}),(0,V.jsx)(k,{open:M,onOpenChange:N,children:(0,V.jsxs)(ne,{className:`sm:max-w-md`,children:[(0,V.jsxs)(D,{children:[(0,V.jsxs)(re,{className:`flex items-center gap-2`,children:[(0,V.jsx)(n,{className:`h-4 w-4 text-warning`}),c(`setup:screen.share.title`,{name:e.name})]}),(0,V.jsx)(O,{children:c(`setup:screen.share.description`)})]}),(0,V.jsx)(`div`,{className:`flex flex-col items-center gap-4 py-4`,children:e.referral&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`text-sm text-center`,children:(0,V.jsxs)(`p`,{className:`font-medium text-warning`,children:[`🎁 `,e.referral.reward]})}),P?(0,V.jsx)(`div`,{className:`rounded-lg border border-border p-2 bg-white`,children:(0,V.jsx)(`img`,{src:P,alt:c(`setup:screen.card.qrAlt`,{name:e.name}),className:`w-[200px] h-[200px]`})}):(0,V.jsx)(`div`,{className:`w-[200px] h-[200px] rounded-lg border border-border flex items-center justify-center bg-muted`,children:(0,V.jsx)(g,{className:`h-6 w-6 animate-spin text-muted-foreground`})}),(0,V.jsxs)(`div`,{className:`w-full space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-center gap-2`,children:[(0,V.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,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.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,V.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,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.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,V.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,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.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,V.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,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.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,V.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,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.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,V.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,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.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,V.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,V.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,V.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,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(j,{value:e.referral.url,readOnly:!0,className:`font-mono text-xs flex-1`}),(0,V.jsx)(A,{size:`sm`,variant:`outline`,onClick:R,className:`shrink-0`,children:ee?(0,V.jsx)(v,{className:`h-4 w-4`}):(0,V.jsx)(a,{className:`h-4 w-4`})})]}),(0,V.jsx)(`p`,{className:`text-[11px] text-muted-foreground text-center`,children:c(`setup:screen.share.hint`)})]})]})})]})})]})}function U(){let{t:e}=t(),{model:n,setProvider:r,setModel:a,wsConnected:o,wsUrl:u}=te(i(e=>({model:e.model,setProvider:e.setProvider,setModel:e.setModel,wsConnected:e.wsConnected,wsUrl:e.wsUrl})));ee();let[f,m]=(0,z.useState)([]),[h,y]=(0,z.useState)({}),[D,ne]=(0,z.useState)([]),[re,O]=(0,z.useState)(!1),[k,j]=(0,z.useState)(null),[N,F]=(0,z.useState)(0),[I,L]=(0,z.useState)(new Set),[B,se]=(0,z.useState)({}),[U,le]=(0,z.useState)(H),[W,G]=(0,z.useState)(!1),[ue,de]=(0,z.useState)(0),[fe,pe]=(0,z.useState)(0),[K,me]=(0,z.useState)(null),q=(0,z.useRef)(!0);(0,z.useEffect)(()=>{let e=new AbortController,t=`${window.location.origin}/providers.json`;return G(!0),ae(t,e.signal).then(t=>{if(t!==H){if(le(t),G(!1),!q.current){let e=t.length-fe;e>0?E.success(s.t(`setup:screen.toasts.providersLoadedNew`,{count:t.length,diff:e})):e<0?E.success(s.t(`setup:screen.toasts.providersLoadedRemoved`,{count:t.length,diff:Math.abs(e)})):E.success(s.t(`setup:screen.toasts.providersLoadedNoChanges`,{count:t.length})),pe(t.length)}me(new Date);return}return ae(`https://raw.githubusercontent.com/WrongStack/WrongStack/main/packages/webui/public/providers.json`,e.signal)}).then(e=>{if(e){if(le(e),!q.current){let t=e.length-fe;t>0?E.success(s.t(`setup:screen.toasts.providersLoadedNew`,{count:e.length,diff:t})):t<0?E.success(s.t(`setup:screen.toasts.providersLoadedRemoved`,{count:e.length,diff:Math.abs(t)})):E.success(s.t(`setup:screen.toasts.providersLoadedNoChanges`,{count:e.length})),pe(e.length)}me(new Date)}}).catch(()=>{q.current||E.error(s.t(`setup:screen.toasts.providersRefreshFailed`))}).finally(()=>{G(!1),q.current=!1}),()=>e.abort()},[ue]);let[J,he]=(0,z.useState)(null),[Y,X]=(0,z.useState)(null),[ge,_e]=(0,z.useState)(!1);(0,z.useEffect)(()=>{if(!o)return;let e=C(u),t=setTimeout(()=>{t=null,O(!1),j(s.t(`setup:screen.errors.backendNotResponding`))},8e3),r=()=>{t&&=(clearTimeout(t),null)},i=e.on(`provider.catalog`,e=>{if(e.type===`provider.catalog`){r(),j(null);let t=e.payload.providers.sort((e,t)=>e.id.localeCompare(t.id));m(t),O(!1)}}),a=e.on(`provider.models`,e=>{if(e.type===`provider.models`){let t=e.payload;if(t.provider!==J)return;y(e=>({...e,[t.provider]:t.models})),_e(!1),t.models.length===1?X(t.models[0].id):n&&t.models.some(e=>e.id===n)&&X(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));ne(t);let n=new Set(t.filter(e=>e.apiKeys.some(e=>e.isActive)).map(e=>e.id));L(n)}}),l=e.on(`provider.probe`,e=>{if(e.type!==`provider.probe`)return;let t=e.payload;se(e=>({...e,[t.providerId]:t}))});return j(null),O(!0),e.listProviders(),()=>{r(),i?.(),a?.(),c?.(),l?.()}},[o,u,n,N,J]);let ve=(0,z.useCallback)(()=>{j(null),F(e=>e+1)},[]),ye=(0,z.useCallback)(()=>{de(e=>e+1)},[]),be=(0,z.useCallback)(t=>oe(t,e),[e]),Z=(0,z.useCallback)(e=>{L(t=>new Set([...t,e])),he(e),X(null)},[]),xe=I.size>0;(0,z.useEffect)(()=>{if(!J||!o)return;let e=C(u);h[J]||(_e(!0),e.listProviderModels(J))},[J,o,u,h]);let Se=J?h[J]??[]:[],Ce=(0,z.useCallback)(async()=>{if(!J||!Y)return;if(!I.has(J)){E.error(`Please save the provider configuration before starting a session.`);return}r(J),a(Y);let e=C(u),t=await e.switchModel(J,Y,5e3);t.success?(e.newSession(),T(`chat`)):E.error(t.message||s.t(`setup:screen.errors.modelSwitchTimeout`))},[J,Y,r,a,u]),we=(0,z.useCallback)(async()=>{if(!J||!Y)return;r(J),a(Y);let e=await C(u).switchModel(J,Y,5e3);e.success?T(`chat`):E.error(e.message||s.t(`setup:screen.errors.modelSwitchTimeout`))},[J,Y,r,a,u]),Te=new Set(U.map(e=>e.id)),Ee=f.filter(e=>!Te.has(e.id)).sort((e,t)=>e.id.localeCompare(t.id)),Q=R(Ee,10);R(D,9);let $=R(Se,12,J);return(0,V.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,V.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,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,V.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,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`h1`,{className:`truncate text-lg font-semibold`,children:e(`setup:screen.header.title`)}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground sm:truncate`,children:e(`setup:screen.header.subtitle`)})]})]}),xe&&J?(0,V.jsxs)(`span`,{className:`text-xs text-success/80`,children:[(0,V.jsx)(v,{className:`h-3 w-3 inline-block mr-1`}),e(`setup:screen.header.continue`)]}):null]}),(0,V.jsx)(M,{className:`min-h-0 flex-1`,children:(0,V.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-8 p-4 pb-4 sm:p-6`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-sm`,children:[(0,V.jsxs)(`div`,{className:w(`flex min-w-0 items-center gap-1.5`,xe?`text-success`:`text-primary font-medium`),children:[(0,V.jsx)(x,{className:`h-4 w-4`}),(0,V.jsx)(`span`,{children:e(`setup:screen.steps.addKeys`)})]}),(0,V.jsx)(l,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,V.jsxs)(`div`,{className:w(`flex min-w-0 items-center gap-1.5`,J?`text-primary font-medium`:`text-muted-foreground`),children:[(0,V.jsx)(p,{className:`h-4 w-4`}),(0,V.jsx)(`span`,{children:e(`setup:screen.steps.pickModel`)})]}),(0,V.jsx)(l,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,V.jsxs)(`div`,{className:w(`flex min-w-0 items-center gap-1.5`,J&&Y?`text-primary font-medium`:`text-muted-foreground`),children:[(0,V.jsx)(c,{className:`h-4 w-4`}),(0,V.jsx)(`span`,{children:e(`setup:screen.steps.start`)})]})]}),(0,V.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-primary/20 bg-primary/5 p-4`,children:[(0,V.jsx)(_,{className:`h-5 w-5 text-primary shrink-0 mt-0.5`}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-sm font-medium`,children:e(`setup:screen.security.title`)}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e(`setup:screen.security.body`)})]})]}),k?(0,V.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,V.jsx)(`div`,{className:`w-12 h-12 rounded-xl bg-destructive/10 border border-destructive/30 flex items-center justify-center`,children:(0,V.jsx)(d,{className:`h-6 w-6 text-destructive`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-sm font-medium text-destructive`,children:e(`setup:screen.errors.backendUnreachable`)}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1 max-w-sm`,children:k})]}),(0,V.jsxs)(A,{onClick:ve,size:`sm`,variant:`outline`,children:[(0,V.jsx)(g,{className:`h-4 w-4 mr-2`}),e(`setup:screen.errors.retry`)]})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.popular`)}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[W&&(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground`,children:[(0,V.jsx)(g,{className:`h-3 w-3 animate-spin`}),e(`setup:screen.providers.updating`)]}),K&&!W&&(0,V.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,title:K.toLocaleString(),children:be(K)}),(0,V.jsxs)(`button`,{type:`button`,onClick:ye,disabled:W,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,V.jsx)(S,{className:w(`h-3 w-3`,W&&`animate-spin`)}),e(`setup:screen.providers.refresh`)]})]})]}),(0,V.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:U.map(e=>(0,V.jsx)(ce,{popular:e,catalogProvider:f.find(t=>t.id===e.id),savedProvider:D.find(t=>t.id===e.id),onKeySaved:Z,probeResult:B[e.id]},e.id))})]}),Ee.length>0&&(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.more`)}),(0,V.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:Q.pageItems.map(t=>(0,V.jsx)(ce,{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:D.find(e=>e.id===t.id),onKeySaved:Z,probeResult:B[t.id]},t.id))}),(0,V.jsx)(P,{page:Q.page,pageSize:Q.pageSize,totalItems:Q.totalItems,onPageChange:Q.setPage,itemLabel:`providers`})]}),(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.selfHosted`)}),(0,V.jsx)(ie,{onKeySaved:Z})]})]}),re&&(0,V.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,V.jsx)(g,{className:`h-6 w-6 animate-spin text-muted-foreground`})}),J&&(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsxs)(`h2`,{className:`text-base font-semibold flex items-center gap-2`,children:[(0,V.jsx)(c,{className:`h-4 w-4 text-primary`}),e(`setup:screen.start.chooseModel`)]}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>{he(null),X(null)},className:`text-xs text-muted-foreground hover:text-foreground transition-colors`,children:e(`setup:screen.start.addMoreKeys`)})]}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`setup:screen.start.modelsFor`,{provider:J})}),ge?(0,V.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,V.jsx)(g,{className:`h-6 w-6 animate-spin text-muted-foreground`})}):Se.length>0?(0,V.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,V.jsx)(`button`,{type:`button`,onClick:()=>X(e.id),className:w(`w-full text-left rounded-xl border p-3 transition-all`,`hover:border-primary/40 hover:bg-primary/5`,Y===e.id?`border-primary bg-primary/10 ring-1 ring-primary/30`:`border-border bg-card`),children:(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,V.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,V.jsx)(`span`,{className:`font-medium text-sm`,children:e.name}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 mt-1`,children:[t&&(0,V.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,V.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-primary/10 text-primary border border-primary/20`,children:e},e))]})]}),Y===e.id&&(0,V.jsx)(`div`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-primary`,children:(0,V.jsx)(v,{className:`h-3 w-3 text-primary-foreground`})})]})},e.id)})}):(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground py-8 text-center`,children:e(`setup:screen.errors.noModels`)}),(0,V.jsx)(P,{page:$.page,pageSize:$.pageSize,totalItems:$.totalItems,onPageChange:$.setPage,itemLabel:`models`})]}),J&&Y&&(0,V.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,V.jsx)(`div`,{className:`mb-3 flex min-w-0 items-center justify-between gap-2 text-sm text-muted-foreground`,children:(0,V.jsxs)(`span`,{className:`min-w-0 truncate`,children:[J,` / `,Y]})}),(0,V.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-2`,children:[(0,V.jsxs)(A,{onClick:Ce,className:`flex-1`,size:`lg`,children:[(0,V.jsx)(p,{className:`h-4 w-4 mr-2`}),e(`setup:screen.start.startSession`),(0,V.jsx)(b,{className:`h-4 w-4 ml-2`})]}),(0,V.jsxs)(A,{onClick:we,variant:`outline`,className:`flex-1`,size:`lg`,children:[(0,V.jsx)(v,{className:`h-4 w-4 mr-2`}),e(`setup:screen.start.saveConfig`)]})]}),(0,V.jsx)(`p`,{className:`text-[11px] text-muted-foreground/60 text-center mt-2`,children:e(`setup:screen.start.saveConfigHint`)})]})]})})]})}export{U as SetupScreen};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-C_zEzV4N.js","assets/rolldown-runtime-hePW80VL.js","assets/monaco-BCqJp2xW.js","assets/monaco-Bowa0-zp.css","assets/markdown-CIRD7kOg.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 a,ga as ae,jr as oe,jt as o,kn as se,lt as s,or as c,ra as ce,ta as le,xa as l,yi as ue,yn as de}from"./vendor-C_zEzV4N.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 a,ga as ae,jr as oe,jt as o,kn as se,lt as s,or as c,ra as ce,ta as le,xa as l,yi as ue,yn as de}from"./vendor-C_zEzV4N.js";import"./i18n-CcHSmDoO.js";import{s as u}from"./monaco-BCqJp2xW.js";import{t as fe}from"./useWebSocket-DjrFK4tQ.js";import{t as d}from"./utils-tsZEnrBH.js";import{n as pe}from"./ui-store-xx1NssJI.js";import{o as me}from"./view-navigation-CZKugncK.js";import{a as he,n as ge,o as _e,t as ve}from"./dialog-BJjDUqb3.js";import{p as f}from"./markdown-CIRD7kOg.js";import{c as ye,g as p,u as m}from"./index-Bj3blCRO.js";import{t as be}from"./empty-state-Cefmzojx.js";var h=e(n(),1),g=s(),xe=(0,h.lazy)(()=>u(()=>import(`./vendor-C_zEzV4N.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:s}=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)(``),[H,Ee]=(0,h.useState)(!1),[U,W]=(0,h.useState)(null),[De,Oe]=(0,h.useState)(!1),[G,K]=(0,h.useState)(null),[q,ke]=(0,h.useState)(!1),[Ae,je]=(0,h.useState)([]),J=(0,h.useRef)(u);J.current=u;let Y=(0,h.useRef)(!1),X=(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]),Z=(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(!s||!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;Ee(!1);let n=J.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}),W({updated:t.payload.updated??[],unchanged:t.payload.unchanged??[],errors:t.payload.errors??[]}),s.send({type:`skills.list`},{echoToChat:!1})}else W({updated:[],unchanged:[],errors:[{name:``,error:t.payload.error??i.t(`activity:skillDetail.updateFailed`)}]})},r=e=>{let t=e;t.payload.skills&&je(t.payload.skills)};return s.on(`skills.content`,t),s.on(`skills.updated`,n),s.on(`skills.list`,r),s.send({type:`skills.content`,payload:{name:y.name,source:y.source}}),()=>{clearTimeout(e),s.off(`skills.content`,t),s.off(`skills.updated`,n),s.off(`skills.list`,r)}},[s,y?.name,y?.source]),(0,h.useEffect)(()=>{D&&(O(!1),A(``),P(null))},[y?.name]);let Q=(0,h.useCallback)(e=>Ae.find(t=>t.name.toLowerCase()===e.toLowerCase()),[Ae]),Me=(0,h.useCallback)(e=>{let t=Q(e);if(t){Y.current=!1;let e=b.slice(0,x+1);e.push(t),v({...J.current,selectedSkill:t,navHistory:e,historyIndex:e.length-1}),O(!1),A(``),W(null)}},[Q,b,x,v]),Ne=(0,h.useCallback)(()=>{if(x<=0)return;Y.current=!0;let e=x-1,t=b[e];v({...J.current,selectedSkill:t,historyIndex:e}),O(!1),A(``),W(null)},[x,b,v]),Pe=(0,h.useCallback)(()=>{if(x>=b.length-1)return;Y.current=!0;let e=x+1,t=b[e];v({...J.current,selectedSkill:t,historyIndex:e}),O(!1),A(``),W(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(!s||!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),s.send({type:`skills.content`,payload:{name:y.name,source:y.source}}),s.send({type:`skills.list`},{echoToChat:!1})):P(n.payload.error??i.t(`activity:skillDetail.saveFailed`)),s.off(`skills.edited`,e)};s.on(`skills.edited`,e),s.editSkill(y.name,k)},[s,y,k]),ze=(0,h.useCallback)(()=>{!s||!y||(Ee(!0),W(null),s.checkForUpdates(y.name,y.source===`user`))},[s,y]),Be=(0,h.useCallback)(()=>{y?.sourceUrl&&navigator.clipboard.writeText(y.sourceUrl).then(()=>{Oe(!0),setTimeout(()=>Oe(!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(!s||!e)return;ke(!0);let t=e=>{let n=e;ke(!1),n.payload.success?(K(null),s.send({type:`skills.list`},{echoToChat:!1}),$()):P(n.payload.error??i.t(`activity:skillDetail.uninstallFailed`)),s.off(`skills.uninstalled`,t)};s.on(`skills.uninstalled`,t),s.uninstallSkill(e.name,e.source===`user`)},[s,$]);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)(oe,{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:De?(0,g.jsx)(ce,{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))}),U&&(0,g.jsxs)(`div`,{className:`mt-2 text-xs space-y-1`,children:[U.updated.length>0&&(0,g.jsx)(`div`,{className:`text-success`,children:n(`activity:skillDetail.updatedLabel`,{list:U.updated.map(e=>`${e.name} (${e.oldRef} → ${e.newRef})`).join(`, `)})}),U.unchanged.length>0&&(0,g.jsx)(`div`,{className:`text-muted-foreground`,children:n(`activity:skillDetail.upToDateLabel`,{list:U.unchanged.join(`, `)})}),U.errors.length>0&&(0,g.jsx)(`div`,{className:`text-destructive`,children:n(`activity:skillDetail.errorsLabel`,{list:U.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:H,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:H?(0,g.jsx)(c,{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)(se,{className:`h-3.5 w-3.5`})}),_(y.source)&&(0,g.jsx)(`button`,{type:`button`,onClick:()=>K(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)(o,{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)(le,{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)(a,{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)(a,{className:`h-3 w-3 text-muted-foreground/65 mx-0.5 shrink-0`}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>{t<x&&(Y.current=!0,v({...J.current,selectedSkill:e,historyIndex:t}),O(!1),A(``),W(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&&Q(t)?(0,g.jsxs)(`button`,{type:`button`,onClick:()=>Me(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 Q(t)?(0,g.jsxs)(`button`,{type:`button`,onClick:()=>Me(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)(c,{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:X.lines,words:X.words,chars:X.chars})}),Z&&(0,g.jsx)(`span`,{className:`text-xs tabular-nums ${Z.level===`critical`?`font-medium text-destructive`:`text-warning`}`,children:n(`activity:skillDetail.charsWarningFmt`,{used:(Z.used/1048576).toFixed(1),limit:(Z.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)(c,{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)(m,{rehypePlugins:[f],components:p,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)(m,{rehypePlugins:[f],components:p,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:()=>{s&&y&&(w(!0),E(null),s.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:!!G,onOpenChange:e=>{e||K(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)(o,{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:()=>K(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:G&&n(`activity:skillDetail.uninstallConfirm`,{name:G.name})}),(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:G&&n(`activity:skillDetail.uninstallRemovePath`,{path:G.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:()=>K(null),disabled:q,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:()=>G&&He(G),disabled:q,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:[q&&(0,g.jsx)(c,{className:`h-3 w-3 animate-spin`}),n(`activity:skillDetail.uninstallAction`)]})]})]})})]}):(0,g.jsx)(be,{icon:(0,g.jsx)(ae,{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,ar as l,dt as u,ea as d,gr as f,lt as p,mn as m,na as h,or as g,ya as _,zi as v}from"./vendor-C_zEzV4N.js";import"./i18n-DxZ0s97D.js";import{t as y}from"./useWebSocket-BepkW6iB.js";import{t as b}from"./utils-tsZEnrBH.js";import{a as x}from"./stores-JAIPqBZz.js";import{r as S}from"./view-navigation-CZKugncK.js";import{t as C}from"./button-DvpRpKkt.js";var w=e(r(),1),T=p(),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)(g,{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)(l,{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)(m,{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)(d,{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)(g,{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),l=x(e=>e.detail),p=x(e=>e.expandedSpecId),m=x(e=>e.setExpanded),[g,_]=(0,w.useState)(`graph`),v=(0,w.useCallback)(e=>{!l||l.specId!==e.id||(i?.send?.({type:`goal.start`,payload:{title:e.title,phases:j(l),autonomous:!0}}),S(`goal`))},[l,i]),E=(0,w.useCallback)(e=>{let t=e.graphId??(l?.specId===e.id?l.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`)},[l,i,r]);(0,w.useEffect)(()=>{i?.send?.({type:`specs.list`})},[i]);let D=(0,w.useCallback)(e=>{p===e.id?m(null):(m(e.id),i?.send?.({type:`specs.get`,payload:{specId:e.id}}))},[p,m,i]),O=l?.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)(u,{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=p===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)(h,{className:`h-4 w-4`}):(0,T.jsx)(d,{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:l?.total??e.total}),l&&(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:!l||l.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`,g===`list`?`bg-primary/15 text-primary`:`text-muted-foreground`),children:[(0,T.jsx)(f,{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`,g===`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`)]})]})]})]}),!l||l.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`)}):g===`graph`?(0,T.jsx)(k,{columns:l.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,ar as l,dt as u,ea as d,gr as f,lt as p,mn as m,na as h,or as g,ya as _,zi as v}from"./vendor-C_zEzV4N.js";import"./i18n-CcHSmDoO.js";import{t as y}from"./useWebSocket-DjrFK4tQ.js";import{t as b}from"./utils-tsZEnrBH.js";import{a as x}from"./stores-kaIFQfXo.js";import{r as S}from"./view-navigation-CZKugncK.js";import{t as C}from"./button-DvpRpKkt.js";var w=e(r(),1),T=p(),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)(g,{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)(l,{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)(m,{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)(d,{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)(g,{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),l=x(e=>e.detail),p=x(e=>e.expandedSpecId),m=x(e=>e.setExpanded),[g,_]=(0,w.useState)(`graph`),v=(0,w.useCallback)(e=>{!l||l.specId!==e.id||(i?.send?.({type:`goal.start`,payload:{title:e.title,phases:j(l),autonomous:!0}}),S(`goal`))},[l,i]),E=(0,w.useCallback)(e=>{let t=e.graphId??(l?.specId===e.id?l.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`)},[l,i,r]);(0,w.useEffect)(()=>{i?.send?.({type:`specs.list`})},[i]);let D=(0,w.useCallback)(e=>{p===e.id?m(null):(m(e.id),i?.send?.({type:`specs.get`,payload:{specId:e.id}}))},[p,m,i]),O=l?.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)(u,{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=p===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)(h,{className:`h-4 w-4`}):(0,T.jsx)(d,{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:l?.total??e.total}),l&&(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:!l||l.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`,g===`list`?`bg-primary/15 text-primary`:`text-muted-foreground`),children:[(0,T.jsx)(f,{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`,g===`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`)]})]})]})]}),!l||l.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`)}):g===`graph`?(0,T.jsx)(k,{columns:l.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{Ai as t,Ba as n,Br as r,Ea as i,Ei as a,Ga as o,Gn as s,Ir as c,M as l,Ma as u,Mi as d,Nt as f,Qr as ee,Wt as p,Zt as te,an as m,ci as ne,dt as re,fa as h,gn as g,lt as _,mi as v,or as y,pa as ie,qt as ae,ut as b,yi as oe,yn as se,zn as x}from"./vendor-C_zEzV4N.js";import"./i18n-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ai as t,Ba as n,Br as r,Ea as i,Ei as a,Ga as o,Gn as s,Ir as c,M as l,Ma as u,Mi as d,Nt as f,Qr as ee,Wt as p,Zt as te,an as m,ci as ne,dt as re,fa as h,gn as g,lt as _,mi as v,or as y,pa as ie,qt as ae,ut as b,yi as oe,yn as se,zn as x}from"./vendor-C_zEzV4N.js";import"./i18n-CcHSmDoO.js";import{t as S}from"./utils-tsZEnrBH.js";import{i as C}from"./stores-kaIFQfXo.js";import{t as w}from"./button-DvpRpKkt.js";import{t as T}from"./input-BtoHcCl9.js";import{A as ce,M as le,b as E,j as D,k as ue,x as O}from"./index-Bj3blCRO.js";var k=e(o(),1),A=_(),j={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}},de={labelKey:`activity:techStackStatus.unknown`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:0};function M(e){return j[e]??de}var N={npm:{label:`npm / Node.js`,icon:x},python:{label:`Python`,icon:d},rust:{label:`Rust`,icon:ae},go:{label:`Go`,icon:g},dotnet:{label:`.NET`,icon:s},php:{label:`PHP`,icon:f},dart:{label:`Dart / Flutter`,icon:a},maven:{label:`Maven`,icon:u},gradle:{label:`Gradle`,icon:ie},ruby:{label:`Ruby`,icon:c},swift:{label:`Swift`,icon:b},elixir:{label:`Elixir`,icon:f},cpp:{label:`C / C++`,icon:t}},fe={labelKey:`activity:techStackStatus.unknown`};function P(e,t){let n=F(e);return n.labelKey?t(n.labelKey):n.label??e}function F(e){return N[e]??fe}function I({ecosystem:e,className:t=`size-3.5 shrink-0`}){let n=F(e);if(!n.icon)return null;let r=n.icon;return(0,A.jsx)(r,{className:t})}function pe(e){return M(e.status).weight>=50}var me=[`critical`,`high`,`medium`,`low`,`info`],L={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`}},R={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`},z={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 B(e){return z[e]??z.unsupported}function V(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 H(e){let t=V(e.locked??e.installed??e.requested),n=V(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 U(e){return e.locked??e.installed??e.requested??null}function W(e){return e.confidence<1}function G({className:e,children:t}){return(0,A.jsx)(`span`,{className:S(`inline-flex shrink-0 items-center gap-1 border px-1.5 py-0.5 text-[10px] font-medium`,e),children:t})}function K({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,A.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,A.jsx)(`p`,{className:`text-[9px] font-bold uppercase tracking-[0.16em] text-muted-foreground`,children:e}),(0,A.jsxs)(`div`,{className:`mt-1 flex items-end justify-between gap-2`,children:[(0,A.jsx)(`p`,{className:S(`font-mono text-xl font-bold tabular-nums`,i),children:t}),(0,A.jsx)(`p`,{className:`truncate text-[9px] text-muted-foreground`,children:n})]})]})}function q(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 he({dependency:e,findings:t,deepDive:r,onDeepDive:a,onBack:o,coverage:s}){let{t:c}=n(),l=M(e.status),u=U(e),d=H(e),f=s?B(s).noteKey:void 0;return(0,A.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,A.jsxs)(`header`,{className:`shrink-0 border-b border-border/70 bg-card/45 p-3`,children:[(0,A.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,A.jsx)(w,{variant:`ghost`,size:`icon`,onClick:o,"aria-label":c(`activity:techStack.backToDependencyList`),className:`shrink-0 md:hidden`,children:(0,A.jsx)(i,{className:`size-4`})}),(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,A.jsx)(`h2`,{className:`min-w-0 truncate font-mono text-sm font-bold text-foreground`,children:e.name}),(0,A.jsx)(G,{className:l.badge,children:c(l.labelKey)})]}),(0,A.jsxs)(`p`,{className:`mt-0.5 truncate text-[10px] text-muted-foreground`,children:[P(e.ecosystem,c),` ·`,` `,e.direct?`direct`:`transitive`,` · `,e.scope,` ·`,` `,e.sourceType,f&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),(0,A.jsx)(`span`,{className:`text-warning`,children:c(f)})]})]})]})]}),(0,A.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-baseline gap-2 font-mono text-xs`,children:[(0,A.jsx)(`span`,{className:`text-foreground`,children:u??`—`}),e.latestStable&&e.latestStable!==u&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,A.jsx)(`span`,{className:`text-info`,children:e.latestStable})]}),d.label&&(0,A.jsxs)(`span`,{className:`text-[10px] text-warning`,children:[`(`,d.label,`)`]})]})]}),(0,A.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:[(0,A.jsxs)(`dl`,{className:`grid grid-cols-2 gap-px border border-border/70 bg-border/60`,children:[(0,A.jsx)(J,{label:c(`activity:techStack.constraint`),value:e.requested??`—`,mono:!0}),(0,A.jsx)(J,{label:c(`activity:techStack.locked`),value:e.locked??`—`,mono:!0}),(0,A.jsx)(J,{label:c(`activity:techStack.latestStable`),value:e.latestStable??`—`,mono:!0}),(0,A.jsx)(J,{label:c(`activity:techStack.license`),value:e.license??`—`}),e.wanted&&(0,A.jsx)(J,{label:c(`activity:techStack.wanted`),value:e.wanted,mono:!0}),e.resolvable&&(0,A.jsx)(J,{label:c(`activity:techStack.resolvable`),value:e.resolvable,mono:!0}),e.purl&&(0,A.jsx)(J,{label:c(`activity:techStack.purl`),value:e.purl,mono:!0}),(0,A.jsx)(J,{label:c(`activity:techStack.registryFlags`),value:[e.deprecated&&`deprecated`,e.yanked&&`yanked`].filter(Boolean).join(`, `)||`none`})]}),(0,A.jsxs)(`section`,{className:`mt-4`,children:[(0,A.jsxs)(`div`,{className:`mb-1.5 flex flex-wrap items-center justify-between gap-2`,children:[(0,A.jsx)(`h3`,{className:`text-[9px] font-bold uppercase tracking-[0.16em] text-muted-foreground`,children:c(`activity:techStack.findings`)}),(0,A.jsxs)(w,{variant:`outline`,size:`sm`,onClick:()=>a(e),disabled:r.status===`loading`,className:`h-7 text-[10px]`,children:[r.status===`loading`?(0,A.jsx)(y,{className:`size-3 animate-spin`}):(0,A.jsx)(p,{className:`size-3`}),r.status===`loading`?`Researching…`:`Deep dive`]})]}),r.status===`error`&&r.error&&(0,A.jsx)(`p`,{role:`alert`,className:`mb-1.5 text-[10px] text-destructive`,children:r.error}),t.length===0?(0,A.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:c(`activity:techStack.nothingFlaggedRunADeepDive`)}):(0,A.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:t.map(e=>(0,A.jsxs)(`div`,{className:`border border-border/70 bg-card/40 p-2`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,A.jsx)(G,{className:L[e.severity].badge,children:c(L[e.severity].labelKey)}),(0,A.jsx)(G,{className:`border-border/70 bg-muted text-muted-foreground`,children:R[e.action]?c(R[e.action]):e.action}),W(e)&&(0,A.jsxs)(G,{className:`border-info/35 bg-info/10 text-info`,children:[(0,A.jsx)(p,{className:`size-2.5`}),`AI · `,Math.round(e.confidence*100),`%`]})]}),(0,A.jsx)(`p`,{className:`mt-1 text-[11px] leading-relaxed text-muted-foreground`,children:e.rationale}),e.breakingRisk&&(0,A.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,A.jsxs)(`section`,{className:`mt-4`,children:[(0,A.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,A.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:c(`activity:techStack.noEvidenceRecorded`)}):(0,A.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.evidence.map((t,n)=>(0,A.jsxs)(`li`,{className:`border border-border/70 bg-card/40 p-2`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,A.jsx)(G,{className:`border-border/70 bg-muted text-muted-foreground`,children:t.kind}),(0,A.jsx)(`span`,{className:`font-mono text-[9px] text-muted-foreground`,children:new Date(t.retrievedAt).toLocaleString()})]}),t.source.startsWith(`http`)?(0,A.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,A.jsx)(`span`,{className:`truncate`,children:t.source}),(0,A.jsx)(v,{className:`size-2.5 shrink-0`})]}):(0,A.jsx)(`p`,{className:`mt-1 truncate font-mono text-[10px] text-muted-foreground`,children:t.source}),t.detail&&(0,A.jsx)(`p`,{className:`mt-0.5 text-[10px] leading-relaxed text-muted-foreground`,children:t.detail})]},`${e.id}-evidence-${n}`))})]})]})]})}function J({label:e,value:t,mono:n}){return(0,A.jsxs)(`div`,{className:`bg-card/55 px-2.5 py-1.5`,children:[(0,A.jsx)(`dt`,{className:`text-[9px] font-bold uppercase tracking-[0.14em] text-muted-foreground`,children:e}),(0,A.jsx)(`dd`,{className:S(`mt-0.5 truncate text-[11px] text-foreground`,n&&`font-mono`),children:t})]})}var Y=`grid grid-cols-[minmax(0,2.2fr)_minmax(0,1.6fr)_minmax(0,1.1fr)] gap-2`;function ge({dependencies:e,selectedId:t,hasDependencies:r,coverageByWorkspaceId:i,onSelect:a}){let{t:o}=n(),s=O(e,30);return e.length===0?(0,A.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 text-center`,children:(0,A.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,A.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,A.jsxs)(`div`,{className:S(Y,`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,A.jsx)(`span`,{children:o(`activity:techStack.package`)}),(0,A.jsx)(`span`,{children:o(`activity:techStack.installedLatest`)}),(0,A.jsx)(`span`,{children:o(`activity:techStack.status`)})]}),(0,A.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,A.jsx)(l,{className:`h-full`,"aria-label":o(`activity:techStack.dependencies`),children:s.pageItems.map(e=>(0,A.jsx)(_e,{dependency:e,selected:e.id===t,coverage:i?.get(e.workspaceId),onSelect:a},e.id))})}),(0,A.jsx)(E,{page:s.page,pageSize:s.pageSize,totalItems:s.totalItems,onPageChange:s.setPage,itemLabel:`dependencies`})]})}function _e({dependency:e,selected:t,coverage:r,onSelect:i}){let{t:a}=n(),o=M(e.status),s=U(e),c=H(e),l=r?B(r).noteKey:void 0;return(0,A.jsxs)(`button`,{type:`button`,onClick:()=>i(e),"aria-current":t,className:S(Y,`w-full items-center border-b border-border/40 px-3 py-2 text-left transition-colors hover:bg-accent/40`,t&&`bg-accent/60`),children:[(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,A.jsx)(`span`,{className:S(`size-1.5 shrink-0`,o.dot),"aria-hidden":`true`}),(0,A.jsx)(`span`,{className:`truncate font-mono text-xs text-foreground`,children:e.name})]}),(0,A.jsxs)(`p`,{className:`mt-0.5 truncate text-[10px] text-muted-foreground`,children:[(0,A.jsx)(I,{ecosystem:e.ecosystem,className:`mr-0.5 inline-block size-3 align-text-bottom`}),P(e.ecosystem,a),` · `,e.direct?`direct`:`transitive`,` · `,e.scope,l&&(0,A.jsxs)(A.Fragment,{children:[` · `,(0,A.jsx)(`span`,{className:`text-warning`,children:a(l)})]})]})]}),(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-1.5 font-mono text-[11px]`,children:[(0,A.jsx)(`span`,{className:`truncate text-foreground`,children:s??`—`}),e.latestStable&&e.latestStable!==s&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`→`}),(0,A.jsx)(`span`,{className:`truncate text-info`,children:e.latestStable})]})]}),c.label?(0,A.jsx)(`p`,{className:`mt-0.5 truncate text-[10px] text-warning`,children:c.label}):e.requested&&(0,A.jsx)(`p`,{className:`mt-0.5 truncate font-mono text-[10px] text-muted-foreground`,children:e.requested})]}),(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1`,children:[(0,A.jsx)(G,{className:o.badge,children:a(o.labelKey)}),e.deprecated&&(0,A.jsx)(G,{className:`border-destructive/35 bg-destructive/10 text-destructive`,children:`dep`}),e.yanked&&(0,A.jsx)(G,{className:`border-destructive/45 bg-destructive/15 text-destructive`,children:`yank`})]})]})}function ve({findings:e,dependenciesById:t,onSelectDependency:r}){let{t:i}=n(),a=O(e,20);if(e.length===0)return(0,A.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 text-center`,children:(0,A.jsxs)(`p`,{className:`max-w-sm text-xs text-muted-foreground`,children:[i(`activity:techStack.noFindingsRun`),` `,(0,A.jsx)(`span`,{className:`font-mono text-foreground`,children:i(`activity:techStack.analyze`)}),` `,i(`activity:techStack.toCheckVersionsAndAdvisoriesAgainst`)]})});let o=me.map(e=>[e,a.pageItems.filter(t=>t.severity===e)]).filter(([,e])=>e.length>0);return(0,A.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,A.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:(0,A.jsx)(`div`,{className:`flex flex-col gap-4`,children:o.map(([e,n])=>(0,A.jsxs)(`section`,{children:[(0,A.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-2`,children:[(0,A.jsx)(G,{className:L[e].badge,children:i(L[e].labelKey)}),(0,A.jsx)(`span`,{className:`font-mono text-[10px] tabular-nums text-muted-foreground`,children:n.length})]}),(0,A.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:n.map(e=>(0,A.jsx)(ye,{finding:e,dependency:t.get(e.dependencyId),onSelectDependency:r},e.id))})]},e))})}),(0,A.jsx)(E,{page:a.page,pageSize:a.pageSize,totalItems:a.totalItems,onPageChange:a.setPage,itemLabel:`findings`})]})}function ye({finding:e,dependency:t,onSelectDependency:r}){let{t:i}=n(),a=W(e);return(0,A.jsxs)(`div`,{className:`border border-border/70 bg-card/40 p-2.5`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,A.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:t?.name??e.dependencyId}),(0,A.jsx)(G,{className:`border-border/70 bg-muted text-muted-foreground`,children:R[e.action]?i(R[e.action]):e.action}),a&&(0,A.jsxs)(G,{className:`border-info/35 bg-info/10 text-info`,children:[(0,A.jsx)(p,{className:`size-2.5`}),`AI · `,Math.round(e.confidence*100),`%`]})]}),(0,A.jsx)(`p`,{className:`mt-1.5 text-[11px] leading-relaxed text-muted-foreground`,children:e.rationale}),e.breakingRisk&&(0,A.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,A.jsx)(`ul`,{className:S(`mt-1.5 flex flex-col gap-0.5`),children:e.evidence.slice(0,4).map((t,n)=>(0,A.jsx)(`li`,{className:`min-w-0 truncate text-[10px]`,children:t.source.startsWith(`http`)?(0,A.jsx)(`a`,{href:t.source,target:`_blank`,rel:`noreferrer noopener`,className:`text-info underline-offset-2 hover:underline`,children:t.detail??t.source}):(0,A.jsx)(`span`,{className:`text-muted-foreground`,children:t.detail??t.source})},`${e.id}-${n}`))})]})}function be({searchQuery:e,ecosystemFilter:t,statusFilter:i,directOnly:a,sort:o,hasFilters:s,ecosystems:c,statuses:l,visibleCount:u,totalCount:d,onSearchChange:f,onEcosystemFilterChange:ee,onStatusFilterChange:p,onToggleDirectOnly:te,onSortChange:ne,onClearFilters:h}){let{t:g}=n();return(0,A.jsxs)(`div`,{className:`shrink-0 space-y-2 border-b border-border/70 bg-card/45 p-3`,children:[(0,A.jsxs)(`div`,{className:`flex gap-2`,children:[(0,A.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,A.jsx)(m,{className:`pointer-events-none absolute left-3 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,A.jsx)(T,{"aria-label":g(`activity:techStack.searchDependencies`),value:e,onChange:e=>f(e.target.value),placeholder:g(`activity:techStack.searchByPackageName`),className:`h-10 min-w-0 bg-background pl-9 pr-8 text-xs`}),e&&(0,A.jsx)(`button`,{type:`button`,"aria-label":g(`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,A.jsx)(re,{className:`size-3.5`})})]}),(0,A.jsx)(w,{variant:a?`default`:`outline`,size:`sm`,onClick:te,"aria-pressed":a,title:g(`activity:techStack.showOnlyDependenciesThisProjectDeclaresItself`),className:`shrink-0`,children:g(`activity:techStack.directOnly`)}),s&&(0,A.jsx)(w,{variant:`ghost`,size:`icon`,onClick:h,"aria-label":g(`activity:techStack.clearAllFilters`),title:g(`activity:techStack.clearAllFilters`),className:`shrink-0`,children:(0,A.jsx)(r,{className:`size-4`})})]}),(0,A.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`label`,{className:`sr-only`,htmlFor:`techstack-ecosystem-filter`,children:g(`activity:techStack.filterByEcosystem`)}),(0,A.jsxs)(`select`,{id:`techstack-ecosystem-filter`,value:t,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,A.jsx)(`option`,{value:`all`,children:g(`activity:techStack.allEcosystems`)}),c.map(([e,t])=>(0,A.jsxs)(`option`,{value:e,children:[P(e,g),` · `,t]},e))]})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`label`,{className:`sr-only`,htmlFor:`techstack-status-filter`,children:g(`activity:techStack.filterByStatus`)}),(0,A.jsxs)(`select`,{id:`techstack-status-filter`,value:i,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,A.jsx)(`option`,{value:`all`,children:g(`activity:techStack.allStatuses`)}),l.map(([e,t])=>(0,A.jsxs)(`option`,{value:e,children:[g(M(e).labelKey),` · `,t]},e))]})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`label`,{className:`sr-only`,htmlFor:`techstack-sort`,children:g(`activity:techStack.sortDependencies`)}),(0,A.jsxs)(`select`,{id:`techstack-sort`,value:o,onChange:e=>ne(e.target.value),className:`h-9 w-full min-w-0 border border-input bg-background px-2 text-xs`,children:[(0,A.jsx)(`option`,{value:`attention`,children:g(`activity:techStack.sortNeedsAttention`)}),(0,A.jsx)(`option`,{value:`drift`,children:g(`activity:techStack.sortMostOutOfDate`)}),(0,A.jsx)(`option`,{value:`name`,children:g(`activity:techStack.sortName`)})]})]})]}),(0,A.jsx)(`p`,{className:S(`text-[10px] text-muted-foreground`,s&&`text-info`),children:u===d?`${d} dependencies`:`${u} of ${d} dependencies`})]})}var xe=[{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`}],X=new Set([`npm`,`python`,`rust`,`go`,`php`,`dotnet`]);function Z(){let{t:e}=n(),t=C(e=>e.snapshot),r=C(e=>e.stale),i=C(e=>e.loading),a=C(e=>e.error),o=C(e=>e.activeJob),[s,c]=(0,k.useState)(`dependencies`),[l,u]=(0,k.useState)(``),[d,f]=(0,k.useState)(`all`),[m,h]=(0,k.useState)(`all`),[g,_]=(0,k.useState)(!1),[v,ie]=(0,k.useState)(`attention`),[b,x]=(0,k.useState)(null),[T,E]=(0,k.useState)([]),[O,j]=(0,k.useState)({status:`idle`,error:null}),[de,N]=(0,k.useState)(null),[fe,P]=(0,k.useState)(null),[F,I]=(0,k.useState)(new Set),[me,L]=(0,k.useState)(!1),R=(0,k.useCallback)(async()=>{let e=C.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))}},[]),z=(0,k.useCallback)(async e=>{let t=C.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))}},[]),B=(0,k.useCallback)(async()=>{let e=C.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}`);C.getState().jobCancelled(e.id)}catch(e){C.getState().setError(e instanceof Error?e.message:String(e))}},[]),V=(0,k.useCallback)(async e=>{j({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}`);E(n.findings??[]),j({status:`idle`,error:null})}catch(e){j({status:`error`,error:e instanceof Error?e.message:String(e)})}},[]);(0,k.useEffect)(()=>{R()},[R]),(0,k.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&&N(t.trend),t.plan&&P(t.plan)}).catch(e=>C.getState().setError(e instanceof Error?e.message:String(e)))},[s,t?.id]);let U=(0,k.useCallback)(async()=>{if(F.size!==0){L(!0);try{let e=await fetch(`/api/techstack/remediation/apply`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({approvedItems:[...F]})}),t=await e.json();if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);I(new Set),await z(`inventory`)}catch(e){C.getState().setError(e instanceof Error?e.message:String(e))}finally{L(!1)}}},[F,z]);(0,k.useEffect)(()=>{E([]),j({status:`idle`,error:null})},[t?.id]);let W=(0,k.useMemo)(()=>t?.dependencies??[],[t]),G=(0,k.useMemo)(()=>t?.findings??[],[t]),J=(0,k.useMemo)(()=>new Map(W.map(e=>[e.id,e])),[W]),Y=(0,k.useMemo)(()=>Ee(W.map(e=>e.ecosystem)),[W]),_e=(0,k.useMemo)(()=>Ee(W.map(e=>e.status)),[W]),ye=(0,k.useMemo)(()=>new Map(t?.workspaces.map(e=>[e.id,e.coverage])??[]),[t]),X=(0,k.useMemo)(()=>{let e=l.trim().toLowerCase(),t=[...W.filter(t=>!(e&&!t.name.toLowerCase().includes(e)||d!==`all`&&t.ecosystem!==d||m!==`all`&&t.status!==m||g&&!t.direct))];return v===`name`?t.sort((e,t)=>e.name.localeCompare(t.name)):v===`drift`?t.sort((e,t)=>H(t).majorsBehind-H(e).majorsBehind||e.name.localeCompare(t.name)):t.sort((e,t)=>M(t.status).weight-M(e.status).weight||Number(t.direct)-Number(e.direct)||e.name.localeCompare(t.name)),t},[W,l,d,m,g,v]),Z=b?J.get(b):void 0,De=(0,k.useMemo)(()=>Z?[...G.filter(e=>e.dependencyId===Z.id),...T.filter(e=>e.dependencyId===Z.id)]:[],[G,T,Z]),Oe=(0,k.useMemo)(()=>W.filter(pe).length,[W]),ke=(0,k.useMemo)(()=>W.filter(e=>H(e).majorsBehind>0).length,[W]),Ae=(0,k.useMemo)(()=>W.filter(e=>e.status===`vulnerable`).length,[W]),je=l.trim()!==``||d!==`all`||m!==`all`||g,Me=(0,k.useCallback)(()=>{u(``),f(`all`),h(`all`),_(!1)},[]),$=!!(o&&![`completed`,`failed`,`cancelled`].includes(o.status)),Ne=(0,k.useCallback)(e=>{x(e),c(`dependencies`)},[]);return(0,A.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,A.jsx)(`header`,{className:`shrink-0 border-b border-border/70 px-4 py-3`,children:(0,A.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,A.jsx)(`h1`,{className:`text-base font-bold sm:text-lg`,children:e(`activity:techStack.techstack`)}),(0,A.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:t?`${t.workspaces.length} workspaces`:`no scan yet`}),r&&(0,A.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,A.jsx)(`p`,{className:`mt-0.5 truncate text-[10px] text-muted-foreground sm:text-xs`,children:t?`${t.targetRoot} · scanned ${new Date(t.createdAt).toLocaleString()}`:`Scan the open project to inventory its dependencies.`})]}),(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,A.jsxs)(w,{variant:`outline`,size:`sm`,onClick:()=>void z(`inventory`),disabled:$,title:e(`activity:techStack.offlineReReadManifestsAndLockfiles`),children:[(0,A.jsx)(se,{className:S(`size-3.5`,$&&`animate-spin`)}),(0,A.jsx)(`span`,{className:`hidden sm:inline`,children:e(`activity:techStack.refresh`)})]}),(0,A.jsxs)(w,{size:`sm`,onClick:()=>void z(`analyze`),disabled:$,title:e(`activity:techStack.checkRegistriesAndAdvisoriesThenInterpretTheResultsWithTheModel`),children:[(0,A.jsx)(p,{className:`size-3.5`}),e(`activity:techStack.analyze`)]}),$&&(0,A.jsx)(w,{variant:`ghost`,size:`icon`,onClick:()=>void B(),"aria-label":e(`activity:techStack.cancelJob`),children:(0,A.jsx)(re,{className:`size-4`})}),(0,A.jsxs)(ue,{children:[(0,A.jsx)(le,{asChild:!0,children:(0,A.jsx)(w,{variant:`ghost`,size:`icon`,disabled:!t,"aria-label":e(`activity:techStack.exportOptions`),title:e(`activity:techStack.exportOptions`),children:(0,A.jsx)(oe,{className:`size-4`})})}),(0,A.jsxs)(ce,{align:`end`,className:`w-60`,children:[(0,A.jsxs)(D,{onClick:()=>t&&q(t,`json`),children:[(0,A.jsx)(ne,{className:`mr-2 size-4`}),e(`activity:techStack.exportSnapshotAsJson`)]}),(0,A.jsxs)(D,{onClick:()=>t&&q(t,`spdx`),children:[(0,A.jsx)(ae,{className:`mr-2 size-4`}),e(`activity:techStack.exportSbomSpdx`)]}),(0,A.jsxs)(D,{onClick:()=>t&&q(t,`cyclonedx`),children:[(0,A.jsx)(te,{className:`mr-2 size-4`}),e(`activity:techStack.exportSbomCycloneDx`)]}),(0,A.jsxs)(D,{onClick:()=>t&&q(t,`md`),children:[(0,A.jsx)(ee,{className:`mr-2 size-4`}),e(`activity:techStack.exportReportMd`)]})]})]})]})]})}),t&&(0,A.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,A.jsx)(K,{label:e(`activity:techStack.dependencies`),value:W.length,hint:`${X.length} visible`}),(0,A.jsx)(K,{label:e(`activity:techStack.outdated`),value:ke,hint:e(`activity:techStack.majorsBehind`),tone:ke>0?`warning`:`success`}),(0,A.jsx)(K,{label:e(`activity:techStack.vulnerable`),value:Ae,hint:e(`activity:techStack.knownAdvisories`),tone:Ae>0?`destructive`:`success`}),(0,A.jsx)(K,{label:e(`activity:techStack.findings`),value:G.length,hint:`${Oe} need attention`,tone:G.length>0?`info`:`default`})]}),($||a)&&(0,A.jsxs)(`div`,{className:`shrink-0 border-b border-border/70 px-4 py-2`,"aria-live":`polite`,children:[$&&o&&(0,A.jsxs)(`div`,{role:`status`,className:`flex items-center gap-2 text-xs text-info`,children:[(0,A.jsx)(y,{className:`size-3.5 animate-spin`}),(0,A.jsx)(`span`,{className:`font-mono`,children:o.status}),o.progress&&(0,A.jsxs)(`span`,{className:`text-muted-foreground`,children:[o.progress.completed,`/`,o.progress.total]})]}),a&&(0,A.jsxs)(`div`,{role:`alert`,className:`flex items-center gap-2 text-xs text-destructive`,children:[(0,A.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:a}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>void R(),className:`underline`,children:e(`activity:techStack.retry`)})]})]}),i&&!t?(0,A.jsx)(Q,{}):t?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`nav`,{className:`flex shrink-0 gap-1 border-b border-border/70 px-2`,children:xe.map(t=>(0,A.jsxs)(`button`,{type:`button`,onClick:()=>c(t.id),"aria-current":s===t.id,className:S(`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`&&G.length>0&&(0,A.jsx)(`span`,{className:`ml-1.5 font-mono text-[10px] tabular-nums text-muted-foreground`,children:G.length})]},t.id))}),s===`dependencies`&&(0,A.jsxs)(`div`,{className:`grid min-h-0 flex-1 md:grid-cols-[minmax(340px,1fr)_minmax(0,1.15fr)]`,children:[(0,A.jsxs)(`section`,{className:S(`min-h-0 border-r border-border/70`,Z?`hidden md:flex md:flex-col`:`flex flex-col`),"aria-label":e(`activity:techStack.dependencyList`),children:[(0,A.jsx)(be,{searchQuery:l,ecosystemFilter:d,statusFilter:m,directOnly:g,sort:v,hasFilters:je,ecosystems:Y,statuses:_e,visibleCount:X.length,totalCount:W.length,onSearchChange:u,onEcosystemFilterChange:f,onStatusFilterChange:h,onToggleDirectOnly:()=>_(e=>!e),onSortChange:ie,onClearFilters:Me}),(0,A.jsx)(ge,{dependencies:X,selectedId:b,hasDependencies:W.length>0,coverageByWorkspaceId:ye,onSelect:e=>x(e.id)})]}),(0,A.jsx)(`section`,{className:S(`min-h-0`,Z?`flex flex-col`:`hidden md:flex md:flex-col`),"aria-label":e(`activity:techStack.dependencyDetail`),children:Z?(0,A.jsx)(he,{dependency:Z,findings:De,deepDive:O,onDeepDive:V,onBack:()=>x(null),coverage:ye.get(Z.workspaceId)}):(0,A.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 text-center`,children:(0,A.jsx)(`p`,{className:`max-w-xs text-xs text-muted-foreground`,children:e(`activity:techStack.selectADependencyToSeeIts`)})})})]}),s===`findings`&&(0,A.jsx)(ve,{findings:G,dependenciesById:J,onSelectDependency:Ne}),s===`workspaces`&&(0,A.jsx)(we,{snapshot:t}),s===`trends`&&(0,A.jsx)(Se,{trend:de}),s===`remediation`&&(0,A.jsx)(Ce,{plan:fe,approved:F,applying:me,onToggle:e=>I(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),onApply:()=>void U()})]}):(0,A.jsx)(Te,{onScan:()=>void z(`inventory`),disabled:$})]})}function Se({trend:e}){return e?(0,A.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:[(0,A.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,A.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:e.points.map(e=>(0,A.jsxs)(`div`,{className:`grid grid-cols-4 border border-border/70 bg-card/40 p-2 text-xs`,children:[(0,A.jsx)(`span`,{children:new Date(e.createdAt).toLocaleDateString()}),(0,A.jsxs)(`span`,{children:[e.dependencies,` deps`]}),(0,A.jsxs)(`span`,{className:`text-warning`,children:[e.outdated,` outdated`]}),(0,A.jsxs)(`span`,{className:`text-destructive`,children:[e.vulnerable,` vulnerable`]})]},e.snapshotId))})]}):(0,A.jsx)(Q,{})}function Ce({plan:e,approved:t,applying:r,onToggle:i,onApply:a}){let{t:o}=n();return e?(0,A.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:[(0,A.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.warning}),(0,A.jsxs)(w,{size:`sm`,disabled:t.size===0||r,onClick:a,children:[r&&(0,A.jsx)(y,{className:`size-3.5 animate-spin`}),`Apply `,t.size>0?t.size:``]})]}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e.items.map(e=>{let n=`${e.workspaceId}:${e.ecosystem}:${e.dependencyName}:${e.action}`,r=e.action===`replace`||e.action===`investigate`||!X.has(e.ecosystem);return(0,A.jsxs)(`label`,{className:S(`flex gap-3 border border-border/70 bg-card/40 p-2.5`,r?`cursor-not-allowed opacity-65`:`cursor-pointer`),children:[(0,A.jsx)(`input`,{type:`checkbox`,disabled:r,checked:t.has(n),onChange:()=>i(n)}),(0,A.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`span`,{className:`block font-mono text-xs`,children:[e.dependencyName,` · `,e.action]}),(0,A.jsxs)(`span`,{className:`block text-[10px] text-muted-foreground`,children:[e.currentVersion??`?`,` → `,e.targetVersion??`latest`,` · `,e.rationale]}),r&&(0,A.jsx)(`span`,{className:`block text-[10px] text-warning`,children:o(`activity:techStack.requiresAManualPackageChoice`)})]})]},n)}),e.items.length===0&&(0,A.jsx)(`p`,{className:`p-8 text-center text-xs text-muted-foreground`,children:o(`activity:techStack.noRemediationNeeded`)})]})]}):(0,A.jsx)(Q,{})}function we({snapshot:e}){let{t}=n(),r=(0,k.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,A.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8`,children:(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t(`activity:techStack.noWorkspacesDetected`)})}):(0,A.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:(0,A.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:e.workspaces.map(e=>{let n=z[e.coverage];return(0,A.jsxs)(`div`,{className:`border border-border/70 bg-card/40 p-2.5`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`p`,{className:`truncate font-mono text-xs text-foreground`,children:e.relativeRoot}),(0,A.jsxs)(`p`,{className:`mt-0.5 flex items-center gap-1 truncate text-[10px] text-muted-foreground`,children:[(0,A.jsx)(I,{ecosystem:e.ecosystem}),(0,A.jsx)(`span`,{children:P(e.ecosystem,t)}),e.packageManager?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,A.jsx)(`span`,{children:e.packageManager})]}):null,(0,A.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,A.jsxs)(`span`,{children:[r.get(e.id)??0,` deps`]})]})]}),(0,A.jsx)(`span`,{className:S(`shrink-0 border px-1.5 py-0.5 text-[10px] font-medium`,n.badge),children:t(n.labelKey)})]}),e.manifests.length>0&&(0,A.jsx)(`div`,{className:`mt-1.5 flex flex-wrap gap-1`,children:e.manifests.map(e=>(0,A.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 Q(){let{t:e}=n();return(0,A.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,A.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,A.jsx)(y,{className:`size-5 animate-spin text-muted-foreground`}),(0,A.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`activity:techStack.loadingSnapshot`)})]})})}function Te({onScan:e,disabled:t}){let{t:r}=n(),i=(0,k.useMemo)(()=>Object.values(N).map(e=>e.label??``).filter(Boolean).join(`, `),[]);return(0,A.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8`,children:(0,A.jsxs)(`div`,{className:`flex max-w-md flex-col items-center gap-3 text-center`,children:[(0,A.jsx)(`div`,{className:`flex size-14 items-center justify-center border border-info/25 bg-info/5 text-info`,children:(0,A.jsx)(h,{className:`size-6`})}),(0,A.jsx)(`h2`,{className:`text-sm font-semibold`,children:r(`activity:techStack.noInventoryYet`)}),(0,A.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,A.jsxs)(w,{size:`sm`,onClick:e,disabled:t,children:[(0,A.jsx)(se,{className:S(`size-3.5`,t&&`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{Z 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-C_zEzV4N.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-C_zEzV4N.js";import"./i18n-CcHSmDoO.js";import{t as u}from"./ws-client-BVq0hf0a.js";import{n as d,t as f}from"./utils-tsZEnrBH.js";import{t as p}from"./session-store-BgiP4PnQ.js";import{I as m}from"./stores-kaIFQfXo.js";import{n as h}from"./ui-store-xx1NssJI.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-C_zEzV4N.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-C_zEzV4N.js";import"./i18n-CcHSmDoO.js";import{n as d,t as f}from"./utils-tsZEnrBH.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};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/activity-DFBPo9d3.js","assets/rolldown-runtime-hePW80VL.js","assets/chat-CzaGXz_W.js","assets/commandPalette-BovBiPec.js","assets/common-BBHmIHQW.js","assets/settings-
|
|
2
|
-
import{Ha as e,Ra as t,Ua as n,Va as r,za as i}from"./vendor-C_zEzV4N.js";import{t as a}from"./activity-DFBPo9d3.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-ZtdXzV5f.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:{}},x=i()(t(e=>({...b,set:t=>e(t),reset:()=>e(b)}),{name:`wrongstack-local-prefs`,version:15,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.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-BCIzGgqa.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-xB2OG18R.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-DFBPo9d3.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-ZtdXzV5f.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-CnuG3uZL.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-CcZ8Byag.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-BZIZDVJp.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-DmEF3l3H.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-ChTE_hao.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-xIdfpBZZ.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-K2WIjlQo.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-Evj_2PTQ.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-CQqsspgO.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-fv8qo7sz.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};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/activity-DFBPo9d3.js","assets/rolldown-runtime-hePW80VL.js","assets/chat-CzaGXz_W.js","assets/commandPalette-BovBiPec.js","assets/common-BBHmIHQW.js","assets/settings-DijFr-kZ.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-C_zEzV4N.js";import{t as a}from"./activity-DFBPo9d3.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-DijFr-kZ.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:{}},x=i()(t(e=>({...b,set:t=>e(t),reset:()=>e(b)}),{name:`wrongstack-local-prefs`,version:15,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.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-BCIzGgqa.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-L9mLQIIP.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-DFBPo9d3.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-DijFr-kZ.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-CnuG3uZL.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-50uwXQIW.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-BZIZDVJp.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-BmJI-gam.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-ChTE_hao.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-CqFe8Jtz.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-K2WIjlQo.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-DeM0wvCG.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-CQqsspgO.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-BPT8LWkU.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};
|