@shumai-one/shumai 0.3.7 → 0.3.8

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 (151) hide show
  1. package/bin/{chunk-9nyhmtp9.js → chunk-0mmw31pj.js} +2 -2
  2. package/bin/{chunk-gjn3w26y.js → chunk-0pm8c9bq.js} +2 -2
  3. package/bin/{chunk-50keqtz9.js → chunk-0qpz48vc.js} +1 -1
  4. package/bin/{chunk-zjj9qj6y.js → chunk-0zbwpfsk.js} +2 -2
  5. package/bin/chunk-15jsnygy.js +5 -0
  6. package/bin/chunk-16s5kfy8.css +1 -0
  7. package/bin/{chunk-hqkmdp31.js → chunk-21rp4vzr.js} +2 -2
  8. package/bin/chunk-24ke0th1.css +1 -0
  9. package/bin/{chunk-260wywfb.js → chunk-28n8xqhm.js} +1 -1
  10. package/bin/{chunk-7hnw6y6d.js → chunk-2dxd0bar.js} +2 -2
  11. package/bin/{chunk-3dx0p1ge.js → chunk-2ejky9qv.js} +1 -1
  12. package/bin/{chunk-dej1gq35.js → chunk-2em77vjv.js} +1 -1
  13. package/bin/{chunk-zg60j9x2.js → chunk-2q26gz0p.js} +1 -1
  14. package/bin/{chunk-9s02m95j.js → chunk-2t0asg3w.js} +2 -2
  15. package/bin/{chunk-rfyaphas.js → chunk-2xaq1y16.js} +2 -2
  16. package/bin/{chunk-qmpph1gt.js → chunk-33r4w0yv.js} +2 -2
  17. package/bin/{chunk-1xzc6z02.js → chunk-3bm3be9d.js} +1 -1
  18. package/bin/{chunk-1sqz0va1.js → chunk-3mx22sn7.js} +2 -2
  19. package/bin/chunk-4cmw4qmt.js +1 -0
  20. package/bin/chunk-4d3wm83a.js +2 -0
  21. package/bin/{chunk-0jkqmbcx.js → chunk-4g4g02e0.js} +1 -1
  22. package/bin/{chunk-tpp9qf5m.js → chunk-5386brz2.js} +2 -2
  23. package/bin/{chunk-98j2z6he.js → chunk-5f9fk8x0.js} +3 -3
  24. package/bin/chunk-5fj5w0gg.js +2 -0
  25. package/bin/chunk-61bxmjd9.js +2 -0
  26. package/bin/{chunk-ptw49k86.js → chunk-6pcs8810.js} +1 -1
  27. package/bin/{chunk-x3ynjbt5.js → chunk-6pmsknnk.js} +2 -2
  28. package/bin/{chunk-9xhnmnnb.js → chunk-6vwqg1ra.js} +2 -2
  29. package/bin/{chunk-2mqqghrz.js → chunk-75segwsp.js} +2 -2
  30. package/bin/{chunk-ftc48rbb.js → chunk-7c85cyn0.js} +3 -3
  31. package/bin/chunk-7eyg2kgv.js +1 -0
  32. package/bin/chunk-7r22vcjy.js +2 -0
  33. package/bin/{chunk-0ycwr0kb.js → chunk-80g5kcm0.js} +1 -1
  34. package/bin/{chunk-5gtew41y.js → chunk-8bhsdk1v.js} +1 -1
  35. package/bin/{chunk-1khzycf9.js → chunk-8fsrs7mh.js} +1 -1
  36. package/bin/chunk-8jfm1j41.js +1 -0
  37. package/bin/chunk-8n6segk5.js +1 -0
  38. package/bin/chunk-99f9r6xm.js +2 -0
  39. package/bin/{chunk-2086rsb2.js → chunk-9acfydwy.js} +1 -1
  40. package/bin/{chunk-vxpnp4xg.js → chunk-9ntwrvhz.js} +2 -2
  41. package/bin/{chunk-s0hgykza.js → chunk-agdza65r.js} +2 -2
  42. package/bin/{chunk-6zs49mef.js → chunk-antsxrw9.js} +1 -1
  43. package/bin/chunk-bapy3qv8.js +1 -0
  44. package/bin/chunk-bc2bf144.js +2 -0
  45. package/bin/{chunk-v8w2nxew.js → chunk-bznz6h19.js} +1 -1
  46. package/bin/{chunk-qcqw7wnv.js → chunk-c24an5j3.js} +1 -1
  47. package/bin/chunk-cm74nd4n.js +1 -0
  48. package/bin/{chunk-87wqbn4g.js → chunk-cynjx7ha.js} +2 -2
  49. package/bin/chunk-cyq3m4qz.js +1 -0
  50. package/bin/chunk-ddff7vm3.js +2 -0
  51. package/bin/{chunk-br5xkaf7.js → chunk-djqs6m7w.js} +3 -3
  52. package/bin/{chunk-60hpa5kf.js → chunk-dn8k5ef5.js} +1 -1
  53. package/bin/chunk-dqdqs0d9.js +1 -0
  54. package/bin/chunk-drjaw6a5.js +14 -0
  55. package/bin/chunk-drvwchyn.js +2 -0
  56. package/bin/{chunk-esrtafz0.js → chunk-e4se9q6n.js} +1 -1
  57. package/bin/chunk-eb551xw7.js +1 -0
  58. package/bin/{chunk-nvjp2rnh.js → chunk-en96pr5c.js} +2 -2
  59. package/bin/{chunk-r5dv0rfv.js → chunk-ep138kb3.js} +2 -2
  60. package/bin/{chunk-jszpvg8e.js → chunk-eqf7k7ax.js} +2 -2
  61. package/bin/{chunk-f2j2cqd1.js → chunk-f3rqamey.js} +2 -2
  62. package/bin/{chunk-3kqdgddm.js → chunk-fvwz4mgw.js} +2 -2
  63. package/bin/chunk-g3p6h6sw.js +68 -0
  64. package/bin/{chunk-81tb4v5v.js → chunk-h9f55mjv.js} +2 -2
  65. package/bin/{chunk-n4gghgrj.js → chunk-jfjjh86p.js} +2 -2
  66. package/bin/{chunk-83k0wa5k.js → chunk-jg31cnqc.js} +2 -2
  67. package/bin/chunk-jk87gxbb.js +2 -0
  68. package/bin/{chunk-4bn9eb9h.js → chunk-jqzvazsf.js} +1 -1
  69. package/bin/chunk-jyk483r4.js +1 -0
  70. package/bin/{chunk-48nzw50r.js → chunk-k0ysbh3h.js} +1 -1
  71. package/bin/{chunk-fcs4v6jq.js → chunk-k5yxntns.js} +2 -2
  72. package/bin/chunk-khjybf4y.js +1 -0
  73. package/bin/{chunk-38g3s1f3.js → chunk-kmt9fj1z.js} +2 -2
  74. package/bin/{chunk-503qq6sa.js → chunk-m49ar48r.js} +2 -2
  75. package/bin/{chunk-a0k1b4sq.js → chunk-m7d52gfe.js} +1 -1
  76. package/bin/{chunk-x6532q76.js → chunk-mjxay7yv.js} +1 -1
  77. package/bin/{chunk-zqg4f56h.js → chunk-mp5etccz.js} +1 -1
  78. package/bin/{chunk-9gzy30zm.js → chunk-n8pas7tj.js} +2 -2
  79. package/bin/{chunk-b8v7jvkb.js → chunk-nc632fxz.js} +2 -2
  80. package/bin/{chunk-6fv38qdc.js → chunk-nffrjwb7.js} +2 -2
  81. package/bin/{chunk-7k3ccca6.js → chunk-p1rrkrn4.js} +1 -1
  82. package/bin/chunk-p6ep6grv.js +1 -0
  83. package/bin/{chunk-p4c4z0f2.js → chunk-ph43tgr6.js} +1 -1
  84. package/bin/{chunk-3xzgddev.js → chunk-pqtwzb3s.js} +1 -1
  85. package/bin/chunk-q0xv46wa.js +2 -0
  86. package/bin/{chunk-qh9rz2ee.js → chunk-qhxznkjk.js} +5 -5
  87. package/bin/chunk-qmja7bsr.js +2 -0
  88. package/bin/{chunk-v98e3gex.js → chunk-qyegjbzd.js} +1 -1
  89. package/bin/{chunk-gjdmnfms.js → chunk-r5rf62aa.js} +1 -1
  90. package/bin/{chunk-2xmsrq7f.js → chunk-rjkj0dr9.js} +2 -2
  91. package/bin/chunk-rjr8c8be.js +3 -0
  92. package/bin/{chunk-af6wbhkv.js → chunk-rq4h4p2g.js} +2 -2
  93. package/bin/{chunk-zwgf211t.js → chunk-scmhhrte.js} +2 -2
  94. package/bin/chunk-sjr6mvgm.js +78 -0
  95. package/bin/{chunk-t9t9evan.js → chunk-ssz62jfs.js} +2 -2
  96. package/bin/{chunk-g60v3jc1.js → chunk-ta02azkp.js} +1 -1
  97. package/bin/{chunk-tzt4c1dm.js → chunk-tfnh9sk9.js} +2 -2
  98. package/bin/{chunk-cqq8e3hc.js → chunk-thqahbva.js} +2 -2
  99. package/bin/chunk-tvzfm7g8.js +2 -0
  100. package/bin/{chunk-k48y9e5s.js → chunk-twm329fs.js} +1 -1
  101. package/bin/{chunk-0t8q76ac.js → chunk-ve826t5r.js} +1 -1
  102. package/bin/chunk-vpfj3q7r.js +1 -0
  103. package/bin/chunk-vqakgjsf.js +1 -0
  104. package/bin/chunk-wgjghs54.js +7 -0
  105. package/bin/chunk-wy1ytxw7.js +41 -0
  106. package/bin/{chunk-t3tp9trj.js → chunk-x788nk6z.js} +2 -2
  107. package/bin/{chunk-b3jh3hf1.js → chunk-x8ksced7.js} +2 -2
  108. package/bin/{chunk-qdycy714.js → chunk-xexxh1zq.js} +1 -1
  109. package/bin/{chunk-6v39c8eg.js → chunk-xktnqktj.js} +2 -2
  110. package/bin/{chunk-7872prvg.js → chunk-xpce3j7g.js} +1 -1
  111. package/bin/{chunk-karn564z.js → chunk-xyzsmjtk.js} +2 -2
  112. package/bin/chunk-y03s8bkz.js +1 -0
  113. package/bin/{chunk-kpn9d97x.js → chunk-y5g2ge6f.js} +1 -1
  114. package/bin/{chunk-qy93r7tm.js → chunk-ygcmv04c.js} +2 -2
  115. package/bin/{chunk-ytzk81tr.js → chunk-ykarhcph.js} +1 -1
  116. package/bin/{chunk-bancgvrc.js → chunk-yr8a8nzv.js} +2 -2
  117. package/bin/chunk-yxtb7xn8.js +2 -0
  118. package/bin/{chunk-n76r6s9k.js → chunk-zaft3sfe.js} +2 -2
  119. package/bin/shumai-app.html +1 -1
  120. package/bin/shumai-app.js +237 -215
  121. package/package.json +7 -7
  122. package/prisma/migrations/20260814090300_add_asset_agentmd/migration.sql +2 -0
  123. package/prisma/migrations/20260814125921_create_asset_agentmd_table/migration.sql +21 -0
  124. package/prisma/schema.prisma +12 -0
  125. package/bin/chunk-0xern7e4.js +0 -1
  126. package/bin/chunk-0yngn45x.js +0 -2
  127. package/bin/chunk-4egayx81.js +0 -2
  128. package/bin/chunk-4rbzswqs.js +0 -71
  129. package/bin/chunk-69tt1pvr.js +0 -2
  130. package/bin/chunk-815ezj20.js +0 -1
  131. package/bin/chunk-85eg9xqx.js +0 -1
  132. package/bin/chunk-86aagej8.js +0 -1
  133. package/bin/chunk-8y1v9dm9.js +0 -2
  134. package/bin/chunk-9gq9782d.js +0 -1
  135. package/bin/chunk-bv88se28.css +0 -1
  136. package/bin/chunk-dv1zpd2p.js +0 -15
  137. package/bin/chunk-eetrc0j1.js +0 -3
  138. package/bin/chunk-eztggp8r.js +0 -1
  139. package/bin/chunk-gf5ds9r9.js +0 -2
  140. package/bin/chunk-h9emz0zb.js +0 -2
  141. package/bin/chunk-h9k2atte.js +0 -1
  142. package/bin/chunk-kkq4wvnc.js +0 -1
  143. package/bin/chunk-ksx113sp.js +0 -1
  144. package/bin/chunk-m6a4rzdt.js +0 -62
  145. package/bin/chunk-mw8f8ngt.js +0 -7
  146. package/bin/chunk-rvspnthy.js +0 -1
  147. package/bin/chunk-sjjndwt4.js +0 -2
  148. package/bin/chunk-tvg9gvqs.js +0 -1
  149. package/bin/chunk-xp4dcyk3.js +0 -1
  150. package/bin/chunk-y8aehqr8.js +0 -2
  151. package/bin/chunk-yvxt48r4.js +0 -1
@@ -1,2 +1,2 @@
1
- import{Sf as A}from"./chunk-s0hgykza.js";import{Qh as w,bi as z,zh as v}from"./chunk-m6a4rzdt.js";var B=(b)=>({queryKey:["projects",b],queryFn:async()=>{let h=await z.api.projects[":projectId"].$get({param:{projectId:b}});if(!h.ok)throw Error("Failed to fetch project");return await h.json()}}),H=w("/projects/$projectId/collections/")({loader:({context:{queryClient:b},params:{projectId:h}})=>b.ensureQueryData(B(h)),pendingComponent:()=>v(A,{})});
2
- export{B as Ff,H as Gf};
1
+ import{ef as A}from"./chunk-agdza65r.js";import{Hh as v,Yh as w,ji as z}from"./chunk-sjr6mvgm.js";var B=(b)=>({queryKey:["projects",b],queryFn:async()=>{let h=await z.api.projects[":projectId"].$get({param:{projectId:b}});if(!h.ok)throw Error("Failed to fetch project");return await h.json()}}),H=w("/projects/$projectId/collections/")({loader:({context:{queryClient:b},params:{projectId:h}})=>b.ensureQueryData(B(h)),pendingComponent:()=>v(A,{})});
2
+ export{B as Ve,H as We};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  function q(k){let b=3735928559,d=1103547991;for(let f=0;f<k.length;f++){let l=k.charCodeAt(f);b=Math.imul(b^l,2654435761),d=Math.imul(d^l,1597334677)}return b=Math.imul(b^b>>>16,2246822507)^Math.imul(d^d>>>13,3266489909),d=Math.imul(d^d>>>16,2246822507)^Math.imul(b^b>>>13,3266489909),(d>>>0).toString(36)+(b>>>0).toString(36)}
3
- export{q as Yk};
3
+ export{q as pl};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Nl as a,Ol as _}from"./chunk-dej1gq35.js";var f=_((J)=>{Object.defineProperty(J,"__esModule",{value:!0});J.Allow=J.ALL=J.COLLECTION=J.ATOM=J.SPECIAL=J.INF=J._INFINITY=J.INFINITY=J.NAN=J.BOOL=J.NULL=J.OBJ=J.ARR=J.NUM=J.STR=void 0;J.STR=1;J.NUM=2;J.ARR=4;J.OBJ=8;J.NULL=16;J.BOOL=32;J.NAN=64;J.INFINITY=128;J._INFINITY=256;J.INF=J.INFINITY|J._INFINITY;J.SPECIAL=J.NULL|J.BOOL|J.INF|J.NAN;J.ATOM=J.STR|J.NUM|J.SPECIAL;J.COLLECTION=J.ARR|J.OBJ;J.ALL=J.ATOM|J.COLLECTION;J.Allow={STR:J.STR,NUM:J.NUM,ARR:J.ARR,OBJ:J.OBJ,NULL:J.NULL,BOOL:J.BOOL,NAN:J.NAN,INFINITY:J.INFINITY,_INFINITY:J._INFINITY,INF:J.INF,SPECIAL:J.SPECIAL,ATOM:J.ATOM,COLLECTION:J.COLLECTION,ALL:J.ALL};J.default=J.Allow});var w=_((X)=>{var d=X&&X.__createBinding||(Object.create?function(F,G,H,z){if(z===void 0)z=H;var K=Object.getOwnPropertyDescriptor(G,H);if(!K||("get"in K?!G.__esModule:K.writable||K.configurable))K={enumerable:!0,get:function(){return G[H]}};Object.defineProperty(F,z,K)}:function(F,G,H,z){if(z===void 0)z=H;F[z]=G[H]}),x=X&&X.__exportStar||function(F,G){for(var H in F)if(H!=="default"&&!Object.prototype.hasOwnProperty.call(G,H))d(G,F,H)};Object.defineProperty(X,"__esModule",{value:!0});X.Allow=X.MalformedJSON=X.PartialJSON=X.parseJSON=X.parse=void 0;var Y=f();Object.defineProperty(X,"Allow",{enumerable:!0,get:function(){return Y.Allow}});x(f(),X);class b extends Error{}X.PartialJSON=b;class P extends Error{}X.MalformedJSON=P;function m(F,G=Y.Allow.ALL){if(typeof F!=="string")throw TypeError(`expecting str, got ${typeof F}`);if(!F.trim())throw Error(`${F} is empty`);return p(F.trim(),G)}X.parseJSON=m;var p=(F,G)=>{let H=F.length,z=0,K=(Q)=>{throw new b(`${Q} at position ${z}`)},$=(Q)=>{throw new P(`${Q} at position ${z}`)},U=()=>{if(V(),z>=H)K("Unexpected end of input");if(F[z]==='"')return O();if(F[z]==="{")return c();if(F[z]==="[")return j();if(F.substring(z,z+4)==="null"||Y.Allow.NULL&G&&H-z<4&&"null".startsWith(F.substring(z)))return z+=4,null;if(F.substring(z,z+4)==="true"||Y.Allow.BOOL&G&&H-z<4&&"true".startsWith(F.substring(z)))return z+=4,!0;if(F.substring(z,z+5)==="false"||Y.Allow.BOOL&G&&H-z<5&&"false".startsWith(F.substring(z)))return z+=5,!1;if(F.substring(z,z+8)==="Infinity"||Y.Allow.INFINITY&G&&H-z<8&&"Infinity".startsWith(F.substring(z)))return z+=8,1/0;if(F.substring(z,z+9)==="-Infinity"||Y.Allow._INFINITY&G&&1<H-z&&H-z<9&&"-Infinity".startsWith(F.substring(z)))return z+=9,-1/0;if(F.substring(z,z+3)==="NaN"||Y.Allow.NAN&G&&H-z<3&&"NaN".startsWith(F.substring(z)))return z+=3,NaN;return g()},O=()=>{let Q=z,Z=!1;z++;while(z<H&&(F[z]!=='"'||Z&&F[z-1]==="\\"))Z=F[z]==="\\"?!Z:!1,z++;if(F.charAt(z)=='"')try{return JSON.parse(F.substring(Q,++z-Number(Z)))}catch(q){$(String(q))}else if(Y.Allow.STR&G)try{return JSON.parse(F.substring(Q,z-Number(Z))+'"')}catch(q){return JSON.parse(F.substring(Q,F.lastIndexOf("\\"))+'"')}K("Unterminated string literal")},c=()=>{z++,V();let Q={};try{while(F[z]!=="}"){if(V(),z>=H&&Y.Allow.OBJ&G)return Q;let Z=O();V(),z++;try{let q=U();Q[Z]=q}catch(q){if(Y.Allow.OBJ&G)return Q;else throw q}if(V(),F[z]===",")z++}}catch(Z){if(Y.Allow.OBJ&G)return Q;else K("Expected '}' at end of object")}return z++,Q},j=()=>{z++;let Q=[];try{while(F[z]!=="]")if(Q.push(U()),V(),F[z]===",")z++}catch(Z){if(Y.Allow.ARR&G)return Q;K("Expected ']' at end of array")}return z++,Q},g=()=>{if(z===0){if(F==="-")$("Not sure what '-' is");try{return JSON.parse(F)}catch(Z){if(Y.Allow.NUM&G)try{return JSON.parse(F.substring(0,F.lastIndexOf("e")))}catch(q){}$(String(Z))}}let Q=z;if(F[z]==="-")z++;while(F[z]&&",]}".indexOf(F[z])===-1)z++;if(z==H&&!(Y.Allow.NUM&G))K("Unterminated number literal");try{return JSON.parse(F.substring(Q,z))}catch(Z){if(F.substring(Q,z)==="-")K("Not sure what '-' is");try{return JSON.parse(F.substring(Q,F.lastIndexOf("e")))}catch(q){$(String(q))}}},V=()=>{while(z<H&&`
2
+ import{em as a,fm as _}from"./chunk-2em77vjv.js";var f=_((J)=>{Object.defineProperty(J,"__esModule",{value:!0});J.Allow=J.ALL=J.COLLECTION=J.ATOM=J.SPECIAL=J.INF=J._INFINITY=J.INFINITY=J.NAN=J.BOOL=J.NULL=J.OBJ=J.ARR=J.NUM=J.STR=void 0;J.STR=1;J.NUM=2;J.ARR=4;J.OBJ=8;J.NULL=16;J.BOOL=32;J.NAN=64;J.INFINITY=128;J._INFINITY=256;J.INF=J.INFINITY|J._INFINITY;J.SPECIAL=J.NULL|J.BOOL|J.INF|J.NAN;J.ATOM=J.STR|J.NUM|J.SPECIAL;J.COLLECTION=J.ARR|J.OBJ;J.ALL=J.ATOM|J.COLLECTION;J.Allow={STR:J.STR,NUM:J.NUM,ARR:J.ARR,OBJ:J.OBJ,NULL:J.NULL,BOOL:J.BOOL,NAN:J.NAN,INFINITY:J.INFINITY,_INFINITY:J._INFINITY,INF:J.INF,SPECIAL:J.SPECIAL,ATOM:J.ATOM,COLLECTION:J.COLLECTION,ALL:J.ALL};J.default=J.Allow});var w=_((X)=>{var d=X&&X.__createBinding||(Object.create?function(F,G,H,z){if(z===void 0)z=H;var K=Object.getOwnPropertyDescriptor(G,H);if(!K||("get"in K?!G.__esModule:K.writable||K.configurable))K={enumerable:!0,get:function(){return G[H]}};Object.defineProperty(F,z,K)}:function(F,G,H,z){if(z===void 0)z=H;F[z]=G[H]}),x=X&&X.__exportStar||function(F,G){for(var H in F)if(H!=="default"&&!Object.prototype.hasOwnProperty.call(G,H))d(G,F,H)};Object.defineProperty(X,"__esModule",{value:!0});X.Allow=X.MalformedJSON=X.PartialJSON=X.parseJSON=X.parse=void 0;var Y=f();Object.defineProperty(X,"Allow",{enumerable:!0,get:function(){return Y.Allow}});x(f(),X);class b extends Error{}X.PartialJSON=b;class P extends Error{}X.MalformedJSON=P;function m(F,G=Y.Allow.ALL){if(typeof F!=="string")throw TypeError(`expecting str, got ${typeof F}`);if(!F.trim())throw Error(`${F} is empty`);return p(F.trim(),G)}X.parseJSON=m;var p=(F,G)=>{let H=F.length,z=0,K=(Q)=>{throw new b(`${Q} at position ${z}`)},$=(Q)=>{throw new P(`${Q} at position ${z}`)},U=()=>{if(V(),z>=H)K("Unexpected end of input");if(F[z]==='"')return O();if(F[z]==="{")return c();if(F[z]==="[")return j();if(F.substring(z,z+4)==="null"||Y.Allow.NULL&G&&H-z<4&&"null".startsWith(F.substring(z)))return z+=4,null;if(F.substring(z,z+4)==="true"||Y.Allow.BOOL&G&&H-z<4&&"true".startsWith(F.substring(z)))return z+=4,!0;if(F.substring(z,z+5)==="false"||Y.Allow.BOOL&G&&H-z<5&&"false".startsWith(F.substring(z)))return z+=5,!1;if(F.substring(z,z+8)==="Infinity"||Y.Allow.INFINITY&G&&H-z<8&&"Infinity".startsWith(F.substring(z)))return z+=8,1/0;if(F.substring(z,z+9)==="-Infinity"||Y.Allow._INFINITY&G&&1<H-z&&H-z<9&&"-Infinity".startsWith(F.substring(z)))return z+=9,-1/0;if(F.substring(z,z+3)==="NaN"||Y.Allow.NAN&G&&H-z<3&&"NaN".startsWith(F.substring(z)))return z+=3,NaN;return g()},O=()=>{let Q=z,Z=!1;z++;while(z<H&&(F[z]!=='"'||Z&&F[z-1]==="\\"))Z=F[z]==="\\"?!Z:!1,z++;if(F.charAt(z)=='"')try{return JSON.parse(F.substring(Q,++z-Number(Z)))}catch(q){$(String(q))}else if(Y.Allow.STR&G)try{return JSON.parse(F.substring(Q,z-Number(Z))+'"')}catch(q){return JSON.parse(F.substring(Q,F.lastIndexOf("\\"))+'"')}K("Unterminated string literal")},c=()=>{z++,V();let Q={};try{while(F[z]!=="}"){if(V(),z>=H&&Y.Allow.OBJ&G)return Q;let Z=O();V(),z++;try{let q=U();Q[Z]=q}catch(q){if(Y.Allow.OBJ&G)return Q;else throw q}if(V(),F[z]===",")z++}}catch(Z){if(Y.Allow.OBJ&G)return Q;else K("Expected '}' at end of object")}return z++,Q},j=()=>{z++;let Q=[];try{while(F[z]!=="]")if(Q.push(U()),V(),F[z]===",")z++}catch(Z){if(Y.Allow.ARR&G)return Q;K("Expected ']' at end of array")}return z++,Q},g=()=>{if(z===0){if(F==="-")$("Not sure what '-' is");try{return JSON.parse(F)}catch(Z){if(Y.Allow.NUM&G)try{return JSON.parse(F.substring(0,F.lastIndexOf("e")))}catch(q){}$(String(Z))}}let Q=z;if(F[z]==="-")z++;while(F[z]&&",]}".indexOf(F[z])===-1)z++;if(z==H&&!(Y.Allow.NUM&G))K("Unterminated number literal");try{return JSON.parse(F.substring(Q,z))}catch(Z){if(F.substring(Q,z)==="-")K("Not sure what '-' is");try{return JSON.parse(F.substring(Q,F.lastIndexOf("e")))}catch(q){$(String(q))}}},V=()=>{while(z<H&&`
3
3
  \r `.includes(F[z]))z++};return U()},l=m;X.parse=l});var N=a(w(),1),e=new Set(['"',"\\","/","b","f","n","r","t","u"]);function s(F){let G=F.codePointAt(0);return G!==void 0&&G>=0&&G<=31}function t(F){switch(F){case"\b":return"\\b";case"\f":return"\\f";case`
4
4
  `:return"\\n";case"\r":return"\\r";case"\t":return"\\t";default:return`\\u${F.codePointAt(0)?.toString(16).padStart(4,"0")??"0000"}`}}function k(F){let G="",H=!1;for(let z=0;z<F.length;z++){let K=F[z];if(!H){if(G+=K,K==='"')H=!0;continue}if(K==='"'){G+=K,H=!1;continue}if(K==="\\"){let $=F[z+1];if($===void 0){G+="\\\\";continue}if($==="u"){let U=F.slice(z+2,z+6);if(/^[0-9a-fA-F]{4}$/.test(U)){G+=`\\u${U}`,z+=5;continue}}if(e.has($)){G+=`\\${$}`,z+=1;continue}G+="\\\\";continue}G+=s(K)?t(K):K}return G}function i(F){try{return JSON.parse(F)}catch(G){let H=k(F);if(H!==F)return JSON.parse(H);throw G}}function n(F){if(!F||F.trim()==="")return{};try{return i(F)}catch{try{return N.parse(F)??{}}catch{try{return N.parse(k(F))??{}}catch{return{}}}}}
5
- export{i as bl,n as cl};
5
+ export{i as ul,n as vl};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Yk as D}from"./chunk-g60v3jc1.js";import{cl as B}from"./chunk-tzt4c1dm.js";import{rl as h,sl as z,tl as C,ul as b,zl as k}from"./chunk-p4c4z0f2.js";import{Al as H}from"./chunk-x6532q76.js";import{Hl as P}from"./chunk-81tb4v5v.js";function T(U,L){let X={v:1,id:U};if(L)X.phase=L;return JSON.stringify(X)}function x(U){if(!U)return;if(U.startsWith("{"))try{let L=JSON.parse(U);if(L.v===1&&typeof L.id==="string"){if(L.phase==="commentary"||L.phase==="final_answer")return{id:L.id,phase:L.phase};return{id:L.id}}}catch{}return{id:U}}function S(U,L){let X=L.filter((Y)=>Y.type==="text").map((Y)=>Y.text).join(`
2
+ import{pl as D}from"./chunk-ta02azkp.js";import{vl as B}from"./chunk-tfnh9sk9.js";import{Kl as h,Ll as z,Ml as C,Nl as b,Sl as k}from"./chunk-ph43tgr6.js";import{Tl as H}from"./chunk-mjxay7yv.js";import{_l as P}from"./chunk-h9f55mjv.js";function T(U,L){let X={v:1,id:U};if(L)X.phase=L;return JSON.stringify(X)}function x(U){if(!U)return;if(U.startsWith("{"))try{let L=JSON.parse(U);if(L.v===1&&typeof L.id==="string"){if(L.phase==="commentary"||L.phase==="final_answer")return{id:L.id,phase:L.phase};return{id:L.id}}}catch{}return{id:U}}function S(U,L){let X=L.filter((Y)=>Y.type==="text").map((Y)=>Y.text).join(`
3
3
  `),F=L.filter((Y)=>Y.type==="image"),$=X.length>0;if(F.length===0||!U.input.includes("image"))return H($?X:F.length>0?"(see attached image)":"(no tool output)");let V=[];if($)V.push({type:"input_text",text:H(X)});for(let Y of F)V.push({type:"input_image",detail:"auto",image_url:`data:${Y.mimeType};base64,${Y.data}`});return V}function p(U,L,X,F){let $=[],V=new Set,Y=(Z)=>{let _=Z.replace(/[^a-zA-Z0-9_-]/g,"_");return(_.length>64?_.slice(0,64):_).replace(/_+$/,"")},O=(Z)=>{let _=`fc_${D(Z)}`;return _.length>64?_.slice(0,64):_},W=(Z,_,q)=>{if(!X.has(U.provider))return Y(Z);if(!Z.includes("|"))return Y(Z);let[j,K]=Z.split("|"),Q=Y(j),N=q.provider!==U.provider||q.api!==U.api?O(K):Y(K);if(!N.startsWith("fc_"))N=Y(`fc_${N}`);return`${Q}|${N}`},G=k(L.messages,U,W);if((F?.includeSystemPrompt??!0)&&L.systemPrompt){let Z=U.compat,_=U.reasoning&&Z?.supportsDeveloperRole!==!1?"developer":"system";$.push({role:_,content:H(L.systemPrompt)})}let w=0;for(let Z of G){if(Z.role==="user")if(typeof Z.content==="string")$.push({role:"user",content:[{type:"input_text",text:H(Z.content)}]});else{let _=Z.content.map((q)=>{if(q.type==="text")return{type:"input_text",text:H(q.text)};return{type:"input_image",detail:"auto",image_url:`data:${q.mimeType};base64,${q.data}`}});if(_.length===0)continue;$.push({role:"user",content:_})}else if(Z.role==="assistant"){let _=[],q=Z,j=q.model!==U.id&&q.provider===U.provider&&q.api===U.api,K=0;for(let Q of Z.content)if(Q.type==="thinking"){if(Q.thinkingSignature){let A=JSON.parse(Q.thinkingSignature);_.push(A)}}else if(Q.type==="text"){let A=Q,N=x(A.textSignature),R=K===0?`msg_pi_${w}`:`msg_pi_${w}_${K}`;K++;let E=N?.id;if(!E)E=R;else if(E.length>64)E=`msg_${D(E)}`;_.push({type:"message",role:"assistant",content:[{type:"output_text",text:H(A.text),annotations:[]}],status:"completed",id:E,phase:N?.phase})}else if(Q.type==="toolCall"){let A=Q,[N,R]=A.id.split("|"),E=F?.grammarToolInputProperties?.get(A.name),J=R;if(j&&J?.startsWith("fc_")||E===void 0&&!J?.startsWith("fc_"))J=void 0;if(E!==void 0)_.push({type:"custom_tool_call",id:J,call_id:N,name:A.name,input:H(h(A.name,A.arguments,E))});else _.push({type:"function_call",id:J,call_id:N,name:A.name,arguments:JSON.stringify(A.arguments)})}if(_.length===0)continue;$.push(..._)}else if(Z.role==="toolResult"){let[_]=Z.toolCallId.split("|"),q=S(U,Z.content);if(F?.grammarToolInputProperties?.has(Z.toolName))$.push({type:"custom_tool_call_output",call_id:_,output:q});else $.push({type:"function_call_output",call_id:_,output:q});let j=[];for(let K of Z.addedToolNames??[]){let Q=F?.deferredTools?.get(K);if(!Q||V.has(K))continue;V.add(K),j.push(Q)}if(j.length>0){let K=j.map((A)=>A.name),Q=`pi_tool_load_${D(`${Z.toolCallId}:${K.join(",")}`)}`;$.push({type:"tool_search_call",call_id:Q,execution:"client",status:"completed",arguments:{query:K.join(" "),limit:K.length}}),$.push({type:"tool_search_output",call_id:Q,execution:"client",status:"completed",tools:v(j,{...F?.toolOptions,deferLoading:!0})})}}w++}return $}function v(U,L){let X=L?.strict===void 0?!1:L.strict,F=L?.supportsStrictMode??!0,$=L?.supportsOpenAIGrammarTools??!1;return U.map((V)=>{let Y=b(V,$);if(Y)return{type:"custom",name:V.name,description:V.description,format:{type:"grammar",syntax:Y.format,definition:Y.definition},...L?.deferLoading?{defer_loading:!0}:{}};let O=C(V,F),W={type:"function",name:V.name,description:V.description,parameters:V.parameters,...L?.deferLoading?{defer_loading:!0}:{}};if(F)W.strict=O??X;return W})}function y(U){let L=U.customInput?.property;if(L===void 0)return"";let X=U.arguments[L];return typeof X==="string"?X:""}function f(U,L,X){let F=U.customInput;if(!F)return;let $=z(F.jsonBuffer,F.property,L,X);return U.arguments={[F.property]:L},$}async function a(U,L,X,F,$){let V=!1,Y=new Map,O=new Map,W=(q,j)=>{let K=Y.get(q);return K?.type===j?K:void 0},G=(q,j)=>{if(j===void 0)return;X.push({type:"toolcall_delta",contentIndex:q.contentIndex,delta:j,partial:L})},M=(q,j)=>{if(j.type==="reasoning"){let K={type:"thinking",thinking:""};L.content.push(K);let Q={type:"thinking",block:K,contentIndex:L.content.length-1};return Y.set(q,Q),X.push({type:"thinking_start",contentIndex:Q.contentIndex,partial:L}),Q}if(j.type==="message"){let K={type:"text",text:""};L.content.push(K);let Q={type:"text",block:K,contentIndex:L.content.length-1};return Y.set(q,Q),X.push({type:"text_start",contentIndex:Q.contentIndex,partial:L}),Q}if(j.type==="function_call"){let K={type:"toolCall",id:`${j.call_id}|${j.id}`,name:j.name,arguments:{},partialJson:j.arguments||""};L.content.push(K);let Q={type:"toolCall",block:K,contentIndex:L.content.length-1};return Y.set(q,Q),X.push({type:"toolcall_start",contentIndex:Q.contentIndex,partial:L}),Q}if(j.type==="custom_tool_call"){let K=$?.grammarToolInputProperties?.get(j.name)??"input",Q=j.input||"",A={type:"toolCall",id:`${j.call_id}|${j.id}`,name:j.name,arguments:{[K]:Q},customInput:{property:K,jsonBuffer:{input:"",started:!1,closed:!1}}};L.content.push(A);let N={type:"toolCall",block:A,contentIndex:L.content.length-1};return Y.set(q,N),X.push({type:"toolcall_start",contentIndex:N.contentIndex,partial:L}),N}return},w=(q,j)=>{return Y.get(q)??M(q,j)},Z=(q)=>{for(let j of q){if(j.type!=="reasoning"||!j.encrypted_content)continue;let K=O.get(j.id);if(!K?.thinkingSignature)continue;let Q=JSON.parse(K.thinkingSignature);if(Q.encrypted_content)continue;K.thinkingSignature=JSON.stringify({...Q,encrypted_content:j.encrypted_content})}},_=(q)=>{if(V=!0,Z(q.output??[]),q?.id)L.responseId=q.id;if(q?.usage){let j=q.usage.input_tokens_details,K=j?.cached_tokens||0,Q=j?.cache_write_tokens||0;L.usage={input:Math.max(0,(q.usage.input_tokens||0)-K-Q),output:q.usage.output_tokens||0,cacheRead:K,cacheWrite:Q,reasoning:q.usage.output_tokens_details?.reasoning_tokens||0,totalTokens:q.usage.total_tokens||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}}}if(P(F,L.usage),$?.applyServiceTierPricing){let j=$.resolveServiceTier?$.resolveServiceTier(q?.service_tier,$.serviceTier):q?.service_tier??$.serviceTier;$.applyServiceTierPricing(L.usage,j)}if(L.stopReason=I(q?.status),L.content.some((j)=>j.type==="toolCall")&&L.stopReason==="stop")L.stopReason="toolUse"};for await(let q of U)if(q.type==="response.created")L.responseId=q.response.id;else if(q.type==="response.output_item.added")M(q.output_index,q.item);else if(q.type==="response.reasoning_summary_text.delta"){let j=W(q.output_index,"thinking");if(!j)continue;j.block.thinking+=q.delta,X.push({type:"thinking_delta",contentIndex:j.contentIndex,delta:q.delta,partial:L})}else if(q.type==="response.reasoning_summary_part.done"){let j=W(q.output_index,"thinking");if(!j)continue;j.block.thinking+=`
4
4
 
5
5
  `,X.push({type:"thinking_delta",contentIndex:j.contentIndex,delta:`
@@ -9,4 +9,4 @@ import{Yk as D}from"./chunk-g60v3jc1.js";import{cl as B}from"./chunk-tzt4c1dm.js
9
9
  `)||"",A=j.content?.map((N)=>N.text).join(`
10
10
 
11
11
  `)||"";K.block.thinking=Q||A||K.block.thinking,K.block.thinkingSignature=JSON.stringify(j),O.set(j.id,K.block),X.push({type:"thinking_end",contentIndex:K.contentIndex,content:K.block.thinking,partial:L}),Y.delete(q.output_index)}else if(j.type==="message"&&K?.type==="text")K.block.text=j.content?.map((Q)=>Q.type==="output_text"?Q.text:Q.refusal).join("")||"",K.block.textSignature=T(j.id,j.phase??void 0),X.push({type:"text_end",contentIndex:K.contentIndex,content:K.block.text,partial:L}),Y.delete(q.output_index);else if(j.type==="function_call"&&K?.type==="toolCall"&&K.block.partialJson!==void 0)K.block.arguments=B(j.arguments||K.block.partialJson||"{}"),delete K.block.partialJson,X.push({type:"toolcall_end",contentIndex:K.contentIndex,toolCall:K.block,partial:L}),Y.delete(q.output_index);else if(j.type==="custom_tool_call"&&K?.type==="toolCall"&&K.block.customInput)G(K,f(K.block,j.input??y(K.block),!0)),delete K.block.customInput,X.push({type:"toolcall_end",contentIndex:K.contentIndex,toolCall:K.block,partial:L}),Y.delete(q.output_index)}else if(q.type==="response.completed"||q.type==="response.incomplete")_(q.response);else if(q.type==="error")throw Error(`Error Code ${q.code}: ${q.message}`||"Unknown error");else if(q.type==="response.failed"){V=!0;let j=q.response?.error,K=q.response?.incomplete_details,Q=j?`${j.code||"unknown"}: ${j.message||"no message"}`:K?.reason?`incomplete: ${K.reason}`:"Unknown error (no error details in response)";throw Error(Q)}if(!V)throw Error("OpenAI Responses stream ended before a terminal response event")}function I(U){if(!U)return"stop";switch(U){case"completed":return"stop";case"incomplete":return"length";case"failed":case"cancelled":return"error";case"in_progress":case"queued":return"stop";default:throw Error(`Unhandled stop reason: ${U}`)}}
12
- export{p as Uk,v as Vk,a as Wk};
12
+ export{p as ll,v as ml,a as nl};
@@ -0,0 +1,2 @@
1
+ import{Hh as o,Qk as t,Wk as a}from"./chunk-sjr6mvgm.js";function m({className:r,orientation:i="horizontal",decorative:e=!0,...n}){return o(t.Root,{"data-slot":"separator",decorative:e,orientation:i,className:a("shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",r),...n})}
2
+ export{m as oa};
@@ -21,4 +21,4 @@ you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
21
21
  new OpenAI({ apiKey, dangerouslyAllowBrowser: true });
22
22
 
23
23
  https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
24
- `);this.baseURL=z.baseURL,this.timeout=z.timeout??x2.DEFAULT_TIMEOUT,this.logger=z.logger??console;let N="warn";this.logLevel=N,this.logLevel=Z2(z.logLevel,"ClientOptions.logLevel",this)??Z2(a("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??N,this.fetchOptions=z.fetchOptions,this.maxRetries=z.maxRetries??2,this.fetch=z.fetch??b2(),E(this,m0,g2,"f"),this._options=z,this.apiKey=typeof Z==="string"?Z:"Missing Key",this.organization=Y,this.project=$,this.webhookSecret=G}withOptions(X){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,organization:this.organization,project:this.project,webhookSecret:this.webhookSecret,...X})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:X,nulls:Z}){return}async authHeaders(X){return V([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery(X){return n2(X)}getUserAgent(){return`${this.constructor.name}/JS ${NX}`}defaultIdempotencyKey(){return`stainless-node-retry-${u0()}`}makeStatusError(X,Z,Y,$){return f.generate(X,Z,Y,$)}async _callApiKey(){let X=this._options.apiKey;if(typeof X!=="function")return!1;let Z;try{Z=await X()}catch(Y){if(Y instanceof U)throw Y;throw new U(`Failed to get token from 'apiKey' function: ${Y.message}`,{cause:Y})}if(typeof Z!=="string"||!Z)throw new U(`Expected 'apiKey' function argument to return a string but it returned ${Z}`);return this.apiKey=Z,!0}buildURL(X,Z,Y){let $=!K(this,O2,"m",y3).call(this)&&Y||this.baseURL,G=C2(X)?new URL(X):new URL($+($.endsWith("/")&&X.startsWith("/")?X.slice(1):X)),W=this.defaultQuery();if(!D2(W))Z={...W,...Z};if(typeof Z==="object"&&Z&&!Array.isArray(Z))G.search=this.stringifyQuery(Z);return G.toString()}async prepareOptions(X){await this._callApiKey()}async prepareRequest(X,{url:Z,options:Y}){}get(X,Z){return this.methodRequest("get",X,Z)}post(X,Z){return this.methodRequest("post",X,Z)}patch(X,Z){return this.methodRequest("patch",X,Z)}put(X,Z){return this.methodRequest("put",X,Z)}delete(X,Z){return this.methodRequest("delete",X,Z)}methodRequest(X,Z,Y){return this.request(Promise.resolve(Y).then(($)=>{return{method:X,path:Z,...$}}))}request(X,Z=null){return new xX(this,this.makeRequest(X,Z,void 0))}async makeRequest(X,Z,Y){let $=await X,G=$.maxRetries??this.maxRetries;if(Z==null)Z=G;await this.prepareOptions($);let{req:W,url:z,timeout:N}=await this.buildRequest($,{retryCount:G-Z});await this.prepareRequest(W,{url:z,options:$});let w="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),F=Y===void 0?"":`, retryOf: ${Y}`,M=Date.now();if(S(this).debug(`[${w}] sending request`,GX({retryOfRequestLogID:Y,method:$.method,url:z,options:$,headers:W.headers})),$.signal?.aborted)throw new I;let H=new AbortController,B=await this.fetchWithTimeout(z,W,N,H).catch(wZ),q=Date.now();if(B instanceof globalThis.Error){let C=`retrying, ${Z} attempts remaining`;if($.signal?.aborted)throw new I;let P=VZ(B)||/timed? ?out/i.test(String(B)+("cause"in B?String(B.cause):""));if(Z)return S(this).info(`[${w}] connection ${P?"timed out":"failed"} - ${C}`),S(this).debug(`[${w}] connection ${P?"timed out":"failed"} (${C})`,GX({retryOfRequestLogID:Y,url:z,durationMs:q-M,message:B.message})),this.retryRequest($,Z,Y??w);if(S(this).info(`[${w}] connection ${P?"timed out":"failed"} - error; no more retries left`),S(this).debug(`[${w}] connection ${P?"timed out":"failed"} (error; no more retries left)`,GX({retryOfRequestLogID:Y,url:z,durationMs:q-M,message:B.message})),P)throw new OX;throw new LX({cause:B})}let T=[...B.headers.entries()].filter(([C])=>C==="x-request-id").map(([C,P])=>", "+C+": "+JSON.stringify(P)).join(""),D=`[${w}${F}${T}] ${W.method} ${z} ${B.ok?"succeeded":"failed"} with status ${B.status} in ${q-M}ms`;if(!B.ok){let C=await this.shouldRetry(B);if(Z&&C){let j=`retrying, ${Z} attempts remaining`;return await v2(B.body),S(this).info(`${D} - ${j}`),S(this).debug(`[${w}] response error (${j})`,GX({retryOfRequestLogID:Y,url:B.url,status:B.status,headers:B.headers,durationMs:q-M})),this.retryRequest($,Z,Y??w,B.headers)}let P=C?"error; no more retries left":"error; not retryable";S(this).info(`${D} - ${P}`);let x=await B.text().catch((j)=>wZ(j).message),_=S2(x),R=_?void 0:x;throw S(this).debug(`[${w}] response error (${P})`,GX({retryOfRequestLogID:Y,url:B.url,status:B.status,headers:B.headers,message:R,durationMs:Date.now()-M})),this.makeStatusError(B.status,_,R,B.headers)}return S(this).info(D),S(this).debug(`[${w}] response start`,GX({retryOfRequestLogID:Y,url:B.url,status:B.status,headers:B.headers,durationMs:q-M})),{response:B,options:$,controller:H,requestLogID:w,retryOfRequestLogID:Y,startTime:M}}getAPIList(X,Z,Y){return this.requestAPIList(Z,Y&&"then"in Y?Y.then(($)=>({method:"get",path:X,...$})):{method:"get",path:X,...Y})}requestAPIList(X,Z){let Y=this.makeRequest(Z,null,void 0);return new q0(this,Y,X)}async fetchWithTimeout(X,Z,Y,$){let{signal:G,method:W,...z}=Z||{},N=this._makeAbort($);if(G)G.addEventListener("abort",N,{once:!0});let w=setTimeout(N,Y),F=globalThis.ReadableStream&&z.body instanceof globalThis.ReadableStream||typeof z.body==="object"&&z.body!==null&&Symbol.asyncIterator in z.body,M={signal:$.signal,...F?{duplex:"half"}:{},method:"GET",...z};if(W)M.method=W.toUpperCase();try{return await this.fetch.call(void 0,X,M)}finally{clearTimeout(w)}}async shouldRetry(X){let Z=X.headers.get("x-should-retry");if(Z==="true")return!0;if(Z==="false")return!1;if(X.status===408)return!0;if(X.status===409)return!0;if(X.status===429)return!0;if(X.status>=500)return!0;return!1}async retryRequest(X,Z,Y,$){let G,W=$?.get("retry-after-ms");if(W){let N=parseFloat(W);if(!Number.isNaN(N))G=N}let z=$?.get("retry-after");if(z&&!G){let N=parseFloat(z);if(!Number.isNaN(N))G=N*1000;else G=Date.parse(z)-Date.now()}if(G===void 0){let N=X.maxRetries??this.maxRetries;G=this.calculateDefaultRetryTimeoutMillis(Z,N)}return await s(G),this.makeRequest(X,Z-1,Y)}calculateDefaultRetryTimeoutMillis(X,Z){let G=Z-X,W=Math.min(0.5*Math.pow(2,G),8),z=1-Math.random()*0.25;return W*z*1000}async buildRequest(X,{retryCount:Z=0}={}){let Y={...X},{method:$,path:G,query:W,defaultBaseURL:z}=Y,N=this.buildURL(G,W,z);if("timeout"in Y)R2("timeout",Y.timeout);Y.timeout=Y.timeout??this.timeout;let{bodyHeaders:w,body:F}=this.buildBody({options:Y}),M=await this.buildHeaders({options:X,method:$,bodyHeaders:w,retryCount:Z});return{req:{method:$,headers:M,...Y.signal&&{signal:Y.signal},...globalThis.ReadableStream&&F instanceof globalThis.ReadableStream&&{duplex:"half"},...F&&{body:F},...this.fetchOptions??{},...Y.fetchOptions??{}},url:N,timeout:Y.timeout}}async buildHeaders({options:X,method:Z,bodyHeaders:Y,retryCount:$}){let G={};if(this.idempotencyHeader&&Z!=="get"){if(!X.idempotencyKey)X.idempotencyKey=this.defaultIdempotencyKey();G[this.idempotencyHeader]=X.idempotencyKey}let W=V([G,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String($),...X.timeout?{"X-Stainless-Timeout":String(Math.trunc(X.timeout/1000))}:{},...y2(),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project},await this.authHeaders(X),this._options.defaultHeaders,Y,X.headers]);return this.validateHeaders(W),W.values}_makeAbort(X){return()=>X.abort()}buildBody({options:{body:X,headers:Z}}){if(!X)return{bodyHeaders:void 0,body:void 0};let Y=V([Z]);if(ArrayBuffer.isView(X)||X instanceof ArrayBuffer||X instanceof DataView||typeof X==="string"&&Y.values.has("content-type")||globalThis.Blob&&X instanceof globalThis.Blob||X instanceof FormData||X instanceof URLSearchParams||globalThis.ReadableStream&&X instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:X};else if(typeof X==="object"&&((Symbol.asyncIterator in X)||(Symbol.iterator in X)&&("next"in X)&&typeof X.next==="function"))return{bodyHeaders:void 0,body:w0(X)};else if(typeof X==="object"&&Y.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(X)};else return K(this,m0,"f").call(this,{body:X,headers:Y})}}x2=L,m0=new WeakMap,O2=new WeakSet,y3=function(){return this.baseURL!=="https://api.openai.com/v1"};L.OpenAI=x2;L.DEFAULT_TIMEOUT=600000;L.OpenAIError=U;L.APIError=f;L.APIConnectionError=LX;L.APIConnectionTimeoutError=OX;L.APIUserAbortError=I;L.NotFoundError=TZ;L.ConflictError=MZ;L.RateLimitError=qZ;L.BadRequestError=HZ;L.AuthenticationError=UZ;L.InternalServerError=LZ;L.PermissionDeniedError=FZ;L.UnprocessableEntityError=EZ;L.InvalidWebhookSignatureError=$X;L.toFile=O0;L.Completions=sX;L.Chat=CX;L.Embeddings=oX;L.Files=XZ;L.Images=GZ;L.Audio=QX;L.Moderations=KZ;L.Models=WZ;L.FineTuning=ZX;L.Graders=bX;L.VectorStores=qX;L.Webhooks=NZ;L.Beta=XX;L.Batches=nX;L.Uploads=vX;L.Responses=MX;L.Realtime=FX;L.Conversations=IX;L.Evals=yX;L.Containers=jX;L.Skills=EX;L.Videos=QZ;class b3 extends L{constructor({baseURL:X=a("OPENAI_BASE_URL"),apiKey:Z=a("AZURE_OPENAI_API_KEY"),apiVersion:Y=a("OPENAI_API_VERSION"),endpoint:$,deployment:G,azureADTokenProvider:W,dangerouslyAllowBrowser:z,...N}={}){if(!Y)throw new U("The OPENAI_API_VERSION environment variable is missing or empty; either provide it, or instantiate the AzureOpenAI client with an apiVersion option, like new AzureOpenAI({ apiVersion: 'My API Version' }).");if(typeof W==="function")z=!0;if(!W&&!Z)throw new U("Missing credentials. Please pass one of `apiKey` and `azureADTokenProvider`, or set the `AZURE_OPENAI_API_KEY` environment variable.");if(W&&Z)throw new U("The `apiKey` and `azureADTokenProvider` arguments are mutually exclusive; only one can be passed at a time.");if(N.defaultQuery={...N.defaultQuery,"api-version":Y},!X){if(!$)$=process.env.AZURE_OPENAI_ENDPOINT;if(!$)throw new U("Must provide one of the `baseURL` or `endpoint` arguments, or the `AZURE_OPENAI_ENDPOINT` environment variable");X=`${$}/openai`}else if($)throw new U("baseURL and endpoint are mutually exclusive");super({apiKey:W??Z,baseURL:X,...N,...z!==void 0?{dangerouslyAllowBrowser:z}:{}});this.apiVersion="",this.apiVersion=Y,this.deploymentName=G}async buildRequest(X,Z={}){if(J8.has(X.path)&&X.method==="post"&&X.body!==void 0){if(!gX(X.body))throw Error("Expected request body to be an object");let Y=this.deploymentName||X.body.model||X.__metadata?.model;if(Y!==void 0&&!this.baseURL.includes("/deployments"))X.path=`/deployments/${Y}${X.path}`}return super.buildRequest(X,Z)}async authHeaders(X){if(typeof this._options.apiKey==="string")return V([{"api-key":this.apiKey}]);return super.authHeaders(X)}}var J8=new Set(["/completions","/chat/completions","/embeddings","/audio/transcriptions","/audio/translations","/audio/speech","/images/generations","/batches","/images/edits"]);export{L as Zk,b3 as _k};
24
+ `);this.baseURL=z.baseURL,this.timeout=z.timeout??x2.DEFAULT_TIMEOUT,this.logger=z.logger??console;let N="warn";this.logLevel=N,this.logLevel=Z2(z.logLevel,"ClientOptions.logLevel",this)??Z2(a("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??N,this.fetchOptions=z.fetchOptions,this.maxRetries=z.maxRetries??2,this.fetch=z.fetch??b2(),E(this,m0,g2,"f"),this._options=z,this.apiKey=typeof Z==="string"?Z:"Missing Key",this.organization=Y,this.project=$,this.webhookSecret=G}withOptions(X){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,organization:this.organization,project:this.project,webhookSecret:this.webhookSecret,...X})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:X,nulls:Z}){return}async authHeaders(X){return V([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery(X){return n2(X)}getUserAgent(){return`${this.constructor.name}/JS ${NX}`}defaultIdempotencyKey(){return`stainless-node-retry-${u0()}`}makeStatusError(X,Z,Y,$){return f.generate(X,Z,Y,$)}async _callApiKey(){let X=this._options.apiKey;if(typeof X!=="function")return!1;let Z;try{Z=await X()}catch(Y){if(Y instanceof U)throw Y;throw new U(`Failed to get token from 'apiKey' function: ${Y.message}`,{cause:Y})}if(typeof Z!=="string"||!Z)throw new U(`Expected 'apiKey' function argument to return a string but it returned ${Z}`);return this.apiKey=Z,!0}buildURL(X,Z,Y){let $=!K(this,O2,"m",y3).call(this)&&Y||this.baseURL,G=C2(X)?new URL(X):new URL($+($.endsWith("/")&&X.startsWith("/")?X.slice(1):X)),W=this.defaultQuery();if(!D2(W))Z={...W,...Z};if(typeof Z==="object"&&Z&&!Array.isArray(Z))G.search=this.stringifyQuery(Z);return G.toString()}async prepareOptions(X){await this._callApiKey()}async prepareRequest(X,{url:Z,options:Y}){}get(X,Z){return this.methodRequest("get",X,Z)}post(X,Z){return this.methodRequest("post",X,Z)}patch(X,Z){return this.methodRequest("patch",X,Z)}put(X,Z){return this.methodRequest("put",X,Z)}delete(X,Z){return this.methodRequest("delete",X,Z)}methodRequest(X,Z,Y){return this.request(Promise.resolve(Y).then(($)=>{return{method:X,path:Z,...$}}))}request(X,Z=null){return new xX(this,this.makeRequest(X,Z,void 0))}async makeRequest(X,Z,Y){let $=await X,G=$.maxRetries??this.maxRetries;if(Z==null)Z=G;await this.prepareOptions($);let{req:W,url:z,timeout:N}=await this.buildRequest($,{retryCount:G-Z});await this.prepareRequest(W,{url:z,options:$});let w="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),F=Y===void 0?"":`, retryOf: ${Y}`,M=Date.now();if(S(this).debug(`[${w}] sending request`,GX({retryOfRequestLogID:Y,method:$.method,url:z,options:$,headers:W.headers})),$.signal?.aborted)throw new I;let H=new AbortController,B=await this.fetchWithTimeout(z,W,N,H).catch(wZ),q=Date.now();if(B instanceof globalThis.Error){let C=`retrying, ${Z} attempts remaining`;if($.signal?.aborted)throw new I;let P=VZ(B)||/timed? ?out/i.test(String(B)+("cause"in B?String(B.cause):""));if(Z)return S(this).info(`[${w}] connection ${P?"timed out":"failed"} - ${C}`),S(this).debug(`[${w}] connection ${P?"timed out":"failed"} (${C})`,GX({retryOfRequestLogID:Y,url:z,durationMs:q-M,message:B.message})),this.retryRequest($,Z,Y??w);if(S(this).info(`[${w}] connection ${P?"timed out":"failed"} - error; no more retries left`),S(this).debug(`[${w}] connection ${P?"timed out":"failed"} (error; no more retries left)`,GX({retryOfRequestLogID:Y,url:z,durationMs:q-M,message:B.message})),P)throw new OX;throw new LX({cause:B})}let T=[...B.headers.entries()].filter(([C])=>C==="x-request-id").map(([C,P])=>", "+C+": "+JSON.stringify(P)).join(""),D=`[${w}${F}${T}] ${W.method} ${z} ${B.ok?"succeeded":"failed"} with status ${B.status} in ${q-M}ms`;if(!B.ok){let C=await this.shouldRetry(B);if(Z&&C){let j=`retrying, ${Z} attempts remaining`;return await v2(B.body),S(this).info(`${D} - ${j}`),S(this).debug(`[${w}] response error (${j})`,GX({retryOfRequestLogID:Y,url:B.url,status:B.status,headers:B.headers,durationMs:q-M})),this.retryRequest($,Z,Y??w,B.headers)}let P=C?"error; no more retries left":"error; not retryable";S(this).info(`${D} - ${P}`);let x=await B.text().catch((j)=>wZ(j).message),_=S2(x),R=_?void 0:x;throw S(this).debug(`[${w}] response error (${P})`,GX({retryOfRequestLogID:Y,url:B.url,status:B.status,headers:B.headers,message:R,durationMs:Date.now()-M})),this.makeStatusError(B.status,_,R,B.headers)}return S(this).info(D),S(this).debug(`[${w}] response start`,GX({retryOfRequestLogID:Y,url:B.url,status:B.status,headers:B.headers,durationMs:q-M})),{response:B,options:$,controller:H,requestLogID:w,retryOfRequestLogID:Y,startTime:M}}getAPIList(X,Z,Y){return this.requestAPIList(Z,Y&&"then"in Y?Y.then(($)=>({method:"get",path:X,...$})):{method:"get",path:X,...Y})}requestAPIList(X,Z){let Y=this.makeRequest(Z,null,void 0);return new q0(this,Y,X)}async fetchWithTimeout(X,Z,Y,$){let{signal:G,method:W,...z}=Z||{},N=this._makeAbort($);if(G)G.addEventListener("abort",N,{once:!0});let w=setTimeout(N,Y),F=globalThis.ReadableStream&&z.body instanceof globalThis.ReadableStream||typeof z.body==="object"&&z.body!==null&&Symbol.asyncIterator in z.body,M={signal:$.signal,...F?{duplex:"half"}:{},method:"GET",...z};if(W)M.method=W.toUpperCase();try{return await this.fetch.call(void 0,X,M)}finally{clearTimeout(w)}}async shouldRetry(X){let Z=X.headers.get("x-should-retry");if(Z==="true")return!0;if(Z==="false")return!1;if(X.status===408)return!0;if(X.status===409)return!0;if(X.status===429)return!0;if(X.status>=500)return!0;return!1}async retryRequest(X,Z,Y,$){let G,W=$?.get("retry-after-ms");if(W){let N=parseFloat(W);if(!Number.isNaN(N))G=N}let z=$?.get("retry-after");if(z&&!G){let N=parseFloat(z);if(!Number.isNaN(N))G=N*1000;else G=Date.parse(z)-Date.now()}if(G===void 0){let N=X.maxRetries??this.maxRetries;G=this.calculateDefaultRetryTimeoutMillis(Z,N)}return await s(G),this.makeRequest(X,Z-1,Y)}calculateDefaultRetryTimeoutMillis(X,Z){let G=Z-X,W=Math.min(0.5*Math.pow(2,G),8),z=1-Math.random()*0.25;return W*z*1000}async buildRequest(X,{retryCount:Z=0}={}){let Y={...X},{method:$,path:G,query:W,defaultBaseURL:z}=Y,N=this.buildURL(G,W,z);if("timeout"in Y)R2("timeout",Y.timeout);Y.timeout=Y.timeout??this.timeout;let{bodyHeaders:w,body:F}=this.buildBody({options:Y}),M=await this.buildHeaders({options:X,method:$,bodyHeaders:w,retryCount:Z});return{req:{method:$,headers:M,...Y.signal&&{signal:Y.signal},...globalThis.ReadableStream&&F instanceof globalThis.ReadableStream&&{duplex:"half"},...F&&{body:F},...this.fetchOptions??{},...Y.fetchOptions??{}},url:N,timeout:Y.timeout}}async buildHeaders({options:X,method:Z,bodyHeaders:Y,retryCount:$}){let G={};if(this.idempotencyHeader&&Z!=="get"){if(!X.idempotencyKey)X.idempotencyKey=this.defaultIdempotencyKey();G[this.idempotencyHeader]=X.idempotencyKey}let W=V([G,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String($),...X.timeout?{"X-Stainless-Timeout":String(Math.trunc(X.timeout/1000))}:{},...y2(),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project},await this.authHeaders(X),this._options.defaultHeaders,Y,X.headers]);return this.validateHeaders(W),W.values}_makeAbort(X){return()=>X.abort()}buildBody({options:{body:X,headers:Z}}){if(!X)return{bodyHeaders:void 0,body:void 0};let Y=V([Z]);if(ArrayBuffer.isView(X)||X instanceof ArrayBuffer||X instanceof DataView||typeof X==="string"&&Y.values.has("content-type")||globalThis.Blob&&X instanceof globalThis.Blob||X instanceof FormData||X instanceof URLSearchParams||globalThis.ReadableStream&&X instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:X};else if(typeof X==="object"&&((Symbol.asyncIterator in X)||(Symbol.iterator in X)&&("next"in X)&&typeof X.next==="function"))return{bodyHeaders:void 0,body:w0(X)};else if(typeof X==="object"&&Y.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(X)};else return K(this,m0,"f").call(this,{body:X,headers:Y})}}x2=L,m0=new WeakMap,O2=new WeakSet,y3=function(){return this.baseURL!=="https://api.openai.com/v1"};L.OpenAI=x2;L.DEFAULT_TIMEOUT=600000;L.OpenAIError=U;L.APIError=f;L.APIConnectionError=LX;L.APIConnectionTimeoutError=OX;L.APIUserAbortError=I;L.NotFoundError=TZ;L.ConflictError=MZ;L.RateLimitError=qZ;L.BadRequestError=HZ;L.AuthenticationError=UZ;L.InternalServerError=LZ;L.PermissionDeniedError=FZ;L.UnprocessableEntityError=EZ;L.InvalidWebhookSignatureError=$X;L.toFile=O0;L.Completions=sX;L.Chat=CX;L.Embeddings=oX;L.Files=XZ;L.Images=GZ;L.Audio=QX;L.Moderations=KZ;L.Models=WZ;L.FineTuning=ZX;L.Graders=bX;L.VectorStores=qX;L.Webhooks=NZ;L.Beta=XX;L.Batches=nX;L.Uploads=vX;L.Responses=MX;L.Realtime=FX;L.Conversations=IX;L.Evals=yX;L.Containers=jX;L.Skills=EX;L.Videos=QZ;class b3 extends L{constructor({baseURL:X=a("OPENAI_BASE_URL"),apiKey:Z=a("AZURE_OPENAI_API_KEY"),apiVersion:Y=a("OPENAI_API_VERSION"),endpoint:$,deployment:G,azureADTokenProvider:W,dangerouslyAllowBrowser:z,...N}={}){if(!Y)throw new U("The OPENAI_API_VERSION environment variable is missing or empty; either provide it, or instantiate the AzureOpenAI client with an apiVersion option, like new AzureOpenAI({ apiVersion: 'My API Version' }).");if(typeof W==="function")z=!0;if(!W&&!Z)throw new U("Missing credentials. Please pass one of `apiKey` and `azureADTokenProvider`, or set the `AZURE_OPENAI_API_KEY` environment variable.");if(W&&Z)throw new U("The `apiKey` and `azureADTokenProvider` arguments are mutually exclusive; only one can be passed at a time.");if(N.defaultQuery={...N.defaultQuery,"api-version":Y},!X){if(!$)$=process.env.AZURE_OPENAI_ENDPOINT;if(!$)throw new U("Must provide one of the `baseURL` or `endpoint` arguments, or the `AZURE_OPENAI_ENDPOINT` environment variable");X=`${$}/openai`}else if($)throw new U("baseURL and endpoint are mutually exclusive");super({apiKey:W??Z,baseURL:X,...N,...z!==void 0?{dangerouslyAllowBrowser:z}:{}});this.apiVersion="",this.apiVersion=Y,this.deploymentName=G}async buildRequest(X,Z={}){if(J8.has(X.path)&&X.method==="post"&&X.body!==void 0){if(!gX(X.body))throw Error("Expected request body to be an object");let Y=this.deploymentName||X.body.model||X.__metadata?.model;if(Y!==void 0&&!this.baseURL.includes("/deployments"))X.path=`/deployments/${Y}${X.path}`}return super.buildRequest(X,Z)}async authHeaders(X){if(typeof this._options.apiKey==="string")return V([{"api-key":this.apiKey}]);return super.authHeaders(X)}}var J8=new Set(["/completions","/chat/completions","/embeddings","/audio/transcriptions","/audio/translations","/audio/speech","/images/generations","/batches","/images/edits"]);export{L as ql,b3 as rl};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Rk as _1}from"./chunk-3xzgddev.js";import{Sk as P1,Tk as f1}from"./chunk-2086rsb2.js";import{$k as D1}from"./chunk-6zs49mef.js";import{al as B1}from"./chunk-hqkmdp31.js";import{bl as j1,cl as S0}from"./chunk-tzt4c1dm.js";import{tl as T1,wl as I1,xl as R1,yl as k1,zl as y1}from"./chunk-p4c4z0f2.js";import{Al as c}from"./chunk-x6532q76.js";import{Bl as S1}from"./chunk-gjdmnfms.js";import{Hl as j0}from"./chunk-81tb4v5v.js";import{Jl as A1}from"./chunk-a0k1b4sq.js";import"./chunk-dej1gq35.js";function U(X,Z,$,W,Y){if(W==="m")throw TypeError("Private method is not writable");if(W==="a"&&!Y)throw TypeError("Private accessor was defined without a setter");if(typeof Z==="function"?X!==Z||!Y:!Z.has(X))throw TypeError("Cannot write private member to an object whose class did not declare it");return W==="a"?Y.call(X,$):Y?Y.value=$:Z.set(X,$),$}function z(X,Z,$,W){if($==="a"&&!W)throw TypeError("Private accessor was defined without a getter");if(typeof Z==="function"?X!==Z||!W:!Z.has(X))throw TypeError("Cannot read private member from an object whose class did not declare it");return $==="m"?W:$==="a"?W.call(X):W?W.value:Z.get(X)}var pZ=function(){let{crypto:X}=globalThis;if(X?.randomUUID)return pZ=X.randomUUID.bind(X),X.randomUUID();let Z=new Uint8Array(1),$=X?()=>X.getRandomValues(Z)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(W)=>(+W^$()&15>>+W/4).toString(16))};function d(X){return typeof X==="object"&&X!==null&&(("name"in X)&&X.name==="AbortError"||("message"in X)&&String(X.message).includes("FetchRequestCanceledException"))}var xX=(X)=>{if(X instanceof Error)return X;if(typeof X==="object"&&X!==null){try{if(Object.prototype.toString.call(X)==="[object Error]"){let Z=Error(X.message,X.cause?{cause:X.cause}:{});if(X.stack)Z.stack=X.stack;if(X.cause&&!Z.cause)Z.cause=X.cause;if(X.name)Z.name=X.name;return Z}}catch{}try{return Error(JSON.stringify(X))}catch{}}return Error(X)};class C extends Error{}class A extends C{constructor(X,Z,$,W,Y){super(`${A.makeMessage(X,Z,$)}`);this.status=X,this.headers=W,this.requestID=W?.get("request-id"),this.error=Z,this.type=Y??null}static makeMessage(X,Z,$){let W=Z?.message?typeof Z.message==="string"?Z.message:JSON.stringify(Z.message):Z?JSON.stringify(Z):$;if(X&&W)return`${X} ${W}`;if(X)return`${X} status code (no body)`;if(W)return W;return"(no status code or body)"}static generate(X,Z,$,W){if(!X||!W)return new s({message:$,cause:xX(Z)});let Y=Z,J=Y?.error?.type;if(X===400)return new FX(X,Y,$,W,J);if(X===401)return new LX(X,Y,$,W,J);if(X===403)return new AX(X,Y,$,W,J);if(X===404)return new jX(X,Y,$,W,J);if(X===409)return new SX(X,Y,$,W,J);if(X===422)return new BX(X,Y,$,W,J);if(X===429)return new DX(X,Y,$,W,J);if(X>=500)return new TX(X,Y,$,W,J);return new A(X,Y,$,W,J)}}class D extends A{constructor({message:X}={}){super(void 0,void 0,X||"Request was aborted.",void 0)}}class s extends A{constructor({message:X,cause:Z}){super(void 0,void 0,X||"Connection error.",void 0);if(Z)this.cause=Z}}class HX extends s{constructor({message:X}={}){super({message:X??"Request timed out."})}}class FX extends A{}class LX extends A{}class AX extends A{}class jX extends A{}class SX extends A{}class BX extends A{}class DX extends A{}class TX extends A{}var c1=/^[a-z][a-z0-9+.-]*:/i,P0=(X)=>{return c1.test(X)},lZ=(X)=>(lZ=Array.isArray,lZ(X)),iZ=lZ;function qZ(X){if(typeof X!=="object")return{};return X??{}}function nZ(X){if(!X)return!0;for(let Z in X)return!1;return!0}function f0(X,Z){return Object.prototype.hasOwnProperty.call(X,Z)}var I0=(X,Z)=>{if(typeof Z!=="number"||!Number.isInteger(Z))throw new C(`${X} must be an integer`);if(Z<0)throw new C(`${X} must be a positive integer`);return Z};var CZ=(X)=>{try{return JSON.parse(X)}catch(Z){return}};var R0=(X)=>new Promise((Z)=>setTimeout(Z,X));var i="0.91.1";var h0=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"};function d1(){if(typeof Deno<"u"&&Deno.build!=null)return"deno";if(typeof EdgeRuntime<"u")return"edge";if(Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]")return"node";return"unknown"}var m1=()=>{let X=d1();if(X==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":i,"X-Stainless-OS":y0(Deno.build.os),"X-Stainless-Arch":k0(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version==="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":i,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(X==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":i,"X-Stainless-OS":y0(globalThis.process.platform??"unknown"),"X-Stainless-Arch":k0(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let Z=u1();if(Z)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":i,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${Z.browser}`,"X-Stainless-Runtime-Version":Z.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":i,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function u1(){if(typeof navigator>"u"||!navigator)return null;let X=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:Z,pattern:$}of X){let W=$.exec(navigator.userAgent);if(W){let Y=W[1]||0,J=W[2]||0,Q=W[3]||0;return{browser:Z,version:`${Y}.${J}.${Q}`}}}return null}var k0=(X)=>{if(X==="x32")return"x32";if(X==="x86_64"||X==="x64")return"x64";if(X==="arm")return"arm";if(X==="aarch64"||X==="arm64")return"arm64";if(X)return`other:${X}`;return"unknown"},y0=(X)=>{if(X=X.toLowerCase(),X.includes("ios"))return"iOS";if(X==="android")return"Android";if(X==="darwin")return"MacOS";if(X==="win32")return"Windows";if(X==="freebsd")return"FreeBSD";if(X==="openbsd")return"OpenBSD";if(X==="linux")return"Linux";if(X)return`Other:${X}`;return"Unknown"},_0,g0=()=>{return _0??(_0=m1())};function b0(){if(typeof fetch<"u")return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function rZ(...X){let Z=globalThis.ReadableStream;if(typeof Z>"u")throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new Z(...X)}function OZ(X){let Z=Symbol.asyncIterator in X?X[Symbol.asyncIterator]():X[Symbol.iterator]();return rZ({start(){},async pull($){let{done:W,value:Y}=await Z.next();if(W)$.close();else $.enqueue(Y)},async cancel(){await Z.return?.()}})}function PX(X){if(X[Symbol.asyncIterator])return X;let Z=X.getReader();return{async next(){try{let $=await Z.read();if($?.done)Z.releaseLock();return $}catch($){throw Z.releaseLock(),$}},async return(){let $=Z.cancel();return Z.releaseLock(),await $,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function v0(X){if(X===null||typeof X!=="object")return;if(X[Symbol.asyncIterator]){await X[Symbol.asyncIterator]().return?.();return}let Z=X.getReader(),$=Z.cancel();Z.releaseLock(),await $}var c0=({headers:X,body:Z})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(Z)}};function d0(X){return Object.entries(X).filter(([Z,$])=>typeof $<"u").map(([Z,$])=>{if(typeof $==="string"||typeof $==="number"||typeof $==="boolean")return`${encodeURIComponent(Z)}=${encodeURIComponent($)}`;if($===null)return`${encodeURIComponent(Z)}=`;throw new C(`Cannot stringify type ${typeof $}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}function p0(X){let Z=0;for(let Y of X)Z+=Y.length;let $=new Uint8Array(Z),W=0;for(let Y of X)$.set(Y,W),W+=Y.length;return $}var m0;function fX(X){let Z;return(m0??(Z=new globalThis.TextEncoder,m0=Z.encode.bind(Z)))(X)}var u0;function aZ(X){let Z;return(u0??(Z=new globalThis.TextDecoder,u0=Z.decode.bind(Z)))(X)}var f,I;class n{constructor(){f.set(this,void 0),I.set(this,void 0),U(this,f,new Uint8Array,"f"),U(this,I,null,"f")}decode(X){if(X==null)return[];let Z=X instanceof ArrayBuffer?new Uint8Array(X):typeof X==="string"?fX(X):X;U(this,f,p0([z(this,f,"f"),Z]),"f");let $=[],W;while((W=i1(z(this,f,"f"),z(this,I,"f")))!=null){if(W.carriage&&z(this,I,"f")==null){U(this,I,W.index,"f");continue}if(z(this,I,"f")!=null&&(W.index!==z(this,I,"f")+1||W.carriage)){$.push(aZ(z(this,f,"f").subarray(0,z(this,I,"f")-1))),U(this,f,z(this,f,"f").subarray(z(this,I,"f")),"f"),U(this,I,null,"f");continue}let Y=z(this,I,"f")!==null?W.preceding-1:W.preceding,J=aZ(z(this,f,"f").subarray(0,Y));$.push(J),U(this,f,z(this,f,"f").subarray(W.index),"f"),U(this,I,null,"f")}return $}flush(){if(!z(this,f,"f").length)return[];return this.decode(`
2
+ import{il as _1}from"./chunk-pqtwzb3s.js";import{jl as P1,kl as f1}from"./chunk-9acfydwy.js";import{sl as D1}from"./chunk-antsxrw9.js";import{tl as B1}from"./chunk-21rp4vzr.js";import{ul as j1,vl as S0}from"./chunk-tfnh9sk9.js";import{Ml as T1,Pl as I1,Ql as R1,Rl as k1,Sl as y1}from"./chunk-ph43tgr6.js";import{Tl as c}from"./chunk-mjxay7yv.js";import{Ul as S1}from"./chunk-r5rf62aa.js";import{_l as j0}from"./chunk-h9f55mjv.js";import{am as A1}from"./chunk-m7d52gfe.js";import"./chunk-2em77vjv.js";function U(X,Z,$,W,Y){if(W==="m")throw TypeError("Private method is not writable");if(W==="a"&&!Y)throw TypeError("Private accessor was defined without a setter");if(typeof Z==="function"?X!==Z||!Y:!Z.has(X))throw TypeError("Cannot write private member to an object whose class did not declare it");return W==="a"?Y.call(X,$):Y?Y.value=$:Z.set(X,$),$}function z(X,Z,$,W){if($==="a"&&!W)throw TypeError("Private accessor was defined without a getter");if(typeof Z==="function"?X!==Z||!W:!Z.has(X))throw TypeError("Cannot read private member from an object whose class did not declare it");return $==="m"?W:$==="a"?W.call(X):W?W.value:Z.get(X)}var pZ=function(){let{crypto:X}=globalThis;if(X?.randomUUID)return pZ=X.randomUUID.bind(X),X.randomUUID();let Z=new Uint8Array(1),$=X?()=>X.getRandomValues(Z)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(W)=>(+W^$()&15>>+W/4).toString(16))};function d(X){return typeof X==="object"&&X!==null&&(("name"in X)&&X.name==="AbortError"||("message"in X)&&String(X.message).includes("FetchRequestCanceledException"))}var xX=(X)=>{if(X instanceof Error)return X;if(typeof X==="object"&&X!==null){try{if(Object.prototype.toString.call(X)==="[object Error]"){let Z=Error(X.message,X.cause?{cause:X.cause}:{});if(X.stack)Z.stack=X.stack;if(X.cause&&!Z.cause)Z.cause=X.cause;if(X.name)Z.name=X.name;return Z}}catch{}try{return Error(JSON.stringify(X))}catch{}}return Error(X)};class C extends Error{}class A extends C{constructor(X,Z,$,W,Y){super(`${A.makeMessage(X,Z,$)}`);this.status=X,this.headers=W,this.requestID=W?.get("request-id"),this.error=Z,this.type=Y??null}static makeMessage(X,Z,$){let W=Z?.message?typeof Z.message==="string"?Z.message:JSON.stringify(Z.message):Z?JSON.stringify(Z):$;if(X&&W)return`${X} ${W}`;if(X)return`${X} status code (no body)`;if(W)return W;return"(no status code or body)"}static generate(X,Z,$,W){if(!X||!W)return new s({message:$,cause:xX(Z)});let Y=Z,J=Y?.error?.type;if(X===400)return new FX(X,Y,$,W,J);if(X===401)return new LX(X,Y,$,W,J);if(X===403)return new AX(X,Y,$,W,J);if(X===404)return new jX(X,Y,$,W,J);if(X===409)return new SX(X,Y,$,W,J);if(X===422)return new BX(X,Y,$,W,J);if(X===429)return new DX(X,Y,$,W,J);if(X>=500)return new TX(X,Y,$,W,J);return new A(X,Y,$,W,J)}}class D extends A{constructor({message:X}={}){super(void 0,void 0,X||"Request was aborted.",void 0)}}class s extends A{constructor({message:X,cause:Z}){super(void 0,void 0,X||"Connection error.",void 0);if(Z)this.cause=Z}}class HX extends s{constructor({message:X}={}){super({message:X??"Request timed out."})}}class FX extends A{}class LX extends A{}class AX extends A{}class jX extends A{}class SX extends A{}class BX extends A{}class DX extends A{}class TX extends A{}var c1=/^[a-z][a-z0-9+.-]*:/i,P0=(X)=>{return c1.test(X)},lZ=(X)=>(lZ=Array.isArray,lZ(X)),iZ=lZ;function qZ(X){if(typeof X!=="object")return{};return X??{}}function nZ(X){if(!X)return!0;for(let Z in X)return!1;return!0}function f0(X,Z){return Object.prototype.hasOwnProperty.call(X,Z)}var I0=(X,Z)=>{if(typeof Z!=="number"||!Number.isInteger(Z))throw new C(`${X} must be an integer`);if(Z<0)throw new C(`${X} must be a positive integer`);return Z};var CZ=(X)=>{try{return JSON.parse(X)}catch(Z){return}};var R0=(X)=>new Promise((Z)=>setTimeout(Z,X));var i="0.91.1";var h0=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"};function d1(){if(typeof Deno<"u"&&Deno.build!=null)return"deno";if(typeof EdgeRuntime<"u")return"edge";if(Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]")return"node";return"unknown"}var m1=()=>{let X=d1();if(X==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":i,"X-Stainless-OS":y0(Deno.build.os),"X-Stainless-Arch":k0(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version==="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":i,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(X==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":i,"X-Stainless-OS":y0(globalThis.process.platform??"unknown"),"X-Stainless-Arch":k0(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let Z=u1();if(Z)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":i,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${Z.browser}`,"X-Stainless-Runtime-Version":Z.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":i,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function u1(){if(typeof navigator>"u"||!navigator)return null;let X=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:Z,pattern:$}of X){let W=$.exec(navigator.userAgent);if(W){let Y=W[1]||0,J=W[2]||0,Q=W[3]||0;return{browser:Z,version:`${Y}.${J}.${Q}`}}}return null}var k0=(X)=>{if(X==="x32")return"x32";if(X==="x86_64"||X==="x64")return"x64";if(X==="arm")return"arm";if(X==="aarch64"||X==="arm64")return"arm64";if(X)return`other:${X}`;return"unknown"},y0=(X)=>{if(X=X.toLowerCase(),X.includes("ios"))return"iOS";if(X==="android")return"Android";if(X==="darwin")return"MacOS";if(X==="win32")return"Windows";if(X==="freebsd")return"FreeBSD";if(X==="openbsd")return"OpenBSD";if(X==="linux")return"Linux";if(X)return`Other:${X}`;return"Unknown"},_0,g0=()=>{return _0??(_0=m1())};function b0(){if(typeof fetch<"u")return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function rZ(...X){let Z=globalThis.ReadableStream;if(typeof Z>"u")throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new Z(...X)}function OZ(X){let Z=Symbol.asyncIterator in X?X[Symbol.asyncIterator]():X[Symbol.iterator]();return rZ({start(){},async pull($){let{done:W,value:Y}=await Z.next();if(W)$.close();else $.enqueue(Y)},async cancel(){await Z.return?.()}})}function PX(X){if(X[Symbol.asyncIterator])return X;let Z=X.getReader();return{async next(){try{let $=await Z.read();if($?.done)Z.releaseLock();return $}catch($){throw Z.releaseLock(),$}},async return(){let $=Z.cancel();return Z.releaseLock(),await $,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function v0(X){if(X===null||typeof X!=="object")return;if(X[Symbol.asyncIterator]){await X[Symbol.asyncIterator]().return?.();return}let Z=X.getReader(),$=Z.cancel();Z.releaseLock(),await $}var c0=({headers:X,body:Z})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(Z)}};function d0(X){return Object.entries(X).filter(([Z,$])=>typeof $<"u").map(([Z,$])=>{if(typeof $==="string"||typeof $==="number"||typeof $==="boolean")return`${encodeURIComponent(Z)}=${encodeURIComponent($)}`;if($===null)return`${encodeURIComponent(Z)}=`;throw new C(`Cannot stringify type ${typeof $}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}function p0(X){let Z=0;for(let Y of X)Z+=Y.length;let $=new Uint8Array(Z),W=0;for(let Y of X)$.set(Y,W),W+=Y.length;return $}var m0;function fX(X){let Z;return(m0??(Z=new globalThis.TextEncoder,m0=Z.encode.bind(Z)))(X)}var u0;function aZ(X){let Z;return(u0??(Z=new globalThis.TextDecoder,u0=Z.decode.bind(Z)))(X)}var f,I;class n{constructor(){f.set(this,void 0),I.set(this,void 0),U(this,f,new Uint8Array,"f"),U(this,I,null,"f")}decode(X){if(X==null)return[];let Z=X instanceof ArrayBuffer?new Uint8Array(X):typeof X==="string"?fX(X):X;U(this,f,p0([z(this,f,"f"),Z]),"f");let $=[],W;while((W=i1(z(this,f,"f"),z(this,I,"f")))!=null){if(W.carriage&&z(this,I,"f")==null){U(this,I,W.index,"f");continue}if(z(this,I,"f")!=null&&(W.index!==z(this,I,"f")+1||W.carriage)){$.push(aZ(z(this,f,"f").subarray(0,z(this,I,"f")-1))),U(this,f,z(this,f,"f").subarray(z(this,I,"f")),"f"),U(this,I,null,"f");continue}let Y=z(this,I,"f")!==null?W.preceding-1:W.preceding,J=aZ(z(this,f,"f").subarray(0,Y));$.push(J),U(this,f,z(this,f,"f").subarray(W.index),"f"),U(this,I,null,"f")}return $}flush(){if(!z(this,f,"f").length)return[];return this.decode(`
3
3
  `)}}f=new WeakMap,I=new WeakMap;n.NEWLINE_CHARS=new Set([`
4
4
  `,"\r"]);n.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function i1(X,Z){for(let Y=Z??0;Y<X.length;Y++){if(X[Y]===10)return{preceding:Y,index:Y+1,carriage:!1};if(X[Y]===13)return{preceding:Y,index:Y+1,carriage:!0}}return null}function l0(X){for(let W=0;W<X.length-1;W++){if(X[W]===10&&X[W+1]===10)return W+2;if(X[W]===13&&X[W+1]===13)return W+2;if(X[W]===13&&X[W+1]===10&&W+3<X.length&&X[W+2]===13&&X[W+3]===10)return W+4}return-1}var MZ={off:0,error:200,warn:300,info:400,debug:500},oZ=(X,Z,$)=>{if(!X)return;if(f0(MZ,X))return X;S($).warn(`${Z} was set to ${JSON.stringify(X)}, expected one of ${JSON.stringify(Object.keys(MZ))}`);return};function IX(){}function EZ(X,Z,$){if(!Z||MZ[X]>MZ[$])return IX;else return Z[X].bind(Z)}var n1={error:IX,warn:IX,info:IX,debug:IX},i0=new WeakMap;function S(X){let Z=X.logger,$=X.logLevel??"off";if(!Z)return n1;let W=i0.get(Z);if(W&&W[0]===$)return W[1];let Y={error:EZ("error",Z,$),warn:EZ("warn",Z,$),info:EZ("info",Z,$),debug:EZ("debug",Z,$)};return i0.set(Z,[$,Y]),Y}var m=(X)=>{if(X.options)X.options={...X.options},delete X.options.headers;if(X.headers)X.headers=Object.fromEntries((X.headers instanceof Headers?[...X.headers]:Object.entries(X.headers)).map(([Z,$])=>[Z,Z.toLowerCase()==="x-api-key"||Z.toLowerCase()==="authorization"||Z.toLowerCase()==="cookie"||Z.toLowerCase()==="set-cookie"?"***":$]));if("retryOfRequestLogID"in X){if(X.retryOfRequestLogID)X.retryOf=X.retryOfRequestLogID;delete X.retryOfRequestLogID}return X};var RX;class R{constructor(X,Z,$){this.iterator=X,RX.set(this,void 0),this.controller=Z,U(this,RX,$,"f")}static fromSSEResponse(X,Z,$){let W=!1,Y=$?S($):console;async function*J(){if(W)throw new C("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");W=!0;let Q=!1;try{for await(let w of r1(X,Z)){if(w.event==="completion")try{yield JSON.parse(w.data)}catch(G){throw Y.error("Could not parse message into JSON:",w.data),Y.error("From chunk:",w.raw),G}if(w.event==="message_start"||w.event==="message_delta"||w.event==="message_stop"||w.event==="content_block_start"||w.event==="content_block_delta"||w.event==="content_block_stop"||w.event==="message"||w.event==="user.message"||w.event==="user.interrupt"||w.event==="user.tool_confirmation"||w.event==="user.custom_tool_result"||w.event==="agent.message"||w.event==="agent.thinking"||w.event==="agent.tool_use"||w.event==="agent.tool_result"||w.event==="agent.mcp_tool_use"||w.event==="agent.mcp_tool_result"||w.event==="agent.custom_tool_use"||w.event==="agent.thread_context_compacted"||w.event==="session.status_running"||w.event==="session.status_idle"||w.event==="session.status_rescheduled"||w.event==="session.status_terminated"||w.event==="session.error"||w.event==="session.deleted"||w.event==="span.model_request_start"||w.event==="span.model_request_end")try{yield JSON.parse(w.data)}catch(G){throw Y.error("Could not parse message into JSON:",w.data),Y.error("From chunk:",w.raw),G}if(w.event==="ping")continue;if(w.event==="error"){let G=CZ(w.data)??w.data,M=G?.error?.type;throw new A(void 0,G,void 0,X.headers,M)}}Q=!0}catch(w){if(d(w))return;throw w}finally{if(!Q)Z.abort()}}return new R(J,Z,$)}static fromReadableStream(X,Z,$){let W=!1;async function*Y(){let Q=new n,w=PX(X);for await(let G of w)for(let M of Q.decode(G))yield M;for(let G of Q.flush())yield G}async function*J(){if(W)throw new C("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");W=!0;let Q=!1;try{for await(let w of Y()){if(Q)continue;if(w)yield JSON.parse(w)}Q=!0}catch(w){if(d(w))return;throw w}finally{if(!Q)Z.abort()}}return new R(J,Z,$)}[(RX=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let X=[],Z=[],$=this.iterator(),W=(Y)=>{return{next:()=>{if(Y.length===0){let J=$.next();X.push(J),Z.push(J)}return Y.shift()}}};return[new R(()=>W(X),this.controller,z(this,RX,"f")),new R(()=>W(Z),this.controller,z(this,RX,"f"))]}toReadableStream(){let X=this,Z;return rZ({async start(){Z=X[Symbol.asyncIterator]()},async pull($){try{let{value:W,done:Y}=await Z.next();if(Y)return $.close();let J=fX(JSON.stringify(W)+`
5
5
  `);$.enqueue(J)}catch(W){$.error(W)}},async cancel(){await Z.return?.()}})}}async function*r1(X,Z){if(!X.body){if(Z.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new C("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new C("Attempted to iterate over a response with no body")}let $=new n0,W=new n,Y=PX(X.body);for await(let J of a1(Y))for(let Q of W.decode(J)){let w=$.decode(Q);if(w)yield w}for(let J of W.flush()){let Q=$.decode(J);if(Q)yield Q}}async function*a1(X){let Z=new Uint8Array;for await(let $ of X){if($==null)continue;let W=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?fX($):$,Y=new Uint8Array(Z.length+W.length);Y.set(Z),Y.set(W,Z.length),Z=Y;let J;while((J=l0(Z))!==-1)yield Z.slice(0,J),Z=Z.slice(J)}if(Z.length>0)yield Z}class n0{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(X){if(X.endsWith("\r"))X=X.substring(0,X.length-1);if(!X){if(!this.event&&!this.data.length)return null;let Y={event:this.event,data:this.data.join(`
@@ -0,0 +1 @@
1
+ import{h as s}from"./chunk-x788nk6z.js";import"./chunk-zaft3sfe.js";import"./chunk-wgjghs54.js";import"./chunk-6pmsknnk.js";import"./chunk-61bxmjd9.js";import"./chunk-ep138kb3.js";import"./chunk-99f9r6xm.js";import"./chunk-jg31cnqc.js";import"./chunk-yxtb7xn8.js";import"./chunk-0mmw31pj.js";import"./chunk-drjaw6a5.js";import"./chunk-tvzfm7g8.js";import"./chunk-5386brz2.js";import"./chunk-15jsnygy.js";import"./chunk-4d3wm83a.js";import"./chunk-8bhsdk1v.js";import"./chunk-fvwz4mgw.js";import"./chunk-xyzsmjtk.js";import"./chunk-jk87gxbb.js";import"./chunk-xktnqktj.js";import"./chunk-0zbwpfsk.js";import"./chunk-33r4w0yv.js";import"./chunk-q0xv46wa.js";import"./chunk-2t0asg3w.js";import"./chunk-cynjx7ha.js";import"./chunk-rjr8c8be.js";import"./chunk-g3p6h6sw.js";import"./chunk-2xaq1y16.js";import"./chunk-f3rqamey.js";import"./chunk-rjkj0dr9.js";import"./chunk-rq4h4p2g.js";import"./chunk-75segwsp.js";import"./chunk-5fj5w0gg.js";import"./chunk-jfjjh86p.js";import{Hh as t,Zh as a}from"./chunk-sjr6mvgm.js";import"./chunk-2em77vjv.js";function h(){let{shareId:n,fileId:o}=e.useParams(),{start:r,version:i,compare:l,cmpLeft:c,cmpRight:p,cmpActive:d}=e.useSearch();return t(s,{shareId:n,initialFileId:o,startTime:r,versionId:i,compare:l,compareLeftId:c,compareRightId:p,compareActiveSide:d})}var e=a("/share/$shareId/files/$fileId")({component:h});export{e as Route};
@@ -0,0 +1 @@
1
+ import{b as P,c as A,d as C,e as D,f as z,g as _}from"./chunk-x8ksced7.js";import{V as ZJ}from"./chunk-ep138kb3.js";import{W as VJ}from"./chunk-99f9r6xm.js";import{X as $J,Y as OJ,Z as XJ}from"./chunk-jg31cnqc.js";import{fa as DJ,ga as KJ,ha as S}from"./chunk-yxtb7xn8.js";import"./chunk-drjaw6a5.js";import"./chunk-tvzfm7g8.js";import{$e as c,Ye as u,Ze as g,_e as b,af as n}from"./chunk-xktnqktj.js";import{Nf as Q}from"./chunk-2t0asg3w.js";import"./chunk-cynjx7ha.js";import{Kg as t}from"./chunk-f3rqamey.js";import{kh as m}from"./chunk-75segwsp.js";import{mh as v,nh as p,oh as I}from"./chunk-5fj5w0gg.js";import{$k as Y,Ak as QJ,Ci as s,Fh as o,Hh as J,Ih as K,Lh as _J,Mh as f,Mj as i,Ph as r,Wk as e,Yk as d,Zh as NJ,bk as GJ,fk as wJ,hl as kJ,ji as M,mi as RJ,ui as YJ,vi as N}from"./chunk-sjr6mvgm.js";import{em as l}from"./chunk-2em77vjv.js";var yJ=l(o(),1);var WJ=l(o(),1);function EJ({teamId:O}){let[X,k]=WJ.useState("team"),[V,R]=WJ.useState("1h"),{data:q,isLoading:F}=f({queryKey:["teams",O,"ai-usage",V,"team"],queryFn:async()=>{let Z=await M.api.teams[":teamId"]["ai-usage"].$get({param:{teamId:O},query:{timeframe:V}});if(!Z.ok)throw Error("Failed to fetch team AI usage");return await Z.json()},enabled:!!O&&X==="team"}),{data:T,isLoading:B}=f({queryKey:["teams",O,"members"],queryFn:async()=>{let Z=await M.api.teams[":teamId"].members.$get({param:{teamId:O},query:{}});if(!Z.ok)throw Error("Failed to fetch team members");return await Z.json()},enabled:!!O&&X==="members"}),h=_J({queries:(T||[]).map((Z)=>({queryKey:["teams",O,"ai-usage",V,Z.id],queryFn:async()=>{let G=await M.api.teams[":teamId"]["ai-usage"].$get({param:{teamId:O},query:{timeframe:V,userId:Z.id}});if(!G.ok)throw Error(`Failed to fetch AI usage for member ${Z.id}`);return await G.json()},enabled:!!O&&X==="members"}))}),y=B||h.some((Z)=>Z.isLoading),H=(Z)=>{if(!Z)return"U";let G=Z.split(" ");if(G.length>1)return`${G[0][0]}${G[G.length-1][0]}`.toUpperCase();return Z.substring(0,2).toUpperCase()},x=(Z)=>{if(!Z)return"";switch(Z.toLowerCase()){case"owner":return Y.owner();case"editor":return Y.editor();case"reviewer":return Y.reviewer();default:return Z}},$=(Z)=>(Z??0).toLocaleString(),L=(Z)=>`$${(Z??0).toFixed(6)}`;return K(u,{className:"border-border/60 shadow-sm",children:[K(g,{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between pb-6",children:[K("div",{children:[J(b,{className:"text-xl font-semibold tracking-tight",children:Y.ai_usage()}),J(c,{className:"text-sm text-muted-foreground mt-1",children:Y.ai_usage_description()})]}),K("div",{className:"flex flex-wrap items-center gap-3",children:[K(KJ,{type:"single",value:X,onValueChange:(Z)=>{if(Z)k(Z)},className:"border rounded-lg p-1 bg-muted/30",children:[J(S,{value:"team",className:"px-3 py-1.5 text-xs font-medium",children:Y.team_view()}),J(S,{value:"members",className:"px-3 py-1.5 text-xs font-medium",children:Y.members_view()})]}),K(KJ,{type:"single",value:V,onValueChange:(Z)=>{if(Z)R(Z)},className:"border rounded-lg p-1 bg-muted/30",children:[J(S,{value:"1h",className:"px-2.5 py-1.5 text-xs font-medium",children:"1h"}),J(S,{value:"24h",className:"px-2.5 py-1.5 text-xs font-medium",children:"24h"}),J(S,{value:"7d",className:"px-2.5 py-1.5 text-xs font-medium",children:"7d"}),J(S,{value:"30d",className:"px-2.5 py-1.5 text-xs font-medium",children:"30d"})]})]})]}),J(n,{children:X==="team"?F?J("div",{className:"flex h-48 items-center justify-center",children:J(N,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):J("div",{className:"rounded-md border",children:K(P,{children:[J(A,{children:K(D,{children:[J(z,{children:Y.team()}),J(z,{className:"text-right",children:Y.input_tokens()}),J(z,{className:"text-right",children:Y.output_tokens()}),J(z,{className:"text-right",children:Y.cache_read_tokens()}),J(z,{className:"text-right",children:Y.total_tokens()}),J(z,{className:"text-right",children:Y.cost()})]})}),J(C,{children:K(D,{children:[J(_,{className:"font-medium",children:Y.team()}),J(_,{className:"text-right",children:$(q?.team?.inputTokens)}),J(_,{className:"text-right",children:$(q?.team?.outputTokens)}),J(_,{className:"text-right",children:$(q?.team?.cacheReadTokens)}),J(_,{className:"text-right font-medium",children:$(q?.team?.totalTokens)}),J(_,{className:"text-right font-medium",children:L(q?.team?.cost)})]})})]})}):y?J("div",{className:"flex h-48 items-center justify-center",children:J(N,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):J("div",{className:"rounded-md border",children:K(P,{children:[J(A,{children:K(D,{children:[J(z,{children:Y.members()}),J(z,{children:Y.role()}),J(z,{className:"text-right",children:Y.input_tokens()}),J(z,{className:"text-right",children:Y.output_tokens()}),J(z,{className:"text-right",children:Y.cache_read_tokens()}),J(z,{className:"text-right",children:Y.total_tokens()}),J(z,{className:"text-right",children:Y.cost()})]})}),J(C,{children:(T||[]).map((Z,G)=>{let U=h[G]?.data?.member;return K(D,{children:[J(_,{children:K("div",{className:"flex items-center gap-3",children:[K(v,{className:"h-8 w-8 rounded-full",children:[Z.image&&J(p,{src:Z.image,alt:Z.name,className:"object-cover"}),J(I,{className:"bg-primary/20 text-xs",children:H(Z.name)})]}),K("div",{className:"flex flex-col",children:[J("span",{className:"text-sm font-medium leading-none",children:Z.name}),J("span",{className:"text-xs text-muted-foreground mt-0.5",children:Z.email})]})]})}),J(_,{className:"text-xs text-muted-foreground",children:x(Z.role)}),J(_,{className:"text-right",children:$(U?.inputTokens)}),J(_,{className:"text-right",children:$(U?.outputTokens)}),J(_,{className:"text-right",children:$(U?.cacheReadTokens)}),J(_,{className:"text-right font-medium",children:$(U?.totalTokens)}),J(_,{className:"text-right font-medium",children:L(U?.cost)})]},Z.id)})})]})})})]})}var a=l(o(),1);function qJ({teamId:O}){let[X,k]=a.useState(null),{ref:V,inView:R}=t(),{data:q,isLoading:F,isError:T,fetchNextPage:B,hasNextPage:h,isFetchingNextPage:y}=r({queryKey:["teams",O,"agent-sessions"],queryFn:async({pageParam:$})=>{let L=await M.api.teams[":teamId"]["agent-sessions"].$get({param:{teamId:O},query:{first:"20",after:$?String($):void 0}});if(!L.ok)throw Error("Failed to fetch agent sessions");return await L.json()},initialPageParam:"",getNextPageParam:($)=>$.pageInfo.cursor||void 0,enabled:!!O});a.useEffect(()=>{if(R&&h&&!y)B()},[R,h,y,B]);let H=q?.pages.flatMap(($)=>$.data).filter(($)=>$.id!=="pending")||[],x=($)=>{switch($){case"comment":return J(Q,{variant:"outline",className:"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20",children:Y.session_type_comment()});case"chat":return J(Q,{variant:"outline",className:"bg-violet-500/10 text-violet-600 dark:text-violet-400 border-violet-500/20",children:Y.session_type_chat()});case"naming":return J(Q,{variant:"outline",className:"bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/20",children:Y.session_type_naming()});default:return J(Q,{variant:"outline",className:"bg-muted text-muted-foreground border-border",children:$})}};return K("div",{className:"space-y-6",children:[K(u,{className:"border border-border/50 shadow-xs",children:[J(g,{className:"pb-4",children:J("div",{className:"flex items-center justify-between",children:K("div",{children:[K(b,{className:"text-xl font-bold flex items-center gap-2",children:[J(i,{className:"w-5 h-5 text-violet-500"}),Y.sessions()]}),J(c,{className:"mt-1 text-sm text-muted-foreground",children:Y.sessions_description()})]})})}),J(n,{children:F?J("div",{className:"flex h-64 items-center justify-center",children:J(N,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):T?J("div",{className:"flex h-64 items-center justify-center text-destructive",children:"Failed to load agent sessions."}):H.length===0?K("div",{className:"flex flex-col items-center justify-center py-12 text-center text-muted-foreground",children:[J(i,{className:"w-10 h-10 text-muted-foreground/40 mb-3"}),J("p",{className:"text-base font-medium",children:Y.no_sessions_found()})]}):K("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[K(P,{children:[J(A,{className:"bg-muted/40",children:K(D,{children:[J(z,{children:Y.session_name()}),J(z,{children:Y.creator()}),J(z,{children:Y.session_type()}),J(z,{className:"text-right",children:Y.create_time()})]})}),J(C,{children:H.map(($)=>K(D,{onClick:()=>k($.id),className:"cursor-pointer hover:bg-muted/50 transition-colors",children:[J(_,{className:"font-medium",children:K("div",{className:"flex flex-col",children:[J("span",{className:"text-sm font-semibold text-foreground",children:$.name||Y.untitled_session()}),J("span",{className:"text-xs font-mono text-muted-foreground/70",children:$.id})]})}),J(_,{children:K("div",{className:"flex items-center gap-2",children:[K(v,{className:"h-6 w-6",children:[J(p,{src:$.creator?.image||void 0}),J(I,{className:"text-[10px]",children:$.creator?.name?.[0]?.toUpperCase()||"?"})]}),J("span",{className:"text-sm text-foreground/90",children:$.creator?.name||"System / Agent"})]})}),J(_,{children:x($.type)}),J(_,{className:"text-right text-xs text-muted-foreground",children:m($.createdAt)})]},$.id))})]}),J("div",{ref:V,className:"py-4 flex justify-center",children:y&&J(N,{className:"h-6 w-6 animate-spin text-muted-foreground"})})]})})]}),J(VJ,{sessionId:X,open:!!X,onOpenChange:($)=>{if(!$)k(null)}})]})}var j=l(o(),1);var hJ=Object.values(DJ);function MJ({teamId:O}){let[X,k]=j.useState([]),[V,R]=j.useState([]),[q,F]=j.useState(""),{ref:T,inView:B}=t(),{data:h}=f({queryKey:["teams",O,"members"],queryFn:async()=>{let W=await M.api.teams[":teamId"].members.$get({param:{teamId:O},query:{}});if(!W.ok)return[];return await W.json()},enabled:!!O}),y=h||[],{data:H,isLoading:x,isError:$,fetchNextPage:L,hasNextPage:Z,isFetchingNextPage:G}=r({queryKey:["teams",O,"audit-logs",X,V,q],queryFn:async({pageParam:W})=>{let E=await M.api.teams[":teamId"]["audit-logs"].$get({param:{teamId:O},query:{first:"20",after:W?String(W):void 0,actions:X.length>0?X:void 0,userIds:V.length>0?V:void 0,itemId:q.trim()||void 0}});if(!E.ok)throw Error("Failed to fetch audit logs");return await E.json()},initialPageParam:"",getNextPageParam:(W)=>W.pageInfo.endCursor||void 0,enabled:!!O});j.useEffect(()=>{if(B&&Z&&!G)L()},[B,Z,G,L]);let U=H?.pages.flatMap((W)=>W.nodes)||[],zJ=H?.pages[0]?.total??0,LJ=(W)=>{k((E)=>E.includes(W)?E.filter((w)=>w!==W):[...E,W])},UJ=(W)=>{R((E)=>E.includes(W)?E.filter((w)=>w!==W):[...E,W])},FJ=(W)=>{if(W.includes("delete")||W.includes("remove")||W.includes("revoke"))return J(Q,{variant:"outline",className:"bg-destructive/10 text-destructive border-destructive/20 font-mono text-xs",children:W});if(W.includes("create")||W.includes("add"))return J(Q,{variant:"outline",className:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20 font-mono text-xs",children:W});if(W.includes("update")||W.includes("reparent")||W.includes("copy"))return J(Q,{variant:"outline",className:"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20 font-mono text-xs",children:W});return J(Q,{variant:"outline",className:"bg-muted text-muted-foreground border-border font-mono text-xs",children:W})},BJ=new Map(y.map((W)=>[W.userId||W.id,W]));return J("div",{className:"space-y-6",children:K(u,{className:"border border-border/50 shadow-xs",children:[K(g,{className:"pb-4",children:[K("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[K("div",{children:[K(b,{className:"text-xl font-bold flex items-center gap-2",children:[J(s,{className:"h-5 w-5 text-primary"}),Y.audit_logs()]}),J(c,{className:"mt-1",children:Y.audit_logs_description()})]}),zJ>0&&K(Q,{variant:"secondary",className:"w-fit text-xs font-normal",children:[zJ," ",Y.audit_logs()]})]}),K("div",{className:"mt-4 flex flex-wrap items-center gap-3 pt-4 border-t border-border/40",children:[K($J,{children:[J(OJ,{asChild:!0,children:K(d,{variant:"outline",size:"sm",className:"h-9 gap-2 text-xs border-dashed",children:[J(YJ,{className:"h-3.5 w-3.5"}),Y.filter_by_action(),X.length>0&&J(Q,{variant:"secondary",className:"ml-1 px-1.5 py-0 text-[10px]",children:X.length})]})}),K(XJ,{className:"w-64 p-2",align:"start",children:[J("div",{className:"text-xs font-semibold text-muted-foreground px-2 py-1 mb-1",children:Y.select_actions()}),J("div",{className:"max-h-60 overflow-y-auto space-y-1 pr-1",children:hJ.map((W)=>K("label",{className:"flex items-center gap-2 px-2 py-1.5 hover:bg-accent rounded-md cursor-pointer text-xs",children:[J(ZJ,{checked:X.includes(W),onCheckedChange:()=>LJ(W)}),J("span",{className:"font-mono",children:W})]},W))}),X.length>0&&J(d,{variant:"ghost",size:"sm",className:"w-full mt-2 h-7 text-xs text-muted-foreground hover:text-foreground",onClick:()=>k([]),children:"Clear Actions"})]})]}),K($J,{children:[J(OJ,{asChild:!0,children:K(d,{variant:"outline",size:"sm",className:"h-9 gap-2 text-xs border-dashed",children:[J(YJ,{className:"h-3.5 w-3.5"}),Y.filter_by_user(),V.length>0&&J(Q,{variant:"secondary",className:"ml-1 px-1.5 py-0 text-[10px]",children:V.length})]})}),K(XJ,{className:"w-64 p-2",align:"start",children:[J("div",{className:"text-xs font-semibold text-muted-foreground px-2 py-1 mb-1",children:Y.select_users()}),J("div",{className:"max-h-60 overflow-y-auto space-y-1 pr-1",children:y.map((W)=>{let E=W.userId||W.user?.id||W.id,w=W.user?.name||W.name||E,JJ=W.user?.image||W.image;return K("label",{className:"flex items-center gap-2 px-2 py-1.5 hover:bg-accent rounded-md cursor-pointer text-xs",children:[J(ZJ,{checked:V.includes(E),onCheckedChange:()=>UJ(E)}),K(v,{className:"h-5 w-5",children:[J(p,{src:JJ||void 0}),J(I,{className:"text-[10px]",children:w.slice(0,2).toUpperCase()})]}),J("span",{className:"truncate",children:w})]},E)})}),V.length>0&&J(d,{variant:"ghost",size:"sm",className:"w-full mt-2 h-7 text-xs text-muted-foreground hover:text-foreground",onClick:()=>R([]),children:"Clear Users"})]})]}),K("div",{className:"relative flex-1 min-w-[200px] max-w-xs",children:[J(GJ,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),J(kJ,{type:"text",placeholder:Y.search_item_id(),value:q,onChange:(W)=>F(W.target.value),className:"pl-8 pr-8 h-9 text-xs"}),q&&J("button",{onClick:()=>F(""),className:"absolute right-2.5 top-2.5 text-muted-foreground hover:text-foreground",children:J(QJ,{className:"h-4 w-4"})})]}),(X.length>0||V.length>0||q)&&J(d,{variant:"ghost",size:"sm",className:"h-9 px-2 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{k([]),R([]),F("")},children:"Clear all"})]})]}),K(n,{className:"p-0",children:[x?J("div",{className:"flex h-64 items-center justify-center",children:J(N,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):$?J("div",{className:"p-8 text-center text-sm text-destructive",children:"Failed to load audit logs."}):U.length===0?J("div",{className:"p-12 text-center text-sm text-muted-foreground",children:Y.no_audit_logs()}):K(P,{children:[J(A,{children:K(D,{className:"hover:bg-transparent border-b border-border/50",children:[J(z,{className:"w-[180px] text-xs font-semibold",children:Y.action()}),J(z,{className:"w-[200px] text-xs font-semibold",children:Y.user()}),J(z,{className:"text-xs font-semibold",children:Y.item_id()}),J(z,{className:"text-xs font-semibold",children:Y.project_id()}),J(z,{className:"w-[160px] text-right text-xs font-semibold",children:Y.timestamp()})]})}),J(C,{children:U.map((W)=>{let E=W.userId?BJ.get(W.userId):null,w=E?.user?.name||E?.name||W.userId||"System",JJ=E?.user?.image||E?.image;return K(D,{className:"hover:bg-muted/40 transition-colors",children:[J(_,{className:"py-3 font-medium",children:FJ(W.action)}),J(_,{className:"py-3",children:K("div",{className:"flex items-center gap-2",children:[K(v,{className:"h-6 w-6",children:[J(p,{src:JJ||void 0}),J(I,{className:"text-[10px]",children:w.slice(0,2).toUpperCase()})]}),J("span",{className:"text-xs font-medium text-foreground truncate max-w-[140px]",children:w})]})}),J(_,{className:"py-3 text-xs font-mono text-muted-foreground",children:W.itemId||"-"}),J(_,{className:"py-3 text-xs font-mono text-muted-foreground",children:W.projectId||"-"}),J(_,{className:"py-3 text-right text-xs text-muted-foreground",children:m(W.createdAt)})]},W.id)})})]}),J("div",{ref:T,className:"py-4 flex justify-center",children:G&&J(N,{className:"h-6 w-6 animate-spin text-muted-foreground"})})]})]})})}function HJ(){let{teamId:O}=SJ.useParams(),[X,k]=yJ.useState("audit-logs"),{data:V,isLoading:R}=f({queryKey:["teams",O,"me"],queryFn:async()=>{let q=await M.api.teams[":teamId"].me.$get({param:{teamId:O}});if(!q.ok)throw Error("Failed to fetch me");return await q.json()},enabled:!!O});if(R)return J("div",{className:"flex h-screen items-center justify-center",children:J(N,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(V?.role?.toLowerCase()!=="owner")return K("div",{className:"flex h-full flex-col items-center justify-center p-8 text-center",children:[J(wJ,{className:"h-12 w-12 text-destructive mb-4"}),J("h2",{className:"text-xl font-bold tracking-tight mb-2",children:Y.access_denied()}),J("p",{className:"text-sm text-muted-foreground max-w-md",children:Y.only_owner_dashboard()})]});return J("div",{className:"h-full bg-background font-sans selection:bg-primary/20 transition-colors duration-300",children:K("div",{className:"flex flex-col md:flex-row h-full",children:[J("div",{className:"w-full h-full md:w-72 bg-sidebar border-b md:border-b-0 md:border-r border-sidebar-border z-10 md:left-16 overflow-y-auto transition-colors duration-300",children:K("nav",{className:"p-4 space-y-1 mt-4",children:[J("div",{className:"mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider",children:Y.dashboard()}),J("div",{className:"mt-4 mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider pt-4 border-t border-sidebar-border",children:Y.team_category()}),K("button",{onClick:()=>k("audit-logs"),className:e("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",X==="audit-logs"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[J(s,{className:"w-5 h-5"}),Y.audit_logs(),X==="audit-logs"&&J("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]}),J("div",{className:"mt-4 mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider pt-4 border-t border-sidebar-border",children:Y.ai()}),K("button",{onClick:()=>k("ai-usage"),className:e("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",X==="ai-usage"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[J(RJ,{className:"w-5 h-5"}),Y.usage(),X==="ai-usage"&&J("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]}),K("button",{onClick:()=>k("ai-sessions"),className:e("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",X==="ai-sessions"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[J(i,{className:"w-5 h-5"}),Y.sessions(),X==="ai-sessions"&&J("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]})]})}),J("div",{className:"flex-1 overflow-y-auto p-4 md:p-8",children:K("div",{className:"max-w-6xl mx-auto space-y-8",children:[X==="audit-logs"&&J(MJ,{teamId:O}),X==="ai-usage"&&J(EJ,{teamId:O}),X==="ai-sessions"&&J(qJ,{teamId:O})]})})]})})}var SJ=NJ("/teams/$teamId/dashboard")({component:HJ});export{SJ as Route};