agent-tower 0.1.12 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/executors/base.executor.d.ts +7 -0
- package/dist/executors/base.executor.d.ts.map +1 -1
- package/dist/executors/base.executor.js +61 -0
- package/dist/executors/base.executor.js.map +1 -1
- package/dist/executors/claude-code.executor.d.ts +6 -1
- package/dist/executors/claude-code.executor.d.ts.map +1 -1
- package/dist/executors/claude-code.executor.js +86 -14
- package/dist/executors/claude-code.executor.js.map +1 -1
- package/dist/executors/image-utils.d.ts +59 -0
- package/dist/executors/image-utils.d.ts.map +1 -0
- package/dist/executors/image-utils.js +191 -0
- package/dist/executors/image-utils.js.map +1 -0
- package/dist/output/claude-code-parser.d.ts.map +1 -1
- package/dist/output/claude-code-parser.js.map +1 -1
- package/dist/services/session-manager.d.ts.map +1 -1
- package/dist/services/session-manager.js +19 -2
- package/dist/services/session-manager.js.map +1 -1
- package/dist/web/assets/{AgentDemoPage-BSSw8lBi.js → AgentDemoPage-CRvlbWcT.js} +1 -1
- package/dist/web/assets/{DemoPage-ChEZOSMK.js → DemoPage-6R4b4Gon.js} +1 -1
- package/dist/web/assets/{NotificationSettingsPage-BAJdVRlt.js → NotificationSettingsPage-CZrEncBT.js} +1 -1
- package/dist/web/assets/{ProfileSettingsPage-CyPOtbPE.js → ProfileSettingsPage-B0NeNKi9.js} +1 -1
- package/dist/web/assets/{ProjectKanbanPage-CsnDujzH.js → ProjectKanbanPage-BM6rclOk.js} +3 -3
- package/dist/web/assets/{ProjectSettingsPage-Cxnloxsj.js → ProjectSettingsPage-Ctv5BWdf.js} +1 -1
- package/dist/web/assets/{api-client-DMOOJTSp.js → api-client-JWeNZKcl.js} +1 -1
- package/dist/web/assets/{chevron-down-7rEIRY5W.js → chevron-down-DVussag2.js} +1 -1
- package/dist/web/assets/{circle-alert-CFxKMUaY.js → circle-alert-CvcZV0Gx.js} +1 -1
- package/dist/web/assets/{code-block-OCS4YCEC-DUXwMB8K.js → code-block-OCS4YCEC-ZmRyZGvD.js} +1 -1
- package/dist/web/assets/{folder-picker-CRsgkd7x.js → folder-picker-B7s6TEGt.js} +1 -1
- package/dist/web/assets/{index-Dcp2WlZ9.js → index-BtJ21Bn6.js} +2 -2
- package/dist/web/assets/{loader-circle-Cc62DVk-.js → loader-circle-CZN73-Yt.js} +1 -1
- package/dist/web/assets/{mermaid-NOHMQCX5-hHU9RKnI.js → mermaid-NOHMQCX5-C13e8gYV.js} +46 -46
- package/dist/web/assets/{modal-B3kSXR7L.js → modal-D7xekFRe.js} +1 -1
- package/dist/web/assets/{query-keys-BEXbNSOV.js → query-keys-C9CBerVg.js} +1 -1
- package/dist/web/assets/{select-CxU95DLf.js → select-Dwk13G3M.js} +1 -1
- package/dist/web/assets/{use-profiles-_o0ZlY5d.js → use-profiles-CtLrX0dV.js} +1 -1
- package/dist/web/assets/{use-projects-Bhtz9KoT.js → use-projects-CVQDuqNr.js} +1 -1
- package/dist/web/assets/{x-BO5t15--.js → x-4BBJo9pY.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/modal-
|
|
2
|
-
import{y as jr,z as So,A as yo,a as Co,q as Qs,d as wo,B as Eo,u as Te,r as R,n as ko,c as ue,R as Z,D as _t,j as c,s as ot,S as Oe,C as rt,i as cr,g as hr,E as Ro,G as Do,L as Mr,_ as Ii}from"./index-Dcp2WlZ9.js";import{Q as ur,b as Lo,c as Ao,e as To,d as jo,f as Mo,s as Nr,g as Pr,w as No,h as Po,i as Oo,a as Ue,q as le,u as nt}from"./query-keys-BEXbNSOV.js";import{C as gt,h as dr,b as fr,d as pr,c as mr,i as vr,G as _s,u as Fi,a as Hi,e as zi,T as Wi,P as $i,f as Ui,S as Or}from"./mermaid-NOHMQCX5-hHU9RKnI.js";import{C as dt,a as as}from"./chevron-down-7rEIRY5W.js";import{P as Zs,X as bs}from"./x-BO5t15--.js";import{a as he,c as me,B as it}from"./api-client-DMOOJTSp.js";import{F as Bo,a as Io,c as Fo,u as Ho,d as zo}from"./use-projects-Bhtz9KoT.js";import{L as Ae}from"./loader-circle-Cc62DVk-.js";import{M as xs,T as qi}from"./modal-B3kSXR7L.js";import{S as es}from"./select-CxU95DLf.js";var Wo=class extends ur{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:jr()})}getOptimisticResult(e){return e.behavior=jr(),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,a=super.createResult(e,t),{isFetching:m,isRefetching:b,isError:C,isRefetchError:r}=a,i=s.fetchMeta?.fetchMore?.direction,l=C&&i==="forward",d=m&&i==="forward",o=C&&i==="backward",p=m&&i==="backward";return{...a,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:yo(t,s.data),hasPreviousPage:So(t,s.data),isFetchNextPageError:l,isFetchingNextPage:d,isFetchPreviousPageError:o,isFetchingPreviousPage:p,isRefetchError:r&&!l&&!o,isRefetching:b&&!d&&!p}}};function Br(e,t){const s=new Set(t);return e.filter(a=>!s.has(a))}function $o(e,t,s){const a=e.slice(0);return a[t]=s,a}var Uo=class extends Co{#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,Qs.batch(()=>{const s=this.#t,a=this.#d(this.#i);a.forEach(d=>d.observer.setOptions(d.defaultedQueryOptions));const m=a.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,l=i?!0:b.some((d,o)=>{const p=this.#e[o];return!p||!wo(d,p)});!i&&!l||(i&&(this.#c=a,this.#t=m),this.#e=b,this.hasListeners()&&(i&&(Br(s,m).forEach(d=>{d.destroy()}),Br(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),a=s.map(b=>b.observer.getOptimisticResult(b.defaultedQueryOptions)),m=s.map(b=>b.defaultedQueryOptions.queryHash);return[a,b=>this.#u(b??a,t,m),()=>this.#h(a,s)]}#h(e,t){return t.map((s,a)=>{const m=e[a];return s.defaultedQueryOptions.notifyOnChangeProps?m:s.observer.trackResult(m,b=>{t.forEach(C=>{C.observer.trackProp(b)})})})}#u(e,t,s){if(t){const a=this.#l,m=s!==void 0&&a!==void 0&&(a.length!==s.length||s.some((b,C)=>b!==a[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=Eo(this.#s,t(e))),this.#s}return e}#d(e){const t=new Map;this.#t.forEach(a=>{const m=a.options.queryHash;if(!m)return;const b=t.get(m);b?b.push(a):t.set(m,[a])});const s=[];return e.forEach(a=>{const m=this.#r.defaultQueryOptions(a),C=t.get(m.queryHash)?.shift()??new ur(this.#r,m);s.push({defaultedQueryOptions:m,observer:C})}),s}#f(e,t){const s=this.#t.indexOf(e);s!==-1&&(this.#e=$o(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&&Qs.batch(()=>{this.listeners.forEach(a=>{a(this.#e)})})}}};function qo({queries:e,...t},s){const a=Te(),m=Lo(),b=Ao(),C=R.useMemo(()=>e.map(g=>{const n=a.defaultQueryOptions(g);return n._optimisticResults=m?"isRestoring":"optimistic",n}),[e,a,m]);C.forEach(g=>{To(g);const n=a.getQueryCache().get(g.queryHash);jo(g,b,n)}),Mo(b);const[r]=R.useState(()=>new Uo(a,C,t)),[i,l,d]=r.getOptimisticResult(C,t.combine),o=!m&&t.subscribed!==!1;R.useSyncExternalStore(R.useCallback(g=>o?r.subscribe(Qs.batchCalls(g)):ko,[r,o]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),R.useEffect(()=>{r.setQueries(C,t)},[C,t,r]);const _=i.some((g,n)=>Nr(C[n],g))?i.flatMap((g,n)=>{const f=C[n];if(f){const h=new ur(a,f);if(Nr(f,g))return Pr(f,h,b);No(g,m)&&Pr(f,h,b)}return[]}):[];if(_.length>0)throw Promise.all(_);const y=i.find((g,n)=>{const f=C[n];return f&&Po({result:g,errorResetBoundary:b,throwOnError:f.throwOnError,query:a.getQueryCache().get(f.queryHash),suspense:f.suspense})});if(y?.error)throw y.error;return l(d())}function Ki(e,t){return Oo(e,Wo)}const Ko=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Xi=ue("arrow-down",Ko);const Xo=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Yi=ue("arrow-right",Xo);const Yo=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Vi=ue("arrow-up",Yo);const Vo=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Ir=ue("circle-check-big",Vo);const Go=[["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"}]],Ss=ue("code-xml",Go);const Qo=[["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"}]],Fr=ue("copy",Qo);const Zo=[["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"}]],Gi=ue("ellipsis-vertical",Zo);const Jo=[["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"}]],ea=ue("file-braces-corner",Jo);const ta=[["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"}]],Ht=ue("file-code-corner",ta);const sa=[["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"}]],ra=ue("file-exclamation-point",sa);const ia=[["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"}]],Qi=ue("file-text",ia);const na=[["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"}]],Zi=ue("folder-open",na);const oa=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],aa=ue("gauge",oa);const la=[["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"}]],ca=ue("git-branch",la);const ha=[["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"}]],ua=ue("git-fork",ha);const da=[["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"}]],zt=ue("git-graph",da);const fa=[["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"}]],Ji=ue("git-merge",fa);const pa=[["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"}]],Ct=ue("history",pa);const ma=[["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"}]],gr=ue("image",ma);const va=[["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"}]],Hr=ue("layers",va);const ga=[["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"}]],_a=ue("maximize",ga);const ba=[["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"}]],xa=ue("message-square",ba);const Sa=[["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"}]],ya=ue("panel-left-close",Sa);const Ca=[["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"}]],wa=ue("panel-left-open",Ca);const Ea=[["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"}]],ka=ue("panel-right-close",Ea);const Ra=[["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"}]],Da=ue("panel-right-open",Ra);const La=[["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"}]],St=ue("play",La);const Aa=[["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"}]],Ta=ue("refresh-cw",Aa);const ja=[["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"}]],Ma=ue("shield",ja);const Na=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],ls=ue("terminal",Na);const Pa=[["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"}]],_r=ue("triangle-alert",Pa);const Oa=[["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"}]],Ba=ue("zap",Oa);const Ia=[["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"}]],Fa=ue("zoom-in",Ia);const Ha=[["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"}]],za=ue("zoom-out",Ha),ys=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function wt(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function br(e){return"nodeType"in e}function $e(e){var t,s;return e?wt(e)?e:br(e)&&(t=(s=e.ownerDocument)==null?void 0:s.defaultView)!=null?t:window:window}function xr(e){const{Document:t}=$e(e);return e instanceof t}function Kt(e){return wt(e)?!1:e instanceof $e(e).HTMLElement}function en(e){return e instanceof $e(e).SVGElement}function Et(e){return e?wt(e)?e.document:br(e)?xr(e)?e:Kt(e)||en(e)?e.ownerDocument:document:document:document}const at=ys?R.useLayoutEffect:R.useEffect;function Cs(e){const t=R.useRef(e);return at(()=>{t.current=e}),R.useCallback(function(){for(var s=arguments.length,a=new Array(s),m=0;m<s;m++)a[m]=arguments[m];return t.current==null?void 0:t.current(...a)},[])}function Wa(){const e=R.useRef(null),t=R.useCallback((a,m)=>{e.current=setInterval(a,m)},[]),s=R.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,s]}function Wt(e,t){t===void 0&&(t=[e]);const s=R.useRef(e);return at(()=>{s.current!==e&&(s.current=e)},t),s}function Xt(e,t){const s=R.useRef();return R.useMemo(()=>{const a=e(s.current);return s.current=a,a},[...t])}function cs(e){const t=Cs(e),s=R.useRef(null),a=R.useCallback(m=>{m!==s.current&&t?.(m,s.current),s.current=m},[]);return[s,a]}function hs(e){const t=R.useRef();return R.useEffect(()=>{t.current=e},[e]),t.current}let Os={};function ws(e,t){return R.useMemo(()=>{if(t)return t;const s=Os[e]==null?0:Os[e]+1;return Os[e]=s,e+"-"+s},[e,t])}function tn(e){return function(t){for(var s=arguments.length,a=new Array(s>1?s-1:0),m=1;m<s;m++)a[m-1]=arguments[m];return a.reduce((b,C)=>{const r=Object.entries(C);for(const[i,l]of r){const d=b[i];d!=null&&(b[i]=d+e*l)}return b},{...t})}}const yt=tn(1),us=tn(-1);function $a(e){return"clientX"in e&&"clientY"in e}function Sr(e){if(!e)return!1;const{KeyboardEvent:t}=$e(e.target);return t&&e instanceof t}function Ua(e){if(!e)return!1;const{TouchEvent:t}=$e(e.target);return t&&e instanceof t}function ds(e){if(Ua(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 $a(e)?{x:e.clientX,y:e.clientY}:null}const $t=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[$t.Translate.toString(e),$t.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:s,easing:a}=e;return t+" "+s+"ms "+a}}}),zr="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function qa(e){return e.matches(zr)?e:e.querySelector(zr)}const Ka={display:"none"};function Xa(e){let{id:t,value:s}=e;return Z.createElement("div",{id:t,style:Ka},s)}function Ya(e){let{id:t,announcement:s,ariaLiveType:a="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 Z.createElement("div",{id:t,style:m,role:"status","aria-live":a,"aria-atomic":!0},s)}function Va(){const[e,t]=R.useState("");return{announce:R.useCallback(a=>{a!=null&&t(a)},[]),announcement:e}}const sn=R.createContext(null);function Ga(e){const t=R.useContext(sn);R.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Qa(){const[e]=R.useState(()=>new Set),t=R.useCallback(a=>(e.add(a),()=>e.delete(a)),[e]);return[R.useCallback(a=>{let{type:m,event:b}=a;e.forEach(C=>{var r;return(r=C[m])==null?void 0:r.call(C,b)})},[e]),t]}const Za={draggable:`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/modal-D7xekFRe.js","assets/index-BtJ21Bn6.js","assets/index-uPUZpEZk.css","assets/api-client-JWeNZKcl.js","assets/x-4BBJo9pY.js","assets/folder-picker-B7s6TEGt.js","assets/mermaid-NOHMQCX5-C13e8gYV.js","assets/chevron-down-DVussag2.js","assets/mermaid-NOHMQCX5-lI9o3AWT.css","assets/loader-circle-CZN73-Yt.js","assets/circle-alert-CvcZV0Gx.js","assets/use-projects-CVQDuqNr.js","assets/query-keys-C9CBerVg.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{y as jr,z as So,A as yo,a as Co,q as Qs,d as wo,B as Eo,u as Te,r as R,n as ko,c as ue,R as Z,D as _t,j as c,s as ot,S as Oe,C as rt,i as cr,g as hr,E as Ro,G as Do,L as Mr,_ as Ii}from"./index-BtJ21Bn6.js";import{Q as ur,b as Lo,c as Ao,e as To,d as jo,f as Mo,s as Nr,g as Pr,w as No,h as Po,i as Oo,a as Ue,q as le,u as nt}from"./query-keys-C9CBerVg.js";import{C as gt,h as dr,b as fr,d as pr,c as mr,i as vr,G as _s,u as Fi,a as Hi,e as zi,T as Wi,P as $i,f as Ui,S as Or}from"./mermaid-NOHMQCX5-C13e8gYV.js";import{C as dt,a as as}from"./chevron-down-DVussag2.js";import{P as Zs,X as bs}from"./x-4BBJo9pY.js";import{a as he,c as me,B as it}from"./api-client-JWeNZKcl.js";import{F as Bo,a as Io,c as Fo,u as Ho,d as zo}from"./use-projects-CVQDuqNr.js";import{L as Ae}from"./loader-circle-CZN73-Yt.js";import{M as xs,T as qi}from"./modal-D7xekFRe.js";import{S as es}from"./select-Dwk13G3M.js";var Wo=class extends ur{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:jr()})}getOptimisticResult(e){return e.behavior=jr(),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,a=super.createResult(e,t),{isFetching:m,isRefetching:b,isError:C,isRefetchError:r}=a,i=s.fetchMeta?.fetchMore?.direction,l=C&&i==="forward",d=m&&i==="forward",o=C&&i==="backward",p=m&&i==="backward";return{...a,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:yo(t,s.data),hasPreviousPage:So(t,s.data),isFetchNextPageError:l,isFetchingNextPage:d,isFetchPreviousPageError:o,isFetchingPreviousPage:p,isRefetchError:r&&!l&&!o,isRefetching:b&&!d&&!p}}};function Br(e,t){const s=new Set(t);return e.filter(a=>!s.has(a))}function $o(e,t,s){const a=e.slice(0);return a[t]=s,a}var Uo=class extends Co{#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,Qs.batch(()=>{const s=this.#t,a=this.#d(this.#i);a.forEach(d=>d.observer.setOptions(d.defaultedQueryOptions));const m=a.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,l=i?!0:b.some((d,o)=>{const p=this.#e[o];return!p||!wo(d,p)});!i&&!l||(i&&(this.#c=a,this.#t=m),this.#e=b,this.hasListeners()&&(i&&(Br(s,m).forEach(d=>{d.destroy()}),Br(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),a=s.map(b=>b.observer.getOptimisticResult(b.defaultedQueryOptions)),m=s.map(b=>b.defaultedQueryOptions.queryHash);return[a,b=>this.#u(b??a,t,m),()=>this.#h(a,s)]}#h(e,t){return t.map((s,a)=>{const m=e[a];return s.defaultedQueryOptions.notifyOnChangeProps?m:s.observer.trackResult(m,b=>{t.forEach(C=>{C.observer.trackProp(b)})})})}#u(e,t,s){if(t){const a=this.#l,m=s!==void 0&&a!==void 0&&(a.length!==s.length||s.some((b,C)=>b!==a[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=Eo(this.#s,t(e))),this.#s}return e}#d(e){const t=new Map;this.#t.forEach(a=>{const m=a.options.queryHash;if(!m)return;const b=t.get(m);b?b.push(a):t.set(m,[a])});const s=[];return e.forEach(a=>{const m=this.#r.defaultQueryOptions(a),C=t.get(m.queryHash)?.shift()??new ur(this.#r,m);s.push({defaultedQueryOptions:m,observer:C})}),s}#f(e,t){const s=this.#t.indexOf(e);s!==-1&&(this.#e=$o(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&&Qs.batch(()=>{this.listeners.forEach(a=>{a(this.#e)})})}}};function qo({queries:e,...t},s){const a=Te(),m=Lo(),b=Ao(),C=R.useMemo(()=>e.map(g=>{const n=a.defaultQueryOptions(g);return n._optimisticResults=m?"isRestoring":"optimistic",n}),[e,a,m]);C.forEach(g=>{To(g);const n=a.getQueryCache().get(g.queryHash);jo(g,b,n)}),Mo(b);const[r]=R.useState(()=>new Uo(a,C,t)),[i,l,d]=r.getOptimisticResult(C,t.combine),o=!m&&t.subscribed!==!1;R.useSyncExternalStore(R.useCallback(g=>o?r.subscribe(Qs.batchCalls(g)):ko,[r,o]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),R.useEffect(()=>{r.setQueries(C,t)},[C,t,r]);const _=i.some((g,n)=>Nr(C[n],g))?i.flatMap((g,n)=>{const f=C[n];if(f){const h=new ur(a,f);if(Nr(f,g))return Pr(f,h,b);No(g,m)&&Pr(f,h,b)}return[]}):[];if(_.length>0)throw Promise.all(_);const y=i.find((g,n)=>{const f=C[n];return f&&Po({result:g,errorResetBoundary:b,throwOnError:f.throwOnError,query:a.getQueryCache().get(f.queryHash),suspense:f.suspense})});if(y?.error)throw y.error;return l(d())}function Ki(e,t){return Oo(e,Wo)}const Ko=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Xi=ue("arrow-down",Ko);const Xo=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Yi=ue("arrow-right",Xo);const Yo=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Vi=ue("arrow-up",Yo);const Vo=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Ir=ue("circle-check-big",Vo);const Go=[["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"}]],Ss=ue("code-xml",Go);const Qo=[["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"}]],Fr=ue("copy",Qo);const Zo=[["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"}]],Gi=ue("ellipsis-vertical",Zo);const Jo=[["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"}]],ea=ue("file-braces-corner",Jo);const ta=[["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"}]],Ht=ue("file-code-corner",ta);const sa=[["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"}]],ra=ue("file-exclamation-point",sa);const ia=[["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"}]],Qi=ue("file-text",ia);const na=[["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"}]],Zi=ue("folder-open",na);const oa=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],aa=ue("gauge",oa);const la=[["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"}]],ca=ue("git-branch",la);const ha=[["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"}]],ua=ue("git-fork",ha);const da=[["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"}]],zt=ue("git-graph",da);const fa=[["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"}]],Ji=ue("git-merge",fa);const pa=[["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"}]],Ct=ue("history",pa);const ma=[["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"}]],gr=ue("image",ma);const va=[["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"}]],Hr=ue("layers",va);const ga=[["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"}]],_a=ue("maximize",ga);const ba=[["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"}]],xa=ue("message-square",ba);const Sa=[["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"}]],ya=ue("panel-left-close",Sa);const Ca=[["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"}]],wa=ue("panel-left-open",Ca);const Ea=[["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"}]],ka=ue("panel-right-close",Ea);const Ra=[["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"}]],Da=ue("panel-right-open",Ra);const La=[["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"}]],St=ue("play",La);const Aa=[["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"}]],Ta=ue("refresh-cw",Aa);const ja=[["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"}]],Ma=ue("shield",ja);const Na=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],ls=ue("terminal",Na);const Pa=[["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"}]],_r=ue("triangle-alert",Pa);const Oa=[["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"}]],Ba=ue("zap",Oa);const Ia=[["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"}]],Fa=ue("zoom-in",Ia);const Ha=[["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"}]],za=ue("zoom-out",Ha),ys=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function wt(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function br(e){return"nodeType"in e}function $e(e){var t,s;return e?wt(e)?e:br(e)&&(t=(s=e.ownerDocument)==null?void 0:s.defaultView)!=null?t:window:window}function xr(e){const{Document:t}=$e(e);return e instanceof t}function Kt(e){return wt(e)?!1:e instanceof $e(e).HTMLElement}function en(e){return e instanceof $e(e).SVGElement}function Et(e){return e?wt(e)?e.document:br(e)?xr(e)?e:Kt(e)||en(e)?e.ownerDocument:document:document:document}const at=ys?R.useLayoutEffect:R.useEffect;function Cs(e){const t=R.useRef(e);return at(()=>{t.current=e}),R.useCallback(function(){for(var s=arguments.length,a=new Array(s),m=0;m<s;m++)a[m]=arguments[m];return t.current==null?void 0:t.current(...a)},[])}function Wa(){const e=R.useRef(null),t=R.useCallback((a,m)=>{e.current=setInterval(a,m)},[]),s=R.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,s]}function Wt(e,t){t===void 0&&(t=[e]);const s=R.useRef(e);return at(()=>{s.current!==e&&(s.current=e)},t),s}function Xt(e,t){const s=R.useRef();return R.useMemo(()=>{const a=e(s.current);return s.current=a,a},[...t])}function cs(e){const t=Cs(e),s=R.useRef(null),a=R.useCallback(m=>{m!==s.current&&t?.(m,s.current),s.current=m},[]);return[s,a]}function hs(e){const t=R.useRef();return R.useEffect(()=>{t.current=e},[e]),t.current}let Os={};function ws(e,t){return R.useMemo(()=>{if(t)return t;const s=Os[e]==null?0:Os[e]+1;return Os[e]=s,e+"-"+s},[e,t])}function tn(e){return function(t){for(var s=arguments.length,a=new Array(s>1?s-1:0),m=1;m<s;m++)a[m-1]=arguments[m];return a.reduce((b,C)=>{const r=Object.entries(C);for(const[i,l]of r){const d=b[i];d!=null&&(b[i]=d+e*l)}return b},{...t})}}const yt=tn(1),us=tn(-1);function $a(e){return"clientX"in e&&"clientY"in e}function Sr(e){if(!e)return!1;const{KeyboardEvent:t}=$e(e.target);return t&&e instanceof t}function Ua(e){if(!e)return!1;const{TouchEvent:t}=$e(e.target);return t&&e instanceof t}function ds(e){if(Ua(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 $a(e)?{x:e.clientX,y:e.clientY}:null}const $t=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[$t.Translate.toString(e),$t.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:s,easing:a}=e;return t+" "+s+"ms "+a}}}),zr="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function qa(e){return e.matches(zr)?e:e.querySelector(zr)}const Ka={display:"none"};function Xa(e){let{id:t,value:s}=e;return Z.createElement("div",{id:t,style:Ka},s)}function Ya(e){let{id:t,announcement:s,ariaLiveType:a="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 Z.createElement("div",{id:t,style:m,role:"status","aria-live":a,"aria-atomic":!0},s)}function Va(){const[e,t]=R.useState("");return{announce:R.useCallback(a=>{a!=null&&t(a)},[]),announcement:e}}const sn=R.createContext(null);function Ga(e){const t=R.useContext(sn);R.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Qa(){const[e]=R.useState(()=>new Set),t=R.useCallback(a=>(e.add(a),()=>e.delete(a)),[e]);return[R.useCallback(a=>{let{type:m,event:b}=a;e.forEach(C=>{var r;return(r=C[m])==null?void 0:r.call(C,b)})},[e]),t]}const Za={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,6 +78,6 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
78
78
|
`);return c.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,l)=>{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"),c.jsx("div",{className:me("px-3 whitespace-pre",d,o),children:i},l)})})}function Ff({entry:e,type:t,workingDir:s}){const[a,m]=R.useState(!1),b=Di[e.status]||Di.M,C=Bf(e.path);return c.jsxs("div",{children:[c.jsxs("button",{onClick:()=>m(r=>!r),className:me("flex items-center gap-2.5 w-full px-4 py-3 text-left active:bg-neutral-50",a&&"bg-neutral-50"),children:[c.jsx("span",{className:me("w-5 h-5 flex items-center justify-center text-[10px] font-bold border rounded shrink-0",b),children:e.status}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("span",{className:"text-sm text-neutral-900 truncate block",children:Of(e.path)}),C&&c.jsx("span",{className:"text-[11px] text-neutral-400 truncate block",children:C})]}),c.jsx("span",{className:"text-neutral-400 shrink-0",children:a?c.jsx(dt,{size:14}):c.jsx(gt,{size:14})})]}),a&&c.jsx(If,{workingDir:s,filePath:e.path,type:t})]})}function Li({title:e,entries:t,type:s,workingDir:a,defaultOpen:m}){const[b,C]=R.useState(m);return t.length===0?null:c.jsxs("div",{children:[c.jsxs("button",{onClick:()=>C(r=>!r),className:"flex items-center gap-2 w-full px-4 py-2.5 active:bg-neutral-50",children:[c.jsx("span",{className:"text-neutral-400",children:b?c.jsx(dt,{size:14}):c.jsx(gt,{size:14})}),c.jsx("span",{className:"text-xs font-semibold text-neutral-500 uppercase tracking-wider",children:e}),c.jsx("span",{className:"text-[10px] bg-neutral-100 px-1.5 py-0.5 rounded text-neutral-500",children:t.length})]}),b&&c.jsx("div",{className:"divide-y divide-neutral-100",children:t.map(r=>c.jsx(Ff,{entry:r,type:s,workingDir:a},`${s}:${r.path}`))})]})}function Hf({workingDir:e}){const{data:t,isLoading:s,isError:a}=Xn(e);if(!e)return c.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-400 text-sm",children:"No workspace selected."});if(s)return c.jsxs("div",{className:"flex-1 flex items-center justify-center text-neutral-400",children:[c.jsx(Ae,{size:16,className:"animate-spin mr-2"}),c.jsx("span",{className:"text-sm",children:"Loading changes..."})]});if(a)return c.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?c.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-neutral-400 py-16",children:[c.jsx(zt,{size:28,className:"mb-3"}),c.jsx("span",{className:"text-sm",children:"No pending changes"})]}):c.jsxs("div",{className:"flex-1 overflow-y-auto overscroll-y-contain",children:[c.jsx(Li,{title:"Uncommitted",entries:m,type:"uncommitted",workingDir:e,defaultOpen:!0}),c.jsx(Li,{title:"Committed",entries:b,type:"committed",workingDir:e,defaultOpen:!1})]})}const Vs=50,Ai={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 zf(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 Wf(e){const t=e.split("/");return t[t.length-1]||e}function $f(e){const t=e.lastIndexOf("/");return t>0?e.slice(0,t):""}function Uf({workingDir:e,hash:t,filePath:s}){const{data:a,isLoading:m,isError:b}=Gn(e,t,s);if(m)return c.jsxs("div",{className:"flex items-center gap-2 px-3 py-4 text-neutral-400",children:[c.jsx(Ae,{size:14,className:"animate-spin"}),c.jsx("span",{className:"text-xs",children:"Loading diff..."})]});if(b)return c.jsx("div",{className:"px-3 py-3 text-xs text-red-500",children:"Failed to load diff."});const C=a?.diff||"";if(!C.trim())return c.jsx("div",{className:"px-3 py-3 text-xs text-neutral-400",children:"No diff content."});const r=C.split(`
|
|
79
79
|
`);return c.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,l)=>{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"),c.jsx("div",{className:me("px-3 whitespace-pre",d,o),children:i},l)})})}function qf({entry:e,workingDir:t,hash:s}){const[a,m]=R.useState(!1),b=Ai[e.status]||Ai.M,C=$f(e.path);return c.jsxs("div",{children:[c.jsxs("button",{onClick:()=>m(r=>!r),className:me("flex items-center gap-2.5 w-full px-4 py-2.5 text-left active:bg-neutral-50",a&&"bg-neutral-50"),children:[c.jsx("span",{className:me("w-5 h-5 flex items-center justify-center text-[10px] font-bold border rounded shrink-0",b),children:e.status}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("span",{className:"text-sm text-neutral-900 truncate block",children:Wf(e.path)}),C&&c.jsx("span",{className:"text-[11px] text-neutral-400 truncate block",children:C})]}),c.jsx("span",{className:"text-neutral-400 shrink-0",children:a?c.jsx(dt,{size:14}):c.jsx(gt,{size:14})})]}),a&&c.jsx(Uf,{workingDir:t,hash:s,filePath:e.path})]})}function Kf({commit:e,workingDir:t}){const[s,a]=R.useState(!1),{data:m,isLoading:b}=Vn(t,s?e.hash:null),C=m?.files||[];return c.jsxs("div",{children:[c.jsxs("button",{onClick:()=>a(r=>!r),className:me("flex items-start gap-3 w-full px-4 py-3 text-left active:bg-neutral-50",s&&"bg-neutral-50"),children:[c.jsx("div",{className:"flex flex-col items-center shrink-0 pt-0.5",children:c.jsx("div",{className:me("w-2.5 h-2.5 rounded-full shrink-0",s?"bg-blue-500":"bg-neutral-300")})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-xs font-mono text-blue-600 shrink-0",children:e.shortHash}),c.jsx("span",{className:"text-sm text-neutral-900 truncate flex-1",children:e.message})]}),c.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[c.jsx("span",{className:"text-[11px] text-neutral-500 truncate",children:e.author}),c.jsx("span",{className:"text-[11px] text-neutral-400",children:zf(e.timestamp)})]})]}),c.jsx("span",{className:"text-neutral-400 shrink-0 pt-0.5",children:s?c.jsx(dt,{size:14}):c.jsx(gt,{size:14})})]}),s&&c.jsxs("div",{className:"pl-4 border-l-2 border-blue-100 ml-[22px]",children:[e.body&&c.jsx("div",{className:"px-3 py-2 text-xs text-neutral-600 whitespace-pre-wrap leading-4",children:e.body}),b?c.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 text-neutral-400",children:[c.jsx(Ae,{size:14,className:"animate-spin"}),c.jsx("span",{className:"text-xs",children:"Loading files..."})]}):C.length===0?c.jsx("div",{className:"px-3 py-3 text-xs text-neutral-400",children:"No files changed"}):c.jsx("div",{className:"divide-y divide-neutral-100",children:C.map(r=>c.jsx(qf,{entry:r,workingDir:t,hash:e.hash},r.path))})]})]})}function Xf({workingDir:e}){const{data:t,isLoading:s,isError:a,fetchNextPage:m,hasNextPage:b,isFetchingNextPage:C}=Ki({queryKey:le.git.log(e||""),queryFn:({pageParam:i=0})=>he.get("/git/log",{params:{workingDir:e||"",limit:String(Vs),skip:String(i)}}),initialPageParam:0,getNextPageParam:(i,l)=>i.commits.length<Vs?void 0:l.length*Vs,enabled:!!e}),r=t?.pages.flatMap(i=>i.commits)||[];return e?s?c.jsxs("div",{className:"flex-1 flex items-center justify-center text-neutral-400",children:[c.jsx(Ae,{size:16,className:"animate-spin mr-2"}),c.jsx("span",{className:"text-sm",children:"Loading history..."})]}):a?c.jsx("div",{className:"flex-1 flex items-center justify-center text-red-500 text-sm",children:"Failed to load history."}):r.length===0?c.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-neutral-400 py-16",children:[c.jsx(Ct,{size:28,className:"mb-3"}),c.jsx("span",{className:"text-sm",children:"No commit history"})]}):c.jsxs("div",{className:"flex-1 overflow-y-auto overscroll-y-contain",children:[c.jsx("div",{className:"divide-y divide-neutral-100",children:r.map(i=>c.jsx(Kf,{commit:i,workingDir:e},i.hash))}),b&&c.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?c.jsxs(c.Fragment,{children:[c.jsx(Ae,{size:14,className:"animate-spin"})," Loading..."]}):"Load more"})]}):c.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-400 text-sm",children:"No workspace selected."})}function Yf({status:e}){const t={[ae.Running]:"bg-blue-500",[ae.Review]:"bg-amber-500",[ae.Pending]:"bg-neutral-400",[ae.Done]:"bg-emerald-500",[ae.Cancelled]:"bg-neutral-400"};return c.jsx("span",{className:`w-2.5 h-2.5 rounded-full ${t[e]}`})}const Vf=[{key:"chat",label:"Chat",icon:xa},{key:"changes",label:"Changes",icon:zt},{key:"history",label:"History",icon:Ct},{key:"workspace",label:"Workspace",icon:Zi}];function Gf({task:e,onBack:t,onDeleteTask:s,isDeleting:a}){const[m,b]=R.useState("chat"),[C,r]=R.useState(""),[i,l]=R.useState(!1),[d,o]=R.useState(!1),[p,_]=R.useState(!1),y=R.useRef(null),g=R.useRef(null),n=R.useRef(null),{scrollRef:f,contentRef:h,isAtBottom:u,scrollToBottom:v}=xn({resize:"smooth",initial:"instant"}),S=Te();R.useEffect(()=>{if(!p)return;const Q=re=>{y.current&&!y.current.contains(re.target)&&_(!1)};return document.addEventListener("mousedown",Q),()=>document.removeEventListener("mousedown",Q)},[p]);const{data:w,isLoading:k}=Zn(e.id),x=R.useMemo(()=>{if(!w)return null;const Q=w.filter(se=>se.status==="ACTIVE"&&Array.isArray(se.sessions)).flatMap(se=>se.sessions??[]),re=se=>{const q=se.createdAt,ie=se.endedAt??se.startedAt??q;if(!ie)return 0;const pe=Date.parse(ie);return Number.isNaN(pe)?0:pe},fe=se=>{const q=Q.filter(ie=>se.includes(ie.status));return q.length===0?null:q.sort((ie,pe)=>re(pe)-re(ie))[0]??null};return fe([we.RUNNING])??fe([we.PENDING])??fe([we.COMPLETED,we.FAILED,we.CANCELLED])},[w]),E=x?.id??"",A=x?.status===we.RUNNING||x?.status===we.PENDING,j=R.useMemo(()=>{if(w){for(const Q of w)if(Q.status==="ACTIVE"&&Q.worktreePath)return Q.worktreePath;return w[0]?.worktreePath}},[w]),T=R.useMemo(()=>{if(w)return w.find(Q=>Q.status==="ACTIVE")?.id},[w]),N=R.useMemo(()=>{const Q=[];if(w&&w.length>0){const re=w.some(se=>se.status==="ACTIVE");w.some(se=>se.sessions?.some(q=>q.status===we.RUNNING||q.status===we.PENDING))&&Q.push("正在运行的 Agent 将被停止"),re&&(Q.push("分支上未合并的变更将丢失"),Q.push("关联的工作目录(worktree)将被清理"))}return Q},[w]),I=Tr(),F=Ar(),H=to(),{isConnected:z,isLoadingSnapshot:D,logs:M,entries:P,attach:O}=Fi({sessionId:E,onExit:R.useCallback(()=>{S.invalidateQueries({queryKey:["workspaces"]})},[S])}),{todos:U}=Hi(P),{files:K,addFiles:X,removeFile:G,clear:ne,buildMarkdownLinks:L,hasFiles:B,isUploading:$}=ro(),W=R.useMemo(()=>{if(!x?.tokenUsage)return;const Q=x.tokenUsage;if(typeof Q.totalTokens=="number")return Q},[x?.tokenUsage]),J=so(M,W);R.useEffect(()=>{E&&z&&O()},[E,z,O]),R.useEffect(()=>{v()},[e.id,v]);const Y=R.useRef(!1),oe=R.useCallback(async()=>{if(!C.trim()&&!B||!E||Y.current||$)return;Y.current=!0;const Q=L(),re=[C.trim(),Q].filter(Boolean).join(`
|
|
80
80
|
|
|
81
|
-
`);r(""),ne(),g.current&&(g.current.style.height="40px"),I.mutate({id:E,message:re},{onSuccess:()=>O(),onSettled:()=>{Y.current=!1}})},[C,E,I,O,B,$,L,ne]),de=R.useCallback(async()=>{E&&(await H.mutateAsync(E),S.invalidateQueries({queryKey:["workspaces"]}))},[E,H,S]),be=R.useCallback(Q=>{const re=Q.target.files;re&&re.length>0&&X(Array.from(re)),Q.target.value=""},[X]),Ee=R.useCallback(Q=>{const re=Q.clipboardData.items,fe=[];for(const se of re)if(se.kind==="file"){const q=se.getAsFile();q&&fe.push(q)}fe.length>0&&(Q.preventDefault(),X(fe))},[X]),te=R.useCallback(Q=>{r(Q.target.value);const re=Q.target;re.style.height="auto",re.style.height=`${Math.max(40,Math.min(re.scrollHeight,140))}px`},[]),Re=R.useCallback(()=>{T&&F.mutate({workspaceId:T})},[T,F]),De=R.useRef(null);return R.useEffect(()=>{const Q=window.visualViewport;if(!Q)return;let re=!1;const fe=()=>{De.current&&(De.current.style.height=`${Q.height}px`,De.current.style.top=`${Q.offsetTop}px`)},se=()=>fe(),q=()=>{re||fe()},ie=()=>{re=!0},pe=()=>{re=!1,requestAnimationFrame(fe)};return Q.addEventListener("resize",se),Q.addEventListener("scroll",q),document.addEventListener("touchstart",ie,{passive:!0}),document.addEventListener("touchend",pe,{passive:!0}),document.addEventListener("touchcancel",pe,{passive:!0}),()=>{Q.removeEventListener("resize",se),Q.removeEventListener("scroll",q),document.removeEventListener("touchstart",ie),document.removeEventListener("touchend",pe),document.removeEventListener("touchcancel",pe)}},[]),R.useEffect(()=>{const Q=De.current;if(!Q)return;const re=fe=>{let se=fe.target;for(;se&&se!==Q;){if(se.tagName==="TEXTAREA"){if(se.scrollHeight>se.clientHeight)return;se=se.parentElement;continue}const ie=window.getComputedStyle(se).overflowY;if((ie==="auto"||ie==="scroll")&&se.scrollHeight>se.clientHeight)return;se=se.parentElement}fe.preventDefault()};return Q.addEventListener("touchmove",re,{passive:!1}),()=>Q.removeEventListener("touchmove",re)},[]),c.jsxs("div",{ref:De,className:"fixed inset-x-0 top-0 flex flex-col h-dvh bg-white overflow-hidden overscroll-none",children:[c.jsxs("header",{className:"shrink-0 bg-white border-b border-neutral-200 z-20",children:[c.jsxs("div",{className:"flex items-center h-11 px-2.5 gap-1.5",children:[c.jsx("button",{onClick:t,className:"p-1.5 -ml-0.5 text-neutral-600 active:text-neutral-900",children:c.jsx(Ro,{size:18})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("h1",{className:"text-[13px] font-bold text-neutral-900 truncate leading-tight",children:e.title}),c.jsxs("div",{className:"flex items-center gap-1 text-[11px] text-neutral-500 leading-tight",children:[c.jsx("span",{className:`font-medium ${e.projectColor}`,children:e.projectName}),c.jsx("span",{className:"text-neutral-300",children:"/"}),c.jsx("span",{className:"font-mono truncate",children:e.branch})]})]}),c.jsx(Yf,{status:e.status}),c.jsx("button",{onClick:Re,disabled:!T,className:"p-1.5 text-neutral-400 active:text-neutral-900 disabled:opacity-30",children:c.jsx(Ss,{size:16})}),s&&c.jsxs("div",{className:"relative",ref:y,children:[c.jsx("button",{onClick:()=>_(Q=>!Q),className:"p-1.5 text-neutral-400 active:text-neutral-900","aria-label":"More actions",children:c.jsx(Gi,{size:16})}),p&&c.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:c.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:[c.jsx(qi,{size:15}),c.jsx("span",{children:"删除任务"})]})})]})]}),c.jsx("div",{className:"flex border-t border-neutral-100",children:Vf.map(({key:Q,label:re,icon:fe})=>c.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:[c.jsx(fe,{size:13}),c.jsx("span",{children:re})]},Q))})]}),m==="chat"&&c.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[c.jsxs("div",{className:"relative flex-1 min-h-0",children:[c.jsx("div",{ref:f,className:"h-full overflow-y-auto overflow-x-hidden overscroll-y-contain px-3 pt-3 pb-2",children:c.jsxs("div",{ref:h,children:[c.jsx("div",{className:"mb-3 pb-2 border-b border-neutral-100",children:c.jsx("p",{className:"text-[13px] text-neutral-500 leading-relaxed",children:e.description})}),k?c.jsx(Ti,{label:"Loading..."}):E?D?c.jsx(Ti,{label:"Loading logs..."}):M.length===0?c.jsx("div",{className:"text-neutral-400 text-center py-8 text-sm",children:A?"Waiting for agent output...":"No logs recorded."}):c.jsx(zi,{logs:M}):c.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[c.jsx("div",{className:"w-12 h-12 bg-neutral-50 rounded-xl border border-neutral-100 flex items-center justify-center mb-4",children:c.jsx(St,{size:20,className:"text-neutral-400 ml-0.5"})}),c.jsx("h3",{className:"text-sm font-medium text-neutral-900 mb-1",children:"尚未启动 Agent"}),c.jsx("p",{className:"text-xs text-neutral-500 mb-5 max-w-[240px]",children:"选择一个 Agent 来执行此任务"}),c.jsxs(it,{onClick:()=>l(!0),children:[c.jsx(St,{size:16,className:"mr-1.5"}),"启动 Agent"]})]})]})}),!u&&c.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:[c.jsx(Xi,{size:12}),c.jsx("span",{children:"回到底部"})]})]}),U.length>0&&c.jsx("div",{className:"px-3 pt-1.5 pb-0.5 bg-white shrink-0 border-t border-neutral-100",children:c.jsx(Wi,{todos:U,compact:!0})}),E&&c.jsx("div",{className:"px-3 py-2 bg-white shrink-0 border-t border-neutral-100",children:c.jsxs("div",{className:"relative bg-white rounded-xl border border-neutral-200 shadow-sm focus-within:border-neutral-300",children:[c.jsx(io,{files:K,onRemove:G}),c.jsx("textarea",{ref:g,value:C,onChange:te,onPaste:Ee,onKeyDown:Q=>{Q.key==="Enter"&&!Q.shiftKey&&!Q.repeat&&!Q.nativeEvent.isComposing&&Q.nativeEvent.keyCode!==229&&(Q.preventDefault(),oe())},rows:1,placeholder:A?"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}}),c.jsx("input",{ref:n,type:"file",multiple:!0,className:"hidden",onChange:be}),c.jsxs("div",{className:"flex items-center justify-between px-2 pb-1.5",children:[c.jsxs("div",{className:"flex items-center gap-0.5",children:[c.jsx("button",{onClick:()=>n.current?.click(),className:"p-1 text-neutral-400 active:text-neutral-600 rounded-lg",children:c.jsx($i,{size:15})}),c.jsx(Sn,{usage:J})]}),A&&!C.trim()&&!B?c.jsx("button",{onClick:de,disabled:H.isPending,className:"p-1.5 rounded-lg bg-red-500 text-white active:bg-red-600 disabled:opacity-50",children:c.jsx(Ui,{size:12})}):c.jsx("button",{onClick:oe,disabled:!C.trim()&&!B||$,className:`p-1.5 rounded-lg transition-colors ${(C.trim()||B)&&!$?"bg-neutral-900 text-white active:bg-black":"bg-transparent text-neutral-300"}`,children:c.jsx(Vi,{size:15})})]})]})})]}),m==="changes"&&c.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:c.jsx(Hf,{workingDir:j})}),m==="history"&&c.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:c.jsx(Xf,{workingDir:j})}),m==="workspace"&&c.jsx("div",{className:"flex-1 overflow-hidden",children:c.jsx(Qn,{sessionId:E||void 0,workingDir:j,projectId:e.projectId,className:"h-full",hideChanges:!0})}),c.jsx(no,{isOpen:i,onClose:()=>l(!1),taskId:e.id,taskTitle:e.title,taskDescription:e.description}),c.jsx(oo,{isOpen:d,onClose:()=>o(!1),onConfirm:()=>{s?.(e.id),o(!1)},title:"删除任务",description:c.jsxs(c.Fragment,{children:[c.jsxs("p",{children:["确认删除任务「",e.title,"」?此操作不可撤销。"]}),N.length>0&&c.jsx("ul",{className:"mt-2 space-y-1",children:N.map((Q,re)=>c.jsxs("li",{className:"flex items-start gap-1.5 text-amber-600",children:[c.jsx("span",{className:"mt-1 shrink-0 w-1.5 h-1.5 rounded-full bg-amber-400"}),c.jsx("span",{children:Q})]},re))})]}),confirmText:"删除",variant:"danger",isLoading:a})]})}function Ti({label:e}){return c.jsxs("div",{className:"flex items-center justify-center py-12 gap-3 text-neutral-400",children:[c.jsxs("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[c.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),c.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),c.jsx("span",{className:"text-sm",children:e})]})}var Qf=Object.defineProperty,gs=Object.getOwnPropertySymbols,lo=Object.prototype.hasOwnProperty,co=Object.prototype.propertyIsEnumerable,ji=(e,t,s)=>t in e?Qf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,ar=(e,t)=>{for(var s in t||(t={}))lo.call(t,s)&&ji(e,s,t[s]);if(gs)for(var s of gs(t))co.call(t,s)&&ji(e,s,t[s]);return e},lr=(e,t)=>{var s={};for(var a in e)lo.call(e,a)&&t.indexOf(a)<0&&(s[a]=e[a]);if(e!=null&&gs)for(var a of gs(e))t.indexOf(a)<0&&co.call(e,a)&&(s[a]=e[a]);return s};var vt;(e=>{const t=class ce{constructor(i,l,d,o){if(this.version=i,this.errorCorrectionLevel=l,this.modules=[],this.isFunction=[],i<ce.MIN_VERSION||i>ce.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 y=0;y<this.size;y++)p.push(!1);for(let y=0;y<this.size;y++)this.modules.push(p.slice()),this.isFunction.push(p.slice());this.drawFunctionPatterns();const _=this.addEccAndInterleave(d);if(this.drawCodewords(_),o==-1){let y=1e9;for(let g=0;g<8;g++){this.applyMask(g),this.drawFormatBits(g);const n=this.getPenaltyScore();n<y&&(o=g,y=n),this.applyMask(g)}}m(0<=o&&o<=7),this.mask=o,this.applyMask(o),this.drawFormatBits(o),this.isFunction=[]}static encodeText(i,l){const d=e.QrSegment.makeSegments(i);return ce.encodeSegments(d,l)}static encodeBinary(i,l){const d=e.QrSegment.makeBytes(i);return ce.encodeSegments([d],l)}static encodeSegments(i,l,d=1,o=40,p=-1,_=!0){if(!(ce.MIN_VERSION<=d&&d<=o&&o<=ce.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let y,g;for(y=d;;y++){const u=ce.getNumDataCodewords(y,l)*8,v=C.getTotalBits(i,y);if(v<=u){g=v;break}if(y>=o)throw new RangeError("Data too long")}for(const u of[ce.Ecc.MEDIUM,ce.Ecc.QUARTILE,ce.Ecc.HIGH])_&&g<=ce.getNumDataCodewords(y,u)*8&&(l=u);let n=[];for(const u of i){s(u.mode.modeBits,4,n),s(u.numChars,u.mode.numCharCountBits(y),n);for(const v of u.getData())n.push(v)}m(n.length==g);const f=ce.getNumDataCodewords(y,l)*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 ce(y,l,h,p)}getModule(i,l){return 0<=i&&i<this.size&&0<=l&&l<this.size&&this.modules[l][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(),l=i.length;for(let d=0;d<l;d++)for(let o=0;o<l;o++)d==0&&o==0||d==0&&o==l-1||d==l-1&&o==0||this.drawAlignmentPattern(i[d],i[o]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(i){const l=this.errorCorrectionLevel.formatBits<<3|i;let d=l;for(let p=0;p<10;p++)d=d<<1^(d>>>9)*1335;const o=(l<<10|d)^21522;m(o>>>15==0);for(let p=0;p<=5;p++)this.setFunctionModule(8,p,a(o,p));this.setFunctionModule(8,7,a(o,6)),this.setFunctionModule(8,8,a(o,7)),this.setFunctionModule(7,8,a(o,8));for(let p=9;p<15;p++)this.setFunctionModule(14-p,8,a(o,p));for(let p=0;p<8;p++)this.setFunctionModule(this.size-1-p,8,a(o,p));for(let p=8;p<15;p++)this.setFunctionModule(8,this.size-15+p,a(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 l=this.version<<12|i;m(l>>>18==0);for(let d=0;d<18;d++){const o=a(l,d),p=this.size-11+d%3,_=Math.floor(d/3);this.setFunctionModule(p,_,o),this.setFunctionModule(_,p,o)}}drawFinderPattern(i,l){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,y=l+d;0<=_&&_<this.size&&0<=y&&y<this.size&&this.setFunctionModule(_,y,p!=2&&p!=4)}}drawAlignmentPattern(i,l){for(let d=-2;d<=2;d++)for(let o=-2;o<=2;o++)this.setFunctionModule(i+o,l+d,Math.max(Math.abs(o),Math.abs(d))!=1)}setFunctionModule(i,l,d){this.modules[l][i]=d,this.isFunction[l][i]=!0}addEccAndInterleave(i){const l=this.version,d=this.errorCorrectionLevel;if(i.length!=ce.getNumDataCodewords(l,d))throw new RangeError("Invalid argument");const o=ce.NUM_ERROR_CORRECTION_BLOCKS[d.ordinal][l],p=ce.ECC_CODEWORDS_PER_BLOCK[d.ordinal][l],_=Math.floor(ce.getNumRawDataModules(l)/8),y=o-_%o,g=Math.floor(_/o);let n=[];const f=ce.reedSolomonComputeDivisor(p);for(let u=0,v=0;u<o;u++){let S=i.slice(v,v+g-p+(u<y?0:1));v+=S.length;const w=ce.reedSolomonComputeRemainder(S,f);u<y&&S.push(0),n.push(S.concat(w))}let h=[];for(let u=0;u<n[0].length;u++)n.forEach((v,S)=>{(u!=g-p||S>=y)&&h.push(v[u])});return m(h.length==_),h}drawCodewords(i){if(i.length!=Math.floor(ce.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let l=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][_]&&l<i.length*8&&(this.modules[g][_]=a(i[l>>>3],7-(l&7)),l++)}}m(l==i.length*8)}applyMask(i){if(i<0||i>7)throw new RangeError("Mask value out of range");for(let l=0;l<this.size;l++)for(let d=0;d<this.size;d++){let o;switch(i){case 0:o=(d+l)%2==0;break;case 1:o=l%2==0;break;case 2:o=d%3==0;break;case 3:o=(d+l)%3==0;break;case 4:o=(Math.floor(d/3)+Math.floor(l/2))%2==0;break;case 5:o=d*l%2+d*l%3==0;break;case 6:o=(d*l%2+d*l%3)%2==0;break;case 7:o=((d+l)%2+d*l%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[l][d]&&o&&(this.modules[l][d]=!this.modules[l][d])}}getPenaltyScore(){let i=0;for(let p=0;p<this.size;p++){let _=!1,y=0,g=[0,0,0,0,0,0,0];for(let n=0;n<this.size;n++)this.modules[p][n]==_?(y++,y==5?i+=ce.PENALTY_N1:y>5&&i++):(this.finderPenaltyAddHistory(y,g),_||(i+=this.finderPenaltyCountPatterns(g)*ce.PENALTY_N3),_=this.modules[p][n],y=1);i+=this.finderPenaltyTerminateAndCount(_,y,g)*ce.PENALTY_N3}for(let p=0;p<this.size;p++){let _=!1,y=0,g=[0,0,0,0,0,0,0];for(let n=0;n<this.size;n++)this.modules[n][p]==_?(y++,y==5?i+=ce.PENALTY_N1:y>5&&i++):(this.finderPenaltyAddHistory(y,g),_||(i+=this.finderPenaltyCountPatterns(g)*ce.PENALTY_N3),_=this.modules[n][p],y=1);i+=this.finderPenaltyTerminateAndCount(_,y,g)*ce.PENALTY_N3}for(let p=0;p<this.size-1;p++)for(let _=0;_<this.size-1;_++){const y=this.modules[p][_];y==this.modules[p][_+1]&&y==this.modules[p+1][_]&&y==this.modules[p+1][_+1]&&(i+=ce.PENALTY_N2)}let l=0;for(const p of this.modules)l=p.reduce((_,y)=>_+(y?1:0),l);const d=this.size*this.size,o=Math.ceil(Math.abs(l*20-d*10)/d)-1;return m(0<=o&&o<=9),i+=o*ce.PENALTY_N4,m(0<=i&&i<=2568888),i}getAlignmentPatternPositions(){if(this.version==1)return[];{const i=Math.floor(this.version/7)+2,l=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-=l)d.splice(1,0,o);return d}}static getNumRawDataModules(i){if(i<ce.MIN_VERSION||i>ce.MAX_VERSION)throw new RangeError("Version number out of range");let l=(16*i+128)*i+64;if(i>=2){const d=Math.floor(i/7)+2;l-=(25*d-10)*d-55,i>=7&&(l-=36)}return m(208<=l&&l<=29648),l}static getNumDataCodewords(i,l){return Math.floor(ce.getNumRawDataModules(i)/8)-ce.ECC_CODEWORDS_PER_BLOCK[l.ordinal][i]*ce.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][i]}static reedSolomonComputeDivisor(i){if(i<1||i>255)throw new RangeError("Degree out of range");let l=[];for(let o=0;o<i-1;o++)l.push(0);l.push(1);let d=1;for(let o=0;o<i;o++){for(let p=0;p<l.length;p++)l[p]=ce.reedSolomonMultiply(l[p],d),p+1<l.length&&(l[p]^=l[p+1]);d=ce.reedSolomonMultiply(d,2)}return l}static reedSolomonComputeRemainder(i,l){let d=l.map(o=>0);for(const o of i){const p=o^d.shift();d.push(0),l.forEach((_,y)=>d[y]^=ce.reedSolomonMultiply(_,p))}return d}static reedSolomonMultiply(i,l){if(i>>>8||l>>>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^=(l>>>o&1)*i;return m(d>>>8==0),d}finderPenaltyCountPatterns(i){const l=i[1];m(l<=this.size*3);const d=l>0&&i[2]==l&&i[3]==l*3&&i[4]==l&&i[5]==l;return(d&&i[0]>=l*4&&i[6]>=l?1:0)+(d&&i[6]>=l*4&&i[0]>=l?1:0)}finderPenaltyTerminateAndCount(i,l,d){return i&&(this.finderPenaltyAddHistory(l,d),l=0),l+=this.size,this.finderPenaltyAddHistory(l,d),this.finderPenaltyCountPatterns(d)}finderPenaltyAddHistory(i,l){l[0]==0&&(i+=this.size),l.pop(),l.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,l){if(i<0||i>31||r>>>i)throw new RangeError("Value out of range");for(let d=i-1;d>=0;d--)l.push(r>>>d&1)}function a(r,i){return(r>>>i&1)!=0}function m(r){if(!r)throw new Error("Assertion error")}const b=class ke{constructor(i,l,d){if(this.mode=i,this.numChars=l,this.bitData=d,l<0)throw new RangeError("Invalid argument");this.bitData=d.slice()}static makeBytes(i){let l=[];for(const d of i)s(d,8,l);return new ke(ke.Mode.BYTE,i.length,l)}static makeNumeric(i){if(!ke.isNumeric(i))throw new RangeError("String contains non-numeric characters");let l=[];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,l),d+=o}return new ke(ke.Mode.NUMERIC,i.length,l)}static makeAlphanumeric(i){if(!ke.isAlphanumeric(i))throw new RangeError("String contains unencodable characters in alphanumeric mode");let l=[],d;for(d=0;d+2<=i.length;d+=2){let o=ke.ALPHANUMERIC_CHARSET.indexOf(i.charAt(d))*45;o+=ke.ALPHANUMERIC_CHARSET.indexOf(i.charAt(d+1)),s(o,11,l)}return d<i.length&&s(ke.ALPHANUMERIC_CHARSET.indexOf(i.charAt(d)),6,l),new ke(ke.Mode.ALPHANUMERIC,i.length,l)}static makeSegments(i){return i==""?[]:ke.isNumeric(i)?[ke.makeNumeric(i)]:ke.isAlphanumeric(i)?[ke.makeAlphanumeric(i)]:[ke.makeBytes(ke.toUtf8ByteArray(i))]}static makeEci(i){let l=[];if(i<0)throw new RangeError("ECI assignment value out of range");if(i<128)s(i,8,l);else if(i<16384)s(2,2,l),s(i,14,l);else if(i<1e6)s(6,3,l),s(i,21,l);else throw new RangeError("ECI assignment value out of range");return new ke(ke.Mode.ECI,0,l)}static isNumeric(i){return ke.NUMERIC_REGEX.test(i)}static isAlphanumeric(i){return ke.ALPHANUMERIC_REGEX.test(i)}getData(){return this.bitData.slice()}static getTotalBits(i,l){let d=0;for(const o of i){const p=o.mode.numCharCountBits(l);if(o.numChars>=1<<p)return 1/0;d+=4+p+o.bitData.length}return d}static toUtf8ByteArray(i){i=encodeURI(i);let l=[];for(let d=0;d<i.length;d++)i.charAt(d)!="%"?l.push(i.charCodeAt(d)):(l.push(parseInt(i.substring(d+1,d+3),16)),d+=2);return l}};b.NUMERIC_REGEX=/^[0-9]*$/,b.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,b.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let C=b;e.QrSegment=b})(vt||(vt={}));(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={}))})(vt||(vt={}));(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={}))})(vt||(vt={}));var xt=vt;var Zf={L:xt.QrCode.Ecc.LOW,M:xt.QrCode.Ecc.MEDIUM,Q:xt.QrCode.Ecc.QUARTILE,H:xt.QrCode.Ecc.HIGH},ho=128,uo="L",fo="#FFFFFF",po="#000000",mo=!1,vo=1,Jf=4,ep=0,tp=.1;function go(e,t=0){const s=[];return e.forEach(function(a,m){let b=null;a.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===a.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 _o(e,t){return e.slice().map((s,a)=>a<t.y||a>=t.y+t.h?s:s.map((m,b)=>b<t.x||b>=t.x+t.w?m:!1))}function sp(e,t,s,a){if(a==null)return null;const m=e.length+s*2,b=Math.floor(t*tp),C=m/t,r=(a.width||b)*C,i=(a.height||b)*C,l=a.x==null?e.length/2-r/2:a.x*C,d=a.y==null?e.length/2-i/2:a.y*C,o=a.opacity==null?1:a.opacity;let p=null;if(a.excavate){let y=Math.floor(l),g=Math.floor(d),n=Math.ceil(r+l-y),f=Math.ceil(i+d-g);p={x:y,y:g,w:n,h:f}}const _=a.crossOrigin;return{x:l,y:d,h:i,w:r,excavation:p,opacity:o,crossOrigin:_}}function rp(e,t){return t!=null?Math.max(Math.floor(t),0):e?Jf:ep}function bo({value:e,level:t,minVersion:s,includeMargin:a,marginSize:m,imageSettings:b,size:C,boostLevel:r}){let i=Z.useMemo(()=>{const y=(Array.isArray(e)?e:[e]).reduce((g,n)=>(g.push(...xt.QrSegment.makeSegments(n)),g),[]);return xt.QrCode.encodeSegments(y,Zf[t],s,void 0,void 0,r)},[e,t,s,r]);const{cells:l,margin:d,numCells:o,calculatedImageSettings:p}=Z.useMemo(()=>{let _=i.getModules();const y=rp(a,m),g=_.length+y*2,n=sp(_,C,y,b);return{cells:_,margin:y,numCells:g,calculatedImageSettings:n}},[i,C,b,a,m]);return{qrcode:i,margin:d,cells:l,numCells:o,calculatedImageSettings:p}}var ip=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),np=Z.forwardRef(function(t,s){const a=t,{value:m,size:b=ho,level:C=uo,bgColor:r=fo,fgColor:i=po,includeMargin:l=mo,minVersion:d=vo,boostLevel:o,marginSize:p,imageSettings:_}=a,g=lr(a,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:n}=g,f=lr(g,["style"]),h=_?.src,u=Z.useRef(null),v=Z.useRef(null),S=Z.useCallback(I=>{u.current=I,typeof s=="function"?s(I):s&&(s.current=I)},[s]),[w,k]=Z.useState(!1),{margin:x,cells:E,numCells:A,calculatedImageSettings:j}=bo({value:m,level:C,minVersion:d,boostLevel:o,includeMargin:l,marginSize:p,imageSettings:_,size:b});Z.useEffect(()=>{if(u.current!=null){const I=u.current,F=I.getContext("2d");if(!F)return;let H=E;const z=v.current,D=j!=null&&z!==null&&z.complete&&z.naturalHeight!==0&&z.naturalWidth!==0;D&&j.excavation!=null&&(H=_o(E,j.excavation));const M=window.devicePixelRatio||1;I.height=I.width=b*M;const P=b/A*M;F.scale(P,P),F.fillStyle=r,F.fillRect(0,0,A,A),F.fillStyle=i,ip?F.fill(new Path2D(go(H,x))):E.forEach(function(O,U){O.forEach(function(K,X){K&&F.fillRect(X+x,U+x,1,1)})}),j&&(F.globalAlpha=j.opacity),D&&F.drawImage(z,j.x+x,j.y+x,j.w,j.h)}}),Z.useEffect(()=>{k(!1)},[h]);const T=ar({height:b,width:b},n);let N=null;return h!=null&&(N=Z.createElement("img",{src:h,key:h,style:{display:"none"},onLoad:()=>{k(!0)},ref:v,crossOrigin:j?.crossOrigin})),Z.createElement(Z.Fragment,null,Z.createElement("canvas",ar({style:T,height:b,width:b,ref:S,role:"img"},f)),N)});np.displayName="QRCodeCanvas";var xo=Z.forwardRef(function(t,s){const a=t,{value:m,size:b=ho,level:C=uo,bgColor:r=fo,fgColor:i=po,includeMargin:l=mo,minVersion:d=vo,boostLevel:o,title:p,marginSize:_,imageSettings:y}=a,g=lr(a,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:n,cells:f,numCells:h,calculatedImageSettings:u}=bo({value:m,level:C,minVersion:d,boostLevel:o,includeMargin:l,marginSize:_,imageSettings:y,size:b});let v=f,S=null;y!=null&&u!=null&&(u.excavation!=null&&(v=_o(f,u.excavation)),S=Z.createElement("image",{href:y.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=go(v,n);return Z.createElement("svg",ar({height:b,width:b,viewBox:`0 0 ${h} ${h}`,ref:s,role:"img"},g),!!p&&Z.createElement("title",null,p),Z.createElement("path",{fill:r,d:`M0,0 h${h}v${h}H0z`,shapeRendering:"crispEdges"}),Z.createElement("path",{fill:i,d:w,shapeRendering:"crispEdges"}),S)});xo.displayName="QRCodeSVG";function op(){return nt({queryKey:le.tunnel.status,queryFn:()=>he.get("/tunnel/status"),refetchInterval:e=>e.state.data?.running?1e4:!1})}function ap(){const e=Te();return Ue({mutationFn:()=>{const t=parseInt(window.location.port||(window.location.protocol==="https:"?"443":"80"),10);return he.post("/tunnel/start",{port:t})},onSuccess:()=>{e.invalidateQueries({queryKey:le.tunnel.status})}})}function lp(){const e=Te();return Ue({mutationFn:()=>he.post("/tunnel/stop"),onSuccess:()=>{e.invalidateQueries({queryKey:le.tunnel.status})}})}function Mi(){const{data:e}=op(),t=ap(),s=lp(),[a,m]=R.useState(!1),[b,C]=R.useState(null),r=R.useRef(null),[i,l]=R.useState({top:0,right:0}),[d,o]=R.useState(!1),p=e?.running??!1,_=t.isPending,y=e?.shareableUrl,g=e?.token;R.useEffect(()=>{if(a&&r.current){const v=r.current.getBoundingClientRect();l({top:v.bottom+8,right:window.innerWidth-v.right})}},[a]);const n=R.useCallback(()=>{p?m(!0):t.mutate(void 0,{onSuccess:()=>m(!0)})},[p,t]),f=R.useCallback(()=>{y&&(navigator.clipboard.writeText(y),C("url"),setTimeout(()=>C(null),2e3))},[y]),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 c.jsxs("div",{className:"relative",children:[c.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:_?c.jsx(Ae,{size:16,className:"animate-spin"}):c.jsx(_s,{size:16})}),p&&!_&&c.jsx("span",{className:"absolute top-0.5 right-0.5 w-2 h-2 bg-emerald-500 rounded-full"}),a&&p&&_t.createPortal(c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"fixed inset-0 z-[100]",onClick:()=>m(!1)}),c.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:[c.jsxs("div",{className:"flex items-center justify-between mb-2",children:[c.jsxs("span",{className:"text-xs font-medium text-emerald-600 flex items-center gap-1.5",children:[c.jsx("span",{className:"w-1.5 h-1.5 bg-emerald-500 rounded-full inline-block"}),"Tunnel Active"]}),c.jsx("button",{onClick:()=>m(!1),className:"p-0.5 text-neutral-400 hover:text-neutral-600 rounded",children:c.jsx(bs,{size:14})})]}),g&&c.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:[c.jsx(Ma,{size:12}),c.jsx("span",{children:"Token protected"})]}),y&&c.jsx("div",{className:"flex justify-center py-3",children:c.jsx(xo,{value:y,size:160})}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("input",{readOnly:!0,value:y??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()}),c.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"?c.jsx(as,{size:14,className:"text-emerald-500"}):c.jsx(Fr,{size:14})})]}),g&&c.jsxs("div",{className:"mt-2",children:[c.jsx("button",{onClick:()=>o(!d),className:"text-xs text-neutral-500 hover:text-neutral-700 transition-colors",children:d?"Hide token":"Show token"}),d&&c.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[c.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}),c.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"?c.jsx(as,{size:14,className:"text-emerald-500"}):c.jsx(Fr,{size:14})})]})]}),c.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 Ni={idle:"Create & Start","creating-task":"Creating Task...","creating-workspace":"Creating Workspace...","creating-session":"Creating Session...","starting-session":"Starting Agent..."},Mt=R.lazy(()=>Ii(()=>import("./modal-B3kSXR7L.js").then(e=>e.m),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.Modal}))),Gs=R.lazy(()=>Ii(()=>import("./folder-picker-CRsgkd7x.js"),__vite__mapDeps([5,1,2,3,6,7,8,9,10,11,12])).then(e=>({default:e.FolderPicker}))),Pi=c.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:[c.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",fill:"currentColor"}),c.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Oi=c.jsx("span",{className:"font-bold text-neutral-900 tracking-tight text-base",children:"Agent Tower"}),cp=260,hp=600,Bi=400;function Cp(){const[e,t]=R.useState(null),[s,a]=R.useState(null),[m,b]=R.useState(Bi),[C,r]=R.useState(!1),[i,l]=R.useState(!1),[d,o]=R.useState(""),[p,_]=R.useState(""),[y,g]=R.useState(""),[n,f]=R.useState(""),[h,u]=R.useState(""),[v,S]=R.useState(""),[w,k]=R.useState([]),[x,E]=R.useState("idle"),A=R.useRef(!1),j=R.useRef(0),T=R.useRef(Bi),N=R.useRef(null),I=Te(),{data:F,isLoading:H}=Ho(),z=F?.data??[],D=R.useMemo(()=>z.map(wf),[z]),M=R.useMemo(()=>z.map(q=>q.id),[z]);Tf(M);const{data:P,isLoading:O}=Rf(s??""),U=qo({queries:s?[]:z.map(q=>({queryKey:le.tasks.list(q.id),queryFn:()=>he.get(`/projects/${q.id}/tasks`,{params:{limit:"100"}})}))}),K=!s&&U.some(q=>q.isLoading),X=R.useMemo(()=>{if(s)return P?.data??[];const q=[];for(const ie of U)ie.data?.data&&q.push(...ie.data.data);return q},[s,P,U]),G=R.useMemo(()=>X.map(kf),[X]),ne=R.useMemo(()=>new Set,[]),L=R.useMemo(()=>{if(!e)return null;const q=G.find(pe=>pe.id===e);if(!q)return null;const ie=z.find(pe=>pe.id===q.projectId);return{id:q.id,projectId:q.projectId,projectName:ie?.name??"Unknown",projectColor:ie?.color??"text-neutral-500",title:q.title,status:q.status,branch:q.branch,mainBranch:ie?.mainBranch??"main",description:q.description}},[e,G,z]),B=zo(),$=Df(h),W=Af(),J=Lf(),Y=R.useCallback(q=>{W.mutate(q,{onSuccess:()=>{e===q&&t(null),I.invalidateQueries({queryKey:le.tasks.all})}})},[W,e,I]),oe=R.useCallback((q,ie)=>{J.mutate({id:q,status:Sf(ie)},{onError:()=>{Do.error("状态变更失败,该操作不被允许")}})},[J]),de=R.useCallback(q=>{q.preventDefault(),A.current=!0,j.current=q.clientX,T.current=m,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[m]);R.useEffect(()=>{const q=pe=>{if(!A.current)return;const Ie=pe.clientX-j.current,je=Math.max(cp,Math.min(hp,T.current+Ie));b(je)},ie=()=>{A.current&&(A.current=!1,document.body.style.cursor="",document.body.style.userSelect="")};return document.addEventListener("mousemove",q),document.addEventListener("mouseup",ie),()=>{document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",ie)}},[]);const be=R.useCallback(()=>{r(!0)},[]),Ee=R.useCallback(()=>{u(s??z[0]?.id??""),S(""),E("idle"),l(!0),he.get("/demo/agents").then(q=>{k(q.agents);const ie=q.agents.find(pe=>pe.available);ie&&S(ie.type)})},[s,z]),te=R.useCallback(()=>{r(!1),o(""),_("")},[]),Re=R.useCallback(()=>{x==="idle"&&(l(!1),g(""),f(""),u(""),S(""),E("idle"))},[x]),De=R.useCallback(async()=>{if(!(!d.trim()||!p.trim()))try{await B.mutateAsync({name:d.trim(),repoPath:p.trim()}),te()}catch{}},[d,p,B,te]),Q=eo(),re=R.useCallback(async()=>{if(!(!y.trim()||!h))try{E("creating-task");const q=await $.mutateAsync({title:y.trim(),description:n.trim()||void 0});if(v){const ie=[y.trim(),n.trim()].filter(Boolean).join(`
|
|
81
|
+
`);r(""),ne(),g.current&&(g.current.style.height="40px"),I.mutate({id:E,message:re},{onSuccess:()=>O(),onSettled:()=>{Y.current=!1}})},[C,E,I,O,B,$,L,ne]),de=R.useCallback(async()=>{E&&(await H.mutateAsync(E),S.invalidateQueries({queryKey:["workspaces"]}))},[E,H,S]),be=R.useCallback(Q=>{const re=Q.target.files;re&&re.length>0&&X(Array.from(re)),Q.target.value=""},[X]),Ee=R.useCallback(Q=>{const re=Q.clipboardData.items,fe=[];for(const se of re)if(se.kind==="file"){const q=se.getAsFile();q&&fe.push(q)}fe.length>0&&(Q.preventDefault(),X(fe))},[X]),te=R.useCallback(Q=>{r(Q.target.value);const re=Q.target;re.style.height="auto",re.style.height=`${Math.max(40,Math.min(re.scrollHeight,140))}px`},[]),Re=R.useCallback(()=>{T&&F.mutate({workspaceId:T})},[T,F]),De=R.useRef(null);return R.useEffect(()=>{const Q=window.visualViewport;if(!Q)return;let re=!1;const fe=()=>{De.current&&(De.current.style.height=`${Q.height}px`,De.current.style.top=`${Q.offsetTop}px`)},se=()=>fe(),q=()=>{re||fe()},ie=()=>{re=!0},pe=()=>{re=!1,requestAnimationFrame(fe)};return Q.addEventListener("resize",se),Q.addEventListener("scroll",q),document.addEventListener("touchstart",ie,{passive:!0}),document.addEventListener("touchend",pe,{passive:!0}),document.addEventListener("touchcancel",pe,{passive:!0}),()=>{Q.removeEventListener("resize",se),Q.removeEventListener("scroll",q),document.removeEventListener("touchstart",ie),document.removeEventListener("touchend",pe),document.removeEventListener("touchcancel",pe)}},[]),R.useEffect(()=>{const Q=De.current;if(!Q)return;const re=fe=>{let se=fe.target;for(;se&&se!==Q;){if(se.tagName==="TEXTAREA"){if(se.scrollHeight>se.clientHeight)return;se=se.parentElement;continue}const ie=window.getComputedStyle(se).overflowY;if((ie==="auto"||ie==="scroll")&&se.scrollHeight>se.clientHeight)return;se=se.parentElement}fe.preventDefault()};return Q.addEventListener("touchmove",re,{passive:!1}),()=>Q.removeEventListener("touchmove",re)},[]),c.jsxs("div",{ref:De,className:"fixed inset-x-0 top-0 flex flex-col h-dvh bg-white overflow-hidden overscroll-none",children:[c.jsxs("header",{className:"shrink-0 bg-white border-b border-neutral-200 z-20",children:[c.jsxs("div",{className:"flex items-center h-11 px-2.5 gap-1.5",children:[c.jsx("button",{onClick:t,className:"p-1.5 -ml-0.5 text-neutral-600 active:text-neutral-900",children:c.jsx(Ro,{size:18})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("h1",{className:"text-[13px] font-bold text-neutral-900 truncate leading-tight",children:e.title}),c.jsxs("div",{className:"flex items-center gap-1 text-[11px] text-neutral-500 leading-tight",children:[c.jsx("span",{className:`font-medium ${e.projectColor}`,children:e.projectName}),c.jsx("span",{className:"text-neutral-300",children:"/"}),c.jsx("span",{className:"font-mono truncate",children:e.branch})]})]}),c.jsx(Yf,{status:e.status}),c.jsx("button",{onClick:Re,disabled:!T,className:"p-1.5 text-neutral-400 active:text-neutral-900 disabled:opacity-30",children:c.jsx(Ss,{size:16})}),s&&c.jsxs("div",{className:"relative",ref:y,children:[c.jsx("button",{onClick:()=>_(Q=>!Q),className:"p-1.5 text-neutral-400 active:text-neutral-900","aria-label":"More actions",children:c.jsx(Gi,{size:16})}),p&&c.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:c.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:[c.jsx(qi,{size:15}),c.jsx("span",{children:"删除任务"})]})})]})]}),c.jsx("div",{className:"flex border-t border-neutral-100",children:Vf.map(({key:Q,label:re,icon:fe})=>c.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:[c.jsx(fe,{size:13}),c.jsx("span",{children:re})]},Q))})]}),m==="chat"&&c.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[c.jsxs("div",{className:"relative flex-1 min-h-0",children:[c.jsx("div",{ref:f,className:"h-full overflow-y-auto overflow-x-hidden overscroll-y-contain px-3 pt-3 pb-2",children:c.jsxs("div",{ref:h,children:[c.jsx("div",{className:"mb-3 pb-2 border-b border-neutral-100",children:c.jsx("p",{className:"text-[13px] text-neutral-500 leading-relaxed",children:e.description})}),k?c.jsx(Ti,{label:"Loading..."}):E?D?c.jsx(Ti,{label:"Loading logs..."}):M.length===0?c.jsx("div",{className:"text-neutral-400 text-center py-8 text-sm",children:A?"Waiting for agent output...":"No logs recorded."}):c.jsx(zi,{logs:M}):c.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[c.jsx("div",{className:"w-12 h-12 bg-neutral-50 rounded-xl border border-neutral-100 flex items-center justify-center mb-4",children:c.jsx(St,{size:20,className:"text-neutral-400 ml-0.5"})}),c.jsx("h3",{className:"text-sm font-medium text-neutral-900 mb-1",children:"尚未启动 Agent"}),c.jsx("p",{className:"text-xs text-neutral-500 mb-5 max-w-[240px]",children:"选择一个 Agent 来执行此任务"}),c.jsxs(it,{onClick:()=>l(!0),children:[c.jsx(St,{size:16,className:"mr-1.5"}),"启动 Agent"]})]})]})}),!u&&c.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:[c.jsx(Xi,{size:12}),c.jsx("span",{children:"回到底部"})]})]}),U.length>0&&c.jsx("div",{className:"px-3 pt-1.5 pb-0.5 bg-white shrink-0 border-t border-neutral-100",children:c.jsx(Wi,{todos:U,compact:!0})}),E&&c.jsx("div",{className:"px-3 py-2 bg-white shrink-0 border-t border-neutral-100",children:c.jsxs("div",{className:"relative bg-white rounded-xl border border-neutral-200 shadow-sm focus-within:border-neutral-300",children:[c.jsx(io,{files:K,onRemove:G}),c.jsx("textarea",{ref:g,value:C,onChange:te,onPaste:Ee,onKeyDown:Q=>{Q.key==="Enter"&&!Q.shiftKey&&!Q.repeat&&!Q.nativeEvent.isComposing&&Q.nativeEvent.keyCode!==229&&(Q.preventDefault(),oe())},rows:1,placeholder:A?"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}}),c.jsx("input",{ref:n,type:"file",multiple:!0,className:"hidden",onChange:be}),c.jsxs("div",{className:"flex items-center justify-between px-2 pb-1.5",children:[c.jsxs("div",{className:"flex items-center gap-0.5",children:[c.jsx("button",{onClick:()=>n.current?.click(),className:"p-1 text-neutral-400 active:text-neutral-600 rounded-lg",children:c.jsx($i,{size:15})}),c.jsx(Sn,{usage:J})]}),A&&!C.trim()&&!B?c.jsx("button",{onClick:de,disabled:H.isPending,className:"p-1.5 rounded-lg bg-red-500 text-white active:bg-red-600 disabled:opacity-50",children:c.jsx(Ui,{size:12})}):c.jsx("button",{onClick:oe,disabled:!C.trim()&&!B||$,className:`p-1.5 rounded-lg transition-colors ${(C.trim()||B)&&!$?"bg-neutral-900 text-white active:bg-black":"bg-transparent text-neutral-300"}`,children:c.jsx(Vi,{size:15})})]})]})})]}),m==="changes"&&c.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:c.jsx(Hf,{workingDir:j})}),m==="history"&&c.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:c.jsx(Xf,{workingDir:j})}),m==="workspace"&&c.jsx("div",{className:"flex-1 overflow-hidden",children:c.jsx(Qn,{sessionId:E||void 0,workingDir:j,projectId:e.projectId,className:"h-full",hideChanges:!0})}),c.jsx(no,{isOpen:i,onClose:()=>l(!1),taskId:e.id,taskTitle:e.title,taskDescription:e.description}),c.jsx(oo,{isOpen:d,onClose:()=>o(!1),onConfirm:()=>{s?.(e.id),o(!1)},title:"删除任务",description:c.jsxs(c.Fragment,{children:[c.jsxs("p",{children:["确认删除任务「",e.title,"」?此操作不可撤销。"]}),N.length>0&&c.jsx("ul",{className:"mt-2 space-y-1",children:N.map((Q,re)=>c.jsxs("li",{className:"flex items-start gap-1.5 text-amber-600",children:[c.jsx("span",{className:"mt-1 shrink-0 w-1.5 h-1.5 rounded-full bg-amber-400"}),c.jsx("span",{children:Q})]},re))})]}),confirmText:"删除",variant:"danger",isLoading:a})]})}function Ti({label:e}){return c.jsxs("div",{className:"flex items-center justify-center py-12 gap-3 text-neutral-400",children:[c.jsxs("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[c.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),c.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),c.jsx("span",{className:"text-sm",children:e})]})}var Qf=Object.defineProperty,gs=Object.getOwnPropertySymbols,lo=Object.prototype.hasOwnProperty,co=Object.prototype.propertyIsEnumerable,ji=(e,t,s)=>t in e?Qf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,ar=(e,t)=>{for(var s in t||(t={}))lo.call(t,s)&&ji(e,s,t[s]);if(gs)for(var s of gs(t))co.call(t,s)&&ji(e,s,t[s]);return e},lr=(e,t)=>{var s={};for(var a in e)lo.call(e,a)&&t.indexOf(a)<0&&(s[a]=e[a]);if(e!=null&&gs)for(var a of gs(e))t.indexOf(a)<0&&co.call(e,a)&&(s[a]=e[a]);return s};var vt;(e=>{const t=class ce{constructor(i,l,d,o){if(this.version=i,this.errorCorrectionLevel=l,this.modules=[],this.isFunction=[],i<ce.MIN_VERSION||i>ce.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 y=0;y<this.size;y++)p.push(!1);for(let y=0;y<this.size;y++)this.modules.push(p.slice()),this.isFunction.push(p.slice());this.drawFunctionPatterns();const _=this.addEccAndInterleave(d);if(this.drawCodewords(_),o==-1){let y=1e9;for(let g=0;g<8;g++){this.applyMask(g),this.drawFormatBits(g);const n=this.getPenaltyScore();n<y&&(o=g,y=n),this.applyMask(g)}}m(0<=o&&o<=7),this.mask=o,this.applyMask(o),this.drawFormatBits(o),this.isFunction=[]}static encodeText(i,l){const d=e.QrSegment.makeSegments(i);return ce.encodeSegments(d,l)}static encodeBinary(i,l){const d=e.QrSegment.makeBytes(i);return ce.encodeSegments([d],l)}static encodeSegments(i,l,d=1,o=40,p=-1,_=!0){if(!(ce.MIN_VERSION<=d&&d<=o&&o<=ce.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let y,g;for(y=d;;y++){const u=ce.getNumDataCodewords(y,l)*8,v=C.getTotalBits(i,y);if(v<=u){g=v;break}if(y>=o)throw new RangeError("Data too long")}for(const u of[ce.Ecc.MEDIUM,ce.Ecc.QUARTILE,ce.Ecc.HIGH])_&&g<=ce.getNumDataCodewords(y,u)*8&&(l=u);let n=[];for(const u of i){s(u.mode.modeBits,4,n),s(u.numChars,u.mode.numCharCountBits(y),n);for(const v of u.getData())n.push(v)}m(n.length==g);const f=ce.getNumDataCodewords(y,l)*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 ce(y,l,h,p)}getModule(i,l){return 0<=i&&i<this.size&&0<=l&&l<this.size&&this.modules[l][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(),l=i.length;for(let d=0;d<l;d++)for(let o=0;o<l;o++)d==0&&o==0||d==0&&o==l-1||d==l-1&&o==0||this.drawAlignmentPattern(i[d],i[o]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(i){const l=this.errorCorrectionLevel.formatBits<<3|i;let d=l;for(let p=0;p<10;p++)d=d<<1^(d>>>9)*1335;const o=(l<<10|d)^21522;m(o>>>15==0);for(let p=0;p<=5;p++)this.setFunctionModule(8,p,a(o,p));this.setFunctionModule(8,7,a(o,6)),this.setFunctionModule(8,8,a(o,7)),this.setFunctionModule(7,8,a(o,8));for(let p=9;p<15;p++)this.setFunctionModule(14-p,8,a(o,p));for(let p=0;p<8;p++)this.setFunctionModule(this.size-1-p,8,a(o,p));for(let p=8;p<15;p++)this.setFunctionModule(8,this.size-15+p,a(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 l=this.version<<12|i;m(l>>>18==0);for(let d=0;d<18;d++){const o=a(l,d),p=this.size-11+d%3,_=Math.floor(d/3);this.setFunctionModule(p,_,o),this.setFunctionModule(_,p,o)}}drawFinderPattern(i,l){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,y=l+d;0<=_&&_<this.size&&0<=y&&y<this.size&&this.setFunctionModule(_,y,p!=2&&p!=4)}}drawAlignmentPattern(i,l){for(let d=-2;d<=2;d++)for(let o=-2;o<=2;o++)this.setFunctionModule(i+o,l+d,Math.max(Math.abs(o),Math.abs(d))!=1)}setFunctionModule(i,l,d){this.modules[l][i]=d,this.isFunction[l][i]=!0}addEccAndInterleave(i){const l=this.version,d=this.errorCorrectionLevel;if(i.length!=ce.getNumDataCodewords(l,d))throw new RangeError("Invalid argument");const o=ce.NUM_ERROR_CORRECTION_BLOCKS[d.ordinal][l],p=ce.ECC_CODEWORDS_PER_BLOCK[d.ordinal][l],_=Math.floor(ce.getNumRawDataModules(l)/8),y=o-_%o,g=Math.floor(_/o);let n=[];const f=ce.reedSolomonComputeDivisor(p);for(let u=0,v=0;u<o;u++){let S=i.slice(v,v+g-p+(u<y?0:1));v+=S.length;const w=ce.reedSolomonComputeRemainder(S,f);u<y&&S.push(0),n.push(S.concat(w))}let h=[];for(let u=0;u<n[0].length;u++)n.forEach((v,S)=>{(u!=g-p||S>=y)&&h.push(v[u])});return m(h.length==_),h}drawCodewords(i){if(i.length!=Math.floor(ce.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let l=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][_]&&l<i.length*8&&(this.modules[g][_]=a(i[l>>>3],7-(l&7)),l++)}}m(l==i.length*8)}applyMask(i){if(i<0||i>7)throw new RangeError("Mask value out of range");for(let l=0;l<this.size;l++)for(let d=0;d<this.size;d++){let o;switch(i){case 0:o=(d+l)%2==0;break;case 1:o=l%2==0;break;case 2:o=d%3==0;break;case 3:o=(d+l)%3==0;break;case 4:o=(Math.floor(d/3)+Math.floor(l/2))%2==0;break;case 5:o=d*l%2+d*l%3==0;break;case 6:o=(d*l%2+d*l%3)%2==0;break;case 7:o=((d+l)%2+d*l%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[l][d]&&o&&(this.modules[l][d]=!this.modules[l][d])}}getPenaltyScore(){let i=0;for(let p=0;p<this.size;p++){let _=!1,y=0,g=[0,0,0,0,0,0,0];for(let n=0;n<this.size;n++)this.modules[p][n]==_?(y++,y==5?i+=ce.PENALTY_N1:y>5&&i++):(this.finderPenaltyAddHistory(y,g),_||(i+=this.finderPenaltyCountPatterns(g)*ce.PENALTY_N3),_=this.modules[p][n],y=1);i+=this.finderPenaltyTerminateAndCount(_,y,g)*ce.PENALTY_N3}for(let p=0;p<this.size;p++){let _=!1,y=0,g=[0,0,0,0,0,0,0];for(let n=0;n<this.size;n++)this.modules[n][p]==_?(y++,y==5?i+=ce.PENALTY_N1:y>5&&i++):(this.finderPenaltyAddHistory(y,g),_||(i+=this.finderPenaltyCountPatterns(g)*ce.PENALTY_N3),_=this.modules[n][p],y=1);i+=this.finderPenaltyTerminateAndCount(_,y,g)*ce.PENALTY_N3}for(let p=0;p<this.size-1;p++)for(let _=0;_<this.size-1;_++){const y=this.modules[p][_];y==this.modules[p][_+1]&&y==this.modules[p+1][_]&&y==this.modules[p+1][_+1]&&(i+=ce.PENALTY_N2)}let l=0;for(const p of this.modules)l=p.reduce((_,y)=>_+(y?1:0),l);const d=this.size*this.size,o=Math.ceil(Math.abs(l*20-d*10)/d)-1;return m(0<=o&&o<=9),i+=o*ce.PENALTY_N4,m(0<=i&&i<=2568888),i}getAlignmentPatternPositions(){if(this.version==1)return[];{const i=Math.floor(this.version/7)+2,l=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-=l)d.splice(1,0,o);return d}}static getNumRawDataModules(i){if(i<ce.MIN_VERSION||i>ce.MAX_VERSION)throw new RangeError("Version number out of range");let l=(16*i+128)*i+64;if(i>=2){const d=Math.floor(i/7)+2;l-=(25*d-10)*d-55,i>=7&&(l-=36)}return m(208<=l&&l<=29648),l}static getNumDataCodewords(i,l){return Math.floor(ce.getNumRawDataModules(i)/8)-ce.ECC_CODEWORDS_PER_BLOCK[l.ordinal][i]*ce.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][i]}static reedSolomonComputeDivisor(i){if(i<1||i>255)throw new RangeError("Degree out of range");let l=[];for(let o=0;o<i-1;o++)l.push(0);l.push(1);let d=1;for(let o=0;o<i;o++){for(let p=0;p<l.length;p++)l[p]=ce.reedSolomonMultiply(l[p],d),p+1<l.length&&(l[p]^=l[p+1]);d=ce.reedSolomonMultiply(d,2)}return l}static reedSolomonComputeRemainder(i,l){let d=l.map(o=>0);for(const o of i){const p=o^d.shift();d.push(0),l.forEach((_,y)=>d[y]^=ce.reedSolomonMultiply(_,p))}return d}static reedSolomonMultiply(i,l){if(i>>>8||l>>>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^=(l>>>o&1)*i;return m(d>>>8==0),d}finderPenaltyCountPatterns(i){const l=i[1];m(l<=this.size*3);const d=l>0&&i[2]==l&&i[3]==l*3&&i[4]==l&&i[5]==l;return(d&&i[0]>=l*4&&i[6]>=l?1:0)+(d&&i[6]>=l*4&&i[0]>=l?1:0)}finderPenaltyTerminateAndCount(i,l,d){return i&&(this.finderPenaltyAddHistory(l,d),l=0),l+=this.size,this.finderPenaltyAddHistory(l,d),this.finderPenaltyCountPatterns(d)}finderPenaltyAddHistory(i,l){l[0]==0&&(i+=this.size),l.pop(),l.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,l){if(i<0||i>31||r>>>i)throw new RangeError("Value out of range");for(let d=i-1;d>=0;d--)l.push(r>>>d&1)}function a(r,i){return(r>>>i&1)!=0}function m(r){if(!r)throw new Error("Assertion error")}const b=class ke{constructor(i,l,d){if(this.mode=i,this.numChars=l,this.bitData=d,l<0)throw new RangeError("Invalid argument");this.bitData=d.slice()}static makeBytes(i){let l=[];for(const d of i)s(d,8,l);return new ke(ke.Mode.BYTE,i.length,l)}static makeNumeric(i){if(!ke.isNumeric(i))throw new RangeError("String contains non-numeric characters");let l=[];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,l),d+=o}return new ke(ke.Mode.NUMERIC,i.length,l)}static makeAlphanumeric(i){if(!ke.isAlphanumeric(i))throw new RangeError("String contains unencodable characters in alphanumeric mode");let l=[],d;for(d=0;d+2<=i.length;d+=2){let o=ke.ALPHANUMERIC_CHARSET.indexOf(i.charAt(d))*45;o+=ke.ALPHANUMERIC_CHARSET.indexOf(i.charAt(d+1)),s(o,11,l)}return d<i.length&&s(ke.ALPHANUMERIC_CHARSET.indexOf(i.charAt(d)),6,l),new ke(ke.Mode.ALPHANUMERIC,i.length,l)}static makeSegments(i){return i==""?[]:ke.isNumeric(i)?[ke.makeNumeric(i)]:ke.isAlphanumeric(i)?[ke.makeAlphanumeric(i)]:[ke.makeBytes(ke.toUtf8ByteArray(i))]}static makeEci(i){let l=[];if(i<0)throw new RangeError("ECI assignment value out of range");if(i<128)s(i,8,l);else if(i<16384)s(2,2,l),s(i,14,l);else if(i<1e6)s(6,3,l),s(i,21,l);else throw new RangeError("ECI assignment value out of range");return new ke(ke.Mode.ECI,0,l)}static isNumeric(i){return ke.NUMERIC_REGEX.test(i)}static isAlphanumeric(i){return ke.ALPHANUMERIC_REGEX.test(i)}getData(){return this.bitData.slice()}static getTotalBits(i,l){let d=0;for(const o of i){const p=o.mode.numCharCountBits(l);if(o.numChars>=1<<p)return 1/0;d+=4+p+o.bitData.length}return d}static toUtf8ByteArray(i){i=encodeURI(i);let l=[];for(let d=0;d<i.length;d++)i.charAt(d)!="%"?l.push(i.charCodeAt(d)):(l.push(parseInt(i.substring(d+1,d+3),16)),d+=2);return l}};b.NUMERIC_REGEX=/^[0-9]*$/,b.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,b.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let C=b;e.QrSegment=b})(vt||(vt={}));(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={}))})(vt||(vt={}));(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={}))})(vt||(vt={}));var xt=vt;var Zf={L:xt.QrCode.Ecc.LOW,M:xt.QrCode.Ecc.MEDIUM,Q:xt.QrCode.Ecc.QUARTILE,H:xt.QrCode.Ecc.HIGH},ho=128,uo="L",fo="#FFFFFF",po="#000000",mo=!1,vo=1,Jf=4,ep=0,tp=.1;function go(e,t=0){const s=[];return e.forEach(function(a,m){let b=null;a.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===a.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 _o(e,t){return e.slice().map((s,a)=>a<t.y||a>=t.y+t.h?s:s.map((m,b)=>b<t.x||b>=t.x+t.w?m:!1))}function sp(e,t,s,a){if(a==null)return null;const m=e.length+s*2,b=Math.floor(t*tp),C=m/t,r=(a.width||b)*C,i=(a.height||b)*C,l=a.x==null?e.length/2-r/2:a.x*C,d=a.y==null?e.length/2-i/2:a.y*C,o=a.opacity==null?1:a.opacity;let p=null;if(a.excavate){let y=Math.floor(l),g=Math.floor(d),n=Math.ceil(r+l-y),f=Math.ceil(i+d-g);p={x:y,y:g,w:n,h:f}}const _=a.crossOrigin;return{x:l,y:d,h:i,w:r,excavation:p,opacity:o,crossOrigin:_}}function rp(e,t){return t!=null?Math.max(Math.floor(t),0):e?Jf:ep}function bo({value:e,level:t,minVersion:s,includeMargin:a,marginSize:m,imageSettings:b,size:C,boostLevel:r}){let i=Z.useMemo(()=>{const y=(Array.isArray(e)?e:[e]).reduce((g,n)=>(g.push(...xt.QrSegment.makeSegments(n)),g),[]);return xt.QrCode.encodeSegments(y,Zf[t],s,void 0,void 0,r)},[e,t,s,r]);const{cells:l,margin:d,numCells:o,calculatedImageSettings:p}=Z.useMemo(()=>{let _=i.getModules();const y=rp(a,m),g=_.length+y*2,n=sp(_,C,y,b);return{cells:_,margin:y,numCells:g,calculatedImageSettings:n}},[i,C,b,a,m]);return{qrcode:i,margin:d,cells:l,numCells:o,calculatedImageSettings:p}}var ip=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),np=Z.forwardRef(function(t,s){const a=t,{value:m,size:b=ho,level:C=uo,bgColor:r=fo,fgColor:i=po,includeMargin:l=mo,minVersion:d=vo,boostLevel:o,marginSize:p,imageSettings:_}=a,g=lr(a,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:n}=g,f=lr(g,["style"]),h=_?.src,u=Z.useRef(null),v=Z.useRef(null),S=Z.useCallback(I=>{u.current=I,typeof s=="function"?s(I):s&&(s.current=I)},[s]),[w,k]=Z.useState(!1),{margin:x,cells:E,numCells:A,calculatedImageSettings:j}=bo({value:m,level:C,minVersion:d,boostLevel:o,includeMargin:l,marginSize:p,imageSettings:_,size:b});Z.useEffect(()=>{if(u.current!=null){const I=u.current,F=I.getContext("2d");if(!F)return;let H=E;const z=v.current,D=j!=null&&z!==null&&z.complete&&z.naturalHeight!==0&&z.naturalWidth!==0;D&&j.excavation!=null&&(H=_o(E,j.excavation));const M=window.devicePixelRatio||1;I.height=I.width=b*M;const P=b/A*M;F.scale(P,P),F.fillStyle=r,F.fillRect(0,0,A,A),F.fillStyle=i,ip?F.fill(new Path2D(go(H,x))):E.forEach(function(O,U){O.forEach(function(K,X){K&&F.fillRect(X+x,U+x,1,1)})}),j&&(F.globalAlpha=j.opacity),D&&F.drawImage(z,j.x+x,j.y+x,j.w,j.h)}}),Z.useEffect(()=>{k(!1)},[h]);const T=ar({height:b,width:b},n);let N=null;return h!=null&&(N=Z.createElement("img",{src:h,key:h,style:{display:"none"},onLoad:()=>{k(!0)},ref:v,crossOrigin:j?.crossOrigin})),Z.createElement(Z.Fragment,null,Z.createElement("canvas",ar({style:T,height:b,width:b,ref:S,role:"img"},f)),N)});np.displayName="QRCodeCanvas";var xo=Z.forwardRef(function(t,s){const a=t,{value:m,size:b=ho,level:C=uo,bgColor:r=fo,fgColor:i=po,includeMargin:l=mo,minVersion:d=vo,boostLevel:o,title:p,marginSize:_,imageSettings:y}=a,g=lr(a,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:n,cells:f,numCells:h,calculatedImageSettings:u}=bo({value:m,level:C,minVersion:d,boostLevel:o,includeMargin:l,marginSize:_,imageSettings:y,size:b});let v=f,S=null;y!=null&&u!=null&&(u.excavation!=null&&(v=_o(f,u.excavation)),S=Z.createElement("image",{href:y.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=go(v,n);return Z.createElement("svg",ar({height:b,width:b,viewBox:`0 0 ${h} ${h}`,ref:s,role:"img"},g),!!p&&Z.createElement("title",null,p),Z.createElement("path",{fill:r,d:`M0,0 h${h}v${h}H0z`,shapeRendering:"crispEdges"}),Z.createElement("path",{fill:i,d:w,shapeRendering:"crispEdges"}),S)});xo.displayName="QRCodeSVG";function op(){return nt({queryKey:le.tunnel.status,queryFn:()=>he.get("/tunnel/status"),refetchInterval:e=>e.state.data?.running?1e4:!1})}function ap(){const e=Te();return Ue({mutationFn:()=>{const t=parseInt(window.location.port||(window.location.protocol==="https:"?"443":"80"),10);return he.post("/tunnel/start",{port:t})},onSuccess:()=>{e.invalidateQueries({queryKey:le.tunnel.status})}})}function lp(){const e=Te();return Ue({mutationFn:()=>he.post("/tunnel/stop"),onSuccess:()=>{e.invalidateQueries({queryKey:le.tunnel.status})}})}function Mi(){const{data:e}=op(),t=ap(),s=lp(),[a,m]=R.useState(!1),[b,C]=R.useState(null),r=R.useRef(null),[i,l]=R.useState({top:0,right:0}),[d,o]=R.useState(!1),p=e?.running??!1,_=t.isPending,y=e?.shareableUrl,g=e?.token;R.useEffect(()=>{if(a&&r.current){const v=r.current.getBoundingClientRect();l({top:v.bottom+8,right:window.innerWidth-v.right})}},[a]);const n=R.useCallback(()=>{p?m(!0):t.mutate(void 0,{onSuccess:()=>m(!0)})},[p,t]),f=R.useCallback(()=>{y&&(navigator.clipboard.writeText(y),C("url"),setTimeout(()=>C(null),2e3))},[y]),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 c.jsxs("div",{className:"relative",children:[c.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:_?c.jsx(Ae,{size:16,className:"animate-spin"}):c.jsx(_s,{size:16})}),p&&!_&&c.jsx("span",{className:"absolute top-0.5 right-0.5 w-2 h-2 bg-emerald-500 rounded-full"}),a&&p&&_t.createPortal(c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"fixed inset-0 z-[100]",onClick:()=>m(!1)}),c.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:[c.jsxs("div",{className:"flex items-center justify-between mb-2",children:[c.jsxs("span",{className:"text-xs font-medium text-emerald-600 flex items-center gap-1.5",children:[c.jsx("span",{className:"w-1.5 h-1.5 bg-emerald-500 rounded-full inline-block"}),"Tunnel Active"]}),c.jsx("button",{onClick:()=>m(!1),className:"p-0.5 text-neutral-400 hover:text-neutral-600 rounded",children:c.jsx(bs,{size:14})})]}),g&&c.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:[c.jsx(Ma,{size:12}),c.jsx("span",{children:"Token protected"})]}),y&&c.jsx("div",{className:"flex justify-center py-3",children:c.jsx(xo,{value:y,size:160})}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("input",{readOnly:!0,value:y??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()}),c.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"?c.jsx(as,{size:14,className:"text-emerald-500"}):c.jsx(Fr,{size:14})})]}),g&&c.jsxs("div",{className:"mt-2",children:[c.jsx("button",{onClick:()=>o(!d),className:"text-xs text-neutral-500 hover:text-neutral-700 transition-colors",children:d?"Hide token":"Show token"}),d&&c.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[c.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}),c.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"?c.jsx(as,{size:14,className:"text-emerald-500"}):c.jsx(Fr,{size:14})})]})]}),c.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 Ni={idle:"Create & Start","creating-task":"Creating Task...","creating-workspace":"Creating Workspace...","creating-session":"Creating Session...","starting-session":"Starting Agent..."},Mt=R.lazy(()=>Ii(()=>import("./modal-D7xekFRe.js").then(e=>e.m),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.Modal}))),Gs=R.lazy(()=>Ii(()=>import("./folder-picker-B7s6TEGt.js"),__vite__mapDeps([5,1,2,3,6,7,8,9,10,11,12])).then(e=>({default:e.FolderPicker}))),Pi=c.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:[c.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",fill:"currentColor"}),c.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Oi=c.jsx("span",{className:"font-bold text-neutral-900 tracking-tight text-base",children:"Agent Tower"}),cp=260,hp=600,Bi=400;function Cp(){const[e,t]=R.useState(null),[s,a]=R.useState(null),[m,b]=R.useState(Bi),[C,r]=R.useState(!1),[i,l]=R.useState(!1),[d,o]=R.useState(""),[p,_]=R.useState(""),[y,g]=R.useState(""),[n,f]=R.useState(""),[h,u]=R.useState(""),[v,S]=R.useState(""),[w,k]=R.useState([]),[x,E]=R.useState("idle"),A=R.useRef(!1),j=R.useRef(0),T=R.useRef(Bi),N=R.useRef(null),I=Te(),{data:F,isLoading:H}=Ho(),z=F?.data??[],D=R.useMemo(()=>z.map(wf),[z]),M=R.useMemo(()=>z.map(q=>q.id),[z]);Tf(M);const{data:P,isLoading:O}=Rf(s??""),U=qo({queries:s?[]:z.map(q=>({queryKey:le.tasks.list(q.id),queryFn:()=>he.get(`/projects/${q.id}/tasks`,{params:{limit:"100"}})}))}),K=!s&&U.some(q=>q.isLoading),X=R.useMemo(()=>{if(s)return P?.data??[];const q=[];for(const ie of U)ie.data?.data&&q.push(...ie.data.data);return q},[s,P,U]),G=R.useMemo(()=>X.map(kf),[X]),ne=R.useMemo(()=>new Set,[]),L=R.useMemo(()=>{if(!e)return null;const q=G.find(pe=>pe.id===e);if(!q)return null;const ie=z.find(pe=>pe.id===q.projectId);return{id:q.id,projectId:q.projectId,projectName:ie?.name??"Unknown",projectColor:ie?.color??"text-neutral-500",title:q.title,status:q.status,branch:q.branch,mainBranch:ie?.mainBranch??"main",description:q.description}},[e,G,z]),B=zo(),$=Df(h),W=Af(),J=Lf(),Y=R.useCallback(q=>{W.mutate(q,{onSuccess:()=>{e===q&&t(null),I.invalidateQueries({queryKey:le.tasks.all})}})},[W,e,I]),oe=R.useCallback((q,ie)=>{J.mutate({id:q,status:Sf(ie)},{onError:()=>{Do.error("状态变更失败,该操作不被允许")}})},[J]),de=R.useCallback(q=>{q.preventDefault(),A.current=!0,j.current=q.clientX,T.current=m,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[m]);R.useEffect(()=>{const q=pe=>{if(!A.current)return;const Ie=pe.clientX-j.current,je=Math.max(cp,Math.min(hp,T.current+Ie));b(je)},ie=()=>{A.current&&(A.current=!1,document.body.style.cursor="",document.body.style.userSelect="")};return document.addEventListener("mousemove",q),document.addEventListener("mouseup",ie),()=>{document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",ie)}},[]);const be=R.useCallback(()=>{r(!0)},[]),Ee=R.useCallback(()=>{u(s??z[0]?.id??""),S(""),E("idle"),l(!0),he.get("/demo/agents").then(q=>{k(q.agents);const ie=q.agents.find(pe=>pe.available);ie&&S(ie.type)})},[s,z]),te=R.useCallback(()=>{r(!1),o(""),_("")},[]),Re=R.useCallback(()=>{x==="idle"&&(l(!1),g(""),f(""),u(""),S(""),E("idle"))},[x]),De=R.useCallback(async()=>{if(!(!d.trim()||!p.trim()))try{await B.mutateAsync({name:d.trim(),repoPath:p.trim()}),te()}catch{}},[d,p,B,te]),Q=eo(),re=R.useCallback(async()=>{if(!(!y.trim()||!h))try{E("creating-task");const q=await $.mutateAsync({title:y.trim(),description:n.trim()||void 0});if(v){const ie=[y.trim(),n.trim()].filter(Boolean).join(`
|
|
82
82
|
|
|
83
83
|
`);E("creating-workspace");const pe=await he.post(`/tasks/${q.id}/workspaces`,{});E("creating-session");const Ie=await he.post(`/workspaces/${pe.id}/sessions`,{agentType:v,prompt:ie});E("starting-session"),await Q.mutateAsync(Ie.id),await I.invalidateQueries({queryKey:le.workspaces.list(q.id)})}t(q.id),E("idle"),l(!1),g(""),f(""),u(""),S("")}catch{E("idle")}},[y,n,h,v,$,Q,I]),fe=H||O||K;return Pf()?e&&L?c.jsxs(c.Fragment,{children:[c.jsx(Gf,{task:L,onBack:()=>t(null),onDeleteTask:Y,isDeleting:W.isPending}),c.jsx(R.Suspense,{fallback:null,children:c.jsx(Mt,{isOpen:C,onClose:te,title:"Create New Project",action:c.jsxs(c.Fragment,{children:[c.jsx("button",{onClick:te,className:"px-4 py-2 text-sm text-neutral-600",children:"Cancel"}),c.jsx("button",{onClick:De,disabled:!d.trim()||!p.trim()||B.isPending,className:`px-4 py-2 text-sm font-medium rounded-lg ${d.trim()&&p.trim()&&!B.isPending?"bg-neutral-900 text-white":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:B.isPending?"Creating...":"Create"})]}),children:c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Project Name"}),c.jsx("input",{type:"text",value:d,onChange:q=>o(q.target.value),placeholder:"e.g., Agent Tower",className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:border-neutral-400",autoFocus:!0})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Repository Path"}),c.jsx(Gs,{value:p,onChange:_})]})]})})})]}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex flex-col h-dvh bg-neutral-50 overflow-hidden text-sm",children:[c.jsxs("header",{className:"h-12 bg-white border-b border-neutral-200 flex items-center px-4 justify-between shrink-0 z-10",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[Pi,Oi]}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(Mi,{}),c.jsx(Mr,{to:"/settings",className:"p-1.5 text-neutral-400 active:text-neutral-900 rounded-md",children:c.jsx(Or,{size:16})})]})]}),fe&&G.length===0?c.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-neutral-400",children:"Loading..."}):c.jsx(Jr,{tasks:G,projects:D,selectedTaskId:null,onSelectTask:t,filterProjectId:s,setFilterProjectId:a,width:"100%",onCreateProject:be,onCreateTask:Ee,activeTaskIds:ne,onTaskStatusChange:oe})]}),c.jsxs(R.Suspense,{fallback:null,children:[c.jsx(Mt,{isOpen:C,onClose:te,title:"Create New Project",action:c.jsxs(c.Fragment,{children:[c.jsx("button",{onClick:te,className:"px-4 py-2 text-sm text-neutral-600",children:"Cancel"}),c.jsx("button",{onClick:De,disabled:!d.trim()||!p.trim()||B.isPending,className:`px-4 py-2 text-sm font-medium rounded-lg ${d.trim()&&p.trim()&&!B.isPending?"bg-neutral-900 text-white":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:B.isPending?"Creating...":"Create"})]}),children:c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Project Name"}),c.jsx("input",{type:"text",value:d,onChange:q=>o(q.target.value),placeholder:"e.g., Agent Tower",className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:border-neutral-400",autoFocus:!0})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Repository Path"}),c.jsx(Gs,{value:p,onChange:_})]})]})}),c.jsx(Mt,{isOpen:i,onClose:Re,title:"Create New Task",action:c.jsxs(c.Fragment,{children:[c.jsx("button",{onClick:Re,disabled:x!=="idle",className:"px-4 py-2 text-sm text-neutral-600 disabled:opacity-50",children:"Cancel"}),c.jsx("button",{onClick:re,disabled:!y.trim()||!h||x!=="idle",className:`px-4 py-2 text-sm font-medium rounded-lg ${y.trim()&&h&&x==="idle"?"bg-neutral-900 text-white":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:Ni[x]})]}),children:c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"flex gap-3",children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Project"}),c.jsx(es,{value:h,onChange:u,options:z.map(q=>({value:q.id,label:q.name})),placeholder:"Select project...",disabled:x!=="idle"})]}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Agent"}),c.jsx(es,{value:v,onChange:S,options:w.map(q=>({value:q.type,label:q.name+(q.available&&q.version?` (${q.version})`:""),disabled:!q.available})),placeholder:w.length===0?"Loading...":"Select agent...",disabled:x!=="idle"})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Task Title"}),c.jsx("input",{type:"text",value:y,onChange:q=>g(q.target.value),placeholder:"e.g., Implement login flow",className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:border-neutral-400",disabled:x!=="idle",onKeyDown:q=>{q.key==="Enter"&&!q.nativeEvent.isComposing&&q.nativeEvent.keyCode!==229&&re()}})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Description"}),c.jsx("textarea",{rows:3,value:n,onChange:q=>f(q.target.value),placeholder:"Optional...",className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:border-neutral-400 resize-none",disabled:x!=="idle",onKeyDown:q=>{(q.metaKey||q.ctrlKey)&&q.key==="Enter"&&!q.nativeEvent.isComposing&&q.nativeEvent.keyCode!==229&&re()}})]})]})})]})]}):c.jsxs("div",{ref:N,className:"flex flex-col h-screen bg-neutral-50 overflow-hidden text-sm",children:[c.jsxs("header",{className:"h-12 bg-white border-b border-neutral-200 flex items-center px-4 justify-between flex-shrink-0 z-10 relative",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[Pi,Oi]}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(Mi,{}),c.jsx(Mr,{to:"/settings",className:"p-1.5 text-neutral-400 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors",children:c.jsx(Or,{size:16})})]})]}),c.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[fe&&G.length===0?c.jsx("div",{className:"h-full flex items-center justify-center text-sm text-neutral-400 border-r border-neutral-200 flex-shrink-0",style:{width:m},children:"Loading..."}):c.jsx(Jr,{tasks:G,projects:D,selectedTaskId:e,onSelectTask:t,filterProjectId:s,setFilterProjectId:a,width:m,onCreateProject:be,onCreateTask:Ee,activeTaskIds:ne,onTaskStatusChange:oe,onDeleteTask:Y}),c.jsx("div",{onMouseDown:de,className:"w-1 cursor-col-resize hover:bg-neutral-300 active:bg-neutral-400 transition-colors z-50 -ml-[2px] flex-shrink-0 h-full",title:"Drag to resize"}),c.jsx(bf,{task:L,onDeleteTask:Y,isDeleting:W.isPending,onTaskStatusChange:oe})]}),c.jsxs(R.Suspense,{fallback:null,children:[c.jsx(Mt,{isOpen:C,onClose:te,title:"Create New Project",action:c.jsxs(c.Fragment,{children:[c.jsx("button",{onClick:te,className:"px-4 py-2 text-sm text-neutral-600 hover:text-neutral-900 transition-colors",children:"Cancel"}),c.jsx("button",{onClick:De,disabled:!d.trim()||!p.trim()||B.isPending,className:`px-4 py-2 text-sm font-medium rounded-lg transition-all ${d.trim()&&p.trim()&&!B.isPending?"bg-neutral-900 text-white hover:bg-black":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:B.isPending?"Creating...":"Create Project"})]}),children:c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Project Name"}),c.jsx("input",{type:"text",value:d,onChange:q=>o(q.target.value),placeholder:"e.g., Agent Tower",className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:border-neutral-400 transition-colors",autoFocus:!0})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Repository Path"}),c.jsx(Gs,{value:p,onChange:_})]}),B.isError&&c.jsx("p",{className:"text-xs text-red-500",children:B.error instanceof Error?B.error.message:"Failed to create project"})]})}),c.jsx(Mt,{isOpen:i,onClose:Re,title:"Create New Task",action:c.jsxs(c.Fragment,{children:[c.jsx("button",{onClick:Re,disabled:x!=="idle",className:"px-4 py-2 text-sm text-neutral-600 hover:text-neutral-900 transition-colors disabled:opacity-50",children:"Cancel"}),c.jsx("button",{onClick:re,disabled:!y.trim()||!h||x!=="idle",className:`px-4 py-2 text-sm font-medium rounded-lg transition-all ${y.trim()&&h&&x==="idle"?"bg-neutral-900 text-white hover:bg-black":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:Ni[x]})]}),children:c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"flex gap-3",children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Project"}),c.jsx(es,{value:h,onChange:u,options:z.map(q=>({value:q.id,label:q.name})),placeholder:"Select project...",disabled:x!=="idle"})]}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Agent"}),c.jsx(es,{value:v,onChange:S,options:w.map(q=>({value:q.type,label:q.name+(q.available&&q.version?` (${q.version})`:""),disabled:!q.available})),placeholder:w.length===0?"Loading...":"Select agent...",disabled:x!=="idle"})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Task Title"}),c.jsx("input",{type:"text",value:y,onChange:q=>g(q.target.value),placeholder:"e.g., Implement login flow",className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:border-neutral-400 transition-colors",disabled:x!=="idle",onKeyDown:q=>{q.key==="Enter"&&!q.nativeEvent.isComposing&&q.nativeEvent.keyCode!==229&&re()}})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Description"}),c.jsx("textarea",{rows:3,value:n,onChange:q=>f(q.target.value),placeholder:"Optional description...",className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:border-neutral-400 transition-colors resize-none",disabled:x!=="idle",onKeyDown:q=>{(q.metaKey||q.ctrlKey)&&q.key==="Enter"&&!q.nativeEvent.isComposing&&q.nativeEvent.keyCode!==229&&re()}})]}),$.isError&&c.jsx("p",{className:"text-xs text-red-500",children:$.error instanceof Error?$.error.message:"Failed to create task"})]})})]})]})}export{Cp as ProjectKanbanPage};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as P,r as o,j as e}from"./index-
|
|
1
|
+
import{c as P,r as o,j as e}from"./index-BtJ21Bn6.js";import{a as k,F as w,u as z,b as q}from"./use-projects-CVQDuqNr.js";import{a as R,B as I}from"./api-client-JWeNZKcl.js";import{S as L}from"./select-Dwk13G3M.js";import{X as C,P as S}from"./x-4BBJo9pY.js";import"./query-keys-C9CBerVg.js";import"./chevron-down-DVussag2.js";const A=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],K=P("folder-plus",A);function M({value:r,onChange:h,repoPath:d,placeholder:m}){const[l,c]=o.useState(""),[u,x]=o.useState([]),[p,s]=o.useState(!1),[a,g]=o.useState(-1),j=o.useRef(null),y=o.useRef(null),i=o.useRef(void 0),f=o.useCallback(async t=>{if(!d||!t){x([]),s(!1);return}try{const n=await R.get("/filesystem/complete",{params:{basePath:d,prefix:t}});x(n.results),s(n.results.length>0),g(-1)}catch{x([]),s(!1)}},[d]);o.useEffect(()=>{if(clearTimeout(i.current),!l){x([]),s(!1);return}return i.current=setTimeout(()=>f(l),200),()=>clearTimeout(i.current)},[l,f]),o.useEffect(()=>{const t=n=>{y.current&&!y.current.contains(n.target)&&j.current&&!j.current.contains(n.target)&&s(!1)};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[]);const b=t=>{const n=t.trim();!n||r.includes(n)||(h([...r,n]),c(""),s(!1),j.current?.focus())},E=t=>{h(r.filter((n,v)=>v!==t))},N=t=>{t.type==="directory"?(c(t.path),j.current?.focus()):b(t.path)},D=(t,n)=>{n.stopPropagation(),b(t.path.replace(/\/$/,""))},F=t=>{t.nativeEvent.isComposing||t.nativeEvent.keyCode===229||(p&&u.length>0?t.key==="ArrowDown"?(t.preventDefault(),g(n=>Math.min(n+1,u.length-1))):t.key==="ArrowUp"?(t.preventDefault(),g(n=>Math.max(n-1,-1))):t.key==="Enter"?(t.preventDefault(),a>=0?N(u[a]):b(l)):t.key==="Escape"&&s(!1):t.key==="Enter"&&(t.preventDefault(),b(l)))};return e.jsxs("div",{children:[r.length>0&&e.jsx("div",{className:"border border-neutral-200 rounded-lg mb-2 divide-y divide-neutral-100",children:r.map((t,n)=>e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 group",children:[t.includes(".")&&!t.endsWith("/")?e.jsx(k,{size:14,className:"text-neutral-400 shrink-0"}):e.jsx(w,{size:14,className:"text-amber-500 shrink-0"}),e.jsx("span",{className:"text-sm font-mono text-neutral-700 truncate flex-1",children:t}),e.jsx("button",{onClick:()=>E(n),className:"p-0.5 text-neutral-300 hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:e.jsx(C,{size:14})})]},t))}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{ref:j,type:"text",value:l,onChange:t=>c(t.target.value),onKeyDown:F,onFocus:()=>{l&&u.length>0&&s(!0)},placeholder:m??"输入文件路径...",className:"flex-1 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("button",{onClick:()=>b(l),disabled:!l.trim(),className:"flex items-center gap-1 px-3 py-2 text-sm bg-neutral-900 text-white rounded-lg hover:bg-neutral-800 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[e.jsx(S,{size:14}),e.jsx("span",{children:"添加"})]})]}),p&&e.jsx("div",{ref:y,className:"absolute z-50 left-0 right-0 mt-1 bg-white border border-neutral-200 rounded-lg shadow-lg max-h-[200px] overflow-y-auto",children:u.map((t,n)=>e.jsxs("button",{onClick:()=>N(t),className:`w-full flex items-center gap-2 px-3 py-1.5 text-sm text-left hover:bg-neutral-50 transition-colors ${n===a?"bg-neutral-100":""}`,children:[t.type==="directory"?e.jsx(w,{size:14,className:"text-amber-500 shrink-0"}):e.jsx(k,{size:14,className:"text-neutral-400 shrink-0"}),e.jsx("span",{className:"font-mono text-neutral-700 truncate flex-1",children:t.path}),t.type==="directory"&&e.jsx("span",{onClick:v=>D(t,v),className:"p-0.5 text-neutral-300 hover:text-emerald-600 shrink-0",title:"添加此目录",children:e.jsx(K,{size:14})})]},t.path))})]})]})}function _({value:r,onChange:h}){const[d,m]=o.useState(""),[l,c]=o.useState(""),u=()=>{const s=d.trim(),a=l.trim();!s||!a||(h([...r,{name:s,command:a}]),m(""),c(""))},x=s=>{h(r.filter((a,g)=>g!==s))},p=s=>{s.key==="Enter"&&!s.nativeEvent.isComposing&&s.nativeEvent.keyCode!==229&&(s.preventDefault(),u())};return e.jsxs("div",{children:[r.length>0&&e.jsx("div",{className:"border border-neutral-200 rounded-lg mb-2 divide-y divide-neutral-100",children:r.map((s,a)=>e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 group",children:[e.jsx("span",{className:"text-sm font-medium text-neutral-700 w-28 shrink-0 truncate",children:s.name}),e.jsx("span",{className:"text-sm font-mono text-neutral-500 flex-1 truncate",children:s.command}),e.jsx("button",{onClick:()=>x(a),className:"p-0.5 text-neutral-300 hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:e.jsx(C,{size:14})})]},a))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:d,onChange:s=>m(s.target.value),onKeyDown:p,placeholder:"名称",className:"w-28 shrink-0 px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:ring-1 focus:ring-neutral-300"}),e.jsx("input",{type:"text",value:l,onChange:s=>c(s.target.value),onKeyDown:p,placeholder:"命令",className:"flex-1 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("button",{onClick:u,disabled:!d.trim()||!l.trim(),className:"flex items-center gap-1 px-3 py-2 text-sm bg-neutral-900 text-white rounded-lg hover:bg-neutral-800 disabled:opacity-30 disabled:cursor-not-allowed transition-colors shrink-0",children:[e.jsx(S,{size:14}),e.jsx("span",{children:"添加"})]})]})]})}function B(r){return r?r.split(",").map(h=>h.trim()).filter(Boolean):[]}function O(r){if(!r)return[];try{return JSON.parse(r)}catch{return[]}}function W(){const{data:r,isLoading:h}=z({limit:100}),d=q(),[m,l]=o.useState(""),[c,u]=o.useState({copyFiles:[],setupScript:"",quickCommands:[]}),[x,p]=o.useState(!1),s=r?.data??[],a=s.find(i=>i.id===m);if(o.useEffect(()=>{!m&&s.length>0&&l(s[0].id)},[s,m]),o.useEffect(()=>{a&&!x&&u({copyFiles:B(a.copyFiles),setupScript:a.setupScript??"",quickCommands:O(a.quickCommands)})},[a,x]),h)return e.jsx("div",{className:"p-6 text-sm text-neutral-400",children:"加载中..."});if(s.length===0)return e.jsx("div",{className:"p-6 text-sm text-neutral-400",children:"暂无项目,请先创建项目"});const g=s.map(i=>({value:i.id,label:i.name})),j=()=>{m&&d.mutate({id:m,copyFiles:c.copyFiles.length>0?c.copyFiles.join(", "):null,setupScript:c.setupScript.trim()||null,quickCommands:c.quickCommands.length>0?JSON.stringify(c.quickCommands):null},{onSuccess:()=>p(!1)})},y=i=>{l(i),p(!1)};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(L,{value:m,onChange:y,options:g,placeholder:"选择项目..."})]}),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:"创建 worktree 时自动从主仓库复制的文件或目录。支持 glob 模式。"}),e.jsx(M,{value:c.copyFiles,onChange:i=>{u(f=>({...f,copyFiles:i})),p(!0)},repoPath:a?.repoPath??""}),e.jsx("p",{className:"text-[11px] text-neutral-400 mt-2",children:"适用于不在 git 管理中但启动必需的文件,如 .env、node_modules、数据库文件等"})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-[13px] font-semibold text-neutral-900 mb-1",children:"Setup 脚本"}),e.jsx("p",{className:"text-[12px] text-neutral-400 mb-3",children:"创建 worktree 后自动执行的命令,每行一条,按顺序执行。"}),e.jsx("textarea",{value:c.setupScript,onChange:i=>{u(f=>({...f,setupScript:i.target.value})),p(!0)},placeholder:`pnpm install
|
|
2
2
|
pnpm run setup`,rows:4,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"}),e.jsx("p",{className:"text-[11px] text-neutral-400 mt-1",children:"命令在 worktree 目录下执行,单条命令超时 5 分钟,失败不会阻断后续命令"})]}),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(_,{value:c.quickCommands,onChange:i=>{u(f=>({...f,quickCommands:i})),p(!0)}})]}),x&&e.jsx("div",{className:"sticky bottom-6 flex justify-end",children:e.jsx(I,{size:"sm",onClick:j,disabled:d.isPending,children:d.isPending?"保存中...":"保存"})})]})}export{W as ProjectSettingsPage};
|