@shumai-one/shumai 0.6.1 → 0.6.3
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/bin/chunk-02b5bcmc.js +1 -0
- package/bin/chunk-09mj32d7.js +2 -0
- package/bin/{chunk-bg6waaf9.js → chunk-09mpcg9x.js} +2 -2
- package/bin/{chunk-ahgq10a7.js → chunk-0a298n62.js} +2 -2
- package/bin/chunk-0rgbxp24.js +3 -0
- package/bin/{chunk-9s0k533c.js → chunk-19zbh4fr.js} +1 -1
- package/bin/{chunk-c6f8x05m.js → chunk-1e1q1hyg.js} +2 -2
- package/bin/chunk-1ja2zw4w.js +2 -0
- package/bin/chunk-1tar0x8s.js +7 -0
- package/bin/{chunk-p1ed0pa6.js → chunk-1y6h4vge.js} +1 -1
- package/bin/{chunk-d18v5vmp.js → chunk-20bamhwa.js} +2 -2
- package/bin/chunk-20w1w9x7.js +2 -0
- package/bin/{chunk-b7qs7hxg.js → chunk-25npafhz.js} +2 -2
- package/bin/chunk-2qgagdb7.js +1 -0
- package/bin/chunk-2t6g3pny.js +3 -0
- package/bin/chunk-34f64q0q.js +2 -0
- package/bin/{chunk-kywdke0y.js → chunk-3hgrw1m0.js} +5 -5
- package/bin/{chunk-16n160h1.js → chunk-3s2ga6mt.js} +1 -1
- package/bin/{chunk-r9gp9yqw.js → chunk-3vpz5nat.js} +1 -1
- package/bin/chunk-4p31kxjh.js +3 -0
- package/bin/{chunk-3j82q2gj.js → chunk-4vjgdj0h.js} +1 -1
- package/bin/chunk-50pfmxt1.js +2 -0
- package/bin/chunk-5ddg5ezb.js +55 -0
- package/bin/chunk-5ngftxjb.js +218 -0
- package/bin/chunk-6f3zhq64.js +5 -0
- package/bin/chunk-6nqqe7w9.js +1 -0
- package/bin/chunk-6t525bmg.js +1 -0
- package/bin/chunk-7546ptwg.js +32 -0
- package/bin/chunk-7jz3cmq6.js +2 -0
- package/bin/{chunk-ht5rht98.js → chunk-7kah3zb5.js} +2 -2
- package/bin/chunk-7mawxsk3.js +2 -0
- package/bin/{chunk-fxtzy5f5.js → chunk-88jg9dq5.js} +2 -2
- package/bin/chunk-8ww98y1m.js +2 -0
- package/bin/chunk-9405hzv2.js +2 -0
- package/bin/chunk-95b4mwyq.js +2 -0
- package/bin/chunk-9vxmgvc8.js +2 -0
- package/bin/chunk-9x42vgeq.js +16 -0
- package/bin/{chunk-s01p4w8d.js → chunk-a74g6h8a.js} +2 -2
- package/bin/{chunk-am6dg0a5.js → chunk-a859y4e1.js} +2 -2
- package/bin/chunk-addssm8d.js +1 -0
- package/bin/chunk-ajq9sxg0.js +129 -0
- package/bin/chunk-amp9h878.js +2 -0
- package/bin/chunk-atdfqdkj.js +7 -0
- package/bin/{chunk-dfecgpce.js → chunk-atpt99h4.js} +13 -13
- package/bin/chunk-awshe30f.js +1 -0
- package/bin/chunk-b3t7gbhm.js +2 -0
- package/bin/chunk-bbxwyhz3.js +4 -0
- package/bin/chunk-bd3v8mp1.js +7 -0
- package/bin/chunk-brgns7hv.js +2 -0
- package/bin/chunk-c02727j9.js +2 -0
- package/bin/chunk-c1wvs81k.js +2 -0
- package/bin/chunk-c8frmqsk.js +2 -0
- package/bin/chunk-cagzye3j.js +2 -0
- package/bin/{chunk-b9d8xdhb.js → chunk-cp96e9pq.js} +1 -1
- package/bin/chunk-d55138xx.js +5 -0
- package/bin/{chunk-3me1v3z5.js → chunk-ddmf9gqv.js} +2 -2
- package/bin/chunk-djb65frk.js +1 -0
- package/bin/{chunk-hzv1mhr5.js → chunk-dkhdn92k.js} +2 -2
- package/bin/chunk-dx9f5wab.js +1 -0
- package/bin/chunk-dygj751y.js +393 -0
- package/bin/chunk-e55sgg8t.js +2 -0
- package/bin/{chunk-fre31bhw.js → chunk-enax4303.js} +2 -2
- package/bin/{chunk-jb8vbeb0.js → chunk-erfkd3z9.js} +2 -2
- package/bin/chunk-esj0kwe5.js +12 -0
- package/bin/chunk-etrm28sy.js +2 -0
- package/bin/chunk-ex3174e3.js +2 -0
- package/bin/{chunk-bs6saf4d.js → chunk-eyjfhdp9.js} +2 -2
- package/bin/{chunk-r5g84kj4.js → chunk-ezjxx44x.js} +3 -3
- package/bin/chunk-f4xnx4n6.js +1 -0
- package/bin/{chunk-jq3pq545.js → chunk-f8hgy69t.js} +2 -2
- package/bin/chunk-fakph5jp.js +1 -0
- package/bin/{chunk-1eqw2dpx.js → chunk-femnbfkj.js} +2 -2
- package/bin/chunk-ffjdkdcv.js +2 -0
- package/bin/chunk-gd016e9p.js +2 -0
- package/bin/chunk-gyv3yrhj.js +2 -0
- package/bin/{chunk-sd6w0z6a.js → chunk-h2bphev9.js} +2 -2
- package/bin/chunk-h3atwgx2.js +1 -0
- package/bin/chunk-h7xny3de.js +2 -0
- package/bin/chunk-hg3rkp41.js +11 -0
- package/bin/chunk-hpzk9k55.js +1 -0
- package/bin/chunk-hsyfrzdd.js +1 -0
- package/bin/chunk-hvyy8vct.js +3 -0
- package/bin/chunk-j2s311yc.js +3 -0
- package/bin/{chunk-swz6v48q.js → chunk-j2txsbxz.js} +2 -2
- package/bin/chunk-j6x53e33.js +1 -0
- package/bin/chunk-jacanzp7.js +1 -0
- package/bin/chunk-jc7dycy6.js +2 -0
- package/bin/{chunk-6hzktewz.js → chunk-jt02kpfc.js} +2 -2
- package/bin/chunk-k7vbk8v4.js +3 -0
- package/bin/chunk-mn0kt3p6.js +3 -0
- package/bin/chunk-mn71dffh.js +4 -0
- package/bin/chunk-npeapp7e.js +7 -0
- package/bin/{chunk-qqj2m1b1.js → chunk-p2vsdnd1.js} +2 -2
- package/bin/chunk-pdw77q09.js +2 -0
- package/bin/chunk-pq6kdp83.js +4 -0
- package/bin/chunk-ptcz4ed3.js +2 -0
- package/bin/chunk-q1fzgqsv.js +2 -0
- package/bin/chunk-q4ny4hpt.js +2 -0
- package/bin/{chunk-wsprap60.js → chunk-q5x0yywj.js} +2 -2
- package/bin/{chunk-h6f2gyt5.js → chunk-q8xr1a8j.js} +2 -2
- package/bin/chunk-q8ysc5ex.js +1 -0
- package/bin/chunk-qm50g4n5.js +10 -0
- package/bin/chunk-qvp24w0q.js +2 -0
- package/bin/chunk-r6t0j0jx.js +11 -0
- package/bin/chunk-s1j4v33x.js +2 -0
- package/bin/{chunk-n412a1hp.js → chunk-s6pk2zyg.js} +6 -6
- package/bin/chunk-s74g9vsk.js +3 -0
- package/bin/chunk-sz19nn1x.js +2 -0
- package/bin/{chunk-agcnbjxk.js → chunk-sz5zawfw.js} +2 -2
- package/bin/chunk-t68y25gf.js +1 -0
- package/bin/chunk-te484xtb.js +13 -0
- package/bin/{chunk-c60j1b4w.js → chunk-tfrevef9.js} +1 -1
- package/bin/chunk-thpw6tcj.js +2 -0
- package/bin/{chunk-w4ydfy9d.js → chunk-v0yevesp.js} +7 -7
- package/bin/chunk-vj4gamdn.js +2 -0
- package/bin/chunk-vmwys2ch.js +2 -0
- package/bin/chunk-vnmggrd6.js +18 -0
- package/bin/{chunk-d4hk62q2.js → chunk-vv0m0m2f.js} +4 -4
- package/bin/chunk-w6g84d59.js +8 -0
- package/bin/chunk-wgvgtttc.js +13 -0
- package/bin/chunk-xy9qpn6b.js +1 -0
- package/bin/{chunk-0tvnfy4k.js → chunk-y3haqtr8.js} +2 -2
- package/bin/chunk-y5dv67mg.js +2 -0
- package/bin/chunk-yb4mzqrd.js +5 -0
- package/bin/chunk-z0de127n.js +5 -0
- package/bin/chunk-z8t6e0ee.js +1 -0
- package/bin/chunk-zfg4yy3c.js +2 -0
- package/bin/{chunk-acmr8v0d.js → chunk-zkvezz89.js} +1 -1
- package/bin/chunk-zrrnvdxq.js +3 -0
- package/bin/chunk-zx1c4vm5.js +42 -0
- package/bin/chunk-zzqse5qc.js +2 -0
- package/bin/shumai-app.html +1 -1
- package/bin/shumai-app.js +942 -1015
- package/package.json +7 -7
- package/prisma/migrations/20261026024507_hash_api_tokens/migration.sql +28 -0
- package/prisma/migrations/20261026031904_add_audit_log_via/migration.sql +2 -0
- package/prisma/migrations/20261029024626_add_oauth_and_jwks/migration.sql +205 -0
- package/prisma/migrations/20261029030321_default_empty_arrays_oauth/migration.sql +25 -0
- package/prisma/schema.prisma +186 -1
- package/bin/chunk-0502p2k7.js +0 -3
- package/bin/chunk-0b0t6y8h.js +0 -11
- package/bin/chunk-1vt9ss7d.js +0 -2
- package/bin/chunk-23780yj6.js +0 -3
- package/bin/chunk-2cpsfc87.js +0 -1
- package/bin/chunk-2w0d9veg.js +0 -2
- package/bin/chunk-2xp9prpq.js +0 -1
- package/bin/chunk-3gqs15zq.js +0 -2
- package/bin/chunk-3pw7z25v.js +0 -3
- package/bin/chunk-3tx9v8kj.js +0 -2
- package/bin/chunk-3wdtp4ht.js +0 -1
- package/bin/chunk-57axjy7y.js +0 -1
- package/bin/chunk-5aqthcm6.js +0 -5
- package/bin/chunk-5gq4q1bb.js +0 -2
- package/bin/chunk-5r1br11d.js +0 -2
- package/bin/chunk-61hrdg0g.js +0 -1
- package/bin/chunk-6aa4xmnw.js +0 -2
- package/bin/chunk-6mrgtn78.js +0 -18
- package/bin/chunk-6s55r0z9.js +0 -1
- package/bin/chunk-6vkfzzvt.js +0 -5
- package/bin/chunk-7dprpnm6.js +0 -2
- package/bin/chunk-7rycq6wb.js +0 -129
- package/bin/chunk-895gzdtp.js +0 -7
- package/bin/chunk-8d1p8qpv.js +0 -1
- package/bin/chunk-8r3k84dh.js +0 -2
- package/bin/chunk-99sarrvt.js +0 -3
- package/bin/chunk-b21z62fj.js +0 -1
- package/bin/chunk-bv589v2m.js +0 -3
- package/bin/chunk-c8kjpmfe.js +0 -2
- package/bin/chunk-c9xyejnk.js +0 -2
- package/bin/chunk-cb9peqy5.js +0 -2
- package/bin/chunk-ckczqmrz.js +0 -5
- package/bin/chunk-cr33cs6j.js +0 -2
- package/bin/chunk-cxet91kt.js +0 -2
- package/bin/chunk-d7e351jd.js +0 -6
- package/bin/chunk-ebcfbn00.js +0 -2
- package/bin/chunk-f0b4a9y3.js +0 -2
- package/bin/chunk-fkn6f4qt.js +0 -4
- package/bin/chunk-g78vapcm.js +0 -2
- package/bin/chunk-gdpfwxea.js +0 -4
- package/bin/chunk-gwqqq0b1.js +0 -32
- package/bin/chunk-h3cwf9aw.js +0 -2
- package/bin/chunk-h4ty530v.js +0 -16
- package/bin/chunk-h58yfx7w.js +0 -2
- package/bin/chunk-h9ngpxyd.js +0 -1
- package/bin/chunk-hbr17jvr.js +0 -13
- package/bin/chunk-hc0xbmtt.js +0 -5
- package/bin/chunk-j9t7tvt5.js +0 -2
- package/bin/chunk-jvt8q0eg.js +0 -2
- package/bin/chunk-jzgtthsj.js +0 -3
- package/bin/chunk-jzjhg7ng.js +0 -1
- package/bin/chunk-k547syp2.js +0 -2
- package/bin/chunk-k7sjpke6.js +0 -2
- package/bin/chunk-k8ct1qgv.js +0 -3
- package/bin/chunk-k9q4nn8b.js +0 -11
- package/bin/chunk-keetdtxb.js +0 -2
- package/bin/chunk-kjjw8mbg.js +0 -1
- package/bin/chunk-mey80kv9.js +0 -54
- package/bin/chunk-nfncawpm.js +0 -12
- package/bin/chunk-nvwt8atc.js +0 -1
- package/bin/chunk-p1d500sf.js +0 -211
- package/bin/chunk-q0vs124k.js +0 -2
- package/bin/chunk-q5795f3s.js +0 -2
- package/bin/chunk-q5j3b0h5.js +0 -3
- package/bin/chunk-qd7pvaxb.js +0 -2
- package/bin/chunk-qhpt7170.js +0 -2
- package/bin/chunk-qt78vs3g.js +0 -2
- package/bin/chunk-ra6mdjr0.js +0 -1
- package/bin/chunk-ryfvaz6v.js +0 -3
- package/bin/chunk-s22eapcc.js +0 -2
- package/bin/chunk-sbg86tch.js +0 -2
- package/bin/chunk-sbqy6m8t.js +0 -1
- package/bin/chunk-sdp9w627.js +0 -14
- package/bin/chunk-sn0nypvd.js +0 -42
- package/bin/chunk-sv92vkyh.js +0 -2
- package/bin/chunk-t6cn018t.js +0 -3
- package/bin/chunk-ts4d1mxf.js +0 -2
- package/bin/chunk-wkdkc12e.js +0 -4
- package/bin/chunk-xgnvktq6.js +0 -10
- package/bin/chunk-xjw3mpvx.js +0 -1
- package/bin/chunk-xsfy8hz3.js +0 -2
- package/bin/chunk-xznq2axj.js +0 -1
- package/bin/chunk-y4v08wq7.js +0 -1
- package/bin/chunk-yncvy335.js +0 -3
- package/bin/chunk-ytzddcj2.js +0 -1
- package/bin/chunk-zxqasmvz.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{w,L,W,a,g,K,Be,Ue,F,Nn,Fn,Ln,Zn,$e,He,Qe,De,Ne,Fe,hd,fa,iv,av,pv,mv,hv,IA,Ve,Mi,C_,$x,Kx,Yx,PC,wS,ES,xI,CI,Cd,S1,Uh,T1,Jc,Ik,Tk,Pi,FR,jp,dg,dt,ft,pt,mt,ht,gt,At,_t,Se,xe,ke,Ce,re,j}from"./chunk-5ngftxjb.js";import{jo}from"./chunk-88jg9dq5.js";import{Br}from"./chunk-7kah3zb5.js";L();function wu({open:P,onOpenChange:G,title:V,members:_,isOwner:r,onInvite:u,onUpdateRole:D,onRemoveMember:y,currentUserId:H,availableMembersToAdd:M,onAddMember:d,type:s="team"}){let[v,C]=w("editor"),[c,b]=w(null),[A,T]=w(!1),[x,m]=w(null),[n,f]=w(null),[R,I]=w({}),[i,l]=w(null),p=(e)=>{if(!e)return"";switch(e.toLowerCase()){case"owner":return Cd();case"editor":return Mi();case"reviewer":return Pi();default:return e}},k=(e,t)=>{I((o)=>({...o,[e]:t}))},U=async(e,t)=>{if(!D)return;m(e);try{await D(e,t),j.success(CI())}catch(o){console.error(o),j.error(Yx())}finally{m(null)}},S=async()=>{if(!y||!n?.id)return;m(n.id);try{await y(n.id),j.success(xI()),f(null)}catch(e){console.error(e),j.error(Kx())}finally{m(null)}},q=async()=>{if(!u)return;T(!0);try{let e=await u(v),t=`${window.location.origin}/signup?inviteCode=${e}`;b(t)}catch(e){console.error(e),j.error($x())}finally{T(!1)}},E=async()=>{if(c){if(await jo(c))j.success(wS())}},h=(e)=>{if(!e)return"??";return e.split(" ").map((t)=>t[0]).slice(0,2).join("").toUpperCase()},J=(e)=>{if(!e)b(null),C("editor"),I({}),l(null);G(e)},N=Array.isArray(_)?_:[],O=Array.isArray(M)?M:[],Q=s==="project"&&r?N.filter((e)=>e.role==="owner"||e.scope==="project"||e.hasCustomRole):N,z=s==="project"&&r?N.filter((e)=>e.scope==="team"&&e.role!=="owner"&&!e.hasCustomRole):[],B=s==="project"&&r?O.filter((e)=>e.scope==="project"):[];return a(Se,{open:P,onOpenChange:J,children:g(xe,{className:"sm:max-w-xl",onOpenAutoFocus:(e)=>e.preventDefault(),children:[a(ke,{children:a(Ce,{children:V})}),g("div",{className:"space-y-4",children:[a("div",{className:"max-h-[300px] overflow-y-auto space-y-2",children:Q.map((e)=>{let t=s==="team"&&e.scope==="project";return g("div",{className:"flex items-center justify-between p-2 rounded-lg hover:bg-muted/50",children:[g("div",{className:"flex items-center gap-3",children:[g($e,{children:[e.image&&a(He,{src:e.image,alt:e.name,className:"object-cover"}),a(Qe,{children:h(e.name)})]}),g("div",{className:"flex flex-col",children:[a("span",{className:"text-sm font-medium",children:e.name}),g("div",{className:"flex items-center gap-2",children:[!t&&a("span",{className:"text-xs text-muted-foreground capitalize",children:p(e.role)}),e.scope&&g(W,{children:[!t&&a("span",{className:"text-[10px] text-muted-foreground/70",children:"•"}),a("span",{className:"text-xs text-muted-foreground capitalize",children:e.scope==="team"?dg():Uh()})]})]})]})]}),r&&e.role!=="owner"&&e.id!==H&&g("div",{className:"flex items-center gap-2",children:[t?a(Nn,{children:g(Fn,{children:[a(Ln,{asChild:!0,children:a("span",{children:a(F,{variant:"outline",size:"sm",className:"h-8 px-2 text-xs capitalize w-26 justify-between",disabled:!0,children:a(Be,{className:"ml-auto h-3 w-3 opacity-50"})})})}),a(Zn,{side:"top",children:a("p",{className:"text-xs",children:T1()})})]})}):g(De,{children:[a(Ne,{asChild:!0,children:g(F,{variant:"outline",size:"sm",className:"h-8 px-2 text-xs capitalize w-26",disabled:x===e.id,children:[p(e.role),a(Be,{className:"ml-1 h-3 w-3 opacity-50"})]})}),a(Fe,{children:g(hd,{value:e.role,onValueChange:(o)=>U(e.id,o),children:[a(fa,{value:"editor",className:"text-xs",children:Mi()}),a(fa,{value:"reviewer",className:"text-xs",children:Pi()})]})})]}),a(F,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>f(e),disabled:x===e.id,children:x===e.id?a(K,{className:"h-3 w-3 animate-spin"}):a(Ue,{className:"h-3 w-3"})})]})]},e.id)})}),a(dt,{open:!!n,onOpenChange:(e)=>!e&&f(null),children:g(ft,{children:[g(pt,{children:[a(ht,{children:Ik()}),a(gt,{children:Tk({name:n?.name||"",type:s==="project"?S1():jp()})})]}),g(mt,{children:[a(_t,{children:Ve()}),a(At,{onClick:S,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Jc()})]})]})})," ",r&&d&&z.length>0&&g("div",{className:"border-t pt-4",children:[a("h4",{className:"text-sm font-medium mb-1",children:pv()}),a("p",{className:"text-xs text-muted-foreground mb-3 font-normal",children:mv()}),a("div",{className:"max-h-[200px] overflow-y-auto space-y-2 pr-1",children:z.map((e)=>{let t=R[e.id]||"editor";return g("div",{className:"flex items-center justify-between p-2 rounded-lg hover:bg-muted/50",children:[g("div",{className:"flex items-center gap-3",children:[g($e,{children:[e.image&&a(He,{src:e.image,alt:e.name,className:"object-cover"}),a(Qe,{children:h(e.name)})]}),g("div",{className:"flex flex-col",children:[a("span",{className:"text-sm font-medium",children:e.name}),a("span",{className:"text-xs text-muted-foreground capitalize",children:e.scope==="team"?dg():Uh()})]})]}),g("div",{className:"flex items-center gap-2",children:[g(De,{children:[a(Ne,{asChild:!0,children:g(F,{variant:"outline",size:"sm",className:"h-8 px-2 text-xs capitalize w-26",disabled:i===e.id,children:[p(t),a(Be,{className:"ml-1 h-3 w-3 opacity-50"})]})}),a(Fe,{children:g(hd,{value:t,onValueChange:(o)=>k(e.id,o),children:[a(fa,{value:"editor",className:"text-xs",children:Mi()}),a(fa,{value:"reviewer",className:"text-xs",children:Pi()})]})})]}),a(F,{onClick:async()=>{l(e.id);try{await d(e.id,t),j.success(IA({name:e.name||""}))}catch(o){console.error(o),j.error(C_({name:e.name||""}))}finally{l(null)}},disabled:i!==null,size:"sm",className:"h-8 text-xs px-3",children:i===e.id?a(K,{className:"h-3 w-3 animate-spin"}):FR()})]})]},e.id)})})]}),r&&d&&B.length>0&&g("div",{className:"border-t pt-4",children:[a("h4",{className:"text-sm font-medium mb-1",children:iv()}),a("p",{className:"text-xs text-muted-foreground mb-3 font-normal",children:av()}),a("div",{className:"max-h-[200px] overflow-y-auto space-y-2 pr-1",children:B.map((e)=>{let t=R[e.id]||"editor";return g("div",{className:"flex items-center justify-between p-2 rounded-lg hover:bg-muted/50",children:[g("div",{className:"flex items-center gap-3",children:[g($e,{children:[e.image&&a(He,{src:e.image,alt:e.name,className:"object-cover"}),a(Qe,{children:h(e.name)})]}),g("div",{className:"flex flex-col",children:[a("span",{className:"text-sm font-medium",children:e.name}),a("span",{className:"text-xs text-muted-foreground capitalize",children:e.scope==="team"?dg():Uh()})]})]}),g("div",{className:"flex items-center gap-2",children:[g(De,{children:[a(Ne,{asChild:!0,children:g(F,{variant:"outline",size:"sm",className:"h-8 px-2 text-xs capitalize w-26",disabled:i===e.id,children:[p(t),a(Be,{className:"ml-1 h-3 w-3 opacity-50"})]})}),a(Fe,{children:g(hd,{value:t,onValueChange:(o)=>k(e.id,o),children:[a(fa,{value:"editor",className:"text-xs",children:Mi()}),a(fa,{value:"reviewer",className:"text-xs",children:Pi()})]})})]}),a(F,{onClick:async()=>{l(e.id);try{await d(e.id,t),j.success(IA({name:e.name||""}))}catch(o){console.error(o),j.error(C_({name:e.name||""}))}finally{l(null)}},disabled:i!==null,size:"sm",className:"h-8 text-xs px-3",children:i===e.id?a(K,{className:"h-3 w-3 animate-spin"}):hv()})]})]},e.id)})})]}),r&&u&&g("div",{className:"border-t pt-4",children:[a("h4",{className:"text-sm font-medium mb-3",children:ES()}),g("div",{className:"space-y-3",children:[g("div",{className:"flex gap-2",children:[g(De,{children:[a(Ne,{asChild:!0,children:g(F,{variant:"outline",className:"w-[120px] justify-between",children:[v==="editor"?Mi():Pi(),a(Be,{className:"h-4 w-4 opacity-50"})]})}),a(Fe,{children:g(hd,{value:v,onValueChange:(e)=>C(e),children:[a(fa,{value:"editor",children:Mi()}),a(fa,{value:"reviewer",children:Pi()})]})})]}),g(F,{onClick:q,disabled:A,className:"flex-1",children:[A&&a(K,{className:"mr-2 h-4 w-4 animate-spin"}),PC()]})]}),c&&g("div",{className:"flex gap-2",children:[a(re,{value:c,readOnly:!0}),a(F,{variant:"outline",size:"icon",onClick:E,children:a(Br,{className:"h-4 w-4"})})]})]})]})]})]})})}
|
|
2
|
+
export{wu};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{z}from"./chunk-5ngftxjb.js";var a=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],$n=z("sparkles",a);
|
|
2
|
+
export{$n};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{S,Q,w,L,W,a,g,ie,X,ee,Tt,Je,R,z,_r,K,rn,$t,yo,On,jt,Ol,xr,Ri,Xo,Re,es,Ue,Ge,B,F,$e,He,Qe,De,Ne,Fe,de,GA,XA,Ve,Cw,Ow,yd,lE,cE,eh,Mt,NE,FE,QE,GE,fp,sx,__,lo,FC,LC,ZC,BC,UC,zC,jC,yp,PS,jI,c0,dT,ET,E0,Q0,Di,Zp,tg,Bp,gy,ug,MM,OM,_y,yy,by,Ey,xy,zp,Sy,UM,ni,dt,ft,pt,mt,ht,gt,At,_t,Se,xe,ke,ot,Ce,Ot,re,Ie,Os,an,Xn,Eo,si,ln,Hp,Vt,j,ze,Nr,yt,hn,ha,Hy,Zo,Eg,nl,ol,Aa,fe,Ke,Xe,et,tt,rt,be,_a,Jp,Yp,Xp,tm}from"./chunk-5ngftxjb.js";import{Jl}from"./chunk-a859y4e1.js";import{Uo}from"./chunk-etrm28sy.js";import{qn}from"./chunk-pdw77q09.js";import{$n}from"./chunk-25npafhz.js";L();var Oe=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],me=z("pen",Oe);function ue({scope:e,onScopeChange:r,selectedGoal:b,onClearGoal:m,onCreateTask:k,canCreateTask:x=!0}){return g("header",{className:"h-14 border-b border-border bg-card/60 backdrop-blur-sm px-4 flex items-center justify-between gap-3 shrink-0 select-none",children:[g("div",{className:"flex items-center gap-3 min-w-0",children:[g("div",{className:"flex items-center bg-muted/60 p-0.5 rounded-lg border border-border/50",children:[g(F,{variant:e==="team"?"secondary":"ghost",size:"sm",onClick:()=>r("team"),className:`h-7 px-2.5 text-xs font-medium gap-1.5 transition-all ${e==="team"?"bg-background text-foreground shadow-xs":"text-muted-foreground hover:text-foreground"}`,children:[a(Uo,{className:"w-3.5 h-3.5"}),a("span",{children:UM()})]}),g(F,{variant:e==="my"?"secondary":"ghost",size:"sm",onClick:()=>r("my"),className:`h-7 px-2.5 text-xs font-medium gap-1.5 transition-all ${e==="my"?"bg-background text-foreground shadow-xs":"text-muted-foreground hover:text-foreground"}`,children:[a(qn,{className:"w-3.5 h-3.5"}),a("span",{children:jI()})]})]}),b&&g("div",{className:"hidden sm:flex items-center gap-1.5 px-2 py-1 rounded-md bg-sidebar-accent border border-sidebar-border text-xs text-sidebar-accent-foreground min-w-0 max-w-[200px] md:max-w-[280px]",children:[a(es,{className:"w-3.5 h-3.5 text-sidebar-primary shrink-0"}),a("span",{className:"truncate font-medium",children:b.id===ha?ni():b.title}),a(F,{variant:"ghost",size:"icon-xs",onClick:m,className:"h-4 w-4 p-0 ml-0.5 text-muted-foreground hover:text-foreground",title:Ow(),children:a(Ge,{className:"w-3 h-3"})})]})]}),x&&a("div",{className:"flex items-center gap-2 shrink-0",children:g(F,{size:"sm",onClick:k,className:"h-8 px-3 text-xs gap-1.5 shadow-xs",children:[a(Re,{className:"w-3.5 h-3.5"}),a("span",{children:eh()})]})})]})}L();L();function se({teamId:e,isOpen:r,onClose:b,goalToEdit:m}){let k=ie(),[x,C]=w(""),[p,D]=w("");S(()=>{if(m)C(m.title),D(m.description||"");else C(""),D("")},[m,r]);let{mutate:I,isPending:A}=ee({mutationFn:async()=>{let n=await R.api.teams[":teamId"].kanban.goals.$post({param:{teamId:e},json:{title:x.trim(),description:p.trim()||void 0}});if(!n.ok){let f=await n.json().catch(()=>({message:lo()}));throw Error(f.message||lo())}return await n.json()},onSuccess:()=>{k.invalidateQueries({queryKey:["teams",e,"kanban","goals"]}),j.success(FC()),b()},onError:(n)=>{j.error(n.message)}}),{mutate:P,isPending:T}=ee({mutationFn:async()=>{if(!m)return;let n=await R.api.teams[":teamId"].kanban.goals[":goalId"].$patch({param:{teamId:e,goalId:m.id},json:{title:x.trim(),description:p.trim()||null}});if(!n.ok){let f=await n.json().catch(()=>({message:lo()}));throw Error(f.message||lo())}return await n.json()},onSuccess:()=>{k.invalidateQueries({queryKey:["teams",e,"kanban","goals"]}),j.success(jC()),b()},onError:(n)=>{j.error(n.message)}}),M=(n)=>{if(n.preventDefault(),!x.trim())return;if(m)P();else I()},l=A||T;return a(Se,{open:r,onOpenChange:(n)=>!n&&b(),children:a(xe,{className:"sm:max-w-xl",children:g("form",{onSubmit:M,className:"space-y-4",children:[g(ke,{children:[a(Ce,{children:m?__():cE()}),a(Ot,{children:m?__():lE()})]}),g("div",{className:"space-y-3 py-2",children:[g("div",{className:"space-y-1.5",children:[a(fe,{htmlFor:"goal-title",children:UC()}),a(re,{id:"goal-title",value:x,onChange:(n)=>C(n.target.value),placeholder:zC(),required:!0,autoFocus:!0})]}),g("div",{className:"space-y-1.5",children:[a(fe,{htmlFor:"goal-description",children:ZC()}),a(Aa,{id:"goal-description",value:p,onChange:(n)=>D(n.target.value),placeholder:BC(),rows:3})]})]}),g(ot,{children:[a(F,{type:"button",variant:"outline",onClick:b,disabled:l,children:Ve()}),g(F,{type:"submit",disabled:!x.trim()||l,children:[l&&a(K,{className:"w-4 h-4 mr-1.5 animate-spin"}),m?Di():yd()]})]})]})})})}function pe({teamId:e,selectedGoalId:r,onSelectGoal:b,isOwnerOrEditor:m=!0}){let k=ie(),[x,C]=w(!1),[p,D]=w(null),[I,A]=w(null),[P,T]=w(!1),{data:M,isLoading:l}=X({queryKey:["teams",e,"kanban","goals"],queryFn:async()=>{let o=await R.api.teams[":teamId"].kanban.goals.$get({param:{teamId:e},query:{}});if(!o.ok)throw Error("Failed to fetch goals");return await o.json()},enabled:!!e}),n=M?.data||[],f=n.reduce((o,s)=>o+(s.taskCount||0),0),{mutate:y,isPending:i}=ee({mutationFn:async(o)=>{let s=await R.api.teams[":teamId"].kanban.goals[":goalId"].$delete({param:{teamId:e,goalId:o}});if(!s.ok){let c=await s.json().catch(()=>({message:lo()}));throw Error(c.message||lo())}return await s.json()},onSuccess:(o,s)=>{if(k.invalidateQueries({queryKey:["teams",e,"kanban","goals"]}),k.invalidateQueries({queryKey:["teams",e,"kanban","tasks"]}),j.success(LC()),r===s)b(null);A(null)},onError:(o)=>{j.error(o.message)}});if(P)return g("div",{className:"border-r border-sidebar-border bg-sidebar flex flex-col items-center w-12 shrink-0 transition-all duration-300",children:[a("div",{className:"h-14 flex items-center justify-center border-b border-sidebar-border w-full shrink-0",children:a(F,{variant:"ghost",size:"icon-sm",onClick:()=>T(!1),title:yp(),className:"text-sidebar-foreground/70 hover:text-sidebar-foreground",children:a(jt,{className:"w-4 h-4"})})}),g("div",{className:"mt-3 flex flex-col items-center gap-2",children:[a(F,{variant:r===null?"secondary":"ghost",size:"icon-sm",onClick:()=>b(null),title:GA(),className:B("w-8 h-8 rounded-md",r===null&&"bg-sidebar-accent text-sidebar-accent-foreground"),children:a(Jl,{className:"w-4 h-4"})}),a(F,{variant:"ghost",size:"icon-sm",onClick:()=>C(!0),title:c0(),className:"w-8 h-8 rounded-md text-sidebar-foreground/70 hover:text-sidebar-foreground",children:a(Re,{className:"w-4 h-4"})})]}),x&&a(se,{teamId:e,isOpen:x,onClose:()=>C(!1)})]});return g("aside",{className:"w-64 border-r border-sidebar-border bg-sidebar flex flex-col shrink-0 transition-all duration-300 select-none",children:[g("div",{className:"h-14 px-3 flex items-center justify-between border-b border-sidebar-border shrink-0",children:[g("div",{className:"flex items-center gap-2 font-semibold text-xs tracking-wider uppercase text-sidebar-foreground/70",children:[a(es,{className:"w-4 h-4 text-sidebar-primary"}),a("span",{children:yp()})]}),g("div",{className:"flex items-center gap-1",children:[m&&a(F,{variant:"ghost",size:"icon-sm",onClick:()=>C(!0),className:"h-7 w-7 text-sidebar-foreground/70 hover:text-sidebar-foreground",title:c0(),children:a(Re,{className:"w-4 h-4"})}),a(F,{variant:"ghost",size:"icon-sm",onClick:()=>T(!0),className:"h-7 w-7 text-sidebar-foreground/70 hover:text-sidebar-foreground",title:"Collapse",children:a(On,{className:"w-4 h-4"})})]})]}),a(Ie,{className:"flex-1 p-2",children:g("div",{className:"space-y-1",children:[g("div",{onClick:()=>b(null),className:B("flex items-center justify-between px-2.5 py-1 rounded-md text-xs font-medium cursor-pointer transition-colors group h-8 min-h-[32px]",r===null?"bg-sidebar-accent text-sidebar-accent-foreground font-semibold shadow-xs":"text-sidebar-foreground/70 hover:bg-sidebar-accent/50 hover:text-sidebar-foreground"),children:[g("div",{className:"flex items-center gap-2 truncate min-w-0",children:[a(Jl,{className:"w-3.5 h-3.5 shrink-0 text-sidebar-primary"}),a("span",{className:"truncate",children:GA()})]}),f>0&&a("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded-full bg-sidebar-border text-sidebar-foreground/60 shrink-0",children:f})]}),l?a("div",{className:"flex items-center justify-center p-4",children:a(K,{className:"w-4 h-4 animate-spin text-muted-foreground"})}):n.length===0?a("div",{className:"px-2.5 py-4 text-center text-xs text-muted-foreground",children:dT()}):n.map((o)=>{let s=r===o.id,c=o.id===ha,v=c?ni():o.title,u=m&&!c;return g("div",{onClick:()=>b(o.id),className:B("flex items-center justify-between px-2.5 py-1 rounded-md text-xs font-medium cursor-pointer transition-colors group relative min-h-[32px]",s?"bg-sidebar-accent text-sidebar-accent-foreground font-semibold shadow-xs":"text-sidebar-foreground/70 hover:bg-sidebar-accent/50 hover:text-sidebar-foreground"),children:[g("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[a(es,{className:B("w-3.5 h-3.5 shrink-0",s?"text-sidebar-primary":"text-muted-foreground")}),a("span",{className:"line-clamp-2 break-words leading-tight",title:v,children:v})]}),a("div",{className:"flex items-center shrink-0 ml-1",children:u?g(W,{children:[(o.taskCount??0)>0&&a("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded-full bg-sidebar-border text-sidebar-foreground/60 group-hover:hidden group-focus-within:hidden [&:has(~_div_[data-state=open])]:hidden",children:o.taskCount}),a("div",{className:"hidden group-hover:flex group-focus-within:flex [&:has([data-state=open])]:flex items-center",onClick:(d)=>d.stopPropagation(),children:g(De,{modal:!1,children:[a(Ne,{asChild:!0,children:a(F,{variant:"ghost",size:"icon-xs",className:"h-6 w-6 p-0 text-muted-foreground hover:text-foreground",children:a(_r,{className:"w-3.5 h-3.5"})})}),g(Fe,{align:"end",className:"w-36",children:[g(de,{onClick:()=>{D(o)},children:[a(me,{className:"w-3.5 h-3.5 mr-2"}),sx()]}),g(de,{className:"text-destructive focus:text-destructive focus:bg-destructive/10",onClick:()=>{A(o)},children:[a(Ue,{className:"w-3.5 h-3.5 mr-2"}),Mt()]})]})]})})]}):(o.taskCount??0)>0&&a("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded-full bg-sidebar-border text-sidebar-foreground/60",children:o.taskCount})})]},o.id)})]})}),(x||p)&&a(se,{teamId:e,isOpen:x||!!p,goalToEdit:p,onClose:()=>{C(!1),D(null)}}),I&&a(dt,{open:!!I,onOpenChange:(o)=>!o&&A(null),children:g(ft,{children:[g(pt,{children:[a(ht,{children:NE()}),a(gt,{children:FE({title:I.title})})]}),g(mt,{children:[a(_t,{disabled:i,children:Ve()}),g(At,{onClick:()=>y(I.id),disabled:i,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[i&&a(K,{className:"w-4 h-4 mr-1.5 animate-spin"}),Mt()]})]})]})})]})}L();L();function ge(e){return+ze(e)<Date.now()}function ve({task:e,onClick:r,onDelete:b,disabled:m,isFirst:k,isLast:x,showBottomIndicator:C,currentUserId:p,currentUserRole:D}){let{source:I}=Hp(),A=!!I,P=D?.toLowerCase()==="owner",T=D?.toLowerCase()==="editor",M=!!p&&e.creator?.id===p,l=e.reporter?.id===p||M,n=e.assignee?.id===p,f=P||T||l||n,y=M||P||l,i=m||!f,{ref:o,isDragging:s}=si({id:e.id,data:{type:"kanban_task",task:e},disabled:i}),{ref:c,isDropTarget:v}=ln({id:`reorder-before-${e.id}`,data:{type:"reorder",task:e,position:"before"},disabled:s||m}),{ref:u,isDropTarget:d}=ln({id:`reorder-after-${e.id}`,data:{type:"reorder",task:e,position:"after"},disabled:s||m}),N=e.isAgentTask,_=e.status===yt.BLOCKED,h=e.dueDate?ge(new Date(e.dueDate))&&e.status!==yt.DONE:!1;return g("div",{className:"relative",children:[a("div",{ref:c,className:B("absolute left-0 right-0 z-20",k?"-top-6 h-[calc(50%+24px)]":"-top-1 h-[calc(50%+4px)]",A&&!s?"pointer-events-auto":"pointer-events-none")}),a("div",{ref:u,className:B("absolute bottom-0 left-0 right-0 z-20",x?"-bottom-6 h-[calc(50%+24px)]":"h-1/2",A&&!s?"pointer-events-auto":"pointer-events-none")}),v&&!s&&a("div",{className:"absolute -top-1.5 left-0 right-0 h-[3px] rounded-full bg-primary shadow-[0_0_8px_rgba(var(--primary),0.6)] z-30 pointer-events-none"}),(d||C)&&!s&&a("div",{className:"absolute -bottom-1.5 left-0 right-0 h-[3px] rounded-full bg-primary shadow-[0_0_8px_rgba(var(--primary),0.6)] z-30 pointer-events-none"}),g("div",{ref:o,onClick:()=>r(e),className:B("group relative flex flex-col gap-2 p-3 rounded-lg border text-card-foreground transition-all duration-200 cursor-pointer select-none",s&&"opacity-40 scale-95 shadow-lg ring-2 ring-primary",!s&&"hover:shadow-md","border-border/80 bg-card hover:border-primary/50 shadow-2xs",_&&"border-red-500/60 bg-red-500/[0.03] ring-1 ring-red-500/20"),children:[g("div",{className:"flex items-center justify-between gap-1.5 min-w-0",children:[g("div",{className:"flex items-center gap-1.5 min-w-0 flex-1",children:[a("span",{className:B("px-1.5 py-0.5 rounded text-[10px] font-medium border uppercase tracking-wider shrink-0",ol(e.priority)),children:nl(e.priority)}),N&&g("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-semibold bg-orange-500/15 text-orange-600 dark:text-orange-400 border border-orange-500/30 shrink-0",children:[a($t,{className:"w-3 h-3"}),a("span",{children:zp()})]}),e.goal&&g("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-muted text-muted-foreground border border-border/70 truncate max-w-[130px]",children:[a(es,{className:"w-2.5 h-2.5 shrink-0"}),a("span",{className:"truncate",children:e.goal.title})]})]}),a("div",{className:"flex items-center gap-1 shrink-0",children:y&&a("div",{className:"opacity-0 group-hover:opacity-100 [&:has([data-state=open])]:opacity-100 focus-within:opacity-100 transition-opacity flex items-center",onClick:(q)=>q.stopPropagation(),children:g(De,{modal:!1,children:[a(Ne,{asChild:!0,children:a(F,{variant:"ghost",size:"icon-xs",className:"h-5 w-5 p-0 text-muted-foreground hover:text-foreground",children:a(_r,{className:"w-3.5 h-3.5"})})}),a(Fe,{align:"end",className:"w-32",children:g(de,{className:"text-destructive focus:text-destructive focus:bg-destructive/10",onClick:()=>b?.(e),children:[a(Ue,{className:"w-3.5 h-3.5 mr-2"}),Mt()]})})]})})})]}),a("h4",{className:"text-xs font-semibold leading-snug line-clamp-2 text-foreground break-words",children:e.title}),_&&g("div",{className:"flex items-start gap-1.5 p-1.5 rounded bg-red-500/10 border border-red-500/20 text-[11px] text-red-600 dark:text-red-400",children:[a(rn,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),a("span",{className:"line-clamp-2 break-words",children:e.latestStatusEvent?.blockReason||e.latestStatusEvent?.reason||e.latestStatusEvent?.summary||gy()})]}),e.status===yt.IN_REVIEW&&e.latestStatusEvent?.summary&&g("div",{className:"flex items-start gap-1.5 p-1.5 rounded bg-purple-500/10 border border-purple-500/20 text-[11px] text-purple-600 dark:text-purple-400",children:[a($n,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),a("span",{className:"line-clamp-2 break-words",children:e.latestStatusEvent.summary})]}),g("div",{className:"flex items-center justify-between gap-2 pt-1 mt-auto border-t border-border/40 text-[11px] text-muted-foreground",children:[a("div",{className:"flex items-center gap-1.5 min-w-0",children:e.assignee?g(W,{children:[N?a("div",{className:"w-5 h-5 rounded-full bg-orange-500/15 border border-orange-500/30 flex items-center justify-center shrink-0",children:a($t,{className:"w-3 h-3 text-orange-600 dark:text-orange-400"})}):g($e,{size:"sm",className:"w-5 h-5 border border-border",children:[a(He,{src:e.assignee.image}),a(Qe,{className:"text-[9px]",children:e.assignee.name.slice(0,2).toUpperCase()})]}),a("span",{className:"truncate text-xs font-medium text-foreground/80 max-w-[90px]",children:e.assignee.name})]}):a("span",{className:"text-[11px] italic text-muted-foreground/60",children:ni()})}),g("div",{className:"flex items-center gap-2 shrink-0",children:[e.dueDate&&g("div",{className:B("flex items-center gap-1 text-[10px] font-mono",h?"text-red-500 font-semibold":"text-muted-foreground"),title:Nr(new Date(e.dueDate),"yyyy/MM/dd HH:mm"),children:[a(yo,{className:"w-3 h-3"}),a("span",{children:Nr(new Date(e.dueDate),"MM/dd")})]}),e.assetCount>0&&g("div",{className:"flex items-center gap-0.5 text-[10px] text-muted-foreground hover:text-foreground",title:PS({count:e.assetCount}),children:[a(Ol,{className:"w-3 h-3"}),a("span",{children:e.assetCount})]}),e.dependencyCount>0&&g("div",{className:"flex items-center gap-0.5 text-[10px] text-muted-foreground hover:text-foreground",title:`${e.dependencyCount} dependencies`,children:[a(Ri,{className:"w-3 h-3"}),a("span",{children:e.dependencyCount})]}),e.commentCount>0&&g("div",{className:"flex items-center gap-0.5 text-[10px] text-muted-foreground hover:text-foreground",title:`${e.commentCount} comments`,children:[a(Xo,{className:"w-3 h-3"}),a("span",{children:e.commentCount})]})]})]})]})]})}function he({teamId:e,status:r,selectedGoalId:b,scope:m,currentUserId:k,currentUserRole:x,onTaskClick:C,onDeleteTask:p,onCreateTaskInColumn:D}){let I=x?.toLowerCase()==="owner"||x?.toLowerCase()==="editor",A=m==="my"?k:void 0,{data:P,fetchNextPage:T,hasNextPage:M,isFetchingNextPage:l,isLoading:n}=Tt({queryKey:["teams",e,"kanban","tasks",{status:r,goalId:b,assigneeId:A}],queryFn:async({pageParam:E=""})=>{let G=await R.api.teams[":teamId"].kanban.tasks.$get({param:{teamId:e},query:{status:r,goalId:b||void 0,assigneeId:A||void 0,first:"20",after:E||void 0}});if(!G.ok)throw Error("Failed to fetch column tasks");return await G.json()},initialPageParam:"",getNextPageParam:(E)=>E.pageInfo?.cursor||void 0,refetchInterval:5000,enabled:!!e}),{ref:f,inView:y}=Vt({threshold:0.1});S(()=>{if(y&&M&&!l)T()},[y,M,l,T]);let i=Q(()=>P?.pages?.flatMap((E)=>Array.isArray(E?.data)?E.data:[])||[],[P]),{source:o,target:s}=Hp(),c=i.filter((E)=>E.id!==o?.id).at(-1),{ref:v,isDropTarget:u}=ln({id:r,data:{type:"kanban_column",status:r,lastTask:c}}),d=o?.data?.type==="kanban_task",N=d&&(u||s?.data?.type==="kanban_column"&&s.data.status===r||s?.data?.type==="reorder"&&s.data.task?.status===r),_=d&&s?.data?.type==="kanban_column"&&s.data.status===r,h=P?.pages?.[0]?.pageInfo?.total??i.length,q=Eg(r);return g("div",{ref:v,className:B("flex flex-col h-full max-h-full w-80 md:w-84 shrink-0 rounded-xl bg-card/60 border border-border/70 shadow-xs transition-colors duration-200 overflow-hidden select-none",N&&"ring-2 ring-primary/60 bg-primary/[0.03] border-primary/40"),children:[g("div",{className:"h-11 px-3.5 flex items-center justify-between border-b border-border/60 bg-card/80 shrink-0",children:[g("div",{className:"flex items-center gap-2 min-w-0",children:[a("div",{className:B("w-2.5 h-2.5 rounded-full shrink-0",q.dot)}),a("h3",{className:"text-xs font-bold tracking-wide uppercase text-foreground/90 truncate",children:Zo(r)})]}),a("div",{className:"flex items-center gap-1 shrink-0",children:a("span",{className:"text-[11px] font-mono px-2 py-0.5 rounded-full bg-muted font-medium text-muted-foreground",children:h})})]}),a(Ie,{className:"flex-1 min-h-0 [&>div>div]:block!",children:g("div",{className:"p-2.5 space-y-2.5 min-h-full flex flex-col",children:[n?a("div",{className:"flex items-center justify-center py-10",children:a(K,{className:"w-5 h-5 animate-spin text-muted-foreground"})}):i.length===0?a("div",{className:"flex flex-col items-center justify-center py-10 px-4 text-center",children:a("p",{className:"text-xs text-muted-foreground/70",children:ET()})}):i.map((E,G)=>a(ve,{task:E,onClick:C,onDelete:p,isFirst:G===0,isLast:G===i.length-1,showBottomIndicator:_&&E.id===c?.id,currentUserId:k,currentUserRole:x},E.id)),a("div",{ref:f,className:"h-2"}),l&&a("div",{className:"flex justify-center py-2",children:a(K,{className:"w-4 h-4 animate-spin text-muted-foreground"})})]})}),I&&a("div",{className:"p-2 border-t border-border/50 bg-card/90 shrink-0",children:g(F,{variant:"ghost",size:"sm",onClick:()=>D(r),className:"w-full justify-center h-8 text-xs font-medium text-muted-foreground hover:text-foreground hover:bg-muted/80 border border-dashed border-border/80",children:[a(Re,{className:"w-3.5 h-3.5 mr-1.5"}),a("span",{children:eh()})]})})]})}function ye({teamId:e,selectedGoalId:r,scope:b,currentUserId:m,currentUserRole:k,onTaskClick:x,onCreateTaskInColumn:C}){let p=ie(),[D,I]=w(null),{mutate:A,isPending:P}=ee({mutationFn:async(l)=>{let n=await R.api.teams[":teamId"].kanban.tasks[":taskId"].$delete({param:{teamId:e,taskId:l}});if(!n.ok){let f=await n.json().catch(()=>({message:lo()}));throw Error(f.message||lo())}return await n.json()},onSuccess:()=>{p.invalidateQueries({queryKey:["teams",e,"kanban","tasks"]}),p.invalidateQueries({queryKey:["teams",e,"kanban","goals"]}),j.success(OM()),I(null)},onError:(l)=>{j.error(l.message)}}),{mutate:T}=ee({mutationFn:async({taskId:l,fromStatus:n,status:f,reason:y,beforeIndex:i,afterIndex:o})=>{let s=await R.api.teams[":teamId"].kanban.tasks[":taskId"].$patch({param:{teamId:e,taskId:l},json:{fromStatus:n,status:f,reason:y,beforeIndex:i,afterIndex:o}});if(!s.ok){let c=await s.json().catch(()=>({message:lo()}));throw Error(c.message||lo())}return await s.json()},onMutate:async({taskId:l,status:n,targetTaskId:f,position:y})=>{await p.cancelQueries({queryKey:["teams",e,"kanban","tasks"]});let i=p.getQueriesData({queryKey:["teams",e,"kanban","tasks"]}),o=null,s=(c)=>c[0]==="teams"&&c[1]===e&&c[2]==="kanban"&&c[3]==="tasks"&&typeof c[4]==="object"&&c[4]!==null&&("status"in c[4]);if(p.setQueriesData({predicate:(c)=>s(c.queryKey)},(c)=>{if(!c||!Array.isArray(c.pages))return c;let v=!1,u=c.pages.map((d)=>{if(!d||!Array.isArray(d.data))return d;let N=d.data.find((_)=>_.id===l);if(N)return o={...N,status:n},v=!0,{...d,data:d.data.filter((_)=>_.id!==l),pageInfo:{...d.pageInfo,total:Math.max(0,(d.pageInfo?.total??d.data.length)-1)}};return d});return v?{...c,pages:u}:c}),o){let c=o;p.setQueriesData({predicate:(v)=>{if(!s(v.queryKey))return!1;return v.queryKey[4]?.status===n}},(v)=>{if(!v||!Array.isArray(v.pages))return v;let u=v.pages.flatMap((h)=>h?.data??[]).filter((h)=>h.id!==l),d=u.length;if(f){let h=u.findIndex((q)=>q.id===f);if(h!==-1)d=y==="before"?h:h+1}u.splice(d,0,c);let N=0,_=v.pages.map((h,q)=>{let E=h?.data?h.data.length:0,G=q===0&&E===0?1:q===v.pages.length-1?u.length-N:E,V=u.slice(N,N+G);return N+=G,{...h,data:V,pageInfo:{...h?.pageInfo,total:(h?.pageInfo?.total??0)+1}}});if(N<u.length&&_.length>0){let h=_.length-1;_[h]={..._[h],data:[..._[h]?.data??[],...u.slice(N)]}}return{...v,pages:_}})}return{previousQueries:i}},onError:(l,n,f)=>{if(f?.previousQueries)for(let[y,i]of f.previousQueries)p.setQueryData(y,i);j.error(l.message)},onSettled:()=>{p.invalidateQueries({queryKey:["teams",e,"kanban","tasks"]})}}),M=(l)=>{if(l.canceled)return;let{source:n,target:f}=l.operation;if(!n||!f)return;let y=n.data;if(y?.type!=="kanban_task"||!y.task)return;let i=y.task,o=k?.toLowerCase()==="owner",s=k?.toLowerCase()==="editor",c=i.reporter?.id===m||i.creator?.id===m,v=i.assignee?.id===m;if(!o&&!s&&!c&&!v){j.error(Cw());return}let u=f.data;if(!u)return;if(u.type==="reorder"&&u.task&&u.position){let d=u.task,N=d.status;if(i.id===d.id)return;let _=u.position==="before"?d.sortIndex??void 0:void 0,h=u.position==="after"?d.sortIndex??void 0:void 0;T({taskId:i.id,fromStatus:i.status,status:N,beforeIndex:_,afterIndex:h,targetTaskId:d.id,position:u.position});return}if(u.type==="kanban_column"&&u.status){let{status:d,lastTask:N}=u;if(N){if(i.id===N.id){if(i.status===d)return;T({taskId:i.id,fromStatus:i.status,status:d});return}T({taskId:i.id,fromStatus:i.status,status:d,afterIndex:N.sortIndex??void 0,targetTaskId:N.id,position:"after"});return}if(i.status===d)return;T({taskId:i.id,fromStatus:i.status,status:d})}};return g(Eo,{sensors:[Xn.configure({activationConstraints:[new an.Distance({value:8})]}),Os],onDragEnd:M,children:[a("div",{className:"flex-1 min-h-0 overflow-x-auto overflow-y-hidden p-4 bg-background/50",children:a("div",{className:"flex gap-4 h-full min-w-max pb-2",children:Hy.map((l)=>a(he,{teamId:e,status:l,selectedGoalId:r,scope:b,currentUserId:m,currentUserRole:k,onTaskClick:x,onDeleteTask:(n)=>I(n),onCreateTaskInColumn:C},l))})}),D&&a(dt,{open:!!D,onOpenChange:(l)=>!l&&I(null),children:g(ft,{children:[g(pt,{children:[a(ht,{children:QE()}),a(gt,{children:GE({title:D.title})})]}),g(mt,{children:[a(_t,{disabled:P,children:Ve()}),g(At,{onClick:()=>A(D.id),disabled:P,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[P&&a(K,{className:"w-4 h-4 mr-1.5 animate-spin"}),Mt()]})]})]})})]})}L();function we({teamId:e,isOpen:r,onClose:b,initialGoalId:m}){let k=ie(),x=m===ha||!m?"none":m,[C,p]=w(""),[D,I]=w(""),[A,P]=w(!1),[T,M]=w(hn.MEDIUM),[l,n]=w(x),[f,y]=w("none"),[i,o]=w("none"),[s,c]=w(void 0),[v,u]=w(void 0),[d,N]=w(null),[_,h]=w(null),[q,E]=w(null),[G,V]=w([]),[Y,Z]=w([]),[ne,oe]=w(!1),{data:le}=X({queryKey:["teams",e,"me"],queryFn:async()=>{let t=await R.api.teams[":teamId"].me.$get({param:{teamId:e}});if(!t.ok)return null;return await t.json()},enabled:!!e&&r});S(()=>{if(r)p(""),I(""),P(!1),M(hn.MEDIUM),n(x),y("none"),o(le?.id||"none"),c(void 0),u(void 0),N(null),h(null),E(null),V([]),Z([])},[r,x,le?.id]);let{data:ce=[]}=X({queryKey:["teams",e,"members","human"],queryFn:async()=>{let t=await R.api.teams[":teamId"].members.$get({param:{teamId:e},query:{includeAgents:"false"}});if(!t.ok)return[];let O=await t.json();return Array.isArray(O)?O:[]},enabled:!!e&&r}),{data:Ae=[]}=X({queryKey:["teams",e,"agents"],queryFn:async()=>{let t=await R.api.teams[":teamId"].agents.$get({param:{teamId:e}});if(!t.ok)return[];return await t.json()||[]},enabled:!!e&&r}),{data:Pe}=X({queryKey:["teams",e,"kanban","goals"],queryFn:async()=>{let t=await R.api.teams[":teamId"].kanban.goals.$get({param:{teamId:e},query:{}});if(!t.ok)return{data:[]};return await t.json()},enabled:!!e&&r}),Le=Pe?.data||[],{mutate:Ee,isPending:J}=ee({mutationFn:async()=>{let t=await R.api.teams[":teamId"].kanban.tasks.$post({param:{teamId:e},json:{title:C.trim(),description:D.trim()||void 0,isAgentTask:A,priority:T,goalId:l!=="none"?l:void 0,assigneeId:f!=="none"?f:void 0,reporterId:i!=="none"?i:void 0,startDate:s?s.toISOString():void 0,dueDate:v?v.toISOString():void 0,projectId:d||void 0,targetFolderId:_||void 0,parentIds:G.length>0?G:void 0,assetIds:Y.length>0?Y.map((O)=>O.id):void 0}});if(!t.ok){let O=await t.text().catch(()=>""),H=lo();if(O)try{let ae=JSON.parse(O);if(ae&&typeof ae.message==="string")H=ae.message}catch{H=O}throw Error(H)}return await t.json()},onSuccess:()=>{k.invalidateQueries({queryKey:["teams",e,"kanban","tasks"]}),k.invalidateQueries({queryKey:["teams",e,"kanban","goals"]}),j.success(MM()),b()},onError:(t)=>{j.error(t.message)}}),Me=(t)=>{if(t.preventDefault(),!C.trim()||J)return;Ee()},te=A;return a(Se,{open:r,onOpenChange:(t)=>!t&&b(),children:g(xe,{className:"sm:max-w-3xl max-h-[90vh] overflow-y-auto",children:[g("form",{onSubmit:Me,className:"space-y-4",children:[a(ke,{children:a(Ce,{children:eh()})}),g("div",{className:"space-y-3.5 py-1",children:[g("div",{className:"space-y-1.5",children:[a(fe,{htmlFor:"create-task-title",children:Ey()}),a(re,{id:"create-task-title",value:C,onChange:(t)=>p(t.target.value),placeholder:xy(),required:!0,autoFocus:!0})]}),g("div",{className:"space-y-1.5",children:[a(fe,{htmlFor:"create-task-desc",children:_y()}),a(Aa,{id:"create-task-desc",value:D,onChange:(t)=>I(t.target.value),placeholder:yy(),rows:3})]}),g("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[g("div",{className:"sm:col-span-2 flex items-center justify-between space-x-2 rounded-lg border border-border/80 bg-muted/30 p-2.5 h-14",children:[g("div",{className:"space-y-0.5 min-w-0 pr-2",children:[g(fe,{htmlFor:"create-is-agent-task",className:"text-xs font-medium cursor-pointer flex items-center gap-1.5",children:[a($t,{className:"w-3.5 h-3.5 text-orange-500"}),a("span",{children:zp()})]}),a("p",{className:"text-[11px] text-muted-foreground line-clamp-1",children:Sy()})]}),a(Ke,{id:"create-is-agent-task",checked:A,onCheckedChange:(t)=>{P(t),y("none")}})]}),g("div",{className:"space-y-1.5",children:[a(fe,{className:"text-xs font-medium text-muted-foreground",children:by()}),g(Xe,{value:T,onValueChange:(t)=>M(t),children:[a(tt,{className:"w-full h-9 text-xs",children:a(et,{})}),a(rt,{children:Object.values(hn).map((t)=>a(be,{value:t,children:a("span",{className:B("px-1.5 py-0.5 rounded text-[10px] uppercase font-medium",ol(t)),children:nl(t)})},t))})]})]}),g("div",{className:"space-y-1.5",children:[a(fe,{className:"text-xs font-medium text-muted-foreground",children:yp()}),g(Xe,{value:l,onValueChange:n,children:[a(tt,{className:"w-full h-9 text-xs",children:a(et,{placeholder:"None"})}),g(rt,{children:[a(be,{value:"none",children:a("span",{className:"text-muted-foreground italic",children:"None"})}),Le.filter((t)=>t.id!==ha).map((t)=>a(be,{value:t.id,children:g("div",{className:"flex items-center gap-2",children:[a(es,{className:"w-3.5 h-3.5 text-primary"}),a("span",{children:t.title})]})},t.id))]})]})]}),g("div",{className:"space-y-1.5",children:[a(fe,{className:"text-xs font-medium text-muted-foreground",children:te?Zp():XA()}),g(Xe,{value:f,onValueChange:y,children:[a(tt,{className:"w-full h-9 text-xs",children:a(et,{placeholder:ni()})}),g(rt,{children:[a(be,{value:"none",children:a("span",{className:"text-muted-foreground italic",children:ni()})}),te?Ae.map((t)=>a(be,{value:t.id,children:g("div",{className:"flex items-center gap-2",children:[a($t,{className:"w-3.5 h-3.5 text-purple-500"}),a("span",{children:t.name})]})},t.id)):ce.map((t)=>a(be,{value:t.id,children:g("div",{className:"flex items-center gap-2",children:[g($e,{size:"sm",className:"w-4 h-4",children:[a(He,{src:t.image}),a(Qe,{className:"text-[8px]",children:t.name.slice(0,2).toUpperCase()})]}),a("span",{children:t.name})]})},t.id))]})]})]}),g("div",{className:"space-y-1.5",children:[a(fe,{className:"text-xs font-medium text-muted-foreground",children:Q0()}),g(Xe,{value:i,onValueChange:o,children:[a(tt,{className:"w-full h-9 text-xs",children:a(et,{placeholder:ni()})}),g(rt,{children:[a(be,{value:"none",children:a("span",{className:"text-muted-foreground italic",children:ni()})}),ce.map((t)=>a(be,{value:t.id,children:g("div",{className:"flex items-center gap-2",children:[g($e,{size:"sm",className:"w-4 h-4",children:[a(He,{src:t.image}),a(Qe,{className:"text-[8px]",children:t.name.slice(0,2).toUpperCase()})]}),a("span",{children:t.name})]})},t.id))]})]})]}),te&&g("div",{className:"sm:col-span-2 space-y-1.5",children:[a(fe,{className:"text-xs font-medium text-muted-foreground",children:ug()}),g(F,{type:"button",variant:"outline",size:"sm",onClick:()=>oe(!0),className:"w-full justify-start h-9 text-xs truncate font-normal",children:[a(xr,{className:"w-3.5 h-3.5 mr-2 text-primary shrink-0"}),a("span",{className:"truncate",children:q||tg()})]})]}),g("div",{className:"space-y-1.5",children:[a(fe,{className:"text-xs font-medium text-muted-foreground",children:Bp()}),a(_a,{value:s,onChange:c,placeholder:Bp(),className:"h-9 text-xs"})]}),g("div",{className:"space-y-1.5",children:[a(fe,{className:"text-xs font-medium text-muted-foreground",children:fp()}),a(_a,{value:v,onChange:u,placeholder:fp(),className:"h-9 text-xs"})]}),g("div",{className:"sm:col-span-2 space-y-1.5",children:[a(fe,{className:"text-xs font-medium text-muted-foreground",children:E0()}),a(Jp,{teamId:e,value:G,onChange:V})]}),a("div",{className:"sm:col-span-2 pt-1",children:a(Yp,{teamId:e,projectId:d,assets:Y,onAddAssets:(t)=>Z((O)=>[...O,...t]),onRemoveAsset:(t)=>Z((O)=>O.filter((H)=>H.id!==t))})})]})]}),g(ot,{children:[a(F,{type:"button",variant:"outline",onClick:b,disabled:J,children:Ve()}),g(F,{type:"submit",disabled:!C.trim()||J,children:[J&&a(K,{className:"w-4 h-4 mr-1.5 animate-spin"}),yd()]})]})]}),ne&&a(Xp,{teamId:e,currentProjectId:d,currentTargetFolderId:_,isOpen:ne,onClose:()=>oe(!1),onSelect:(t,O,H)=>{N(t),h(O),E(H||"Selected Folder")}})]})})}function Te({teamId:e,initialTaskId:r}){let[b,m]=w("team"),[k,x]=w(null),[C,p]=w(r??null),[D,I]=w(!1);S(()=>{if(r)p(r)},[r]);let[A,P]=w(yt.TODO),{data:T,isLoading:M}=X({queryKey:["teams",e,"me"],queryFn:async()=>{let s=await R.api.teams[":teamId"].me.$get({param:{teamId:e}});if(!s.ok)throw Error("Failed to fetch me");return await s.json()},enabled:!!e}),{data:l}=X({queryKey:["teams",e,"kanban","goals"],queryFn:async()=>{let s=await R.api.teams[":teamId"].kanban.goals.$get({param:{teamId:e},query:{}});if(!s.ok)return{data:[]};return await s.json()},enabled:!!e}),n=l?.data||[],f=k?n.find((s)=>s.id===k)||null:null,y=T?.role?.toLowerCase()==="owner"||T?.role?.toLowerCase()==="editor",i=(s=yt.TODO)=>{P(s),I(!0)},o=(s)=>{p(s.id)};if(M)return a("div",{className:"flex h-full items-center justify-center",children:a(K,{className:"w-8 h-8 animate-spin text-muted-foreground"})});return g("div",{className:"flex flex-row h-full bg-background overflow-hidden font-sans",children:[a(pe,{teamId:e,selectedGoalId:k,onSelectGoal:x,isOwnerOrEditor:y}),g("div",{className:"flex-1 flex flex-col min-w-0 h-full overflow-hidden",children:[a(ue,{scope:b,onScopeChange:m,selectedGoal:f,onClearGoal:()=>x(null),onCreateTask:()=>i(yt.TODO),canCreateTask:y}),a(ye,{teamId:e,selectedGoalId:k,scope:b,currentUserId:T?.id,currentUserRole:T?.role,onTaskClick:o,onCreateTaskInColumn:(s)=>i(s)})]}),C&&a(tm,{teamId:e,taskId:C,isOpen:!!C,onClose:()=>p(null),canEdit:y}),D&&a(we,{teamId:e,isOpen:D,initialStatus:A,initialGoalId:k,onClose:()=>I(!1)})]})}function je(){let{teamId:e}=_e.useParams(),{taskId:r}=_e.useSearch();return a(Te,{teamId:e,initialTaskId:r})}var _e=Je("/teams/$teamId/kanban")({component:je});export{_e as Route};
|