blade-code 0.10.46 → 0.10.63

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.
Files changed (114) hide show
  1. package/dist/blade.js +2 -2
  2. package/dist/chunk-0d1197b9.js +1 -0
  3. package/dist/chunk-0ft3egjr.js +710 -0
  4. package/dist/chunk-0jxh2zq5.js +5 -0
  5. package/dist/{chunk-4dthhzfe.js → chunk-1hb0rt7n.js} +1 -1
  6. package/dist/{chunk-26wse17p.js → chunk-1jc7d3nt.js} +2 -2
  7. package/dist/{chunk-sqd5ge5s.js → chunk-2xbmkyb2.js} +1 -1
  8. package/dist/chunk-2xsrqsk9.js +44 -0
  9. package/dist/chunk-2yws8pqt.js +1 -0
  10. package/dist/{chunk-0qsssahq.js → chunk-2z3xe3rw.js} +1 -1
  11. package/dist/{chunk-fk4wbmv6.js → chunk-3tednchw.js} +2 -2
  12. package/dist/chunk-5sk6v1et.js +10 -0
  13. package/dist/{chunk-qp2z1r7y.js → chunk-69rc9hw6.js} +1 -1
  14. package/dist/chunk-6fdvffcc.js +2 -0
  15. package/dist/{chunk-c9s4n31b.js → chunk-6g3qzz9h.js} +1 -1
  16. package/dist/{chunk-2eddqgnh.js → chunk-6rg6mngq.js} +1 -1
  17. package/dist/{chunk-8y3skwtt.js → chunk-6x1g554w.js} +1 -1
  18. package/dist/{chunk-m8ss9rmx.js → chunk-7b467h8k.js} +1 -1
  19. package/dist/{chunk-8vtyatd6.js → chunk-83wm4akj.js} +1 -1
  20. package/dist/chunk-86gc2mqb.js +1 -0
  21. package/dist/{chunk-cxzx7j0p.js → chunk-87jz5600.js} +1 -1
  22. package/dist/{chunk-1atpfmpe.js → chunk-8an49nbn.js} +53 -53
  23. package/dist/chunk-8b1ehxzh.js +45 -0
  24. package/dist/{chunk-yk9pxkc1.js → chunk-8ekk8pa7.js} +1 -1
  25. package/dist/{chunk-xes0szvj.js → chunk-94d8hhqc.js} +2 -2
  26. package/dist/{chunk-s5205dnv.js → chunk-95hvy6dn.js} +2 -2
  27. package/dist/chunk-9c31jemm.js +1 -0
  28. package/dist/chunk-9kmtcgm6.js +2 -0
  29. package/dist/{chunk-mrsc4a55.js → chunk-9r0yebs1.js} +1 -1
  30. package/dist/{chunk-szdcprq7.js → chunk-9rjaem5f.js} +2 -2
  31. package/dist/{chunk-t4y3h47y.js → chunk-adz2756v.js} +2 -2
  32. package/dist/{chunk-ssymrsyx.js → chunk-atqnan6x.js} +2 -2
  33. package/dist/{chunk-hfrcwkc8.js → chunk-av10vmxk.js} +1 -1
  34. package/dist/{chunk-9rrced3b.js → chunk-b19f55s7.js} +1 -1
  35. package/dist/{chunk-q78s028m.js → chunk-cm9mph7j.js} +1 -1
  36. package/dist/chunk-cq77ah56.js +6 -0
  37. package/dist/{chunk-qmxfkkgn.js → chunk-cr154zrx.js} +2 -2
  38. package/dist/chunk-cx05we7e.js +1 -0
  39. package/dist/{chunk-qb0sqh29.js → chunk-cz68x56m.js} +2 -2
  40. package/dist/{chunk-tpa75y39.js → chunk-d1t91jgz.js} +1 -1
  41. package/dist/{chunk-2yvte5a7.js → chunk-detkh4dd.js} +1 -1
  42. package/dist/chunk-dpzx4mgb.js +1 -0
  43. package/dist/chunk-dq9ya06q.js +1 -0
  44. package/dist/{chunk-f4sp074f.js → chunk-eeac8teg.js} +1 -1
  45. package/dist/chunk-ej6h16ae.js +3 -0
  46. package/dist/{chunk-hcm55r3d.js → chunk-fp1h8wdh.js} +1 -1
  47. package/dist/{chunk-ecf8dh3c.js → chunk-fp2fh7cn.js} +16 -16
  48. package/dist/chunk-g0n88mhg.js +1 -0
  49. package/dist/{chunk-j66r48pz.js → chunk-hpehkz2x.js} +2 -2
  50. package/dist/{chunk-jmksywff.js → chunk-j8akkmc8.js} +1 -1
  51. package/dist/{chunk-7fqsgdee.js → chunk-j9snkjpe.js} +2 -2
  52. package/dist/{chunk-v9tzhe90.js → chunk-jk8bqc5b.js} +2 -2
  53. package/dist/{chunk-67zpsrst.js → chunk-k4ermznt.js} +1 -1
  54. package/dist/chunk-khkhsaan.js +2 -0
  55. package/dist/{chunk-kfpzrmq7.js → chunk-kjvntyr5.js} +1 -1
  56. package/dist/{chunk-4qvna4m2.js → chunk-kxrss9sv.js} +1 -1
  57. package/dist/chunk-m0t7g2vg.js +1 -0
  58. package/dist/{chunk-8kzdhgys.js → chunk-ng0tkmrn.js} +2 -2
  59. package/dist/chunk-nnbfk60b.js +1 -0
  60. package/dist/chunk-nnc1abkf.js +1 -0
  61. package/dist/{chunk-2yjm55cb.js → chunk-pdrqnywp.js} +1 -1
  62. package/dist/chunk-q7pznpyh.js +1 -0
  63. package/dist/{chunk-y6tkxqjx.js → chunk-qs4erqd0.js} +2 -2
  64. package/dist/chunk-rwy763tf.js +160 -0
  65. package/dist/chunk-tf4p1778.js +1 -0
  66. package/dist/{chunk-5vbrcvxg.js → chunk-ttkwrqtp.js} +1 -1
  67. package/dist/chunk-vhckw5e7.js +1 -0
  68. package/dist/{chunk-yrd794kb.js → chunk-w4sp56dn.js} +1 -1
  69. package/dist/{chunk-56qew7w0.js → chunk-wwsg165p.js} +2 -2
  70. package/dist/{chunk-wwvb6znp.js → chunk-wy4pn9sk.js} +1 -1
  71. package/dist/chunk-xsx1av03.js +1621 -0
  72. package/dist/{chunk-fhnkyqfb.js → chunk-y8r2knxm.js} +2 -2
  73. package/dist/chunk-yagna3ws.js +8 -0
  74. package/dist/web/assets/ChatView-B6IO9U-D.js +18 -0
  75. package/dist/web/assets/{CodeBlockHighlighter-Bb3gIeQv.js → CodeBlockHighlighter-DVGtFQgX.js} +1 -1
  76. package/dist/web/assets/{FilePreview-BXg9VaTv.js → FilePreview-C-8_o7yw.js} +1 -1
  77. package/dist/web/assets/{MarkdownRenderer-vxpqGt4L.js → MarkdownRenderer-D04IKQhF.js} +3 -3
  78. package/dist/web/assets/{SettingsModal-4L1nPkh0.js → SettingsModal-BMoZLVEe.js} +1 -1
  79. package/dist/web/assets/{TaskSwitcher-DKSqTLK1.js → TaskSwitcher-CIuCEbvU.js} +1 -1
  80. package/dist/web/assets/{TerminalPanel-Bv9PDclr.js → TerminalPanel-fTk9D5hU.js} +1 -1
  81. package/dist/web/assets/{index-Bz4W1-8a.js → index-CO5sUiJn.js} +6 -6
  82. package/dist/web/assets/index-Dxdnbd79.css +1 -0
  83. package/dist/web/assets/{session-events-DJh6SZcl.js → session-events-BvtUOaNG.js} +8 -8
  84. package/dist/web/index.html +3 -3
  85. package/package.json +12 -2
  86. package/dist/chunk-3y784b9c.js +0 -1
  87. package/dist/chunk-54d7545y.js +0 -1
  88. package/dist/chunk-6cx4t8r6.js +0 -1
  89. package/dist/chunk-6h28xs47.js +0 -8
  90. package/dist/chunk-7qpbtnsa.js +0 -6
  91. package/dist/chunk-7sna3js9.js +0 -2
  92. package/dist/chunk-807x1cw8.js +0 -2
  93. package/dist/chunk-9mnbnyrc.js +0 -1
  94. package/dist/chunk-aarwre5y.js +0 -1
  95. package/dist/chunk-bvf9syb2.js +0 -3
  96. package/dist/chunk-cyw6cpac.js +0 -44
  97. package/dist/chunk-egczvfsv.js +0 -5
  98. package/dist/chunk-fer18bbe.js +0 -1
  99. package/dist/chunk-fz91aw1w.js +0 -10
  100. package/dist/chunk-j7edwwg1.js +0 -2
  101. package/dist/chunk-mqmf40p2.js +0 -1
  102. package/dist/chunk-n5dkq98k.js +0 -160
  103. package/dist/chunk-qbvm38ba.js +0 -1
  104. package/dist/chunk-sh58bey1.js +0 -1
  105. package/dist/chunk-sjtbp01y.js +0 -710
  106. package/dist/chunk-sztrmhgd.js +0 -1
  107. package/dist/chunk-v6ydjg9c.js +0 -1
  108. package/dist/chunk-vhamhbej.js +0 -1612
  109. package/dist/chunk-vhxtzacr.js +0 -1
  110. package/dist/chunk-yha9fpc7.js +0 -1
  111. package/dist/chunk-yvyqhw5q.js +0 -45
  112. package/dist/chunk-z1aqe7ms.js +0 -1
  113. package/dist/web/assets/ChatView-CyxiCTbL.js +0 -18
  114. package/dist/web/assets/index-7zaeanZL.css +0 -1
@@ -0,0 +1,18 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkdownRenderer-D04IKQhF.js","assets/index-CO5sUiJn.js","assets/vendor-react-DG5dkZ_t.js","assets/vendor-radix-DXRuAJHH.js","assets/vendor-icons-ICv1v-tf.js","assets/session-events-BvtUOaNG.js","assets/index-Dxdnbd79.css"])))=>i.map(i=>d[i]);
2
+ import{r as b,j as e}from"./vendor-react-DG5dkZ_t.js";import{u as F,a as y,b as ve,s as Fe,c as qe,d as Q,D as $e,e as De,f as ze,g as Be,h as Ie,i as _e,j as T,k as U,B as xe,_ as Ge,S as We,l as Je,m as Qe,C as Ye,n as Xe}from"./index-CO5sUiJn.js";import{Q as we,O as Ze,G as et,Y as tt,L as R,z as st,T as se,C as ne,Z as at,v as rt,_ as nt,B as it,$ as Pe,y as ie,m as ge,R as ke,s as ot,H as ct,a0 as Le,U as lt,a1 as dt,a2 as ut,a3 as mt,P as Ve,a4 as ht,X as xt,a5 as pt,a6 as ft,f as Oe,a7 as bt,W as vt,a as gt}from"./vendor-icons-ICv1v-tf.js";import{k as kt,g as jt,l as yt,e as wt,t as Nt,j as St}from"./session-events-BvtUOaNG.js";import{j as Ct,k as Et,l as Tt,m as Ue}from"./vendor-radix-DXRuAJHH.js";function Ne(t){return t.split("/").filter(Boolean).at(-1)||t}function Mt(){const t=F(),s=y(S=>S.sessions),a=y(S=>S.currentSessionRef),r=y(S=>S.taskDeliveryActions),i=y(S=>S.deliverTask),n=ve(S=>S.openFilePreview),[d,f]=b.useState(!1),l=s.find(S=>Fe({sessionId:S.sessionId,projectPath:S.projectPath},a));if(!(l!=null&&l.taskIsolation))return null;const c=l.taskDiffStat,k=l.taskIsolation==="worktree",o=qe(l),h=r[Q(o)],u=l.taskDelivery,j=(u==null?void 0:u.status)==="conflicted",N=!!(c&&(c.changedFiles>0||c.commits>0)),m=!["queued","running"].includes(l.taskStatus),w=(u==null?void 0:u.status)==="applied"||(u==null?void 0:u.status)==="discarded",g=k&&N&&m&&!w,p=c?c.additions+c.deletions:0,x=p>0&&c?c.additions/p*100:0,E=S=>{i(o,S).catch(()=>{})};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex min-h-10 flex-wrap items-center gap-x-3 gap-y-1.5 border-b border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas-veil))]/60 px-3 py-1.5 font-mono text-[10.5px] text-[hsl(var(--deck-ink-muted))] backdrop-blur-sm sm:px-5",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5",children:[e.jsx(we,{className:"h-3 w-3 shrink-0 text-[hsl(var(--deck-ink-faint))]"}),e.jsx("span",{className:"truncate text-[hsl(var(--deck-ink))]",children:Ne(l.taskSourceProjectPath||l.projectPath)})]}),e.jsx("span",{className:"text-[hsl(var(--deck-ink-faint))]/60",children:"/"}),e.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5",children:[k?e.jsx(Ze,{className:"h-3 w-3 shrink-0 text-[hsl(var(--deck-accent))]"}):e.jsx(we,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:k?"text-[hsl(var(--deck-accent))]":void 0,children:t(k?"artifact.env.isolated":"artifact.env.local")})]}),l.taskWorktreeBranch&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-[hsl(var(--deck-ink-faint))]/60",children:"/"}),e.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5 truncate",title:l.taskWorktreeBranch,children:[e.jsx(et,{className:"h-3 w-3 shrink-0 text-[hsl(var(--deck-ink-faint))]"}),e.jsx("span",{className:"truncate",children:l.taskWorktreeBranch})]})]})]}),c&&e.jsxs("div",{className:"ml-auto flex max-w-full items-center gap-2",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 text-[hsl(var(--deck-ink-muted))]",children:[e.jsx(tt,{className:"h-3 w-3 text-[hsl(var(--deck-ink-faint))]"}),e.jsx("span",{className:"tabular-nums",children:c.changedFiles})]}),p>0&&e.jsxs("span",{className:"relative hidden h-1.5 w-14 overflow-hidden rounded-sm border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] sm:inline-flex","aria-hidden":"true",children:[e.jsx("span",{className:"h-full bg-[hsl(var(--deck-accent))]",style:{width:`${x}%`}}),e.jsx("span",{className:"h-full bg-red-500/80",style:{width:`${100-x}%`}})]}),e.jsxs("span",{className:"tabular-nums text-[hsl(var(--deck-accent))]",children:["+",c.additions]}),e.jsxs("span",{className:"tabular-nums text-red-600 dark:text-red-400",children:["-",c.deletions]}),c.commits>0&&e.jsx("span",{className:"hidden tabular-nums text-[hsl(var(--deck-ink-faint))] sm:inline",children:t("artifact.commits",{count:c.commits})}),N&&(u==null?void 0:u.status)!=="discarded"&&e.jsx("button",{type:"button",onClick:()=>n({tab:"diff"}),className:"inline-flex items-center gap-1 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-2 py-1 text-[hsl(var(--deck-ink))] transition hover:border-[hsl(var(--deck-accent)/0.55)] hover:text-[hsl(var(--deck-accent))]",children:t("artifact.review")}),g&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",disabled:!!h,onClick:()=>E("apply"),className:"inline-flex items-center gap-1 rounded-md bg-[hsl(var(--deck-accent))] px-2 py-1 font-semibold text-white transition hover:brightness-95 disabled:cursor-wait disabled:opacity-65",children:[h==="apply"?e.jsx(R,{className:"h-3 w-3 animate-spin"}):e.jsx(st,{className:"h-3 w-3"}),t(h==="apply"?"artifact.applying":j?"artifact.retryApply":"artifact.apply")]}),e.jsx("button",{type:"button",disabled:!!h,onClick:()=>f(!0),className:"inline-flex items-center gap-1 rounded-md px-1.5 py-1 text-[hsl(var(--deck-ink-faint))] transition hover:bg-red-500/10 hover:text-red-600 disabled:cursor-wait disabled:opacity-50 dark:hover:text-red-400","aria-label":t("artifact.discard"),title:t("artifact.discard"),children:h==="discard"?e.jsx(R,{className:"h-3 w-3 animate-spin"}):e.jsx(se,{className:"h-3 w-3"})})]}),(u==null?void 0:u.status)==="applied"&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md bg-emerald-500/10 px-2 py-1 font-semibold text-emerald-700 dark:text-emerald-300",children:[e.jsx(ne,{className:"h-3 w-3"}),t("artifact.applied")]}),(u==null?void 0:u.status)==="discarded"&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md bg-[hsl(var(--deck-surface-2))] px-2 py-1 text-[hsl(var(--deck-ink-faint))]",children:[e.jsx(se,{className:"h-3 w-3"}),t("artifact.discarded")]})]}),(u==null?void 0:u.status)==="conflicted"&&e.jsxs("div",{className:"flex w-full items-start gap-1.5 border-t border-amber-500/20 pt-1.5 text-amber-700 dark:text-amber-300",role:"alert",children:[e.jsx(at,{className:"mt-0.5 h-3 w-3 shrink-0"}),e.jsxs("span",{className:"min-w-0 flex-1 space-y-0.5",children:[e.jsx("span",{className:"block",children:u.message||t("artifact.conflict")}),e.jsx("span",{className:"block text-[hsl(var(--deck-ink-faint))]",children:t("artifact.conflictHint")})]})]})]}),e.jsx($e,{open:d,onOpenChange:f,children:e.jsxs(De,{className:"w-[calc(100%_-_2rem)] max-w-md border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] text-[hsl(var(--deck-ink))]",children:[e.jsxs(ze,{children:[e.jsx(Be,{children:t("artifact.discardDialog.title")}),e.jsx(Ie,{className:"text-[hsl(var(--deck-ink-muted))]",children:t("artifact.discardDialog.description",{project:Ne(l.taskSourceProjectPath||l.projectPath),count:(c==null?void 0:c.changedFiles)??0})})]}),e.jsx("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 px-3 py-2 text-xs leading-relaxed text-red-700 dark:text-red-300",children:t("artifact.discardDialog.warning")}),e.jsxs(_e,{className:"gap-2 sm:space-x-0",children:[e.jsx("button",{type:"button",onClick:()=>f(!1),className:"rounded-md border border-[hsl(var(--deck-border))] px-3 py-2 text-sm hover:bg-[hsl(var(--deck-surface-2))]",children:t("artifact.discardDialog.cancel")}),e.jsxs("button",{type:"button",onClick:()=>{f(!1),E("discard")},className:"inline-flex items-center justify-center gap-1.5 rounded-md bg-red-600 px-3 py-2 text-sm font-semibold text-white hover:bg-red-700",children:[e.jsx(se,{className:"h-3.5 w-3.5"}),t("artifact.discardDialog.confirm")]})]})]})})]})}const At=new Set(["completed","stale","failed","aborted","interrupted"]),Rt={completed:"chat.review.status.completed",stale:"chat.review.status.stale",failed:"chat.review.status.failed",aborted:"chat.review.status.aborted",interrupted:"chat.review.status.interrupted"},Ft={completed:"bg-emerald-500/10 text-emerald-700 dark:text-emerald-300 border-emerald-500/20",stale:"bg-amber-500/10 text-amber-700 dark:text-amber-300 border-amber-500/20",failed:"bg-red-500/10 text-red-700 dark:text-red-300 border-red-500/20",aborted:"bg-zinc-500/10 text-zinc-700 dark:text-zinc-300 border-zinc-500/20",interrupted:"bg-amber-500/10 text-amber-700 dark:text-amber-300 border-amber-500/20"};function ae(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:void 0}function $t(t){const s=ae(t),a=ae(s==null?void 0:s.codeLocation),r=s==null?void 0:s.priority,i=s==null?void 0:s.confidenceScore,n=a==null?void 0:a.lineStart,d=a==null?void 0:a.lineEnd;if(!(typeof(s==null?void 0:s.title)!="string"||typeof s.body!="string"||r!==0&&r!==1&&r!==2&&r!==3||typeof i!="number"||!Number.isFinite(i)||typeof(a==null?void 0:a.path)!="string"||!Number.isInteger(n)||!Number.isInteger(d)))return{title:s.title,body:s.body,priority:r,confidenceScore:i,codeLocation:{path:a.path,lineStart:n,lineEnd:d}}}function Dt(t){const s=ae(t),a=ae(s==null?void 0:s.target);if((s==null?void 0:s.phase)!=="completed"||typeof s.status!="string"||!At.has(s.status)||typeof(a==null?void 0:a.label)!="string"||a.kind!=="uncommitted"&&a.kind!=="base"&&a.kind!=="commit"||typeof s.overallExplanation!="string"||!Array.isArray(s.findings))return;const r=s.findings.map($t);if(!r.some(i=>i===void 0))return{status:s.status,target:{kind:a.kind,label:a.label,...typeof a.reference=="string"?{reference:a.reference}:{}},overallExplanation:s.overallExplanation,findings:r,...typeof s.error=="string"?{error:s.error}:{}}}function Bt(t){const{path:s,lineStart:a,lineEnd:r}=t.codeLocation;return a===r?`${s}:L${a}`:`${s}:L${a}-${r}`}function It({report:t}){const s=F(),a=t.target.kind==="uncommitted"?s("chat.review.target.uncommitted"):t.target.kind==="base"?s("chat.review.target.base",{ref:t.target.reference??t.target.label}):s("chat.review.target.commit",{ref:t.target.reference??t.target.label});return e.jsxs("section",{"data-code-review-report":!0,className:"overflow-hidden rounded-xl border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]",children:[e.jsxs("header",{className:"flex flex-wrap items-center justify-between gap-3 border-b border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-surface-2))]/60 px-4 py-3",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-[13px] font-semibold text-[hsl(var(--deck-ink))]",children:s("chat.review.title")}),e.jsxs("p",{className:"mt-0.5 font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:[s("chat.review.target"),": ",a]})]}),e.jsxs("span",{className:T("rounded-full border px-2.5 py-1 font-mono text-[10.5px] font-medium",Ft[t.status]),children:[s("chat.review.status"),": ",s(Rt[t.status])]})]}),e.jsxs("div",{className:"space-y-4 px-4 py-3.5",children:[e.jsx("p",{className:"whitespace-pre-wrap text-[13px] leading-6 text-[hsl(var(--deck-ink-muted))]",children:t.overallExplanation}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[e.jsx("h4",{className:"deck-eyebrow text-[hsl(var(--deck-ink-faint))]",children:s("chat.review.findings")}),e.jsx("span",{className:"font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:t.findings.length})]}),t.findings.length===0?e.jsx("div",{className:"rounded-lg bg-[hsl(var(--deck-surface-2))] px-3 py-2.5 text-[12px] text-[hsl(var(--deck-ink-muted))]",children:s("chat.review.noFindings")}):e.jsx("ol",{className:"space-y-2",children:t.findings.map((r,i)=>e.jsxs("li",{className:"rounded-lg border border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas-veil))] px-3 py-2.5",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[e.jsx("h5",{className:"text-[12.5px] font-medium leading-5 text-[hsl(var(--deck-ink))]",children:r.title}),e.jsx("span",{className:"shrink-0 font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:s("chat.review.confidence",{value:r.confidenceScore.toFixed(2)})})]}),e.jsx("code",{className:"mt-1 block text-[10.5px] text-[hsl(var(--deck-accent))]",children:Bt(r)}),e.jsx("p",{className:"mt-1.5 whitespace-pre-wrap text-[12px] leading-5 text-[hsl(var(--deck-ink-muted))]",children:r.body})]},`${r.codeLocation.path}:${r.codeLocation.lineStart}:${i}`))})]}),t.error&&e.jsxs("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 px-3 py-2 text-[11px] text-red-700 dark:text-red-300",children:[e.jsxs("span",{className:"font-medium",children:[s("chat.review.error"),":"]})," ",t.error]})]})]})}function _t({elicitation:t,messageId:s}){const a=F(),r=y(g=>g.currentSessionRef),i=y(g=>g.setElicitation),[n,d]=b.useState(()=>Lt(t.details.fields??[])),[f,l]=b.useState(()=>Vt(t.details.fields??[])),[c,k]=b.useState(!1),[o,h]=b.useState(),u=t.details.fields??[],j=b.useMemo(()=>u.every(g=>{var x;if(!g.required)return!0;if(oe(g))return!!((x=f[g.name])!=null&&x.trim()||g.defaultValue!==void 0);const p=n[g.name]??g.defaultValue;return Array.isArray(p)?p.length>0:p!==void 0}),[u,f,n]);if(t.status!=="pending")return e.jsx("div",{className:"rounded-lg border 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:a(t.status==="cancelled"?"interaction.elicitation.cancelled":"interaction.elicitation.responded")});const N=async(g,p)=>{if(!(!r||c)){k(!0),h(void 0);try{await U.respondToElicitation(r,t.toolCallId,{action:g,...p?{content:p}:{}}),i(s,{...t,status:"responded"})}catch(x){h(x instanceof Error?x.message:a("interaction.elicitation.failed"))}finally{k(!1)}}},m=async()=>{try{await N("accept",Ot(u,n,f))}catch(g){h(g instanceof Error?g.message:String(g))}},w=()=>{const g=t.details.url;if(!g){h("MCP URL is unavailable");return}if(!window.open(g,"_blank","noopener,noreferrer")){h("The browser blocked the external window");return}N("accept")};return e.jsxs("div",{"data-pending-interaction":"elicitation",tabIndex:-1,role:"alert",className:"space-y-4 rounded-lg border border-amber-300/70 bg-amber-50/70 p-4 outline-none focus-visible:ring-2 focus-visible:ring-amber-500 dark:border-amber-800/70 dark:bg-amber-950/25",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(rt,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-600 dark:text-amber-400"}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsxs("div",{className:"font-mono text-[12px] font-semibold text-[hsl(var(--deck-ink))]",children:[a("interaction.elicitation.title")," · ",t.details.serverName]}),e.jsx("div",{className:"font-mono text-[12px] text-[hsl(var(--deck-ink-muted))]",children:t.details.message}),e.jsx("div",{className:"font-mono text-[11px] text-amber-700 dark:text-amber-300",children:a("interaction.elicitation.warning")})]})]}),t.details.mode==="url"?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] p-3 font-mono text-[11px]",children:[e.jsx("div",{className:"text-[hsl(var(--deck-ink-muted))]",children:t.details.domain}),e.jsx("div",{className:"mt-1 break-all text-[hsl(var(--deck-ink))]",children:t.details.url})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(q,{onClick:w,disabled:c,primary:!0,label:a("interaction.elicitation.open"),icon:e.jsx(nt,{className:"h-3.5 w-3.5"})}),e.jsx(q,{onClick:()=>void N("decline"),disabled:c,label:a("interaction.elicitation.decline")}),e.jsx(q,{onClick:()=>void N("cancel"),disabled:c,label:a("interaction.elicitation.cancel")})]})]}):e.jsxs("div",{className:"space-y-4",children:[u.map(g=>e.jsx(Pt,{field:g,value:n[g.name],rawValue:f[g.name]??"",onValueChange:p=>d(x=>({...x,[g.name]:p})),onRawChange:p=>l(x=>({...x,[g.name]:p}))},g.name)),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(q,{onClick:()=>void m(),disabled:c||!j,primary:!0,label:a("interaction.elicitation.submit"),icon:c?e.jsx(R,{className:"h-3.5 w-3.5 animate-spin"}):null}),e.jsx(q,{onClick:()=>void N("decline"),disabled:c,label:a("interaction.elicitation.decline")}),e.jsx(q,{onClick:()=>void N("cancel"),disabled:c,label:a("interaction.elicitation.cancel")})]})]}),o&&e.jsx("div",{className:"rounded-md border border-red-300/70 bg-red-50 px-2.5 py-2 font-mono text-[11px] text-red-700 dark:border-red-900/70 dark:bg-red-950/35 dark:text-red-300",children:o})]})}function Pt({field:t,value:s,rawValue:a,onValueChange:r,onRawChange:i}){return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{htmlFor:`mcp-elicitation-${t.name}`,className:"block font-mono text-[12px] font-medium text-[hsl(var(--deck-ink))]",children:[t.title,t.required?" *":""]}),t.description&&e.jsx("div",{className:"font-mono text-[11px] text-[hsl(var(--deck-ink-faint))]",children:t.description}),t.type==="select"||t.type==="multi-select"||t.type==="boolean"?e.jsx("div",{id:`mcp-elicitation-${t.name}`,className:"flex flex-wrap gap-2",children:Ut(t).map(n=>{const d=Array.isArray(s)?s.includes(n.value):s===n.typedValue;return e.jsx("button",{type:"button","aria-pressed":d,onClick:()=>{if(t.type==="multi-select"){const f=Array.isArray(s)?s:[];r(f.includes(n.value)?f.filter(l=>l!==n.value):[...f,n.value])}else r(n.typedValue)},className:T("rounded-md border px-3 py-2 font-mono text-[12px] transition-colors",d?"border-emerald-500 bg-emerald-50 text-emerald-800 dark:bg-emerald-950/40 dark:text-emerald-200":"border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] text-[hsl(var(--deck-ink-muted))] hover:text-[hsl(var(--deck-ink))]"),children:n.label},n.value)})}):e.jsx("input",{id:`mcp-elicitation-${t.name}`,type:Ht(t),value:a,onChange:n=>i(n.target.value),min:t.minimum,max:t.maximum,minLength:t.minLength,maxLength:t.maxLength,required:t.required,placeholder:t.defaultValue===void 0?t.required?"Required":"Optional":String(t.defaultValue),className:"w-full rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] px-3 py-2 font-mono text-[12px] text-[hsl(var(--deck-ink))] outline-none transition-colors focus:border-amber-500 focus:ring-1 focus:ring-amber-500"})]})}function q({onClick:t,disabled:s,primary:a=!1,label:r,icon:i}){return e.jsxs("button",{type:"button",onClick:t,disabled:s,className:T("inline-flex min-h-8 items-center gap-1.5 rounded-md px-3 py-1.5 font-mono text-[12px] transition-colors disabled:cursor-wait disabled:opacity-50",a?"bg-amber-600 text-white hover:bg-amber-700":"border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] text-[hsl(var(--deck-ink-muted))] hover:text-[hsl(var(--deck-ink))]"),children:[i,r]})}function Lt(t){return Object.fromEntries(t.filter(s=>!oe(s)&&s.defaultValue!==void 0).map(s=>[s.name,Array.isArray(s.defaultValue)?[...s.defaultValue]:s.defaultValue]))}function Vt(t){return Object.fromEntries(t.filter(s=>oe(s)&&s.defaultValue!==void 0).map(s=>[s.name,String(s.defaultValue)]))}function Ot(t,s,a){var i;const r={};for(const n of t){if(oe(n)){const f=((i=a[n.name])==null?void 0:i.trim())??"";if(!f){if(n.defaultValue!==void 0)r[n.name]=n.defaultValue;else if(n.required)throw new Error(`${n.title} is required`);continue}if(n.type==="number"||n.type==="integer"){const l=Number(f);if(!Number.isFinite(l))throw new Error(`${n.title} must be a finite number`);if(n.type==="integer"&&!Number.isSafeInteger(l))throw new Error(`${n.title} must be a safe integer`);r[n.name]=l}else r[n.name]=f;continue}const d=s[n.name]??n.defaultValue;if(d===void 0){if(n.required)throw new Error(`${n.title} is required`);continue}if(Array.isArray(d)){if(n.minItems!==void 0&&d.length<n.minItems)throw new Error(`${n.title} requires at least ${n.minItems} choices`);if(n.maxItems!==void 0&&d.length>n.maxItems)throw new Error(`${n.title} allows at most ${n.maxItems} choices`)}r[n.name]=d}return r}function Ut(t){return t.type==="boolean"?[{value:"true",label:"Yes",typedValue:!0},{value:"false",label:"No",typedValue:!1}]:(t.options??[]).map(s=>({...s,typedValue:s.value}))}function oe(t){return t.type==="string"||t.type==="number"||t.type==="integer"}function Ht(t){return t.type==="number"||t.type==="integer"?"number":t.format==="email"?"email":t.format==="uri"?"url":t.format==="date"?"date":t.format==="date-time"?"datetime-local":"text"}function Kt(t){if(!t||typeof t!="object"||Array.isArray(t))return;const s=t;if(!(!s.output||typeof s.output!="object"||Array.isArray(s.output)))return{output:s.output,...typeof s.schemaDigest=="string"?{schemaDigest:s.schemaDigest}:{}}}function qt({report:t}){const s=F(),[a,r]=b.useState(!1),i=JSON.stringify(t.output,null,2),n=async()=>{try{await navigator.clipboard.writeText(i),r(!0),window.setTimeout(()=>r(!1),1400)}catch{}};return e.jsxs("section",{"data-structured-output":!0,className:"overflow-hidden rounded-lg border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]",children:[e.jsxs("header",{className:"flex min-h-9 items-center justify-between gap-3 border-b border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] px-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(it,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-accent))]"}),e.jsx("span",{className:"font-mono text-[11px] font-semibold text-[hsl(var(--deck-ink))]",children:s("chat.structuredOutput.title")}),t.schemaDigest&&e.jsxs("span",{title:t.schemaDigest,className:"truncate font-mono text-[9px] text-[hsl(var(--deck-ink-faint))]",children:["sha256:",t.schemaDigest.slice(0,10)]})]}),e.jsx("button",{type:"button",onClick:n,"aria-label":s("chat.structuredOutput.copy"),title:s("chat.structuredOutput.copy"),className:"flex h-6 w-6 shrink-0 items-center justify-center rounded text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:a?e.jsx(ne,{className:"h-3.5 w-3.5 text-[hsl(var(--deck-accent))]"}):e.jsx(Pe,{className:"h-3.5 w-3.5"})})]}),e.jsx("pre",{className:"max-h-[440px] overflow-auto whitespace-pre p-3 font-mono text-[11px] leading-5 text-[hsl(var(--deck-ink))]",children:i})]})}const zt=b.lazy(()=>Ge(()=>import("./MarkdownRenderer-D04IKQhF.js").then(t=>t.M),__vite__mapDeps([0,1,2,3,4,5,6])).then(t=>({default:t.MarkdownRenderer})));function Se({text:t,label:s}){const[a,r]=b.useState(!1);if(!t.trim())return null;const i=async()=>{try{await navigator.clipboard.writeText(t),r(!0),window.setTimeout(()=>r(!1),1400)}catch{}};return e.jsx("button",{type:"button","aria-label":s,title:s,onClick:i,className:"flex h-6 w-6 items-center justify-center rounded-md text-[hsl(var(--deck-ink-faint))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:a?e.jsx(ne,{className:"h-3.5 w-3.5 text-[hsl(var(--deck-accent))]"}):e.jsx(Pe,{className:"h-3.5 w-3.5"})})}function Gt(){return e.jsx("div",{className:"flex h-8 w-8 shrink-0 select-none items-center justify-center rounded-lg border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] shadow-[0_1px_0_hsl(var(--deck-hairline))]",children:e.jsx(xe,{size:20,pulse:!1})})}function Wt(){return e.jsx("div",{className:"flex h-8 w-8 shrink-0 select-none items-center justify-center rounded-full border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas-veil))]",children:e.jsx("span",{className:"font-mono text-[11px] font-medium text-[hsl(var(--deck-ink))]",children:"U"})})}function Ce(t){let s=t;return s=s.replace(/<system-reminder>[\s\S]*?<\/system-reminder>/g,""),s=s.replace(/<file path="[^"]*">[\s\S]*?<\/file>/g,""),s=s.replace(/<attached_files>[\s\S]*?<\/attached_files>/g,""),s=s.trim(),s}function Jt(t){if(typeof t=="string")return{text:Ce(t),images:[]};const s=t.filter(r=>r.type==="text").map(r=>r.text).join(`
3
+ `),a=t.filter(r=>r.type==="image_url").map(r=>r.image_url.url);return{text:Ce(s),images:a}}function je(t){return typeof t=="string"?t:t.filter(s=>s.type==="text").map(s=>s.text).join(`
4
+ `)}function Qt(t){const s=t.agentContent;return s?kt(s):je(t.content)}function Ee({content:t,syntaxHighlight:s=!0}){return e.jsx(b.Suspense,{fallback:e.jsx("pre",{className:"text-[14px] text-[hsl(var(--deck-ink))] font-mono whitespace-pre-wrap",children:t}),children:e.jsx(zt,{content:t,syntaxHighlight:s})})}function ye({status:t}){if(!t)return null;const s={running:"bg-[#FEF3C7] text-[#92400E] dark:bg-[#F59E0B]/20 dark:text-[#FBBF24]",success:"bg-[#DCFCE7] text-[#15803D] dark:bg-[#22C55E]/20 dark:text-[#22C55E]",error:"bg-[#FEE2E2] text-[#b91c1c] dark:bg-[#EF4444]/20 dark:text-[#fca5a5]",pending:"bg-[#E5E7EB] text-[#6B7280] dark:bg-[#27272a] dark:text-[#a1a1aa]",info:"bg-[#DBEAFE] text-[#1D4ED8] dark:bg-[#3B82F6]/20 dark:text-[#60A5FA]"},a={running:"Running",success:"Success",error:"Error",pending:"Pending",info:"Info"};return e.jsx("span",{className:T("text-[11px] px-2 py-0.5 rounded-full font-mono",s[t]),children:a[t]})}function Yt(t){if(!t)return"";if(typeof t=="string")try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}return JSON.stringify(t,null,2)}const Te=500;function He(t,s){if(t.length<=s)return t;let a=Math.max(0,s);return a>0&&/[\uD800-\uDBFF]/.test(t.charAt(a-1))&&(a-=1),t.slice(0,a)}function Me(t,s){if(t.length<=s)return t;let a=Math.max(0,t.length-s);return/[\uDC00-\uDFFF]/.test(t.charAt(a))&&(a+=1),t.slice(a)}function de(t,s){if(t.length<=s)return t;if(s<=0)return"";const a=`
5
+ ... (display clipped) ...
6
+ `,r=s-a.length;if(r<=0)return Me(t,s);const i=Math.floor(r/3);return`${He(t,i)}${a}${Me(t,r-i)}`}function Xt(t){const s=t.split(`
7
+ `),a=s.at(-1),r=a!=null&&a.startsWith("Output truncated")?a:void 0,i=r?s.slice(0,-1).join(`
8
+ `):t,n=r?`
9
+ ${r}`:"",d=Math.max(0,Te-n.length),l=i.indexOf(`
10
+ stderr:
11
+ `);let c;if(l>=0&&i.includes(`
12
+ stdout:
13
+ `)){const k=i.slice(0,l),o=i.slice(l+1),h=Math.max(0,d-1),u=Math.floor(h/2);c=`${de(k,u)}
14
+ ${de(o,h-u)}`}else c=de(i,d);return{body:He(c,d),...r?{notice:r}:{},truncated:!!r||t.length>Te}}function Zt({tool:t}){const[s,a]=b.useState(!1),r=Yt(t.arguments),i=t.output?Xt(t.output):void 0;return e.jsxs("div",{"data-tool-name":t.toolName,"data-tool-status":t.status,"data-tool-truncated":i!=null&&i.truncated?"true":"false",className:"bg-white dark:bg-[#18181b] border border-[hsl(var(--deck-border))] rounded-lg overflow-hidden",children:[e.jsxs("button",{type:"button","aria-expanded":s,"data-tool-call-id":t.toolCallId,onClick:()=>a(n=>!n),className:"w-full flex items-center justify-between px-3 py-2 bg-[hsl(var(--deck-surface-2))] hover:bg-[hsl(var(--deck-surface))] transition-colors",children:[e.jsxs("div",{className:"flex gap-2 items-center min-w-0",children:[s?e.jsx(ie,{className:"h-4 w-4 text-[hsl(var(--deck-ink-faint))] shrink-0"}):e.jsx(ge,{className:"h-4 w-4 text-[hsl(var(--deck-ink-faint))] shrink-0"}),e.jsx("span",{className:"text-[12px] text-[hsl(var(--deck-ink))] font-mono shrink-0",children:t.toolName}),t.summary&&e.jsx("span",{className:"text-[11px] text-[hsl(var(--deck-ink-muted))] font-mono truncate",children:t.summary})]}),e.jsx(ye,{status:t.status})]}),t.status==="running"&&t.progressMessage&&e.jsxs("div",{className:"border-t border-[hsl(var(--deck-border))] px-3 py-2 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 font-mono text-[10px] text-[hsl(var(--deck-ink-muted))]",children:[e.jsx("span",{className:"truncate",children:t.progressMessage}),t.progressTotal!==void 0&&t.progress!==void 0&&e.jsxs("span",{className:"shrink-0",children:[Math.max(0,Math.min(100,Math.round(t.progress/t.progressTotal*100))),"%"]})]}),t.progressTotal!==void 0&&t.progress!==void 0&&e.jsx("div",{role:"progressbar","aria-label":`${t.toolName} progress`,"aria-valuemin":0,"aria-valuemax":t.progressTotal,"aria-valuenow":Math.min(t.progress,t.progressTotal),className:"h-1 overflow-hidden rounded-full bg-[hsl(var(--deck-border))]",children:e.jsx("div",{className:"h-full rounded-full bg-amber-500 transition-[width] duration-150",style:{width:`${Math.max(0,Math.min(100,t.progress/t.progressTotal*100))}%`}})})]}),s&&e.jsxs("div",{className:"px-3 py-2 space-y-2 border-t border-[hsl(var(--deck-border))]",children:[r&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-[11px] text-[hsl(var(--deck-ink-muted))] font-mono",children:"Arguments"}),e.jsx("pre",{className:"text-[11px] text-[hsl(var(--deck-ink))] bg-[hsl(var(--deck-surface-2))] border border-[hsl(var(--deck-border))] rounded-md p-2 overflow-x-auto whitespace-pre-wrap font-mono max-h-[120px] overflow-y-auto",children:r})]}),i&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-[11px] text-[hsl(var(--deck-ink-muted))] font-mono",children:"Output"}),e.jsxs("pre",{"data-tool-output":!0,className:"text-[11px] text-[hsl(var(--deck-ink))] bg-[hsl(var(--deck-surface-2))] border border-[hsl(var(--deck-border))] rounded-md p-2 overflow-x-auto whitespace-pre-wrap font-mono max-h-[120px] overflow-y-auto",children:[i.body,i.notice&&e.jsxs(e.Fragment,{children:[`
15
+ `,e.jsx("span",{"data-tool-truncation-notice":!0,children:i.notice})]})]})]})]})]})}function Ke({toolCalls:t}){return t.length===0?null:e.jsx("div",{className:"space-y-2",children:t.map(s=>e.jsx(Zt,{tool:s},s.toolCallId))})}function es({toolCalls:t,toolCallIds:s}){const a=F(),[r,i]=b.useState(!1),n=b.useMemo(()=>new Map(t.map(o=>[o.toolCallId,o])),[t]),d=s.flatMap(o=>{const h=n.get(o);return h?[h]:[]});if(d.length===0)return null;const f=d.filter(o=>o.status==="running").length,l=d.filter(o=>o.status==="error").length,c=[...d].reverse().find(o=>o.status==="running"&&!!o.progressMessage),k=f>0?a(d.length===1?"chat.timeline.tools.runningOne":"chat.timeline.tools.running",{count:d.length}):l>0?a(d.length===1?"chat.timeline.tools.completedOneWithError":"chat.timeline.tools.completedWithErrors",{count:d.length,errors:l}):a(d.length===1?"chat.timeline.tools.completedOne":"chat.timeline.tools.completed",{count:d.length});return e.jsxs("div",{"data-agent-tool-group":!0,className:"py-0.5",children:[e.jsxs("button",{type:"button","aria-expanded":r,onClick:()=>i(o=>!o),className:"group flex min-h-7 w-full items-center gap-1.5 rounded-md px-1.5 text-left font-mono text-[11.5px] text-[hsl(var(--deck-ink-faint))] transition-colors hover:bg-[hsl(var(--deck-surface))]/65 hover:text-[hsl(var(--deck-ink-muted))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:[r?e.jsx(ie,{className:"h-3.5 w-3.5 shrink-0"}):e.jsx(ge,{className:"h-3.5 w-3.5 shrink-0"}),f>0&&e.jsx(R,{className:"h-3 w-3 shrink-0 animate-spin text-[hsl(var(--deck-accent))]"}),e.jsx("span",{children:k}),(c==null?void 0:c.progressMessage)&&e.jsxs("span",{className:"min-w-0 truncate text-[10.5px] text-[hsl(var(--deck-ink-muted))]",children:[c.progressMessage,c.progress!==void 0&&c.progressTotal!==void 0&&` · ${Math.max(0,Math.min(100,Math.round(c.progress/c.progressTotal*100)))}%`]})]}),(c==null?void 0:c.progress)!==void 0&&c.progressTotal!==void 0&&e.jsx("div",{role:"progressbar","aria-label":`${c.toolName} progress`,"aria-valuemin":0,"aria-valuemax":c.progressTotal,"aria-valuenow":Math.min(c.progress,c.progressTotal),className:"mx-1.5 h-0.5 overflow-hidden rounded-full bg-[hsl(var(--deck-border))]",children:e.jsx("div",{className:"h-full rounded-full bg-amber-500 transition-[width] duration-150",style:{width:`${Math.max(0,Math.min(100,c.progress/c.progressTotal*100))}%`}})}),r&&e.jsx("div",{"data-agent-tool-group-details":!0,className:"mt-2 space-y-2 pl-1",children:e.jsx(Ke,{toolCalls:d})})]})}function ts({content:t}){const s=F(),[a,r]=b.useState(!1);return t?e.jsxs("div",{"data-agent-thinking":!0,className:"py-0.5",children:[e.jsxs("button",{type:"button","aria-expanded":a,onClick:()=>r(i=>!i),className:"flex min-h-7 w-full items-center gap-1.5 rounded-md px-1.5 text-left font-mono text-[11.5px] text-[hsl(var(--deck-ink-faint))] transition-colors hover:bg-[hsl(var(--deck-surface))]/65 hover:text-[hsl(var(--deck-ink-muted))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:[a?e.jsx(ie,{className:"h-4 w-4 text-[hsl(var(--deck-ink-faint))]"}):e.jsx(ge,{className:"h-4 w-4 text-[hsl(var(--deck-ink-faint))]"}),e.jsx("span",{children:s("chat.timeline.thinking")})]}),a&&e.jsx("div",{className:"ml-1 mt-1 border-l border-[hsl(var(--deck-border))] py-1 pl-3",children:e.jsx("pre",{className:"whitespace-pre-wrap font-mono text-[11px] leading-5 text-[hsl(var(--deck-ink-muted))]",children:t})})]}):null}function ss({tasks:t}){if(t.length===0)return null;const s=t.filter(r=>r.status==="completed").length,a=s===t.length;return e.jsx("div",{className:"bg-[hsl(var(--deck-surface-2))] border border-[hsl(var(--deck-border))] rounded-lg px-3 py-2",children:e.jsx("div",{className:"flex gap-2 items-center",children:e.jsx("span",{className:"text-[12px] text-[hsl(var(--deck-ink-muted))] font-mono",children:a?"✓ All tasks done":`Tasks: ${s}/${t.length}`})})})}function as({toolCalls:t}){const s=ve(r=>r.openFilePreview),a=b.useMemo(()=>{const r=new Map,i=["Write","SearchReplace","Edit","ApplyPatch"];for(const n of t){if(n.status!=="success")continue;const d=n.metadata;if(n.toolName==="ApplyPatch"&&Array.isArray(d==null?void 0:d.changes)){for(const l of d.changes)l&&typeof l=="object"&&"path"in l&&typeof l.path=="string"&&r.set(l.path,{path:l.path,toolName:n.toolName});continue}const f=d==null?void 0:d.file_path;f&&i.includes(n.toolName)&&r.set(f,{path:f,toolName:n.toolName})}return Array.from(r.values())},[t]);return a.length===0?null:e.jsxs("div",{className:"bg-[hsl(var(--deck-surface-2))] border border-[hsl(var(--deck-border))] rounded-lg px-3 py-2",children:[e.jsxs("div",{className:"text-[11px] text-[hsl(var(--deck-ink-muted))] font-mono mb-1.5",children:["Changed files (",a.length,")"]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:a.map(({path:r})=>{const i=r.split("/").pop()||r;return e.jsxs("button",{onClick:()=>s({tab:"diff",targetPath:r}),className:"flex items-center gap-1 px-2 py-1 text-[11px] font-mono bg-[#E5E7EB] dark:bg-[#27272a] text-[hsl(var(--deck-ink))] rounded hover:bg-[#D1D5DB] dark:hover:bg-[#3f3f46] transition-colors",title:r,children:[e.jsx(ot,{className:"w-3 h-3"}),i]},r)})})]})}function rs({subagent:t}){var G,K,Y,X;const s=F(),[a,r]=b.useState(null),[i,n]=b.useState(!1),[d,f]=b.useState(null),[l,c]=b.useState(!1),[k,o]=b.useState(""),[h,u]=b.useState(!1),[j,N]=b.useState(null),[m,w]=b.useState(null),[g,p]=b.useState(null),x=y(M=>M.currentSessionRef),E=y(M=>M.isStreaming),S=y(M=>M.isTemporarySession);if(!t)return null;const D=t.status==="running",A=a!==null?a:D,V=t.toolCalls||d||[],_=t.output||t.thinking||V.length>0||t.sessionId,C=m&&m.status!=="running"?m:g,B=(C==null?void 0:C.id)??t.sessionId,H=((G=C==null?void 0:C.restartRecovery)==null?void 0:G.outcome)==="failed",ce=!D&&!E&&!S&&!H&&(m==null?void 0:m.status)!=="running"&&!!(B&&x);b.useEffect(()=>{if(!A||D||!t.sessionId||!(x!=null&&x.projectPath)||d!==null||t.toolCalls&&t.toolCalls.length>0)return;let M=!0;return n(!0),U.getMessages({sessionId:t.sessionId,projectPath:x.projectPath}).then(P=>{var I,$;if(!M)return;const L=wt(P),v=new Map;for(const W of L)if(($=(I=W.agentContent)==null?void 0:I.toolCalls)!=null&&$.length)for(const le of W.agentContent.toolCalls)v.has(le.toolCallId)||v.set(le.toolCallId,le);f(Array.from(v.values()))}).finally(()=>{M&&n(!1)}),()=>{M=!1}},[A,D,t.sessionId,t.toolCalls,d,x==null?void 0:x.projectPath]),b.useEffect(()=>{if(!t.sessionId||!x)return;let M=!0;const P=t.rootAgentId??t.sessionId,L=t.resumeDepth??0;return U.listSubagents(x).then(v=>{if(!M)return;p(v.find($=>$.id===t.sessionId)??null);const I=v.filter($=>$.id!==t.sessionId&&$.rootAgentId===P&&$.resumeDepth>L).sort(($,W)=>W.resumeDepth-$.resumeDepth||W.lastActiveAt-$.lastActiveAt)[0];I&&w(I)}).catch(()=>{}),()=>{M=!1}},[x==null?void 0:x.sessionId,x==null?void 0:x.projectPath,t.sessionId,t.rootAgentId,t.resumeDepth]),b.useEffect(()=>{if(!m||m.status!=="running"||!x)return;let M=!0;const P=async()=>{try{const I=(await U.listSubagents(x)).find($=>$.id===m.id);M&&I&&w(I)}catch{}},L=window.setInterval(()=>{P()},1e3);return()=>{M=!1,window.clearInterval(L)}},[x,m==null?void 0:m.id,m==null?void 0:m.status]);const z=async()=>{if(!(!x||!B||!k.trim()||h)){u(!0),N(null);try{const M=await U.resumeSubagent(x,B,k.trim());w(M.session),o(""),c(!1),r(!0)}catch(M){N(M instanceof Error?M.message:s("chat.subagent.resumeFailed"))}finally{u(!1)}}};return e.jsxs("div",{"data-subagent-id":t.id,"data-subagent-session-id":t.sessionId,className:"bg-[hsl(var(--deck-surface-2))] border border-[hsl(var(--deck-border))] rounded-lg px-3 py-2",children:[e.jsxs("button",{type:"button",onClick:()=>r(!A),className:"flex gap-2 justify-between items-center w-full transition-opacity cursor-pointer hover:opacity-80",children:[e.jsxs("div",{className:"flex gap-2 items-center",children:[D&&e.jsx(R,{className:"h-3 w-3 animate-spin text-[hsl(var(--deck-ink-muted))]"}),e.jsxs("span",{className:"text-[12px] text-[hsl(var(--deck-ink-muted))] font-mono",children:[t.type,": ",t.description]}),e.jsx(ye,{status:t.status==="completed"?"success":t.status==="failed"?"error":"running"}),t.type==="verification"&&t.verificationVerdict&&e.jsx("span",{"data-verification-verdict":t.verificationVerdict,className:T("rounded px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide",t.verificationVerdict==="pass"?"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400":t.verificationVerdict==="fail"?"bg-red-500/10 text-red-600 dark:text-red-400":"bg-amber-500/10 text-amber-600 dark:text-amber-400"),children:t.verificationVerdict}),t.resumedFrom&&e.jsx("span",{className:"rounded bg-[#EDE9FE] px-1.5 py-0.5 text-[10px] font-mono text-[#6D28D9] dark:bg-[#2E1065] dark:text-[#C4B5FD]",title:s("chat.subagent.resumedFromTitle",{id:t.resumedFrom}),children:s("chat.subagent.resumedDepth",{depth:t.resumeDepth??1})})]}),_&&e.jsx(ie,{className:T("h-3.5 w-3.5 text-[hsl(var(--deck-ink-muted))] transition-transform",A&&"rotate-180")})]}),!A&&!D&&t.output&&e.jsx("div",{"data-subagent-output-summary":!0,className:"mt-2 max-h-10 overflow-hidden whitespace-pre-wrap break-words font-mono text-[11px] text-[hsl(var(--deck-ink))]",children:t.output}),A&&e.jsxs("div",{className:"mt-2 space-y-2",children:[(t.output||t.thinking)&&e.jsxs(e.Fragment,{children:[t.output&&e.jsx("pre",{className:"text-[11px] text-[hsl(var(--deck-ink))] bg-[hsl(var(--deck-surface-2))] border border-[hsl(var(--deck-border))] rounded-md p-2 overflow-x-auto whitespace-pre-wrap font-mono max-h-[160px] overflow-y-auto",children:t.output}),t.thinking&&e.jsx("pre",{className:"text-[11px] text-[hsl(var(--deck-ink-muted))] bg-[hsl(var(--deck-surface-2))] border border-[hsl(var(--deck-border))] rounded-md p-2 overflow-x-auto whitespace-pre-wrap font-mono max-h-[120px] overflow-y-auto",children:t.thinking})]}),i&&e.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-[hsl(var(--deck-ink-muted))] font-mono",children:[e.jsx(R,{className:"w-3 h-3 animate-spin"}),s("chat.subagent.loadingLogs")]}),!i&&V.length>0&&e.jsx(Ke,{toolCalls:V}),m&&e.jsxs("div",{className:"rounded-md border border-[#DDD6FE] bg-[#F5F3FF] p-2 text-[11px] font-mono text-[#5B21B6] dark:border-[#4C1D95] dark:bg-[#1E1B4B] dark:text-[#C4B5FD]",children:[e.jsx("div",{children:s("chat.subagent.resumedAs",{id:m.id,status:m.status,depth:m.resumeDepth??1})}),(((K=m.result)==null?void 0:K.message)||((Y=m.result)==null?void 0:Y.error))&&e.jsx("div",{className:"mt-1 whitespace-pre-wrap text-[hsl(var(--deck-ink))]",children:m.result.message||m.result.error})]}),H&&((X=C==null?void 0:C.result)==null?void 0:X.error)&&e.jsx("div",{role:"alert",className:"text-[11px] text-red-600",children:C.result.error}),ce&&e.jsxs("div",{className:"space-y-2",children:[l?e.jsxs("div",{className:"space-y-2 rounded-md border border-[#E5E7EB] bg-white p-2 dark:border-[#27272a] dark:bg-[#111113]",children:[e.jsx("textarea",{"aria-label":s("chat.subagent.followUpAria"),value:k,onChange:M=>o(M.target.value),placeholder:s("chat.subagent.followUpPlaceholder"),rows:3,className:"w-full resize-y rounded border border-[#D1D5DB] bg-white p-2 text-[11px] text-[#111827] outline-none focus:border-[#8B5CF6] dark:border-[#3f3f46] dark:bg-[#18181b] dark:text-[#f4f4f5]"}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx("button",{type:"button",onClick:()=>{c(!1),N(null)},className:"rounded px-2 py-1 text-[11px] text-[#6B7280] hover:bg-[#F3F4F6] dark:hover:bg-[#27272a]",children:s("chat.subagent.cancel")}),e.jsxs("button",{type:"button",onClick:()=>void z(),disabled:!k.trim()||h,className:"flex items-center gap-1 rounded bg-[#7C3AED] px-2 py-1 text-[11px] font-medium text-white disabled:opacity-50",children:[h&&e.jsx(R,{className:"w-3 h-3 animate-spin"}),s("chat.subagent.resumeAgent")]})]})]}):e.jsxs("button",{type:"button","aria-label":s("chat.subagent.resumeAria"),onClick:()=>c(!0),className:"flex items-center gap-1.5 rounded-md border border-[#D1D5DB] px-2 py-1 text-[11px] font-medium text-[#374151] transition-colors hover:bg-[#F3F4F6] dark:border-[#3f3f46] dark:text-[#d4d4d8] dark:hover:bg-[#27272a]",children:[e.jsx(ke,{className:"w-3 h-3"}),s("chat.subagent.resume")]}),j&&e.jsx("div",{role:"alert",className:"text-[11px] text-red-600",children:j})]})]})]})}function ns({confirmation:t,messageId:s}){const a=F(),[r,i]=b.useState(!1),[n,d]=b.useState(null),f=y(k=>k.currentSessionRef),l=y(k=>k.setConfirmation);if(!t)return null;const c=async(k,o)=>{if(!(!f||r)){i(!0),d(null);try{await U.respondPermission(f,t.toolCallId,{approved:k,scope:o}),l(s,{...t,status:k?"approved":"denied"})}catch(h){d(h instanceof Error?h.message:a("interaction.permission.failed"))}finally{i(!1)}}};return t.status!=="pending"?null:e.jsxs("div",{"data-pending-interaction":"permission",tabIndex:-1,role:"alert",className:"space-y-3 rounded-lg border border-amber-300/70 bg-amber-50/70 p-4 outline-none focus-visible:ring-2 focus-visible:ring-amber-500 dark:border-amber-800/70 dark:bg-amber-950/25",children:[e.jsx("div",{className:"text-[13px] text-[hsl(var(--deck-ink))] font-mono",children:a("interaction.permission.title",{tool:t.toolName})}),e.jsx("div",{className:"text-[12px] text-[hsl(var(--deck-ink-muted))] font-mono",children:t.description}),t.diff&&e.jsx("pre",{className:"text-[11px] text-[hsl(var(--deck-ink))] bg-[hsl(var(--deck-surface-2))] border border-[hsl(var(--deck-border))] rounded-md p-2 overflow-x-auto whitespace-pre-wrap font-mono max-h-[200px] overflow-y-auto",children:t.diff}),n&&e.jsx("div",{role:"alert",className:"rounded-md border border-red-300/70 bg-red-50 px-2.5 py-2 font-mono text-[11px] text-red-700 dark:border-red-900/70 dark:bg-red-950/35 dark:text-red-300",children:n}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("button",{type:"button",onClick:()=>void c(!0,"once"),disabled:r,className:"min-h-8 px-3 py-1.5 text-[12px] font-mono bg-[#22C55E] text-white rounded-md hover:bg-[#16A34A] disabled:cursor-wait disabled:opacity-50",children:r?e.jsx(R,{className:"h-3.5 w-3.5 animate-spin"}):a("interaction.permission.once")}),t.allowRemember!==!1&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>void c(!0,"session"),disabled:r,className:"min-h-8 px-3 py-1.5 text-[12px] font-mono bg-[#3B82F6] text-white rounded-md hover:bg-[#2563EB] disabled:cursor-wait disabled:opacity-50",children:a("interaction.permission.session")}),e.jsx("button",{type:"button",onClick:()=>void c(!0,"project"),disabled:r,className:"min-h-8 px-3 py-1.5 text-[12px] font-mono bg-[#6366F1] text-white rounded-md hover:bg-[#4F46E5] disabled:cursor-wait disabled:opacity-50",children:a("interaction.permission.project")})]}),e.jsx("button",{type:"button",onClick:()=>void c(!1),disabled:r,className:"min-h-8 px-3 py-1.5 text-[12px] font-mono bg-[#EF4444] text-white rounded-md hover:bg-[#DC2626] disabled:cursor-wait disabled:opacity-50",children:a("interaction.permission.deny")})]})]})}function is({question:t,messageId:s}){const a=F(),[r,i]=b.useState({}),[n,d]=b.useState({}),[f,l]=b.useState(!1),[c,k]=b.useState(null),o=y(m=>m.currentSessionRef),h=y(m=>m.setQuestion),u=b.useMemo(()=>t?t.questions.reduce((m,w)=>{var E;const g=(E=n[w.header])==null?void 0:E.trim(),p=r[w.header];if(w.multiSelect){const S=Array.isArray(p)?[...p]:[];return g&&S.push(g),S.length>0&&(m[w.header]=S),m}const x=g||(typeof p=="string"?p:"");return x&&(m[w.header]=x),m},{}):{},[r,n,t]),j=(t==null?void 0:t.questions.every(m=>m.header in u))??!1;if(!t)return null;const N=async()=>{if(!(!o||f||!j)){l(!0),k(null);try{await U.respondToQuestion(o,t.toolCallId,u),h(s,{...t,status:"answered",answers:u})}catch(m){k(m instanceof Error?m.message:a("interaction.question.failed"))}finally{l(!1)}}};return t.status!=="pending"?e.jsx("div",{className:"bg-[hsl(var(--deck-surface-2))] border border-[hsl(var(--deck-border))] rounded-lg px-3 py-2",children:e.jsx("div",{className:"text-[12px] text-[hsl(var(--deck-ink-muted))] font-mono",children:a("interaction.question.answered")})}):e.jsxs("div",{"data-pending-interaction":"question",tabIndex:-1,role:"alert",className:"space-y-4 rounded-lg border border-amber-300/70 bg-amber-50/70 p-4 outline-none focus-visible:ring-2 focus-visible:ring-amber-500 dark:border-amber-800/70 dark:bg-amber-950/25",children:[t.questions.map((m,w)=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-[13px] text-[hsl(var(--deck-ink))] font-mono",children:m.question}),e.jsxs("div",{className:"space-y-1",children:[m.options.map((g,p)=>e.jsxs("button",{type:"button",onClick:()=>{if(m.multiSelect){const x=r[m.header]||[],E=x.includes(g.label)?x.filter(S=>S!==g.label):[...x,g.label];i({...r,[m.header]:E})}else i({...r,[m.header]:g.label}),d({...n,[m.header]:""})},className:T("w-full text-left px-3 py-2 rounded-md border text-[12px] font-mono transition-colors","border-[hsl(var(--deck-border))]",(m.multiSelect?(r[m.header]||[]).includes(g.label):r[m.header]===g.label)?"bg-[#DCFCE7] text-[#166534] dark:bg-[#22C55E]/20 dark:text-[#E5E5E5]":"bg-[hsl(var(--deck-surface-2))] text-[hsl(var(--deck-ink-muted))]"),children:[e.jsx("div",{children:g.label}),e.jsx("div",{className:"text-[11px] text-[hsl(var(--deck-ink-faint))] mt-1",children:g.description})]},p)),e.jsx("input",{"aria-label":`${m.header} other response`,value:n[m.header]??"",onChange:g=>d({...n,[m.header]:g.target.value}),placeholder:a("interaction.question.other"),className:"w-full rounded-md border border-[#E5E7EB] bg-white px-3 py-2 text-[12px] text-[#111827] outline-none focus:border-[#22C55E] dark:border-[#27272a] dark:bg-[#111113] dark:text-[#E5E5E5]"})]})]},w)),c&&e.jsx("div",{role:"alert",className:"rounded-md border border-red-300/70 bg-red-50 px-2.5 py-2 font-mono text-[11px] text-red-700 dark:border-red-900/70 dark:bg-red-950/35 dark:text-red-300",children:c}),e.jsxs("button",{type:"button",onClick:()=>void N(),disabled:f||!j,className:"inline-flex min-h-8 items-center gap-1.5 px-3 py-1.5 text-[12px] font-mono bg-[#22C55E] text-white rounded-md hover:bg-[#16A34A] disabled:cursor-wait disabled:opacity-50",children:[f&&e.jsx(R,{className:"h-3.5 w-3.5 animate-spin"}),a("interaction.question.submit")]})]})}function os({message:t}){const s=t.agentContent,a=y(j=>j.isStreaming&&j.currentAssistantMessageId===t.id);if(!s){const j=je(t.content);return j?e.jsx(Ee,{content:j}):null}const{toolCalls:r,tasks:i,confirmation:n,question:d,elicitation:f}=s,l=jt(s),c=yt(s);if(!(c.length>0||i.length>0||l.length>0||n||d||f)&&a)return e.jsxs("div",{className:"flex items-center gap-2 text-[hsl(var(--deck-ink-muted))]",children:[e.jsx(R,{className:"w-4 h-4 animate-spin"}),e.jsx("span",{className:"text-[12px] font-mono",children:"Thinking..."})]});const h=r.length>0&&r.every(j=>j.status==="success"||j.status==="error")&&!a,u=!a;return e.jsxs("div",{className:"space-y-3",children:[c.map(j=>j.type==="thinking"?e.jsx("div",{"data-agent-timeline-block":"thinking",children:e.jsx(ts,{content:j.content})},j.id):j.type==="text"?e.jsx("div",{"data-agent-timeline-block":"text",children:e.jsx(Ee,{content:j.content,syntaxHighlight:u})},j.id):e.jsx("div",{"data-agent-timeline-block":"tool_group",children:e.jsx(es,{toolCalls:r,toolCallIds:j.toolCallIds})},j.id)),i.length>0&&e.jsx(ss,{tasks:i}),l.map(j=>e.jsx(rs,{subagent:j},j.id)),n&&e.jsx(ns,{confirmation:n,messageId:t.id}),d&&e.jsx(is,{question:d,messageId:t.id}),f&&e.jsx(_t,{elicitation:f,messageId:t.id}),h&&e.jsx(as,{toolCalls:r})]})}function cs({message:t,showAvatar:s=!0}){var f,l,c,k;const a=t.role==="user";if(t.role==="system"){const o=je(t.content);return e.jsx("div",{"data-chat-message-id":t.id,"data-chat-role":"system",className:"flex justify-center p-2 w-full",children:e.jsx("div",{className:"text-xs text-[hsl(var(--deck-ink-muted))] bg-[#F3F4F6] dark:bg-[#18181b] px-3 py-1 rounded-full font-mono",children:o})})}if(a){const o=(f=t.metadata)!=null&&f.userShellCommand&&typeof t.metadata.userShellCommand=="object"?t.metadata.userShellCommand:(l=t.metadata)!=null&&l.userShellExecution&&typeof t.metadata.userShellExecution=="object"?t.metadata.userShellExecution:void 0;if(o){const j=typeof o.command=="string"?o.command:"",N=o.status==="running"?"running":o.status==="completed"?"success":"error",m=typeof o.output=="string"?o.output:[typeof o.stdout=="string"?o.stdout:"",typeof o.stderr=="string"&&o.stderr?`stderr:
16
+ ${o.stderr}`:""].filter(Boolean).join(`
17
+ `);return e.jsx("div",{"data-chat-message-id":t.id,"data-chat-role":"user","data-user-shell-command":!0,className:"flex w-full justify-end p-4",children:e.jsxs("div",{className:"w-full max-w-[85%] overflow-hidden rounded-lg border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] px-3 py-2",children:[e.jsxs("div",{className:"min-w-0 truncate font-mono text-[12px] text-[hsl(var(--deck-ink))]",children:[e.jsx("span",{className:"mr-2 text-amber-600 dark:text-amber-400",children:"$"}),j]}),e.jsx(ye,{status:N})]}),e.jsx("pre",{className:"max-h-64 overflow-auto whitespace-pre-wrap px-3 py-2 font-mono text-[11px] text-[hsl(var(--deck-ink-muted))]",children:m||"(no output)"}),typeof o.exitCode=="number"&&e.jsxs("div",{className:"border-t border-[hsl(var(--deck-border))] px-3 py-1.5 font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:["exit ",o.exitCode,typeof o.durationMs=="number"?` · ${(o.durationMs/1e3).toFixed(3)}s`:"",o.truncated===!0?" · truncated":""]})]})})}const{text:h,images:u}=Jt(t.content);return e.jsxs("div",{"data-chat-message-id":t.id,"data-chat-role":"user",className:"group flex gap-2 justify-end p-4 w-full items-start",children:[e.jsx("div",{className:"mt-1 flex shrink-0 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",children:e.jsx(Se,{text:h,label:"Copy message"})}),e.jsxs("div",{className:"bg-[hsl(var(--deck-surface-2))] rounded-lg px-4 py-3 max-w-[85%]",children:[h&&e.jsx("p",{className:"text-[14px] text-[hsl(var(--deck-ink))] font-mono leading-relaxed whitespace-pre-wrap",children:h}),u.length>0&&e.jsx("div",{className:T("grid gap-2",u.length===1?"grid-cols-1 mt-0":"grid-cols-2 mt-3"),children:u.map((j,N)=>e.jsx("img",{src:j,alt:`attachment-${N+1}`,className:"object-cover w-full max-h-64 rounded-md"},`${j}-${N}`))})]}),e.jsx(Wt,{})]})}const i=Qt(t),n=Dt((c=t.metadata)==null?void 0:c.codeReview),d=Kt((k=t.metadata)==null?void 0:k.structuredOutput);return e.jsxs("div",{"data-chat-message-id":t.id,"data-chat-role":"assistant",className:T("group flex gap-4 justify-start w-full",s?"p-4":"px-4 pt-0 pb-3"),children:[s?e.jsx(Gt,{}):e.jsx("div",{className:"w-8 shrink-0"}),e.jsxs("div",{className:"overflow-hidden flex-1 min-w-0",children:[n?e.jsx(It,{report:n}):d?e.jsx(qt,{report:d}):e.jsx(os,{message:t}),!d&&i.trim()&&e.jsx("div",{className:"mt-1.5 flex opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",children:e.jsx(Se,{text:i,label:"Copy response"})})]})]})}const ls=b.memo(cs);function ds(t,s,a){return Math.max(0,t+(a-s))}function us(t,s,a){return Math.min(s,Math.max(0,t)+Math.max(0,a))}function Ae(t,s){return t?t.querySelector(`[data-chat-message-id="${CSS.escape(s)}"]`):null}function ms({turns:t,viewportRef:s,containerRef:a,onRevealTurn:r}){const i=F(),[n,d]=b.useState(null),[f,l]=b.useState(!1),c=b.useRef(null),k=b.useCallback(()=>{var m;const h=s.current,u=a.current;if(!h||!u||t.length===0)return;const j=h.getBoundingClientRect().top;let N=((m=t[0])==null?void 0:m.id)??null;for(const w of t){const g=Ae(u,w.id);if(g)if(g.getBoundingClientRect().top-j<=24)N=w.id;else break}d(N)},[t,s,a]);b.useEffect(()=>{const h=s.current;if(!h)return;const u=()=>{c.current===null&&(c.current=window.requestAnimationFrame(()=>{c.current=null,k()}))};return k(),h.addEventListener("scroll",u,{passive:!0}),()=>{h.removeEventListener("scroll",u),c.current!==null&&(window.cancelAnimationFrame(c.current),c.current=null)}},[k,s]);const o=b.useCallback(h=>{const u=()=>{const N=Ae(a.current,h.id);N&&(N.scrollIntoView({behavior:"smooth",block:"start"}),d(h.id))};r(h.index)?u():window.requestAnimationFrame(()=>window.requestAnimationFrame(u))},[a,r]);return t.length<2?null:e.jsx("nav",{"aria-label":i("chat.turns.aria"),className:"absolute right-1 top-1/2 z-20 hidden -translate-y-1/2 sm:block",onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),onFocusCapture:()=>l(!0),onBlurCapture:h=>{h.currentTarget.contains(h.relatedTarget)||l(!1)},children:e.jsxs("div",{className:"relative flex items-center justify-end",children:[e.jsx("ul",{className:T("flex flex-col items-center gap-2 py-2 transition-opacity",f?"opacity-0":"opacity-100"),"aria-hidden":f,children:t.map(h=>e.jsx("li",{children:e.jsx("span",{className:T("block rounded-full transition-all",h.id===n?"h-2 w-2 bg-[hsl(var(--deck-accent))]":"h-1.5 w-1.5 bg-[hsl(var(--deck-ink-faint))]/40")})},h.id))}),e.jsx("div",{className:T("absolute right-0 max-h-[min(70vh,520px)] w-[280px] overflow-y-auto rounded-lg border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]/95 p-1 shadow-xl backdrop-blur transition-all",f?"pointer-events-auto translate-x-0 opacity-100":"pointer-events-none translate-x-2 opacity-0"),children:t.map((h,u)=>e.jsxs("button",{type:"button",onClick:()=>o(h),className:T("flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left transition-colors",h.id===n?"bg-[hsl(var(--deck-hairline))]/70 text-[hsl(var(--deck-ink))]":"text-[hsl(var(--deck-ink-muted))] hover:bg-[hsl(var(--deck-hairline))]/50 hover:text-[hsl(var(--deck-ink))]"),children:[e.jsx("span",{className:T("mt-1 h-1.5 w-1.5 shrink-0 rounded-full",h.id===n?"bg-[hsl(var(--deck-accent))]":"bg-[hsl(var(--deck-ink-faint))]/40")}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block font-mono text-[9.5px] uppercase tracking-[0.12em] text-[hsl(var(--deck-ink-faint))]",children:i("chat.turns.label",{n:u+1})}),e.jsx("span",{className:"line-clamp-2 text-[12px] leading-4",children:h.preview})]})]},h.id))})]})})}const Re=80;function hs(t){return typeof t=="string"?t:Array.isArray(t)?t.filter(s=>s.type==="text").map(s=>s.text).join(" "):""}function xs(t){const s=hs(t).replace(/\s+/g," ").trim();return s?s.length>Re?`${s.slice(0,Re-1)}…`:s:""}function ps(t){const s=[];for(let a=0;a<t.length;a+=1){const r=t[a];if(r.role!=="user"||!r.id)continue;const i=xs(r.content);i&&s.push({id:r.id,index:a,preview:i})}return s}const ue=120,me=80,fs=96;function J(t){return(t==null?void 0:t.querySelector("[data-radix-scroll-area-viewport]"))??null}function bs({messages:t,isLoading:s}){const a=F(),r=b.useRef(null),i=b.useRef(null),n=b.useRef(!0),d=b.useRef(t.length),f=b.useRef(null),[l,c]=b.useState(ue),[k,o]=b.useState(!1);b.useEffect(()=>{const p=J(r.current);if(!p||!n.current)return;const x=window.requestAnimationFrame(()=>{p.scrollTop=p.scrollHeight});return()=>window.cancelAnimationFrame(x)},[t]),b.useEffect(()=>{const p=J(r.current);if(!p)return;i.current=p;const x=()=>{const S=p.scrollHeight-p.scrollTop-p.clientHeight<=fs;n.current=S,o(!S)};return x(),p.addEventListener("scroll",x,{passive:!0}),()=>p.removeEventListener("scroll",x)},[]),b.useEffect(()=>{const p=d.current;d.current=t.length,c(x=>x>=p&&t.length>p?t.length:Math.min(Math.max(x,ue),t.length||ue))},[t.length]);const h=Math.max(t.length-l,0),u=h,j=b.useMemo(()=>t.slice(u),[t,u]),N=b.useMemo(()=>ps(t),[t]);if(b.useLayoutEffect(()=>{var E;const p=f.current;if(!p)return;const x=J(r.current);if(f.current=null,!!x){if((E=p.element)!=null&&E.isConnected){const S=p.element.getBoundingClientRect().top-p.viewportTop;x.scrollTop+=S;return}x.scrollTop=ds(p.scrollTop,p.scrollHeight,x.scrollHeight)}},[l]),s)return e.jsx("div",{role:"status","aria-live":"polite","aria-busy":"true",className:"flex overflow-hidden flex-1 justify-center items-center px-5 py-8 min-h-0",children:e.jsxs("div",{className:"w-full max-w-[560px]",children:[e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 animate-pulse rounded-full bg-[hsl(var(--deck-accent-soft))] blur-xl"}),e.jsx(xe,{size:42,className:"relative"})]}),e.jsxs("div",{className:"mt-4 inline-flex items-center gap-1.5 font-mono text-[10px] uppercase tracking-[0.16em] text-[hsl(var(--deck-accent))]",children:[e.jsx(ct,{className:"w-3 h-3"}),a("chat.list.loading.eyebrow")]}),e.jsx("h2",{className:"mt-2 text-[15px] font-medium text-[hsl(var(--deck-ink))]",children:a("chat.list.loading.title")}),e.jsx("p",{className:"mt-1 max-w-sm text-[11.5px] leading-5 text-[hsl(var(--deck-ink-faint))]",children:a("chat.list.loading.hint")})]}),e.jsx("div",{"aria-hidden":"true",className:"mt-7 space-y-4 rounded-xl border border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-surface))]/45 px-4 py-5",children:[72,88,64].map((p,x)=>e.jsxs("div",{className:T("flex gap-3",x%2===1&&"flex-row-reverse"),children:[e.jsx("span",{className:"h-7 w-7 shrink-0 animate-pulse rounded-md bg-[hsl(var(--deck-surface-2))]"}),e.jsx("span",{className:"h-10 animate-pulse rounded-lg bg-[hsl(var(--deck-surface-2))]",style:{width:`${p}%`,animationDelay:`${x*120}ms`}})]},p))})]})});if(t.length===0&&!s)return e.jsx("div",{className:"flex flex-1 justify-center items-center",children:e.jsxs("div",{className:"flex flex-col gap-4 items-center text-center",children:[e.jsx(xe,{size:44}),e.jsxs("div",{children:[e.jsx("div",{className:"deck-eyebrow text-[hsl(var(--deck-accent))]",children:a("chat.list.empty.eyebrow")}),e.jsx("div",{className:"mt-2 text-[15px] font-medium text-[hsl(var(--deck-ink))]",children:a("chat.list.empty.title")}),e.jsx("div",{className:"mt-1 max-w-xs text-[12px] text-[hsl(var(--deck-ink-muted))]",children:a("chat.list.empty.hint")})]})]})});const m=()=>{const p=J(r.current);p&&(n.current=!0,o(!1),p.scrollTo({top:p.scrollHeight,behavior:"smooth"}))},w=()=>{var x;const p=J(r.current);if(p){const E=((x=r.current)==null?void 0:x.querySelector("[data-chat-message-id]"))??null;f.current={element:E,viewportTop:(E==null?void 0:E.getBoundingClientRect().top)??0,scrollHeight:p.scrollHeight,scrollTop:p.scrollTop}}c(E=>us(E,t.length,me))},g=p=>p>=u?!0:(c(t.length),!1);return e.jsxs("div",{ref:r,className:"relative flex-1 min-h-0",children:[e.jsx(We,{className:"h-full",children:e.jsxs("div",{className:"flex flex-col px-4 pb-4 w-full md:px-6",children:[h>0&&e.jsx("div",{className:"flex justify-center py-3",children:e.jsx("button",{type:"button",onClick:w,"aria-label":a("chat.list.showEarlierWithRemaining",{count:Math.min(h,me),remaining:h}),className:"rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 py-1.5 font-mono text-[12px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:border-[hsl(var(--deck-border-strong))] hover:text-[hsl(var(--deck-ink))]",children:a("chat.list.showEarlier",{count:Math.min(h,me)})})}),j.map((p,x)=>{const E=u+x,S=E>0?t[E-1]:null,D=!S||S.role!==p.role||S.role==="user";return e.jsx(ls,{message:p,showAvatar:D},p.id||`msg-${E}`)})]})}),e.jsx(ms,{turns:N,viewportRef:i,containerRef:r,onRevealTurn:g}),k&&e.jsxs("button",{type:"button",onClick:m,className:"absolute bottom-4 left-1/2 z-10 inline-flex -translate-x-1/2 items-center gap-1.5 rounded-full border border-[hsl(var(--deck-border-strong))] bg-[hsl(var(--deck-surface))]/95 px-3 py-1.5 font-mono text-[11px] text-[hsl(var(--deck-ink-muted))] shadow-lg backdrop-blur transition-colors hover:text-[hsl(var(--deck-ink))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:[e.jsx(Le,{className:"h-3.5 w-3.5 text-[hsl(var(--deck-accent))]"}),a("chat.list.jumpLatest")]})]})}const vs=b.memo(bs),pe=Ct,fe=Et,be=Tt,re=b.forwardRef(({className:t,sideOffset:s=4,...a},r)=>e.jsx(Ue,{ref:r,sideOffset:s,className:T("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",t),...a}));re.displayName=Ue.displayName;const gs={active:{labelKey:"goal.status.active",dot:"bg-[hsl(var(--deck-accent))] shadow-[0_0_6px_hsl(var(--deck-accent-glow)/0.5)]",accent:"text-[hsl(var(--deck-accent))]"},verifying:{labelKey:"goal.status.active",dot:"animate-pulse bg-sky-400",accent:"text-sky-600 dark:text-sky-300"},paused:{labelKey:"goal.status.paused",dot:"bg-amber-400",accent:"text-amber-600 dark:text-amber-300"},blocked:{labelKey:"goal.status.blocked",dot:"bg-rose-500",accent:"text-rose-600 dark:text-rose-300"},usage_limited:{labelKey:"goal.status.usageLimited",dot:"bg-orange-500",accent:"text-orange-600 dark:text-orange-300"},budget_limited:{labelKey:"goal.status.budgetLimited",dot:"bg-orange-500",accent:"text-orange-600 dark:text-orange-300"},complete:{labelKey:"goal.status.complete",dot:"bg-emerald-500",accent:"text-emerald-600 dark:text-emerald-300"}};function Z(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:String(t)}function ks(t){if(t<60)return`${t}s`;const s=Math.floor(t/60),a=t%60;return a===0?`${s}m`:`${s}m ${a}s`}function js(){var _;const t=F(),{locale:s}=Je(),a=y(C=>C.goal),r=y(C=>C.pauseGoal),i=y(C=>C.resumeGoal),n=y(C=>C.editGoal),d=y(C=>C.clearGoal),[f,l]=b.useState(!1),[c,k]=b.useState(!1),[o,h]=b.useState(""),[u,j]=b.useState(null),[N,m]=b.useState(!1);if(b.useEffect(()=>{l(!1),k(!1),h((a==null?void 0:a.objective)??""),m(!1)},[a==null?void 0:a.goalId]),!a)return null;const w=gs[a.status],g=["active","verifying","paused","blocked"].includes(a.status),p=a.status==="active"||a.status==="verifying",x=a.status==="paused"||a.status==="blocked",E=u!==null,S=async(C,B)=>{j(C);try{await B()}finally{j(null)}},D=()=>{h(a.objective),k(!0),l(!0)},A=async C=>{C.preventDefault();const B=o.trim();if(!B||B===a.objective){k(!1);return}await S("edit",()=>n(B)),k(!1)},V=async()=>{await S("delete",d),m(!1)};return e.jsxs(e.Fragment,{children:[e.jsx(pe,{delayDuration:250,children:e.jsxs("section",{"aria-label":t("goal.aria.section"),className:"mx-3 mb-1 shrink-0","data-blade-goal-status":a.status,children:[e.jsxs("div",{className:T("flex h-9 items-center gap-2 rounded-lg border px-3 transition-colors","border-[hsl(var(--deck-border))]/60 bg-[hsl(var(--deck-surface))]/80 backdrop-blur-sm",f&&"rounded-b-none border-b-0"),children:[a.status==="complete"?e.jsx(lt,{className:"h-3.5 w-3.5 shrink-0 text-emerald-500"}):e.jsx(dt,{className:T("h-3.5 w-3.5 shrink-0",w.accent)}),e.jsx("span",{className:T("h-1.5 w-1.5 shrink-0 rounded-full",w.dot)}),e.jsx("span",{className:T("shrink-0 text-[10px] font-medium leading-none",w.accent),children:a.status==="verifying"?s==="zh"?"验证中":"Verifying":t(w.labelKey)}),e.jsx("span",{className:"h-3 w-px shrink-0 bg-[hsl(var(--deck-hairline))]"}),e.jsx("button",{type:"button","aria-label":t(f?"goal.action.collapse":"goal.action.expand"),className:"min-w-0 flex-1 truncate text-left text-[12px] leading-5 text-[hsl(var(--deck-ink))]/85 outline-none transition-colors hover:text-[hsl(var(--deck-ink))]",onClick:()=>l(C=>!C),"aria-expanded":f,title:a.objective,children:a.objective}),a.tokensUsed>0&&e.jsxs("span",{className:"hidden shrink-0 text-[10px] tabular-nums text-[hsl(var(--deck-ink-muted))] sm:inline",children:[Z(a.tokensUsed),a.tokenBudget!==void 0&&`/${Z(a.tokenBudget)}`]}),e.jsxs("div",{className:"flex shrink-0 items-center",children:[p&&e.jsx(ee,{label:t("goal.action.pause"),disabled:E,onClick:()=>void S("pause",r),children:u==="pause"?e.jsx(R,{className:"animate-spin"}):e.jsx(ut,{})}),x&&e.jsx(ee,{label:t("goal.action.resume"),disabled:E,onClick:()=>void S("resume",i),children:u==="resume"?e.jsx(R,{className:"animate-spin"}):e.jsx(mt,{})}),e.jsx(ee,{label:t(g?"goal.action.edit":"goal.action.expand"),disabled:!g&&!f,onClick:g?D:()=>l(C=>!C),children:g?e.jsx(Ve,{}):e.jsx(ht,{})}),e.jsx(ee,{label:t("goal.action.delete"),disabled:E,destructive:!0,onClick:()=>m(!0),children:e.jsx(se,{})})]})]}),f&&e.jsx("div",{className:"rounded-b-lg border border-t-0 border-[hsl(var(--deck-border))]/60 bg-[hsl(var(--deck-surface))]/80 px-4 py-3 backdrop-blur-sm",children:c?e.jsxs("form",{onSubmit:A,children:[e.jsx("textarea",{id:"goal-objective",value:o,onChange:C=>h(C.target.value),onKeyDown:C=>{C.key==="Escape"&&k(!1)},rows:3,autoFocus:!0,className:"w-full resize-none rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] px-3 py-2 text-[12px] leading-5 text-[hsl(var(--deck-ink))] outline-none transition-shadow focus:border-[hsl(var(--deck-accent))] focus:ring-1 focus:ring-[hsl(var(--deck-accent-glow))]"}),e.jsxs("div",{className:"mt-2 flex items-center justify-end gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>k(!1),className:"inline-flex h-7 items-center gap-1 rounded-md px-2.5 text-[11px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-hairline))]/60",children:[e.jsx(xt,{className:"h-3 w-3"}),t("goal.action.cancel")]}),e.jsxs("button",{type:"submit",disabled:!o.trim()||u==="edit",className:"inline-flex h-7 items-center gap-1 rounded-md bg-[hsl(var(--deck-accent))] px-2.5 text-[11px] font-medium text-white transition-colors hover:bg-[hsl(var(--deck-accent))]/90 disabled:cursor-not-allowed disabled:opacity-50",children:[u==="edit"?e.jsx(R,{className:"h-3 w-3 animate-spin"}):e.jsx(ne,{className:"h-3 w-3"}),t("goal.action.save")]})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"whitespace-pre-wrap text-[12px] leading-5 text-[hsl(var(--deck-ink))]/90",children:a.objective}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-4 gap-y-1.5 text-[10px] text-[hsl(var(--deck-ink-muted))]",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(pt,{className:"h-3 w-3"}),Z(a.tokensUsed),a.tokenBudget!==void 0&&` / ${Z(a.tokenBudget)}`," ",t("goal.metrics.tokens")]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(ft,{className:"h-3 w-3"}),ks(a.timeUsedSeconds)]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(ke,{className:"h-3 w-3"}),a.continuationCount===1?t("goal.metrics.continuationOne",{n:a.continuationCount}):t("goal.metrics.continuationMany",{n:a.continuationCount})]})]}),a.completionVerification&&e.jsxs("div",{"data-goal-verification":a.completionVerification.status,className:"mt-2 rounded-md border border-sky-200/50 bg-sky-50/60 px-2.5 py-2 text-[11px] text-sky-900 dark:border-sky-400/15 dark:bg-sky-400/[0.05] dark:text-sky-100",children:[e.jsxs("p",{className:"font-mono font-medium",children:["#",a.completionVerification.attempt," ·"," ",a.completionVerification.status.toUpperCase()," ·"," ",((_=a.completionVerification.verifierSessionId)==null?void 0:_.slice(0,12))??"-"]}),a.completionVerification.summary&&e.jsx("p",{className:"mt-1 line-clamp-3 whitespace-pre-wrap opacity-80",children:a.completionVerification.summary}),a.completionVerification.evidenceSha256&&e.jsxs("p",{className:"mt-1 font-mono text-[10px] opacity-60",children:["sha256:",a.completionVerification.evidenceSha256.slice(0,12)]})]}),a.statusReason&&e.jsx("div",{className:"mt-2 rounded-md border border-amber-200/50 bg-amber-50/60 px-2.5 py-1.5 text-[11px] text-amber-800 dark:border-amber-400/15 dark:bg-amber-400/[0.05] dark:text-amber-200",children:a.statusReason})]})})]})}),e.jsx($e,{open:N,onOpenChange:m,children:e.jsxs(De,{className:"max-w-[400px] border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]",children:[e.jsx(Be,{children:t("goal.dialog.title")}),e.jsx(Ie,{children:t("goal.dialog.description")}),e.jsxs(_e,{className:"mt-2",children:[e.jsx("button",{type:"button",onClick:()=>m(!1),className:"inline-flex h-8 items-center justify-center rounded-md border border-[hsl(var(--deck-border))] px-3 text-[12px] text-[hsl(var(--deck-ink))] hover:bg-[hsl(var(--deck-hairline))]/60",children:t("goal.action.cancel")}),e.jsxs("button",{type:"button",disabled:u==="delete",onClick:()=>void V(),className:"inline-flex gap-1.5 justify-center items-center px-3 h-8 text-[12px] font-medium text-white bg-rose-600 rounded-md hover:bg-rose-500 disabled:opacity-50",children:[u==="delete"&&e.jsx(R,{className:"w-3.5 h-3.5 animate-spin"}),t("goal.action.delete")]})]})]})})]})}function ee({label:t,children:s,disabled:a,destructive:r,onClick:i}){return e.jsxs(fe,{children:[e.jsx(be,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":t,disabled:a,onClick:i,className:T("flex h-6 w-6 items-center justify-center rounded-md text-[hsl(var(--deck-ink-muted))] outline-none transition-colors focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent-glow))]/50 disabled:cursor-not-allowed disabled:opacity-35 [&_svg]:h-3.5 [&_svg]:w-3.5",r?"hover:bg-rose-500/10 hover:text-rose-500":"hover:bg-[hsl(var(--deck-hairline))]/60 hover:text-[hsl(var(--deck-ink))]"),children:s})}),e.jsx(re,{side:"top",className:"text-[10px]",children:t})]})}function ys(){const t=F(),s=y(l=>l.currentSessionRef),a=y(l=>l.sessions),r=y(l=>l.messages),i=b.useMemo(()=>{var c,k,o,h,u;const l=s?(c=Qe(a,s))==null?void 0:c.pendingInteraction:void 0;if(l)return l.type;for(let j=r.length-1;j>=0;j-=1){const N=(k=r[j])==null?void 0:k.agentContent;if(((o=N==null?void 0:N.confirmation)==null?void 0:o.status)==="pending")return"permission";if(((h=N==null?void 0:N.question)==null?void 0:h.status)==="pending")return"question";if(((u=N==null?void 0:N.elicitation)==null?void 0:u.status)==="pending")return"elicitation"}return null},[s,r,a]);if(!i)return null;const n=()=>{const l=document.querySelector(`[data-pending-interaction="${i}"]`);l==null||l.scrollIntoView({block:"center",behavior:"smooth"}),window.setTimeout(()=>l==null?void 0:l.focus(),250)},d=i==="question",f=i==="elicitation";return e.jsxs("div",{role:"alert",className:"mx-3 mb-2 flex flex-wrap items-center gap-2 rounded-lg border border-amber-300/80 bg-amber-50/95 px-3 py-2 font-mono text-amber-950 shadow-sm backdrop-blur dark:border-amber-800/80 dark:bg-amber-950/90 dark:text-amber-100 sm:mx-5",children:[e.jsx(Oe,{className:"h-4 w-4 shrink-0 text-amber-600 dark:text-amber-400"}),e.jsxs("div",{className:"min-w-[180px] flex-1",children:[e.jsx("div",{className:"text-[11.5px] font-semibold",children:t(d?"interaction.bar.questionTitle":f?"interaction.bar.elicitationTitle":"interaction.bar.permissionTitle")}),e.jsx("div",{className:"mt-0.5 text-[10px] leading-4 text-amber-800 dark:text-amber-300",children:t(d?"interaction.bar.questionHint":f?"interaction.bar.elicitationHint":"interaction.bar.permissionHint")})]}),e.jsxs("button",{type:"button",onClick:n,className:"inline-flex min-h-8 shrink-0 items-center gap-1.5 rounded-md border border-amber-400/80 bg-white/80 px-2.5 text-[10.5px] font-medium transition-colors hover:bg-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-500 dark:border-amber-700 dark:bg-amber-950/70 dark:hover:bg-amber-900",children:[e.jsx(Le,{className:"h-3 w-3"}),t("interaction.bar.review")]})]})}function he(t){return Number.isFinite(t)?Math.max(0,t):0}function ws(t){const s=he(t.totalInputTokens),a=he(t.cacheReadTokens),r=he(t.cacheWriteTokens),i=Math.min(a,s),n=Math.min(r,Math.max(0,s-i)),d=Math.max(0,s-i-n),f=s>0&&(a>0||r>0);return{totalInputTokens:s,cacheReadTokens:i,cacheWriteTokens:n,uncachedInputTokens:d,...f?{hitRate:i/s}:{}}}function Ns(t){return t===void 0||!Number.isFinite(t)?"—":`${Math.round(Math.max(0,Math.min(1,t))*100)}%`}const Ss={running:"status.phase.running",compacting:"status.phase.compacting",recovering_context:"status.phase.recoveringContext",switching_model:"status.phase.switchingModel",waiting_permission:"status.phase.waitingPermission",error:"status.phase.error",idle:""},Cs={model_changed:"status.cacheBreak.model",system_prompt_changed:"status.cacheBreak.system",tools_changed:"status.cacheBreak.tools",request_policy_changed:"status.cacheBreak.policy",ttl_expired:"status.cacheBreak.ttl",server_side:"status.cacheBreak.server"},O=t=>t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t.toString(),te=t=>{const s=Math.max(0,Math.ceil(t/1e3)),a=Math.floor(s/60),r=s%60;return a>0?`${a}m ${r}s`:`${r}s`};function Es(){const t=F(),s=y(w=>w.tokenUsage),a=y(w=>w.isStreaming),r=y(w=>w.agentPhase),i=y(w=>w.providerAdmission),n=y(w=>w.providerCircuit),d=y(w=>w.providerRetry),f=y(w=>w.providerStall),l=y(w=>w.actionStationarity),c=Ss[r]??"",k=(d==null?void 0:d.delayMs)!==void 0?` · ${Math.max(0,Math.ceil(d.delayMs/1e3))}s`:"",o=l?`${t(l.phase==="halted"?"status.phase.actionStationarityStopped":"status.phase.actionStationarityRecovering")} · ${l.toolName} · ${l.runLength}/${l.haltThreshold}`:n?n.phase==="probe"?"Provider · Recovery probe":`Provider · Circuit open${n.retryAfterMs!==void 0?` · probe in ${te(n.retryAfterMs)}`:""}${n.recoveryRemainingMs!==void 0?` · ${te(n.recoveryRemainingMs)}`:""}`:i?`Provider · Capacity queue ${i.queuePosition}/${Math.max(i.queueDepth,i.queuePosition)} · ${i.scope} · ${te(i.waitMs)}`:d?d.mode==="bounded_foreground"?`Provider · Bounded recovery · ${d.attempt}/${d.maxRetries} · ${te(d.recoveryRemainingMs??0)}`:`Provider · ${t("chat.error.action.retryingTask")} · ${d.attempt}/${d.maxRetries}${k}`:f?`${t("status.phase.providerStall")} · ${Math.ceil(f.durationMs/1e3)}s / ${Math.ceil(f.timeoutMs/1e3)}s`:c?t(c):"",h=s.maxContextTokens>0?Math.round(s.totalTokens/s.maxContextTokens*100):0,u=ws(s),j=Ns(u.hitRate),N=Math.min(h,100),m=h>95?"danger":h>80?"warn":"safe";return e.jsxs("div",{className:"flex items-center gap-2 border-t border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas-veil))]/70 px-3 py-2 font-mono text-[11px] text-[hsl(var(--deck-ink-muted))] backdrop-blur-sm sm:gap-4 sm:px-5",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[e.jsx("span",{className:"deck-eyebrow text-[hsl(var(--deck-ink-faint))]",children:t("status.context")}),e.jsxs("span",{className:"flex gap-1 items-baseline tabular-nums",children:[e.jsx("span",{className:T("text-[12px] font-medium",m==="safe"&&"text-[hsl(var(--deck-ink))]",m==="warn"&&"text-amber-600 dark:text-amber-400",m==="danger"&&"text-red-600 dark:text-red-400"),children:O(s.totalTokens)}),e.jsxs("span",{className:"text-[hsl(var(--deck-ink-faint))]",children:["/ ",O(s.maxContextTokens)]})]}),s.isDefaultMaxTokens&&e.jsx(pe,{children:e.jsxs(fe,{children:[e.jsx(be,{asChild:!0,children:e.jsx(bt,{className:"h-3 w-3 cursor-help text-[hsl(var(--deck-ink-faint))]"})}),e.jsx(re,{side:"top",className:"max-w-[220px]",children:e.jsx("p",{className:"text-xs",children:t("status.tokenLimitTooltip")})})]})}),e.jsxs("div",{className:"relative hidden h-2 w-32 overflow-hidden rounded-sm border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] sm:block","aria-hidden":"true",children:[e.jsx("div",{className:T("absolute inset-y-0 left-0 transition-[width] duration-300",m==="safe"&&"bg-[hsl(var(--deck-accent))]",m==="warn"&&"bg-amber-500",m==="danger"&&"bg-red-500"),style:{width:`${N}%`}}),e.jsx("div",{className:"flex absolute inset-0 pointer-events-none",children:[25,50,75].map(w=>e.jsx("span",{className:"absolute inset-y-0 w-px bg-[hsl(var(--deck-canvas-veil))]/60",style:{left:`${w}%`}},w))})]}),e.jsxs("span",{className:T("w-10 text-right tabular-nums text-[hsl(var(--deck-ink-faint))]",m==="warn"&&"text-amber-600 dark:text-amber-400",m==="danger"&&"text-red-600 dark:text-red-400"),children:[h,"%"]})]}),e.jsx(pe,{children:e.jsxs(fe,{children:[e.jsx(be,{asChild:!0,children:e.jsxs("div",{className:"flex shrink-0 cursor-help items-baseline gap-2 border-l border-[hsl(var(--deck-hairline))] pl-2 sm:pl-4","data-testid":"prompt-cache-hit-rate","aria-label":`${t("status.cache")} ${j}`,children:[e.jsx("span",{className:"deck-eyebrow text-[hsl(var(--deck-ink-faint))]",children:t("status.cache")}),e.jsx("span",{className:T("tabular-nums",u.hitRate===void 0?"text-[hsl(var(--deck-ink-faint))]":"font-medium text-[hsl(var(--deck-accent))]"),children:j})]})}),e.jsx(re,{side:"top",className:"max-w-[280px]",children:u.hitRate===void 0?e.jsx("p",{className:"text-xs",children:t("status.cacheUnavailable")}):e.jsxs("div",{className:"space-y-1 text-xs",children:[e.jsx("p",{children:t("status.cacheTooltip")}),e.jsx("p",{className:"font-mono tabular-nums",children:t("status.cacheDetails",{read:O(u.cacheReadTokens),write:O(u.cacheWriteTokens),uncached:O(u.uncachedInputTokens)})}),s.cacheBreak&&e.jsx("p",{className:"text-[hsl(var(--deck-accent))]",children:t("status.cacheBreak",{reason:t(Cs[s.cacheBreak.reason]??"status.cacheBreak.server"),previous:O(s.cacheBreak.previousCacheReadTokens),current:O(s.cacheBreak.cacheReadTokens)})})]})})]})}),e.jsx("div",{className:"flex-1"}),a&&o&&e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsx("span",{className:"deck-pulse-dot"}),e.jsx("span",{className:"text-[hsl(var(--deck-accent))]",children:o})]})]})}function Ts(t){const s=[...t].reverse().find(i=>i.role==="user");if(!s)return null;if(typeof s.content=="string")return{content:s.content,attachments:[]};const a=s.content.filter(i=>i.type==="text").map(i=>i.text).join(`
18
+ `),r=s.content.filter(i=>i.type==="image_url").map((i,n)=>{var f;const d=((f=i.image_url.url.match(/^data:([^;,]+)[;,]/))==null?void 0:f[1])??"application/octet-stream";return{id:`recovery-${s.id}-${n}`,name:`attachment-${n+1}`,mimeType:d,dataUrl:i.image_url.url}});return{content:a,attachments:r}}function Ds(){var L;const t=F(),s=y(v=>v.messages),a=y(v=>v.currentSessionRef),r=y(v=>v.isStreaming),i=y(v=>v.isStopping),n=y(v=>v.sessionEventConnectionState),d=y(v=>v.pendingSteeringCount),f=y(v=>v.pendingInputDelivery),l=y(v=>v.recoveredSteeringCount),c=y(v=>v.isLoading),k=y(v=>v.error),o=y(v=>v.errorContext),h=y(v=>v.sessions),u=y(v=>v.sendMessage),j=y(v=>v.abortSession),N=y(v=>v.retryTask),m=y(v=>v.retryingTaskKeys),w=ve(v=>v.openSettings),g=y(v=>v.reconnectSessionEvents),p=y(v=>v.clearError),[x,E]=b.useState(null),S=a?h.find(v=>v.sessionId===a.sessionId&&v.projectPath===a.projectPath):void 0,D=!!k&&((o==null?void 0:o.kind)==="navigation"||!(o!=null&&o.sessionRef)||Fe(o.sessionRef,a)),A=(o==null?void 0:o.failureCode)??((L=S==null?void 0:S.taskFailure)==null?void 0:L.code),V=(o==null?void 0:o.kind)==="execution"&&A?t(Nt(A)):k==="queue_full"?t("chat.error.queueFull"):k==="turn_unavailable"||k==="turn_active"?t("chat.error.turnChanged"):k,_=n==="connecting"||n==="reconnecting",C=r&&n!=="connected",B=a?`session:${Q(a)}`:"session:temporary",H=b.useMemo(()=>Ts(s),[s]),ce=a?Q(a):"temporary-session",z=!!(a&&(S!=null&&S.taskRetryAvailable)&&(!A||St(A)))&&((o==null?void 0:o.kind)==="execution"||(o==null?void 0:o.kind)==="task_action"),G=(o==null?void 0:o.kind)==="execution"&&(A==="authentication"||A==="permission"||A==="model_unavailable"),K=a?m.includes(Q(a)):!1;b.useEffect(()=>{E(null)},[ce]);const Y=async v=>u({content:v.content,modelId:v.modelId,reasoningEffort:v.reasoningEffort,serviceTier:v.serviceTier,responseVerbosity:v.responseVerbosity,communicationStyle:v.communicationStyle,...v.outputSchema?{outputSchema:v.outputSchema}:{},attachments:v.attachments.map(I=>({type:"image",content:I.dataUrl,mimeType:I.mimeType,name:I.name}))}),X=()=>j(),M=async()=>{if(G){p(),w("models");return}if(z&&a){p(),await N(a).catch(()=>{});return}if((o==null?void 0:o.kind)==="execution"&&H){E({...H,revision:Date.now()}),p();return}p(),requestAnimationFrame(()=>Xe())},P=z?t(K?"chat.error.action.retryingTask":"chat.error.action.retryTask"):G?t("chat.error.action.checkModels"):(o==null?void 0:o.kind)==="execution"&&H?t("chat.error.action.editResend"):(o==null?void 0:o.kind)==="submission"?t("chat.error.action.returnDraft"):null;return e.jsxs("div",{className:"flex h-full flex-col bg-[hsl(var(--deck-canvas))]",children:[D&&e.jsxs("div",{role:"alert","data-blade-session-error":!0,className:"flex min-h-11 flex-wrap items-center gap-2 border-b border-red-200/60 bg-red-50/80 px-4 py-2 font-mono text-[11px] text-red-700 dark:border-red-900/50 dark:bg-red-950/30 dark:text-red-300 sm:px-5",children:[e.jsx(Oe,{className:"h-3.5 w-3.5 shrink-0"}),e.jsxs("span",{className:"min-w-0 flex-1 break-words",children:[e.jsx("span",{className:"font-semibold",children:t((o==null?void 0:o.kind)==="submission"?"chat.error.title.submission":(o==null?void 0:o.kind)==="execution"?"chat.error.title.execution":(o==null?void 0:o.kind)==="navigation"?"chat.error.title.navigation":"chat.error.title.generic")})," ",V]}),P&&e.jsxs("button",{type:"button",onClick:()=>void M(),disabled:K,className:"inline-flex min-h-7 shrink-0 items-center gap-1.5 rounded-md border border-red-300/70 bg-white/65 px-2.5 font-medium transition-colors hover:bg-white focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-red-500 disabled:cursor-wait disabled:opacity-60 dark:border-red-800 dark:bg-red-950/45 dark:hover:bg-red-900/60",children:[z?K?e.jsx(R,{className:"h-3 w-3 animate-spin"}):e.jsx(ke,{className:"h-3 w-3"}):e.jsx(Ve,{className:"h-3 w-3"}),P]}),e.jsx("button",{type:"button",onClick:p,"aria-label":t("chat.error.dismiss"),className:"p-1 text-red-500 rounded transition-colors hover:bg-red-100/60 hover:text-red-700 dark:hover:bg-red-950/60 dark:hover:text-red-100",children:"✕"})]}),(_||n==="offline")&&e.jsxs("div",{role:n==="offline"?"alert":"status","aria-live":"polite",className:"flex min-h-10 flex-wrap items-center gap-2 border-b border-amber-300/60 bg-amber-50/80 px-4 py-2 font-mono text-[11px] text-amber-900 dark:border-amber-800/60 dark:bg-amber-950/35 dark:text-amber-200 sm:px-5",children:[_?e.jsx(R,{className:"h-3.5 w-3.5 shrink-0 animate-spin"}):e.jsx(vt,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"min-w-0 flex-1",children:t(_?"chat.connection.reconnecting":"chat.connection.offline")}),n==="offline"&&e.jsxs("button",{type:"button",onClick:()=>void g().catch(()=>{}),className:"inline-flex min-h-7 items-center gap-1.5 rounded-md border border-amber-400/70 bg-white/60 px-2.5 font-medium transition-colors hover:bg-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-500 dark:border-amber-700 dark:bg-amber-950/50 dark:hover:bg-amber-900/50",children:[e.jsx(gt,{className:"h-3 w-3"}),t("chat.connection.retry")]})]}),e.jsx(Mt,{}),e.jsx(vs,{messages:s,isLoading:c},a?Q(a):"temporary-session"),e.jsx(ys,{}),e.jsx(js,{}),e.jsx(Ye,{draftKey:B,draft:x==null?void 0:x.content,draftAttachments:x==null?void 0:x.attachments,draftRevision:x==null?void 0:x.revision,onSend:Y,onAbort:X,disabled:c||C,isStreaming:r,isStopping:i,pendingSteeringCount:d,pendingInputDelivery:f,recoveredSteeringCount:l,workspacePath:a==null?void 0:a.projectPath},B),e.jsx(Es,{})]})}export{Ds as ChatView};
@@ -1,4 +1,4 @@
1
- import{c as I,j as Ke}from"./vendor-react-DG5dkZ_t.js";import{f as Ve,p as Se,a as xe,n as Ae,h as Je,s as Qe,d as Ne}from"./MarkdownRenderer-vxpqGt4L.js";import"./index-Bz4W1-8a.js";import"./vendor-radix-DXRuAJHH.js";import"./vendor-icons-ICv1v-tf.js";import"./session-events-DJh6SZcl.js";function Pe(e,t){if(e==null)return{};var n={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(t.indexOf(a)!==-1)continue;n[a]=e[a]}return n}function et(e,t){if(e==null)return{};var n,a,o=Pe(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function se(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}function tt(e){if(Array.isArray(e))return se(e)}function nt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function at(e,t){if(e){if(typeof e=="string")return se(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?se(e,t):void 0}}function ot(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1
+ import{c as I,j as Ke}from"./vendor-react-DG5dkZ_t.js";import{f as Ve,p as Se,a as xe,n as Ae,h as Je,s as Qe,d as Ne}from"./MarkdownRenderer-D04IKQhF.js";import"./index-CO5sUiJn.js";import"./vendor-radix-DXRuAJHH.js";import"./vendor-icons-ICv1v-tf.js";import"./session-events-BvtUOaNG.js";function Pe(e,t){if(e==null)return{};var n={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(t.indexOf(a)!==-1)continue;n[a]=e[a]}return n}function et(e,t){if(e==null)return{};var n,a,o=Pe(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function se(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}function tt(e){if(Array.isArray(e))return se(e)}function nt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function at(e,t){if(e){if(typeof e=="string")return se(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?se(e,t):void 0}}function ot(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function le(e){return tt(e)||nt(e)||at(e)||ot()}function Z(e){"@babel/helpers - typeof";return Z=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Z(e)}function rt(e,t){if(Z(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var a=n.call(e,t);if(Z(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function it(e){var t=rt(e,"string");return Z(t)=="symbol"?t:t+""}function Te(e,t,n){return(t=it(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ce(){return ce=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},ce.apply(null,arguments)}function Ee(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,a)}return n}function H(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ee(Object(n),!0).forEach(function(a){Te(e,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ee(Object(n)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))})}return e}function st(e){var t=e.length;if(t===0||t===1)return e;if(t===2)return[e[0],e[1],"".concat(e[0],".").concat(e[1]),"".concat(e[1],".").concat(e[0])];if(t===3)return[e[0],e[1],e[2],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0])];if(t>=4)return[e[0],e[1],e[2],e[3],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[2],".").concat(e[3]),"".concat(e[3],".").concat(e[0]),"".concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[0]),"".concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[3],".").concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[2],".").concat(e[1],".").concat(e[0])]}var ie={};function lt(e){if(e.length===0||e.length===1)return e;var t=e.join(".");return ie[t]||(ie[t]=st(e)),ie[t]}function ct(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,a=e.filter(function(r){return r!=="token"}),o=lt(a);return o.reduce(function(r,s){return H(H({},r),n[s])},t)}function Fe(e){return e.join(" ")}function ut(e,t){var n=0;return function(a){return n+=1,a.map(function(o,r){return Ie({node:o,stylesheet:e,useInlineStyles:t,key:"code-segment-".concat(n,"-").concat(r)})})}}function Ie(e){var t=e.node,n=e.stylesheet,a=e.style,o=a===void 0?{}:a,r=e.useInlineStyles,s=e.key,i=t.properties,c=t.type,l=t.tagName,u=t.value;if(c==="text")return u;if(l){var g=ut(n,r),d;if(!r)d=H(H({},i),{},{className:Fe(i.className)});else{var p=Object.keys(n).reduce(function(b,w){return w.split(".").forEach(function(N){b.includes(N)||b.push(N)}),b},[]),f=i.className&&i.className.includes("token")?["token"]:[],v=i.className&&f.concat(i.className.filter(function(b){return!p.includes(b)}));d=H(H({},i),{},{className:Fe(v)||void 0,style:ct(i.className,Object.assign({},i.style,o),n)})}var y=g(t.children);return I.createElement(l,ce({key:s},d),y)}}const dt=function(e,t){var n=e.listLanguages();return n.indexOf(t)!==-1};var gt=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function $e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,a)}return n}function R(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?$e(Object(n),!0).forEach(function(a){Te(e,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$e(Object(n)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))})}return e}var pt=/\n/g;function ft(e){return e.match(pt)}function ht(e){var t=e.lines,n=e.startingLineNumber,a=e.style;return t.map(function(o,r){var s=r+n;return I.createElement("span",{key:"line-".concat(r),className:"react-syntax-highlighter-line-number",style:typeof a=="function"?a(s):a},"".concat(s,`
3
3
  `))})}function bt(e){var t=e.codeString,n=e.codeStyle,a=e.containerStyle,o=a===void 0?{float:"left",paddingRight:"10px"}:a,r=e.numberStyle,s=r===void 0?{}:r,i=e.startingLineNumber;return I.createElement("code",{style:Object.assign({},n,o)},ht({lines:t.replace(/\n$/,"").split(`
4
4
  `),style:s,startingLineNumber:i}))}function mt(e){return"".concat(e.toString().length,".25em")}function Re(e,t){return{type:"element",tagName:"span",properties:{key:"line-number--".concat(e),className:["comment","linenumber","react-syntax-highlighter-line-number"],style:t},children:[{type:"text",value:e}]}}function De(e,t,n){var a={display:"inline-block",minWidth:mt(n),paddingRight:"1em",textAlign:"right",userSelect:"none"},o=typeof e=="function"?e(t):e,r=R(R({},a),o);return r}function J(e){var t=e.children,n=e.lineNumber,a=e.lineNumberStyle,o=e.largestLineNumber,r=e.showInlineLineNumbers,s=e.lineProps,i=s===void 0?{}:s,c=e.className,l=c===void 0?[]:c,u=e.showLineNumbers,g=e.wrapLongLines,d=e.wrapLines,p=d===void 0?!1:d,f=p?R({},typeof i=="function"?i(n):i):{};if(f.className=f.className?[].concat(le(f.className.trim().split(/\s+/)),le(l)):l,n&&r){var v=De(a,n,o);t.unshift(Re(n,v))}return g&u&&(f.style=R({display:"flex"},f.style)),{type:"element",tagName:"span",properties:f,children:t}}function ze(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];e.length===void 0&&(e=[e]);for(var a=0;a<e.length;a++){var o=e[a];if(o.type==="text")n.push(J({children:[o],className:le(new Set(t))}));else if(o.children){var r,s=t.concat(((r=o.properties)===null||r===void 0?void 0:r.className)||[]);ze(o.children,s).forEach(function(i){return n.push(i)})}}return n}function yt(e,t,n,a,o,r,s,i,c){var l,u=ze(e.value),g=[],d=-1,p=0;function f(S,k){var x=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return J({children:S,lineNumber:k,lineNumberStyle:i,largestLineNumber:s,showInlineLineNumbers:o,lineProps:n,className:x,showLineNumbers:a,wrapLongLines:c,wrapLines:t})}function v(S,k){if(a&&k&&o){var x=De(i,k,s);S.unshift(Re(k,x))}return S}function y(S,k){var x=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return t||x.length>0?f(S,k,x):v(S,k)}for(var b=function(){var k=u[p],x=k.children[0].value,E=ft(x);if(E){var j=x.split(`
@@ -1,5 +1,5 @@
1
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 T,u as P,b as et,a as B,s as V,I as Te,k as Xt,J as Yt,w as Zt,_ as er}from"./index-Bz4W1-8a.js";import{r as o,j as t}from"./vendor-react-DG5dkZ_t.js";import{k as Pe,a4 as tr,am as rr,y as bt,m as vt,s as kt,L as gt,d as nr,ak as sr,R as ar,X as or}from"./vendor-icons-ICv1v-tf.js";import"./vendor-radix-DXRuAJHH.js";import"./session-events-DJh6SZcl.js";const yt=o.createContext(null);function wt(e){const r=o.useContext(yt);if(!r)throw new Error(`${e} must be used within <Tabs>`);return r}function ir({value:e,onValueChange:r,className:s,children:a}){const c=o.useMemo(()=>({value:e,setValue:r}),[e,r]);return t.jsx(yt.Provider,{value:c,children:t.jsx("div",{className:s,children:a})})}function cr({className:e,children:r}){return t.jsx("div",{role:"tablist",className:T("inline-flex items-center",e),children:r})}function Fe({value:e,className:r,children:s}){const{value:a,setValue:c}=wt("TabsTrigger"),i=a===e;return t.jsx("button",{type:"button",role:"tab","aria-selected":i,"data-state":i?"active":"inactive",onClick:()=>c(e),className:T("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))]",r),children:s})}function Le({value:e,className:r,children:s}){const{value:a}=wt("TabsContent");return a!==e?null:t.jsx("div",{role:"tabpanel",className:r,children:s})}const lr={"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 dr(e){const r=e.replace("#",""),s=parseInt(r.substring(0,2),16),a=parseInt(r.substring(2,4),16),c=parseInt(r.substring(4,6),16);return(.299*s+.587*a+.114*c)/255<.5}function ur(e){return{base:dr(e.background.primary)?"vs-dark":"vs",inherit:!0,rules:[{token:"",foreground:e.text.primary.replace("#",""),background:e.background.primary.replace("#","")},{token:"comment",foreground:e.syntax.comment.replace("#",""),fontStyle:"italic"},{token:"string",foreground:e.syntax.string.replace("#","")},{token:"number",foreground:e.syntax.number.replace("#","")},{token:"keyword",foreground:e.syntax.keyword.replace("#","")},{token:"type",foreground:e.syntax.type.replace("#","")},{token:"identifier",foreground:e.syntax.variable.replace("#","")},{token:"function",foreground:e.syntax.function.replace("#","")},{token:"variable",foreground:e.syntax.variable.replace("#","")},{token:"operator",foreground:e.syntax.operator.replace("#","")},{token:"delimiter",foreground:e.syntax.operator.replace("#","")},{token:"tag",foreground:e.syntax.tag.replace("#","")},{token:"attribute.name",foreground:e.syntax.attr.replace("#","")},{token:"attribute.value",foreground:e.syntax.string.replace("#","")}],colors:{"editor.background":e.background.primary,"editor.foreground":e.text.primary,"editor.lineHighlightBackground":e.background.secondary,"editor.selectionBackground":`${e.syntax.function}40`,"editorLineNumber.foreground":e.text.muted,"editorLineNumber.activeForeground":e.text.secondary,"editorCursor.foreground":e.text.primary,"editorIndentGuide.background":e.border.light,"editorWidget.background":e.background.secondary,"editorWidget.border":e.border.light,"scrollbarSlider.background":`${e.text.muted}40`,"scrollbarSlider.hoverBackground":`${e.text.muted}60`}}}const tt=new Set;function rt(e,r){const s=r.toLowerCase().replace(/\s+/g,"-"),a=lr[s];if(!a)return"vs-dark";if(!tt.has(s)){const c=ur(a);e.editor.defineTheme(s,c),tt.add(s)}return s}function oe(e){return e.normalize("NFKC").toLocaleLowerCase().trim()}function fr(e,r,s){const a=oe(r).split(/\s+/).filter(Boolean);return e.filter(c=>{if(s!=="all"&&c.status!==s)return!1;if(a.length===0)return!0;const i=oe([c.title,c.subtitle,c.content].filter(Boolean).join(" "));return a.every(g=>i.includes(g))})}function jt(e){return e.replace(/\/+$/,"").split("/").filter(Boolean).at(-1)||e}function hr(e,r){const s=oe(r).split(/\s+/).filter(Boolean);return s.length===0?e:e.filter(a=>{const c=oe([a.filePath,a.summary].filter(Boolean).join(" "));return s.every(i=>c.includes(i))})}function pr(e,r,s){return r===0?0:(e+s+r)%r}const nt=20,st=20,at=160,ot=240;function it(e,r){const s=i=>i.replace(/\\/g,"/").replace(/^\.?\//,"").replace(/\/+/g,"/"),a=s(e),c=s(r);return a===c||a.endsWith(`/${c}`)||c.endsWith(`/${a}`)}function mr({diffs:e,expanded:r,targetPath:s,onToggle:a,onSetAllExpanded:c}){var d,N;const i=P(),[g,u]=o.useState(""),b=`${g}\0${e.length}\0${((d=e[0])==null?void 0:d.filePath)??""}\0${((N=e.at(-1))==null?void 0:N.filePath)??""}`,[f,h]=o.useState({key:b,count:nt}),x=f.key===b?f.count:nt,m=o.useMemo(()=>hr(e,g),[e,g]),k=o.useMemo(()=>{const p=m.slice(0,x);if(!s)return p;const j=m.find(S=>S.filePath&&it(S.filePath,s));return j&&!p.includes(j)?[...p,j]:p},[m,s,x]);return t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"sticky top-0 z-10 space-y-2 bg-[hsl(var(--deck-canvas))] pb-1",children:[t.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:[t.jsx(Pe,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink-faint))]"}),t.jsx("input",{type:"search","aria-label":i("preview.diff.searchAria"),placeholder:i("preview.diff.searchPlaceholder"),value:g,onChange:p=>u(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))]"}),t.jsxs("span",{className:"font-mono text-[9px] tabular-nums text-[hsl(var(--deck-ink-faint))]",children:[m.length,"/",e.length]})]}),t.jsxs("div",{className:"flex items-center justify-between font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:[t.jsx("span",{children:i("preview.diff.changedFiles",{count:e.length})}),t.jsxs("span",{className:"flex items-center gap-1",children:[t.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:[t.jsx(tr,{className:"h-3 w-3"}),i("preview.diff.expandAll")]}),t.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:[t.jsx(rr,{className:"h-3 w-3"}),i("preview.diff.collapseAll")]})]})]})]}),m.length===0?t.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")}):k.map(p=>{const j=p.filePath||"unknown",S=e.indexOf(p),E=r[j]??S===0,A=!!(s&&it(j,s));return t.jsxs("div",{"data-preview-diff-path":p.filePath,className:T("overflow-hidden rounded-lg border border-[hsl(var(--deck-border))] transition-colors",A&&"border-[hsl(var(--deck-accent)/0.7)] bg-[hsl(var(--deck-accent-soft))] ring-1 ring-[hsl(var(--deck-accent)/0.2)]"),children:[t.jsxs("button",{type:"button","aria-expanded":E,onClick:()=>a(j),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:[E?t.jsx(bt,{className:"h-4 w-4 text-[hsl(var(--deck-ink-muted))]"}):t.jsx(vt,{className:"h-4 w-4 text-[hsl(var(--deck-ink-muted))]"}),t.jsx(kt,{className:"h-4 w-4 text-[hsl(var(--deck-ink-muted))]"}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-left font-mono text-[13px] text-[hsl(var(--deck-ink))]",children:jt(j)}),p.summary&&t.jsx("span",{className:"shrink-0 font-mono text-[11px] text-[hsl(var(--deck-ink-muted))]",children:p.summary})]}),E&&t.jsxs("div",{className:"border-t border-[hsl(var(--deck-border))]",children:[t.jsx("div",{className:"truncate px-3 py-1 font-mono text-[11px] text-[hsl(var(--deck-ink-faint))]",children:p.filePath}),t.jsx(xr,{diff:p.diff})]})]},j)}),x<m.length&&t.jsx("div",{className:"flex justify-center pt-1",children:t.jsx("button",{type:"button",onClick:()=>h({key:b,count:Math.min(m.length,x+st)}),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(st,m.length-x)})})})]})}function xr({diff:e}){const r=P(),s=o.useMemo(()=>e.patch.split(`
2
+ import{j as T,u as P,b as et,a as B,s as V,I as Te,k as Xt,J as Yt,w as Zt,_ as er}from"./index-CO5sUiJn.js";import{r as o,j as t}from"./vendor-react-DG5dkZ_t.js";import{k as Pe,a4 as tr,am as rr,y as bt,m as vt,s as kt,L as gt,d as nr,ak as sr,R as ar,X as or}from"./vendor-icons-ICv1v-tf.js";import"./vendor-radix-DXRuAJHH.js";import"./session-events-BvtUOaNG.js";const yt=o.createContext(null);function wt(e){const r=o.useContext(yt);if(!r)throw new Error(`${e} must be used within <Tabs>`);return r}function ir({value:e,onValueChange:r,className:s,children:a}){const c=o.useMemo(()=>({value:e,setValue:r}),[e,r]);return t.jsx(yt.Provider,{value:c,children:t.jsx("div",{className:s,children:a})})}function cr({className:e,children:r}){return t.jsx("div",{role:"tablist",className:T("inline-flex items-center",e),children:r})}function Fe({value:e,className:r,children:s}){const{value:a,setValue:c}=wt("TabsTrigger"),i=a===e;return t.jsx("button",{type:"button",role:"tab","aria-selected":i,"data-state":i?"active":"inactive",onClick:()=>c(e),className:T("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))]",r),children:s})}function Le({value:e,className:r,children:s}){const{value:a}=wt("TabsContent");return a!==e?null:t.jsx("div",{role:"tabpanel",className:r,children:s})}const lr={"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 dr(e){const r=e.replace("#",""),s=parseInt(r.substring(0,2),16),a=parseInt(r.substring(2,4),16),c=parseInt(r.substring(4,6),16);return(.299*s+.587*a+.114*c)/255<.5}function ur(e){return{base:dr(e.background.primary)?"vs-dark":"vs",inherit:!0,rules:[{token:"",foreground:e.text.primary.replace("#",""),background:e.background.primary.replace("#","")},{token:"comment",foreground:e.syntax.comment.replace("#",""),fontStyle:"italic"},{token:"string",foreground:e.syntax.string.replace("#","")},{token:"number",foreground:e.syntax.number.replace("#","")},{token:"keyword",foreground:e.syntax.keyword.replace("#","")},{token:"type",foreground:e.syntax.type.replace("#","")},{token:"identifier",foreground:e.syntax.variable.replace("#","")},{token:"function",foreground:e.syntax.function.replace("#","")},{token:"variable",foreground:e.syntax.variable.replace("#","")},{token:"operator",foreground:e.syntax.operator.replace("#","")},{token:"delimiter",foreground:e.syntax.operator.replace("#","")},{token:"tag",foreground:e.syntax.tag.replace("#","")},{token:"attribute.name",foreground:e.syntax.attr.replace("#","")},{token:"attribute.value",foreground:e.syntax.string.replace("#","")}],colors:{"editor.background":e.background.primary,"editor.foreground":e.text.primary,"editor.lineHighlightBackground":e.background.secondary,"editor.selectionBackground":`${e.syntax.function}40`,"editorLineNumber.foreground":e.text.muted,"editorLineNumber.activeForeground":e.text.secondary,"editorCursor.foreground":e.text.primary,"editorIndentGuide.background":e.border.light,"editorWidget.background":e.background.secondary,"editorWidget.border":e.border.light,"scrollbarSlider.background":`${e.text.muted}40`,"scrollbarSlider.hoverBackground":`${e.text.muted}60`}}}const tt=new Set;function rt(e,r){const s=r.toLowerCase().replace(/\s+/g,"-"),a=lr[s];if(!a)return"vs-dark";if(!tt.has(s)){const c=ur(a);e.editor.defineTheme(s,c),tt.add(s)}return s}function oe(e){return e.normalize("NFKC").toLocaleLowerCase().trim()}function fr(e,r,s){const a=oe(r).split(/\s+/).filter(Boolean);return e.filter(c=>{if(s!=="all"&&c.status!==s)return!1;if(a.length===0)return!0;const i=oe([c.title,c.subtitle,c.content].filter(Boolean).join(" "));return a.every(g=>i.includes(g))})}function jt(e){return e.replace(/\/+$/,"").split("/").filter(Boolean).at(-1)||e}function hr(e,r){const s=oe(r).split(/\s+/).filter(Boolean);return s.length===0?e:e.filter(a=>{const c=oe([a.filePath,a.summary].filter(Boolean).join(" "));return s.every(i=>c.includes(i))})}function pr(e,r,s){return r===0?0:(e+s+r)%r}const nt=20,st=20,at=160,ot=240;function it(e,r){const s=i=>i.replace(/\\/g,"/").replace(/^\.?\//,"").replace(/\/+/g,"/"),a=s(e),c=s(r);return a===c||a.endsWith(`/${c}`)||c.endsWith(`/${a}`)}function mr({diffs:e,expanded:r,targetPath:s,onToggle:a,onSetAllExpanded:c}){var d,N;const i=P(),[g,u]=o.useState(""),b=`${g}\0${e.length}\0${((d=e[0])==null?void 0:d.filePath)??""}\0${((N=e.at(-1))==null?void 0:N.filePath)??""}`,[f,h]=o.useState({key:b,count:nt}),x=f.key===b?f.count:nt,m=o.useMemo(()=>hr(e,g),[e,g]),k=o.useMemo(()=>{const p=m.slice(0,x);if(!s)return p;const j=m.find(S=>S.filePath&&it(S.filePath,s));return j&&!p.includes(j)?[...p,j]:p},[m,s,x]);return t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"sticky top-0 z-10 space-y-2 bg-[hsl(var(--deck-canvas))] pb-1",children:[t.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:[t.jsx(Pe,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink-faint))]"}),t.jsx("input",{type:"search","aria-label":i("preview.diff.searchAria"),placeholder:i("preview.diff.searchPlaceholder"),value:g,onChange:p=>u(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))]"}),t.jsxs("span",{className:"font-mono text-[9px] tabular-nums text-[hsl(var(--deck-ink-faint))]",children:[m.length,"/",e.length]})]}),t.jsxs("div",{className:"flex items-center justify-between font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:[t.jsx("span",{children:i("preview.diff.changedFiles",{count:e.length})}),t.jsxs("span",{className:"flex items-center gap-1",children:[t.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:[t.jsx(tr,{className:"h-3 w-3"}),i("preview.diff.expandAll")]}),t.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:[t.jsx(rr,{className:"h-3 w-3"}),i("preview.diff.collapseAll")]})]})]})]}),m.length===0?t.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")}):k.map(p=>{const j=p.filePath||"unknown",S=e.indexOf(p),E=r[j]??S===0,A=!!(s&&it(j,s));return t.jsxs("div",{"data-preview-diff-path":p.filePath,className:T("overflow-hidden rounded-lg border border-[hsl(var(--deck-border))] transition-colors",A&&"border-[hsl(var(--deck-accent)/0.7)] bg-[hsl(var(--deck-accent-soft))] ring-1 ring-[hsl(var(--deck-accent)/0.2)]"),children:[t.jsxs("button",{type:"button","aria-expanded":E,onClick:()=>a(j),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:[E?t.jsx(bt,{className:"h-4 w-4 text-[hsl(var(--deck-ink-muted))]"}):t.jsx(vt,{className:"h-4 w-4 text-[hsl(var(--deck-ink-muted))]"}),t.jsx(kt,{className:"h-4 w-4 text-[hsl(var(--deck-ink-muted))]"}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-left font-mono text-[13px] text-[hsl(var(--deck-ink))]",children:jt(j)}),p.summary&&t.jsx("span",{className:"shrink-0 font-mono text-[11px] text-[hsl(var(--deck-ink-muted))]",children:p.summary})]}),E&&t.jsxs("div",{className:"border-t border-[hsl(var(--deck-border))]",children:[t.jsx("div",{className:"truncate px-3 py-1 font-mono text-[11px] text-[hsl(var(--deck-ink-faint))]",children:p.filePath}),t.jsx(xr,{diff:p.diff})]})]},j)}),x<m.length&&t.jsx("div",{className:"flex justify-center pt-1",children:t.jsx("button",{type:"button",onClick:()=>h({key:b,count:Math.min(m.length,x+st)}),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(st,m.length-x)})})})]})}function xr({diff:e}){const r=P(),s=o.useMemo(()=>e.patch.split(`
3
3
  `),[e.patch]),[a,c]=o.useState({patch:e.patch,count:at}),i=a.patch===e.patch?a.count:at,g=s.slice(0,i);let u=0,b=0;return t.jsxs("div",{className:"overflow-hidden rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]",children:[t.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:[t.jsx("span",{children:r("preview.diff.patch")}),e.matchLine&&t.jsx("span",{children:r("preview.diff.line",{line:e.matchLine})})]}),t.jsx("div",{className:"overflow-x-auto font-mono text-[12px]",children:g.map((f,h)=>{if(f.startsWith("@@")){const x=/@@ -(?<old>\d+),?(?<oldCount>\d*) \+(?<new>\d+),?(?<newCount>\d*) @@/.exec(f);return x!=null&&x.groups&&(u=Number.parseInt(x.groups.old,10),b=Number.parseInt(x.groups.new,10)),t.jsx(z,{line:f},`${f}-${h}`)}if(f.startsWith("---")||f.startsWith("+++")||f.startsWith("Index:")||f.startsWith("==="))return t.jsx(z,{line:f},`${f}-${h}`);if(f.startsWith("+")){const x=b++;return t.jsx(z,{line:f,oldLine:null,newLine:x},`${f}-${h}`)}if(f.startsWith("-")){const x=u++;return t.jsx(z,{line:f,oldLine:x,newLine:null},`${f}-${h}`)}return f.startsWith(" ")?t.jsx(z,{line:f,oldLine:u++,newLine:b++},`${f}-${h}`):t.jsx(z,{line:f},`${f}-${h}`)})}),i<s.length&&t.jsx("div",{className:"flex justify-center border-t border-[hsl(var(--deck-border))] p-2",children:t.jsx("button",{type:"button",onClick:()=>c({patch:e.patch,count:Math.min(s.length,i+ot)}),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:r("preview.diff.showMoreLines",{count:Math.min(ot,s.length-i)})})})]})}function z({line:e,oldLine:r,newLine:s}){const a=e.startsWith("---")||e.startsWith("+++")||e.startsWith("Index:")||e.startsWith("==="),c=e.startsWith("@@"),i=e[0],g=a||c?e:e.slice(1),u=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 t.jsxs("div",{"data-preview-diff-line":!0,className:T("grid min-w-max grid-cols-[40px_40px_1fr] gap-2 px-3 py-0.5",u),children:[t.jsx("span",{className:"text-right text-[hsl(var(--deck-ink-faint))]",children:r?String(r).padStart(2," "):""}),t.jsx("span",{className:"text-right text-[hsl(var(--deck-ink-faint))]",children:s?String(s).padStart(2," "):""}),t.jsx("span",{className:"whitespace-pre",children:g})]})}function br({nodes:e,expandedDirs:r,childrenCache:s,directoryStates:a,selectedPath:c,onToggleDir:i,onRetryDir:g,onSelectFile:u}){return t.jsx(t.Fragment,{children:e.map(b=>t.jsx(Nt,{node:b,depth:0,expandedDirs:r,childrenCache:s,directoryStates:a,selectedPath:c,onToggleDir:i,onRetryDir:g,onSelectFile:u},b.path))})}function Nt({node:e,depth:r,expandedDirs:s,childrenCache:a,directoryStates:c,selectedPath:i,onToggleDir:g,onRetryDir:u,onSelectFile:b}){const f=P(),h=e.type==="dir",x=!!s[e.path],m=!h&&i===e.path,k=a[e.path]??[],d=c[e.path],N=r*14+24;return t.jsxs("div",{children:[t.jsxs("button",{type:"button","aria-expanded":h?x:void 0,"aria-busy":h&&(d==null?void 0:d.status)==="loading",onClick:()=>h?g(e.path):b(e.path),className:T("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))]",h&&"cursor-pointer"),style:{paddingLeft:r*14+8},children:[h?(d==null?void 0:d.status)==="loading"?t.jsx(gt,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-[hsl(var(--deck-accent))]"}):x?t.jsx(nr,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink))]"}):t.jsx(sr,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink-muted))]"}):t.jsx(kt,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink-faint))]"}),t.jsx("span",{className:"truncate text-[hsl(var(--deck-ink))]",children:e.name})]}),h&&x&&t.jsxs("div",{children:[(d==null?void 0:d.status)==="loading"&&t.jsx("div",{role:"status",style:{paddingLeft:N},className:"py-1 font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:f("preview.files.directoryLoading")}),(d==null?void 0:d.status)==="error"&&t.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:[t.jsx("div",{className:"truncate",title:d.message,children:d.message}),t.jsxs("button",{type:"button",onClick:()=>u(e.path),className:"mt-1 inline-flex items-center gap-1 font-medium underline-offset-2 hover:underline",children:[t.jsx(ar,{className:"h-2.5 w-2.5"}),f("preview.action.retry")]})]}),(d==null?void 0:d.status)==="loaded"&&k.length===0&&t.jsx("div",{style:{paddingLeft:N},className:"py-1 font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:f("preview.files.directoryEmpty")}),k.map(p=>t.jsx(Nt,{node:p,depth:r+1,expandedDirs:s,childrenCache:a,directoryStates:c,selectedPath:i,onToggleDir:g,onRetryDir:u,onSelectFile:b},p.path))]})]})}const ct=80,lt=80;function vr({logs:e}){var d,N;const r=P(),[s,a]=o.useState(""),[c,i]=o.useState("all"),[g,u]=o.useState({}),b=`${c}\0${s}\0${e.length}\0${((d=e[0])==null?void 0:d.id)??""}\0${((N=e.at(-1))==null?void 0:N.id)??""}`,[f,h]=o.useState({key:b,count:ct}),x=o.useMemo(()=>fr(e,s,c),[c,e,s]),m=f.key===b?f.count:ct,k=x.slice(0,m);return t.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[t.jsxs("div",{className:"space-y-2 border-b border-[hsl(var(--deck-border))] px-4 py-3",children:[t.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:[t.jsx(Pe,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink-faint))]"}),t.jsx("input",{type:"search","aria-label":r("preview.logs.searchAria"),placeholder:r("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))]"}),t.jsxs("span",{className:"font-mono text-[9px] tabular-nums text-[hsl(var(--deck-ink-faint))]",children:[x.length,"/",e.length]})]}),t.jsx("div",{className:"flex items-center gap-1","aria-label":r("preview.logs.filterAria"),children:["all","running","error","success"].map(p=>t.jsx("button",{type:"button","aria-pressed":c===p,onClick:()=>i(p),className:T("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:r(`preview.logs.filter.${p}`)},p))})]}),t.jsxs("div",{className:"min-h-0 flex-1 space-y-3 overflow-y-auto px-4 py-4",children:[e.length===0?t.jsx(dt,{title:r("preview.logs.emptyTitle"),subtitle:r("preview.logs.emptyHint")}):x.length===0?t.jsx(dt,{title:r("preview.logs.noMatches"),subtitle:r("preview.logs.noMatchesHint")}):k.map(p=>{var W;const j=g[p.id],S=(p.content||"").split(`
4
4
  `),E=S.length>10||(((W=p.content)==null?void 0:W.length)||0)>800,A=j||!E?S:S.slice(0,8);return t.jsxs("div",{"data-preview-log-id":p.id,className:"overflow-hidden rounded-lg border border-[hsl(var(--deck-border))]",children:[t.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:[t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("div",{className:"font-mono text-[12px] text-[hsl(var(--deck-ink))]",children:p.title}),p.subtitle&&t.jsx("div",{className:"font-mono text-[11px] text-[hsl(var(--deck-ink-muted))]",children:p.subtitle})]}),t.jsx(kr,{status:p.status})]}),p.content&&t.jsxs("div",{className:"space-y-2 px-3 py-3",children:[t.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:[A.join(`
5
5
  `),!j&&E&&`