@shumai-one/shumai 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/bin/{chunk-qag3w2dd.js → chunk-0aj303as.js} +1 -1
  2. package/bin/{chunk-976v5s8y.js → chunk-0qkj838r.js} +1 -1
  3. package/bin/{chunk-mg6fce5x.js → chunk-0rxhc7ka.js} +1 -1
  4. package/bin/chunk-0xbf8bcg.js +2 -0
  5. package/bin/{chunk-t1mxqskx.js → chunk-15sefy5t.js} +1 -1
  6. package/bin/{chunk-jfjcxyhf.js → chunk-1wm57c6y.js} +3 -3
  7. package/bin/{chunk-7ktvhtp1.js → chunk-1xpec5r8.js} +1 -1
  8. package/bin/chunk-23d3968z.js +2 -0
  9. package/bin/{chunk-y4s3xr4n.js → chunk-262hkppb.js} +2 -2
  10. package/bin/{chunk-qj2kpkje.js → chunk-29tx9qe2.js} +1 -1
  11. package/bin/{chunk-a5s5ny4z.js → chunk-2aamsc5v.js} +1 -1
  12. package/bin/{chunk-gd5xwgp6.js → chunk-2aascrtb.js} +1 -1
  13. package/bin/chunk-2g12s6mc.js +2 -0
  14. package/bin/{chunk-pv76qkym.js → chunk-31baz5n0.js} +1 -1
  15. package/bin/{chunk-hmsb7ehr.js → chunk-46ar48f9.js} +1 -1
  16. package/bin/chunk-4e3jbp84.js +1 -0
  17. package/bin/chunk-4jk0y1w1.js +1 -0
  18. package/bin/{chunk-ga0drqj7.js → chunk-4qpa7b5t.js} +1 -1
  19. package/bin/{chunk-99db4j0k.js → chunk-54tr7y2x.js} +1 -1
  20. package/bin/{chunk-9n783gva.js → chunk-5d2q46mx.js} +1 -1
  21. package/bin/{chunk-qf7n519d.js → chunk-5m9be8an.js} +2 -2
  22. package/bin/{chunk-1w9dnk5p.js → chunk-5r8858hx.js} +1 -1
  23. package/bin/{chunk-ydagqpny.js → chunk-5t6c3038.js} +1 -1
  24. package/bin/chunk-6z65xd0w.js +3 -0
  25. package/bin/{chunk-qjjr3fff.js → chunk-77r8w95d.js} +1 -1
  26. package/bin/chunk-7e06b2zb.js +2 -0
  27. package/bin/{chunk-58aabg1f.js → chunk-7hsgmjpa.js} +2 -2
  28. package/bin/{chunk-7mnezagc.js → chunk-88fg1sw7.js} +1 -1
  29. package/bin/{chunk-m11g9hx7.js → chunk-8mkfgcvb.js} +2 -2
  30. package/bin/chunk-8tf6kgdj.js +2 -0
  31. package/bin/{chunk-b9hb5jzt.js → chunk-8wqfkm4c.js} +1 -1
  32. package/bin/{chunk-ag35pxnb.js → chunk-922nnh39.js} +1 -1
  33. package/bin/{chunk-ymyyap80.js → chunk-925q4paa.js} +1 -1
  34. package/bin/{chunk-wfex9jw0.js → chunk-92xxys10.js} +6 -6
  35. package/bin/{chunk-0a5k9avd.js → chunk-97jzve52.js} +1 -1
  36. package/bin/{chunk-dzm2f82x.js → chunk-9ab6k4rq.js} +1 -1
  37. package/bin/{chunk-mwh2n8yt.js → chunk-9avkn3x1.js} +1 -1
  38. package/bin/{chunk-pmx9760x.js → chunk-9h027f50.js} +1 -1
  39. package/bin/chunk-av71yjaa.js +1 -0
  40. package/bin/{chunk-mjncyjwf.js → chunk-b8js74jk.js} +1 -1
  41. package/bin/{chunk-861dz0bf.js → chunk-bd71dp4j.js} +1 -1
  42. package/bin/{chunk-v3j7acwn.js → chunk-bs0fjz3w.js} +2 -2
  43. package/bin/chunk-byqc8tzq.js +1 -0
  44. package/bin/chunk-ccw7mjgq.js +5 -0
  45. package/bin/{chunk-kj751zje.js → chunk-cxhmr356.js} +1 -1
  46. package/bin/{chunk-hcz4snm7.js → chunk-d3wmdjze.js} +1 -1
  47. package/bin/{chunk-82w2419d.js → chunk-de99643r.js} +2 -2
  48. package/bin/{chunk-dwf5e5g3.js → chunk-dghtwyq1.js} +1 -1
  49. package/bin/{chunk-5k03xpzq.js → chunk-dqgv5yy1.js} +1 -1
  50. package/bin/{chunk-q72ax3m8.js → chunk-e3s3rz2e.js} +1 -1
  51. package/bin/{chunk-79n633wf.js → chunk-e52nga6c.js} +1 -1
  52. package/bin/{chunk-8abs8d48.js → chunk-e7ndw3hg.js} +2 -2
  53. package/bin/chunk-f14sqw1d.js +1 -0
  54. package/bin/chunk-f7sbkfmk.js +2 -0
  55. package/bin/{chunk-2xnys7v4.js → chunk-fa2g2wge.js} +1 -1
  56. package/bin/{chunk-044xt1se.js → chunk-fbte2rmd.js} +1 -1
  57. package/bin/{chunk-k1r17nfa.js → chunk-fcvtgx1y.js} +1 -1
  58. package/bin/chunk-fd5a3pdd.js +1 -0
  59. package/bin/{chunk-hqptebzb.js → chunk-fepymbka.js} +1 -1
  60. package/bin/{chunk-cpr05qng.js → chunk-fz88kkk1.js} +1 -1
  61. package/bin/chunk-g6zzg6v2.js +1 -0
  62. package/bin/{chunk-6724dtsx.js → chunk-g8th86na.js} +1 -1
  63. package/bin/chunk-gswbc6y9.js +2 -0
  64. package/bin/{chunk-pvy0gccg.js → chunk-gtrc5ka2.js} +1 -1
  65. package/bin/chunk-h0ytx8zc.js +2 -0
  66. package/bin/{chunk-mv8c5fky.js → chunk-hkbybhww.js} +1 -1
  67. package/bin/{chunk-e3c6hyz8.js → chunk-hr97a5j5.js} +1 -1
  68. package/bin/{chunk-7h75r7ep.js → chunk-j8qtab70.js} +1 -1
  69. package/bin/{chunk-jyjnt0s9.js → chunk-jf3vn5c3.js} +2 -2
  70. package/bin/{chunk-azfgjqjx.js → chunk-kfhtk3eh.js} +1 -1
  71. package/bin/chunk-kr06nrbx.js +2 -0
  72. package/bin/{chunk-nceqrqey.js → chunk-m4zpf9gg.js} +1 -1
  73. package/bin/{chunk-1ae8csk6.js → chunk-mqjzmn0e.js} +1 -1
  74. package/bin/{chunk-sp75qe28.js → chunk-mzg1h07d.js} +1 -1
  75. package/bin/{chunk-cj5qwc9c.js → chunk-nrwna4ha.js} +1 -1
  76. package/bin/chunk-nyhqy6q2.js +62 -0
  77. package/bin/{chunk-4zq8vxcy.css → chunk-pmswtfe3.css} +1 -1
  78. package/bin/chunk-pq18zenh.js +2 -0
  79. package/bin/{chunk-p3emandj.js → chunk-q24epdh8.js} +2 -2
  80. package/bin/{chunk-2djd6pq1.js → chunk-qksb0v3c.js} +2 -2
  81. package/bin/chunk-qqk51620.js +2 -0
  82. package/bin/chunk-r0w920zb.js +1 -0
  83. package/bin/{chunk-2dz8nn9v.js → chunk-re0b7sj7.js} +1 -1
  84. package/bin/{chunk-x9q2vzn8.js → chunk-rtngbgpk.js} +1 -1
  85. package/bin/{chunk-zn9jbc6t.js → chunk-ry33f2qk.js} +1 -1
  86. package/bin/{chunk-k5bekrrp.js → chunk-s46zwr4p.js} +1 -1
  87. package/bin/chunk-s8t74q9m.js +1 -0
  88. package/bin/chunk-sd86v1e6.js +1 -0
  89. package/bin/{chunk-v98yavtp.js → chunk-srn8t0v7.js} +1 -1
  90. package/bin/chunk-szzff7gd.js +1 -0
  91. package/bin/{chunk-46c5xkmn.js → chunk-t3t6021k.js} +1 -1
  92. package/bin/{chunk-jbde7evp.js → chunk-thsbcbay.js} +1 -1
  93. package/bin/chunk-tspps87j.js +1 -0
  94. package/bin/{chunk-v05d1aeq.js → chunk-w7dn1m95.js} +1 -1
  95. package/bin/{chunk-w1d5vmtc.js → chunk-wc8sc9r9.js} +1 -1
  96. package/bin/chunk-wg98cacx.js +2 -0
  97. package/bin/chunk-wsyg4rwg.js +2 -0
  98. package/bin/{chunk-ga3mh3cd.js → chunk-xcwbg4w9.js} +1 -1
  99. package/bin/{chunk-9bpjfkjf.js → chunk-xyjw8w3r.js} +1 -1
  100. package/bin/chunk-y2qp11v9.js +1 -0
  101. package/bin/{chunk-ngd23mtc.js → chunk-ybhgmvxa.js} +1 -1
  102. package/bin/{chunk-phw4ne8b.js → chunk-ygz6pawn.js} +1 -1
  103. package/bin/{chunk-hy50c4pw.js → chunk-ymeycphq.js} +2 -2
  104. package/bin/{chunk-c1v946wb.js → chunk-zemrvz79.js} +2 -2
  105. package/bin/{chunk-29pkpmvy.js → chunk-zzx99j8t.js} +1 -1
  106. package/bin/shumai-app.html +1 -1
  107. package/bin/shumai-app.js +248 -224
  108. package/package.json +7 -7
  109. package/prisma/migrations/20260723025234_add_ai_usage_table/migration.sql +28 -0
  110. package/prisma/migrations/20260723032755_add_ai_usage_unique_constraint/migration.sql +8 -0
  111. package/prisma/schema.prisma +25 -0
  112. package/bin/chunk-211y81mp.js +0 -1
  113. package/bin/chunk-25d1g086.js +0 -2
  114. package/bin/chunk-4fnak2zn.js +0 -2
  115. package/bin/chunk-50ebjdkv.js +0 -2
  116. package/bin/chunk-5j7axztv.js +0 -2
  117. package/bin/chunk-6h4ay2p8.js +0 -2
  118. package/bin/chunk-6w5cn6p3.js +0 -3
  119. package/bin/chunk-75jka5v9.js +0 -5
  120. package/bin/chunk-9evm8x70.js +0 -1
  121. package/bin/chunk-bepnbw1g.js +0 -2
  122. package/bin/chunk-bg24g9kk.js +0 -1
  123. package/bin/chunk-dqtq9t8e.js +0 -1
  124. package/bin/chunk-fgnxtqtk.js +0 -1
  125. package/bin/chunk-fxvb6g2r.js +0 -1
  126. package/bin/chunk-kjkmh26f.js +0 -1
  127. package/bin/chunk-m3dwydr3.js +0 -2
  128. package/bin/chunk-mk1jewvw.js +0 -2
  129. package/bin/chunk-q9sgjs4d.js +0 -1
  130. package/bin/chunk-s2725w64.js +0 -1
  131. package/bin/chunk-saq5797j.js +0 -1
  132. package/bin/chunk-sy8rqacm.js +0 -2
  133. package/bin/chunk-t84t3v6q.js +0 -1
  134. package/bin/chunk-ttsqdsxr.js +0 -2
  135. package/bin/chunk-vreq89j6.js +0 -1
  136. package/bin/chunk-wbhsmhgp.js +0 -2
  137. package/bin/chunk-wf4d1anc.js +0 -62
  138. package/bin/chunk-xv4mfppt.js +0 -2
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{Ae as k,De as E,Fe as J,He as I,Ie as V,Ke as X,Ne as _,oe as JG,pe as r,qe as u,se as H,xe as W,ye as l,ze as N}from"./chunk-ga3mh3cd.js";function q(G,Q){let Y={};if(!Object.keys(Q).length)return Y=G,Y;for(let[K,B]of Object.entries(G)){let O=Q[K];if(O===null)continue;Y[O??K]=B}return Y}function UG(G){let Q={};for(let[Y,K]of Object.entries(G))if(typeof K<"u")Q[Y]=K;return Q}class C extends Error{rawValue;rawMessage;static[Symbol.hasInstance](G){if(!(G instanceof Error))return!1;if(!("rawValue"in G))return!1;if(!("rawMessage"in G))return!1;if(!("pretty"in G))return!1;if(typeof G.pretty!=="function")return!1;return!0}constructor(G,Q,Y){super(`${G}: ${Q}`);this.name="SDKValidationError",this.cause=Q,this.rawValue=Y,this.rawMessage=G}pretty(){if(this.cause instanceof r)return`${this.rawMessage}
2
+ import{Ae as k,De as E,Fe as J,He as I,Ie as V,Ke as X,Ne as _,oe as JG,pe as r,qe as u,se as H,xe as W,ye as l,ze as N}from"./chunk-xcwbg4w9.js";function q(G,Q){let Y={};if(!Object.keys(Q).length)return Y=G,Y;for(let[K,B]of Object.entries(G)){let O=Q[K];if(O===null)continue;Y[O??K]=B}return Y}function UG(G){let Q={};for(let[Y,K]of Object.entries(G))if(typeof K<"u")Q[Y]=K;return Q}class C extends Error{rawValue;rawMessage;static[Symbol.hasInstance](G){if(!(G instanceof Error))return!1;if(!("rawValue"in G))return!1;if(!("rawMessage"in G))return!1;if(!("pretty"in G))return!1;if(typeof G.pretty!=="function")return!1;return!0}constructor(G,Q,Y){super(`${G}: ${Q}`);this.name="SDKValidationError",this.cause=Q,this.rawValue=Y,this.rawMessage=G}pretty(){if(this.cause instanceof r)return`${this.rawMessage}
3
3
  ${yG(this.cause)}`;else return this.toString()}}function yG(G){return u(G)}function t(G){return{ok:!0,value:G}}function s(G){return{ok:!1,error:G}}async function vG(G){let Q=await G;if(!Q.ok)throw Q.error;return Q.value}function i(G,Q,Y){try{return t(Q(G))}catch(K){return s(new C(Y,K,G))}}var o=J({prompt_tokens:W().default(0),completion_tokens:W().default(0),total_tokens:W().default(0),prompt_audio_seconds:_(W()).optional()}).catchall(N()).transform((G)=>{return q(G,{prompt_tokens:"promptTokens",completion_tokens:"completionTokens",total_tokens:"totalTokens",prompt_audio_seconds:"promptAudioSeconds"})}),hG=J({promptTokens:W().default(0),completionTokens:W().default(0),totalTokens:W().default(0),promptAudioSeconds:_(W()).optional()}).catchall(N()).transform((G)=>{return{...q(G,{promptTokens:"prompt_tokens",completionTokens:"completion_tokens",totalTokens:"total_tokens",promptAudioSeconds:"prompt_audio_seconds"})}});function j(G){return z++,G}var z=0,a=0;function P(){a++;let G=z;return{end:(Q)=>{let Y=z-G;if(z=G+(Q??Y),--a===0)z=0;return Y}}}function M(G){let Q=Object.values(G);return I([...Q.map((Y)=>X(Y)),H().transform((Y)=>j(Y))])}function lG(G){let Q=Object.values(G).filter((Y)=>typeof Y==="number");return I([...Q.map((Y)=>X(Y)),W().transform((Y)=>j(Y))])}function f(G){return H()}function cG(G){return W()}var e=Symbol("UNKNOWN");function n(G){return typeof G==="object"&&G!==null&&e in G}function GG(G,Q,Y={}){let{unknownValue:K="UNKNOWN",outputPropertyName:B}=Y;return k().transform((O)=>{let w=Object.defineProperties({raw:O,[B??G]:K,isUnknown:!0},{[e]:{value:!0,enumerable:!1,configurable:!1}});if(!(typeof O==="object"&&O!==null))return w;let F=O[G];if(typeof F!=="string")return w;if(!(F in Q))return w;let $=Q[F];if(!$)return w;let T=P(),y=$.safeParse(O);if(!y.success)return T.end(0),w;if(T.end(),B)y.data[B]=F;return y.data})}var HG=/^\d{4}-\d{2}-\d{2}$/;class v{serialized;static today(){return new v(new Date)}constructor(G){if(typeof G==="string"&&!HG.test(G))throw RangeError("RFCDate: date strings must be in the format YYYY-MM-DD: "+G);let Q=new Date(G);if(isNaN(+Q))throw RangeError("RFCDate: invalid date provided: "+G);if(this.serialized=Q.toISOString().slice(0,10),!HG.test(this.serialized))throw TypeError(`RFCDate: failed to build valid date with given value: ${G} serialized to ${this.serialized}`)}toJSON(){return this.toString()}toString(){return this.serialized}}function Z(G){return k().transform((Q,Y)=>{let K=[],B=G.map(()=>[]),O=P();for(let[D,F]of G.entries()){let $=P(),T=F.safeParse(Q),y=$.end(),xG=0;if(T.success){K.push({data:T.data,inexactCount:y,zeroDefaultCount:0,fieldCount:-1});continue}B[D].push(...T.error.issues)}if(K.length===0)return O.end(0),Y.addIssue({input:Q,code:"invalid_union",errors:B}),JG;let w=K[0];for(let D of K){if(K.length>1)D.fieldCount=PG(D.data);w=zG(D,w)}return O.end(w.inexactCount),w.data})}function zG(G,Q){let Y=G.inexactCount===0,K=Q.inexactCount===0;if(Y!==K)return Y?G:Q;let B=G.fieldCount-G.zeroDefaultCount,O=Q.fieldCount-Q.zeroDefaultCount;if(B!==O)return B>O?G:Q;return G.inexactCount<Q.inexactCount?G:Q}function PG(G){let Q=0,Y=[G],K=0;while(K<Y.length){let B=Y[K++];if(B===void 0||n(B))continue;let O=typeof B;if(B===null||O==="number"||O==="string"||O==="boolean"||O==="bigint"||B instanceof Date||B instanceof v){Q++;continue}if(Array.isArray(B)){Y.push(...B);continue}if(O==="object")Y.push(...Object.values(B))}return Q}var QG=J({type:X("input_audio"),input_audio:H()}).transform((G)=>{return q(G,{input_audio:"inputAudio"})}),XG=J({type:X("input_audio"),inputAudio:H()}).transform((G)=>{return q(G,{inputAudio:"input_audio"})});var YG=J({type:X("document_url").default("document_url"),document_url:H(),document_name:_(H()).optional()}).transform((G)=>{return q(G,{document_url:"documentUrl",document_name:"documentName"})}),_G=J({type:X("document_url").default("document_url"),documentUrl:H(),documentName:_(H()).optional()}).transform((G)=>{return q(G,{documentUrl:"document_url",documentName:"document_name"})});var ZG=J({type:X("file").default("file"),file_id:H()}).transform((G)=>{return q(G,{file_id:"fileId"})}),WG=J({type:X("file").default("file"),fileId:H()}).transform((G)=>{return q(G,{fileId:"file_id"})});var qG={Low:"low",Auto:"auto",High:"high"},BG=M(qG),KG=f(qG);var b=J({url:H(),detail:_(BG).optional()}),p=J({url:H(),detail:_(KG).optional()});var BH=Z([b,H()]),KH=Z([p,H()]);var OG=J({type:X("image_url").default("image_url"),image_url:Z([b,H()])}).transform((G)=>{return q(G,{image_url:"imageUrl"})}),AG=J({type:X("image_url").default("image_url"),imageUrl:Z([p,H()])}).transform((G)=>{return q(G,{imageUrl:"image_url"})});var wH=Z([W(),H()]),NH=Z([W(),H()]);var L=J({type:X("reference").default("reference"),reference_ids:E(Z([W(),H()]))}).transform((G)=>{return q(G,{reference_ids:"referenceIds"})}),R=J({type:X("reference").default("reference"),referenceIds:E(Z([W(),H()]))}).transform((G)=>{return q(G,{referenceIds:"reference_ids"})});var x=J({type:X("text").default("text"),text:H()}),U=J({type:X("text").default("text"),text:H()});var EG={WebSearch:"web_search",WebSearchPremium:"web_search_premium",CodeInterpreter:"code_interpreter",ImageGeneration:"image_generation",DocumentLibrary:"document_library"},h=M(EG),g=f(EG);var yH=Z([h,H()]),zH=Z([g,H()]);var d=J({type:X("tool_reference").default("tool_reference"),tool:Z([h,H()]),title:H(),url:_(H()).optional(),favicon:_(H()).optional(),description:_(H()).optional()}),m=J({type:X("tool_reference").default("tool_reference"),tool:Z([g,H()]),title:H(),url:_(H()).optional(),favicon:_(H()).optional(),description:_(H()).optional()});var UH=Z([d,x,L]),$H=Z([m,U,R]);var wG=J({type:X("thinking").default("thinking"),thinking:E(Z([d,x,L])),signature:_(H()).optional(),closed:l().optional()}),NG=J({type:X("thinking").default("thinking"),thinking:E(Z([m,U,R])),signature:_(H()).optional(),closed:l().optional()});var c=GG("type",{image_url:OG.and(J({type:X("image_url")})),document_url:YG.and(J({type:X("document_url")})),text:x.and(J({type:X("text")})),reference:L.and(J({type:X("reference")})),file:ZG.and(J({type:X("file")})),thinking:wG.and(J({type:X("thinking")})),input_audio:QG}),gH=I([AG.and(J({type:X("image_url")})),_G.and(J({type:X("document_url")})),U.and(J({type:X("text")})),R.and(J({type:X("reference")})),WG.and(J({type:X("file")})),NG.and(J({type:X("thinking")})),XG]);var lH=Z([V(H(),N()),H()]),cH=Z([V(H(),N()),H()]);var VG=J({name:H(),arguments:Z([V(H(),N()),H()])}),DG=J({name:H(),arguments:Z([V(H(),N()),H()])});var FG=J({id:H().default("null"),type:H().optional(),function:VG,index:W().default(0)}),tH=J({id:H().default("null"),type:H().optional(),function:DG,index:W().default(0)});var nH=Z([H(),E(c)]);var TG=J({role:_(H()).optional(),content:_(Z([H(),E(c)])).optional(),tool_calls:_(E(FG)).optional(),tool_call_id:_(H()).optional(),index:_(W()).optional(),metadata:_(V(H(),N())).optional()}).transform((G)=>{return q(G,{tool_calls:"toolCalls",tool_call_id:"toolCallId"})});var IG={Stop:"stop",Length:"length",Error:"error",ToolCalls:"tool_calls"},LG=M(IG),MG=J({index:W(),delta:TG,finish_reason:_(LG)}).transform((G)=>{return q(G,{finish_reason:"finishReason"})});var RG=J({id:H(),object:H().optional(),created:W().optional(),model:H(),usage:o.optional(),choices:E(MG)});function ZJ(G){return i(G,(Q)=>RG.parse(JSON.parse(Q)),"Failed to parse 'CompletionChunk' from JSON")}
4
4
  export{yG as gb,t as hb,s as ib,vG as jb,i as kb,q as lb,UG as mb,M as nb,lG as ob,f as pb,cG as qb,GG as rb,Z as sb,YG as tb,_G as ub,WG as vb,OG as wb,AG as xb,x as yb,U as zb,h as Ab,g as Bb,d as Cb,m as Db,wG as Eb,NG as Fb,c as Gb,gH as Hb,FG as Ib,tH as Jb,TG as Kb,o as Lb,hG as Mb,RG as Nb,ZJ as Ob};
@@ -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 rk,b3 as sk};
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 xk,b3 as yk};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Uk as G}from"./chunk-976v5s8y.js";var q=null;function H(k){if(typeof process>"u"||!process.versions?.bun||Object.keys(process.env).length>0)return;if(q===null){q=new Map;try{let{readFileSync:w}=G("fs"),D=w("/proc/self/environ","utf-8");for(let z of D.split("\x00")){let A=z.indexOf("=");if(A>0)q.set(z.slice(0,A),z.slice(A+1))}}catch{}}return q.get(k)}function I(k,w){return w?.[k]||(typeof process<"u"?process.env[k]:void 0)||H(k)||void 0}
2
+ import{_k as G}from"./chunk-0qkj838r.js";var q=null;function H(k){if(typeof process>"u"||!process.versions?.bun||Object.keys(process.env).length>0)return;if(q===null){q=new Map;try{let{readFileSync:w}=G("fs"),D=w("/proc/self/environ","utf-8");for(let z of D.split("\x00")){let A=z.indexOf("=");if(A>0)q.set(z.slice(0,A),z.slice(A+1))}}catch{}}return q.get(k)}function I(k,w){return w?.[k]||(typeof process<"u"?process.env[k]:void 0)||H(k)||void 0}
3
3
  export{I as Zb};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  function f(b){return b.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"")}
3
- export{f as Ok};
3
+ export{f as Uk};
@@ -0,0 +1 @@
1
+ import{Ya as lz}from"./chunk-kr06nrbx.js";import{Za as a}from"./chunk-b8js74jk.js";import{$a as Dz,_a as yz,ab as bz,bb as Cz,cb as fz,db as Iz,eb as gz,fb as uz}from"./chunk-0xbf8bcg.js";import{Ng as hz}from"./chunk-fz88kkk1.js";import{Og as c}from"./chunk-dghtwyq1.js";import{Qg as E,Rg as b,Tg as C,Ug as f,Vg as M,ch as wz,dh as n,eh as Rz,fh as Kz,gh as kz,hh as qz,ih as Az,jh as Ez}from"./chunk-gswbc6y9.js";import{$h as Bz,Bh as m,Fj as Gz,Gh as Pz,Mj as Lz,Qh as Yz,Sh as X,Th as Jz,Uh as Uz,ai as zz,ci as Wz,di as $z,gk as _z,hk as Sz,ik as Mz,jk as vz,mh as Xz,mk as V,nh as N,oh as z,oi as Tz,oj as Zz,ph as J,qh as x,th as Vz,uh as Oz,vh as k,vi as i}from"./chunk-nyhqy6q2.js";import{Vk as Qz}from"./chunk-0qkj838r.js";var K=Qz(Xz(),1);function Fz({open:Z,onOpenChange:$,mode:T,teamId:F,project:W}){let q=x(),R=m(),[H,O]=K.useState(""),[v,B]=K.useState(!0),[I,P]=K.useState(void 0),[h,U]=K.useState(void 0),[A,w]=K.useState(!1),S=K.useRef(null);K.useEffect(()=>{if(Z)if(T==="edit"&&W)O(W.name||""),P(W.coverImageKey),U(W.coverImage),B(W.enableNotification!==!1);else O(""),P(void 0),U(void 0),B(!0)},[Z,T,W]);let g=X.api.teams[":teamId"].projects.$post,{mutate:j}=k({mutationFn:async(Q)=>{let _=await g({param:{teamId:F},json:Q});if(!_.ok)throw Error(V.failed_create_project());return await _.json()},onSuccess:(Q)=>{q.invalidateQueries({queryKey:["teams",F,"projects"]}),$(!1);let _=Q;if(_&&typeof _.id==="string")R({to:"/projects/$projectId",params:{projectId:_.id}})}}),u=X.api.projects[":projectId"].$put,{mutate:y}=k({mutationFn:async(Q)=>{let _=await u({param:{projectId:W.id},json:Q});if(!_.ok)throw Error(V.failed_update_project());return await _.json()},onSuccess:()=>{q.invalidateQueries({queryKey:["teams",F,"projects"]}),$(!1)}}),r=X.api.teams[":teamId"].files.$post,{mutate:D}=k({mutationFn:async({file:Q})=>{let _=await r({param:{teamId:F},form:{file:Q}});if(!_.ok)throw Error(V.failed_upload_file());return await _.json()},onSuccess:(Q)=>{let _=Q;if(_&&typeof _.key==="string")P(_.key);w(!1)},onError:()=>{w(!1)}}),o=(Q)=>{let _=Q.target.files?.[0];if(_){w(!0);let e=URL.createObjectURL(_);U(e),D({file:_})}},t=()=>{S.current?.click()},s=(Q)=>{Q.stopPropagation(),P(void 0),U(void 0)},l=()=>{if(!H.trim())return;if(T==="create")j({name:H.trim(),coverImageKey:I,enableNotification:v});else if(T==="edit"&&W?.id)y({name:H.trim(),coverImageKey:I,enableNotification:v})};return z(Rz,{open:Z,onOpenChange:$,children:J(Kz,{className:"sm:max-w-[550px] overflow-hidden rounded-2xl border border-border/60 bg-background/95 backdrop-blur-md shadow-2xl p-0 gap-0",children:[J(kz,{className:"relative overflow-hidden bg-gradient-to-br from-primary/5 to-transparent p-6 border-b border-border/40",children:[z("div",{className:"absolute top-0 right-0 w-24 h-24 bg-primary/10 rounded-full blur-2xl pointer-events-none"}),z("div",{className:"absolute bottom-0 left-10 w-32 h-12 bg-primary/5 rounded-full blur-xl pointer-events-none"}),z("div",{className:"flex items-center gap-3",children:J("div",{children:[z(Az,{className:"text-xl font-semibold tracking-tight text-foreground",children:T==="create"?V.create_new_project():V.project_settings()}),z(Ez,{className:"text-xs text-muted-foreground/80 mt-1",children:T==="create"?V.configure_new_project_description():V.manage_project_description()})]})})]}),J("div",{className:"space-y-6 p-6 max-h-[75vh] overflow-y-auto",children:[J("div",{className:"space-y-2",children:[z(c,{htmlFor:"name",className:"text-sm font-semibold tracking-tight text-foreground",children:V.project_name()}),J("div",{className:"relative",children:[z(n,{id:"name",value:H,onChange:(Q)=>O(Q.target.value),placeholder:V.project_name_placeholder(),className:"h-11 px-4 rounded-xl border-border/80 focus-visible:ring-ring/25 focus-visible:border-primary transition-all shadow-xs pr-10"}),H.trim()&&z("div",{className:"absolute inset-y-0 right-3 flex items-center",children:z(i,{className:"w-4 h-4 text-primary"})})]}),z("p",{className:"text-[11px] text-muted-foreground",children:V.project_name_hint()})]}),J("div",{className:"space-y-3 border-t border-border/40 pt-5",children:[J("div",{className:"flex items-center justify-between",children:[J(c,{className:"text-sm font-semibold tracking-tight text-foreground flex items-center gap-1.5",children:[z($z,{className:"w-4 h-4 text-primary"}),V.project_cover()]}),h&&J("button",{type:"button",onClick:s,className:"text-xs text-muted-foreground hover:text-destructive hover:bg-destructive/5 px-2.5 py-1 rounded-lg transition-all flex items-center gap-1 font-medium",children:[z(Lz,{className:"w-3.5 h-3.5"}),V.remove_cover()]})]}),J("div",{className:"relative aspect-square w-48 mx-auto rounded-2xl border border-dashed border-border flex items-center justify-center cursor-pointer overflow-hidden group shadow-inner bg-muted/20 transition-all duration-300 hover:border-primary/50 hover:bg-muted/40",onClick:t,children:[z("input",{type:"file",ref:S,className:"hidden",accept:"image/*",onChange:o}),A&&z("div",{className:"absolute inset-0 bg-background/70 backdrop-blur-xs flex flex-col items-center justify-center gap-2 z-20",children:J("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-background border rounded-full shadow-lg",children:[z(zz,{className:"w-4 h-4 animate-spin text-primary"}),z("span",{className:"text-xs font-semibold text-foreground",children:V.uploading()})]})}),h?J(N,{children:[z("img",{src:h,alt:V.cover_preview(),className:"w-full h-full object-cover transition-transform duration-500 group-hover:scale-105"}),J("div",{className:"absolute inset-0 bg-black/45 opacity-0 group-hover:opacity-100 transition-opacity duration-300 flex flex-col items-center justify-center gap-1.5 text-white z-10",children:[z(Gz,{className:"w-5 h-5 transform translate-y-1 group-hover:translate-y-0 transition-transform duration-300"}),z("span",{className:"text-xs font-semibold",children:V.upload_image()})]})]}):J("div",{className:"flex flex-col items-center gap-2 text-center p-4",children:[z("div",{className:"p-2.5 rounded-full bg-background border shadow-xs group-hover:scale-110 transition-transform duration-300",children:z(Gz,{className:"w-4 h-4 text-muted-foreground"})}),J("div",{children:[z("p",{className:"text-xs font-medium text-foreground",children:V.upload_cover()}),z("p",{className:"text-[11px] text-muted-foreground mt-0.5 max-w-[140px] mx-auto leading-normal",children:V.upload_cover_hint()})]})]})]})]}),J("div",{className:"space-y-3 border-t border-border/40 pt-5",children:[J(c,{className:"text-sm font-semibold tracking-tight text-foreground flex items-center gap-1.5",children:[z(Wz,{className:"w-4 h-4 text-primary"}),V.project_preferences()]}),J("div",{className:"flex items-start justify-between rounded-xl border border-border/50 bg-muted/10 p-4 transition-all duration-300 hover:bg-muted/20",children:[J("div",{className:"space-y-1 pr-4",children:[J("div",{className:"text-sm font-semibold flex items-center gap-2 text-foreground",children:[z(Tz,{className:"w-4 h-4 text-primary"}),V.activity_notifications()]}),z("p",{className:"text-xs text-muted-foreground leading-normal",children:V.activity_notifications_description()})]}),z(a,{checked:v,onCheckedChange:B,disabled:A,className:"mt-0.5"})]})]})]}),J(qz,{className:"flex items-center justify-end gap-3 px-6 py-4 bg-muted/20 border-t border-border/40",children:[z(E,{type:"button",variant:"ghost",onClick:()=>$(!1),disabled:A,className:"rounded-xl h-10 px-4 hover:bg-muted font-medium text-sm text-muted-foreground hover:text-foreground transition-colors",children:V.cancel()}),z(E,{type:"submit",onClick:l,disabled:!H.trim()||A,className:"rounded-xl h-10 px-5 bg-primary text-primary-foreground hover:bg-primary/90 font-semibold text-sm shadow-lg shadow-primary/10 hover:shadow-primary/20 active:scale-98 transition-all flex items-center gap-2",children:A?J(N,{children:[z(zz,{className:"w-4 h-4 animate-spin"}),V.processing()]}):T==="create"?V.create_project():V.save_changes()})]})]})})}function Nz({sortBy:Z,sortDirection:$,onSortChange:T}){let F=(H)=>{T(H,$)},W=()=>{T(Z,$==="asc"?"desc":"asc")},q=(H)=>{switch(H){case"name":return V.sort_name();case"created_at":return V.sort_created();case"updated_at":return V.sort_updated();default:return H}},R=$==="asc";return J(b,{children:[z(C,{asChild:!0,children:J(E,{variant:"outline",className:"gap-2 bg-muted/50",children:[z("span",{className:"text-muted-foreground",children:V.sorted_by_label()}),z("span",{className:"font-medium text-foreground",children:q(Z)})]})}),J(f,{align:"end",className:"w-56 p-2",children:[z("div",{className:"text-xs font-semibold text-muted-foreground mb-2 px-2",children:V.sort_by()}),J(b,{children:[z(C,{asChild:!0,children:J(E,{variant:"ghost",className:"w-full justify-between font-normal px-2 h-10 bg-muted/50 hover:bg-muted mb-2 border",children:[z("span",{children:q(Z)}),z(Jz,{className:"h-4 w-4 opacity-50"})]})}),z(f,{className:"w-52",children:["name","created_at","updated_at"].map((H)=>J(M,{onClick:()=>F(H),className:"justify-between",children:[q(H),Z===H&&z(i,{className:"h-4 w-4"})]},H))})]}),J(E,{variant:"ghost",className:"w-full justify-between font-normal px-2 h-10 bg-muted/50 hover:bg-muted border",onClick:W,children:[z("span",{className:"text-muted-foreground",children:Z==="name"?R?z(N,{children:V.sort_a_to_z()}):z(N,{children:V.sort_z_to_a()}):R?z(N,{children:V.sort_oldest_to_newest()}):z(N,{children:V.sort_newest_to_oldest()})}),R?z(Uz,{className:"h-4 w-4 opacity-50"}):z(Jz,{className:"h-4 w-4 opacity-50"})]})]})]})}var L=Qz(Xz(),1);function tz(){let{teamId:Z}=sz.useParams(),{canEdit:$,canAdmin:T}=wz(),F=m(),W=x(),[q,R]=L.useState(null),[H,O]=L.useState(!1),[v,B]=L.useState("create"),[I,P]=L.useState(void 0),[h,U]=L.useState(!1),[A,w]=L.useState(void 0),[S,g]=L.useState(""),[j,u]=L.useState(!1),[y,r]=L.useState("name"),[D,o]=L.useState("asc"),t=X.api.teams[":teamId"].projects.$get,{data:s}=Oz({queryKey:["teams",Z,"projects",y,D],queryFn:async()=>{let G=await t({param:{teamId:Z},query:{sortBy:y,sortDirection:D}});if(!G.ok)throw Error("Failed to fetch projects");return await G.json()}}),{data:l}=Vz({queryKey:["teams",Z,"members"],queryFn:async()=>{let G=await X.api.teams[":teamId"].members.$get({param:{teamId:Z},query:{}});if(!G.ok)throw Error("Failed to fetch members");return await G.json()}}),{data:Q}=Vz({queryKey:["teams",Z,"me"],queryFn:async()=>{let G=await X.api.teams[":teamId"].me.$get({param:{teamId:Z}});if(!G.ok)throw Error("Failed to fetch me");return await G.json()}}),_=X.api.teams[":teamId"].invite.$post,e=k({mutationFn:async(G)=>{let Y=await _(G);if(!Y.ok)throw Error("Failed to invite");return await Y.json()}}),d=k({mutationFn:async(G)=>{if(!(await X.api.projects[":projectId"].$delete({param:{projectId:G}})).ok)throw Error("Failed to delete project")},onSuccess:()=>{W.invalidateQueries({queryKey:["teams",Z,"projects"]})}}),dz=k({mutationFn:async(G)=>{let Y=await X.api.projects[":projectId"].$put({param:{projectId:G.id},json:{enableNotification:!G.enableNotification}});if(!Y.ok)throw Error("Failed to update project notification settings");return await Y.json()},onSuccess:()=>{W.invalidateQueries({queryKey:["teams",Z,"projects"]}),Yz.success(V.project_notification_updated())},onError:(G)=>{Yz.error(G instanceof Error?G.message:V.failed_update_project_notification())}}),Hz=()=>{B("create"),P(void 0),O(!0)},pz=()=>{R("create"),setTimeout(()=>{R(null)},100),setTimeout(()=>{Hz()},200)},cz=(G)=>{B("edit"),P(G),O(!0)},xz=(G)=>{w(G),g(""),U(!0)},mz=async()=>{if(A&&S==="delete")try{await d.mutateAsync(A.id),U(!1)}catch(G){console.error(G)}},iz=(G,Y)=>{if(Y.detail>1)return;R(G),setTimeout(()=>{R(null)},100),setTimeout(()=>{F({to:"/projects/$projectId",params:{projectId:G}})},200)},nz=async(G)=>{return(await e.mutateAsync({param:{teamId:Z},json:{role:G}})).code},az=k({mutationFn:async({userId:G,role:Y})=>{if(!(await X.api.teams[":teamId"].members[":userId"].$patch({param:{teamId:Z,userId:G},json:{role:Y}})).ok)throw Error("Failed to update member role")},onSuccess:()=>{W.invalidateQueries({queryKey:["teams",Z,"members"]})}}),jz=k({mutationFn:async(G)=>{if(!(await X.api.teams[":teamId"].members[":userId"].$delete({param:{teamId:Z,userId:G}})).ok)throw Error("Failed to remove member")},onSuccess:()=>{W.invalidateQueries({queryKey:["teams",Z,"members"]})}}),rz=(G)=>{if(!G)return"??";return G.split(" ").map((Y)=>Y[0]).slice(0,2).join("").toUpperCase()},oz=(G,Y)=>{r(G),o(Y)},p=Array.isArray(l)?l:[];return J("div",{className:"flex-1 overflow-y-auto p-4",children:[J("div",{className:"flex flex-wrap items-center justify-between mb-4 gap-4",children:[z("h1",{className:"text-2xl font-bold",children:V.projects()}),J("div",{className:"flex flex-wrap items-center gap-4",children:[J("div",{className:"flex items-center -space-x-2 cursor-pointer hover:opacity-90",onClick:()=>u(!0),children:[p.slice(0,3).map((G)=>J(Sz,{className:"border-2 border-background w-8 h-8",children:[G.image&&z(Mz,{src:G.image,alt:G.name,className:"object-cover"}),z(vz,{className:"text-[10px]",children:rz(G.name)})]},G.id)),p.length>3&&J("div",{className:"flex items-center justify-center w-8 h-8 rounded-full border-2 border-background bg-muted text-[10px] font-medium",children:["+",p.length-3]})]}),z(Nz,{sortBy:y,sortDirection:D,onSortChange:oz}),$&&J(E,{className:"bg-orange-600 hover:bg-orange-700 text-white gap-2",onClick:Hz,children:[z(Zz,{className:"w-4 h-4"}),V.create_project()]})]})]}),J("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6 gap-4",children:[s.data?.map((G)=>z("div",{className:_z("shadow-md relative border rounded-xl overflow-hidden cursor-pointer transition-transform duration-100 ease-in-out",q===G.id?"scale-95":"scale-100"),onClick:(Y)=>iz(G.id,Y),children:J("div",{className:"flex flex-col",children:[J("div",{className:"relative w-full h-full aspect-square flex items-center justify-center bg-zinc-400/20",children:[G.coverImage?z("img",{src:G.coverImage,alt:G.name,className:"w-full h-full object-cover rounded"}):J("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 180.95 164.7",preserveAspectRatio:"xMidYMid slice",className:"w-full h-full object-cover rounded",children:[z("polygon",{fill:"#FC9F8E",points:"0 18.5 0 76.0 151.69 164.7 180.95 164.7 180.95 113.6"}),z("polygon",{fill:"#FEBAB8",points:"0 0 74.58 61.5 90.53 51.6 110.33 63.9 180.95 18.9 180.95 0"}),z("polyline",{fill:"#FAA5A5",points:"0 18.5 74.58 61.5 90.53 51.6 110.33 63.9 180.95 18.9 180.95 0 0 0"}),z("polygon",{fill:"#EC5B6C",points:"0 76.0 0 164.7 151.69 164.7"}),z("polygon",{fill:"#E85C71",points:"180.95 18.9 110.33 63.9 117.37 68.0 117.26 73.4 180.95 113.6"}),z("polygon",{fill:"#C8405B",points:"117.26 73.4 117.37 99.0 90.53 114.9 174.35 164.7 180.95 164.7 180.95 113.6"}),z("polygon",{fill:"#FFCCBE",points:"90.53 51.6 63.69 68.1 90.53 83.4"}),z("path",{fill:"#FB9991",d:"M 90.53 51.6 L 90.53 61.3 L 100.87 67.4 L 90.53 73.5 L 90.53 83.4 L 117.37 68.0 C 117.15 67.6 90.53 51.6 90.53 51.6 Z"}),z("path",{fill:"#FFEACD",d:"M 63.69 68.1 C 63.47 68.5 64.02 99.3 64.02 99.3 C 64.02 99.3 64.46 99.6 64.9 99.9 L 90.53 83.4 L 63.69 68.1 Z"}),z("polygon",{fill:"#FFCFB5",points:"64.02 99.3 90.53 114.9 90.53 83.4"}),z("path",{fill:"#F67D73",d:"M 90.53 83.4 L 90.53 114.9 L 117.37 99.0 Z"}),z("path",{fill:"#F26560",d:"M 90.53 83.4 L 117.37 99.0 L 117.37 68.0 Z"}),z("polygon",{fill:"#EB5F5B",points:"80.08 67.5 90.53 73.5 90.53 61.3"}),z("polygon",{fill:"#DB4D50",points:"90.53 61.3 90.53 73.5 100.87 67.4"})]}),z("div",{className:"absolute bottom-0 left-0 w-full h-[65%] bg-linear-to-t from-black/35 to-black/0"}),z("p",{className:"absolute left-1 bottom-2 text-white",children:G.name})]}),J("div",{className:"px-2 h-10 flex justify-between items-center",children:[J("p",{className:"truncate pr-1 text-xs text-muted-foreground",children:[V.updated_ago()," ",hz(G.updatedAt??"")]}),z("div",{onClick:(Y)=>Y.stopPropagation(),children:J(b,{modal:!1,children:[z(C,{asChild:!0,children:z("button",{className:"hover:bg-muted outline-none flex px-1",children:z(Bz,{className:"w-5 h-5 text-muted-foreground"})})}),J(f,{align:"end",children:[$&&z(M,{onClick:(Y)=>{Y.stopPropagation(),cz(G)},children:V.project_settings()}),J(M,{className:"flex items-center justify-between gap-4 cursor-pointer",onSelect:(Y)=>{Y.preventDefault(),dz.mutate(G)},children:[z("span",{children:V.notification()}),z(a,{checked:G.enableNotification??!0,className:"pointer-events-none"})]}),T&&z(M,{className:"text-destructive focus:text-destructive",onClick:()=>xz(G),children:V.delete()})]})]})})]})]})},G.id)),$&&z("div",{className:_z("shadow-md relative border rounded-xl overflow-hidden cursor-pointer transition-transform duration-100 ease-in-out border-dashed hover:border-orange-600/50 group",q==="create"?"scale-95":"scale-100"),onClick:pz,children:J("div",{className:"flex flex-col",children:[z("div",{className:"relative w-full aspect-square flex items-center justify-center bg-zinc-400/5 group-hover:bg-orange-600/5 transition-colors",children:z(Zz,{className:"w-8 h-8 text-zinc-400 group-hover:text-orange-600 transition-colors"})}),z("div",{className:"px-2 h-10 flex items-center justify-center bg-zinc-400/10 border-t group-hover:bg-orange-600/10 transition-colors",children:z("p",{className:"text-sm text-muted-foreground group-hover:text-orange-600 transition-colors",children:V.create_project()})})]})})]}),z(Fz,{open:H,onOpenChange:O,mode:v,teamId:Z,project:I}),z(yz,{open:h,onOpenChange:U,children:J(Dz,{children:[J(bz,{children:[z(fz,{children:V.are_you_sure()}),J(Iz,{children:[V.delete_project_warning({name:A?.name??""}),J("div",{className:"mt-4 flex flex-col gap-2 text-foreground",children:[z("span",{className:"text-sm font-medium",children:V.type_delete_to_confirm()}),z(n,{value:S,onChange:(G)=>g(G.target.value),placeholder:V.delete_placeholder(),className:"h-9",autoFocus:!0})]})]})]}),J(Cz,{children:[z(uz,{disabled:d.isPending,children:V.cancel()}),z(gz,{onClick:(G)=>{G.preventDefault(),mz()},disabled:S!=="delete"||d.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:d.isPending?V.deleting():V.delete()})]})]})}),z(lz,{open:j,onOpenChange:u,title:V.team_members(),type:"team",members:p,isOwner:Q?.role==="owner",onInvite:nz,onUpdateRole:async(G,Y)=>{await az.mutateAsync({userId:G,role:Y})},onRemoveMember:async(G)=>{await jz.mutateAsync(G)},currentUserId:Q?.id})]})}var sz=Pz("/teams/$teamId/")({component:tz});export{sz as Route};
@@ -1,2 +1,2 @@
1
- import{Cj as e,Fj as a,Tg as t}from"./chunk-wf4d1anc.js";function n({className:i,size:r="default",...s}){return t(e.Root,{"data-slot":"switch","data-size":r,className:a("peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80",i),...s,children:t(e.Thumb,{"data-slot":"switch-thumb",className:a("pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0 dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground")})})}
1
+ import{ck as e,gk as a,oh as t}from"./chunk-nyhqy6q2.js";function n({className:i,size:r="default",...s}){return t(e.Root,{"data-slot":"switch","data-size":r,className:a("peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80",i),...s,children:t(e.Thumb,{"data-slot":"switch-thumb",className:a("pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0 dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground")})})}
2
2
  export{n as Za};