agent-tower 0.2.6 → 0.2.7

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 (32) hide show
  1. package/dist/executors/codex.executor.d.ts +2 -6
  2. package/dist/executors/codex.executor.d.ts.map +1 -1
  3. package/dist/executors/codex.executor.js +3 -11
  4. package/dist/executors/codex.executor.js.map +1 -1
  5. package/dist/executors/default-providers.json +1 -2
  6. package/dist/web/assets/{AgentDemoPage-DSyU6XMx.js → AgentDemoPage-YmanLcCN.js} +1 -1
  7. package/dist/web/assets/{DemoPage-BxYQv1Wa.js → DemoPage-BqY38vpM.js} +1 -1
  8. package/dist/web/assets/{NotificationSettingsPage-mln4lAxn.js → NotificationSettingsPage-BCHTrcGM.js} +1 -1
  9. package/dist/web/assets/{ProfileSettingsPage-CS-WK307.js → ProfileSettingsPage-BUjwXVis.js} +1 -1
  10. package/dist/web/assets/{ProjectKanbanPage-Bz0Q0ZZy.js → ProjectKanbanPage-BnV1bfmb.js} +3 -3
  11. package/dist/web/assets/{ProjectSettingsPage-CBnahNua.js → ProjectSettingsPage-n3WgEYp1.js} +1 -1
  12. package/dist/web/assets/ProviderSettingsPage-BNb3ixUl.js +54 -0
  13. package/dist/web/assets/{api-client-iFY2ykuZ.js → api-client-CvkWGC57.js} +1 -1
  14. package/dist/web/assets/{chevron-down-CxTrrnvp.js → chevron-down-gMypHmvg.js} +1 -1
  15. package/dist/web/assets/{circle-alert-CHDHEO67.js → circle-alert-R4XXB7n4.js} +1 -1
  16. package/dist/web/assets/{circle-check-uswR_cEa.js → circle-check-gk9yWlOW.js} +1 -1
  17. package/dist/web/assets/{code-block-OCS4YCEC-VVSDpKw-.js → code-block-OCS4YCEC-37w58MP9.js} +1 -1
  18. package/dist/web/assets/{folder-picker-DshGpYNS.js → folder-picker-BNSXB4UX.js} +1 -1
  19. package/dist/web/assets/{index-hdGFeHu1.js → index-DFLmhfiK.js} +2 -2
  20. package/dist/web/assets/{loader-circle-BYF33K7x.js → loader-circle-DkuE984n.js} +1 -1
  21. package/dist/web/assets/{mermaid-NOHMQCX5-CQLrOBEw.js → mermaid-NOHMQCX5-BCuuUgP6.js} +3 -3
  22. package/dist/web/assets/{modal-BCL0660p.js → modal-Cs0LO1_I.js} +1 -1
  23. package/dist/web/assets/{pencil-SJi1qbh9.js → pencil-DBXkFcMj.js} +1 -1
  24. package/dist/web/assets/{query-keys-B2VhRmAm.js → query-keys-Ddm69Sh0.js} +1 -1
  25. package/dist/web/assets/{select-WuDnj3zN.js → select-CXYXolOw.js} +1 -1
  26. package/dist/web/assets/{use-profiles-DYTDOkn8.js → use-profiles-C--W_RiQ.js} +1 -1
  27. package/dist/web/assets/{use-projects-BLI6qXx-.js → use-projects-Cnz3uQZV.js} +1 -1
  28. package/dist/web/assets/{use-providers-C1i5uxRH.js → use-providers-BkyYy5Sg.js} +1 -1
  29. package/dist/web/assets/{x-Bn5zgMLL.js → x-Yu7IY3ea.js} +1 -1
  30. package/dist/web/index.html +1 -1
  31. package/package.json +1 -1
  32. package/dist/web/assets/ProviderSettingsPage-D-Lrg1Sj.js +0 -54
@@ -13,12 +13,8 @@ export interface CodexConfig {
13
13
  appendPrompt?: string;
14
14
  /** 模型选择 (gpt-5.3-codex, gpt-5.3-codex-spark, gpt-5.1-codex-max) */
15
15
  model?: string;
16
- /** 沙箱模式 (read-only, workspace-write, danger-full-access) */
17
- sandbox?: string;
18
- /** 审批策略 (untrusted, on-request, never, reject) */
19
- approvalPolicy?: string;
20
- /** 兼容旧配置:全自动模式,相当于 on-request + workspace-write */
21
- fullAuto?: boolean;
16
+ /** 跳过所有确认提示并在无沙箱环境下执行命令(危险,仅用于外部已隔离的环境) */
17
+ dangerouslyBypassApprovalsAndSandbox?: boolean;
22
18
  /** 启用实时网络搜索 */
23
19
  liveSearch?: boolean;
24
20
  /** 配置 profile 名称,对应 ~/.codex/config.toml 中的 [profiles.xxx] */
@@ -1 +1 @@
1
- {"version":3,"file":"codex.executor.d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AAM,GAAG,IAAI;IAIxC;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAmB5B;;OAEG;IACH,SAAS,CAAC,mBAAmB,IAAI,cAAc;IA4B/C;;OAEG;IACG,KAAK,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,YAAY,CAAC;IAyB/D;;OAEG;IACG,aAAa,CACjB,MAAM,EAAE,mBAAmB,EAC3B,SAAS,EAAE,MAAM,EACjB,gBAAgB,CAAC,EAAE,MAAM,GACxB,OAAO,CAAC,YAAY,CAAC;IAgCxB;;OAEG;IACH,OAAO,CAAC,aAAa;CAMtB"}
@@ -148,17 +148,9 @@ export class CodexExecutor extends BaseExecutor {
148
148
  if (this.config.model) {
149
149
  builder.extendParams(['--model', this.config.model]);
150
150
  }
151
- // 沙箱模式
152
- if (this.config.sandbox) {
153
- builder.extendParams(['--sandbox', this.config.sandbox]);
154
- }
155
- // 审批策略
156
- if (this.config.approvalPolicy) {
157
- builder.extendParams(['--ask-for-approval', this.config.approvalPolicy]);
158
- }
159
- // 全自动模式
160
- if (this.config.fullAuto) {
161
- builder.extendParams(['--full-auto']);
151
+ // 跳过所有确认提示并在无沙箱环境下执行命令(危险模式,类似 Claude Code 的 --dangerously-skip-permissions)
152
+ if (this.config.dangerouslyBypassApprovalsAndSandbox) {
153
+ builder.extendParams(['--dangerously-bypass-approvals-and-sandbox']);
162
154
  }
163
155
  // 实时搜索
164
156
  if (this.config.liveSearch) {
@@ -1 +1 @@
1
- {"version":3,"file":"codex.executor.js","sourceRoot":"","sources":["../../src/executors/codex.executor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAA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AAC,CAAC;IACrD,CAAC;IAED;;OAEG;IACK,aAAa,CAAC,MAAc;QAClC,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;YAC7B,OAAO,GAAG,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;QAChD,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
@@ -40,8 +40,7 @@
40
40
  "agentType": "CODEX",
41
41
  "env": {},
42
42
  "config": {
43
- "sandbox": "workspace-write",
44
- "approvalPolicy": "on-request"
43
+ "dangerouslyBypassApprovalsAndSandbox": true
45
44
  },
46
45
  "isDefault": true,
47
46
  "builtIn": true
@@ -1 +1 @@
1
- import{c as b,r as s,j as e,L as W}from"./index-hdGFeHu1.js";import{a as f,B as y}from"./api-client-iFY2ykuZ.js";import{u as Q,a as X,b as L,c as Y,d as Z,S as ee,e as te,T as se,P as ne,G as re,f as ae}from"./mermaid-NOHMQCX5-CQLrOBEw.js";import{d as le}from"./use-profiles-DYTDOkn8.js";import{C as ie}from"./chevron-down-CxTrrnvp.js";import"./log-adapter-50wgehrc.js";import"./query-keys-B2VhRmAm.js";const oe=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],ce=b("at-sign",oe);const de=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],xe=b("chevron-up",de);const me=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],ue=b("hash",me);const pe=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],he=b("send",pe),ge=!0;function Se(){const[w,_]=s.useState([]),[l,S]=s.useState(""),[d,k]=s.useState("DEFAULT"),[i,A]=s.useState(""),[r,D]=s.useState(null),[a,o]=s.useState("idle"),[h,E]=s.useState(!1),[x,j]=s.useState(""),$=s.useRef(null),C=s.useRef(null),m=s.useRef(null),{data:u}=le(l),H=u?Object.keys(u):["DEFAULT"],U=t=>{S(t),k("DEFAULT")},F=s.useCallback(t=>{o(t===0?"stopped":"error")},[]),M=s.useCallback(t=>{console.error("Agent error:",t),o("error")},[]),{isConnected:p,isAttached:g,logs:v,entries:V,agentSessionId:I,attach:z,clearLogs:P}=Q({sessionId:r||"",onExit:F,onError:M}),{todos:R}=X(V);s.useEffect(()=>{f.get("/demo/agents").then(t=>{_(t.agents);const n=t.agents.find(N=>N.available);n&&S(n.type)})},[]),s.useEffect(()=>{$.current?.scrollToBottom("smooth")},[v]),s.useEffect(()=>{console.log(`[AgentDemoPage:useEffect] t=${Date.now()} sessionId=${r} isConnected=${p} isAttached=${g}`),r&&p&&!g&&(console.log(`[AgentDemoPage:useEffect] t=${Date.now()} calling attach()`),z())},[r,p,g,z]);const B=t=>{if(j(t.target.value),m.current){m.current.style.height="auto";const N=Math.min(m.current.scrollHeight,210);m.current.style.height=`${N}px`}},G=async()=>{if(!l||!i.trim())return;const t=Date.now();console.log(`[AgentDemoPage:handleStart] t=${t} starting...`),o("starting"),P();try{const n=await f.post("/demo/start",{agentType:l,prompt:i.trim(),variant:d});ge&&console.log(`[AgentDemoPage:handleStart] t=${Date.now()} apiTime=${Date.now()-t}ms sessionId=${n.sessionId}`),D(n.sessionId),o("running")}catch(n){console.error("Start failed:",n),o("error")}},T=async()=>{if(!r||!x.trim())return;const t=x.trim();j("");try{await f.post(`/demo/${r}/message`,{message:t})}catch(n){console.error("Send failed:",n)}},O=async()=>{if(r)try{await f.post(`/demo/${r}/stop`),o("stopped")}catch(t){console.error("Stop failed:",t)}},K=()=>{D(null),o("idle"),A(""),j(""),P()},q=a==="running",c=r!==null,J=w.find(t=>t.type===l);return e.jsxs("div",{className:"flex flex-col h-full bg-white",children:[e.jsxs("div",{className:"px-8 py-5 border-b border-neutral-100 bg-white transition-all duration-300",children:[e.jsxs("div",{className:"flex items-center flex-wrap gap-3",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("span",{className:"text-base font-medium text-blue-600",children:"Agent Demo"}),e.jsx("span",{className:"text-neutral-300 text-sm",children:"/"}),e.jsx("span",{className:"text-xl font-bold text-neutral-900 tracking-tight",children:c?i.slice(0,50)+(i.length>50?"...":""):"新会话"})]}),e.jsxs("div",{className:"flex items-center",children:[a==="running"&&e.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-0.5 bg-blue-50 text-blue-700 rounded-full text-xs font-medium border border-blue-100",children:[e.jsx(L,{className:"w-3.5 h-3.5 animate-pulse"}),e.jsx("span",{children:"Running"})]}),a==="stopped"&&e.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-0.5 bg-emerald-50 text-emerald-700 rounded-full text-xs font-medium border border-emerald-100",children:[e.jsx(Y,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Done"})]}),a==="idle"&&e.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-0.5 bg-neutral-100 text-neutral-600 rounded-full text-xs font-medium border border-neutral-200",children:[e.jsx(Z,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Idle"})]}),a==="starting"&&e.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-0.5 bg-amber-50 text-amber-700 rounded-full text-xs font-medium border border-amber-100",children:[e.jsx(L,{className:"w-3.5 h-3.5 animate-spin"}),e.jsx("span",{children:"Starting..."})]}),a==="error"&&e.jsx("div",{className:"flex items-center gap-1.5 px-2.5 py-0.5 bg-red-50 text-red-700 rounded-full text-xs font-medium border border-red-100",children:e.jsx("span",{children:"Error"})})]})]}),c&&e.jsxs("div",{className:"mt-1.5 flex items-start gap-2 group max-w-4xl",children:[e.jsx("div",{className:`text-sm text-neutral-600 leading-relaxed cursor-pointer transition-all ${h?"":"truncate"}`,onClick:()=>E(!h),children:i}),e.jsx("button",{onClick:()=>E(!h),className:"mt-0.5 text-neutral-400 opacity-0 group-hover:opacity-100 hover:text-neutral-600 transition-opacity",children:h?e.jsx(xe,{size:14}):e.jsx(ie,{size:14})})]}),e.jsxs("div",{className:"flex items-center gap-6 mt-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"text-neutral-400 font-medium",children:"Agent"}),e.jsx("div",{className:"flex items-center gap-1.5 text-neutral-900 font-medium bg-neutral-50 px-2 py-1 rounded border border-neutral-100",children:J?.name||l||"未选择"})]}),d!=="DEFAULT"&&e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"text-neutral-400 font-medium",children:"Variant"}),e.jsx("div",{className:"flex items-center gap-1.5 text-neutral-700 font-medium bg-blue-50 px-2 py-1 rounded border border-blue-100",children:d})]}),I&&e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"text-neutral-400 font-medium",children:"Session"}),e.jsxs("div",{className:"flex items-center gap-1.5 text-neutral-700 font-mono bg-neutral-50 px-2 py-1 rounded border border-neutral-100",children:[I.slice(0,8),"..."]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"text-neutral-400 font-medium",children:"连接"}),e.jsx("div",{className:`flex items-center gap-1.5 font-medium px-2 py-1 rounded border ${p?"text-emerald-700 bg-emerald-50 border-emerald-100":"text-neutral-500 bg-neutral-50 border-neutral-100"}`,children:p?g?"已连接":"连接中...":"未连接"})]}),c&&e.jsx(y,{variant:"outline",size:"sm",onClick:K,className:"ml-auto",children:"新会话"}),e.jsxs(W,{to:"/settings/profiles",className:`flex items-center gap-1.5 text-xs text-neutral-500 hover:text-neutral-900 transition-colors ${c?"":"ml-auto"}`,children:[e.jsx(ee,{size:14}),e.jsx("span",{children:"Profiles 设置"})]})]})]}),e.jsx("div",{ref:C,className:"flex-1 overflow-y-auto px-8 py-6",children:c?e.jsx("div",{className:"min-h-[200px]",children:v.length===0?e.jsx("div",{className:"text-neutral-400 text-center py-8",children:"等待 Agent 响应..."}):e.jsx(te,{ref:$,logs:v,scrollElementRef:C})}):e.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold mb-3 text-neutral-900",children:"选择 Agent"}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:w.map(t=>e.jsxs(y,{variant:l===t.type?"default":"outline",disabled:!t.available,onClick:()=>U(t.type),children:[t.name,t.available&&t.version&&` (${t.version})`,!t.available&&" (不可用)"]},t.type))})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold mb-3 text-neutral-900",children:"配置变体 (Profile Variant)"}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:H.map(t=>e.jsx("button",{onClick:()=>k(t),className:`px-3 py-1.5 rounded-full text-sm font-medium border transition-colors ${d===t?"bg-neutral-900 text-white border-neutral-900":"bg-white text-neutral-600 border-neutral-200 hover:border-neutral-400"}`,children:t},t))}),u&&u[d]&&e.jsx("p",{className:"mt-2 text-xs text-neutral-500 font-mono",children:Object.entries(u[d]).map(([t,n])=>`${t}: ${JSON.stringify(n)}`).join(", ")})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold mb-3 text-neutral-900",children:"输入任务"}),e.jsxs("div",{className:"relative border border-neutral-200 rounded-xl shadow-sm bg-white focus-within:ring-1 focus-within:ring-neutral-300 focus-within:border-neutral-300 transition-all duration-200",children:[e.jsx("textarea",{value:i,onChange:t=>A(t.target.value),rows:4,placeholder:"描述你想让 Agent 完成的任务...",className:"w-full px-4 py-3 bg-transparent border-none focus:outline-none focus:ring-0 resize-none text-neutral-900 placeholder-neutral-400 leading-relaxed text-sm"}),e.jsx("div",{className:"flex items-center justify-end px-3 pb-3 pt-1",children:e.jsx(y,{onClick:G,disabled:a==="starting"||!l||!i.trim(),children:a==="starting"?"启动中...":"开始"})})]})]})]})}),c&&R.length>0&&e.jsx("div",{className:"px-8 py-2 bg-white border-t border-neutral-100",children:e.jsx(se,{todos:R})}),c&&e.jsx("div",{className:"px-8 py-6 border-t border-neutral-100 bg-white",children:e.jsxs("div",{className:"relative border border-neutral-200 rounded-xl shadow-sm bg-white focus-within:ring-1 focus-within:ring-neutral-300 focus-within:border-neutral-300 transition-all duration-200",children:[e.jsx("textarea",{ref:m,value:x,onChange:B,rows:3,placeholder:"发送消息给 Agent...",className:"w-full px-4 py-3 bg-transparent border-none focus:outline-none focus:ring-0 resize-none text-neutral-900 placeholder-neutral-400 leading-relaxed text-sm scrollbar-thin scrollbar-thumb-neutral-200 scrollbar-track-transparent",style:{minHeight:"80px",maxHeight:"210px"},onKeyDown:t=>{t.key==="Enter"&&!t.shiftKey&&!t.repeat&&!t.nativeEvent.isComposing&&t.nativeEvent.keyCode!==229&&(t.preventDefault(),T())}}),e.jsxs("div",{className:"flex items-center justify-between px-3 pb-3 pt-1 border-t border-transparent",children:[e.jsxs("div",{className:"flex items-center gap-1 text-neutral-400",children:[e.jsx("button",{className:"p-2 hover:bg-neutral-100 hover:text-neutral-600 rounded-lg transition-colors",title:"Attach File",children:e.jsx(ne,{size:18})}),e.jsx("button",{className:"p-2 hover:bg-neutral-100 hover:text-neutral-600 rounded-lg transition-colors",title:"Mention",children:e.jsx(ce,{size:18})}),e.jsx("button",{className:"p-2 hover:bg-neutral-100 hover:text-neutral-600 rounded-lg transition-colors",title:"Reference Issue",children:e.jsx(ue,{size:18})}),e.jsx("div",{className:"w-px h-4 bg-neutral-200 mx-1"}),e.jsx("button",{className:"p-2 hover:bg-neutral-100 hover:text-neutral-600 rounded-lg transition-colors",title:"Search Web",children:e.jsx(re,{size:18})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[q&&e.jsxs("button",{onClick:O,className:"flex items-center gap-2 px-3 py-2 text-xs font-semibold text-red-600 bg-red-50 hover:bg-red-100 rounded-lg transition-colors",children:[e.jsx(ae,{size:12,fill:"currentColor"}),e.jsx("span",{children:"Stop"})]}),e.jsxs("button",{onClick:T,disabled:!x.trim(),className:`flex items-center gap-2 px-3 py-2 text-xs font-semibold rounded-lg transition-all ${x.trim()?"bg-neutral-900 text-white hover:bg-black shadow-sm":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:[e.jsx("span",{children:"Send"}),e.jsx(he,{size:14})]})]})]})]})})]})}export{Se as AgentDemoPage};
1
+ import{c as b,r as s,j as e,L as W}from"./index-DFLmhfiK.js";import{a as f,B as y}from"./api-client-CvkWGC57.js";import{u as Q,a as X,b as L,c as Y,d as Z,S as ee,e as te,T as se,P as ne,G as re,f as ae}from"./mermaid-NOHMQCX5-BCuuUgP6.js";import{d as le}from"./use-profiles-C--W_RiQ.js";import{C as ie}from"./chevron-down-gMypHmvg.js";import"./log-adapter-50wgehrc.js";import"./query-keys-Ddm69Sh0.js";const oe=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],ce=b("at-sign",oe);const de=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],xe=b("chevron-up",de);const me=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],ue=b("hash",me);const pe=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],he=b("send",pe),ge=!0;function Se(){const[w,_]=s.useState([]),[l,S]=s.useState(""),[d,k]=s.useState("DEFAULT"),[i,A]=s.useState(""),[r,D]=s.useState(null),[a,o]=s.useState("idle"),[h,E]=s.useState(!1),[x,j]=s.useState(""),$=s.useRef(null),C=s.useRef(null),m=s.useRef(null),{data:u}=le(l),H=u?Object.keys(u):["DEFAULT"],U=t=>{S(t),k("DEFAULT")},F=s.useCallback(t=>{o(t===0?"stopped":"error")},[]),M=s.useCallback(t=>{console.error("Agent error:",t),o("error")},[]),{isConnected:p,isAttached:g,logs:v,entries:V,agentSessionId:I,attach:z,clearLogs:P}=Q({sessionId:r||"",onExit:F,onError:M}),{todos:R}=X(V);s.useEffect(()=>{f.get("/demo/agents").then(t=>{_(t.agents);const n=t.agents.find(N=>N.available);n&&S(n.type)})},[]),s.useEffect(()=>{$.current?.scrollToBottom("smooth")},[v]),s.useEffect(()=>{console.log(`[AgentDemoPage:useEffect] t=${Date.now()} sessionId=${r} isConnected=${p} isAttached=${g}`),r&&p&&!g&&(console.log(`[AgentDemoPage:useEffect] t=${Date.now()} calling attach()`),z())},[r,p,g,z]);const B=t=>{if(j(t.target.value),m.current){m.current.style.height="auto";const N=Math.min(m.current.scrollHeight,210);m.current.style.height=`${N}px`}},G=async()=>{if(!l||!i.trim())return;const t=Date.now();console.log(`[AgentDemoPage:handleStart] t=${t} starting...`),o("starting"),P();try{const n=await f.post("/demo/start",{agentType:l,prompt:i.trim(),variant:d});ge&&console.log(`[AgentDemoPage:handleStart] t=${Date.now()} apiTime=${Date.now()-t}ms sessionId=${n.sessionId}`),D(n.sessionId),o("running")}catch(n){console.error("Start failed:",n),o("error")}},T=async()=>{if(!r||!x.trim())return;const t=x.trim();j("");try{await f.post(`/demo/${r}/message`,{message:t})}catch(n){console.error("Send failed:",n)}},O=async()=>{if(r)try{await f.post(`/demo/${r}/stop`),o("stopped")}catch(t){console.error("Stop failed:",t)}},K=()=>{D(null),o("idle"),A(""),j(""),P()},q=a==="running",c=r!==null,J=w.find(t=>t.type===l);return e.jsxs("div",{className:"flex flex-col h-full bg-white",children:[e.jsxs("div",{className:"px-8 py-5 border-b border-neutral-100 bg-white transition-all duration-300",children:[e.jsxs("div",{className:"flex items-center flex-wrap gap-3",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("span",{className:"text-base font-medium text-blue-600",children:"Agent Demo"}),e.jsx("span",{className:"text-neutral-300 text-sm",children:"/"}),e.jsx("span",{className:"text-xl font-bold text-neutral-900 tracking-tight",children:c?i.slice(0,50)+(i.length>50?"...":""):"新会话"})]}),e.jsxs("div",{className:"flex items-center",children:[a==="running"&&e.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-0.5 bg-blue-50 text-blue-700 rounded-full text-xs font-medium border border-blue-100",children:[e.jsx(L,{className:"w-3.5 h-3.5 animate-pulse"}),e.jsx("span",{children:"Running"})]}),a==="stopped"&&e.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-0.5 bg-emerald-50 text-emerald-700 rounded-full text-xs font-medium border border-emerald-100",children:[e.jsx(Y,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Done"})]}),a==="idle"&&e.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-0.5 bg-neutral-100 text-neutral-600 rounded-full text-xs font-medium border border-neutral-200",children:[e.jsx(Z,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Idle"})]}),a==="starting"&&e.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-0.5 bg-amber-50 text-amber-700 rounded-full text-xs font-medium border border-amber-100",children:[e.jsx(L,{className:"w-3.5 h-3.5 animate-spin"}),e.jsx("span",{children:"Starting..."})]}),a==="error"&&e.jsx("div",{className:"flex items-center gap-1.5 px-2.5 py-0.5 bg-red-50 text-red-700 rounded-full text-xs font-medium border border-red-100",children:e.jsx("span",{children:"Error"})})]})]}),c&&e.jsxs("div",{className:"mt-1.5 flex items-start gap-2 group max-w-4xl",children:[e.jsx("div",{className:`text-sm text-neutral-600 leading-relaxed cursor-pointer transition-all ${h?"":"truncate"}`,onClick:()=>E(!h),children:i}),e.jsx("button",{onClick:()=>E(!h),className:"mt-0.5 text-neutral-400 opacity-0 group-hover:opacity-100 hover:text-neutral-600 transition-opacity",children:h?e.jsx(xe,{size:14}):e.jsx(ie,{size:14})})]}),e.jsxs("div",{className:"flex items-center gap-6 mt-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"text-neutral-400 font-medium",children:"Agent"}),e.jsx("div",{className:"flex items-center gap-1.5 text-neutral-900 font-medium bg-neutral-50 px-2 py-1 rounded border border-neutral-100",children:J?.name||l||"未选择"})]}),d!=="DEFAULT"&&e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"text-neutral-400 font-medium",children:"Variant"}),e.jsx("div",{className:"flex items-center gap-1.5 text-neutral-700 font-medium bg-blue-50 px-2 py-1 rounded border border-blue-100",children:d})]}),I&&e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"text-neutral-400 font-medium",children:"Session"}),e.jsxs("div",{className:"flex items-center gap-1.5 text-neutral-700 font-mono bg-neutral-50 px-2 py-1 rounded border border-neutral-100",children:[I.slice(0,8),"..."]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"text-neutral-400 font-medium",children:"连接"}),e.jsx("div",{className:`flex items-center gap-1.5 font-medium px-2 py-1 rounded border ${p?"text-emerald-700 bg-emerald-50 border-emerald-100":"text-neutral-500 bg-neutral-50 border-neutral-100"}`,children:p?g?"已连接":"连接中...":"未连接"})]}),c&&e.jsx(y,{variant:"outline",size:"sm",onClick:K,className:"ml-auto",children:"新会话"}),e.jsxs(W,{to:"/settings/profiles",className:`flex items-center gap-1.5 text-xs text-neutral-500 hover:text-neutral-900 transition-colors ${c?"":"ml-auto"}`,children:[e.jsx(ee,{size:14}),e.jsx("span",{children:"Profiles 设置"})]})]})]}),e.jsx("div",{ref:C,className:"flex-1 overflow-y-auto px-8 py-6",children:c?e.jsx("div",{className:"min-h-[200px]",children:v.length===0?e.jsx("div",{className:"text-neutral-400 text-center py-8",children:"等待 Agent 响应..."}):e.jsx(te,{ref:$,logs:v,scrollElementRef:C})}):e.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold mb-3 text-neutral-900",children:"选择 Agent"}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:w.map(t=>e.jsxs(y,{variant:l===t.type?"default":"outline",disabled:!t.available,onClick:()=>U(t.type),children:[t.name,t.available&&t.version&&` (${t.version})`,!t.available&&" (不可用)"]},t.type))})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold mb-3 text-neutral-900",children:"配置变体 (Profile Variant)"}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:H.map(t=>e.jsx("button",{onClick:()=>k(t),className:`px-3 py-1.5 rounded-full text-sm font-medium border transition-colors ${d===t?"bg-neutral-900 text-white border-neutral-900":"bg-white text-neutral-600 border-neutral-200 hover:border-neutral-400"}`,children:t},t))}),u&&u[d]&&e.jsx("p",{className:"mt-2 text-xs text-neutral-500 font-mono",children:Object.entries(u[d]).map(([t,n])=>`${t}: ${JSON.stringify(n)}`).join(", ")})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold mb-3 text-neutral-900",children:"输入任务"}),e.jsxs("div",{className:"relative border border-neutral-200 rounded-xl shadow-sm bg-white focus-within:ring-1 focus-within:ring-neutral-300 focus-within:border-neutral-300 transition-all duration-200",children:[e.jsx("textarea",{value:i,onChange:t=>A(t.target.value),rows:4,placeholder:"描述你想让 Agent 完成的任务...",className:"w-full px-4 py-3 bg-transparent border-none focus:outline-none focus:ring-0 resize-none text-neutral-900 placeholder-neutral-400 leading-relaxed text-sm"}),e.jsx("div",{className:"flex items-center justify-end px-3 pb-3 pt-1",children:e.jsx(y,{onClick:G,disabled:a==="starting"||!l||!i.trim(),children:a==="starting"?"启动中...":"开始"})})]})]})]})}),c&&R.length>0&&e.jsx("div",{className:"px-8 py-2 bg-white border-t border-neutral-100",children:e.jsx(se,{todos:R})}),c&&e.jsx("div",{className:"px-8 py-6 border-t border-neutral-100 bg-white",children:e.jsxs("div",{className:"relative border border-neutral-200 rounded-xl shadow-sm bg-white focus-within:ring-1 focus-within:ring-neutral-300 focus-within:border-neutral-300 transition-all duration-200",children:[e.jsx("textarea",{ref:m,value:x,onChange:B,rows:3,placeholder:"发送消息给 Agent...",className:"w-full px-4 py-3 bg-transparent border-none focus:outline-none focus:ring-0 resize-none text-neutral-900 placeholder-neutral-400 leading-relaxed text-sm scrollbar-thin scrollbar-thumb-neutral-200 scrollbar-track-transparent",style:{minHeight:"80px",maxHeight:"210px"},onKeyDown:t=>{t.key==="Enter"&&!t.shiftKey&&!t.repeat&&!t.nativeEvent.isComposing&&t.nativeEvent.keyCode!==229&&(t.preventDefault(),T())}}),e.jsxs("div",{className:"flex items-center justify-between px-3 pb-3 pt-1 border-t border-transparent",children:[e.jsxs("div",{className:"flex items-center gap-1 text-neutral-400",children:[e.jsx("button",{className:"p-2 hover:bg-neutral-100 hover:text-neutral-600 rounded-lg transition-colors",title:"Attach File",children:e.jsx(ne,{size:18})}),e.jsx("button",{className:"p-2 hover:bg-neutral-100 hover:text-neutral-600 rounded-lg transition-colors",title:"Mention",children:e.jsx(ce,{size:18})}),e.jsx("button",{className:"p-2 hover:bg-neutral-100 hover:text-neutral-600 rounded-lg transition-colors",title:"Reference Issue",children:e.jsx(ue,{size:18})}),e.jsx("div",{className:"w-px h-4 bg-neutral-200 mx-1"}),e.jsx("button",{className:"p-2 hover:bg-neutral-100 hover:text-neutral-600 rounded-lg transition-colors",title:"Search Web",children:e.jsx(re,{size:18})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[q&&e.jsxs("button",{onClick:O,className:"flex items-center gap-2 px-3 py-2 text-xs font-semibold text-red-600 bg-red-50 hover:bg-red-100 rounded-lg transition-colors",children:[e.jsx(ae,{size:12,fill:"currentColor"}),e.jsx("span",{children:"Stop"})]}),e.jsxs("button",{onClick:T,disabled:!x.trim(),className:`flex items-center gap-2 px-3 py-2 text-xs font-semibold rounded-lg transition-all ${x.trim()?"bg-neutral-900 text-white hover:bg-black shadow-sm":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:[e.jsx("span",{children:"Send"}),e.jsx(he,{size:14})]})]})]})]})})]})}export{Se as AgentDemoPage};
@@ -1,4 +1,4 @@
1
- import{r as n,s as E,S as d,C as k,j as s}from"./index-hdGFeHu1.js";import{c as _,a as R,B}from"./api-client-iFY2ykuZ.js";function T(I){const{sessionId:a,onOutput:x,onExit:b,onError:u}=I,[j,c]=n.useState(()=>E.isConnected()),[v,m]=n.useState(!1),r=n.useRef({onOutput:x,onExit:b,onError:u});r.current={onOutput:x,onExit:b,onError:u},n.useEffect(()=>{const t=E.getSocket();c(t.connected);const i=()=>c(!0),p=()=>{c(!1),m(!1)},O=l=>{l.sessionId===a&&r.current.onOutput?.(l.data)},h=l=>{l.sessionId===a&&(m(!1),r.current.onExit?.(l.exitCode))},g=l=>{l.sessionId===a&&r.current.onError?.(l.message)},N=l=>{l.sessionId===a&&m(!0)},C=l=>{l.sessionId===a&&m(!1)};return t.on("connect",i),t.on("disconnect",p),t.on(d.SESSION_STDOUT,O),t.on(d.SESSION_EXIT,h),t.on(d.SESSION_ERROR,g),t.on(d.SESSION_SUBSCRIBED,N),t.on(d.SESSION_UNSUBSCRIBED,C),c(t.connected),()=>{t.off("connect",i),t.off("disconnect",p),t.off(d.SESSION_STDOUT,O),t.off(d.SESSION_EXIT,h),t.off(d.SESSION_ERROR,g),t.off(d.SESSION_SUBSCRIBED,N),t.off(d.SESSION_UNSUBSCRIBED,C),t.emit(k.UNSUBSCRIBE,{topic:"session",id:a})}},[a]);const y=n.useCallback(()=>new Promise(t=>{const i=E.getSocket();if(!i.connected){t(!1);return}i.emit(k.SUBSCRIBE,{topic:"session",id:a},p=>{t(p.success)})}),[a]),w=n.useCallback(()=>{E.getSocket().emit(k.UNSUBSCRIBE,{topic:"session",id:a})},[a]),S=n.useCallback(t=>{E.getSocket().emit(k.INPUT,{sessionId:a,data:t})},[a]),D=n.useCallback((t,i)=>{E.getSocket().emit(k.RESIZE,{sessionId:a,cols:t,rows:i})},[a]);return{isConnected:j,isAttached:v,attach:y,detach:w,sendInput:S,resize:D}}function U({className:I,...a}){return s.jsx("div",{"data-slot":"card",className:_("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",I),...a})}function P(){const[I,a]=n.useState([]),[x,b]=n.useState(""),[u,j]=n.useState(""),[c,v]=n.useState(null),[m,r]=n.useState([]),[y,w]=n.useState(!1),[S,D]=n.useState(""),t=n.useRef(null),i=n.useCallback(e=>{r(o=>{const f=o[o.length-1];return f&&f.role==="agent"?[...o.slice(0,-1),{...f,content:f.content+e}]:[...o,{role:"agent",content:e,timestamp:new Date}]})},[]),p=n.useCallback(e=>{r(o=>[...o,{role:"agent",content:`
1
+ import{r as n,s as E,S as d,C as k,j as s}from"./index-DFLmhfiK.js";import{c as _,a as R,B}from"./api-client-CvkWGC57.js";function T(I){const{sessionId:a,onOutput:x,onExit:b,onError:u}=I,[j,c]=n.useState(()=>E.isConnected()),[v,m]=n.useState(!1),r=n.useRef({onOutput:x,onExit:b,onError:u});r.current={onOutput:x,onExit:b,onError:u},n.useEffect(()=>{const t=E.getSocket();c(t.connected);const i=()=>c(!0),p=()=>{c(!1),m(!1)},O=l=>{l.sessionId===a&&r.current.onOutput?.(l.data)},h=l=>{l.sessionId===a&&(m(!1),r.current.onExit?.(l.exitCode))},g=l=>{l.sessionId===a&&r.current.onError?.(l.message)},N=l=>{l.sessionId===a&&m(!0)},C=l=>{l.sessionId===a&&m(!1)};return t.on("connect",i),t.on("disconnect",p),t.on(d.SESSION_STDOUT,O),t.on(d.SESSION_EXIT,h),t.on(d.SESSION_ERROR,g),t.on(d.SESSION_SUBSCRIBED,N),t.on(d.SESSION_UNSUBSCRIBED,C),c(t.connected),()=>{t.off("connect",i),t.off("disconnect",p),t.off(d.SESSION_STDOUT,O),t.off(d.SESSION_EXIT,h),t.off(d.SESSION_ERROR,g),t.off(d.SESSION_SUBSCRIBED,N),t.off(d.SESSION_UNSUBSCRIBED,C),t.emit(k.UNSUBSCRIBE,{topic:"session",id:a})}},[a]);const y=n.useCallback(()=>new Promise(t=>{const i=E.getSocket();if(!i.connected){t(!1);return}i.emit(k.SUBSCRIBE,{topic:"session",id:a},p=>{t(p.success)})}),[a]),w=n.useCallback(()=>{E.getSocket().emit(k.UNSUBSCRIBE,{topic:"session",id:a})},[a]),S=n.useCallback(t=>{E.getSocket().emit(k.INPUT,{sessionId:a,data:t})},[a]),D=n.useCallback((t,i)=>{E.getSocket().emit(k.RESIZE,{sessionId:a,cols:t,rows:i})},[a]);return{isConnected:j,isAttached:v,attach:y,detach:w,sendInput:S,resize:D}}function U({className:I,...a}){return s.jsx("div",{"data-slot":"card",className:_("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",I),...a})}function P(){const[I,a]=n.useState([]),[x,b]=n.useState(""),[u,j]=n.useState(""),[c,v]=n.useState(null),[m,r]=n.useState([]),[y,w]=n.useState(!1),[S,D]=n.useState(""),t=n.useRef(null),i=n.useCallback(e=>{r(o=>{const f=o[o.length-1];return f&&f.role==="agent"?[...o.slice(0,-1),{...f,content:f.content+e}]:[...o,{role:"agent",content:e,timestamp:new Date}]})},[]),p=n.useCallback(e=>{r(o=>[...o,{role:"agent",content:`
2
2
  [进程退出,退出码: ${e}]`,timestamp:new Date}]),v(null)},[]),O=n.useCallback(e=>{r(o=>[...o,{role:"agent",content:`
3
3
  [错误: ${e}]`,timestamp:new Date}])},[]),{isConnected:h,isAttached:g,attach:N}=T({sessionId:c||"",onOutput:i,onExit:p,onError:O});n.useEffect(()=>{R.get("/demo/agents").then(e=>{a(e.agents);const o=e.agents.find(f=>f.available);o&&b(o.type)})},[]),n.useEffect(()=>{t.current?.scrollIntoView({behavior:"smooth"})},[m]),n.useEffect(()=>{c&&h&&!g&&N()},[c,h,g,N]);const C=async()=>{if(!(!x||!u.trim())){w(!0),r([{role:"user",content:u,timestamp:new Date}]);try{const e=await R.post("/demo/start",{agentType:x,prompt:u.trim()});v(e.sessionId),j("")}catch(e){r(o=>[...o,{role:"agent",content:`启动失败: ${e instanceof Error?e.message:"未知错误"}`,timestamp:new Date}])}finally{w(!1)}}},l=async()=>{if(!c||!S.trim())return;const e=S.trim();r(o=>[...o,{role:"user",content:e,timestamp:new Date}]),D("");try{await R.post(`/demo/${c}/message`,{message:e})}catch(o){r(f=>[...f,{role:"agent",content:`发送失败: ${o instanceof Error?o.message:"未知错误"}`,timestamp:new Date}])}},A=async()=>{if(c)try{await R.post(`/demo/${c}/stop`),r(e=>[...e,{role:"agent",content:`
4
4
  [会话已停止]`,timestamp:new Date}]),v(null)}catch(e){console.error("Stop failed:",e)}};return s.jsxs("div",{className:"flex flex-col h-full max-w-4xl mx-auto p-4 gap-4",children:[s.jsx("h1",{className:"text-2xl font-bold",children:"Agent 交互演示"}),!c&&s.jsxs(U,{className:"p-4",children:[s.jsx("h2",{className:"text-lg font-semibold mb-3",children:"选择 Agent"}),s.jsx("div",{className:"flex gap-2 flex-wrap mb-4",children:I.map(e=>s.jsxs(B,{variant:x===e.type?"default":"outline",disabled:!e.available,onClick:()=>b(e.type),children:[e.name,e.available&&e.version&&` (${e.version})`,!e.available&&" (不可用)"]},e.type))}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{type:"text",value:u,onChange:e=>j(e.target.value),onKeyDown:e=>e.key==="Enter"&&!e.nativeEvent.isComposing&&e.nativeEvent.keyCode!==229&&C(),placeholder:"输入你的问题或任务...",className:"flex-1 px-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"}),s.jsx(B,{onClick:C,disabled:y||!x||!u.trim(),children:y?"启动中...":"开始"})]})]}),s.jsxs(U,{className:"flex-1 p-4 overflow-hidden flex flex-col",children:[s.jsxs("div",{className:"flex justify-between items-center mb-3",children:[s.jsx("h2",{className:"text-lg font-semibold",children:"对话"}),c&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm text-gray-500",children:h?g?"已连接":"连接中...":"未连接"}),s.jsx(B,{variant:"outline",size:"sm",onClick:A,children:"停止"})]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto space-y-3",children:[m.length===0?s.jsx("div",{className:"text-gray-400 text-center py-8",children:"选择 Agent 并输入问题开始对话"}):m.map((e,o)=>s.jsxs("div",{className:`p-3 rounded-lg ${e.role==="user"?"bg-blue-100 ml-8":"bg-gray-100 mr-8"}`,children:[s.jsx("div",{className:"text-xs text-gray-500 mb-1",children:e.role==="user"?"你":"Agent"}),s.jsx("pre",{className:"whitespace-pre-wrap font-mono text-sm",children:e.content})]},o)),s.jsx("div",{ref:t})]}),c&&s.jsxs("div",{className:"flex gap-2 mt-3 pt-3 border-t",children:[s.jsx("input",{type:"text",value:S,onChange:e=>D(e.target.value),onKeyDown:e=>e.key==="Enter"&&!e.repeat&&!e.nativeEvent.isComposing&&e.nativeEvent.keyCode!==229&&l(),placeholder:"发送后续消息...",className:"flex-1 px-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"}),s.jsx(B,{onClick:l,disabled:!S.trim(),children:"发送"})]})]})]})}export{P as DemoPage};
@@ -1 +1 @@
1
- import{c as U,u as S,r as l,j as e}from"./index-hdGFeHu1.js";import{u as E,a as j,q as y}from"./query-keys-B2VhRmAm.js";import{a as x,B as g}from"./api-client-iFY2ykuZ.js";import{S as I}from"./select-WuDnj3zN.js";import{L as P}from"./loader-circle-BYF33K7x.js";import{C as q}from"./circle-check-uswR_cEa.js";import{C as R}from"./circle-alert-CHDHEO67.js";import"./chevron-down-CxTrrnvp.js";const z=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],L=U("link",z);function B(){return E({queryKey:y.notifications.settings,queryFn:()=>x.get("/notifications/settings")})}function A(){const s=S();return j({mutationFn:c=>x.put("/notifications/settings",c),onSuccess:()=>{s.invalidateQueries({queryKey:y.notifications.settings})}})}function F(){return j({mutationFn:s=>x.post("/notifications/test",s)})}const K=[{value:"none",label:"无"},{value:"feishu",label:"飞书"}];function G(){const{data:s,isLoading:c}=B(),r=A(),a=F(),[n,p]=l.useState({webhookUrl:"",baseUrl:"",titleTemplate:"",bodyTemplate:""}),[u,h]=l.useState(!1),[f,i]=l.useState("idle"),d=l.useRef(void 0);if(l.useEffect(()=>{s&&!u&&p({webhookUrl:s.feishuWebhookUrl??"",baseUrl:s.thirdPartyBaseUrl??"",titleTemplate:s.taskInReviewTitleTemplate??"",bodyTemplate:s.taskInReviewBodyTemplate??""})},[s,u]),l.useEffect(()=>(a.isSuccess?(i("success"),d.current=setTimeout(()=>i("idle"),3e3)):a.isError&&(i("error"),d.current=setTimeout(()=>i("idle"),5e3)),()=>clearTimeout(d.current)),[a.isSuccess,a.isError]),c)return e.jsx("div",{className:"p-6 text-sm text-neutral-400",children:"加载中..."});const m=s?.osNotificationEnabled??!0,b=s?.thirdPartyChannel??"none",o=(t,w)=>{p(C=>({...C,[t]:w})),h(!0)},N=()=>{r.mutate({osNotificationEnabled:!m})},k=t=>{r.mutate({thirdPartyChannel:t})},v=()=>{r.mutate({feishuWebhookUrl:n.webhookUrl.trim()||null,thirdPartyBaseUrl:n.baseUrl.trim()||null,taskInReviewTitleTemplate:n.titleTemplate.trim()||"Agent Tower",taskInReviewBodyTemplate:n.bodyTemplate.trim()||'✅ "{taskTitle}" 已完成,等待审查'},{onSuccess:()=>h(!1)})},T=()=>{n.webhookUrl.trim()&&a.mutate({channel:"feishu",webhookUrl:n.webhookUrl.trim(),baseUrl:n.baseUrl.trim()||void 0})};return e.jsxs("div",{className:"px-10 py-6 mx-auto w-full max-w-3xl space-y-8",children:[e.jsxs("section",{children:[e.jsx("h3",{className:"text-[13px] font-semibold text-neutral-900 mb-1",children:"系统通知"}),e.jsx("p",{className:"text-[12px] text-neutral-400 mb-3",children:"任务完成时弹出桌面通知"}),e.jsx("button",{onClick:N,className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors ${m?"bg-neutral-900":"bg-neutral-200"}`,children:e.jsx("span",{className:`inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform ${m?"translate-x-[18px]":"translate-x-[3px]"}`})})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-[13px] font-semibold text-neutral-900 mb-1",children:"第三方通知"}),e.jsx("p",{className:"text-[12px] text-neutral-400 mb-3",children:"选择一个第三方渠道接收通知"}),e.jsx(I,{value:b,onChange:t=>k(t),options:K}),b==="feishu"&&e.jsxs("div",{className:"mt-4 space-y-4",children:[e.jsxs("div",{className:"p-4 border border-neutral-100 rounded-lg space-y-3",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center gap-1 text-[13px] font-medium text-neutral-700 mb-1",children:[e.jsx(L,{size:12}),"Webhook URL"]}),e.jsx("input",{type:"text",value:n.webhookUrl,onChange:t=>o("webhookUrl",t.target.value),placeholder:"https://open.feishu.cn/open-apis/bot/v2/hook/...",className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm font-mono focus:outline-none focus:ring-1 focus:ring-neutral-300"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(g,{size:"sm",variant:"outline",onClick:T,disabled:!n.webhookUrl.trim()||a.isPending,children:[a.isPending&&e.jsx(P,{size:12,className:"animate-spin mr-1"}),"测试发送"]}),f==="success"&&e.jsxs("span",{className:"flex items-center gap-1 text-xs text-green-600",children:[e.jsx(q,{size:12}),"发送成功"]}),f==="error"&&e.jsxs("span",{className:"flex items-center gap-1 text-xs text-red-500",children:[e.jsx(R,{size:12}),"发送失败"]})]})]}),e.jsx("div",{className:"p-4 border border-neutral-100 rounded-lg space-y-3",children:e.jsxs("div",{children:[e.jsx("label",{className:"block text-[13px] font-medium text-neutral-700 mb-1",children:"跳转地址(用于生成任务链接)"}),e.jsx("input",{type:"text",value:n.baseUrl,onChange:t=>o("baseUrl",t.target.value),placeholder:"http://localhost:5173",className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm font-mono focus:outline-none focus:ring-1 focus:ring-neutral-300"}),e.jsxs("p",{className:"text-[11px] text-neutral-400 mt-1",children:['通知卡片中的"查看任务"按钮将跳转到 ',"{baseUrl}/projects/{projectId}/tasks/{taskId}"]})]})})]})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-[13px] font-semibold text-neutral-900 mb-1",children:"通知模板"}),e.jsxs("p",{className:"text-[12px] text-neutral-400 mb-3",children:["支持变量: ","{taskTitle}",", ","{taskId}",", ","{projectId}",", ","{projectName}",", ","{status}"]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[13px] font-medium text-neutral-700 mb-1",children:"标题模板"}),e.jsx("input",{type:"text",value:n.titleTemplate,onChange:t=>o("titleTemplate",t.target.value),placeholder:"Agent Tower",className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:ring-1 focus:ring-neutral-300"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[13px] font-medium text-neutral-700 mb-1",children:"内容模板"}),e.jsx("textarea",{value:n.bodyTemplate,onChange:t=>o("bodyTemplate",t.target.value),placeholder:'✅ "{taskTitle}" 已完成,等待审查',rows:2,className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:ring-1 focus:ring-neutral-300 resize-none"})]})]})]}),u&&e.jsx("div",{className:"sticky bottom-6 flex justify-end",children:e.jsx(g,{size:"sm",onClick:v,disabled:r.isPending,children:r.isPending?"保存中...":"保存所有更改"})})]})}export{G as NotificationSettingsPage};
1
+ import{c as U,u as S,r as l,j as e}from"./index-DFLmhfiK.js";import{u as E,a as j,q as y}from"./query-keys-Ddm69Sh0.js";import{a as x,B as g}from"./api-client-CvkWGC57.js";import{S as I}from"./select-CXYXolOw.js";import{L as P}from"./loader-circle-DkuE984n.js";import{C as q}from"./circle-check-gk9yWlOW.js";import{C as R}from"./circle-alert-R4XXB7n4.js";import"./chevron-down-gMypHmvg.js";const z=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],L=U("link",z);function B(){return E({queryKey:y.notifications.settings,queryFn:()=>x.get("/notifications/settings")})}function A(){const s=S();return j({mutationFn:c=>x.put("/notifications/settings",c),onSuccess:()=>{s.invalidateQueries({queryKey:y.notifications.settings})}})}function F(){return j({mutationFn:s=>x.post("/notifications/test",s)})}const K=[{value:"none",label:"无"},{value:"feishu",label:"飞书"}];function G(){const{data:s,isLoading:c}=B(),r=A(),a=F(),[n,p]=l.useState({webhookUrl:"",baseUrl:"",titleTemplate:"",bodyTemplate:""}),[u,h]=l.useState(!1),[f,i]=l.useState("idle"),d=l.useRef(void 0);if(l.useEffect(()=>{s&&!u&&p({webhookUrl:s.feishuWebhookUrl??"",baseUrl:s.thirdPartyBaseUrl??"",titleTemplate:s.taskInReviewTitleTemplate??"",bodyTemplate:s.taskInReviewBodyTemplate??""})},[s,u]),l.useEffect(()=>(a.isSuccess?(i("success"),d.current=setTimeout(()=>i("idle"),3e3)):a.isError&&(i("error"),d.current=setTimeout(()=>i("idle"),5e3)),()=>clearTimeout(d.current)),[a.isSuccess,a.isError]),c)return e.jsx("div",{className:"p-6 text-sm text-neutral-400",children:"加载中..."});const m=s?.osNotificationEnabled??!0,b=s?.thirdPartyChannel??"none",o=(t,w)=>{p(C=>({...C,[t]:w})),h(!0)},N=()=>{r.mutate({osNotificationEnabled:!m})},k=t=>{r.mutate({thirdPartyChannel:t})},v=()=>{r.mutate({feishuWebhookUrl:n.webhookUrl.trim()||null,thirdPartyBaseUrl:n.baseUrl.trim()||null,taskInReviewTitleTemplate:n.titleTemplate.trim()||"Agent Tower",taskInReviewBodyTemplate:n.bodyTemplate.trim()||'✅ "{taskTitle}" 已完成,等待审查'},{onSuccess:()=>h(!1)})},T=()=>{n.webhookUrl.trim()&&a.mutate({channel:"feishu",webhookUrl:n.webhookUrl.trim(),baseUrl:n.baseUrl.trim()||void 0})};return e.jsxs("div",{className:"px-10 py-6 mx-auto w-full max-w-3xl space-y-8",children:[e.jsxs("section",{children:[e.jsx("h3",{className:"text-[13px] font-semibold text-neutral-900 mb-1",children:"系统通知"}),e.jsx("p",{className:"text-[12px] text-neutral-400 mb-3",children:"任务完成时弹出桌面通知"}),e.jsx("button",{onClick:N,className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors ${m?"bg-neutral-900":"bg-neutral-200"}`,children:e.jsx("span",{className:`inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform ${m?"translate-x-[18px]":"translate-x-[3px]"}`})})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-[13px] font-semibold text-neutral-900 mb-1",children:"第三方通知"}),e.jsx("p",{className:"text-[12px] text-neutral-400 mb-3",children:"选择一个第三方渠道接收通知"}),e.jsx(I,{value:b,onChange:t=>k(t),options:K}),b==="feishu"&&e.jsxs("div",{className:"mt-4 space-y-4",children:[e.jsxs("div",{className:"p-4 border border-neutral-100 rounded-lg space-y-3",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center gap-1 text-[13px] font-medium text-neutral-700 mb-1",children:[e.jsx(L,{size:12}),"Webhook URL"]}),e.jsx("input",{type:"text",value:n.webhookUrl,onChange:t=>o("webhookUrl",t.target.value),placeholder:"https://open.feishu.cn/open-apis/bot/v2/hook/...",className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm font-mono focus:outline-none focus:ring-1 focus:ring-neutral-300"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(g,{size:"sm",variant:"outline",onClick:T,disabled:!n.webhookUrl.trim()||a.isPending,children:[a.isPending&&e.jsx(P,{size:12,className:"animate-spin mr-1"}),"测试发送"]}),f==="success"&&e.jsxs("span",{className:"flex items-center gap-1 text-xs text-green-600",children:[e.jsx(q,{size:12}),"发送成功"]}),f==="error"&&e.jsxs("span",{className:"flex items-center gap-1 text-xs text-red-500",children:[e.jsx(R,{size:12}),"发送失败"]})]})]}),e.jsx("div",{className:"p-4 border border-neutral-100 rounded-lg space-y-3",children:e.jsxs("div",{children:[e.jsx("label",{className:"block text-[13px] font-medium text-neutral-700 mb-1",children:"跳转地址(用于生成任务链接)"}),e.jsx("input",{type:"text",value:n.baseUrl,onChange:t=>o("baseUrl",t.target.value),placeholder:"http://localhost:5173",className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm font-mono focus:outline-none focus:ring-1 focus:ring-neutral-300"}),e.jsxs("p",{className:"text-[11px] text-neutral-400 mt-1",children:['通知卡片中的"查看任务"按钮将跳转到 ',"{baseUrl}/projects/{projectId}/tasks/{taskId}"]})]})})]})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-[13px] font-semibold text-neutral-900 mb-1",children:"通知模板"}),e.jsxs("p",{className:"text-[12px] text-neutral-400 mb-3",children:["支持变量: ","{taskTitle}",", ","{taskId}",", ","{projectId}",", ","{projectName}",", ","{status}"]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[13px] font-medium text-neutral-700 mb-1",children:"标题模板"}),e.jsx("input",{type:"text",value:n.titleTemplate,onChange:t=>o("titleTemplate",t.target.value),placeholder:"Agent Tower",className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:ring-1 focus:ring-neutral-300"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[13px] font-medium text-neutral-700 mb-1",children:"内容模板"}),e.jsx("textarea",{value:n.bodyTemplate,onChange:t=>o("bodyTemplate",t.target.value),placeholder:'✅ "{taskTitle}" 已完成,等待审查',rows:2,className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:ring-1 focus:ring-neutral-300 resize-none"})]})]})]}),u&&e.jsx("div",{className:"sticky bottom-6 flex justify-end",children:e.jsx(g,{size:"sm",onClick:v,disabled:r.isPending,children:r.isPending?"保存中...":"保存所有更改"})})]})}export{G as NotificationSettingsPage};
@@ -1,3 +1,3 @@
1
- import{r as o,j as e}from"./index-hdGFeHu1.js";import{u as J,a as V,b as $,c as L}from"./use-profiles-DYTDOkn8.js";import{B as N}from"./api-client-iFY2ykuZ.js";import{T as A,M as D}from"./modal-BCL0660p.js";import{P as I}from"./x-Bn5zgMLL.js";import{P as M}from"./pencil-SJi1qbh9.js";import"./query-keys-B2VhRmAm.js";function U(i){return Object.entries(i).map(([c,u])=>`${c}: ${JSON.stringify(u)}`).join(", ")}const g={CLAUDE_CODE:"Claude Code",GEMINI_CLI:"Gemini CLI",CURSOR_AGENT:"Cursor Agent"};function q(){const{data:i,isLoading:c}=J(),{data:u}=V(),d=$(),v=L(),[r,a]=o.useState(null),[f,x]=o.useState(""),[m,p]=o.useState(""),[h,l]=o.useState(""),C=(t,s,n)=>{a({agentType:t,variant:s,config:n,isNew:!1}),p(s),x(JSON.stringify(n,null,2)),l("")},S=t=>{a({agentType:t,variant:"",config:{},isNew:!0}),p(""),x(`{
1
+ import{r as o,j as e}from"./index-DFLmhfiK.js";import{u as J,a as V,b as $,c as L}from"./use-profiles-C--W_RiQ.js";import{B as N}from"./api-client-CvkWGC57.js";import{T as A,M as D}from"./modal-Cs0LO1_I.js";import{P as I}from"./x-Yu7IY3ea.js";import{P as M}from"./pencil-DBXkFcMj.js";import"./query-keys-Ddm69Sh0.js";function U(i){return Object.entries(i).map(([c,u])=>`${c}: ${JSON.stringify(u)}`).join(", ")}const g={CLAUDE_CODE:"Claude Code",GEMINI_CLI:"Gemini CLI",CURSOR_AGENT:"Cursor Agent"};function q(){const{data:i,isLoading:c}=J(),{data:u}=V(),d=$(),v=L(),[r,a]=o.useState(null),[f,x]=o.useState(""),[m,p]=o.useState(""),[h,l]=o.useState(""),C=(t,s,n)=>{a({agentType:t,variant:s,config:n,isNew:!1}),p(s),x(JSON.stringify(n,null,2)),l("")},S=t=>{a({agentType:t,variant:"",config:{},isNew:!0}),p(""),x(`{
2
2
 
3
3
  }`),l("")},E=()=>{if(!(!r||!m.trim()))try{const t=JSON.parse(f);l(""),d.mutate({agentType:r.agentType,variant:m.trim().toUpperCase(),config:t},{onSuccess:()=>a(null)})}catch{l("JSON 格式错误")}},w=(t,s)=>{confirm(`确定删除 ${t} / ${s}?`)&&v.mutate({agentType:t,variant:s})},y=(t,s)=>!!u?.executors[t]?.[s];if(c)return e.jsx("div",{className:"p-6 text-sm text-neutral-400",children:"加载中..."});const O=i?.executors??{};return e.jsxs("div",{className:"px-10 py-6 mx-auto w-full max-w-3xl",children:[Object.entries(O).map(([t,s])=>e.jsxs("div",{className:"mb-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h3",{className:"text-[13px] font-semibold text-neutral-900",children:g[t]??t}),e.jsxs("button",{onClick:()=>S(t),className:"flex items-center gap-1 text-xs text-neutral-400 hover:text-neutral-900 transition-colors",children:[e.jsx(I,{size:12}),e.jsx("span",{children:"新增"})]})]}),e.jsx("div",{className:"border border-neutral-100 rounded-lg overflow-hidden",children:Object.entries(s).map(([n,b],P,k)=>{const j=y(t,n);return e.jsxs("div",{className:`flex items-center gap-3 px-4 py-2.5 hover:bg-neutral-50 transition-colors group ${P<k.length-1?"border-b border-neutral-100":""}`,children:[e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded text-[11px] font-semibold tracking-wide ${n==="DEFAULT"?"bg-blue-50 text-blue-600":"bg-neutral-50 text-neutral-600"}`,children:n}),e.jsx("span",{className:"flex-1 text-[12px] text-neutral-400 font-mono truncate",children:U(b)}),j&&e.jsx("span",{className:"text-[11px] text-neutral-300 font-medium",children:"内置"}),e.jsxs("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[e.jsx("button",{onClick:()=>C(t,n,b),className:"p-1 text-neutral-300 hover:text-neutral-700 rounded transition-colors",children:e.jsx(M,{size:13})}),!j&&e.jsx("button",{onClick:()=>w(t,n),className:"p-1 text-neutral-300 hover:text-red-500 rounded transition-colors",children:e.jsx(A,{size:13})})]})]},n)})})]},t)),e.jsx(D,{isOpen:!!r,onClose:()=>a(null),title:r?.isNew?`新增 Variant — ${g[r.agentType]??r.agentType}`:`编辑 ${r?.variant}`,action:e.jsxs(e.Fragment,{children:[e.jsx(N,{variant:"outline",onClick:()=>a(null),children:"取消"}),e.jsx(N,{onClick:E,disabled:d.isPending,children:d.isPending?"保存中...":"保存"})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[13px] font-medium text-neutral-700 mb-1",children:"Variant 名称"}),e.jsx("input",{type:"text",value:m,onChange:t=>p(t.target.value),disabled:!r?.isNew,placeholder:"例如: CUSTOM",className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:ring-1 focus:ring-neutral-300 disabled:bg-neutral-50 disabled:text-neutral-500 font-mono"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[13px] font-medium text-neutral-700 mb-1",children:"配置 (JSON)"}),e.jsx("textarea",{value:f,onChange:t=>{x(t.target.value),l("")},rows:6,className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm font-mono focus:outline-none focus:ring-1 focus:ring-neutral-300 resize-none"}),h&&e.jsx("p",{className:"mt-1 text-xs text-red-500",children:h})]})]})})]})}export{q as ProfileSettingsPage};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/modal-BCL0660p.js","assets/index-hdGFeHu1.js","assets/index-Br9066ZX.css","assets/api-client-iFY2ykuZ.js","assets/x-Bn5zgMLL.js","assets/folder-picker-DshGpYNS.js","assets/mermaid-NOHMQCX5-CQLrOBEw.js","assets/log-adapter-50wgehrc.js","assets/chevron-down-CxTrrnvp.js","assets/mermaid-NOHMQCX5-lI9o3AWT.css","assets/loader-circle-BYF33K7x.js","assets/circle-alert-CHDHEO67.js","assets/use-projects-BLI6qXx-.js","assets/query-keys-B2VhRmAm.js"])))=>i.map(i=>d[i]);
2
- import{z as Pr,A as wo,B as Eo,a as ko,q as tr,d as Ro,D as Do,u as Ie,r as R,n as To,c as ve,R as ee,E as Rt,j as a,s as ht,S as We,C as nt,i as Yt,g as Vt,G as Fi,H as jo,y as Lo,L as Or,_ as Hi}from"./index-hdGFeHu1.js";import{Q as dr,b as Ao,c as No,e as Mo,d as Po,f as Oo,s as Br,g as Ir,w as Bo,h as Io,i as Fo,a as Ge,q as ce,u as at}from"./query-keys-B2VhRmAm.js";import{C as kt,h as fr,b as pr,d as mr,c as vr,i as gr,G as Es,u as zi,a as Wi,Q as $i,e as Ui,T as qi,P as ds,f as Ki,S as Fr}from"./mermaid-NOHMQCX5-CQLrOBEw.js";import{C as gt,a as fs}from"./chevron-down-CxTrrnvp.js";import{P as sr,X as ks}from"./x-Bn5zgMLL.js";import{u as _r,C as Ho,S as Oe,T as it,A as is}from"./use-providers-C1i5uxRH.js";import"./log-adapter-50wgehrc.js";import{a as be,c as Se,B as ot,t as Xi}from"./api-client-iFY2ykuZ.js";import{F as zo,a as Wo,c as $o,u as Uo,d as qo}from"./use-projects-BLI6qXx-.js";import{L as Be}from"./loader-circle-BYF33K7x.js";import{M as Rs,T as Yi}from"./modal-BCL0660p.js";import{S as ns}from"./select-WuDnj3zN.js";var Ko=class extends dr{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:Pr()})}getOptimisticResult(e){return e.behavior=Pr(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:s}=e,l=super.createResult(e,t),{isFetching:m,isRefetching:b,isError:C,isRefetchError:r}=l,i=s.fetchMeta?.fetchMore?.direction,c=C&&i==="forward",d=m&&i==="forward",o=C&&i==="backward",p=m&&i==="backward";return{...l,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Eo(t,s.data),hasPreviousPage:wo(t,s.data),isFetchNextPageError:c,isFetchingNextPage:d,isFetchPreviousPageError:o,isFetchingPreviousPage:p,isRefetchError:r&&!c&&!o,isRefetching:b&&!d&&!p}}};function Hr(e,t){const s=new Set(t);return e.filter(l=>!s.has(l))}function Xo(e,t,s){const l=e.slice(0);return l[t]=s,l}var Yo=class extends ko{#r;#e;#i;#n;#t;#s;#o;#a;#l;#c=[];constructor(e,t,s){super(),this.#r=e,this.#n=s,this.#i=[],this.#t=[],this.#e=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#t.forEach(e=>{e.subscribe(t=>{this.#f(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach(e=>{e.destroy()})}setQueries(e,t){this.#i=e,this.#n=t,tr.batch(()=>{const s=this.#t,l=this.#d(this.#i);l.forEach(d=>d.observer.setOptions(d.defaultedQueryOptions));const m=l.map(d=>d.observer),b=m.map(d=>d.getCurrentResult()),C=s.length!==m.length,r=m.some((d,o)=>d!==s[o]),i=C||r,c=i?!0:b.some((d,o)=>{const p=this.#e[o];return!p||!Ro(d,p)});!i&&!c||(i&&(this.#c=l,this.#t=m),this.#e=b,this.hasListeners()&&(i&&(Hr(s,m).forEach(d=>{d.destroy()}),Hr(m,s).forEach(d=>{d.subscribe(o=>{this.#f(d,o)})})),this.#p()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(e=>e.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(e,t){const s=this.#d(e),l=s.map(b=>b.observer.getOptimisticResult(b.defaultedQueryOptions)),m=s.map(b=>b.defaultedQueryOptions.queryHash);return[l,b=>this.#u(b??l,t,m),()=>this.#h(l,s)]}#h(e,t){return t.map((s,l)=>{const m=e[l];return s.defaultedQueryOptions.notifyOnChangeProps?m:s.observer.trackResult(m,b=>{t.forEach(C=>{C.observer.trackProp(b)})})})}#u(e,t,s){if(t){const l=this.#l,m=s!==void 0&&l!==void 0&&(l.length!==s.length||s.some((b,C)=>b!==l[C]));return(!this.#s||this.#e!==this.#a||m||t!==this.#o)&&(this.#o=t,this.#a=this.#e,s!==void 0&&(this.#l=s),this.#s=Do(this.#s,t(e))),this.#s}return e}#d(e){const t=new Map;this.#t.forEach(l=>{const m=l.options.queryHash;if(!m)return;const b=t.get(m);b?b.push(l):t.set(m,[l])});const s=[];return e.forEach(l=>{const m=this.#r.defaultQueryOptions(l),C=t.get(m.queryHash)?.shift()??new dr(this.#r,m);s.push({defaultedQueryOptions:m,observer:C})}),s}#f(e,t){const s=this.#t.indexOf(e);s!==-1&&(this.#e=Xo(this.#e,s,t),this.#p())}#p(){if(this.hasListeners()){const e=this.#s,t=this.#h(this.#e,this.#c),s=this.#u(t,this.#n?.combine);e!==s&&tr.batch(()=>{this.listeners.forEach(l=>{l(this.#e)})})}}};function Vo({queries:e,...t},s){const l=Ie(),m=Ao(),b=No(),C=R.useMemo(()=>e.map(g=>{const n=l.defaultQueryOptions(g);return n._optimisticResults=m?"isRestoring":"optimistic",n}),[e,l,m]);C.forEach(g=>{Mo(g);const n=l.getQueryCache().get(g.queryHash);Po(g,b,n)}),Oo(b);const[r]=R.useState(()=>new Yo(l,C,t)),[i,c,d]=r.getOptimisticResult(C,t.combine),o=!m&&t.subscribed!==!1;R.useSyncExternalStore(R.useCallback(g=>o?r.subscribe(tr.batchCalls(g)):To,[r,o]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),R.useEffect(()=>{r.setQueries(C,t)},[C,t,r]);const _=i.some((g,n)=>Br(C[n],g))?i.flatMap((g,n)=>{const f=C[n];if(f){const h=new dr(l,f);if(Br(f,g))return Ir(f,h,b);Bo(g,m)&&Ir(f,h,b)}return[]}):[];if(_.length>0)throw Promise.all(_);const S=i.find((g,n)=>{const f=C[n];return f&&Io({result:g,errorResetBoundary:b,throwOnError:f.throwOnError,query:l.getQueryCache().get(f.queryHash),suspense:f.suspense})});if(S?.error)throw S.error;return c(d())}function Vi(e,t){return Fo(e,Ko)}const Go=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Gi=ve("arrow-down",Go);const Qo=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Qi=ve("arrow-right",Qo);const Zo=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Zi=ve("arrow-up",Zo);const Jo=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],zr=ve("circle-check-big",Jo);const ea=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],Ds=ve("code-xml",ea);const ta=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Wr=ve("copy",ta);const sa=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],Ji=ve("ellipsis-vertical",sa);const ra=[["path",{d:"M14 22h4a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v6",key:"14cnrg"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M5 14a1 1 0 0 0-1 1v2a1 1 0 0 1-1 1 1 1 0 0 1 1 1v2a1 1 0 0 0 1 1",key:"sr0ebq"}],["path",{d:"M9 22a1 1 0 0 0 1-1v-2a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-2a1 1 0 0 0-1-1",key:"w793db"}]],ia=ve("file-braces-corner",ra);const na=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],Wt=ve("file-code-corner",na);const oa=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aa=ve("file-exclamation-point",oa);const la=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],en=ve("file-text",la);const ca=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],tn=ve("folder-open",ca);const ha=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],ua=ve("gauge",ha);const da=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],fa=ve("git-branch",da);const pa=[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]],ma=ve("git-fork",pa);const va=[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v6",key:"158jrl"}],["circle",{cx:"5",cy:"18",r:"3",key:"104gr9"}],["path",{d:"M12 3v18",key:"108xh3"}],["circle",{cx:"19",cy:"6",r:"3",key:"108a5v"}],["path",{d:"M16 15.7A9 9 0 0 0 19 9",key:"1e3vqb"}]],$t=ve("git-graph",va);const ga=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]],sn=ve("git-merge",ga);const _a=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],At=ve("history",_a);const ba=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],br=ve("image",ba);const xa=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],$r=ve("layers",xa);const Sa=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],ya=ve("maximize",Sa);const Ca=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],wa=ve("message-square",Ca);const Ea=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],ka=ve("panel-left-close",Ea);const Ra=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],Da=ve("panel-left-open",Ra);const Ta=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],ja=ve("panel-right-close",Ta);const La=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],Aa=ve("panel-right-open",La);const Na=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],jt=ve("play",Na);const Ma=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Pa=ve("refresh-cw",Ma);const Oa=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],Ba=ve("shield",Oa);const Ia=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],ps=ve("terminal",Ia);const Fa=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],xr=ve("triangle-alert",Fa);const Ha=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],za=ve("zap",Ha);const Wa=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],$a=ve("zoom-in",Wa);const Ua=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],qa=ve("zoom-out",Ua),Ts=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Nt(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Sr(e){return"nodeType"in e}function Ye(e){var t,s;return e?Nt(e)?e:Sr(e)&&(t=(s=e.ownerDocument)==null?void 0:s.defaultView)!=null?t:window:window}function yr(e){const{Document:t}=Ye(e);return e instanceof t}function Gt(e){return Nt(e)?!1:e instanceof Ye(e).HTMLElement}function rn(e){return e instanceof Ye(e).SVGElement}function Mt(e){return e?Nt(e)?e.document:Sr(e)?yr(e)?e:Gt(e)||rn(e)?e.ownerDocument:document:document:document}const ut=Ts?R.useLayoutEffect:R.useEffect;function js(e){const t=R.useRef(e);return ut(()=>{t.current=e}),R.useCallback(function(){for(var s=arguments.length,l=new Array(s),m=0;m<s;m++)l[m]=arguments[m];return t.current==null?void 0:t.current(...l)},[])}function Ka(){const e=R.useRef(null),t=R.useCallback((l,m)=>{e.current=setInterval(l,m)},[]),s=R.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,s]}function Ut(e,t){t===void 0&&(t=[e]);const s=R.useRef(e);return ut(()=>{s.current!==e&&(s.current=e)},t),s}function Qt(e,t){const s=R.useRef();return R.useMemo(()=>{const l=e(s.current);return s.current=l,l},[...t])}function ms(e){const t=js(e),s=R.useRef(null),l=R.useCallback(m=>{m!==s.current&&t?.(m,s.current),s.current=m},[]);return[s,l]}function vs(e){const t=R.useRef();return R.useEffect(()=>{t.current=e},[e]),t.current}let Hs={};function Ls(e,t){return R.useMemo(()=>{if(t)return t;const s=Hs[e]==null?0:Hs[e]+1;return Hs[e]=s,e+"-"+s},[e,t])}function nn(e){return function(t){for(var s=arguments.length,l=new Array(s>1?s-1:0),m=1;m<s;m++)l[m-1]=arguments[m];return l.reduce((b,C)=>{const r=Object.entries(C);for(const[i,c]of r){const d=b[i];d!=null&&(b[i]=d+e*c)}return b},{...t})}}const Lt=nn(1),gs=nn(-1);function Xa(e){return"clientX"in e&&"clientY"in e}function Cr(e){if(!e)return!1;const{KeyboardEvent:t}=Ye(e.target);return t&&e instanceof t}function Ya(e){if(!e)return!1;const{TouchEvent:t}=Ye(e.target);return t&&e instanceof t}function _s(e){if(Ya(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:s}=e.touches[0];return{x:t,y:s}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:s}=e.changedTouches[0];return{x:t,y:s}}}return Xa(e)?{x:e.clientX,y:e.clientY}:null}const qt=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:s}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(s?Math.round(s):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:s}=e;return"scaleX("+t+") scaleY("+s+")"}},Transform:{toString(e){if(e)return[qt.Translate.toString(e),qt.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:s,easing:l}=e;return t+" "+s+"ms "+l}}}),Ur="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Va(e){return e.matches(Ur)?e:e.querySelector(Ur)}const Ga={display:"none"};function Qa(e){let{id:t,value:s}=e;return ee.createElement("div",{id:t,style:Ga},s)}function Za(e){let{id:t,announcement:s,ariaLiveType:l="assertive"}=e;const m={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return ee.createElement("div",{id:t,style:m,role:"status","aria-live":l,"aria-atomic":!0},s)}function Ja(){const[e,t]=R.useState("");return{announce:R.useCallback(l=>{l!=null&&t(l)},[]),announcement:e}}const on=R.createContext(null);function el(e){const t=R.useContext(on);R.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function tl(){const[e]=R.useState(()=>new Set),t=R.useCallback(l=>(e.add(l),()=>e.delete(l)),[e]);return[R.useCallback(l=>{let{type:m,event:b}=l;e.forEach(C=>{var r;return(r=C[m])==null?void 0:r.call(C,b)})},[e]),t]}const sl={draggable:`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/modal-Cs0LO1_I.js","assets/index-DFLmhfiK.js","assets/index-Br9066ZX.css","assets/api-client-CvkWGC57.js","assets/x-Yu7IY3ea.js","assets/folder-picker-BNSXB4UX.js","assets/mermaid-NOHMQCX5-BCuuUgP6.js","assets/log-adapter-50wgehrc.js","assets/chevron-down-gMypHmvg.js","assets/mermaid-NOHMQCX5-lI9o3AWT.css","assets/loader-circle-DkuE984n.js","assets/circle-alert-R4XXB7n4.js","assets/use-projects-Cnz3uQZV.js","assets/query-keys-Ddm69Sh0.js"])))=>i.map(i=>d[i]);
2
+ import{z as Pr,A as wo,B as Eo,a as ko,q as tr,d as Ro,D as Do,u as Ie,r as R,n as To,c as ve,R as ee,E as Rt,j as a,s as ht,S as We,C as nt,i as Yt,g as Vt,G as Fi,H as jo,y as Lo,L as Or,_ as Hi}from"./index-DFLmhfiK.js";import{Q as dr,b as Ao,c as No,e as Mo,d as Po,f as Oo,s as Br,g as Ir,w as Bo,h as Io,i as Fo,a as Ge,q as ce,u as at}from"./query-keys-Ddm69Sh0.js";import{C as kt,h as fr,b as pr,d as mr,c as vr,i as gr,G as Es,u as zi,a as Wi,Q as $i,e as Ui,T as qi,P as ds,f as Ki,S as Fr}from"./mermaid-NOHMQCX5-BCuuUgP6.js";import{C as gt,a as fs}from"./chevron-down-gMypHmvg.js";import{P as sr,X as ks}from"./x-Yu7IY3ea.js";import{u as _r,C as Ho,S as Oe,T as it,A as is}from"./use-providers-BkyYy5Sg.js";import"./log-adapter-50wgehrc.js";import{a as be,c as Se,B as ot,t as Xi}from"./api-client-CvkWGC57.js";import{F as zo,a as Wo,c as $o,u as Uo,d as qo}from"./use-projects-Cnz3uQZV.js";import{L as Be}from"./loader-circle-DkuE984n.js";import{M as Rs,T as Yi}from"./modal-Cs0LO1_I.js";import{S as ns}from"./select-CXYXolOw.js";var Ko=class extends dr{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:Pr()})}getOptimisticResult(e){return e.behavior=Pr(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:s}=e,l=super.createResult(e,t),{isFetching:m,isRefetching:b,isError:C,isRefetchError:r}=l,i=s.fetchMeta?.fetchMore?.direction,c=C&&i==="forward",d=m&&i==="forward",o=C&&i==="backward",p=m&&i==="backward";return{...l,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Eo(t,s.data),hasPreviousPage:wo(t,s.data),isFetchNextPageError:c,isFetchingNextPage:d,isFetchPreviousPageError:o,isFetchingPreviousPage:p,isRefetchError:r&&!c&&!o,isRefetching:b&&!d&&!p}}};function Hr(e,t){const s=new Set(t);return e.filter(l=>!s.has(l))}function Xo(e,t,s){const l=e.slice(0);return l[t]=s,l}var Yo=class extends ko{#r;#e;#i;#n;#t;#s;#o;#a;#l;#c=[];constructor(e,t,s){super(),this.#r=e,this.#n=s,this.#i=[],this.#t=[],this.#e=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#t.forEach(e=>{e.subscribe(t=>{this.#f(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach(e=>{e.destroy()})}setQueries(e,t){this.#i=e,this.#n=t,tr.batch(()=>{const s=this.#t,l=this.#d(this.#i);l.forEach(d=>d.observer.setOptions(d.defaultedQueryOptions));const m=l.map(d=>d.observer),b=m.map(d=>d.getCurrentResult()),C=s.length!==m.length,r=m.some((d,o)=>d!==s[o]),i=C||r,c=i?!0:b.some((d,o)=>{const p=this.#e[o];return!p||!Ro(d,p)});!i&&!c||(i&&(this.#c=l,this.#t=m),this.#e=b,this.hasListeners()&&(i&&(Hr(s,m).forEach(d=>{d.destroy()}),Hr(m,s).forEach(d=>{d.subscribe(o=>{this.#f(d,o)})})),this.#p()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(e=>e.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(e,t){const s=this.#d(e),l=s.map(b=>b.observer.getOptimisticResult(b.defaultedQueryOptions)),m=s.map(b=>b.defaultedQueryOptions.queryHash);return[l,b=>this.#u(b??l,t,m),()=>this.#h(l,s)]}#h(e,t){return t.map((s,l)=>{const m=e[l];return s.defaultedQueryOptions.notifyOnChangeProps?m:s.observer.trackResult(m,b=>{t.forEach(C=>{C.observer.trackProp(b)})})})}#u(e,t,s){if(t){const l=this.#l,m=s!==void 0&&l!==void 0&&(l.length!==s.length||s.some((b,C)=>b!==l[C]));return(!this.#s||this.#e!==this.#a||m||t!==this.#o)&&(this.#o=t,this.#a=this.#e,s!==void 0&&(this.#l=s),this.#s=Do(this.#s,t(e))),this.#s}return e}#d(e){const t=new Map;this.#t.forEach(l=>{const m=l.options.queryHash;if(!m)return;const b=t.get(m);b?b.push(l):t.set(m,[l])});const s=[];return e.forEach(l=>{const m=this.#r.defaultQueryOptions(l),C=t.get(m.queryHash)?.shift()??new dr(this.#r,m);s.push({defaultedQueryOptions:m,observer:C})}),s}#f(e,t){const s=this.#t.indexOf(e);s!==-1&&(this.#e=Xo(this.#e,s,t),this.#p())}#p(){if(this.hasListeners()){const e=this.#s,t=this.#h(this.#e,this.#c),s=this.#u(t,this.#n?.combine);e!==s&&tr.batch(()=>{this.listeners.forEach(l=>{l(this.#e)})})}}};function Vo({queries:e,...t},s){const l=Ie(),m=Ao(),b=No(),C=R.useMemo(()=>e.map(g=>{const n=l.defaultQueryOptions(g);return n._optimisticResults=m?"isRestoring":"optimistic",n}),[e,l,m]);C.forEach(g=>{Mo(g);const n=l.getQueryCache().get(g.queryHash);Po(g,b,n)}),Oo(b);const[r]=R.useState(()=>new Yo(l,C,t)),[i,c,d]=r.getOptimisticResult(C,t.combine),o=!m&&t.subscribed!==!1;R.useSyncExternalStore(R.useCallback(g=>o?r.subscribe(tr.batchCalls(g)):To,[r,o]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),R.useEffect(()=>{r.setQueries(C,t)},[C,t,r]);const _=i.some((g,n)=>Br(C[n],g))?i.flatMap((g,n)=>{const f=C[n];if(f){const h=new dr(l,f);if(Br(f,g))return Ir(f,h,b);Bo(g,m)&&Ir(f,h,b)}return[]}):[];if(_.length>0)throw Promise.all(_);const S=i.find((g,n)=>{const f=C[n];return f&&Io({result:g,errorResetBoundary:b,throwOnError:f.throwOnError,query:l.getQueryCache().get(f.queryHash),suspense:f.suspense})});if(S?.error)throw S.error;return c(d())}function Vi(e,t){return Fo(e,Ko)}const Go=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Gi=ve("arrow-down",Go);const Qo=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Qi=ve("arrow-right",Qo);const Zo=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Zi=ve("arrow-up",Zo);const Jo=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],zr=ve("circle-check-big",Jo);const ea=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],Ds=ve("code-xml",ea);const ta=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Wr=ve("copy",ta);const sa=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],Ji=ve("ellipsis-vertical",sa);const ra=[["path",{d:"M14 22h4a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v6",key:"14cnrg"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M5 14a1 1 0 0 0-1 1v2a1 1 0 0 1-1 1 1 1 0 0 1 1 1v2a1 1 0 0 0 1 1",key:"sr0ebq"}],["path",{d:"M9 22a1 1 0 0 0 1-1v-2a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-2a1 1 0 0 0-1-1",key:"w793db"}]],ia=ve("file-braces-corner",ra);const na=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],Wt=ve("file-code-corner",na);const oa=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aa=ve("file-exclamation-point",oa);const la=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],en=ve("file-text",la);const ca=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],tn=ve("folder-open",ca);const ha=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],ua=ve("gauge",ha);const da=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],fa=ve("git-branch",da);const pa=[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]],ma=ve("git-fork",pa);const va=[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v6",key:"158jrl"}],["circle",{cx:"5",cy:"18",r:"3",key:"104gr9"}],["path",{d:"M12 3v18",key:"108xh3"}],["circle",{cx:"19",cy:"6",r:"3",key:"108a5v"}],["path",{d:"M16 15.7A9 9 0 0 0 19 9",key:"1e3vqb"}]],$t=ve("git-graph",va);const ga=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]],sn=ve("git-merge",ga);const _a=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],At=ve("history",_a);const ba=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],br=ve("image",ba);const xa=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],$r=ve("layers",xa);const Sa=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],ya=ve("maximize",Sa);const Ca=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],wa=ve("message-square",Ca);const Ea=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],ka=ve("panel-left-close",Ea);const Ra=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],Da=ve("panel-left-open",Ra);const Ta=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],ja=ve("panel-right-close",Ta);const La=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],Aa=ve("panel-right-open",La);const Na=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],jt=ve("play",Na);const Ma=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Pa=ve("refresh-cw",Ma);const Oa=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],Ba=ve("shield",Oa);const Ia=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],ps=ve("terminal",Ia);const Fa=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],xr=ve("triangle-alert",Fa);const Ha=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],za=ve("zap",Ha);const Wa=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],$a=ve("zoom-in",Wa);const Ua=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],qa=ve("zoom-out",Ua),Ts=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Nt(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Sr(e){return"nodeType"in e}function Ye(e){var t,s;return e?Nt(e)?e:Sr(e)&&(t=(s=e.ownerDocument)==null?void 0:s.defaultView)!=null?t:window:window}function yr(e){const{Document:t}=Ye(e);return e instanceof t}function Gt(e){return Nt(e)?!1:e instanceof Ye(e).HTMLElement}function rn(e){return e instanceof Ye(e).SVGElement}function Mt(e){return e?Nt(e)?e.document:Sr(e)?yr(e)?e:Gt(e)||rn(e)?e.ownerDocument:document:document:document}const ut=Ts?R.useLayoutEffect:R.useEffect;function js(e){const t=R.useRef(e);return ut(()=>{t.current=e}),R.useCallback(function(){for(var s=arguments.length,l=new Array(s),m=0;m<s;m++)l[m]=arguments[m];return t.current==null?void 0:t.current(...l)},[])}function Ka(){const e=R.useRef(null),t=R.useCallback((l,m)=>{e.current=setInterval(l,m)},[]),s=R.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,s]}function Ut(e,t){t===void 0&&(t=[e]);const s=R.useRef(e);return ut(()=>{s.current!==e&&(s.current=e)},t),s}function Qt(e,t){const s=R.useRef();return R.useMemo(()=>{const l=e(s.current);return s.current=l,l},[...t])}function ms(e){const t=js(e),s=R.useRef(null),l=R.useCallback(m=>{m!==s.current&&t?.(m,s.current),s.current=m},[]);return[s,l]}function vs(e){const t=R.useRef();return R.useEffect(()=>{t.current=e},[e]),t.current}let Hs={};function Ls(e,t){return R.useMemo(()=>{if(t)return t;const s=Hs[e]==null?0:Hs[e]+1;return Hs[e]=s,e+"-"+s},[e,t])}function nn(e){return function(t){for(var s=arguments.length,l=new Array(s>1?s-1:0),m=1;m<s;m++)l[m-1]=arguments[m];return l.reduce((b,C)=>{const r=Object.entries(C);for(const[i,c]of r){const d=b[i];d!=null&&(b[i]=d+e*c)}return b},{...t})}}const Lt=nn(1),gs=nn(-1);function Xa(e){return"clientX"in e&&"clientY"in e}function Cr(e){if(!e)return!1;const{KeyboardEvent:t}=Ye(e.target);return t&&e instanceof t}function Ya(e){if(!e)return!1;const{TouchEvent:t}=Ye(e.target);return t&&e instanceof t}function _s(e){if(Ya(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:s}=e.touches[0];return{x:t,y:s}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:s}=e.changedTouches[0];return{x:t,y:s}}}return Xa(e)?{x:e.clientX,y:e.clientY}:null}const qt=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:s}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(s?Math.round(s):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:s}=e;return"scaleX("+t+") scaleY("+s+")"}},Transform:{toString(e){if(e)return[qt.Translate.toString(e),qt.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:s,easing:l}=e;return t+" "+s+"ms "+l}}}),Ur="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Va(e){return e.matches(Ur)?e:e.querySelector(Ur)}const Ga={display:"none"};function Qa(e){let{id:t,value:s}=e;return ee.createElement("div",{id:t,style:Ga},s)}function Za(e){let{id:t,announcement:s,ariaLiveType:l="assertive"}=e;const m={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return ee.createElement("div",{id:t,style:m,role:"status","aria-live":l,"aria-atomic":!0},s)}function Ja(){const[e,t]=R.useState("");return{announce:R.useCallback(l=>{l!=null&&t(l)},[]),announcement:e}}const on=R.createContext(null);function el(e){const t=R.useContext(on);R.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function tl(){const[e]=R.useState(()=>new Set),t=R.useCallback(l=>(e.add(l),()=>e.delete(l)),[e]);return[R.useCallback(l=>{let{type:m,event:b}=l;e.forEach(C=>{var r;return(r=C[m])==null?void 0:r.call(C,b)})},[e]),t]}const sl={draggable:`
3
3
  To pick up a draggable item, press the space bar.
4
4
  While dragging, use the arrow keys to move the item.
5
5
  Press space again to drop the item in its new position, or press escape to cancel.
@@ -78,7 +78,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
78
78
  `);return a.jsx("div",{className:"overflow-x-auto bg-neutral-950 rounded-lg mx-3 mb-3 font-mono text-[11px] leading-5",children:r.map((i,c)=>{let d="",o="text-neutral-400";return i.startsWith("+")&&!i.startsWith("+++")?(d="bg-emerald-950/40",o="text-emerald-400"):i.startsWith("-")&&!i.startsWith("---")?(d="bg-red-950/40",o="text-red-400"):i.startsWith("@@")&&(d="bg-blue-950/30",o="text-blue-400"),a.jsx("div",{className:Se("px-3 whitespace-pre",d,o),children:i},c)})})}function Yf({entry:e,type:t,workingDir:s}){const[l,m]=R.useState(!1),b=Ti[e.status]||Ti.M,C=Kf(e.path);return a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>m(r=>!r),className:Se("flex items-center gap-2.5 w-full px-4 py-3 text-left active:bg-neutral-50",l&&"bg-neutral-50"),children:[a.jsx("span",{className:Se("w-5 h-5 flex items-center justify-center text-[10px] font-bold border rounded shrink-0",b),children:e.status}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("span",{className:"text-sm text-neutral-900 truncate block",children:qf(e.path)}),C&&a.jsx("span",{className:"text-[11px] text-neutral-400 truncate block",children:C})]}),a.jsx("span",{className:"text-neutral-400 shrink-0",children:l?a.jsx(gt,{size:14}):a.jsx(kt,{size:14})})]}),l&&a.jsx(Xf,{workingDir:s,filePath:e.path,type:t})]})}function ji({title:e,entries:t,type:s,workingDir:l,defaultOpen:m}){const[b,C]=R.useState(m);return t.length===0?null:a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>C(r=>!r),className:"flex items-center gap-2 w-full px-4 py-2.5 active:bg-neutral-50",children:[a.jsx("span",{className:"text-neutral-400",children:b?a.jsx(gt,{size:14}):a.jsx(kt,{size:14})}),a.jsx("span",{className:"text-xs font-semibold text-neutral-500 uppercase tracking-wider",children:e}),a.jsx("span",{className:"text-[10px] bg-neutral-100 px-1.5 py-0.5 rounded text-neutral-500",children:t.length})]}),b&&a.jsx("div",{className:"divide-y divide-neutral-100",children:t.map(r=>a.jsx(Yf,{entry:r,type:s,workingDir:l},`${s}:${r.path}`))})]})}function Vf({workingDir:e}){const{data:t,isLoading:s,isError:l}=Qn(e);if(!e)return a.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-400 text-sm",children:"No workspace selected."});if(s)return a.jsxs("div",{className:"flex-1 flex items-center justify-center text-neutral-400",children:[a.jsx(Be,{size:16,className:"animate-spin mr-2"}),a.jsx("span",{className:"text-sm",children:"Loading changes..."})]});if(l)return a.jsx("div",{className:"flex-1 flex items-center justify-center text-red-500 text-sm",children:"Failed to load changes."});const m=t?.uncommitted||[],b=t?.committed||[];return m.length+b.length===0?a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-neutral-400 py-16",children:[a.jsx($t,{size:28,className:"mb-3"}),a.jsx("span",{className:"text-sm",children:"No pending changes"})]}):a.jsxs("div",{className:"flex-1 overflow-y-auto overscroll-y-contain",children:[a.jsx(ji,{title:"Uncommitted",entries:m,type:"uncommitted",workingDir:e,defaultOpen:!0}),a.jsx(ji,{title:"Committed",entries:b,type:"committed",workingDir:e,defaultOpen:!1})]})}const Js=50,Li={M:"text-amber-600 border-amber-200 bg-amber-50",A:"text-emerald-600 border-emerald-200 bg-emerald-50",D:"text-red-600 border-red-200 bg-red-50",R:"text-blue-600 border-blue-200 bg-blue-50"};function Gf(e){const s=Math.floor(Date.now()/1e3)-e;return s<60?`${s}s ago`:s<3600?`${Math.floor(s/60)}m ago`:s<86400?`${Math.floor(s/3600)}h ago`:s<604800?`${Math.floor(s/86400)}d ago`:new Date(e*1e3).toLocaleDateString()}function Qf(e){const t=e.split("/");return t[t.length-1]||e}function Zf(e){const t=e.lastIndexOf("/");return t>0?e.slice(0,t):""}function Jf({workingDir:e,hash:t,filePath:s}){const{data:l,isLoading:m,isError:b}=eo(e,t,s);if(m)return a.jsxs("div",{className:"flex items-center gap-2 px-3 py-4 text-neutral-400",children:[a.jsx(Be,{size:14,className:"animate-spin"}),a.jsx("span",{className:"text-xs",children:"Loading diff..."})]});if(b)return a.jsx("div",{className:"px-3 py-3 text-xs text-red-500",children:"Failed to load diff."});const C=l?.diff||"";if(!C.trim())return a.jsx("div",{className:"px-3 py-3 text-xs text-neutral-400",children:"No diff content."});const r=C.split(`
79
79
  `);return a.jsx("div",{className:"overflow-x-auto bg-neutral-950 rounded-lg mx-3 mb-3 font-mono text-[11px] leading-5",children:r.map((i,c)=>{let d="",o="text-neutral-400";return i.startsWith("+")&&!i.startsWith("+++")?(d="bg-emerald-950/40",o="text-emerald-400"):i.startsWith("-")&&!i.startsWith("---")?(d="bg-red-950/40",o="text-red-400"):i.startsWith("@@")&&(d="bg-blue-950/30",o="text-blue-400"),a.jsx("div",{className:Se("px-3 whitespace-pre",d,o),children:i},c)})})}function ep({entry:e,workingDir:t,hash:s}){const[l,m]=R.useState(!1),b=Li[e.status]||Li.M,C=Zf(e.path);return a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>m(r=>!r),className:Se("flex items-center gap-2.5 w-full px-4 py-2.5 text-left active:bg-neutral-50",l&&"bg-neutral-50"),children:[a.jsx("span",{className:Se("w-5 h-5 flex items-center justify-center text-[10px] font-bold border rounded shrink-0",b),children:e.status}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("span",{className:"text-sm text-neutral-900 truncate block",children:Qf(e.path)}),C&&a.jsx("span",{className:"text-[11px] text-neutral-400 truncate block",children:C})]}),a.jsx("span",{className:"text-neutral-400 shrink-0",children:l?a.jsx(gt,{size:14}):a.jsx(kt,{size:14})})]}),l&&a.jsx(Jf,{workingDir:t,hash:s,filePath:e.path})]})}function tp({commit:e,workingDir:t}){const[s,l]=R.useState(!1),{data:m,isLoading:b}=Jn(t,s?e.hash:null),C=m?.files||[];return a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>l(r=>!r),className:Se("flex items-start gap-3 w-full px-4 py-3 text-left active:bg-neutral-50",s&&"bg-neutral-50"),children:[a.jsx("div",{className:"flex flex-col items-center shrink-0 pt-0.5",children:a.jsx("div",{className:Se("w-2.5 h-2.5 rounded-full shrink-0",s?"bg-blue-500":"bg-neutral-300")})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-xs font-mono text-blue-600 shrink-0",children:e.shortHash}),a.jsx("span",{className:"text-sm text-neutral-900 truncate flex-1",children:e.message})]}),a.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[a.jsx("span",{className:"text-[11px] text-neutral-500 truncate",children:e.author}),a.jsx("span",{className:"text-[11px] text-neutral-400",children:Gf(e.timestamp)})]})]}),a.jsx("span",{className:"text-neutral-400 shrink-0 pt-0.5",children:s?a.jsx(gt,{size:14}):a.jsx(kt,{size:14})})]}),s&&a.jsxs("div",{className:"pl-4 border-l-2 border-blue-100 ml-[22px]",children:[e.body&&a.jsx("div",{className:"px-3 py-2 text-xs text-neutral-600 whitespace-pre-wrap leading-4",children:e.body}),b?a.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 text-neutral-400",children:[a.jsx(Be,{size:14,className:"animate-spin"}),a.jsx("span",{className:"text-xs",children:"Loading files..."})]}):C.length===0?a.jsx("div",{className:"px-3 py-3 text-xs text-neutral-400",children:"No files changed"}):a.jsx("div",{className:"divide-y divide-neutral-100",children:C.map(r=>a.jsx(ep,{entry:r,workingDir:t,hash:e.hash},r.path))})]})]})}function sp({workingDir:e}){const{data:t,isLoading:s,isError:l,fetchNextPage:m,hasNextPage:b,isFetchingNextPage:C}=Vi({queryKey:ce.git.log(e||""),queryFn:({pageParam:i=0})=>be.get("/git/log",{params:{workingDir:e||"",limit:String(Js),skip:String(i)}}),initialPageParam:0,getNextPageParam:(i,c)=>i.commits.length<Js?void 0:c.length*Js,enabled:!!e}),r=t?.pages.flatMap(i=>i.commits)||[];return e?s?a.jsxs("div",{className:"flex-1 flex items-center justify-center text-neutral-400",children:[a.jsx(Be,{size:16,className:"animate-spin mr-2"}),a.jsx("span",{className:"text-sm",children:"Loading history..."})]}):l?a.jsx("div",{className:"flex-1 flex items-center justify-center text-red-500 text-sm",children:"Failed to load history."}):r.length===0?a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-neutral-400 py-16",children:[a.jsx(At,{size:28,className:"mb-3"}),a.jsx("span",{className:"text-sm",children:"No commit history"})]}):a.jsxs("div",{className:"flex-1 overflow-y-auto overscroll-y-contain",children:[a.jsx("div",{className:"divide-y divide-neutral-100",children:r.map(i=>a.jsx(tp,{commit:i,workingDir:e},i.hash))}),b&&a.jsx("button",{type:"button",onClick:()=>m(),disabled:C,className:"w-full py-4 text-sm text-neutral-500 active:text-neutral-700 active:bg-neutral-50 flex items-center justify-center gap-2",children:C?a.jsxs(a.Fragment,{children:[a.jsx(Be,{size:14,className:"animate-spin"})," Loading..."]}):"Load more"})]}):a.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-400 text-sm",children:"No workspace selected."})}const rp="/api";function ip(e){if(!Yt())return e;const t=Vt();if(!t)return e;const s=e.includes("?")?"&":"?";return`${e}${s}token=${encodeURIComponent(t)}`}const np=e=>e.includes("://")||e.startsWith("/api/")?e:e.startsWith("/")?ip(`${rp}/attachments/by-path?path=${encodeURIComponent(e)}`):e,op=({src:e,alt:t,...s})=>a.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"inline-block",children:a.jsx("img",{src:e,alt:t,...s,className:"max-w-[300px] max-h-[200px] object-contain rounded-lg border border-neutral-200 cursor-pointer active:opacity-90 transition-opacity"})}),ap={img:op};function lp({status:e}){const t={[le.Running]:"bg-blue-500",[le.Review]:"bg-amber-500",[le.Pending]:"bg-neutral-400",[le.Done]:"bg-emerald-500",[le.Cancelled]:"bg-neutral-400"};return a.jsx("span",{className:`w-2.5 h-2.5 rounded-full ${t[e]}`})}const cp=[{key:"chat",label:"Chat",icon:wa},{key:"changes",label:"Changes",icon:$t},{key:"history",label:"History",icon:At},{key:"workspace",label:"Workspace",icon:tn}];function hp({task:e,onBack:t,onDeleteTask:s,isDeleting:l}){const[m,b]=R.useState("chat"),[C,r]=R.useState(""),[i,c]=R.useState(!1),[d,o]=R.useState(!1),[p,_]=R.useState(!1),S=R.useRef(null),g=R.useRef(null),n=R.useRef(null),{scrollRef:f,contentRef:h,isAtBottom:u,scrollToBottom:v}=Cn({resize:"smooth",initial:"instant"}),x=Ie();R.useEffect(()=>{if(!p)return;const Q=se=>{S.current&&!S.current.contains(se.target)&&_(!1)};return document.addEventListener("mousedown",Q),()=>document.removeEventListener("mousedown",Q)},[p]);const{data:w,isLoading:k}=so(e.id),y=R.useMemo(()=>{if(!w)return null;const Q=w.filter(ne=>ne.status==="ACTIVE"&&Array.isArray(ne.sessions)).flatMap(ne=>ne.sessions??[]),se=ne=>{const ge=ne.createdAt,me=ne.endedAt??ne.startedAt??ge;if(!me)return 0;const ye=Date.parse(me);return Number.isNaN(ye)?0:ye},ue=ne=>{const ge=Q.filter(me=>ne.includes(me.status));return ge.length===0?null:ge.sort((me,ye)=>se(ye)-se(me))[0]??null};return ue([Oe.RUNNING])??ue([Oe.PENDING])??ue([Oe.COMPLETED,Oe.FAILED,Oe.CANCELLED])},[w]),E=y?.id??"",j=y?.status===Oe.RUNNING||y?.status===Oe.PENDING,A=oo(y),L=R.useMemo(()=>{if(w){for(const Q of w)if(Q.status==="ACTIVE"&&Q.worktreePath)return Q.worktreePath;return w[0]?.worktreePath}},[w]),N=R.useMemo(()=>{if(w)return w.find(Q=>Q.status==="ACTIVE")?.id},[w]),B=R.useMemo(()=>{const Q=[];if(w&&w.length>0){const se=w.some(ne=>ne.status==="ACTIVE");w.some(ne=>ne.sessions?.some(ge=>ge.status===Oe.RUNNING||ge.status===Oe.PENDING))&&Q.push("正在运行的 Agent 将被停止"),se&&(Q.push("分支上未合并的变更将丢失"),Q.push("关联的工作目录(worktree)将被清理"))}return Q},[w]),I=Nr(),H=Ar(),W=no(),{isConnected:D,isLoadingSnapshot:M,logs:P,entries:O,attach:U}=zi({sessionId:E,onExit:R.useCallback(()=>{x.invalidateQueries({queryKey:["workspaces"]})},[x])}),{todos:K}=Wi(O),{files:V,addFiles:Y,removeFile:ie,clear:T,buildMarkdownLinks:F,hasFiles:$,isUploading:z}=Mr(),J=R.useMemo(()=>{if(!y?.tokenUsage)return;const Q=y.tokenUsage;if(typeof Q.totalTokens=="number")return Q},[y?.tokenUsage]),X=ao(P,J);R.useEffect(()=>{E&&D&&U()},[E,D,U]),R.useEffect(()=>{v()},[e.id,v]);const oe=R.useRef(!1),he=R.useCallback(async()=>{if(!C.trim()&&!$||!E||oe.current||z)return;oe.current=!0;const Q=F(),se=[C.trim(),Q].filter(Boolean).join(`
80
80
 
81
- `);r(""),T(),g.current&&(g.current.style.height="40px"),I.mutate({id:E,message:se},{onSuccess:()=>U(),onSettled:()=>{oe.current=!1}})},[C,E,I,U,$,z,F,T]),we=R.useCallback(async()=>{E&&(await W.mutateAsync(E),x.invalidateQueries({queryKey:["workspaces"]}))},[E,W,x]),je=R.useCallback(Q=>{const se=Q.target.files;se&&se.length>0&&Y(Array.from(se)),Q.target.value=""},[Y]),Z=R.useCallback(Q=>{const se=Q.clipboardData.items,ue=[];for(const ne of se)if(ne.kind==="file"){const ge=ne.getAsFile();ge&&ue.push(ge)}ue.length>0&&(Q.preventDefault(),Y(ue))},[Y]),ze=R.useCallback(Q=>{r(Q.target.value);const se=Q.target;se.style.height="auto",se.style.height=`${Math.max(40,Math.min(se.scrollHeight,140))}px`},[]),Fe=R.useCallback(()=>{N&&H.mutate({workspaceId:N})},[N,H]),Re=R.useRef(null);return R.useEffect(()=>{const Q=window.visualViewport;if(!Q)return;let se=!1;const ue=()=>{Re.current&&(Re.current.style.height=`${Q.height}px`,Re.current.style.top=`${Q.offsetTop}px`)},ne=()=>ue(),ge=()=>{se||ue()},me=()=>{se=!0},ye=()=>{se=!1,requestAnimationFrame(ue)};return Q.addEventListener("resize",ne),Q.addEventListener("scroll",ge),document.addEventListener("touchstart",me,{passive:!0}),document.addEventListener("touchend",ye,{passive:!0}),document.addEventListener("touchcancel",ye,{passive:!0}),()=>{Q.removeEventListener("resize",ne),Q.removeEventListener("scroll",ge),document.removeEventListener("touchstart",me),document.removeEventListener("touchend",ye),document.removeEventListener("touchcancel",ye)}},[]),R.useEffect(()=>{const Q=Re.current;if(!Q)return;const se=ue=>{let ne=ue.target;for(;ne&&ne!==Q;){if(ne.tagName==="TEXTAREA"){if(ne.scrollHeight>ne.clientHeight)return;ne=ne.parentElement;continue}const me=window.getComputedStyle(ne).overflowY;if((me==="auto"||me==="scroll")&&ne.scrollHeight>ne.clientHeight)return;ne=ne.parentElement}ue.preventDefault()};return Q.addEventListener("touchmove",se,{passive:!1}),()=>Q.removeEventListener("touchmove",se)},[]),a.jsxs("div",{ref:Re,className:"fixed inset-x-0 top-0 flex flex-col h-dvh bg-white overflow-hidden overscroll-none",children:[a.jsxs("header",{className:"shrink-0 bg-white border-b border-neutral-200 z-20",children:[a.jsxs("div",{className:"flex items-center h-11 px-2.5 gap-1.5",children:[a.jsx("button",{onClick:t,className:"p-1.5 -ml-0.5 text-neutral-600 active:text-neutral-900",children:a.jsx(jo,{size:18})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h1",{className:"text-[13px] font-bold text-neutral-900 truncate leading-tight",children:e.title}),a.jsxs("div",{className:"flex items-center gap-1 text-[11px] text-neutral-500 leading-tight",children:[a.jsx("span",{className:`font-medium ${e.projectColor}`,children:e.projectName}),a.jsx("span",{className:"text-neutral-300",children:"/"}),a.jsx("span",{className:"font-mono truncate",children:e.branch})]})]}),a.jsx(lp,{status:e.status}),a.jsx("button",{onClick:Fe,disabled:!N,className:"p-1.5 text-neutral-400 active:text-neutral-900 disabled:opacity-30",children:a.jsx(Ds,{size:16})}),s&&a.jsxs("div",{className:"relative",ref:S,children:[a.jsx("button",{onClick:()=>_(Q=>!Q),className:"p-1.5 text-neutral-400 active:text-neutral-900","aria-label":"More actions",children:a.jsx(Ji,{size:16})}),p&&a.jsx("div",{className:"absolute right-0 top-full mt-1 w-40 bg-white rounded-lg border border-neutral-200 shadow-lg z-50 py-1",children:a.jsxs("button",{onClick:()=>{o(!0),_(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-red-600 active:bg-red-50",children:[a.jsx(Yi,{size:15}),a.jsx("span",{children:"删除任务"})]})})]})]}),a.jsx("div",{className:"flex border-t border-neutral-100",children:cp.map(({key:Q,label:se,icon:ue})=>a.jsxs("button",{onClick:()=>b(Q),className:`flex-1 flex items-center justify-center gap-1 py-2 text-[11px] font-medium transition-colors ${m===Q?"text-neutral-900 border-b-2 border-neutral-900":"text-neutral-400 border-b-2 border-transparent"}`,children:[a.jsx(ue,{size:13}),a.jsx("span",{children:se})]},Q))})]}),m==="chat"&&a.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[a.jsxs("div",{className:"relative flex-1 min-h-0",children:[a.jsx("div",{ref:f,className:"h-full overflow-y-auto overflow-x-hidden overscroll-y-contain px-3 pt-3 pb-2",children:a.jsxs("div",{ref:h,children:[a.jsx("div",{className:"mb-3 pb-2 border-b border-neutral-100",children:e.description?a.jsx("div",{className:"text-[13px] text-neutral-500 leading-relaxed prose prose-sm max-w-none",children:a.jsx($i,{urlTransform:np,components:ap,children:e.description})}):a.jsx("p",{className:"text-[13px] text-neutral-400 italic",children:"No description"})}),k?a.jsx(Ai,{label:"Loading..."}):E?M?a.jsx(Ai,{label:"Loading logs..."}):P.length===0?a.jsx("div",{className:"text-neutral-400 text-center py-8 text-sm",children:j?"Waiting for agent output...":"No logs recorded."}):a.jsx(Ui,{logs:P}):a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[a.jsx("div",{className:"w-12 h-12 bg-neutral-50 rounded-xl border border-neutral-100 flex items-center justify-center mb-4",children:a.jsx(jt,{size:20,className:"text-neutral-400 ml-0.5"})}),a.jsx("h3",{className:"text-sm font-medium text-neutral-900 mb-1",children:"尚未启动 Agent"}),a.jsx("p",{className:"text-xs text-neutral-500 mb-5 max-w-[240px]",children:"选择一个 Agent 来执行此任务"}),a.jsxs(ot,{onClick:()=>c(!0),children:[a.jsx(jt,{size:16,className:"mr-1.5"}),"启动 Agent"]})]})]})}),!u&&a.jsxs("button",{onClick:()=>v(),className:"absolute bottom-2 left-1/2 -translate-x-1/2 z-10 flex items-center gap-1 px-2.5 py-1 bg-white/90 backdrop-blur-sm border border-neutral-200 rounded-full shadow-md text-[11px] text-neutral-600 active:bg-white transition-all","aria-label":"Scroll to bottom",children:[a.jsx(Gi,{size:12}),a.jsx("span",{children:"回到底部"})]})]}),K.length>0&&a.jsx("div",{className:"px-3 pt-1.5 pb-0.5 bg-white shrink-0 border-t border-neutral-100",children:a.jsx(qi,{todos:K,compact:!0})}),E&&a.jsx("div",{className:"px-3 py-2 bg-white shrink-0 border-t border-neutral-100",children:a.jsxs("div",{className:"relative bg-white rounded-xl border border-neutral-200 shadow-sm focus-within:border-neutral-300",children:[a.jsx(Cs,{files:V,onRemove:ie}),a.jsx("textarea",{ref:g,value:C,onChange:ze,onPaste:Z,onKeyDown:Q=>{Q.key==="Enter"&&!Q.shiftKey&&!Q.repeat&&!Q.nativeEvent.isComposing&&Q.nativeEvent.keyCode!==229&&(Q.preventDefault(),he())},rows:1,placeholder:j?"Message Agent...":"Continue conversation...",className:"w-full px-3 pt-2.5 pb-1 bg-transparent border-none focus:outline-none resize-none text-[15px] text-neutral-900 placeholder-neutral-400",style:{minHeight:40,maxHeight:140}}),a.jsx("input",{ref:n,type:"file",multiple:!0,className:"hidden",onChange:je}),a.jsxs("div",{className:"flex items-center justify-between px-2 pb-1.5",children:[a.jsx("div",{className:"flex items-center gap-0.5",children:a.jsx("button",{onClick:()=>n.current?.click(),className:"p-1 text-neutral-400 active:text-neutral-600 rounded-lg",children:a.jsx(ds,{size:15})})}),a.jsxs("div",{className:"flex items-center gap-1",children:[A&&a.jsxs("span",{className:"flex items-center gap-0.5 text-[11px] text-neutral-400 px-1.5 py-0.5 select-none",children:[a.jsx(Fi,{size:12,className:"shrink-0"}),a.jsx("span",{children:Xi(A,10)})]}),a.jsx(En,{usage:X}),j&&!C.trim()&&!$?a.jsx("button",{onClick:we,disabled:W.isPending,className:"p-1.5 rounded-lg bg-red-500 text-white active:bg-red-600 disabled:opacity-50",children:a.jsx(Ki,{size:12})}):a.jsx("button",{onClick:he,disabled:!C.trim()&&!$||z,className:`p-1.5 rounded-lg transition-colors ${(C.trim()||$)&&!z?"bg-neutral-900 text-white active:bg-black":"bg-transparent text-neutral-300"}`,children:a.jsx(Zi,{size:15})})]})]})]})})]}),m==="changes"&&a.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:a.jsx(Vf,{workingDir:L})}),m==="history"&&a.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:a.jsx(sp,{workingDir:L})}),m==="workspace"&&a.jsx("div",{className:"flex-1 overflow-hidden",children:a.jsx(to,{sessionId:E||void 0,workingDir:L,projectId:e.projectId,className:"h-full",hideChanges:!0})}),a.jsx(lo,{isOpen:i,onClose:()=>c(!1),taskId:e.id,taskTitle:e.title,taskDescription:e.description}),a.jsx(co,{isOpen:d,onClose:()=>o(!1),onConfirm:()=>{s?.(e.id),o(!1)},title:"删除任务",description:a.jsxs(a.Fragment,{children:[a.jsxs("p",{children:["确认删除任务「",e.title,"」?此操作不可撤销。"]}),B.length>0&&a.jsx("ul",{className:"mt-2 space-y-1",children:B.map((Q,se)=>a.jsxs("li",{className:"flex items-start gap-1.5 text-amber-600",children:[a.jsx("span",{className:"mt-1 shrink-0 w-1.5 h-1.5 rounded-full bg-amber-400"}),a.jsx("span",{children:Q})]},se))})]}),confirmText:"删除",variant:"danger",isLoading:l})]})}function Ai({label:e}){return a.jsxs("div",{className:"flex items-center justify-center py-12 gap-3 text-neutral-400",children:[a.jsxs("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),a.jsx("span",{className:"text-sm",children:e})]})}var up=Object.defineProperty,ws=Object.getOwnPropertySymbols,uo=Object.prototype.hasOwnProperty,fo=Object.prototype.propertyIsEnumerable,Ni=(e,t,s)=>t in e?up(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,hr=(e,t)=>{for(var s in t||(t={}))uo.call(t,s)&&Ni(e,s,t[s]);if(ws)for(var s of ws(t))fo.call(t,s)&&Ni(e,s,t[s]);return e},ur=(e,t)=>{var s={};for(var l in e)uo.call(e,l)&&t.indexOf(l)<0&&(s[l]=e[l]);if(e!=null&&ws)for(var l of ws(e))t.indexOf(l)<0&&fo.call(e,l)&&(s[l]=e[l]);return s};var Et;(e=>{const t=class fe{constructor(i,c,d,o){if(this.version=i,this.errorCorrectionLevel=c,this.modules=[],this.isFunction=[],i<fe.MIN_VERSION||i>fe.MAX_VERSION)throw new RangeError("Version value out of range");if(o<-1||o>7)throw new RangeError("Mask value out of range");this.size=i*4+17;let p=[];for(let S=0;S<this.size;S++)p.push(!1);for(let S=0;S<this.size;S++)this.modules.push(p.slice()),this.isFunction.push(p.slice());this.drawFunctionPatterns();const _=this.addEccAndInterleave(d);if(this.drawCodewords(_),o==-1){let S=1e9;for(let g=0;g<8;g++){this.applyMask(g),this.drawFormatBits(g);const n=this.getPenaltyScore();n<S&&(o=g,S=n),this.applyMask(g)}}m(0<=o&&o<=7),this.mask=o,this.applyMask(o),this.drawFormatBits(o),this.isFunction=[]}static encodeText(i,c){const d=e.QrSegment.makeSegments(i);return fe.encodeSegments(d,c)}static encodeBinary(i,c){const d=e.QrSegment.makeBytes(i);return fe.encodeSegments([d],c)}static encodeSegments(i,c,d=1,o=40,p=-1,_=!0){if(!(fe.MIN_VERSION<=d&&d<=o&&o<=fe.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let S,g;for(S=d;;S++){const u=fe.getNumDataCodewords(S,c)*8,v=C.getTotalBits(i,S);if(v<=u){g=v;break}if(S>=o)throw new RangeError("Data too long")}for(const u of[fe.Ecc.MEDIUM,fe.Ecc.QUARTILE,fe.Ecc.HIGH])_&&g<=fe.getNumDataCodewords(S,u)*8&&(c=u);let n=[];for(const u of i){s(u.mode.modeBits,4,n),s(u.numChars,u.mode.numCharCountBits(S),n);for(const v of u.getData())n.push(v)}m(n.length==g);const f=fe.getNumDataCodewords(S,c)*8;m(n.length<=f),s(0,Math.min(4,f-n.length),n),s(0,(8-n.length%8)%8,n),m(n.length%8==0);for(let u=236;n.length<f;u^=253)s(u,8,n);let h=[];for(;h.length*8<n.length;)h.push(0);return n.forEach((u,v)=>h[v>>>3]|=u<<7-(v&7)),new fe(S,c,h,p)}getModule(i,c){return 0<=i&&i<this.size&&0<=c&&c<this.size&&this.modules[c][i]}getModules(){return this.modules}drawFunctionPatterns(){for(let d=0;d<this.size;d++)this.setFunctionModule(6,d,d%2==0),this.setFunctionModule(d,6,d%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const i=this.getAlignmentPatternPositions(),c=i.length;for(let d=0;d<c;d++)for(let o=0;o<c;o++)d==0&&o==0||d==0&&o==c-1||d==c-1&&o==0||this.drawAlignmentPattern(i[d],i[o]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(i){const c=this.errorCorrectionLevel.formatBits<<3|i;let d=c;for(let p=0;p<10;p++)d=d<<1^(d>>>9)*1335;const o=(c<<10|d)^21522;m(o>>>15==0);for(let p=0;p<=5;p++)this.setFunctionModule(8,p,l(o,p));this.setFunctionModule(8,7,l(o,6)),this.setFunctionModule(8,8,l(o,7)),this.setFunctionModule(7,8,l(o,8));for(let p=9;p<15;p++)this.setFunctionModule(14-p,8,l(o,p));for(let p=0;p<8;p++)this.setFunctionModule(this.size-1-p,8,l(o,p));for(let p=8;p<15;p++)this.setFunctionModule(8,this.size-15+p,l(o,p));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let i=this.version;for(let d=0;d<12;d++)i=i<<1^(i>>>11)*7973;const c=this.version<<12|i;m(c>>>18==0);for(let d=0;d<18;d++){const o=l(c,d),p=this.size-11+d%3,_=Math.floor(d/3);this.setFunctionModule(p,_,o),this.setFunctionModule(_,p,o)}}drawFinderPattern(i,c){for(let d=-4;d<=4;d++)for(let o=-4;o<=4;o++){const p=Math.max(Math.abs(o),Math.abs(d)),_=i+o,S=c+d;0<=_&&_<this.size&&0<=S&&S<this.size&&this.setFunctionModule(_,S,p!=2&&p!=4)}}drawAlignmentPattern(i,c){for(let d=-2;d<=2;d++)for(let o=-2;o<=2;o++)this.setFunctionModule(i+o,c+d,Math.max(Math.abs(o),Math.abs(d))!=1)}setFunctionModule(i,c,d){this.modules[c][i]=d,this.isFunction[c][i]=!0}addEccAndInterleave(i){const c=this.version,d=this.errorCorrectionLevel;if(i.length!=fe.getNumDataCodewords(c,d))throw new RangeError("Invalid argument");const o=fe.NUM_ERROR_CORRECTION_BLOCKS[d.ordinal][c],p=fe.ECC_CODEWORDS_PER_BLOCK[d.ordinal][c],_=Math.floor(fe.getNumRawDataModules(c)/8),S=o-_%o,g=Math.floor(_/o);let n=[];const f=fe.reedSolomonComputeDivisor(p);for(let u=0,v=0;u<o;u++){let x=i.slice(v,v+g-p+(u<S?0:1));v+=x.length;const w=fe.reedSolomonComputeRemainder(x,f);u<S&&x.push(0),n.push(x.concat(w))}let h=[];for(let u=0;u<n[0].length;u++)n.forEach((v,x)=>{(u!=g-p||x>=S)&&h.push(v[u])});return m(h.length==_),h}drawCodewords(i){if(i.length!=Math.floor(fe.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let c=0;for(let d=this.size-1;d>=1;d-=2){d==6&&(d=5);for(let o=0;o<this.size;o++)for(let p=0;p<2;p++){const _=d-p,g=(d+1&2)==0?this.size-1-o:o;!this.isFunction[g][_]&&c<i.length*8&&(this.modules[g][_]=l(i[c>>>3],7-(c&7)),c++)}}m(c==i.length*8)}applyMask(i){if(i<0||i>7)throw new RangeError("Mask value out of range");for(let c=0;c<this.size;c++)for(let d=0;d<this.size;d++){let o;switch(i){case 0:o=(d+c)%2==0;break;case 1:o=c%2==0;break;case 2:o=d%3==0;break;case 3:o=(d+c)%3==0;break;case 4:o=(Math.floor(d/3)+Math.floor(c/2))%2==0;break;case 5:o=d*c%2+d*c%3==0;break;case 6:o=(d*c%2+d*c%3)%2==0;break;case 7:o=((d+c)%2+d*c%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[c][d]&&o&&(this.modules[c][d]=!this.modules[c][d])}}getPenaltyScore(){let i=0;for(let p=0;p<this.size;p++){let _=!1,S=0,g=[0,0,0,0,0,0,0];for(let n=0;n<this.size;n++)this.modules[p][n]==_?(S++,S==5?i+=fe.PENALTY_N1:S>5&&i++):(this.finderPenaltyAddHistory(S,g),_||(i+=this.finderPenaltyCountPatterns(g)*fe.PENALTY_N3),_=this.modules[p][n],S=1);i+=this.finderPenaltyTerminateAndCount(_,S,g)*fe.PENALTY_N3}for(let p=0;p<this.size;p++){let _=!1,S=0,g=[0,0,0,0,0,0,0];for(let n=0;n<this.size;n++)this.modules[n][p]==_?(S++,S==5?i+=fe.PENALTY_N1:S>5&&i++):(this.finderPenaltyAddHistory(S,g),_||(i+=this.finderPenaltyCountPatterns(g)*fe.PENALTY_N3),_=this.modules[n][p],S=1);i+=this.finderPenaltyTerminateAndCount(_,S,g)*fe.PENALTY_N3}for(let p=0;p<this.size-1;p++)for(let _=0;_<this.size-1;_++){const S=this.modules[p][_];S==this.modules[p][_+1]&&S==this.modules[p+1][_]&&S==this.modules[p+1][_+1]&&(i+=fe.PENALTY_N2)}let c=0;for(const p of this.modules)c=p.reduce((_,S)=>_+(S?1:0),c);const d=this.size*this.size,o=Math.ceil(Math.abs(c*20-d*10)/d)-1;return m(0<=o&&o<=9),i+=o*fe.PENALTY_N4,m(0<=i&&i<=2568888),i}getAlignmentPatternPositions(){if(this.version==1)return[];{const i=Math.floor(this.version/7)+2,c=this.version==32?26:Math.ceil((this.version*4+4)/(i*2-2))*2;let d=[6];for(let o=this.size-7;d.length<i;o-=c)d.splice(1,0,o);return d}}static getNumRawDataModules(i){if(i<fe.MIN_VERSION||i>fe.MAX_VERSION)throw new RangeError("Version number out of range");let c=(16*i+128)*i+64;if(i>=2){const d=Math.floor(i/7)+2;c-=(25*d-10)*d-55,i>=7&&(c-=36)}return m(208<=c&&c<=29648),c}static getNumDataCodewords(i,c){return Math.floor(fe.getNumRawDataModules(i)/8)-fe.ECC_CODEWORDS_PER_BLOCK[c.ordinal][i]*fe.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][i]}static reedSolomonComputeDivisor(i){if(i<1||i>255)throw new RangeError("Degree out of range");let c=[];for(let o=0;o<i-1;o++)c.push(0);c.push(1);let d=1;for(let o=0;o<i;o++){for(let p=0;p<c.length;p++)c[p]=fe.reedSolomonMultiply(c[p],d),p+1<c.length&&(c[p]^=c[p+1]);d=fe.reedSolomonMultiply(d,2)}return c}static reedSolomonComputeRemainder(i,c){let d=c.map(o=>0);for(const o of i){const p=o^d.shift();d.push(0),c.forEach((_,S)=>d[S]^=fe.reedSolomonMultiply(_,p))}return d}static reedSolomonMultiply(i,c){if(i>>>8||c>>>8)throw new RangeError("Byte out of range");let d=0;for(let o=7;o>=0;o--)d=d<<1^(d>>>7)*285,d^=(c>>>o&1)*i;return m(d>>>8==0),d}finderPenaltyCountPatterns(i){const c=i[1];m(c<=this.size*3);const d=c>0&&i[2]==c&&i[3]==c*3&&i[4]==c&&i[5]==c;return(d&&i[0]>=c*4&&i[6]>=c?1:0)+(d&&i[6]>=c*4&&i[0]>=c?1:0)}finderPenaltyTerminateAndCount(i,c,d){return i&&(this.finderPenaltyAddHistory(c,d),c=0),c+=this.size,this.finderPenaltyAddHistory(c,d),this.finderPenaltyCountPatterns(d)}finderPenaltyAddHistory(i,c){c[0]==0&&(i+=this.size),c.pop(),c.unshift(i)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function s(r,i,c){if(i<0||i>31||r>>>i)throw new RangeError("Value out of range");for(let d=i-1;d>=0;d--)c.push(r>>>d&1)}function l(r,i){return(r>>>i&1)!=0}function m(r){if(!r)throw new Error("Assertion error")}const b=class Te{constructor(i,c,d){if(this.mode=i,this.numChars=c,this.bitData=d,c<0)throw new RangeError("Invalid argument");this.bitData=d.slice()}static makeBytes(i){let c=[];for(const d of i)s(d,8,c);return new Te(Te.Mode.BYTE,i.length,c)}static makeNumeric(i){if(!Te.isNumeric(i))throw new RangeError("String contains non-numeric characters");let c=[];for(let d=0;d<i.length;){const o=Math.min(i.length-d,3);s(parseInt(i.substring(d,d+o),10),o*3+1,c),d+=o}return new Te(Te.Mode.NUMERIC,i.length,c)}static makeAlphanumeric(i){if(!Te.isAlphanumeric(i))throw new RangeError("String contains unencodable characters in alphanumeric mode");let c=[],d;for(d=0;d+2<=i.length;d+=2){let o=Te.ALPHANUMERIC_CHARSET.indexOf(i.charAt(d))*45;o+=Te.ALPHANUMERIC_CHARSET.indexOf(i.charAt(d+1)),s(o,11,c)}return d<i.length&&s(Te.ALPHANUMERIC_CHARSET.indexOf(i.charAt(d)),6,c),new Te(Te.Mode.ALPHANUMERIC,i.length,c)}static makeSegments(i){return i==""?[]:Te.isNumeric(i)?[Te.makeNumeric(i)]:Te.isAlphanumeric(i)?[Te.makeAlphanumeric(i)]:[Te.makeBytes(Te.toUtf8ByteArray(i))]}static makeEci(i){let c=[];if(i<0)throw new RangeError("ECI assignment value out of range");if(i<128)s(i,8,c);else if(i<16384)s(2,2,c),s(i,14,c);else if(i<1e6)s(6,3,c),s(i,21,c);else throw new RangeError("ECI assignment value out of range");return new Te(Te.Mode.ECI,0,c)}static isNumeric(i){return Te.NUMERIC_REGEX.test(i)}static isAlphanumeric(i){return Te.ALPHANUMERIC_REGEX.test(i)}getData(){return this.bitData.slice()}static getTotalBits(i,c){let d=0;for(const o of i){const p=o.mode.numCharCountBits(c);if(o.numChars>=1<<p)return 1/0;d+=4+p+o.bitData.length}return d}static toUtf8ByteArray(i){i=encodeURI(i);let c=[];for(let d=0;d<i.length;d++)i.charAt(d)!="%"?c.push(i.charCodeAt(d)):(c.push(parseInt(i.substring(d+1,d+3),16)),d+=2);return c}};b.NUMERIC_REGEX=/^[0-9]*$/,b.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,b.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let C=b;e.QrSegment=b})(Et||(Et={}));(e=>{(t=>{const s=class{constructor(m,b){this.ordinal=m,this.formatBits=b}};s.LOW=new s(0,1),s.MEDIUM=new s(1,0),s.QUARTILE=new s(2,3),s.HIGH=new s(3,2),t.Ecc=s})(e.QrCode||(e.QrCode={}))})(Et||(Et={}));(e=>{(t=>{const s=class{constructor(m,b){this.modeBits=m,this.numBitsCharCount=b}numCharCountBits(m){return this.numBitsCharCount[Math.floor((m+7)/17)]}};s.NUMERIC=new s(1,[10,12,14]),s.ALPHANUMERIC=new s(2,[9,11,13]),s.BYTE=new s(4,[8,16,16]),s.KANJI=new s(8,[8,10,12]),s.ECI=new s(7,[0,0,0]),t.Mode=s})(e.QrSegment||(e.QrSegment={}))})(Et||(Et={}));var Tt=Et;var dp={L:Tt.QrCode.Ecc.LOW,M:Tt.QrCode.Ecc.MEDIUM,Q:Tt.QrCode.Ecc.QUARTILE,H:Tt.QrCode.Ecc.HIGH},po=128,mo="L",vo="#FFFFFF",go="#000000",_o=!1,bo=1,fp=4,pp=0,mp=.1;function xo(e,t=0){const s=[];return e.forEach(function(l,m){let b=null;l.forEach(function(C,r){if(!C&&b!==null){s.push(`M${b+t} ${m+t}h${r-b}v1H${b+t}z`),b=null;return}if(r===l.length-1){if(!C)return;b===null?s.push(`M${r+t},${m+t} h1v1H${r+t}z`):s.push(`M${b+t},${m+t} h${r+1-b}v1H${b+t}z`);return}C&&b===null&&(b=r)})}),s.join("")}function So(e,t){return e.slice().map((s,l)=>l<t.y||l>=t.y+t.h?s:s.map((m,b)=>b<t.x||b>=t.x+t.w?m:!1))}function vp(e,t,s,l){if(l==null)return null;const m=e.length+s*2,b=Math.floor(t*mp),C=m/t,r=(l.width||b)*C,i=(l.height||b)*C,c=l.x==null?e.length/2-r/2:l.x*C,d=l.y==null?e.length/2-i/2:l.y*C,o=l.opacity==null?1:l.opacity;let p=null;if(l.excavate){let S=Math.floor(c),g=Math.floor(d),n=Math.ceil(r+c-S),f=Math.ceil(i+d-g);p={x:S,y:g,w:n,h:f}}const _=l.crossOrigin;return{x:c,y:d,h:i,w:r,excavation:p,opacity:o,crossOrigin:_}}function gp(e,t){return t!=null?Math.max(Math.floor(t),0):e?fp:pp}function yo({value:e,level:t,minVersion:s,includeMargin:l,marginSize:m,imageSettings:b,size:C,boostLevel:r}){let i=ee.useMemo(()=>{const S=(Array.isArray(e)?e:[e]).reduce((g,n)=>(g.push(...Tt.QrSegment.makeSegments(n)),g),[]);return Tt.QrCode.encodeSegments(S,dp[t],s,void 0,void 0,r)},[e,t,s,r]);const{cells:c,margin:d,numCells:o,calculatedImageSettings:p}=ee.useMemo(()=>{let _=i.getModules();const S=gp(l,m),g=_.length+S*2,n=vp(_,C,S,b);return{cells:_,margin:S,numCells:g,calculatedImageSettings:n}},[i,C,b,l,m]);return{qrcode:i,margin:d,cells:c,numCells:o,calculatedImageSettings:p}}var _p=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),bp=ee.forwardRef(function(t,s){const l=t,{value:m,size:b=po,level:C=mo,bgColor:r=vo,fgColor:i=go,includeMargin:c=_o,minVersion:d=bo,boostLevel:o,marginSize:p,imageSettings:_}=l,g=ur(l,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:n}=g,f=ur(g,["style"]),h=_?.src,u=ee.useRef(null),v=ee.useRef(null),x=ee.useCallback(B=>{u.current=B,typeof s=="function"?s(B):s&&(s.current=B)},[s]),[w,k]=ee.useState(!1),{margin:y,cells:E,numCells:j,calculatedImageSettings:A}=yo({value:m,level:C,minVersion:d,boostLevel:o,includeMargin:c,marginSize:p,imageSettings:_,size:b});ee.useEffect(()=>{if(u.current!=null){const B=u.current,I=B.getContext("2d");if(!I)return;let H=E;const W=v.current,D=A!=null&&W!==null&&W.complete&&W.naturalHeight!==0&&W.naturalWidth!==0;D&&A.excavation!=null&&(H=So(E,A.excavation));const M=window.devicePixelRatio||1;B.height=B.width=b*M;const P=b/j*M;I.scale(P,P),I.fillStyle=r,I.fillRect(0,0,j,j),I.fillStyle=i,_p?I.fill(new Path2D(xo(H,y))):E.forEach(function(O,U){O.forEach(function(K,V){K&&I.fillRect(V+y,U+y,1,1)})}),A&&(I.globalAlpha=A.opacity),D&&I.drawImage(W,A.x+y,A.y+y,A.w,A.h)}}),ee.useEffect(()=>{k(!1)},[h]);const L=hr({height:b,width:b},n);let N=null;return h!=null&&(N=ee.createElement("img",{src:h,key:h,style:{display:"none"},onLoad:()=>{k(!0)},ref:v,crossOrigin:A?.crossOrigin})),ee.createElement(ee.Fragment,null,ee.createElement("canvas",hr({style:L,height:b,width:b,ref:x,role:"img"},f)),N)});bp.displayName="QRCodeCanvas";var Co=ee.forwardRef(function(t,s){const l=t,{value:m,size:b=po,level:C=mo,bgColor:r=vo,fgColor:i=go,includeMargin:c=_o,minVersion:d=bo,boostLevel:o,title:p,marginSize:_,imageSettings:S}=l,g=ur(l,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:n,cells:f,numCells:h,calculatedImageSettings:u}=yo({value:m,level:C,minVersion:d,boostLevel:o,includeMargin:c,marginSize:_,imageSettings:S,size:b});let v=f,x=null;S!=null&&u!=null&&(u.excavation!=null&&(v=So(f,u.excavation)),x=ee.createElement("image",{href:S.src,height:u.h,width:u.w,x:u.x+n,y:u.y+n,preserveAspectRatio:"none",opacity:u.opacity,crossOrigin:u.crossOrigin}));const w=xo(v,n);return ee.createElement("svg",hr({height:b,width:b,viewBox:`0 0 ${h} ${h}`,ref:s,role:"img"},g),!!p&&ee.createElement("title",null,p),ee.createElement("path",{fill:r,d:`M0,0 h${h}v${h}H0z`,shapeRendering:"crispEdges"}),ee.createElement("path",{fill:i,d:w,shapeRendering:"crispEdges"}),x)});Co.displayName="QRCodeSVG";function xp(){return at({queryKey:ce.tunnel.status,queryFn:()=>be.get("/tunnel/status"),refetchInterval:e=>e.state.data?.running?1e4:!1})}function Sp(){const e=Ie();return Ge({mutationFn:()=>{const t=parseInt(window.location.port||(window.location.protocol==="https:"?"443":"80"),10);return be.post("/tunnel/start",{port:t})},onSuccess:()=>{e.invalidateQueries({queryKey:ce.tunnel.status})}})}function yp(){const e=Ie();return Ge({mutationFn:()=>be.post("/tunnel/stop"),onSuccess:()=>{e.invalidateQueries({queryKey:ce.tunnel.status})}})}function Mi(){const{data:e}=xp(),t=Sp(),s=yp(),[l,m]=R.useState(!1),[b,C]=R.useState(null),r=R.useRef(null),[i,c]=R.useState({top:0,right:0}),[d,o]=R.useState(!1),p=e?.running??!1,_=t.isPending,S=e?.shareableUrl,g=e?.token;R.useEffect(()=>{if(l&&r.current){const v=r.current.getBoundingClientRect();c({top:v.bottom+8,right:window.innerWidth-v.right})}},[l]);const n=R.useCallback(()=>{p?m(!0):t.mutate(void 0,{onSuccess:()=>m(!0)})},[p,t]),f=R.useCallback(()=>{S&&(navigator.clipboard.writeText(S),C("url"),setTimeout(()=>C(null),2e3))},[S]),h=R.useCallback(()=>{g&&(navigator.clipboard.writeText(g),C("token"),setTimeout(()=>C(null),2e3))},[g]),u=R.useCallback(()=>{s.mutate(),m(!1),o(!1)},[s]);return a.jsxs("div",{className:"relative",children:[a.jsx("button",{ref:r,onClick:n,disabled:_,className:`p-1.5 rounded-md transition-colors ${p?"text-emerald-600 hover:bg-emerald-50":"text-neutral-400 hover:text-neutral-900 hover:bg-neutral-100"}`,title:p?"Tunnel active":"Share via tunnel",children:_?a.jsx(Be,{size:16,className:"animate-spin"}):a.jsx(Es,{size:16})}),p&&!_&&a.jsx("span",{className:"absolute top-0.5 right-0.5 w-2 h-2 bg-emerald-500 rounded-full"}),l&&p&&Rt.createPortal(a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-[100]",onClick:()=>m(!1)}),a.jsxs("div",{className:"fixed z-[101] w-80 bg-white rounded-lg shadow-lg border border-neutral-200 p-3",style:{top:i.top,right:i.right},children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("span",{className:"text-xs font-medium text-emerald-600 flex items-center gap-1.5",children:[a.jsx("span",{className:"w-1.5 h-1.5 bg-emerald-500 rounded-full inline-block"}),"Tunnel Active"]}),a.jsx("button",{onClick:()=>m(!1),className:"p-0.5 text-neutral-400 hover:text-neutral-600 rounded",children:a.jsx(ks,{size:14})})]}),g&&a.jsxs("div",{className:"flex items-center gap-1.5 mb-2 px-2 py-1 bg-emerald-50 rounded text-xs text-emerald-700",children:[a.jsx(Ba,{size:12}),a.jsx("span",{children:"Token protected"})]}),S&&a.jsx("div",{className:"flex justify-center py-3",children:a.jsx(Co,{value:S,size:160})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{readOnly:!0,value:S??e?.url??"",className:"flex-1 px-2 py-1.5 text-xs bg-neutral-50 border border-neutral-200 rounded-md text-neutral-700 select-all",onFocus:v=>v.target.select()}),a.jsx("button",{onClick:f,className:"p-1.5 text-neutral-500 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors",title:"Copy shareable link",children:b==="url"?a.jsx(fs,{size:14,className:"text-emerald-500"}):a.jsx(Wr,{size:14})})]}),g&&a.jsxs("div",{className:"mt-2",children:[a.jsx("button",{onClick:()=>o(!d),className:"text-xs text-neutral-500 hover:text-neutral-700 transition-colors",children:d?"Hide token":"Show token"}),d&&a.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[a.jsx("code",{className:"flex-1 px-2 py-1.5 text-xs bg-neutral-50 border border-neutral-200 rounded-md text-neutral-600 break-all",children:g}),a.jsx("button",{onClick:h,className:"p-1.5 text-neutral-500 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors shrink-0",title:"Copy token",children:b==="token"?a.jsx(fs,{size:14,className:"text-emerald-500"}):a.jsx(Wr,{size:14})})]})]}),a.jsx("button",{onClick:u,disabled:s.isPending,className:"mt-2 w-full px-3 py-1.5 text-xs text-red-600 hover:bg-red-50 rounded-md transition-colors",children:s.isPending?"Stopping...":"Stop Tunnel"})]})]}),document.body)]})}const Pi={idle:"Create & Start","creating-task":"Creating Task...","creating-workspace":"Creating Workspace...","creating-session":"Creating Session...","starting-session":"Starting Agent..."},Ot=R.lazy(()=>Hi(()=>import("./modal-BCL0660p.js").then(e=>e.m),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.Modal}))),er=R.lazy(()=>Hi(()=>import("./folder-picker-DshGpYNS.js"),__vite__mapDeps([5,1,2,3,6,7,8,9,10,11,12,13])).then(e=>({default:e.FolderPicker}))),Oi=a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-neutral-900",children:[a.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",fill:"currentColor"}),a.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Bi=a.jsx("span",{className:"font-bold text-neutral-900 tracking-tight text-base",children:"Agent Tower"}),Cp=260,wp=600,Ii=400;function Fp(){const[e,t]=R.useState(null),[s,l]=R.useState(null),[m,b]=R.useState(Ii),[C,r]=R.useState(!1),[i,c]=R.useState(!1),[d,o]=R.useState(""),[p,_]=R.useState(""),[S,g]=R.useState(""),[n,f]=R.useState(""),[h,u]=R.useState(""),[v,x]=R.useState(""),[w,k]=R.useState("idle"),{files:y,addFiles:E,removeFile:j,clear:A,buildMarkdownLinks:L,isUploading:N}=Mr(),B=R.useRef(null),I=R.useRef(!1),H=R.useRef(0),W=R.useRef(Ii),D=R.useRef(null),M=Ie(),{data:P,isLoading:O}=_r(),{data:U,isLoading:K}=Uo(),V=U?.data??[],Y=R.useMemo(()=>V.map(Nf),[V]),ie=R.useMemo(()=>V.map(q=>q.id),[V]);Hf(ie);const{data:T,isLoading:F}=Of(s??""),$=Vo({queries:s?[]:V.map(q=>({queryKey:ce.tasks.list(q.id),queryFn:()=>be.get(`/projects/${q.id}/tasks`,{params:{limit:"100"}})}))}),z=!s&&$.some(q=>q.isLoading),J=R.useMemo(()=>{if(s)return T?.data??[];const q=[];for(const re of $)re.data?.data&&q.push(...re.data.data);return q},[s,T,$]),X=R.useMemo(()=>{const q=new Map;for(const re of J){const ae=re.createdAt?new Date(re.createdAt).getTime():0,pe=q.get(re.projectId)??0;ae>pe&&q.set(re.projectId,ae)}return[...V].sort((re,ae)=>{const pe=q.get(re.id)??(re.createdAt?new Date(re.createdAt).getTime():0);return(q.get(ae.id)??(ae.createdAt?new Date(ae.createdAt).getTime():0))-pe})},[V,J]),oe=R.useMemo(()=>{if(!P)return[];const q=localStorage.getItem("providerUsageCount"),re=q?JSON.parse(q):{};return[...P].sort((ae,pe)=>{const xe=ae.availability.type!=="NOT_FOUND",Me=pe.availability.type!=="NOT_FOUND";if(xe!==Me)return xe?-1:1;const qe=re[ae.provider.id]??0;return(re[pe.provider.id]??0)-qe})},[P]),he=R.useMemo(()=>J.map(Pf),[J]),we=R.useMemo(()=>new Set,[]),je=R.useMemo(()=>{if(!e)return null;const q=he.find(ae=>ae.id===e);if(!q)return null;const re=V.find(ae=>ae.id===q.projectId);return{id:q.id,projectId:q.projectId,projectName:re?.name??"Unknown",projectColor:re?.color??"text-neutral-500",title:q.title,status:q.status,branch:q.branch,mainBranch:re?.mainBranch??"main",description:q.description}},[e,he,V]),Z=qo(),ze=Bf(h),Fe=Ff(),Re=If(),Q=R.useCallback(q=>{Fe.mutate(q,{onSuccess:()=>{e===q&&t(null),M.invalidateQueries({queryKey:ce.tasks.all})}})},[Fe,e,M]),se=R.useCallback((q,re)=>{Re.mutate({id:q,status:jf(re)},{onError:()=>{Lo.error("状态变更失败,该操作不被允许")}})},[Re]),ue=R.useCallback(q=>{q.preventDefault(),I.current=!0,H.current=q.clientX,W.current=m,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[m]);R.useEffect(()=>{const q=ae=>{if(!I.current)return;const pe=ae.clientX-H.current,xe=Math.max(Cp,Math.min(wp,W.current+pe));b(xe)},re=()=>{I.current&&(I.current=!1,document.body.style.cursor="",document.body.style.userSelect="")};return document.addEventListener("mousemove",q),document.addEventListener("mouseup",re),()=>{document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",re)}},[]);const ne=R.useCallback(()=>{r(!0)},[]),ge=R.useCallback(()=>{const q=localStorage.getItem("lastSelectedProjectId"),re=localStorage.getItem("lastSelectedProviderId"),ae=q&&X.find(Me=>Me.id===q)?q:s??X[0]?.id??"";u(ae);const pe=oe?.find(Me=>Me.availability.type!=="NOT_FOUND"),xe=re&&oe?.find(Me=>Me.provider.id===re&&Me.availability.type!=="NOT_FOUND")?re:pe?.provider.id??"";x(xe),k("idle"),c(!0)},[s,X,oe]),me=R.useCallback(()=>{r(!1),o(""),_("")},[]),ye=R.useCallback(()=>{w==="idle"&&(c(!1),g(""),f(""),u(""),x(""),k("idle"),A())},[w,A]),Le=R.useCallback(async()=>{if(!(!d.trim()||!p.trim()))try{await Z.mutateAsync({name:d.trim(),repoPath:p.trim()}),me()}catch{}},[d,p,Z,me]),Ve=io(),Ae=R.useCallback(async()=>{if(!(!S.trim()||!h))try{const q=L(),re=[n.trim(),q].filter(Boolean).join(`
81
+ `);r(""),T(),g.current&&(g.current.style.height="40px"),I.mutate({id:E,message:se},{onSuccess:()=>U(),onSettled:()=>{oe.current=!1}})},[C,E,I,U,$,z,F,T]),we=R.useCallback(async()=>{E&&(await W.mutateAsync(E),x.invalidateQueries({queryKey:["workspaces"]}))},[E,W,x]),je=R.useCallback(Q=>{const se=Q.target.files;se&&se.length>0&&Y(Array.from(se)),Q.target.value=""},[Y]),Z=R.useCallback(Q=>{const se=Q.clipboardData.items,ue=[];for(const ne of se)if(ne.kind==="file"){const ge=ne.getAsFile();ge&&ue.push(ge)}ue.length>0&&(Q.preventDefault(),Y(ue))},[Y]),ze=R.useCallback(Q=>{r(Q.target.value);const se=Q.target;se.style.height="auto",se.style.height=`${Math.max(40,Math.min(se.scrollHeight,140))}px`},[]),Fe=R.useCallback(()=>{N&&H.mutate({workspaceId:N})},[N,H]),Re=R.useRef(null);return R.useEffect(()=>{const Q=window.visualViewport;if(!Q)return;let se=!1;const ue=()=>{Re.current&&(Re.current.style.height=`${Q.height}px`,Re.current.style.top=`${Q.offsetTop}px`)},ne=()=>ue(),ge=()=>{se||ue()},me=()=>{se=!0},ye=()=>{se=!1,requestAnimationFrame(ue)};return Q.addEventListener("resize",ne),Q.addEventListener("scroll",ge),document.addEventListener("touchstart",me,{passive:!0}),document.addEventListener("touchend",ye,{passive:!0}),document.addEventListener("touchcancel",ye,{passive:!0}),()=>{Q.removeEventListener("resize",ne),Q.removeEventListener("scroll",ge),document.removeEventListener("touchstart",me),document.removeEventListener("touchend",ye),document.removeEventListener("touchcancel",ye)}},[]),R.useEffect(()=>{const Q=Re.current;if(!Q)return;const se=ue=>{let ne=ue.target;for(;ne&&ne!==Q;){if(ne.tagName==="TEXTAREA"){if(ne.scrollHeight>ne.clientHeight)return;ne=ne.parentElement;continue}const me=window.getComputedStyle(ne).overflowY;if((me==="auto"||me==="scroll")&&ne.scrollHeight>ne.clientHeight)return;ne=ne.parentElement}ue.preventDefault()};return Q.addEventListener("touchmove",se,{passive:!1}),()=>Q.removeEventListener("touchmove",se)},[]),a.jsxs("div",{ref:Re,className:"fixed inset-x-0 top-0 flex flex-col h-dvh bg-white overflow-hidden overscroll-none",children:[a.jsxs("header",{className:"shrink-0 bg-white border-b border-neutral-200 z-20",children:[a.jsxs("div",{className:"flex items-center h-11 px-2.5 gap-1.5",children:[a.jsx("button",{onClick:t,className:"p-1.5 -ml-0.5 text-neutral-600 active:text-neutral-900",children:a.jsx(jo,{size:18})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h1",{className:"text-[13px] font-bold text-neutral-900 truncate leading-tight",children:e.title}),a.jsxs("div",{className:"flex items-center gap-1 text-[11px] text-neutral-500 leading-tight",children:[a.jsx("span",{className:`font-medium ${e.projectColor}`,children:e.projectName}),a.jsx("span",{className:"text-neutral-300",children:"/"}),a.jsx("span",{className:"font-mono truncate",children:e.branch})]})]}),a.jsx(lp,{status:e.status}),a.jsx("button",{onClick:Fe,disabled:!N,className:"p-1.5 text-neutral-400 active:text-neutral-900 disabled:opacity-30",children:a.jsx(Ds,{size:16})}),s&&a.jsxs("div",{className:"relative",ref:S,children:[a.jsx("button",{onClick:()=>_(Q=>!Q),className:"p-1.5 text-neutral-400 active:text-neutral-900","aria-label":"More actions",children:a.jsx(Ji,{size:16})}),p&&a.jsx("div",{className:"absolute right-0 top-full mt-1 w-40 bg-white rounded-lg border border-neutral-200 shadow-lg z-50 py-1",children:a.jsxs("button",{onClick:()=>{o(!0),_(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-red-600 active:bg-red-50",children:[a.jsx(Yi,{size:15}),a.jsx("span",{children:"删除任务"})]})})]})]}),a.jsx("div",{className:"flex border-t border-neutral-100",children:cp.map(({key:Q,label:se,icon:ue})=>a.jsxs("button",{onClick:()=>b(Q),className:`flex-1 flex items-center justify-center gap-1 py-2 text-[11px] font-medium transition-colors ${m===Q?"text-neutral-900 border-b-2 border-neutral-900":"text-neutral-400 border-b-2 border-transparent"}`,children:[a.jsx(ue,{size:13}),a.jsx("span",{children:se})]},Q))})]}),m==="chat"&&a.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[a.jsxs("div",{className:"relative flex-1 min-h-0",children:[a.jsx("div",{ref:f,className:"h-full overflow-y-auto overflow-x-hidden overscroll-y-contain px-3 pt-3 pb-2",children:a.jsxs("div",{ref:h,children:[a.jsx("div",{className:"mb-3 pb-2 border-b border-neutral-100",children:e.description?a.jsx("div",{className:"text-[13px] text-neutral-500 leading-relaxed prose prose-sm max-w-none",children:a.jsx($i,{urlTransform:np,components:ap,children:e.description})}):a.jsx("p",{className:"text-[13px] text-neutral-400 italic",children:"No description"})}),k?a.jsx(Ai,{label:"Loading..."}):E?M?a.jsx(Ai,{label:"Loading logs..."}):P.length===0?a.jsx("div",{className:"text-neutral-400 text-center py-8 text-sm",children:j?"Waiting for agent output...":"No logs recorded."}):a.jsx(Ui,{logs:P}):a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[a.jsx("div",{className:"w-12 h-12 bg-neutral-50 rounded-xl border border-neutral-100 flex items-center justify-center mb-4",children:a.jsx(jt,{size:20,className:"text-neutral-400 ml-0.5"})}),a.jsx("h3",{className:"text-sm font-medium text-neutral-900 mb-1",children:"尚未启动 Agent"}),a.jsx("p",{className:"text-xs text-neutral-500 mb-5 max-w-[240px]",children:"选择一个 Agent 来执行此任务"}),a.jsxs(ot,{onClick:()=>c(!0),children:[a.jsx(jt,{size:16,className:"mr-1.5"}),"启动 Agent"]})]})]})}),!u&&a.jsxs("button",{onClick:()=>v(),className:"absolute bottom-2 left-1/2 -translate-x-1/2 z-10 flex items-center gap-1 px-2.5 py-1 bg-white/90 backdrop-blur-sm border border-neutral-200 rounded-full shadow-md text-[11px] text-neutral-600 active:bg-white transition-all","aria-label":"Scroll to bottom",children:[a.jsx(Gi,{size:12}),a.jsx("span",{children:"回到底部"})]})]}),K.length>0&&a.jsx("div",{className:"px-3 pt-1.5 pb-0.5 bg-white shrink-0 border-t border-neutral-100",children:a.jsx(qi,{todos:K,compact:!0})}),E&&a.jsx("div",{className:"px-3 py-2 bg-white shrink-0 border-t border-neutral-100",children:a.jsxs("div",{className:"relative bg-white rounded-xl border border-neutral-200 shadow-sm focus-within:border-neutral-300",children:[a.jsx(Cs,{files:V,onRemove:ie}),a.jsx("textarea",{ref:g,value:C,onChange:ze,onPaste:Z,onKeyDown:Q=>{Q.key==="Enter"&&!Q.shiftKey&&!Q.repeat&&!Q.nativeEvent.isComposing&&Q.nativeEvent.keyCode!==229&&(Q.preventDefault(),he())},rows:1,placeholder:j?"Message Agent...":"Continue conversation...",className:"w-full px-3 pt-2.5 pb-1 bg-transparent border-none focus:outline-none resize-none text-[15px] text-neutral-900 placeholder-neutral-400",style:{minHeight:40,maxHeight:140}}),a.jsx("input",{ref:n,type:"file",multiple:!0,className:"hidden",onChange:je}),a.jsxs("div",{className:"flex items-center justify-between px-2 pb-1.5",children:[a.jsx("div",{className:"flex items-center gap-0.5",children:a.jsx("button",{onClick:()=>n.current?.click(),className:"p-1 text-neutral-400 active:text-neutral-600 rounded-lg",children:a.jsx(ds,{size:15})})}),a.jsxs("div",{className:"flex items-center gap-1",children:[A&&a.jsxs("span",{className:"flex items-center gap-0.5 text-[11px] text-neutral-400 px-1.5 py-0.5 select-none",children:[a.jsx(Fi,{size:12,className:"shrink-0"}),a.jsx("span",{children:Xi(A,10)})]}),a.jsx(En,{usage:X}),j&&!C.trim()&&!$?a.jsx("button",{onClick:we,disabled:W.isPending,className:"p-1.5 rounded-lg bg-red-500 text-white active:bg-red-600 disabled:opacity-50",children:a.jsx(Ki,{size:12})}):a.jsx("button",{onClick:he,disabled:!C.trim()&&!$||z,className:`p-1.5 rounded-lg transition-colors ${(C.trim()||$)&&!z?"bg-neutral-900 text-white active:bg-black":"bg-transparent text-neutral-300"}`,children:a.jsx(Zi,{size:15})})]})]})]})})]}),m==="changes"&&a.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:a.jsx(Vf,{workingDir:L})}),m==="history"&&a.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:a.jsx(sp,{workingDir:L})}),m==="workspace"&&a.jsx("div",{className:"flex-1 overflow-hidden",children:a.jsx(to,{sessionId:E||void 0,workingDir:L,projectId:e.projectId,className:"h-full",hideChanges:!0})}),a.jsx(lo,{isOpen:i,onClose:()=>c(!1),taskId:e.id,taskTitle:e.title,taskDescription:e.description}),a.jsx(co,{isOpen:d,onClose:()=>o(!1),onConfirm:()=>{s?.(e.id),o(!1)},title:"删除任务",description:a.jsxs(a.Fragment,{children:[a.jsxs("p",{children:["确认删除任务「",e.title,"」?此操作不可撤销。"]}),B.length>0&&a.jsx("ul",{className:"mt-2 space-y-1",children:B.map((Q,se)=>a.jsxs("li",{className:"flex items-start gap-1.5 text-amber-600",children:[a.jsx("span",{className:"mt-1 shrink-0 w-1.5 h-1.5 rounded-full bg-amber-400"}),a.jsx("span",{children:Q})]},se))})]}),confirmText:"删除",variant:"danger",isLoading:l})]})}function Ai({label:e}){return a.jsxs("div",{className:"flex items-center justify-center py-12 gap-3 text-neutral-400",children:[a.jsxs("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),a.jsx("span",{className:"text-sm",children:e})]})}var up=Object.defineProperty,ws=Object.getOwnPropertySymbols,uo=Object.prototype.hasOwnProperty,fo=Object.prototype.propertyIsEnumerable,Ni=(e,t,s)=>t in e?up(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,hr=(e,t)=>{for(var s in t||(t={}))uo.call(t,s)&&Ni(e,s,t[s]);if(ws)for(var s of ws(t))fo.call(t,s)&&Ni(e,s,t[s]);return e},ur=(e,t)=>{var s={};for(var l in e)uo.call(e,l)&&t.indexOf(l)<0&&(s[l]=e[l]);if(e!=null&&ws)for(var l of ws(e))t.indexOf(l)<0&&fo.call(e,l)&&(s[l]=e[l]);return s};var Et;(e=>{const t=class fe{constructor(i,c,d,o){if(this.version=i,this.errorCorrectionLevel=c,this.modules=[],this.isFunction=[],i<fe.MIN_VERSION||i>fe.MAX_VERSION)throw new RangeError("Version value out of range");if(o<-1||o>7)throw new RangeError("Mask value out of range");this.size=i*4+17;let p=[];for(let S=0;S<this.size;S++)p.push(!1);for(let S=0;S<this.size;S++)this.modules.push(p.slice()),this.isFunction.push(p.slice());this.drawFunctionPatterns();const _=this.addEccAndInterleave(d);if(this.drawCodewords(_),o==-1){let S=1e9;for(let g=0;g<8;g++){this.applyMask(g),this.drawFormatBits(g);const n=this.getPenaltyScore();n<S&&(o=g,S=n),this.applyMask(g)}}m(0<=o&&o<=7),this.mask=o,this.applyMask(o),this.drawFormatBits(o),this.isFunction=[]}static encodeText(i,c){const d=e.QrSegment.makeSegments(i);return fe.encodeSegments(d,c)}static encodeBinary(i,c){const d=e.QrSegment.makeBytes(i);return fe.encodeSegments([d],c)}static encodeSegments(i,c,d=1,o=40,p=-1,_=!0){if(!(fe.MIN_VERSION<=d&&d<=o&&o<=fe.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let S,g;for(S=d;;S++){const u=fe.getNumDataCodewords(S,c)*8,v=C.getTotalBits(i,S);if(v<=u){g=v;break}if(S>=o)throw new RangeError("Data too long")}for(const u of[fe.Ecc.MEDIUM,fe.Ecc.QUARTILE,fe.Ecc.HIGH])_&&g<=fe.getNumDataCodewords(S,u)*8&&(c=u);let n=[];for(const u of i){s(u.mode.modeBits,4,n),s(u.numChars,u.mode.numCharCountBits(S),n);for(const v of u.getData())n.push(v)}m(n.length==g);const f=fe.getNumDataCodewords(S,c)*8;m(n.length<=f),s(0,Math.min(4,f-n.length),n),s(0,(8-n.length%8)%8,n),m(n.length%8==0);for(let u=236;n.length<f;u^=253)s(u,8,n);let h=[];for(;h.length*8<n.length;)h.push(0);return n.forEach((u,v)=>h[v>>>3]|=u<<7-(v&7)),new fe(S,c,h,p)}getModule(i,c){return 0<=i&&i<this.size&&0<=c&&c<this.size&&this.modules[c][i]}getModules(){return this.modules}drawFunctionPatterns(){for(let d=0;d<this.size;d++)this.setFunctionModule(6,d,d%2==0),this.setFunctionModule(d,6,d%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const i=this.getAlignmentPatternPositions(),c=i.length;for(let d=0;d<c;d++)for(let o=0;o<c;o++)d==0&&o==0||d==0&&o==c-1||d==c-1&&o==0||this.drawAlignmentPattern(i[d],i[o]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(i){const c=this.errorCorrectionLevel.formatBits<<3|i;let d=c;for(let p=0;p<10;p++)d=d<<1^(d>>>9)*1335;const o=(c<<10|d)^21522;m(o>>>15==0);for(let p=0;p<=5;p++)this.setFunctionModule(8,p,l(o,p));this.setFunctionModule(8,7,l(o,6)),this.setFunctionModule(8,8,l(o,7)),this.setFunctionModule(7,8,l(o,8));for(let p=9;p<15;p++)this.setFunctionModule(14-p,8,l(o,p));for(let p=0;p<8;p++)this.setFunctionModule(this.size-1-p,8,l(o,p));for(let p=8;p<15;p++)this.setFunctionModule(8,this.size-15+p,l(o,p));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let i=this.version;for(let d=0;d<12;d++)i=i<<1^(i>>>11)*7973;const c=this.version<<12|i;m(c>>>18==0);for(let d=0;d<18;d++){const o=l(c,d),p=this.size-11+d%3,_=Math.floor(d/3);this.setFunctionModule(p,_,o),this.setFunctionModule(_,p,o)}}drawFinderPattern(i,c){for(let d=-4;d<=4;d++)for(let o=-4;o<=4;o++){const p=Math.max(Math.abs(o),Math.abs(d)),_=i+o,S=c+d;0<=_&&_<this.size&&0<=S&&S<this.size&&this.setFunctionModule(_,S,p!=2&&p!=4)}}drawAlignmentPattern(i,c){for(let d=-2;d<=2;d++)for(let o=-2;o<=2;o++)this.setFunctionModule(i+o,c+d,Math.max(Math.abs(o),Math.abs(d))!=1)}setFunctionModule(i,c,d){this.modules[c][i]=d,this.isFunction[c][i]=!0}addEccAndInterleave(i){const c=this.version,d=this.errorCorrectionLevel;if(i.length!=fe.getNumDataCodewords(c,d))throw new RangeError("Invalid argument");const o=fe.NUM_ERROR_CORRECTION_BLOCKS[d.ordinal][c],p=fe.ECC_CODEWORDS_PER_BLOCK[d.ordinal][c],_=Math.floor(fe.getNumRawDataModules(c)/8),S=o-_%o,g=Math.floor(_/o);let n=[];const f=fe.reedSolomonComputeDivisor(p);for(let u=0,v=0;u<o;u++){let x=i.slice(v,v+g-p+(u<S?0:1));v+=x.length;const w=fe.reedSolomonComputeRemainder(x,f);u<S&&x.push(0),n.push(x.concat(w))}let h=[];for(let u=0;u<n[0].length;u++)n.forEach((v,x)=>{(u!=g-p||x>=S)&&h.push(v[u])});return m(h.length==_),h}drawCodewords(i){if(i.length!=Math.floor(fe.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let c=0;for(let d=this.size-1;d>=1;d-=2){d==6&&(d=5);for(let o=0;o<this.size;o++)for(let p=0;p<2;p++){const _=d-p,g=(d+1&2)==0?this.size-1-o:o;!this.isFunction[g][_]&&c<i.length*8&&(this.modules[g][_]=l(i[c>>>3],7-(c&7)),c++)}}m(c==i.length*8)}applyMask(i){if(i<0||i>7)throw new RangeError("Mask value out of range");for(let c=0;c<this.size;c++)for(let d=0;d<this.size;d++){let o;switch(i){case 0:o=(d+c)%2==0;break;case 1:o=c%2==0;break;case 2:o=d%3==0;break;case 3:o=(d+c)%3==0;break;case 4:o=(Math.floor(d/3)+Math.floor(c/2))%2==0;break;case 5:o=d*c%2+d*c%3==0;break;case 6:o=(d*c%2+d*c%3)%2==0;break;case 7:o=((d+c)%2+d*c%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[c][d]&&o&&(this.modules[c][d]=!this.modules[c][d])}}getPenaltyScore(){let i=0;for(let p=0;p<this.size;p++){let _=!1,S=0,g=[0,0,0,0,0,0,0];for(let n=0;n<this.size;n++)this.modules[p][n]==_?(S++,S==5?i+=fe.PENALTY_N1:S>5&&i++):(this.finderPenaltyAddHistory(S,g),_||(i+=this.finderPenaltyCountPatterns(g)*fe.PENALTY_N3),_=this.modules[p][n],S=1);i+=this.finderPenaltyTerminateAndCount(_,S,g)*fe.PENALTY_N3}for(let p=0;p<this.size;p++){let _=!1,S=0,g=[0,0,0,0,0,0,0];for(let n=0;n<this.size;n++)this.modules[n][p]==_?(S++,S==5?i+=fe.PENALTY_N1:S>5&&i++):(this.finderPenaltyAddHistory(S,g),_||(i+=this.finderPenaltyCountPatterns(g)*fe.PENALTY_N3),_=this.modules[n][p],S=1);i+=this.finderPenaltyTerminateAndCount(_,S,g)*fe.PENALTY_N3}for(let p=0;p<this.size-1;p++)for(let _=0;_<this.size-1;_++){const S=this.modules[p][_];S==this.modules[p][_+1]&&S==this.modules[p+1][_]&&S==this.modules[p+1][_+1]&&(i+=fe.PENALTY_N2)}let c=0;for(const p of this.modules)c=p.reduce((_,S)=>_+(S?1:0),c);const d=this.size*this.size,o=Math.ceil(Math.abs(c*20-d*10)/d)-1;return m(0<=o&&o<=9),i+=o*fe.PENALTY_N4,m(0<=i&&i<=2568888),i}getAlignmentPatternPositions(){if(this.version==1)return[];{const i=Math.floor(this.version/7)+2,c=this.version==32?26:Math.ceil((this.version*4+4)/(i*2-2))*2;let d=[6];for(let o=this.size-7;d.length<i;o-=c)d.splice(1,0,o);return d}}static getNumRawDataModules(i){if(i<fe.MIN_VERSION||i>fe.MAX_VERSION)throw new RangeError("Version number out of range");let c=(16*i+128)*i+64;if(i>=2){const d=Math.floor(i/7)+2;c-=(25*d-10)*d-55,i>=7&&(c-=36)}return m(208<=c&&c<=29648),c}static getNumDataCodewords(i,c){return Math.floor(fe.getNumRawDataModules(i)/8)-fe.ECC_CODEWORDS_PER_BLOCK[c.ordinal][i]*fe.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][i]}static reedSolomonComputeDivisor(i){if(i<1||i>255)throw new RangeError("Degree out of range");let c=[];for(let o=0;o<i-1;o++)c.push(0);c.push(1);let d=1;for(let o=0;o<i;o++){for(let p=0;p<c.length;p++)c[p]=fe.reedSolomonMultiply(c[p],d),p+1<c.length&&(c[p]^=c[p+1]);d=fe.reedSolomonMultiply(d,2)}return c}static reedSolomonComputeRemainder(i,c){let d=c.map(o=>0);for(const o of i){const p=o^d.shift();d.push(0),c.forEach((_,S)=>d[S]^=fe.reedSolomonMultiply(_,p))}return d}static reedSolomonMultiply(i,c){if(i>>>8||c>>>8)throw new RangeError("Byte out of range");let d=0;for(let o=7;o>=0;o--)d=d<<1^(d>>>7)*285,d^=(c>>>o&1)*i;return m(d>>>8==0),d}finderPenaltyCountPatterns(i){const c=i[1];m(c<=this.size*3);const d=c>0&&i[2]==c&&i[3]==c*3&&i[4]==c&&i[5]==c;return(d&&i[0]>=c*4&&i[6]>=c?1:0)+(d&&i[6]>=c*4&&i[0]>=c?1:0)}finderPenaltyTerminateAndCount(i,c,d){return i&&(this.finderPenaltyAddHistory(c,d),c=0),c+=this.size,this.finderPenaltyAddHistory(c,d),this.finderPenaltyCountPatterns(d)}finderPenaltyAddHistory(i,c){c[0]==0&&(i+=this.size),c.pop(),c.unshift(i)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function s(r,i,c){if(i<0||i>31||r>>>i)throw new RangeError("Value out of range");for(let d=i-1;d>=0;d--)c.push(r>>>d&1)}function l(r,i){return(r>>>i&1)!=0}function m(r){if(!r)throw new Error("Assertion error")}const b=class Te{constructor(i,c,d){if(this.mode=i,this.numChars=c,this.bitData=d,c<0)throw new RangeError("Invalid argument");this.bitData=d.slice()}static makeBytes(i){let c=[];for(const d of i)s(d,8,c);return new Te(Te.Mode.BYTE,i.length,c)}static makeNumeric(i){if(!Te.isNumeric(i))throw new RangeError("String contains non-numeric characters");let c=[];for(let d=0;d<i.length;){const o=Math.min(i.length-d,3);s(parseInt(i.substring(d,d+o),10),o*3+1,c),d+=o}return new Te(Te.Mode.NUMERIC,i.length,c)}static makeAlphanumeric(i){if(!Te.isAlphanumeric(i))throw new RangeError("String contains unencodable characters in alphanumeric mode");let c=[],d;for(d=0;d+2<=i.length;d+=2){let o=Te.ALPHANUMERIC_CHARSET.indexOf(i.charAt(d))*45;o+=Te.ALPHANUMERIC_CHARSET.indexOf(i.charAt(d+1)),s(o,11,c)}return d<i.length&&s(Te.ALPHANUMERIC_CHARSET.indexOf(i.charAt(d)),6,c),new Te(Te.Mode.ALPHANUMERIC,i.length,c)}static makeSegments(i){return i==""?[]:Te.isNumeric(i)?[Te.makeNumeric(i)]:Te.isAlphanumeric(i)?[Te.makeAlphanumeric(i)]:[Te.makeBytes(Te.toUtf8ByteArray(i))]}static makeEci(i){let c=[];if(i<0)throw new RangeError("ECI assignment value out of range");if(i<128)s(i,8,c);else if(i<16384)s(2,2,c),s(i,14,c);else if(i<1e6)s(6,3,c),s(i,21,c);else throw new RangeError("ECI assignment value out of range");return new Te(Te.Mode.ECI,0,c)}static isNumeric(i){return Te.NUMERIC_REGEX.test(i)}static isAlphanumeric(i){return Te.ALPHANUMERIC_REGEX.test(i)}getData(){return this.bitData.slice()}static getTotalBits(i,c){let d=0;for(const o of i){const p=o.mode.numCharCountBits(c);if(o.numChars>=1<<p)return 1/0;d+=4+p+o.bitData.length}return d}static toUtf8ByteArray(i){i=encodeURI(i);let c=[];for(let d=0;d<i.length;d++)i.charAt(d)!="%"?c.push(i.charCodeAt(d)):(c.push(parseInt(i.substring(d+1,d+3),16)),d+=2);return c}};b.NUMERIC_REGEX=/^[0-9]*$/,b.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,b.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let C=b;e.QrSegment=b})(Et||(Et={}));(e=>{(t=>{const s=class{constructor(m,b){this.ordinal=m,this.formatBits=b}};s.LOW=new s(0,1),s.MEDIUM=new s(1,0),s.QUARTILE=new s(2,3),s.HIGH=new s(3,2),t.Ecc=s})(e.QrCode||(e.QrCode={}))})(Et||(Et={}));(e=>{(t=>{const s=class{constructor(m,b){this.modeBits=m,this.numBitsCharCount=b}numCharCountBits(m){return this.numBitsCharCount[Math.floor((m+7)/17)]}};s.NUMERIC=new s(1,[10,12,14]),s.ALPHANUMERIC=new s(2,[9,11,13]),s.BYTE=new s(4,[8,16,16]),s.KANJI=new s(8,[8,10,12]),s.ECI=new s(7,[0,0,0]),t.Mode=s})(e.QrSegment||(e.QrSegment={}))})(Et||(Et={}));var Tt=Et;var dp={L:Tt.QrCode.Ecc.LOW,M:Tt.QrCode.Ecc.MEDIUM,Q:Tt.QrCode.Ecc.QUARTILE,H:Tt.QrCode.Ecc.HIGH},po=128,mo="L",vo="#FFFFFF",go="#000000",_o=!1,bo=1,fp=4,pp=0,mp=.1;function xo(e,t=0){const s=[];return e.forEach(function(l,m){let b=null;l.forEach(function(C,r){if(!C&&b!==null){s.push(`M${b+t} ${m+t}h${r-b}v1H${b+t}z`),b=null;return}if(r===l.length-1){if(!C)return;b===null?s.push(`M${r+t},${m+t} h1v1H${r+t}z`):s.push(`M${b+t},${m+t} h${r+1-b}v1H${b+t}z`);return}C&&b===null&&(b=r)})}),s.join("")}function So(e,t){return e.slice().map((s,l)=>l<t.y||l>=t.y+t.h?s:s.map((m,b)=>b<t.x||b>=t.x+t.w?m:!1))}function vp(e,t,s,l){if(l==null)return null;const m=e.length+s*2,b=Math.floor(t*mp),C=m/t,r=(l.width||b)*C,i=(l.height||b)*C,c=l.x==null?e.length/2-r/2:l.x*C,d=l.y==null?e.length/2-i/2:l.y*C,o=l.opacity==null?1:l.opacity;let p=null;if(l.excavate){let S=Math.floor(c),g=Math.floor(d),n=Math.ceil(r+c-S),f=Math.ceil(i+d-g);p={x:S,y:g,w:n,h:f}}const _=l.crossOrigin;return{x:c,y:d,h:i,w:r,excavation:p,opacity:o,crossOrigin:_}}function gp(e,t){return t!=null?Math.max(Math.floor(t),0):e?fp:pp}function yo({value:e,level:t,minVersion:s,includeMargin:l,marginSize:m,imageSettings:b,size:C,boostLevel:r}){let i=ee.useMemo(()=>{const S=(Array.isArray(e)?e:[e]).reduce((g,n)=>(g.push(...Tt.QrSegment.makeSegments(n)),g),[]);return Tt.QrCode.encodeSegments(S,dp[t],s,void 0,void 0,r)},[e,t,s,r]);const{cells:c,margin:d,numCells:o,calculatedImageSettings:p}=ee.useMemo(()=>{let _=i.getModules();const S=gp(l,m),g=_.length+S*2,n=vp(_,C,S,b);return{cells:_,margin:S,numCells:g,calculatedImageSettings:n}},[i,C,b,l,m]);return{qrcode:i,margin:d,cells:c,numCells:o,calculatedImageSettings:p}}var _p=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),bp=ee.forwardRef(function(t,s){const l=t,{value:m,size:b=po,level:C=mo,bgColor:r=vo,fgColor:i=go,includeMargin:c=_o,minVersion:d=bo,boostLevel:o,marginSize:p,imageSettings:_}=l,g=ur(l,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:n}=g,f=ur(g,["style"]),h=_?.src,u=ee.useRef(null),v=ee.useRef(null),x=ee.useCallback(B=>{u.current=B,typeof s=="function"?s(B):s&&(s.current=B)},[s]),[w,k]=ee.useState(!1),{margin:y,cells:E,numCells:j,calculatedImageSettings:A}=yo({value:m,level:C,minVersion:d,boostLevel:o,includeMargin:c,marginSize:p,imageSettings:_,size:b});ee.useEffect(()=>{if(u.current!=null){const B=u.current,I=B.getContext("2d");if(!I)return;let H=E;const W=v.current,D=A!=null&&W!==null&&W.complete&&W.naturalHeight!==0&&W.naturalWidth!==0;D&&A.excavation!=null&&(H=So(E,A.excavation));const M=window.devicePixelRatio||1;B.height=B.width=b*M;const P=b/j*M;I.scale(P,P),I.fillStyle=r,I.fillRect(0,0,j,j),I.fillStyle=i,_p?I.fill(new Path2D(xo(H,y))):E.forEach(function(O,U){O.forEach(function(K,V){K&&I.fillRect(V+y,U+y,1,1)})}),A&&(I.globalAlpha=A.opacity),D&&I.drawImage(W,A.x+y,A.y+y,A.w,A.h)}}),ee.useEffect(()=>{k(!1)},[h]);const L=hr({height:b,width:b},n);let N=null;return h!=null&&(N=ee.createElement("img",{src:h,key:h,style:{display:"none"},onLoad:()=>{k(!0)},ref:v,crossOrigin:A?.crossOrigin})),ee.createElement(ee.Fragment,null,ee.createElement("canvas",hr({style:L,height:b,width:b,ref:x,role:"img"},f)),N)});bp.displayName="QRCodeCanvas";var Co=ee.forwardRef(function(t,s){const l=t,{value:m,size:b=po,level:C=mo,bgColor:r=vo,fgColor:i=go,includeMargin:c=_o,minVersion:d=bo,boostLevel:o,title:p,marginSize:_,imageSettings:S}=l,g=ur(l,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:n,cells:f,numCells:h,calculatedImageSettings:u}=yo({value:m,level:C,minVersion:d,boostLevel:o,includeMargin:c,marginSize:_,imageSettings:S,size:b});let v=f,x=null;S!=null&&u!=null&&(u.excavation!=null&&(v=So(f,u.excavation)),x=ee.createElement("image",{href:S.src,height:u.h,width:u.w,x:u.x+n,y:u.y+n,preserveAspectRatio:"none",opacity:u.opacity,crossOrigin:u.crossOrigin}));const w=xo(v,n);return ee.createElement("svg",hr({height:b,width:b,viewBox:`0 0 ${h} ${h}`,ref:s,role:"img"},g),!!p&&ee.createElement("title",null,p),ee.createElement("path",{fill:r,d:`M0,0 h${h}v${h}H0z`,shapeRendering:"crispEdges"}),ee.createElement("path",{fill:i,d:w,shapeRendering:"crispEdges"}),x)});Co.displayName="QRCodeSVG";function xp(){return at({queryKey:ce.tunnel.status,queryFn:()=>be.get("/tunnel/status"),refetchInterval:e=>e.state.data?.running?1e4:!1})}function Sp(){const e=Ie();return Ge({mutationFn:()=>{const t=parseInt(window.location.port||(window.location.protocol==="https:"?"443":"80"),10);return be.post("/tunnel/start",{port:t})},onSuccess:()=>{e.invalidateQueries({queryKey:ce.tunnel.status})}})}function yp(){const e=Ie();return Ge({mutationFn:()=>be.post("/tunnel/stop"),onSuccess:()=>{e.invalidateQueries({queryKey:ce.tunnel.status})}})}function Mi(){const{data:e}=xp(),t=Sp(),s=yp(),[l,m]=R.useState(!1),[b,C]=R.useState(null),r=R.useRef(null),[i,c]=R.useState({top:0,right:0}),[d,o]=R.useState(!1),p=e?.running??!1,_=t.isPending,S=e?.shareableUrl,g=e?.token;R.useEffect(()=>{if(l&&r.current){const v=r.current.getBoundingClientRect();c({top:v.bottom+8,right:window.innerWidth-v.right})}},[l]);const n=R.useCallback(()=>{p?m(!0):t.mutate(void 0,{onSuccess:()=>m(!0)})},[p,t]),f=R.useCallback(()=>{S&&(navigator.clipboard.writeText(S),C("url"),setTimeout(()=>C(null),2e3))},[S]),h=R.useCallback(()=>{g&&(navigator.clipboard.writeText(g),C("token"),setTimeout(()=>C(null),2e3))},[g]),u=R.useCallback(()=>{s.mutate(),m(!1),o(!1)},[s]);return a.jsxs("div",{className:"relative",children:[a.jsx("button",{ref:r,onClick:n,disabled:_,className:`p-1.5 rounded-md transition-colors ${p?"text-emerald-600 hover:bg-emerald-50":"text-neutral-400 hover:text-neutral-900 hover:bg-neutral-100"}`,title:p?"Tunnel active":"Share via tunnel",children:_?a.jsx(Be,{size:16,className:"animate-spin"}):a.jsx(Es,{size:16})}),p&&!_&&a.jsx("span",{className:"absolute top-0.5 right-0.5 w-2 h-2 bg-emerald-500 rounded-full"}),l&&p&&Rt.createPortal(a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-[100]",onClick:()=>m(!1)}),a.jsxs("div",{className:"fixed z-[101] w-80 bg-white rounded-lg shadow-lg border border-neutral-200 p-3",style:{top:i.top,right:i.right},children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("span",{className:"text-xs font-medium text-emerald-600 flex items-center gap-1.5",children:[a.jsx("span",{className:"w-1.5 h-1.5 bg-emerald-500 rounded-full inline-block"}),"Tunnel Active"]}),a.jsx("button",{onClick:()=>m(!1),className:"p-0.5 text-neutral-400 hover:text-neutral-600 rounded",children:a.jsx(ks,{size:14})})]}),g&&a.jsxs("div",{className:"flex items-center gap-1.5 mb-2 px-2 py-1 bg-emerald-50 rounded text-xs text-emerald-700",children:[a.jsx(Ba,{size:12}),a.jsx("span",{children:"Token protected"})]}),S&&a.jsx("div",{className:"flex justify-center py-3",children:a.jsx(Co,{value:S,size:160})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{readOnly:!0,value:S??e?.url??"",className:"flex-1 px-2 py-1.5 text-xs bg-neutral-50 border border-neutral-200 rounded-md text-neutral-700 select-all",onFocus:v=>v.target.select()}),a.jsx("button",{onClick:f,className:"p-1.5 text-neutral-500 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors",title:"Copy shareable link",children:b==="url"?a.jsx(fs,{size:14,className:"text-emerald-500"}):a.jsx(Wr,{size:14})})]}),g&&a.jsxs("div",{className:"mt-2",children:[a.jsx("button",{onClick:()=>o(!d),className:"text-xs text-neutral-500 hover:text-neutral-700 transition-colors",children:d?"Hide token":"Show token"}),d&&a.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[a.jsx("code",{className:"flex-1 px-2 py-1.5 text-xs bg-neutral-50 border border-neutral-200 rounded-md text-neutral-600 break-all",children:g}),a.jsx("button",{onClick:h,className:"p-1.5 text-neutral-500 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors shrink-0",title:"Copy token",children:b==="token"?a.jsx(fs,{size:14,className:"text-emerald-500"}):a.jsx(Wr,{size:14})})]})]}),a.jsx("button",{onClick:u,disabled:s.isPending,className:"mt-2 w-full px-3 py-1.5 text-xs text-red-600 hover:bg-red-50 rounded-md transition-colors",children:s.isPending?"Stopping...":"Stop Tunnel"})]})]}),document.body)]})}const Pi={idle:"Create & Start","creating-task":"Creating Task...","creating-workspace":"Creating Workspace...","creating-session":"Creating Session...","starting-session":"Starting Agent..."},Ot=R.lazy(()=>Hi(()=>import("./modal-Cs0LO1_I.js").then(e=>e.m),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.Modal}))),er=R.lazy(()=>Hi(()=>import("./folder-picker-BNSXB4UX.js"),__vite__mapDeps([5,1,2,3,6,7,8,9,10,11,12,13])).then(e=>({default:e.FolderPicker}))),Oi=a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-neutral-900",children:[a.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",fill:"currentColor"}),a.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Bi=a.jsx("span",{className:"font-bold text-neutral-900 tracking-tight text-base",children:"Agent Tower"}),Cp=260,wp=600,Ii=400;function Fp(){const[e,t]=R.useState(null),[s,l]=R.useState(null),[m,b]=R.useState(Ii),[C,r]=R.useState(!1),[i,c]=R.useState(!1),[d,o]=R.useState(""),[p,_]=R.useState(""),[S,g]=R.useState(""),[n,f]=R.useState(""),[h,u]=R.useState(""),[v,x]=R.useState(""),[w,k]=R.useState("idle"),{files:y,addFiles:E,removeFile:j,clear:A,buildMarkdownLinks:L,isUploading:N}=Mr(),B=R.useRef(null),I=R.useRef(!1),H=R.useRef(0),W=R.useRef(Ii),D=R.useRef(null),M=Ie(),{data:P,isLoading:O}=_r(),{data:U,isLoading:K}=Uo(),V=U?.data??[],Y=R.useMemo(()=>V.map(Nf),[V]),ie=R.useMemo(()=>V.map(q=>q.id),[V]);Hf(ie);const{data:T,isLoading:F}=Of(s??""),$=Vo({queries:s?[]:V.map(q=>({queryKey:ce.tasks.list(q.id),queryFn:()=>be.get(`/projects/${q.id}/tasks`,{params:{limit:"100"}})}))}),z=!s&&$.some(q=>q.isLoading),J=R.useMemo(()=>{if(s)return T?.data??[];const q=[];for(const re of $)re.data?.data&&q.push(...re.data.data);return q},[s,T,$]),X=R.useMemo(()=>{const q=new Map;for(const re of J){const ae=re.createdAt?new Date(re.createdAt).getTime():0,pe=q.get(re.projectId)??0;ae>pe&&q.set(re.projectId,ae)}return[...V].sort((re,ae)=>{const pe=q.get(re.id)??(re.createdAt?new Date(re.createdAt).getTime():0);return(q.get(ae.id)??(ae.createdAt?new Date(ae.createdAt).getTime():0))-pe})},[V,J]),oe=R.useMemo(()=>{if(!P)return[];const q=localStorage.getItem("providerUsageCount"),re=q?JSON.parse(q):{};return[...P].sort((ae,pe)=>{const xe=ae.availability.type!=="NOT_FOUND",Me=pe.availability.type!=="NOT_FOUND";if(xe!==Me)return xe?-1:1;const qe=re[ae.provider.id]??0;return(re[pe.provider.id]??0)-qe})},[P]),he=R.useMemo(()=>J.map(Pf),[J]),we=R.useMemo(()=>new Set,[]),je=R.useMemo(()=>{if(!e)return null;const q=he.find(ae=>ae.id===e);if(!q)return null;const re=V.find(ae=>ae.id===q.projectId);return{id:q.id,projectId:q.projectId,projectName:re?.name??"Unknown",projectColor:re?.color??"text-neutral-500",title:q.title,status:q.status,branch:q.branch,mainBranch:re?.mainBranch??"main",description:q.description}},[e,he,V]),Z=qo(),ze=Bf(h),Fe=Ff(),Re=If(),Q=R.useCallback(q=>{Fe.mutate(q,{onSuccess:()=>{e===q&&t(null),M.invalidateQueries({queryKey:ce.tasks.all})}})},[Fe,e,M]),se=R.useCallback((q,re)=>{Re.mutate({id:q,status:jf(re)},{onError:()=>{Lo.error("状态变更失败,该操作不被允许")}})},[Re]),ue=R.useCallback(q=>{q.preventDefault(),I.current=!0,H.current=q.clientX,W.current=m,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[m]);R.useEffect(()=>{const q=ae=>{if(!I.current)return;const pe=ae.clientX-H.current,xe=Math.max(Cp,Math.min(wp,W.current+pe));b(xe)},re=()=>{I.current&&(I.current=!1,document.body.style.cursor="",document.body.style.userSelect="")};return document.addEventListener("mousemove",q),document.addEventListener("mouseup",re),()=>{document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",re)}},[]);const ne=R.useCallback(()=>{r(!0)},[]),ge=R.useCallback(()=>{const q=localStorage.getItem("lastSelectedProjectId"),re=localStorage.getItem("lastSelectedProviderId"),ae=q&&X.find(Me=>Me.id===q)?q:s??X[0]?.id??"";u(ae);const pe=oe?.find(Me=>Me.availability.type!=="NOT_FOUND"),xe=re&&oe?.find(Me=>Me.provider.id===re&&Me.availability.type!=="NOT_FOUND")?re:pe?.provider.id??"";x(xe),k("idle"),c(!0)},[s,X,oe]),me=R.useCallback(()=>{r(!1),o(""),_("")},[]),ye=R.useCallback(()=>{w==="idle"&&(c(!1),g(""),f(""),u(""),x(""),k("idle"),A())},[w,A]),Le=R.useCallback(async()=>{if(!(!d.trim()||!p.trim()))try{await Z.mutateAsync({name:d.trim(),repoPath:p.trim()}),me()}catch{}},[d,p,Z,me]),Ve=io(),Ae=R.useCallback(async()=>{if(!(!S.trim()||!h))try{const q=L(),re=[n.trim(),q].filter(Boolean).join(`
82
82
 
83
83
  `);k("creating-task");const ae=await ze.mutateAsync({title:S.trim(),description:re||void 0});if(localStorage.setItem("lastSelectedProjectId",h),v){localStorage.setItem("lastSelectedProviderId",v);const pe=localStorage.getItem("providerUsageCount"),xe=pe?JSON.parse(pe):{};xe[v]=(xe[v]??0)+1,localStorage.setItem("providerUsageCount",JSON.stringify(xe))}if(v){const pe=[S.trim(),re].filter(Boolean).join(`
84
84