blade-code 0.10.83 → 0.10.85
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/blade.js +2 -2
- package/dist/{chunk-8215sm79.js → chunk-0nsrw84g.js} +1 -1
- package/dist/{chunk-t5ysd5z8.js → chunk-1gv7095w.js} +1 -1
- package/dist/{chunk-xepdd9yj.js → chunk-1jyr0t4q.js} +1 -1
- package/dist/{chunk-bd5e1n5z.js → chunk-1khv7fp2.js} +1 -1
- package/dist/{chunk-r4mjdkzv.js → chunk-1q3z3ryy.js} +1 -1
- package/dist/{chunk-t6phsb5h.js → chunk-21rjwgc2.js} +1 -1
- package/dist/{chunk-m0a75642.js → chunk-72th07qj.js} +1 -1
- package/dist/{chunk-aqkexfag.js → chunk-7md9r31q.js} +1 -1
- package/dist/{chunk-xp3ad15c.js → chunk-7ne59gra.js} +1 -1
- package/dist/{chunk-hqsqk5dp.js → chunk-7qa8rfmy.js} +1 -1
- package/dist/{chunk-69rpb78b.js → chunk-7wjqw574.js} +1 -1
- package/dist/{chunk-mgtcjwhy.js → chunk-99h419nm.js} +1 -1
- package/dist/{chunk-q14mgye7.js → chunk-9ye1s8tj.js} +1 -1
- package/dist/{chunk-d4k4v959.js → chunk-a0nb3aad.js} +1 -1
- package/dist/{chunk-73j10ezs.js → chunk-ax95qw8w.js} +1 -1
- package/dist/{chunk-k50z8903.js → chunk-bvzzq0jb.js} +1 -1
- package/dist/{chunk-fs9j9gas.js → chunk-c7sx7pa4.js} +1 -1
- package/dist/{chunk-js3j00ka.js → chunk-cxe0ghk2.js} +1 -1
- package/dist/{chunk-1htd858b.js → chunk-d7v34g3f.js} +2 -2
- package/dist/{chunk-4pksah0q.js → chunk-fevtj34k.js} +1 -1
- package/dist/{chunk-zp27f256.js → chunk-ff5y1ba2.js} +1 -1
- package/dist/{chunk-g832dwdm.js → chunk-h1gapq0a.js} +1 -1
- package/dist/{chunk-4rq0jhf4.js → chunk-hm782j80.js} +1 -1
- package/dist/{chunk-mq2nx77s.js → chunk-htt5c847.js} +1 -1
- package/dist/{chunk-a14vnxrf.js → chunk-jw8zwqyg.js} +1 -1
- package/dist/{chunk-r51ds5qw.js → chunk-knwa4gmn.js} +1 -1
- package/dist/chunk-kvk1bbqj.js +1 -0
- package/dist/{chunk-qb242y47.js → chunk-kzzzzymt.js} +1 -1
- package/dist/{chunk-p9a3d507.js → chunk-mhq9p8mm.js} +1 -1
- package/dist/{chunk-xy67pj74.js → chunk-ppyqrdqc.js} +3 -3
- package/dist/{chunk-fkwfymb6.js → chunk-q4c1nv7m.js} +1 -1
- package/dist/{chunk-cchk5xrs.js → chunk-rg3bvddy.js} +1 -1
- package/dist/{chunk-rmqksw1e.js → chunk-syg4pnbr.js} +1 -1
- package/dist/{chunk-3p808rrt.js → chunk-tbbc90bs.js} +1 -1
- package/dist/{chunk-2b7zryg3.js → chunk-xkb0zrjj.js} +1 -1
- package/dist/{chunk-xzgqyzmy.js → chunk-y8fswz6h.js} +35 -35
- package/dist/chunk-znv9g3mt.js +1 -0
- package/dist/web/assets/{ChatView-DRn47Y3l.js → ChatView-DMPNX1fC.js} +3 -3
- package/dist/web/assets/{CodeBlockHighlighter-DxATdO6i.js → CodeBlockHighlighter-DeJNC14V.js} +1 -1
- package/dist/web/assets/FilePreview-qWMpc2P_.js +8 -0
- package/dist/web/assets/{KanbanBoard-DEUuLh0H.js → KanbanBoard-DvHAwhcw.js} +1 -1
- package/dist/web/assets/{MarkdownRenderer-BA9VgOyM.js → MarkdownRenderer-BY51R1Fj.js} +3 -3
- package/dist/web/assets/{SettingsModal-CXq3qDgQ.js → SettingsModal-CZGKcV1S.js} +1 -1
- package/dist/web/assets/{TaskSwitcher-CUcZEUQH.js → TaskSwitcher-DgeqVRAB.js} +1 -1
- package/dist/web/assets/{TerminalPanel-CcC6f3H_.js → TerminalPanel-KOLgH_tg.js} +1 -1
- package/dist/web/assets/index-BNeDPN7E.css +1 -0
- package/dist/web/assets/{index-CfVQVVVI.js → index-DHX-G3RT.js} +4 -4
- package/dist/web/assets/{teamService-BX1zdQBb.js → teamService-Bxs4R7Al.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/chunk-mbt25rs5.js +0 -1
- package/dist/chunk-znhjr51w.js +0 -1
- package/dist/web/assets/FilePreview-D21mo4fn.js +0 -8
- package/dist/web/assets/index-8G4ejlcH.css +0 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DI8ZWdWH.js","assets/vendor-react-DG5dkZ_t.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{j as R,l as er,t as O,u as _,b as nt,a as U,s as J,O as Pe,k as tr,n as rr,_ as nr}from"./index-DHX-G3RT.js";import{r as o,j as e}from"./vendor-react-DG5dkZ_t.js";import{aj as sr,al as ar,a as or,r as st,J as ir,$ as cr,L as We,l as _e,a5 as lr,as as dr,z as yt,n as wt,t as jt,d as ur,ar as fr,R as hr,X as pr}from"./vendor-icons-DovdPN7M.js";import"./vendor-radix-DXRuAJHH.js";import"./session-events-Bgir_Gl_.js";const Nt=o.createContext(null);function Et(r){const t=o.useContext(Nt);if(!t)throw new Error(`${r} must be used within <Tabs>`);return t}function mr({value:r,onValueChange:t,className:s,children:a}){const c=o.useMemo(()=>({value:r,setValue:t}),[r,t]);return e.jsx(Nt.Provider,{value:c,children:e.jsx("div",{className:s,children:a})})}function xr({className:r,children:t}){return e.jsx("div",{role:"tablist",className:R("inline-flex items-center",r),children:t})}function ce({value:r,className:t,children:s}){const{value:a,setValue:c}=Et("TabsTrigger"),i=a===r;return e.jsx("button",{type:"button",role:"tab","aria-selected":i,"data-state":i?"active":"inactive",onClick:()=>c(r),className:R("inline-flex items-center justify-center whitespace-nowrap rounded-sm transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[hsl(var(--deck-accent))]",t),children:s})}function le({value:r,className:t,children:s,forceMount:a=!1}){const{value:c}=Et("TabsContent"),i=c===r;return!i&&!a?null:e.jsx("div",{role:"tabpanel",hidden:!i,className:t,children:s})}const br={"ayu-dark":{background:{primary:"#0f1419",secondary:"#14191f"},text:{primary:"#e6e1cf",secondary:"#bae67e",muted:"#5c6773"},border:{light:"#2d323b"},syntax:{comment:"#5c6773",string:"#bae67e",number:"#ffcc66",keyword:"#ff8f40",function:"#73d0ff",variable:"#e6e1cf",operator:"#f29e74",type:"#73d0ff",tag:"#ff8f40",attr:"#ffd580",default:"#e6e1cf"}},dracula:{background:{primary:"#282a36",secondary:"#44475a"},text:{primary:"#f8f8f2",secondary:"#f1fa8c",muted:"#6272a4"},border:{light:"#44475a"},syntax:{comment:"#6272a4",string:"#f1fa8c",number:"#bd93f9",keyword:"#ff79c6",function:"#50fa7b",variable:"#f8f8f2",operator:"#ff79c6",type:"#8be9fd",tag:"#ff79c6",attr:"#50fa7b",default:"#f8f8f2"}},monokai:{background:{primary:"#272822",secondary:"#3e3d32"},text:{primary:"#f8f8f2",secondary:"#e6db74",muted:"#75715e"},border:{light:"#3e3d32"},syntax:{comment:"#75715e",string:"#e6db74",number:"#ae81ff",keyword:"#f92672",function:"#a6e22e",variable:"#f8f8f2",operator:"#f92672",type:"#66d9ef",tag:"#f92672",attr:"#a6e22e",default:"#f8f8f2"}},nord:{background:{primary:"#2e3440",secondary:"#3b4252"},text:{primary:"#eceff4",secondary:"#d8dee9",muted:"#4c566a"},border:{light:"#434c5e"},syntax:{comment:"#616e88",string:"#a3be8c",number:"#b48ead",keyword:"#81a1c1",function:"#88c0d0",variable:"#d8dee9",operator:"#81a1c1",type:"#8fbcbb",tag:"#81a1c1",attr:"#8fbcbb",default:"#eceff4"}},"solarized-light":{background:{primary:"#fdf6e3",secondary:"#eee8d5"},text:{primary:"#586e75",secondary:"#657b83",muted:"#93a1a1"},border:{light:"#eee8d5"},syntax:{comment:"#93a1a1",string:"#2aa198",number:"#d33682",keyword:"#859900",function:"#268bd2",variable:"#657b83",operator:"#859900",type:"#b58900",tag:"#268bd2",attr:"#93a1a1",default:"#657b83"}},"solarized-dark":{background:{primary:"#002b36",secondary:"#073642"},text:{primary:"#839496",secondary:"#93a1a1",muted:"#586e75"},border:{light:"#073642"},syntax:{comment:"#586e75",string:"#2aa198",number:"#d33682",keyword:"#859900",function:"#268bd2",variable:"#839496",operator:"#859900",type:"#b58900",tag:"#268bd2",attr:"#93a1a1",default:"#839496"}},"tokyo-night":{background:{primary:"#1a1b26",secondary:"#292e42"},text:{primary:"#a9b1d6",secondary:"#c0caf5",muted:"#565f89"},border:{light:"#292e42"},syntax:{comment:"#565f89",string:"#9ece6a",number:"#ff9e64",keyword:"#bb9af7",function:"#7aa2f7",variable:"#c0caf5",operator:"#89ddff",type:"#7dcfff",tag:"#f7768e",attr:"#7aa2f7",default:"#a9b1d6"}},github:{background:{primary:"#ffffff",secondary:"#f6f8fa"},text:{primary:"#24292f",secondary:"#57606a",muted:"#6e7781"},border:{light:"#d0d7de"},syntax:{comment:"#6e7781",string:"#0a3069",number:"#0550ae",keyword:"#cf222e",function:"#8250df",variable:"#24292f",operator:"#cf222e",type:"#0550ae",tag:"#116329",attr:"#0550ae",default:"#24292f"}},gruvbox:{background:{primary:"#282828",secondary:"#3c3836"},text:{primary:"#ebdbb2",secondary:"#d5c4a1",muted:"#928374"},border:{light:"#3c3836"},syntax:{comment:"#928374",string:"#b8bb26",number:"#d3869b",keyword:"#fb4934",function:"#b8bb26",variable:"#ebdbb2",operator:"#fe8019",type:"#fabd2f",tag:"#fb4934",attr:"#fabd2f",default:"#ebdbb2"}},"one-dark":{background:{primary:"#282c34",secondary:"#21252b"},text:{primary:"#abb2bf",secondary:"#e5c07b",muted:"#5c6370"},border:{light:"#3e4451"},syntax:{comment:"#5c6370",string:"#98c379",number:"#d19a66",keyword:"#c678dd",function:"#61afef",variable:"#e06c75",operator:"#56b6c2",type:"#e5c07b",tag:"#e06c75",attr:"#d19a66",default:"#abb2bf"}},catppuccin:{background:{primary:"#1e1e2e",secondary:"#313244"},text:{primary:"#cdd6f4",secondary:"#f5e0dc",muted:"#6c7086"},border:{light:"#313244"},syntax:{comment:"#6c7086",string:"#a6e3a1",number:"#fab387",keyword:"#cba6f7",function:"#89b4fa",variable:"#f5e0dc",operator:"#89dceb",type:"#f9e2af",tag:"#f38ba8",attr:"#f9e2af",default:"#cdd6f4"}},"rose-pine":{background:{primary:"#191724",secondary:"#1f1d2e"},text:{primary:"#e0def4",secondary:"#908caa",muted:"#6e6a86"},border:{light:"#26233a"},syntax:{comment:"#6e6a86",string:"#f6c177",number:"#ebbcba",keyword:"#c4a7e7",function:"#9ccfd8",variable:"#e0def4",operator:"#31748f",type:"#eb6f92",tag:"#eb6f92",attr:"#c4a7e7",default:"#e0def4"}},kanagawa:{background:{primary:"#1f1f28",secondary:"#2a2a37"},text:{primary:"#dcd7ba",secondary:"#c8c093",muted:"#727169"},border:{light:"#2a2a37"},syntax:{comment:"#727169",string:"#98bb6c",number:"#d27e99",keyword:"#957fb8",function:"#7e9cd8",variable:"#dcd7ba",operator:"#c0a36e",type:"#7aa89f",tag:"#e46876",attr:"#ffa066",default:"#dcd7ba"}}};function vr(r){const t=r.replace("#",""),s=parseInt(t.substring(0,2),16),a=parseInt(t.substring(2,4),16),c=parseInt(t.substring(4,6),16);return(.299*s+.587*a+.114*c)/255<.5}function kr(r){return{base:vr(r.background.primary)?"vs-dark":"vs",inherit:!0,rules:[{token:"",foreground:r.text.primary.replace("#",""),background:r.background.primary.replace("#","")},{token:"comment",foreground:r.syntax.comment.replace("#",""),fontStyle:"italic"},{token:"string",foreground:r.syntax.string.replace("#","")},{token:"number",foreground:r.syntax.number.replace("#","")},{token:"keyword",foreground:r.syntax.keyword.replace("#","")},{token:"type",foreground:r.syntax.type.replace("#","")},{token:"identifier",foreground:r.syntax.variable.replace("#","")},{token:"function",foreground:r.syntax.function.replace("#","")},{token:"variable",foreground:r.syntax.variable.replace("#","")},{token:"operator",foreground:r.syntax.operator.replace("#","")},{token:"delimiter",foreground:r.syntax.operator.replace("#","")},{token:"tag",foreground:r.syntax.tag.replace("#","")},{token:"attribute.name",foreground:r.syntax.attr.replace("#","")},{token:"attribute.value",foreground:r.syntax.string.replace("#","")}],colors:{"editor.background":r.background.primary,"editor.foreground":r.text.primary,"editor.lineHighlightBackground":r.background.secondary,"editor.selectionBackground":`${r.syntax.function}40`,"editorLineNumber.foreground":r.text.muted,"editorLineNumber.activeForeground":r.text.secondary,"editorCursor.foreground":r.text.primary,"editorIndentGuide.background":r.border.light,"editorWidget.background":r.background.secondary,"editorWidget.border":r.border.light,"scrollbarSlider.background":`${r.text.muted}40`,"scrollbarSlider.hoverBackground":`${r.text.muted}60`}}}const at=new Set;function ot(r,t){const s=t.toLowerCase().replace(/\s+/g,"-"),a=br[s];if(!a)return"vs-dark";if(!at.has(s)){const c=kr(a);r.editor.defineTheme(s,c),at.add(s)}return s}const gr="http://localhost:3000",yr=2048,wr=/^(?:localhost|127(?:\.\d{1,3}){3}|0\.0\.0\.0|\[::1\]|10(?:\.\d{1,3}){3}|192\.168(?:\.\d{1,3}){2}|172\.(?:1[6-9]|2\d|3[01])(?:\.\d{1,3}){2})(?::\d+)?$/i,jr=/^[a-z\d.-]+:\d+$/i,Nr={en:{toolbarAria:"Browser navigation",addressAria:"Browser address",addressPlaceholder:"Enter an HTTP or HTTPS URL",back:"Go back",forward:"Go forward",reload:"Reload page",go:"Open address",openExternal:"Open in system browser",frameTitle:"Browser preview",emptyTitle:"No page open",status:{idle:"Idle",loading:"Loading…",ready:"Ready",error:"Failed"},error:{empty:"Enter a URL.",invalid:"Enter a valid URL.",protocol:"Only HTTP and HTTPS URLs are supported.",credentials:"URLs containing credentials are not allowed.",same_origin:"The Blade Web origin cannot be embedded in itself."}},zh:{toolbarAria:"浏览器导航",addressAria:"浏览器地址",addressPlaceholder:"输入 HTTP 或 HTTPS 地址",back:"后退",forward:"前进",reload:"刷新页面",go:"打开地址",openExternal:"在系统浏览器中打开",frameTitle:"浏览器预览",emptyTitle:"未打开页面",status:{idle:"空闲",loading:"正在加载…",ready:"就绪",error:"加载失败"},error:{empty:"请输入地址。",invalid:"请输入有效地址。",protocol:"仅支持 HTTP 与 HTTPS 地址。",credentials:"不允许使用包含凭据的地址。",same_origin:"不能在面板中嵌套 Blade Web 自身地址。"}}};function Er(){return typeof window>"u"?void 0:window.location.origin}function Sr(r,t=Er()){const s=r.trim();if(!s)return{ok:!1,reason:"empty"};if(s.length>yr)return{ok:!1,reason:"invalid"};let a=s;const c=a.split(/[/?#]/,1)[0]??"";wr.test(c)||jr.test(c)?a=`http://${a}`:a.startsWith("//")?a=`https:${a}`:/^[a-z][a-z\d+.-]*:/i.test(a)||(a=`https://${a}`);let i;try{i=new URL(a)}catch{return{ok:!1,reason:"invalid"}}return i.protocol!=="http:"&&i.protocol!=="https:"?{ok:!1,reason:"protocol"}:i.username||i.password?{ok:!1,reason:"credentials"}:t&&i.origin===t?{ok:!1,reason:"same_origin"}:{ok:!0,url:i.href}}function Cr(r,t){if(r.entries[r.index]===t)return r;const s=[...r.entries.slice(0,r.index+1),t].slice(-50);return{entries:s,index:s.length-1}}function Tr(){const{locale:r}=er(),t=Nr[r],[s,a]=o.useState(gr),[c,i]=o.useState([]),[b,f]=o.useState(-1),[k,h]=o.useState(0),[u,x]=o.useState("idle"),[m,v]=o.useState(null),l=c[b]??null,N=o.useMemo(()=>{if(!l)return"";try{return new URL(l).host}catch{return""}},[l]),p=E=>{a(E),v(null),x("loading")},w=E=>{const C=Sr(E);if(!C.ok){v(C.reason);return}if(C.url===l){p(C.url),h(V=>V+1);return}const $=Cr({entries:c,index:b},C.url);i($.entries),f($.index),p(C.url)},T=E=>{const C=c[E];C&&(f(E),p(C))},D=E=>{E.preventDefault(),w(s)},L=m?t.error[m]:null;return e.jsxs("section",{"data-preview-browser":!0,className:"flex h-full min-h-0 flex-col bg-[hsl(var(--deck-canvas))]",children:[e.jsxs("form",{"aria-label":t.toolbarAria,onSubmit:D,className:"flex h-12 shrink-0 items-center gap-1 border-b border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] px-2",children:[e.jsx(O,{type:"button",variant:"ghost",size:"icon",disabled:b<=0,"aria-label":t.back,title:t.back,onClick:()=>T(b-1),className:"h-8 w-8 rounded-md text-[hsl(var(--deck-ink-muted))]",children:e.jsx(sr,{className:"h-4 w-4"})}),e.jsx(O,{type:"button",variant:"ghost",size:"icon",disabled:b<0||b>=c.length-1,"aria-label":t.forward,title:t.forward,onClick:()=>T(b+1),className:"h-8 w-8 rounded-md text-[hsl(var(--deck-ink-muted))]",children:e.jsx(ar,{className:"h-4 w-4"})}),e.jsx(O,{type:"button",variant:"ghost",size:"icon",disabled:!l,"aria-label":t.reload,title:t.reload,onClick:()=>{l&&(p(l),h(E=>E+1))},className:"h-8 w-8 rounded-md text-[hsl(var(--deck-ink-muted))]",children:e.jsx(or,{className:R("h-4 w-4",u==="loading"&&"animate-spin")})}),e.jsxs("div",{className:R("flex h-8 min-w-0 flex-1 items-center gap-2 rounded-md border bg-[hsl(var(--deck-canvas))] px-2",m?"border-red-500/70":"border-[hsl(var(--deck-border))] focus-within:border-[hsl(var(--deck-accent)/0.65)]"),children:[e.jsx(st,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink-faint))]"}),e.jsx("input",{"data-preview-browser-address":!0,value:s,onChange:E=>{a(E.target.value),v(null)},onKeyDown:E=>{E.key==="Escape"&&l&&(E.preventDefault(),a(l),v(null))},"aria-label":t.addressAria,placeholder:t.addressPlaceholder,autoCapitalize:"none",autoComplete:"off",spellCheck:!1,className:"min-w-0 flex-1 bg-transparent font-mono text-[11px] text-[hsl(var(--deck-ink))] outline-none placeholder:text-[hsl(var(--deck-ink-faint))]"})]}),e.jsx(O,{type:"submit",variant:"ghost",size:"icon","aria-label":t.go,title:t.go,className:"h-8 w-8 rounded-md text-[hsl(var(--deck-accent))]",children:e.jsx(ir,{className:"h-4 w-4"})}),e.jsx(O,{type:"button",variant:"ghost",size:"icon",disabled:!l,"aria-label":t.openExternal,title:t.openExternal,onClick:()=>{l&&window.open(l,"_blank","noopener,noreferrer")},className:"h-8 w-8 rounded-md text-[hsl(var(--deck-ink-muted))]",children:e.jsx(cr,{className:"h-4 w-4"})})]}),L&&e.jsx("div",{role:"alert",className:"shrink-0 border-b border-red-500/25 bg-red-500/10 px-3 py-2 font-mono text-[10.5px] text-red-700 dark:text-red-300",children:L}),e.jsx("div",{"aria-busy":u==="loading",className:"relative min-h-0 flex-1 overflow-hidden bg-white",children:l?e.jsxs(e.Fragment,{children:[e.jsx("iframe",{"data-preview-browser-frame":!0,src:l,title:t.frameTitle,sandbox:"allow-downloads allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts",referrerPolicy:"no-referrer",onLoad:()=>x("ready"),onError:()=>x("error"),className:"block h-full w-full border-0 bg-white"},`${l}:${k}`),u==="loading"&&e.jsxs("div",{className:"pointer-events-none absolute inset-x-0 top-0 flex h-8 items-center justify-center border-b border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas)/0.92)] backdrop-blur-sm",children:[e.jsx(We,{className:"mr-2 h-3.5 w-3.5 animate-spin text-[hsl(var(--deck-accent))]"}),e.jsx("span",{className:"font-mono text-[10.5px] text-[hsl(var(--deck-ink-muted))]",children:t.status.loading})]})]}):e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 bg-[hsl(var(--deck-canvas-veil))] text-center",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] text-[hsl(var(--deck-ink-faint))]",children:e.jsx(st,{className:"h-5 w-5"})}),e.jsx("span",{className:"font-mono text-[11px] text-[hsl(var(--deck-ink-muted))]",children:t.emptyTitle})]})}),e.jsxs("div",{"data-preview-browser-status":u,"aria-live":"polite",className:"flex h-7 shrink-0 items-center justify-between border-t border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] px-3 font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:R("h-1.5 w-1.5 shrink-0 rounded-full bg-[hsl(var(--deck-ink-faint))]",u==="loading"&&"bg-amber-500",u==="ready"&&"bg-emerald-500",u==="error"&&"bg-red-500")}),e.jsx("span",{children:t.status[u]})]}),N&&e.jsx("span",{className:"ml-3 truncate",children:N})]})]})}function ue(r){return r.normalize("NFKC").toLocaleLowerCase().trim()}function Rr(r,t,s){const a=ue(t).split(/\s+/).filter(Boolean);return r.filter(c=>{if(s!=="all"&&c.status!==s)return!1;if(a.length===0)return!0;const i=ue([c.title,c.subtitle,c.content].filter(Boolean).join(" "));return a.every(b=>i.includes(b))})}function St(r){return r.replace(/\/+$/,"").split("/").filter(Boolean).at(-1)||r}function Dr(r,t){const s=ue(t).split(/\s+/).filter(Boolean);return s.length===0?r:r.filter(a=>{const c=ue([a.filePath,a.summary].filter(Boolean).join(" "));return s.every(i=>c.includes(i))})}function Lr(r,t,s){return t===0?0:(r+s+t)%t}const it=20,ct=20,lt=160,dt=240;function ut(r,t){const s=i=>i.replace(/\\/g,"/").replace(/^\.?\//,"").replace(/\/+/g,"/"),a=s(r),c=s(t);return a===c||a.endsWith(`/${c}`)||c.endsWith(`/${a}`)}function Fr({diffs:r,expanded:t,targetPath:s,onToggle:a,onSetAllExpanded:c}){var l,N;const i=_(),[b,f]=o.useState(""),k=`${b}\0${r.length}\0${((l=r[0])==null?void 0:l.filePath)??""}\0${((N=r.at(-1))==null?void 0:N.filePath)??""}`,[h,u]=o.useState({key:k,count:it}),x=h.key===k?h.count:it,m=o.useMemo(()=>Dr(r,b),[r,b]),v=o.useMemo(()=>{const p=m.slice(0,x);if(!s)return p;const w=m.find(T=>T.filePath&&ut(T.filePath,s));return w&&!p.includes(w)?[...p,w]:p},[m,s,x]);return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"sticky top-0 z-10 space-y-2 bg-[hsl(var(--deck-canvas))] pb-1",children:[e.jsxs("div",{className:"flex h-8 items-center gap-2 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-2 focus-within:border-[hsl(var(--deck-accent)/0.6)]",children:[e.jsx(_e,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink-faint))]"}),e.jsx("input",{type:"search","aria-label":i("preview.diff.searchAria"),placeholder:i("preview.diff.searchPlaceholder"),value:b,onChange:p=>f(p.target.value),className:"min-w-0 flex-1 bg-transparent font-mono text-[11px] text-[hsl(var(--deck-ink))] outline-none placeholder:text-[hsl(var(--deck-ink-faint))]"}),e.jsxs("span",{className:"font-mono text-[9px] tabular-nums text-[hsl(var(--deck-ink-faint))]",children:[m.length,"/",r.length]})]}),e.jsxs("div",{className:"flex items-center justify-between font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:[e.jsx("span",{children:i("preview.diff.changedFiles",{count:r.length})}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsxs("button",{type:"button",onClick:()=>c(!0),className:"inline-flex items-center gap-1 rounded px-1.5 py-1 transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink-muted))]",children:[e.jsx(lr,{className:"h-3 w-3"}),i("preview.diff.expandAll")]}),e.jsxs("button",{type:"button",onClick:()=>c(!1),className:"inline-flex items-center gap-1 rounded px-1.5 py-1 transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink-muted))]",children:[e.jsx(dr,{className:"h-3 w-3"}),i("preview.diff.collapseAll")]})]})]})]}),m.length===0?e.jsx("div",{className:"rounded-lg border border-dashed border-[hsl(var(--deck-border))] p-6 text-center font-mono text-[12px] text-[hsl(var(--deck-ink-muted))]",children:i("preview.diff.noMatches")}):v.map(p=>{const w=p.filePath||"unknown",T=r.indexOf(p),D=t[w]??T===0,L=!!(s&&ut(w,s));return e.jsxs("div",{"data-preview-diff-path":p.filePath,className:R("overflow-hidden rounded-lg border border-[hsl(var(--deck-border))] transition-colors",L&&"border-[hsl(var(--deck-accent)/0.7)] bg-[hsl(var(--deck-accent-soft))] ring-1 ring-[hsl(var(--deck-accent)/0.2)]"),children:[e.jsxs("button",{type:"button","aria-expanded":D,onClick:()=>a(w),className:"flex w-full items-center gap-2 bg-[hsl(var(--deck-surface-2))] px-3 py-2 transition-colors hover:bg-[hsl(var(--deck-surface))] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[hsl(var(--deck-accent)/0.65)]",children:[D?e.jsx(yt,{className:"h-4 w-4 text-[hsl(var(--deck-ink-muted))]"}):e.jsx(wt,{className:"h-4 w-4 text-[hsl(var(--deck-ink-muted))]"}),e.jsx(jt,{className:"h-4 w-4 text-[hsl(var(--deck-ink-muted))]"}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-left font-mono text-[13px] text-[hsl(var(--deck-ink))]",children:St(w)}),p.summary&&e.jsx("span",{className:"shrink-0 font-mono text-[11px] text-[hsl(var(--deck-ink-muted))]",children:p.summary})]}),D&&e.jsxs("div",{className:"border-t border-[hsl(var(--deck-border))]",children:[e.jsx("div",{className:"truncate px-3 py-1 font-mono text-[11px] text-[hsl(var(--deck-ink-faint))]",children:p.filePath}),e.jsx(Pr,{diff:p.diff})]})]},w)}),x<m.length&&e.jsx("div",{className:"flex justify-center pt-1",children:e.jsx("button",{type:"button",onClick:()=>u({key:k,count:Math.min(m.length,x+ct)}),className:"rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 py-1.5 font-mono text-[11px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:border-[hsl(var(--deck-border-strong))] hover:text-[hsl(var(--deck-ink))]",children:i("preview.diff.showMoreFiles",{count:Math.min(ct,m.length-x)})})})]})}function Pr({diff:r}){const t=_(),s=o.useMemo(()=>r.patch.split(`
|
|
3
|
+
`),[r.patch]),[a,c]=o.useState({patch:r.patch,count:lt}),i=a.patch===r.patch?a.count:lt,b=s.slice(0,i);let f=0,k=0;return e.jsxs("div",{className:"overflow-hidden rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] px-3 py-2 font-mono text-[12px] text-[hsl(var(--deck-ink-muted))]",children:[e.jsx("span",{children:t("preview.diff.patch")}),r.matchLine&&e.jsx("span",{children:t("preview.diff.line",{line:r.matchLine})})]}),e.jsx("div",{className:"overflow-x-auto font-mono text-[12px]",children:b.map((h,u)=>{if(h.startsWith("@@")){const x=/@@ -(?<old>\d+),?(?<oldCount>\d*) \+(?<new>\d+),?(?<newCount>\d*) @@/.exec(h);return x!=null&&x.groups&&(f=Number.parseInt(x.groups.old,10),k=Number.parseInt(x.groups.new,10)),e.jsx(H,{line:h},`${h}-${u}`)}if(h.startsWith("---")||h.startsWith("+++")||h.startsWith("Index:")||h.startsWith("==="))return e.jsx(H,{line:h},`${h}-${u}`);if(h.startsWith("+")){const x=k++;return e.jsx(H,{line:h,oldLine:null,newLine:x},`${h}-${u}`)}if(h.startsWith("-")){const x=f++;return e.jsx(H,{line:h,oldLine:x,newLine:null},`${h}-${u}`)}return h.startsWith(" ")?e.jsx(H,{line:h,oldLine:f++,newLine:k++},`${h}-${u}`):e.jsx(H,{line:h},`${h}-${u}`)})}),i<s.length&&e.jsx("div",{className:"flex justify-center border-t border-[hsl(var(--deck-border))] p-2",children:e.jsx("button",{type:"button",onClick:()=>c({patch:r.patch,count:Math.min(s.length,i+dt)}),className:"rounded-md border border-[hsl(var(--deck-border))] px-3 py-1 font-mono text-[10.5px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-surface-2))] hover:text-[hsl(var(--deck-ink))]",children:t("preview.diff.showMoreLines",{count:Math.min(dt,s.length-i)})})})]})}function H({line:r,oldLine:t,newLine:s}){const a=r.startsWith("---")||r.startsWith("+++")||r.startsWith("Index:")||r.startsWith("==="),c=r.startsWith("@@"),i=r[0],b=a||c?r:r.slice(1),f=a?"text-[hsl(var(--deck-ink-muted))]":i==="+"?"bg-[#22C55E]/10 text-[#166534] dark:bg-[#22C55E]/10 dark:text-[#86efac]":i==="-"?"bg-[#EF4444]/10 text-[#b91c1c] dark:bg-[#EF4444]/10 dark:text-[#fca5a5]":c?"bg-[#DBEAFE] text-[#1d4ed8] dark:bg-[#1e3a8a]/30 dark:text-[#93c5fd]":"text-[hsl(var(--deck-ink))]";return e.jsxs("div",{"data-preview-diff-line":!0,className:R("grid min-w-max grid-cols-[40px_40px_1fr] gap-2 px-3 py-0.5",f),children:[e.jsx("span",{className:"text-right text-[hsl(var(--deck-ink-faint))]",children:t?String(t).padStart(2," "):""}),e.jsx("span",{className:"text-right text-[hsl(var(--deck-ink-faint))]",children:s?String(s).padStart(2," "):""}),e.jsx("span",{className:"whitespace-pre",children:b})]})}function Ir({nodes:r,expandedDirs:t,childrenCache:s,directoryStates:a,selectedPath:c,onToggleDir:i,onRetryDir:b,onSelectFile:f}){return e.jsx(e.Fragment,{children:r.map(k=>e.jsx(Ct,{node:k,depth:0,expandedDirs:t,childrenCache:s,directoryStates:a,selectedPath:c,onToggleDir:i,onRetryDir:b,onSelectFile:f},k.path))})}function Ct({node:r,depth:t,expandedDirs:s,childrenCache:a,directoryStates:c,selectedPath:i,onToggleDir:b,onRetryDir:f,onSelectFile:k}){const h=_(),u=r.type==="dir",x=!!s[r.path],m=!u&&i===r.path,v=a[r.path]??[],l=c[r.path],N=t*14+24;return e.jsxs("div",{children:[e.jsxs("button",{type:"button","aria-expanded":u?x:void 0,"aria-busy":u&&(l==null?void 0:l.status)==="loading",onClick:()=>u?b(r.path):k(r.path),className:R("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left font-mono text-[12px] transition-colors",m?"border border-[#16A34A]/30 bg-[#16A34A]/10 text-[#111827] dark:border-[#22C55E]/30 dark:bg-[#22C55E]/10 dark:text-[#E5E5E5]":"text-[hsl(var(--deck-ink-muted))] hover:bg-[hsl(var(--deck-surface))]",u&&"cursor-pointer"),style:{paddingLeft:t*14+8},children:[u?(l==null?void 0:l.status)==="loading"?e.jsx(We,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-[hsl(var(--deck-accent))]"}):x?e.jsx(ur,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink))]"}):e.jsx(fr,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink-muted))]"}):e.jsx(jt,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink-faint))]"}),e.jsx("span",{className:"truncate text-[hsl(var(--deck-ink))]",children:r.name})]}),u&&x&&e.jsxs("div",{children:[(l==null?void 0:l.status)==="loading"&&e.jsx("div",{role:"status",style:{paddingLeft:N},className:"py-1 font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:h("preview.files.directoryLoading")}),(l==null?void 0:l.status)==="error"&&e.jsxs("div",{role:"alert",style:{marginLeft:N},className:"my-1 mr-1 rounded-md border border-red-200 bg-red-50/70 px-2 py-1.5 font-mono text-[10px] text-red-700 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-300",children:[e.jsx("div",{className:"truncate",title:l.message,children:l.message}),e.jsxs("button",{type:"button",onClick:()=>f(r.path),className:"mt-1 inline-flex items-center gap-1 font-medium underline-offset-2 hover:underline",children:[e.jsx(hr,{className:"h-2.5 w-2.5"}),h("preview.action.retry")]})]}),(l==null?void 0:l.status)==="loaded"&&v.length===0&&e.jsx("div",{style:{paddingLeft:N},className:"py-1 font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:h("preview.files.directoryEmpty")}),v.map(p=>e.jsx(Ct,{node:p,depth:t+1,expandedDirs:s,childrenCache:a,directoryStates:c,selectedPath:i,onToggleDir:b,onRetryDir:f,onSelectFile:k},p.path))]})]})}const ft=80,ht=80;function Ar({logs:r}){var l,N;const t=_(),[s,a]=o.useState(""),[c,i]=o.useState("all"),[b,f]=o.useState({}),k=`${c}\0${s}\0${r.length}\0${((l=r[0])==null?void 0:l.id)??""}\0${((N=r.at(-1))==null?void 0:N.id)??""}`,[h,u]=o.useState({key:k,count:ft}),x=o.useMemo(()=>Rr(r,s,c),[c,r,s]),m=h.key===k?h.count:ft,v=x.slice(0,m);return e.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[e.jsxs("div",{className:"space-y-2 border-b border-[hsl(var(--deck-border))] px-4 py-3",children:[e.jsxs("div",{className:"flex h-8 items-center gap-2 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-2 focus-within:border-[hsl(var(--deck-accent)/0.6)]",children:[e.jsx(_e,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink-faint))]"}),e.jsx("input",{type:"search","aria-label":t("preview.logs.searchAria"),placeholder:t("preview.logs.searchPlaceholder"),value:s,onChange:p=>a(p.target.value),className:"min-w-0 flex-1 bg-transparent font-mono text-[11px] text-[hsl(var(--deck-ink))] outline-none placeholder:text-[hsl(var(--deck-ink-faint))]"}),e.jsxs("span",{className:"font-mono text-[9px] tabular-nums text-[hsl(var(--deck-ink-faint))]",children:[x.length,"/",r.length]})]}),e.jsx("div",{className:"flex items-center gap-1","aria-label":t("preview.logs.filterAria"),children:["all","running","error","success"].map(p=>e.jsx("button",{type:"button","aria-pressed":c===p,onClick:()=>i(p),className:R("rounded-md border px-2 py-1 font-mono text-[9.5px] transition-colors",c===p?"border-[hsl(var(--deck-accent)/0.45)] bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-accent))]":"border-[hsl(var(--deck-border))] text-[hsl(var(--deck-ink-faint))] hover:text-[hsl(var(--deck-ink-muted))]"),children:t(`preview.logs.filter.${p}`)},p))})]}),e.jsxs("div",{className:"min-h-0 flex-1 space-y-3 overflow-y-auto px-4 py-4",children:[r.length===0?e.jsx(pt,{title:t("preview.logs.emptyTitle"),subtitle:t("preview.logs.emptyHint")}):x.length===0?e.jsx(pt,{title:t("preview.logs.noMatches"),subtitle:t("preview.logs.noMatchesHint")}):v.map(p=>{var E;const w=b[p.id],T=(p.content||"").split(`
|
|
4
|
+
`),D=T.length>10||(((E=p.content)==null?void 0:E.length)||0)>800,L=w||!D?T:T.slice(0,8);return e.jsxs("div",{"data-preview-log-id":p.id,className:"overflow-hidden rounded-lg border border-[hsl(var(--deck-border))]",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] px-3 py-2",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("div",{className:"font-mono text-[12px] text-[hsl(var(--deck-ink))]",children:p.title}),p.subtitle&&e.jsx("div",{className:"font-mono text-[11px] text-[hsl(var(--deck-ink-muted))]",children:p.subtitle})]}),e.jsx(Wr,{status:p.status})]}),p.content&&e.jsxs("div",{className:"space-y-2 px-3 py-3",children:[e.jsxs("pre",{className:"overflow-x-auto whitespace-pre-wrap rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] p-3 font-mono text-[12px] text-[hsl(var(--deck-ink))]",children:[L.join(`
|
|
5
|
+
`),!w&&D&&`
|
|
6
|
+
…`]}),D&&e.jsxs("button",{type:"button",onClick:()=>f(C=>({...C,[p.id]:!C[p.id]})),className:"flex items-center gap-1 font-mono text-[12px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:text-[hsl(var(--deck-ink))]",children:[w?e.jsx(yt,{className:"h-3 w-3"}):e.jsx(wt,{className:"h-3 w-3"}),t(w?"preview.logs.collapse":"preview.logs.expand")]})]})]},p.id)}),m<x.length&&e.jsx("div",{className:"flex justify-center",children:e.jsx("button",{type:"button",onClick:()=>u({key:k,count:Math.min(x.length,m+ht)}),className:"rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 py-1.5 font-mono text-[11px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:border-[hsl(var(--deck-border-strong))] hover:text-[hsl(var(--deck-ink))]",children:t("preview.logs.showMore",{count:Math.min(ht,x.length-m)})})})]})]})}function pt({title:r,subtitle:t}){return e.jsxs("div",{className:"rounded-lg border border-dashed border-[hsl(var(--deck-border))] p-6 text-center",children:[e.jsx("div",{className:"font-mono text-[13px] text-[hsl(var(--deck-ink))]",children:r}),e.jsx("div",{className:"mt-1 font-mono text-[12px] text-[hsl(var(--deck-ink-muted))]",children:t})]})}function Wr({status:r}){const t=_(),s=t(r==="success"?"preview.logs.status.success":r==="error"?"preview.logs.status.error":"preview.logs.status.running"),a=r==="success"?"bg-[#22C55E] text-white":r==="error"?"bg-[#FEE2E2] text-[#b91c1c] dark:bg-[#EF4444]/20 dark:text-[#fca5a5]":"bg-[hsl(var(--deck-surface))] text-[hsl(var(--deck-ink-muted))]";return e.jsx("span",{className:R("rounded-full px-2 py-0.5 font-mono text-[11px]",a),children:s})}const _r=640,Tt=360,Ae=960;function mt(r){const t=typeof window>"u"?Ae:Math.max(280,Math.floor(window.innerWidth*.72));return Math.min(Ae,t,Math.max(Tt,Math.round(r)))}function Rt(r,t,s){var a;if(r){const c=(a=s==null?void 0:s.taskDelivery)==null?void 0:a.status;return(s==null?void 0:s.taskIsolation)==="worktree"&&s.taskSourceProjectPath&&(c==="applied"||c==="discarded")?{sessionId:r.sessionId,projectPath:s.taskSourceProjectPath}:r}return t?{sessionId:`project:${t}`,projectPath:t}:null}function Ie(){const r=U.getState(),t=r.sessions.find(s=>J({sessionId:s.sessionId,projectPath:s.projectPath},r.currentSessionRef));return Rt(r.currentSessionRef,r.selectedProjectPath,t)}function xt(r,t){const s=i=>i.replace(/\\/g,"/").replace(/^\.?\//,"").replace(/\/+/g,"/"),a=s(r),c=s(t);return a===c||a.endsWith(`/${c}`)||c.endsWith(`/${a}`)}const $r=o.lazy(async()=>({default:(await nr(()=>import("./index-DI8ZWdWH.js"),__vite__mapDeps([0,1]))).Editor}));function de(r,t){return r instanceof Error?r.message:t}function Kr({returnFocusElement:r}={}){var tt,rt;const t=_(),{toggleFilePreview:s,previewWidth:a,setPreviewWidth:c,previewTab:i,setPreviewTab:b,previewTargetPath:f,previewRequestId:k}=nt(),h=U(n=>n.messages),u=U(n=>n.currentSessionRef),x=U(n=>n.sessions),m=U(n=>n.selectedProjectPath),v=o.useMemo(()=>x.find(n=>J({sessionId:n.sessionId,projectPath:n.projectPath},u)),[u,x]),l=o.useMemo(()=>Rt(u,m,v),[v,u,m]),[N,p]=o.useState(i),[w,T]=o.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 1023px)").matches),[D,L]=o.useState(null),[E,C]=o.useState(!1),[$,V]=o.useState([]),[Dt,$e]=o.useState({}),[Lt,Me]=o.useState({}),[Ft,Pt]=o.useState(0),[Q,fe]=o.useState(!1),[X,he]=o.useState(null),[M,pe]=o.useState(""),[Y,Z]=o.useState([]),[ze,ee]=o.useState(!1),[It,te]=o.useState(!1),[At,Wt]=o.useState(0),[me,re]=o.useState(0),[_t,xe]=o.useState({}),[$t,ne]=o.useState({}),[P,Be]=o.useState(null),[Mt,be]=o.useState(""),[ve,ke]=o.useState(!1),[ge,ye]=o.useState(null),[qe,we]=o.useState(!1),He=o.useRef(l),z=o.useRef(0),se=o.useRef(0),B=o.useRef({}),je=o.useRef(0),ae=o.useRef(0),q=o.useRef(0),I=o.useRef({}),oe=o.useRef({}),Ne=o.useRef({}),Ee=o.useRef(null),Se=o.useRef(null),Oe=o.useRef(null),Ue=o.useRef(null),Ce=o.useRef(a),Ge=o.useRef(u),Te=o.useRef(null);o.useLayoutEffect(()=>{J(He.current,l)||(z.current+=1),He.current=l},[l]),o.useEffect(()=>{if(typeof window.matchMedia!="function")return;const n=window.matchMedia("(max-width: 1023px)"),d=()=>T(n.matches);return d(),n.addEventListener("change",d),()=>n.removeEventListener("change",d)},[]),o.useEffect(()=>(Ue.current=r??(document.activeElement instanceof HTMLElement?document.activeElement:null),()=>{const n=Ue.current;requestAnimationFrame(()=>{n!=null&&n.isConnected&&n.focus({preventScroll:!0})})}),[r]),o.useEffect(()=>{var n;w&&((n=Oe.current)==null||n.focus({preventScroll:!0}))},[w]);const zt=n=>{var S;if(!w)return;if(n.key==="Escape"){n.preventDefault(),s();return}if(n.key!=="Tab")return;const d=Array.from(((S=Se.current)==null?void 0:S.querySelectorAll('button:not([disabled]), input:not([disabled]), [href], [tabindex]:not([tabindex="-1"])'))??[]).filter(j=>!j.closest("[hidden]"));if(d.length===0)return;const y=d[0],g=d[d.length-1];n.shiftKey&&document.activeElement===y?(n.preventDefault(),g==null||g.focus()):!n.shiftKey&&document.activeElement===g&&(n.preventDefault(),y==null||y.focus())},K=(n,d)=>d===z.current&&J(Ie(),n),Ve=async(n,d="")=>{const y=d?`/suggestions/files/tree?path=${encodeURIComponent(d)}`:"/suggestions/files/tree",g=await fetch(y,{headers:Pe(n)});if(!g.ok)throw new Error(t("preview.files.treeFailed"));return(await g.json()).map(j=>({...j,children:j.type==="dir"?[]:void 0}))};o.useEffect(()=>{const n=++se.current;return(async()=>{if(!l){V([]),fe(!1),he(null);return}const y={...l},g=z.current,S=()=>n===se.current&&K(y,g);if(S()){V([]),fe(!0),he(null);try{const j=await Ve(y);S()&&V(j)}catch(j){S()&&he(de(j,t("preview.files.treeFailed")))}finally{S()&&fe(!1)}}})(),()=>{se.current===n&&(se.current+=1)}},[Ft,l==null?void 0:l.projectPath,l==null?void 0:l.sessionId]),o.useEffect(()=>{Ee.current=null,I.current={},oe.current={},Ne.current={},B.current={},je.current+=1,Be(null),be(""),ke(!1),ye(null),we(!1),xe({}),$e({}),Me({}),pe(""),Z([]),ee(!1),te(!1),re(0),ne({})},[l==null?void 0:l.projectPath,l==null?void 0:l.sessionId]);const Bt=o.useMemo(()=>zr(h),[h]),[qt,Ke]=o.useState(null),[Ht,Re]=o.useState(!1),[Je,Qe]=o.useState(null),[Ot,Ut]=o.useState(0),De=(v==null?void 0:v.taskIsolation)==="worktree"&&((tt=v.taskDelivery)==null?void 0:tt.status)==="discarded",Xe=(v==null?void 0:v.taskIsolation)==="worktree"&&!!v.taskDiffStat&&!De,Ye=Xe&&!!(v!=null&&v.taskDiffStat&&v.taskDiffStat.changedFiles>0),A=De?[]:Xe?qt??[]:Bt,Gt=o.useMemo(()=>Mr(h),[h]);o.useEffect(()=>{const n=M.trim(),d=++ae.current;if(re(0),te(!1),!n||N!=="files"||!l){Z([]),ee(!1);return}const y={...l},g=z.current;ee(!0);const S=window.setTimeout(()=>{fetch(`/suggestions/files?q=${encodeURIComponent(n)}&limit=100&type=file`,{headers:Pe(y)}).then(async j=>{if(!j.ok)throw new Error(t("preview.files.searchFailed"));return await j.json()}).then(j=>{d===ae.current&&K(y,g)&&(Z(j.filter(F=>!F.endsWith("/"))),te(!1))}).catch(()=>{d===ae.current&&K(y,g)&&(Z([]),te(!0))}).finally(()=>{d===ae.current&&ee(!1)})},160);return()=>window.clearTimeout(S)},[N,M,At,l==null?void 0:l.projectPath,l==null?void 0:l.sessionId]),o.useEffect(()=>{p(nt.getState().previewTab)},[k]),o.useEffect(()=>{const n=Ge.current;if(Ge.current=u,u||!m){Te.current=null;return}const d=!!n||Te.current!==m;Te.current=m,d&&N==="diff"&&(p("files"),b("files"))},[N,u==null?void 0:u.projectPath,u==null?void 0:u.sessionId,m,b]),o.useEffect(()=>{var y;if(!f||N!=="diff")return;const n=(y=A.find(g=>g.filePath&&xt(g.filePath,f)))==null?void 0:y.filePath;if(!n)return;ne(g=>({...g,[n]:!0}));const d=requestAnimationFrame(()=>{var S,j;const g=Array.from(((S=Se.current)==null?void 0:S.querySelectorAll("[data-preview-diff-path]"))??[]).find(F=>xt(F.dataset.previewDiffPath??"",f));typeof(g==null?void 0:g.scrollIntoView)=="function"&&g.scrollIntoView({block:"nearest",behavior:"smooth"}),(j=g==null?void 0:g.querySelector("button"))==null||j.focus({preventScroll:!0})});return()=>cancelAnimationFrame(d)},[N,A,k,f]),o.useEffect(()=>{const n=++q.current;if(Ke(null),Qe(null),Re(!1),!u||!Ye)return;const d={...u};return Re(!0),tr.getTaskDiff(d).then(y=>{n!==q.current||!J(U.getState().currentSessionRef,d)||Ke(y.files.map(g=>({filePath:g.path,diff:{patch:g.patch},summary:g.binary?"binary":`+${g.additions} -${g.deletions}${g.truncated?" (truncated)":""}`})))}).catch(y=>{n===q.current&&Qe(de(y,t("preview.diff.failedTitle")))}).finally(()=>{n===q.current&&Re(!1)}),()=>{q.current===n&&(q.current+=1)}},[v==null?void 0:v.taskCompletedAt,(rt=v==null?void 0:v.taskDelivery)==null?void 0:rt.status,v==null?void 0:v.taskDiffStat,v==null?void 0:v.taskIsolation,u,Ye,Ot]);const Vt=n=>{ne(d=>({...d,[n]:!d[n]}))},Kt=n=>{ne(Object.fromEntries(A.map(d=>[d.filePath||"unknown",n])))},ie=async n=>{const d=Ie();if(!d)return;const y=z.current,g=++je.current,S=()=>g===je.current&&Ee.current===n&&K(d,y);Ee.current=n,Be(n),be(""),ke(!0),ye(null),we(!1);try{const j=await fetch(`/suggestions/files/content?path=${encodeURIComponent(n)}`,{headers:Pe(d)});if(!j.ok)throw new Error(t("preview.files.contentFailed"));const F=await j.json();S()&&(be(F.content||""),we(!!F.truncated))}catch(j){S()&&ye(de(j,t("preview.files.contentFailed")))}finally{S()&&ke(!1)}},Jt=n=>{if(n.key==="ArrowDown"||n.key==="ArrowUp"){n.preventDefault(),re(d=>Lr(d,Y.length,n.key==="ArrowDown"?1:-1));return}if(n.key==="Enter"){const d=Y[me];if(!d)return;n.preventDefault(),ie(d);return}n.key==="Escape"&&(n.preventDefault(),pe(""))},Le=(n,d)=>{const y={...Ne.current,[n]:d};Ne.current=y,Me(y)},Ze=async n=>{const d=(B.current[n]??0)+1;B.current[n]=d,Le(n,{status:"loading"});const y=Ie();if(!y)return;const g=z.current,S=()=>B.current[n]===d&&I.current[n]===!0&&K(y,g);try{const j=await Ve(y,n);if(S()){const F={...oe.current,[n]:j};oe.current=F,$e(F),Le(n,{status:"loaded"})}}catch(j){S()&&Le(n,{status:"error",message:de(j,t("preview.files.treeFailed"))})}},Qt=n=>{const d=!I.current[n],y={...I.current,[n]:d};if(I.current=y,xe(y),!d){B.current[n]=(B.current[n]??0)+1;return}oe.current[n]||Ze(n)},Xt=n=>{if(!I.current[n]){const d={...I.current,[n]:!0};I.current=d,xe(d)}Ze(n)},Yt=n=>{n.preventDefault(),n.currentTarget.setPointerCapture(n.pointerId),Ce.current=a,C(!0),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},Zt=n=>{if(!E)return;const d=mt(window.innerWidth-n.clientX);Ce.current=d,L(d)},et=n=>{E&&(n.currentTarget.hasPointerCapture(n.pointerId)&&n.currentTarget.releasePointerCapture(n.pointerId),C(!1),L(null),c(Ce.current),document.body.style.cursor="",document.body.style.userSelect="")};o.useEffect(()=>()=>{document.body.style.cursor="",document.body.style.userSelect=""},[]);const Fe=mt(D??a);return e.jsxs("div",{ref:Se,"data-testid":"file-preview",role:w?"dialog":"complementary","aria-modal":w||void 0,"aria-label":t("preview.title"),onKeyDown:zt,style:{width:Fe,maxWidth:"72vw"},className:"relative flex h-full min-w-[360px] shrink-0 flex-col border-l border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] shadow-xl max-lg:fixed max-lg:inset-0 max-lg:z-[60] max-lg:!h-dvh max-lg:!w-full max-lg:!max-w-full max-lg:min-w-0 max-lg:border-l-0",children:[e.jsx("div",{role:"separator","aria-label":t("preview.action.resize"),"aria-orientation":"vertical","aria-valuemin":Tt,"aria-valuemax":Ae,"aria-valuenow":Fe,"aria-hidden":w||void 0,tabIndex:w?-1:0,onPointerDown:Yt,onPointerMove:Zt,onPointerUp:et,onPointerCancel:et,onDoubleClick:()=>c(_r),onKeyDown:n=>{n.key!=="ArrowLeft"&&n.key!=="ArrowRight"||(n.preventDefault(),c(Fe+(n.key==="ArrowLeft"?24:-24)))},className:R("absolute inset-y-0 -left-1 z-20 w-2 cursor-col-resize touch-none outline-none max-lg:hidden","after:absolute after:inset-y-0 after:left-1/2 after:w-px after:-translate-x-1/2 after:bg-transparent after:transition-colors","hover:after:bg-[hsl(var(--deck-accent)/0.6)] focus-visible:after:bg-[hsl(var(--deck-accent))]",E&&"after:bg-[hsl(var(--deck-accent))]")}),e.jsxs("div",{className:"flex items-center justify-between px-4 h-12 border-b border-[hsl(var(--deck-border))] shrink-0",children:[e.jsx("span",{className:"font-normal text-[13px] text-[hsl(var(--deck-ink-muted))] font-mono",children:t("preview.title")}),e.jsx(O,{ref:Oe,variant:"ghost",size:"icon",onClick:s,"aria-label":t("preview.action.close"),title:t("preview.action.close"),className:"h-8 w-8 text-[hsl(var(--deck-ink-faint))] hover:text-[hsl(var(--deck-ink))] hover:bg-[hsl(var(--deck-surface))]",children:e.jsx(pr,{className:"w-4 h-4"})})]}),e.jsxs(mr,{value:N,onValueChange:n=>{const d=n;p(d),b(d)},className:"flex flex-col flex-1 min-h-0",children:[e.jsx("div",{className:"px-4 py-3 border-b border-[hsl(var(--deck-border))]",children:e.jsxs(xr,{className:"grid h-9 w-full grid-cols-4 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] p-1",children:[e.jsx(ce,{value:"diff",className:"px-2 font-mono text-[12px] text-[hsl(var(--deck-ink-muted))] data-[state=active]:bg-[hsl(var(--deck-canvas-veil))] data-[state=active]:text-[hsl(var(--deck-ink))]",children:t("preview.tab.diff")}),e.jsx(ce,{value:"files",className:"px-2 font-mono text-[12px] text-[hsl(var(--deck-ink-muted))] data-[state=active]:bg-[hsl(var(--deck-canvas-veil))] data-[state=active]:text-[hsl(var(--deck-ink))]",children:t("preview.tab.files")}),e.jsx(ce,{value:"logs",className:"px-2 font-mono text-[12px] text-[hsl(var(--deck-ink-muted))] data-[state=active]:bg-[hsl(var(--deck-canvas-veil))] data-[state=active]:text-[hsl(var(--deck-ink))]",children:t("preview.tab.logs")}),e.jsx(ce,{value:"browser",className:"px-2 font-mono text-[12px] text-[hsl(var(--deck-ink-muted))] data-[state=active]:bg-[hsl(var(--deck-canvas-veil))] data-[state=active]:text-[hsl(var(--deck-ink))]",children:t("preview.tab.browser")})]})}),e.jsx(le,{value:"diff",className:"overflow-hidden flex-1 mt-0",children:e.jsx("div",{className:"overflow-y-auto px-4 py-4 space-y-3 h-full",children:De?e.jsx(W,{title:t("preview.diff.discardedTitle"),subtitle:t("preview.diff.discardedHint"),role:"status"}):Ht&&A.length===0?e.jsx(W,{title:t("preview.diff.loadingTitle"),subtitle:t("preview.diff.loadingHint")}):Je&&A.length===0?e.jsx(W,{title:t("preview.diff.failedTitle"),subtitle:Je,actionLabel:t("preview.action.retry"),onAction:()=>Ut(n=>n+1),role:"alert"}):A.length===0?e.jsx(W,{title:t("preview.diff.emptyTitle"),subtitle:t("preview.diff.emptyHint")}):e.jsx(Fr,{diffs:A,expanded:$t,targetPath:f,onToggle:Vt,onSetAllExpanded:Kt})})}),e.jsx(le,{value:"files",className:"overflow-hidden flex-1 mt-0",children:e.jsxs("div",{className:"px-4 py-4 h-full",children:[Q&&e.jsx(W,{title:t("preview.files.loadingTitle"),subtitle:t("preview.files.loadingHint")}),!Q&&X&&e.jsx(W,{title:t("preview.files.failedTitle"),subtitle:X,actionLabel:t("preview.action.retry"),onAction:()=>Pt(n=>n+1),role:"alert"}),!Q&&!X&&$.length===0&&e.jsx(W,{title:t("preview.files.emptyTitle"),subtitle:t("preview.files.emptyHint")}),!Q&&!X&&$.length>0&&e.jsxs("div",{className:"grid h-full min-h-0 grid-cols-[minmax(170px,220px)_minmax(0,1fr)] gap-3 max-sm:grid-cols-1 max-sm:grid-rows-[180px_minmax(0,1fr)]",children:[e.jsxs("div",{className:"flex min-h-0 flex-col overflow-hidden rounded-lg border border-[hsl(var(--deck-border))]",children:[e.jsx("div",{className:"border-b border-[hsl(var(--deck-border))] p-2",children:e.jsxs("div",{className:"flex h-8 items-center gap-2 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-2 focus-within:border-[hsl(var(--deck-accent)/0.6)]",children:[e.jsx(_e,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink-faint))]"}),e.jsx("input",{type:"search","aria-label":t("preview.files.searchAria"),placeholder:t("preview.files.searchPlaceholder"),value:M,onChange:n=>pe(n.target.value),onKeyDown:Jt,className:"min-w-0 flex-1 bg-transparent font-mono text-[11px] text-[hsl(var(--deck-ink))] outline-none placeholder:text-[hsl(var(--deck-ink-faint))]"}),ze&&e.jsx(We,{className:"h-3 w-3 shrink-0 animate-spin text-[hsl(var(--deck-accent))]"})]})}),e.jsx("div",{role:M?"listbox":void 0,"aria-label":M?t("preview.files.searchResultsAria"):void 0,className:"min-h-0 flex-1 overflow-y-auto p-2",children:M?It?e.jsxs("div",{role:"alert",className:"px-2 py-5 text-center font-mono text-[10.5px] text-red-700 dark:text-red-300",children:[e.jsx("div",{children:t("preview.files.searchFailed")}),e.jsx("button",{type:"button",onClick:()=>Wt(n=>n+1),className:"mt-1 underline underline-offset-2",children:t("preview.action.retry")})]}):Y.length>0?Y.map((n,d)=>e.jsxs("button",{type:"button",role:"option","aria-selected":d===me,"data-preview-file-result":d,onMouseEnter:()=>re(d),onClick:()=>void ie(n),className:R("mb-0.5 flex w-full min-w-0 flex-col rounded-md px-2 py-1.5 text-left font-mono transition-colors",d===me?"bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-ink))]":"text-[hsl(var(--deck-ink-muted))] hover:bg-[hsl(var(--deck-surface))]"),children:[e.jsx("span",{className:"truncate text-[11.5px]",children:St(n)}),e.jsx("span",{className:"truncate text-[9px] text-[hsl(var(--deck-ink-faint))]",children:n})]},n)):!ze&&e.jsx("div",{className:"px-2 py-5 text-center font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:t("preview.files.noMatches")}):e.jsx(Ir,{nodes:$,expandedDirs:_t,childrenCache:Dt,directoryStates:Lt,selectedPath:P,onToggleDir:Qt,onRetryDir:Xt,onSelectFile:ie})})]}),e.jsxs("div",{className:"border border-[hsl(var(--deck-border))] rounded-lg overflow-hidden flex flex-col min-h-0",children:[e.jsxs("div",{className:"px-3 py-2 bg-[hsl(var(--deck-surface-2))] border-b border-[hsl(var(--deck-border))] text-[12px] text-[hsl(var(--deck-ink-muted))] font-mono flex items-center justify-between",children:[e.jsx("span",{className:"min-w-0 truncate",children:P||t("preview.files.selectTitle")}),P&&e.jsx("span",{className:"ml-2 shrink-0 text-[11px] text-[hsl(var(--deck-ink-faint))] font-mono",children:t(ve?"preview.files.status.loading":qe?"preview.files.status.truncated":"preview.files.status.ready")})]}),qe&&!ve&&e.jsx("div",{className:"px-3 py-2 bg-[#FEF3C7] dark:bg-[#111113] border-b border-[hsl(var(--deck-border))] text-[11px] text-[#b45309] dark:text-[#facc15] font-mono",children:t("preview.files.truncatedNotice")}),e.jsxs("div",{className:"flex-1 min-h-0",children:[!P&&e.jsx("div",{className:"h-full flex items-center justify-center text-[12px] text-[hsl(var(--deck-ink-muted))] font-mono",children:t("preview.files.pickHint")}),P&&ge&&e.jsxs("div",{role:"alert",className:"flex h-full flex-col items-center justify-center gap-2 px-4 text-center font-mono text-[12px] text-[#DC2626] dark:text-[#fca5a5]",children:[e.jsx("span",{children:ge}),e.jsx("button",{type:"button",onClick:()=>void ie(P),className:"underline underline-offset-2",children:t("preview.action.retry")})]}),P&&!ge&&e.jsx("div",{className:"h-full",children:ve?e.jsx(gt,{}):e.jsx(o.Suspense,{fallback:e.jsx(gt,{}),children:e.jsx(Br,{content:Mt,filename:P})})})]})]})]})]})}),e.jsx(le,{value:"logs",className:"overflow-hidden flex-1 mt-0",children:e.jsx(Ar,{logs:Gt})}),e.jsx(le,{value:"browser",forceMount:!0,className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(Tr,{})})]})]})}function W({title:r,subtitle:t,actionLabel:s,onAction:a,role:c}){return e.jsxs("div",{role:c,className:"border border-dashed border-[hsl(var(--deck-border))] rounded-lg p-6 text-center",children:[e.jsx("div",{className:"text-[13px] text-[hsl(var(--deck-ink))] font-mono",children:r}),e.jsx("div",{className:"text-[12px] text-[hsl(var(--deck-ink-muted))] font-mono mt-1",children:t}),s&&a&&e.jsx("button",{type:"button",onClick:a,className:"mt-3 rounded-md border border-[hsl(var(--deck-border))] px-2.5 py-1 font-mono text-[11px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]",children:s})]})}function Mr(r){return r.flatMap(t=>{var c,i,b;const s=[];if((c=t.agentContent)!=null&&c.toolCalls)for(const f of t.agentContent.toolCalls){const k=kt(f.arguments),h=f.output,u=h?(i=G(h))!=null&&i.diff?vt(h):h:void 0;s.push({id:`${t.id}-${f.toolCallId}`,title:f.toolName||"Tool",subtitle:f.summary,status:f.status==="success"?"success":f.status==="error"?"error":"running",content:u||(k?`Arguments:
|
|
7
|
+
${k}`:void 0),timestamp:t.timestamp})}const a=t.metadata;if(a){if(a.kind==="tool_call"){const f=a.toolName||"Tool",k=kt(a.arguments);s.push({id:t.id,title:`Tool Call · ${f}`,subtitle:a.toolKind?String(a.toolKind):void 0,status:a.status==="success"?"success":a.status==="error"?"error":"running",content:k?`Arguments:
|
|
8
|
+
${k}`:void 0,timestamp:t.timestamp})}if(a.kind==="tool_result"){const f=a.toolName||"Tool",k=a.success,h=a.summary,u=a.output,x=u?(b=G(u))!=null&&b.diff?vt(u):u:void 0;s.push({id:t.id,title:`Tool Result · ${f}`,subtitle:h,status:k===void 0?"running":k?"success":"error",content:x,timestamp:t.timestamp})}}return s})}function zr(r){var a;const t=[],s=new Set;for(let c=r.length-1;c>=0;c-=1){const i=r[c];if((a=i.agentContent)!=null&&a.toolCalls)for(let u=i.agentContent.toolCalls.length-1;u>=0;u-=1){const x=i.agentContent.toolCalls[u],m=x.metadata;if((m==null?void 0:m.kind)==="patch"&&Array.isArray(m.changes)){bt(t,s,m.changes,x.summary);continue}const v=x.output||"",l=G(v)||G((m==null?void 0:m.diff_snippet)||"");if(l!=null&&l.diff){const N=(m==null?void 0:m.file_path)||x.toolName||"unknown";if(!s.has(N)){s.add(N);const p=typeof(m==null?void 0:m.oldContent)=="string"?m.oldContent:void 0,w=typeof(m==null?void 0:m.newContent)=="string"?m.newContent:void 0;t.push({diff:l.diff,filePath:N,summary:x.summary,oldContent:p,newContent:w})}}}const b=i.metadata;if(!b||b.kind!=="tool_result")continue;const f=b.metadata;if((f==null?void 0:f.kind)==="patch"&&Array.isArray(f.changes)){bt(t,s,f.changes,b.summary);continue}const k=b.output||(typeof i.content=="string"?i.content:"")||"",h=G(k)||G((f==null?void 0:f.diff_snippet)||"");if(h!=null&&h.diff){const u=(f==null?void 0:f.file_path)||b.toolName||"unknown";if(!s.has(u)){s.add(u);const x=typeof(f==null?void 0:f.oldContent)=="string"?f.oldContent:void 0,m=typeof(f==null?void 0:f.newContent)=="string"?f.newContent:void 0;t.push({diff:h.diff,filePath:u,summary:b.summary,oldContent:x,newContent:m})}}}return t.reverse()}function bt(r,t,s,a){for(let c=s.length-1;c>=0;c--){const i=s[c];!i||typeof i!="object"||!("path"in i)||typeof i.path!="string"||!("diff"in i)||typeof i.diff!="string"||t.has(i.path)||(t.add(i.path),r.push({diff:{patch:i.diff,startLine:1,matchLine:1},filePath:i.path,summary:a,oldContent:"oldContent"in i&&typeof i.oldContent=="string"?i.oldContent:void 0,newContent:"newContent"in i&&typeof i.newContent=="string"?i.newContent:void 0}))}}function G(r){if(!r)return null;const t=/<<<DIFF>>>\s*([\s\S]*?)\s*<<<\/DIFF>>>/m,s=r.match(t);if(!s)return null;try{return{diff:JSON.parse(s[1])}}catch{return null}}function vt(r){return r?r.replace(/<<<DIFF>>>[\s\S]*?<<<\/DIFF>>>/m,"").trim():""}function kt(r){if(!r)return"";if(typeof r=="string")try{return JSON.stringify(JSON.parse(r),null,2)}catch{return r}return JSON.stringify(r,null,2)}function gt(){const r=_();return e.jsx("div",{className:"h-full flex items-center justify-center text-[12px] text-[hsl(var(--deck-ink-muted))] font-mono",children:r("preview.files.editorLoading")})}function Br({content:r,filename:t}){const{codeTheme:s}=rr(),a=o.useRef(null),[c,i]=o.useState("vs-dark"),b=qr(t),f=k=>{a.current=k;const h=ot(k,s);i(h)};return o.useEffect(()=>{if(a.current){const k=ot(a.current,s);i(k)}},[s]),e.jsx($r,{value:r,language:b,theme:c,height:"100%",beforeMount:f,options:{readOnly:!0,minimap:{enabled:!1},fontSize:12,lineNumbers:"on",wordWrap:"on",scrollBeyondLastLine:!1,automaticLayout:!0}},t)}function qr(r){var a;const t=((a=r.split(".").pop())==null?void 0:a.toLowerCase())||"";return{ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",json:"json",md:"markdown",css:"css",scss:"scss",html:"html",yml:"yaml",yaml:"yaml",go:"go",rs:"rust",py:"python",java:"java",c:"c",cpp:"cpp",h:"cpp",hpp:"cpp",sh:"shell",zsh:"shell",toml:"toml",xml:"xml"}[t]||"plaintext"}export{Kr as FilePreview};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,r as p}from"./vendor-react-DG5dkZ_t.js";import{u as V,c as g,d as M,p as ne,q as pe,j as P,r as be,D as fe,e as ve,f as ge,g as je,h as Ne,i as ye,t as ee,a as o,v as we,b as U,w as Se,P as Pe}from"./index-CfVQVVVI.js";import{ac as re,ad as Te,ae as Ce,L as E,R as De,S as Ie,P as Ae,A as _e,J as Ke,V as Ee,f as Fe,a9 as Re,e as se,af as Oe,a4 as qe,a3 as Le,i as Me,l as Be,c as ze,W as Qe,a as Ue}from"./vendor-icons-DovdPN7M.js";import"./vendor-radix-DXRuAJHH.js";import"./session-events-Bgir_Gl_.js";const G=["waiting","active","blocked","review"],ae={high:0,medium:1,low:2};function Ve(t){return t.taskIsolation!==void 0||t.taskPromptSummary!==void 0||t.taskRetryAvailable===!0}function te(t){return t.taskSourceProjectPath||t.projectPath}function Ye(t){return t.pendingInteraction?"blocked":t.taskStatus==="queued"?"waiting":t.taskStatus==="running"?"active":t.taskStatus==="completed"?"review":"blocked"}function He(t,r){if(t.pendingInteraction!==r.pendingInteraction)return t.pendingInteraction?-1:1;const i=ae[t.taskPriority??"medium"]-ae[r.taskPriority??"medium"];if(i!==0)return i;const u=t.taskDueAt?Date.parse(t.taskDueAt):Number.POSITIVE_INFINITY,n=r.taskDueAt?Date.parse(r.taskDueAt):Number.POSITIVE_INFINITY;if(u!==n)return u-n;if(t.taskStatus==="queued"&&r.taskStatus==="queued"){const m=(t.taskQueuePosition??Number.POSITIVE_INFINITY)-(r.taskQueuePosition??Number.POSITIVE_INFINITY);if(m!==0)return m}return r.lastMessageTime.localeCompare(t.lastMessageTime)}function We(t){const r={waiting:[],active:[],blocked:[],review:[]};for(const i of t)Ve(i)&&r[Ye(i)].push(i);for(const i of G)r[i].sort(He);return r}function $e(t){return`TASK-${t.replace(/^task-?/,"").slice(0,6).toUpperCase()}`}const Ge={high:{label:"kanban.priority.high",className:"border-red-200 bg-red-50 text-red-700 dark:border-red-900/70 dark:bg-red-950/35 dark:text-red-300"},medium:{label:"kanban.priority.medium",className:"border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-900/70 dark:bg-amber-950/35 dark:text-amber-300"},low:{label:"kanban.priority.low",className:"border-zinc-200 bg-zinc-50 text-zinc-600 dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-400"}},Je={feature:"kanban.kind.feature",bug:"kanban.kind.bug",maintenance:"kanban.kind.maintenance",research:"kanban.kind.research"};function Xe(t){const r=new Date(t);return Number.isNaN(r.getTime())?"":new Intl.DateTimeFormat(be()==="zh"?"zh-CN":"en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(r)}function K({label:t,onClick:r,disabled:i,tone:u="neutral",children:n}){return e.jsx("button",{type:"button","aria-label":t,title:t,disabled:i,onClick:r,className:P("flex h-7 w-7 shrink-0 items-center justify-center rounded-md transition-colors focus-visible:outline-none focus-visible:ring-1 disabled:cursor-wait disabled:opacity-45",u==="danger"?"text-red-500 hover:bg-red-500/10 focus-visible:ring-red-500":u==="accent"?"text-[hsl(var(--deck-accent))] hover:bg-[hsl(var(--deck-accent-soft))] focus-visible:ring-[hsl(var(--deck-accent))]":"text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-surface-2))] hover:text-[hsl(var(--deck-ink))] focus-visible:ring-[hsl(var(--deck-accent))]"),children:n})}function Ze({session:t,unread:r,cancelling:i,retrying:u,updating:n,onOpen:m,onInspect:T,onEdit:C,onCancel:y,onRetry:c,onArchive:k}){const l=V(),w=g(t),f=M(w),b=ne(t,l),v=Ge[t.taskPriority??"medium"],x=t.taskKind??"feature",h=pe(t,l),D=t.taskSourceProjectPath||t.projectPath,I=D.split("/").filter(Boolean).at(-1)||D,F=t.taskStatus==="queued"||t.taskStatus==="running",N=!!t.taskRetryAvailable&&["failed","interrupted","cancelled"].includes(t.taskStatus),A=!!t.pendingInteraction,S=t.taskStatus==="completed";return e.jsxs("article",{"data-kanban-task":f,className:P("group rounded-md border bg-[hsl(var(--deck-surface))] px-3 py-3 shadow-[0_1px_2px_hsl(var(--deck-ink)/0.04)] transition-[border-color,box-shadow,transform]","border-[hsl(var(--deck-border))] hover:-translate-y-px hover:border-[hsl(var(--deck-border-strong))] hover:shadow-[0_8px_24px_-16px_hsl(var(--deck-ink)/0.35)]",r&&"border-[hsl(var(--deck-accent)/0.55)]"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"font-mono text-[9.5px] uppercase text-[hsl(var(--deck-ink-faint))]",children:$e(t.sessionId)}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[r&&e.jsx("span",{"aria-label":l("kanban.card.unread"),title:l("kanban.card.unread"),className:"h-1.5 w-1.5 rounded-full bg-[hsl(var(--deck-accent))] shadow-[0_0_6px_hsl(var(--deck-accent-glow)/0.8)]"}),e.jsx("span",{className:"truncate font-mono text-[9.5px] text-[hsl(var(--deck-ink-faint))]",children:I})]})]}),e.jsx("button",{type:"button",onClick:m,className:"mt-2 block w-full text-left text-[13px] font-medium leading-[1.45] text-[hsl(var(--deck-ink))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:b}),h&&e.jsx("p",{title:h,className:P("mt-1.5 line-clamp-2 text-[10.5px] leading-[1.45]",A||t.taskStatus==="failed"?"text-red-600 dark:text-red-400":"text-[hsl(var(--deck-ink-faint))]"),children:h}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-1",children:[e.jsx("span",{className:P("rounded-sm border px-1.5 py-0.5 font-mono text-[9px] font-medium",v.className),children:l(v.label)}),e.jsx("span",{className:"rounded-sm border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] px-1.5 py-0.5 font-mono text-[9px] text-[hsl(var(--deck-ink-muted))]",children:l(Je[x])}),t.taskDueAt&&e.jsxs("span",{className:P("inline-flex items-center gap-1 rounded-sm border px-1.5 py-0.5 font-mono text-[9px]",Date.parse(t.taskDueAt)<Date.now()&&!S?"border-red-200 bg-red-50 text-red-700 dark:border-red-900/70 dark:bg-red-950/35 dark:text-red-300":"border-[hsl(var(--deck-border))] text-[hsl(var(--deck-ink-faint))]"),children:[e.jsx(re,{className:"h-2.5 w-2.5"}),Xe(t.taskDueAt)]})]}),t.taskStatus==="queued"&&t.taskQueuePosition&&e.jsx("div",{className:"mt-2 font-mono text-[9.5px] text-amber-700 dark:text-amber-400",children:l("kanban.card.queuePosition",{position:t.taskQueuePosition,depth:t.taskQueueDepth??t.taskQueuePosition})}),t.taskDiffStat&&e.jsx("div",{className:"mt-2 font-mono text-[9.5px] text-[hsl(var(--deck-ink-faint))]",children:l("kanban.card.diff",{files:t.taskDiffStat.changedFiles,additions:t.taskDiffStat.additions,deletions:t.taskDiffStat.deletions})}),e.jsxs("div",{className:"mt-3 flex items-center justify-end gap-0.5 border-t border-[hsl(var(--deck-hairline))] pt-2",children:[A&&e.jsx(K,{label:l("kanban.action.respond"),onClick:m,tone:"danger",children:e.jsx(Te,{className:"h-3.5 w-3.5"})}),S&&e.jsx(K,{label:l("kanban.action.inspect"),onClick:T,tone:"accent",children:e.jsx(Ce,{className:"h-3.5 w-3.5"})}),N&&e.jsx(K,{label:l("kanban.action.retry"),onClick:c,disabled:u,tone:"accent",children:u?e.jsx(E,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(De,{className:"h-3.5 w-3.5"})}),F&&e.jsx(K,{label:l("kanban.action.cancel"),onClick:y,disabled:i,tone:"danger",children:i?e.jsx(E,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(Ie,{className:"h-3.5 w-3.5"})}),e.jsx(K,{label:l("kanban.action.edit"),onClick:C,disabled:n,children:n?e.jsx(E,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(Ae,{className:"h-3.5 w-3.5"})}),S&&e.jsx(K,{label:l("kanban.action.archive"),onClick:k,children:e.jsx(_e,{className:"h-3.5 w-3.5"})}),e.jsx(K,{label:l("kanban.action.open"),onClick:m,children:e.jsx(Ke,{className:"h-3.5 w-3.5"})})]})]})}const ea={waiting:{title:"kanban.column.waiting",description:"kanban.column.waitingDescription",icon:Re,accent:"bg-amber-400",iconStyle:"text-amber-700 dark:text-amber-400"},active:{title:"kanban.column.active",description:"kanban.column.activeDescription",icon:E,accent:"bg-blue-500",iconStyle:"text-blue-700 dark:text-blue-400"},blocked:{title:"kanban.column.blocked",description:"kanban.column.blockedDescription",icon:Fe,accent:"bg-red-500",iconStyle:"text-red-700 dark:text-red-400"},review:{title:"kanban.column.review",description:"kanban.column.reviewDescription",icon:Ee,accent:"bg-[hsl(var(--deck-accent))]",iconStyle:"text-[hsl(var(--deck-accent))]"}};function aa({id:t,sessions:r,unreadTaskKeys:i,cancellingTaskKeys:u,retryingTaskKeys:n,updatingTaskKeys:m,taskKey:T,onOpen:C,onInspect:y,onEdit:c,onCancel:k,onRetry:l,onArchive:w}){const f=V(),b=ea[t],v=b.icon;return e.jsxs("section",{"data-kanban-column":t,"aria-labelledby":`kanban-column-${t}`,className:"flex min-h-[180px] min-w-0 flex-col border-t-2 border-[hsl(var(--deck-hairline))] pt-3 md:min-h-[360px]",children:[e.jsxs("header",{className:"mb-3 flex min-h-12 items-start gap-2 px-0.5",children:[e.jsx(v,{className:P("mt-0.5 h-3.5 w-3.5 shrink-0",b.iconStyle,t==="active"&&"animate-spin")}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{id:`kanban-column-${t}`,className:"font-mono text-[11px] font-semibold uppercase text-[hsl(var(--deck-ink))]",children:f(b.title)}),e.jsx("span",{className:"min-w-5 rounded-sm bg-[hsl(var(--deck-surface-2))] px-1.5 py-0.5 text-center font-mono text-[9px] text-[hsl(var(--deck-ink-faint))]",children:r.length})]}),e.jsx("p",{className:"mt-0.5 text-[10px] leading-4 text-[hsl(var(--deck-ink-faint))]",children:f(b.description)})]}),e.jsx("span",{className:P("mt-1 h-1.5 w-1.5 shrink-0 rounded-full",b.accent)})]}),e.jsxs("div",{className:"flex flex-1 flex-col gap-2.5",children:[r.map(x=>{const h=T(x);return e.jsx(Ze,{session:x,unread:i.includes(h),cancelling:u.includes(h),retrying:n.includes(h),updating:m.includes(h),onOpen:()=>C(x),onInspect:()=>y(x),onEdit:()=>c(x),onCancel:()=>k(x),onRetry:()=>l(x),onArchive:()=>w(x)},h)}),r.length===0&&e.jsx("div",{className:"flex min-h-28 items-center justify-center rounded-md border border-dashed border-[hsl(var(--deck-border))] px-4 text-center font-mono text-[10px] leading-4 text-[hsl(var(--deck-ink-faint))]",children:f("kanban.column.empty")})]})]})}function ta(t){if(!t)return"";const r=new Date(t);return Number.isNaN(r.getTime())?"":new Date(r.getTime()-r.getTimezoneOffset()*6e4).toISOString().slice(0,16)}function na({open:t,onOpenChange:r,projects:i,defaultProjectPath:u,session:n,submitting:m,canCreate:T,onCreate:C,onUpdate:y}){const c=V(),k=!!n,[l,w]=p.useState(""),[f,b]=p.useState(""),[v,x]=p.useState(u??""),[h,D]=p.useState("medium"),[I,F]=p.useState("feature"),[N,A]=p.useState(""),[S,R]=p.useState(null);p.useEffect(()=>{var s;t&&(w((n==null?void 0:n.title)??""),b((n==null?void 0:n.taskPromptSummary)??""),x((n==null?void 0:n.taskSourceProjectPath)??(n==null?void 0:n.projectPath)??u??((s=i.find(j=>j.available))==null?void 0:s.path)??""),D((n==null?void 0:n.taskPriority)??"medium"),F((n==null?void 0:n.taskKind)??"feature"),A(ta(n==null?void 0:n.taskDueAt)),R(null))},[u,t,i,n]);const B=async s=>{s.preventDefault();const j=l.trim(),z=f.trim();if(!(!k&&(!z||!v))){R(null);try{k?await y({...j?{title:j}:{},taskPriority:h,taskKind:I,taskDueAt:N?new Date(N).toISOString():null}):await C({...j?{title:j}:{},prompt:z,projectPath:v,taskPriority:h,taskKind:I,...N?{taskDueAt:new Date(N).toISOString()}:{}}),r(!1)}catch(O){R(O instanceof Error?O.message:c("kanban.dialog.submitFailed"))}}};return e.jsx(fe,{open:t,onOpenChange:r,children:e.jsxs(ve,{className:"max-w-[560px] gap-0 overflow-hidden border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] p-0",children:[e.jsxs(ge,{className:"border-b border-[hsl(var(--deck-hairline))] px-5 py-4",children:[e.jsx(je,{className:"font-mono text-[15px] text-[hsl(var(--deck-ink))]",children:c(k?"kanban.dialog.editTitle":"kanban.dialog.createTitle")}),e.jsx(Ne,{className:"text-[11.5px] text-[hsl(var(--deck-ink-faint))]",children:c(k?"kanban.dialog.editDescription":"kanban.dialog.createDescription")})]}),e.jsxs("form",{onSubmit:B,children:[e.jsxs("div",{className:"grid gap-4 px-5 py-5",children:[e.jsxs("label",{className:"grid gap-1.5",children:[e.jsx("span",{className:"font-mono text-[10px] uppercase text-[hsl(var(--deck-ink-muted))]",children:c("kanban.field.title")}),e.jsx("input",{value:l,onChange:s=>w(s.target.value),maxLength:200,className:"field",placeholder:c("kanban.field.titlePlaceholder")})]}),!k&&e.jsxs("label",{className:"grid gap-1.5",children:[e.jsx("span",{className:"font-mono text-[10px] uppercase text-[hsl(var(--deck-ink-muted))]",children:c("kanban.field.prompt")}),e.jsx("textarea",{required:!0,value:f,onChange:s=>b(s.target.value),maxLength:32e3,rows:6,className:"min-h-32 w-full resize-y rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] px-3 py-2.5 text-[13px] leading-5 text-[hsl(var(--deck-ink))] outline-none placeholder:text-[hsl(var(--deck-ink-faint))] focus:border-[hsl(var(--deck-accent)/0.6)] focus:ring-1 focus:ring-[hsl(var(--deck-accent)/0.35)]",placeholder:c("kanban.field.promptPlaceholder")})]}),!k&&e.jsxs("label",{className:"grid gap-1.5",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-[10px] uppercase text-[hsl(var(--deck-ink-muted))]",children:[e.jsx(se,{className:"h-3 w-3"}),c("kanban.field.project")]}),e.jsx("select",{required:!0,value:v,onChange:s=>x(s.target.value),className:"field",children:i.filter(s=>s.available).map(s=>e.jsx("option",{value:s.path,children:s.name},s.path))})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[e.jsxs("label",{className:"grid gap-1.5",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-[10px] uppercase text-[hsl(var(--deck-ink-muted))]",children:[e.jsx(Oe,{className:"h-3 w-3"}),c("kanban.field.kind")]}),e.jsxs("select",{value:I,onChange:s=>F(s.target.value),className:"field",children:[e.jsx("option",{value:"feature",children:c("kanban.kind.feature")}),e.jsx("option",{value:"bug",children:c("kanban.kind.bug")}),e.jsx("option",{value:"maintenance",children:c("kanban.kind.maintenance")}),e.jsx("option",{value:"research",children:c("kanban.kind.research")})]})]}),e.jsxs("label",{className:"grid gap-1.5",children:[e.jsx("span",{className:"font-mono text-[10px] uppercase text-[hsl(var(--deck-ink-muted))]",children:c("kanban.field.priority")}),e.jsxs("select",{value:h,onChange:s=>D(s.target.value),className:"field",children:[e.jsx("option",{value:"high",children:c("kanban.priority.high")}),e.jsx("option",{value:"medium",children:c("kanban.priority.medium")}),e.jsx("option",{value:"low",children:c("kanban.priority.low")})]})]}),e.jsxs("label",{className:"grid gap-1.5",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-[10px] uppercase text-[hsl(var(--deck-ink-muted))]",children:[e.jsx(re,{className:"h-3 w-3"}),c("kanban.field.dueAt")]}),e.jsx("input",{type:"datetime-local",value:N,onChange:s=>A(s.target.value),className:"field min-w-0"})]})]}),!k&&e.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] px-3 py-2 font-mono text-[10px] text-[hsl(var(--deck-ink-muted))]",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-[hsl(var(--deck-accent))]"}),c("kanban.dialog.localExecution")]}),S&&e.jsx("div",{role:"alert",className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 text-[11px] text-red-700 dark:border-red-900/70 dark:bg-red-950/35 dark:text-red-300",children:S})]}),e.jsxs(ye,{className:"border-t border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-surface-2))]/60 px-5 py-3",children:[e.jsx(ee,{type:"button",variant:"ghost",onClick:()=>r(!1),disabled:m,children:c("kanban.dialog.cancel")}),e.jsxs(ee,{type:"submit",disabled:m||!k&&(!T||!f.trim()||!v),className:"gap-2",children:[m&&e.jsx(E,{className:"h-3.5 w-3.5 animate-spin"}),c(k?"kanban.dialog.save":"kanban.dialog.dispatch")]})]})]})]})})}function oa(){var Z;const t=V(),r=o(a=>a.sessions),i=o(a=>a.boundProjects),u=o(a=>a.selectedProjectPath),n=o(a=>a.taskWorkspaceInfo),m=o(a=>a.catalogLoadState),T=o(a=>a.taskEventConnectionState),C=o(a=>a.isDispatchingTask),y=o(a=>a.isUpdatingTaskAdmission),c=o(a=>a.cancellingTaskKeys),k=o(a=>a.retryingTaskKeys),l=o(a=>a.updatingTaskKeys),w=o(a=>a.unreadTaskKeys),f=o(a=>a.error),b=o(a=>a.selectProject),v=o(a=>a.selectSession),x=o(a=>a.dispatchTask),h=o(a=>a.updateTask),D=o(a=>a.cancelTask),I=o(a=>a.retryTask),F=o(a=>a.archiveSession),N=o(a=>a.setTaskAdmissionPaused),A=o(a=>a.reconnectTaskEvents),S=o(a=>a.clearError),R=we(a=>a.currentMode),B=U(a=>a.setMainView),s=U(a=>a.boardProjectPath),j=U(a=>a.setBoardProjectPath),z=U(a=>a.openFilePreview),[O,ce]=p.useState(""),[ie,Y]=p.useState(!1),[le,H]=p.useState(null),[oe,W]=p.useState(!1);p.useEffect(()=>{s&&!i.some(a=>a.path===s&&a.available)&&j(null)},[s,i,j]);const q=r.find(a=>M(g(a))===le)??null,$=O.trim().toLowerCase(),J=p.useMemo(()=>r.filter(a=>s&&te(a)!==s?!1:$?[a.sessionId,ne(a,t),a.taskPromptSummary,te(a),a.taskPriority,a.taskKind].filter(Boolean).join(" ").toLowerCase().includes($):!0),[s,$,r,t]),X=p.useMemo(()=>We(J),[J]),de=G.reduce((a,d)=>a+X[d].length,0),_=n==null?void 0:n.taskAdmission,L=_?!_.paused:!0,Q=i.filter(a=>a.available),ue=s??u??((Z=Q[0])==null?void 0:Z.path)??null,me=q?l.includes(M(g(q))):C,ke=async a=>{B("workspace"),await v(g(a))},xe=async a=>{B("workspace"),await v(g(a)),z({tab:"diff"})},he=async a=>{b(a.projectPath),await x({...a,isolation:"local",permissionMode:R},{selectSession:!1})};return e.jsxs("main",{"data-kanban-board":!0,className:"flex h-full min-w-0 flex-col overflow-hidden bg-[hsl(var(--deck-canvas))] text-[hsl(var(--deck-ink))]",children:[e.jsxs("div",{className:"border-b border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas))] px-4 py-3 sm:px-6",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h1",{className:"font-mono text-[15px] font-semibold",children:t("kanban.title")}),e.jsx("span",{className:"rounded-sm border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-1.5 py-0.5 font-mono text-[9px] text-[hsl(var(--deck-ink-faint))]",children:t("kanban.taskCount",{count:de})})]}),e.jsx("p",{className:"mt-0.5 text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:t("kanban.subtitle")})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[_&&e.jsx("div",{className:"hidden rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-2.5 py-1.5 lg:block",children:e.jsx(Se,{inFlight:_.inFlight,queued:_.queued,maxConcurrent:_.maxConcurrent,compact:!0})}),e.jsxs("button",{type:"button",role:"switch","aria-checked":L,disabled:!_||y,onClick:()=>{N(L).catch(()=>{})},className:P("inline-flex h-8 items-center gap-2 rounded-md border px-2.5 font-mono text-[10.5px] transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:opacity-45",L?"border-[hsl(var(--deck-accent)/0.45)] bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-accent))]":"border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] text-[hsl(var(--deck-ink-muted))]"),children:[y?e.jsx(E,{className:"h-3 w-3 animate-spin"}):L?e.jsx(qe,{className:"h-3 w-3 fill-current"}):e.jsx(Le,{className:"h-3 w-3"}),t(L?"kanban.autoClaim.running":"kanban.autoClaim.paused")]}),e.jsxs("button",{type:"button",onClick:()=>{if(Q.length===0){W(!0);return}H(null),Y(!0)},className:"inline-flex h-8 items-center gap-1.5 rounded-md bg-[hsl(var(--deck-ink))] px-3 font-mono text-[10.5px] font-medium text-[hsl(var(--deck-canvas))] transition-opacity hover:opacity-85 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[hsl(var(--deck-accent))]",children:[e.jsx(Me,{className:"h-3.5 w-3.5"}),t("kanban.action.newTask")]})]})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[e.jsxs("label",{className:"relative min-w-[180px] flex-1 sm:max-w-[320px]",children:[e.jsx(Be,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-[hsl(var(--deck-ink-faint))]"}),e.jsx("input",{type:"search",value:O,onChange:a=>ce(a.target.value),"aria-label":t("kanban.searchAria"),placeholder:t("kanban.searchPlaceholder"),className:"h-8 w-full rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] pl-8 pr-3 font-mono text-[10.5px] text-[hsl(var(--deck-ink))] outline-none placeholder:text-[hsl(var(--deck-ink-faint))] focus:border-[hsl(var(--deck-accent)/0.55)] focus:ring-1 focus:ring-[hsl(var(--deck-accent)/0.25)]"})]}),e.jsxs("label",{className:"relative",children:[e.jsx(se,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-[hsl(var(--deck-accent))]"}),e.jsxs("select",{value:s??"__all__",onChange:a=>{const d=a.target.value;j(d==="__all__"?null:d),d!=="__all__"&&b(d)},"aria-label":t("kanban.projectFilterAria"),className:"h-8 min-w-[160px] appearance-none rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] pl-8 pr-7 font-mono text-[10.5px] text-[hsl(var(--deck-ink-muted))] outline-none focus:border-[hsl(var(--deck-accent)/0.55)]",children:[e.jsx("option",{value:"__all__",children:t("kanban.projectAll")}),Q.map(a=>e.jsx("option",{value:a.path,children:a.name},a.path))]})]}),e.jsx("button",{type:"button",onClick:()=>W(!0),"aria-label":t("projects.bind.action"),title:t("projects.bind.action"),className:"flex h-8 w-8 items-center justify-center rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] text-[hsl(var(--deck-ink-faint))] hover:text-[hsl(var(--deck-accent))]",children:e.jsx(ze,{className:"h-3.5 w-3.5"})}),m==="loading"||m==="hydrating"?e.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-[9.5px] text-[hsl(var(--deck-ink-faint))]",children:[e.jsx(E,{className:"h-3 w-3 animate-spin"}),t("sidebar.catalog.syncing")]}):null]})]}),T==="offline"&&e.jsxs("div",{role:"alert",className:"flex items-center gap-2 border-b border-amber-300/60 bg-amber-50/80 px-4 py-2 text-[10.5px] text-amber-800 dark:border-amber-900/70 dark:bg-amber-950/30 dark:text-amber-300 sm:px-6",children:[e.jsx(Qe,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"flex-1",children:t("kanban.feed.offline")}),e.jsxs("button",{type:"button",onClick:()=>void A().catch(()=>{}),className:"inline-flex h-7 items-center gap-1 rounded-md px-2 font-mono hover:bg-amber-100 dark:hover:bg-amber-900/40",children:[e.jsx(Ue,{className:"h-3 w-3"}),t("taskHome.feed.retry")]})]}),f&&e.jsxs("div",{role:"alert",className:"flex items-center gap-3 border-b border-red-200 bg-red-50 px-4 py-2 text-[10.5px] text-red-700 dark:border-red-900/70 dark:bg-red-950/30 dark:text-red-300 sm:px-6",children:[e.jsx("span",{className:"flex-1",children:f}),e.jsx("button",{type:"button",onClick:S,className:"font-mono underline",children:t("taskHome.error.dismiss")})]}),e.jsx("div",{className:"flex-1 overflow-auto px-4 py-4 sm:px-6",children:e.jsx("div",{className:"grid min-w-0 grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-4",children:G.map(a=>e.jsx(aa,{id:a,sessions:X[a],unreadTaskKeys:w,cancellingTaskKeys:c,retryingTaskKeys:k,updatingTaskKeys:l,taskKey:d=>M(g(d)),onOpen:d=>{ke(d).catch(()=>{})},onInspect:d=>{xe(d).catch(()=>{})},onEdit:d=>{H(M(g(d))),Y(!0)},onCancel:d=>{D(g(d)).catch(()=>{})},onRetry:d=>{I(g(d)).catch(()=>{})},onArchive:d=>{F(g(d))}},a))})}),e.jsx(na,{open:ie,onOpenChange:a=>{Y(a),a||H(null)},projects:i,defaultProjectPath:ue,session:q,submitting:me,canCreate:Q.length>0,onCreate:he,onUpdate:async a=>{q&&await h(g(q),a)}}),e.jsx(Pe,{open:oe,onOpenChange:W})]})}export{oa as KanbanBoard};
|
|
1
|
+
import{j as e,r as p}from"./vendor-react-DG5dkZ_t.js";import{u as V,c as g,d as M,p as ne,q as pe,j as P,r as be,D as fe,e as ve,f as ge,g as je,h as Ne,i as ye,t as ee,a as o,v as we,b as U,w as Se,P as Pe}from"./index-DHX-G3RT.js";import{ac as re,ad as Te,ae as Ce,L as E,R as De,S as Ie,P as Ae,A as _e,J as Ke,V as Ee,f as Fe,a9 as Re,e as se,af as Oe,a4 as qe,a3 as Le,i as Me,l as Be,c as ze,W as Qe,a as Ue}from"./vendor-icons-DovdPN7M.js";import"./vendor-radix-DXRuAJHH.js";import"./session-events-Bgir_Gl_.js";const G=["waiting","active","blocked","review"],ae={high:0,medium:1,low:2};function Ve(t){return t.taskIsolation!==void 0||t.taskPromptSummary!==void 0||t.taskRetryAvailable===!0}function te(t){return t.taskSourceProjectPath||t.projectPath}function Ye(t){return t.pendingInteraction?"blocked":t.taskStatus==="queued"?"waiting":t.taskStatus==="running"?"active":t.taskStatus==="completed"?"review":"blocked"}function He(t,r){if(t.pendingInteraction!==r.pendingInteraction)return t.pendingInteraction?-1:1;const i=ae[t.taskPriority??"medium"]-ae[r.taskPriority??"medium"];if(i!==0)return i;const u=t.taskDueAt?Date.parse(t.taskDueAt):Number.POSITIVE_INFINITY,n=r.taskDueAt?Date.parse(r.taskDueAt):Number.POSITIVE_INFINITY;if(u!==n)return u-n;if(t.taskStatus==="queued"&&r.taskStatus==="queued"){const m=(t.taskQueuePosition??Number.POSITIVE_INFINITY)-(r.taskQueuePosition??Number.POSITIVE_INFINITY);if(m!==0)return m}return r.lastMessageTime.localeCompare(t.lastMessageTime)}function We(t){const r={waiting:[],active:[],blocked:[],review:[]};for(const i of t)Ve(i)&&r[Ye(i)].push(i);for(const i of G)r[i].sort(He);return r}function $e(t){return`TASK-${t.replace(/^task-?/,"").slice(0,6).toUpperCase()}`}const Ge={high:{label:"kanban.priority.high",className:"border-red-200 bg-red-50 text-red-700 dark:border-red-900/70 dark:bg-red-950/35 dark:text-red-300"},medium:{label:"kanban.priority.medium",className:"border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-900/70 dark:bg-amber-950/35 dark:text-amber-300"},low:{label:"kanban.priority.low",className:"border-zinc-200 bg-zinc-50 text-zinc-600 dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-400"}},Je={feature:"kanban.kind.feature",bug:"kanban.kind.bug",maintenance:"kanban.kind.maintenance",research:"kanban.kind.research"};function Xe(t){const r=new Date(t);return Number.isNaN(r.getTime())?"":new Intl.DateTimeFormat(be()==="zh"?"zh-CN":"en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(r)}function K({label:t,onClick:r,disabled:i,tone:u="neutral",children:n}){return e.jsx("button",{type:"button","aria-label":t,title:t,disabled:i,onClick:r,className:P("flex h-7 w-7 shrink-0 items-center justify-center rounded-md transition-colors focus-visible:outline-none focus-visible:ring-1 disabled:cursor-wait disabled:opacity-45",u==="danger"?"text-red-500 hover:bg-red-500/10 focus-visible:ring-red-500":u==="accent"?"text-[hsl(var(--deck-accent))] hover:bg-[hsl(var(--deck-accent-soft))] focus-visible:ring-[hsl(var(--deck-accent))]":"text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-surface-2))] hover:text-[hsl(var(--deck-ink))] focus-visible:ring-[hsl(var(--deck-accent))]"),children:n})}function Ze({session:t,unread:r,cancelling:i,retrying:u,updating:n,onOpen:m,onInspect:T,onEdit:C,onCancel:y,onRetry:c,onArchive:k}){const l=V(),w=g(t),f=M(w),b=ne(t,l),v=Ge[t.taskPriority??"medium"],x=t.taskKind??"feature",h=pe(t,l),D=t.taskSourceProjectPath||t.projectPath,I=D.split("/").filter(Boolean).at(-1)||D,F=t.taskStatus==="queued"||t.taskStatus==="running",N=!!t.taskRetryAvailable&&["failed","interrupted","cancelled"].includes(t.taskStatus),A=!!t.pendingInteraction,S=t.taskStatus==="completed";return e.jsxs("article",{"data-kanban-task":f,className:P("group rounded-md border bg-[hsl(var(--deck-surface))] px-3 py-3 shadow-[0_1px_2px_hsl(var(--deck-ink)/0.04)] transition-[border-color,box-shadow,transform]","border-[hsl(var(--deck-border))] hover:-translate-y-px hover:border-[hsl(var(--deck-border-strong))] hover:shadow-[0_8px_24px_-16px_hsl(var(--deck-ink)/0.35)]",r&&"border-[hsl(var(--deck-accent)/0.55)]"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"font-mono text-[9.5px] uppercase text-[hsl(var(--deck-ink-faint))]",children:$e(t.sessionId)}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[r&&e.jsx("span",{"aria-label":l("kanban.card.unread"),title:l("kanban.card.unread"),className:"h-1.5 w-1.5 rounded-full bg-[hsl(var(--deck-accent))] shadow-[0_0_6px_hsl(var(--deck-accent-glow)/0.8)]"}),e.jsx("span",{className:"truncate font-mono text-[9.5px] text-[hsl(var(--deck-ink-faint))]",children:I})]})]}),e.jsx("button",{type:"button",onClick:m,className:"mt-2 block w-full text-left text-[13px] font-medium leading-[1.45] text-[hsl(var(--deck-ink))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:b}),h&&e.jsx("p",{title:h,className:P("mt-1.5 line-clamp-2 text-[10.5px] leading-[1.45]",A||t.taskStatus==="failed"?"text-red-600 dark:text-red-400":"text-[hsl(var(--deck-ink-faint))]"),children:h}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-1",children:[e.jsx("span",{className:P("rounded-sm border px-1.5 py-0.5 font-mono text-[9px] font-medium",v.className),children:l(v.label)}),e.jsx("span",{className:"rounded-sm border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] px-1.5 py-0.5 font-mono text-[9px] text-[hsl(var(--deck-ink-muted))]",children:l(Je[x])}),t.taskDueAt&&e.jsxs("span",{className:P("inline-flex items-center gap-1 rounded-sm border px-1.5 py-0.5 font-mono text-[9px]",Date.parse(t.taskDueAt)<Date.now()&&!S?"border-red-200 bg-red-50 text-red-700 dark:border-red-900/70 dark:bg-red-950/35 dark:text-red-300":"border-[hsl(var(--deck-border))] text-[hsl(var(--deck-ink-faint))]"),children:[e.jsx(re,{className:"h-2.5 w-2.5"}),Xe(t.taskDueAt)]})]}),t.taskStatus==="queued"&&t.taskQueuePosition&&e.jsx("div",{className:"mt-2 font-mono text-[9.5px] text-amber-700 dark:text-amber-400",children:l("kanban.card.queuePosition",{position:t.taskQueuePosition,depth:t.taskQueueDepth??t.taskQueuePosition})}),t.taskDiffStat&&e.jsx("div",{className:"mt-2 font-mono text-[9.5px] text-[hsl(var(--deck-ink-faint))]",children:l("kanban.card.diff",{files:t.taskDiffStat.changedFiles,additions:t.taskDiffStat.additions,deletions:t.taskDiffStat.deletions})}),e.jsxs("div",{className:"mt-3 flex items-center justify-end gap-0.5 border-t border-[hsl(var(--deck-hairline))] pt-2",children:[A&&e.jsx(K,{label:l("kanban.action.respond"),onClick:m,tone:"danger",children:e.jsx(Te,{className:"h-3.5 w-3.5"})}),S&&e.jsx(K,{label:l("kanban.action.inspect"),onClick:T,tone:"accent",children:e.jsx(Ce,{className:"h-3.5 w-3.5"})}),N&&e.jsx(K,{label:l("kanban.action.retry"),onClick:c,disabled:u,tone:"accent",children:u?e.jsx(E,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(De,{className:"h-3.5 w-3.5"})}),F&&e.jsx(K,{label:l("kanban.action.cancel"),onClick:y,disabled:i,tone:"danger",children:i?e.jsx(E,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(Ie,{className:"h-3.5 w-3.5"})}),e.jsx(K,{label:l("kanban.action.edit"),onClick:C,disabled:n,children:n?e.jsx(E,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(Ae,{className:"h-3.5 w-3.5"})}),S&&e.jsx(K,{label:l("kanban.action.archive"),onClick:k,children:e.jsx(_e,{className:"h-3.5 w-3.5"})}),e.jsx(K,{label:l("kanban.action.open"),onClick:m,children:e.jsx(Ke,{className:"h-3.5 w-3.5"})})]})]})}const ea={waiting:{title:"kanban.column.waiting",description:"kanban.column.waitingDescription",icon:Re,accent:"bg-amber-400",iconStyle:"text-amber-700 dark:text-amber-400"},active:{title:"kanban.column.active",description:"kanban.column.activeDescription",icon:E,accent:"bg-blue-500",iconStyle:"text-blue-700 dark:text-blue-400"},blocked:{title:"kanban.column.blocked",description:"kanban.column.blockedDescription",icon:Fe,accent:"bg-red-500",iconStyle:"text-red-700 dark:text-red-400"},review:{title:"kanban.column.review",description:"kanban.column.reviewDescription",icon:Ee,accent:"bg-[hsl(var(--deck-accent))]",iconStyle:"text-[hsl(var(--deck-accent))]"}};function aa({id:t,sessions:r,unreadTaskKeys:i,cancellingTaskKeys:u,retryingTaskKeys:n,updatingTaskKeys:m,taskKey:T,onOpen:C,onInspect:y,onEdit:c,onCancel:k,onRetry:l,onArchive:w}){const f=V(),b=ea[t],v=b.icon;return e.jsxs("section",{"data-kanban-column":t,"aria-labelledby":`kanban-column-${t}`,className:"flex min-h-[180px] min-w-0 flex-col border-t-2 border-[hsl(var(--deck-hairline))] pt-3 md:min-h-[360px]",children:[e.jsxs("header",{className:"mb-3 flex min-h-12 items-start gap-2 px-0.5",children:[e.jsx(v,{className:P("mt-0.5 h-3.5 w-3.5 shrink-0",b.iconStyle,t==="active"&&"animate-spin")}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{id:`kanban-column-${t}`,className:"font-mono text-[11px] font-semibold uppercase text-[hsl(var(--deck-ink))]",children:f(b.title)}),e.jsx("span",{className:"min-w-5 rounded-sm bg-[hsl(var(--deck-surface-2))] px-1.5 py-0.5 text-center font-mono text-[9px] text-[hsl(var(--deck-ink-faint))]",children:r.length})]}),e.jsx("p",{className:"mt-0.5 text-[10px] leading-4 text-[hsl(var(--deck-ink-faint))]",children:f(b.description)})]}),e.jsx("span",{className:P("mt-1 h-1.5 w-1.5 shrink-0 rounded-full",b.accent)})]}),e.jsxs("div",{className:"flex flex-1 flex-col gap-2.5",children:[r.map(x=>{const h=T(x);return e.jsx(Ze,{session:x,unread:i.includes(h),cancelling:u.includes(h),retrying:n.includes(h),updating:m.includes(h),onOpen:()=>C(x),onInspect:()=>y(x),onEdit:()=>c(x),onCancel:()=>k(x),onRetry:()=>l(x),onArchive:()=>w(x)},h)}),r.length===0&&e.jsx("div",{className:"flex min-h-28 items-center justify-center rounded-md border border-dashed border-[hsl(var(--deck-border))] px-4 text-center font-mono text-[10px] leading-4 text-[hsl(var(--deck-ink-faint))]",children:f("kanban.column.empty")})]})]})}function ta(t){if(!t)return"";const r=new Date(t);return Number.isNaN(r.getTime())?"":new Date(r.getTime()-r.getTimezoneOffset()*6e4).toISOString().slice(0,16)}function na({open:t,onOpenChange:r,projects:i,defaultProjectPath:u,session:n,submitting:m,canCreate:T,onCreate:C,onUpdate:y}){const c=V(),k=!!n,[l,w]=p.useState(""),[f,b]=p.useState(""),[v,x]=p.useState(u??""),[h,D]=p.useState("medium"),[I,F]=p.useState("feature"),[N,A]=p.useState(""),[S,R]=p.useState(null);p.useEffect(()=>{var s;t&&(w((n==null?void 0:n.title)??""),b((n==null?void 0:n.taskPromptSummary)??""),x((n==null?void 0:n.taskSourceProjectPath)??(n==null?void 0:n.projectPath)??u??((s=i.find(j=>j.available))==null?void 0:s.path)??""),D((n==null?void 0:n.taskPriority)??"medium"),F((n==null?void 0:n.taskKind)??"feature"),A(ta(n==null?void 0:n.taskDueAt)),R(null))},[u,t,i,n]);const B=async s=>{s.preventDefault();const j=l.trim(),z=f.trim();if(!(!k&&(!z||!v))){R(null);try{k?await y({...j?{title:j}:{},taskPriority:h,taskKind:I,taskDueAt:N?new Date(N).toISOString():null}):await C({...j?{title:j}:{},prompt:z,projectPath:v,taskPriority:h,taskKind:I,...N?{taskDueAt:new Date(N).toISOString()}:{}}),r(!1)}catch(O){R(O instanceof Error?O.message:c("kanban.dialog.submitFailed"))}}};return e.jsx(fe,{open:t,onOpenChange:r,children:e.jsxs(ve,{className:"max-w-[560px] gap-0 overflow-hidden border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] p-0",children:[e.jsxs(ge,{className:"border-b border-[hsl(var(--deck-hairline))] px-5 py-4",children:[e.jsx(je,{className:"font-mono text-[15px] text-[hsl(var(--deck-ink))]",children:c(k?"kanban.dialog.editTitle":"kanban.dialog.createTitle")}),e.jsx(Ne,{className:"text-[11.5px] text-[hsl(var(--deck-ink-faint))]",children:c(k?"kanban.dialog.editDescription":"kanban.dialog.createDescription")})]}),e.jsxs("form",{onSubmit:B,children:[e.jsxs("div",{className:"grid gap-4 px-5 py-5",children:[e.jsxs("label",{className:"grid gap-1.5",children:[e.jsx("span",{className:"font-mono text-[10px] uppercase text-[hsl(var(--deck-ink-muted))]",children:c("kanban.field.title")}),e.jsx("input",{value:l,onChange:s=>w(s.target.value),maxLength:200,className:"field",placeholder:c("kanban.field.titlePlaceholder")})]}),!k&&e.jsxs("label",{className:"grid gap-1.5",children:[e.jsx("span",{className:"font-mono text-[10px] uppercase text-[hsl(var(--deck-ink-muted))]",children:c("kanban.field.prompt")}),e.jsx("textarea",{required:!0,value:f,onChange:s=>b(s.target.value),maxLength:32e3,rows:6,className:"min-h-32 w-full resize-y rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] px-3 py-2.5 text-[13px] leading-5 text-[hsl(var(--deck-ink))] outline-none placeholder:text-[hsl(var(--deck-ink-faint))] focus:border-[hsl(var(--deck-accent)/0.6)] focus:ring-1 focus:ring-[hsl(var(--deck-accent)/0.35)]",placeholder:c("kanban.field.promptPlaceholder")})]}),!k&&e.jsxs("label",{className:"grid gap-1.5",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-[10px] uppercase text-[hsl(var(--deck-ink-muted))]",children:[e.jsx(se,{className:"h-3 w-3"}),c("kanban.field.project")]}),e.jsx("select",{required:!0,value:v,onChange:s=>x(s.target.value),className:"field",children:i.filter(s=>s.available).map(s=>e.jsx("option",{value:s.path,children:s.name},s.path))})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[e.jsxs("label",{className:"grid gap-1.5",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-[10px] uppercase text-[hsl(var(--deck-ink-muted))]",children:[e.jsx(Oe,{className:"h-3 w-3"}),c("kanban.field.kind")]}),e.jsxs("select",{value:I,onChange:s=>F(s.target.value),className:"field",children:[e.jsx("option",{value:"feature",children:c("kanban.kind.feature")}),e.jsx("option",{value:"bug",children:c("kanban.kind.bug")}),e.jsx("option",{value:"maintenance",children:c("kanban.kind.maintenance")}),e.jsx("option",{value:"research",children:c("kanban.kind.research")})]})]}),e.jsxs("label",{className:"grid gap-1.5",children:[e.jsx("span",{className:"font-mono text-[10px] uppercase text-[hsl(var(--deck-ink-muted))]",children:c("kanban.field.priority")}),e.jsxs("select",{value:h,onChange:s=>D(s.target.value),className:"field",children:[e.jsx("option",{value:"high",children:c("kanban.priority.high")}),e.jsx("option",{value:"medium",children:c("kanban.priority.medium")}),e.jsx("option",{value:"low",children:c("kanban.priority.low")})]})]}),e.jsxs("label",{className:"grid gap-1.5",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-[10px] uppercase text-[hsl(var(--deck-ink-muted))]",children:[e.jsx(re,{className:"h-3 w-3"}),c("kanban.field.dueAt")]}),e.jsx("input",{type:"datetime-local",value:N,onChange:s=>A(s.target.value),className:"field min-w-0"})]})]}),!k&&e.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] px-3 py-2 font-mono text-[10px] text-[hsl(var(--deck-ink-muted))]",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-[hsl(var(--deck-accent))]"}),c("kanban.dialog.localExecution")]}),S&&e.jsx("div",{role:"alert",className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 text-[11px] text-red-700 dark:border-red-900/70 dark:bg-red-950/35 dark:text-red-300",children:S})]}),e.jsxs(ye,{className:"border-t border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-surface-2))]/60 px-5 py-3",children:[e.jsx(ee,{type:"button",variant:"ghost",onClick:()=>r(!1),disabled:m,children:c("kanban.dialog.cancel")}),e.jsxs(ee,{type:"submit",disabled:m||!k&&(!T||!f.trim()||!v),className:"gap-2",children:[m&&e.jsx(E,{className:"h-3.5 w-3.5 animate-spin"}),c(k?"kanban.dialog.save":"kanban.dialog.dispatch")]})]})]})]})})}function oa(){var Z;const t=V(),r=o(a=>a.sessions),i=o(a=>a.boundProjects),u=o(a=>a.selectedProjectPath),n=o(a=>a.taskWorkspaceInfo),m=o(a=>a.catalogLoadState),T=o(a=>a.taskEventConnectionState),C=o(a=>a.isDispatchingTask),y=o(a=>a.isUpdatingTaskAdmission),c=o(a=>a.cancellingTaskKeys),k=o(a=>a.retryingTaskKeys),l=o(a=>a.updatingTaskKeys),w=o(a=>a.unreadTaskKeys),f=o(a=>a.error),b=o(a=>a.selectProject),v=o(a=>a.selectSession),x=o(a=>a.dispatchTask),h=o(a=>a.updateTask),D=o(a=>a.cancelTask),I=o(a=>a.retryTask),F=o(a=>a.archiveSession),N=o(a=>a.setTaskAdmissionPaused),A=o(a=>a.reconnectTaskEvents),S=o(a=>a.clearError),R=we(a=>a.currentMode),B=U(a=>a.setMainView),s=U(a=>a.boardProjectPath),j=U(a=>a.setBoardProjectPath),z=U(a=>a.openFilePreview),[O,ce]=p.useState(""),[ie,Y]=p.useState(!1),[le,H]=p.useState(null),[oe,W]=p.useState(!1);p.useEffect(()=>{s&&!i.some(a=>a.path===s&&a.available)&&j(null)},[s,i,j]);const q=r.find(a=>M(g(a))===le)??null,$=O.trim().toLowerCase(),J=p.useMemo(()=>r.filter(a=>s&&te(a)!==s?!1:$?[a.sessionId,ne(a,t),a.taskPromptSummary,te(a),a.taskPriority,a.taskKind].filter(Boolean).join(" ").toLowerCase().includes($):!0),[s,$,r,t]),X=p.useMemo(()=>We(J),[J]),de=G.reduce((a,d)=>a+X[d].length,0),_=n==null?void 0:n.taskAdmission,L=_?!_.paused:!0,Q=i.filter(a=>a.available),ue=s??u??((Z=Q[0])==null?void 0:Z.path)??null,me=q?l.includes(M(g(q))):C,ke=async a=>{B("workspace"),await v(g(a))},xe=async a=>{B("workspace"),await v(g(a)),z({tab:"diff"})},he=async a=>{b(a.projectPath),await x({...a,isolation:"local",permissionMode:R},{selectSession:!1})};return e.jsxs("main",{"data-kanban-board":!0,className:"flex h-full min-w-0 flex-col overflow-hidden bg-[hsl(var(--deck-canvas))] text-[hsl(var(--deck-ink))]",children:[e.jsxs("div",{className:"border-b border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas))] px-4 py-3 sm:px-6",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h1",{className:"font-mono text-[15px] font-semibold",children:t("kanban.title")}),e.jsx("span",{className:"rounded-sm border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-1.5 py-0.5 font-mono text-[9px] text-[hsl(var(--deck-ink-faint))]",children:t("kanban.taskCount",{count:de})})]}),e.jsx("p",{className:"mt-0.5 text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:t("kanban.subtitle")})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[_&&e.jsx("div",{className:"hidden rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-2.5 py-1.5 lg:block",children:e.jsx(Se,{inFlight:_.inFlight,queued:_.queued,maxConcurrent:_.maxConcurrent,compact:!0})}),e.jsxs("button",{type:"button",role:"switch","aria-checked":L,disabled:!_||y,onClick:()=>{N(L).catch(()=>{})},className:P("inline-flex h-8 items-center gap-2 rounded-md border px-2.5 font-mono text-[10.5px] transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:opacity-45",L?"border-[hsl(var(--deck-accent)/0.45)] bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-accent))]":"border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] text-[hsl(var(--deck-ink-muted))]"),children:[y?e.jsx(E,{className:"h-3 w-3 animate-spin"}):L?e.jsx(qe,{className:"h-3 w-3 fill-current"}):e.jsx(Le,{className:"h-3 w-3"}),t(L?"kanban.autoClaim.running":"kanban.autoClaim.paused")]}),e.jsxs("button",{type:"button",onClick:()=>{if(Q.length===0){W(!0);return}H(null),Y(!0)},className:"inline-flex h-8 items-center gap-1.5 rounded-md bg-[hsl(var(--deck-ink))] px-3 font-mono text-[10.5px] font-medium text-[hsl(var(--deck-canvas))] transition-opacity hover:opacity-85 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[hsl(var(--deck-accent))]",children:[e.jsx(Me,{className:"h-3.5 w-3.5"}),t("kanban.action.newTask")]})]})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[e.jsxs("label",{className:"relative min-w-[180px] flex-1 sm:max-w-[320px]",children:[e.jsx(Be,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-[hsl(var(--deck-ink-faint))]"}),e.jsx("input",{type:"search",value:O,onChange:a=>ce(a.target.value),"aria-label":t("kanban.searchAria"),placeholder:t("kanban.searchPlaceholder"),className:"h-8 w-full rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] pl-8 pr-3 font-mono text-[10.5px] text-[hsl(var(--deck-ink))] outline-none placeholder:text-[hsl(var(--deck-ink-faint))] focus:border-[hsl(var(--deck-accent)/0.55)] focus:ring-1 focus:ring-[hsl(var(--deck-accent)/0.25)]"})]}),e.jsxs("label",{className:"relative",children:[e.jsx(se,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-[hsl(var(--deck-accent))]"}),e.jsxs("select",{value:s??"__all__",onChange:a=>{const d=a.target.value;j(d==="__all__"?null:d),d!=="__all__"&&b(d)},"aria-label":t("kanban.projectFilterAria"),className:"h-8 min-w-[160px] appearance-none rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] pl-8 pr-7 font-mono text-[10.5px] text-[hsl(var(--deck-ink-muted))] outline-none focus:border-[hsl(var(--deck-accent)/0.55)]",children:[e.jsx("option",{value:"__all__",children:t("kanban.projectAll")}),Q.map(a=>e.jsx("option",{value:a.path,children:a.name},a.path))]})]}),e.jsx("button",{type:"button",onClick:()=>W(!0),"aria-label":t("projects.bind.action"),title:t("projects.bind.action"),className:"flex h-8 w-8 items-center justify-center rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] text-[hsl(var(--deck-ink-faint))] hover:text-[hsl(var(--deck-accent))]",children:e.jsx(ze,{className:"h-3.5 w-3.5"})}),m==="loading"||m==="hydrating"?e.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-[9.5px] text-[hsl(var(--deck-ink-faint))]",children:[e.jsx(E,{className:"h-3 w-3 animate-spin"}),t("sidebar.catalog.syncing")]}):null]})]}),T==="offline"&&e.jsxs("div",{role:"alert",className:"flex items-center gap-2 border-b border-amber-300/60 bg-amber-50/80 px-4 py-2 text-[10.5px] text-amber-800 dark:border-amber-900/70 dark:bg-amber-950/30 dark:text-amber-300 sm:px-6",children:[e.jsx(Qe,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"flex-1",children:t("kanban.feed.offline")}),e.jsxs("button",{type:"button",onClick:()=>void A().catch(()=>{}),className:"inline-flex h-7 items-center gap-1 rounded-md px-2 font-mono hover:bg-amber-100 dark:hover:bg-amber-900/40",children:[e.jsx(Ue,{className:"h-3 w-3"}),t("taskHome.feed.retry")]})]}),f&&e.jsxs("div",{role:"alert",className:"flex items-center gap-3 border-b border-red-200 bg-red-50 px-4 py-2 text-[10.5px] text-red-700 dark:border-red-900/70 dark:bg-red-950/30 dark:text-red-300 sm:px-6",children:[e.jsx("span",{className:"flex-1",children:f}),e.jsx("button",{type:"button",onClick:S,className:"font-mono underline",children:t("taskHome.error.dismiss")})]}),e.jsx("div",{className:"flex-1 overflow-auto px-4 py-4 sm:px-6",children:e.jsx("div",{className:"grid min-w-0 grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-4",children:G.map(a=>e.jsx(aa,{id:a,sessions:X[a],unreadTaskKeys:w,cancellingTaskKeys:c,retryingTaskKeys:k,updatingTaskKeys:l,taskKey:d=>M(g(d)),onOpen:d=>{ke(d).catch(()=>{})},onInspect:d=>{xe(d).catch(()=>{})},onEdit:d=>{H(M(g(d))),Y(!0)},onCancel:d=>{D(g(d)).catch(()=>{})},onRetry:d=>{I(g(d)).catch(()=>{})},onArchive:d=>{F(g(d))}},a))})}),e.jsx(na,{open:ie,onOpenChange:a=>{Y(a),a||H(null)},projects:i,defaultProjectPath:ue,session:q,submitting:me,canCreate:Q.length>0,onCreate:he,onUpdate:async a=>{q&&await h(g(q),a)}}),e.jsx(Pe,{open:oe,onOpenChange:W})]})}export{oa as KanbanBoard};
|