@shumai-one/shumai 0.5.2 → 0.5.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.
Files changed (138) hide show
  1. package/bin/{chunk-zf5cyxnt.js → chunk-03zkxckm.js} +1 -1
  2. package/bin/{chunk-2w6gve12.js → chunk-04nqnkzs.js} +3 -3
  3. package/bin/{chunk-rw5h0n0s.js → chunk-157axqz1.js} +1 -1
  4. package/bin/{chunk-w9z27p0m.js → chunk-1tesbv8w.js} +1 -1
  5. package/bin/{chunk-vzdgsfkf.js → chunk-24da4wg9.js} +1 -1
  6. package/bin/chunk-24nx3krz.js +2 -0
  7. package/bin/{chunk-twpc640e.js → chunk-26am2rzm.js} +1 -1
  8. package/bin/{chunk-8ayz61rc.js → chunk-2pt9h882.js} +3 -3
  9. package/bin/{chunk-mn108p93.js → chunk-2rrcdhkj.js} +1 -1
  10. package/bin/{chunk-ryepy5er.js → chunk-2w2bknn2.js} +4 -4
  11. package/bin/{chunk-ypkkfwfb.js → chunk-3ahax79y.js} +2 -2
  12. package/bin/{chunk-zdzkjp4q.js → chunk-3fjgf7eb.js} +2 -2
  13. package/bin/{chunk-rmvhyqyb.js → chunk-3wcvema0.js} +3 -3
  14. package/bin/{chunk-kvwec0p3.js → chunk-40tmh04g.js} +2 -2
  15. package/bin/chunk-45p7d22e.js +2 -0
  16. package/bin/chunk-461gcgrs.js +2 -0
  17. package/bin/{chunk-p0j4wpa5.js → chunk-4bc3gqmn.js} +1 -1
  18. package/bin/{chunk-8tzfcqtb.js → chunk-4nkwe7dz.js} +1 -1
  19. package/bin/{chunk-eqr0znmc.js → chunk-59ayg5am.js} +1 -1
  20. package/bin/{chunk-8zgq5sav.js → chunk-5ebb2pdf.js} +2 -2
  21. package/bin/{chunk-n76w2wcr.js → chunk-5y3kx4kk.js} +1 -1
  22. package/bin/{chunk-d2dgazjj.js → chunk-68xsb3t8.js} +1 -1
  23. package/bin/{chunk-n9vp9nbg.js → chunk-6hs63sva.js} +30 -30
  24. package/bin/{chunk-bpxw19ez.js → chunk-6pwf7qa6.js} +1 -1
  25. package/bin/{chunk-f5z3096k.js → chunk-6sq6dfa1.js} +2 -2
  26. package/bin/chunk-87secbzy.js +1 -0
  27. package/bin/chunk-8pykp70z.js +1 -0
  28. package/bin/{chunk-3pm6q6kg.js → chunk-8ts3xkme.js} +1 -1
  29. package/bin/{chunk-rza95y4z.js → chunk-909h3qzp.js} +2 -2
  30. package/bin/{chunk-0v9srsdz.js → chunk-929abwgr.js} +1 -1
  31. package/bin/{chunk-j53sjkxt.js → chunk-9ca8a5f2.js} +1 -1
  32. package/bin/{chunk-2pw7xcrn.js → chunk-9fyb95r5.js} +1 -1
  33. package/bin/{chunk-mneeg71d.js → chunk-axeq2pq5.js} +2 -2
  34. package/bin/{chunk-r249n1xe.js → chunk-b3tkvdfk.js} +2 -2
  35. package/bin/{chunk-9ggwc289.js → chunk-b6dbqs39.js} +1 -1
  36. package/bin/{chunk-w73v578p.js → chunk-b88tdt79.js} +2 -2
  37. package/bin/{chunk-19q13a80.js → chunk-bcyvxp1c.js} +4 -4
  38. package/bin/{chunk-7qvvf0yd.js → chunk-bn0taqr3.js} +2 -2
  39. package/bin/chunk-cb37q6t0.js +1 -0
  40. package/bin/chunk-cfqny70c.js +3 -0
  41. package/bin/{chunk-ffj9cq9y.js → chunk-cqnected.js} +1 -1
  42. package/bin/{chunk-98mg3dpd.js → chunk-cvfznrnt.js} +4 -4
  43. package/bin/{chunk-951r2rx1.js → chunk-d1q1tn36.js} +1 -1
  44. package/bin/{chunk-0asthrjf.js → chunk-d1rjpbgv.js} +2 -2
  45. package/bin/{chunk-81dawvn4.js → chunk-eshwjf91.js} +2 -2
  46. package/bin/{chunk-04avc4fn.js → chunk-fa9yq17g.js} +26 -26
  47. package/bin/{chunk-m6v8vt2b.js → chunk-fnkkwna8.js} +2 -2
  48. package/bin/{chunk-3q5qkfkc.js → chunk-fpjvr3qw.js} +1 -1
  49. package/bin/{chunk-ggfx2b0f.js → chunk-fsr83nb1.js} +1 -1
  50. package/bin/{chunk-kzr6ecke.js → chunk-fznchvm7.js} +1 -1
  51. package/bin/chunk-g2z0c39g.js +1 -0
  52. package/bin/{chunk-5vqbzsjv.js → chunk-gvcjqcjf.js} +1 -1
  53. package/bin/{chunk-0ge2mm8j.js → chunk-hbnpx0a5.js} +1 -1
  54. package/bin/{chunk-tvkekn4z.js → chunk-hgy9rqt1.js} +1 -1
  55. package/bin/chunk-hk659cg2.css +1 -0
  56. package/bin/{chunk-8ny7wvzb.js → chunk-hn2g40r6.js} +1 -1
  57. package/bin/{chunk-0y4zq3y4.js → chunk-hsx4pns6.js} +1 -1
  58. package/bin/{chunk-bbcmhcvc.js → chunk-hy5ncvpf.js} +2 -2
  59. package/bin/{chunk-5nqvqvqp.js → chunk-j420aqk8.js} +3 -3
  60. package/bin/{chunk-t1yamxgk.js → chunk-k3ds96cb.js} +1 -1
  61. package/bin/{chunk-dppfek34.js → chunk-m41tbrvt.js} +2 -2
  62. package/bin/chunk-m9f21ye9.js +1 -0
  63. package/bin/chunk-md7pgk86.js +2 -0
  64. package/bin/chunk-me3zmpj5.js +14 -0
  65. package/bin/chunk-mg6sybt0.js +1 -0
  66. package/bin/{chunk-jgfye6nf.js → chunk-mzme3m82.js} +1 -1
  67. package/bin/{chunk-ce0bhc72.js → chunk-n08h1jgx.js} +1 -1
  68. package/bin/{chunk-ae6zgjhd.js → chunk-ncv8v6mj.js} +2 -2
  69. package/bin/{chunk-cx32wsa1.js → chunk-nmd1901j.js} +1 -1
  70. package/bin/{chunk-wnqxyqrg.js → chunk-np39aknv.js} +2 -2
  71. package/bin/{chunk-dche0gy0.js → chunk-p7zw53ep.js} +1 -1
  72. package/bin/{chunk-xr2v0d6y.js → chunk-ppb4aj0y.js} +4 -4
  73. package/bin/{chunk-15vsw36h.js → chunk-pwq6dbb5.js} +5 -5
  74. package/bin/chunk-q1gfypy3.js +2 -0
  75. package/bin/{chunk-0j22699g.js → chunk-q4qqmes7.js} +2 -2
  76. package/bin/{chunk-vm2pz2hm.js → chunk-q7t5zs7n.js} +2 -2
  77. package/bin/{chunk-e439kt05.js → chunk-qcpeefhr.js} +1 -1
  78. package/bin/{chunk-6rn094yj.js → chunk-qjdvs1s5.js} +1 -1
  79. package/bin/{chunk-9zgqjdx1.js → chunk-qqapw198.js} +2 -2
  80. package/bin/chunk-qx553512.js +211 -0
  81. package/bin/chunk-r3s1x5wp.js +1 -0
  82. package/bin/{chunk-rtaya5wc.js → chunk-rh8dy99a.js} +2 -2
  83. package/bin/{chunk-5rzxekn4.js → chunk-s0vfj06y.js} +1 -1
  84. package/bin/{chunk-4zksqvwj.js → chunk-s6g2mzpn.js} +2 -2
  85. package/bin/{chunk-zckxc8m6.js → chunk-s9sf37dv.js} +2 -2
  86. package/bin/{chunk-19jpn3r6.js → chunk-scvepfv8.js} +1 -1
  87. package/bin/chunk-sjbvt3wa.js +2 -0
  88. package/bin/{chunk-mn208vrv.js → chunk-srmx5z3v.js} +2 -2
  89. package/bin/{chunk-r776bhsg.js → chunk-srv5kvm4.js} +1 -1
  90. package/bin/{chunk-qmrg2jhs.js → chunk-t1h12r3q.js} +5 -5
  91. package/bin/{chunk-gvas3xkp.js → chunk-t6myw0jf.js} +1 -1
  92. package/bin/{chunk-z8e4wc59.js → chunk-t8jfp3vx.js} +1 -1
  93. package/bin/{chunk-15w79661.js → chunk-tqdde9bj.js} +1 -1
  94. package/bin/chunk-vk9ecq8n.js +2 -0
  95. package/bin/{chunk-d5hbzp7t.js → chunk-vsnq4381.js} +1 -1
  96. package/bin/{chunk-1nvj833s.js → chunk-w4adkd0a.js} +5 -5
  97. package/bin/{chunk-qxscgcn9.js → chunk-wbmqbpgm.js} +1 -1
  98. package/bin/{chunk-v034sfw8.js → chunk-wperd2h9.js} +2 -2
  99. package/bin/{chunk-y2dhf3p0.js → chunk-xbw7ffrz.js} +2 -2
  100. package/bin/{chunk-9bakwac0.js → chunk-xdrpahym.js} +4 -4
  101. package/bin/{chunk-6jkjx0n2.js → chunk-xfmnfcv2.js} +3 -3
  102. package/bin/chunk-xhngtwn9.js +1 -0
  103. package/bin/chunk-xjnehexk.js +2 -0
  104. package/bin/chunk-xzb0t8mx.js +1 -0
  105. package/bin/{chunk-k3prp6c6.js → chunk-y5h5d5gx.js} +4 -4
  106. package/bin/{chunk-wwkhskce.js → chunk-y6xyc4wp.js} +2 -2
  107. package/bin/{chunk-93p27bbm.js → chunk-zpk87b33.js} +5 -5
  108. package/bin/{chunk-asy868kq.js → chunk-zq5j9wsc.js} +1 -1
  109. package/bin/{chunk-grjek810.js → chunk-zsg61vr0.js} +2 -2
  110. package/bin/chunk-zts21ft7.js +1 -0
  111. package/bin/{chunk-cpj562n6.js → chunk-zzbn0b6c.js} +1 -1
  112. package/bin/shumai-app.html +1 -1
  113. package/bin/shumai-app.js +350 -333
  114. package/package.json +7 -7
  115. package/prisma/migrations/20261014054332_add_embedding_768/migration.sql +8 -0
  116. package/prisma/schema.prisma +10 -8
  117. package/bin/chunk-2gf95tj0.js +0 -1
  118. package/bin/chunk-2tk5w3jc.js +0 -1
  119. package/bin/chunk-301e7g3z.js +0 -2
  120. package/bin/chunk-3kmjbc3m.js +0 -2
  121. package/bin/chunk-3td60k1m.js +0 -2
  122. package/bin/chunk-42hrvk6k.js +0 -211
  123. package/bin/chunk-5bk16qdp.js +0 -2
  124. package/bin/chunk-8abhmarc.js +0 -2
  125. package/bin/chunk-965102pf.js +0 -3
  126. package/bin/chunk-acn3r2m2.js +0 -1
  127. package/bin/chunk-ce75dw3k.css +0 -1
  128. package/bin/chunk-d9qpgkek.js +0 -2
  129. package/bin/chunk-dv6p6n5e.js +0 -1
  130. package/bin/chunk-qb178ntp.js +0 -2
  131. package/bin/chunk-s4r6e6ms.js +0 -1
  132. package/bin/chunk-syjjke3f.js +0 -1
  133. package/bin/chunk-tgfxe0sb.js +0 -1
  134. package/bin/chunk-tjretpx8.js +0 -1
  135. package/bin/chunk-w4yjgez6.js +0 -14
  136. package/bin/chunk-wjcebkpb.js +0 -1
  137. package/bin/chunk-ws71fg50.js +0 -2
  138. package/bin/chunk-yfp3q4da.js +0 -1
@@ -1 +1 @@
1
- import{F,P,m,D,_,u,Xn,S,L,t,o,V,Hu,$u,br,Rc,Yi,wo,Ht,Yo,Gu,Vu,Qu,Ku,Pc,Wu,Z,B,mt,ze,A,I,lr,O,Tt,ve,er,Ut,Jo,Ne,E,gt,ye,Y,Pt,Er,Lt,se,cr,C,Ce,Ie,Te,HA,$A,G0,K0,W0,Rf,y_,sh,De,na,uh,Iy,zc,mh,qs,Xo,kh,Rh,kv,Rv,Gh,Pw,Nx,Dx,pS,dp,fp,IS,BS,vg,Vc,NE,zg,XE,tC,vp,nC,iC,qg,lC,cC,Hg,uC,fC,Ld,Zd,Bd,kl,Ip,bC,vC,wC,xC,Ud,$s,qC,oI,aI,wI,NI,OI,FI,LI,ZI,dA,BI,$d,LT,zT,r1,SA,_n,Qp,F1,L1,Xc,Xe,et,tt,rt,nt,ot,st,it,z,Nt,M,Fl,kn,em,he,At,_t,yt,wr,af,Ke,vt,wt,kt,at}from"./chunk-42hrvk6k.js";import{Ro,yr}from"./chunk-ffj9cq9y.js";import{Ql}from"./chunk-8ayz61rc.js";import{Ws,zo,Jl,Wa,Oi,Xl}from"./chunk-81dawvn4.js";import{Pn,Nn,Dn,xr,It,xt}from"./chunk-t1yamxgk.js";import"./chunk-15w79661.js";import"./chunk-zf5cyxnt.js";import{Kn,co}from"./chunk-8tzfcqtb.js";S();function te(a,e){let s=new Set(e);return a.filter((i)=>!s.has(i))}var ae=class extends wo{#r;#e;#o;#a;#t;#s;#i;#n;#l;#d=[];constructor(a,e,s){super();this.#r=a,this.#a=s,this.#o=[],this.#t=[],this.#e=[],this.setQueries(e)}onSubscribe(){if(this.listeners.size===1)this.#t.forEach((a)=>{a.subscribe((e)=>{this.#p(a,e)})})}onUnsubscribe(){if(!this.listeners.size)this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach((a)=>{a.destroy()})}setQueries(a,e){this.#o=a,this.#a=e,Ht.batch(()=>{let s=this.#t,i=this.#u(this.#o);i.forEach((p)=>p.observer.setOptions(p.defaultedQueryOptions));let c=i.map((p)=>p.observer),r=c.map((p)=>p.getCurrentResult()),f=s.length!==c.length,g=c.some((p,x)=>p!==s[x]),b=f||g,v=b?!0:r.some((p,x)=>{let N=this.#e[x];return!N||!Yi(p,N)});if(!b&&!v)return;if(b)this.#d=i,this.#t=c;if(this.#e=r,!this.hasListeners())return;if(b)te(s,c).forEach((p)=>{p.destroy()}),te(c,s).forEach((p)=>{p.subscribe((x)=>{this.#p(p,x)})});this.#f()})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map((a)=>a.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(a,e){let s=this.#u(a),i=s.map((r)=>r.observer.getOptimisticResult(r.defaultedQueryOptions)),c=s.map((r)=>r.defaultedQueryOptions.queryHash);return[i,(r)=>this.#c(r??i,e,c),()=>this.#m(i,s)]}#m(a,e){let s=new Set;return e.map((i,c)=>{let r=a[c];return!i.defaultedQueryOptions.notifyOnChangeProps?i.observer.trackResult(r,(f)=>{if(!s.has(f))s.add(f),e.forEach((g)=>{g.observer.trackProp(f)})}):r})}#c(a,e,s){if(e){let i=this.#l,c=s!==void 0&&i!==void 0&&(i.length!==s.length||s.some((r,f)=>r!==i[f]));if(this.#e!==this.#n||c||e!==this.#i){if(this.#i=e,this.#n=this.#e,s!==void 0)this.#l=s;this.#s=Rc(this.#s,e(a))}return this.#s}return a}#g(){return!this.#a?.combine||this.#t.some((a,e)=>a.options.suspense&&this.#e[e]?.data===void 0)}#u(a){let e=new Map;this.#t.forEach((i)=>{let c=i.options.queryHash;if(!c)return;let r=e.get(c);if(r)r.push(i);else e.set(c,[i])});let s=[];return a.forEach((i)=>{let c=this.#r.defaultQueryOptions(i),r=e.get(c.queryHash)?.shift()??new Yo(this.#r,c);s.push({defaultedQueryOptions:c,observer:r})}),s}#p(a,e){let s=this.#t.indexOf(a);if(s!==-1)this.#e=this.#e.slice(),this.#e[s]=e,this.#f()}#f(){if(this.hasListeners()){let a=this.#g(),e=this.#s,s=a?e:this.#c(this.#m(this.#e,this.#d),this.#a?.combine);if(a||e!==s)Ht.batch(()=>{this.listeners.forEach((i)=>{i(this.#e)})})}}};S();function re({queries:a,...e},s){let i=V(s),c=Hu(),r=$u(),f=e.subscribed!==!1,g=D(()=>a.map((d)=>{let h=i.defaultQueryOptions(d);return h._optimisticResults=c?"isRestoring":f?"optimistic":void 0,h}),[a,i,c,f]);g.forEach((d)=>{Ku(d);let h=i.getQueryCache().get(d.queryHash);Gu(d,r,h)}),Vu(r);let[b]=u(()=>new ae(i,g,e)),[v,p,x]=b.getOptimisticResult(g,e.combine),N=!c&&f;Xn(P((d)=>N?b.subscribe(Ht.batchCalls(d)):br,[b,N]),()=>b.getCurrentResult(),()=>b.getCurrentResult()),m(()=>{b.setQueries(g,e)},[g,e,b]);let n=v.some((d,h)=>Pc(g[h],d))?v.flatMap((d,h)=>{let w=g[h];if(w&&Pc(w,d)){let q=new Yo(i,w);return Wu(w,q,r)}return[]}):[];if(n.length>0)throw Promise.all(n);let y=v.find((d,h)=>{let w=g[h];return w&&Qu({result:d,errorResetBoundary:r,throwOnError:w.throwOnError,query:i.getQueryCache().get(w.queryHash),suspense:w.suspense})});if(y)throw y.error;return p(x())}S();S();var xe=Object.defineProperty,H=(a,e)=>xe(a,"name",{value:e,configurable:!0}),W="Collapsible",[we,Mt]=gt(W),[_e,X]=we(W),Re=F(H(function(e,s){let{__scopeCollapsible:i,open:c,defaultOpen:r,disabled:f,onOpenChange:g,...b}=e,[v,p]=Lt({prop:c,defaultProp:r??!1,onChange:g,caller:W});return t(_e,{scope:i,disabled:f,contentId:Er(),open:v,onOpenToggle:P(()=>p((x)=>!x),[p]),children:t(se.div,{"data-state":U(v),"data-disabled":f?"":void 0,...b,ref:s})})},"Collapsible")),ke="CollapsibleTrigger",Ae=F(H(function(e,s){let{__scopeCollapsible:i,...c}=e,r=X(ke,i);return t(se.button,{type:"button","aria-controls":r.open?r.contentId:void 0,"aria-expanded":r.open||!1,"data-state":U(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...c,ref:s,onClick:Y(e.onClick,r.onOpenToggle)})},"CollapsibleTrigger")),oe="CollapsibleContent",qe=F(H(function(e,s){let{forceMount:i,...c}=e,r=X(oe,e.__scopeCollapsible);return t(cr,{present:i||r.open,children:({present:f})=>t(Pe,{...c,ref:s,present:f})})},"CollapsibleContent")),Pe=F(H(function(e,s){let{__scopeCollapsible:i,present:c,children:r,...f}=e,g=X(oe,i),[b,v]=u(c),p=_(null),x=ye(s,p),N=_(0),n=N.current,y=_(0),d=y.current,h=g.open||b,w=_(h),q=_(void 0);return m(()=>{let R=requestAnimationFrame(()=>w.current=!1);return()=>cancelAnimationFrame(R)},[]),Pt(()=>{let R=p.current;if(R){q.current=q.current||{transitionDuration:R.style.transitionDuration,animationName:R.style.animationName},R.style.transitionDuration="0s",R.style.animationName="none";let j=R.getBoundingClientRect();if(N.current=j.height,y.current=j.width,!w.current)R.style.transitionDuration=q.current.transitionDuration,R.style.animationName=q.current.animationName;v(c)}},[g.open,c]),t(se.div,{"data-state":U(g.open),"data-disabled":g.disabled?"":void 0,id:g.contentId,hidden:!h,...f,ref:x,style:{["--radix-collapsible-content-height"]:n?`${n}px`:void 0,["--radix-collapsible-content-width"]:d?`${d}px`:void 0,...e.style},children:h&&r})},"CollapsibleContentImpl"));function U(a){return a?"open":"closed"}H(U,"getState");var Se=Re;var He=[["path",{d:"M5 21v-6",key:"1hz6c0"}],["path",{d:"M12 21V3",key:"1lcnhd"}],["path",{d:"M19 21V9",key:"unv183"}]],ie=I("chart-no-axes-column",He);var Oe=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],J=I("funnel",Oe);var Qe=[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z",key:"1n2ejm"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1",key:"1qfcsi"}]],Q=I("messages-square",Qe);function ne({teamId:a}){let[e,s]=u("team"),[i,c]=u("1h"),{data:r,isLoading:f}=Z({queryKey:["teams",a,"ai-usage",i,"team"],queryFn:async()=>{let d=await A.api.teams[":teamId"]["ai-usage"].$get({param:{teamId:a},query:{timeframe:i}});if(!d.ok)throw Error("Failed to fetch team AI usage");return await d.json()},enabled:!!a&&e==="team"}),{data:g,isLoading:b}=Z({queryKey:["teams",a,"members"],queryFn:async()=>{let d=await A.api.teams[":teamId"].members.$get({param:{teamId:a},query:{}});if(!d.ok)throw Error("Failed to fetch team members");return await d.json()},enabled:!!a&&e==="members"}),v=re({queries:(g||[]).map((d)=>({queryKey:["teams",a,"ai-usage",i,d.id],queryFn:async()=>{let h=await A.api.teams[":teamId"]["ai-usage"].$get({param:{teamId:a},query:{timeframe:i,userId:d.id}});if(!h.ok)throw Error(`Failed to fetch AI usage for member ${d.id}`);return await h.json()},enabled:!!a&&e==="members"}))}),p=b||v.some((d)=>d.isLoading),x=(d)=>{if(!d)return"U";let h=d.split(" ");if(h.length>1)return`${h[0][0]}${h[h.length-1][0]}`.toUpperCase();return d.substring(0,2).toUpperCase()},N=(d)=>{if(!d)return"";switch(d.toLowerCase()){case"owner":return Vc();case"editor":return qs();case"reviewer":return $s();default:return d}},n=(d)=>(d??0).toLocaleString(),y=(d)=>`$${(d??0).toFixed(6)}`;return o(Ke,{className:"border-border/60 shadow-sm",children:[o(vt,{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between pb-6",children:[o("div",{children:[t(wt,{className:"text-xl font-semibold tracking-tight",children:K0()}),t(kt,{className:"text-sm text-muted-foreground mt-1",children:W0()})]}),o("div",{className:"flex flex-wrap items-center gap-3",children:[o(Ro,{type:"single",value:e,onValueChange:(d)=>{if(d)s(d)},className:"border rounded-lg p-1 bg-muted/30",children:[t(yr,{value:"team",className:"px-3 py-1.5 text-xs font-medium",children:zT()}),t(yr,{value:"members",className:"px-3 py-1.5 text-xs font-medium",children:Dx()})]}),o(Ro,{type:"single",value:i,onValueChange:(d)=>{if(d)c(d)},className:"border rounded-lg p-1 bg-muted/30",children:[t(yr,{value:"1h",className:"px-2.5 py-1.5 text-xs font-medium",children:"1h"}),t(yr,{value:"24h",className:"px-2.5 py-1.5 text-xs font-medium",children:"24h"}),t(yr,{value:"7d",className:"px-2.5 py-1.5 text-xs font-medium",children:"7d"}),t(yr,{value:"30d",className:"px-2.5 py-1.5 text-xs font-medium",children:"30d"})]})]})]}),t(at,{children:e==="team"?f?t("div",{className:"flex h-48 items-center justify-center",children:t(O,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):t("div",{className:"rounded-md border",children:o(Pn,{children:[t(Nn,{children:o(xr,{children:[t(It,{children:$d()}),t(It,{className:"text-right",children:Gh()}),t(It,{className:"text-right",children:vg()}),t(It,{className:"text-right",children:sh()}),t(It,{className:"text-right",children:SA()}),t(It,{className:"text-right",children:uh()})]})}),t(Dn,{children:o(xr,{children:[t(xt,{className:"font-medium",children:$d()}),t(xt,{className:"text-right",children:n(r?.team?.inputTokens)}),t(xt,{className:"text-right",children:n(r?.team?.outputTokens)}),t(xt,{className:"text-right",children:n(r?.team?.cacheReadTokens)}),t(xt,{className:"text-right font-medium",children:n(r?.team?.totalTokens)}),t(xt,{className:"text-right font-medium",children:y(r?.team?.cost)})]})})]})}):p?t("div",{className:"flex h-48 items-center justify-center",children:t(O,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):t("div",{className:"rounded-md border",children:o(Pn,{children:[t(Nn,{children:o(xr,{children:[t(It,{children:Nx()}),t(It,{children:qC()}),t(It,{className:"text-right",children:Gh()}),t(It,{className:"text-right",children:vg()}),t(It,{className:"text-right",children:sh()}),t(It,{className:"text-right",children:SA()}),t(It,{className:"text-right",children:uh()})]})}),t(Dn,{children:(g||[]).map((d,h)=>{let w=v[h]?.data?.member;return o(xr,{children:[t(xt,{children:o("div",{className:"flex items-center gap-3",children:[o(Ce,{className:"h-8 w-8 rounded-full",children:[d.image&&t(Ie,{src:d.image,alt:d.name,className:"object-cover"}),t(Te,{className:"bg-primary/20 text-xs",children:x(d.name)})]}),o("div",{className:"flex flex-col",children:[t("span",{className:"text-sm font-medium leading-none",children:d.name}),t("span",{className:"text-xs text-muted-foreground mt-0.5",children:d.email})]})]})}),t(xt,{className:"text-xs text-muted-foreground",children:N(d.role)}),t(xt,{className:"text-right",children:n(w?.inputTokens)}),t(xt,{className:"text-right",children:n(w?.outputTokens)}),t(xt,{className:"text-right",children:n(w?.cacheReadTokens)}),t(xt,{className:"text-right font-medium",children:n(w?.totalTokens)}),t(xt,{className:"text-right font-medium",children:y(w?.cost)})]},d.id)})})]})})})]})}S();function le({teamId:a}){let[e,s]=u(null),{ref:i,inView:c}=Nt(),{data:r,isLoading:f,isError:g,fetchNextPage:b,hasNextPage:v,isFetchingNextPage:p}=mt({queryKey:["teams",a,"agent-sessions"],queryFn:async({pageParam:n})=>{let y=await A.api.teams[":teamId"]["agent-sessions"].$get({param:{teamId:a},query:{first:"20",after:n?String(n):void 0}});if(!y.ok)throw Error("Failed to fetch agent sessions");return await y.json()},initialPageParam:"",getNextPageParam:(n)=>n.pageInfo.cursor||void 0,enabled:!!a});m(()=>{if(c&&v&&!p)b()},[c,v,p,b]);let x=r?.pages.flatMap((n)=>n.data).filter((n)=>n.id!=="pending")||[],N=(n)=>{switch(n){case"comment":return t(he,{variant:"outline",className:"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20",children:LI()});case"chat":return t(he,{variant:"outline",className:"bg-violet-500/10 text-violet-600 dark:text-violet-400 border-violet-500/20",children:FI()});case"naming":return t(he,{variant:"outline",className:"bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/20",children:ZI()});default:return t(he,{variant:"outline",className:"bg-muted text-muted-foreground border-border",children:n})}};return o("div",{className:"space-y-6",children:[o(Ke,{className:"border border-border/50 shadow-xs",children:[t(vt,{className:"pb-4",children:t("div",{className:"flex items-center justify-between",children:o("div",{children:[o(wt,{className:"text-xl font-bold flex items-center gap-2",children:[t(Q,{className:"w-5 h-5 text-violet-500"}),dA()]}),t(kt,{className:"mt-1 text-sm text-muted-foreground",children:BI()})]})})}),t(at,{children:f?t("div",{className:"flex h-64 items-center justify-center",children:t(O,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):g?t("div",{className:"flex h-64 items-center justify-center text-destructive",children:"Failed to load agent sessions."}):x.length===0?o("div",{className:"flex flex-col items-center justify-center py-12 text-center text-muted-foreground",children:[t(Q,{className:"w-10 h-10 text-muted-foreground/40 mb-3"}),t("p",{className:"text-base font-medium",children:IS()})]}):o("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[o(Pn,{children:[t(Nn,{className:"bg-muted/40",children:o(xr,{children:[t(It,{children:NI()}),t(It,{children:zc()}),t(It,{children:OI()}),t(It,{className:"text-right",children:Iy()})]})}),t(Dn,{children:x.map((n)=>o(xr,{onClick:()=>s(n.id),className:"cursor-pointer hover:bg-muted/50 transition-colors",children:[t(xt,{className:"font-medium",children:o("div",{className:"flex flex-col",children:[t("span",{className:"text-sm font-semibold text-foreground",children:n.name||Qp()}),t("span",{className:"text-xs font-mono text-muted-foreground/70",children:n.id})]})}),t(xt,{children:o("div",{className:"flex items-center gap-2",children:[o(Ce,{className:"h-6 w-6",children:[t(Ie,{src:n.creator?.image||void 0}),t(Te,{className:"text-[10px]",children:n.creator?.name?.[0]?.toUpperCase()||"?"})]}),t("span",{className:"text-sm text-foreground/90",children:n.creator?.name||"System / Agent"})]})}),t(xt,{children:N(n.type)}),t(xt,{className:"text-right text-xs text-muted-foreground",children:kn(n.createdAt)})]},n.id))})]}),t("div",{ref:i,className:"py-4 flex justify-center",children:p&&t(O,{className:"h-6 w-6 animate-spin text-muted-foreground"})})]})})]}),t(Ql,{sessionId:e,open:!!e,onOpenChange:(n)=>{if(!n)s(null)}})]})}S();function de({...a}){return t(Se,{"data-slot":"collapsible",...a})}function me({...a}){return t(Ae,{"data-slot":"collapsible-trigger",...a})}function ce({...a}){return t(qe,{"data-slot":"collapsible-content",...a})}function ee(a){switch(a.toLowerCase()){case"owner":return Vc();case"editor":return qs();case"reviewer":return $s();default:return a}}function Le(a,e){if(typeof a==="object"&&a!==null&&"message"in a){let s=a.message;if(typeof s==="string")return s}return e}function Be({rule:a}){let e=a.resourceData??{};if(a.resource==="agent_mcp_call_count")return t("span",{children:vC({value:String(e.id??"")})});if(a.resource==="agent_bash_call_count")return t("span",{children:bC({value:String(e.match??"*")})});if(a.resource==="agent_tool_call_count")return t("span",{children:wC({value:String(e.name??e.toolName??"*")})});return null}function Me({rule:a}){if(a.scopeMode==="all_members")return o(he,{variant:"secondary",className:"gap-1 text-xs",children:[t(co,{className:"h-3 w-3"}),o("span",{children:[Ld(),a.role?` (${ee(a.role)})`:` (${kl()})`]})]});if(a.scopeMode==="each_member")return o(he,{variant:"secondary",className:"gap-1 text-xs",children:[t(Kn,{className:"h-3 w-3"}),o("span",{children:[Zd(),a.role?` (${ee(a.role)})`:` (${kl()})`]})]});return o(he,{variant:"secondary",className:"gap-1 text-xs",children:[t(Jo,{className:"h-3 w-3"}),o("span",{children:[Bd()," (",a.userIds?.length||0,")"]})]})}function Fe({teamId:a,rule:e,record:s}){let i=V(),[c,r]=u(!1),[f,g]=u(()=>new Date),b=Wa[e.resource],v=e.scopeMode==="all_members",p=s.percent>=100,x=v?e.role?`${fC()}: ${ee(e.role)}`:xC():s.user?.name||s.userId||_n();m(()=>{if(!s.isWindowActive||!s.periodEnd)return;let n=window.setInterval(()=>g(new Date),60000);return()=>window.clearInterval(n)},[s.isWindowActive,s.periodEnd]);let N=B({mutationFn:async()=>{let n=await A.api.teams[":teamId"].quotas[":id"].records.reset.$post({param:{teamId:a,id:e.id},json:{userId:s.userId??null}});if(!n.ok){let y=await n.json().catch(()=>null);throw Error(Le(y,Rh()))}return await n.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["teams",a,"quotas",e.id,"records"]}),i.invalidateQueries({queryKey:["teams",a,"quotas"]}),r(!1),M.success(cC())},onError:(n)=>{let y=n instanceof Error?n.message:Rh();r(!1),M.error(y)}});return o(L,{children:[o("div",{className:"space-y-3 rounded-xl border border-border/70 bg-card p-4 text-card-foreground shadow-2xs",children:[o("div",{className:"flex items-center justify-between gap-3",children:[o("div",{className:"flex min-w-0 items-center gap-3",children:[v?t("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:t(co,{className:"h-5 w-5"})}):o(Ce,{className:"h-9 w-9 shrink-0 border border-border/50",children:[t(Ie,{src:s.user?.image||void 0}),t(Te,{className:"text-xs font-semibold",children:s.user?.name?.[0]?.toUpperCase()||"U"})]}),o("div",{className:"min-w-0",children:[t("div",{className:"truncate text-sm font-semibold text-foreground",children:x}),!v&&s.user?.email&&t("div",{className:"truncate text-xs text-muted-foreground",children:s.user.email})]})]}),o("div",{className:"flex shrink-0 items-center gap-2",children:[s.isWindowActive&&s.periodEnd?o(he,{variant:"outline",className:"hidden gap-1 border-primary/30 bg-primary/5 text-xs text-primary sm:flex",children:[t(er,{className:"h-3 w-3"}),t("span",{children:qg({time:em(s.periodEnd,f)})})]}):o(he,{variant:"secondary",className:"hidden gap-1 text-xs text-muted-foreground sm:flex",children:[t(lr,{className:"h-3 w-3 text-primary"}),t("span",{children:zg()})]}),o(C,{type:"button",variant:"outline",size:"sm",className:"gap-1.5",onClick:()=>r(!0),disabled:N.isPending,children:[N.isPending?t(O,{className:"h-3.5 w-3.5 animate-spin"}):t(Ws,{className:"h-3.5 w-3.5"}),Hg()]})]})]}),o("div",{className:"space-y-1.5 pt-1",children:[t(af,{value:Math.min(100,Math.max(0,s.percent)),className:"h-2"}),o("div",{className:"flex items-center justify-between gap-2 text-xs font-medium",children:[o("span",{className:p?"font-bold text-destructive":"text-foreground",children:[Oi(e.resource,s.consumed)," /"," ",Oi(e.resource,e.limit)," ",b?.unit]}),o("span",{className:p?"font-bold text-destructive":"text-muted-foreground",children:[s.percent,"%"]})]})]}),o("div",{className:"flex items-center justify-between gap-2 text-xs text-muted-foreground sm:hidden",children:[s.isWindowActive&&s.periodEnd?o("span",{className:"flex items-center gap-1 text-primary",children:[t(er,{className:"h-3 w-3"}),qg({time:em(s.periodEnd,f)})]}):o("span",{className:"flex items-center gap-1",children:[t(lr,{className:"h-3 w-3 text-primary"}),zg()]}),o("span",{children:[lC(),": ",Oi(e.resource,s.remaining)," ",b?.unit]})]})]}),t(Xe,{open:c,onOpenChange:r,children:o(et,{children:[o(tt,{children:[t(nt,{children:Hg()}),t(ot,{children:uC({target:x})})]}),o(rt,{children:[t(it,{disabled:N.isPending,children:De()}),o(st,{onClick:(n)=>{n.preventDefault(),N.mutate()},disabled:N.isPending,children:[N.isPending&&t(O,{className:"mr-2 h-4 w-4 animate-spin"}),na()]})]})]})})]})}function je({teamId:a,rule:e}){let[s,i]=u(!1),[c,r]=u(""),f=Wa[e.resource],g=f?.icon||zo,{data:b,isLoading:v,isError:p}=Z({queryKey:["teams",a,"quotas",e.id,"records"],queryFn:async()=>{let n=await A.api.teams[":teamId"].quotas[":id"].records.$get({param:{teamId:a,id:e.id}});if(!n.ok)throw Error(kh());return await n.json()},enabled:s,refetchInterval:s?1e4:!1}),x=b?.records??[],N=x.filter((n)=>{if(!c.trim())return!0;let y=c.toLowerCase();return n.user?.name.toLowerCase().includes(y)||n.user?.email.toLowerCase().includes(y)});return o(de,{open:s,onOpenChange:i,className:"rounded-xl border border-border/70",children:[t(me,{asChild:!0,children:o("button",{type:"button","aria-label":s?XE():nC(),className:"flex w-full items-center justify-between gap-4 p-4 text-left transition-colors hover:bg-muted/40",children:[o("div",{className:"flex min-w-0 items-start gap-3",children:[t("div",{className:"mt-0.5 rounded-lg bg-primary/10 p-2 text-primary",children:t(g,{className:"h-5 w-5"})}),o("div",{className:"min-w-0",children:[o("div",{className:"flex flex-wrap items-center gap-2",children:[t("span",{className:"font-semibold text-foreground",children:f?.label()||e.resource}),!e.enabled&&t(he,{variant:"secondary",children:vp()})]}),o("div",{className:"mt-1 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground",children:[t(Me,{rule:e}),o(he,{variant:"outline",className:"gap-1 text-xs",children:[t(er,{className:"h-3 w-3"}),Oi(e.resource,e.limit)," ",f?.unit," /"," ",Xl(e.period)]}),t(Be,{rule:e})]})]})]}),t(ve,{className:`h-5 w-5 shrink-0 text-muted-foreground transition-transform ${s?"rotate-180":""}`})]})}),t(ce,{children:o("div",{className:"space-y-3 border-t border-border/60 bg-muted/10 p-4",children:[e.scopeMode!=="all_members"&&x.length>3&&o("div",{className:"relative",children:[t(Ut,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),t(z,{value:c,onChange:(n)=>r(n.target.value),placeholder:Ip(),className:"h-9 pl-9 text-sm"})]}),v?t("div",{className:"flex justify-center py-10",children:t(O,{className:"h-7 w-7 animate-spin text-primary"})}):p?t("div",{className:"py-8 text-center text-sm text-destructive",children:kh()}):N.length===0?t("div",{className:"py-8 text-center text-sm text-muted-foreground",children:iC()}):N.map((n,y)=>t(Fe,{teamId:a,rule:e,record:n},n.id||n.userId||`record-${y}`))]})})]})}function ue({teamId:a}){let{data:e,isLoading:s,isError:i}=Z({queryKey:["teams",a,"quotas"],queryFn:async()=>{let r=await A.api.teams[":teamId"].quotas.$get({param:{teamId:a}});if(!r.ok)throw Error(Xo());return await r.json()},enabled:!!a}),c=e?.rules??[];return o(Ke,{className:"border-border/60 shadow-sm",children:[o(vt,{children:[o(wt,{className:"flex items-center gap-2 text-xl font-semibold tracking-tight",children:[t(zo,{className:"h-5 w-5 text-primary"}),Ud()]}),t(kt,{children:tC()})]}),t(at,{children:s?t("div",{className:"flex h-48 items-center justify-center",children:t(O,{className:"h-7 w-7 animate-spin text-muted-foreground"})}):i?t("div",{className:"py-10 text-center text-sm text-destructive",children:Xo()}):c.length===0?o("div",{className:"flex flex-col items-center justify-center rounded-xl border-2 border-dashed border-border py-12 text-center",children:[t(zo,{className:"mb-3 h-10 w-10 text-muted-foreground/50"}),t("p",{className:"text-base font-medium text-foreground",children:fp()}),t("p",{className:"mt-1 max-w-md text-sm text-muted-foreground",children:dp()})]}):t("div",{className:"space-y-3",children:c.map((r)=>t(je,{teamId:a,rule:r},r.id))})})]})}S();var Ue=Object.values(Fl);function pe({teamId:a}){let[e,s]=u([]),[i,c]=u([]),[r,f]=u(""),{ref:g,inView:b}=Nt(),{data:v}=Z({queryKey:["teams",a,"members"],queryFn:async()=>{let l=await A.api.teams[":teamId"].members.$get({param:{teamId:a},query:{}});if(!l.ok)return[];return await l.json()},enabled:!!a}),p=v||[],{data:x,isLoading:N,isError:n,fetchNextPage:y,hasNextPage:d,isFetchingNextPage:h}=mt({queryKey:["teams",a,"audit-logs",e,i,r],queryFn:async({pageParam:l})=>{let T=await A.api.teams[":teamId"]["audit-logs"].$get({param:{teamId:a},query:{first:"20",after:l?String(l):void 0,actions:e.length>0?e:void 0,userIds:i.length>0?i:void 0,itemId:r.trim()||void 0}});if(!T.ok)throw Error("Failed to fetch audit logs");return await T.json()},initialPageParam:"",getNextPageParam:(l)=>l.pageInfo.endCursor||void 0,enabled:!!a});m(()=>{if(b&&d&&!h)y()},[b,d,h,y]);let w=x?.pages.flatMap((l)=>l.nodes)||[],q=x?.pages[0]?.total??0,R=(l)=>{s((T)=>T.includes(l)?T.filter((k)=>k!==l):[...T,l])},j=(l)=>{c((T)=>T.includes(l)?T.filter((k)=>k!==l):[...T,l])},fe=(l)=>{if(l.includes("delete")||l.includes("remove")||l.includes("revoke"))return t(he,{variant:"outline",className:"bg-destructive/10 text-destructive border-destructive/20 font-mono text-xs",children:l});if(l.includes("create")||l.includes("add"))return t(he,{variant:"outline",className:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20 font-mono text-xs",children:l});if(l.includes("update")||l.includes("reparent")||l.includes("copy"))return t(he,{variant:"outline",className:"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20 font-mono text-xs",children:l});return t(he,{variant:"outline",className:"bg-muted text-muted-foreground border-border font-mono text-xs",children:l})},ge=new Map(p.map((l)=>[l.userId||l.id,l]));return t("div",{className:"space-y-6",children:o(Ke,{className:"border border-border/50 shadow-xs",children:[o(vt,{className:"pb-4",children:[o("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[o("div",{children:[o(wt,{className:"text-xl font-bold flex items-center gap-2",children:[t(Ws,{className:"h-5 w-5 text-primary"}),Rf()]}),t(kt,{className:"mt-1",children:y_()})]}),q>0&&o(he,{variant:"secondary",className:"w-fit text-xs font-normal",children:[q," ",Rf()]})]}),o("div",{className:"mt-4 flex flex-wrap items-center gap-3 pt-4 border-t border-border/40",children:[o(At,{children:[t(_t,{asChild:!0,children:o(C,{variant:"outline",size:"sm",className:"h-9 gap-2 text-xs border-dashed",children:[t(J,{className:"h-3.5 w-3.5"}),kv(),e.length>0&&t(he,{variant:"secondary",className:"ml-1 px-1.5 py-0 text-[10px]",children:e.length})]})}),o(yt,{className:"w-64 p-2",align:"start",children:[t("div",{className:"text-xs font-semibold text-muted-foreground px-2 py-1 mb-1",children:aI()}),t("div",{className:"max-h-60 overflow-y-auto space-y-1 pr-1",children:Ue.map((l)=>o("label",{className:"flex items-center gap-2 px-2 py-1.5 hover:bg-accent rounded-md cursor-pointer text-xs",children:[t(wr,{checked:e.includes(l),onCheckedChange:()=>R(l)}),t("span",{className:"font-mono",children:l})]},l))}),e.length>0&&t(C,{variant:"ghost",size:"sm",className:"w-full mt-2 h-7 text-xs text-muted-foreground hover:text-foreground",onClick:()=>s([]),children:"Clear Actions"})]})]}),o(At,{children:[t(_t,{asChild:!0,children:o(C,{variant:"outline",size:"sm",className:"h-9 gap-2 text-xs border-dashed",children:[t(J,{className:"h-3.5 w-3.5"}),Rv(),i.length>0&&t(he,{variant:"secondary",className:"ml-1 px-1.5 py-0 text-[10px]",children:i.length})]})}),o(yt,{className:"w-64 p-2",align:"start",children:[t("div",{className:"text-xs font-semibold text-muted-foreground px-2 py-1 mb-1",children:wI()}),t("div",{className:"max-h-60 overflow-y-auto space-y-1 pr-1",children:p.map((l)=>{let T=l.userId||l.user?.id||l.id,k=l.user?.name||l.name||T,K=l.user?.image||l.image;return o("label",{className:"flex items-center gap-2 px-2 py-1.5 hover:bg-accent rounded-md cursor-pointer text-xs",children:[t(wr,{checked:i.includes(T),onCheckedChange:()=>j(T)}),o(Ce,{className:"h-5 w-5",children:[t(Ie,{src:K||void 0}),t(Te,{className:"text-[10px]",children:k.slice(0,2).toUpperCase()})]}),t("span",{className:"truncate",children:k})]},T)})}),i.length>0&&t(C,{variant:"ghost",size:"sm",className:"w-full mt-2 h-7 text-xs text-muted-foreground hover:text-foreground",onClick:()=>c([]),children:"Clear Users"})]})]}),o("div",{className:"relative flex-1 min-w-[200px] max-w-xs",children:[t(Ut,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),t(z,{type:"text",placeholder:oI(),value:r,onChange:(l)=>f(l.target.value),className:"pl-8 pr-8 h-9 text-xs"}),r&&t("button",{onClick:()=>f(""),className:"absolute right-2.5 top-2.5 text-muted-foreground hover:text-foreground",children:t(Ne,{className:"h-4 w-4"})})]}),(e.length>0||i.length>0||r)&&t(C,{variant:"ghost",size:"sm",className:"h-9 px-2 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{s([]),c([]),f("")},children:"Clear all"})]})]}),o(at,{className:"p-0",children:[N?t("div",{className:"flex h-64 items-center justify-center",children:t(O,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):n?t("div",{className:"p-8 text-center text-sm text-destructive",children:"Failed to load audit logs."}):w.length===0?t("div",{className:"p-12 text-center text-sm text-muted-foreground",children:pS()}):o(Pn,{children:[t(Nn,{children:o(xr,{className:"hover:bg-transparent border-b border-border/50",children:[t(It,{className:"w-[180px] text-xs font-semibold",children:$A()}),t(It,{className:"w-[200px] text-xs font-semibold",children:L1()}),t(It,{className:"text-xs font-semibold",children:Pw()}),t(It,{className:"text-xs font-semibold",children:NE()}),t(It,{className:"w-[160px] text-right text-xs font-semibold",children:r1()})]})}),t(Dn,{children:w.map((l)=>{let T=l.userId?ge.get(l.userId):null,k=T?.user?.name||T?.name||l.userId||"System",K=T?.user?.image||T?.image;return o(xr,{className:"hover:bg-muted/40 transition-colors",children:[t(xt,{className:"py-3 font-medium",children:fe(l.action)}),t(xt,{className:"py-3",children:o("div",{className:"flex items-center gap-2",children:[o(Ce,{className:"h-6 w-6",children:[t(Ie,{src:K||void 0}),t(Te,{className:"text-[10px]",children:k.slice(0,2).toUpperCase()})]}),t("span",{className:"text-xs font-medium text-foreground truncate max-w-[160px]",children:l.agent?Xc({user:k,agent:l.agent.name}):k}),l.agent&&t(Tt,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"})]})}),t(xt,{className:"py-3 text-xs font-mono text-muted-foreground",children:l.itemId||"-"}),t(xt,{className:"py-3 text-xs font-mono text-muted-foreground",children:l.projectId||"-"}),t(xt,{className:"py-3 text-right text-xs text-muted-foreground",children:kn(l.createdAt)})]},l.id)})})]}),t("div",{ref:g,className:"py-4 flex justify-center",children:h&&t(O,{className:"h-6 w-6 animate-spin text-muted-foreground"})})]})]})})}function $e(){let{teamId:a}=Ge.useParams(),[e,s]=u("audit-logs"),{data:i,isLoading:c}=Z({queryKey:["teams",a,"me"],queryFn:async()=>{let r=await A.api.teams[":teamId"].me.$get({param:{teamId:a}});if(!r.ok)throw Error("Failed to fetch me");return await r.json()},enabled:!!a});if(c)return t("div",{className:"flex h-screen items-center justify-center",children:t(O,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(i?.role?.toLowerCase()!=="owner")return o("div",{className:"flex h-full flex-col items-center justify-center p-8 text-center",children:[t(Jl,{className:"h-12 w-12 text-destructive mb-4"}),t("h2",{className:"text-xl font-bold tracking-tight mb-2",children:HA()}),t("p",{className:"text-sm text-muted-foreground max-w-md",children:BS()})]});return t("div",{className:"h-full bg-background font-sans selection:bg-primary/20 transition-colors duration-300",children:o("div",{className:"flex flex-col md:flex-row h-full",children:[t("div",{className:"w-full h-full md:w-72 bg-sidebar border-b md:border-b-0 md:border-r border-sidebar-border z-10 md:left-16 overflow-y-auto transition-colors duration-300",children:o("nav",{className:"p-4 space-y-1 mt-4",children:[t("div",{className:"mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider",children:mh()}),t("div",{className:"mt-4 mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider pt-4 border-t border-sidebar-border",children:LT()}),o("button",{onClick:()=>s("audit-logs"),className:E("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",e==="audit-logs"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[t(Ws,{className:"w-5 h-5"}),Rf(),e==="audit-logs"&&t("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]}),o("button",{onClick:()=>s("quotas"),className:E("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",e==="quotas"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[t(zo,{className:"w-5 h-5"}),Ud(),e==="quotas"&&t("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]}),t("div",{className:"mt-4 mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider pt-4 border-t border-sidebar-border",children:G0()}),o("button",{onClick:()=>s("ai-usage"),className:E("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",e==="ai-usage"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[t(ie,{className:"w-5 h-5"}),F1(),e==="ai-usage"&&t("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]}),o("button",{onClick:()=>s("ai-sessions"),className:E("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",e==="ai-sessions"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[t(Q,{className:"w-5 h-5"}),dA(),e==="ai-sessions"&&t("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]})]})}),t("div",{className:"flex-1 overflow-y-auto p-4 md:p-8",children:o("div",{className:"max-w-6xl mx-auto space-y-8",children:[e==="audit-logs"&&t(pe,{teamId:a}),e==="ai-usage"&&t(ne,{teamId:a}),e==="ai-sessions"&&t(le,{teamId:a}),e==="quotas"&&t(ue,{teamId:a})]})})]})})}var Ge=ze("/teams/$teamId/dashboard")({component:$e});export{Ge as Route};
1
+ import{F,P,m,D,_,u,Xn,S,L,t,o,V,Hu,$u,br,Dc,Yi,wo,Ht,Yo,Gu,Vu,Qu,Ku,Oc,Wu,Z,B,mt,ze,A,I,ir,O,Tt,ve,er,Ut,Jo,Ne,C,gt,ye,Y,Pt,Er,Lt,se,cr,E,Ce,Ie,Te,qA,HA,V0,W0,Y0,Rf,b_,sh,De,na,uh,Ty,qc,mh,Hs,Xo,kh,Rh,Rv,Pv,$h,Nw,Nx,Dx,pS,dp,fp,IS,BS,bg,Kc,NE,Ug,XE,tC,vp,nC,iC,jg,lC,cC,qg,uC,fC,Ld,Zd,Bd,Nl,Ip,bC,vC,wC,xC,Ud,Gs,qC,oI,aI,wI,NI,OI,FI,LI,ZI,uA,BI,$d,FT,UT,t1,xA,An,Qp,O1,F1,tu,Xe,et,tt,rt,nt,ot,st,it,z,Nt,M,Bl,kn,em,me,At,_t,yt,wr,af,Ke,vt,wt,kt,at}from"./chunk-qx553512.js";import{Ro,yr}from"./chunk-cqnected.js";import{Yl}from"./chunk-2pt9h882.js";import{Ys,zo,tc,Xa,Oi,rc}from"./chunk-eshwjf91.js";import{Pn,Nn,Dn,xr,It,xt}from"./chunk-k3ds96cb.js";import"./chunk-tqdde9bj.js";import"./chunk-03zkxckm.js";import{Kn,co}from"./chunk-4nkwe7dz.js";S();function te(a,e){let s=new Set(e);return a.filter((i)=>!s.has(i))}var ae=class extends wo{#r;#e;#o;#a;#t;#s;#i;#n;#l;#d=[];constructor(a,e,s){super();this.#r=a,this.#a=s,this.#o=[],this.#t=[],this.#e=[],this.setQueries(e)}onSubscribe(){if(this.listeners.size===1)this.#t.forEach((a)=>{a.subscribe((e)=>{this.#p(a,e)})})}onUnsubscribe(){if(!this.listeners.size)this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach((a)=>{a.destroy()})}setQueries(a,e){this.#o=a,this.#a=e,Ht.batch(()=>{let s=this.#t,i=this.#u(this.#o);i.forEach((p)=>p.observer.setOptions(p.defaultedQueryOptions));let c=i.map((p)=>p.observer),r=c.map((p)=>p.getCurrentResult()),f=s.length!==c.length,g=c.some((p,x)=>p!==s[x]),b=f||g,v=b?!0:r.some((p,x)=>{let N=this.#e[x];return!N||!Yi(p,N)});if(!b&&!v)return;if(b)this.#d=i,this.#t=c;if(this.#e=r,!this.hasListeners())return;if(b)te(s,c).forEach((p)=>{p.destroy()}),te(c,s).forEach((p)=>{p.subscribe((x)=>{this.#p(p,x)})});this.#f()})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map((a)=>a.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(a,e){let s=this.#u(a),i=s.map((r)=>r.observer.getOptimisticResult(r.defaultedQueryOptions)),c=s.map((r)=>r.defaultedQueryOptions.queryHash);return[i,(r)=>this.#c(r??i,e,c),()=>this.#m(i,s)]}#m(a,e){let s=new Set;return e.map((i,c)=>{let r=a[c];return!i.defaultedQueryOptions.notifyOnChangeProps?i.observer.trackResult(r,(f)=>{if(!s.has(f))s.add(f),e.forEach((g)=>{g.observer.trackProp(f)})}):r})}#c(a,e,s){if(e){let i=this.#l,c=s!==void 0&&i!==void 0&&(i.length!==s.length||s.some((r,f)=>r!==i[f]));if(this.#e!==this.#n||c||e!==this.#i){if(this.#i=e,this.#n=this.#e,s!==void 0)this.#l=s;this.#s=Dc(this.#s,e(a))}return this.#s}return a}#g(){return!this.#a?.combine||this.#t.some((a,e)=>a.options.suspense&&this.#e[e]?.data===void 0)}#u(a){let e=new Map;this.#t.forEach((i)=>{let c=i.options.queryHash;if(!c)return;let r=e.get(c);if(r)r.push(i);else e.set(c,[i])});let s=[];return a.forEach((i)=>{let c=this.#r.defaultQueryOptions(i),r=e.get(c.queryHash)?.shift()??new Yo(this.#r,c);s.push({defaultedQueryOptions:c,observer:r})}),s}#p(a,e){let s=this.#t.indexOf(a);if(s!==-1)this.#e=this.#e.slice(),this.#e[s]=e,this.#f()}#f(){if(this.hasListeners()){let a=this.#g(),e=this.#s,s=a?e:this.#c(this.#m(this.#e,this.#d),this.#a?.combine);if(a||e!==s)Ht.batch(()=>{this.listeners.forEach((i)=>{i(this.#e)})})}}};S();function re({queries:a,...e},s){let i=V(s),c=Hu(),r=$u(),f=e.subscribed!==!1,g=D(()=>a.map((d)=>{let h=i.defaultQueryOptions(d);return h._optimisticResults=c?"isRestoring":f?"optimistic":void 0,h}),[a,i,c,f]);g.forEach((d)=>{Ku(d);let h=i.getQueryCache().get(d.queryHash);Gu(d,r,h)}),Vu(r);let[b]=u(()=>new ae(i,g,e)),[v,p,x]=b.getOptimisticResult(g,e.combine),N=!c&&f;Xn(P((d)=>N?b.subscribe(Ht.batchCalls(d)):br,[b,N]),()=>b.getCurrentResult(),()=>b.getCurrentResult()),m(()=>{b.setQueries(g,e)},[g,e,b]);let n=v.some((d,h)=>Oc(g[h],d))?v.flatMap((d,h)=>{let w=g[h];if(w&&Oc(w,d)){let q=new Yo(i,w);return Wu(w,q,r)}return[]}):[];if(n.length>0)throw Promise.all(n);let y=v.find((d,h)=>{let w=g[h];return w&&Qu({result:d,errorResetBoundary:r,throwOnError:w.throwOnError,query:i.getQueryCache().get(w.queryHash),suspense:w.suspense})});if(y)throw y.error;return p(x())}S();S();var xe=Object.defineProperty,H=(a,e)=>xe(a,"name",{value:e,configurable:!0}),W="Collapsible",[we,Mt]=gt(W),[_e,X]=we(W),Re=F(H(function(e,s){let{__scopeCollapsible:i,open:c,defaultOpen:r,disabled:f,onOpenChange:g,...b}=e,[v,p]=Lt({prop:c,defaultProp:r??!1,onChange:g,caller:W});return t(_e,{scope:i,disabled:f,contentId:Er(),open:v,onOpenToggle:P(()=>p((x)=>!x),[p]),children:t(se.div,{"data-state":U(v),"data-disabled":f?"":void 0,...b,ref:s})})},"Collapsible")),ke="CollapsibleTrigger",Ae=F(H(function(e,s){let{__scopeCollapsible:i,...c}=e,r=X(ke,i);return t(se.button,{type:"button","aria-controls":r.open?r.contentId:void 0,"aria-expanded":r.open||!1,"data-state":U(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...c,ref:s,onClick:Y(e.onClick,r.onOpenToggle)})},"CollapsibleTrigger")),oe="CollapsibleContent",qe=F(H(function(e,s){let{forceMount:i,...c}=e,r=X(oe,e.__scopeCollapsible);return t(cr,{present:i||r.open,children:({present:f})=>t(Pe,{...c,ref:s,present:f})})},"CollapsibleContent")),Pe=F(H(function(e,s){let{__scopeCollapsible:i,present:c,children:r,...f}=e,g=X(oe,i),[b,v]=u(c),p=_(null),x=ye(s,p),N=_(0),n=N.current,y=_(0),d=y.current,h=g.open||b,w=_(h),q=_(void 0);return m(()=>{let R=requestAnimationFrame(()=>w.current=!1);return()=>cancelAnimationFrame(R)},[]),Pt(()=>{let R=p.current;if(R){q.current=q.current||{transitionDuration:R.style.transitionDuration,animationName:R.style.animationName},R.style.transitionDuration="0s",R.style.animationName="none";let j=R.getBoundingClientRect();if(N.current=j.height,y.current=j.width,!w.current)R.style.transitionDuration=q.current.transitionDuration,R.style.animationName=q.current.animationName;v(c)}},[g.open,c]),t(se.div,{"data-state":U(g.open),"data-disabled":g.disabled?"":void 0,id:g.contentId,hidden:!h,...f,ref:x,style:{["--radix-collapsible-content-height"]:n?`${n}px`:void 0,["--radix-collapsible-content-width"]:d?`${d}px`:void 0,...e.style},children:h&&r})},"CollapsibleContentImpl"));function U(a){return a?"open":"closed"}H(U,"getState");var Se=Re;var He=[["path",{d:"M5 21v-6",key:"1hz6c0"}],["path",{d:"M12 21V3",key:"1lcnhd"}],["path",{d:"M19 21V9",key:"unv183"}]],ie=I("chart-no-axes-column",He);var Oe=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],J=I("funnel",Oe);var Qe=[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z",key:"1n2ejm"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1",key:"1qfcsi"}]],Q=I("messages-square",Qe);function ne({teamId:a}){let[e,s]=u("team"),[i,c]=u("1h"),{data:r,isLoading:f}=Z({queryKey:["teams",a,"ai-usage",i,"team"],queryFn:async()=>{let d=await A.api.teams[":teamId"]["ai-usage"].$get({param:{teamId:a},query:{timeframe:i}});if(!d.ok)throw Error("Failed to fetch team AI usage");return await d.json()},enabled:!!a&&e==="team"}),{data:g,isLoading:b}=Z({queryKey:["teams",a,"members"],queryFn:async()=>{let d=await A.api.teams[":teamId"].members.$get({param:{teamId:a},query:{}});if(!d.ok)throw Error("Failed to fetch team members");return await d.json()},enabled:!!a&&e==="members"}),v=re({queries:(g||[]).map((d)=>({queryKey:["teams",a,"ai-usage",i,d.id],queryFn:async()=>{let h=await A.api.teams[":teamId"]["ai-usage"].$get({param:{teamId:a},query:{timeframe:i,userId:d.id}});if(!h.ok)throw Error(`Failed to fetch AI usage for member ${d.id}`);return await h.json()},enabled:!!a&&e==="members"}))}),p=b||v.some((d)=>d.isLoading),x=(d)=>{if(!d)return"U";let h=d.split(" ");if(h.length>1)return`${h[0][0]}${h[h.length-1][0]}`.toUpperCase();return d.substring(0,2).toUpperCase()},N=(d)=>{if(!d)return"";switch(d.toLowerCase()){case"owner":return Kc();case"editor":return Hs();case"reviewer":return Gs();default:return d}},n=(d)=>(d??0).toLocaleString(),y=(d)=>`$${(d??0).toFixed(6)}`;return o(Ke,{className:"border-border/60 shadow-sm",children:[o(vt,{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between pb-6",children:[o("div",{children:[t(wt,{className:"text-xl font-semibold tracking-tight",children:W0()}),t(kt,{className:"text-sm text-muted-foreground mt-1",children:Y0()})]}),o("div",{className:"flex flex-wrap items-center gap-3",children:[o(Ro,{type:"single",value:e,onValueChange:(d)=>{if(d)s(d)},className:"border rounded-lg p-1 bg-muted/30",children:[t(yr,{value:"team",className:"px-3 py-1.5 text-xs font-medium",children:UT()}),t(yr,{value:"members",className:"px-3 py-1.5 text-xs font-medium",children:Dx()})]}),o(Ro,{type:"single",value:i,onValueChange:(d)=>{if(d)c(d)},className:"border rounded-lg p-1 bg-muted/30",children:[t(yr,{value:"1h",className:"px-2.5 py-1.5 text-xs font-medium",children:"1h"}),t(yr,{value:"24h",className:"px-2.5 py-1.5 text-xs font-medium",children:"24h"}),t(yr,{value:"7d",className:"px-2.5 py-1.5 text-xs font-medium",children:"7d"}),t(yr,{value:"30d",className:"px-2.5 py-1.5 text-xs font-medium",children:"30d"})]})]})]}),t(at,{children:e==="team"?f?t("div",{className:"flex h-48 items-center justify-center",children:t(O,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):t("div",{className:"rounded-md border",children:o(Pn,{children:[t(Nn,{children:o(xr,{children:[t(It,{children:$d()}),t(It,{className:"text-right",children:$h()}),t(It,{className:"text-right",children:bg()}),t(It,{className:"text-right",children:sh()}),t(It,{className:"text-right",children:xA()}),t(It,{className:"text-right",children:uh()})]})}),t(Dn,{children:o(xr,{children:[t(xt,{className:"font-medium",children:$d()}),t(xt,{className:"text-right",children:n(r?.team?.inputTokens)}),t(xt,{className:"text-right",children:n(r?.team?.outputTokens)}),t(xt,{className:"text-right",children:n(r?.team?.cacheReadTokens)}),t(xt,{className:"text-right font-medium",children:n(r?.team?.totalTokens)}),t(xt,{className:"text-right font-medium",children:y(r?.team?.cost)})]})})]})}):p?t("div",{className:"flex h-48 items-center justify-center",children:t(O,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):t("div",{className:"rounded-md border",children:o(Pn,{children:[t(Nn,{children:o(xr,{children:[t(It,{children:Nx()}),t(It,{children:qC()}),t(It,{className:"text-right",children:$h()}),t(It,{className:"text-right",children:bg()}),t(It,{className:"text-right",children:sh()}),t(It,{className:"text-right",children:xA()}),t(It,{className:"text-right",children:uh()})]})}),t(Dn,{children:(g||[]).map((d,h)=>{let w=v[h]?.data?.member;return o(xr,{children:[t(xt,{children:o("div",{className:"flex items-center gap-3",children:[o(Ce,{className:"h-8 w-8 rounded-full",children:[d.image&&t(Ie,{src:d.image,alt:d.name,className:"object-cover"}),t(Te,{className:"bg-primary/20 text-xs",children:x(d.name)})]}),o("div",{className:"flex flex-col",children:[t("span",{className:"text-sm font-medium leading-none",children:d.name}),t("span",{className:"text-xs text-muted-foreground mt-0.5",children:d.email})]})]})}),t(xt,{className:"text-xs text-muted-foreground",children:N(d.role)}),t(xt,{className:"text-right",children:n(w?.inputTokens)}),t(xt,{className:"text-right",children:n(w?.outputTokens)}),t(xt,{className:"text-right",children:n(w?.cacheReadTokens)}),t(xt,{className:"text-right font-medium",children:n(w?.totalTokens)}),t(xt,{className:"text-right font-medium",children:y(w?.cost)})]},d.id)})})]})})})]})}S();function le({teamId:a}){let[e,s]=u(null),{ref:i,inView:c}=Nt(),{data:r,isLoading:f,isError:g,fetchNextPage:b,hasNextPage:v,isFetchingNextPage:p}=mt({queryKey:["teams",a,"agent-sessions"],queryFn:async({pageParam:n})=>{let y=await A.api.teams[":teamId"]["agent-sessions"].$get({param:{teamId:a},query:{first:"20",after:n?String(n):void 0}});if(!y.ok)throw Error("Failed to fetch agent sessions");return await y.json()},initialPageParam:"",getNextPageParam:(n)=>n.pageInfo.cursor||void 0,enabled:!!a});m(()=>{if(c&&v&&!p)b()},[c,v,p,b]);let x=r?.pages.flatMap((n)=>n.data).filter((n)=>n.id!=="pending")||[],N=(n)=>{switch(n){case"comment":return t(me,{variant:"outline",className:"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20",children:LI()});case"chat":return t(me,{variant:"outline",className:"bg-violet-500/10 text-violet-600 dark:text-violet-400 border-violet-500/20",children:FI()});case"naming":return t(me,{variant:"outline",className:"bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/20",children:ZI()});default:return t(me,{variant:"outline",className:"bg-muted text-muted-foreground border-border",children:n})}};return o("div",{className:"space-y-6",children:[o(Ke,{className:"border border-border/50 shadow-xs",children:[t(vt,{className:"pb-4",children:t("div",{className:"flex items-center justify-between",children:o("div",{children:[o(wt,{className:"text-xl font-bold flex items-center gap-2",children:[t(Q,{className:"w-5 h-5 text-violet-500"}),uA()]}),t(kt,{className:"mt-1 text-sm text-muted-foreground",children:BI()})]})})}),t(at,{children:f?t("div",{className:"flex h-64 items-center justify-center",children:t(O,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):g?t("div",{className:"flex h-64 items-center justify-center text-destructive",children:"Failed to load agent sessions."}):x.length===0?o("div",{className:"flex flex-col items-center justify-center py-12 text-center text-muted-foreground",children:[t(Q,{className:"w-10 h-10 text-muted-foreground/40 mb-3"}),t("p",{className:"text-base font-medium",children:IS()})]}):o("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[o(Pn,{children:[t(Nn,{className:"bg-muted/40",children:o(xr,{children:[t(It,{children:NI()}),t(It,{children:qc()}),t(It,{children:OI()}),t(It,{className:"text-right",children:Ty()})]})}),t(Dn,{children:x.map((n)=>o(xr,{onClick:()=>s(n.id),className:"cursor-pointer hover:bg-muted/50 transition-colors",children:[t(xt,{className:"font-medium",children:o("div",{className:"flex flex-col",children:[t("span",{className:"text-sm font-semibold text-foreground",children:n.name||Qp()}),t("span",{className:"text-xs font-mono text-muted-foreground/70",children:n.id})]})}),t(xt,{children:o("div",{className:"flex items-center gap-2",children:[o(Ce,{className:"h-6 w-6",children:[t(Ie,{src:n.creator?.image||void 0}),t(Te,{className:"text-[10px]",children:n.creator?.name?.[0]?.toUpperCase()||"?"})]}),t("span",{className:"text-sm text-foreground/90",children:n.creator?.name||"System / Agent"})]})}),t(xt,{children:N(n.type)}),t(xt,{className:"text-right text-xs text-muted-foreground",children:kn(n.createdAt)})]},n.id))})]}),t("div",{ref:i,className:"py-4 flex justify-center",children:p&&t(O,{className:"h-6 w-6 animate-spin text-muted-foreground"})})]})})]}),t(Yl,{sessionId:e,open:!!e,onOpenChange:(n)=>{if(!n)s(null)}})]})}S();function de({...a}){return t(Se,{"data-slot":"collapsible",...a})}function ce({...a}){return t(Ae,{"data-slot":"collapsible-trigger",...a})}function ue({...a}){return t(qe,{"data-slot":"collapsible-content",...a})}function ee(a){switch(a.toLowerCase()){case"owner":return Kc();case"editor":return Hs();case"reviewer":return Gs();default:return a}}function Le(a,e){if(typeof a==="object"&&a!==null&&"message"in a){let s=a.message;if(typeof s==="string")return s}return e}function Be({rule:a}){let e=a.resourceData??{};if(a.resource==="agent_mcp_call_count")return t("span",{children:vC({value:String(e.id??"")})});if(a.resource==="agent_bash_call_count")return t("span",{children:bC({value:String(e.match??"*")})});if(a.resource==="agent_tool_call_count")return t("span",{children:wC({value:String(e.name??e.toolName??"*")})});return null}function Me({rule:a}){if(a.scopeMode==="all_members")return o(me,{variant:"secondary",className:"gap-1 text-xs",children:[t(co,{className:"h-3 w-3"}),o("span",{children:[Ld(),a.role?` (${ee(a.role)})`:` (${Nl()})`]})]});if(a.scopeMode==="each_member")return o(me,{variant:"secondary",className:"gap-1 text-xs",children:[t(Kn,{className:"h-3 w-3"}),o("span",{children:[Zd(),a.role?` (${ee(a.role)})`:` (${Nl()})`]})]});return o(me,{variant:"secondary",className:"gap-1 text-xs",children:[t(Jo,{className:"h-3 w-3"}),o("span",{children:[Bd()," (",a.userIds?.length||0,")"]})]})}function Fe({teamId:a,rule:e,record:s}){let i=V(),[c,r]=u(!1),[f,g]=u(()=>new Date),b=Xa[e.resource],v=e.scopeMode==="all_members",p=s.percent>=100,x=v?e.role?`${fC()}: ${ee(e.role)}`:xC():s.user?.name||s.userId||An();m(()=>{if(!s.isWindowActive||!s.periodEnd)return;let n=window.setInterval(()=>g(new Date),60000);return()=>window.clearInterval(n)},[s.isWindowActive,s.periodEnd]);let N=B({mutationFn:async()=>{let n=await A.api.teams[":teamId"].quotas[":id"].records.reset.$post({param:{teamId:a,id:e.id},json:{userId:s.userId??null}});if(!n.ok){let y=await n.json().catch(()=>null);throw Error(Le(y,Rh()))}return await n.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["teams",a,"quotas",e.id,"records"]}),i.invalidateQueries({queryKey:["teams",a,"quotas"]}),r(!1),M.success(cC())},onError:(n)=>{let y=n instanceof Error?n.message:Rh();r(!1),M.error(y)}});return o(L,{children:[o("div",{className:"space-y-3 rounded-xl border border-border/70 bg-card p-4 text-card-foreground shadow-2xs",children:[o("div",{className:"flex items-center justify-between gap-3",children:[o("div",{className:"flex min-w-0 items-center gap-3",children:[v?t("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:t(co,{className:"h-5 w-5"})}):o(Ce,{className:"h-9 w-9 shrink-0 border border-border/50",children:[t(Ie,{src:s.user?.image||void 0}),t(Te,{className:"text-xs font-semibold",children:s.user?.name?.[0]?.toUpperCase()||"U"})]}),o("div",{className:"min-w-0",children:[t("div",{className:"truncate text-sm font-semibold text-foreground",children:x}),!v&&s.user?.email&&t("div",{className:"truncate text-xs text-muted-foreground",children:s.user.email})]})]}),o("div",{className:"flex shrink-0 items-center gap-2",children:[s.isWindowActive&&s.periodEnd?o(me,{variant:"outline",className:"hidden gap-1 border-primary/30 bg-primary/5 text-xs text-primary sm:flex",children:[t(er,{className:"h-3 w-3"}),t("span",{children:jg({time:em(s.periodEnd,f)})})]}):o(me,{variant:"secondary",className:"hidden gap-1 text-xs text-muted-foreground sm:flex",children:[t(ir,{className:"h-3 w-3 text-primary"}),t("span",{children:Ug()})]}),o(E,{type:"button",variant:"outline",size:"sm",className:"gap-1.5",onClick:()=>r(!0),disabled:N.isPending,children:[N.isPending?t(O,{className:"h-3.5 w-3.5 animate-spin"}):t(Ys,{className:"h-3.5 w-3.5"}),qg()]})]})]}),o("div",{className:"space-y-1.5 pt-1",children:[t(af,{value:Math.min(100,Math.max(0,s.percent)),className:"h-2"}),o("div",{className:"flex items-center justify-between gap-2 text-xs font-medium",children:[o("span",{className:p?"font-bold text-destructive":"text-foreground",children:[Oi(e.resource,s.consumed)," /"," ",Oi(e.resource,e.limit)," ",b?.unit]}),o("span",{className:p?"font-bold text-destructive":"text-muted-foreground",children:[s.percent,"%"]})]})]}),o("div",{className:"flex items-center justify-between gap-2 text-xs text-muted-foreground sm:hidden",children:[s.isWindowActive&&s.periodEnd?o("span",{className:"flex items-center gap-1 text-primary",children:[t(er,{className:"h-3 w-3"}),jg({time:em(s.periodEnd,f)})]}):o("span",{className:"flex items-center gap-1",children:[t(ir,{className:"h-3 w-3 text-primary"}),Ug()]}),o("span",{children:[lC(),": ",Oi(e.resource,s.remaining)," ",b?.unit]})]})]}),t(Xe,{open:c,onOpenChange:r,children:o(et,{children:[o(tt,{children:[t(nt,{children:qg()}),t(ot,{children:uC({target:x})})]}),o(rt,{children:[t(it,{disabled:N.isPending,children:De()}),o(st,{onClick:(n)=>{n.preventDefault(),N.mutate()},disabled:N.isPending,children:[N.isPending&&t(O,{className:"mr-2 h-4 w-4 animate-spin"}),na()]})]})]})})]})}function je({teamId:a,rule:e}){let[s,i]=u(!1),[c,r]=u(""),f=Xa[e.resource],g=f?.icon||zo,{data:b,isLoading:v,isError:p}=Z({queryKey:["teams",a,"quotas",e.id,"records"],queryFn:async()=>{let n=await A.api.teams[":teamId"].quotas[":id"].records.$get({param:{teamId:a,id:e.id}});if(!n.ok)throw Error(kh());return await n.json()},enabled:s,refetchInterval:s?1e4:!1}),x=b?.records??[],N=x.filter((n)=>{if(!c.trim())return!0;let y=c.toLowerCase();return n.user?.name.toLowerCase().includes(y)||n.user?.email.toLowerCase().includes(y)});return o(de,{open:s,onOpenChange:i,className:"rounded-xl border border-border/70",children:[t(ce,{asChild:!0,children:o("button",{type:"button","aria-label":s?XE():nC(),className:"flex w-full items-center justify-between gap-4 p-4 text-left transition-colors hover:bg-muted/40",children:[o("div",{className:"flex min-w-0 items-start gap-3",children:[t("div",{className:"mt-0.5 rounded-lg bg-primary/10 p-2 text-primary",children:t(g,{className:"h-5 w-5"})}),o("div",{className:"min-w-0",children:[o("div",{className:"flex flex-wrap items-center gap-2",children:[t("span",{className:"font-semibold text-foreground",children:f?.label()||e.resource}),!e.enabled&&t(me,{variant:"secondary",children:vp()})]}),o("div",{className:"mt-1 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground",children:[t(Me,{rule:e}),o(me,{variant:"outline",className:"gap-1 text-xs",children:[t(er,{className:"h-3 w-3"}),Oi(e.resource,e.limit)," ",f?.unit," /"," ",rc(e.period)]}),t(Be,{rule:e})]})]})]}),t(ve,{className:`h-5 w-5 shrink-0 text-muted-foreground transition-transform ${s?"rotate-180":""}`})]})}),t(ue,{children:o("div",{className:"space-y-3 border-t border-border/60 bg-muted/10 p-4",children:[e.scopeMode!=="all_members"&&x.length>3&&o("div",{className:"relative",children:[t(Ut,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),t(z,{value:c,onChange:(n)=>r(n.target.value),placeholder:Ip(),className:"h-9 pl-9 text-sm"})]}),v?t("div",{className:"flex justify-center py-10",children:t(O,{className:"h-7 w-7 animate-spin text-primary"})}):p?t("div",{className:"py-8 text-center text-sm text-destructive",children:kh()}):N.length===0?t("div",{className:"py-8 text-center text-sm text-muted-foreground",children:iC()}):N.map((n,y)=>t(Fe,{teamId:a,rule:e,record:n},n.id||n.userId||`record-${y}`))]})})]})}function pe({teamId:a}){let{data:e,isLoading:s,isError:i}=Z({queryKey:["teams",a,"quotas"],queryFn:async()=>{let r=await A.api.teams[":teamId"].quotas.$get({param:{teamId:a}});if(!r.ok)throw Error(Xo());return await r.json()},enabled:!!a}),c=e?.rules??[];return o(Ke,{className:"border-border/60 shadow-sm",children:[o(vt,{children:[o(wt,{className:"flex items-center gap-2 text-xl font-semibold tracking-tight",children:[t(zo,{className:"h-5 w-5 text-primary"}),Ud()]}),t(kt,{children:tC()})]}),t(at,{children:s?t("div",{className:"flex h-48 items-center justify-center",children:t(O,{className:"h-7 w-7 animate-spin text-muted-foreground"})}):i?t("div",{className:"py-10 text-center text-sm text-destructive",children:Xo()}):c.length===0?o("div",{className:"flex flex-col items-center justify-center rounded-xl border-2 border-dashed border-border py-12 text-center",children:[t(zo,{className:"mb-3 h-10 w-10 text-muted-foreground/50"}),t("p",{className:"text-base font-medium text-foreground",children:fp()}),t("p",{className:"mt-1 max-w-md text-sm text-muted-foreground",children:dp()})]}):t("div",{className:"space-y-3",children:c.map((r)=>t(je,{teamId:a,rule:r},r.id))})})]})}S();var Ue=Object.values(Bl);function fe({teamId:a}){let[e,s]=u([]),[i,c]=u([]),[r,f]=u(""),{ref:g,inView:b}=Nt(),{data:v}=Z({queryKey:["teams",a,"members"],queryFn:async()=>{let l=await A.api.teams[":teamId"].members.$get({param:{teamId:a},query:{}});if(!l.ok)return[];return await l.json()},enabled:!!a}),p=v||[],{data:x,isLoading:N,isError:n,fetchNextPage:y,hasNextPage:d,isFetchingNextPage:h}=mt({queryKey:["teams",a,"audit-logs",e,i,r],queryFn:async({pageParam:l})=>{let T=await A.api.teams[":teamId"]["audit-logs"].$get({param:{teamId:a},query:{first:"20",after:l?String(l):void 0,actions:e.length>0?e:void 0,userIds:i.length>0?i:void 0,itemId:r.trim()||void 0}});if(!T.ok)throw Error("Failed to fetch audit logs");return await T.json()},initialPageParam:"",getNextPageParam:(l)=>l.pageInfo.endCursor||void 0,enabled:!!a});m(()=>{if(b&&d&&!h)y()},[b,d,h,y]);let w=x?.pages.flatMap((l)=>l.nodes)||[],q=x?.pages[0]?.total??0,R=(l)=>{s((T)=>T.includes(l)?T.filter((k)=>k!==l):[...T,l])},j=(l)=>{c((T)=>T.includes(l)?T.filter((k)=>k!==l):[...T,l])},ge=(l)=>{if(l.includes("delete")||l.includes("remove")||l.includes("revoke"))return t(me,{variant:"outline",className:"bg-destructive/10 text-destructive border-destructive/20 font-mono text-xs",children:l});if(l.includes("create")||l.includes("add"))return t(me,{variant:"outline",className:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20 font-mono text-xs",children:l});if(l.includes("update")||l.includes("reparent")||l.includes("copy"))return t(me,{variant:"outline",className:"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20 font-mono text-xs",children:l});return t(me,{variant:"outline",className:"bg-muted text-muted-foreground border-border font-mono text-xs",children:l})},be=new Map(p.map((l)=>[l.userId||l.id,l]));return t("div",{className:"space-y-6",children:o(Ke,{className:"border border-border/50 shadow-xs",children:[o(vt,{className:"pb-4",children:[o("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[o("div",{children:[o(wt,{className:"text-xl font-bold flex items-center gap-2",children:[t(Ys,{className:"h-5 w-5 text-primary"}),Rf()]}),t(kt,{className:"mt-1",children:b_()})]}),q>0&&o(me,{variant:"secondary",className:"w-fit text-xs font-normal",children:[q," ",Rf()]})]}),o("div",{className:"mt-4 flex flex-wrap items-center gap-3 pt-4 border-t border-border/40",children:[o(At,{children:[t(_t,{asChild:!0,children:o(E,{variant:"outline",size:"sm",className:"h-9 gap-2 text-xs border-dashed",children:[t(J,{className:"h-3.5 w-3.5"}),Rv(),e.length>0&&t(me,{variant:"secondary",className:"ml-1 px-1.5 py-0 text-[10px]",children:e.length})]})}),o(yt,{className:"w-64 p-2",align:"start",children:[t("div",{className:"text-xs font-semibold text-muted-foreground px-2 py-1 mb-1",children:aI()}),t("div",{className:"max-h-60 overflow-y-auto space-y-1 pr-1",children:Ue.map((l)=>o("label",{className:"flex items-center gap-2 px-2 py-1.5 hover:bg-accent rounded-md cursor-pointer text-xs",children:[t(wr,{checked:e.includes(l),onCheckedChange:()=>R(l)}),t("span",{className:"font-mono",children:l})]},l))}),e.length>0&&t(E,{variant:"ghost",size:"sm",className:"w-full mt-2 h-7 text-xs text-muted-foreground hover:text-foreground",onClick:()=>s([]),children:"Clear Actions"})]})]}),o(At,{children:[t(_t,{asChild:!0,children:o(E,{variant:"outline",size:"sm",className:"h-9 gap-2 text-xs border-dashed",children:[t(J,{className:"h-3.5 w-3.5"}),Pv(),i.length>0&&t(me,{variant:"secondary",className:"ml-1 px-1.5 py-0 text-[10px]",children:i.length})]})}),o(yt,{className:"w-64 p-2",align:"start",children:[t("div",{className:"text-xs font-semibold text-muted-foreground px-2 py-1 mb-1",children:wI()}),t("div",{className:"max-h-60 overflow-y-auto space-y-1 pr-1",children:p.map((l)=>{let T=l.userId||l.user?.id||l.id,k=l.user?.name||l.name||T,K=l.user?.image||l.image;return o("label",{className:"flex items-center gap-2 px-2 py-1.5 hover:bg-accent rounded-md cursor-pointer text-xs",children:[t(wr,{checked:i.includes(T),onCheckedChange:()=>j(T)}),o(Ce,{className:"h-5 w-5",children:[t(Ie,{src:K||void 0}),t(Te,{className:"text-[10px]",children:k.slice(0,2).toUpperCase()})]}),t("span",{className:"truncate",children:k})]},T)})}),i.length>0&&t(E,{variant:"ghost",size:"sm",className:"w-full mt-2 h-7 text-xs text-muted-foreground hover:text-foreground",onClick:()=>c([]),children:"Clear Users"})]})]}),o("div",{className:"relative flex-1 min-w-[200px] max-w-xs",children:[t(Ut,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),t(z,{type:"text",placeholder:oI(),value:r,onChange:(l)=>f(l.target.value),className:"pl-8 pr-8 h-9 text-xs"}),r&&t("button",{onClick:()=>f(""),className:"absolute right-2.5 top-2.5 text-muted-foreground hover:text-foreground",children:t(Ne,{className:"h-4 w-4"})})]}),(e.length>0||i.length>0||r)&&t(E,{variant:"ghost",size:"sm",className:"h-9 px-2 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{s([]),c([]),f("")},children:"Clear all"})]})]}),o(at,{className:"p-0",children:[N?t("div",{className:"flex h-64 items-center justify-center",children:t(O,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):n?t("div",{className:"p-8 text-center text-sm text-destructive",children:"Failed to load audit logs."}):w.length===0?t("div",{className:"p-12 text-center text-sm text-muted-foreground",children:pS()}):o(Pn,{children:[t(Nn,{children:o(xr,{className:"hover:bg-transparent border-b border-border/50",children:[t(It,{className:"w-[180px] text-xs font-semibold",children:HA()}),t(It,{className:"w-[200px] text-xs font-semibold",children:F1()}),t(It,{className:"text-xs font-semibold",children:Nw()}),t(It,{className:"text-xs font-semibold",children:NE()}),t(It,{className:"w-[160px] text-right text-xs font-semibold",children:t1()})]})}),t(Dn,{children:w.map((l)=>{let T=l.userId?be.get(l.userId):null,k=T?.user?.name||T?.name||l.userId||"System",K=T?.user?.image||T?.image;return o(xr,{className:"hover:bg-muted/40 transition-colors",children:[t(xt,{className:"py-3 font-medium",children:ge(l.action)}),t(xt,{className:"py-3",children:o("div",{className:"flex items-center gap-2",children:[o(Ce,{className:"h-6 w-6",children:[t(Ie,{src:K||void 0}),t(Te,{className:"text-[10px]",children:k.slice(0,2).toUpperCase()})]}),t("span",{className:"text-xs font-medium text-foreground truncate max-w-[160px]",children:l.agent?tu({user:k,agent:l.agent.name}):k}),l.agent&&t(Tt,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"})]})}),t(xt,{className:"py-3 text-xs font-mono text-muted-foreground",children:l.itemId||"-"}),t(xt,{className:"py-3 text-xs font-mono text-muted-foreground",children:l.projectId||"-"}),t(xt,{className:"py-3 text-right text-xs text-muted-foreground",children:kn(l.createdAt)})]},l.id)})})]}),t("div",{ref:g,className:"py-4 flex justify-center",children:h&&t(O,{className:"h-6 w-6 animate-spin text-muted-foreground"})})]})]})})}function $e(){let{teamId:a}=Ge.useParams(),[e,s]=u("audit-logs"),{data:i,isLoading:c}=Z({queryKey:["teams",a,"me"],queryFn:async()=>{let r=await A.api.teams[":teamId"].me.$get({param:{teamId:a}});if(!r.ok)throw Error("Failed to fetch me");return await r.json()},enabled:!!a});if(c)return t("div",{className:"flex h-screen items-center justify-center",children:t(O,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(i?.role?.toLowerCase()!=="owner")return o("div",{className:"flex h-full flex-col items-center justify-center p-8 text-center",children:[t(tc,{className:"h-12 w-12 text-destructive mb-4"}),t("h2",{className:"text-xl font-bold tracking-tight mb-2",children:qA()}),t("p",{className:"text-sm text-muted-foreground max-w-md",children:BS()})]});return t("div",{className:"h-full bg-background font-sans selection:bg-primary/20 transition-colors duration-300",children:o("div",{className:"flex flex-col md:flex-row h-full",children:[t("div",{className:"w-full h-full md:w-72 bg-sidebar border-b md:border-b-0 md:border-r border-sidebar-border z-10 md:left-16 overflow-y-auto transition-colors duration-300",children:o("nav",{className:"p-4 space-y-1 mt-4",children:[t("div",{className:"mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider",children:mh()}),t("div",{className:"mt-4 mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider pt-4 border-t border-sidebar-border",children:FT()}),o("button",{onClick:()=>s("audit-logs"),className:C("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",e==="audit-logs"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[t(Ys,{className:"w-5 h-5"}),Rf(),e==="audit-logs"&&t("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]}),o("button",{onClick:()=>s("quotas"),className:C("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",e==="quotas"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[t(zo,{className:"w-5 h-5"}),Ud(),e==="quotas"&&t("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]}),t("div",{className:"mt-4 mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider pt-4 border-t border-sidebar-border",children:V0()}),o("button",{onClick:()=>s("ai-usage"),className:C("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",e==="ai-usage"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[t(ie,{className:"w-5 h-5"}),O1(),e==="ai-usage"&&t("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]}),o("button",{onClick:()=>s("ai-sessions"),className:C("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",e==="ai-sessions"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[t(Q,{className:"w-5 h-5"}),uA(),e==="ai-sessions"&&t("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]})]})}),t("div",{className:"flex-1 overflow-y-auto p-4 md:p-8",children:o("div",{className:"max-w-6xl mx-auto space-y-8",children:[e==="audit-logs"&&t(fe,{teamId:a}),e==="ai-usage"&&t(ne,{teamId:a}),e==="ai-sessions"&&t(le,{teamId:a}),e==="quotas"&&t(pe,{teamId:a})]})})]})})}var Ge=ze("/teams/$teamId/dashboard")({component:$e});export{Ge as Route};
@@ -1,2 +1,2 @@
1
- import{m,_,u,S,L,t,o,V,B,A,O,Kr,ve,Et,ht,Us,de,C,ge,Ae,_e,K,De,na,lh,ct,jc,qc,yh,Eb,Cb,Zh,Bh,Uh,ap,lp,cp,up,El,hg,pp,mp,Cg,Ig,Mp,Kg,mA,$p,p1,Kp,Wp,Xe,et,tt,rt,nt,ot,st,it,ue,ae,pe,qe,le,Mt,z,Ot,Nt,M,Jr,bn,UA}from"./chunk-42hrvk6k.js";import{lu,cu,uu,du,fu}from"./chunk-w4yjgez6.js";import{Uo}from"./chunk-04avc4fn.js";import{uo}from"./chunk-qxscgcn9.js";S();var Se=[];function $l({teamId:r,projectId:D,assetId:p,folders:a,files:l,totalFolders:Me,totalFiles:Re,totalFoldersSize:ze,totalFilesSize:Ue,selectedItem:J,selectedIds:w,onItemSelect:X,onItemDoubleClick:Y,onSaveField:Be,onClearSelection:$e,fetchNextFoldersPage:Z,hasNextFoldersPage:ee,isFetchingNextFoldersPage:y,fetchNextFilesPage:te,hasNextFilesPage:oe,isFetchingNextFilesPage:b,isRecentlyDeleted:x=!1,isRecents:k=!1,isLoading:se=!1,isShareView:q=!1,isPublic:ie=!1,shareId:Oe,allowDownload:re=!0}){let d=V(),{canEdit:N,canAdmin:We}=Ot(D),ne=_(null),ce=_(null),[W,je]=u(!0),[j,Qe]=u(!0),[He,F]=u(!1),[I,me]=u(""),[Ke,Q]=u(!1),fe=Me??a.length,he=Re??l.length,we=ze??(a.length>0?a.reduce((e,s)=>e+(s.sizeByte||0),0):-1),ye=Ue??(l.length>0?l.reduce((e,s)=>e+(s.sizeByte||0),0):-1),Le=we>-1,Pe=ye>-1,be=(e,s)=>{if(s)return e===1?lp({count:e}):ap({count:e});else return e===1?up({count:e}):cp({count:e})},{editingItemId:xe,setEditingItemId:ke,handleAction:Ce,onRenameSubmit:Ne,isDeleteDialogOpen:Ve,setIsDeleteDialogOpen:Ge,confirmDelete:Je,isDownloadDialogOpen:Ye,setIsDownloadDialogOpen:H,isLoadingLinks:T,resolvedFiles:Fe,startDownload:Ze}=fu({teamId:r,projectId:D,assetId:p,folders:a,files:l,selectedIds:w,isPublic:ie,shareId:Oe}),{ref:at,inView:Ie}=Nt();m(()=>{if(Ie){if(ee&&!y)Z();else if(oe&&!b)te()}},[Ie,ee,y,oe,b,Z,te]);let lt=bn((e)=>e.startTask),dt=A.api.teams[":teamId"].upload.tasks.$post,{mutate:mt}=B({mutationFn:async(e)=>{let s=await dt(e);if(!s.ok)throw Error("Failed to create upload task");return await s.json()},onMutate:()=>({files:[...Se]}),onSuccess:async(e,s,n)=>{let f=n?.files||[],g=f.map((i)=>{let v=e.createdAssets?.find((c)=>c.tempId===i.id),R=e.presignedUrls?.find((c)=>c.id===i.id);return{fileId:v?.assetId||R?.fileId||i.id,name:i.file.name,size:i.file.size}}).filter((i)=>!!i.fileId),h=f.filter((i)=>!i.file.name.startsWith(".")),E=h.length===1?h[0].file.name:`${h.length} Items`;if(e.taskId)lt(e.taskId,E,g);d.invalidateQueries({queryKey:["search",r,p]}),d.invalidateQueries({queryKey:["teams",r,"upload","tasks"]}),await cu({files:f,taskId:e.taskId,teamId:r,storageBackend:e.storageBackend||"local",createdAssets:e.createdAssets,presignedUrls:e.presignedUrls,onFileFinished:async()=>{await d.invalidateQueries({queryKey:["search",r,p]})}}),d.invalidateQueries({queryKey:["search",r,p]}),d.invalidateQueries({queryKey:["teams",r,"upload","tasks"]})}}),Te=(e)=>{if(!e||e.length===0)return;let s=[],n=[],f=new Map;for(let g of e){let h=(g.webkitRelativePath||g.name).split("/");if(h.some((U)=>U.startsWith(".")))continue;let E=h.pop(),i=n,v="";for(let U of h)if(v=`${v}/${U}`,!f.has(v)){let G=[],wt={name:U,type:"folder",id:Uo(),children:G,size:0};i.push(wt),f.set(v,G),i=G}else i=f.get(v);let R={file:g,id:Uo()};s.push(R);let c=g.type;if(E.toLowerCase().endsWith(".wma")&&c?.startsWith("video/"))c=c.replace(/^video\//,"audio/");i.push({name:E,size:g.size,type:"file",id:R.id,children:[],mediaType:c})}Se=s,mt({param:{teamId:r},json:{parentId:p,files:n}})},pt=A.api.folders.$post,{mutate:ut,isPending:Ee}=B({mutationFn:async(e)=>{let s=await pt({json:{name:e,parentId:p}});if(!s.ok)throw Error("Failed to create folder");return await s.json()},onSuccess:()=>{M.success(El()),F(!1),me(""),d.invalidateQueries({queryKey:["search",r,p]}),d.invalidateQueries({queryKey:["folders"]})},onError:(e)=>{M.error(`Error: ${e.message}`)}}),{mutate:ft,isPending:P}=B({mutationFn:async()=>{let e=await A.api.projects[":projectId"]["empty-trash"].$post({param:{projectId:D}});if(!e.ok)throw Error("Failed to empty trash");return await e.json()},onSuccess:()=>{M.success(p1()),d.invalidateQueries({queryKey:["projects",D,"recently-deleted"]}),$e(),Q(!1)},onError:(e)=>{M.error(`Error: ${e.message}`)}}),gt=(e)=>{if(e.preventDefault(),!I.trim())return;ut(I.trim())},vt=!se&&a.length===0&&l.length===0&&!y&&!b;return o("div",{className:"flex-1 flex flex-col min-h-0 bg-background overflow-hidden relative",children:[N&&o(L,{children:[t("input",{type:"file",ref:ne,multiple:!0,className:"hidden",onChange:(e)=>{if(e.target.files)Te(e.target.files)}}),t("input",{type:"file",ref:ce,multiple:!0,webkitdirectory:"true",className:"hidden",onChange:(e)=>{if(e.target.files)Te(e.target.files)}})]}),x&&o("div",{className:"flex items-center justify-between px-4 py-2.5 bg-muted/20 border-b border-border text-sm shrink-0",children:[o("div",{className:"flex items-center gap-2 text-muted-foreground",children:[t(Kr,{className:"h-4 w-4 text-amber-500 shrink-0"}),t("span",{className:"text-xs",children:Mp()})]}),We&&t(C,{variant:"destructive",size:"sm",disabled:P||a.length===0&&l.length===0,onClick:()=>Q(!0),className:"h-7 px-2.5 text-xs font-medium bg-destructive/10 text-destructive border border-destructive/20 hover:bg-destructive hover:text-destructive-foreground",children:"Delete"})]}),o("div",{className:"flex-1 overflow-y-auto min-h-0 p-3 pb-24",children:[se&&a.length===0&&l.length===0?t(UA,{}):o("div",{className:"max-w-lg mx-auto w-full",children:[fe>0&&o("div",{className:"mb-4",children:[o("button",{onClick:()=>je(!W),className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground mb-3 font-medium select-none cursor-pointer",children:[W?t(ve,{className:"h-4 w-4"}):t(Et,{className:"h-4 w-4"}),o("span",{children:[be(fe,!1),Le?` • ${Jr(we)}`:""]})]}),W&&t("div",{className:"grid grid-cols-1 gap-4 w-full",children:a.map((e)=>t(du,{item:e,isSelected:J?.id===e.id,isChecked:w.has(e.id),isEditing:xe===e.id,onSelect:X,onDoubleClick:Y,onContextMenu:()=>{},onDragStart:()=>{},onDrop:()=>{},onRename:(s)=>Ne(e,s),onFinishEditing:()=>ke(null),onAction:(s,n)=>Ce(s,n),isRecentlyDeleted:x,isRecents:k,selectedCount:w.size,canEdit:N,isShareView:q,allowDownload:re},e.id))})]}),he>0&&o("div",{className:"mb-4",children:[o("button",{onClick:()=>Qe(!j),className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground mb-3 font-medium select-none cursor-pointer",children:[j?t(ve,{className:"h-4 w-4"}):t(Et,{className:"h-4 w-4"}),o("span",{children:[be(he,!0),Pe?` • ${Jr(ye)}`:""]})]}),j&&t("div",{className:"grid grid-cols-1 gap-4 w-full",children:l.map((e)=>t(uu,{teamId:r,item:e,isSelected:J?.id===e.id,isChecked:w.has(e.id),isEditing:xe===e.id,onSelect:X,onDoubleClick:Y,onContextMenu:()=>{},onDragStart:()=>{},onDrop:()=>{},onRename:(s)=>Ne(e,s),onFinishEditing:()=>ke(null),onSaveField:(s,n)=>Be?.(e.id,s,n),fields:[],onAction:(s,n)=>Ce(s,n),isRecentlyDeleted:x,isRecents:k,selectedCount:w.size,canEdit:N,isShareView:q,allowDownload:re},e.id))})]})]}),vt&&t("div",{className:"flex flex-col items-center justify-center h-64 text-sm text-muted-foreground p-6 text-center",children:k?o("div",{className:"flex flex-col items-center gap-2",children:[t(Us,{className:"h-10 w-10 text-muted-foreground/40 mb-1"}),t("p",{className:"font-medium text-foreground",children:pp()}),t("p",{className:"text-xs text-muted-foreground",children:mp()})]}):t("span",{children:$p()})}),t("div",{ref:at,className:"py-4 flex justify-center items-center min-h-6",children:(y||b)&&t(O,{className:"h-5 w-5 animate-spin text-muted-foreground"})})]}),N&&!x&&!k&&!q&&!ie&&t("div",{className:"fixed bottom-6 right-6 z-30",children:o(ge,{modal:!1,children:[t(Ae,{asChild:!0,children:t(C,{size:"icon",className:"h-14 w-14 rounded-full bg-primary text-primary-foreground shadow-lg shadow-primary/25 hover:bg-primary/90 flex items-center justify-center","aria-label":"Actions",children:t(de,{className:"h-6 w-6"})})}),o(_e,{align:"end",side:"top",className:"w-48 mb-2",children:[o(K,{onClick:()=>ne.current?.click(),className:"flex items-center gap-2.5 py-2 cursor-pointer",children:[t(uo,{className:"h-4 w-4"}),t("span",{children:Kp()})]}),o(K,{onClick:()=>ce.current?.click(),className:"flex items-center gap-2.5 py-2 cursor-pointer",children:[t(uo,{className:"h-4 w-4"}),t("span",{children:Wp()})]}),o(K,{onClick:()=>F(!0),className:"flex items-center gap-2.5 py-2 cursor-pointer",children:[t(lu,{className:"h-4 w-4"}),t("span",{children:El()})]})]})]})}),t(ue,{open:He,onOpenChange:F,children:t(ae,{className:"sm:max-w-md",children:o("form",{onSubmit:gt,children:[o(pe,{children:[t(le,{children:El()}),t(Mt,{children:Bh()})]}),t("div",{className:"py-4",children:t(z,{autoFocus:!0,placeholder:Bh(),value:I,onChange:(e)=>me(e.target.value)})}),o(qe,{children:[t(C,{type:"button",variant:"outline",onClick:()=>F(!1),children:De()}),o(C,{type:"submit",disabled:!I.trim()||Ee,children:[Ee?t(O,{className:"h-4 w-4 animate-spin mr-2"}):null,na()]})]})]})})}),t(Xe,{open:Ve,onOpenChange:Ge,children:o(et,{children:[o(tt,{children:[t(nt,{children:qc()}),t(ot,{children:jc()})]}),o(rt,{children:[t(it,{children:De()}),t(st,{onClick:()=>Je(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:ct()})]})]})}),t(Xe,{open:Ke,onOpenChange:Q,children:o(et,{children:[o(tt,{children:[t(nt,{children:Cb()}),t(ot,{children:Eb()})]}),o(rt,{children:[t(it,{children:De()}),t(st,{onClick:(e)=>{e.preventDefault(),ft()},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",disabled:P,children:P?"Deleting...":ct()})]})]})}),t(ue,{open:Ye,onOpenChange:H,children:o(ae,{className:"sm:max-w-md",children:[o(pe,{children:[t(le,{children:T?Cg():lh()}),t(Mt,{children:T?Kg():Zh()})]}),T?o("div",{className:"space-y-4 py-6 flex flex-col items-center justify-center",children:[t(O,{className:"h-8 w-8 animate-spin text-primary"}),t("span",{className:"text-sm font-medium text-muted-foreground mt-2",children:Ig()})]}):o("div",{className:"space-y-4 py-2",children:[t("div",{className:"text-sm text-muted-foreground",children:yh({count:Fe.length})}),o("div",{className:"flex items-start gap-3 p-3 text-sm rounded-lg bg-amber-50 dark:bg-amber-950/30 text-amber-800 dark:text-amber-300 border border-amber-200 dark:border-amber-900/30",children:[t(Kr,{className:"h-5 w-5 shrink-0 mt-0.5"}),o("div",{children:[t("p",{className:"font-semibold",children:hg()}),t("p",{className:"mt-0.5 text-xs text-amber-700/90 dark:text-amber-400/90",children:Uh()})]})]})]}),t(qe,{children:!T?o(L,{children:[t(C,{variant:"outline",onClick:()=>H(!1),children:De()}),o(C,{onClick:Ze,className:"gap-2",disabled:Fe.length===0,children:[t(ht,{className:"h-4 w-4"}),mA()]})]}):t(C,{variant:"outline",onClick:()=>H(!1),children:De()})})]})})]})}
2
- export{$l};
1
+ import{m,_,u,S,L,t,o,V,B,A,O,Kr,ve,Et,ht,zs,de,E,ge,Ae,_e,K,De,na,lh,ct,Hc,$c,yh,Cb,Ib,Lh,Zh,Bh,ap,lp,cp,up,Tl,mg,pp,mp,Eg,Cg,Mp,Qg,pA,$p,f1,Kp,Wp,Xe,et,tt,rt,nt,ot,st,it,ue,ae,pe,qe,le,Mt,z,Ot,Nt,M,yn,bn,BA}from"./chunk-qx553512.js";import{uu,du,Va,Qa,fu}from"./chunk-me3zmpj5.js";import{Uo}from"./chunk-fa9yq17g.js";import{uo}from"./chunk-wbmqbpgm.js";S();var Se=[];function Ql({teamId:r,projectId:D,assetId:p,folders:a,files:l,totalFolders:Me,totalFiles:Re,totalFoldersSize:ze,totalFilesSize:Ue,selectedItem:J,selectedIds:w,onItemSelect:X,onItemDoubleClick:Y,onSaveField:Be,onClearSelection:$e,fetchNextFoldersPage:Z,hasNextFoldersPage:ee,isFetchingNextFoldersPage:y,fetchNextFilesPage:te,hasNextFilesPage:oe,isFetchingNextFilesPage:b,isRecentlyDeleted:x=!1,isRecents:k=!1,isLoading:se=!1,isShareView:q=!1,isPublic:ie=!1,shareId:Oe,allowDownload:re=!0}){let d=V(),{canEdit:C,canAdmin:We}=Ot(D),ne=_(null),ce=_(null),[W,je]=u(!0),[j,Qe]=u(!0),[He,N]=u(!1),[F,me]=u(""),[Ke,Q]=u(!1),fe=Me??a.length,he=Re??l.length,we=ze??(a.length>0?a.reduce((e,s)=>e+(s.sizeByte||0),0):-1),ye=Ue??(l.length>0?l.reduce((e,s)=>e+(s.sizeByte||0),0):-1),Le=we>-1,Pe=ye>-1,be=(e,s)=>{if(s)return e===1?lp({count:e}):ap({count:e});else return e===1?up({count:e}):cp({count:e})},{editingItemId:xe,setEditingItemId:ke,handleAction:Ce,onRenameSubmit:Ne,isDeleteDialogOpen:Ve,setIsDeleteDialogOpen:Ge,confirmDelete:Je,isDownloadDialogOpen:Ye,setIsDownloadDialogOpen:H,isLoadingLinks:I,resolvedFiles:Fe,startDownload:Ze}=fu({teamId:r,projectId:D,assetId:p,folders:a,files:l,selectedIds:w,isPublic:ie,shareId:Oe}),{ref:at,inView:Ie}=Nt();m(()=>{if(Ie){if(ee&&!y)Z();else if(oe&&!b)te()}},[Ie,ee,y,oe,b,Z,te]);let lt=bn((e)=>e.startTask),dt=A.api.teams[":teamId"].upload.tasks.$post,{mutate:mt}=B({mutationFn:async(e)=>{let s=await dt(e);if(!s.ok)throw Error("Failed to create upload task");return await s.json()},onMutate:()=>({files:[...Se]}),onSuccess:async(e,s,n)=>{let f=n?.files||[],g=f.map((i)=>{let v=e.createdAssets?.find((c)=>c.tempId===i.id),R=e.presignedUrls?.find((c)=>c.id===i.id);return{fileId:v?.assetId||R?.fileId||i.id,name:i.file.name,size:i.file.size}}).filter((i)=>!!i.fileId),h=f.filter((i)=>!i.file.name.startsWith(".")),T=h.length===1?h[0].file.name:`${h.length} Items`;if(e.taskId)lt(e.taskId,T,g);d.invalidateQueries({queryKey:["search",r,p]}),d.invalidateQueries({queryKey:["teams",r,"upload","tasks"]}),await du({files:f,taskId:e.taskId,teamId:r,storageBackend:e.storageBackend||"local",createdAssets:e.createdAssets,presignedUrls:e.presignedUrls,onFileFinished:async()=>{await d.invalidateQueries({queryKey:["search",r,p]})}}),d.invalidateQueries({queryKey:["search",r,p]}),d.invalidateQueries({queryKey:["teams",r,"upload","tasks"]})}}),Te=(e)=>{if(!e||e.length===0)return;let s=[],n=[],f=new Map;for(let g of e){let h=(g.webkitRelativePath||g.name).split("/");if(h.some((U)=>U.startsWith(".")))continue;let T=h.pop(),i=n,v="";for(let U of h)if(v=`${v}/${U}`,!f.has(v)){let G=[],wt={name:U,type:"folder",id:Uo(),children:G,size:0};i.push(wt),f.set(v,G),i=G}else i=f.get(v);let R={file:g,id:Uo()};s.push(R);let c=g.type;if(T.toLowerCase().endsWith(".wma")&&c?.startsWith("video/"))c=c.replace(/^video\//,"audio/");i.push({name:T,size:g.size,type:"file",id:R.id,children:[],mediaType:c})}Se=s,mt({param:{teamId:r},json:{parentId:p,files:n}})},pt=A.api.folders.$post,{mutate:ut,isPending:Ee}=B({mutationFn:async(e)=>{let s=await pt({json:{name:e,parentId:p}});if(!s.ok)throw Error("Failed to create folder");return await s.json()},onSuccess:()=>{M.success(Tl()),N(!1),me(""),d.invalidateQueries({queryKey:["search",r,p]}),d.invalidateQueries({queryKey:["folders"]})},onError:(e)=>{M.error(`Error: ${e.message}`)}}),{mutate:ft,isPending:P}=B({mutationFn:async()=>{let e=await A.api.projects[":projectId"]["empty-trash"].$post({param:{projectId:D}});if(!e.ok)throw Error("Failed to empty trash");return await e.json()},onSuccess:()=>{M.success(f1()),d.invalidateQueries({queryKey:["projects",D,"recently-deleted"]}),$e(),Q(!1)},onError:(e)=>{M.error(`Error: ${e.message}`)}}),gt=(e)=>{if(e.preventDefault(),!F.trim())return;ut(F.trim())},vt=!se&&a.length===0&&l.length===0&&!y&&!b;return o("div",{className:"flex-1 flex flex-col min-h-0 bg-background overflow-hidden relative",children:[C&&o(L,{children:[t("input",{type:"file",ref:ne,multiple:!0,className:"hidden",onChange:(e)=>{if(e.target.files)Te(e.target.files)}}),t("input",{type:"file",ref:ce,multiple:!0,webkitdirectory:"true",className:"hidden",onChange:(e)=>{if(e.target.files)Te(e.target.files)}})]}),x&&o("div",{className:"flex items-center justify-between px-4 py-2.5 bg-muted/20 border-b border-border text-sm shrink-0",children:[o("div",{className:"flex items-center gap-2 text-muted-foreground",children:[t(Kr,{className:"h-4 w-4 text-amber-500 shrink-0"}),t("span",{className:"text-xs",children:Mp()})]}),We&&t(E,{variant:"destructive",size:"sm",disabled:P||a.length===0&&l.length===0,onClick:()=>Q(!0),className:"h-7 px-2.5 text-xs font-medium bg-destructive/10 text-destructive border border-destructive/20 hover:bg-destructive hover:text-destructive-foreground",children:"Delete"})]}),o("div",{className:"flex-1 overflow-y-auto min-h-0 p-3 pb-24",children:[se&&a.length===0&&l.length===0?t(BA,{}):o("div",{className:"max-w-lg mx-auto w-full",children:[fe>0&&o("div",{className:"mb-4",children:[o("button",{onClick:()=>je(!W),className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground mb-3 font-medium select-none cursor-pointer",children:[W?t(ve,{className:"h-4 w-4"}):t(Et,{className:"h-4 w-4"}),o("span",{children:[be(fe,!1),Le?` • ${yn(we)}`:""]})]}),W&&t("div",{className:"grid grid-cols-1 gap-4 w-full",children:a.map((e)=>t(Qa,{item:e,isSelected:J?.id===e.id,isChecked:w.has(e.id),isEditing:xe===e.id,onSelect:X,onDoubleClick:Y,onContextMenu:()=>{},onDragStart:()=>{},onDrop:()=>{},onRename:(s)=>Ne(e,s),onFinishEditing:()=>ke(null),onAction:(s,n)=>Ce(s,n),isRecentlyDeleted:x,isRecents:k,selectedCount:w.size,canEdit:C,isShareView:q,allowDownload:re},e.id))})]}),he>0&&o("div",{className:"mb-4",children:[o("button",{onClick:()=>Qe(!j),className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground mb-3 font-medium select-none cursor-pointer",children:[j?t(ve,{className:"h-4 w-4"}):t(Et,{className:"h-4 w-4"}),o("span",{children:[be(he,!0),Pe?` • ${yn(ye)}`:""]})]}),j&&t("div",{className:"grid grid-cols-1 gap-4 w-full",children:l.map((e)=>t(Va,{teamId:r,item:e,isSelected:J?.id===e.id,isChecked:w.has(e.id),isEditing:xe===e.id,onSelect:X,onDoubleClick:Y,onContextMenu:()=>{},onDragStart:()=>{},onDrop:()=>{},onRename:(s)=>Ne(e,s),onFinishEditing:()=>ke(null),onSaveField:(s,n)=>Be?.(e.id,s,n),fields:[],onAction:(s,n)=>Ce(s,n),isRecentlyDeleted:x,isRecents:k,selectedCount:w.size,canEdit:C,isShareView:q,allowDownload:re},e.id))})]})]}),vt&&t("div",{className:"flex flex-col items-center justify-center h-64 text-sm text-muted-foreground p-6 text-center",children:k?o("div",{className:"flex flex-col items-center gap-2",children:[t(zs,{className:"h-10 w-10 text-muted-foreground/40 mb-1"}),t("p",{className:"font-medium text-foreground",children:pp()}),t("p",{className:"text-xs text-muted-foreground",children:mp()})]}):t("span",{children:$p()})}),t("div",{ref:at,className:"py-4 flex justify-center items-center min-h-6",children:(y||b)&&t(O,{className:"h-5 w-5 animate-spin text-muted-foreground"})})]}),C&&!x&&!k&&!q&&!ie&&t("div",{className:"fixed bottom-6 right-6 z-30",children:o(ge,{modal:!1,children:[t(Ae,{asChild:!0,children:t(E,{size:"icon",className:"h-14 w-14 rounded-full bg-primary text-primary-foreground shadow-lg shadow-primary/25 hover:bg-primary/90 flex items-center justify-center","aria-label":"Actions",children:t(de,{className:"h-6 w-6"})})}),o(_e,{align:"end",side:"top",className:"w-48 mb-2",children:[o(K,{onClick:()=>ne.current?.click(),className:"flex items-center gap-2.5 py-2 cursor-pointer",children:[t(uo,{className:"h-4 w-4"}),t("span",{children:Kp()})]}),o(K,{onClick:()=>ce.current?.click(),className:"flex items-center gap-2.5 py-2 cursor-pointer",children:[t(uo,{className:"h-4 w-4"}),t("span",{children:Wp()})]}),o(K,{onClick:()=>N(!0),className:"flex items-center gap-2.5 py-2 cursor-pointer",children:[t(uu,{className:"h-4 w-4"}),t("span",{children:Tl()})]})]})]})}),t(ue,{open:He,onOpenChange:N,children:t(ae,{className:"sm:max-w-md",children:o("form",{onSubmit:gt,children:[o(pe,{children:[t(le,{children:Tl()}),t(Mt,{children:Zh()})]}),t("div",{className:"py-4",children:t(z,{autoFocus:!0,placeholder:Zh(),value:F,onChange:(e)=>me(e.target.value)})}),o(qe,{children:[t(E,{type:"button",variant:"outline",onClick:()=>N(!1),children:De()}),o(E,{type:"submit",disabled:!F.trim()||Ee,children:[Ee?t(O,{className:"h-4 w-4 animate-spin mr-2"}):null,na()]})]})]})})}),t(Xe,{open:Ve,onOpenChange:Ge,children:o(et,{children:[o(tt,{children:[t(nt,{children:$c()}),t(ot,{children:Hc()})]}),o(rt,{children:[t(it,{children:De()}),t(st,{onClick:()=>Je(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:ct()})]})]})}),t(Xe,{open:Ke,onOpenChange:Q,children:o(et,{children:[o(tt,{children:[t(nt,{children:Ib()}),t(ot,{children:Cb()})]}),o(rt,{children:[t(it,{children:De()}),t(st,{onClick:(e)=>{e.preventDefault(),ft()},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",disabled:P,children:P?"Deleting...":ct()})]})]})}),t(ue,{open:Ye,onOpenChange:H,children:o(ae,{className:"sm:max-w-md",children:[o(pe,{children:[t(le,{children:I?Eg():lh()}),t(Mt,{children:I?Qg():Lh()})]}),I?o("div",{className:"space-y-4 py-6 flex flex-col items-center justify-center",children:[t(O,{className:"h-8 w-8 animate-spin text-primary"}),t("span",{className:"text-sm font-medium text-muted-foreground mt-2",children:Cg()})]}):o("div",{className:"space-y-4 py-2",children:[t("div",{className:"text-sm text-muted-foreground",children:yh({count:Fe.length})}),o("div",{className:"flex items-start gap-3 p-3 text-sm rounded-lg bg-amber-50 dark:bg-amber-950/30 text-amber-800 dark:text-amber-300 border border-amber-200 dark:border-amber-900/30",children:[t(Kr,{className:"h-5 w-5 shrink-0 mt-0.5"}),o("div",{children:[t("p",{className:"font-semibold",children:mg()}),t("p",{className:"mt-0.5 text-xs text-amber-700/90 dark:text-amber-400/90",children:Bh()})]})]})]}),t(qe,{children:!I?o(L,{children:[t(E,{variant:"outline",onClick:()=>H(!1),children:De()}),o(E,{onClick:Ze,className:"gap-2",disabled:Fe.length===0,children:[t(ht,{className:"h-4 w-4"}),pA()]})]}):t(E,{variant:"outline",onClick:()=>H(!1),children:De()})})]})})]})}
2
+ export{Ql};
@@ -1,2 +1,2 @@
1
- import{I,wp,xp,Sp,Ep,Pd,Nd,Dd,Od,Fd,iu}from"./chunk-42hrvk6k.js";import{Mo}from"./chunk-15w79661.js";import{ko}from"./chunk-zf5cyxnt.js";var o=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Ws=I("activity",o);var a=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],lo=I("cpu",a);var r=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],zo=I("gauge",r);var c=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],wn=I("server",c);var n=[["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"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],Jl=I("shield-alert",n);var i=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],ha=I("dollar-sign",i);var Wa={agent_total_tokens:{label:()=>Fd(),icon:lo,unit:"tokens"},agent_cost:{label:()=>Nd(),icon:ha,unit:"$"},agent_mcp_call_count:{label:()=>Dd(),icon:wn,unit:"calls"},agent_bash_call_count:{label:()=>Pd(),icon:ko,unit:"calls"},agent_tool_call_count:{label:()=>Od(),icon:Mo,unit:"calls"}};function Oi(e,t){if(e==="agent_cost")return`$${t.toFixed(2)}`;return t.toLocaleString()}function Xl(e){switch(iu(e)){case"1hour":return xp();case"5hour":return Sp();case"1day":return wp();case"7day":return Ep();default:return e}}
2
- export{Ws,lo,ha,zo,wn,Jl,Wa,Oi,Xl};
1
+ import{I,wp,xp,Sp,Ep,Pd,Nd,Dd,Od,Fd,lu}from"./chunk-qx553512.js";import{Mo}from"./chunk-tqdde9bj.js";import{ko}from"./chunk-03zkxckm.js";var o=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Ys=I("activity",o);var a=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],lo=I("cpu",a);var r=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],zo=I("gauge",r);var c=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],wn=I("server",c);var n=[["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"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],tc=I("shield-alert",n);var i=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],ha=I("dollar-sign",i);var Xa={agent_total_tokens:{label:()=>Fd(),icon:lo,unit:"tokens"},agent_cost:{label:()=>Nd(),icon:ha,unit:"$"},agent_mcp_call_count:{label:()=>Dd(),icon:wn,unit:"calls"},agent_bash_call_count:{label:()=>Pd(),icon:ko,unit:"calls"},agent_tool_call_count:{label:()=>Od(),icon:Mo,unit:"calls"}};function Oi(e,t){if(e==="agent_cost")return`$${t.toFixed(2)}`;return t.toLocaleString()}function rc(e){switch(lu(e)){case"1hour":return xp();case"5hour":return Sp();case"1day":return wp();case"7day":return Ep();default:return e}}
2
+ export{Ys,lo,ha,zo,wn,tc,Xa,Oi,rc};