@shumai-one/shumai 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/bin/{chunk-e7ndw3hg.js → chunk-0p333kh7.js} +3 -3
  2. package/bin/chunk-1wz0dge4.js +3 -0
  3. package/bin/{chunk-gtrc5ka2.js → chunk-1yqar2gz.js} +1 -1
  4. package/bin/{chunk-fz88kkk1.js → chunk-1zpw2mbj.js} +2 -2
  5. package/bin/{chunk-46ar48f9.js → chunk-28egv700.js} +1 -1
  6. package/bin/{chunk-0xbf8bcg.js → chunk-2m2saan7.js} +2 -2
  7. package/bin/chunk-2p0rg6xs.js +1 -0
  8. package/bin/{chunk-w88219ex.js → chunk-2xmsa8wv.js} +1 -1
  9. package/bin/{chunk-mzg1h07d.js → chunk-36wf2dq0.js} +1 -1
  10. package/bin/{chunk-ta7bfdrn.js → chunk-3g54qkv5.js} +1 -1
  11. package/bin/chunk-3ge0s4k2.js +1 -0
  12. package/bin/{chunk-hr97a5j5.js → chunk-449feg7g.js} +1 -1
  13. package/bin/{chunk-hkbybhww.js → chunk-48ebezek.js} +1 -1
  14. package/bin/{chunk-8qg47kj6.js → chunk-4gbs9swm.js} +1 -1
  15. package/bin/{chunk-thsbcbay.js → chunk-4tt3jvm1.js} +1 -1
  16. package/bin/{chunk-15sefy5t.js → chunk-5jhrqbk2.js} +2 -2
  17. package/bin/{chunk-wg98cacx.js → chunk-5x1ppya9.js} +2 -2
  18. package/bin/{chunk-nrwna4ha.js → chunk-652x28v2.js} +1 -1
  19. package/bin/{chunk-0qkj838r.js → chunk-6f1twjf6.js} +1 -1
  20. package/bin/chunk-6ks4277t.js +2 -0
  21. package/bin/{chunk-0rxhc7ka.js → chunk-6wa075zh.js} +2 -2
  22. package/bin/{chunk-qksb0v3c.js → chunk-736tcjve.js} +2 -2
  23. package/bin/chunk-80d6p55n.js +1 -0
  24. package/bin/{chunk-gswbc6y9.js → chunk-8a9k4qj6.js} +2 -2
  25. package/bin/chunk-8g1s0pq1.js +2 -0
  26. package/bin/chunk-8gkm2ysh.js +1 -0
  27. package/bin/chunk-8nvybmyv.js +2 -0
  28. package/bin/{chunk-srn8t0v7.js → chunk-8rkp0fc5.js} +1 -1
  29. package/bin/{chunk-1wm57c6y.js → chunk-8sr8ff6a.js} +3 -3
  30. package/bin/{chunk-2aamsc5v.js → chunk-93jcw0pn.js} +1 -1
  31. package/bin/{chunk-3rmc8nz6.js → chunk-9bvwwj5y.js} +1 -1
  32. package/bin/{chunk-925q4paa.js → chunk-9fefn2st.js} +1 -1
  33. package/bin/{chunk-262hkppb.js → chunk-9h3c60vw.js} +2 -2
  34. package/bin/{chunk-xyjw8w3r.js → chunk-9jd3d3f3.js} +1 -1
  35. package/bin/chunk-9nwjhams.js +1 -0
  36. package/bin/{chunk-7b17fb36.js → chunk-9q32g9jd.js} +1 -1
  37. package/bin/{chunk-0aj303as.js → chunk-9zy0a8kt.js} +2 -2
  38. package/bin/{chunk-w7dn1m95.js → chunk-a06432s3.js} +1 -1
  39. package/bin/{chunk-de99643r.js → chunk-a1mtpcrd.js} +2 -2
  40. package/bin/{chunk-4e3jbp84.js → chunk-a2njf6av.js} +1 -1
  41. package/bin/{chunk-5d2q46mx.js → chunk-a6dvjjce.js} +1 -1
  42. package/bin/{chunk-s46zwr4p.js → chunk-aa2tkqg0.js} +1 -1
  43. package/bin/{chunk-fbte2rmd.js → chunk-ab45988z.js} +1 -1
  44. package/bin/chunk-af3nys0r.js +1 -0
  45. package/bin/{chunk-29tx9qe2.js → chunk-agd2jevj.js} +1 -1
  46. package/bin/{chunk-9h027f50.js → chunk-bf5a4yc8.js} +1 -1
  47. package/bin/{chunk-ybhgmvxa.js → chunk-bjfwz2m7.js} +2 -2
  48. package/bin/{chunk-e52nga6c.js → chunk-bnpw72vt.js} +2 -2
  49. package/bin/{chunk-c45rh4hk.js → chunk-c003q4v6.js} +1 -1
  50. package/bin/{chunk-5m9be8an.js → chunk-cfamv4b2.js} +2 -2
  51. package/bin/{chunk-922nnh39.js → chunk-cm25nm9t.js} +1 -1
  52. package/bin/{chunk-9h3ds7rn.js → chunk-cmcsxkh1.js} +2 -2
  53. package/bin/{chunk-zemrvz79.js → chunk-cspp4n1d.js} +2 -2
  54. package/bin/{chunk-kfhtk3eh.js → chunk-cwebycwv.js} +1 -1
  55. package/bin/chunk-cx1ebj9k.js +1 -0
  56. package/bin/chunk-d1p9qz3y.js +7 -0
  57. package/bin/{chunk-q24epdh8.js → chunk-d3cqp0tb.js} +2 -2
  58. package/bin/{chunk-97jzve52.js → chunk-d5fapvnp.js} +2 -2
  59. package/bin/{chunk-e3s3rz2e.js → chunk-ddag2ezv.js} +2 -2
  60. package/bin/{chunk-7hsgmjpa.js → chunk-dk45f6mp.js} +2 -2
  61. package/bin/{chunk-9ab6k4rq.js → chunk-e0kw3bst.js} +1 -1
  62. package/bin/{chunk-bd71dp4j.js → chunk-e56nza63.js} +1 -1
  63. package/bin/{chunk-re0b7sj7.js → chunk-e66j69wz.js} +1 -1
  64. package/bin/{chunk-pq18zenh.js → chunk-ea0fh29m.js} +1 -1
  65. package/bin/{chunk-s1n39qte.js → chunk-en4m76fw.js} +1 -1
  66. package/bin/{chunk-f14sqw1d.js → chunk-epsctccj.js} +1 -1
  67. package/bin/{chunk-92xxys10.js → chunk-evzxjqr3.js} +2 -2
  68. package/bin/{chunk-ymeycphq.js → chunk-f4x2dxe5.js} +3 -3
  69. package/bin/{chunk-pxw97qbq.js → chunk-fr3dg9aj.js} +1 -1
  70. package/bin/{chunk-fcvtgx1y.js → chunk-fvf7j1qj.js} +1 -1
  71. package/bin/{chunk-bs0fjz3w.js → chunk-fwcm78s9.js} +2 -2
  72. package/bin/{chunk-xcwbg4w9.js → chunk-fytbcgak.js} +2 -2
  73. package/bin/{chunk-wc8sc9r9.js → chunk-gc7b9j22.js} +1 -1
  74. package/bin/{chunk-b8js74jk.js → chunk-h1hj60fr.js} +2 -2
  75. package/bin/{chunk-9avkn3x1.js → chunk-h3y7szbm.js} +2 -2
  76. package/bin/{chunk-j8qtab70.js → chunk-hdqvbds8.js} +1 -1
  77. package/bin/{chunk-q09dfja5.js → chunk-he4h8e9e.js} +2 -2
  78. package/bin/{chunk-d2vxmn9v.js → chunk-hktggc90.js} +1 -1
  79. package/bin/{chunk-fepymbka.js → chunk-jh6pw37a.js} +1 -1
  80. package/bin/{chunk-ygz6pawn.js → chunk-jjgwrvdb.js} +1 -1
  81. package/bin/{chunk-2dsmsa6a.js → chunk-jmh934ca.js} +1 -1
  82. package/bin/{chunk-dghtwyq1.js → chunk-jtwvd0te.js} +2 -2
  83. package/bin/{chunk-4qpa7b5t.js → chunk-jxxq76at.js} +1 -1
  84. package/bin/chunk-jyr3g5m4.js +1 -0
  85. package/bin/{chunk-zzx99j8t.js → chunk-k0s6gfg6.js} +1 -1
  86. package/bin/chunk-ky3dx324.js +2 -0
  87. package/bin/{chunk-h0ytx8zc.js → chunk-mw0rc5m7.js} +1 -1
  88. package/bin/chunk-mzre12bp.js +1 -0
  89. package/bin/{chunk-s8t74q9m.js → chunk-n0cn0xfg.js} +1 -1
  90. package/bin/{chunk-88fg1sw7.js → chunk-nd6psyzq.js} +2 -2
  91. package/bin/{chunk-m4zpf9gg.js → chunk-nmzvxgd6.js} +2 -2
  92. package/bin/{chunk-891h8br6.js → chunk-nxhzchen.js} +1 -1
  93. package/bin/{chunk-8mkfgcvb.js → chunk-phc9efjf.js} +2 -2
  94. package/bin/{chunk-n4meg9wb.js → chunk-pna93n17.js} +1 -1
  95. package/bin/{chunk-d3wmdjze.js → chunk-pvx55h1v.js} +1 -1
  96. package/bin/{chunk-g8th86na.js → chunk-pzehf31g.js} +1 -1
  97. package/bin/{chunk-nyhqy6q2.js → chunk-q0dhm16d.js} +5 -5
  98. package/bin/chunk-q11m2cp3.js +2 -0
  99. package/bin/{chunk-31baz5n0.js → chunk-qjf561n2.js} +1 -1
  100. package/bin/chunk-qs5k9j8s.js +1 -0
  101. package/bin/{chunk-ztmj61z9.js → chunk-qt9efp9y.js} +1 -1
  102. package/bin/{chunk-1xpec5r8.js → chunk-qwxt1cha.js} +2 -2
  103. package/bin/{chunk-5t6c3038.js → chunk-r8vrfefa.js} +1 -1
  104. package/bin/{chunk-cxhmr356.js → chunk-rybbss5f.js} +1 -1
  105. package/bin/{chunk-t3t6021k.js → chunk-sa4gc1f5.js} +2 -2
  106. package/bin/{chunk-jf3vn5c3.js → chunk-sprpjp4t.js} +2 -2
  107. package/bin/chunk-swa43tzr.js +3 -0
  108. package/bin/{chunk-14fh4s1a.js → chunk-szs8dy1s.js} +2 -2
  109. package/bin/{chunk-ry33f2qk.js → chunk-t0detvbj.js} +2 -2
  110. package/bin/chunk-t0fq8b99.js +2 -0
  111. package/bin/{chunk-pmswtfe3.css → chunk-tm6z4hkd.css} +1 -1
  112. package/bin/{chunk-wsyg4rwg.js → chunk-vdn3jymh.js} +1 -1
  113. package/bin/{chunk-8wqfkm4c.js → chunk-vjxgv3r6.js} +1 -1
  114. package/bin/{chunk-dqgv5yy1.js → chunk-w3m9g3e9.js} +1 -1
  115. package/bin/{chunk-5r8858hx.js → chunk-wcfpdfgy.js} +2 -2
  116. package/bin/{chunk-rtngbgpk.js → chunk-wv8xk7n7.js} +1 -1
  117. package/bin/{chunk-7e06b2zb.js → chunk-wwsvnz4v.js} +1 -1
  118. package/bin/{chunk-qqk51620.js → chunk-y132jbf0.js} +1 -1
  119. package/bin/{chunk-2aascrtb.js → chunk-yaydmgcg.js} +1 -1
  120. package/bin/{chunk-7we7ex0m.js → chunk-yvgs4kmv.js} +1 -1
  121. package/bin/{chunk-fa2g2wge.js → chunk-z5p39kpk.js} +2 -2
  122. package/bin/{chunk-77r8w95d.js → chunk-zct68gc7.js} +2 -2
  123. package/bin/{chunk-mqjzmn0e.js → chunk-zy2sqtt9.js} +1 -1
  124. package/bin/shumai-app.html +1 -1
  125. package/bin/shumai-app.js +260 -208
  126. package/package.json +7 -7
  127. package/prisma/migrations/20260728024147_add_agent_session_entry_columns/migration.sql +14 -0
  128. package/prisma/migrations/20260728024205_migrate_agent_session_entry_data/migration.sql +12 -0
  129. package/prisma/migrations/20260728031230_remove_agent_session_entry_legacy_entry_column/migration.sql +8 -0
  130. package/prisma/schema.prisma +12 -6
  131. package/bin/chunk-23d3968z.js +0 -2
  132. package/bin/chunk-2g12s6mc.js +0 -2
  133. package/bin/chunk-4jk0y1w1.js +0 -1
  134. package/bin/chunk-54tr7y2x.js +0 -3
  135. package/bin/chunk-6z65xd0w.js +0 -3
  136. package/bin/chunk-8tf6kgdj.js +0 -2
  137. package/bin/chunk-av71yjaa.js +0 -1
  138. package/bin/chunk-byqc8tzq.js +0 -1
  139. package/bin/chunk-ccw7mjgq.js +0 -5
  140. package/bin/chunk-f7sbkfmk.js +0 -2
  141. package/bin/chunk-fd5a3pdd.js +0 -1
  142. package/bin/chunk-g6zzg6v2.js +0 -1
  143. package/bin/chunk-kr06nrbx.js +0 -2
  144. package/bin/chunk-r0w920zb.js +0 -1
  145. package/bin/chunk-sd86v1e6.js +0 -1
  146. package/bin/chunk-szzff7gd.js +0 -1
  147. package/bin/chunk-tspps87j.js +0 -1
  148. package/bin/chunk-y2qp11v9.js +0 -1
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  function B(q){return q==="cloudflare-workers-ai"||q==="cloudflare-ai-gateway"}function D(q){let k=q.baseUrl;if(!k.includes("{"))return k;return k.replace(/\{([A-Z_][A-Z0-9_]*)\}/g,(A,x)=>{let y=process.env[x];if(!y)throw Error(`${x} is required for provider ${q.provider} but is not set.`);return y})}function z(q){let k=q[q.length-1];return k&&k.role!=="user"?"agent":"user"}function F(q){return q.some((k)=>{if(k.role==="user"&&Array.isArray(k.content))return k.content.some((w)=>w.type==="image");if(k.role==="toolResult"&&Array.isArray(k.content))return k.content.some((w)=>w.type==="image");return!1})}function G(q){let k={"X-Initiator":z(q.messages),"Openai-Intent":"conversation-edits"};if(q.hasImages)k["Copilot-Vision-Request"]="true";return k}
3
- export{B as nk,D as ok,F as pk,G as qk};
3
+ export{B as ok,D as pk,F as qk,G as rk};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  var f=new Set;function h(b){return f.add(b),()=>{f.delete(b)}}
3
- export{h as ke};
3
+ export{h as le};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Rb as $Q}from"./chunk-891h8br6.js";import{Ub as c,Vb as XQ,Wb as l}from"./chunk-e3s3rz2e.js";import"./chunk-3rmc8nz6.js";import{Yb as VQ}from"./chunk-s1n39qte.js";import{Zb as g}from"./chunk-9avkn3x1.js";import{ec as GQ,fc as FQ}from"./chunk-w88219ex.js";import{hc as YQ}from"./chunk-2dsmsa6a.js";import"./chunk-ta7bfdrn.js";import{lc as u}from"./chunk-pxw97qbq.js";import{ke as NQ}from"./chunk-8qg47kj6.js";import{le as x,me as JQ,ne as zQ}from"./chunk-c45rh4hk.js";import"./chunk-ybhgmvxa.js";import{af as ZQ}from"./chunk-q09dfja5.js";import{bf as QQ}from"./chunk-d2vxmn9v.js";import"./chunk-bs0fjz3w.js";import"./chunk-0qkj838r.js";function i(Q){let $=Q.filter((G)=>G!==void 0);if($.length===0)return{cleanup:()=>{}};if($.length===1)return{signal:$[0],cleanup:()=>{}};let Z=new AbortController,Y=[],F=(G)=>{if(!Z.signal.aborted)Z.abort(G.reason)};for(let G of $){if(G.aborted){F(G);break}let V=()=>F(G);G.addEventListener("abort",V,{once:!0}),Y.push({signal:G,listener:V})}return{signal:Z.signal,cleanup:()=>{for(let{signal:G,listener:V}of Y)G.removeEventListener("abort",V)}}}var PQ={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};function v(Q,$){let Z=Q.toLowerCase(),Y=Q.toUpperCase();return $?.[Z]||$?.[Y]||g(Z)||g(Y)||""}function AQ(Q){if(Q instanceof URL)return Q;try{return new URL(Q)}catch{return}}function UQ(Q,$,Z){let Y=v("no_proxy",Z).toLowerCase();if(!Y)return!0;if(Y==="*")return!1;return Y.split(/[,\s]/).every((F)=>{if(!F)return!0;let G=F.match(/^(.+):(\d+)$/),V=G?G[1]:F,j=G?Number.parseInt(G[2],10):0;if(j&&j!==$)return!0;if(!/^[.*]/.test(V))return Q!==V;if(V.startsWith("*"))V=V.slice(1);return!Q.endsWith(V)})}function wQ(Q,$){let Z=AQ(Q);if(!Z?.protocol||!Z.host)return"";let Y=Z.protocol.split(":",1)[0],F=Z.host.replace(/:\d*$/,""),G=Number.parseInt(Z.port,10)||PQ[Y]||0;if(!UQ(F,G,$))return"";let V=v(`${Y}_proxy`,$)||v("all_proxy",$);if(V&&!V.includes("://"))V=`${Y}://${V}`;return V}var CQ="Unsupported proxy protocol. SOCKS and PAC proxy URLs are not supported; use an HTTP or HTTPS proxy URL.";function a(Q,$){let Z=wQ(Q,$);if(!Z)return;let Y;try{Y=new URL(Z)}catch(F){throw Error(`Invalid proxy URL ${JSON.stringify(Z)}: ${F instanceof Error?F.message:String(F)}`)}if(Y.protocol!=="http:"&&Y.protocol!=="https:")throw Error(`${CQ} Got ${Y.protocol}`);return Y}function EQ(){if(typeof process>"u"||!(process.versions?.node||process.versions?.bun))return null;return process.getBuiltinModule?.("node:os")??null}var T=EQ(),fQ="https://chatgpt.com/backend-api",MQ="https://api.openai.com/auth",SQ=0,n=1000,TQ=60000,hQ=15000,IQ=3,jQ=new Set(["openai","openai-codex","opencode"]),xQ=1009,kQ="websocket_connection_limit_reached",bQ=new Set(["completed","incomplete","failed","cancelled","queued","in_progress"]);function gQ(Q){return/GoUsageLimitError|FreeUsageLimitError|Monthly usage limit reached|available balance|insufficient_quota|out of budget|quota exceeded|billing/i.test(Q)}function vQ(Q,$){if(Q===429&&gQ($))return!1;if(Q===429||Q===500||Q===502||Q===503||Q===504)return!0;return/rate.?limit|overloaded|service.?unavailable|upstream.?connect|connection.?refused/i.test($)}function yQ(Q){let $=Q.get("retry-after-ms");if($!==null){let G=Number($);if(Number.isFinite(G))return Math.max(0,G)}let Z=Q.get("retry-after");if(!Z)return;let Y=Number(Z);if(Number.isFinite(Y))return Math.max(0,Y*1000);let F=Date.parse(Z);if(!Number.isNaN(F))return Math.max(0,F-Date.now());return}function mQ(Q,$){let Z=$?.maxRetryDelayMs??TQ;return Z>0?Math.min(Q,Z):Q}function r(Q,$){return new Promise((Z,Y)=>{if($?.aborted){Y(Error("Request was aborted"));return}let F=setTimeout(Z,Q);$?.addEventListener("abort",()=>{clearTimeout(F),Y(Error("Request was aborted"))})})}function t(Q){if(Q===void 0)return;if(!Number.isFinite(Q)||Q<0)throw Error(`Invalid timeoutMs: ${String(Q)}`);return Math.floor(Q)}function uQ(){if(typeof process>"u"||!(process.versions?.node||process.versions?.bun))return null;return process.getBuiltinModule?.("node:zlib")??null}function cQ(Q){let $=uQ();if(!$||typeof $.zstdCompressSync!=="function")return null;try{let Z=$.zstdCompressSync(Q,{params:{[$.constants.ZSTD_c_compressionLevel]:IQ}});return new Uint8Array(Z.buffer,Z.byteOffset,Z.byteLength)}catch{return null}}var lQ=(Q,$,Z)=>{let Y=new QQ;return(async()=>{let F={role:"assistant",content:[],api:"openai-codex-responses",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 G=Z?.apiKey;if(!G)throw Error(`No API key for provider: ${Q.provider}`);let V=qZ(G),j=pQ(Q,$,Z),N=await Z?.onPayload?.(j,Q);if(N!==void 0)j=N;let X=Z?.sessionId||_Z(),W=OZ(Q.headers,Z?.headers,V,G,Z?.sessionId),J=RZ(Q.headers,Z?.headers,V,G,X),_=JSON.stringify(j),z=t(Z?.timeoutMs),q=t(Z?.websocketConnectTimeoutMs),D=Z?.transport||"auto",B=D!=="sse"&&BQ(Z?.sessionId);if(B)s(Z?.sessionId);if(D!=="sse"&&!B){let O=!1,H=!1;while(!0){O=!1;try{if(await WZ(iQ(Q.baseUrl),j,J,F,Y,Q,()=>{O=!0},z,q,Z),Z?.signal?.aborted)throw Error("Request was aborted");Y.push({type:"done",reason:F.stopReason,message:F}),Y.end();return}catch(A){let C=Z?.signal?.aborted,S=!O&&rQ(A);if(!C&&S&&!H){H=!0;continue}if(C||nQ(A)&&!S)throw A;if(zQ(F,JQ("provider_transport_failure",A,{configuredTransport:D,fallbackTransport:O?void 0:"sse",eventsEmitted:O,phase:O?"after_message_stream_start":"before_message_stream_start",requestBytes:new TextEncoder().encode(_).byteLength})),YZ(Z?.sessionId,A),O)throw A;s(Z?.sessionId);break}}}let R=cQ(_);if(R)W.set("content-encoding","zstd");let K=R??_,L,w,b=Z?.maxRetries??SQ;for(let O=0;O<=b;O++){if(Z?.signal?.aborted)throw Error("Request was aborted");try{let H=z!==void 0&&z>0?AbortSignal.timeout(z):void 0,A=i([Z?.signal,H]);try{L=await fetch(DQ(Q.baseUrl),{method:"POST",headers:W,body:K,signal:A.signal})}catch(E){if(H?.aborted&&!Z?.signal?.aborted)throw Error(`Codex SSE response headers timed out after ${z}ms`);throw E}finally{A.cleanup()}if(await Z?.onResponse?.({status:L.status,headers:u(L.headers)},Q),L.ok)break;let C=await L.text();if(O<b&&vQ(L.status,C)){let E=yQ(L.headers),HQ=E===void 0?n*2**O:L.status===429?mQ(E,Z):E;await r(HQ,Z?.signal);continue}let S=new Response(C,{status:L.status,statusText:L.statusText}),d=await BZ(S);throw Error(d.friendlyMessage||d.message)}catch(H){if(H instanceof Error){if(H.name==="AbortError"||H.message==="Request was aborted")throw Error("Request was aborted")}if(w=H instanceof Error?H:Error(String(H)),O<b&&!w.message.includes("usage limit")){let A=n*2**O;await r(A,Z?.signal);continue}throw w}}if(!L?.ok)throw w??Error("Failed after retries");if(!L.body)throw Error("No response body");if(Y.push({type:"start",partial:F}),await aQ(L,F,Y,Q,Z),Z?.signal?.aborted)throw Error("Request was aborted");Y.push({type:"done",reason:F.stopReason,message:F}),Y.end()}catch(G){for(let V of F.content)delete V.partialJson;F.stopReason=Z?.signal?.aborted?"aborted":"error",F.errorMessage=FQ(GQ(G)),Y.push({type:"error",reason:F.stopReason,error:F}),Y.end()}})(),Y},bZ=(Q,$,Z)=>{let Y=Z?.apiKey;if(!Y)throw Error(`No API key for provider: ${Q.provider}`);let F=YQ(Q,$,Z,Y),G=Z?.reasoning?ZQ(Q,Z.reasoning):void 0;return lQ(Q,$,{...F,reasoningEffort:G==="off"?void 0:G})};function pQ(Q,$,Z){let Y=$Q($,Q.compat?.supportsToolSearch??!1),F=c(Q,$,jQ,{includeSystemPrompt:!1,deferredTools:Y.deferred}),G={model:Q.id,store:!1,stream:!0,instructions:$.systemPrompt||"You are a helpful assistant.",input:F,text:{verbosity:Z?.textVerbosity||"low"},include:["reasoning.encrypted_content"],prompt_cache_key:VQ(Z?.sessionId),tool_choice:Z?.toolChoice??"auto",parallel_tool_calls:!0};if(Z?.temperature!==void 0)G.temperature=Z.temperature;if(Z?.serviceTier!==void 0)G.service_tier=Z.serviceTier;if(Y.immediate.length>0)G.tools=XQ(Y.immediate,{strict:null});if(Z?.reasoningEffort!==void 0){let V=Z.reasoningEffort==="none"?Q.thinkingLevelMap?.off??"none":Q.thinkingLevelMap?.[Z.reasoningEffort]??Z.reasoningEffort;if(V!==null)G.reasoning={effort:V,summary:Z.reasoningSummary??"auto"}}return G}function dQ(Q,$){switch($){case"flex":return 0.5;case"priority":return Q.id==="gpt-5.5"?2.5:2;default:return 1}}function KQ(Q,$,Z){let Y=dQ(Z,$);if(Y===1)return;Q.cost.input*=Y,Q.cost.output*=Y,Q.cost.cacheRead*=Y,Q.cost.cacheWrite*=Y,Q.cost.total=Q.cost.input+Q.cost.output+Q.cost.cacheRead+Q.cost.cacheWrite}function LQ(Q,$){if(Q==="default"&&($==="flex"||$==="priority"))return $;return Q??$}function DQ(Q){let Z=(Q&&Q.trim().length>0?Q:fQ).replace(/\/+$/,"");if(Z.endsWith("/codex/responses"))return Z;if(Z.endsWith("/codex"))return`${Z}/responses`;return`${Z}/codex/responses`}function iQ(Q){let $=new URL(DQ(Q));if($.protocol==="https:")$.protocol="wss:";if($.protocol==="http:")$.protocol="ws:";return $.toString()}async function aQ(Q,$,Z,Y,F){await l(WQ(oQ(Q,F?.signal)),$,Z,Y,{serviceTier:F?.serviceTier,resolveServiceTier:LQ,applyServiceTierPricing:(G,V)=>KQ(G,V,Y)})}class f extends Error{code;payload;constructor(Q,$){super(Q);this.name="CodexApiError",this.code=$?.code,this.payload=$?.payload,this.cause=$?.cause}}class k extends Error{payload;constructor(Q,$){super(Q);this.name="CodexProtocolError",this.payload=$?.payload,this.cause=$?.cause}}function nQ(Q){return Q instanceof f||Q instanceof k}function rQ(Q){return Q instanceof f&&Q.code===kQ}function tQ(Q){let $=Q.error&&typeof Q.error==="object"?Q.error:void 0;return{code:typeof Q.code==="string"?Q.code:typeof $?.code==="string"?$.code:void 0,message:typeof Q.message==="string"?Q.message:typeof $?.message==="string"?$.message:void 0}}async function*WQ(Q){for await(let $ of Q){let Z=typeof $.type==="string"?$.type:void 0;if(!Z)continue;if(Z==="error"){let{code:Y,message:F}=tQ($);throw new f(`Codex error: ${F||Y||JSON.stringify($)}`,{code:Y,payload:$})}if(Z==="response.failed"){let Y=$.response,F=Y?.error?.code,G=Y?.error?.message;throw new f(G||"Codex response failed",{code:F,payload:$})}if(Z==="response.done"||Z==="response.completed"||Z==="response.incomplete"){let Y=$.response,F=Y?{...Y,status:sQ(Y.status)}:Y;yield{...$,type:"response.completed",response:F};return}yield $}}function sQ(Q){if(typeof Q!=="string")return;return bQ.has(Q)?Q:void 0}async function*oQ(Q,$){if(!Q.body)return;let Z=Q.body.getReader(),Y=new TextDecoder,F="",G=()=>{Z.cancel().catch(()=>{})};$?.addEventListener("abort",G,{once:!0});try{while(!0){if($?.aborted)throw Error("Request was aborted");let{done:V,value:j}=await Z.read();if($?.aborted)throw Error("Request was aborted");if(V)break;F+=Y.decode(j,{stream:!0});let N=F.indexOf(`
2
+ import{Sb as $Q}from"./chunk-nxhzchen.js";import{Vb as c,Wb as XQ,Xb as l}from"./chunk-ddag2ezv.js";import"./chunk-hdqvbds8.js";import{Zb as VQ}from"./chunk-en4m76fw.js";import{_b as g}from"./chunk-h3y7szbm.js";import{fc as GQ,gc as FQ}from"./chunk-2xmsa8wv.js";import{ic as YQ}from"./chunk-jmh934ca.js";import"./chunk-bf5a4yc8.js";import{mc as u}from"./chunk-fr3dg9aj.js";import{le as NQ}from"./chunk-4gbs9swm.js";import{me as x,ne as JQ,oe as zQ}from"./chunk-c003q4v6.js";import"./chunk-cspp4n1d.js";import{bf as ZQ}from"./chunk-he4h8e9e.js";import{cf as QQ}from"./chunk-hktggc90.js";import"./chunk-fwcm78s9.js";import"./chunk-6f1twjf6.js";function i(Q){let $=Q.filter((G)=>G!==void 0);if($.length===0)return{cleanup:()=>{}};if($.length===1)return{signal:$[0],cleanup:()=>{}};let Z=new AbortController,Y=[],F=(G)=>{if(!Z.signal.aborted)Z.abort(G.reason)};for(let G of $){if(G.aborted){F(G);break}let V=()=>F(G);G.addEventListener("abort",V,{once:!0}),Y.push({signal:G,listener:V})}return{signal:Z.signal,cleanup:()=>{for(let{signal:G,listener:V}of Y)G.removeEventListener("abort",V)}}}var PQ={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};function v(Q,$){let Z=Q.toLowerCase(),Y=Q.toUpperCase();return $?.[Z]||$?.[Y]||g(Z)||g(Y)||""}function AQ(Q){if(Q instanceof URL)return Q;try{return new URL(Q)}catch{return}}function UQ(Q,$,Z){let Y=v("no_proxy",Z).toLowerCase();if(!Y)return!0;if(Y==="*")return!1;return Y.split(/[,\s]/).every((F)=>{if(!F)return!0;let G=F.match(/^(.+):(\d+)$/),V=G?G[1]:F,j=G?Number.parseInt(G[2],10):0;if(j&&j!==$)return!0;if(!/^[.*]/.test(V))return Q!==V;if(V.startsWith("*"))V=V.slice(1);return!Q.endsWith(V)})}function wQ(Q,$){let Z=AQ(Q);if(!Z?.protocol||!Z.host)return"";let Y=Z.protocol.split(":",1)[0],F=Z.host.replace(/:\d*$/,""),G=Number.parseInt(Z.port,10)||PQ[Y]||0;if(!UQ(F,G,$))return"";let V=v(`${Y}_proxy`,$)||v("all_proxy",$);if(V&&!V.includes("://"))V=`${Y}://${V}`;return V}var CQ="Unsupported proxy protocol. SOCKS and PAC proxy URLs are not supported; use an HTTP or HTTPS proxy URL.";function a(Q,$){let Z=wQ(Q,$);if(!Z)return;let Y;try{Y=new URL(Z)}catch(F){throw Error(`Invalid proxy URL ${JSON.stringify(Z)}: ${F instanceof Error?F.message:String(F)}`)}if(Y.protocol!=="http:"&&Y.protocol!=="https:")throw Error(`${CQ} Got ${Y.protocol}`);return Y}function EQ(){if(typeof process>"u"||!(process.versions?.node||process.versions?.bun))return null;return process.getBuiltinModule?.("node:os")??null}var T=EQ(),fQ="https://chatgpt.com/backend-api",MQ="https://api.openai.com/auth",SQ=0,n=1000,TQ=60000,hQ=15000,IQ=3,jQ=new Set(["openai","openai-codex","opencode"]),xQ=1009,kQ="websocket_connection_limit_reached",bQ=new Set(["completed","incomplete","failed","cancelled","queued","in_progress"]);function gQ(Q){return/GoUsageLimitError|FreeUsageLimitError|Monthly usage limit reached|available balance|insufficient_quota|out of budget|quota exceeded|billing/i.test(Q)}function vQ(Q,$){if(Q===429&&gQ($))return!1;if(Q===429||Q===500||Q===502||Q===503||Q===504)return!0;return/rate.?limit|overloaded|service.?unavailable|upstream.?connect|connection.?refused/i.test($)}function yQ(Q){let $=Q.get("retry-after-ms");if($!==null){let G=Number($);if(Number.isFinite(G))return Math.max(0,G)}let Z=Q.get("retry-after");if(!Z)return;let Y=Number(Z);if(Number.isFinite(Y))return Math.max(0,Y*1000);let F=Date.parse(Z);if(!Number.isNaN(F))return Math.max(0,F-Date.now());return}function mQ(Q,$){let Z=$?.maxRetryDelayMs??TQ;return Z>0?Math.min(Q,Z):Q}function r(Q,$){return new Promise((Z,Y)=>{if($?.aborted){Y(Error("Request was aborted"));return}let F=setTimeout(Z,Q);$?.addEventListener("abort",()=>{clearTimeout(F),Y(Error("Request was aborted"))})})}function t(Q){if(Q===void 0)return;if(!Number.isFinite(Q)||Q<0)throw Error(`Invalid timeoutMs: ${String(Q)}`);return Math.floor(Q)}function uQ(){if(typeof process>"u"||!(process.versions?.node||process.versions?.bun))return null;return process.getBuiltinModule?.("node:zlib")??null}function cQ(Q){let $=uQ();if(!$||typeof $.zstdCompressSync!=="function")return null;try{let Z=$.zstdCompressSync(Q,{params:{[$.constants.ZSTD_c_compressionLevel]:IQ}});return new Uint8Array(Z.buffer,Z.byteOffset,Z.byteLength)}catch{return null}}var lQ=(Q,$,Z)=>{let Y=new QQ;return(async()=>{let F={role:"assistant",content:[],api:"openai-codex-responses",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 G=Z?.apiKey;if(!G)throw Error(`No API key for provider: ${Q.provider}`);let V=qZ(G),j=pQ(Q,$,Z),N=await Z?.onPayload?.(j,Q);if(N!==void 0)j=N;let X=Z?.sessionId||_Z(),W=OZ(Q.headers,Z?.headers,V,G,Z?.sessionId),J=RZ(Q.headers,Z?.headers,V,G,X),_=JSON.stringify(j),z=t(Z?.timeoutMs),q=t(Z?.websocketConnectTimeoutMs),D=Z?.transport||"auto",B=D!=="sse"&&BQ(Z?.sessionId);if(B)s(Z?.sessionId);if(D!=="sse"&&!B){let O=!1,H=!1;while(!0){O=!1;try{if(await WZ(iQ(Q.baseUrl),j,J,F,Y,Q,()=>{O=!0},z,q,Z),Z?.signal?.aborted)throw Error("Request was aborted");Y.push({type:"done",reason:F.stopReason,message:F}),Y.end();return}catch(A){let C=Z?.signal?.aborted,S=!O&&rQ(A);if(!C&&S&&!H){H=!0;continue}if(C||nQ(A)&&!S)throw A;if(zQ(F,JQ("provider_transport_failure",A,{configuredTransport:D,fallbackTransport:O?void 0:"sse",eventsEmitted:O,phase:O?"after_message_stream_start":"before_message_stream_start",requestBytes:new TextEncoder().encode(_).byteLength})),YZ(Z?.sessionId,A),O)throw A;s(Z?.sessionId);break}}}let R=cQ(_);if(R)W.set("content-encoding","zstd");let K=R??_,L,w,b=Z?.maxRetries??SQ;for(let O=0;O<=b;O++){if(Z?.signal?.aborted)throw Error("Request was aborted");try{let H=z!==void 0&&z>0?AbortSignal.timeout(z):void 0,A=i([Z?.signal,H]);try{L=await fetch(DQ(Q.baseUrl),{method:"POST",headers:W,body:K,signal:A.signal})}catch(E){if(H?.aborted&&!Z?.signal?.aborted)throw Error(`Codex SSE response headers timed out after ${z}ms`);throw E}finally{A.cleanup()}if(await Z?.onResponse?.({status:L.status,headers:u(L.headers)},Q),L.ok)break;let C=await L.text();if(O<b&&vQ(L.status,C)){let E=yQ(L.headers),HQ=E===void 0?n*2**O:L.status===429?mQ(E,Z):E;await r(HQ,Z?.signal);continue}let S=new Response(C,{status:L.status,statusText:L.statusText}),d=await BZ(S);throw Error(d.friendlyMessage||d.message)}catch(H){if(H instanceof Error){if(H.name==="AbortError"||H.message==="Request was aborted")throw Error("Request was aborted")}if(w=H instanceof Error?H:Error(String(H)),O<b&&!w.message.includes("usage limit")){let A=n*2**O;await r(A,Z?.signal);continue}throw w}}if(!L?.ok)throw w??Error("Failed after retries");if(!L.body)throw Error("No response body");if(Y.push({type:"start",partial:F}),await aQ(L,F,Y,Q,Z),Z?.signal?.aborted)throw Error("Request was aborted");Y.push({type:"done",reason:F.stopReason,message:F}),Y.end()}catch(G){for(let V of F.content)delete V.partialJson;F.stopReason=Z?.signal?.aborted?"aborted":"error",F.errorMessage=FQ(GQ(G)),Y.push({type:"error",reason:F.stopReason,error:F}),Y.end()}})(),Y},bZ=(Q,$,Z)=>{let Y=Z?.apiKey;if(!Y)throw Error(`No API key for provider: ${Q.provider}`);let F=YQ(Q,$,Z,Y),G=Z?.reasoning?ZQ(Q,Z.reasoning):void 0;return lQ(Q,$,{...F,reasoningEffort:G==="off"?void 0:G})};function pQ(Q,$,Z){let Y=$Q($,Q.compat?.supportsToolSearch??!1),F=c(Q,$,jQ,{includeSystemPrompt:!1,deferredTools:Y.deferred}),G={model:Q.id,store:!1,stream:!0,instructions:$.systemPrompt||"You are a helpful assistant.",input:F,text:{verbosity:Z?.textVerbosity||"low"},include:["reasoning.encrypted_content"],prompt_cache_key:VQ(Z?.sessionId),tool_choice:Z?.toolChoice??"auto",parallel_tool_calls:!0};if(Z?.temperature!==void 0)G.temperature=Z.temperature;if(Z?.serviceTier!==void 0)G.service_tier=Z.serviceTier;if(Y.immediate.length>0)G.tools=XQ(Y.immediate,{strict:null});if(Z?.reasoningEffort!==void 0){let V=Z.reasoningEffort==="none"?Q.thinkingLevelMap?.off??"none":Q.thinkingLevelMap?.[Z.reasoningEffort]??Z.reasoningEffort;if(V!==null)G.reasoning={effort:V,summary:Z.reasoningSummary??"auto"}}return G}function dQ(Q,$){switch($){case"flex":return 0.5;case"priority":return Q.id==="gpt-5.5"?2.5:2;default:return 1}}function KQ(Q,$,Z){let Y=dQ(Z,$);if(Y===1)return;Q.cost.input*=Y,Q.cost.output*=Y,Q.cost.cacheRead*=Y,Q.cost.cacheWrite*=Y,Q.cost.total=Q.cost.input+Q.cost.output+Q.cost.cacheRead+Q.cost.cacheWrite}function LQ(Q,$){if(Q==="default"&&($==="flex"||$==="priority"))return $;return Q??$}function DQ(Q){let Z=(Q&&Q.trim().length>0?Q:fQ).replace(/\/+$/,"");if(Z.endsWith("/codex/responses"))return Z;if(Z.endsWith("/codex"))return`${Z}/responses`;return`${Z}/codex/responses`}function iQ(Q){let $=new URL(DQ(Q));if($.protocol==="https:")$.protocol="wss:";if($.protocol==="http:")$.protocol="ws:";return $.toString()}async function aQ(Q,$,Z,Y,F){await l(WQ(oQ(Q,F?.signal)),$,Z,Y,{serviceTier:F?.serviceTier,resolveServiceTier:LQ,applyServiceTierPricing:(G,V)=>KQ(G,V,Y)})}class f extends Error{code;payload;constructor(Q,$){super(Q);this.name="CodexApiError",this.code=$?.code,this.payload=$?.payload,this.cause=$?.cause}}class k extends Error{payload;constructor(Q,$){super(Q);this.name="CodexProtocolError",this.payload=$?.payload,this.cause=$?.cause}}function nQ(Q){return Q instanceof f||Q instanceof k}function rQ(Q){return Q instanceof f&&Q.code===kQ}function tQ(Q){let $=Q.error&&typeof Q.error==="object"?Q.error:void 0;return{code:typeof Q.code==="string"?Q.code:typeof $?.code==="string"?$.code:void 0,message:typeof Q.message==="string"?Q.message:typeof $?.message==="string"?$.message:void 0}}async function*WQ(Q){for await(let $ of Q){let Z=typeof $.type==="string"?$.type:void 0;if(!Z)continue;if(Z==="error"){let{code:Y,message:F}=tQ($);throw new f(`Codex error: ${F||Y||JSON.stringify($)}`,{code:Y,payload:$})}if(Z==="response.failed"){let Y=$.response,F=Y?.error?.code,G=Y?.error?.message;throw new f(G||"Codex response failed",{code:F,payload:$})}if(Z==="response.done"||Z==="response.completed"||Z==="response.incomplete"){let Y=$.response,F=Y?{...Y,status:sQ(Y.status)}:Y;yield{...$,type:"response.completed",response:F};return}yield $}}function sQ(Q){if(typeof Q!=="string")return;return bQ.has(Q)?Q:void 0}async function*oQ(Q,$){if(!Q.body)return;let Z=Q.body.getReader(),Y=new TextDecoder,F="",G=()=>{Z.cancel().catch(()=>{})};$?.addEventListener("abort",G,{once:!0});try{while(!0){if($?.aborted)throw Error("Request was aborted");let{done:V,value:j}=await Z.read();if($?.aborted)throw Error("Request was aborted");if(V)break;F+=Y.decode(j,{stream:!0});let N=F.indexOf(`
3
3
 
4
4
  `);while(N!==-1){let X=F.slice(0,N);F=F.slice(N+2);let W=X.split(`
5
5
  `).filter((J)=>J.startsWith("data:")).map((J)=>J.slice(5).trim());if(W.length>0){let J=W.join(`
@@ -1,2 +1,2 @@
1
- import{gk as r,oh as o}from"./chunk-nyhqy6q2.js";function d({className:t,...a}){return o("div",{"data-slot":"card",className:r("flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm",t),...a})}function n({className:t,...a}){return o("div",{"data-slot":"card-header",className:r("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...a})}function c({className:t,...a}){return o("div",{"data-slot":"card-title",className:r("leading-none font-semibold",t),...a})}function s({className:t,...a}){return o("div",{"data-slot":"card-description",className:r("text-sm text-muted-foreground",t),...a})}function i({className:t,...a}){return o("div",{"data-slot":"card-content",className:r("px-6",t),...a})}function l({className:t,...a}){return o("div",{"data-slot":"card-footer",className:r("flex items-center px-6 [.border-t]:pt-6",t),...a})}
2
- export{d as qf,n as rf,c as sf,s as tf,i as uf,l as vf};
1
+ import{hk as r,ph as o}from"./chunk-q0dhm16d.js";function d({className:t,...a}){return o("div",{"data-slot":"card",className:r("flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm",t),...a})}function n({className:t,...a}){return o("div",{"data-slot":"card-header",className:r("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...a})}function c({className:t,...a}){return o("div",{"data-slot":"card-title",className:r("leading-none font-semibold",t),...a})}function s({className:t,...a}){return o("div",{"data-slot":"card-description",className:r("text-sm text-muted-foreground",t),...a})}function i({className:t,...a}){return o("div",{"data-slot":"card-content",className:r("px-6",t),...a})}function l({className:t,...a}){return o("div",{"data-slot":"card-footer",className:r("flex items-center px-6 [.border-t]:pt-6",t),...a})}
2
+ export{d as rf,n as sf,c as tf,s as uf,i as vf,l as wf};
@@ -1,2 +1,2 @@
1
- import{Of as Rf,Pf as Lf,Qf as Vf,Rf as Cf,Wf as Hf,Xf as Jf,Yf as Kf,Zf as Qf,_f as Wf,bg as _f}from"./chunk-77r8w95d.js";import{hg as Zf,ig as Gf}from"./chunk-54tr7y2x.js";import{jg as zf}from"./chunk-1xpec5r8.js";import{pg as $f}from"./chunk-fa2g2wge.js";import{$g as l,Rg as Sf,Sg as a,Tg as Nf,Ug as Uf,Vg as W,Yg as qf,Zg as g,_g as p,ah as c,ch as Xf}from"./chunk-gswbc6y9.js";import{Bh as u,Dh as d,Mi as n,Sh as i,Ti as o,Wi as s,Zh as x,_i as ff,gk as D,mk as X,nh as O,oh as f,ph as V,qi as e,vi as j,wi as r}from"./chunk-nyhqy6q2.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 pf};
1
+ import{$f as Wf,Pf as Rf,Qf as Lf,Rf as Vf,Sf as Cf,Xf as Hf,Yf as Jf,Zf as Kf,_f as Qf,cg as _f}from"./chunk-zct68gc7.js";import{ig as Zf,jg as Gf}from"./chunk-swa43tzr.js";import{kg as zf}from"./chunk-qwxt1cha.js";import{qg as $f}from"./chunk-z5p39kpk.js";import{$g as p,Sg as Sf,Tg as a,Ug as Nf,Vg as Uf,Wg as W,Zg as qf,_g as g,ah as l,bh as c,dh as Xf}from"./chunk-8a9k4qj6.js";import{$i as ff,Ch as u,Eh as d,Ni as n,Th as i,Ui as o,Xi as s,_h as x,hk as D,nk as X,oh as O,ph as f,qh as V,ri as e,wi as j,xi as r}from"./chunk-q0dhm16d.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 qf};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Dk as T,Ek as A,Fk as G,Gk as C,Hk as I,Ik as M}from"./chunk-qksb0v3c.js";import{Nk as v}from"./chunk-1wm57c6y.js";import{Ok as P}from"./chunk-re0b7sj7.js";import{Rk as K,Sk as O,Tk as S}from"./chunk-922nnh39.js";import{Uk as y}from"./chunk-9h027f50.js";import"./chunk-0qkj838r.js";var B=0,z=(q,V,J)=>{let N=new S;return(async()=>{let w={role:"assistant",content:[],api:"google-generative-ai",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 X=J?.apiKey;if(!X)throw Error(`No API key for provider: ${q.provider}`);let $=x(q,X,J?.headers),Y=f(q,V,J),H=await J?.onPayload?.(Y,q);if(H!==void 0)Y=H;let h=await $.models.generateContentStream(Y);N.push({type:"start",partial:w});let Q=null,R=w.content,Z=()=>R.length-1;for await(let _ of h){w.responseId||=_.responseId;let E=_.candidates?.[0];if(E?.content?.parts)for(let W of E.content.parts){if(W.text!==void 0){let D=T(W);if(!Q||D&&Q.type!=="thinking"||!D&&Q.type!=="text"){if(Q)if(Q.type==="text")N.push({type:"text_end",contentIndex:R.length-1,content:Q.text,partial:w});else N.push({type:"thinking_end",contentIndex:Z(),content:Q.thinking,partial:w});if(D)Q={type:"thinking",thinking:"",thinkingSignature:void 0},w.content.push(Q),N.push({type:"thinking_start",contentIndex:Z(),partial:w});else Q={type:"text",text:""},w.content.push(Q),N.push({type:"text_start",contentIndex:Z(),partial:w})}if(Q.type==="thinking")Q.thinking+=W.text,Q.thinkingSignature=A(Q.thinkingSignature,W.thoughtSignature),N.push({type:"thinking_delta",contentIndex:Z(),delta:W.text,partial:w});else Q.text+=W.text,Q.textSignature=A(Q.textSignature,W.thoughtSignature),N.push({type:"text_delta",contentIndex:Z(),delta:W.text,partial:w})}if(W.functionCall){if(Q){if(Q.type==="text")N.push({type:"text_end",contentIndex:Z(),content:Q.text,partial:w});else N.push({type:"thinking_end",contentIndex:Z(),content:Q.thinking,partial:w});Q=null}let D=W.functionCall.id,U={type:"toolCall",id:!D||w.content.some((j)=>j.type==="toolCall"&&j.id===D)?`${W.functionCall.name}_${Date.now()}_${++B}`:D,name:W.functionCall.name||"",arguments:W.functionCall.args??{},...W.thoughtSignature&&{thoughtSignature:W.thoughtSignature}};w.content.push(U),N.push({type:"toolcall_start",contentIndex:Z(),partial:w}),N.push({type:"toolcall_delta",contentIndex:Z(),delta:JSON.stringify(U.arguments),partial:w}),N.push({type:"toolcall_end",contentIndex:Z(),toolCall:U,partial:w})}}if(E?.finishReason){if(w.stopReason=M(E.finishReason),w.content.some((W)=>W.type==="toolCall"))w.stopReason="toolUse"}if(_.usageMetadata)w.usage={input:(_.usageMetadata.promptTokenCount||0)-(_.usageMetadata.cachedContentTokenCount||0),output:(_.usageMetadata.candidatesTokenCount||0)+(_.usageMetadata.thoughtsTokenCount||0),cacheRead:_.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,totalTokens:_.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},K(q,w.usage)}if(Q)if(Q.type==="text")N.push({type:"text_end",contentIndex:Z(),content:Q.text,partial:w});else N.push({type:"thinking_end",contentIndex:Z(),content:Q.thinking,partial:w});if(J?.signal?.aborted)throw Error("Request was aborted");if(w.stopReason==="aborted"||w.stopReason==="error")throw Error("An unknown error occurred");N.push({type:"done",reason:w.stopReason,message:w}),N.end()}catch(X){for(let $ of w.content)if("index"in $)delete $.index;w.stopReason=J?.signal?.aborted?"aborted":"error",w.errorMessage=X instanceof Error?X.message:JSON.stringify(X),N.push({type:"error",reason:w.stopReason,error:w}),N.end()}})(),N},l=(q,V,J)=>{let N=J?.apiKey;if(!N)throw Error(`No API key for provider: ${q.provider}`);let w=P(q,J,N);if(!J?.reasoning)return z(q,V,{...w,thinking:{enabled:!1}});let X=O(q,J.reasoning),$=X==="off"?"high":X,Y=q;if(L(Y)||b(Y)||F(Y))return z(q,V,{...w,thinking:{enabled:!0,level:g($,Y)}});return z(q,V,{...w,thinking:{enabled:!0,budgetTokens:a(Y,$,J.thinkingBudgets)}})};function x(q,V,J){let N={};if(q.baseUrl)N.baseUrl=q.baseUrl,N.apiVersion="";if(q.headers||J)N.headers={...q.headers,...J};return new v({apiKey:V,httpOptions:Object.keys(N).length>0?N:void 0})}function f(q,V,J={}){let N=G(q,V),w={};if(J.temperature!==void 0)w.temperature=J.temperature;if(J.maxTokens!==void 0)w.maxOutputTokens=J.maxTokens;let X={...Object.keys(w).length>0&&w,...V.systemPrompt&&{systemInstruction:y(V.systemPrompt)},...V.tools&&V.tools.length>0&&{tools:C(V.tools)}};if(V.tools&&V.tools.length>0&&J.toolChoice)X.toolConfig={functionCallingConfig:{mode:I(J.toolChoice)}};else X.toolConfig=void 0;if(J.thinking?.enabled&&q.reasoning){let Y={includeThoughts:!0};if(J.thinking.level!==void 0)Y.thinkingLevel=J.thinking.level;else if(J.thinking.budgetTokens!==void 0)Y.thinkingBudget=J.thinking.budgetTokens;X.thinkingConfig=Y}else if(q.reasoning&&J.thinking&&!J.thinking.enabled)X.thinkingConfig=k(q);if(J.signal){if(J.signal.aborted)throw Error("Request aborted");X.abortSignal=J.signal}return{model:q.id,contents:N,config:X}}function F(q){return/gemma-?4/.test(q.id.toLowerCase())}function L(q){return/gemini-3(?:\.\d+)?-pro/.test(q.id.toLowerCase())}function b(q){return/gemini-3(?:\.\d+)?-flash/.test(q.id.toLowerCase())}function k(q){if(L(q))return{thinkingLevel:"LOW"};if(b(q))return{thinkingLevel:"MINIMAL"};if(F(q))return{thinkingLevel:"MINIMAL"};return{thinkingBudget:0}}function g(q,V){if(L(V))switch(q){case"minimal":case"low":return"LOW";case"medium":case"high":return"HIGH"}if(F(V))switch(q){case"minimal":case"low":return"MINIMAL";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 a(q,V,J){if(J?.[V]!==void 0)return J[V];if(q.id.includes("2.5-pro"))return{minimal:128,low:2048,medium:8192,high:32768}[V];if(q.id.includes("2.5-flash-lite"))return{minimal:512,low:2048,medium:8192,high:24576}[V];if(q.id.includes("2.5-flash"))return{minimal:128,low:2048,medium:8192,high:24576}[V];return-1}export{l as streamSimpleGoogle,z as streamGoogle};
2
+ import{Ek as T,Fk as A,Gk as G,Hk as C,Ik as I,Jk as M}from"./chunk-nmzvxgd6.js";import{Ok as v}from"./chunk-8sr8ff6a.js";import{Pk as P}from"./chunk-e66j69wz.js";import{Sk as K,Tk as O,Uk as S}from"./chunk-cm25nm9t.js";import{Vk as y}from"./chunk-3g54qkv5.js";import"./chunk-6f1twjf6.js";var B=0,z=(q,V,J)=>{let N=new S;return(async()=>{let w={role:"assistant",content:[],api:"google-generative-ai",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 X=J?.apiKey;if(!X)throw Error(`No API key for provider: ${q.provider}`);let $=x(q,X,J?.headers),Y=f(q,V,J),H=await J?.onPayload?.(Y,q);if(H!==void 0)Y=H;let h=await $.models.generateContentStream(Y);N.push({type:"start",partial:w});let Q=null,R=w.content,Z=()=>R.length-1;for await(let _ of h){w.responseId||=_.responseId;let E=_.candidates?.[0];if(E?.content?.parts)for(let W of E.content.parts){if(W.text!==void 0){let D=T(W);if(!Q||D&&Q.type!=="thinking"||!D&&Q.type!=="text"){if(Q)if(Q.type==="text")N.push({type:"text_end",contentIndex:R.length-1,content:Q.text,partial:w});else N.push({type:"thinking_end",contentIndex:Z(),content:Q.thinking,partial:w});if(D)Q={type:"thinking",thinking:"",thinkingSignature:void 0},w.content.push(Q),N.push({type:"thinking_start",contentIndex:Z(),partial:w});else Q={type:"text",text:""},w.content.push(Q),N.push({type:"text_start",contentIndex:Z(),partial:w})}if(Q.type==="thinking")Q.thinking+=W.text,Q.thinkingSignature=A(Q.thinkingSignature,W.thoughtSignature),N.push({type:"thinking_delta",contentIndex:Z(),delta:W.text,partial:w});else Q.text+=W.text,Q.textSignature=A(Q.textSignature,W.thoughtSignature),N.push({type:"text_delta",contentIndex:Z(),delta:W.text,partial:w})}if(W.functionCall){if(Q){if(Q.type==="text")N.push({type:"text_end",contentIndex:Z(),content:Q.text,partial:w});else N.push({type:"thinking_end",contentIndex:Z(),content:Q.thinking,partial:w});Q=null}let D=W.functionCall.id,U={type:"toolCall",id:!D||w.content.some((j)=>j.type==="toolCall"&&j.id===D)?`${W.functionCall.name}_${Date.now()}_${++B}`:D,name:W.functionCall.name||"",arguments:W.functionCall.args??{},...W.thoughtSignature&&{thoughtSignature:W.thoughtSignature}};w.content.push(U),N.push({type:"toolcall_start",contentIndex:Z(),partial:w}),N.push({type:"toolcall_delta",contentIndex:Z(),delta:JSON.stringify(U.arguments),partial:w}),N.push({type:"toolcall_end",contentIndex:Z(),toolCall:U,partial:w})}}if(E?.finishReason){if(w.stopReason=M(E.finishReason),w.content.some((W)=>W.type==="toolCall"))w.stopReason="toolUse"}if(_.usageMetadata)w.usage={input:(_.usageMetadata.promptTokenCount||0)-(_.usageMetadata.cachedContentTokenCount||0),output:(_.usageMetadata.candidatesTokenCount||0)+(_.usageMetadata.thoughtsTokenCount||0),cacheRead:_.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,totalTokens:_.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},K(q,w.usage)}if(Q)if(Q.type==="text")N.push({type:"text_end",contentIndex:Z(),content:Q.text,partial:w});else N.push({type:"thinking_end",contentIndex:Z(),content:Q.thinking,partial:w});if(J?.signal?.aborted)throw Error("Request was aborted");if(w.stopReason==="aborted"||w.stopReason==="error")throw Error("An unknown error occurred");N.push({type:"done",reason:w.stopReason,message:w}),N.end()}catch(X){for(let $ of w.content)if("index"in $)delete $.index;w.stopReason=J?.signal?.aborted?"aborted":"error",w.errorMessage=X instanceof Error?X.message:JSON.stringify(X),N.push({type:"error",reason:w.stopReason,error:w}),N.end()}})(),N},l=(q,V,J)=>{let N=J?.apiKey;if(!N)throw Error(`No API key for provider: ${q.provider}`);let w=P(q,J,N);if(!J?.reasoning)return z(q,V,{...w,thinking:{enabled:!1}});let X=O(q,J.reasoning),$=X==="off"?"high":X,Y=q;if(L(Y)||b(Y)||F(Y))return z(q,V,{...w,thinking:{enabled:!0,level:g($,Y)}});return z(q,V,{...w,thinking:{enabled:!0,budgetTokens:a(Y,$,J.thinkingBudgets)}})};function x(q,V,J){let N={};if(q.baseUrl)N.baseUrl=q.baseUrl,N.apiVersion="";if(q.headers||J)N.headers={...q.headers,...J};return new v({apiKey:V,httpOptions:Object.keys(N).length>0?N:void 0})}function f(q,V,J={}){let N=G(q,V),w={};if(J.temperature!==void 0)w.temperature=J.temperature;if(J.maxTokens!==void 0)w.maxOutputTokens=J.maxTokens;let X={...Object.keys(w).length>0&&w,...V.systemPrompt&&{systemInstruction:y(V.systemPrompt)},...V.tools&&V.tools.length>0&&{tools:C(V.tools)}};if(V.tools&&V.tools.length>0&&J.toolChoice)X.toolConfig={functionCallingConfig:{mode:I(J.toolChoice)}};else X.toolConfig=void 0;if(J.thinking?.enabled&&q.reasoning){let Y={includeThoughts:!0};if(J.thinking.level!==void 0)Y.thinkingLevel=J.thinking.level;else if(J.thinking.budgetTokens!==void 0)Y.thinkingBudget=J.thinking.budgetTokens;X.thinkingConfig=Y}else if(q.reasoning&&J.thinking&&!J.thinking.enabled)X.thinkingConfig=k(q);if(J.signal){if(J.signal.aborted)throw Error("Request aborted");X.abortSignal=J.signal}return{model:q.id,contents:N,config:X}}function F(q){return/gemma-?4/.test(q.id.toLowerCase())}function L(q){return/gemini-3(?:\.\d+)?-pro/.test(q.id.toLowerCase())}function b(q){return/gemini-3(?:\.\d+)?-flash/.test(q.id.toLowerCase())}function k(q){if(L(q))return{thinkingLevel:"LOW"};if(b(q))return{thinkingLevel:"MINIMAL"};if(F(q))return{thinkingLevel:"MINIMAL"};return{thinkingBudget:0}}function g(q,V){if(L(V))switch(q){case"minimal":case"low":return"LOW";case"medium":case"high":return"HIGH"}if(F(V))switch(q){case"minimal":case"low":return"MINIMAL";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 a(q,V,J){if(J?.[V]!==void 0)return J[V];if(q.id.includes("2.5-pro"))return{minimal:128,low:2048,medium:8192,high:32768}[V];if(q.id.includes("2.5-flash-lite"))return{minimal:512,low:2048,medium:8192,high:24576}[V];if(q.id.includes("2.5-flash"))return{minimal:128,low:2048,medium:8192,high:24576}[V];return-1}export{l as streamSimpleGoogle,z as streamGoogle};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  var j=Object.create;var{getPrototypeOf:k,defineProperty:f,getOwnPropertyNames:l}=Object;var m=Object.prototype.hasOwnProperty;function n(a){return this[a]}var o,p,s=(a,b,c)=>{var g=a!=null&&typeof a==="object";if(g){var h=b?o??=new WeakMap:p??=new WeakMap,i=h.get(a);if(i)return i}c=a!=null?j(k(a)):{};let d=b||!a||!a.__esModule?f(c,"default",{value:a,enumerable:!0}):c;for(let e of l(a))if(!m.call(d,e))f(d,e,{get:n.bind(a,e),enumerable:!0});if(g)h.set(a,d);return d};var t=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);var q=(a)=>a;function r(a,b){this[a]=q.bind(null,b)}var u=(a,b)=>{for(var c in b)f(a,c,{get:b[c],enumerable:!0,configurable:!0,set:r.bind(b,c)})};var v=(a,b)=>()=>(a&&(b=a(a=0)),b);var w=(a)=>JSON.parse(a);var x=import.meta.require;
3
- export{s as Vk,t as Wk,u as Xk,v as Yk,w as Zk,x as _k};
3
+ export{s as Wk,t as Xk,u as Yk,v as Zk,w as _k,x as $k};
@@ -0,0 +1,2 @@
1
+ import{n as p}from"./chunk-9jd3d3f3.js";import{V as Yz,W as Zz,X as _z,Y as $z,Z as Kz}from"./chunk-vdn3jymh.js";import{Ua as Uz}from"./chunk-8rkp0fc5.js";import{Wa as S}from"./chunk-cwebycwv.js";import{jg as v}from"./chunk-swa43tzr.js";import{Ng as Jz}from"./chunk-1zpw2mbj.js";import{ch as Xz}from"./chunk-8a9k4qj6.js";import{Dj as A,Mj as Gz,Th as r,Ui as h,bi as o,hk as T,ki as t,mi as e,nh as Bz,nk as Y,oh as B,ph as z,pj as zz,qh as J,rh as a,ri as M,si as s,uh as n,xi as b}from"./chunk-q0dhm16d.js";import{Wk as Rz}from"./chunk-6f1twjf6.js";var Z=Rz(Bz(),1);function uz({projectId:O,contextAssetId:R}){let{isHistoryMode:W,setIsHistoryMode:I,currentSessionId:Vz,chatAssets:u,removeAsset:Wz,messages:E,historySessions:g,isStreaming:D,fetchHistorySessions:m,loadSession:Lz,deleteSession:Nz,startNewSession:Qz,sendMessage:Pz,abortActiveSession:Oz,selectedAgentId:H,setSelectedAgentId:w}=v(),{teamId:_,ensureTeamIdForProject:l}=Xz();Z.useEffect(()=>{if(O)l(O)},[O,l]);let{data:Dz=[]}=n({queryKey:["agents",_],queryFn:async()=>{if(!_)return[];let G=await r.api.teams[":teamId"].agents.$get({param:{teamId:_}});if(!G.ok)throw Error("failed to fetch agents");return G.json()},enabled:!!_}),F=Dz.filter((G)=>G.type==="chat"&&G.enabled);Z.useEffect(()=>{if(F.length>0){if(!F.some((X)=>X.id===H))w(F[0].id)}},[F,H,w]);let[C,j]=Z.useState(""),d=Z.useRef(null),y=Z.useRef(null),k=Z.useRef(!0),f=Z.useRef(!0);Z.useEffect(()=>{f.current=!0,k.current=!0},[O,R,W]),Z.useEffect(()=>{let G=y.current?.querySelector('[data-slot="scroll-area-viewport"]');if(!G)return;let{scrollTop:X,isAtBottom:$}=v.getState(),V=setTimeout(()=>{if($)G.scrollTop=G.scrollHeight;else G.scrollTop=X;let Q=setTimeout(()=>{f.current=!1},50);return()=>clearTimeout(Q)},0);return()=>clearTimeout(V)},[O,R,W]),Z.useEffect(()=>{let G=y.current?.querySelector('[data-slot="scroll-area-viewport"]');if(!G)return;let X=()=>{if(f.current)return;let $=G.scrollTop,V=G.scrollHeight-$-G.clientHeight<10;v.getState().setScrollState($,V)};return G.addEventListener("scroll",X),()=>{G.removeEventListener("scroll",X)}},[O,R,W]);let{ref:qz,isDropTarget:Ez}=Uz({id:"chatbot-sidebar",data:{type:"chatbot-sidebar"}});Z.useEffect(()=>{if(!W){let{isAtBottom:G}=v.getState();if(G||D){let X=k.current?"auto":"smooth";d.current?.scrollIntoView({behavior:X})}k.current=!1}},[E,D,W]),Z.useEffect(()=>{if(W&&_)m(_)},[W,m,_]);let q=a(),Fz=Z.useCallback(()=>{q.invalidateQueries({queryKey:["search"]}),q.invalidateQueries({queryKey:["folders"]}),q.invalidateQueries({queryKey:["files"]}),q.invalidateQueries({queryKey:["file"]}),q.invalidateQueries({queryKey:["version_stacks"]}),q.invalidateQueries({queryKey:["projects"]})},[q]),x=()=>{if(!C.trim()||D||!_)return;Pz(_,C,O,R,Fz),j("")},Hz=(G)=>{if(G.nativeEvent.isComposing)return;if(G.key==="Enter"&&!G.shiftKey)G.preventDefault(),x()},c=(G)=>{if(typeof G==="string")return G;if(Array.isArray(G))return G.map((X)=>{if(typeof X==="string")return X;if(X&&typeof X==="object"&&"type"in X&&X.type==="text"&&"text"in X)return String(X.text);return""}).join("");return""},i=(G)=>{return G.replace(/<@([a-zA-Z0-9_-]+)>/g,"@$1").replace(/^\[([^\]]+)\]:/gm,"\\[$1\\]:")},Cz=(G)=>{switch(G.role){case"user":return z("div",{className:"flex justify-end w-full",children:z("div",{className:"bg-primary text-primary-foreground rounded-lg px-3 py-2 max-w-[85%] text-sm whitespace-pre-wrap shadow-xs break-words",children:c(G.content)})},G.id);case"assistant":{let $=G.content;if(!$)return null;let V=[];if($.forEach((K,L)=>{if(!K||typeof K!=="object")return;let N=K;switch(N.type){case"text":{let U=N.text;if(typeof U!=="string"||!U.trim())return;V.push(z("div",{className:"text-sm leading-[1.8] prose prose-sm dark:prose-invert max-w-none break-words",children:z(p,{components:{pre:({node:P,...vz})=>z("pre",{className:"whitespace-pre-wrap break-all break-words bg-muted text-foreground p-4 rounded-md border border-border/50 font-mono text-sm",...vz})},children:i(U)})},`txt-${L}`));break}case"thinking":{let U=N.thinking;if(typeof U!=="string"||!U.trim())return;V.push(J("details",{className:"group border border-border/50 rounded-lg bg-muted/20 my-2 overflow-hidden",children:[J("summary",{className:"flex items-center gap-2 p-2.5 text-xs font-medium text-muted-foreground select-none cursor-pointer hover:bg-muted/40 transition-colors list-none [&::-webkit-details-marker]:hidden",children:[z(s,{className:"h-3.5 w-3.5 text-primary/70 animate-pulse"}),z("span",{children:Y.role_thinking()||"Thinking"}),z(b,{className:"h-3 w-3 ml-auto transition-transform group-open:rotate-180"})]}),z("div",{className:"p-3 pt-0 text-xs text-muted-foreground/90 border-t border-border/40 bg-muted/10 leading-relaxed prose prose-sm dark:prose-invert max-w-none whitespace-pre-wrap font-sans",children:z(p,{children:i(U)})})]},`think-${L}`));break}case"toolCall":{let U=String(N.name||N.toolName||Y.unknown()),P=N.arguments||N.args;V.push(J("details",{className:"group border border-border/50 rounded-lg bg-violet-500/5 my-2 overflow-hidden",children:[J("summary",{className:"flex items-center gap-2 p-2.5 text-xs font-semibold text-violet-600 dark:text-violet-400 select-none cursor-pointer hover:bg-violet-500/10 transition-colors list-none [&::-webkit-details-marker]:hidden",children:[z(Gz,{className:"h-3.5 w-3.5"}),z("span",{children:Y.calling_tool()}),z("span",{className:"font-mono bg-violet-500/10 px-1.5 py-0.5 rounded text-[11px] text-violet-700 dark:text-violet-300",children:U}),z(b,{className:"h-3 w-3 ml-auto transition-transform group-open:rotate-180"})]}),!!P&&J("div",{className:"p-3 pt-0 text-[10px] text-muted-foreground/90 border-t border-border/40 bg-violet-500/5 font-sans",children:[z("div",{className:"text-[9px] text-muted-foreground/60 uppercase font-bold tracking-wider mb-1.5",children:Y.tool_arguments()||"Arguments"}),z("pre",{className:"font-mono bg-muted/30 p-2 rounded border border-border/30 overflow-x-auto max-h-32",children:JSON.stringify(P,null,2)})]})]},`tool-${L}`));break}case"image":{let U=String(N.mimeType||"image/png"),P=String(N.data||"");V.push(z("div",{className:"my-2 max-w-full",children:P?z("img",{src:P.startsWith("data:")?P:`data:${U};base64,${P}`,alt:"Attached asset",className:"max-h-60 rounded border border-border/50 object-contain shadow-xs"}):z("div",{className:"text-xs text-muted-foreground italic flex items-center gap-1.5 py-1",children:Y.image_object()})},`img-${L}`));break}default:{let U=JSON.stringify(K,null,2);if(U==="{}")return;V.push(z("pre",{className:"text-xs text-foreground/80 font-mono whitespace-pre-wrap break-words bg-muted/20 p-2 rounded",children:U},`other-${L}`))}}}),V.length===0)return null;let Q=!1;if($.length>0){let K=$[$.length-1];if(typeof K==="string"&&K.trim().length>0)Q=!0;else if(K&&typeof K==="object"){let L=K;if(L.type==="text"&&typeof L.text==="string"&&L.text.trim().length>0)Q=!0}}return J("div",{className:"flex flex-col w-full space-y-1",children:[z("div",{className:"space-y-2 w-full",children:V}),Q&&z("div",{className:"text-[10px] text-muted-foreground self-start italic pt-1",children:Y.created_by_agent()})]},G.id)}case"toolResult":return z("div",{className:"flex items-center gap-2 text-xs text-muted-foreground bg-muted/40 p-2 rounded-md border border-border/50",children:z("span",{className:"font-semibold",children:Y.tool_result_with_name({name:G.toolName||"tool"})})},G.id);case"thinking_level_change":case"custom":{let X=G;if(X.customType==="context_display_info"){let Q=X.details?.assets||[];if(Q.length===0)return null;return J("div",{className:"text-xs text-muted-foreground bg-muted/40 p-2.5 rounded-lg border border-border/50 space-y-1 my-1",children:[z("div",{className:"font-semibold",children:Y.assets_added_to_context()}),z("ul",{className:"list-disc list-inside space-y-0.5",children:Q.map((K)=>J("li",{className:"truncate",children:[K.name," ",J("span",{className:"text-muted-foreground/70",children:["(",K.type,")"]})]},K.id))})]},G.id)}let $=X.content||"";return z("div",{className:"text-center text-xs text-muted-foreground italic bg-muted/20 py-1.5 rounded",children:c($)},G.id)}default:return null}};return J("div",{ref:qz,className:T("relative flex flex-col h-full bg-background transition-colors duration-200 min-h-0"),children:[Ez&&z("div",{className:"absolute inset-0 bg-accent/30 border-2 border-primary z-50 pointer-events-none flex items-center justify-center p-6 text-center animate-in fade-in duration-150",children:J("div",{className:"bg-background/95 text-foreground px-4 py-3 rounded-xl border border-border/80 flex flex-col items-center gap-2 shadow-lg max-w-[80%] animate-in zoom-in-95 duration-150",children:[z(M,{className:"h-6 w-6 text-primary animate-bounce"}),z("span",{className:"text-sm font-semibold text-foreground",children:Y.chatbot_drag_drop_hint()||"Drop assets here"})]})}),z("div",{className:"flex items-center justify-between p-4 pt-[0.7rem] flex-shrink-0",children:W?J(B,{children:[z("div",{className:"flex items-center gap-2 font-semibold",children:z("span",{children:Y.history()})}),z("button",{onClick:()=>I(!1),className:"p-1.5 hover:bg-accent rounded-md text-muted-foreground hover:text-foreground transition-colors",title:"Close History",children:z(t,{className:"h-4 w-4"})})]}):J(B,{children:[z("div",{className:"flex items-center gap-2 font-semibold",children:z("span",{children:Y.shumai_agent()})}),J("div",{className:"flex items-center gap-1",children:[z("button",{onClick:Qz,className:"p-1.5 hover:bg-accent rounded-md text-muted-foreground hover:text-foreground transition-colors",title:Y.new_chat(),children:z(zz,{className:"h-4 w-4"})}),z("button",{onClick:()=>I(!0),className:"p-1.5 hover:bg-accent rounded-md text-muted-foreground hover:text-foreground transition-colors",title:Y.history(),children:z(h,{className:"h-4 w-4"})})]})]})}),W?z(S,{className:"flex-1 p-4 min-h-0",children:g.length===0?J("div",{className:"flex flex-col items-center justify-center h-48 text-muted-foreground p-4 text-center",children:[z(h,{className:"h-8 w-8 mb-2 opacity-50 text-muted-foreground"}),z("p",{className:"text-sm",children:Y.no_history_sessions()})]}):z("div",{className:"space-y-2 pb-4",children:g.map((G)=>{let X=G.id===Vz;return J("div",{className:T("group relative flex items-center justify-between p-3 border rounded-lg transition-all cursor-pointer bg-card",X?"border-primary":"border-border hover:bg-accent/30"),children:[J("div",{onClick:()=>_&&Lz(_,G.id),className:"flex-1 min-w-0 pr-6",children:[z("div",{className:"text-sm font-semibold text-foreground truncate",children:G.name||Y.new_chat()}),z("div",{className:"text-xs text-muted-foreground mt-0.5",children:Jz(G.createdAt)})]}),z("button",{onClick:($)=>{if($.stopPropagation(),_&&confirm(Y.delete_session_confirm()))Nz(_,G.id)},className:"absolute right-3 opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity text-muted-foreground hover:text-destructive p-1 rounded hover:bg-muted",title:"Delete Session",children:z(A,{className:"h-4 w-4"})})]},G.id)})})}):J(B,{children:[z(S,{ref:y,className:"flex-1 p-4 min-h-0 [&>div>div]:!block",children:E.length===0?J("div",{className:"flex flex-col items-center justify-center h-48 border-2 border-dashed border-border rounded-lg text-muted-foreground p-4 text-center",children:[z(M,{className:"h-8 w-8 mb-2 opacity-50 text-muted-foreground"}),z("p",{className:"text-sm",children:Y.chatbot_drag_drop_hint()})]}):J("div",{className:"space-y-4 pb-4",children:[E.map(Cz),D&&E.length>0&&E[E.length-1].role==="user"&&J("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground italic",children:[z(o,{className:"h-3 w-3 animate-spin text-primary"}),z("span",{children:"Thinking..."})]}),z("div",{ref:d})]})}),z("div",{className:"p-2 flex-shrink-0 bg-background",children:J("div",{className:"relative flex flex-col w-full border border-foreground/20 rounded-2xl shadow-xs transition-all duration-200 focus-within:ring-2 focus-within:ring-primary focus-within:border-transparent bg-background overflow-hidden",children:[u.length>0&&z("div",{className:"flex flex-col gap-1.5 min-h-0 max-h-[160px] overflow-y-auto border-b border-border bg-muted/5 p-3 divide-y divide-border/50",children:u.map((G)=>J("div",{className:"flex items-center justify-between py-1.5 text-xs group",children:[J("div",{className:"flex items-baseline gap-1.5 min-w-0 pr-2",children:[z("span",{className:"truncate font-medium text-foreground",children:G.name}),z("span",{className:"text-[9px] text-muted-foreground uppercase flex-shrink-0",children:G.type})]}),z("button",{onClick:()=>Wz(G.id),className:"text-muted-foreground hover:text-destructive transition-colors p-0.5",title:Y.remove_from_context(),children:z(A,{className:"h-3.5 w-3.5"})})]},G.id))}),z("textarea",{value:C,onChange:(G)=>j(G.target.value),onKeyDown:Hz,placeholder:"Type a message...",rows:2,className:"w-full bg-transparent border-none focus:ring-0 focus:outline-hidden resize-none min-h-[44px] max-h-[120px] px-3 py-2 text-sm focus-visible:outline-hidden focus:ring-transparent focus:border-transparent focus-visible:ring-0",disabled:D}),J("div",{className:"flex justify-between items-center px-3 pb-2 pt-1",children:[z("div",{className:"flex items-center gap-1.5 min-w-0 max-w-[70%]",children:F.length>0?J(Yz,{value:H||"",onValueChange:(G)=>w(G),disabled:D,children:[z(_z,{className:"h-8 border-none bg-transparent hover:bg-muted text-muted-foreground hover:text-foreground focus:ring-0 focus:ring-offset-0 px-2 py-0 gap-1.5 text-xs shrink-0 select-none shadow-none max-w-full",children:z(Zz,{placeholder:Y.select_agent()})}),z($z,{children:F.map((G)=>z(Kz,{value:G.id,children:J("div",{className:"flex items-center gap-2",children:[G.avatar?z("img",{src:G.avatar,alt:G.name,className:"w-4 h-4 rounded-full object-cover"}):z(M,{className:"w-4 h-4 text-muted-foreground"}),z("span",{className:"text-xs",children:G.name})]})},G.id))})]}):z("div",{className:"flex items-center gap-1.5 px-2 py-1 text-[11px] text-muted-foreground/60 italic select-none",children:z("span",{children:Y.no_chat_agents_warning()})})}),D?z("button",{onClick:()=>{if(_)Oz(_)},className:"p-2 rounded-full transition-all duration-200 flex items-center justify-center shrink-0 shadow-sm bg-destructive text-destructive-foreground hover:bg-destructive/90 transform hover:-translate-y-0.5",title:"Stop generation",children:z("div",{className:"h-4 w-4 flex items-center justify-center",children:z("div",{className:"h-3 w-3 bg-current rounded-[2px] bg-white"})})}):z("button",{onClick:x,disabled:!C.trim()||!H,className:T("p-2 rounded-full transition-all duration-200 flex items-center justify-center shrink-0 shadow-sm",C.trim()&&H?"bg-primary text-primary-foreground hover:bg-primary/95 transform hover:-translate-y-0.5":"bg-muted text-muted-foreground cursor-not-allowed opacity-50"),children:z(e,{className:"h-4 w-4"})})]})]})})]})]})}
2
+ export{uz as k};