@shumai-one/shumai 0.4.8 → 0.5.0

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 (167) hide show
  1. package/bin/{chunk-qw76wcrb.js → chunk-03bfjh8k.js} +2 -2
  2. package/bin/{chunk-6xqpbkb6.js → chunk-0tf15vee.js} +2 -2
  3. package/bin/{chunk-e333evwr.js → chunk-0vtk7wrf.js} +2 -2
  4. package/bin/{chunk-b93qxjts.js → chunk-0yv0nnmh.js} +2 -2
  5. package/bin/{chunk-pg5mayjc.js → chunk-12npypek.js} +2 -2
  6. package/bin/chunk-13d525jm.js +2 -0
  7. package/bin/{chunk-qrmkkxjh.js → chunk-1k16xsqq.js} +10 -10
  8. package/bin/{chunk-dk2trprj.js → chunk-1yt1gsyy.js} +1 -1
  9. package/bin/{chunk-wqqdy0xb.js → chunk-20anqpf1.js} +2 -2
  10. package/bin/{chunk-tjhbr5ks.js → chunk-2g5qdx4s.js} +1 -1
  11. package/bin/{chunk-0b5s5ge0.js → chunk-31vx01aw.js} +2 -2
  12. package/bin/{chunk-tycap2k9.js → chunk-32japja5.js} +1 -1
  13. package/bin/chunk-35mpp84e.js +2 -0
  14. package/bin/{chunk-d9dmr2vc.js → chunk-36r20sj7.js} +1 -1
  15. package/bin/{chunk-67ewr4j4.js → chunk-3btc8a0p.js} +2 -2
  16. package/bin/{chunk-2y7y60pc.js → chunk-3cvbb6kh.js} +2 -2
  17. package/bin/chunk-3ewmtf1c.js +1 -0
  18. package/bin/chunk-3fjgf7eb.js +3 -0
  19. package/bin/chunk-3xw70yr4.js +2 -0
  20. package/bin/{chunk-1qk4e3j9.js → chunk-3z20b2hz.js} +2 -2
  21. package/bin/{chunk-hed37kyr.js → chunk-3zvvct3r.js} +1 -1
  22. package/bin/{chunk-1zpsbvq9.js → chunk-51h2bgpf.js} +3 -3
  23. package/bin/{chunk-5vvvgjvz.js → chunk-5bpvwv66.js} +2 -2
  24. package/bin/{chunk-4tpkx2ft.js → chunk-5jbx9gqe.js} +1 -1
  25. package/bin/{chunk-vfv27kve.js → chunk-5patxztz.js} +4 -4
  26. package/bin/chunk-5seey9ee.js +2 -0
  27. package/bin/{chunk-251rat7t.js → chunk-5t05jpna.js} +3 -3
  28. package/bin/{chunk-pbq64m5k.js → chunk-5yd9cv7f.js} +5 -5
  29. package/bin/chunk-66hdwm6f.js +2 -0
  30. package/bin/{chunk-mcq3pe4v.js → chunk-6bgbx563.js} +2 -2
  31. package/bin/{chunk-j3qz3wa3.js → chunk-6vvs18bw.js} +1 -1
  32. package/bin/chunk-756mr32b.js +2 -0
  33. package/bin/{chunk-fezar34g.js → chunk-7vd5yajk.js} +5 -5
  34. package/bin/chunk-7wb3dga5.js +2 -0
  35. package/bin/{chunk-tf3hke5h.js → chunk-9h6nn1a3.js} +1 -1
  36. package/bin/chunk-9k86d2a3.js +4 -0
  37. package/bin/chunk-9wk11jtz.js +1 -0
  38. package/bin/chunk-a1crhhzy.js +1 -0
  39. package/bin/chunk-axfwh5et.js +2 -0
  40. package/bin/{chunk-yeb5bcxz.js → chunk-b9j5575n.js} +2 -2
  41. package/bin/chunk-cgsxyw07.js +2 -0
  42. package/bin/{chunk-5pcv139g.js → chunk-cw8z9w5c.js} +2 -2
  43. package/bin/{chunk-4tm9cw4v.js → chunk-czny5thj.js} +2 -2
  44. package/bin/{chunk-jwhgybtg.js → chunk-d7mgjqf8.js} +1 -1
  45. package/bin/{chunk-jgnp68ez.js → chunk-d9btz95y.js} +1 -1
  46. package/bin/chunk-dckdnqc0.js +2 -0
  47. package/bin/chunk-dx0wz749.js +211 -0
  48. package/bin/{chunk-mn9ax7qa.js → chunk-dz33q4v1.js} +2 -2
  49. package/bin/chunk-dz4fdrmk.js +1 -0
  50. package/bin/{chunk-29wjvgwv.js → chunk-e3r1m6rb.js} +1 -1
  51. package/bin/chunk-edjtb7pk.js +2 -0
  52. package/bin/{chunk-j95fjg69.js → chunk-eez1yncf.js} +2 -2
  53. package/bin/{chunk-x33bf3ay.js → chunk-exgtwask.js} +1 -1
  54. package/bin/{chunk-ws216bmf.js → chunk-f22nrm6r.js} +4 -4
  55. package/bin/{chunk-xmn5v64e.js → chunk-fhq5m9ya.js} +2 -2
  56. package/bin/{chunk-gj3vrbkx.js → chunk-fyssg02c.js} +31 -31
  57. package/bin/{chunk-rzannb5e.js → chunk-g8h1e1kh.js} +2 -2
  58. package/bin/{chunk-qje7g7t7.js → chunk-ghjhyajn.js} +2 -2
  59. package/bin/{chunk-9v10mkts.js → chunk-gptzcgte.js} +1 -1
  60. package/bin/{chunk-r8ss8xm1.js → chunk-grsgkkrb.js} +5 -5
  61. package/bin/{chunk-dpn61sht.js → chunk-gy8z8sd7.js} +1 -1
  62. package/bin/{chunk-e3qxpswy.js → chunk-h153xefb.js} +1 -1
  63. package/bin/chunk-h82r29wm.js +129 -0
  64. package/bin/{chunk-ze3msq86.js → chunk-h9x81yp6.js} +1 -1
  65. package/bin/{chunk-b9p9yhky.js → chunk-hr2027z3.js} +8 -8
  66. package/bin/{chunk-7rvyq5gr.js → chunk-hx76pje1.js} +1 -1
  67. package/bin/chunk-hz9stgvn.js +1 -0
  68. package/bin/chunk-hzr8100w.js +3 -0
  69. package/bin/{chunk-4sq35ks7.js → chunk-j3xaq9s3.js} +2 -2
  70. package/bin/{chunk-pbmkewt5.js → chunk-j909v9p5.js} +1 -1
  71. package/bin/chunk-jb6d142z.js +1 -0
  72. package/bin/chunk-k9cgfzgk.js +3 -0
  73. package/bin/{chunk-zhx4vsgt.js → chunk-kgfa5y9w.js} +10 -10
  74. package/bin/{chunk-1ymyhrh2.js → chunk-kzsdp31a.js} +2 -2
  75. package/bin/{chunk-9ht2kr33.js → chunk-m1xc3t0p.js} +7 -7
  76. package/bin/{chunk-wdbew0hx.js → chunk-m7dp8rqv.js} +1 -1
  77. package/bin/{chunk-0jaj2807.js → chunk-m9sp00a9.js} +4 -4
  78. package/bin/{chunk-qn37fsy3.js → chunk-mcd7zas7.js} +2 -2
  79. package/bin/chunk-meyvvmgk.js +1 -0
  80. package/bin/{chunk-y4pe65d1.js → chunk-mqr096rn.js} +1 -1
  81. package/bin/{chunk-ybnykjsg.js → chunk-mt532a33.js} +1 -1
  82. package/bin/{chunk-twx715xf.js → chunk-myd3wg9a.js} +2 -2
  83. package/bin/chunk-n1b3pt17.js +14 -0
  84. package/bin/chunk-n5v48hz5.js +2 -0
  85. package/bin/{chunk-65ets3f0.js → chunk-p5v22g5n.js} +2 -2
  86. package/bin/chunk-phzemmmy.js +2 -0
  87. package/bin/{chunk-w53gqdnw.js → chunk-q5mkbnr9.js} +2 -2
  88. package/bin/chunk-qhzat67w.js +2 -0
  89. package/bin/{chunk-7nv7r7zx.js → chunk-r1m4q8vw.js} +1 -1
  90. package/bin/{chunk-jhxcm88f.js → chunk-r5rpdhed.js} +2 -2
  91. package/bin/{chunk-v6tjp5qt.js → chunk-r6gkv98n.js} +6 -6
  92. package/bin/{chunk-s26a26h3.js → chunk-rkq6jvhb.js} +3 -3
  93. package/bin/{chunk-drpdjxmw.js → chunk-rn9rktp4.js} +5 -5
  94. package/bin/{chunk-dscq4a4k.js → chunk-rq2h2bwt.js} +2 -2
  95. package/bin/{chunk-dp1mrw7m.js → chunk-sg7n2g3z.js} +1 -1
  96. package/bin/chunk-smcn7ep7.js +2 -0
  97. package/bin/{chunk-p706vjvr.js → chunk-tcat7q9p.js} +2 -2
  98. package/bin/chunk-tf8q7h6b.js +1 -0
  99. package/bin/{chunk-6t5r26bm.js → chunk-trndqdaa.js} +1 -1
  100. package/bin/chunk-tvr5rm1g.js +1 -0
  101. package/bin/chunk-ty88m3yg.js +2 -0
  102. package/bin/chunk-v2x9915x.js +1 -0
  103. package/bin/{chunk-fnca3xqw.js → chunk-v42jcex0.js} +4 -4
  104. package/bin/{chunk-pq3pyrvy.js → chunk-vbbn4hth.js} +1 -1
  105. package/bin/chunk-vnk2p7mq.css +1 -0
  106. package/bin/{chunk-r7e2fmmx.js → chunk-wkxm6yny.js} +2 -2
  107. package/bin/{chunk-t2sqtc9p.js → chunk-wydd7sz7.js} +2 -2
  108. package/bin/chunk-x8hky9td.js +1 -0
  109. package/bin/{chunk-frma9pgq.js → chunk-xvdd04gy.js} +1 -1
  110. package/bin/{chunk-ht64xpjp.js → chunk-y03z5rrg.js} +3 -3
  111. package/bin/chunk-y12ah7c6.js +1 -0
  112. package/bin/chunk-y7jz31ay.js +1 -0
  113. package/bin/chunk-ydk3edsw.js +1 -0
  114. package/bin/{chunk-6h76kqv2.js → chunk-yfe6hkzk.js} +3 -3
  115. package/bin/{chunk-afsm0ct9.js → chunk-z1r86fna.js} +2 -2
  116. package/bin/{chunk-bcjkapyp.js → chunk-z8mmqfm4.js} +1 -1
  117. package/bin/chunk-zbma2zeh.js +1 -0
  118. package/bin/{chunk-45mheqnm.js → chunk-zcrtr8qd.js} +2 -2
  119. package/bin/{chunk-czwpfv0w.js → chunk-zfqz72sd.js} +1 -1
  120. package/bin/{chunk-nradb5py.js → chunk-zhe16jvg.js} +1 -1
  121. package/bin/{chunk-75x3b8ds.js → chunk-zwb9kamp.js} +2 -2
  122. package/bin/shumai-app.html +1 -1
  123. package/bin/shumai-app.js +572 -321
  124. package/package.json +9 -8
  125. package/prisma/migrations/20260927092537_add_notification_email_status/migration.sql +11 -0
  126. package/prisma/migrations/20261001015042_migrate_video_strategy_multi_and_resolutions/migration.sql +16 -0
  127. package/prisma/migrations/20261002104921_add_asset_status_failed/migration.sql +2 -0
  128. package/prisma/schema.prisma +11 -0
  129. package/bin/chunk-07pgpftg.js +0 -14
  130. package/bin/chunk-1y7nvhgx.js +0 -3
  131. package/bin/chunk-2ftmxhr5.js +0 -2
  132. package/bin/chunk-2kxhdnma.js +0 -3
  133. package/bin/chunk-3rjdkmhb.js +0 -2
  134. package/bin/chunk-43dzhk24.js +0 -211
  135. package/bin/chunk-55n569j1.js +0 -1
  136. package/bin/chunk-6jaf9hxa.js +0 -1
  137. package/bin/chunk-6vst0k0k.js +0 -2
  138. package/bin/chunk-7hxd4st0.js +0 -1
  139. package/bin/chunk-9kb55e6b.js +0 -1
  140. package/bin/chunk-bbk5v964.js +0 -1
  141. package/bin/chunk-bcqhjbpy.js +0 -2
  142. package/bin/chunk-bxksbrcm.js +0 -1
  143. package/bin/chunk-c1a1srsw.js +0 -2
  144. package/bin/chunk-c7yxnyep.js +0 -1
  145. package/bin/chunk-da4fd4f8.js +0 -2
  146. package/bin/chunk-dmewtzbe.js +0 -1
  147. package/bin/chunk-faaqparg.js +0 -2
  148. package/bin/chunk-g82qnxw6.js +0 -2
  149. package/bin/chunk-gc6m7agb.js +0 -3
  150. package/bin/chunk-j6ptdqp9.js +0 -2
  151. package/bin/chunk-kdg245g7.js +0 -1
  152. package/bin/chunk-mg4p33eg.js +0 -2
  153. package/bin/chunk-mrdznst9.js +0 -1
  154. package/bin/chunk-msg8j3hj.css +0 -1
  155. package/bin/chunk-n4f1he1g.js +0 -4
  156. package/bin/chunk-nsvfcp3f.js +0 -1
  157. package/bin/chunk-nx782n1x.js +0 -2
  158. package/bin/chunk-p4hwyysm.js +0 -2
  159. package/bin/chunk-qw4v0qdg.js +0 -1
  160. package/bin/chunk-rvj965cr.js +0 -1
  161. package/bin/chunk-sf9ezxgy.js +0 -2
  162. package/bin/chunk-twwpbp8d.js +0 -2
  163. package/bin/chunk-v3yfee88.js +0 -2
  164. package/bin/chunk-vq24vj88.js +0 -1
  165. package/bin/chunk-x79scans.js +0 -299
  166. package/bin/chunk-xktxk53n.js +0 -1
  167. package/bin/chunk-yvz2b957.js +0 -2
@@ -1,4 +0,0 @@
1
- // @bun
2
- import{Fr,Xs,af,e,m,d,x,U,a,r,T,_,l,s}from"./chunk-fezar34g.js";function c(t,n){let o={};if(!Object.keys(n).length)return o=t,o;for(let[u,i]of Object.entries(t)){let p=n[u];if(p===null)continue;o[p??u]=i}return o}function y(t){let n={};for(let[o,u]of Object.entries(t))if(typeof u<"u")n[o]=u;return n}class I extends Error{rawValue;rawMessage;static[Symbol.hasInstance](t){if(!(t instanceof Error))return!1;if(!("rawValue"in t))return!1;if(!("rawMessage"in t))return!1;if(!("pretty"in t))return!1;if(typeof t.pretty!=="function")return!1;return!0}constructor(t,n,o){super(`${t}: ${n}`);this.name="SDKValidationError",this.cause=n,this.rawValue=o,this.rawMessage=t}pretty(){if(this.cause instanceof Xs)return`${this.rawMessage}
3
- ${Xd(this.cause)}`;else return this.toString()}}function Xd(t){return af(t)}function hi(t){return{ok:!0,value:t}}function rs(t){return{ok:!1,error:t}}async function N(t){let n=await t;if(!n.ok)throw n.error;return n.value}function v(t,n,o){try{return hi(n(t))}catch(u){return rs(new I(o,u,t))}}var zo=r({prompt_tokens:m().default(0),completion_tokens:m().default(0),total_tokens:m().default(0),prompt_audio_seconds:s(m()).optional()}).catchall(x()).transform((t)=>c(t,{prompt_tokens:"promptTokens",completion_tokens:"completionTokens",total_tokens:"totalTokens",prompt_audio_seconds:"promptAudioSeconds"})),oc=r({promptTokens:m().default(0),completionTokens:m().default(0),totalTokens:m().default(0),promptAudioSeconds:s(m()).optional()}).catchall(x()).transform((t)=>({...c(t,{promptTokens:"prompt_tokens",completionTokens:"completion_tokens",totalTokens:"total_tokens",promptAudioSeconds:"prompt_audio_seconds"})}));function w(t){return C++,t}var C=0,A=0;function k(){A++;let t=C;return{end:(n)=>{let o=C-t;if(C=t+(n??o),--A===0)C=0;return o}}}function J(t){let n=Object.values(t);return T([...n.map((o)=>l(o)),e().transform((o)=>w(o))])}function Gi(t){let n=Object.values(t).filter((o)=>typeof o==="number");return T([...n.map((o)=>l(o)),m().transform((o)=>w(o))])}function ut(t){return e()}function om(t){return m()}var P=Symbol("UNKNOWN");function K(t){return typeof t==="object"&&t!==null&&P in t}function Ke(t,n,o={}){let{unknownValue:u="UNKNOWN",outputPropertyName:i}=o;return U().transform((p)=>{let h=Object.defineProperties({raw:p,[i??t]:u,isUnknown:!0},{[P]:{value:!0,enumerable:!1,configurable:!1}});if(!(typeof p==="object"&&p!==null))return h;let S=p[t];if(typeof S!=="string")return h;if(!(S in n))return h;let F=n[S];if(!F)return h;let g=k(),b=F.safeParse(p);if(!b.success)return g.end(0),h;if(g.end(),i)b.data[i]=S;return b.data})}var Y=/^\d{4}-\d{2}-\d{2}$/;class j{serialized;static today(){return new j(new Date)}constructor(t){if(typeof t==="string"&&!Y.test(t))throw RangeError("RFCDate: date strings must be in the format YYYY-MM-DD: "+t);let n=new Date(t);if(isNaN(+n))throw RangeError("RFCDate: invalid date provided: "+t);if(this.serialized=n.toISOString().slice(0,10),!Y.test(this.serialized))throw TypeError(`RFCDate: failed to build valid date with given value: ${t} serialized to ${this.serialized}`)}toJSON(){return this.toString()}toString(){return this.serialized}}function M(t){return U().transform((n,o)=>{let u=[],i=t.map(()=>[]),p=k();for(let[z,S]of t.entries()){let F=k(),g=S.safeParse(n),b=F.end(),ie=0;if(g.success){u.push({data:g.data,inexactCount:b,zeroDefaultCount:0,fieldCount:-1});continue}i[z].push(...g.error.issues)}if(u.length===0)return p.end(0),o.addIssue({input:n,code:"invalid_union",errors:i}),Fr;let h=u[0];for(let z of u){if(u.length>1)z.fieldCount=ne(z.data);h=te(z,h)}return p.end(h.inexactCount),h.data})}function te(t,n){let o=t.inexactCount===0,u=n.inexactCount===0;if(o!==u)return o?t:n;let i=t.fieldCount-t.zeroDefaultCount,p=n.fieldCount-n.zeroDefaultCount;if(i!==p)return i>p?t:n;return t.inexactCount<n.inexactCount?t:n}function ne(t){let n=0,o=[t],u=0;while(u<o.length){let i=o[u++];if(i===void 0||K(i))continue;let p=typeof i;if(i===null||p==="number"||p==="string"||p==="boolean"||p==="bigint"||i instanceof Date||i instanceof j){n++;continue}if(Array.isArray(i)){o.push(...i);continue}if(p==="object")o.push(...Object.values(i))}return n}var B=r({type:l("input_audio"),input_audio:e()}).transform((t)=>c(t,{input_audio:"inputAudio"})),V=r({type:l("input_audio"),inputAudio:e()}).transform((t)=>c(t,{inputAudio:"input_audio"}));var Na=r({type:l("document_url").default("document_url"),document_url:e(),document_name:s(e()).optional()}).transform((t)=>c(t,{document_url:"documentUrl",document_name:"documentName"})),Gs=r({type:l("document_url").default("document_url"),documentUrl:e(),documentName:s(e()).optional()}).transform((t)=>c(t,{documentUrl:"document_url",documentName:"document_name"}));var W=r({type:l("file").default("file"),file_id:e()}).transform((t)=>c(t,{file_id:"fileId"})),rc=r({type:l("file").default("file"),fileId:e()}).transform((t)=>c(t,{fileId:"file_id"}));var Z={Low:"low",Auto:"auto",High:"high"},q=J(Z),G=ut(Z);var E=r({url:e(),detail:s(q).optional()}),L=r({url:e(),detail:s(G).optional()});var De=M([E,e()]),Ee=M([L,e()]);var Da=r({type:l("image_url").default("image_url"),image_url:M([E,e()])}).transform((t)=>c(t,{image_url:"imageUrl"})),Vs=r({type:l("image_url").default("image_url"),imageUrl:M([L,e()])}).transform((t)=>c(t,{imageUrl:"image_url"}));var Pe=M([m(),e()]),Me=M([m(),e()]);var O=r({type:l("reference").default("reference"),reference_ids:a(M([m(),e()]))}).transform((t)=>c(t,{reference_ids:"referenceIds"})),R=r({type:l("reference").default("reference"),referenceIds:a(M([m(),e()]))}).transform((t)=>c(t,{referenceIds:"reference_ids"}));var ns=r({type:l("text").default("text"),text:e()}),os=r({type:l("text").default("text"),text:e()});var H={WebSearch:"web_search",WebSearchPremium:"web_search_premium",CodeInterpreter:"code_interpreter",ImageGeneration:"image_generation",DocumentLibrary:"document_library"},an=J(H),Qs=ut(H);var qe=M([an,e()]),Ge=M([Qs,e()]);var gi=r({type:l("tool_reference").default("tool_reference"),tool:M([an,e()]),title:e(),url:s(e()).optional(),favicon:s(e()).optional(),description:s(e()).optional()}),nc=r({type:l("tool_reference").default("tool_reference"),tool:M([Qs,e()]),title:e(),url:s(e()).optional(),favicon:s(e()).optional(),description:s(e()).optional()});var nt=M([gi,ns,O]),ot=M([nc,os,R]);var Pa=r({type:l("thinking").default("thinking"),thinking:a(M([gi,ns,O])),signature:s(e()).optional(),closed:d().optional()}),Oa=r({type:l("thinking").default("thinking"),thinking:a(M([nc,os,R])),signature:s(e()).optional(),closed:d().optional()});var Vi=Ke("type",{image_url:Da.and(r({type:l("image_url")})),document_url:Na.and(r({type:l("document_url")})),text:ns.and(r({type:l("text")})),reference:O.and(r({type:l("reference")})),file:W.and(r({type:l("file")})),thinking:Pa.and(r({type:l("thinking")})),input_audio:B}),Ks=T([Vs.and(r({type:l("image_url")})),Gs.and(r({type:l("document_url")})),os.and(r({type:l("text")})),R.and(r({type:l("reference")})),rc.and(r({type:l("file")})),Oa.and(r({type:l("thinking")})),V]);var zt=M([_(e(),x()),e()]),St=M([_(e(),x()),e()]);var Q=r({name:e(),arguments:M([_(e(),x()),e()])}),X=r({name:e(),arguments:M([_(e(),x()),e()])});var gu=r({id:e().default("null"),type:e().optional(),function:Q,index:m().default(0)}),sm=r({id:e().default("null"),type:e().optional(),function:X,index:m().default(0)});var Jt=M([e(),a(Vi)]);var Au=r({role:s(e()).optional(),content:s(M([e(),a(Vi)])).optional(),tool_calls:s(a(gu)).optional(),tool_call_id:s(e()).optional(),index:s(m()).optional(),metadata:s(_(e(),x())).optional()}).transform((t)=>c(t,{tool_calls:"toolCalls",tool_call_id:"toolCallId"}));var oe={Stop:"stop",Length:"length",Error:"error",ToolCalls:"tool_calls"},re=J(oe),ee=r({index:m(),delta:Au,finish_reason:s(re)}).transform((t)=>c(t,{finish_reason:"finishReason"}));var ef=r({id:e(),object:e().optional(),created:m().optional(),model:e(),usage:zo.optional(),choices:a(ee)});function am(t){return v(t,(n)=>ef.parse(JSON.parse(n)),"Failed to parse 'CompletionChunk' from JSON")}
4
- export{Xd,hi,rs,N,v,c,y,J,Gi,ut,om,Ke,M,Na,Gs,rc,Da,Vs,ns,os,an,Qs,gi,nc,Pa,Oa,Vi,Ks,gu,sm,Au,zo,oc,ef,am};
@@ -1 +0,0 @@
1
- import{t,Ue}from"./chunk-43dzhk24.js";import"./chunk-07pgpftg.js";import"./chunk-6vst0k0k.js";import"./chunk-yeb5bcxz.js";import"./chunk-x79scans.js";import"./chunk-5pcv139g.js";import"./chunk-yvz2b957.js";import"./chunk-bcqhjbpy.js";import"./chunk-1zpsbvq9.js";import"./chunk-6h76kqv2.js";import"./chunk-0jaj2807.js";import"./chunk-g82qnxw6.js";import"./chunk-twx715xf.js";import{va}from"./chunk-j6ptdqp9.js";import"./chunk-rzannb5e.js";import"./chunk-sf9ezxgy.js";import"./chunk-67ewr4j4.js";import"./chunk-mcq3pe4v.js";import"./chunk-jgnp68ez.js";import"./chunk-4tm9cw4v.js";import"./chunk-jhxcm88f.js";function p(){let{shareId:a,fileId:s}=e.useParams(),{start:n,version:o,compare:r,cmpLeft:i,cmpRight:l,cmpActive:c}=e.useSearch();return t(va,{shareId:a,initialFileId:s,startTime:n,versionId:o,compare:r,compareLeftId:i,compareRightId:l,compareActiveSide:c})}var e=Ue("/share/$shareId/files/$fileId")({component:p});export{e as Route};
@@ -1,2 +0,0 @@
1
- import{I,pp,mp,hp,gp,Ed,Cd,Id,Td,Md,eu}from"./chunk-43dzhk24.js";import{Co}from"./chunk-j95fjg69.js";import{Io}from"./chunk-sf9ezxgy.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"}]],$s=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"}]],ao=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"}]],Bo=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"}]],bn=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"}]],Gl=I("shield-alert",n);var i=[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],di=I("user-check",i);var u=[["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"}]],ui=I("dollar-sign",u);var $i={agent_total_tokens:{label:()=>Md(),icon:ao,unit:"tokens"},agent_cost:{label:()=>Cd(),icon:ui,unit:"$"},agent_mcp_call_count:{label:()=>Id(),icon:bn,unit:"calls"},agent_bash_call_count:{label:()=>Ed(),icon:Io,unit:"calls"},agent_tool_call_count:{label:()=>Td(),icon:Co,unit:"calls"}};function Ra(e,t){if(e==="agent_cost")return`$${t.toFixed(2)}`;return t.toLocaleString()}function Vl(e){switch(eu(e)){case"1hour":return mp();case"5hour":return hp();case"1day":return pp();case"7day":return gp();default:return e}}
2
- export{$s,ao,ui,Bo,bn,Gl,di,$i,Ra,Vl};
@@ -1,2 +0,0 @@
1
- import{I}from"./chunk-43dzhk24.js";var o=[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h4",key:"q8tih4"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h10",key:"jvxblo"}]],Ol=I("arrow-up-narrow-wide",o);
2
- export{Ol};
@@ -1 +0,0 @@
1
- import{h,S,t,Z,Ue,A,lt,wt,rm}from"./chunk-43dzhk24.js";import"./chunk-5pcv139g.js";import"./chunk-0jaj2807.js";import"./chunk-xmn5v64e.js";import"./chunk-twx715xf.js";import{Bi}from"./chunk-gj3vrbkx.js";import"./chunk-6xqpbkb6.js";import"./chunk-e333evwr.js";import{rr}from"./chunk-faaqparg.js";import"./chunk-rzannb5e.js";import"./chunk-2ftmxhr5.js";import"./chunk-j95fjg69.js";import"./chunk-mcq3pe4v.js";S();function p(){let{projectId:e,folderId:d}=s.useParams(),{teamId:r,ensureTeamIdForProject:i}=lt();h(()=>{i(e)},[e,i]);let{data:a}=rr(rm(e)),o=a?.rootFolder,{data:l}=Z({queryKey:["folders",o],queryFn:async()=>{let n=await A.api.folders[":folderId"].$get({param:{folderId:o}});if(!n.ok)throw Error("failed to fetch folder");return await n.json()},enabled:!!o});if(!r||!o||!l)return t(wt,{});return t(Bi,{teamId:r,projectId:e,projectName:a.name??"",assetId:d,rootFolderId:o,isRoot:!1})}var s=Ue("/projects/$projectId/folders/$folderId_/agentsmd")({component:p});export{s as Route};
@@ -1 +0,0 @@
1
- import{O,P,h,D,b,u,Yn,S,L,t,o,K,Bu,Uu,_r,Ec,Va,bo,Ht,Ko,zu,ju,qu,Hu,Cc,$u,Z,B,ft,Ue,A,I,vr,F,St,ve,Xt,Bt,Re,C,pt,_e,Y,It,xr,Ft,se,ir,E,Ce,Ie,Te,wA,xA,S0,T0,M0,xf,e_,Wm,Ne,Xa,th,ly,Oc,sh,Zs,Yo,_h,yh,iv,lv,Nh,Gv,Gw,Vw,wx,rp,np,Fx,Qx,og,zc,jS,xg,lE,uE,fp,fE,hE,Eg,AE,_E,Cg,yE,vE,kd,Rd,Nd,Sl,_p,ME,kE,RE,NE,Dd,Us,JE,fC,hC,kC,FC,ZC,BC,UC,zC,$g,jC,Zd,E1,M1,q1,sA,gn,Bp,fI,pI,Vc,Je,Xe,et,tt,rt,nt,ot,st,H,Nt,k,kl,Mn,$p,be,mt,ht,gt,Pr,Jd,Et,kt,Rt,Ut,Mt}from"./chunk-43dzhk24.js";import{To,Ar}from"./chunk-yeb5bcxz.js";import{jl}from"./chunk-1zpsbvq9.js";import{$s,Bo,Gl,di,$i,Ra,Vl}from"./chunk-nx782n1x.js";import{Rn,Nn,Dn,br,xt,_t}from"./chunk-pg5mayjc.js";import"./chunk-j95fjg69.js";import"./chunk-sf9ezxgy.js";import{Vn,io}from"./chunk-67ewr4j4.js";S();function te(a,e){let s=new Set(e);return a.filter((i)=>!s.has(i))}var ae=class extends bo{#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((c)=>c.observer.setOptions(c.defaultedQueryOptions));let m=i.map((c)=>c.observer),r=m.map((c)=>c.getCurrentResult()),p=s.length!==m.length,f=m.some((c,v)=>c!==s[v]),g=p||f,N=g?!0:r.some((c,v)=>{let y=this.#e[v];return!y||!Va(c,y)});if(!g&&!N)return;if(g)this.#d=i,this.#t=m;if(this.#e=r,!this.hasListeners())return;if(g)te(s,m).forEach((c)=>{c.destroy()}),te(m,s).forEach((c)=>{c.subscribe((v)=>{this.#p(c,v)})});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)),m=s.map((r)=>r.defaultedQueryOptions.queryHash);return[i,(r)=>this.#c(r??i,e,m),()=>this.#m(i,s)]}#m(a,e){let s=new Set;return e.map((i,m)=>{let r=a[m];return!i.defaultedQueryOptions.notifyOnChangeProps?i.observer.trackResult(r,(p)=>{if(!s.has(p))s.add(p),e.forEach((f)=>{f.observer.trackProp(p)})}):r})}#c(a,e,s){if(e){let i=this.#l,m=s!==void 0&&i!==void 0&&(i.length!==s.length||s.some((r,p)=>r!==i[p]));if(this.#e!==this.#n||m||e!==this.#i){if(this.#i=e,this.#n=this.#e,s!==void 0)this.#l=s;this.#s=Ec(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 m=i.options.queryHash;if(!m)return;let r=e.get(m);if(r)r.push(i);else e.set(m,[i])});let s=[];return a.forEach((i)=>{let m=this.#r.defaultQueryOptions(i),r=e.get(m.queryHash)?.shift()??new Ko(this.#r,m);s.push({defaultedQueryOptions:m,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=K(s),m=Bu(),r=Uu(),p=e.subscribed!==!1,f=D(()=>a.map((d)=>{let x=i.defaultQueryOptions(d);return x._optimisticResults=m?"isRestoring":p?"optimistic":void 0,x}),[a,i,m,p]);f.forEach((d)=>{Hu(d);let x=i.getQueryCache().get(d.queryHash);zu(d,r,x)}),ju(r);let[g]=u(()=>new ae(i,f,e)),[N,c,v]=g.getOptimisticResult(f,e.combine),y=!m&&p;Yn(P((d)=>y?g.subscribe(Ht.batchCalls(d)):_r,[g,y]),()=>g.getCurrentResult(),()=>g.getCurrentResult()),h(()=>{g.setQueries(f,e)},[f,e,g]);let n=N.some((d,x)=>Cc(f[x],d))?N.flatMap((d,x)=>{let _=f[x];if(_&&Cc(_,d)){let Q=new Ko(i,_);return $u(_,Q,r)}return[]}):[];if(n.length>0)throw Promise.all(n);let w=N.find((d,x)=>{let _=f[x];return _&&qu({result:d,errorResetBoundary:r,throwOnError:_.throwOnError,query:i.getQueryCache().get(_.queryHash),suspense:_.suspense})});if(w)throw w.error;return c(v())}S();S();var xe=Object.defineProperty,M=(a,e)=>xe(a,"name",{value:e,configurable:!0}),W="Collapsible",[ye,Qt]=pt(W),[we,X]=ye(W),ke=O(M(function(e,s){let{__scopeCollapsible:i,open:m,defaultOpen:r,disabled:p,onOpenChange:f,...g}=e,[N,c]=Ft({prop:m,defaultProp:r??!1,onChange:f,caller:W});return t(we,{scope:i,disabled:p,contentId:xr(),open:N,onOpenToggle:P(()=>c((v)=>!v),[c]),children:t(se.div,{"data-state":z(N),"data-disabled":p?"":void 0,...g,ref:s})})},"Collapsible")),Ae="CollapsibleTrigger",qe=O(M(function(e,s){let{__scopeCollapsible:i,...m}=e,r=X(Ae,i);return t(se.button,{type:"button","aria-controls":r.open?r.contentId:void 0,"aria-expanded":r.open||!1,"data-state":z(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...m,ref:s,onClick:Y(e.onClick,r.onOpenToggle)})},"CollapsibleTrigger")),oe="CollapsibleContent",De=O(M(function(e,s){let{forceMount:i,...m}=e,r=X(oe,e.__scopeCollapsible);return t(ir,{present:i||r.open,children:({present:p})=>t(Pe,{...m,ref:s,present:p})})},"CollapsibleContent")),Pe=O(M(function(e,s){let{__scopeCollapsible:i,present:m,children:r,...p}=e,f=X(oe,i),[g,N]=u(m),c=b(null),v=_e(s,c),y=b(0),n=y.current,w=b(0),d=w.current,x=f.open||g,_=b(x),Q=b(void 0);return h(()=>{let R=requestAnimationFrame(()=>_.current=!1);return()=>cancelAnimationFrame(R)},[]),It(()=>{let R=c.current;if(R){Q.current=Q.current||{transitionDuration:R.style.transitionDuration,animationName:R.style.animationName},R.style.transitionDuration="0s",R.style.animationName="none";let U=R.getBoundingClientRect();if(y.current=U.height,w.current=U.width,!_.current)R.style.transitionDuration=Q.current.transitionDuration,R.style.animationName=Q.current.animationName;N(m)}},[f.open,m]),t(se.div,{"data-state":z(f.open),"data-disabled":f.disabled?"":void 0,id:f.contentId,hidden:!x,...p,ref:v,style:{["--radix-collapsible-content-height"]:n?`${n}px`:void 0,["--radix-collapsible-content-width"]:d?`${d}px`:void 0,...e.style},children:x&&r})},"CollapsibleContentImpl"));function z(a){return a?"open":"closed"}M(z,"getState");var Se=ke;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"}]],j=I("messages-square",Qe);function ne({teamId:a}){let[e,s]=u("team"),[i,m]=u("1h"),{data:r,isLoading:p}=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:f,isLoading:g}=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"}),N=re({queries:(f||[]).map((d)=>({queryKey:["teams",a,"ai-usage",i,d.id],queryFn:async()=>{let x=await A.api.teams[":teamId"]["ai-usage"].$get({param:{teamId:a},query:{timeframe:i,userId:d.id}});if(!x.ok)throw Error(`Failed to fetch AI usage for member ${d.id}`);return await x.json()},enabled:!!a&&e==="members"}))}),c=g||N.some((d)=>d.isLoading),v=(d)=>{if(!d)return"U";let x=d.split(" ");if(x.length>1)return`${x[0][0]}${x[x.length-1][0]}`.toUpperCase();return d.substring(0,2).toUpperCase()},y=(d)=>{if(!d)return"";switch(d.toLowerCase()){case"owner":return zc();case"editor":return Zs();case"reviewer":return Us();default:return d}},n=(d)=>(d??0).toLocaleString(),w=(d)=>`$${(d??0).toFixed(6)}`;return o(Et,{className:"border-border/60 shadow-sm",children:[o(kt,{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between pb-6",children:[o("div",{children:[t(Rt,{className:"text-xl font-semibold tracking-tight",children:T0()}),t(Ut,{className:"text-sm text-muted-foreground mt-1",children:M0()})]}),o("div",{className:"flex flex-wrap items-center gap-3",children:[o(To,{type:"single",value:e,onValueChange:(d)=>{if(d)s(d)},className:"border rounded-lg p-1 bg-muted/30",children:[t(Ar,{value:"team",className:"px-3 py-1.5 text-xs font-medium",children:M1()}),t(Ar,{value:"members",className:"px-3 py-1.5 text-xs font-medium",children:Vw()})]}),o(To,{type:"single",value:i,onValueChange:(d)=>{if(d)m(d)},className:"border rounded-lg p-1 bg-muted/30",children:[t(Ar,{value:"1h",className:"px-2.5 py-1.5 text-xs font-medium",children:"1h"}),t(Ar,{value:"24h",className:"px-2.5 py-1.5 text-xs font-medium",children:"24h"}),t(Ar,{value:"7d",className:"px-2.5 py-1.5 text-xs font-medium",children:"7d"}),t(Ar,{value:"30d",className:"px-2.5 py-1.5 text-xs font-medium",children:"30d"})]})]})]}),t(Mt,{children:e==="team"?p?t("div",{className:"flex h-48 items-center justify-center",children:t(F,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):t("div",{className:"rounded-md border",children:o(Rn,{children:[t(Nn,{children:o(br,{children:[t(xt,{children:Zd()}),t(xt,{className:"text-right",children:Nh()}),t(xt,{className:"text-right",children:og()}),t(xt,{className:"text-right",children:Wm()}),t(xt,{className:"text-right",children:sA()}),t(xt,{className:"text-right",children:th()})]})}),t(Dn,{children:o(br,{children:[t(_t,{className:"font-medium",children:Zd()}),t(_t,{className:"text-right",children:n(r?.team?.inputTokens)}),t(_t,{className:"text-right",children:n(r?.team?.outputTokens)}),t(_t,{className:"text-right",children:n(r?.team?.cacheReadTokens)}),t(_t,{className:"text-right font-medium",children:n(r?.team?.totalTokens)}),t(_t,{className:"text-right font-medium",children:w(r?.team?.cost)})]})})]})}):c?t("div",{className:"flex h-48 items-center justify-center",children:t(F,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):t("div",{className:"rounded-md border",children:o(Rn,{children:[t(Nn,{children:o(br,{children:[t(xt,{children:Gw()}),t(xt,{children:JE()}),t(xt,{className:"text-right",children:Nh()}),t(xt,{className:"text-right",children:og()}),t(xt,{className:"text-right",children:Wm()}),t(xt,{className:"text-right",children:sA()}),t(xt,{className:"text-right",children:th()})]})}),t(Dn,{children:(f||[]).map((d,x)=>{let _=N[x]?.data?.member;return o(br,{children:[t(_t,{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:v(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(_t,{className:"text-xs text-muted-foreground",children:y(d.role)}),t(_t,{className:"text-right",children:n(_?.inputTokens)}),t(_t,{className:"text-right",children:n(_?.outputTokens)}),t(_t,{className:"text-right",children:n(_?.cacheReadTokens)}),t(_t,{className:"text-right font-medium",children:n(_?.totalTokens)}),t(_t,{className:"text-right font-medium",children:w(_?.cost)})]},d.id)})})]})})})]})}S();function le({teamId:a}){let[e,s]=u(null),{ref:i,inView:m}=Nt(),{data:r,isLoading:p,isError:f,fetchNextPage:g,hasNextPage:N,isFetchingNextPage:c}=ft({queryKey:["teams",a,"agent-sessions"],queryFn:async({pageParam:n})=>{let w=await A.api.teams[":teamId"]["agent-sessions"].$get({param:{teamId:a},query:{first:"20",after:n?String(n):void 0}});if(!w.ok)throw Error("Failed to fetch agent sessions");return await w.json()},initialPageParam:"",getNextPageParam:(n)=>n.pageInfo.cursor||void 0,enabled:!!a});h(()=>{if(m&&N&&!c)g()},[m,N,c,g]);let v=r?.pages.flatMap((n)=>n.data).filter((n)=>n.id!=="pending")||[],y=(n)=>{switch(n){case"comment":return t(be,{variant:"outline",className:"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20",children:UC()});case"chat":return t(be,{variant:"outline",className:"bg-violet-500/10 text-violet-600 dark:text-violet-400 border-violet-500/20",children:BC()});case"naming":return t(be,{variant:"outline",className:"bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/20",children:zC()});default:return t(be,{variant:"outline",className:"bg-muted text-muted-foreground border-border",children:n})}};return o("div",{className:"space-y-6",children:[o(Et,{className:"border border-border/50 shadow-xs",children:[t(kt,{className:"pb-4",children:t("div",{className:"flex items-center justify-between",children:o("div",{children:[o(Rt,{className:"text-xl font-bold flex items-center gap-2",children:[t(j,{className:"w-5 h-5 text-violet-500"}),$g()]}),t(Ut,{className:"mt-1 text-sm text-muted-foreground",children:jC()})]})})}),t(Mt,{children:p?t("div",{className:"flex h-64 items-center justify-center",children:t(F,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):f?t("div",{className:"flex h-64 items-center justify-center text-destructive",children:"Failed to load agent sessions."}):v.length===0?o("div",{className:"flex flex-col items-center justify-center py-12 text-center text-muted-foreground",children:[t(j,{className:"w-10 h-10 text-muted-foreground/40 mb-3"}),t("p",{className:"text-base font-medium",children:Fx()})]}):o("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[o(Rn,{children:[t(Nn,{className:"bg-muted/40",children:o(br,{children:[t(xt,{children:FC()}),t(xt,{children:Oc()}),t(xt,{children:ZC()}),t(xt,{className:"text-right",children:ly()})]})}),t(Dn,{children:v.map((n)=>o(br,{onClick:()=>s(n.id),className:"cursor-pointer hover:bg-muted/50 transition-colors",children:[t(_t,{className:"font-medium",children:o("div",{className:"flex flex-col",children:[t("span",{className:"text-sm font-semibold text-foreground",children:n.name||Bp()}),t("span",{className:"text-xs font-mono text-muted-foreground/70",children:n.id})]})}),t(_t,{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(_t,{children:y(n.type)}),t(_t,{className:"text-right text-xs text-muted-foreground",children:Mn(n.createdAt)})]},n.id))})]}),t("div",{ref:i,className:"py-4 flex justify-center",children:c&&t(F,{className:"h-6 w-6 animate-spin text-muted-foreground"})})]})})]}),t(jl,{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(qe,{"data-slot":"collapsible-trigger",...a})}function ce({...a}){return t(De,{"data-slot":"collapsible-content",...a})}function ee(a){switch(a.toLowerCase()){case"owner":return zc();case"editor":return Zs();case"reviewer":return Us();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:kE({value:String(e.id??"")})});if(a.resource==="agent_bash_call_count")return t("span",{children:ME({value:String(e.match??"*")})});if(a.resource==="agent_tool_call_count")return t("span",{children:RE({value:String(e.name??e.toolName??"*")})});return null}function Me({rule:a}){if(a.scopeMode==="all_members")return o(be,{variant:"secondary",className:"gap-1 text-xs",children:[t(io,{className:"h-3 w-3"}),o("span",{children:[kd(),a.role?` (${ee(a.role)})`:` (${Sl()})`]})]});if(a.scopeMode==="each_member")return o(be,{variant:"secondary",className:"gap-1 text-xs",children:[t(Vn,{className:"h-3 w-3"}),o("span",{children:[Rd(),a.role?` (${ee(a.role)})`:` (${Sl()})`]})]});return o(be,{variant:"secondary",className:"gap-1 text-xs",children:[t(di,{className:"h-3 w-3"}),o("span",{children:[Nd()," (",a.userIds?.length||0,")"]})]})}function Fe({teamId:a,rule:e,record:s}){let i=K(),[m,r]=u(!1),[p,f]=u(()=>new Date),g=$i[e.resource],N=e.scopeMode==="all_members",c=s.percent>=100,v=N?e.role?`${vE()}: ${ee(e.role)}`:NE():s.user?.name||s.userId||gn();h(()=>{if(!s.isWindowActive||!s.periodEnd)return;let n=window.setInterval(()=>f(new Date),60000);return()=>window.clearInterval(n)},[s.isWindowActive,s.periodEnd]);let y=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 w=await n.json().catch(()=>null);throw Error(Le(w,yh()))}return await n.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["teams",a,"quotas",e.id,"records"]}),i.invalidateQueries({queryKey:["teams",a,"quotas"]}),r(!1),k.success(_E())},onError:(n)=>{let w=n instanceof Error?n.message:yh();r(!1),k.error(w)}});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:[N?t("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:t(io,{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:v}),!N&&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(be,{variant:"outline",className:"hidden gap-1 border-primary/30 bg-primary/5 text-xs text-primary sm:flex",children:[t(Xt,{className:"h-3 w-3"}),t("span",{children:Eg({time:$p(s.periodEnd,p)})})]}):o(be,{variant:"secondary",className:"hidden gap-1 text-xs text-muted-foreground sm:flex",children:[t(vr,{className:"h-3 w-3 text-primary"}),t("span",{children:xg()})]}),o(E,{type:"button",variant:"outline",size:"sm",className:"gap-1.5",onClick:()=>r(!0),disabled:y.isPending,children:[y.isPending?t(F,{className:"h-3.5 w-3.5 animate-spin"}):t($s,{className:"h-3.5 w-3.5"}),Cg()]})]})]}),o("div",{className:"space-y-1.5 pt-1",children:[t(Jd,{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:c?"font-bold text-destructive":"text-foreground",children:[Ra(e.resource,s.consumed)," /"," ",Ra(e.resource,e.limit)," ",g?.unit]}),o("span",{className:c?"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(Xt,{className:"h-3 w-3"}),Eg({time:$p(s.periodEnd,p)})]}):o("span",{className:"flex items-center gap-1",children:[t(vr,{className:"h-3 w-3 text-primary"}),xg()]}),o("span",{children:[AE(),": ",Ra(e.resource,s.remaining)," ",g?.unit]})]})]}),t(Je,{open:m,onOpenChange:r,children:o(Xe,{children:[o(et,{children:[t(rt,{children:Cg()}),t(nt,{children:yE({target:v})})]}),o(tt,{children:[t(st,{disabled:y.isPending,children:Ne()}),o(ot,{onClick:(n)=>{n.preventDefault(),y.mutate()},disabled:y.isPending,children:[y.isPending&&t(F,{className:"mr-2 h-4 w-4 animate-spin"}),Xa()]})]})]})})]})}function je({teamId:a,rule:e}){let[s,i]=u(!1),[m,r]=u(""),p=$i[e.resource],f=p?.icon||Bo,{data:g,isLoading:N,isError:c}=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(_h());return await n.json()},enabled:s,refetchInterval:s?1e4:!1}),v=g?.records??[],y=v.filter((n)=>{if(!m.trim())return!0;let w=m.toLowerCase();return n.user?.name.toLowerCase().includes(w)||n.user?.email.toLowerCase().includes(w)});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?lE():fE(),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(f,{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:p?.label()||e.resource}),!e.enabled&&t(be,{variant:"secondary",children:fp()})]}),o("div",{className:"mt-1 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground",children:[t(Me,{rule:e}),o(be,{variant:"outline",className:"gap-1 text-xs",children:[t(Xt,{className:"h-3 w-3"}),Ra(e.resource,e.limit)," ",p?.unit," /"," ",Vl(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"&&v.length>3&&o("div",{className:"relative",children:[t(Bt,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),t(H,{value:m,onChange:(n)=>r(n.target.value),placeholder:_p(),className:"h-9 pl-9 text-sm"})]}),N?t("div",{className:"flex justify-center py-10",children:t(F,{className:"h-7 w-7 animate-spin text-primary"})}):c?t("div",{className:"py-8 text-center text-sm text-destructive",children:_h()}):y.length===0?t("div",{className:"py-8 text-center text-sm text-muted-foreground",children:hE()}):y.map((n,w)=>t(Fe,{teamId:a,rule:e,record:n},n.id||n.userId||`record-${w}`))]})})]})}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(Yo());return await r.json()},enabled:!!a}),m=e?.rules??[];return o(Et,{className:"border-border/60 shadow-sm",children:[o(kt,{children:[o(Rt,{className:"flex items-center gap-2 text-xl font-semibold tracking-tight",children:[t(Bo,{className:"h-5 w-5 text-primary"}),Dd()]}),t(Ut,{children:uE()})]}),t(Mt,{children:s?t("div",{className:"flex h-48 items-center justify-center",children:t(F,{className:"h-7 w-7 animate-spin text-muted-foreground"})}):i?t("div",{className:"py-10 text-center text-sm text-destructive",children:Yo()}):m.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(Bo,{className:"mb-3 h-10 w-10 text-muted-foreground/50"}),t("p",{className:"text-base font-medium text-foreground",children:np()}),t("p",{className:"mt-1 max-w-md text-sm text-muted-foreground",children:rp()})]}):t("div",{className:"space-y-3",children:m.map((r)=>t(je,{teamId:a,rule:r},r.id))})})]})}S();var $e=Object.values(kl);function pe({teamId:a}){let[e,s]=u([]),[i,m]=u([]),[r,p]=u(""),{ref:f,inView:g}=Nt(),{data:N}=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}),c=N||[],{data:v,isLoading:y,isError:n,fetchNextPage:w,hasNextPage:d,isFetchingNextPage:x}=ft({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});h(()=>{if(g&&d&&!x)w()},[g,d,x,w]);let _=v?.pages.flatMap((l)=>l.nodes)||[],Q=v?.pages[0]?.total??0,R=(l)=>{s((T)=>T.includes(l)?T.filter((q)=>q!==l):[...T,l])},U=(l)=>{m((T)=>T.includes(l)?T.filter((q)=>q!==l):[...T,l])},fe=(l)=>{if(l.includes("delete")||l.includes("remove")||l.includes("revoke"))return t(be,{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(be,{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(be,{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(be,{variant:"outline",className:"bg-muted text-muted-foreground border-border font-mono text-xs",children:l})},ge=new Map(c.map((l)=>[l.userId||l.id,l]));return t("div",{className:"space-y-6",children:o(Et,{className:"border border-border/50 shadow-xs",children:[o(kt,{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(Rt,{className:"text-xl font-bold flex items-center gap-2",children:[t($s,{className:"h-5 w-5 text-primary"}),xf()]}),t(Ut,{className:"mt-1",children:e_()})]}),Q>0&&o(be,{variant:"secondary",className:"w-fit text-xs font-normal",children:[Q," ",xf()]})]}),o("div",{className:"mt-4 flex flex-wrap items-center gap-3 pt-4 border-t border-border/40",children:[o(mt,{children:[t(ht,{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"}),iv(),e.length>0&&t(be,{variant:"secondary",className:"ml-1 px-1.5 py-0 text-[10px]",children:e.length})]})}),o(gt,{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:hC()}),t("div",{className:"max-h-60 overflow-y-auto space-y-1 pr-1",children:$e.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(Pr,{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(mt,{children:[t(ht,{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"}),lv(),i.length>0&&t(be,{variant:"secondary",className:"ml-1 px-1.5 py-0 text-[10px]",children:i.length})]})}),o(gt,{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:kC()}),t("div",{className:"max-h-60 overflow-y-auto space-y-1 pr-1",children:c.map((l)=>{let T=l.userId||l.user?.id||l.id,q=l.user?.name||l.name||T,V=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(Pr,{checked:i.includes(T),onCheckedChange:()=>U(T)}),o(Ce,{className:"h-5 w-5",children:[t(Ie,{src:V||void 0}),t(Te,{className:"text-[10px]",children:q.slice(0,2).toUpperCase()})]}),t("span",{className:"truncate",children:q})]},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:()=>m([]),children:"Clear Users"})]})]}),o("div",{className:"relative flex-1 min-w-[200px] max-w-xs",children:[t(Bt,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),t(H,{type:"text",placeholder:fC(),value:r,onChange:(l)=>p(l.target.value),className:"pl-8 pr-8 h-9 text-xs"}),r&&t("button",{onClick:()=>p(""),className:"absolute right-2.5 top-2.5 text-muted-foreground hover:text-foreground",children:t(Re,{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([]),m([]),p("")},children:"Clear all"})]})]}),o(Mt,{className:"p-0",children:[y?t("div",{className:"flex h-64 items-center justify-center",children:t(F,{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."}):_.length===0?t("div",{className:"p-12 text-center text-sm text-muted-foreground",children:wx()}):o(Rn,{children:[t(Nn,{children:o(br,{className:"hover:bg-transparent border-b border-border/50",children:[t(xt,{className:"w-[180px] text-xs font-semibold",children:xA()}),t(xt,{className:"w-[200px] text-xs font-semibold",children:pI()}),t(xt,{className:"text-xs font-semibold",children:Gv()}),t(xt,{className:"text-xs font-semibold",children:jS()}),t(xt,{className:"w-[160px] text-right text-xs font-semibold",children:q1()})]})}),t(Dn,{children:_.map((l)=>{let T=l.userId?ge.get(l.userId):null,q=T?.user?.name||T?.name||l.userId||"System",V=T?.user?.image||T?.image;return o(br,{className:"hover:bg-muted/40 transition-colors",children:[t(_t,{className:"py-3 font-medium",children:fe(l.action)}),t(_t,{className:"py-3",children:o("div",{className:"flex items-center gap-2",children:[o(Ce,{className:"h-6 w-6",children:[t(Ie,{src:V||void 0}),t(Te,{className:"text-[10px]",children:q.slice(0,2).toUpperCase()})]}),t("span",{className:"text-xs font-medium text-foreground truncate max-w-[160px]",children:l.agent?Vc({user:q,agent:l.agent.name}):q}),l.agent&&t(St,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"})]})}),t(_t,{className:"py-3 text-xs font-mono text-muted-foreground",children:l.itemId||"-"}),t(_t,{className:"py-3 text-xs font-mono text-muted-foreground",children:l.projectId||"-"}),t(_t,{className:"py-3 text-right text-xs text-muted-foreground",children:Mn(l.createdAt)})]},l.id)})})]}),t("div",{ref:f,className:"py-4 flex justify-center",children:x&&t(F,{className:"h-6 w-6 animate-spin text-muted-foreground"})})]})]})})}function ze(){let{teamId:a}=Ge.useParams(),[e,s]=u("audit-logs"),{data:i,isLoading:m}=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(m)return t("div",{className:"flex h-screen items-center justify-center",children:t(F,{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(Gl,{className:"h-12 w-12 text-destructive mb-4"}),t("h2",{className:"text-xl font-bold tracking-tight mb-2",children:wA()}),t("p",{className:"text-sm text-muted-foreground max-w-md",children:Qx()})]});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:sh()}),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:E1()}),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($s,{className:"w-5 h-5"}),xf(),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(Bo,{className:"w-5 h-5"}),Dd(),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:S0()}),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"}),fI(),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(j,{className:"w-5 h-5"}),$g(),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=Ue("/teams/$teamId/dashboard")({component:ze});export{Ge as Route};
@@ -1,2 +0,0 @@
1
- import{I}from"./chunk-43dzhk24.js";var e=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Io=I("terminal",e);
2
- export{Io};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{nf}from"./chunk-t2sqtc9p.js";export default nf();
@@ -1,2 +0,0 @@
1
- // @bun
2
- import"./chunk-r8ss8xm1.js";import{uf,NI}from"./chunk-ht64xpjp.js";export{uf as createKyselyAdapter,NI as kyselyAdapter};
@@ -1 +0,0 @@
1
- import{h,b,u,S,L,t,o,K,Si,Z,B,Me,Un,Ue,A,F,er,C,E,Ne,it,Fc,Lc,jy,fd,ki,Zb,xh,Oo,$E,Fo,Je,Xe,et,tt,rt,nt,ot,st,ue,ie,me,Ge,le,H,lt,Nt,k,on,Ur,$t,lr,gr,Lo,gA}from"./chunk-43dzhk24.js";import"./chunk-6vst0k0k.js";import"./chunk-yeb5bcxz.js";import{Wr}from"./chunk-5pcv139g.js";import"./chunk-0jaj2807.js";import{wa}from"./chunk-xmn5v64e.js";import{Xo,Ul,ts,ys}from"./chunk-x79scans.js";import{Fl,Ll}from"./chunk-g82qnxw6.js";import"./chunk-1zpsbvq9.js";import{Sa}from"./chunk-6h76kqv2.js";import{Er}from"./chunk-twx715xf.js";import"./chunk-j95fjg69.js";import"./chunk-sf9ezxgy.js";import"./chunk-67ewr4j4.js";import"./chunk-4tm9cw4v.js";import"./chunk-jhxcm88f.js";S();var kt=({item:n})=>{if(n.preview?.thumbnailUrl)return t("img",{src:n.preview.thumbnailUrl,alt:"Preview",className:"w-full h-full object-cover"});if(n.preview?.proxyType==="audio"||n.proxyType==="audio")return t("div",{className:"w-full h-full flex items-center justify-center bg-muted",children:t(Xo,{className:"w-5 h-5 text-muted-foreground"})});return t("div",{className:"w-full h-full flex items-center justify-center bg-muted",children:t(er,{className:"w-5 h-5 text-muted-foreground"})})},Te=({projectId:n,currentAssetId:s,parentFolderId:w,initialFiles:d,initialNextCursor:D})=>{let{ref:a,inView:N}=Nt({threshold:0,rootMargin:"200px"}),x=b(null),V=b(!0),[c,p]=u(d),[f,U]=u(D),[W,Y]=u(!!D),[q,g]=u(!1);return h(()=>{p(d),U(D),Y(!!D),V.current=!0},[d,D]),h(()=>{(async()=>{if(!f||q||!N||!W)return;g(!0);try{let y=await A.api.folders[":folderId"].search.$post({param:{folderId:w},json:{assetType:"file",after:f,first:200,recursively:!1,conditions:[]}});if(!y.ok)throw Error("Failed to fetch next page");let P=await y.json(),X=P.data||[];p((G)=>[...G,...X]),U(P.pageInfo?.cursor||void 0),Y(!!P.pageInfo?.cursor&&X.length>0)}catch(y){console.error("Error fetching next page:",y)}finally{g(!1)}})()},[N,f,W,q,w]),h(()=>{if(c.some((y)=>y?.id===s)&&x.current)if(V.current)x.current.scrollIntoView({block:"center",inline:"center",behavior:"auto"}),V.current=!1;else x.current.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})},[c,s]),t("div",{className:"h-24 md:h-full w-full md:w-24 bg-gray-100 dark:bg-gray-950 flex flex-row md:flex-col flex-shrink-0 select-none",children:o("div",{className:"flex-1 overflow-x-auto overflow-y-hidden md:overflow-y-auto md:overflow-x-hidden px-4 md:px-0 py-2 md:py-4 flex flex-row md:flex-col items-center gap-3 no-scrollbar",children:[c.map((m)=>{if(!m)return null;let y=m.id===s;return t("div",{ref:m.id===s?x:null,className:"flex-shrink-0",children:o(Un,{to:"/projects/$projectId/files/$fileId",params:{projectId:n,fileId:m.id},search:{version:void 0},className:C("rounded-lg border overflow-hidden flex items-center justify-center transition-all bg-muted/30 block relative",y?"w-[62px] h-[62px] opacity-100":"w-[52px] h-[52px] opacity-60 hover:opacity-100"),children:[t(kt,{item:m}),m.agent&&t("span",{className:"absolute top-1 right-1 z-10 pointer-events-none select-none rounded bg-black/60 px-1 py-0.5 text-[10px] font-medium leading-none text-white",title:m.agent.name,"data-testid":"carousel-agent-badge",children:"AI"})]})},m.id)}),W&&t("div",{ref:a,className:"px-2 md:px-0 py-2 md:py-4 flex justify-center items-center h-full md:w-full flex-shrink-0",children:q&&t(F,{className:"h-5 w-5 animate-spin text-muted-foreground"})})]})})};S();function At(){let{projectId:n,fileId:s}=$e.useParams(),w=$e.useSearch(),{version:d,start:D}=w,a=d||s,{cmpLeft:N,cmpRight:x}=w,V=w.cmpActive??"left",c=!!w.compare&&!!N&&!!x,p=b(null),{teamId:f,ensureTeamIdForProject:U}=lt(),[W,Y]=u(360),[q,g]=u([]),{fileViewRightSidebarCollapsed:m}=$t(),{isChatbotOpen:y}=lr(),P=gr((e)=>Boolean(e.metadata["appearance.hideAgent"])),[X,G]=u(0),[he,z]=u(null),[ge,Le]=u(null),[Ee,ye]=u(void 0),[_,ne]=u({show:!1,files:[],nextCursor:void 0,folderId:void 0}),Ve=A.api.files[":fileId"].metadata.$patch,{mutate:qe}=B({mutationFn:async(e)=>{let r=await Ve(e);if(!r.ok)throw Error("Failed to patch metadata");return await r.json()}}),J=K(),{members:Pe,fetchProjectMembers:Ie}=Ur(),ze=Lo();h(()=>{U(n)},[n,U]),h(()=>{if(n)Ie(n,!0)},[n,Ie]),h(()=>{if(n&&s)A.api.projects[":projectId"].recents.view.$post({param:{projectId:n},json:{assetId:s}}).catch(()=>{})},[n,s]);let{data:ve,isLoading:_e,isError:Ke,isFetching:Oe}=Z({queryKey:["files",s],queryFn:async()=>{let e=await A.api.files[":fileId"].$get({param:{fileId:s}});if(!e.ok)throw Error("Failed to fetch stack");return await e.json()},enabled:!!f,placeholderData:Si}),{data:He,isLoading:Qe,isError:Be,isFetching:We}=Z({queryKey:["files",d],queryFn:async()=>{let e=await A.api.files[":fileId"].$get({param:{fileId:d}});if(!e.ok)throw Error("Failed to fetch version");return await e.json()},enabled:!!f&&!!d,placeholderData:Si}),{data:Ye}=Z({queryKey:["version_stacks",s,"versions"],queryFn:async()=>{let e=await A.api.version_stacks[":stackId"].versions.$get({param:{stackId:s}});if(!e.ok)throw Error("Failed to fetch versions");return await e.json()},enabled:!!n&&!!s&&(!!d||c)}),{data:R}=Z({queryKey:["projects",n],queryFn:async()=>{let e=await A.api.projects[":projectId"].$get({param:{projectId:n}});if(!e.ok)throw Error("Failed to fetch project");return await e.json()}}),I=Me(),{setProjectState:we,clearProjectState:xe}=on(),Ze=_e||!!d&&Qe,at=Ke||!!d&&Be,ct=Oe||!!d&&We,i=He||ve,j=d?Ye:ve?.versionStack?.versions,l=i?.ancestorFolders?.[0]?.id??R?.rootFolder??"",[re,ee]=u(!1),[te,be]=u(""),se=b(null),ae=b(!1),[dt,ce]=u(!1),ft=A.api.files[":fileId"].$put,{mutate:pt,mutateAsync:ut,isPending:Fe}=B({mutationFn:async(e)=>{let r=await ft(e);if(!r.ok)throw Error("Failed to rename file");return await r.json()},onSuccess:()=>{J.invalidateQueries({queryKey:["files"]}),J.invalidateQueries({queryKey:["version_stacks"]}),k.success($E?.()||"Renamed successfully"),ee(!1)},onError:()=>{k.error(Zb?.()||"Failed to rename")}}),mt=A.api.files.$delete,{mutate:ht,mutateAsync:gt,isPending:ke}=B({mutationFn:async(e)=>{if(!(await mt(e)).ok)throw Error("Failed to delete file")},onSuccess:()=>{if(J.invalidateQueries({queryKey:["files"]}),J.invalidateQueries({queryKey:["version_stacks"]}),k.success(jy?.()||"Deleted"),ce(!1),l&&l!==R?.rootFolder)I({to:"/projects/$projectId/folders/$folderId",params:{projectId:n,folderId:l}});else I({to:"/projects/$projectId",params:{projectId:n}})},onError:()=>{k.error(ki?.()||"Failed to delete")}}),yt=(e)=>{if(e?.preventDefault(),!te.trim()||!a)return;pt({param:{fileId:a},json:{name:te.trim()}})},It=()=>{if(!a)return;ht({json:{ids:[a]}})};h(()=>{if(i&&R&&f)we({teamId:f,projectId:n,projectName:R.name??"",ancestorFolders:i.ancestorFolders??[],currentAsset:{id:a||s,name:i.name,type:"file",version:j?j.find((e)=>e.id===a)?.version??j.length:void 0,proxyType:i.proxyType},isRootFolder:!1,fileId:s,downloadInfo:{originalKey:i.media?.original?.key,videoTranscodes:i.media?.videoTranscodes?.map((e)=>({key:e.key,width:e.width,height:e.height,hdr:e.hdr}))},versions:j,compareMode:c,canCompareVersions:(j?.length??0)>=2,onCompareVersions:()=>{let e=Ul(j);if(!e)return;I({to:"/projects/$projectId/files/$fileId",params:{projectId:n,fileId:s},search:(r)=>({...r,version:void 0,compare:!0,cmpLeft:e.left.id,cmpRight:e.right.id,cmpActive:"left"})})},onFolderClick:(e)=>{I({to:"/projects/$projectId/folders/$folderId",params:{projectId:n,folderId:e}})},onRename:()=>{ae.current=!1,be(i?.name??""),ee(!0)},onDelete:()=>{ce(!0)}});return()=>xe()},[f,n,R,i,j,a,s,c,we,xe,I]),h(()=>{if(!re)return;let e=setTimeout(()=>{ae.current=!0},1000);return()=>clearTimeout(e)},[re]);let vt=()=>{if(ae.current)return;setTimeout(()=>{if(se.current)ys(se.current)},0)};if(h(()=>{if(!l||!a)return;if(_.folderId===l)return;let e=!0;return(async()=>{try{let v="",T=!1,M=[],fe=void 0;for(let De=0;De<5;De++){let Se=await A.api.folders[":folderId"].search.$post({param:{folderId:l},json:{assetType:"file",after:v,first:200,recursively:!1,conditions:[]}});if(!Se.ok)throw Error("Failed to search parent folder for carousel");let Q=await Se.json(),pe=Q.data||[];if(M.push(...pe),pe.some((oe)=>oe.id===a)){if(T=!0,fe=Q.pageInfo?.cursor||void 0,Q.pageInfo?.cursor)try{let oe=await A.api.folders[":folderId"].search.$post({param:{folderId:l},json:{assetType:"file",after:Q.pageInfo.cursor,first:200,recursively:!1,conditions:[]}});if(oe.ok){let Re=await oe.json(),Ft=Re.data||[];M.push(...Ft),fe=Re.pageInfo?.cursor||void 0}}catch{}break}if(!Q.pageInfo?.cursor||pe.length<200)break;v=Q.pageInfo.cursor}if(e)if(T)ne({show:!0,files:M,nextCursor:fe,folderId:l});else ne({show:!1,files:[],nextCursor:void 0,folderId:l})}catch(v){if(console.error(v),e)ne({show:!1,files:[],nextCursor:void 0,folderId:l})}})(),()=>{e=!1}},[l,a,_.folderId]),h(()=>{G(0),z(null),g([])},[i?.id]),h(()=>{z(null),g([])},[ge?.id]),h(()=>{Wr.getState().reset(),Wr.getState().setIsDrawing(!1),g([]),z(null)},[a]),Ze&&!i)return t(gA,{});if(at||!i||!R||!f)return t("div",{children:xh()});let O=c?ge:i,Ae=O?.id??a,je=(e,r)=>{if(!f)return;qe({param:{fileId:Ae},json:[{key:e,value:r}]},{onSuccess:()=>{J.invalidateQueries({queryKey:["files",Ae]})}})},de=(e)=>{I({to:"/projects/$projectId/files/$fileId",params:{projectId:n,fileId:s},search:(r)=>({...r,...e})})},wt=()=>{de({compare:void 0,cmpLeft:void 0,cmpRight:void 0,cmpActive:void 0,version:V==="left"?N:x})},xt=(e)=>{z(e.id||null);let r=e.annotations;if(r&&r.length>0)g(r);else g([]);if(c){if(e.second!==null&&e.second!==void 0)ye({second:e.second,nonce:Date.now()});return}if(e.second!==null&&e.second!==void 0)p.current?.seekTo(e.second),p.current?.pause();else if(r&&r.length>0)p.current?.pause()},bt=(e)=>{z(e.id||null);let v=e.details,T=v?.annotations;if(T&&T.length>0)g(T);else g([]);let M=v?.position?.type==="time"?v.position.seconds:v?.position?.type==="page"?v.position.page:void 0;if(c){if(M!==void 0)ye({second:M,nonce:Date.now()});return}if(M!==void 0)p.current?.seekTo(M),p.current?.pause();else if(T&&T.length>0)p.current?.pause()},Ce=()=>{g([]),z(null)};if(ze&&!c)return t(Fl,{projectId:n,teamId:f,fileId:s,file:i,projectInfo:R,ancestorFolders:i.ancestorFolders??[],parentFolderId:l,versions:j,activeFileId:a,startTime:D,siblingFiles:_.files,onNavigateToFile:(e)=>{I({to:"/projects/$projectId/files/$fileId",params:{projectId:n,fileId:e}})},onNavigateBack:()=>{if(l&&l!==R?.rootFolder)I({to:"/projects/$projectId/folders/$folderId",params:{projectId:n,folderId:l}});else I({to:"/projects/$projectId",params:{projectId:n}})},onSelectVersion:(e)=>{I({to:"/projects/$projectId/files/$fileId",params:{projectId:n,fileId:s},search:(r)=>({...r,version:e})})},onRenameFile:async(e)=>{await ut({param:{fileId:a},json:{name:e}})},onDeleteFile:async()=>{await gt({json:{ids:[a]}})},onSaveField:je});return o("div",{className:"h-full flex flex-1 flex-col bg-background",children:[o("div",{className:"h-full flex flex-1 overflow-hidden",children:[o("div",{className:"flex-1 relative",children:[ct&&!c&&t("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-background/50",children:t(F,{className:"h-8 w-8 animate-spin text-foreground"})}),c&&N&&x?t(Ll,{versions:j??[],leftId:N,rightId:x,activeSide:V,annotations:q,seekRequest:Ee,onActiveSideChange:(e)=>de({cmpActive:e}),onSwitchVersion:(e,r)=>de(e==="left"?{cmpLeft:r}:{cmpRight:r}),onExit:wt,onActiveAssetChange:Le,onPlay:Ce,onTimeUpdate:G}):t(ts,{file:i,mediaControllerRef:p,onPlay:Ce,onTimeUpdate:G,annotations:q,startTime:D,children:_.show&&t(Te,{projectId:n,currentAssetId:a,parentFolderId:l,initialFiles:_.files,initialNextCursor:_.nextCursor})})]}),(!m||y&&!P)&&o(L,{children:[t(Er,{onResize:(e)=>{Y((r)=>Math.max(300,Math.min(600,r-e)))},className:"hidden md:block"}),t("div",{style:{width:W},className:"flex-shrink-0 bg-background flex flex-col",children:y&&!P?t(wa,{projectId:n,contextAssetId:a,file:O,currentTime:X,frameRate:O?.media?.metadata?.frameRate||30,startTimecode:O?.media?.metadata?.startTimecode,onTyping:()=>{if(c)return;p.current?.pause()},onSelectMessage:bt,selectedMessageId:he}):t(Sa,{teamId:f,projectId:n,file:O,onSaveField:je,members:Pe,onCommentSelect:xt,currentTime:X,onTyping:()=>{if(c)return;p.current?.pause()},selectedCommentId:he,hideAnnotationControl:O?.proxyType==="audio"})})]})]}),t(ue,{open:re,onOpenChange:ee,children:t(ie,{children:o("form",{onSubmit:yt,children:[t(me,{children:t(le,{children:Oo()})}),t("div",{className:"py-4",children:t(H,{ref:se,value:te,onChange:(e)=>be(e.target.value),placeholder:fd?.()||"Enter new name",onFocus:vt,autoFocus:!0})}),o(Ge,{children:[t(E,{type:"button",variant:"outline",onClick:()=>ee(!1),children:Ne()}),o(E,{type:"submit",disabled:Fe||!te.trim(),children:[Fe&&t(F,{className:"mr-2 h-4 w-4 animate-spin"}),Fo()]})]})]})})}),t(Je,{open:dt,onOpenChange:ce,children:o(Xe,{children:[o(et,{children:[t(rt,{children:Lc?.()||"Delete Asset?"}),t(nt,{children:Fc?.()||"Deleted items can be recovered for 30 days before being permanently deleted."})]}),o(tt,{children:[t(st,{children:Ne()}),o(ot,{onClick:It,disabled:ke,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[ke&&t(F,{className:"mr-2 h-4 w-4 animate-spin"}),it()]})]})]})})]})}var $e=Ue("/projects/$projectId/files/$fileId")({component:At});export{$e as Route};