@shumai-one/shumai 0.3.1 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/bin/{chunk-dwswqq3g.js → chunk-0a0sdyta.js} +1 -1
  2. package/bin/{chunk-qmtvy2j4.js → chunk-0dcv6kpk.js} +2 -2
  3. package/bin/chunk-1cjgpspz.js +2 -0
  4. package/bin/chunk-1pgtq4rc.js +2 -0
  5. package/bin/chunk-1rsp4hc5.js +1 -0
  6. package/bin/{chunk-7eycsyk6.js → chunk-2475z7vk.js} +1 -1
  7. package/bin/chunk-25qj10ny.js +1 -0
  8. package/bin/{chunk-gn8snrnk.js → chunk-2fc5hk8r.js} +1 -1
  9. package/bin/{chunk-qc6dmzn0.js → chunk-2jvqhps9.js} +2 -2
  10. package/bin/{chunk-ve7v8wtv.js → chunk-3823qzr0.js} +2 -2
  11. package/bin/{chunk-zxpef55w.js → chunk-3g9g2c7h.js} +3 -3
  12. package/bin/chunk-3gcnj1eq.js +2 -0
  13. package/bin/chunk-41m51y08.js +2 -0
  14. package/bin/chunk-4g7h9qhr.js +8 -0
  15. package/bin/chunk-4v5ykazp.js +1 -0
  16. package/bin/{chunk-k20bhxed.js → chunk-525eypdk.js} +1 -1
  17. package/bin/{chunk-h2wsm7h3.js → chunk-57kgmgfs.js} +2 -2
  18. package/bin/{chunk-gvn079hy.js → chunk-5cm4vge8.js} +2 -2
  19. package/bin/{chunk-31mjcykb.js → chunk-5vwkfxy7.js} +2 -2
  20. package/bin/chunk-5x3vzer8.js +1 -0
  21. package/bin/chunk-67rr836p.js +3 -0
  22. package/bin/chunk-6jgq154r.js +2 -0
  23. package/bin/chunk-7436fyrg.js +2 -0
  24. package/bin/{chunk-s05f0v9t.js → chunk-749c09cw.js} +1 -1
  25. package/bin/{chunk-9p2d0mk1.js → chunk-7anqxx1z.js} +1 -1
  26. package/bin/{chunk-s7qpj715.js → chunk-7pjes19z.js} +2 -2
  27. package/bin/{chunk-f8cn9m28.js → chunk-7x7jtkh8.js} +1 -1
  28. package/bin/chunk-804ndet8.js +2 -0
  29. package/bin/chunk-8a75zqbz.js +2 -0
  30. package/bin/{chunk-tsncwscz.js → chunk-9a7a1p1j.js} +2 -2
  31. package/bin/chunk-9e99n265.js +12 -0
  32. package/bin/chunk-9g6vy76b.js +2 -0
  33. package/bin/{chunk-wap08p4j.js → chunk-9sdhdhv4.js} +2 -2
  34. package/bin/{chunk-g2dk56e7.js → chunk-9vgjhemh.js} +1 -1
  35. package/bin/{chunk-1dawjfk8.js → chunk-9zvteyz0.js} +2 -2
  36. package/bin/chunk-a8daqpfh.js +7 -0
  37. package/bin/{chunk-na2nympm.js → chunk-am1m29pv.js} +1 -1
  38. package/bin/{chunk-xawwxdq9.js → chunk-bd6x5ns9.js} +2 -2
  39. package/bin/{chunk-wr5byz6r.js → chunk-bn4ewsy8.js} +1 -1
  40. package/bin/{chunk-ss45w8ks.js → chunk-bw6wyw7k.js} +2 -2
  41. package/bin/{chunk-8yz1expv.js → chunk-c0c88nje.js} +48 -48
  42. package/bin/chunk-c7rj0f5r.js +3 -0
  43. package/bin/chunk-cdqvg03f.js +3 -0
  44. package/bin/{chunk-zs9b0f3z.js → chunk-d3kpqay2.js} +2 -2
  45. package/bin/chunk-d6v81kjj.js +1 -0
  46. package/bin/chunk-dfcrtdk2.js +1 -0
  47. package/bin/chunk-eczsk2xd.js +62 -0
  48. package/bin/{chunk-yahb7wan.js → chunk-ey7vty63.js} +2 -2
  49. package/bin/{chunk-nzy3pjjm.js → chunk-fwqpq2sy.js} +2 -2
  50. package/bin/{chunk-vnfmh5ke.js → chunk-g097058z.js} +2 -2
  51. package/bin/{chunk-a76c5r3c.js → chunk-g224r7mc.js} +2 -2
  52. package/bin/chunk-g5e93f59.js +2 -0
  53. package/bin/chunk-g5xkj9p3.js +2 -0
  54. package/bin/chunk-gaemak59.js +4 -0
  55. package/bin/{chunk-hrzm70wg.js → chunk-gh4w2bdg.js} +1 -1
  56. package/bin/chunk-gpeyctxd.js +2 -0
  57. package/bin/{chunk-nqh128dt.js → chunk-gpmaaca1.js} +2 -2
  58. package/bin/{chunk-1d22tysv.js → chunk-h4a3ms2b.js} +2 -2
  59. package/bin/chunk-h73653yp.js +1 -0
  60. package/bin/chunk-hp139z0j.js +2 -0
  61. package/bin/chunk-hz6s7by4.js +11 -0
  62. package/bin/chunk-j4y8c864.js +1 -0
  63. package/bin/chunk-jkh04dka.js +8 -0
  64. package/bin/chunk-m268vcdm.js +2 -0
  65. package/bin/{chunk-vy24ncn2.js → chunk-m6sssvg3.js} +1 -1
  66. package/bin/chunk-mggfc9ya.js +2 -0
  67. package/bin/chunk-mhwp74hh.js +3 -0
  68. package/bin/{chunk-vgb8bzcg.js → chunk-mm810jv7.js} +2 -2
  69. package/bin/chunk-p1bcbtmg.js +3 -0
  70. package/bin/chunk-p86w1eaw.js +45 -0
  71. package/bin/{chunk-1nh6xgek.js → chunk-p8enen2a.js} +1 -1
  72. package/bin/chunk-pbb1tdwt.js +1 -0
  73. package/bin/chunk-pbfkw90e.js +1 -0
  74. package/bin/chunk-pdajhyqm.js +2 -0
  75. package/bin/{chunk-ph3e1bpp.js → chunk-pqxh0cg7.js} +2 -2
  76. package/bin/chunk-q8me9zev.js +1 -0
  77. package/bin/chunk-qshm5vcn.js +2 -0
  78. package/bin/chunk-qx2mzv89.js +2 -0
  79. package/bin/{chunk-amsb41z5.js → chunk-r5jmnsqj.js} +1 -1
  80. package/bin/{chunk-arpna31w.js → chunk-rt0pvhdf.js} +1 -1
  81. package/bin/{chunk-kgb16ggd.css → chunk-s10v4b01.css} +1 -1
  82. package/bin/{chunk-vt4zpasm.js → chunk-s1b5kf34.js} +2 -2
  83. package/bin/{chunk-ws07a9kv.js → chunk-t15a1vp6.js} +1 -1
  84. package/bin/{chunk-3rcc5s99.js → chunk-tc7q988r.js} +2 -2
  85. package/bin/chunk-ts9f4zqh.js +5 -0
  86. package/bin/chunk-tzmzqmcg.js +7 -0
  87. package/bin/chunk-v0xbr5e6.js +2 -0
  88. package/bin/{chunk-08mxv0sm.js → chunk-v0yhkcj5.js} +2 -2
  89. package/bin/{chunk-3t7mjvdv.js → chunk-v75fanse.js} +2 -2
  90. package/bin/chunk-va6hxm7n.js +3 -0
  91. package/bin/chunk-vf3bg920.js +3 -0
  92. package/bin/{chunk-ejfmxjw6.js → chunk-vg6mkdj1.js} +2 -2
  93. package/bin/{chunk-j0p1peav.js → chunk-wkth5xwr.js} +2 -2
  94. package/bin/chunk-wpntb95k.js +2 -0
  95. package/bin/{chunk-mahxw48e.js → chunk-wtzkfwmx.js} +2 -2
  96. package/bin/{chunk-hfp4hpca.js → chunk-x0r8dcq0.js} +2 -2
  97. package/bin/{chunk-etces6ff.js → chunk-xcbb21j9.js} +2 -2
  98. package/bin/{chunk-mcxsk75h.js → chunk-xgb533n0.js} +3 -3
  99. package/bin/{chunk-7jjc175m.js → chunk-xn9cpax1.js} +3 -3
  100. package/bin/{chunk-5vqan9c4.js → chunk-xsw3pb5p.js} +2 -2
  101. package/bin/chunk-yedr4r8a.js +2 -0
  102. package/bin/chunk-yfjn4qn2.js +1 -0
  103. package/bin/chunk-yfkcv10v.js +2 -0
  104. package/bin/{chunk-20y3wte3.js → chunk-yj6tmjsc.js} +2 -2
  105. package/bin/chunk-z9560a6e.js +1 -0
  106. package/bin/chunk-zgsy3k3h.js +3 -0
  107. package/bin/shumai-app.html +1 -1
  108. package/bin/shumai-app.js +381 -330
  109. package/package.json +7 -7
  110. package/prisma/migrations/20260801065040_add_audit_log/migration.sql +33 -0
  111. package/prisma/migrations/20260805021613_add_asset_autofill_context/migration.sql +2 -0
  112. package/prisma/schema.prisma +25 -0
  113. package/bin/chunk-08dr94gp.js +0 -2
  114. package/bin/chunk-0ed7h2xm.js +0 -2
  115. package/bin/chunk-0t4z17qr.js +0 -2
  116. package/bin/chunk-2ynx0den.js +0 -8
  117. package/bin/chunk-31a3k77j.js +0 -2
  118. package/bin/chunk-3jdef7n4.js +0 -6
  119. package/bin/chunk-4ahve1nf.js +0 -2
  120. package/bin/chunk-4hdx2tv0.js +0 -2
  121. package/bin/chunk-4p7xpfey.js +0 -2
  122. package/bin/chunk-5e1xqaj4.js +0 -2
  123. package/bin/chunk-5f81c951.js +0 -1
  124. package/bin/chunk-5s7c0qww.js +0 -1
  125. package/bin/chunk-5zntjzxw.js +0 -3
  126. package/bin/chunk-6a2eb3b5.js +0 -3
  127. package/bin/chunk-6gy7c4d7.js +0 -1
  128. package/bin/chunk-7d4scsf6.js +0 -1
  129. package/bin/chunk-7d5kep8c.js +0 -2
  130. package/bin/chunk-7y8dng8t.js +0 -2
  131. package/bin/chunk-8m6zg15c.js +0 -4
  132. package/bin/chunk-8n60m9x3.js +0 -1
  133. package/bin/chunk-8qyke29r.js +0 -7
  134. package/bin/chunk-90et6bwm.js +0 -3
  135. package/bin/chunk-a10tf0d8.js +0 -3
  136. package/bin/chunk-a9t667xv.js +0 -1
  137. package/bin/chunk-b10meywb.js +0 -2
  138. package/bin/chunk-b1e3tec3.js +0 -62
  139. package/bin/chunk-bdjhb77e.js +0 -2
  140. package/bin/chunk-bmqw3j2d.js +0 -2
  141. package/bin/chunk-c3fvs0bv.js +0 -4
  142. package/bin/chunk-c5my1b3k.js +0 -7
  143. package/bin/chunk-dhekxndw.js +0 -3
  144. package/bin/chunk-dwaj1yn4.js +0 -2
  145. package/bin/chunk-er1rb6yj.js +0 -1
  146. package/bin/chunk-etqpzc9e.js +0 -3
  147. package/bin/chunk-fdpjw17x.js +0 -7
  148. package/bin/chunk-gqh4ttjh.js +0 -3
  149. package/bin/chunk-h270n69j.js +0 -7
  150. package/bin/chunk-hz31j0hk.js +0 -4
  151. package/bin/chunk-jm6bxtzt.js +0 -41
  152. package/bin/chunk-k9w6mk9d.js +0 -3
  153. package/bin/chunk-m4py21f3.js +0 -2
  154. package/bin/chunk-mqbxagfd.js +0 -2
  155. package/bin/chunk-nr89225z.js +0 -2
  156. package/bin/chunk-nrf5r23d.js +0 -1
  157. package/bin/chunk-nt9tfjx6.js +0 -12
  158. package/bin/chunk-p396vw9h.js +0 -8
  159. package/bin/chunk-p9xfyqh1.js +0 -2
  160. package/bin/chunk-pgae67hk.js +0 -3
  161. package/bin/chunk-ph11924k.js +0 -1
  162. package/bin/chunk-pj0fgb2x.js +0 -6
  163. package/bin/chunk-pp072ksj.js +0 -2
  164. package/bin/chunk-q5cdjzbv.js +0 -3
  165. package/bin/chunk-qgq96tbp.js +0 -2
  166. package/bin/chunk-qvgc9e08.js +0 -3
  167. package/bin/chunk-rfh4ppaa.js +0 -1
  168. package/bin/chunk-rrhq3t4s.js +0 -1
  169. package/bin/chunk-sf6fwvrs.js +0 -8
  170. package/bin/chunk-sr9bty78.js +0 -1
  171. package/bin/chunk-t2txvzkp.js +0 -3
  172. package/bin/chunk-td54rdfj.js +0 -8
  173. package/bin/chunk-vb9m47z9.js +0 -1
  174. package/bin/chunk-vf066xwh.js +0 -3
  175. package/bin/chunk-w3a50kz8.js +0 -3
  176. package/bin/chunk-w9w5301f.js +0 -4
  177. package/bin/chunk-wny0qagx.js +0 -3
  178. package/bin/chunk-wqhk76de.js +0 -14
  179. package/bin/chunk-wrz9e73c.js +0 -2
  180. package/bin/chunk-x5dcgk62.js +0 -6
  181. package/bin/chunk-y2nw8rbx.js +0 -4
  182. package/bin/chunk-y9ttm07y.js +0 -3
  183. package/bin/chunk-zg0vm233.js +0 -2
  184. package/bin/chunk-zhd2mkbr.js +0 -1
  185. package/bin/chunk-zx9cv3t8.js +0 -2
@@ -1 +0,0 @@
1
- import{j as U}from"./chunk-0ed7h2xm.js";import"./chunk-bmqw3j2d.js";import"./chunk-zx9cv3t8.js";import"./chunk-8yz1expv.js";import"./chunk-nzy3pjjm.js";import"./chunk-h270n69j.js";import"./chunk-mqbxagfd.js";import"./chunk-zhd2mkbr.js";import"./chunk-bdjhb77e.js";import"./chunk-p9xfyqh1.js";import"./chunk-31mjcykb.js";import"./chunk-hfp4hpca.js";import"./chunk-wrz9e73c.js";import"./chunk-1nh6xgek.js";import"./chunk-3rcc5s99.js";import"./chunk-20y3wte3.js";import{ef as N}from"./chunk-xawwxdq9.js";import"./chunk-qc6dmzn0.js";import{Bf as K}from"./chunk-ve7v8wtv.js";import"./chunk-7y8dng8t.js";import"./chunk-3t7mjvdv.js";import"./chunk-pgae67hk.js";import"./chunk-tsncwscz.js";import"./chunk-h2wsm7h3.js";import"./chunk-etces6ff.js";import"./chunk-yahb7wan.js";import"./chunk-mahxw48e.js";import"./chunk-wap08p4j.js";import{bh as J}from"./chunk-nr89225z.js";import{Ah as G,Mh as H,gh as Z,ih as q,nh as B,oh as D}from"./chunk-b1e3tec3.js";import{Xk as Y}from"./chunk-ws07a9kv.js";var V=Y(Z(),1);function _(){let{projectId:h,folderId:W}=z.useParams(),{teamId:v,ensureTeamIdForProject:w}=J();V.useEffect(()=>{w(h)},[h,w]);let{data:A}=D(N(h)),b=A?.rootFolder,{data:X}=B({queryKey:["folders",b],queryFn:()=>(async()=>{return await(await H.api.folders[":folderId"].$get({param:{folderId:b}})).json()})(),enabled:!!b});if(!v||!b||!X)return q(K,{});return q(U,{teamId:v,projectId:h,projectName:A.name??"",assetId:W,rootFolderId:b})}var z=G("/projects/$projectId/folders/$folderId")({component:_});export{z as Route};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{pc as e,qc as p,rc as t}from"./chunk-mcxsk75h.js";import"./chunk-7jjc175m.js";import"./chunk-gvn079hy.js";import"./chunk-1d22tysv.js";import"./chunk-f8cn9m28.js";import"./chunk-1dawjfk8.js";import"./chunk-ws07a9kv.js";export{t as kyselyAdapter,e as getKyselyDatabaseType,p as createKyselyAdapter};
@@ -1,2 +0,0 @@
1
- import{$j as A,Lj as k,Zj as F,ak as V,ih as t,jh as R}from"./chunk-b1e3tec3.js";import{_k as l}from"./chunk-ws07a9kv.js";function D(a,b){var f=a.length;a.push(b);a:for(;0<f;){var g=f-1>>>1,d=a[g];if(0<q(d,b))a[g]=b,a[f]=d,f=g;else break a}}function C(a){return a.length===0?null:a[0]}function H(a){if(a.length===0)return null;var b=a[0],f=a.pop();if(f!==b){a[0]=f;a:for(var g=0,d=a.length,Z=d>>>1;g<Z;){var $=2*(g+1)-1,P=a[$],N=$+1,G=a[N];if(0>q(P,f))N<d&&0>q(G,P)?(a[g]=G,a[N]=f,g=N):(a[g]=P,a[$]=f,g=$);else if(N<d&&0>q(G,f))a[g]=G,a[N]=f,g=N;else break a}}return b}function q(a,b){var f=a.sortIndex-b.sortIndex;return f!==0?f:a.id-b.id}function S(a){for(var b=C(o);b!==null;){if(b.callback===null)H(o);else if(b.startTime<=a)H(o),b.sortIndex=b.expirationTime,D(w,b);else break;b=C(o)}}function c(a){if(K=!1,S(a),!J)if(C(w)!==null)J=!0,E||(E=!0,B());else{var b=C(o);b!==null&&I(c,b.startTime-a)}}function m(){return n?!0:_()-L<p?!1:!0}function U(){if(n=!1,E){var a=_();L=a;var b=!0;try{a:{J=!1,K&&(K=!1,j(X),X=-1),T=!0;var f=O;try{t:{S(a);for(z=C(w);z!==null&&!(z.expirationTime>a&&m());){var g=z.callback;if(typeof g==="function"){z.callback=null,O=z.priorityLevel;var d=g(z.expirationTime<=a);if(a=_(),typeof d==="function"){z.callback=d,S(a),b=!0;break t}z===C(w)&&H(w),S(a)}else H(w);z=C(w)}if(z!==null)b=!0;else{var Z=C(o);Z!==null&&I(c,Z.startTime-a),b=!1}}break a}finally{z=null,O=f,T=!1}b=void 0}}finally{b?B():E=!1}}}function I(a,b){X=u(function(){a(_())},b)}var _=void 0,M,v,W,w,o,h=1,z=null,O=3,T=!1,J=!1,K=!1,n=!1,u,j,s,E=!1,X=-1,p=5,L=-1,B,Q,y,i=5,r=1,e=4,aa=3,ta=2,ba=function(a){a.callback=null},fa=function(){return O},ga=function(){n=!0},da=function(a,b){switch(a){case 1:case 2:case 3:case 4:case 5:break;default:a=3}var f=O;O=a;try{return b()}finally{O=f}},za=function(a,b,f){var g=_();switch(typeof f==="object"&&f!==null?(f=f.delay,f=typeof f==="number"&&0<f?g+f:g):f=g,a){case 1:var d=-1;break;case 2:d=250;break;case 5:d=1073741823;break;case 4:d=1e4;break;default:d=5000}return d=f+d,a={id:h++,callback:b,priorityLevel:a,startTime:f,expirationTime:d,sortIndex:-1},f>g?(a.sortIndex=f,D(o,a),C(w)===null&&a===C(o)&&(K?(j(X),X=-1):K=!0,I(c,f-g))):(a.sortIndex=d,D(w,a),J||T||(J=!0,E||(E=!0,B()))),a},Ca;var wa=l(()=>{if(typeof performance==="object"&&typeof performance.now==="function")M=performance,_=function(){return M.now()};else v=Date,W=v.now(),_=function(){return v.now()-W};w=[],o=[],u=typeof setTimeout==="function"?setTimeout:null,j=typeof clearTimeout==="function"?clearTimeout:null,s=typeof setImmediate<"u"?setImmediate:null;if(typeof s==="function")B=function(){s(U)};else if(typeof MessageChannel<"u")Q=new MessageChannel,y=Q.port2,Q.port1.onmessage=U,B=function(){y.postMessage(null)};else B=function(){u(U,0)};Ca=m});function Na({className:a,orientation:b="horizontal",...f}){return t(F.Root,{"data-slot":"tabs","data-orientation":b,orientation:b,className:V("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",a),...f})}var x=k("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-[orientation=horizontal]/tabs:h-9 group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function Va({className:a,variant:b="default",...f}){return t(F.List,{"data-slot":"tabs-list","data-variant":b,className:V(x({variant:b}),a),...f})}function Aa({className:a,...b}){return t(F.Trigger,{"data-slot":"tabs-trigger",className:V("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent","data-[state=active]:bg-background data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 dark:data-[state=active]:text-foreground","after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100",a),...b})}function Oa({className:a,...b}){return t(F.Content,{"data-slot":"tabs-content",className:V("flex-1 outline-none",a),...b})}function Ka({delayDuration:a=0,...b}){return t(A.Provider,{"data-slot":"tooltip-provider",delayDuration:a,...b})}function Xa({...a}){return t(A.Root,{"data-slot":"tooltip",...a})}function Za({...a}){return t(A.Trigger,{"data-slot":"tooltip-trigger",...a})}function $a({className:a,sideOffset:b=0,children:f,...g}){return t(A.Portal,{children:R(A.Content,{"data-slot":"tooltip-content",sideOffset:b,className:V("z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",a),...g,children:[f,t(A.Arrow,{className:"z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground"})]})})}var Y={viewBox:"0 -960 960 960",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},qa=(a)=>t("svg",{...Y,...a,children:t("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm120-80v-560H200v560h120Zm80 0h360v-560H400v560Z"})}),va=(a)=>t("svg",{...Y,...a,children:t("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm360-80v-560H200v560h360Zm200 0v-560H640v560h120Z"})}),Sa=(a)=>t("svg",{...Y,...a,children:t("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm560-80v-560H400v560h360Z"})}),Qa=(a)=>t("svg",{...Y,...a,children:t("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm360-80v-560H200v560h360Z"})}),Ha=(a)=>R("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...a,children:[t("path",{d:"M12 8V4H8"}),t("path",{d:"M6 7H18A3 3 0 0 1 21 10V18A3 3 0 0 1 18 21H6A3 3 0 0 1 3 18V10A3 3 0 0 1 6 7ZM8 13V15A1 1 0 0 0 10 15V13A1 1 0 0 0 8 13ZM14 13V15A1 1 0 0 0 16 15V13A1 1 0 0 0 14 13Z",fill:"currentColor",stroke:"none"}),t("path",{d:"M2 14h2"}),t("path",{d:"M20 14h2"})]}),Pa=(a)=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:30,height:30,viewBox:"120 -792 720 720",fill:"none","aria-hidden":"true",focusable:"false",...a,children:t("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M 160 -180 v -72 h 80 v -252 q 0 -74.7 50 -132.75 T 420 -712.8 v -25.2 q 0 -22.5 17.5 -38.25 T 480 -792 q 25 0 42.5 15.75 T 540 -738 v 25.2 q 80 18 130 76.05 T 720 -504 v 252 h 80 v 72 H 160 Z M 480 -72 q -33 0 -56.5 -21.15 T 400 -144 h 160 q 0 29.7 -23.5 50.85 T 480 -72 Z",fill:"currentColor"})}),Ua=(a)=>R("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",focusable:"false",...a,children:[t("path",{d:"M10.77 10.377a1 1 0 0 0-.132.437l-.105 1.665a.5.5 0 0 0 .793.436l1.32-.96a1 1 0 0 0 .278-.309l3.912-6.775a1.25 1.25 0 1 0-2.165-1.25l-3.901 6.756Z",fill:"currentColor"}),t("path",{d:"M11.016 6.75a.758.758 0 0 1-.758.748c-2.938 0-4.882 1.71-5.517 3.95-.708 2.499.245 4.459 1.979 5.851 1.767 1.42 4.31 2.203 6.547 2.203.415 0 .749.335.745.748a.758.758 0 0 1-.758.748c-2.536 0-5.421-.873-7.485-2.531-2.098-1.686-3.38-4.225-2.475-7.414.818-2.883 3.354-5.051 6.977-5.051.415 0 .749.335.745.748Z",fill:"currentColor"}),t("path",{d:"M17.147 8.315a.767.767 0 0 1 1.058-.168c1.666 1.188 2.508 2.542 2.733 3.876a4.5 4.5 0 0 1-.805 3.392c-.919 1.434-2.714 2.074-4.479 2.185-1.799.113-3.78-.302-5.292-1.216a.733.733 0 0 1-.242-1.022.768.768 0 0 1 1.042-.246c1.216.734 2.881 1.096 4.409 1 1.553-.097 2.755-.647 3.292-1.5l.015-.022.015-.021a3.025 3.025 0 0 0 .553-2.294c-.148-.876-.72-1.915-2.137-2.926a.733.733 0 0 1-.162-1.038Z",fill:"currentColor"})]}),Da=(a)=>{return R("svg",{viewBox:"0 0 100 100",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a,children:[t("defs",{children:t("clipPath",{id:"bg-clip",children:t("rect",{x:"5",y:"5",width:"90",height:"90",rx:"22"})})}),t("rect",{x:"5",y:"5",width:"90",height:"90",rx:"22",fill:"#D95A66"}),t("path",{d:"M 35 75 L 65 75 L 80 60 L 75 30 L 175 130 L 135 175 Z",fill:"#A8384D",clipPath:"url(#bg-clip)"}),t("path",{d:"M 25 30 Q 38 36 50 42 L 35 55 L 35 75 L 20 60 Z",fill:"#FDF0D5"}),t("path",{d:"M 50 42 Q 62 36 75 30 L 80 60 L 65 75 L 65 55 Z",fill:"#E77A65"}),t("path",{d:"M 35 75 L 65 75 L 65 55 L 50 42 L 35 55 Z",fill:"#F5B895"}),t("path",{d:"M 50 42 Q 38 36 25 30 Q 38 26 50 20 Q 62 26 75 30 Q 62 36 50 42 Z",fill:"#F4B8B8"}),t("path",{d:"M 50 25 L 42 30 L 50 35 Z",fill:"#E57A5F"}),t("path",{d:"M 50 25 L 58 30 L 50 35 Z",fill:"#C2523C"})]})},Ma=(a)=>t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"24 24 152 152",fill:"none","aria-hidden":"true",focusable:"false",...a,children:t("path",{d:"M 44 170 L 44 100 L 24 100 L 100 30 L 126 54 L 126 36 L 142 36 L 142 69 L 176 100 L 156 100 L 156 170 L 120 170 L 120 136 A 20 20 0 0 0 80 136 L 80 170 Z",fill:"currentColor"})});function Wa({uploading:a=!1,className:b="",...f}){return R("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"15 15 70 70",width:30,height:30,className:`${b} ${a?"animate-upload-breathing":""}`,"aria-hidden":"true",focusable:"false",style:a?{transformOrigin:"center"}:void 0,...f,children:[a&&t("defs",{children:R("linearGradient",{id:"upload-gradient",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[t("stop",{offset:"0%",stopColor:"#3b82f6",children:t("animate",{attributeName:"stop-color",values:"#3b82f6;#ec4899;#8b5cf6;#3b82f6",dur:"3s",repeatCount:"indefinite"})}),t("stop",{offset:"50%",stopColor:"#8b5cf6",children:t("animate",{attributeName:"stop-color",values:"#8b5cf6;#3b82f6;#ec4899;#8b5cf6",dur:"3s",repeatCount:"indefinite"})}),t("stop",{offset:"100%",stopColor:"#ec4899",children:t("animate",{attributeName:"stop-color",values:"#ec4899;#8b5cf6;#3b82f6;#ec4899",dur:"3s",repeatCount:"indefinite"})})]})}),t("path",{d:"M 44.1 75 H 30 A 15 15 0 0 1 30 45 A 20 20 0 0 1 70 45 A 15 15 0 0 1 70 75 H 55.9 V 60.2 H 61.9 L 50 45.3 L 38.1 60.2 H 44.1 Z",fill:a?"url(#upload-gradient)":"currentColor"})]})}
2
- export{_ as Df,i as Ef,r as Ff,e as Gf,aa as Hf,ta as If,ba as Jf,fa as Kf,ga as Lf,da as Mf,za as Nf,Ca as Of,wa as Pf,Ka as Qf,Xa as Rf,Za as Sf,$a as Tf,Na as Uf,Va as Vf,Aa as Wf,Oa as Xf,qa as Yf,va as Zf,Sa as _f,Qa as $f,Ha as ag,Pa as bg,Ua as cg,Da as dg,Ma as eg,Wa as fg};
@@ -1,4 +0,0 @@
1
- // @bun
2
- import{Lk as L,Nk as w}from"./chunk-zxpef55w.js";import{Sk as Z}from"./chunk-5zntjzxw.js";import{Wk as J}from"./chunk-qvgc9e08.js";function d(b){return b.thought===!0}function B(b,j){if(typeof j==="string"&&j.length>0)return j;return b}var x=/^[A-Za-z0-9+/]+={0,2}$/;function T(b){if(!b)return!1;if(b.length%4!==0)return!1;return x.test(b)}function Q(b,j){return b&&T(j)?j:void 0}function U(b){return b.startsWith("claude-")||b.startsWith("gpt-oss-")}function f(b){let j=b.toLowerCase().match(/^gemini(?:-live)?-(\d+)/);if(!j)return;return Number.parseInt(j[1],10)}function y(b){let j=f(b);if(j!==void 0)return j>=3;return!0}function R(b,j){let A=[],N=(z)=>{if(!U(b.id))return z;return z.replace(/[^a-zA-Z0-9_-]/g,"_").slice(0,64)},$=Z(j.messages,b,N);for(let z of $)if(z.role==="user")if(typeof z.content==="string")A.push({role:"user",parts:[{text:J(z.content)}]});else{let E=z.content.map((D)=>{if(D.type==="text")return{text:J(D.text)};else return{inlineData:{mimeType:D.mimeType,data:D.data}}});if(E.length===0)continue;A.push({role:"user",parts:E})}else if(z.role==="assistant"){let E=[],D=z.provider===b.provider&&z.model===b.id;for(let q of z.content)if(q.type==="text"){if(!q.text||q.text.trim()==="")continue;let G=Q(D,q.textSignature);E.push({text:J(q.text),...G&&{thoughtSignature:G}})}else if(q.type==="thinking"){if(!q.thinking||q.thinking.trim()==="")continue;if(D){let G=Q(D,q.thinkingSignature);E.push({thought:!0,text:J(q.thinking),...G&&{thoughtSignature:G}})}else E.push({text:J(q.thinking)})}else if(q.type==="toolCall"){let G=Q(D,q.thoughtSignature),K={functionCall:{name:q.name,args:q.arguments??{},...U(b.id)?{id:q.id}:{}},...G&&{thoughtSignature:G}};E.push(K)}if(E.length===0)continue;A.push({role:"model",parts:E})}else if(z.role==="toolResult"){let D=z.content.filter((H)=>H.type==="text").map((H)=>H.text).join(`
3
- `),q=b.input.includes("image")?z.content.filter((H)=>H.type==="image"):[],G=D.length>0,K=q.length>0,V=y(b.id),W=G?J(D):K?"(see attached image)":"",X=q.map((H)=>({inlineData:{mimeType:H.mimeType,data:H.data}})),v=U(b.id),Y={functionResponse:{name:z.toolName,response:z.isError?{error:W}:{output:W},...K&&V&&{parts:X},...v?{id:z.toolCallId}:{}}},O=A[A.length-1];if(O?.role==="user"&&O.parts?.some((H)=>H.functionResponse))O.parts.push(Y);else A.push({role:"user",parts:[Y]});if(K&&!V)A.push({role:"user",parts:[{text:"Tool result image:"},...X]})}return A}var F=new Set(["$schema","$id","$anchor","$dynamicAnchor","$vocabulary","$comment","$defs","definitions"]);function _(b){if(typeof b!=="object"||b===null||Array.isArray(b))return b;let j={};for(let[A,N]of Object.entries(b)){if(F.has(A))continue;j[A]=_(N)}return j}function C(b,j=!1){if(b.length===0)return;return[{functionDeclarations:b.map((A)=>({name:A.name,description:A.description,...j?{parameters:_(A.parameters)}:{parametersJsonSchema:A.parameters}}))}]}function k(b){switch(b){case"auto":return L.AUTO;case"none":return L.NONE;case"any":return L.ANY;default:return L.AUTO}}function P(b){switch(b){case w.STOP:return"stop";case w.MAX_TOKENS:return"length";case w.BLOCKLIST:case w.PROHIBITED_CONTENT:case w.SPII:case w.SAFETY:case w.IMAGE_SAFETY:case w.IMAGE_PROHIBITED_CONTENT:case w.IMAGE_RECITATION:case w.IMAGE_OTHER:case w.RECITATION:case w.FINISH_REASON_UNSPECIFIED:case w.OTHER:case w.LANGUAGE:case w.MALFORMED_FUNCTION_CALL:case w.UNEXPECTED_TOOL_CALL:case w.NO_IMAGE:return"error";default:throw Error(`Unhandled stop reason: ${b}`)}}
4
- export{d as Fk,B as Gk,R as Hk,C as Ik,k as Jk,P as Kk};
@@ -1 +0,0 @@
1
- import{g as q}from"./chunk-qgq96tbp.js";import"./chunk-vt4zpasm.js";import"./chunk-8yz1expv.js";import"./chunk-nzy3pjjm.js";import"./chunk-h270n69j.js";import"./chunk-mqbxagfd.js";import"./chunk-zhd2mkbr.js";import"./chunk-bdjhb77e.js";import"./chunk-p9xfyqh1.js";import"./chunk-31mjcykb.js";import"./chunk-hfp4hpca.js";import"./chunk-wrz9e73c.js";import"./chunk-1nh6xgek.js";import"./chunk-3rcc5s99.js";import"./chunk-20y3wte3.js";import"./chunk-5e1xqaj4.js";import"./chunk-ejfmxjw6.js";import"./chunk-7y8dng8t.js";import"./chunk-3t7mjvdv.js";import"./chunk-pgae67hk.js";import"./chunk-tsncwscz.js";import"./chunk-h2wsm7h3.js";import"./chunk-etces6ff.js";import"./chunk-yahb7wan.js";import"./chunk-mahxw48e.js";import"./chunk-wap08p4j.js";import"./chunk-nr89225z.js";import{Ah as k,ih as f}from"./chunk-b1e3tec3.js";import"./chunk-ws07a9kv.js";function w(){let{shareId:v}=A.useParams();return f(q,{shareId:v})}var A=k("/share/$shareId/")({component:w});export{A as Route};
@@ -1,7 +0,0 @@
1
- // @bun
2
- import{Ub as m,Vb as c}from"./chunk-hrzm70wg.js";import{_b as s}from"./chunk-wr5byz6r.js";import{$b as d}from"./chunk-ss45w8ks.js";import{gc as l,hc as a}from"./chunk-w3a50kz8.js";import{jc as i,lc as n}from"./chunk-6a2eb3b5.js";import{mc as w}from"./chunk-amsb41z5.js";import{nc as p}from"./chunk-gn8snrnk.js";import{Ze as T}from"./chunk-w9w5301f.js";import{bf as g,cf as r}from"./chunk-k9w6mk9d.js";import{df as k}from"./chunk-wny0qagx.js";import{zk as h}from"./chunk-k20bhxed.js";import"./chunk-hz31j0hk.js";import"./chunk-ws07a9kv.js";function C(J,X){if(!J)return!1;let Q=X.toLowerCase();for(let[Y,_]of Object.entries(J))if(Y.toLowerCase()===Q&&_!==null&&_.trim().length>0)return!0;return!1}function t(J,X,Q){if(X)return X;if(C(Q,"authorization")||C(Q,"cf-aig-authorization"))return"unused";throw Error(`No API key for provider: ${J}`)}function $J(J){for(let X of J){if(X.role==="toolResult")return!0;if(X.role==="assistant"){if(X.content.some((Q)=>Q.type==="toolCall"))return!0}}return!1}function u(J){return J.type==="text"}function qJ(J){return J.type==="thinking"}function ZJ(J){return J.type==="toolCall"}function KJ(J){return J.type==="image"}function jJ(J){if(typeof J!=="object"||J===null)return!1;let X=J;return X.type==="reasoning.encrypted"&&typeof X.id==="string"&&X.id.length>0&&typeof X.data==="string"&&X.data.length>0}function e(J,X){if(J)return J;if(d("PI_CACHE_RETENTION",X)==="long")return"long";return"short"}var zJ=(J,X,Q)=>{let Y=new k;return(async()=>{let _={role:"assistant",content:[],api:J.api,provider:J.provider,model:J.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 H=t(J.provider,Q?.apiKey,Q?.headers),K=f(J),$=e(Q?.cacheRetention,Q?.env),q=$==="none"?void 0:Q?.sessionId,j=HJ(J,X,H,Q?.headers,q,K),V=LJ(J,X,Q,K,$),O=await Q?.onPayload?.(V,J);if(O!==void 0)V=O;let P={...Q?.signal?{signal:Q.signal}:{},...Q?.timeoutMs!==void 0?{timeout:Q.timeoutMs}:{},maxRetries:Q?.maxRetries??0},{data:A,response:F}=await j.chat.completions.create(V,P).withResponse();await Q?.onResponse?.({status:F.status,headers:p(F.headers)},J),Y.push({type:"start",partial:_});let E=null,L=null,G=!1,v=new Map,U=new Map,I=new Map,B=_.content,y=(Z)=>B.indexOf(Z),JJ=(Z)=>{let z=y(Z);if(z===-1)return;if(Z.type==="text")Y.push({type:"text_end",contentIndex:z,content:Z.text,partial:_});else if(Z.type==="thinking")Y.push({type:"thinking_end",contentIndex:z,content:Z.thinking,partial:_});else if(Z.type==="toolCall")Z.arguments=T(Z.partialArgs),delete Z.partialArgs,delete Z.streamIndex,Y.push({type:"toolcall_end",contentIndex:z,toolCall:Z,partial:_})},QJ=()=>{if(!E)E={type:"text",text:""},B.push(E),Y.push({type:"text_start",contentIndex:y(E),partial:_});return E},XJ=(Z)=>{if(!L)L={type:"thinking",thinking:"",thinkingSignature:Z},B.push(L),Y.push({type:"thinking_start",contentIndex:y(L),partial:_});return L},YJ=(Z)=>{if(!Z.id)return;let z=I.get(Z.id);if(z)Z.thoughtSignature=z,I.delete(Z.id)},_J=(Z)=>{let z=typeof Z.index==="number"?Z.index:void 0,N=z!==void 0?v.get(z):void 0;if(!N&&Z.id)N=U.get(Z.id);if(!N){if(N={type:"toolCall",id:Z.id||"",name:Z.function?.name||"",arguments:{},partialArgs:"",streamIndex:z},z!==void 0)v.set(z,N);if(Z.id)U.set(Z.id,N);B.push(N),Y.push({type:"toolcall_start",contentIndex:y(N),partial:_})}if(z!==void 0&&N.streamIndex===void 0)N.streamIndex=z,v.set(z,N);if(Z.id)U.set(Z.id,N);return YJ(N),N};for await(let Z of A){if(!Z||typeof Z!=="object")continue;if(_.responseId||=Z.id,typeof Z.model==="string"&&Z.model.length>0&&Z.model!==J.id)_.responseModel||=Z.model;if(Z.usage)_.usage=b(Z.usage,J);let z=Array.isArray(Z.choices)?Z.choices[0]:void 0;if(!z)continue;if(!Z.usage&&z.usage)_.usage=b(z.usage,J);if(z.finish_reason){let N=yJ(z.finish_reason);if(_.stopReason=N.stopReason,N.errorMessage)_.errorMessage=N.errorMessage;G=!0}if(z.delta){if(z.delta.content!==null&&z.delta.content!==void 0&&z.delta.content.length>0){let W=QJ();W.text+=z.delta.content,Y.push({type:"text_delta",contentIndex:y(W),delta:z.delta.content,partial:_})}let N=["reasoning_content","reasoning","reasoning_text"],R=z.delta,M=null;for(let W of N){let S=R[W];if(typeof S==="string"&&S.length>0){M=W;break}}if(M){let W=R[M];if(typeof W==="string"&&W.length>0){let S=J.provider==="opencode-go"&&M==="reasoning"?"reasoning_content":M,D=XJ(S);D.thinking+=W,Y.push({type:"thinking_delta",contentIndex:y(D),delta:W,partial:_})}}if(z?.delta?.tool_calls)for(let W of z.delta.tool_calls){let S=_J(W);if(!S.id&&W.id)S.id=W.id,U.set(W.id,S);if(!S.name&&W.function?.name)S.name=W.function.name;let D="";if(W.function?.arguments)D=W.function.arguments,S.partialArgs=(S.partialArgs??"")+W.function.arguments,S.arguments=T(S.partialArgs);Y.push({type:"toolcall_delta",contentIndex:y(S),delta:D,partial:_})}let x=z.delta.reasoning_details;if(Array.isArray(x)){for(let W of x)if(jJ(W)){let S=JSON.stringify(W),D=U.get(W.id);if(D)D.thoughtSignature=S;else I.set(W.id,S)}}}}for(let Z of B)JJ(Z);if(Q?.signal?.aborted)throw Error("Request was aborted");if(_.stopReason==="aborted")throw Error("Request was aborted");if(_.stopReason==="error")throw Error(_.errorMessage||"Provider returned an error stop reason");if(!G)throw Error("Stream ended without finish_reason");Y.push({type:"done",reason:_.stopReason,message:_}),Y.end()}catch(H){for(let $ of _.content)delete $.index,delete $.partialArgs,delete $.streamIndex;_.stopReason=Q?.signal?.aborted?"aborted":"error",_.errorMessage=a(l(H));let K=H?.error?.metadata?.raw;if(K&&!_.errorMessage.includes(String(K)))_.errorMessage+=`
3
- ${K}`;Y.push({type:"error",reason:_.stopReason,error:_}),Y.end()}})(),Y},hJ=(J,X,Q)=>{t(J.provider,Q?.apiKey,Q?.headers);let Y=i(J,X,Q,Q?.apiKey),_=Q?.reasoning?r(J,Q.reasoning):void 0,H=_==="off"?void 0:_,K=Q?.toolChoice;return zJ(J,X,{...Y,reasoningEffort:H,toolChoice:K})};function HJ(J,X,Q,Y,_,H=f(J)){let K={...J.headers};if(J.provider==="github-copilot"){let $=m(X.messages),q=c({messages:X.messages,hasImages:$});Object.assign(K,q)}if(_&&H.sendSessionAffinityHeaders)if(H.sessionAffinityFormat==="openrouter")K["x-session-id"]=_;else{if(H.sessionAffinityFormat==="openai")K.session_id=_;K["x-client-request-id"]=_,K["x-session-affinity"]=_}if(Y)Object.assign(K,Y);return new h({apiKey:Q,baseURL:J.baseUrl,dangerouslyAllowBrowser:!0,defaultHeaders:K})}function LJ(J,X,Q,Y=f(J),_=e(Q?.cacheRetention,Q?.env)){let H=EJ(J,X,Y),K=GJ(Y,_),$={model:J.id,messages:H,stream:!0,prompt_cache_key:J.baseUrl.includes("api.openai.com")&&_!=="none"||_==="long"&&Y.supportsLongCacheRetention?s(Q?.sessionId):void 0,prompt_cache_retention:_==="long"&&Y.supportsLongCacheRetention?"24h":void 0};if(Y.supportsUsageInStreaming!==!1)$.stream_options={include_usage:!0};if(Y.supportsStore)$.store=!1;if(Q?.maxTokens)if(Y.maxTokensField==="max_tokens")$.max_tokens=Q.maxTokens;else $.max_completion_tokens=Q.maxTokens;if(Q?.temperature!==void 0)$.temperature=Q.temperature;if(X.tools&&X.tools.length>0){if($.tools=DJ(X.tools,Y),Y.zaiToolStream)$.tool_stream=!0}else if($J(X.messages))$.tools=[];if(K)NJ(H,$.tools,K);if(Q?.toolChoice)$.tool_choice=Q.toolChoice;if(Y.thinkingFormat==="zai"&&J.reasoning){let q=$;if(q.thinking=Q?.reasoningEffort?{type:"enabled",clear_thinking:!1}:{type:"disabled"},Q?.reasoningEffort&&Y.supportsReasoningEffort){let j=J.thinkingLevelMap?.[Q.reasoningEffort],V=j===void 0?Q.reasoningEffort:j;if(typeof V==="string")q.reasoning_effort=V}}else if(Y.thinkingFormat==="qwen"&&J.reasoning)$.enable_thinking=!!Q?.reasoningEffort;else if(Y.thinkingFormat==="qwen-chat-template"&&J.reasoning)$.chat_template_kwargs={enable_thinking:!!Q?.reasoningEffort,preserve_thinking:!0};else if(Y.thinkingFormat==="chat-template"&&J.reasoning){let q=VJ(J,Q,Y);if(q)$.chat_template_kwargs=q}else if(Y.thinkingFormat==="deepseek"&&J.reasoning){if(Q?.reasoningEffort)$.thinking={type:"enabled"};else if(J.thinkingLevelMap?.off!==null)$.thinking={type:"disabled"};if(Q?.reasoningEffort&&Y.supportsReasoningEffort)$.reasoning_effort=J.thinkingLevelMap?.[Q.reasoningEffort]??Q.reasoningEffort}else if(Y.thinkingFormat==="openrouter"&&J.reasoning){let q=$;if(Q?.reasoningEffort)q.reasoning={effort:J.thinkingLevelMap?.[Q.reasoningEffort]??Q.reasoningEffort};else if(J.thinkingLevelMap?.off!==null)q.reasoning={effort:J.thinkingLevelMap?.off??"none"}}else if(Y.thinkingFormat==="ant-ling"&&J.reasoning&&Q?.reasoningEffort){let q=J.thinkingLevelMap?.[Q.reasoningEffort];if(typeof q==="string")$.reasoning={effort:q}}else if(Y.thinkingFormat==="together"&&J.reasoning){let q=$;if(q.reasoning={enabled:!!Q?.reasoningEffort},Q?.reasoningEffort&&Y.supportsReasoningEffort)q.reasoning_effort=J.thinkingLevelMap?.[Q.reasoningEffort]??Q.reasoningEffort}else if(Y.thinkingFormat==="string-thinking"&&J.reasoning){let q=$;if(Q?.reasoningEffort)q.thinking=J.thinkingLevelMap?.[Q.reasoningEffort]??Q.reasoningEffort;else if(J.thinkingLevelMap?.off!==null)q.thinking=J.thinkingLevelMap?.off??"none"}else if(Q?.reasoningEffort&&J.reasoning&&Y.supportsReasoningEffort)$.reasoning_effort=J.thinkingLevelMap?.[Q.reasoningEffort]??Q.reasoningEffort;else if(!Q?.reasoningEffort&&J.reasoning&&Y.supportsReasoningEffort){let q=J.thinkingLevelMap?.off;if(typeof q==="string")$.reasoning_effort=q}if(J.compat?.openRouterRouting)$.provider=J.compat.openRouterRouting;if(J.compat?.vercelGatewayRouting){let q=J.compat.vercelGatewayRouting;if(q.only||q.order){let j={};if(q.only)j.only=q.only;if(q.order)j.order=q.order;$.providerOptions={gateway:j}}}return $}function VJ(J,X,Q){let Y={};for(let[_,H]of Object.entries(Q.chatTemplateKwargs)){let K=WJ(J,X,H);if(K!==void 0)Y[_]=K}return Object.keys(Y).length>0?Y:void 0}function WJ(J,X,Q){if(typeof Q!=="object"||Q===null)return Q;let Y=X?.reasoningEffort;if(!Y&&Q.omitWhenOff)return;if(Q.$var==="thinking.enabled")return!!Y;let _=Y?J.thinkingLevelMap?.[Y]:J.thinkingLevelMap?.off;return _===void 0?Y:typeof _==="string"?_:void 0}function GJ(J,X){if(J.cacheControlFormat!=="anthropic"||X==="none")return;let Q=X==="long"&&J.supportsLongCacheRetention?"1h":void 0;return{type:"ephemeral",...Q?{ttl:Q}:{}}}function NJ(J,X,Q){SJ(J,Q),FJ(X,Q),OJ(J,Q)}function SJ(J,X){for(let Q of J)if(Q.role==="system"||Q.role==="developer"){PJ(Q,X);return}}function OJ(J,X){for(let Q=J.length-1;Q>=0;Q--){let Y=J[Q];if(Y.role==="user"||Y.role==="assistant"){if(AJ(Y,X))return}}}function FJ(J,X){if(!J||J.length===0)return;let Q=J[J.length-1];Q.cache_control=X}function PJ(J,X){return o(J,X)}function AJ(J,X){if(J.role==="user"||J.role==="assistant")return o(J,X);return!1}function o(J,X){let Q=J.content;if(typeof Q==="string"){if(Q.length===0)return!1;return J.content=[{type:"text",text:Q,cache_control:X}],!0}if(!Array.isArray(Q))return!1;for(let Y=Q.length-1;Y>=0;Y--){let _=Q[Y];if(_?.type==="text"){let H=_;return H.cache_control=X,!0}}return!1}function EJ(J,X,Q){let Y=[],_=($)=>{if($.includes("|")){let[q]=$.split("|");return q.replace(/[^a-zA-Z0-9_-]/g,"_").slice(0,40)}if(J.provider==="openai")return $.length>40?$.slice(0,40):$;return $},H=n(X.messages,J,($)=>_($));if(X.systemPrompt){let q=J.reasoning&&Q.supportsDeveloperRole?"developer":"system";Y.push({role:q,content:w(X.systemPrompt)})}let K=null;for(let $=0;$<H.length;$++){let q=H[$];if(Q.requiresAssistantAfterToolResult&&K==="toolResult"&&q.role==="user")Y.push({role:"assistant",content:"I have processed the tool results."});if(q.role==="user")if(typeof q.content==="string")Y.push({role:"user",content:w(q.content)});else{let j=q.content.map((V)=>{if(V.type==="text")return{type:"text",text:w(V.text)};else return{type:"image_url",image_url:{url:`data:${V.mimeType};base64,${V.data}`}}});if(j.length===0)continue;Y.push({role:"user",content:j})}else if(q.role==="assistant"){let j={role:"assistant",content:Q.requiresAssistantAfterToolResult?"":null},V=q.content.filter(u).filter((L)=>L.text.trim().length>0).map((L)=>({type:"text",text:w(L.text)})),O=V.map((L)=>L.text).join(""),P=q.content.filter(qJ).filter((L)=>L.thinking.trim().length>0);if(P.length>0)if(Q.requiresThinkingAsText){let L=P.map((G)=>w(G.thinking)).join(`
4
-
5
- `);j.content=[{type:"text",text:L},...V]}else{if(O.length>0)j.content=O;let L=P[0].thinkingSignature;if(J.provider==="opencode-go"&&L==="reasoning")L="reasoning_content";if(L&&L.length>0)j[L]=P.map((G)=>G.thinking).join(`
6
- `)}else if(O.length>0)j.content=O;let A=q.content.filter(ZJ);if(A.length>0){j.tool_calls=A.map((G)=>({id:G.id,type:"function",function:{name:G.name,arguments:JSON.stringify(G.arguments)}}));let L=A.filter((G)=>G.thoughtSignature).map((G)=>{try{return JSON.parse(G.thoughtSignature)}catch{return null}}).filter(Boolean);if(L.length>0)j.reasoning_details=L}if(Q.requiresReasoningContentOnAssistantMessages&&J.reasoning&&j.reasoning_content===void 0)j.reasoning_content="";let F=j.content;if(!(F!==null&&F!==void 0&&(typeof F==="string"?F.length>0:F.length>0))&&!j.tool_calls)continue;Y.push(j)}else if(q.role==="toolResult"){let j=[],V=$;for(;V<H.length&&H[V].role==="toolResult";V++){let O=H[V],P=O.content.filter(u).map((G)=>G.text).join(`
7
- `),A=O.content.some((G)=>G.type==="image"),E=P.length>0?P:A?"(see attached image)":"(no tool output)",L={role:"tool",content:w(E),tool_call_id:O.toolCallId};if(Q.requiresToolResultName&&O.toolName)L.name=O.toolName;if(Y.push(L),A&&J.input.includes("image")){for(let G of O.content)if(KJ(G))j.push({type:"image_url",image_url:{url:`data:${G.mimeType};base64,${G.data}`}})}}if($=V-1,j.length>0){if(Q.requiresAssistantAfterToolResult)Y.push({role:"assistant",content:"I have processed the tool results."});Y.push({role:"user",content:[{type:"text",text:"Attached image(s) from tool result:"},...j]}),K="user"}else K="toolResult";continue}K=q.role}return Y}function DJ(J,X){return J.map((Q)=>({type:"function",function:{name:Q.name,description:Q.description,parameters:Q.parameters,...X.supportsStrictMode!==!1&&{strict:!1}}}))}function b(J,X){let Q=J.prompt_tokens||0,Y=J.prompt_tokens_details?.cached_tokens??J.prompt_cache_hit_tokens??0,_=J.prompt_tokens_details?.cache_write_tokens||0,H=Math.max(0,Q-Y-_),K=J.completion_tokens||0,$={input:H,output:K,cacheRead:Y,cacheWrite:_,reasoning:J.completion_tokens_details?.reasoning_tokens||0,totalTokens:H+K+Y+_,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}};return g(X,$),$}function yJ(J){if(J===null)return{stopReason:"stop"};switch(J){case"stop":case"end":return{stopReason:"stop"};case"length":return{stopReason:"length"};case"function_call":case"tool_calls":return{stopReason:"toolUse"};case"content_filter":return{stopReason:"error",errorMessage:"Provider finish_reason: content_filter"};case"network_error":return{stopReason:"error",errorMessage:"Provider finish_reason: network_error"};default:return{stopReason:"error",errorMessage:`Provider finish_reason: ${J}`}}}function wJ(J){let{provider:X,baseUrl:Q}=J,Y=X==="zai"||X==="zai-coding-cn"||Q.includes("api.z.ai")||Q.includes("open.bigmodel.cn"),_=X==="together"||Q.includes("api.together.ai")||Q.includes("api.together.xyz"),H=X==="moonshotai"||X==="moonshotai-cn"||Q.includes("api.moonshot."),K=X==="openrouter"||Q.includes("openrouter.ai"),$=X==="cloudflare-workers-ai"||Q.includes("api.cloudflare.com"),q=X==="cloudflare-ai-gateway"||Q.includes("gateway.ai.cloudflare.com"),j=X==="nvidia"||Q.includes("integrate.api.nvidia.com"),V=X==="ant-ling"||Q.includes("api.ant-ling.com"),O=j||X==="cerebras"||Q.includes("cerebras.ai")||X==="xai"||Q.includes("api.x.ai")||_||Q.includes("chutes.ai")||Q.includes("deepseek.com")||Y||H||X==="opencode"||Q.includes("opencode.ai")||$||q||V,P=Q.includes("chutes.ai")||H||q||_||j||V,A=X==="xai"||Q.includes("api.x.ai"),F=X==="deepseek"||Q.includes("deepseek.com"),E=K&&(J.id.startsWith("anthropic/")||J.id.startsWith("openai/")),L=X==="openrouter"&&J.id.startsWith("anthropic/")?"anthropic":void 0;return{supportsStore:!O,supportsDeveloperRole:E||!O&&!K,supportsReasoningEffort:!A&&!Y&&!H&&!_&&!q&&!j&&!V,supportsUsageInStreaming:!0,maxTokensField:P?"max_tokens":"max_completion_tokens",requiresToolResultName:!1,requiresAssistantAfterToolResult:!1,requiresThinkingAsText:!1,requiresReasoningContentOnAssistantMessages:F,thinkingFormat:F?"deepseek":Y?"zai":_?"together":V?"ant-ling":K?"openrouter":"openai",openRouterRouting:{},vercelGatewayRouting:{},chatTemplateKwargs:{},zaiToolStream:!1,supportsStrictMode:!H&&!_&&!q&&!j,cacheControlFormat:L,sendSessionAffinityHeaders:!1,sessionAffinityFormat:K?"openrouter":"openai",supportsLongCacheRetention:!(_||$||q||j||V)}}function f(J){let X=wJ(J);if(!J.compat)return X;return{supportsStore:J.compat.supportsStore??X.supportsStore,supportsDeveloperRole:J.compat.supportsDeveloperRole??X.supportsDeveloperRole,supportsReasoningEffort:J.compat.supportsReasoningEffort??X.supportsReasoningEffort,supportsUsageInStreaming:J.compat.supportsUsageInStreaming??X.supportsUsageInStreaming,maxTokensField:J.compat.maxTokensField??X.maxTokensField,requiresToolResultName:J.compat.requiresToolResultName??X.requiresToolResultName,requiresAssistantAfterToolResult:J.compat.requiresAssistantAfterToolResult??X.requiresAssistantAfterToolResult,requiresThinkingAsText:J.compat.requiresThinkingAsText??X.requiresThinkingAsText,requiresReasoningContentOnAssistantMessages:J.compat.requiresReasoningContentOnAssistantMessages??X.requiresReasoningContentOnAssistantMessages,thinkingFormat:J.compat.thinkingFormat??X.thinkingFormat,openRouterRouting:J.compat.openRouterRouting??{},vercelGatewayRouting:J.compat.vercelGatewayRouting??X.vercelGatewayRouting,chatTemplateKwargs:J.compat.chatTemplateKwargs??X.chatTemplateKwargs,zaiToolStream:J.compat.zaiToolStream??X.zaiToolStream,supportsStrictMode:J.compat.supportsStrictMode??X.supportsStrictMode,cacheControlFormat:J.compat.cacheControlFormat??X.cacheControlFormat,sendSessionAffinityHeaders:J.compat.sendSessionAffinityHeaders??X.sendSessionAffinityHeaders,sessionAffinityFormat:J.compat.sessionAffinityFormat??X.sessionAffinityFormat,supportsLongCacheRetention:J.compat.supportsLongCacheRetention??X.supportsLongCacheRetention}}export{hJ as streamSimple,zJ as stream,EJ as convertMessages};
@@ -1,3 +0,0 @@
1
- // @bun
2
- function x(f){let b={};for(let[q,w]of f.entries())b[q]=w;return b}
3
- export{x as Ek};
@@ -1,3 +0,0 @@
1
- // @bun
2
- function z(b){if(b instanceof Error)return b.message||b.name;if(typeof b==="string")return b;return String(b)}function A(b){if(!(b instanceof Error))return{name:"ThrownValue",message:z(b)};let k=b.code;return{name:b.name||void 0,message:b.message||b.name,stack:b.stack,code:typeof k==="string"||typeof k==="number"?k:void 0}}function B(b,k,q){return{type:b,timestamp:Date.now(),error:A(k),details:q}}function C(b,k){b.diagnostics=[...b.diagnostics??[],k]}
3
- export{z as ne,B as oe,C as pe};
@@ -1 +0,0 @@
1
- import{h as RB,i as bB}from"./chunk-vt4zpasm.js";import{k as gB}from"./chunk-bmqw3j2d.js";import{o as LB,r as MB}from"./chunk-8yz1expv.js";import"./chunk-nzy3pjjm.js";import{P as NB}from"./chunk-mqbxagfd.js";import"./chunk-zhd2mkbr.js";import"./chunk-bdjhb77e.js";import{Wa as DB}from"./chunk-31mjcykb.js";import"./chunk-hfp4hpca.js";import"./chunk-3rcc5s99.js";import"./chunk-20y3wte3.js";import{Cf as kB}from"./chunk-ve7v8wtv.js";import"./chunk-7y8dng8t.js";import{jg as VB,kg as wB}from"./chunk-pgae67hk.js";import"./chunk-tsncwscz.js";import{qg as EB}from"./chunk-etces6ff.js";import{rg as $B}from"./chunk-yahb7wan.js";import"./chunk-mahxw48e.js";import"./chunk-wap08p4j.js";import{bh as PB}from"./chunk-nr89225z.js";import{Ah as TB,Gi as _B,Mh as q,Wh as p,ak as UB,eh as d,gh as XB,hh as zB,hi as ZB,ih as G,ik as yB,jh as D,kh as HB,nh as j,ph as QB,vh as qB,xh as YB}from"./chunk-b1e3tec3.js";import{Xk as KB}from"./chunk-ws07a9kv.js";var $=KB(XB(),1);var tB=({item:J})=>{if(J.preview?.thumbnailUrl)return G("img",{src:J.preview.thumbnailUrl,alt:"Preview",className:"w-full h-full object-cover"});if(J.preview?.proxyType==="audio"||J.proxyType==="audio")return G("div",{className:"w-full h-full flex items-center justify-center bg-muted",children:G(ZB,{className:"w-5 h-5 text-muted-foreground"})});return G("div",{className:"w-full h-full flex items-center justify-center bg-muted",children:G(_B,{className:"w-5 h-5 text-muted-foreground"})})},OB=({projectId:J,currentAssetId:X,parentFolderId:Q,initialFiles:_,initialNextCursor:w})=>{let{ref:z,inView:k}=$B({threshold:0,rootMargin:"200px"}),T=$.useRef(null),N=$.useRef(!1),[O,y]=$.useState(_),[Z,R]=$.useState(w),[b,S]=$.useState(!!w),[L,P]=$.useState(!1);return $.useEffect(()=>{y(_),R(w),S(!!w),N.current=!1},[_,w]),$.useEffect(()=>{(async()=>{if(!Z||L||!k||!b)return;P(!0);try{let W=await q.api.folders[":folderId"].search.$post({param:{folderId:Q},json:{assetType:"file",after:Z,first:200,recursively:!1,conditions:[]}});if(!W.ok)throw Error("Failed to fetch next page");let g=await W.json(),M=g.data||[];y((f)=>[...f,...M]),R(g.pageInfo?.cursor||void 0),S(!!g.pageInfo?.cursor&&M.length>0)}catch(W){console.error("Error fetching next page:",W)}finally{P(!1)}})()},[k,Z,b,L,Q]),$.useEffect(()=>{N.current=!1},[X]),$.useEffect(()=>{if(O.some((W)=>W?.id===X)&&T.current&&!N.current)T.current.scrollIntoView({block:"center",inline:"center",behavior:"smooth"}),N.current=!0},[O,X]),G("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:D("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:[O.map((H)=>{if(!H)return null;let W=H.id===X;return G("div",{ref:H.id===X?T:null,className:"flex-shrink-0",children:G(YB,{to:"/projects/$projectId/files/$fileId",params:{projectId:J,fileId:H.id},search:{version:void 0},className:UB("rounded-lg border overflow-hidden flex items-center justify-center transition-all bg-muted/30 block",W?"w-[62px] h-[62px] opacity-100":"w-[52px] h-[52px] opacity-60 hover:opacity-100"),children:G(tB,{item:H})})},H.id)}),b&&G("div",{ref:z,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:L&&G(p,{className:"h-5 w-5 animate-spin text-muted-foreground"})})]})})};var Y=KB(XB(),1);function eB(){let{projectId:J,fileId:X}=WB.useParams(),Q=WB.useSearch(),_=Q.version,w=Q.start,z=_||X,k=Q.cmpLeft,T=Q.cmpRight,N=Q.cmpActive??"left",O=!!Q.compare&&!!k&&!!T,y=Y.useRef(null),{teamId:Z,ensureTeamIdForProject:R}=PB(),[b,S]=Y.useState(360),[L,P]=Y.useState([]),{fileViewRightSidebarCollapsed:H}=EB(),{isChatbotOpen:W}=wB(),[g,M]=Y.useState(0),[f,C]=Y.useState(null),[l,AB]=Y.useState(null),[xB,jB]=Y.useState(void 0),[A,I]=Y.useState({show:!1,files:[],nextCursor:void 0,folderId:void 0}),SB=q.api.files[":fileId"].metadata.$patch,{mutate:CB}=QB({mutationFn:async(B)=>{let K=await SB(B);if(!K.ok)throw Error("Failed to patch metadata");return await K.json()}}),hB=HB(),{members:FB,fetchMembers:n}=NB();Y.useEffect(()=>{R(J)},[J,R]),Y.useEffect(()=>{if(Z)n(Z,!0)},[Z,n]);let{data:o,isLoading:vB,isError:pB,isFetching:fB}=j({queryKey:["files",X],queryFn:async()=>{let B=await q.api.files[":fileId"].$get({param:{fileId:X}});if(!B.ok)throw Error("Failed to fetch stack");return await B.json()},enabled:!!Z,placeholderData:d}),{data:IB,isLoading:mB,isError:uB,isFetching:cB}=j({queryKey:["files",_],queryFn:async()=>{let B=await q.api.files[":fileId"].$get({param:{fileId:_}});if(!B.ok)throw Error("Failed to fetch version");return await B.json()},enabled:!!Z&&!!_,placeholderData:d}),{data:dB}=j({queryKey:["version_stacks",X,"versions"],queryFn:async()=>{let B=await q.api.version_stacks[":stackId"].versions.$get({param:{stackId:X}});if(!B.ok)throw Error("Failed to fetch versions");return await B.json()},enabled:!!J&&!!X&&(!!_||O)}),{data:x}=j({queryKey:["projects",J],queryFn:async()=>{let B=await q.api.projects[":projectId"].$get({param:{projectId:J}});if(!B.ok)throw Error("Failed to fetch project");return await B.json()}}),h=qB(),{setProjectState:a,clearProjectState:r}=VB(),lB=vB||!!_&&mB,nB=pB||!!_&&uB,oB=fB||!!_&&cB,U=IB||o,V=_?dB:o?.versionStack?.versions;Y.useEffect(()=>{if(U&&x&&Z)a({teamId:Z,projectId:J,projectName:x.name??"",ancestorFolders:U.ancestorFolders??[],currentAsset:{name:U.name,type:"file",version:V?V.find((B)=>B.id===z)?.version??V.length:void 0,proxyType:U.proxyType},isRootFolder:!1,fileId:X,downloadInfo:{originalKey:U.media?.original?.key,videoTranscodes:U.media?.videoTranscodes?.map((B)=>({key:B.key,width:B.width,height:B.height,isRaw:B.isRaw}))},versions:V,compareMode:O,canCompareVersions:(V?.length??0)>=2,onCompareVersions:()=>{let B=LB(V);if(!B)return;h({to:"/projects/$projectId/files/$fileId",params:{projectId:J,fileId:X},search:(K)=>({...K,version:void 0,compare:!0,cmpLeft:B.left.id,cmpRight:B.right.id,cmpActive:"left"})})},onFolderClick:(B)=>{h({to:"/projects/$projectId/folders/$folderId",params:{projectId:J,folderId:B}})}});return()=>r()},[Z,J,x,U,V,z,X,O,a,r,h]);let E=U?.ancestorFolders?.[0]?.id??x?.rootFolder??"";if(Y.useEffect(()=>{if(!E||!z)return;if(A.folderId===E)return;let B=!0;return(async()=>{try{let F="",t=!1,e=[],BB=void 0;for(let GB=0;GB<5;GB++){let JB=await q.api.folders[":folderId"].search.$post({param:{folderId:E},json:{assetType:"file",after:F,first:200,recursively:!1,conditions:[]}});if(!JB.ok)throw Error("Failed to search parent folder for carousel");let v=await JB.json(),c=v.data||[];if(e.push(...c),c.some((sB)=>sB.id===z)){t=!0,BB=v.pageInfo?.cursor||void 0;break}if(!v.pageInfo?.cursor||c.length<200)break;F=v.pageInfo.cursor}if(B)if(t)I({show:!0,files:e,nextCursor:BB,folderId:E});else I({show:!1,files:[],nextCursor:void 0,folderId:E})}catch(F){if(console.error(F),B)I({show:!1,files:[],nextCursor:void 0,folderId:E})}})(),()=>{B=!1}},[E,z,A.folderId]),Y.useEffect(()=>{M(0),C(null),P([])},[U?.id]),Y.useEffect(()=>{C(null),P([])},[l?.id]),lB&&!U)return G(kB,{});if(nB||!U||!x||!Z)return G("div",{children:yB.file_not_found()});let m=O?l:U,i=m?.id??z,aB=(B,K)=>{if(!Z)return;CB({param:{fileId:i},json:[{key:B,value:K}]},{onSuccess:()=>{hB.invalidateQueries({queryKey:["files",i]})}})},u=(B)=>{h({to:"/projects/$projectId/files/$fileId",params:{projectId:J,fileId:X},search:(K)=>({...K,...B})})},rB=()=>{u({compare:void 0,cmpLeft:void 0,cmpRight:void 0,cmpActive:void 0,version:N==="left"?k:T})},iB=(B)=>{C(B.id||null);let K=B.annotations;if(K&&K.length>0)P(K);else P([]);if(O){if(B.second!==null&&B.second!==void 0)jB({second:B.second,nonce:Date.now()});return}if(B.second!==null&&B.second!==void 0)y.current?.seekTo(B.second),y.current?.pause();else if(K&&K.length>0)y.current?.pause()},s=()=>{P([]),C(null)};return G("div",{className:"h-full flex flex-1 flex-col bg-background",children:D("div",{className:"h-full flex flex-1 overflow-hidden",children:[D("div",{className:"flex-1 relative",children:[oB&&!O&&G("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-background/50",children:G(p,{className:"h-8 w-8 animate-spin text-foreground"})}),O&&k&&T?G(bB,{versions:V??[],leftId:k,rightId:T,activeSide:N,annotations:L,seekRequest:xB,onActiveSideChange:(B)=>u({cmpActive:B}),onSwitchVersion:(B,K)=>u(B==="left"?{cmpLeft:K}:{cmpRight:K}),onExit:rB,onActiveAssetChange:AB,onPlay:s,onTimeUpdate:M}):G(RB,{file:U,mediaControllerRef:y,onPlay:s,onTimeUpdate:M,annotations:L,startTime:w,children:A.show&&G(OB,{projectId:J,currentAssetId:z,parentFolderId:E,initialFiles:A.files,initialNextCursor:A.nextCursor})})]}),(!H||W)&&D(zB,{children:[G(DB,{onResize:(B)=>{S((K)=>Math.max(300,Math.min(600,K-B)))},className:"hidden md:block"}),G("div",{style:{width:b},className:"flex-shrink-0 bg-background flex flex-col",children:W?G(gB,{projectId:J,contextAssetId:z}):G(MB,{teamId:Z,projectId:J,file:m,onSaveField:aB,members:FB,onCommentSelect:iB,currentTime:g,onTyping:()=>{if(O)return;y.current?.pause()},selectedCommentId:f,hideAnnotationControl:m?.proxyType==="audio"})})]})]})})}var WB=TB("/projects/$projectId/files/$fileId")({component:eB});export{WB as Route};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{$b as V}from"./chunk-ss45w8ks.js";import{ac as v,bc as U,cc as x,dc as b,ec as f,fc as h}from"./chunk-y2nw8rbx.js";import{gc as I,hc as B}from"./chunk-w3a50kz8.js";import{jc as T}from"./chunk-6a2eb3b5.js";import{mc as C}from"./chunk-amsb41z5.js";import{oc as P}from"./chunk-gn8snrnk.js";import{bf as E,cf as M}from"./chunk-k9w6mk9d.js";import{df as y}from"./chunk-wny0qagx.js";import{Mk as F,Ok as K,Pk as j}from"./chunk-zxpef55w.js";import"./chunk-ws07a9kv.js";var k="v1",u="gcp-vertex-credentials",a={THINKING_LEVEL_UNSPECIFIED:F.THINKING_LEVEL_UNSPECIFIED,MINIMAL:F.MINIMAL,LOW:F.LOW,MEDIUM:F.MEDIUM,HIGH:F.HIGH},c=0,R=(q,w,J)=>{let Y=new y;return(async()=>{let Q={role:"assistant",content:[],api:"google-vertex",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 $=n(J),D=$?l(q,$,J?.headers):p(q,t(J),o(J),J?.headers,J?.env),N=qq(q,w,J),L=await J?.onPayload?.(N,q);if(L!==void 0)N=L;let d=await D.models.generateContentStream(N);Y.push({type:"start",partial:Q});let Z=null,O=Q.content,X=()=>O.length-1;for await(let z of d){Q.responseId||=z.responseId;let H=z.candidates?.[0];if(H?.content?.parts)for(let W of H.content.parts){if(W.text!==void 0){let _=v(W);if(!Z||_&&Z.type!=="thinking"||!_&&Z.type!=="text"){if(Z)if(Z.type==="text")Y.push({type:"text_end",contentIndex:O.length-1,content:Z.text,partial:Q});else Y.push({type:"thinking_end",contentIndex:X(),content:Z.thinking,partial:Q});if(_)Z={type:"thinking",thinking:"",thinkingSignature:void 0},Q.content.push(Z),Y.push({type:"thinking_start",contentIndex:X(),partial:Q});else Z={type:"text",text:""},Q.content.push(Z),Y.push({type:"text_start",contentIndex:X(),partial:Q})}if(Z.type==="thinking")Z.thinking+=W.text,Z.thinkingSignature=U(Z.thinkingSignature,W.thoughtSignature),Y.push({type:"thinking_delta",contentIndex:X(),delta:W.text,partial:Q});else Z.text+=W.text,Z.textSignature=U(Z.textSignature,W.thoughtSignature),Y.push({type:"text_delta",contentIndex:X(),delta:W.text,partial:Q})}if(W.functionCall){if(Z){if(Z.type==="text")Y.push({type:"text_end",contentIndex:X(),content:Z.text,partial:Q});else Y.push({type:"thinking_end",contentIndex:X(),content:Z.thinking,partial:Q});Z=null}let _=W.functionCall.id,S={type:"toolCall",id:!_||Q.content.some((A)=>A.type==="toolCall"&&A.id===_)?`${W.functionCall.name}_${Date.now()}_${++c}`:_,name:W.functionCall.name||"",arguments:W.functionCall.args??{},...W.thoughtSignature&&{thoughtSignature:W.thoughtSignature}};Q.content.push(S),Y.push({type:"toolcall_start",contentIndex:X(),partial:Q}),Y.push({type:"toolcall_delta",contentIndex:X(),delta:JSON.stringify(S.arguments),partial:Q}),Y.push({type:"toolcall_end",contentIndex:X(),toolCall:S,partial:Q})}}if(H?.finishReason){if(Q.stopReason=h(H.finishReason),Q.content.some((W)=>W.type==="toolCall"))Q.stopReason="toolUse"}if(z.usageMetadata)Q.usage={input:(z.usageMetadata.promptTokenCount||0)-(z.usageMetadata.cachedContentTokenCount||0),output:(z.usageMetadata.candidatesTokenCount||0)+(z.usageMetadata.thoughtsTokenCount||0),cacheRead:z.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,reasoning:z.usageMetadata.thoughtsTokenCount||0,totalTokens:z.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},E(q,Q.usage)}if(Z)if(Z.type==="text")Y.push({type:"text_end",contentIndex:X(),content:Z.text,partial:Q});else Y.push({type:"thinking_end",contentIndex:X(),content:Z.thinking,partial:Q});if(J?.signal?.aborted)throw Error("Request was aborted");if(Q.stopReason==="aborted"||Q.stopReason==="error")throw Error("An unknown error occurred");Y.push({type:"done",reason:Q.stopReason,message:Q}),Y.end()}catch($){for(let D of Q.content)if("index"in D)delete D.index;Q.stopReason=J?.signal?.aborted?"aborted":"error",Q.errorMessage=B(I($)),Y.push({type:"error",reason:Q.stopReason,error:Q}),Y.end()}})(),Y},Hq=(q,w,J)=>{let Y=T(q,w,J,void 0);if(!J?.reasoning)return R(q,w,{...Y,thinking:{enabled:!1}});let Q=M(q,J.reasoning),$=Q==="off"?"high":Q,D=q;if(G(D)||m(D))return R(q,w,{...Y,thinking:{enabled:!0,level:Jq($,D)}});return R(q,w,{...Y,thinking:{enabled:!0,budgetTokens:Qq(D,$,J.thinkingBudgets)}})};function p(q,w,J,Y,Q){let $=i(Q);return new j({vertexai:!0,project:w,location:J,apiVersion:k,...$?{googleAuthOptions:$}:{},httpOptions:g(q,Y)})}function l(q,w,J){return new j({vertexai:!0,apiKey:w,apiVersion:k,httpOptions:g(q,J)})}function g(q,w){let J={},Y=r(q.baseUrl);if(Y){if(J.baseUrl=Y,J.baseUrlResourceScope=K.COLLECTION,s(Y))J.apiVersion=""}let Q=P({...q.headers,...w});if(Q)J.headers=Q;return Object.keys(J).length>0?J:void 0}function r(q){let w=q.trim();if(!w||w.includes("{location}"))return;return w}function s(q){try{return new URL(q).pathname.split("/").some((J)=>/^v\d+(?:beta\d*)?$/.test(J))}catch{return/(?:^|\/)v\d+(?:beta\d*)?(?:\/|$)/.test(q)}}function i(q){let w=V("GOOGLE_APPLICATION_CREDENTIALS",q);return w?{keyFilename:w}:void 0}function n(q){let w=q?.apiKey?.trim();if(!w||w===u||e(w))return;return w}function e(q){return/^<[^>]+>$/.test(q)}function t(q){let w=q?.project||V("GOOGLE_CLOUD_PROJECT",q?.env)||V("GCLOUD_PROJECT",q?.env);if(!w)throw Error("Vertex AI requires a project ID. Set GOOGLE_CLOUD_PROJECT/GCLOUD_PROJECT or pass project in options.");return w}function o(q){let w=q?.location||V("GOOGLE_CLOUD_LOCATION",q?.env);if(!w)throw Error("Vertex AI requires a location. Set GOOGLE_CLOUD_LOCATION or pass location in options.");return w}function qq(q,w,J={}){let Y=x(q,w),Q={};if(J.temperature!==void 0)Q.temperature=J.temperature;if(J.maxTokens!==void 0)Q.maxOutputTokens=J.maxTokens;let $={...Object.keys(Q).length>0&&Q,...w.systemPrompt&&{systemInstruction:C(w.systemPrompt)},...w.tools&&w.tools.length>0&&{tools:b(w.tools)}};if(w.tools&&w.tools.length>0&&J.toolChoice)$.toolConfig={functionCallingConfig:{mode:f(J.toolChoice)}};else $.toolConfig=void 0;if(J.thinking?.enabled&&q.reasoning){let N={includeThoughts:!0};if(J.thinking.level!==void 0)N.thinkingLevel=a[J.thinking.level];else if(J.thinking.budgetTokens!==void 0)N.thinkingBudget=J.thinking.budgetTokens;$.thinkingConfig=N}else if(q.reasoning&&J.thinking&&!J.thinking.enabled)$.thinkingConfig=wq(q);if(J.signal){if(J.signal.aborted)throw Error("Request aborted");$.abortSignal=J.signal}return{model:q.id,contents:Y,config:$}}function G(q){return/gemini-3(?:\.\d+)?-pro/.test(q.id.toLowerCase())}function m(q){let w=q.id.toLowerCase();return/gemini-3(?:\.\d+)?-flash/.test(w)||w==="gemini-flash-latest"||w==="gemini-flash-lite-latest"}function wq(q){let w=q;if(G(w))return{thinkingLevel:F.LOW};if(m(w))return{thinkingLevel:F.MINIMAL};return{thinkingBudget:0}}function Jq(q,w){if(G(w))switch(q){case"minimal":case"low":return"LOW";case"medium":case"high":return"HIGH"}switch(q){case"minimal":return"MINIMAL";case"low":return"LOW";case"medium":return"MEDIUM";case"high":return"HIGH"}}function Qq(q,w,J){if(J?.[w]!==void 0)return J[w];if(q.id.includes("2.5-pro"))return{minimal:128,low:2048,medium:8192,high:32768}[w];if(q.id.includes("2.5-flash"))return{minimal:128,low:2048,medium:8192,high:24576}[w];return-1}export{Hq as streamSimple,R as stream};