@shumai-one/shumai 0.2.0 → 0.2.2

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 (175) hide show
  1. package/bin/chunk-0aj303as.js +3 -0
  2. package/bin/{chunk-kbzm1pwx.js → chunk-0qkj838r.js} +1 -1
  3. package/bin/{chunk-5a2maxwp.js → chunk-0rxhc7ka.js} +2 -2
  4. package/bin/chunk-0xbf8bcg.js +2 -0
  5. package/bin/{chunk-xh2ntgmk.js → chunk-14fh4s1a.js} +2 -2
  6. package/bin/{chunk-6mn3jqm9.js → chunk-15sefy5t.js} +2 -2
  7. package/bin/{chunk-mjan6b09.js → chunk-1wm57c6y.js} +3 -3
  8. package/bin/{chunk-pf8edn5x.js → chunk-1xpec5r8.js} +2 -2
  9. package/bin/chunk-23d3968z.js +2 -0
  10. package/bin/{chunk-r3n9zpfw.js → chunk-262hkppb.js} +2 -2
  11. package/bin/{chunk-3n1k9qt5.js → chunk-29tx9qe2.js} +1 -1
  12. package/bin/chunk-2aamsc5v.js +2 -0
  13. package/bin/chunk-2aascrtb.js +2 -0
  14. package/bin/chunk-2dsmsa6a.js +3 -0
  15. package/bin/chunk-2g12s6mc.js +2 -0
  16. package/bin/chunk-31baz5n0.js +2 -0
  17. package/bin/{chunk-a5kfa0k9.js → chunk-3rmc8nz6.js} +1 -1
  18. package/bin/{chunk-dyybbn07.js → chunk-46ar48f9.js} +1 -1
  19. package/bin/chunk-4e3jbp84.js +1 -0
  20. package/bin/chunk-4jk0y1w1.js +1 -0
  21. package/bin/{chunk-7ddaxdpf.js → chunk-4qpa7b5t.js} +1 -1
  22. package/bin/{chunk-8wv3kdz9.js → chunk-54tr7y2x.js} +2 -2
  23. package/bin/{chunk-ehfk24cf.js → chunk-5d2q46mx.js} +1 -1
  24. package/bin/{chunk-2cmg5sfn.js → chunk-5m9be8an.js} +2 -2
  25. package/bin/{chunk-yk3k5g5w.js → chunk-5r8858hx.js} +2 -2
  26. package/bin/{chunk-fwe9g818.js → chunk-5t6c3038.js} +1 -1
  27. package/bin/chunk-6z65xd0w.js +3 -0
  28. package/bin/{chunk-cp18trqb.js → chunk-77r8w95d.js} +2 -2
  29. package/bin/chunk-7b17fb36.js +6 -0
  30. package/bin/chunk-7e06b2zb.js +2 -0
  31. package/bin/{chunk-29ectt6g.js → chunk-7hsgmjpa.js} +2 -2
  32. package/bin/chunk-7we7ex0m.js +3 -0
  33. package/bin/{chunk-6r9w7z15.js → chunk-88fg1sw7.js} +2 -2
  34. package/bin/chunk-891h8br6.js +3 -0
  35. package/bin/{chunk-m7jfszqt.js → chunk-8mkfgcvb.js} +2 -2
  36. package/bin/chunk-8qg47kj6.js +3 -0
  37. package/bin/chunk-8tf6kgdj.js +2 -0
  38. package/bin/{chunk-s8d2045p.js → chunk-8wqfkm4c.js} +1 -1
  39. package/bin/{chunk-3rajscaz.js → chunk-922nnh39.js} +1 -1
  40. package/bin/{chunk-aakzq0w1.js → chunk-925q4paa.js} +1 -1
  41. package/bin/{chunk-frm7vz6v.js → chunk-92xxys10.js} +6 -6
  42. package/bin/chunk-97jzve52.js +4 -0
  43. package/bin/{chunk-w4y97tzy.js → chunk-9ab6k4rq.js} +1 -1
  44. package/bin/chunk-9avkn3x1.js +3 -0
  45. package/bin/{chunk-22dje1f5.js → chunk-9h027f50.js} +1 -1
  46. package/bin/{chunk-ec88pb09.js → chunk-9h3ds7rn.js} +2 -2
  47. package/bin/chunk-av71yjaa.js +1 -0
  48. package/bin/{chunk-xpqcvxej.js → chunk-b8js74jk.js} +1 -1
  49. package/bin/chunk-bd71dp4j.js +8 -0
  50. package/bin/{chunk-yhj8c5re.js → chunk-bs0fjz3w.js} +2 -2
  51. package/bin/chunk-byqc8tzq.js +1 -0
  52. package/bin/chunk-c45rh4hk.js +3 -0
  53. package/bin/chunk-ccw7mjgq.js +5 -0
  54. package/bin/{chunk-3x62t1m0.js → chunk-cxhmr356.js} +1 -1
  55. package/bin/chunk-d2vxmn9v.js +3 -0
  56. package/bin/chunk-d3wmdjze.js +8 -0
  57. package/bin/{chunk-z42cyc20.js → chunk-de99643r.js} +2 -2
  58. package/bin/{chunk-4kk5g619.js → chunk-dghtwyq1.js} +2 -2
  59. package/bin/chunk-dqgv5yy1.js +6 -0
  60. package/bin/chunk-e3s3rz2e.js +12 -0
  61. package/bin/chunk-e52nga6c.js +3 -0
  62. package/bin/chunk-e7ndw3hg.js +12 -0
  63. package/bin/chunk-f14sqw1d.js +1 -0
  64. package/bin/chunk-f7sbkfmk.js +2 -0
  65. package/bin/{chunk-mnv6pj0k.js → chunk-fa2g2wge.js} +2 -2
  66. package/bin/{chunk-fcb14agg.js → chunk-fbte2rmd.js} +1 -1
  67. package/bin/chunk-fcvtgx1y.js +7 -0
  68. package/bin/chunk-fd5a3pdd.js +1 -0
  69. package/bin/{chunk-49ej1y67.js → chunk-fepymbka.js} +2 -2
  70. package/bin/{chunk-j8q688sx.js → chunk-fz88kkk1.js} +2 -2
  71. package/bin/chunk-g6zzg6v2.js +1 -0
  72. package/bin/chunk-g8th86na.js +2 -0
  73. package/bin/chunk-gswbc6y9.js +2 -0
  74. package/bin/{chunk-d1ka11hc.js → chunk-gtrc5ka2.js} +1 -1
  75. package/bin/chunk-h0ytx8zc.js +2 -0
  76. package/bin/{chunk-gdm6y33a.js → chunk-hkbybhww.js} +1 -1
  77. package/bin/chunk-hr97a5j5.js +4 -0
  78. package/bin/{chunk-dypsm6m2.js → chunk-j8qtab70.js} +1 -1
  79. package/bin/{chunk-hdk93ghf.js → chunk-jf3vn5c3.js} +2 -2
  80. package/bin/{chunk-ajqsprm0.js → chunk-kfhtk3eh.js} +2 -2
  81. package/bin/chunk-kr06nrbx.js +2 -0
  82. package/bin/{chunk-9rw65s3e.js → chunk-m4zpf9gg.js} +2 -2
  83. package/bin/{chunk-y1xs4c5j.js → chunk-mqjzmn0e.js} +1 -1
  84. package/bin/{chunk-d2y3rbjm.js → chunk-mzg1h07d.js} +1 -1
  85. package/bin/{chunk-ysq64j13.js → chunk-n4meg9wb.js} +1 -1
  86. package/bin/{chunk-acxm86fh.js → chunk-nrwna4ha.js} +1 -1
  87. package/bin/chunk-nyhqy6q2.js +62 -0
  88. package/bin/{chunk-4zq8vxcy.css → chunk-pmswtfe3.css} +1 -1
  89. package/bin/chunk-pq18zenh.js +2 -0
  90. package/bin/chunk-pxw97qbq.js +3 -0
  91. package/bin/chunk-q09dfja5.js +3 -0
  92. package/bin/{chunk-m54p1cvp.js → chunk-q24epdh8.js} +2 -2
  93. package/bin/{chunk-k5w64spz.js → chunk-qksb0v3c.js} +2 -2
  94. package/bin/chunk-qqk51620.js +2 -0
  95. package/bin/chunk-r0w920zb.js +1 -0
  96. package/bin/{chunk-08m8mzfa.js → chunk-re0b7sj7.js} +1 -1
  97. package/bin/chunk-rtngbgpk.js +7 -0
  98. package/bin/{chunk-5tmf3c0g.js → chunk-ry33f2qk.js} +2 -2
  99. package/bin/{chunk-9n0etqsy.js → chunk-s1n39qte.js} +1 -1
  100. package/bin/{chunk-3qdn3pty.js → chunk-s46zwr4p.js} +1 -1
  101. package/bin/chunk-s8t74q9m.js +1 -0
  102. package/bin/chunk-sd86v1e6.js +1 -0
  103. package/bin/{chunk-kpy0kpna.js → chunk-srn8t0v7.js} +2 -2
  104. package/bin/chunk-szzff7gd.js +1 -0
  105. package/bin/{chunk-fwf8yne2.js → chunk-t3t6021k.js} +2 -2
  106. package/bin/{chunk-eadb78m8.js → chunk-ta7bfdrn.js} +1 -1
  107. package/bin/chunk-thsbcbay.js +8 -0
  108. package/bin/chunk-tspps87j.js +1 -0
  109. package/bin/chunk-w7dn1m95.js +2 -0
  110. package/bin/chunk-w88219ex.js +3 -0
  111. package/bin/{chunk-pqm0g14r.js → chunk-wc8sc9r9.js} +2 -2
  112. package/bin/chunk-wg98cacx.js +2 -0
  113. package/bin/chunk-wsyg4rwg.js +2 -0
  114. package/bin/{chunk-n5hfy93f.js → chunk-xcwbg4w9.js} +3 -3
  115. package/bin/{chunk-dgx2zxze.js → chunk-xyjw8w3r.js} +2 -2
  116. package/bin/chunk-y2qp11v9.js +1 -0
  117. package/bin/{chunk-1fpqq6ed.js → chunk-ybhgmvxa.js} +2 -2
  118. package/bin/{chunk-1wq9hjjr.js → chunk-ygz6pawn.js} +1 -1
  119. package/bin/{chunk-mv79zk8q.js → chunk-ymeycphq.js} +3 -3
  120. package/bin/{chunk-wv4fe1fj.js → chunk-zemrvz79.js} +2 -2
  121. package/bin/{chunk-3rt9mnj3.js → chunk-ztmj61z9.js} +1 -1
  122. package/bin/chunk-zzx99j8t.js +2 -0
  123. package/bin/shumai-app.html +1 -1
  124. package/bin/shumai-app.js +308 -283
  125. package/package.json +7 -7
  126. package/prisma/migrations/20260722022359_add_skill_permission/migration.sql +2 -0
  127. package/prisma/migrations/20260723025234_add_ai_usage_table/migration.sql +28 -0
  128. package/prisma/migrations/20260723032755_add_ai_usage_unique_constraint/migration.sql +8 -0
  129. package/prisma/schema.prisma +26 -0
  130. package/bin/chunk-09wp20mv.js +0 -1
  131. package/bin/chunk-0at8vxt5.js +0 -3
  132. package/bin/chunk-0zv7f9ca.js +0 -2
  133. package/bin/chunk-2k4vp654.js +0 -2
  134. package/bin/chunk-2s5a64nr.js +0 -2
  135. package/bin/chunk-2tbya52d.js +0 -2
  136. package/bin/chunk-2vs3evc7.js +0 -14
  137. package/bin/chunk-33169en9.js +0 -8
  138. package/bin/chunk-33ee1cvv.js +0 -2
  139. package/bin/chunk-3m39v371.js +0 -1
  140. package/bin/chunk-4hnrd4qh.js +0 -2
  141. package/bin/chunk-6c4c7t0n.js +0 -1
  142. package/bin/chunk-6frqqxkv.js +0 -1
  143. package/bin/chunk-7rhjej0x.js +0 -3
  144. package/bin/chunk-7wvgtw25.js +0 -3
  145. package/bin/chunk-8s0ae37g.js +0 -1
  146. package/bin/chunk-94h8644q.js +0 -2
  147. package/bin/chunk-ac2ky3q0.js +0 -12
  148. package/bin/chunk-axx5bh38.js +0 -2
  149. package/bin/chunk-cthpdt54.js +0 -11
  150. package/bin/chunk-d0earxhc.js +0 -4
  151. package/bin/chunk-d0n8nxp3.js +0 -3
  152. package/bin/chunk-d22pyc5n.js +0 -1
  153. package/bin/chunk-dmgjse02.js +0 -4
  154. package/bin/chunk-e5833tbd.js +0 -2
  155. package/bin/chunk-g7wrxnmd.js +0 -1
  156. package/bin/chunk-gk7158n4.js +0 -2
  157. package/bin/chunk-hb5v9ees.js +0 -2
  158. package/bin/chunk-jrvrg4fx.js +0 -1
  159. package/bin/chunk-k712q1zj.js +0 -2
  160. package/bin/chunk-kef0rnwn.js +0 -1
  161. package/bin/chunk-n296vcfw.js +0 -3
  162. package/bin/chunk-n6jgyv4y.js +0 -3
  163. package/bin/chunk-nar4s9v9.js +0 -3
  164. package/bin/chunk-nn8e9j7c.js +0 -1
  165. package/bin/chunk-nwtb6dt1.js +0 -62
  166. package/bin/chunk-ps4h3387.js +0 -5
  167. package/bin/chunk-q4f5vvtx.js +0 -2
  168. package/bin/chunk-qqesrgjk.js +0 -7
  169. package/bin/chunk-qz9xht6d.js +0 -2
  170. package/bin/chunk-symna5cj.js +0 -1
  171. package/bin/chunk-twzgpwst.js +0 -2
  172. package/bin/chunk-vgvmt2m1.js +0 -2
  173. package/bin/chunk-w4t9n9te.js +0 -6
  174. package/bin/chunk-z14hh99h.js +0 -2
  175. package/bin/chunk-zsdwska1.js +0 -1
@@ -1 +0,0 @@
1
- import{a as v}from"./chunk-gk7158n4.js";import"./chunk-hb5v9ees.js";import"./chunk-ps4h3387.js";import"./chunk-dgx2zxze.js";import"./chunk-axx5bh38.js";import"./chunk-e5833tbd.js";import"./chunk-q4f5vvtx.js";import"./chunk-33ee1cvv.js";import"./chunk-kpy0kpna.js";import"./chunk-ajqsprm0.js";import"./chunk-xpqcvxej.js";import"./chunk-4hnrd4qh.js";import"./chunk-twzgpwst.js";import"./chunk-6mn3jqm9.js";import"./chunk-fwf8yne2.js";import"./chunk-cp18trqb.js";import"./chunk-8wv3kdz9.js";import"./chunk-j8q688sx.js";import"./chunk-pf8edn5x.js";import"./chunk-5a2maxwp.js";import"./chunk-4kk5g619.js";import"./chunk-mnv6pj0k.js";import{bg as k,sg as q}from"./chunk-nwtb6dt1.js";import"./chunk-kbzm1pwx.js";function B(){let{shareId:w,folderId:A}=C.useParams();return k(v,{shareId:w,initialFolderId:A})}var C=q("/share/$shareId/folders/$folderId")({component:B});export{C as Route};
@@ -1,2 +0,0 @@
1
- import{Ve as Rf,We as Lf,Xe as Vf,Ye as Cf,bf as Hf,cf as Jf,df as Kf,ef as Qf,ff as Wf,if as _f}from"./chunk-cp18trqb.js";import{mf as Zf,nf as Gf}from"./chunk-8wv3kdz9.js";import{Mf as zf}from"./chunk-pf8edn5x.js";import{Xf as $f}from"./chunk-mnv6pj0k.js";import{Dh as o,Eg as i,Gh as s,Kg as x,Kh as ff,Pi as D,Vi as Sf,Wi as a,Xi as Nf,Yi as Uf,Zi as W,ag as O,aj as qf,bg as f,bh as e,bj as g,cg as V,cj as p,dj as l,ej as c,gh as j,hh as r,hj as X,jj as Xf,ng as u,pg as d,wh as n}from"./chunk-nwtb6dt1.js";function Yf({teamId:K,projectId:L,projectName:_,ancestorFolders:B,currentAsset:U,isRootFolder:Y,displayStyle:E,onDisplayStyleChange:h,isLeftSidebarCollapsed:P,onLeftSidebarToggle:T,isRightSidebarCollapsed:$,onRightSidebarToggle:v,isChatbotOpen:Z=!1,onChatbotToggle:N,isPublic:Q=!1,onFolderClick:w,fileId:q,shareId:G,downloadInfo:z,versions:S,compareMode:J=!1,canCompareVersions:b=!1,onCompareVersions:A}){let k=u(),{canEdit:y}=Xf(L),I=!1,m=(R)=>{if(!q)return;if(Q&&G){k({to:"/share/$shareId/files/$fileId",params:{shareId:G,fileId:q},search:(C)=>({...C,version:R})});return}if(!L)return;k({to:"/projects/$projectId/files/$fileId",params:{projectId:L,fileId:q},search:(C)=>({...C,version:R})})},M=async(R)=>{if(!q)return;try{let C=G?await i.api.shares[":shareId"].files[":fileId"]["download-url"].$post({param:{shareId:G,fileId:q},json:{key:R}}):await i.api.files["download-url"].$post({json:{key:R,assetId:q}});if(!C.ok)return;let{url:H}=await C.json(),F=document.createElement("a");F.href=H,F.download="",document.body.appendChild(F),F.click(),document.body.removeChild(F)}catch{}},Bf=U.proxyType!=="audio"&&z?.videoTranscodes&&z.videoTranscodes.filter((R)=>!R.isRaw).length>0,Ef=Q?[{name:_,id:"root"},...B.slice().reverse().map((R)=>({name:R.name||"",id:R.id}))]:[{name:X.all_projects(),path:`/teams/${K}`,isMuted:!0},{name:_,path:`/projects/${L}`},...B.slice().reverse().map((R)=>({name:R.name||"",path:`/projects/${L}/folders/${R.id}`}))];return V("div",{className:"flex h-14 flex-wrap items-center justify-between gap-2 border-b border-border bg-card px-4 py-2",children:[V("div",{className:"flex min-w-0 flex-shrink items-center gap-1",children:[Ef.map((R,C)=>V("div",{className:"flex items-center gap-1",children:[C>0&&f("span",{className:"text-muted-foreground",children:"/"}),R.path?f(d,{to:R.path,className:D("truncate rounded px-2 py-1 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground",R.isMuted?"text-muted-foreground":"text-foreground"),children:R.name}):f("button",{onClick:()=>R.id&&w?.(R.id),className:"truncate rounded px-2 py-1 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground text-foreground",children:R.name})]},C)),!Y&&!J&&V("div",{className:"flex items-center gap-1",children:[f("span",{className:"text-muted-foreground",children:"/"}),U.type==="folder"?f("span",{className:"truncate rounded px-2 py-1 text-sm font-medium text-foreground",children:U.name}):V(Sf,{children:[V(Nf,{className:"flex items-center gap-1 truncate rounded px-2 py-1 text-sm font-medium text-foreground transition-colors hover:bg-accent hover:text-accent-foreground",children:[f("span",{children:U.name}),U.version!==void 0&&V(zf,{variant:"outline",className:"px-1 py-0 text-xs",children:["v",U.version]}),f(r,{className:"h-4 w-4"})]}),V(Uf,{className:"w-56",children:[Bf?V(p,{children:[f(l,{className:"flex items-center gap-2",children:f("span",{children:X.download()})}),f(a,{children:V(c,{className:"w-48",children:[f(qf,{children:X.download()}),z?.videoTranscodes?.filter((R)=>!R.isRaw).map((R)=>{let C=Math.max(R.width,R.height),H=`${R.height}p`;if(C>=3840)H="2160p";else if(C>=1920)H="1080p";else if(C>=1280)H="720p";else if(C>=960)H="540p";else if(C>=640)H="360p";else if(C>=320)H="180p";return V(W,{onClick:()=>M(R.key),className:"flex items-center justify-between",children:[f("span",{children:H}),f("span",{className:"text-xs text-muted-foreground",children:"MP4"})]},H)}),z?.originalKey&&V(O,{children:[f(g,{}),V(W,{onClick:()=>M(z.originalKey),className:"flex items-center justify-between",children:[f("span",{children:"Original"}),f("span",{className:"text-xs text-muted-foreground",children:U.name?.split(".").pop()?.toUpperCase()||"RAW"})]})]})]})})]}):f(W,{onClick:()=>z?.originalKey&&M(z.originalKey),disabled:!z?.originalKey,children:X.download()}),y&&f(W,{onClick:()=>console.log("Rename"),children:"Rename"}),y&&f(W,{onClick:()=>console.log("Delete"),children:"Delete"}),b&&A&&V(O,{children:[f(g,{}),V(W,{onClick:()=>A(),children:[f(x,{className:"h-4 w-4"}),f("span",{children:X.compare_versions()})]})]}),S&&S.length>0&&V(O,{children:[f(g,{}),V(p,{children:[V(l,{className:"flex items-center gap-2",children:[f(o,{className:"h-4 w-4"}),f("span",{children:"Versions"})]}),f(a,{children:V(c,{className:"w-80 p-1",children:[f("div",{className:"flex flex-col gap-1 max-h-96 overflow-y-auto",children:S.map((R)=>{let C=U.version===R.version;return V(W,{onClick:()=>m(R.id),className:"flex items-center gap-3 py-2 px-3 rounded-md cursor-pointer focus:bg-accent focus:text-accent-foreground",children:[V("div",{className:"flex-shrink-0 flex items-center justify-center bg-muted dark:bg-muted-foreground/20 text-muted-foreground dark:text-muted-foreground rounded-full px-2 py-0.5 text-xs font-semibold select-none min-w-[2rem]",children:["v",R.version]}),f("div",{className:"h-10 w-16 flex-shrink-0 overflow-hidden rounded-md border border-border bg-muted flex items-center justify-center",children:R.previewUrl?f("img",{src:R.previewUrl,alt:R.name||void 0,className:"h-full w-full object-cover"}):f(n,{className:"h-4 w-4 text-muted-foreground"})}),V("div",{className:"flex flex-col flex-1 min-w-0 text-left",children:[f("span",{className:"truncate text-sm font-semibold text-foreground",children:R.name}),f("span",{className:"truncate text-xs text-muted-foreground",children:R.creator?.name||"Unknown"})]}),C&&f(j,{className:"h-4 w-4 text-primary ml-auto flex-shrink-0"})]},R.id)})}),f(g,{}),f("div",{className:"p-1",children:f("button",{className:"w-full text-center text-xs font-medium py-2 px-3 rounded-md bg-muted/80 hover:bg-muted text-foreground transition-colors",onClick:()=>console.log("Manage versions"),children:"Manage versions..."})})]})})]})]})]})]})]})]}),V("div",{className:"flex items-center gap-2",children:[V("div",{className:"flex flex-shrink-0 items-center gap-1 rounded-md border border-border bg-background p-1",children:[!q&&!Q&&T&&f("button",{onClick:T,className:"rounded p-1.5 text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground",title:P?"Show Left Sidebar":"Hide Left Sidebar",children:P?f(Hf,{className:"h-4 w-4"}):f(Kf,{className:"h-4 w-4 fill-primary stroke-0"})}),!q&&!Q&&E&&h&&V(O,{children:[f("button",{onClick:()=>h("card"),className:`rounded p-1.5 transition-colors ${E==="card"?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"}`,title:"Card View",children:f(s,{className:"h-4 w-4"})}),f("button",{onClick:()=>h("list"),className:`rounded p-1.5 transition-colors ${E==="list"?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"}`,title:"List View",children:f(ff,{className:"h-4 w-4"})})]}),f("button",{onClick:v,className:`rounded p-1.5 transition-colors ${!$&&!Z?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"}`,title:$?"Show Right Sidebar":"Hide Right Sidebar",children:!$&&!Z?f(Qf,{className:"h-4 w-4 fill-primary stroke-0"}):f(Jf,{className:"h-4 w-4"})})]}),!Q&&N&&f(Rf,{children:V(Lf,{children:[f(Vf,{asChild:!0,children:f("span",{children:f("button",{disabled:!1,onClick:N,className:D("h-9 w-9 flex items-center justify-center rounded-full border border-border bg-background transition-colors",Z?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground",!1),children:Z?f(Wf,{className:"h-6 w-6 text-primary transition-colors"}):f(e,{className:"h-6 w-6 text-muted-foreground transition-colors"})})})}),f(Cf,{children:f("p",{children:Z?X.hide_chatbot():X.show_chatbot()})})]})})]})]})}function cf(){let{projectState:K}=Zf(),L=$f(),{isChatbotOpen:_,setIsChatbotOpen:B}=Gf();if(!K)return f(hf,{});let{teamId:U,projectId:Y,projectName:E,ancestorFolders:h,currentAsset:P,isRootFolder:T,fileId:$,downloadInfo:v,versions:Z,isPublic:N,shareId:Q,onFolderClick:w,compareMode:q,canCompareVersions:G,onCompareVersions:z}=K,S=!!$,J=!!Q&&!S,b=S?L.fileViewLeftSidebarCollapsed:J?L.shareConfigLeftSidebarCollapsed:L.fileListLeftSidebarCollapsed,A=N?void 0:()=>S?L.setFileViewLeftSidebarCollapsed(!L.fileViewLeftSidebarCollapsed):J?L.setShareConfigLeftSidebarCollapsed(!L.shareConfigLeftSidebarCollapsed):L.setFileListLeftSidebarCollapsed(!L.fileListLeftSidebarCollapsed),k=N&&K.isRightSidebarCollapsed!==void 0?K.isRightSidebarCollapsed:S?L.fileViewRightSidebarCollapsed:J?L.shareConfigRightSidebarCollapsed:L.fileListRightSidebarCollapsed,y=N&&K.onRightSidebarToggle?K.onRightSidebarToggle:()=>{if(!N&&_)if(B(!1),S)L.setFileViewRightSidebarCollapsed(!1);else if(J)L.setShareConfigRightSidebarCollapsed(!1);else L.setFileListRightSidebarCollapsed(!1);else if(S)L.setFileViewRightSidebarCollapsed(!L.fileViewRightSidebarCollapsed);else if(J)L.setShareConfigRightSidebarCollapsed(!L.shareConfigRightSidebarCollapsed);else L.setFileListRightSidebarCollapsed(!L.fileListRightSidebarCollapsed)},I=N?void 0:()=>{B(!_)},m=Y?L.viewModes[Y]??"card":"card";return f(Yf,{teamId:U,projectId:Y,projectName:E,ancestorFolders:h,currentAsset:P,isRootFolder:T,displayStyle:S||J?void 0:m,onDisplayStyleChange:S||J?void 0:N?void 0:(t)=>{if(Y)L.setViewMode(Y,t)},isLeftSidebarCollapsed:b,onLeftSidebarToggle:A,isRightSidebarCollapsed:k,onRightSidebarToggle:y,isChatbotOpen:!N&&_,onChatbotToggle:I,isPublic:N,shareId:Q,fileId:$,downloadInfo:v,versions:Z,onFolderClick:w,compareMode:q,canCompareVersions:G,onCompareVersions:z})}function hf(){return f("div",{className:"flex h-14 flex-wrap items-center justify-center gap-2 border-b border-border bg-card px-4 py-2 flex-shrink-0",children:f(_f,{className:"w-10 h-10 text-orange-600"})})}
2
- export{cf as ve};
@@ -1,2 +0,0 @@
1
- import{e as DG,f as PG}from"./chunk-49ej1y67.js";import{g as RG}from"./chunk-2s5a64nr.js";import{h as NG}from"./chunk-ps4h3387.js";import{n as wG}from"./chunk-dgx2zxze.js";import{I as MG,v as OG}from"./chunk-axx5bh38.js";import{ga as kG}from"./chunk-33ee1cvv.js";import{Ea as k,Ga as QG,Ha as UG,Ia as EG,Ra as LG,Ua as qG,Wa as c}from"./chunk-kpy0kpna.js";import{mf as KG,nf as n}from"./chunk-8wv3kdz9.js";import{Lf as zG}from"./chunk-6r9w7z15.js";import{Xf as WG}from"./chunk-mnv6pj0k.js";import{$f as $J,Eg as $,Pi as $G,ag as p,bg as Z,cg as W,dg as AG,fg as m,hg as BG,hj as HG,ig as I,jj as TG,ng as VG}from"./chunk-nwtb6dt1.js";import{Zj as VJ}from"./chunk-kbzm1pwx.js";var Y=VJ($J(),1);function HJ({teamId:_,projectId:X,projectName:P,assetId:A,rootFolderId:M,collection:z,onUpdateCollection:vG}){let N=VG(),o=AG(),{canEdit:xG}=TG(X),{setFields:r}=OG(),yG=$.api.files[":fileId"].metadata.$patch,{mutate:bG}=BG({mutationFn:async(G)=>{if(!(await yG(G)).ok)throw Error("Failed to patch metadata");return null}}),{data:v}=m({queryKey:["fields",X],queryFn:async()=>{let G=await $.api.projects[":projectId"].fields.$get({param:{projectId:X}});if(!G.ok)throw Error("Failed to fetch fields");return await G.json()},enabled:!!X});Y.useEffect(()=>{if(v)r(v,X)},[v,X,r]);let B=A==="recently-deleted",[CG,x]=Y.useState(null),[H,w]=Y.useState(new Set),[y,l]=Y.useState(null),[hG,FG]=Y.useState(240),[gG,uG]=Y.useState(360),{isChatbotOpen:b}=n(),{members:fG,fetchMembers:i}=MG(),{metadata:jG,fetchMetadata:a,setMetadata:SG}=zG();Y.useEffect(()=>{if(_)i(_),a(_)},[_,i,a]);let C=Y.useMemo(()=>{return z?.filter?.searchFilter?.conditions||[]},[z]),[O,h]=Y.useState(C);Y.useEffect(()=>{h(C)},[C]);let d=`project:${X}:sort`,Q=jG[d]||{field:"custom",order:"asc"},pG=(G)=>{if(G)SG(_,d,G)},K=!!z,F=O.length>0||K,{fileListLeftSidebarCollapsed:s,setFileListLeftSidebarCollapsed:mG,fileListRightSidebarCollapsed:t,setFileListRightSidebarCollapsed:IG,viewModes:nG}=WG(),e=nG[X]??"card",cG=Y.useRef(null),{data:R}=B?{data:void 0}:m({queryKey:["folders",A],queryFn:async()=>{let G=await $.api.folders[":folderId"].$get({param:{folderId:A}});if(!G.ok)throw Error("failed to fetch folder");return await G.json()}}),{setProjectState:GG,clearProjectState:JG}=KG();Y.useEffect(()=>{return GG({teamId:_,projectId:X,projectName:P,ancestorFolders:R?.ancestorFolders??[],currentAsset:B?{name:"Recently Deleted",type:"folder"}:K?{name:z.name,type:"folder"}:{name:R?.name,type:"folder"},isRootFolder:!B&&!K&&A===M,onFolderClick:(G)=>{N({to:"/projects/$projectId/folders/$folderId",params:{projectId:X,folderId:G}})}}),()=>JG()},[_,X,P,R,B,A,M,GG,JG,N]);let{data:g,fetchNextPage:oG,hasNextPage:rG,isFetchingNextPage:lG}=I({queryKey:B?["projects",X,"recently-deleted","folder"]:["search",_,A,"folder",O,Q,K],queryFn:async({pageParam:G})=>{if(B||K){if(B){let V=await $.api.projects[":projectId"]["recently-deleted"].$get({param:{projectId:X},query:{assetType:"folder",after:G}});if(!V.ok)throw Error("failed to fetch recently deleted folders");return await V.json()}return{data:[],pageInfo:{total:0}}}if(F)return{data:[],pageInfo:{total:0}};let J=await $.api.folders[":folderId"].search.$post({param:{folderId:A},json:{assetType:"folder",after:G,recursively:!1,sort:Q,conditions:[]}});if(!J.ok)throw Error("failed to search folders");return await J.json()},enabled:!F,initialPageParam:"",getNextPageParam:(G)=>{return G.pageInfo?.cursor||void 0}}),{data:u,fetchNextPage:iG,hasNextPage:aG,isFetchingNextPage:dG}=I({queryKey:B?["projects",X,"recently-deleted","file"]:["search",_,A,"file",O,Q,K],queryFn:async({pageParam:G})=>{if(B){let V=await $.api.projects[":projectId"]["recently-deleted"].$get({param:{projectId:X},query:{assetType:"file",after:G}});if(!V.ok)throw Error("failed to fetch recently deleted files");return await V.json()}let J=await $.api.folders[":folderId"].search.$post({param:{folderId:A},json:{assetType:"file",after:G,recursively:F||K,conditions:O,sort:Q}});if(!J.ok)throw Error("failed to search files");return await J.json()},initialPageParam:"",getNextPageParam:(G)=>{return G.pageInfo?.cursor||void 0}}),D=g?.pages.flatMap((G)=>G.data??[])??[],T=u?.pages.flatMap((G)=>G.data??[])??[],sG=g?.pages[0]?.pageInfo?.total,tG=u?.pages[0]?.pageInfo?.total,eG=g?.pages[0]?.pageInfo?.totalSize,GJ=u?.pages[0]?.pageInfo?.totalSize,XG=()=>{w(new Set),x(null),l(null)},{dragState:U,handleDragStart:JJ,handleDragEnd:XJ}=PG({teamId:_,projectId:X,assetId:A,folders:D,files:T,selectedIds:H,onClearSelection:XG}),f=Y.useMemo(()=>{if(H.size!==1)return null;let G=Array.from(H)[0];return T.find((V)=>V.id===G)||null},[H,T]),YJ=(G)=>{if(B)return;if(G.type==="folder")h([]),N({to:"/projects/$projectId/folders/$folderId",params:{projectId:X,folderId:G.id}});else N({to:"/projects/$projectId/files/$fileId",params:{projectId:X,fileId:G.versionStack?G.versionStack.id:G.id},search:{version:void 0}})},ZJ=(G,J)=>{let V=J.metaKey||J.ctrlKey;if(J.shiftKey&&y){let ZG=[...D,...T].find((L)=>L.id===y);if(ZG)if(ZG.type===G.type){let L=G.type==="folder"?D:T,j=L.findIndex((q)=>q.id===y),S=L.findIndex((q)=>q.id===G.id);if(j!==-1&&S!==-1){let q=Math.min(j,S),_J=Math.max(j,S),AJ=L.slice(q,_J+1),_G=new Set(H);AJ.forEach((BJ)=>{_G.add(BJ.id)}),w(_G),x(G);return}}else return}if(V){let E=new Set(H);if(E.has(G.id))E.delete(G.id);else E.add(G.id);w(E)}else w(new Set([G.id]));l(G.id),x(G)},YG=(G,J,V)=>{bG({param:{fileId:G},json:[{key:J,value:V}]},{onSuccess:()=>{o.invalidateQueries({queryKey:["folders",A,"children",{assetType:"file"}]}),o.invalidateQueries({queryKey:["search",_,A]})}})};return W(LG,{modifiers:[DG.configure({anchor:{x:0,y:0}})],plugins:(G)=>G.map((J)=>{if(J===k)return k.configure({dropAnimation:null});if(typeof J==="object"&&J!==null&&"plugin"in J&&J.plugin===k)return k.configure({dropAnimation:null});return J}),sensors:B||!xG?[]:[EG.configure({activationConstraints:[new UG.Distance({value:10})]}),QG],onDragStart:JJ,onDragEnd:XJ,children:[Z("div",{className:"flex flex-1 flex-col bg-background min-h-0",children:W("div",{ref:cG,className:"flex flex-1 overflow-hidden relative",children:[!s&&Z("div",{className:"md:hidden fixed inset-0 bg-black/50 z-40",onClick:()=>mG(!0)}),(!t||b)&&Z("div",{className:"md:hidden fixed inset-0 bg-black/50 z-40",onClick:()=>{IG(!0),n.getState().setIsChatbotOpen(!1)}}),!s&&W(p,{children:[Z("div",{className:"bg-background",style:{width:hG},children:Z(kG,{teamId:_,projectId:X,projectName:P,rootFolderId:M,dragState:U,ancestorFolders:R?.ancestorFolders??[]})}),Z(c,{onResize:(G)=>{FG((J)=>Math.max(180,Math.min(400,J+G)))},className:"hidden md:block"})]}),Z(NG,{teamId:_,projectId:X,assetId:A,folders:D,files:T,totalFolders:sG,totalFiles:tG,totalFoldersSize:eG,totalFilesSize:GJ,selectedItem:CG,selectedIds:H,onItemSelect:ZJ,onItemDoubleClick:YJ,onSaveField:YG,displayStyle:e,onClearSelection:XG,fetchNextFoldersPage:oG,hasNextFoldersPage:rG||!1,isFetchingNextFoldersPage:lG,fetchNextFilesPage:iG,hasNextFilesPage:aG||!1,isFetchingNextFilesPage:dG,isRecentlyDeleted:B,filterConditions:O,onFilterChange:h,sort:Q,onSortChange:pG,dragState:U,collection:z,onUpdateCollection:vG,rootFolderId:M}),(!t||b)&&W(p,{children:[Z(c,{onResize:(G)=>{uG((J)=>Math.max(240,Math.min(600,J-G)))},className:"hidden md:block"}),Z("div",{style:{width:gG},className:"bg-background flex flex-col flex-shrink-0",children:b?Z(RG,{projectId:X,contextAssetId:A}):f?Z(wG,{teamId:_,projectId:X,file:f,onSaveField:(G,J)=>YG(f.id,G,J),members:fG,hideAnnotationControl:!0}):Z("div",{className:"flex h-full items-center justify-center p-4 text-center text-sm text-muted-foreground",children:HG.select_asset_to_view_details()})})]})]})}),Z(qG,{children:U?.isActive?Z("div",{className:$G("flex items-center gap-2 rounded-md bg-popover px-3 py-2 text-sm font-medium text-popover-foreground shadow-md ring-1 ring-border cursor-grabbing",e==="list"&&"w-30 h-[40px] px-0 flex-none overflow-hidden justify-center"),style:{transform:"translate(0px, 0px)"},children:W("span",{children:["Moving ",U.itemCount," item",U.itemCount!==1?"s":""]})}):null})]})}
2
- export{HJ as d};
@@ -1,6 +0,0 @@
1
- // @bun
2
- import{ib as f,jb as I,kb as h}from"./chunk-nar4s9v9.js";import{qb as A}from"./chunk-7ddaxdpf.js";import{xb as g,yb as v,zb as x}from"./chunk-0at8vxt5.js";import{Ab as j}from"./chunk-22dje1f5.js";import{fe as C,ge as F}from"./chunk-wv4fe1fj.js";import{ie as O,ke as T}from"./chunk-7rhjej0x.js";import{le as B}from"./chunk-n6jgyv4y.js";import{vj as L}from"./chunk-3qdn3pty.js";import"./chunk-yhj8c5re.js";import"./chunk-kbzm1pwx.js";function k(Q){if(Q)return Q;if(typeof process<"u"&&process.env.PI_CACHE_RETENTION==="long")return"long";return"short"}function c(Q,Z){let Y=k(Z);if(Y==="none")return{retention:Y};let _=Y==="long"&&H(Q).supportsLongCacheRetention?"1h":void 0;return{retention:Y,cacheControl:{type:"ephemeral",..._&&{ttl:_}}}}var m="2.1.75",d=["Read","Write","Edit","Bash","Grep","Glob","AskUserQuestion","EnterPlanMode","ExitPlanMode","KillShell","NotebookEdit","Skill","Task","TaskOutput","TodoWrite","WebFetch","WebSearch"],r=new Map(d.map((Q)=>[Q.toLowerCase(),Q])),b=(Q)=>r.get(Q.toLowerCase())??Q,i=(Q,Z)=>{if(Z&&Z.length>0){let Y=Q.toLowerCase(),_=Z.find((X)=>X.name.toLowerCase()===Y);if(_)return _.name}return Q};function S(Q){if(!Q.some((X)=>X.type==="image"))return j(Q.map((X)=>X.text).join(`
3
- `));let Y=Q.map((X)=>{if(X.type==="text")return{type:"text",text:j(X.text)};return{type:"image",source:{type:"base64",media_type:X.mimeType,data:X.data}}});if(!Y.some((X)=>X.type==="text"))Y.unshift({type:"text",text:"(see attached image)"});return Y}var l="fine-grained-tool-streaming-2025-05-14",a="interleaved-thinking-2025-05-14";function H(Q){let Z=Q.provider==="fireworks",Y=Q.provider==="cloudflare-ai-gateway"&&Q.baseUrl.includes("anthropic");return{supportsEagerToolInputStreaming:Q.compat?.supportsEagerToolInputStreaming??!Z,supportsLongCacheRetention:Q.compat?.supportsLongCacheRetention??!Z,sendSessionAffinityHeaders:Q.compat?.sendSessionAffinityHeaders??!!(Z||Y),supportsCacheControlOnTools:Q.compat?.supportsCacheControlOnTools??!Z}}function z(...Q){let Z={};for(let Y of Q)if(Y)Object.assign(Z,Y);return Z}var n=new Set(["message_start","message_delta","message_stop","content_block_start","content_block_delta","content_block_stop"]);function u(Q){if(!Q.event&&Q.data.length===0)return null;let Z={event:Q.event,data:Q.data.join(`
4
- `),raw:[...Q.raw]};return Q.event=null,Q.data=[],Q.raw=[],Z}function R(Q,Z){if(Q==="")return u(Z);if(Z.raw.push(Q),Q.startsWith(":"))return null;let Y=Q.indexOf(":"),_=Y===-1?Q:Q.slice(0,Y),X=Y===-1?"":Q.slice(Y+1);if(X.startsWith(" "))X=X.slice(1);if(_==="event")Z.event=X;else if(_==="data")Z.data.push(X);return null}function s(Q){let Z=Q.indexOf("\r"),Y=Q.indexOf(`
5
- `);if(Z===-1)return Y;if(Y===-1)return Z;return Math.min(Z,Y)}function w(Q){let Z=s(Q);if(Z===-1)return null;let Y=Z+1;if(Q[Z]==="\r"&&Q[Y]===`
6
- `)Y+=1;return{line:Q.slice(0,Z),rest:Q.slice(Y)}}async function*t(Q,Z){let Y=Q.getReader(),_=new TextDecoder,X={event:null,data:[],raw:[]},$="";try{while(!0){if(Z?.aborted)throw Error("Request was aborted");let{value:W,done:D}=await Y.read();if(D)break;$+=_.decode(W,{stream:!0});let G=w($);while(G){$=G.rest;let N=R(G.line,X);if(N)yield N;G=w($)}}$+=_.decode();let V=w($);while(V){$=V.rest;let W=R(V.line,X);if(W)yield W;V=w($)}if($.length>0){let W=R($,X);if(W)yield W}let J=u(X);if(J)yield J}finally{Y.releaseLock()}}async function*o(Q,Z){if(!Q.body)throw Error("Attempted to iterate over an Anthropic response with no body");let Y=!1,_=!1;for await(let X of t(Q.body,Z)){if(X.event==="error")throw Error(X.data);if(!n.has(X.event??""))continue;try{let $=C(X.data);if($.type==="message_start")Y=!0;else if($.type==="message_stop")_=!0;yield $}catch($){let V=$ instanceof Error?$.message:String($);throw Error(`Could not parse Anthropic SSE event ${X.event}: ${V}; data=${X.data}; raw=${X.raw.join("\\n")}`)}}if(Y&&!_)throw Error("Anthropic stream ended before message_stop")}var K=(Q,Z,Y)=>{let _=new T;return(async()=>{let X={role:"assistant",content:[],api:Q.api,provider:Q.provider,model:Q.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"stop",timestamp:Date.now()};try{let $,V;if(Y?.client)$=Y.client,V=!1;else{let q=Y?.apiKey??B(Q.provider)??"",P;if(Q.provider==="github-copilot"){let p=I(Z.messages);P=h({messages:Z.messages,hasImages:p})}let E=(Y?.cacheRetention??k())==="none"?void 0:Y?.sessionId,y=XQ(Q,q,Y?.interleavedThinking??!0,$Q(Q,Z),Y?.headers,P,E);$=y.client,V=y.isOAuthToken}let J=YQ(Q,Z,V,Y),W=await Y?.onPayload?.(J,Q);if(W!==void 0)J=W;let D={...Y?.signal?{signal:Y.signal}:{},...Y?.timeoutMs!==void 0?{timeout:Y.timeoutMs}:{},...Y?.maxRetries!==void 0?{maxRetries:Y.maxRetries}:{}},G=await $.messages.create({...J,stream:!0},D).asResponse();await Y?.onResponse?.({status:G.status,headers:A(G.headers)},Q),_.push({type:"start",partial:X});let N=X.content;for await(let q of o(G,Y?.signal))if(q.type==="message_start")X.responseId=q.message.id,X.usage.input=q.message.usage.input_tokens||0,X.usage.output=q.message.usage.output_tokens||0,X.usage.cacheRead=q.message.usage.cache_read_input_tokens||0,X.usage.cacheWrite=q.message.usage.cache_creation_input_tokens||0,X.usage.totalTokens=X.usage.input+X.usage.output+X.usage.cacheRead+X.usage.cacheWrite,O(Q,X.usage);else if(q.type==="content_block_start"){if(q.content_block.type==="text"){let P={type:"text",text:"",index:q.index};X.content.push(P),_.push({type:"text_start",contentIndex:X.content.length-1,partial:X})}else if(q.content_block.type==="thinking"){let P={type:"thinking",thinking:"",thinkingSignature:"",index:q.index};X.content.push(P),_.push({type:"thinking_start",contentIndex:X.content.length-1,partial:X})}else if(q.content_block.type==="redacted_thinking"){let P={type:"thinking",thinking:"[Reasoning redacted]",thinkingSignature:q.content_block.data,redacted:!0,index:q.index};X.content.push(P),_.push({type:"thinking_start",contentIndex:X.content.length-1,partial:X})}else if(q.content_block.type==="tool_use"){let P={type:"toolCall",id:q.content_block.id,name:V?i(q.content_block.name,Z.tools):q.content_block.name,arguments:q.content_block.input??{},partialJson:"",index:q.index};X.content.push(P),_.push({type:"toolcall_start",contentIndex:X.content.length-1,partial:X})}}else if(q.type==="content_block_delta"){if(q.delta.type==="text_delta"){let P=N.findIndex((E)=>E.index===q.index),U=N[P];if(U&&U.type==="text")U.text+=q.delta.text,_.push({type:"text_delta",contentIndex:P,delta:q.delta.text,partial:X})}else if(q.delta.type==="thinking_delta"){let P=N.findIndex((E)=>E.index===q.index),U=N[P];if(U&&U.type==="thinking")U.thinking+=q.delta.thinking,_.push({type:"thinking_delta",contentIndex:P,delta:q.delta.thinking,partial:X})}else if(q.delta.type==="input_json_delta"){let P=N.findIndex((E)=>E.index===q.index),U=N[P];if(U&&U.type==="toolCall")U.partialJson+=q.delta.partial_json,U.arguments=F(U.partialJson),_.push({type:"toolcall_delta",contentIndex:P,delta:q.delta.partial_json,partial:X})}else if(q.delta.type==="signature_delta"){let P=N.findIndex((E)=>E.index===q.index),U=N[P];if(U&&U.type==="thinking")U.thinkingSignature=U.thinkingSignature||"",U.thinkingSignature+=q.delta.signature}}else if(q.type==="content_block_stop"){let P=N.findIndex((E)=>E.index===q.index),U=N[P];if(U){if(delete U.index,U.type==="text")_.push({type:"text_end",contentIndex:P,content:U.text,partial:X});else if(U.type==="thinking")_.push({type:"thinking_end",contentIndex:P,content:U.thinking,partial:X});else if(U.type==="toolCall")U.arguments=F(U.partialJson),delete U.partialJson,_.push({type:"toolcall_end",contentIndex:P,toolCall:U,partial:X})}}else if(q.type==="message_delta"){if(q.delta.stop_reason)X.stopReason=VQ(q.delta.stop_reason);if(q.usage.input_tokens!=null)X.usage.input=q.usage.input_tokens;if(q.usage.output_tokens!=null)X.usage.output=q.usage.output_tokens;if(q.usage.cache_read_input_tokens!=null)X.usage.cacheRead=q.usage.cache_read_input_tokens;if(q.usage.cache_creation_input_tokens!=null)X.usage.cacheWrite=q.usage.cache_creation_input_tokens;X.usage.totalTokens=X.usage.input+X.usage.output+X.usage.cacheRead+X.usage.cacheWrite,O(Q,X.usage)}if(Y?.signal?.aborted)throw Error("Request was aborted");if(X.stopReason==="aborted"||X.stopReason==="error")throw Error("An unknown error occurred");_.push({type:"done",reason:X.stopReason,message:X}),_.end()}catch($){for(let V of X.content)delete V.index,delete V.partialJson;X.stopReason=Y?.signal?.aborted?"aborted":"error",X.errorMessage=$ instanceof Error?$.message:JSON.stringify($),_.push({type:"error",reason:X.stopReason,error:X}),_.end()}})(),_};function M(Q){return Q.includes("opus-4-6")||Q.includes("opus-4.6")||Q.includes("opus-4-7")||Q.includes("opus-4.7")||Q.includes("sonnet-4-6")||Q.includes("sonnet-4.6")}function e(Q,Z){let Y=Z?Q.thinkingLevelMap?.[Z]:void 0;if(typeof Y==="string")return Y;switch(Z){case"minimal":case"low":return"low";case"medium":return"medium";case"high":return"high";default:return"high"}}var wQ=(Q,Z,Y)=>{let _=Y?.apiKey||B(Q.provider);if(!_)throw Error(`No API key for provider: ${Q.provider}`);let X=g(Q,Y,_);if(!Y?.reasoning)return K(Q,Z,{...X,thinkingEnabled:!1});if(M(Q.id)){let V=e(Q,Y.reasoning);return K(Q,Z,{...X,thinkingEnabled:!0,effort:V})}let $=v(X.maxTokens,Q.maxTokens,Y.reasoning,Y.thinkingBudgets);return K(Q,Z,{...X,maxTokens:$.maxTokens,thinkingEnabled:!0,thinkingBudgetTokens:$.thinkingBudget})};function QQ(Q){return Q.includes("sk-ant-oat")}function XQ(Q,Z,Y,_,X,$,V){let J=Y&&!M(Q.id),W=[];if(_)W.push(l);if(J)W.push(a);if(Q.provider==="cloudflare-ai-gateway")return{client:new L({apiKey:null,authToken:null,baseURL:f(Q),dangerouslyAllowBrowser:!0,defaultHeaders:z({accept:"application/json","anthropic-dangerous-direct-browser-access":"true","cf-aig-authorization":`Bearer ${Z}`,"x-api-key":null,Authorization:null,...W.length>0?{"anthropic-beta":W.join(",")}:{}},Q.headers,X)}),isOAuthToken:!1};if(Q.provider==="github-copilot")return{client:new L({apiKey:null,authToken:Z,baseURL:Q.baseUrl,dangerouslyAllowBrowser:!0,defaultHeaders:z({accept:"application/json","anthropic-dangerous-direct-browser-access":"true",...W.length>0?{"anthropic-beta":W.join(",")}:{}},Q.headers,$,X)}),isOAuthToken:!1};if(QQ(Z))return{client:new L({apiKey:null,authToken:Z,baseURL:Q.baseUrl,dangerouslyAllowBrowser:!0,defaultHeaders:z({accept:"application/json","anthropic-dangerous-direct-browser-access":"true","anthropic-beta":["claude-code-20250219","oauth-2025-04-20",...W].join(","),"user-agent":`claude-cli/${m}`,"x-app":"cli"},Q.headers,X)}),isOAuthToken:!0};let D=V&&H(Q).sendSessionAffinityHeaders?{"x-session-affinity":V}:{};return{client:new L({apiKey:Z,authToken:null,baseURL:Q.baseUrl,dangerouslyAllowBrowser:!0,defaultHeaders:z({accept:"application/json","anthropic-dangerous-direct-browser-access":"true",...W.length>0?{"anthropic-beta":W.join(",")}:{}},D,Q.headers,X)}),isOAuthToken:!1}}function YQ(Q,Z,Y,_){let{cacheControl:X}=c(Q,_?.cacheRetention),$={model:Q.id,messages:_Q(Z.messages,Q,Y,X),max_tokens:_?.maxTokens??Q.maxTokens,stream:!0};if(Y){if($.system=[{type:"text",text:"You are Claude Code, Anthropic's official CLI for Claude.",...X?{cache_control:X}:{}}],Z.systemPrompt)$.system.push({type:"text",text:j(Z.systemPrompt),...X?{cache_control:X}:{}})}else if(Z.systemPrompt)$.system=[{type:"text",text:j(Z.systemPrompt),...X?{cache_control:X}:{}}];if(_?.temperature!==void 0&&!_?.thinkingEnabled)$.temperature=_.temperature;if(Z.tools&&Z.tools.length>0){let V=H(Q);$.tools=qQ(Z.tools,Y,V.supportsEagerToolInputStreaming,V.supportsCacheControlOnTools?X:void 0)}if(Q.reasoning){if(_?.thinkingEnabled){let V=_.thinkingDisplay??"summarized";if(M(Q.id)){if($.thinking={type:"adaptive",display:V},_.effort)$.output_config=_.effort==="xhigh"?{effort:_.effort}:{effort:_.effort}}else $.thinking={type:"enabled",budget_tokens:_.thinkingBudgetTokens||1024,display:V}}else if(_?.thinkingEnabled===!1)$.thinking={type:"disabled"}}if(_?.metadata){let V=_.metadata.user_id;if(typeof V==="string")$.metadata={user_id:V}}if(_?.toolChoice)if(typeof _.toolChoice==="string")$.tool_choice={type:_.toolChoice};else $.tool_choice=_.toolChoice;return $}function ZQ(Q){return Q.replace(/[^a-zA-Z0-9_-]/g,"_").slice(0,64)}function _Q(Q,Z,Y,_){let X=[],$=x(Q,Z,ZQ);for(let V=0;V<$.length;V++){let J=$[V];if(J.role==="user")if(typeof J.content==="string"){if(J.content.trim().length>0)X.push({role:"user",content:j(J.content)})}else{let D=J.content.map((G)=>{if(G.type==="text")return{type:"text",text:j(G.text)};else return{type:"image",source:{type:"base64",media_type:G.mimeType,data:G.data}}}).filter((G)=>{if(G.type==="text")return G.text.trim().length>0;return!0});if(D.length===0)continue;X.push({role:"user",content:D})}else if(J.role==="assistant"){let W=[];for(let D of J.content)if(D.type==="text"){if(D.text.trim().length===0)continue;W.push({type:"text",text:j(D.text)})}else if(D.type==="thinking"){if(D.redacted){W.push({type:"redacted_thinking",data:D.thinkingSignature});continue}if(D.thinking.trim().length===0)continue;if(!D.thinkingSignature||D.thinkingSignature.trim().length===0)W.push({type:"text",text:j(D.thinking)});else W.push({type:"thinking",thinking:j(D.thinking),signature:D.thinkingSignature})}else if(D.type==="toolCall")W.push({type:"tool_use",id:D.id,name:Y?b(D.name):D.name,input:D.arguments??{}});if(W.length===0)continue;X.push({role:"assistant",content:W})}else if(J.role==="toolResult"){let W=[];W.push({type:"tool_result",tool_use_id:J.toolCallId,content:S(J.content),is_error:J.isError});let D=V+1;while(D<$.length&&$[D].role==="toolResult"){let G=$[D];W.push({type:"tool_result",tool_use_id:G.toolCallId,content:S(G.content),is_error:G.isError}),D++}V=D-1,X.push({role:"user",content:W})}}if(_&&X.length>0){let V=X[X.length-1];if(V.role==="user"){if(Array.isArray(V.content)){let J=V.content[V.content.length-1];if(J&&(J.type==="text"||J.type==="image"||J.type==="tool_result"))J.cache_control=_}else if(typeof V.content==="string")V.content=[{type:"text",text:V.content,cache_control:_}]}}return X}function $Q(Q,Z){return!!Z.tools?.length&&!H(Q).supportsEagerToolInputStreaming}function qQ(Q,Z,Y,_){if(!Q)return[];return Q.map((X,$)=>{let V=X.parameters;return{name:Z?b(X.name):X.name,description:X.description,...Y?{eager_input_streaming:!0}:{},input_schema:{type:"object",properties:V.properties??{},required:V.required??[]},..._&&$===Q.length-1?{cache_control:_}:{}}})}function VQ(Q){switch(Q){case"end_turn":return"stop";case"max_tokens":return"length";case"tool_use":return"toolUse";case"refusal":return"error";case"pause_turn":return"stop";case"stop_sequence":return"stop";case"sensitive":return"error";default:throw Error(`Unhandled stop reason: ${Q}`)}}export{wQ as streamSimpleAnthropic,K as streamAnthropic};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{qb as L}from"./chunk-7ddaxdpf.js";import{Ab as M}from"./chunk-22dje1f5.js";import{le as I}from"./chunk-n6jgyv4y.js";import{Bj as E}from"./chunk-w4y97tzy.js";import"./chunk-kbzm1pwx.js";var j=async(f,G,B)=>{let D={api:f.api,provider:f.provider,model:f.id,output:[],stopReason:"stop",timestamp:Date.now()};try{let F=B?.apiKey||I(f.provider);if(!F)throw Error(`No API key available for provider: ${f.provider}`);let Q=v(f,F,B?.headers),N=z(f,G),V=await B?.onPayload?.(N,f);if(V!==void 0)N=V;let J={...B?.signal?{signal:B.signal}:{},...B?.timeoutMs!==void 0?{timeout:B.timeoutMs}:{},...B?.maxRetries!==void 0?{maxRetries:B.maxRetries}:{}},{data:S,response:b}=await Q.chat.completions.create(N,J).withResponse();await B?.onResponse?.({status:b.status,headers:L(b.headers)},f);let X=S;if(D.responseId=X.id,X.usage)D.usage=A(X.usage,f);let Y=X.choices[0];if(Y){let Z=Y.message.content;if(typeof Z==="string"&&Z.length>0)D.output.push({type:"text",text:Z});for(let _ of Y.message.images??[]){let q=typeof _.image_url==="string"?_.image_url:_.image_url?.url;if(!q?.startsWith("data:"))continue;let $=q.match(/^data:([^;]+);base64,(.+)$/);if(!$)continue;D.output.push({type:"image",mimeType:$[1],data:$[2]})}}return D}catch(F){return D.stopReason=B?.signal?.aborted?"aborted":"error",D.errorMessage=F instanceof Error?F.message:JSON.stringify(F),D}};function v(f,G,B){return new E({apiKey:G,baseURL:f.baseUrl,dangerouslyAllowBrowser:!0,defaultHeaders:{...f.headers,...B}})}function z(f,G){let B=G.input.map((D)=>{if(D.type==="text")return{type:"text",text:M(D.text)};return{type:"image_url",image_url:{url:`data:${D.mimeType};base64,${D.data}`}}});return{model:f.id,messages:[{role:"user",content:B}],stream:!1,modalities:f.output.includes("text")?["image","text"]:["image"]}}function A(f,G){let B=f.prompt_tokens||0,D=f.prompt_tokens_details?.cached_tokens||0,F=f.prompt_tokens_details?.cache_write_tokens||0,Q=F>0?Math.max(0,D-F):D,N=Math.max(0,B-Q-F),V=f.completion_tokens||0,J={input:N,output:V,cacheRead:Q,cacheWrite:F,totalTokens:N+V+Q+F,cost:{input:G.cost.input/1e6*N,output:G.cost.output/1e6*V,cacheRead:G.cost.cacheRead/1e6*Q,cacheWrite:G.cost.cacheWrite/1e6*F,total:0}};return J.cost.total=J.cost.input+J.cost.output+J.cost.cacheRead+J.cost.cacheWrite,J}export{j as generateImagesOpenRouter};
@@ -1 +0,0 @@
1
- import{d as _}from"./chunk-vgvmt2m1.js";import"./chunk-49ej1y67.js";import"./chunk-2s5a64nr.js";import"./chunk-ps4h3387.js";import"./chunk-dgx2zxze.js";import"./chunk-axx5bh38.js";import"./chunk-e5833tbd.js";import"./chunk-q4f5vvtx.js";import"./chunk-33ee1cvv.js";import"./chunk-kpy0kpna.js";import"./chunk-ajqsprm0.js";import"./chunk-xpqcvxej.js";import"./chunk-4hnrd4qh.js";import{se as Y,te as Z}from"./chunk-r3n9zpfw.js";import"./chunk-fwf8yne2.js";import"./chunk-cp18trqb.js";import"./chunk-8wv3kdz9.js";import"./chunk-j8q688sx.js";import"./chunk-6r9w7z15.js";import"./chunk-pf8edn5x.js";import"./chunk-5a2maxwp.js";import"./chunk-4kk5g619.js";import"./chunk-mnv6pj0k.js";import{$f as O,Eg as B,bg as w,fg as A,gg as N,hg as U,hj as W,ij as X,sg as V}from"./chunk-nwtb6dt1.js";import{Zj as M}from"./chunk-kbzm1pwx.js";var h=M(O(),1);function R(){let{projectId:k,collectionId:D}=P.useParams(),{teamId:G,ensureTeamIdForProject:H}=X();h.useEffect(()=>{H(k)},[k,H]);let{data:J}=N(Y(k)),{data:v,refetch:z}=A({...Z(D)}),{mutate:E}=U({mutationFn:async(q)=>{let K=await B.api.collections[":collectionId"].$patch({param:{collectionId:D},json:q});if(!K.ok)throw Error("Failed to update collection");return await K.json()},onSuccess:()=>{z()}}),b=J?.rootFolder,{data:L}=A({queryKey:["folders",b],queryFn:async()=>{let q=await B.api.folders[":folderId"].$get({param:{folderId:b}});if(!q.ok)throw Error("Failed to fetch folder");return await q.json()},enabled:!!b});if(!G||!b||!L||!v)return w("div",{children:W.loading_collection()});let $=v.filter.sourceFolderId||b;return w(_,{teamId:G,projectId:k,projectName:J.name??"",assetId:$,rootFolderId:b,collection:v,onUpdateCollection:E})}var P=V("/projects/$projectId/collections/$collectionId")({component:R});export{P as Route};