gemi 0.244.0 → 0.246.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (235) hide show
  1. package/dist/ai/AgentController.d.ts +4 -3
  2. package/dist/ai/AgentController.d.ts.map +1 -1
  3. package/dist/ai/client/index.js +87 -14
  4. package/dist/ai/client/index.js.map +1 -1
  5. package/dist/ai/index.js +30 -30
  6. package/dist/ai/index.js.map +3 -3
  7. package/dist/ai/testing/index.js +2 -2
  8. package/dist/ai/testing/index.js.map +1 -1
  9. package/dist/ai/useChat.d.ts +5 -3
  10. package/dist/ai/useChat.d.ts.map +1 -1
  11. package/dist/app/index.js +1 -1
  12. package/dist/bun/plugin.js +1 -1
  13. package/dist/bun/preload.js +1 -1
  14. package/dist/{chunk-t77xnb8k.js → chunk-11fc5nve.js} +3 -3
  15. package/dist/{chunk-t77xnb8k.js.map → chunk-11fc5nve.js.map} +1 -1
  16. package/dist/{chunk-7mxwstm2.js → chunk-1gptecxr.js} +2 -2
  17. package/dist/{chunk-7mxwstm2.js.map → chunk-1gptecxr.js.map} +1 -1
  18. package/dist/{chunk-n537kc55.js → chunk-1v7qcmr7.js} +2 -2
  19. package/dist/{chunk-n537kc55.js.map → chunk-1v7qcmr7.js.map} +1 -1
  20. package/dist/{chunk-632nqkza.js → chunk-2kt5kgaq.js} +2 -2
  21. package/dist/{chunk-632nqkza.js.map → chunk-2kt5kgaq.js.map} +1 -1
  22. package/dist/{chunk-s0azv6dd.js → chunk-31fgprsv.js} +2 -2
  23. package/dist/{chunk-s0azv6dd.js.map → chunk-31fgprsv.js.map} +1 -1
  24. package/dist/{chunk-wac3gv1t.js → chunk-3n7rmrd1.js} +2 -2
  25. package/dist/{chunk-wac3gv1t.js.map → chunk-3n7rmrd1.js.map} +1 -1
  26. package/dist/{chunk-vqtzwnwr.js → chunk-4md5qxe1.js} +2 -2
  27. package/dist/{chunk-vqtzwnwr.js.map → chunk-4md5qxe1.js.map} +1 -1
  28. package/dist/{chunk-tws22txn.js → chunk-5961jw1h.js} +2 -2
  29. package/dist/{chunk-7ztbpqed.js.map → chunk-5961jw1h.js.map} +1 -1
  30. package/dist/{chunk-65m459jb.js → chunk-5npzvdh9.js} +2 -2
  31. package/dist/{chunk-65m459jb.js.map → chunk-5npzvdh9.js.map} +1 -1
  32. package/dist/{chunk-4y0j6c56.js → chunk-71ap56wq.js} +4 -4
  33. package/dist/{chunk-4y0j6c56.js.map → chunk-71ap56wq.js.map} +1 -1
  34. package/dist/{chunk-7ztbpqed.js → chunk-748evey0.js} +2 -2
  35. package/dist/{chunk-tws22txn.js.map → chunk-748evey0.js.map} +1 -1
  36. package/dist/{chunk-bbhrs7s3.js → chunk-7gf0hjth.js} +2 -2
  37. package/dist/{chunk-bbhrs7s3.js.map → chunk-7gf0hjth.js.map} +1 -1
  38. package/dist/{chunk-xvnjahea.js → chunk-7jpfvs5v.js} +2 -2
  39. package/dist/{chunk-xvnjahea.js.map → chunk-7jpfvs5v.js.map} +1 -1
  40. package/dist/chunk-8fb7gey2.js +5 -0
  41. package/dist/{chunk-8dga75cv.js.map → chunk-8fb7gey2.js.map} +1 -1
  42. package/dist/{chunk-e0e43wvq.js → chunk-8vzxnjp4.js} +2 -2
  43. package/dist/{chunk-e0e43wvq.js.map → chunk-8vzxnjp4.js.map} +1 -1
  44. package/dist/{chunk-p03jdwc1.js → chunk-akvv3mvx.js} +2 -2
  45. package/dist/{chunk-p03jdwc1.js.map → chunk-akvv3mvx.js.map} +1 -1
  46. package/dist/{chunk-dfat5nmk.js → chunk-b0hjrnn6.js} +3 -3
  47. package/dist/{chunk-dfat5nmk.js.map → chunk-b0hjrnn6.js.map} +1 -1
  48. package/dist/{chunk-sew755q5.js → chunk-b1dxjd33.js} +1 -1
  49. package/dist/{chunk-e4a6smfv.js → chunk-b1gt8s41.js} +1 -1
  50. package/dist/{chunk-3tpj5t10.js → chunk-b5g6ch5p.js} +2 -2
  51. package/dist/{chunk-3tpj5t10.js.map → chunk-b5g6ch5p.js.map} +1 -1
  52. package/dist/{chunk-ed64ynex.js → chunk-ba2yfwv1.js} +2 -2
  53. package/dist/{chunk-ed64ynex.js.map → chunk-ba2yfwv1.js.map} +1 -1
  54. package/dist/{chunk-ac135mmf.js → chunk-bcpxyv8m.js} +2 -2
  55. package/dist/{chunk-ac135mmf.js.map → chunk-bcpxyv8m.js.map} +1 -1
  56. package/dist/{chunk-h6dzn5j6.js → chunk-be0r4rgs.js} +2 -2
  57. package/dist/{chunk-h6dzn5j6.js.map → chunk-be0r4rgs.js.map} +1 -1
  58. package/dist/{chunk-57n0m9fv.js → chunk-bv76ypa6.js} +2 -2
  59. package/dist/{chunk-57n0m9fv.js.map → chunk-bv76ypa6.js.map} +1 -1
  60. package/dist/{chunk-9xm5z33t.js → chunk-c2cdf01r.js} +2 -2
  61. package/dist/{chunk-9xm5z33t.js.map → chunk-c2cdf01r.js.map} +1 -1
  62. package/dist/{chunk-26pfh03x.js → chunk-cyxsmd4q.js} +3 -3
  63. package/dist/{chunk-26pfh03x.js.map → chunk-cyxsmd4q.js.map} +1 -1
  64. package/dist/{chunk-5pfbqc1c.js → chunk-d8ekdvsw.js} +2 -2
  65. package/dist/{chunk-5pfbqc1c.js.map → chunk-d8ekdvsw.js.map} +1 -1
  66. package/dist/{chunk-093j5rh8.js → chunk-dapd4vkd.js} +3 -3
  67. package/dist/{chunk-093j5rh8.js.map → chunk-dapd4vkd.js.map} +1 -1
  68. package/dist/{chunk-gqw25apr.js → chunk-dx4h7rap.js} +2 -2
  69. package/dist/{chunk-gqw25apr.js.map → chunk-dx4h7rap.js.map} +1 -1
  70. package/dist/{chunk-mbstaydx.js → chunk-dxtxvxcz.js} +2 -2
  71. package/dist/{chunk-mbstaydx.js.map → chunk-dxtxvxcz.js.map} +1 -1
  72. package/dist/{chunk-7c48nxqb.js → chunk-exw8wa9c.js} +3 -3
  73. package/dist/{chunk-7c48nxqb.js.map → chunk-exw8wa9c.js.map} +1 -1
  74. package/dist/{chunk-fs2cdxry.js → chunk-fe7f6jbc.js} +2 -2
  75. package/dist/{chunk-fs2cdxry.js.map → chunk-fe7f6jbc.js.map} +1 -1
  76. package/dist/{chunk-fb3qkmwh.js → chunk-fesg4q4p.js} +2 -2
  77. package/dist/{chunk-fb3qkmwh.js.map → chunk-fesg4q4p.js.map} +1 -1
  78. package/dist/{chunk-0jmh2271.js → chunk-ffb2mytk.js} +2 -2
  79. package/dist/{chunk-0jmh2271.js.map → chunk-ffb2mytk.js.map} +1 -1
  80. package/dist/{chunk-t67dbfqs.js → chunk-fgmd1hn7.js} +3 -3
  81. package/dist/{chunk-t67dbfqs.js.map → chunk-fgmd1hn7.js.map} +1 -1
  82. package/dist/{chunk-fwmzms6e.js → chunk-ggh1hzdb.js} +2 -2
  83. package/dist/{chunk-fwmzms6e.js.map → chunk-ggh1hzdb.js.map} +1 -1
  84. package/dist/{chunk-kjz6jh54.js → chunk-gm14dthh.js} +3 -3
  85. package/dist/{chunk-kjz6jh54.js.map → chunk-gm14dthh.js.map} +1 -1
  86. package/dist/{chunk-d39h1mrz.js → chunk-gmkzq212.js} +3 -3
  87. package/dist/{chunk-d39h1mrz.js.map → chunk-gmkzq212.js.map} +1 -1
  88. package/dist/{chunk-54v3y7mg.js → chunk-gx5yhz2m.js} +3 -3
  89. package/dist/{chunk-54v3y7mg.js.map → chunk-gx5yhz2m.js.map} +1 -1
  90. package/dist/{chunk-ge5m9qdt.js → chunk-h02cqzar.js} +2 -2
  91. package/dist/{chunk-ge5m9qdt.js.map → chunk-h02cqzar.js.map} +1 -1
  92. package/dist/{chunk-hvw25pe3.js → chunk-h2ar54x8.js} +1 -1
  93. package/dist/{chunk-kejexfsg.js → chunk-h6yse9wf.js} +2 -2
  94. package/dist/{chunk-kejexfsg.js.map → chunk-h6yse9wf.js.map} +1 -1
  95. package/dist/{chunk-n8cm2sw6.js → chunk-hh3m9be7.js} +2 -2
  96. package/dist/{chunk-n8cm2sw6.js.map → chunk-hh3m9be7.js.map} +1 -1
  97. package/dist/{chunk-11hmhyk5.js → chunk-hhka8j31.js} +3 -3
  98. package/dist/{chunk-11hmhyk5.js.map → chunk-hhka8j31.js.map} +1 -1
  99. package/dist/{chunk-xy5evkaz.js → chunk-hmdpf21x.js} +1 -1
  100. package/dist/{chunk-ss0gk90s.js → chunk-jv7n3p61.js} +2 -2
  101. package/dist/{chunk-ss0gk90s.js.map → chunk-jv7n3p61.js.map} +1 -1
  102. package/dist/{chunk-2yvzc5tq.js → chunk-jzg9zdtj.js} +2 -2
  103. package/dist/{chunk-2yvzc5tq.js.map → chunk-jzg9zdtj.js.map} +1 -1
  104. package/dist/{chunk-zpnxr23b.js → chunk-k5vt2kz6.js} +2 -2
  105. package/dist/{chunk-zpnxr23b.js.map → chunk-k5vt2kz6.js.map} +1 -1
  106. package/dist/{chunk-yqsnrp2b.js → chunk-kck2q09f.js} +2 -2
  107. package/dist/{chunk-yqsnrp2b.js.map → chunk-kck2q09f.js.map} +1 -1
  108. package/dist/{chunk-9cxs1q57.js → chunk-ket76475.js} +2 -2
  109. package/dist/{chunk-9cxs1q57.js.map → chunk-ket76475.js.map} +1 -1
  110. package/dist/{chunk-ye1kbxkx.js → chunk-kjzvrx2p.js} +3 -3
  111. package/dist/{chunk-ye1kbxkx.js.map → chunk-kjzvrx2p.js.map} +1 -1
  112. package/dist/{chunk-v3ddktnq.js → chunk-kss2kkmm.js} +3 -3
  113. package/dist/{chunk-v3ddktnq.js.map → chunk-kss2kkmm.js.map} +1 -1
  114. package/dist/{chunk-jr53em8y.js → chunk-mbfjxyq0.js} +2 -2
  115. package/dist/{chunk-jr53em8y.js.map → chunk-mbfjxyq0.js.map} +1 -1
  116. package/dist/{chunk-w9v8bbp8.js → chunk-mc7p37d0.js} +2 -2
  117. package/dist/{chunk-w9v8bbp8.js.map → chunk-mc7p37d0.js.map} +1 -1
  118. package/dist/{chunk-rffa9x3d.js → chunk-n26d4z3t.js} +2 -2
  119. package/dist/{chunk-rffa9x3d.js.map → chunk-n26d4z3t.js.map} +1 -1
  120. package/dist/{chunk-646bqwp8.js → chunk-n8kke112.js} +2 -2
  121. package/dist/{chunk-646bqwp8.js.map → chunk-n8kke112.js.map} +1 -1
  122. package/dist/{chunk-vh6vc4h1.js → chunk-nbdjbde4.js} +3 -3
  123. package/dist/{chunk-vh6vc4h1.js.map → chunk-nbdjbde4.js.map} +1 -1
  124. package/dist/{chunk-2mtm1yt6.js → chunk-p8ypq16v.js} +2 -2
  125. package/dist/{chunk-2mtm1yt6.js.map → chunk-p8ypq16v.js.map} +1 -1
  126. package/dist/{chunk-fy4142fv.js → chunk-ptm1d4vp.js} +2 -2
  127. package/dist/{chunk-fy4142fv.js.map → chunk-ptm1d4vp.js.map} +1 -1
  128. package/dist/chunk-q0k1j5a4.js +10 -0
  129. package/dist/{chunk-q94v5skw.js.map → chunk-q0k1j5a4.js.map} +4 -6
  130. package/dist/{chunk-t4eeg7j1.js → chunk-qbm49b1t.js} +3 -3
  131. package/dist/{chunk-t4eeg7j1.js.map → chunk-qbm49b1t.js.map} +1 -1
  132. package/dist/{chunk-eb4mx34p.js → chunk-r9266nax.js} +3 -3
  133. package/dist/{chunk-eb4mx34p.js.map → chunk-r9266nax.js.map} +1 -1
  134. package/dist/{chunk-e3m0anq1.js → chunk-rqknf5k0.js} +3 -3
  135. package/dist/{chunk-e3m0anq1.js.map → chunk-rqknf5k0.js.map} +1 -1
  136. package/dist/{chunk-4f8qpzsw.js → chunk-rtmz9yvj.js} +1 -1
  137. package/dist/{chunk-bsmy8vqs.js → chunk-rxtec0qr.js} +2 -2
  138. package/dist/{chunk-bsmy8vqs.js.map → chunk-rxtec0qr.js.map} +1 -1
  139. package/dist/{chunk-7qt9pxm6.js → chunk-s4xekxsk.js} +1 -1
  140. package/dist/{chunk-sp79baph.js → chunk-se0tnb9x.js} +2 -2
  141. package/dist/{chunk-sp79baph.js.map → chunk-se0tnb9x.js.map} +1 -1
  142. package/dist/chunk-t56z2zec.js +88 -0
  143. package/dist/{chunk-v040m0k2.js.map → chunk-t56z2zec.js.map} +15 -12
  144. package/dist/{chunk-fjh3xaq7.js → chunk-thdhm39v.js} +2 -2
  145. package/dist/{chunk-fjh3xaq7.js.map → chunk-thdhm39v.js.map} +1 -1
  146. package/dist/{chunk-zrqqnfrs.js → chunk-vg0yj29r.js} +2 -2
  147. package/dist/{chunk-zrqqnfrs.js.map → chunk-vg0yj29r.js.map} +1 -1
  148. package/dist/{chunk-110ecy3e.js → chunk-vq0gcvcy.js} +2 -2
  149. package/dist/{chunk-110ecy3e.js.map → chunk-vq0gcvcy.js.map} +1 -1
  150. package/dist/{chunk-3ywtqcxt.js → chunk-w31afsrx.js} +2 -2
  151. package/dist/{chunk-3ywtqcxt.js.map → chunk-w31afsrx.js.map} +1 -1
  152. package/dist/{chunk-27f9z8yk.js → chunk-wr7xq82n.js} +3 -3
  153. package/dist/{chunk-27f9z8yk.js.map → chunk-wr7xq82n.js.map} +1 -1
  154. package/dist/{chunk-2g6cmkrn.js → chunk-xac2vwtq.js} +3 -3
  155. package/dist/{chunk-2g6cmkrn.js.map → chunk-xac2vwtq.js.map} +1 -1
  156. package/dist/{chunk-mjfnv2r9.js → chunk-y1qmedgq.js} +2 -2
  157. package/dist/{chunk-mjfnv2r9.js.map → chunk-y1qmedgq.js.map} +1 -1
  158. package/dist/{chunk-c0hxmw3a.js → chunk-z5ha9z3m.js} +2 -2
  159. package/dist/{chunk-c0hxmw3a.js.map → chunk-z5ha9z3m.js.map} +1 -1
  160. package/dist/{chunk-yrna0ajq.js → chunk-z5wwhgsg.js} +3 -3
  161. package/dist/{chunk-yrna0ajq.js.map → chunk-z5wwhgsg.js.map} +1 -1
  162. package/dist/{chunk-0tsnmrf9.js → chunk-zc42brkr.js} +2 -2
  163. package/dist/{chunk-0tsnmrf9.js.map → chunk-zc42brkr.js.map} +1 -1
  164. package/dist/{chunk-hhaxacwh.js → chunk-zez3fjnf.js} +2 -2
  165. package/dist/{chunk-hhaxacwh.js.map → chunk-zez3fjnf.js.map} +1 -1
  166. package/dist/{chunk-rwyn40p1.js → chunk-ztg4pgqe.js} +2 -2
  167. package/dist/{chunk-rwyn40p1.js.map → chunk-ztg4pgqe.js.map} +1 -1
  168. package/dist/config/index.js +1 -1
  169. package/dist/console/run.js +2 -2
  170. package/dist/console/run.js.map +1 -1
  171. package/dist/container/index.js +2 -2
  172. package/dist/container/index.js.map +1 -1
  173. package/dist/database/index.js +2 -2
  174. package/dist/database/index.js.map +1 -1
  175. package/dist/email/index.js +2 -2
  176. package/dist/email/index.js.map +1 -1
  177. package/dist/facades/index.js +2 -2
  178. package/dist/facades/index.js.map +1 -1
  179. package/dist/foundation/index.js +2 -2
  180. package/dist/foundation/index.js.map +1 -1
  181. package/dist/http/ApiRouter.d.ts +11 -0
  182. package/dist/http/ApiRouter.d.ts.map +1 -1
  183. package/dist/http/McpEndpoint.d.ts +228 -0
  184. package/dist/http/McpEndpoint.d.ts.map +1 -0
  185. package/dist/http/RateLimitMiddleware.d.ts +7 -0
  186. package/dist/http/RateLimitMiddleware.d.ts.map +1 -1
  187. package/dist/http/index.d.ts +1 -0
  188. package/dist/http/index.d.ts.map +1 -1
  189. package/dist/http/index.js +2 -2
  190. package/dist/http/index.js.map +1 -1
  191. package/dist/i18n/dictionaryRuntime.js +2 -2
  192. package/dist/i18n/dictionaryRuntime.js.map +1 -1
  193. package/dist/i18n/index.js +2 -2
  194. package/dist/i18n/index.js.map +1 -1
  195. package/dist/kernel/index.js +2 -2
  196. package/dist/kernel/index.js.map +1 -1
  197. package/dist/orm/index.js +2 -2
  198. package/dist/orm/index.js.map +1 -1
  199. package/dist/probe/index.js +2 -2
  200. package/dist/probe/index.js.map +1 -1
  201. package/dist/server/index.js +2 -2
  202. package/dist/server/index.js.map +1 -1
  203. package/dist/services/index.js +2 -2
  204. package/dist/services/index.js.map +1 -1
  205. package/dist/services/mcp/http/McpHttpServer.d.ts +0 -1
  206. package/dist/services/mcp/http/McpHttpServer.d.ts.map +1 -1
  207. package/dist/services/mcp/http/protocol.d.ts +6 -0
  208. package/dist/services/mcp/http/protocol.d.ts.map +1 -1
  209. package/dist/services/middleware/MiddlewareRegistry.d.ts +12 -0
  210. package/dist/services/middleware/MiddlewareRegistry.d.ts.map +1 -1
  211. package/dist/services/queue/work.js +2 -2
  212. package/dist/services/queue/work.js.map +1 -1
  213. package/dist/services/router/DomainResolver.d.ts +22 -5
  214. package/dist/services/router/DomainResolver.d.ts.map +1 -1
  215. package/dist/services/router/DomainRouter.d.ts +1 -1
  216. package/dist/services/router/DomainRouter.d.ts.map +1 -1
  217. package/dist/services/router/config.d.ts +42 -4
  218. package/dist/services/router/config.d.ts.map +1 -1
  219. package/dist/stats/route-table.js +1 -1
  220. package/dist/stats/route-table.js.map +1 -1
  221. package/dist/stats/routeTable.d.ts +1 -1
  222. package/dist/stats/routeTable.d.ts.map +1 -1
  223. package/dist/support/index.js +2 -2
  224. package/dist/support/index.js.map +1 -1
  225. package/dist/vitest/index.js +1 -1
  226. package/package.json +1 -1
  227. package/dist/chunk-8dga75cv.js +0 -5
  228. package/dist/chunk-q94v5skw.js +0 -10
  229. package/dist/chunk-v040m0k2.js +0 -88
  230. /package/dist/{chunk-sew755q5.js.map → chunk-b1dxjd33.js.map} +0 -0
  231. /package/dist/{chunk-e4a6smfv.js.map → chunk-b1gt8s41.js.map} +0 -0
  232. /package/dist/{chunk-hvw25pe3.js.map → chunk-h2ar54x8.js.map} +0 -0
  233. /package/dist/{chunk-xy5evkaz.js.map → chunk-hmdpf21x.js.map} +0 -0
  234. /package/dist/{chunk-4f8qpzsw.js.map → chunk-rtmz9yvj.js.map} +0 -0
  235. /package/dist/{chunk-7qt9pxm6.js.map → chunk-s4xekxsk.js.map} +0 -0
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{T as M}from"./chunk-0tsnmrf9.js";import{an as E}from"./chunk-7ztbpqed.js";class x{marshaller;serializer;deserializer;serdeContext;defaultContentType;constructor({marshaller:i,serializer:n,deserializer:o,serdeContext:c,defaultContentType:y}){this.marshaller=i,this.serializer=n,this.deserializer=o,this.serdeContext=c,this.defaultContentType=y}async serializeEventStream({eventStream:i,requestSchema:n,initialRequest:o}){let c=this.marshaller,y=n.getEventStreamMember(),p=n.getMemberSchema(y),d=this.serializer,f=this.defaultContentType,h=Symbol("initialRequestMarker"),S={async*[Symbol.asyncIterator](){if(o){let r={":event-type":{type:"string",value:"initial-request"},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:f}};d.write(n,o);let t=d.flush();yield{[h]:!0,headers:r,body:t}}for await(let r of i)yield r}};return c.serialize(S,(r)=>{if(r[h])return{headers:r.headers,body:r.body};let t=Object.keys(r).find((s)=>{return s!=="__type"})??"",{additionalHeaders:e,body:a,eventType:l,explicitPayloadContentType:m}=this.writeEventBody(t,p,r);return{headers:{":event-type":{type:"string",value:l},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:m??f},...e},body:a}})}async deserializeEventStream({response:i,responseSchema:n,initialResponseContainer:o}){let c=this.marshaller,y=n.getEventStreamMember(),d=n.getMemberSchema(y).getMemberSchemas(),f=Symbol("initialResponseMarker"),h=c.deserialize(i.body,async(t)=>{let e=Object.keys(t).find((l)=>{return l!=="__type"})??"",a=t[e].body;if(e==="initial-response"){let l=await this.deserializer.read(n,a);return delete l[y],{[f]:!0,...l}}else if(e in d){let l=d[e];if(l.isStructSchema()){let m={},u=!1;for(let[s,g]of l.structIterator()){let{eventHeader:v,eventPayload:w}=g.getMergedTraits();if(u=u||Boolean(v||w),w){if(g.isBlobSchema())m[s]=a;else if(g.isStringSchema())m[s]=(this.serdeContext?.utf8Encoder??z.toUtf8)(a);else if(g.isStructSchema())m[s]=await this.deserializer.read(g,a)}else if(v){let b=t[e].headers[s]?.value;if(b!=null)if(g.isNumericSchema())if(b&&typeof b==="object"&&"bytes"in b)m[s]=BigInt(b.toString());else m[s]=Number(b);else m[s]=b}}if(u)return{[e]:m};if(a.byteLength===0)return{[e]:{}}}return{[e]:await this.deserializer.read(l,a)}}else return{$unknown:t}}),S=h[Symbol.asyncIterator](),r=await S.next();if(r.done)return h;if(r.value?.[f]){if(!n)throw Error("@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.");for(let[t,e]of Object.entries(r.value))o[t]=e}return{async*[Symbol.asyncIterator](){if(!r?.value?.[f])yield r.value;while(!0){let{done:t,value:e}=await S.next();if(t)break;yield e}}}}writeEventBody(i,n,o){let c=this.serializer,y=i,p=null,d,f=(()=>{return n.getSchema()[4].includes(i)})(),h={};if(!f){let[t,e]=o[i];y=t,c.write(15,e)}else{let t=n.getMemberSchema(i);if(t.isStructSchema()){for(let[e,a]of t.structIterator()){let{eventHeader:l,eventPayload:m}=a.getMergedTraits();if(m)p=e;else if(l){let u=o[i][e],s="binary";if(a.isNumericSchema())if(-2147483648<=u&&u<=2147483647)s="integer";else s="long";else if(a.isTimestampSchema())s="timestamp";else if(a.isStringSchema())s="string";else if(a.isBooleanSchema())s="boolean";if(u!=null)h[e]={type:s,value:u},delete o[i][e]}}if(p!==null){let e=t.getMemberSchema(p);if(e.isBlobSchema())d="application/octet-stream";else if(e.isStringSchema())d="text/plain";c.write(e,o[i][p])}else c.write(t,o[i])}else if(t.isUnitSchema())c.write(t,{});else throw Error("@smithy/core/event-streams - non-struct member not supported in event stream union.")}let S=c.flush()??new Uint8Array;return{body:typeof S==="string"?(this.serdeContext?.utf8Decoder??z.fromUtf8)(S):S,eventType:y,explicitPayloadContentType:d,additionalHeaders:h}}}var z,T;var C=E(()=>{z=M();T=x});C();export{T as EventStreamSerde};export default {get EventStreamSerde(){return T}};
2
+ import{T as M}from"./chunk-zc42brkr.js";import{pn as E}from"./chunk-748evey0.js";class x{marshaller;serializer;deserializer;serdeContext;defaultContentType;constructor({marshaller:i,serializer:n,deserializer:o,serdeContext:c,defaultContentType:y}){this.marshaller=i,this.serializer=n,this.deserializer=o,this.serdeContext=c,this.defaultContentType=y}async serializeEventStream({eventStream:i,requestSchema:n,initialRequest:o}){let c=this.marshaller,y=n.getEventStreamMember(),p=n.getMemberSchema(y),d=this.serializer,f=this.defaultContentType,h=Symbol("initialRequestMarker"),S={async*[Symbol.asyncIterator](){if(o){let r={":event-type":{type:"string",value:"initial-request"},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:f}};d.write(n,o);let t=d.flush();yield{[h]:!0,headers:r,body:t}}for await(let r of i)yield r}};return c.serialize(S,(r)=>{if(r[h])return{headers:r.headers,body:r.body};let t=Object.keys(r).find((s)=>{return s!=="__type"})??"",{additionalHeaders:e,body:a,eventType:l,explicitPayloadContentType:m}=this.writeEventBody(t,p,r);return{headers:{":event-type":{type:"string",value:l},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:m??f},...e},body:a}})}async deserializeEventStream({response:i,responseSchema:n,initialResponseContainer:o}){let c=this.marshaller,y=n.getEventStreamMember(),d=n.getMemberSchema(y).getMemberSchemas(),f=Symbol("initialResponseMarker"),h=c.deserialize(i.body,async(t)=>{let e=Object.keys(t).find((l)=>{return l!=="__type"})??"",a=t[e].body;if(e==="initial-response"){let l=await this.deserializer.read(n,a);return delete l[y],{[f]:!0,...l}}else if(e in d){let l=d[e];if(l.isStructSchema()){let m={},u=!1;for(let[s,g]of l.structIterator()){let{eventHeader:v,eventPayload:w}=g.getMergedTraits();if(u=u||Boolean(v||w),w){if(g.isBlobSchema())m[s]=a;else if(g.isStringSchema())m[s]=(this.serdeContext?.utf8Encoder??z.toUtf8)(a);else if(g.isStructSchema())m[s]=await this.deserializer.read(g,a)}else if(v){let b=t[e].headers[s]?.value;if(b!=null)if(g.isNumericSchema())if(b&&typeof b==="object"&&"bytes"in b)m[s]=BigInt(b.toString());else m[s]=Number(b);else m[s]=b}}if(u)return{[e]:m};if(a.byteLength===0)return{[e]:{}}}return{[e]:await this.deserializer.read(l,a)}}else return{$unknown:t}}),S=h[Symbol.asyncIterator](),r=await S.next();if(r.done)return h;if(r.value?.[f]){if(!n)throw Error("@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.");for(let[t,e]of Object.entries(r.value))o[t]=e}return{async*[Symbol.asyncIterator](){if(!r?.value?.[f])yield r.value;while(!0){let{done:t,value:e}=await S.next();if(t)break;yield e}}}}writeEventBody(i,n,o){let c=this.serializer,y=i,p=null,d,f=(()=>{return n.getSchema()[4].includes(i)})(),h={};if(!f){let[t,e]=o[i];y=t,c.write(15,e)}else{let t=n.getMemberSchema(i);if(t.isStructSchema()){for(let[e,a]of t.structIterator()){let{eventHeader:l,eventPayload:m}=a.getMergedTraits();if(m)p=e;else if(l){let u=o[i][e],s="binary";if(a.isNumericSchema())if(-2147483648<=u&&u<=2147483647)s="integer";else s="long";else if(a.isTimestampSchema())s="timestamp";else if(a.isStringSchema())s="string";else if(a.isBooleanSchema())s="boolean";if(u!=null)h[e]={type:s,value:u},delete o[i][e]}}if(p!==null){let e=t.getMemberSchema(p);if(e.isBlobSchema())d="application/octet-stream";else if(e.isStringSchema())d="text/plain";c.write(e,o[i][p])}else c.write(t,o[i])}else if(t.isUnitSchema())c.write(t,{});else throw Error("@smithy/core/event-streams - non-struct member not supported in event stream union.")}let S=c.flush()??new Uint8Array;return{body:typeof S==="string"?(this.serdeContext?.utf8Decoder??z.fromUtf8)(S):S,eventType:y,explicitPayloadContentType:d,additionalHeaders:h}}}var z,T;var C=E(()=>{z=M();T=x});C();export{T as EventStreamSerde};export default {get EventStreamSerde(){return T}};
3
3
 
4
- //# debugId=6C0F7E5DFB8B747064756E2164756E21
4
+ //# debugId=889C80F94B3E227D64756E2164756E21
@@ -5,6 +5,6 @@
5
5
  "'use strict';\n\nvar utilUtf8 = require('@smithy/util-utf8');\n\nclass EventStreamSerde {\n marshaller;\n serializer;\n deserializer;\n serdeContext;\n defaultContentType;\n constructor({ marshaller, serializer, deserializer, serdeContext, defaultContentType, }) {\n this.marshaller = marshaller;\n this.serializer = serializer;\n this.deserializer = deserializer;\n this.serdeContext = serdeContext;\n this.defaultContentType = defaultContentType;\n }\n async serializeEventStream({ eventStream, requestSchema, initialRequest, }) {\n const marshaller = this.marshaller;\n const eventStreamMember = requestSchema.getEventStreamMember();\n const unionSchema = requestSchema.getMemberSchema(eventStreamMember);\n const serializer = this.serializer;\n const defaultContentType = this.defaultContentType;\n const initialRequestMarker = Symbol(\"initialRequestMarker\");\n const eventStreamIterable = {\n async *[Symbol.asyncIterator]() {\n if (initialRequest) {\n const headers = {\n \":event-type\": { type: \"string\", value: \"initial-request\" },\n \":message-type\": { type: \"string\", value: \"event\" },\n \":content-type\": { type: \"string\", value: defaultContentType },\n };\n serializer.write(requestSchema, initialRequest);\n const body = serializer.flush();\n yield {\n [initialRequestMarker]: true,\n headers,\n body,\n };\n }\n for await (const page of eventStream) {\n yield page;\n }\n },\n };\n return marshaller.serialize(eventStreamIterable, (event) => {\n if (event[initialRequestMarker]) {\n return {\n headers: event.headers,\n body: event.body,\n };\n }\n const unionMember = Object.keys(event).find((key) => {\n return key !== \"__type\";\n }) ?? \"\";\n const { additionalHeaders, body, eventType, explicitPayloadContentType } = this.writeEventBody(unionMember, unionSchema, event);\n const headers = {\n \":event-type\": { type: \"string\", value: eventType },\n \":message-type\": { type: \"string\", value: \"event\" },\n \":content-type\": { type: \"string\", value: explicitPayloadContentType ?? defaultContentType },\n ...additionalHeaders,\n };\n return {\n headers,\n body,\n };\n });\n }\n async deserializeEventStream({ response, responseSchema, initialResponseContainer, }) {\n const marshaller = this.marshaller;\n const eventStreamMember = responseSchema.getEventStreamMember();\n const unionSchema = responseSchema.getMemberSchema(eventStreamMember);\n const memberSchemas = unionSchema.getMemberSchemas();\n const initialResponseMarker = Symbol(\"initialResponseMarker\");\n const asyncIterable = marshaller.deserialize(response.body, async (event) => {\n const unionMember = Object.keys(event).find((key) => {\n return key !== \"__type\";\n }) ?? \"\";\n const body = event[unionMember].body;\n if (unionMember === \"initial-response\") {\n const dataObject = await this.deserializer.read(responseSchema, body);\n delete dataObject[eventStreamMember];\n return {\n [initialResponseMarker]: true,\n ...dataObject,\n };\n }\n else if (unionMember in memberSchemas) {\n const eventStreamSchema = memberSchemas[unionMember];\n if (eventStreamSchema.isStructSchema()) {\n const out = {};\n let hasBindings = false;\n for (const [name, member] of eventStreamSchema.structIterator()) {\n const { eventHeader, eventPayload } = member.getMergedTraits();\n hasBindings = hasBindings || Boolean(eventHeader || eventPayload);\n if (eventPayload) {\n if (member.isBlobSchema()) {\n out[name] = body;\n }\n else if (member.isStringSchema()) {\n out[name] = (this.serdeContext?.utf8Encoder ?? utilUtf8.toUtf8)(body);\n }\n else if (member.isStructSchema()) {\n out[name] = await this.deserializer.read(member, body);\n }\n }\n else if (eventHeader) {\n const value = event[unionMember].headers[name]?.value;\n if (value != null) {\n if (member.isNumericSchema()) {\n if (value && typeof value === \"object\" && \"bytes\" in value) {\n out[name] = BigInt(value.toString());\n }\n else {\n out[name] = Number(value);\n }\n }\n else {\n out[name] = value;\n }\n }\n }\n }\n if (hasBindings) {\n return {\n [unionMember]: out,\n };\n }\n if (body.byteLength === 0) {\n return {\n [unionMember]: {},\n };\n }\n }\n return {\n [unionMember]: await this.deserializer.read(eventStreamSchema, body),\n };\n }\n else {\n return {\n $unknown: event,\n };\n }\n });\n const asyncIterator = asyncIterable[Symbol.asyncIterator]();\n const firstEvent = await asyncIterator.next();\n if (firstEvent.done) {\n return asyncIterable;\n }\n if (firstEvent.value?.[initialResponseMarker]) {\n if (!responseSchema) {\n throw new Error(\"@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.\");\n }\n for (const [key, value] of Object.entries(firstEvent.value)) {\n initialResponseContainer[key] = value;\n }\n }\n return {\n async *[Symbol.asyncIterator]() {\n if (!firstEvent?.value?.[initialResponseMarker]) {\n yield firstEvent.value;\n }\n while (true) {\n const { done, value } = await asyncIterator.next();\n if (done) {\n break;\n }\n yield value;\n }\n },\n };\n }\n writeEventBody(unionMember, unionSchema, event) {\n const serializer = this.serializer;\n let eventType = unionMember;\n let explicitPayloadMember = null;\n let explicitPayloadContentType;\n const isKnownSchema = (() => {\n const struct = unionSchema.getSchema();\n return struct[4].includes(unionMember);\n })();\n const additionalHeaders = {};\n if (!isKnownSchema) {\n const [type, value] = event[unionMember];\n eventType = type;\n serializer.write(15, value);\n }\n else {\n const eventSchema = unionSchema.getMemberSchema(unionMember);\n if (eventSchema.isStructSchema()) {\n for (const [memberName, memberSchema] of eventSchema.structIterator()) {\n const { eventHeader, eventPayload } = memberSchema.getMergedTraits();\n if (eventPayload) {\n explicitPayloadMember = memberName;\n }\n else if (eventHeader) {\n const value = event[unionMember][memberName];\n let type = \"binary\";\n if (memberSchema.isNumericSchema()) {\n if ((-2) ** 31 <= value && value <= 2 ** 31 - 1) {\n type = \"integer\";\n }\n else {\n type = \"long\";\n }\n }\n else if (memberSchema.isTimestampSchema()) {\n type = \"timestamp\";\n }\n else if (memberSchema.isStringSchema()) {\n type = \"string\";\n }\n else if (memberSchema.isBooleanSchema()) {\n type = \"boolean\";\n }\n if (value != null) {\n additionalHeaders[memberName] = {\n type,\n value,\n };\n delete event[unionMember][memberName];\n }\n }\n }\n if (explicitPayloadMember !== null) {\n const payloadSchema = eventSchema.getMemberSchema(explicitPayloadMember);\n if (payloadSchema.isBlobSchema()) {\n explicitPayloadContentType = \"application/octet-stream\";\n }\n else if (payloadSchema.isStringSchema()) {\n explicitPayloadContentType = \"text/plain\";\n }\n serializer.write(payloadSchema, event[unionMember][explicitPayloadMember]);\n }\n else {\n serializer.write(eventSchema, event[unionMember]);\n }\n }\n else if (eventSchema.isUnitSchema()) {\n serializer.write(eventSchema, {});\n }\n else {\n throw new Error(\"@smithy/core/event-streams - non-struct member not supported in event stream union.\");\n }\n }\n const messageSerialization = serializer.flush() ?? new Uint8Array();\n const body = typeof messageSerialization === \"string\"\n ? (this.serdeContext?.utf8Decoder ?? utilUtf8.fromUtf8)(messageSerialization)\n : messageSerialization;\n return {\n body,\n eventType,\n explicitPayloadContentType,\n additionalHeaders,\n };\n }\n}\n\nexports.EventStreamSerde = EventStreamSerde;\n"
6
6
  ],
7
7
  "mappings": ";uFAIA,AAAM,CAAiB,CACnB,WACA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AAO,UAEX,GAAI,GAAS,KACT,EAAkB,GAAc,CAC5B,OACA,OACJ,EACA,OAAO,EAAM,GAAa,IAItC,GAAI,IAA0B,KAAM,CAChC,IAAM,EAAgB,EAAY,gBAAgB,CAAqB,EACvE,GAAI,EAAc,aAAa,EAC3B,EAA6B,2BAE5B,QAAI,EAAc,eAAe,EAClC,EAA6B,aAEjC,EAAW,MAAM,EAAe,EAAM,GAAa,EAAsB,EAGzE,OAAW,MAAM,EAAa,EAAM,EAAY,EAGnD,QAAI,EAAY,aAAa,EAC9B,EAAW,MAAM,EAAa,CAAC,CAAC,EAGhC,WAAU,MAAM,qFAAqF,EAG7G,IAAM,EAAuB,EAAW,MAAM,GAAK,IAAI,WAIvD,MAAO,CACH,KAJS,OAAO,IAAyB,UACtC,KAAK,cAAc,aAAe,EAAS,UAAU,CAAoB,EAC1E,EAGF,YACA,6BACA,mBACJ,EAER,KA9PI,EAgQI,eAhQJ,MAgQI,EAAmB",
8
- "debugId": "6C0F7E5DFB8B747064756E2164756E21",
8
+ "debugId": "889C80F94B3E227D64756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{h as _t}from"./chunk-tws22txn.js";import{A as oo,B as Lt,C as yo,i as er,k as M,l as vo,m as Eo,n as So,p as Gr,q as zr,r as kt,s as Io,t as cr,u as Po,v as xo,w as ar,x as eo,y as ro,z as to}from"./chunk-eb4mx34p.js";import{D as gt}from"./chunk-c0hxmw3a.js";import{E as hr,F as mt,H as Qt,L as Ue,P as f}from"./chunk-dfat5nmk.js";import{Q as Oo}from"./chunk-rwyn40p1.js";import{T as zt}from"./chunk-0tsnmrf9.js";import{U as Ht}from"./chunk-fjh3xaq7.js";import"./chunk-ss0gk90s.js";import"./chunk-fs2cdxry.js";import"./chunk-xvnjahea.js";import"./chunk-h6dzn5j6.js";import{Aa as Zt}from"./chunk-57n0m9fv.js";import{_m as S}from"./chunk-7ztbpqed.js";var A=S((oe)=>{Object.defineProperty(oe,"__esModule",{value:!0});oe.resolveHttpAuthSchemeConfig=oe.defaultSSOOIDCHttpAuthSchemeProvider=oe.defaultSSOOIDCHttpAuthSchemeParametersProvider=void 0;var Rr=M(),w=hr(),fr=async(e,r,i)=>{return{operation:(0,w.getSmithyContext)(r).operation,region:await(0,w.normalizeProvider)(e.region)()||(()=>{throw Error("expected `region` to be configured for `aws.auth#sigv4`")})()}};oe.defaultSSOOIDCHttpAuthSchemeParametersProvider=fr;function Fr(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sso-oauth",region:e.region},propertiesExtractor:(r,i)=>({signingProperties:{config:r,context:i}})}}function Ur(e){return{schemeId:"smithy.api#noAuth"}}var $r=(e)=>{let r=[];switch(e.operation){case"CreateToken":{r.push(Ur(e));break}default:r.push(Fr(e))}return r};oe.defaultSSOOIDCHttpAuthSchemeProvider=$r;var jr=(e)=>{let r=(0,Rr.resolveAwsSdkSigV4Config)(e);return Object.assign(r,{authSchemePreference:(0,w.normalizeProvider)(e.authSchemePreference??[])})};oe.resolveHttpAuthSchemeConfig=jr});var De=S((xe)=>{Object.defineProperty(xe,"__esModule",{value:!0});xe.ruleSet=void 0;var Ee="required",p="fn",d="argv",q="ref",se=!0,ne="isSet",N="booleanEquals",D="error",b="endpoint",I="tree",G="PartitionResult",z="getAttr",pe={[Ee]:!1,type:"string"},de={[Ee]:!0,default:!1,type:"boolean"},ce={[q]:"Endpoint"},Se={[p]:N,[d]:[{[q]:"UseFIPS"},!0]},Ie={[p]:N,[d]:[{[q]:"UseDualStack"},!0]},n={},ae={[p]:z,[d]:[{[q]:G},"supportsFIPS"]},Pe={[q]:G},le={[p]:N,[d]:[!0,{[p]:z,[d]:[Pe,"supportsDualStack"]}]},ue=[Se],Oe=[Ie],ve=[{[q]:"Region"}],Ar={version:"1.0",parameters:{Region:pe,UseDualStack:de,UseFIPS:de,Endpoint:pe},rules:[{conditions:[{[p]:ne,[d]:[ce]}],rules:[{conditions:ue,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:D},{conditions:Oe,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:D},{endpoint:{url:ce,properties:n,headers:n},type:b}],type:I},{conditions:[{[p]:ne,[d]:ve}],rules:[{conditions:[{[p]:"aws.partition",[d]:ve,assign:G}],rules:[{conditions:[Se,Ie],rules:[{conditions:[{[p]:N,[d]:[se,ae]},le],rules:[{endpoint:{url:"https://oidc-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:n,headers:n},type:b}],type:I},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:D}],type:I},{conditions:ue,rules:[{conditions:[{[p]:N,[d]:[ae,se]}],rules:[{conditions:[{[p]:"stringEquals",[d]:[{[p]:z,[d]:[Pe,"name"]},"aws-us-gov"]}],endpoint:{url:"https://oidc.{Region}.amazonaws.com",properties:n,headers:n},type:b},{endpoint:{url:"https://oidc-fips.{Region}.{PartitionResult#dnsSuffix}",properties:n,headers:n},type:b}],type:I},{error:"FIPS is enabled but this partition does not support FIPS",type:D}],type:I},{conditions:Oe,rules:[{conditions:[le],rules:[{endpoint:{url:"https://oidc.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:n,headers:n},type:b}],type:I},{error:"DualStack is enabled but this partition does not support DualStack",type:D}],type:I},{endpoint:{url:"https://oidc.{Region}.{PartitionResult#dnsSuffix}",properties:n,headers:n},type:b}],type:I}],type:I},{error:"Invalid Configuration: Missing Region",type:D}]};xe.ruleSet=Ar});var Ne=S((be)=>{Object.defineProperty(be,"__esModule",{value:!0});be.defaultEndpointResolver=void 0;var mr=zr(),m=Gr(),Hr=De(),Lr=new m.EndpointCache({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),Tr=(e,r={})=>{return Lr.get(e,()=>(0,m.resolveEndpoint)(Hr.ruleSet,{endpointParams:e,logger:r.logger}))};be.defaultEndpointResolver=Tr;m.customEndpointFunctions.aws=mr.awsEndpointFunctions});var F=S((L)=>{Object.defineProperty(L,"__esModule",{value:!0});L.SSOOIDCServiceException=L.__ServiceException=void 0;var he=f();Object.defineProperty(L,"__ServiceException",{enumerable:!0,get:function(){return he.ServiceException}});class H extends he.ServiceException{constructor(e){super(e);Object.setPrototypeOf(this,H.prototype)}}L.SSOOIDCServiceException=H});var k=S((fe)=>{Object.defineProperty(fe,"__esModule",{value:!0});fe.UnsupportedGrantTypeException=fe.UnauthorizedClientException=fe.SlowDownException=fe.InvalidScopeException=fe.InvalidRequestException=fe.InvalidGrantException=fe.InvalidClientException=fe.InternalServerException=fe.ExpiredTokenException=fe.AuthorizationPendingException=fe.AccessDeniedException=void 0;var l=F();class T extends l.SSOOIDCServiceException{name="AccessDeniedException";$fault="client";error;reason;error_description;constructor(e){super({name:"AccessDeniedException",$fault:"client",...e});Object.setPrototypeOf(this,T.prototype),this.error=e.error,this.reason=e.reason,this.error_description=e.error_description}}fe.AccessDeniedException=T;class B extends l.SSOOIDCServiceException{name="AuthorizationPendingException";$fault="client";error;error_description;constructor(e){super({name:"AuthorizationPendingException",$fault:"client",...e});Object.setPrototypeOf(this,B.prototype),this.error=e.error,this.error_description=e.error_description}}fe.AuthorizationPendingException=B;class V extends l.SSOOIDCServiceException{name="ExpiredTokenException";$fault="client";error;error_description;constructor(e){super({name:"ExpiredTokenException",$fault:"client",...e});Object.setPrototypeOf(this,V.prototype),this.error=e.error,this.error_description=e.error_description}}fe.ExpiredTokenException=V;class W extends l.SSOOIDCServiceException{name="InternalServerException";$fault="server";error;error_description;constructor(e){super({name:"InternalServerException",$fault:"server",...e});Object.setPrototypeOf(this,W.prototype),this.error=e.error,this.error_description=e.error_description}}fe.InternalServerException=W;class Y extends l.SSOOIDCServiceException{name="InvalidClientException";$fault="client";error;error_description;constructor(e){super({name:"InvalidClientException",$fault:"client",...e});Object.setPrototypeOf(this,Y.prototype),this.error=e.error,this.error_description=e.error_description}}fe.InvalidClientException=Y;class J extends l.SSOOIDCServiceException{name="InvalidGrantException";$fault="client";error;error_description;constructor(e){super({name:"InvalidGrantException",$fault:"client",...e});Object.setPrototypeOf(this,J.prototype),this.error=e.error,this.error_description=e.error_description}}fe.InvalidGrantException=J;class K extends l.SSOOIDCServiceException{name="InvalidRequestException";$fault="client";error;reason;error_description;constructor(e){super({name:"InvalidRequestException",$fault:"client",...e});Object.setPrototypeOf(this,K.prototype),this.error=e.error,this.reason=e.reason,this.error_description=e.error_description}}fe.InvalidRequestException=K;class X extends l.SSOOIDCServiceException{name="InvalidScopeException";$fault="client";error;error_description;constructor(e){super({name:"InvalidScopeException",$fault:"client",...e});Object.setPrototypeOf(this,X.prototype),this.error=e.error,this.error_description=e.error_description}}fe.InvalidScopeException=X;class C extends l.SSOOIDCServiceException{name="SlowDownException";$fault="client";error;error_description;constructor(e){super({name:"SlowDownException",$fault:"client",...e});Object.setPrototypeOf(this,C.prototype),this.error=e.error,this.error_description=e.error_description}}fe.SlowDownException=C;class Q extends l.SSOOIDCServiceException{name="UnauthorizedClientException";$fault="client";error;error_description;constructor(e){super({name:"UnauthorizedClientException",$fault:"client",...e});Object.setPrototypeOf(this,Q.prototype),this.error=e.error,this.error_description=e.error_description}}fe.UnauthorizedClientException=Q;class Z extends l.SSOOIDCServiceException{name="UnsupportedGrantTypeException";$fault="client";error;error_description;constructor(e){super({name:"UnsupportedGrantTypeException",$fault:"client",...e});Object.setPrototypeOf(this,Z.prototype),this.error=e.error,this.error_description=e.error_description}}fe.UnsupportedGrantTypeException=Z});var g=S((ze)=>{Object.defineProperty(ze,"__esModule",{value:!0});ze.CreateToken$=ze.CreateTokenResponse$=ze.CreateTokenRequest$=ze.errorTypeRegistries=ze.UnsupportedGrantTypeException$=ze.UnauthorizedClientException$=ze.SlowDownException$=ze.InvalidScopeException$=ze.InvalidRequestException$=ze.InvalidGrantException$=ze.InvalidClientException$=ze.InternalServerException$=ze.ExpiredTokenException$=ze.AuthorizationPendingException$=ze.AccessDeniedException$=ze.SSOOIDCServiceException$=void 0;var kr="AccessDeniedException",gr="AuthorizationPendingException",_r="AccessToken",et="ClientSecret",rt="CreateToken",tt="CreateTokenRequest",ot="CreateTokenResponse",it="CodeVerifier",st="ExpiredTokenException",nt="InvalidClientException",pt="InvalidGrantException",dt="InvalidRequestException",ct="InternalServerException",at="InvalidScopeException",lt="IdToken",ut="RefreshToken",Ot="SlowDownException",vt="UnauthorizedClientException",Et="UnsupportedGrantTypeException",St="accessToken",E="client",It="clientId",Pt="clientSecret",xt="codeVerifier",yt="code",Dt="deviceCode",t="error",bt="expiresIn",u="error_description",qt="grantType",Nt="http",O="httpError",ht="idToken",$e="reason",je="refreshToken",Rt="redirectUri",we="smithy.ts.sdk.synthetic.com.amazonaws.ssooidc",ft="scope",Ft="server",Ut="tokenType",o="com.amazonaws.ssooidc",Me=Ue(),v=k(),$t=F(),Ae=Me.TypeRegistry.for(we);ze.SSOOIDCServiceException$=[-3,we,"SSOOIDCServiceException",0,[],[]];Ae.registerError(ze.SSOOIDCServiceException$,$t.SSOOIDCServiceException);var c=Me.TypeRegistry.for(o);ze.AccessDeniedException$=[-3,o,kr,{[t]:E,[O]:400},[t,$e,u],[0,0,0]];c.registerError(ze.AccessDeniedException$,v.AccessDeniedException);ze.AuthorizationPendingException$=[-3,o,gr,{[t]:E,[O]:400},[t,u],[0,0]];c.registerError(ze.AuthorizationPendingException$,v.AuthorizationPendingException);ze.ExpiredTokenException$=[-3,o,st,{[t]:E,[O]:400},[t,u],[0,0]];c.registerError(ze.ExpiredTokenException$,v.ExpiredTokenException);ze.InternalServerException$=[-3,o,ct,{[t]:Ft,[O]:500},[t,u],[0,0]];c.registerError(ze.InternalServerException$,v.InternalServerException);ze.InvalidClientException$=[-3,o,nt,{[t]:E,[O]:401},[t,u],[0,0]];c.registerError(ze.InvalidClientException$,v.InvalidClientException);ze.InvalidGrantException$=[-3,o,pt,{[t]:E,[O]:400},[t,u],[0,0]];c.registerError(ze.InvalidGrantException$,v.InvalidGrantException);ze.InvalidRequestException$=[-3,o,dt,{[t]:E,[O]:400},[t,$e,u],[0,0,0]];c.registerError(ze.InvalidRequestException$,v.InvalidRequestException);ze.InvalidScopeException$=[-3,o,at,{[t]:E,[O]:400},[t,u],[0,0]];c.registerError(ze.InvalidScopeException$,v.InvalidScopeException);ze.SlowDownException$=[-3,o,Ot,{[t]:E,[O]:400},[t,u],[0,0]];c.registerError(ze.SlowDownException$,v.SlowDownException);ze.UnauthorizedClientException$=[-3,o,vt,{[t]:E,[O]:400},[t,u],[0,0]];c.registerError(ze.UnauthorizedClientException$,v.UnauthorizedClientException);ze.UnsupportedGrantTypeException$=[-3,o,Et,{[t]:E,[O]:400},[t,u],[0,0]];c.registerError(ze.UnsupportedGrantTypeException$,v.UnsupportedGrantTypeException);ze.errorTypeRegistries=[Ae,c];var jt=[0,o,_r,8,0],wt=[0,o,et,8,0],Mt=[0,o,it,8,0],At=[0,o,lt,8,0],Ge=[0,o,ut,8,0];ze.CreateTokenRequest$=[3,o,tt,0,[It,Pt,qt,Dt,yt,je,ft,Rt,xt],[0,[()=>wt,0],0,0,0,[()=>Ge,0],64,0,[()=>Mt,0]],3];ze.CreateTokenResponse$=[3,o,ot,0,[St,Ut,bt,je,ht],[[()=>jt,0],0,1,[()=>Ge,0],[()=>At,0]]];ze.CreateToken$=[9,o,rt,{[Nt]:["POST","/token",200]},()=>ze.CreateTokenRequest$,()=>ze.CreateTokenResponse$]});var or=S((rr)=>{Object.defineProperty(rr,"__esModule",{value:!0});rr.getRuntimeConfig=void 0;var Tt=M(),Bt=Lt(),Vt=er(),Wt=f(),Yt=Ht(),ge=mt(),_e=zt(),Jt=A(),Kt=Ne(),Xt=g(),Ct=(e)=>{return{apiVersion:"2019-06-10",base64Decoder:e?.base64Decoder??ge.fromBase64,base64Encoder:e?.base64Encoder??ge.toBase64,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??Kt.defaultEndpointResolver,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??Jt.defaultSSOOIDCHttpAuthSchemeProvider,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(r)=>r.getIdentityProvider("aws.auth#sigv4"),signer:new Tt.AwsSdkSigV4Signer},{schemeId:"smithy.api#noAuth",identityProvider:(r)=>r.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new Vt.NoAuthSigner}],logger:e?.logger??new Wt.NoOpLogger,protocol:e?.protocol??Bt.AwsRestJsonProtocol,protocolSettings:e?.protocolSettings??{defaultNamespace:"com.amazonaws.ssooidc",errorTypeRegistries:Xt.errorTypeRegistries,version:"2019-06-10",serviceTarget:"AWSSSOOIDCService"},serviceId:e?.serviceId??"SSO OIDC",urlParser:e?.urlParser??Yt.parseUrl,utf8Decoder:e?.utf8Decoder??_e.fromUtf8,utf8Encoder:e?.utf8Encoder??_e.toUtf8}};rr.getRuntimeConfig=Ct});var Or=S((lr)=>{Object.defineProperty(lr,"__esModule",{value:!0});lr.getRuntimeConfig=void 0;var io=Zt(),so=io.__importDefault(_t()),ir=M(),sr=eo(),U=cr(),no=ro(),nr=ar(),x=gt(),pr=Qt(),dr=f(),po=to(),co=oo(),ao=kt(),lo=or(),uo=(e)=>{(0,dr.emitWarningIfUnsupportedVersion)(process.version);let r=(0,co.resolveDefaultsModeConfig)(e),i=()=>r().then(dr.loadConfigsForDefaultMode),a=(0,lo.getRuntimeConfig)(e);(0,ir.emitWarningIfUnsupportedVersion)(process.version);let s={profile:e?.profile,logger:a.logger};return{...a,...e,runtime:"node",defaultsMode:r,authSchemePreference:e?.authSchemePreference??(0,x.loadConfig)(ir.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS,s),bodyLengthChecker:e?.bodyLengthChecker??po.calculateBodyLength,defaultUserAgentProvider:e?.defaultUserAgentProvider??(0,sr.createDefaultUserAgentProvider)({serviceId:a.serviceId,clientVersion:so.default.version}),maxAttempts:e?.maxAttempts??(0,x.loadConfig)(nr.NODE_MAX_ATTEMPT_CONFIG_OPTIONS,e),region:e?.region??(0,x.loadConfig)(U.NODE_REGION_CONFIG_OPTIONS,{...U.NODE_REGION_CONFIG_FILE_OPTIONS,...s}),requestHandler:pr.NodeHttpHandler.create(e?.requestHandler??i),retryMode:e?.retryMode??(0,x.loadConfig)({...nr.NODE_RETRY_MODE_CONFIG_OPTIONS,default:async()=>(await i()).retryMode||ao.DEFAULT_RETRY_MODE},e),sha256:e?.sha256??no.Hash.bind(null,"sha256"),streamCollector:e?.streamCollector??pr.streamCollector,useDualstackEndpoint:e?.useDualstackEndpoint??(0,x.loadConfig)(U.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS,s),useFipsEndpoint:e?.useFipsEndpoint??(0,x.loadConfig)(U.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS,s),userAgentAppId:e?.userAgentAppId??(0,x.loadConfig)(sr.NODE_APP_ID_CONFIG_OPTIONS,s)}};lr.getRuntimeConfig=uo});var Yo=S((P)=>{var vr=vo(),Do=Eo(),bo=So(),Er=Io(),qo=cr(),_=er(),No=Ue(),ho=Po(),yr=xo(),Sr=ar(),y=f(),Ir=A(),Ro=Or(),Pr=yo(),xr=Oo(),h=g(),$=k(),fo=F(),Fo=(e)=>{return Object.assign(e,{useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:"sso-oauth"})},Uo={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}},$o=(e)=>{let{httpAuthSchemes:r,httpAuthSchemeProvider:i,credentials:a}=e;return{setHttpAuthScheme(s){let R=r.findIndex((j)=>j.schemeId===s.schemeId);if(R===-1)r.push(s);else r.splice(R,1,s)},httpAuthSchemes(){return r},setHttpAuthSchemeProvider(s){i=s},httpAuthSchemeProvider(){return i},setCredentials(s){a=s},credentials(){return a}}},jo=(e)=>{return{httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}},wo=(e,r)=>{let i=Object.assign(Pr.getAwsRegionExtensionConfiguration(e),y.getDefaultExtensionConfiguration(e),xr.getHttpHandlerExtensionConfiguration(e),$o(e));return r.forEach((a)=>a.configure(i)),Object.assign(e,Pr.resolveAwsRegionExtensionConfiguration(i),y.resolveDefaultRuntimeConfig(i),xr.resolveHttpHandlerRuntimeConfig(i),jo(i))};class ee extends y.Client{config;constructor(...[e]){let r=Ro.getRuntimeConfig(e||{});super(r);this.initConfig=r;let i=Fo(r),a=Er.resolveUserAgentConfig(i),s=Sr.resolveRetryConfig(a),R=qo.resolveRegionConfig(s),j=vr.resolveHostHeaderConfig(R),Dr=yr.resolveEndpointConfig(j),br=Ir.resolveHttpAuthSchemeConfig(Dr),qr=wo(br,e?.extensions||[]);this.config=qr,this.middlewareStack.use(No.getSchemaSerdePlugin(this.config)),this.middlewareStack.use(Er.getUserAgentPlugin(this.config)),this.middlewareStack.use(Sr.getRetryPlugin(this.config)),this.middlewareStack.use(ho.getContentLengthPlugin(this.config)),this.middlewareStack.use(vr.getHostHeaderPlugin(this.config)),this.middlewareStack.use(Do.getLoggerPlugin(this.config)),this.middlewareStack.use(bo.getRecursionDetectionPlugin(this.config)),this.middlewareStack.use(_.getHttpAuthSchemeEndpointRuleSetPlugin(this.config,{httpAuthSchemeParametersProvider:Ir.defaultSSOOIDCHttpAuthSchemeParametersProvider,identityProviderConfigProvider:async(Nr)=>new _.DefaultIdentityProviderConfig({"aws.auth#sigv4":Nr.credentials})})),this.middlewareStack.use(_.getHttpSigningPlugin(this.config))}destroy(){super.destroy()}}class re extends y.Command.classBuilder().ep(Uo).m(function(e,r,i,a){return[yr.getEndpointPlugin(i,e.getEndpointParameterInstructions())]}).s("AWSSSOOIDCService","CreateToken",{}).n("SSOOIDCClient","CreateTokenCommand").sc(h.CreateToken$).build(){}var Mo={CreateTokenCommand:re};class te extends ee{}y.createAggregatedClient(Mo,te);var Ao={KMS_ACCESS_DENIED:"KMS_AccessDeniedException"},Go={KMS_DISABLED_KEY:"KMS_DisabledException",KMS_INVALID_KEY_USAGE:"KMS_InvalidKeyUsageException",KMS_INVALID_STATE:"KMS_InvalidStateException",KMS_KEY_NOT_FOUND:"KMS_NotFoundException"};P.$Command=y.Command;P.__Client=y.Client;P.SSOOIDCServiceException=fo.SSOOIDCServiceException;P.AccessDeniedExceptionReason=Ao;P.CreateTokenCommand=re;P.InvalidRequestExceptionReason=Go;P.SSOOIDC=te;P.SSOOIDCClient=ee;Object.prototype.hasOwnProperty.call(h,"__proto__")&&!Object.prototype.hasOwnProperty.call(P,"__proto__")&&Object.defineProperty(P,"__proto__",{enumerable:!0,value:h.__proto__});Object.keys(h).forEach(function(e){if(e!=="default"&&!Object.prototype.hasOwnProperty.call(P,e))P[e]=h[e]});Object.prototype.hasOwnProperty.call($,"__proto__")&&!Object.prototype.hasOwnProperty.call(P,"__proto__")&&Object.defineProperty(P,"__proto__",{enumerable:!0,value:$.__proto__});Object.keys($).forEach(function(e){if(e!=="default"&&!Object.prototype.hasOwnProperty.call(P,e))P[e]=$[e]})});export default Yo();
2
+ import{h as _t}from"./chunk-5961jw1h.js";import{A as oo,B as Lt,C as yo,i as er,k as M,l as vo,m as Eo,n as So,p as Gr,q as zr,r as kt,s as Io,t as cr,u as Po,v as xo,w as ar,x as eo,y as ro,z as to}from"./chunk-r9266nax.js";import{D as gt}from"./chunk-z5ha9z3m.js";import{E as hr,F as mt,H as Qt,L as Ue,P as f}from"./chunk-b0hjrnn6.js";import{Q as Oo}from"./chunk-ztg4pgqe.js";import{T as zt}from"./chunk-zc42brkr.js";import{U as Ht}from"./chunk-thdhm39v.js";import"./chunk-jv7n3p61.js";import"./chunk-fe7f6jbc.js";import"./chunk-7jpfvs5v.js";import"./chunk-be0r4rgs.js";import{Aa as Zt}from"./chunk-bv76ypa6.js";import{nn as S}from"./chunk-748evey0.js";var A=S((oe)=>{Object.defineProperty(oe,"__esModule",{value:!0});oe.resolveHttpAuthSchemeConfig=oe.defaultSSOOIDCHttpAuthSchemeProvider=oe.defaultSSOOIDCHttpAuthSchemeParametersProvider=void 0;var Rr=M(),w=hr(),fr=async(e,r,i)=>{return{operation:(0,w.getSmithyContext)(r).operation,region:await(0,w.normalizeProvider)(e.region)()||(()=>{throw Error("expected `region` to be configured for `aws.auth#sigv4`")})()}};oe.defaultSSOOIDCHttpAuthSchemeParametersProvider=fr;function Fr(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sso-oauth",region:e.region},propertiesExtractor:(r,i)=>({signingProperties:{config:r,context:i}})}}function Ur(e){return{schemeId:"smithy.api#noAuth"}}var $r=(e)=>{let r=[];switch(e.operation){case"CreateToken":{r.push(Ur(e));break}default:r.push(Fr(e))}return r};oe.defaultSSOOIDCHttpAuthSchemeProvider=$r;var jr=(e)=>{let r=(0,Rr.resolveAwsSdkSigV4Config)(e);return Object.assign(r,{authSchemePreference:(0,w.normalizeProvider)(e.authSchemePreference??[])})};oe.resolveHttpAuthSchemeConfig=jr});var De=S((xe)=>{Object.defineProperty(xe,"__esModule",{value:!0});xe.ruleSet=void 0;var Ee="required",p="fn",d="argv",q="ref",se=!0,ne="isSet",N="booleanEquals",D="error",b="endpoint",I="tree",G="PartitionResult",z="getAttr",pe={[Ee]:!1,type:"string"},de={[Ee]:!0,default:!1,type:"boolean"},ce={[q]:"Endpoint"},Se={[p]:N,[d]:[{[q]:"UseFIPS"},!0]},Ie={[p]:N,[d]:[{[q]:"UseDualStack"},!0]},n={},ae={[p]:z,[d]:[{[q]:G},"supportsFIPS"]},Pe={[q]:G},le={[p]:N,[d]:[!0,{[p]:z,[d]:[Pe,"supportsDualStack"]}]},ue=[Se],Oe=[Ie],ve=[{[q]:"Region"}],Ar={version:"1.0",parameters:{Region:pe,UseDualStack:de,UseFIPS:de,Endpoint:pe},rules:[{conditions:[{[p]:ne,[d]:[ce]}],rules:[{conditions:ue,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:D},{conditions:Oe,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:D},{endpoint:{url:ce,properties:n,headers:n},type:b}],type:I},{conditions:[{[p]:ne,[d]:ve}],rules:[{conditions:[{[p]:"aws.partition",[d]:ve,assign:G}],rules:[{conditions:[Se,Ie],rules:[{conditions:[{[p]:N,[d]:[se,ae]},le],rules:[{endpoint:{url:"https://oidc-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:n,headers:n},type:b}],type:I},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:D}],type:I},{conditions:ue,rules:[{conditions:[{[p]:N,[d]:[ae,se]}],rules:[{conditions:[{[p]:"stringEquals",[d]:[{[p]:z,[d]:[Pe,"name"]},"aws-us-gov"]}],endpoint:{url:"https://oidc.{Region}.amazonaws.com",properties:n,headers:n},type:b},{endpoint:{url:"https://oidc-fips.{Region}.{PartitionResult#dnsSuffix}",properties:n,headers:n},type:b}],type:I},{error:"FIPS is enabled but this partition does not support FIPS",type:D}],type:I},{conditions:Oe,rules:[{conditions:[le],rules:[{endpoint:{url:"https://oidc.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:n,headers:n},type:b}],type:I},{error:"DualStack is enabled but this partition does not support DualStack",type:D}],type:I},{endpoint:{url:"https://oidc.{Region}.{PartitionResult#dnsSuffix}",properties:n,headers:n},type:b}],type:I}],type:I},{error:"Invalid Configuration: Missing Region",type:D}]};xe.ruleSet=Ar});var Ne=S((be)=>{Object.defineProperty(be,"__esModule",{value:!0});be.defaultEndpointResolver=void 0;var mr=zr(),m=Gr(),Hr=De(),Lr=new m.EndpointCache({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),Tr=(e,r={})=>{return Lr.get(e,()=>(0,m.resolveEndpoint)(Hr.ruleSet,{endpointParams:e,logger:r.logger}))};be.defaultEndpointResolver=Tr;m.customEndpointFunctions.aws=mr.awsEndpointFunctions});var F=S((L)=>{Object.defineProperty(L,"__esModule",{value:!0});L.SSOOIDCServiceException=L.__ServiceException=void 0;var he=f();Object.defineProperty(L,"__ServiceException",{enumerable:!0,get:function(){return he.ServiceException}});class H extends he.ServiceException{constructor(e){super(e);Object.setPrototypeOf(this,H.prototype)}}L.SSOOIDCServiceException=H});var k=S((fe)=>{Object.defineProperty(fe,"__esModule",{value:!0});fe.UnsupportedGrantTypeException=fe.UnauthorizedClientException=fe.SlowDownException=fe.InvalidScopeException=fe.InvalidRequestException=fe.InvalidGrantException=fe.InvalidClientException=fe.InternalServerException=fe.ExpiredTokenException=fe.AuthorizationPendingException=fe.AccessDeniedException=void 0;var l=F();class T extends l.SSOOIDCServiceException{name="AccessDeniedException";$fault="client";error;reason;error_description;constructor(e){super({name:"AccessDeniedException",$fault:"client",...e});Object.setPrototypeOf(this,T.prototype),this.error=e.error,this.reason=e.reason,this.error_description=e.error_description}}fe.AccessDeniedException=T;class B extends l.SSOOIDCServiceException{name="AuthorizationPendingException";$fault="client";error;error_description;constructor(e){super({name:"AuthorizationPendingException",$fault:"client",...e});Object.setPrototypeOf(this,B.prototype),this.error=e.error,this.error_description=e.error_description}}fe.AuthorizationPendingException=B;class V extends l.SSOOIDCServiceException{name="ExpiredTokenException";$fault="client";error;error_description;constructor(e){super({name:"ExpiredTokenException",$fault:"client",...e});Object.setPrototypeOf(this,V.prototype),this.error=e.error,this.error_description=e.error_description}}fe.ExpiredTokenException=V;class W extends l.SSOOIDCServiceException{name="InternalServerException";$fault="server";error;error_description;constructor(e){super({name:"InternalServerException",$fault:"server",...e});Object.setPrototypeOf(this,W.prototype),this.error=e.error,this.error_description=e.error_description}}fe.InternalServerException=W;class Y extends l.SSOOIDCServiceException{name="InvalidClientException";$fault="client";error;error_description;constructor(e){super({name:"InvalidClientException",$fault:"client",...e});Object.setPrototypeOf(this,Y.prototype),this.error=e.error,this.error_description=e.error_description}}fe.InvalidClientException=Y;class J extends l.SSOOIDCServiceException{name="InvalidGrantException";$fault="client";error;error_description;constructor(e){super({name:"InvalidGrantException",$fault:"client",...e});Object.setPrototypeOf(this,J.prototype),this.error=e.error,this.error_description=e.error_description}}fe.InvalidGrantException=J;class K extends l.SSOOIDCServiceException{name="InvalidRequestException";$fault="client";error;reason;error_description;constructor(e){super({name:"InvalidRequestException",$fault:"client",...e});Object.setPrototypeOf(this,K.prototype),this.error=e.error,this.reason=e.reason,this.error_description=e.error_description}}fe.InvalidRequestException=K;class X extends l.SSOOIDCServiceException{name="InvalidScopeException";$fault="client";error;error_description;constructor(e){super({name:"InvalidScopeException",$fault:"client",...e});Object.setPrototypeOf(this,X.prototype),this.error=e.error,this.error_description=e.error_description}}fe.InvalidScopeException=X;class C extends l.SSOOIDCServiceException{name="SlowDownException";$fault="client";error;error_description;constructor(e){super({name:"SlowDownException",$fault:"client",...e});Object.setPrototypeOf(this,C.prototype),this.error=e.error,this.error_description=e.error_description}}fe.SlowDownException=C;class Q extends l.SSOOIDCServiceException{name="UnauthorizedClientException";$fault="client";error;error_description;constructor(e){super({name:"UnauthorizedClientException",$fault:"client",...e});Object.setPrototypeOf(this,Q.prototype),this.error=e.error,this.error_description=e.error_description}}fe.UnauthorizedClientException=Q;class Z extends l.SSOOIDCServiceException{name="UnsupportedGrantTypeException";$fault="client";error;error_description;constructor(e){super({name:"UnsupportedGrantTypeException",$fault:"client",...e});Object.setPrototypeOf(this,Z.prototype),this.error=e.error,this.error_description=e.error_description}}fe.UnsupportedGrantTypeException=Z});var g=S((ze)=>{Object.defineProperty(ze,"__esModule",{value:!0});ze.CreateToken$=ze.CreateTokenResponse$=ze.CreateTokenRequest$=ze.errorTypeRegistries=ze.UnsupportedGrantTypeException$=ze.UnauthorizedClientException$=ze.SlowDownException$=ze.InvalidScopeException$=ze.InvalidRequestException$=ze.InvalidGrantException$=ze.InvalidClientException$=ze.InternalServerException$=ze.ExpiredTokenException$=ze.AuthorizationPendingException$=ze.AccessDeniedException$=ze.SSOOIDCServiceException$=void 0;var kr="AccessDeniedException",gr="AuthorizationPendingException",_r="AccessToken",et="ClientSecret",rt="CreateToken",tt="CreateTokenRequest",ot="CreateTokenResponse",it="CodeVerifier",st="ExpiredTokenException",nt="InvalidClientException",pt="InvalidGrantException",dt="InvalidRequestException",ct="InternalServerException",at="InvalidScopeException",lt="IdToken",ut="RefreshToken",Ot="SlowDownException",vt="UnauthorizedClientException",Et="UnsupportedGrantTypeException",St="accessToken",E="client",It="clientId",Pt="clientSecret",xt="codeVerifier",yt="code",Dt="deviceCode",t="error",bt="expiresIn",u="error_description",qt="grantType",Nt="http",O="httpError",ht="idToken",$e="reason",je="refreshToken",Rt="redirectUri",we="smithy.ts.sdk.synthetic.com.amazonaws.ssooidc",ft="scope",Ft="server",Ut="tokenType",o="com.amazonaws.ssooidc",Me=Ue(),v=k(),$t=F(),Ae=Me.TypeRegistry.for(we);ze.SSOOIDCServiceException$=[-3,we,"SSOOIDCServiceException",0,[],[]];Ae.registerError(ze.SSOOIDCServiceException$,$t.SSOOIDCServiceException);var c=Me.TypeRegistry.for(o);ze.AccessDeniedException$=[-3,o,kr,{[t]:E,[O]:400},[t,$e,u],[0,0,0]];c.registerError(ze.AccessDeniedException$,v.AccessDeniedException);ze.AuthorizationPendingException$=[-3,o,gr,{[t]:E,[O]:400},[t,u],[0,0]];c.registerError(ze.AuthorizationPendingException$,v.AuthorizationPendingException);ze.ExpiredTokenException$=[-3,o,st,{[t]:E,[O]:400},[t,u],[0,0]];c.registerError(ze.ExpiredTokenException$,v.ExpiredTokenException);ze.InternalServerException$=[-3,o,ct,{[t]:Ft,[O]:500},[t,u],[0,0]];c.registerError(ze.InternalServerException$,v.InternalServerException);ze.InvalidClientException$=[-3,o,nt,{[t]:E,[O]:401},[t,u],[0,0]];c.registerError(ze.InvalidClientException$,v.InvalidClientException);ze.InvalidGrantException$=[-3,o,pt,{[t]:E,[O]:400},[t,u],[0,0]];c.registerError(ze.InvalidGrantException$,v.InvalidGrantException);ze.InvalidRequestException$=[-3,o,dt,{[t]:E,[O]:400},[t,$e,u],[0,0,0]];c.registerError(ze.InvalidRequestException$,v.InvalidRequestException);ze.InvalidScopeException$=[-3,o,at,{[t]:E,[O]:400},[t,u],[0,0]];c.registerError(ze.InvalidScopeException$,v.InvalidScopeException);ze.SlowDownException$=[-3,o,Ot,{[t]:E,[O]:400},[t,u],[0,0]];c.registerError(ze.SlowDownException$,v.SlowDownException);ze.UnauthorizedClientException$=[-3,o,vt,{[t]:E,[O]:400},[t,u],[0,0]];c.registerError(ze.UnauthorizedClientException$,v.UnauthorizedClientException);ze.UnsupportedGrantTypeException$=[-3,o,Et,{[t]:E,[O]:400},[t,u],[0,0]];c.registerError(ze.UnsupportedGrantTypeException$,v.UnsupportedGrantTypeException);ze.errorTypeRegistries=[Ae,c];var jt=[0,o,_r,8,0],wt=[0,o,et,8,0],Mt=[0,o,it,8,0],At=[0,o,lt,8,0],Ge=[0,o,ut,8,0];ze.CreateTokenRequest$=[3,o,tt,0,[It,Pt,qt,Dt,yt,je,ft,Rt,xt],[0,[()=>wt,0],0,0,0,[()=>Ge,0],64,0,[()=>Mt,0]],3];ze.CreateTokenResponse$=[3,o,ot,0,[St,Ut,bt,je,ht],[[()=>jt,0],0,1,[()=>Ge,0],[()=>At,0]]];ze.CreateToken$=[9,o,rt,{[Nt]:["POST","/token",200]},()=>ze.CreateTokenRequest$,()=>ze.CreateTokenResponse$]});var or=S((rr)=>{Object.defineProperty(rr,"__esModule",{value:!0});rr.getRuntimeConfig=void 0;var Tt=M(),Bt=Lt(),Vt=er(),Wt=f(),Yt=Ht(),ge=mt(),_e=zt(),Jt=A(),Kt=Ne(),Xt=g(),Ct=(e)=>{return{apiVersion:"2019-06-10",base64Decoder:e?.base64Decoder??ge.fromBase64,base64Encoder:e?.base64Encoder??ge.toBase64,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??Kt.defaultEndpointResolver,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??Jt.defaultSSOOIDCHttpAuthSchemeProvider,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(r)=>r.getIdentityProvider("aws.auth#sigv4"),signer:new Tt.AwsSdkSigV4Signer},{schemeId:"smithy.api#noAuth",identityProvider:(r)=>r.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new Vt.NoAuthSigner}],logger:e?.logger??new Wt.NoOpLogger,protocol:e?.protocol??Bt.AwsRestJsonProtocol,protocolSettings:e?.protocolSettings??{defaultNamespace:"com.amazonaws.ssooidc",errorTypeRegistries:Xt.errorTypeRegistries,version:"2019-06-10",serviceTarget:"AWSSSOOIDCService"},serviceId:e?.serviceId??"SSO OIDC",urlParser:e?.urlParser??Yt.parseUrl,utf8Decoder:e?.utf8Decoder??_e.fromUtf8,utf8Encoder:e?.utf8Encoder??_e.toUtf8}};rr.getRuntimeConfig=Ct});var Or=S((lr)=>{Object.defineProperty(lr,"__esModule",{value:!0});lr.getRuntimeConfig=void 0;var io=Zt(),so=io.__importDefault(_t()),ir=M(),sr=eo(),U=cr(),no=ro(),nr=ar(),x=gt(),pr=Qt(),dr=f(),po=to(),co=oo(),ao=kt(),lo=or(),uo=(e)=>{(0,dr.emitWarningIfUnsupportedVersion)(process.version);let r=(0,co.resolveDefaultsModeConfig)(e),i=()=>r().then(dr.loadConfigsForDefaultMode),a=(0,lo.getRuntimeConfig)(e);(0,ir.emitWarningIfUnsupportedVersion)(process.version);let s={profile:e?.profile,logger:a.logger};return{...a,...e,runtime:"node",defaultsMode:r,authSchemePreference:e?.authSchemePreference??(0,x.loadConfig)(ir.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS,s),bodyLengthChecker:e?.bodyLengthChecker??po.calculateBodyLength,defaultUserAgentProvider:e?.defaultUserAgentProvider??(0,sr.createDefaultUserAgentProvider)({serviceId:a.serviceId,clientVersion:so.default.version}),maxAttempts:e?.maxAttempts??(0,x.loadConfig)(nr.NODE_MAX_ATTEMPT_CONFIG_OPTIONS,e),region:e?.region??(0,x.loadConfig)(U.NODE_REGION_CONFIG_OPTIONS,{...U.NODE_REGION_CONFIG_FILE_OPTIONS,...s}),requestHandler:pr.NodeHttpHandler.create(e?.requestHandler??i),retryMode:e?.retryMode??(0,x.loadConfig)({...nr.NODE_RETRY_MODE_CONFIG_OPTIONS,default:async()=>(await i()).retryMode||ao.DEFAULT_RETRY_MODE},e),sha256:e?.sha256??no.Hash.bind(null,"sha256"),streamCollector:e?.streamCollector??pr.streamCollector,useDualstackEndpoint:e?.useDualstackEndpoint??(0,x.loadConfig)(U.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS,s),useFipsEndpoint:e?.useFipsEndpoint??(0,x.loadConfig)(U.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS,s),userAgentAppId:e?.userAgentAppId??(0,x.loadConfig)(sr.NODE_APP_ID_CONFIG_OPTIONS,s)}};lr.getRuntimeConfig=uo});var Yo=S((P)=>{var vr=vo(),Do=Eo(),bo=So(),Er=Io(),qo=cr(),_=er(),No=Ue(),ho=Po(),yr=xo(),Sr=ar(),y=f(),Ir=A(),Ro=Or(),Pr=yo(),xr=Oo(),h=g(),$=k(),fo=F(),Fo=(e)=>{return Object.assign(e,{useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:"sso-oauth"})},Uo={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}},$o=(e)=>{let{httpAuthSchemes:r,httpAuthSchemeProvider:i,credentials:a}=e;return{setHttpAuthScheme(s){let R=r.findIndex((j)=>j.schemeId===s.schemeId);if(R===-1)r.push(s);else r.splice(R,1,s)},httpAuthSchemes(){return r},setHttpAuthSchemeProvider(s){i=s},httpAuthSchemeProvider(){return i},setCredentials(s){a=s},credentials(){return a}}},jo=(e)=>{return{httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}},wo=(e,r)=>{let i=Object.assign(Pr.getAwsRegionExtensionConfiguration(e),y.getDefaultExtensionConfiguration(e),xr.getHttpHandlerExtensionConfiguration(e),$o(e));return r.forEach((a)=>a.configure(i)),Object.assign(e,Pr.resolveAwsRegionExtensionConfiguration(i),y.resolveDefaultRuntimeConfig(i),xr.resolveHttpHandlerRuntimeConfig(i),jo(i))};class ee extends y.Client{config;constructor(...[e]){let r=Ro.getRuntimeConfig(e||{});super(r);this.initConfig=r;let i=Fo(r),a=Er.resolveUserAgentConfig(i),s=Sr.resolveRetryConfig(a),R=qo.resolveRegionConfig(s),j=vr.resolveHostHeaderConfig(R),Dr=yr.resolveEndpointConfig(j),br=Ir.resolveHttpAuthSchemeConfig(Dr),qr=wo(br,e?.extensions||[]);this.config=qr,this.middlewareStack.use(No.getSchemaSerdePlugin(this.config)),this.middlewareStack.use(Er.getUserAgentPlugin(this.config)),this.middlewareStack.use(Sr.getRetryPlugin(this.config)),this.middlewareStack.use(ho.getContentLengthPlugin(this.config)),this.middlewareStack.use(vr.getHostHeaderPlugin(this.config)),this.middlewareStack.use(Do.getLoggerPlugin(this.config)),this.middlewareStack.use(bo.getRecursionDetectionPlugin(this.config)),this.middlewareStack.use(_.getHttpAuthSchemeEndpointRuleSetPlugin(this.config,{httpAuthSchemeParametersProvider:Ir.defaultSSOOIDCHttpAuthSchemeParametersProvider,identityProviderConfigProvider:async(Nr)=>new _.DefaultIdentityProviderConfig({"aws.auth#sigv4":Nr.credentials})})),this.middlewareStack.use(_.getHttpSigningPlugin(this.config))}destroy(){super.destroy()}}class re extends y.Command.classBuilder().ep(Uo).m(function(e,r,i,a){return[yr.getEndpointPlugin(i,e.getEndpointParameterInstructions())]}).s("AWSSSOOIDCService","CreateToken",{}).n("SSOOIDCClient","CreateTokenCommand").sc(h.CreateToken$).build(){}var Mo={CreateTokenCommand:re};class te extends ee{}y.createAggregatedClient(Mo,te);var Ao={KMS_ACCESS_DENIED:"KMS_AccessDeniedException"},Go={KMS_DISABLED_KEY:"KMS_DisabledException",KMS_INVALID_KEY_USAGE:"KMS_InvalidKeyUsageException",KMS_INVALID_STATE:"KMS_InvalidStateException",KMS_KEY_NOT_FOUND:"KMS_NotFoundException"};P.$Command=y.Command;P.__Client=y.Client;P.SSOOIDCServiceException=fo.SSOOIDCServiceException;P.AccessDeniedExceptionReason=Ao;P.CreateTokenCommand=re;P.InvalidRequestExceptionReason=Go;P.SSOOIDC=te;P.SSOOIDCClient=ee;Object.prototype.hasOwnProperty.call(h,"__proto__")&&!Object.prototype.hasOwnProperty.call(P,"__proto__")&&Object.defineProperty(P,"__proto__",{enumerable:!0,value:h.__proto__});Object.keys(h).forEach(function(e){if(e!=="default"&&!Object.prototype.hasOwnProperty.call(P,e))P[e]=h[e]});Object.prototype.hasOwnProperty.call($,"__proto__")&&!Object.prototype.hasOwnProperty.call(P,"__proto__")&&Object.defineProperty(P,"__proto__",{enumerable:!0,value:$.__proto__});Object.keys($).forEach(function(e){if(e!=="default"&&!Object.prototype.hasOwnProperty.call(P,e))P[e]=$[e]})});export default Yo();
3
3
 
4
- //# debugId=45031831B91B96B164756E2164756E21
4
+ //# debugId=56B975E6FD9B095D64756E2164756E21
@@ -13,6 +13,6 @@
13
13
  "'use strict';\n\nvar middlewareHostHeader = require('@aws-sdk/middleware-host-header');\nvar middlewareLogger = require('@aws-sdk/middleware-logger');\nvar middlewareRecursionDetection = require('@aws-sdk/middleware-recursion-detection');\nvar middlewareUserAgent = require('@aws-sdk/middleware-user-agent');\nvar configResolver = require('@smithy/config-resolver');\nvar core = require('@smithy/core');\nvar schema = require('@smithy/core/schema');\nvar middlewareContentLength = require('@smithy/middleware-content-length');\nvar middlewareEndpoint = require('@smithy/middleware-endpoint');\nvar middlewareRetry = require('@smithy/middleware-retry');\nvar smithyClient = require('@smithy/smithy-client');\nvar httpAuthSchemeProvider = require('./auth/httpAuthSchemeProvider');\nvar runtimeConfig = require('./runtimeConfig');\nvar regionConfigResolver = require('@aws-sdk/region-config-resolver');\nvar protocolHttp = require('@smithy/protocol-http');\nvar schemas_0 = require('./schemas/schemas_0');\nvar errors = require('./models/errors');\nvar SSOOIDCServiceException = require('./models/SSOOIDCServiceException');\n\nconst resolveClientEndpointParameters = (options) => {\n return Object.assign(options, {\n useDualstackEndpoint: options.useDualstackEndpoint ?? false,\n useFipsEndpoint: options.useFipsEndpoint ?? false,\n defaultSigningName: \"sso-oauth\",\n });\n};\nconst commonParams = {\n UseFIPS: { type: \"builtInParams\", name: \"useFipsEndpoint\" },\n Endpoint: { type: \"builtInParams\", name: \"endpoint\" },\n Region: { type: \"builtInParams\", name: \"region\" },\n UseDualStack: { type: \"builtInParams\", name: \"useDualstackEndpoint\" },\n};\n\nconst getHttpAuthExtensionConfiguration = (runtimeConfig) => {\n const _httpAuthSchemes = runtimeConfig.httpAuthSchemes;\n let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;\n let _credentials = runtimeConfig.credentials;\n return {\n setHttpAuthScheme(httpAuthScheme) {\n const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId);\n if (index === -1) {\n _httpAuthSchemes.push(httpAuthScheme);\n }\n else {\n _httpAuthSchemes.splice(index, 1, httpAuthScheme);\n }\n },\n httpAuthSchemes() {\n return _httpAuthSchemes;\n },\n setHttpAuthSchemeProvider(httpAuthSchemeProvider) {\n _httpAuthSchemeProvider = httpAuthSchemeProvider;\n },\n httpAuthSchemeProvider() {\n return _httpAuthSchemeProvider;\n },\n setCredentials(credentials) {\n _credentials = credentials;\n },\n credentials() {\n return _credentials;\n },\n };\n};\nconst resolveHttpAuthRuntimeConfig = (config) => {\n return {\n httpAuthSchemes: config.httpAuthSchemes(),\n httpAuthSchemeProvider: config.httpAuthSchemeProvider(),\n credentials: config.credentials(),\n };\n};\n\nconst resolveRuntimeExtensions = (runtimeConfig, extensions) => {\n const extensionConfiguration = Object.assign(regionConfigResolver.getAwsRegionExtensionConfiguration(runtimeConfig), smithyClient.getDefaultExtensionConfiguration(runtimeConfig), protocolHttp.getHttpHandlerExtensionConfiguration(runtimeConfig), getHttpAuthExtensionConfiguration(runtimeConfig));\n extensions.forEach((extension) => extension.configure(extensionConfiguration));\n return Object.assign(runtimeConfig, regionConfigResolver.resolveAwsRegionExtensionConfiguration(extensionConfiguration), smithyClient.resolveDefaultRuntimeConfig(extensionConfiguration), protocolHttp.resolveHttpHandlerRuntimeConfig(extensionConfiguration), resolveHttpAuthRuntimeConfig(extensionConfiguration));\n};\n\nclass SSOOIDCClient extends smithyClient.Client {\n config;\n constructor(...[configuration]) {\n const _config_0 = runtimeConfig.getRuntimeConfig(configuration || {});\n super(_config_0);\n this.initConfig = _config_0;\n const _config_1 = resolveClientEndpointParameters(_config_0);\n const _config_2 = middlewareUserAgent.resolveUserAgentConfig(_config_1);\n const _config_3 = middlewareRetry.resolveRetryConfig(_config_2);\n const _config_4 = configResolver.resolveRegionConfig(_config_3);\n const _config_5 = middlewareHostHeader.resolveHostHeaderConfig(_config_4);\n const _config_6 = middlewareEndpoint.resolveEndpointConfig(_config_5);\n const _config_7 = httpAuthSchemeProvider.resolveHttpAuthSchemeConfig(_config_6);\n const _config_8 = resolveRuntimeExtensions(_config_7, configuration?.extensions || []);\n this.config = _config_8;\n this.middlewareStack.use(schema.getSchemaSerdePlugin(this.config));\n this.middlewareStack.use(middlewareUserAgent.getUserAgentPlugin(this.config));\n this.middlewareStack.use(middlewareRetry.getRetryPlugin(this.config));\n this.middlewareStack.use(middlewareContentLength.getContentLengthPlugin(this.config));\n this.middlewareStack.use(middlewareHostHeader.getHostHeaderPlugin(this.config));\n this.middlewareStack.use(middlewareLogger.getLoggerPlugin(this.config));\n this.middlewareStack.use(middlewareRecursionDetection.getRecursionDetectionPlugin(this.config));\n this.middlewareStack.use(core.getHttpAuthSchemeEndpointRuleSetPlugin(this.config, {\n httpAuthSchemeParametersProvider: httpAuthSchemeProvider.defaultSSOOIDCHttpAuthSchemeParametersProvider,\n identityProviderConfigProvider: async (config) => new core.DefaultIdentityProviderConfig({\n \"aws.auth#sigv4\": config.credentials,\n }),\n }));\n this.middlewareStack.use(core.getHttpSigningPlugin(this.config));\n }\n destroy() {\n super.destroy();\n }\n}\n\nclass CreateTokenCommand extends smithyClient.Command\n .classBuilder()\n .ep(commonParams)\n .m(function (Command, cs, config, o) {\n return [middlewareEndpoint.getEndpointPlugin(config, Command.getEndpointParameterInstructions())];\n})\n .s(\"AWSSSOOIDCService\", \"CreateToken\", {})\n .n(\"SSOOIDCClient\", \"CreateTokenCommand\")\n .sc(schemas_0.CreateToken$)\n .build() {\n}\n\nconst commands = {\n CreateTokenCommand,\n};\nclass SSOOIDC extends SSOOIDCClient {\n}\nsmithyClient.createAggregatedClient(commands, SSOOIDC);\n\nconst AccessDeniedExceptionReason = {\n KMS_ACCESS_DENIED: \"KMS_AccessDeniedException\",\n};\nconst InvalidRequestExceptionReason = {\n KMS_DISABLED_KEY: \"KMS_DisabledException\",\n KMS_INVALID_KEY_USAGE: \"KMS_InvalidKeyUsageException\",\n KMS_INVALID_STATE: \"KMS_InvalidStateException\",\n KMS_KEY_NOT_FOUND: \"KMS_NotFoundException\",\n};\n\nexports.$Command = smithyClient.Command;\nexports.__Client = smithyClient.Client;\nexports.SSOOIDCServiceException = SSOOIDCServiceException.SSOOIDCServiceException;\nexports.AccessDeniedExceptionReason = AccessDeniedExceptionReason;\nexports.CreateTokenCommand = CreateTokenCommand;\nexports.InvalidRequestExceptionReason = InvalidRequestExceptionReason;\nexports.SSOOIDC = SSOOIDC;\nexports.SSOOIDCClient = SSOOIDCClient;\nObject.prototype.hasOwnProperty.call(schemas_0, '__proto__') &&\n !Object.prototype.hasOwnProperty.call(exports, '__proto__') &&\n Object.defineProperty(exports, '__proto__', {\n enumerable: true,\n value: schemas_0['__proto__']\n });\n\nObject.keys(schemas_0).forEach(function (k) {\n if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = schemas_0[k];\n});\nObject.prototype.hasOwnProperty.call(errors, '__proto__') &&\n !Object.prototype.hasOwnProperty.call(exports, '__proto__') &&\n Object.defineProperty(exports, '__proto__', {\n enumerable: true,\n value: errors['__proto__']\n });\n\nObject.keys(errors).forEach(function (k) {\n if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = errors[k];\n});\n"
14
14
  ],
15
15
  "mappings": ";uuBACA,CAAO,SAAe,HAAS,OAAc,LAAE,AAAO,JAAK,LAAC,JACpD,yBAAsC,kCAA+C,4CAAsD,OACnJ,IAAM,OACA,OACA,GAAiD,MAAO,EAAQ,EAAS,IAAU,CACrF,MAAO,CACH,WAAY,EAAG,EAAkB,kBAAkB,CAAO,EAAE,UAC5D,OAAS,MAAO,EAAG,EAAkB,mBAAmB,EAAO,MAAM,EAAE,IAClE,IAAM,CACH,MAAU,MAAM,yDAAyD,IAC1E,CACX,GAEI,kDAAiD,GACzD,SAAS,EAAgC,CAAC,EAAgB,CACtD,MAAO,CACH,SAAU,iBACV,kBAAmB,CACf,KAAM,YACN,OAAQ,EAAe,MAC3B,EACA,oBAAqB,CAAC,EAAQ,KAAa,CACvC,kBAAmB,CACf,SACA,SACJ,CACJ,EACJ,EAEJ,SAAS,EAAmC,CAAC,EAAgB,CACzD,MAAO,CACH,SAAU,mBACd,EAEJ,IAAM,GAAuC,CAAC,IAAmB,CAC7D,IAAM,EAAU,CAAC,EACjB,OAAQ,EAAe,eACd,cAAe,CAChB,EAAQ,KAAK,GAAoC,CAAc,CAAC,EAChE,KACJ,SAEI,EAAQ,KAAK,GAAiC,CAAc,CAAC,EAGrE,OAAO,GAEH,wCAAuC,GAC/C,IAAM,GAA8B,CAAC,IAAW,CAC5C,IAAM,GAAY,EAAG,GAAO,0BAA0B,CAAM,EAC5D,OAAO,OAAO,OAAO,EAAU,CAC3B,sBAAuB,EAAG,EAAkB,mBAAmB,EAAO,sBAAwB,CAAC,CAAC,CACpG,CAAC,GAEG,+BAA8B,qBCtDtC,OAAO,eAAe,GAAS,aAAc,CAAE,MAAO,EAAK,CAAC,EACpD,WA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  "names": []
18
18
  }
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{$d as M,Ld as IQ,Td as A,Ud as JQ,Vd as x5,Wd as O5,Xd as RQ,Yd as M5,Zd as f,_d as VQ,td as GQ,vd as g}from"./chunk-11hmhyk5.js";import{Kj as X5,Sj as U5}from"./chunk-54v3y7mg.js";var{fetch:r5,WebSocket:s5}=globalThis;function oQ(Q,$){if(typeof Bun>"u")return Q!==$;return typeof Q!=="function"||!/\{\s*\[native code\]\s*\}\s*$/.test(Function.prototype.toString.call(Q))}class qQ extends Error{constructor(Q){super(`A model provider tried to call ${a5(Q)} from a test. Tests under vitest do not reach real model providers: give the agent a scripted or fake provider, or set GEMI_AI_LIVE=1 to make real (billed) calls.`);this.name="LiveModelCallRefusedError"}}function tQ(Q=process.env){return!Q.VITEST||Q.GEMI_AI_LIVE==="1"}function eQ(Q){if(tQ()||oQ(globalThis.fetch,r5)||$5(Q))return;throw new qQ(Q)}function Q5(Q){let $=globalThis.WebSocket;if(tQ()||oQ($,s5)||$5(Q))return;throw new qQ(Q)}function $5(Q){let $;try{$=new URL(Q).hostname}catch{return!1}return $==="localhost"||$.endsWith(".localhost")||$==="[::1]"||/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test($)}function a5(Q){try{return new URL(Q).origin}catch{return"a provider"}}function CQ(Q,$,J){let Z=Q.on;if(Z===void 0)return!0;if(typeof Z!=="function")return Z.includes($.code);try{return Z($,J)===!0}catch{return!1}}var o5=4000,t5=60000;function J5(Q){if(Q===void 0)return;let $=(J,Z)=>typeof J==="number"&&Number.isFinite(J)&&J>=Z;if(!Q||!$(Q.patienceMs,0)||Q.initialWaitMs!==void 0&&!$(Q.initialWaitMs,1)||Q.maxWaitMs!==void 0&&!$(Q.maxWaitMs,1)||Q.on!==void 0&&typeof Q.on!=="function"&&!(Array.isArray(Q.on)&&Q.on.every((J)=>typeof J==="string")))throw Error(`The provider's retry policy ${JSON.stringify(Q)} is not usable: patienceMs has to be a number of milliseconds (0 or more), initialWaitMs and maxWaitMs above 0, and on a list of error codes or a function.`)}function FQ(Q,$,J,Z,Y){let V=Q.patienceMs-Z;if(V<=0)return;let G=Q.maxWaitMs??t5,W=Q.initialWaitMs??o5,H=J!==void 0?Math.min(J,G):Math.round(Math.min(G,W*2**$)*(0.5+Y()*0.5));return Math.min(H,V)}var e5=500,Z5=20000;function Q6(Q,$){if(!Q)return;let J=Q.trim();if(/^\d+(\.\d+)?$/.test(J))return Math.max(0,Number(J)*1000);let Z=Date.parse(J);if(Number.isNaN(Z))return;return Math.max(0,Z-$)}function $Q(Q,$){let J=Math.min(Z5,e5*2**Q);return Math.round(J*(0.5+$()*0.5))}function $6(Q){return Q===429||Q===408||Q===409||Q>=500}function J6(Q,$){return $6(Q)&&M($).retryable}function Y5(Q){return Q.reason??new DOMException("The operation was aborted.","AbortError")}function V5(Q,$){return new Promise((J,Z)=>{let Y=setTimeout(J,Q);$?.addEventListener("abort",()=>{clearTimeout(Y),Z(Y5($))},{once:!0})})}async function LQ(Q,$,J=V5){if(!$)return await J(Q);$.throwIfAborted();let Z;try{await Promise.race([J(Q,$),new Promise((Y,V)=>{Z=()=>V(Y5($)),$.addEventListener("abort",Z,{once:!0})})])}finally{if(Z)$.removeEventListener("abort",Z)}}async function m(Q,$,J){if(!J.fetchImpl)eQ(Q);let Z=J.fetchImpl??((B,K)=>fetch(B,K)),Y=J.sleep??V5,V=J.random??Math.random,G=J.now??Date.now,W=Math.max(0,J.maxRetries),H=J.startedAt??G(),X=J.retry,q=(B,K,j,F)=>{let x=G()-H;try{J.onRetry?.({attempt:K+1,maxRetries:W,error:M(j),...f(j),timedOut:F,delayMs:B,elapsedMs:x,...X?{remainingMs:Math.max(0,X.patienceMs-x-B)}:{}})}catch{}return LQ(B,J.signal,Y)},z=(B,K,j,F)=>{if(!X)return;let{status:x}=f(j);if(!CQ(X,M(j),{...x?{status:x}:{},timedOut:F}))return;return FQ(X,B-W,K,G()-H,V)};for(let B=0;;B++){J.signal?.throwIfAborted();let K=new AbortController,j=()=>K.abort(J.signal?.reason);J.signal?.addEventListener("abort",j,{once:!0});let F=!1,x=J.timeoutMs>0?setTimeout(()=>{F=!0,K.abort()},J.timeoutMs):void 0,D;try{D=await Z(Q,{...$,signal:K.signal})}catch(o){if(x!==void 0)clearTimeout(x);if(J.signal?.removeEventListener("abort",j),J.signal?.aborted)throw o;let k=F?new JQ(J.timeoutMs):o;if(F&&J.retryTimeouts===!1)throw k;let T=B<W?$Q(B,V):z(B,void 0,k,F);if(T===void 0)throw k;await q(T,B,k,F);continue}if(x!==void 0)clearTimeout(x);if(D.ok)return D;J.signal?.removeEventListener("abort",j);let d=await Z6(D),I=new A(D.status,d,D.headers.get("x-request-id")??D.headers.get("request-id")??void 0,Q6(D.headers.get("retry-after"),G()));if(!J6(D.status,I))throw I;let N=I.retryAfter??(D.status===429?M(I).retryAfter:void 0),S=B>=W?z(B,N,I,!1):N===void 0?$Q(B,V):Math.min(N,Z5);if(S===void 0)throw I;await q(S,B,I,!1)}}async function Z6(Q){let $;try{$=await Q.text()}catch{return null}try{return JSON.parse($)}catch{return $}}function G5(Q,$,J){let Z=$.idleMs>0?$.idleMs:0,Y=$.maxMs>0?$.maxMs:0;if(!Q||!Z&&!Y)return Q;let V=Y?performance.now()+Y:1/0,G=Q.getReader();return new ReadableStream({async pull(W){let H,X,q=Math.max(0,V-performance.now()),z=!Z||q<=Z,B=z?q:Z,K=new Promise((j,F)=>{H=setTimeout(()=>{X=z?J.max():J.idle(),F(X)},B)});try{let j=await Promise.race([G.read(),K]);if(j.done)W.close();else W.enqueue(j.value)}catch(j){let F=X??j;W.error(F),G.cancel(F).catch(()=>{})}finally{clearTimeout(H)}},cancel(W){return G.cancel(W)}},{highWaterMark:0})}var NQ=30000,B5=10,K5=7200,Y6=600,V6="gpt-live-transcribe";function G6(Q){return Q.type==="transcription"}function B6(Q){if(Q.language!==void 0&&Q.languages!==void 0)throw TypeError("A transcription session takes `languages` or `language`, not both (gpt-live-transcribe reads `languages`).");for(let Y of Q.keywords??[])if(/[<>\r\n]/.test(Y))throw TypeError(`Transcription keywords must be one line without "<" or ">", got ${JSON.stringify(Y)}.`);let $={model:Q.model??V6};if(Q.prompt!==void 0)$.prompt=Q.prompt;if(Q.keywords?.length)$.keywords=Q.keywords;if(Q.languages?.length)$.languages=Q.languages;if(Q.language!==void 0)$.language=Q.language;if(Q.delay!==void 0)$.delay=Q.delay;let J={transcription:$,turn_detection:Q.turnDetection?W5(Q.turnDetection):null};if(Q.noiseReduction!==void 0)J.noise_reduction=Q.noiseReduction&&{type:Q.noiseReduction};let Z={type:"transcription",audio:{input:J}};if(Q.logprobs)Z.include=["item.input_audio_transcription.logprobs"];return{...Z,...Q.vendor}}function K6(Q){if(!Q)return{type:"object",properties:{}};return X5(Q)?Q.toJSONSchema():Q}function ZQ(Q,$){if(G6(Q))return B6(Q);let J={type:"realtime"},Z=Q.model??$;if(Z)J.model=Z;if(Q.instructions!==void 0)J.instructions=Q.instructions;if(Q.outputModalities)J.output_modalities=Q.outputModalities;if(Q.maxOutputTokens!==void 0)J.max_output_tokens=Q.maxOutputTokens;if(Q.truncation!==void 0)J.truncation=Q.truncation;if(Q.tools)J.tools=Q.tools.map((G)=>({type:"function",name:G.name,...G.description?{description:G.description}:{},parameters:K6(G.parameters)}));if(Q.toolChoice!==void 0)J.tool_choice=typeof Q.toolChoice==="string"?Q.toolChoice:{type:"function",name:Q.toolChoice.name};let Y={};if(Q.turnDetection!==void 0)Y.turn_detection=Q.turnDetection&&W5(Q.turnDetection);if(Q.transcription!==void 0)Y.transcription=Q.transcription;if(Q.noiseReduction!==void 0)Y.noise_reduction=Q.noiseReduction&&{type:Q.noiseReduction};let V={};if(Q.voice!==void 0)V.voice=Q.voice;if(Q.speed!==void 0)V.speed=Q.speed;if(Object.keys(Y).length||Object.keys(V).length)J.audio={...Object.keys(Y).length?{input:Y}:{},...Object.keys(V).length?{output:V}:{}};return{...J,...Q.vendor}}function W5(Q){let $={type:Q.type};if(Q.createResponse!==void 0)$.create_response=Q.createResponse;if(Q.interruptResponse!==void 0)$.interrupt_response=Q.interruptResponse;if(Q.type==="semantic_vad"){if(Q.eagerness!==void 0)$.eagerness=Q.eagerness}else{if(Q.threshold!==void 0)$.threshold=Q.threshold;if(Q.prefixPaddingMs!==void 0)$.prefix_padding_ms=Q.prefixPaddingMs;if(Q.silenceDurationMs!==void 0)$.silence_duration_ms=Q.silenceDurationMs;if(Q.idleTimeoutMs!==void 0)$.idle_timeout_ms=Q.idleTimeoutMs}return $}function DQ(Q){let $=Number(Q?.input_tokens??0),J=Number(Q?.output_tokens??0),Z={inputTokens:$,outputTokens:J,totalTokens:Number(Q?.total_tokens??$+J)},Y=Q?.input_token_details??Q?.input_tokens_details,V=Q?.output_token_details??Q?.output_tokens_details;if(typeof Y?.cached_tokens==="number")Z.cachedInputTokens=Y.cached_tokens;if(typeof Y?.audio_tokens==="number")Z.audioInputTokens=Y.audio_tokens;let G=Y?.cached_tokens_details?.audio_tokens;if(typeof G==="number")Z.cachedAudioInputTokens=G;if(typeof Y?.image_tokens==="number"&&Y.image_tokens>0)Z.imageInputTokens=Y.image_tokens;if(typeof V?.audio_tokens==="number")Z.audioOutputTokens=V.audio_tokens;return Z}class i extends Error{code;retryable;status;constructor(Q,$={}){super(Q.message,{cause:$.cause});if(this.name="RealtimeRequestError",this.code=Q.code,this.retryable=Q.retryable,$.status!==void 0)this.status=$.status}}var X6=60;class YQ{model;target;options;constructor(Q,$){this.target=Q,this.options=$,this.model=$.model}url(Q){return`${this.target.base}/realtime${Q}${this.target.query}`}sidebandUrl(Q){let $=this.target.base.replace(/^http(s?):/i,(Z,Y)=>`ws${Y}:`),J=this.target.query?`${this.target.query}&`:"?";return`${$}/realtime${J}call_id=${encodeURIComponent(Q)}`}async createCall(Q){let $=Q.flow??this.options.callFlow??"unified",J,Z;if($==="ephemeral")J={authorization:`Bearer ${(await this.clientSecret({session:Q.session,ttlSeconds:X6,signal:Q.signal})).value}`,"content-type":"application/sdp"},Z=Q.sdp;else{let H=new FormData;H.set("sdp",Q.sdp),H.set("session",JSON.stringify(ZQ(Q.session??{},this.model))),J=await this.target.headers(),Z=H}if(Q.safetyIdentifier)J["OpenAI-Safety-Identifier"]=Q.safetyIdentifier;let Y=this.url("/calls"),V=await this.request(Q.webrtcFilter?`${Y}${Y.includes("?")?"&":"?"}webrtcfilter=on`:Y,{method:"POST",headers:J,body:Z},Q.signal),G=await V.text(),W=H6(V);if(!W)throw new i({code:"provider_error",message:"The provider started a realtime call but did not say which one (no Location).",retryable:!1});return{sdpAnswer:G,callId:W}}async clientSecret(Q={}){let $=Q.ttlSeconds??Y6;if(!Number.isInteger($)||$<B5||$>K5)throw RangeError(`ttlSeconds must be a whole number from ${B5} to ${K5}, got ${$}.`);let J={...await this.target.headers(),"content-type":"application/json"};if(Q.safetyIdentifier)J["OpenAI-Safety-Identifier"]=Q.safetyIdentifier;let Y=await(await this.request(this.url("/client_secrets"),{method:"POST",headers:J,body:JSON.stringify({expires_after:{anchor:"created_at",seconds:$},session:ZQ(Q.session??{},this.model)})},Q.signal)).json();if(typeof Y?.value!=="string")throw new i({code:"provider_error",message:"The provider answered a client secret request with no secret.",retryable:!1});return{value:Y.value,expiresAt:Number(Y.expires_at??0),session:Y.session,callsUrl:this.url("/calls")}}async hangup(Q,$={}){try{await this.request(this.url(`/calls/${encodeURIComponent(Q)}/hangup`),{method:"POST",headers:await this.target.headers()},$.signal)}catch(J){if(W6(J,Q))return;throw J}}sideband(Q,$={}){return new PQ({...$,callId:Q,url:this.sidebandUrl(Q),headers:this.target.headers,webSocket:$.webSocket??this.options.webSocket,hangup:()=>this.hangup(Q)})}async request(Q,$,J){try{return await m(Q,$,{maxRetries:this.target.maxRetries,timeoutMs:this.target.timeoutMs,retryTimeouts:!1,signal:J,fetchImpl:this.options.fetchImpl})}catch(Z){if(J?.aborted)throw Z;throw new i(M(Z),{cause:Z,...Z instanceof A?{status:Z.status}:{}})}}}function W6(Q,$){if(!(Q instanceof i)||Q.status!==404)return!1;let J=Q.cause instanceof A?Q.cause.body:void 0,Z=J?.error??J,Y=String(Z?.code??"").toLowerCase(),V=String(Z?.message??"").toLowerCase();if(Y.includes("call"))return!0;if(V.includes($.toLowerCase()))return!0;return/\bcall\b/.test(V)&&/not (be )?found|does not exist|no longer|ended/.test(V)}function H6(Q){let $=Q.headers.get("location");if(!$)return;let J=$.split("?")[0].replace(/\/+$/,""),Z=J.slice(J.lastIndexOf("/")+1);return Z?decodeURIComponent(Z):void 0}var j6={"response.audio_transcript.delta":"response.output_audio_transcript.delta","response.audio_transcript.done":"response.output_audio_transcript.done","response.text.delta":"response.output_text.delta","response.text.done":"response.output_text.done","response.audio.delta":"response.output_audio.delta","response.audio.done":"response.output_audio.done"};function z6(Q){if(typeof Q!=="string")return;let $;try{$=JSON.parse(Q)}catch{return}if(!$||typeof $!=="object"||typeof $.type!=="string")return;let J=j6[$.type];if(J)$.type=J;if($.type==="response.done"&&$.response?.usage)$.usage=DQ($.response.usage);if($.type==="conversation.item.input_audio_transcription.completed"&&$.usage)if($.usage.type==="duration"){let Z=Number($.usage.seconds);if(Number.isFinite(Z))$.transcriptionSeconds=Z}else $.transcriptionUsage=DQ($.usage);return $}var H5=1,q6=500;function C6(Q,$){let J=globalThis.WebSocket;if(!J)throw Error("No global WebSocket: the realtime sideband needs Bun or Node 22+.");return Q5(Q),new J(Q,{headers:$.headers})}class PQ{callId;ready;closed;init;socket;finalEvent;outbox=[];subscribers=new Set;listeners=new Set;backlog=[];closing=!1;finished=!1;everOpened=!1;failures=0;resolveReady;rejectReady;resolveClosed;constructor(Q){this.init=Q,this.callId=Q.callId,this.ready=new Promise(($,J)=>{this.resolveReady=$,this.rejectReady=J}),this.ready.catch(()=>{}),this.closed=new Promise(($)=>this.resolveClosed=$),this.open()}send(Q){if(this.finished||this.closing)return;let $=JSON.stringify(Q);if(this.socket?.readyState===H5)this.socket.send($);else this.outbox.push($)}updateSession(Q){this.send({type:"session.update",session:ZQ(Q)})}addItem(Q){this.send({type:"conversation.item.create",item:Q})}addNote(Q){this.addItem({type:"message",role:"system",content:[{type:"input_text",text:Q}]})}functionOutput(Q,$){this.addItem({type:"function_call_output",call_id:Q,output:typeof $==="string"?$:JSON.stringify($)})}createResponse(Q={}){let $={};if(Q.instructions!==void 0)$.instructions=Q.instructions;if(Q.toolChoice!==void 0)$.tool_choice=typeof Q.toolChoice==="string"?Q.toolChoice:{type:"function",name:Q.toolChoice.name};if(Q.outputModalities)$.output_modalities=Q.outputModalities;if(Q.conversation)$.conversation=Q.conversation;if(Q.metadata)$.metadata=Q.metadata;Object.assign($,Q.vendor),this.send(Object.keys($).length?{type:"response.create",response:$}:{type:"response.create"})}cancelResponse(Q){this.send(Q?{type:"response.cancel",response_id:Q}:{type:"response.cancel"})}on(Q){return this.listeners.add(Q),()=>this.listeners.delete(Q)}[Symbol.asyncIterator](){let Q={queue:this.backlog??[],done:this.finished};return this.backlog=void 0,this.subscribers.add(Q),{next:async()=>{for(;;){let J=Q.queue.shift();if(J)return{value:J,done:!1};if(Q.done)return this.subscribers.delete(Q),{value:void 0,done:!0};await new Promise((Z)=>Q.wake=Z),Q.wake=void 0}},return:async()=>{return Q.done=!0,Q.queue.length=0,this.subscribers.delete(Q),{value:void 0,done:!0}}}}close(Q=1000,$="closed"){if(this.finished||this.closing)return;if(this.closing=!0,this.socket&&this.socket.readyState<=H5)this.socket.close(Q,$);else this.finish(Q,$,!0)}async hangup(){try{await this.init.hangup()}catch(Q){if(this.finalEvent&&!this.finalEvent.byClient&&this.finalEvent.code===1000)return;throw Q}this.close(1000,"hangup")}async open(){let Q;try{let J=await this.init.headers();if(this.closing)return this.finish(1000,"closed",!0);Q=(this.init.webSocket??C6)(this.init.url,{headers:J})}catch(J){return this.dropped(1006,J instanceof Error?J.message:String(J),!1)}this.socket=Q;let $=!1;Q.addEventListener("open",()=>{$=!0;let J=this.everOpened;this.everOpened=!0;let Z=this.failures;this.failures=0;for(let Y of this.outbox.splice(0))Q.send(Y);if(this.resolveReady(),J)this.emit({type:"sideband.reconnected",attempt:Z})}),Q.addEventListener("message",(J)=>{let Z=z6(J.data);if(Z)this.emit(Z)}),Q.addEventListener("close",(J)=>{if(this.socket!==Q)return;this.dropped(J.code??1006,J.reason??"",$)}),Q.addEventListener("error",()=>{})}dropped(Q,$,J){if(this.socket=void 0,this.closing)return this.finish(Q,$,!0);let Z=this.init.reconnect?.attempts??3;if(!((Q!==1000||!J)&&this.failures<Z))return this.finish(Q,$,!1);this.failures+=1;let V=(this.init.reconnect?.delayMs??500)*2**(this.failures-1);setTimeout(()=>void this.open(),V)}finish(Q,$,J){if(this.finished)return;this.finished=!0,this.outbox.length=0;let Z={type:"sideband.closed",code:Q,reason:$,byClient:J};this.finalEvent=Z,this.emit(Z);for(let Y of this.subscribers)Y.done=!0,Y.wake?.();if(!this.everOpened)this.rejectReady(Error(`Realtime sideband did not open (${Q} ${$}).`));this.resolveClosed(Z)}emit(Q){if(this.backlog){if(this.backlog.push(Q),this.backlog.length>q6)this.backlog.shift()}for(let $ of this.subscribers){if($.done)continue;$.queue.push(Q),$.wake?.()}for(let $ of this.listeners)try{$(Q)}catch{}}}var q5=3;function UQ(Q){let $=new Map;for(let J of Q)for(let Z of J.content??[]){if(Z.type!=="file"||!Z.fileId||$.has(Z.fileId))continue;$.set(Z.fileId,{name:Z.name,mimeType:Z.mimeType})}return $}function C5(Q,$,J=new Map){if(!($ instanceof A))return[];if($.status!==400&&$.status!==404)return[];let Z=OQ($.body);if(!Z)return[];let Y=F6(Q.input);if(Y.length===0)return[];let V=/^input\[(\d+)\]\.content\[(\d+)\]\.file_id$/.exec(Z.param??"");if(V){let X=Q.input[Number(V[1])],q=xQ(X)[Number(V[2])],z=q&&typeof q.file_id==="string"?q.file_id:void 0;if(z)return[z]}let G=Z.message??"",W=z5(Y.map((X)=>X.fileId).filter((X)=>L6(G,X)));if(W.length>0)return W;let H=/Expected (image type|context stuffing file type) to be a supported format:.*but got \.([a-z0-9]+)\.?\s*$/is.exec(G);if(H){let X=H[1].toLowerCase()==="image type"?"input_image":"input_file",q=H[2].toLowerCase(),z=z5(Y.filter((K)=>K.type===X).map((K)=>K.fileId)),B=z.filter((K)=>(J.get(K)?.name??"").trim().toLowerCase().endsWith(`.${q}`));if(B.length===1)return B;if(B.length===0&&z.length===1)return z}return[]}function F5(Q,$,J=new Map){return{...Q,input:Q.input.map((Z)=>{let Y=xQ(Z);if(!Y.some((V)=>j5(V,$)))return Z;return{...Z,content:Y.map((V)=>j5(V,$)?{type:"input_text",text:n(J.get(String(V.file_id))?.name)}:V)}})}}function n(Q){return`[${Q?`attachment ${JSON.stringify(Q)}`:"an attachment"} could not be read by the provider and is not shown to you. Tell the user if it matters to the answer; uploading it again may help.]`}function j5(Q,$){return typeof Q.file_id==="string"&&$.has(Q.file_id)}function xQ(Q){let $=Q?.content;return Array.isArray($)?$:[]}function F6(Q){let $=[];for(let J of Q)for(let Z of xQ(J))if(typeof Z.file_id==="string"&&Z.file_id)$.push({type:String(Z.type),fileId:Z.file_id});return $}function OQ(Q){if(!Q||typeof Q!=="object")return null;let $=Q,J=$.error&&typeof $.error==="object"?$.error:Q;return{message:typeof J.message==="string"?J.message:void 0,param:typeof J.param==="string"?J.param:void 0}}function L6(Q,$){let J=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`(^|[^A-Za-z0-9_-])${J}($|[^A-Za-z0-9_-])`).test(Q)}function z5(Q){return[...new Set(Q)]}function L5(Q,$){if(!($ instanceof A))return null;if($.status!==400&&$.status!==404)return null;let J=Q?.input;if(!Array.isArray(J))return null;let Z=OQ($.body)?.message??"",Y=/Item with id '([^']+)' not found/i.exec(Z)?.[1];if(!Y)return null;let V=(G)=>G?.type==="reasoning";if(!J.some((G)=>V(G)&&G.id===Y))return null;return{...Q,input:J.filter((G)=>!V(G))}}async function*_Q(Q){let $="",J="",Z=[],Y,V=()=>{if(Z.length===0&&!J)return null;let H={event:J,data:Z.join(`
2
+ import{Kd as IQ,Sd as A,Td as JQ,Ud as x5,Vd as O5,Wd as RQ,Xd as M5,Yd as f,Zd as VQ,_d as M,sd as GQ,ud as g}from"./chunk-hhka8j31.js";import{Zj as X5,fk as U5}from"./chunk-gx5yhz2m.js";var{fetch:r5,WebSocket:s5}=globalThis;function oQ(Q,$){if(typeof Bun>"u")return Q!==$;return typeof Q!=="function"||!/\{\s*\[native code\]\s*\}\s*$/.test(Function.prototype.toString.call(Q))}class qQ extends Error{constructor(Q){super(`A model provider tried to call ${a5(Q)} from a test. Tests under vitest do not reach real model providers: give the agent a scripted or fake provider, or set GEMI_AI_LIVE=1 to make real (billed) calls.`);this.name="LiveModelCallRefusedError"}}function tQ(Q=process.env){return!Q.VITEST||Q.GEMI_AI_LIVE==="1"}function eQ(Q){if(tQ()||oQ(globalThis.fetch,r5)||$5(Q))return;throw new qQ(Q)}function Q5(Q){let $=globalThis.WebSocket;if(tQ()||oQ($,s5)||$5(Q))return;throw new qQ(Q)}function $5(Q){let $;try{$=new URL(Q).hostname}catch{return!1}return $==="localhost"||$.endsWith(".localhost")||$==="[::1]"||/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test($)}function a5(Q){try{return new URL(Q).origin}catch{return"a provider"}}function CQ(Q,$,J){let Z=Q.on;if(Z===void 0)return!0;if(typeof Z!=="function")return Z.includes($.code);try{return Z($,J)===!0}catch{return!1}}var o5=4000,t5=60000;function J5(Q){if(Q===void 0)return;let $=(J,Z)=>typeof J==="number"&&Number.isFinite(J)&&J>=Z;if(!Q||!$(Q.patienceMs,0)||Q.initialWaitMs!==void 0&&!$(Q.initialWaitMs,1)||Q.maxWaitMs!==void 0&&!$(Q.maxWaitMs,1)||Q.on!==void 0&&typeof Q.on!=="function"&&!(Array.isArray(Q.on)&&Q.on.every((J)=>typeof J==="string")))throw Error(`The provider's retry policy ${JSON.stringify(Q)} is not usable: patienceMs has to be a number of milliseconds (0 or more), initialWaitMs and maxWaitMs above 0, and on a list of error codes or a function.`)}function FQ(Q,$,J,Z,Y){let V=Q.patienceMs-Z;if(V<=0)return;let G=Q.maxWaitMs??t5,W=Q.initialWaitMs??o5,H=J!==void 0?Math.min(J,G):Math.round(Math.min(G,W*2**$)*(0.5+Y()*0.5));return Math.min(H,V)}var e5=500,Z5=20000;function Q6(Q,$){if(!Q)return;let J=Q.trim();if(/^\d+(\.\d+)?$/.test(J))return Math.max(0,Number(J)*1000);let Z=Date.parse(J);if(Number.isNaN(Z))return;return Math.max(0,Z-$)}function $Q(Q,$){let J=Math.min(Z5,e5*2**Q);return Math.round(J*(0.5+$()*0.5))}function $6(Q){return Q===429||Q===408||Q===409||Q>=500}function J6(Q,$){return $6(Q)&&M($).retryable}function Y5(Q){return Q.reason??new DOMException("The operation was aborted.","AbortError")}function V5(Q,$){return new Promise((J,Z)=>{let Y=setTimeout(J,Q);$?.addEventListener("abort",()=>{clearTimeout(Y),Z(Y5($))},{once:!0})})}async function LQ(Q,$,J=V5){if(!$)return await J(Q);$.throwIfAborted();let Z;try{await Promise.race([J(Q,$),new Promise((Y,V)=>{Z=()=>V(Y5($)),$.addEventListener("abort",Z,{once:!0})})])}finally{if(Z)$.removeEventListener("abort",Z)}}async function m(Q,$,J){if(!J.fetchImpl)eQ(Q);let Z=J.fetchImpl??((B,K)=>fetch(B,K)),Y=J.sleep??V5,V=J.random??Math.random,G=J.now??Date.now,W=Math.max(0,J.maxRetries),H=J.startedAt??G(),X=J.retry,q=(B,K,j,F)=>{let x=G()-H;try{J.onRetry?.({attempt:K+1,maxRetries:W,error:M(j),...f(j),timedOut:F,delayMs:B,elapsedMs:x,...X?{remainingMs:Math.max(0,X.patienceMs-x-B)}:{}})}catch{}return LQ(B,J.signal,Y)},z=(B,K,j,F)=>{if(!X)return;let{status:x}=f(j);if(!CQ(X,M(j),{...x?{status:x}:{},timedOut:F}))return;return FQ(X,B-W,K,G()-H,V)};for(let B=0;;B++){J.signal?.throwIfAborted();let K=new AbortController,j=()=>K.abort(J.signal?.reason);J.signal?.addEventListener("abort",j,{once:!0});let F=!1,x=J.timeoutMs>0?setTimeout(()=>{F=!0,K.abort()},J.timeoutMs):void 0,D;try{D=await Z(Q,{...$,signal:K.signal})}catch(o){if(x!==void 0)clearTimeout(x);if(J.signal?.removeEventListener("abort",j),J.signal?.aborted)throw o;let k=F?new JQ(J.timeoutMs):o;if(F&&J.retryTimeouts===!1)throw k;let T=B<W?$Q(B,V):z(B,void 0,k,F);if(T===void 0)throw k;await q(T,B,k,F);continue}if(x!==void 0)clearTimeout(x);if(D.ok)return D;J.signal?.removeEventListener("abort",j);let d=await Z6(D),I=new A(D.status,d,D.headers.get("x-request-id")??D.headers.get("request-id")??void 0,Q6(D.headers.get("retry-after"),G()));if(!J6(D.status,I))throw I;let N=I.retryAfter??(D.status===429?M(I).retryAfter:void 0),S=B>=W?z(B,N,I,!1):N===void 0?$Q(B,V):Math.min(N,Z5);if(S===void 0)throw I;await q(S,B,I,!1)}}async function Z6(Q){let $;try{$=await Q.text()}catch{return null}try{return JSON.parse($)}catch{return $}}function G5(Q,$,J){let Z=$.idleMs>0?$.idleMs:0,Y=$.maxMs>0?$.maxMs:0;if(!Q||!Z&&!Y)return Q;let V=Y?performance.now()+Y:1/0,G=Q.getReader();return new ReadableStream({async pull(W){let H,X,q=Math.max(0,V-performance.now()),z=!Z||q<=Z,B=z?q:Z,K=new Promise((j,F)=>{H=setTimeout(()=>{X=z?J.max():J.idle(),F(X)},B)});try{let j=await Promise.race([G.read(),K]);if(j.done)W.close();else W.enqueue(j.value)}catch(j){let F=X??j;W.error(F),G.cancel(F).catch(()=>{})}finally{clearTimeout(H)}},cancel(W){return G.cancel(W)}},{highWaterMark:0})}var NQ=30000,B5=10,K5=7200,Y6=600,V6="gpt-live-transcribe";function G6(Q){return Q.type==="transcription"}function B6(Q){if(Q.language!==void 0&&Q.languages!==void 0)throw TypeError("A transcription session takes `languages` or `language`, not both (gpt-live-transcribe reads `languages`).");for(let Y of Q.keywords??[])if(/[<>\r\n]/.test(Y))throw TypeError(`Transcription keywords must be one line without "<" or ">", got ${JSON.stringify(Y)}.`);let $={model:Q.model??V6};if(Q.prompt!==void 0)$.prompt=Q.prompt;if(Q.keywords?.length)$.keywords=Q.keywords;if(Q.languages?.length)$.languages=Q.languages;if(Q.language!==void 0)$.language=Q.language;if(Q.delay!==void 0)$.delay=Q.delay;let J={transcription:$,turn_detection:Q.turnDetection?W5(Q.turnDetection):null};if(Q.noiseReduction!==void 0)J.noise_reduction=Q.noiseReduction&&{type:Q.noiseReduction};let Z={type:"transcription",audio:{input:J}};if(Q.logprobs)Z.include=["item.input_audio_transcription.logprobs"];return{...Z,...Q.vendor}}function K6(Q){if(!Q)return{type:"object",properties:{}};return X5(Q)?Q.toJSONSchema():Q}function ZQ(Q,$){if(G6(Q))return B6(Q);let J={type:"realtime"},Z=Q.model??$;if(Z)J.model=Z;if(Q.instructions!==void 0)J.instructions=Q.instructions;if(Q.outputModalities)J.output_modalities=Q.outputModalities;if(Q.maxOutputTokens!==void 0)J.max_output_tokens=Q.maxOutputTokens;if(Q.truncation!==void 0)J.truncation=Q.truncation;if(Q.tools)J.tools=Q.tools.map((G)=>({type:"function",name:G.name,...G.description?{description:G.description}:{},parameters:K6(G.parameters)}));if(Q.toolChoice!==void 0)J.tool_choice=typeof Q.toolChoice==="string"?Q.toolChoice:{type:"function",name:Q.toolChoice.name};let Y={};if(Q.turnDetection!==void 0)Y.turn_detection=Q.turnDetection&&W5(Q.turnDetection);if(Q.transcription!==void 0)Y.transcription=Q.transcription;if(Q.noiseReduction!==void 0)Y.noise_reduction=Q.noiseReduction&&{type:Q.noiseReduction};let V={};if(Q.voice!==void 0)V.voice=Q.voice;if(Q.speed!==void 0)V.speed=Q.speed;if(Object.keys(Y).length||Object.keys(V).length)J.audio={...Object.keys(Y).length?{input:Y}:{},...Object.keys(V).length?{output:V}:{}};return{...J,...Q.vendor}}function W5(Q){let $={type:Q.type};if(Q.createResponse!==void 0)$.create_response=Q.createResponse;if(Q.interruptResponse!==void 0)$.interrupt_response=Q.interruptResponse;if(Q.type==="semantic_vad"){if(Q.eagerness!==void 0)$.eagerness=Q.eagerness}else{if(Q.threshold!==void 0)$.threshold=Q.threshold;if(Q.prefixPaddingMs!==void 0)$.prefix_padding_ms=Q.prefixPaddingMs;if(Q.silenceDurationMs!==void 0)$.silence_duration_ms=Q.silenceDurationMs;if(Q.idleTimeoutMs!==void 0)$.idle_timeout_ms=Q.idleTimeoutMs}return $}function DQ(Q){let $=Number(Q?.input_tokens??0),J=Number(Q?.output_tokens??0),Z={inputTokens:$,outputTokens:J,totalTokens:Number(Q?.total_tokens??$+J)},Y=Q?.input_token_details??Q?.input_tokens_details,V=Q?.output_token_details??Q?.output_tokens_details;if(typeof Y?.cached_tokens==="number")Z.cachedInputTokens=Y.cached_tokens;if(typeof Y?.audio_tokens==="number")Z.audioInputTokens=Y.audio_tokens;let G=Y?.cached_tokens_details?.audio_tokens;if(typeof G==="number")Z.cachedAudioInputTokens=G;if(typeof Y?.image_tokens==="number"&&Y.image_tokens>0)Z.imageInputTokens=Y.image_tokens;if(typeof V?.audio_tokens==="number")Z.audioOutputTokens=V.audio_tokens;return Z}class i extends Error{code;retryable;status;constructor(Q,$={}){super(Q.message,{cause:$.cause});if(this.name="RealtimeRequestError",this.code=Q.code,this.retryable=Q.retryable,$.status!==void 0)this.status=$.status}}var X6=60;class YQ{model;target;options;constructor(Q,$){this.target=Q,this.options=$,this.model=$.model}url(Q){return`${this.target.base}/realtime${Q}${this.target.query}`}sidebandUrl(Q){let $=this.target.base.replace(/^http(s?):/i,(Z,Y)=>`ws${Y}:`),J=this.target.query?`${this.target.query}&`:"?";return`${$}/realtime${J}call_id=${encodeURIComponent(Q)}`}async createCall(Q){let $=Q.flow??this.options.callFlow??"unified",J,Z;if($==="ephemeral")J={authorization:`Bearer ${(await this.clientSecret({session:Q.session,ttlSeconds:X6,signal:Q.signal})).value}`,"content-type":"application/sdp"},Z=Q.sdp;else{let H=new FormData;H.set("sdp",Q.sdp),H.set("session",JSON.stringify(ZQ(Q.session??{},this.model))),J=await this.target.headers(),Z=H}if(Q.safetyIdentifier)J["OpenAI-Safety-Identifier"]=Q.safetyIdentifier;let Y=this.url("/calls"),V=await this.request(Q.webrtcFilter?`${Y}${Y.includes("?")?"&":"?"}webrtcfilter=on`:Y,{method:"POST",headers:J,body:Z},Q.signal),G=await V.text(),W=H6(V);if(!W)throw new i({code:"provider_error",message:"The provider started a realtime call but did not say which one (no Location).",retryable:!1});return{sdpAnswer:G,callId:W}}async clientSecret(Q={}){let $=Q.ttlSeconds??Y6;if(!Number.isInteger($)||$<B5||$>K5)throw RangeError(`ttlSeconds must be a whole number from ${B5} to ${K5}, got ${$}.`);let J={...await this.target.headers(),"content-type":"application/json"};if(Q.safetyIdentifier)J["OpenAI-Safety-Identifier"]=Q.safetyIdentifier;let Y=await(await this.request(this.url("/client_secrets"),{method:"POST",headers:J,body:JSON.stringify({expires_after:{anchor:"created_at",seconds:$},session:ZQ(Q.session??{},this.model)})},Q.signal)).json();if(typeof Y?.value!=="string")throw new i({code:"provider_error",message:"The provider answered a client secret request with no secret.",retryable:!1});return{value:Y.value,expiresAt:Number(Y.expires_at??0),session:Y.session,callsUrl:this.url("/calls")}}async hangup(Q,$={}){try{await this.request(this.url(`/calls/${encodeURIComponent(Q)}/hangup`),{method:"POST",headers:await this.target.headers()},$.signal)}catch(J){if(W6(J,Q))return;throw J}}sideband(Q,$={}){return new PQ({...$,callId:Q,url:this.sidebandUrl(Q),headers:this.target.headers,webSocket:$.webSocket??this.options.webSocket,hangup:()=>this.hangup(Q)})}async request(Q,$,J){try{return await m(Q,$,{maxRetries:this.target.maxRetries,timeoutMs:this.target.timeoutMs,retryTimeouts:!1,signal:J,fetchImpl:this.options.fetchImpl})}catch(Z){if(J?.aborted)throw Z;throw new i(M(Z),{cause:Z,...Z instanceof A?{status:Z.status}:{}})}}}function W6(Q,$){if(!(Q instanceof i)||Q.status!==404)return!1;let J=Q.cause instanceof A?Q.cause.body:void 0,Z=J?.error??J,Y=String(Z?.code??"").toLowerCase(),V=String(Z?.message??"").toLowerCase();if(Y.includes("call"))return!0;if(V.includes($.toLowerCase()))return!0;return/\bcall\b/.test(V)&&/not (be )?found|does not exist|no longer|ended/.test(V)}function H6(Q){let $=Q.headers.get("location");if(!$)return;let J=$.split("?")[0].replace(/\/+$/,""),Z=J.slice(J.lastIndexOf("/")+1);return Z?decodeURIComponent(Z):void 0}var j6={"response.audio_transcript.delta":"response.output_audio_transcript.delta","response.audio_transcript.done":"response.output_audio_transcript.done","response.text.delta":"response.output_text.delta","response.text.done":"response.output_text.done","response.audio.delta":"response.output_audio.delta","response.audio.done":"response.output_audio.done"};function z6(Q){if(typeof Q!=="string")return;let $;try{$=JSON.parse(Q)}catch{return}if(!$||typeof $!=="object"||typeof $.type!=="string")return;let J=j6[$.type];if(J)$.type=J;if($.type==="response.done"&&$.response?.usage)$.usage=DQ($.response.usage);if($.type==="conversation.item.input_audio_transcription.completed"&&$.usage)if($.usage.type==="duration"){let Z=Number($.usage.seconds);if(Number.isFinite(Z))$.transcriptionSeconds=Z}else $.transcriptionUsage=DQ($.usage);return $}var H5=1,q6=500;function C6(Q,$){let J=globalThis.WebSocket;if(!J)throw Error("No global WebSocket: the realtime sideband needs Bun or Node 22+.");return Q5(Q),new J(Q,{headers:$.headers})}class PQ{callId;ready;closed;init;socket;finalEvent;outbox=[];subscribers=new Set;listeners=new Set;backlog=[];closing=!1;finished=!1;everOpened=!1;failures=0;resolveReady;rejectReady;resolveClosed;constructor(Q){this.init=Q,this.callId=Q.callId,this.ready=new Promise(($,J)=>{this.resolveReady=$,this.rejectReady=J}),this.ready.catch(()=>{}),this.closed=new Promise(($)=>this.resolveClosed=$),this.open()}send(Q){if(this.finished||this.closing)return;let $=JSON.stringify(Q);if(this.socket?.readyState===H5)this.socket.send($);else this.outbox.push($)}updateSession(Q){this.send({type:"session.update",session:ZQ(Q)})}addItem(Q){this.send({type:"conversation.item.create",item:Q})}addNote(Q){this.addItem({type:"message",role:"system",content:[{type:"input_text",text:Q}]})}functionOutput(Q,$){this.addItem({type:"function_call_output",call_id:Q,output:typeof $==="string"?$:JSON.stringify($)})}createResponse(Q={}){let $={};if(Q.instructions!==void 0)$.instructions=Q.instructions;if(Q.toolChoice!==void 0)$.tool_choice=typeof Q.toolChoice==="string"?Q.toolChoice:{type:"function",name:Q.toolChoice.name};if(Q.outputModalities)$.output_modalities=Q.outputModalities;if(Q.conversation)$.conversation=Q.conversation;if(Q.metadata)$.metadata=Q.metadata;Object.assign($,Q.vendor),this.send(Object.keys($).length?{type:"response.create",response:$}:{type:"response.create"})}cancelResponse(Q){this.send(Q?{type:"response.cancel",response_id:Q}:{type:"response.cancel"})}on(Q){return this.listeners.add(Q),()=>this.listeners.delete(Q)}[Symbol.asyncIterator](){let Q={queue:this.backlog??[],done:this.finished};return this.backlog=void 0,this.subscribers.add(Q),{next:async()=>{for(;;){let J=Q.queue.shift();if(J)return{value:J,done:!1};if(Q.done)return this.subscribers.delete(Q),{value:void 0,done:!0};await new Promise((Z)=>Q.wake=Z),Q.wake=void 0}},return:async()=>{return Q.done=!0,Q.queue.length=0,this.subscribers.delete(Q),{value:void 0,done:!0}}}}close(Q=1000,$="closed"){if(this.finished||this.closing)return;if(this.closing=!0,this.socket&&this.socket.readyState<=H5)this.socket.close(Q,$);else this.finish(Q,$,!0)}async hangup(){try{await this.init.hangup()}catch(Q){if(this.finalEvent&&!this.finalEvent.byClient&&this.finalEvent.code===1000)return;throw Q}this.close(1000,"hangup")}async open(){let Q;try{let J=await this.init.headers();if(this.closing)return this.finish(1000,"closed",!0);Q=(this.init.webSocket??C6)(this.init.url,{headers:J})}catch(J){return this.dropped(1006,J instanceof Error?J.message:String(J),!1)}this.socket=Q;let $=!1;Q.addEventListener("open",()=>{$=!0;let J=this.everOpened;this.everOpened=!0;let Z=this.failures;this.failures=0;for(let Y of this.outbox.splice(0))Q.send(Y);if(this.resolveReady(),J)this.emit({type:"sideband.reconnected",attempt:Z})}),Q.addEventListener("message",(J)=>{let Z=z6(J.data);if(Z)this.emit(Z)}),Q.addEventListener("close",(J)=>{if(this.socket!==Q)return;this.dropped(J.code??1006,J.reason??"",$)}),Q.addEventListener("error",()=>{})}dropped(Q,$,J){if(this.socket=void 0,this.closing)return this.finish(Q,$,!0);let Z=this.init.reconnect?.attempts??3;if(!((Q!==1000||!J)&&this.failures<Z))return this.finish(Q,$,!1);this.failures+=1;let V=(this.init.reconnect?.delayMs??500)*2**(this.failures-1);setTimeout(()=>void this.open(),V)}finish(Q,$,J){if(this.finished)return;this.finished=!0,this.outbox.length=0;let Z={type:"sideband.closed",code:Q,reason:$,byClient:J};this.finalEvent=Z,this.emit(Z);for(let Y of this.subscribers)Y.done=!0,Y.wake?.();if(!this.everOpened)this.rejectReady(Error(`Realtime sideband did not open (${Q} ${$}).`));this.resolveClosed(Z)}emit(Q){if(this.backlog){if(this.backlog.push(Q),this.backlog.length>q6)this.backlog.shift()}for(let $ of this.subscribers){if($.done)continue;$.queue.push(Q),$.wake?.()}for(let $ of this.listeners)try{$(Q)}catch{}}}var q5=3;function UQ(Q){let $=new Map;for(let J of Q)for(let Z of J.content??[]){if(Z.type!=="file"||!Z.fileId||$.has(Z.fileId))continue;$.set(Z.fileId,{name:Z.name,mimeType:Z.mimeType})}return $}function C5(Q,$,J=new Map){if(!($ instanceof A))return[];if($.status!==400&&$.status!==404)return[];let Z=OQ($.body);if(!Z)return[];let Y=F6(Q.input);if(Y.length===0)return[];let V=/^input\[(\d+)\]\.content\[(\d+)\]\.file_id$/.exec(Z.param??"");if(V){let X=Q.input[Number(V[1])],q=xQ(X)[Number(V[2])],z=q&&typeof q.file_id==="string"?q.file_id:void 0;if(z)return[z]}let G=Z.message??"",W=z5(Y.map((X)=>X.fileId).filter((X)=>L6(G,X)));if(W.length>0)return W;let H=/Expected (image type|context stuffing file type) to be a supported format:.*but got \.([a-z0-9]+)\.?\s*$/is.exec(G);if(H){let X=H[1].toLowerCase()==="image type"?"input_image":"input_file",q=H[2].toLowerCase(),z=z5(Y.filter((K)=>K.type===X).map((K)=>K.fileId)),B=z.filter((K)=>(J.get(K)?.name??"").trim().toLowerCase().endsWith(`.${q}`));if(B.length===1)return B;if(B.length===0&&z.length===1)return z}return[]}function F5(Q,$,J=new Map){return{...Q,input:Q.input.map((Z)=>{let Y=xQ(Z);if(!Y.some((V)=>j5(V,$)))return Z;return{...Z,content:Y.map((V)=>j5(V,$)?{type:"input_text",text:n(J.get(String(V.file_id))?.name)}:V)}})}}function n(Q){return`[${Q?`attachment ${JSON.stringify(Q)}`:"an attachment"} could not be read by the provider and is not shown to you. Tell the user if it matters to the answer; uploading it again may help.]`}function j5(Q,$){return typeof Q.file_id==="string"&&$.has(Q.file_id)}function xQ(Q){let $=Q?.content;return Array.isArray($)?$:[]}function F6(Q){let $=[];for(let J of Q)for(let Z of xQ(J))if(typeof Z.file_id==="string"&&Z.file_id)$.push({type:String(Z.type),fileId:Z.file_id});return $}function OQ(Q){if(!Q||typeof Q!=="object")return null;let $=Q,J=$.error&&typeof $.error==="object"?$.error:Q;return{message:typeof J.message==="string"?J.message:void 0,param:typeof J.param==="string"?J.param:void 0}}function L6(Q,$){let J=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`(^|[^A-Za-z0-9_-])${J}($|[^A-Za-z0-9_-])`).test(Q)}function z5(Q){return[...new Set(Q)]}function L5(Q,$){if(!($ instanceof A))return null;if($.status!==400&&$.status!==404)return null;let J=Q?.input;if(!Array.isArray(J))return null;let Z=OQ($.body)?.message??"",Y=/Item with id '([^']+)' not found/i.exec(Z)?.[1];if(!Y)return null;let V=(G)=>G?.type==="reasoning";if(!J.some((G)=>V(G)&&G.id===Y))return null;return{...Q,input:J.filter((G)=>!V(G))}}async function*_Q(Q){let $="",J="",Z=[],Y,V=()=>{if(Z.length===0&&!J)return null;let H={event:J,data:Z.join(`
3
3
  `),id:Y};return J="",Z=[],Y=void 0,H.data?H:null},G=(H)=>{let X=H.endsWith("\r")?H.slice(0,-1):H;if(X==="")return V();if(X.startsWith(":"))return null;let q=X.indexOf(":"),z=q===-1?X:X.slice(0,q),B=q===-1?"":X.slice(q+1);if(B.startsWith(" "))B=B.slice(1);if(z==="event")J=B;else if(z==="data")Z.push(B);else if(z==="id")Y=B;return null};for await(let H of Q){$+=H;let X=$.indexOf(`
4
4
  `);while(X!==-1){let q=$.slice(0,X);$=$.slice(X+1);let z=G(q);if(z)yield z;X=$.indexOf(`
5
5
  `)}}if($.length>0){let H=G($);if(H)yield H}let W=V();if(W)yield W}async function*P5(Q,$={}){let J=new Map,Z=new Set,Y,V=!1,G,W=(H,X)=>({type:"finish",reason:H,usage:X,...G?{model:G}:{}});for await(let H of _Q(Q)){if(H.data==="[DONE]")break;let X;try{X=JSON.parse(H.data)}catch{continue}let q=typeof X.type==="string"?X.type:H.event,z=X.response?.model;if(typeof z==="string"&&z)G=z;switch(q){case"response.output_text.delta":{let B=String(X.delta??"");if(!B)break;yield $.structuredOutput?{type:"output-delta",delta:B}:{type:"text-delta",delta:B};break}case"response.reasoning_summary_text.delta":case"response.reasoning_text.delta":{let B=String(X.delta??"");if(!B)break;yield{type:"reasoning-delta",delta:B,id:X.item_id};break}case"response.output_item.added":{let B=X.item;if(!B)break;if(B.type==="function_call"){let K=String(B.id??X.item_id??B.call_id??"");J.set(K,{callId:String(B.call_id??K),name:String(B.name??""),namespace:typeof B.namespace==="string"&&B.namespace?B.namespace:void 0,done:!1})}break}case"response.function_call_arguments.delta":{let B=J.get(String(X.item_id??""));if(!B)break;let K=String(X.delta??"");if(!K)break;yield{type:"tool-call-delta",toolCallId:B.callId,name:B.name,argsDelta:K,...B.namespace?{namespace:B.namespace}:{}};break}case"response.function_call_arguments.done":{let B=String(X.item_id??""),K=J.get(B);if(!K)break;K.done=!0,yield{type:"tool-call",toolCallId:K.callId,name:K.name,args:String(X.arguments??""),...K.namespace?{namespace:K.namespace}:{}};break}case"response.output_item.done":{let B=X.item;if(!B)break;if(B.type==="function_call"){let K=String(B.id??X.item_id??B.call_id??""),j=J.get(K);if(j?.done)break;let F=(typeof B.namespace==="string"?B.namespace:"")||j?.namespace;if(yield{type:"tool-call",toolCallId:String(B.call_id??K),name:String(B.name??j?.name??""),args:String(B.arguments??""),...F?{namespace:F}:{}},j)j.done=!0;break}if(B.type==="tool_search_call"||B.type==="tool_search_output"){if(B.type==="tool_search_call"&&B.arguments!==void 0)Y=B.arguments;let K=P6(B);if(K.loaded.length===0&&K.namespaces.length===0)break;let j=String(B.tool_search_call_id??B.id??"");if(Z.has(j))break;Z.add(j);let F=Y;Y=void 0,yield{type:"tool-search",...K,...F!==void 0&&F!==null?{arguments:F}:{}}}break}case"response.refusal.done":{yield{type:"error",error:{code:"content_filtered",message:String(X.refusal??"The model refused to answer."),retryable:!1}};break}case"response.completed":{V=!0,yield W("stop",MQ(X.response?.usage));break}case"response.incomplete":{V=!0;let B=MQ(X.response?.usage),K=X.response?.incomplete_details?.reason;if(K==="content_filter"){yield{type:"error",error:{code:"content_filtered",message:N6(X.response?.content_filters),retryable:!1}},yield W("error",B);break}yield W(K==="max_output_tokens"?"length":"stop",B);break}case"response.failed":case"error":{V=!0;let B=X.response?.error??X.error??X;yield{type:"error",error:D6(B),...VQ(B)},yield W("error",MQ(X.response?.usage));break}}if(V)return}if(!V)yield{type:"error",error:{code:"provider_error",message:"The provider stream ended without a terminal event.",retryable:!0}},yield W("error",U())}function P6(Q){let $=[],J=[];return N5(Q.results??Q.tools??Q.loaded??Q.output,$,J,0),{loaded:SQ($),namespaces:SQ(J)}}function N5(Q,$,J,Z){if(!Array.isArray(Q)||Z>4)return;for(let Y of Q){if(typeof Y==="string"){$.push(Y);continue}if(!Y||typeof Y!=="object")continue;let V=Y,G=typeof V.name==="string"?V.name:typeof V.tool_name==="string"?V.tool_name:"",W=V.tools??V.functions;if(Array.isArray(W)){if(G)J.push(G);N5(W,$,J,Z+1);continue}if(G)$.push(G)}}function SQ(Q){return Q.filter(($,J)=>Q.indexOf($)===J)}function N6(Q){if(!Array.isArray(Q))return"The provider's content filter blocked this request.";let J=[];for(let Z of Q){if(!Z||typeof Z!=="object")continue;let Y=Z,V=Y.content_filter_results;if(!V||typeof V!=="object")continue;for(let[G,W]of Object.entries(V))if(W&&typeof W==="object"&&W.filtered===!0)J.push(`${G} (${String(Y.source_type??"unknown")})`)}return J.length===0?"The provider's content filter blocked this request.":`The provider's content filter blocked this request. Categories: ${SQ(J).join(", ")}.`}function D6(Q){let $=typeof Q?.message==="string"?Q.message:"The provider stream failed.",J=String(Q?.code??"").toLowerCase();if(J==="rate_limit_exceeded")return{code:"rate_limited",message:$,retryable:!0};if(J==="context_length_exceeded")return{code:"context_length_exceeded",message:$,retryable:!1};if(J.includes("content_filter"))return{code:"content_filtered",message:$,retryable:!1};return{code:"provider_error",message:$,retryable:!0}}function U(){return{inputTokens:0,outputTokens:0,totalTokens:0}}function MQ(Q){if(!Q)return U();let $=Number(Q.input_tokens??0),J=Number(Q.output_tokens??0),Z={inputTokens:$,outputTokens:J,totalTokens:Number(Q.total_tokens??$+J)},Y=Q.output_tokens_details?.reasoning_tokens;if(typeof Y==="number")Z.reasoningTokens=Y;let V=Q.input_tokens_details?.cached_tokens;if(typeof V==="number")Z.cachedInputTokens=V;return Z}async function*D5(Q){if(!Q)return;let $=Q.getReader(),J=new TextDecoder;try{while(!0){let{done:Y,value:V}=await $.read();if(Y)break;if(V)yield J.decode(V,{stream:!0})}let Z=J.decode();if(Z)yield Z}finally{$.releaseLock()}}function BQ(Q){return{responsesUrl:`${Q.base}/responses${Q.query}`,filesUrl:`${Q.base}/files${Q.query}`,headers:Q.headers,timeoutMs:Q.timeoutMs,streamIdleTimeoutMs:Q.streamIdleTimeoutMs,streamMaxDurationMs:Q.streamMaxDurationMs,maxToolArgumentChars:Q.maxToolArgumentChars,maxToolArgumentWhitespace:Q.maxToolArgumentWhitespace,maxRetries:Q.maxRetries,...Q.retry?{retry:Q.retry}:{}}}async function*KQ(Q,$,J){let Z=J.parse??P5,Y=$,V=new Set,G=0,W=!1,H=Math.max(0,Q.maxRetries),X=Q.random??Math.random,q,z=(N)=>{if(!q)return N;let S=g(g(U(),q),N.usage);return q=void 0,{...N,usage:S}},B=(N)=>z({type:"finish",reason:"aborted",usage:N??U()}),K=(N)=>g(g(U(),q??U()),N),j=Q.streamIdleTimeoutMs??0,F=Q.streamMaxDurationMs??0,x=Q.maxToolArgumentChars??0,D=Q.maxToolArgumentWhitespace??0,d=Q.now??Date.now,I=d();for(let N=0;;N++){let S=new AbortController,o=J.signal?AbortSignal.any([J.signal,S.signal]):S.signal,k;while(k===void 0)try{let L=[],C=()=>{},P=m(Q.responsesUrl,{method:"POST",headers:{...await Q.headers(),"content-type":"application/json"},body:JSON.stringify(Y)},{maxRetries:Q.maxRetries,timeoutMs:Q.timeoutMs,signal:o,fetchImpl:Q.fetchImpl,sleep:Q.sleep,random:Q.random,now:Q.now,startedAt:I,...Q.retry?{retry:Q.retry}:{},onRetry:(R)=>{L.push({type:"retry",...R,phase:"request"}),C()}}),_=P.then(()=>!0,()=>!0);for(;;){let R=new Promise((y)=>C=()=>y(!1)),b=await Promise.race([_,R]);if(yield*L.splice(0),b)break}k=await P}catch(L){let C=Y,P=J.files&&G<q5?C5(C,L,J.files).filter((b)=>!V.has(b)):[];if(P.length>0){G++;let b=M(L).message;for(let y of P)V.add(y),yield{type:"file-rejected",fileId:y,message:b,...f(L)};Y=F5(C,new Set(P),J.files);continue}let _=W?null:L5(Y,L);if(_){W=!0,Y=_;continue}let R=M(L);if(R.code==="aborted"){yield B();return}yield{type:"error",error:R,...f(L)},yield z({type:"finish",reason:"error",usage:U()});return}let T=[],l=!1,u,zQ=!1,E,w=new Map,v,aQ=()=>v?{usage:K(v)}:{},t;try{let L=G5(k.body,{idleMs:j,maxMs:F},{idle:()=>{let C=new x5(j);return S.abort(C),C},max:()=>{let C=new O5(F);return S.abort(C),C}});for await(let C of Z(D5(L),{structuredOutput:J.structuredOutput,onUsage:(P)=>v=P})){if(C.type==="usage"){v=C.usage,yield{type:"usage",usage:K(C.usage)};continue}if(C.type==="tool-call-delta"){let P=w.get(C.toolCallId);if(!P)w.set(C.toolCallId,P=U6());x6(P,C.argsDelta,D>0);let _=P.chars;if(D>0&&P.space>D){let R=P.text.trimEnd(),b=O6(R);if(M6(C.name,C.toolCallId,_,P.space,D,b),!b){let y=new M5(D,C.name,C.toolCallId,_,P.space);throw S.abort(y),y}w.delete(C.toolCallId),t={type:"tool-call",toolCallId:C.toolCallId,name:C.name,args:R,...C.namespace?{namespace:C.namespace}:{}};break}if(x>0&&_>x){let R=new RQ(x,C.name,C.toolCallId,_);throw S.abort(R),R}yield C;continue}if(C.type==="tool-call")w.delete(C.toolCallId);if(l){yield C.type==="finish"?z(C):C;continue}if(GQ(C)){l=!0,yield*T.splice(0),yield C;continue}if(C.type==="error")u=C.error;T.push(C)}if(t)await L?.cancel().catch(()=>{})}catch(L){zQ=L instanceof JQ;let C=M(L);if(C.code==="aborted"||J.signal?.aborted){yield B(v);return}if(L instanceof RQ)E=L.detail;if(l){yield{type:"error",error:C,...E?{toolArgumentsTooLong:E}:{},...aQ()},yield z({type:"finish",reason:"error",usage:v??U()});return}u=C,T.push({type:"error",error:C,...E?{toolArgumentsTooLong:E}:{},...aQ()},{type:"finish",reason:"error",usage:v??U()})}if(t){if(S.abort(),!l)yield*T.splice(0);if(yield t,w.size>0)yield{type:"tool-call-discard",toolCallIds:[...w.keys()]};yield z({type:"finish",reason:"stop",usage:v??U()});return}if(l)return;let e={};for(let L of T)if(L.type==="error")e=f(L);let QQ=!u?.retryable||J.signal?.aborted||E&&J.retryToolArgumentsTooLong===!1?void 0:N<H?$Q(N,X):Q.retry&&CQ(Q.retry,u,{...e.status!==void 0?{status:e.status}:{},timedOut:zQ,...E?{toolArgumentsTooLong:E}:{}})?FQ(Q.retry,N-H,u.retryAfter,d()-I,X):void 0;if(QQ!==void 0){let L;for(let _ of T)if(_.type==="finish")L=g(L??U(),_.usage);if(L)q=g(q??U(),L);let C=L&&L.totalTokens>0?{usage:L}:{};if(w.size>0)yield{type:"tool-call-discard",toolCallIds:[...w.keys()]};let P=d()-I;if(yield{type:"retry",attempt:N+1,maxRetries:H,error:u,...e,...C,phase:"stream",timedOut:zQ,...E?{toolArgumentsTooLong:E}:{},delayMs:QQ,elapsedMs:P,...Q.retry?{remainingMs:Math.max(0,Q.retry.patienceMs-P-QQ)}:{}},q&&q.totalTokens>0)yield{type:"usage",usage:K(U())};try{await LQ(QQ,J.signal,Q.sleep)}catch{yield B();return}continue}for(let L of T)yield L.type==="finish"?z(L):L;return}}function U6(){return{chars:0,text:"",inString:!1,escaped:!1,space:0}}function x6(Q,$,J){if(Q.chars+=$.length,!J)return;Q.text+=$;for(let Z of $){if(Q.inString){if(Q.escaped)Q.escaped=!1;else if(Z==="\\")Q.escaped=!0;else if(Z==='"')Q.inString=!1}else if(Z===" "||Z===`
@@ -9,4 +9,4 @@ import{$d as M,Ld as IQ,Td as A,Ud as JQ,Vd as x5,Wd as O5,Xd as RQ,Yd as M5,Zd
9
9
  ${JSON.stringify(Q)}`}function i6(Q,$){if(Q==="none")return{type:"none"};if(Q==="required")return $?{type:"any"}:{type:"auto"};if(Q&&typeof Q==="object")return $?{type:"tool",name:Q.name}:{type:"auto"};return{type:"auto"}}function n6(Q,$){let J=[],Z=new Map;for(let z of Q){let B=z.role==="assistant"?"assistant":"user";J.push("step-end");for(let K of z.content??[])switch(K.type){case"text":{if(B==="assistant"?!!K.text:!!K.text?.trim())J.push({role:B,block:{type:"text",text:K.text}});break}case"output":{if(K.partial)break;let j=K.text??JSON.stringify(K.value);J.push({role:B,block:{type:"text",text:j}});break}case"file":{if(B==="assistant")break;for(let j of e6(K,$))J.push({role:B,block:j});break}case"reasoning":{let j=B==="assistant"?t6(K):void 0;if(j)J.push({role:B,block:j});break}case"tool-call":{if(K.partial)break;J.push({role:"assistant",block:{type:"tool_use",id:K.toolCallId,name:String(K.name),input:h(K.input)?K.input:{}}});break}case"tool-result":{if(J.push("step-end"),Z.has(K.toolCallId))break;Z.set(K.toolCallId,{type:"tool_result",tool_use_id:K.toolCallId,content:bQ(K),...K.status==="error"?{is_error:!0}:{}});break}}}let Y=[],V=(z,B)=>{let K=Y[Y.length-1];if(K&&K.role===z)K.content.push(B);else Y.push({role:z,content:[B]})},G=new Set,W=EQ(Q),H=[],X=!1,q=()=>{for(let z of H)V("user",Z.get(z)??o6(z,W.has(z)));H=[],X=!1};for(let z of J){if(z==="step-end"){X=!0;continue}let{role:B,block:K}=z;if(X||B==="user")q();if(K.type==="tool_use"){let j=String(K.id);if(G.has(j))continue;G.add(j),H.push(j)}V(B,K)}if(q(),Y[0]?.role==="assistant")Y.unshift({role:"user",content:[{type:"text",text:r6}]});if(Y.at(-1)?.role==="assistant")Y.push({role:"user",content:[{type:"text",text:s6}]});return Y}var r6="(The conversation continues from an earlier point.)",s6="Continue.",a6="No result was recorded for this tool call. Assume it did not complete.";function o6(Q,$){return{type:"tool_result",tool_use_id:Q,content:$?TQ:a6}}function t6(Q){let $=Q.providerMetadata?.anthropic;if(!h($))return;if($.type==="thinking"&&typeof $.signature==="string")return{type:"thinking",thinking:Q.text??"",signature:$.signature};if($.type==="redacted_thinking"&&typeof $.data==="string")return{type:"redacted_thinking",data:$.data};return}function e6(Q,$){let J=kQ(Q),Z=(V)=>J?[{type:"text",text:r(Q,V)}]:[];if(!$.fileInput)return Z(!1);if(vQ(Q,J),!Q.fileId)return Z(!1);let Y=Q.providerRejected?void 0:$7(Q);if(!Y)return[...Z(!1),{type:"text",text:n(Q.name)}];return[...Z(!0),{type:Y,source:{type:"file",file_id:Q.fileId}}]}var Q7=new Set(["image/jpeg","image/png","image/gif","image/webp"]);function $7(Q){let $=Q.mimeType?.trim().toLowerCase()??"";if(wQ(Q))return!$||Q7.has($)?"image":void 0;if($)return $==="application/pdf"||$==="text/plain"?"document":void 0;return/\.(pdf|txt)$/i.test(Q.name??"")?"document":void 0}function h(Q){return!!Q&&typeof Q==="object"&&!Array.isArray(Q)}function J7(Q){return Array.isArray(Q.tools)}function Z7(Q){let $=[];for(let J of Q??[])for(let Z of J7(J)?J.tools:[J])$.push({name:Z.name,description:Z.description,input_schema:Z.parameters,eager_input_streaming:!0});return $}async function*v5(Q,$={}){let J=new Map,Z=[],Y,V={},G,W,H=!1,X=(q)=>({type:"finish",reason:q,usage:a(V),...Y?{model:Y}:{}});for await(let q of _Q(Q)){let z;try{z=JSON.parse(q.data)}catch{continue}switch(typeof z.type==="string"?z.type:q.event){case"message_start":{let K=z.message??{};if(typeof K.model==="string"&&K.model)Y=K.model;V=w5(V,K.usage),$.onUsage?.(a(V)),yield{type:"usage",usage:a(V)};break}case"content_block_start":{let K=Number(z.index),j=z.content_block??{},F={type:String(j.type??""),id:typeof j.id==="string"?j.id:void 0,name:typeof j.name==="string"?j.name:void 0,args:"",signature:typeof j.signature==="string"?j.signature:""};if(J.set(K,F),F.type==="redacted_thinking")yield{type:"reasoning-delta",delta:"",providerMetadata:{anthropic:{type:"redacted_thinking",data:String(j.data??"")}}};if(F.type==="text"&&typeof j.text==="string"&&j.text)yield k5(j.text,$);break}case"content_block_delta":{let K=J.get(Number(z.index)),j=z.delta??{};if(!K)break;if(j.type==="text_delta"){let F=String(j.text??"");if(F)yield k5(F,$)}else if(j.type==="thinking_delta"){let F=String(j.thinking??"");if(F)yield{type:"reasoning-delta",delta:F}}else if(j.type==="signature_delta")K.signature+=String(j.signature??"");else if(j.type==="input_json_delta"&&K.type==="tool_use"){let F=String(j.partial_json??"");if(!F)break;K.args+=F,yield{type:"tool-call-delta",toolCallId:K.id??"",name:K.name??"",argsDelta:F}}break}case"content_block_stop":{let K=Number(z.index),j=J.get(K);if(J.delete(K),j?.type==="thinking")yield{type:"reasoning-delta",delta:"",providerMetadata:{anthropic:{type:"thinking",signature:j.signature}}};if(j?.type==="tool_use")if(j.args||="{}",Y7(j.args))yield E5(j);else Z.push(j);break}case"message_delta":{if(typeof z.delta?.stop_reason==="string")G=z.delta.stop_reason;if(z.delta?.stop_details)W=z.delta.stop_details;V=w5(V,z.usage),$.onUsage?.(a(V)),yield{type:"usage",usage:a(V)};break}case"message_stop":{if(H=!0,G==="refusal"){yield{type:"error",error:G7(W)},yield X("error");break}let K=V7(G);if(Z.length>0&&K==="length")yield{type:"tool-call-discard",toolCallIds:Z.map((j)=>j.id??"")};else for(let j of Z)yield E5(j);yield X(K);break}case"error":{H=!0;let K=z.error??z;yield{type:"error",error:B7(K),...VQ(K)},yield X("error");break}}if(H)return}yield{type:"error",error:{code:"provider_error",message:"The provider stream ended without a terminal event.",retryable:!0}},yield X("error")}function E5(Q){return{type:"tool-call",toolCallId:Q.id??"",name:Q.name??"",args:Q.args}}function Y7(Q){try{return JSON.parse(Q),!0}catch{return!1}}function k5(Q,$){return $.structuredOutput?{type:"output-delta",delta:Q}:{type:"text-delta",delta:Q}}function V7(Q){if(Q==="max_tokens"||Q==="model_context_window_exceeded")return"length";return"stop"}function G7(Q){let $=typeof Q?.explanation==="string"?Q.explanation:"",J=typeof Q?.category==="string"?` (${Q.category})`:"";return{code:"content_filtered",message:$||`The model declined to answer${J}.`,retryable:!1}}function B7(Q){let $=String(Q?.type??"").toLowerCase(),J=typeof Q?.message==="string"?Q.message:"The provider stream failed.";if($==="rate_limit_error")return{code:"rate_limited",message:J,retryable:!0};if($==="invalid_request_error"||$==="request_too_large")return{code:/prompt is too long|request_too_large/i.test(`${$} ${J}`)?"context_length_exceeded":"provider_error",message:J,retryable:!1};if($==="authentication_error"||$==="permission_error"||$==="billing_error"||$==="not_found_error")return{code:"provider_error",message:J,retryable:!1};return{code:"provider_error",message:J,retryable:!0}}function w5(Q,$){if(!$||typeof $!=="object")return Q;let J={...Q};for(let Y of["input_tokens","output_tokens","cache_creation_input_tokens","cache_read_input_tokens"])if(typeof $[Y]==="number")J[Y]=$[Y];let Z=$.output_tokens_details?.thinking_tokens;if(typeof Z==="number")J.thinking_tokens=Z;return J}function a(Q){if(!Q)return U();let{cache_read_input_tokens:$,cache_creation_input_tokens:J}=Q,Z=(Q.input_tokens??0)+($??0)+(J??0),Y=Q.output_tokens??0,V={inputTokens:Z,outputTokens:Y,totalTokens:Z+Y};if(typeof $==="number")V.cachedInputTokens=$;if(typeof J==="number")V.cacheWriteInputTokens=J;if(typeof Q.thinking_tokens==="number")V.reasoningTokens=Q.thinking_tokens;return V}function yQ(Q){let $=HQ(Q);if($.startsWith("gpt-3.5")||$.startsWith("text-")||$.startsWith("davinci"))return{reasoning:!1,structuredOutput:!1,fileInput:!1,parallelToolCalls:!0,toolSearch:!1,supportsForcedToolChoice:!0};let J=h5($);if(J?.kind==="o")return{reasoning:!0,structuredOutput:!0,fileInput:!0,parallelToolCalls:J.major>1,toolSearch:b5(J),supportsForcedToolChoice:!0};if(J?.kind==="gpt")return{reasoning:J.major>=5,structuredOutput:J.major>4||$.startsWith("gpt-4o")||$.startsWith("gpt-4.1"),fileInput:J.major>4||$.startsWith("gpt-4o")||$.startsWith("gpt-4.1"),parallelToolCalls:!0,toolSearch:b5(J),supportsForcedToolChoice:!0};return{reasoning:!0,structuredOutput:!0,fileInput:!0,parallelToolCalls:!0,toolSearch:!0,supportsForcedToolChoice:!0}}function b5(Q){if(Q.kind==="o")return Q.major>=5;return Q.major>5||Q.major===5&&Q.minor>=2}function fQ(Q){let $=h5(HQ(Q));return{trailingContext:!0,allowedTools:!$||$.kind==="gpt"&&$.major>=5}}function gQ(){return{trailingContext:!0}}function uQ(Q){let $=HQ(Q),J=/^claude-(?:opus|sonnet|haiku)-4(?:-(\d{1,2}))?(?:-\d{8})?$/.exec($);return{reasoning:!(/^claude-(?:3|2|instant)/.test($)||!!J&&Number(J[1]??0)<=5),structuredOutput:!0,fileInput:!0,parallelToolCalls:!0,toolSearch:!1,supportsForcedToolChoice:K7(Q)}}function K7(Q){let $=HQ(Q);return/^claude-(?:3|2|instant)/.test($)||/^claude-(?:opus|sonnet|haiku)-4(?:-|$)/.test($)||/^claude-(?:opus|sonnet|fable|mythos)-5(?:-\d{8})?$/.test($)||/^claude-haiku-5-5(?:-\d{8})?$/.test($)}function HQ(Q){return Q.trim().toLowerCase()}function h5(Q){let $=/^gpt-(\d+)(?:\.(\d+))?/.exec(Q);if($?.[1])return{kind:"gpt",major:Number($[1]),minor:Number($[2]??0)};let J=/^o(\d+)(?:[-.]|$)/.exec(Q);if(J?.[1])return{kind:"o",major:Number(J[1]),minor:0};return null}var mQ=120000,cQ=2,pQ=120000,dQ=300000,lQ=1000;function O(Q){return typeof process>"u"?void 0:process.env?.[Q]}var X7="preview";function y5(Q){let $=Q.trim().replace(/\/+$/,"");if(!$)return"";return`${$.replace(/\/openai(?:\/v1)?$/i,"")}/openai`}function W7(Q){return/^\d{4}-\d{2}-\d{2}/.test(Q)?"":"/v1"}function iQ(Q,$={}){return{base:(Q.baseURL??O("OPENAI_BASE_URL")??"https://api.openai.com/v1").replace(/\/+$/,""),query:"",headers:async()=>{let Z=Q.apiKey??O("OPENAI_API_KEY");return{...Z?{authorization:`Bearer ${Z}`}:{},...Q.headers}},timeoutMs:Q.timeoutMs??$.timeoutMs??mQ,streamIdleTimeoutMs:Q.streamIdleTimeoutMs??pQ,streamMaxDurationMs:Q.streamMaxDurationMs??dQ,maxToolArgumentChars:Q.maxToolArgumentChars??0,maxToolArgumentWhitespace:Q.maxToolArgumentWhitespace??lQ,maxRetries:Q.maxRetries??cQ,...rQ(Q)}}function f5(Q){let $=Q.baseURL??Q.endpoint??O("AZURE_OPENAI_ENDPOINT");if($)return y5($);let J=Q.resourceName??O("AZURE_OPENAI_RESOURCE_NAME")??O("AZURE_RESOURCE_NAME");return J?y5(`https://${J.trim()}.cognitiveservices.azure.com`):""}function nQ(Q,$={}){let J=Q.apiVersion??O("AZURE_OPENAI_API_VERSION")??X7;return{base:`${f5(Q)}${W7(J)}`,query:`?api-version=${encodeURIComponent(J)}`,headers:async()=>{if(Q.getToken)return{authorization:`Bearer ${await Q.getToken()}`,...Q.headers};let Z=Q.apiKey??O("AZURE_OPENAI_API_KEY");return{...Z?{"api-key":Z}:{},...Q.headers}},timeoutMs:Q.timeoutMs??$.timeoutMs??mQ,streamIdleTimeoutMs:Q.streamIdleTimeoutMs??pQ,streamMaxDurationMs:Q.streamMaxDurationMs??dQ,maxToolArgumentChars:Q.maxToolArgumentChars??0,maxToolArgumentWhitespace:Q.maxToolArgumentWhitespace??lQ,maxRetries:Q.maxRetries??cQ,...rQ(Q)}}var H7="2026-10-21";function g5(Q,$={}){let J=Q.baseURL??O("ANTHROPIC_BASE_URL")??"https://api.anthropic.com";return m5(J,Q,$,async()=>{let Z=Q.workspaceId??O("ANTHROPIC_WORKSPACE_ID"),Y=Z?{"anthropic-workspace-id":Z}:{},V=Q.apiKey??O("ANTHROPIC_API_KEY");if(V)return{"x-api-key":V,...Y};let G=O("ANTHROPIC_AUTH_TOKEN");return G?{authorization:`Bearer ${G}`,...Y}:Y})}function u5(Q,$={}){let J=Q.resourceName??O("ANTHROPIC_FOUNDRY_RESOURCE"),Z=Q.baseURL??Q.endpoint??O("ANTHROPIC_FOUNDRY_BASE_URL")??(J?`https://${J.trim()}.services.ai.azure.com/anthropic`:"");if(!Z.trim())throw Error("AzureAnthropicProvider has no Foundry endpoint. Set `endpoint` (the deployment's Target URI without `/v1/messages`, e.g. `https://<resource>.services.ai.azure.com/anthropic`) or `resourceName`, or the ANTHROPIC_FOUNDRY_BASE_URL or ANTHROPIC_FOUNDRY_RESOURCE environment variable.");return m5(Z,Q,$,async()=>{if(Q.getToken)return{authorization:`Bearer ${await Q.getToken()}`};let Y=Q.apiKey??O("ANTHROPIC_FOUNDRY_API_KEY");return Y?{"api-key":Y}:{}})}function m5(Q,$,J,Z){return{base:`${Q.trim().replace(/\/+$/,"").replace(/\/v1$/,"")}/v1`,query:"",headers:async()=>({...await Z(),"anthropic-version":H7,...$.headers}),timeoutMs:$.timeoutMs??J.timeoutMs??mQ,streamIdleTimeoutMs:$.streamIdleTimeoutMs??pQ,streamMaxDurationMs:$.streamMaxDurationMs??dQ,maxToolArgumentChars:$.maxToolArgumentChars??0,maxToolArgumentWhitespace:$.maxToolArgumentWhitespace??lQ,maxRetries:$.maxRetries??cQ,...rQ($)}}function c5(Q,$={}){return{...nQ(Q,$),base:`${f5(Q)}/v1`,query:""}}function rQ(Q){return J5(Q.retry),Q.retry?{retry:Q.retry}:{}}class jQ{static models(){return[]}normalizeError(Q){return M(Q)}}var p5=["gpt-5.5","gpt-5.4","gpt-5.4-mini","gpt-5.4-nano","gpt-5.2","gpt-5.1","gpt-5","gpt-5-mini","gpt-5-nano","gpt-4.1","gpt-4.1-mini","gpt-4.1-nano","gpt-4o","gpt-4o-mini","o4-mini","o3","o3-mini"];class d5 extends jQ{model;capabilities;config;constructor(Q,$={}){super();this.model=Q,this.capabilities={...yQ(Q),...fQ(Q)},this.config=$}static model(Q,$){return new d5(Q,$)}static models(){return p5}stream(Q){let $=AQ(Q,{model:this.model,capabilities:this.capabilities});return KQ(this.endpoint(),$,{signal:Q.signal,retryToolArgumentsTooLong:Q.retryToolArgumentsTooLong,structuredOutput:Boolean(Q.output),files:UQ(Q.messages)})}upload(Q){return XQ(this.endpoint(),Q)}deleteFile(Q){return WQ(this.endpoint(),Q)}endpoint(){return BQ(iQ(this.config))}get realtime(){return new YQ(iQ(this.config,{timeoutMs:NQ}),{model:this.model})}}var j7=["claude-opus-5-5","claude-sonnet-5-5","claude-haiku-5-5","claude-fable-5-2","claude-fable-5-1","claude-opus-5","claude-sonnet-5","claude-fable-5","claude-opus-4-8","claude-sonnet-4-6","claude-haiku-4-5"];class sQ extends jQ{model;capabilities;config;constructor(Q,$={}){super();this.model=Q,this.capabilities={...uQ(Q),...gQ()},this.config=$}cacheWriteFactor(Q){return 1.25}static model(Q,$){return new sQ(Q,$)}static models(){return j7}stream(Q){return this.send(Q)}async*send(Q){let $=Q,J=!1,Z=new Set;for(;;){let Y=this.request($);if(J)Y=A5(Y);let V,G=!1;for await(let W of KQ(this.endpointFor(Y),Y,{signal:Q.signal,retryToolArgumentsTooLong:Q.retryToolArgumentsTooLong,structuredOutput:Boolean(Q.output),parse:v5})){if(V)continue;if(!G&&W.type==="error"&&W.status===400){let H=I5(W.error.message);if(H&&!Z.has(H)){Z.add(H),V=H;continue}}if(GQ(W))G=!0;yield W}if(!V)return;if(V==="thinking")J=!0;else if($.output)$={...$,output:{...$.output,strict:!1}}}}request(Q){return R5(Q,{model:this.deployment(),modelId:this.model,capabilities:this.capabilities,forcedToolChoice:this.capabilities.supportsForcedToolChoice!==!1,blockBinding:this.bindsThinking()})}endpointFor(Q){let $=this.endpoint();if(!(Q.thinking?.type==="adaptive"&&Q.thinking.block_binding))return $;return{...$,headers:async()=>{let Z=await $.headers(),Y=Z["anthropic-beta"];return{...Z,"anthropic-beta":Y?`${Y},${hQ}`:hQ}}}}bindsThinking(){return!0}deployment(){return this.model}upload(Q){return XQ(this.endpoint(),Q,null)}deleteFile(Q){return WQ(this.endpoint(),Q)}endpoint(){return l5(g5(this.config))}}function l5(Q){return{...BQ(Q),responsesUrl:`${Q.base}/messages`}}class i5 extends sQ{constructor(Q,$={}){super(Q,$);this.capabilities={...uQ(Q),...gQ(),fileInput:!1}}static model(Q,$){return new i5(Q,$)}upload(Q){return Promise.reject(Error("AzureAnthropicProvider does not upload files: the Files API is not available on Azure-hosted Foundry deployments. The file is still stored by gemi and named to the model by its attachment id."))}deleteFile(Q){return Promise.reject(Error("AzureAnthropicProvider does not delete files: the Files API is not available on Azure-hosted Foundry deployments."))}deployment(){return this.config.deployment??this.model}bindsThinking(){return!1}endpoint(){return l5(u5(this.config))}}class n5 extends jQ{model;capabilities;config;constructor(Q,$={}){super();this.model=Q,this.capabilities={...yQ(Q),...fQ(Q)},this.config=$}static model(Q,$){return new n5(Q,$)}static models(){return p5}stream(Q){let $=AQ(Q,{model:this.deployment(),capabilities:this.capabilities});return KQ(this.endpoint(),$,{signal:Q.signal,retryToolArgumentsTooLong:Q.retryToolArgumentsTooLong,structuredOutput:Boolean(Q.output),files:UQ(Q.messages)})}upload(Q){return XQ(this.endpoint(),Q,"assistants")}deleteFile(Q){return WQ(this.endpoint(),Q)}deployment(){return this.config.deployment??this.model}endpoint(){return BQ(nQ(this.config))}get realtime(){return new YQ(c5(this.config,{timeoutMs:NQ}),{model:this.deployment(),callFlow:"ephemeral"})}}
10
10
  export{m as ca,iQ as da,nQ as ea,PQ as fa,V6 as ga,DQ as ha,i as ia,YQ as ja,W6 as ka,jQ as la,d5 as ma,sQ as na,i5 as oa,n5 as pa};
11
11
 
12
- //# debugId=A5CC43DDF0F1414964756E2164756E21
12
+ //# debugId=32B390F94EF83ED164756E2164756E21