@qitqode/qitqode-android-arm64 0.1.34 → 0.1.36

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 (451) hide show
  1. package/bundle/{chunk-7311jry1.js → chunk-00sr2gwz.js} +2 -2
  2. package/bundle/{chunk-azhw650z.js → chunk-02xcb52z.js} +2 -2
  3. package/bundle/{chunk-gws1rn1v.js → chunk-08q55ya0.js} +1 -1
  4. package/bundle/chunk-092bx2yw.js +2 -0
  5. package/bundle/{chunk-xgr6jnd6.js → chunk-0g25z230.js} +1 -1
  6. package/bundle/chunk-0j6dhrew.js +2 -0
  7. package/bundle/chunk-0jrgk6vk.js +2 -0
  8. package/bundle/chunk-0qn52zsd.js +2 -0
  9. package/bundle/chunk-10accb7b.js +2 -0
  10. package/bundle/{chunk-rjy5mqwz.js → chunk-132tcp2j.js} +2 -2
  11. package/bundle/chunk-13kpdfr7.js +2 -0
  12. package/bundle/chunk-15s8zwgf.js +2 -0
  13. package/bundle/{chunk-nj4d554m.js → chunk-1bx2sjn6.js} +1 -1
  14. package/bundle/chunk-1kgyfja6.js +2 -0
  15. package/bundle/{chunk-bv29k2pf.js → chunk-1mcsf4yb.js} +2 -2
  16. package/bundle/{chunk-kwx9ewe0.js → chunk-1wpjmwnh.js} +1 -1
  17. package/bundle/chunk-1yv5h8k4.js +2 -0
  18. package/bundle/chunk-24rw1br0.js +3 -0
  19. package/bundle/{chunk-snr44en9.js → chunk-25bp7pcm.js} +2 -2
  20. package/bundle/{chunk-kmcsz8yv.js → chunk-2dkrfc1s.js} +1 -1
  21. package/bundle/chunk-364ccew0.js +3 -0
  22. package/bundle/{chunk-ppkqr9cn.js → chunk-37dvnent.js} +2 -2
  23. package/bundle/chunk-3bkdbqjj.js +2 -0
  24. package/bundle/chunk-3bnqw3xp.js +3 -0
  25. package/bundle/{chunk-08m0hkdz.js → chunk-3dr4469n.js} +1 -1
  26. package/bundle/{chunk-2fkfbdcy.js → chunk-3gw6r3hf.js} +179 -179
  27. package/bundle/{chunk-n96tvjgj.js → chunk-3mepk08v.js} +2 -2
  28. package/bundle/chunk-3sz6gw10.js +3 -0
  29. package/bundle/chunk-41x11r2s.js +3 -0
  30. package/bundle/{chunk-xqdrr7xg.js → chunk-45mjcxqk.js} +1 -1
  31. package/bundle/{chunk-qrtc3etn.js → chunk-4fa390yr.js} +2 -2
  32. package/bundle/chunk-4gs87ghj.js +3 -0
  33. package/bundle/chunk-4kqdzdv5.js +3 -0
  34. package/bundle/{chunk-3k2b05fv.js → chunk-4sazy0nq.js} +1 -1
  35. package/bundle/chunk-4tbqsrsn.js +2 -0
  36. package/bundle/{chunk-ngccf7ga.js → chunk-52b1v7mn.js} +1 -1
  37. package/bundle/chunk-53kns5wy.js +2 -0
  38. package/bundle/{chunk-11v7vz3y.js → chunk-549ptbaj.js} +1 -1
  39. package/bundle/chunk-559ek1ym.js +2 -0
  40. package/bundle/{chunk-34p46th6.js → chunk-5bate758.js} +1 -1
  41. package/bundle/{chunk-kdcnder5.js → chunk-5kmfnkzv.js} +1 -1
  42. package/bundle/{chunk-9msnx26q.js → chunk-5pkg052s.js} +2 -2
  43. package/bundle/chunk-5yfzzmv0.js +2 -0
  44. package/bundle/{chunk-rsszcqxd.js → chunk-60qyqqxx.js} +1 -1
  45. package/bundle/{chunk-94pcpztx.js → chunk-64s7vfj7.js} +2 -2
  46. package/bundle/{chunk-bzgj60w4.js → chunk-6sfhbckv.js} +1 -1
  47. package/bundle/{chunk-8762ty72.js → chunk-70pb4kcm.js} +2 -2
  48. package/bundle/{chunk-04hvaaje.js → chunk-72zxassf.js} +1 -1
  49. package/bundle/{chunk-yz6898wy.js → chunk-73ckx171.js} +1 -1
  50. package/bundle/chunk-7cbj28fp.js +2 -0
  51. package/bundle/chunk-7dep7g7c.js +2 -0
  52. package/bundle/{chunk-gj0wt0cy.js → chunk-7fawtcnn.js} +1 -1
  53. package/bundle/{chunk-zfn0z4sh.js → chunk-7gbytqkn.js} +2 -2
  54. package/bundle/{chunk-x66ycpfs.js → chunk-7jhrxzjx.js} +2 -2
  55. package/bundle/{chunk-09pkckr1.js → chunk-7vftsy04.js} +1 -1
  56. package/bundle/{chunk-zfd70p01.js → chunk-8dxdeksr.js} +1 -1
  57. package/bundle/{chunk-6styp5dn.js → chunk-8fgamz4y.js} +1 -1
  58. package/bundle/{chunk-9qdr9t8c.js → chunk-8q6z6emx.js} +1 -1
  59. package/bundle/{chunk-4ttf9rjd.js → chunk-8r3410c2.js} +1 -1
  60. package/bundle/{chunk-3mzcr3fw.js → chunk-8tp4whyw.js} +1 -1
  61. package/bundle/chunk-8yn64y27.js +2 -0
  62. package/bundle/{chunk-41v0x1jk.js → chunk-8yr682pv.js} +2 -2
  63. package/bundle/chunk-8ywa7az5.js +2 -0
  64. package/bundle/chunk-8ywdddts.js +2 -0
  65. package/bundle/chunk-8zmreqxx.js +2 -0
  66. package/bundle/chunk-92zjark4.js +2 -0
  67. package/bundle/chunk-983rqajz.js +7 -0
  68. package/bundle/{chunk-kjyw00jp.js → chunk-9cw4cnz0.js} +1 -1
  69. package/bundle/{chunk-2swch6mx.js → chunk-9dh9bc9d.js} +1 -1
  70. package/bundle/{chunk-y437vyza.js → chunk-9fkmhmh6.js} +1 -1
  71. package/bundle/{chunk-7vd91wsd.js → chunk-9nk0ts0s.js} +1 -1
  72. package/bundle/{chunk-p9cnzxb8.js → chunk-9s4whpg1.js} +2 -2
  73. package/bundle/{chunk-yajd975f.js → chunk-9xvctnjr.js} +1 -1
  74. package/bundle/chunk-9yakc5yv.js +28 -0
  75. package/bundle/{chunk-4wxxyrxn.js → chunk-9zre5e54.js} +1 -1
  76. package/bundle/chunk-a42q5mx4.js +3 -0
  77. package/bundle/{chunk-yt3f3j35.js → chunk-a9y27zd2.js} +1 -1
  78. package/bundle/{chunk-mex0fe9s.js → chunk-acyj91wq.js} +1 -1
  79. package/bundle/chunk-aq28ejhv.js +2 -0
  80. package/bundle/{chunk-pkc4ddw1.js → chunk-atpzz901.js} +1 -1
  81. package/bundle/chunk-ax1y4699.js +2 -0
  82. package/bundle/{chunk-dctj3c22.js → chunk-b0jh0rby.js} +2 -2
  83. package/bundle/chunk-b0x888w9.js +2 -0
  84. package/bundle/chunk-b10px5g4.js +2 -0
  85. package/bundle/chunk-b1qhpxee.js +2 -0
  86. package/bundle/chunk-b4ysd5b4.js +9 -0
  87. package/bundle/chunk-bcs2gvmp.js +2 -0
  88. package/bundle/{chunk-7mxt5b0h.js → chunk-bjcb9kt0.js} +1 -1
  89. package/bundle/{chunk-67d5d8mr.js → chunk-bnz0mxak.js} +1 -1
  90. package/bundle/{chunk-wwgd4rzx.js → chunk-brh35yt5.js} +2 -2
  91. package/bundle/chunk-bs020a3x.js +2 -0
  92. package/bundle/{chunk-7eexey82.js → chunk-c72jajx9.js} +1 -1
  93. package/bundle/{chunk-81trveht.js → chunk-cagk1sjd.js} +1 -1
  94. package/bundle/{chunk-1byd3wma.js → chunk-cdh26622.js} +2 -2
  95. package/bundle/chunk-cjxcnhmq.js +14 -0
  96. package/bundle/{chunk-ygjtwjnk.js → chunk-cx0j6mpq.js} +1 -1
  97. package/bundle/{chunk-zh3fny3z.js → chunk-cx7p4ezk.js} +2 -2
  98. package/bundle/chunk-d0xs3j5h.js +2 -0
  99. package/bundle/{chunk-pxmhe36r.js → chunk-d1rn44wz.js} +1 -1
  100. package/bundle/chunk-d72rty3t.js +2 -0
  101. package/bundle/{chunk-0c6ep9mc.js → chunk-d93z6hrn.js} +1 -1
  102. package/bundle/{chunk-seghf5fc.js → chunk-dgx4rq86.js} +1 -1
  103. package/bundle/{chunk-qzj6027k.js → chunk-dh1h513y.js} +1 -1
  104. package/bundle/chunk-dj951pms.js +2 -0
  105. package/bundle/chunk-dp6zktka.js +2 -0
  106. package/bundle/{chunk-ba3h1pzs.js → chunk-dshnn54c.js} +1 -1
  107. package/bundle/{chunk-73myw3bj.js → chunk-dt899wbf.js} +2 -2
  108. package/bundle/chunk-dvqdtdza.js +2 -0
  109. package/bundle/{chunk-6ynxf3q7.js → chunk-dvxk6mr6.js} +2 -2
  110. package/bundle/chunk-dx7h5r8j.js +2 -0
  111. package/bundle/{chunk-bnss5dkk.js → chunk-dykqn0nj.js} +2 -2
  112. package/bundle/chunk-e03tgfpb.js +8 -0
  113. package/bundle/chunk-e07dbha4.js +2 -0
  114. package/bundle/chunk-e88wd9ex.js +2 -0
  115. package/bundle/{chunk-y9zstzed.js → chunk-eaqfnwdj.js} +1 -1
  116. package/bundle/chunk-ebabnv33.js +3 -0
  117. package/bundle/chunk-ebdpg3cn.js +2 -0
  118. package/bundle/{chunk-w9nzsd3w.js → chunk-ebkztnpf.js} +180 -178
  119. package/bundle/chunk-ec7pznsp.js +2 -0
  120. package/bundle/chunk-et7kz7kx.js +2 -0
  121. package/bundle/{chunk-kfmz2p27.js → chunk-ev3a2sxv.js} +2 -2
  122. package/bundle/{chunk-d00c1k9w.js → chunk-ewpzqnj4.js} +1 -1
  123. package/bundle/chunk-eyc6tb5h.js +2 -0
  124. package/bundle/chunk-eywryd3k.js +2 -0
  125. package/bundle/chunk-eze57bty.js +2 -0
  126. package/bundle/{chunk-qddt2gcs.js → chunk-ezrskm25.js} +1 -1
  127. package/bundle/chunk-f36ctnbp.js +3 -0
  128. package/bundle/{chunk-q5fygrnr.js → chunk-f77nxt23.js} +2 -2
  129. package/bundle/chunk-fa47vzfc.js +2 -0
  130. package/bundle/chunk-fe397ph0.js +2 -0
  131. package/bundle/chunk-fjm9kstr.js +5 -0
  132. package/bundle/{chunk-5xq3h51b.js → chunk-fmxm4kaj.js} +2 -2
  133. package/bundle/chunk-fr75ytdr.js +2 -0
  134. package/bundle/chunk-fw2tnbt6.js +2 -0
  135. package/bundle/chunk-fwr2qgqb.js +2 -0
  136. package/bundle/chunk-g204pt98.js +2 -0
  137. package/bundle/chunk-g5prcvq2.js +14 -0
  138. package/bundle/{chunk-ggydr1ze.js → chunk-g794ey6w.js} +1 -1
  139. package/bundle/chunk-gcgmwqhh.js +2 -0
  140. package/bundle/{chunk-rmve21dh.js → chunk-gg7bg3ek.js} +1 -1
  141. package/bundle/{chunk-9x25d115.js → chunk-gkj4a27z.js} +1 -1
  142. package/bundle/chunk-gvtjxg0d.js +2 -0
  143. package/bundle/chunk-gw36mrg4.js +2 -0
  144. package/bundle/{chunk-z8gdmvgg.js → chunk-gwfx7tx7.js} +2 -2
  145. package/bundle/{chunk-q8hd01j7.js → chunk-gxmxx8jb.js} +1 -1
  146. package/bundle/{chunk-tge53d52.js → chunk-h1kg35mn.js} +1 -1
  147. package/bundle/chunk-h36qec67.js +2 -0
  148. package/bundle/{chunk-0msqaywp.js → chunk-h7w35n7w.js} +1 -1
  149. package/bundle/chunk-h9gtymfm.js +2 -0
  150. package/bundle/chunk-h9qn35pn.js +2 -0
  151. package/bundle/{chunk-mr8j7rc6.js → chunk-hb9mc5f9.js} +1 -1
  152. package/bundle/{chunk-5a7fs1hg.js → chunk-hbh2034m.js} +1 -1
  153. package/bundle/{chunk-df2aswz3.js → chunk-hcy77w6t.js} +1 -1
  154. package/bundle/{chunk-6a7c7wnf.js → chunk-hgsykghj.js} +2 -2
  155. package/bundle/chunk-hhjkezfz.js +2 -0
  156. package/bundle/chunk-hnz570f9.js +3 -0
  157. package/bundle/{chunk-0csy9x1n.js → chunk-htkwc2se.js} +2 -2
  158. package/bundle/chunk-j21dnncc.js +4 -0
  159. package/bundle/{chunk-1yt5rsew.js → chunk-j63fkt6n.js} +1 -1
  160. package/bundle/chunk-ja18tvc7.js +2 -0
  161. package/bundle/{chunk-03xppy47.js → chunk-jcjaw7tk.js} +2 -2
  162. package/bundle/{chunk-jkh6eg7d.js → chunk-jf6ry79j.js} +4 -4
  163. package/bundle/{chunk-ke7n9t5p.js → chunk-jgz1a29w.js} +3 -3
  164. package/bundle/{chunk-ebcdxmdd.js → chunk-jngchw38.js} +1 -1
  165. package/bundle/{chunk-j5ymkhry.js → chunk-jqn27885.js} +1 -1
  166. package/bundle/chunk-jr2q5295.js +3 -0
  167. package/bundle/{chunk-hj3ddt53.js → chunk-jts0dma5.js} +2 -2
  168. package/bundle/chunk-jw16f6t0.js +4 -0
  169. package/bundle/chunk-jxg15t11.js +2 -0
  170. package/bundle/{chunk-7hm0c2yg.js → chunk-kqhh2pm9.js} +1 -1
  171. package/bundle/{chunk-0h8wdch6.js → chunk-kt0ej3nq.js} +1 -1
  172. package/bundle/chunk-kwzawx7r.js +2 -0
  173. package/bundle/{chunk-n6msxne8.js → chunk-kx2dp8ch.js} +1 -1
  174. package/bundle/chunk-m0mek3es.js +2 -0
  175. package/bundle/chunk-m31d2n6h.js +2 -0
  176. package/bundle/{chunk-egn55fa2.js → chunk-mcc5ynma.js} +3 -3
  177. package/bundle/{chunk-md8161zd.js → chunk-mdzzcrf9.js} +2 -2
  178. package/bundle/{chunk-knpyt206.js → chunk-mqtqcc10.js} +2 -2
  179. package/bundle/{chunk-ynwkr3yh.js → chunk-mvnxwwe7.js} +2 -2
  180. package/bundle/{chunk-xkv3yta0.js → chunk-mvsrzvc4.js} +4 -4
  181. package/bundle/{chunk-b4knxpqh.js → chunk-mw2hr4pd.js} +1 -1
  182. package/bundle/{chunk-vszbqv24.js → chunk-mzbr0m2v.js} +1 -1
  183. package/bundle/{chunk-bj00xk8k.js → chunk-n0trgp1c.js} +2 -2
  184. package/bundle/chunk-n14qktbg.js +2 -0
  185. package/bundle/{chunk-yjk6zv2z.js → chunk-n2ygpy76.js} +1 -1
  186. package/bundle/{chunk-4ntbxet5.js → chunk-n7xgfm5x.js} +2 -2
  187. package/bundle/{chunk-06k6egt2.js → chunk-neqy8j4n.js} +1 -1
  188. package/bundle/{chunk-nj61v4n7.js → chunk-njkserae.js} +1 -1
  189. package/bundle/{chunk-n6gtdx5h.js → chunk-nq495be3.js} +1 -1
  190. package/bundle/chunk-nr4q9fv7.js +2 -0
  191. package/bundle/{chunk-p3qkexpk.js → chunk-nsjp44fp.js} +1 -1
  192. package/bundle/chunk-nzzsj54n.js +2 -0
  193. package/bundle/chunk-p19qfw59.js +2 -0
  194. package/bundle/chunk-p2yxj9s4.js +2 -0
  195. package/bundle/{chunk-1dtzxt2w.js → chunk-p3rp99na.js} +1 -1
  196. package/bundle/chunk-p8czsxp0.js +3 -0
  197. package/bundle/chunk-p8k48st6.js +5 -0
  198. package/bundle/{chunk-79agp7v3.js → chunk-p8kpqyxb.js} +2 -2
  199. package/bundle/{chunk-9fxkh84w.js → chunk-p9zrk16q.js} +1 -1
  200. package/bundle/{chunk-xhkd9yf3.js → chunk-pmv8yr8c.js} +2 -2
  201. package/bundle/{chunk-ee23d2nz.js → chunk-pnq1h5az.js} +2 -2
  202. package/bundle/chunk-pq3qwxa8.js +2 -0
  203. package/bundle/{chunk-wfd5h6ax.js → chunk-pqnbdygz.js} +2 -2
  204. package/bundle/chunk-ps9p14y6.js +2 -0
  205. package/bundle/{chunk-zfcp509b.js → chunk-pxx2hz0g.js} +2 -2
  206. package/bundle/{chunk-zpf31kxb.js → chunk-q7rt76qw.js} +1 -1
  207. package/bundle/{chunk-rq4w0by4.js → chunk-q81m4m9z.js} +1 -1
  208. package/bundle/chunk-qagc6v17.js +2 -0
  209. package/bundle/{chunk-mq6jn47r.js → chunk-qb35hqm4.js} +1 -1
  210. package/bundle/chunk-qc0zhbhm.js +2 -0
  211. package/bundle/{chunk-keveg5gx.js → chunk-qdcf1ay5.js} +2 -2
  212. package/bundle/chunk-qp9y0g73.js +3 -0
  213. package/bundle/chunk-qpd0gab8.js +2 -0
  214. package/bundle/{chunk-6b196wjz.js → chunk-qqne79vp.js} +2 -2
  215. package/bundle/{chunk-g4gjz7sq.js → chunk-qs4wef8c.js} +1 -1
  216. package/bundle/chunk-r0ewmh6f.js +2 -0
  217. package/bundle/chunk-r3df289z.js +2 -0
  218. package/bundle/{chunk-by855es0.js → chunk-r58gzg6m.js} +1 -1
  219. package/bundle/{chunk-fmq0m4k5.js → chunk-r6ndvzd0.js} +1 -1
  220. package/bundle/chunk-r78kfhvz.js +2 -0
  221. package/bundle/{chunk-dyv2hqvc.js → chunk-rcyhqkv5.js} +1 -1
  222. package/bundle/{chunk-h2m8fdqm.js → chunk-rd4x4tsv.js} +1 -1
  223. package/bundle/chunk-rebsz3bj.js +2 -0
  224. package/bundle/{chunk-yp5bypsp.js → chunk-rexdr63q.js} +2 -2
  225. package/bundle/{chunk-1me21qdc.js → chunk-rgxy4ngt.js} +1 -1
  226. package/bundle/chunk-rph5xswc.js +2 -0
  227. package/bundle/{chunk-dcndy4sr.js → chunk-rph9zj24.js} +1 -1
  228. package/bundle/chunk-rqmvj7f4.js +3 -0
  229. package/bundle/{chunk-ryfqwsft.js → chunk-rrd0jf5m.js} +1 -1
  230. package/bundle/{chunk-mpygdb5a.js → chunk-s8mghr5a.js} +2 -2
  231. package/bundle/chunk-schtpyjs.js +2 -0
  232. package/bundle/{chunk-nmehsm3w.js → chunk-shwjjrj8.js} +1 -1
  233. package/bundle/{chunk-08f4khsw.js → chunk-snt1kefv.js} +3 -3
  234. package/bundle/{chunk-s8hq6trz.js → chunk-srxx88nb.js} +1 -1
  235. package/bundle/{chunk-gy0wm7e1.js → chunk-std2bgv7.js} +2 -2
  236. package/bundle/{chunk-dffhkd30.js → chunk-swcgsrbj.js} +1 -1
  237. package/bundle/chunk-sy3n0qhc.js +800 -0
  238. package/bundle/{chunk-wgk7ynt3.js → chunk-t01bhw5h.js} +3 -3
  239. package/bundle/chunk-t0jjes17.js +2 -0
  240. package/bundle/{chunk-y370dqf3.js → chunk-t5tfppwv.js} +2 -2
  241. package/bundle/chunk-t8rke5fr.js +8 -0
  242. package/bundle/chunk-tabcpx7t.js +4 -0
  243. package/bundle/{chunk-gmzrvxnv.js → chunk-tdmn21z0.js} +2 -2
  244. package/bundle/{chunk-71zw0qhf.js → chunk-tdxbm1nd.js} +1 -1
  245. package/bundle/{chunk-p825vsjy.js → chunk-te5tfq79.js} +1 -1
  246. package/bundle/chunk-tf4xwqz7.js +2 -0
  247. package/bundle/{chunk-fg35hwa0.js → chunk-tgd5ctnt.js} +2 -2
  248. package/bundle/chunk-tqazneg6.js +2 -0
  249. package/bundle/{chunk-qa2j0qmy.js → chunk-txqc7543.js} +2 -2
  250. package/bundle/chunk-tzg4z74d.js +2 -0
  251. package/bundle/{chunk-a3a1trap.js → chunk-v3x5nrc4.js} +2 -2
  252. package/bundle/chunk-v8dd6tyn.js +2 -0
  253. package/bundle/chunk-v8ksjgc3.js +2 -0
  254. package/bundle/chunk-v8vcwx23.js +2 -0
  255. package/bundle/chunk-vc4e6xc4.js +10 -0
  256. package/bundle/chunk-vcrakhgy.js +3 -0
  257. package/bundle/{chunk-za63b5mc.js → chunk-vdpd4akk.js} +2 -2
  258. package/bundle/{chunk-6p7yg5sr.js → chunk-vftqwdpg.js} +1 -1
  259. package/bundle/chunk-vg41rtdy.js +2 -0
  260. package/bundle/{chunk-r0k21apr.js → chunk-vgaxv70x.js} +2 -2
  261. package/bundle/{chunk-nkk4fyqf.js → chunk-vgnddhdj.js} +1 -1
  262. package/bundle/{chunk-xd3xc1vv.js → chunk-vm58fkrv.js} +1 -1
  263. package/bundle/{chunk-qg2vk5fw.js → chunk-vsys768k.js} +1 -1
  264. package/bundle/{chunk-s4qtphwx.js → chunk-w03fdrxe.js} +1 -1
  265. package/bundle/chunk-w1ypf53m.js +3 -0
  266. package/bundle/chunk-w24660y4.js +3 -0
  267. package/bundle/{chunk-z1ay3qd0.js → chunk-w3bmf3zz.js} +1 -1
  268. package/bundle/{chunk-28cm7m3t.js → chunk-w57j3pgz.js} +82 -82
  269. package/bundle/{chunk-vsr8mnj6.js → chunk-w5940jxm.js} +1 -1
  270. package/bundle/chunk-w6rf2knb.js +2 -0
  271. package/bundle/chunk-w9pdvcf9.js +3 -0
  272. package/bundle/{chunk-yk97q51d.js → chunk-wev34grp.js} +2 -2
  273. package/bundle/chunk-wh7r96t3.js +2 -0
  274. package/bundle/{chunk-1pg6pv0m.js → chunk-wm77svwm.js} +1 -1
  275. package/bundle/chunk-wnjqaxze.js +2 -0
  276. package/bundle/{chunk-qkjdr337.js → chunk-x6rr6ss1.js} +1 -1
  277. package/bundle/{chunk-bbzztav6.js → chunk-xdacgfba.js} +1 -1
  278. package/bundle/{chunk-6p94fpbn.js → chunk-xdjwapwy.js} +2 -2
  279. package/bundle/chunk-xfz698bh.js +2 -0
  280. package/bundle/{chunk-zwnhf4z1.js → chunk-xhbb8b5g.js} +1 -1
  281. package/bundle/chunk-xqwvx3qq.js +2 -0
  282. package/bundle/chunk-xxj3sgd5.js +2 -0
  283. package/bundle/chunk-xyjehgzm.js +3 -0
  284. package/bundle/{chunk-cs38g1bx.js → chunk-y0ydzdfc.js} +1 -1
  285. package/bundle/{chunk-wvf5q2hz.js → chunk-y1b2h15z.js} +1 -1
  286. package/bundle/{chunk-1gf116rg.js → chunk-yacccwf6.js} +1 -1
  287. package/bundle/chunk-ydc6ypjt.js +77 -0
  288. package/bundle/{chunk-dhqaqeq6.js → chunk-yeq7b87a.js} +1 -1
  289. package/bundle/chunk-yfp9y71y.js +2 -0
  290. package/bundle/chunk-yg9c1v8v.js +2 -0
  291. package/bundle/{chunk-e6xnynaz.js → chunk-yha554nm.js} +2 -2
  292. package/bundle/{chunk-rv1stdvb.js → chunk-yj6rbe9p.js} +2 -2
  293. package/bundle/chunk-yjjh339w.js +2 -0
  294. package/bundle/{chunk-j8q252w3.js → chunk-yjp0btmq.js} +3 -3
  295. package/bundle/{chunk-c5pb87yf.js → chunk-ymtcm4xd.js} +1 -1
  296. package/bundle/chunk-yt6vd7a5.js +2 -0
  297. package/bundle/{chunk-ssk8tkwd.js → chunk-yw9pfqxt.js} +1 -1
  298. package/bundle/{chunk-g6cyhxwg.js → chunk-yykjvt7f.js} +2 -2
  299. package/bundle/{chunk-sfes6pp1.js → chunk-yzh4rmrt.js} +1 -1
  300. package/bundle/chunk-yzq3c3dq.js +2 -0
  301. package/bundle/{chunk-prh3c44x.js → chunk-yzwgvjzd.js} +1 -1
  302. package/bundle/chunk-z1j25911.js +2 -0
  303. package/bundle/{chunk-rkwrjphh.js → chunk-z1rshv6g.js} +1 -1
  304. package/bundle/chunk-z29ahthm.js +2 -0
  305. package/bundle/{chunk-jgjnz82k.js → chunk-zaan8jk6.js} +1 -1
  306. package/bundle/{chunk-6gb65bv1.js → chunk-zbqzm65q.js} +1 -1
  307. package/bundle/{chunk-bk4phk66.js → chunk-zesbm9k1.js} +1 -1
  308. package/bundle/{chunk-c6vfwjg4.js → chunk-zfcfyagt.js} +1 -1
  309. package/bundle/{chunk-ywkvq7zb.js → chunk-zfnbk5gy.js} +1 -1
  310. package/bundle/chunk-zgre4gc2.js +2 -0
  311. package/bundle/{chunk-z7430qxg.js → chunk-zrmx397j.js} +1 -1
  312. package/bundle/chunk-zthkjx33.js +2 -0
  313. package/bundle/chunk-zxddasg8.js +2 -0
  314. package/bundle/index.js +3 -3
  315. package/bundle/parser.worker.js +2 -2
  316. package/bundle/worker.js +1 -1
  317. package/package.json +1 -1
  318. package/bundle/chunk-0x5jn813.js +0 -2
  319. package/bundle/chunk-1hmq2fpt.js +0 -14
  320. package/bundle/chunk-28t9akfn.js +0 -2
  321. package/bundle/chunk-2h1fcqvf.js +0 -2
  322. package/bundle/chunk-2scyp9ns.js +0 -2
  323. package/bundle/chunk-2tw58kwb.js +0 -2
  324. package/bundle/chunk-2vxx0tax.js +0 -2
  325. package/bundle/chunk-2ybt3p5z.js +0 -2
  326. package/bundle/chunk-2zpkw3ge.js +0 -2
  327. package/bundle/chunk-397be2x0.js +0 -2
  328. package/bundle/chunk-3c78nkgn.js +0 -2
  329. package/bundle/chunk-3vnnxq40.js +0 -2
  330. package/bundle/chunk-425mq6k8.js +0 -2
  331. package/bundle/chunk-43yv7tz1.js +0 -2
  332. package/bundle/chunk-499gp5g5.js +0 -2
  333. package/bundle/chunk-4sw6frjt.js +0 -2
  334. package/bundle/chunk-4xw14sed.js +0 -2
  335. package/bundle/chunk-536naqqv.js +0 -2
  336. package/bundle/chunk-57najm15.js +0 -2
  337. package/bundle/chunk-5he3d7cy.js +0 -2
  338. package/bundle/chunk-5vzrn6za.js +0 -3
  339. package/bundle/chunk-696z96a6.js +0 -2
  340. package/bundle/chunk-6hybp2mt.js +0 -2
  341. package/bundle/chunk-6v9nbb4c.js +0 -3
  342. package/bundle/chunk-6y423jax.js +0 -3
  343. package/bundle/chunk-72ghkgcn.js +0 -2
  344. package/bundle/chunk-741teh8k.js +0 -2
  345. package/bundle/chunk-7b3wx6kn.js +0 -2
  346. package/bundle/chunk-7bwe0ayr.js +0 -3
  347. package/bundle/chunk-7hh0654f.js +0 -3
  348. package/bundle/chunk-891yevv2.js +0 -2
  349. package/bundle/chunk-8d5k45yj.js +0 -2
  350. package/bundle/chunk-8eje5baf.js +0 -8
  351. package/bundle/chunk-8ktgy41r.js +0 -2
  352. package/bundle/chunk-8q73cjyj.js +0 -2
  353. package/bundle/chunk-8y623qdx.js +0 -2
  354. package/bundle/chunk-921vn745.js +0 -2
  355. package/bundle/chunk-9y97bzht.js +0 -8
  356. package/bundle/chunk-a0rp7gh4.js +0 -77
  357. package/bundle/chunk-a48t0g95.js +0 -3
  358. package/bundle/chunk-a8119c3a.js +0 -2
  359. package/bundle/chunk-akk84fnc.js +0 -2
  360. package/bundle/chunk-aw7j7brm.js +0 -2
  361. package/bundle/chunk-b34t8v7x.js +0 -2
  362. package/bundle/chunk-b8hmj4jq.js +0 -2
  363. package/bundle/chunk-bja8q0ke.js +0 -3
  364. package/bundle/chunk-c5fa8cb1.js +0 -2
  365. package/bundle/chunk-cfw9pyt7.js +0 -2
  366. package/bundle/chunk-ckbwdrm3.js +0 -2
  367. package/bundle/chunk-cz3h5n1v.js +0 -3
  368. package/bundle/chunk-d80hk5x9.js +0 -3
  369. package/bundle/chunk-d8dk05kd.js +0 -2
  370. package/bundle/chunk-dwajajaq.js +0 -2
  371. package/bundle/chunk-dxcrggvq.js +0 -2
  372. package/bundle/chunk-e7ah0e61.js +0 -2
  373. package/bundle/chunk-e7v9trve.js +0 -11
  374. package/bundle/chunk-efndtzby.js +0 -2
  375. package/bundle/chunk-eq2pepce.js +0 -2
  376. package/bundle/chunk-esp6jv63.js +0 -7
  377. package/bundle/chunk-f693s9vn.js +0 -2
  378. package/bundle/chunk-f9v5n0t6.js +0 -2
  379. package/bundle/chunk-fdadk5tw.js +0 -2
  380. package/bundle/chunk-ftepqwyq.js +0 -2
  381. package/bundle/chunk-g4nq9swr.js +0 -3
  382. package/bundle/chunk-gdb67zmn.js +0 -14
  383. package/bundle/chunk-gk28ffhg.js +0 -2
  384. package/bundle/chunk-gpfc4z4v.js +0 -2
  385. package/bundle/chunk-gqvg02zp.js +0 -2
  386. package/bundle/chunk-h3k1dk9m.js +0 -2
  387. package/bundle/chunk-h8c3dcqt.js +0 -2
  388. package/bundle/chunk-hfq11w4h.js +0 -2
  389. package/bundle/chunk-hg0etbkx.js +0 -3
  390. package/bundle/chunk-hw5qyht3.js +0 -3
  391. package/bundle/chunk-hwf58w1k.js +0 -2
  392. package/bundle/chunk-j0jdkqf5.js +0 -5
  393. package/bundle/chunk-jm722vy1.js +0 -4
  394. package/bundle/chunk-kdvs4871.js +0 -2
  395. package/bundle/chunk-kk3ve911.js +0 -2
  396. package/bundle/chunk-kv72hxkp.js +0 -3
  397. package/bundle/chunk-m4j7jyrd.js +0 -3
  398. package/bundle/chunk-mdts0641.js +0 -2
  399. package/bundle/chunk-mf3sm0pk.js +0 -2
  400. package/bundle/chunk-mkng9ykt.js +0 -2
  401. package/bundle/chunk-npv80mcx.js +0 -2
  402. package/bundle/chunk-ny9hnvzy.js +0 -2
  403. package/bundle/chunk-p15sv2dg.js +0 -3
  404. package/bundle/chunk-pe98rznj.js +0 -2
  405. package/bundle/chunk-q1czj6be.js +0 -2
  406. package/bundle/chunk-q6wm9yt0.js +0 -2
  407. package/bundle/chunk-qbx70v64.js +0 -2
  408. package/bundle/chunk-qc3ce3vc.js +0 -3
  409. package/bundle/chunk-qek6a75r.js +0 -2
  410. package/bundle/chunk-qkk1as5n.js +0 -2
  411. package/bundle/chunk-qsm9xw87.js +0 -2
  412. package/bundle/chunk-qyzze0dv.js +0 -2
  413. package/bundle/chunk-r2w3gr8d.js +0 -2
  414. package/bundle/chunk-r5bqcpkz.js +0 -2
  415. package/bundle/chunk-r67c858b.js +0 -2
  416. package/bundle/chunk-r9fvfkee.js +0 -2
  417. package/bundle/chunk-rq47pn3r.js +0 -2
  418. package/bundle/chunk-rvt1tdy8.js +0 -2
  419. package/bundle/chunk-ry7q8xn6.js +0 -2
  420. package/bundle/chunk-s27xvrft.js +0 -2
  421. package/bundle/chunk-s2vasbwj.js +0 -2
  422. package/bundle/chunk-scy39p6q.js +0 -2
  423. package/bundle/chunk-shenqgrx.js +0 -2
  424. package/bundle/chunk-sz0gkx88.js +0 -5
  425. package/bundle/chunk-t5qamf96.js +0 -2
  426. package/bundle/chunk-t9mz17gb.js +0 -3
  427. package/bundle/chunk-tt8jke90.js +0 -2
  428. package/bundle/chunk-ttevj0pj.js +0 -2
  429. package/bundle/chunk-v6tgn668.js +0 -2
  430. package/bundle/chunk-v7c54cyj.js +0 -2
  431. package/bundle/chunk-vgefaens.js +0 -2
  432. package/bundle/chunk-vkq0faj8.js +0 -2
  433. package/bundle/chunk-vkqzmzpw.js +0 -2
  434. package/bundle/chunk-vv59b4re.js +0 -2
  435. package/bundle/chunk-vwqy7n3g.js +0 -2
  436. package/bundle/chunk-w5kg2yz0.js +0 -3
  437. package/bundle/chunk-wbzs30fk.js +0 -28
  438. package/bundle/chunk-wet3bnwn.js +0 -2
  439. package/bundle/chunk-wfegee41.js +0 -2
  440. package/bundle/chunk-wmaz57f6.js +0 -800
  441. package/bundle/chunk-wn076jwj.js +0 -2
  442. package/bundle/chunk-x0m1qye9.js +0 -2
  443. package/bundle/chunk-x9s90xd1.js +0 -3
  444. package/bundle/chunk-xy5cjach.js +0 -2
  445. package/bundle/chunk-y70aachh.js +0 -2
  446. package/bundle/chunk-ya8g02hv.js +0 -9
  447. package/bundle/chunk-yqk58hf6.js +0 -3
  448. package/bundle/chunk-ysgxt83y.js +0 -2
  449. package/bundle/chunk-zm5dfk2b.js +0 -3
  450. package/bundle/chunk-zph1c2q1.js +0 -3
  451. package/bundle/chunk-zwdnh860.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{$q as R,Cq as NG,Eq as _,Jq as DG,Zq as t,ar as b,br as xG,hr as f,ir as s,jr as O,nr as IG,oq as y,tq as l,vq as p,xq as qG}from"./chunk-z8gdmvgg.js";import{Ar as PG,Cr as T,ur as AG,vr as r}from"./chunk-kwx9ewe0.js";import{pv as Q}from"./chunk-gmzrvxnv.js";function h(G){return G.replace(/[_-]([a-z])/g,(Y)=>Y[1].toUpperCase())}function MG(G,Y){let Z=h(G);if(Z!==G&&(Y==null?void 0:Y[Z])!=null)return Z;return G}var SG=Q.object({error:Q.object({message:Q.string(),type:Q.string().nullish(),param:Q.any().nullish(),code:Q.union([Q.string(),Q.number()]).nullish()})}),m={errorSchema:SG,errorToMessage:(G)=>G.error.message};function jG(G){var Y,Z,U,z,V,j;if(G==null)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};let B=(Y=G.prompt_tokens)!=null?Y:0,H=(Z=G.completion_tokens)!=null?Z:0,X=(z=(U=G.prompt_tokens_details)==null?void 0:U.cached_tokens)!=null?z:0,L=(j=(V=G.completion_tokens_details)==null?void 0:V.reasoning_tokens)!=null?j:0;return{inputTokens:{total:B,noCache:B-X,cacheRead:X,cacheWrite:void 0},outputTokens:{total:H,text:H-L,reasoning:L},raw:G}}function u(G){var Y,Z;return(Z=(Y=G==null?void 0:G.providerOptions)==null?void 0:Y.openaiCompatible)!=null?Z:{}}function RG(G){switch(G){case"audio/wav":return"wav";case"audio/mp3":case"audio/mpeg":return"mp3";default:return null}}function yG(G){var Y,Z,U;let z=[];for(let{role:V,content:j,...B}of G){let H=u({...B});switch(V){case"system":{z.push({role:"system",content:j,...H});break}case"user":{if(j.length===1&&j[0].type==="text"){z.push({role:"user",content:j[0].text,...u(j[0])});break}z.push({role:"user",content:j.map((X)=>{var L;let $=u(X);switch(X.type){case"text":return{type:"text",text:X.text,...$};case"file":{if(X.mediaType.startsWith("image/")){let J=X.mediaType==="image/*"?"image/jpeg":X.mediaType;return{type:"image_url",image_url:{url:X.data instanceof URL?X.data.toString():`data:${J};base64,${p(X.data)}`},...$}}if(X.mediaType.startsWith("audio/")){if(X.data instanceof URL)throw new T({functionality:"audio file parts with URLs"});let J=RG(X.mediaType);if(J===null)throw new T({functionality:`audio media type ${X.mediaType}`});return{type:"input_audio",input_audio:{data:p(X.data),format:J},...$}}if(X.mediaType==="application/pdf"){if(X.data instanceof URL)throw new T({functionality:"PDF file parts with URLs"});return{type:"file",file:{filename:(L=X.filename)!=null?L:"document.pdf",file_data:`data:application/pdf;base64,${p(X.data)}`},...$}}if(X.mediaType.startsWith("text/"))return{type:"text",text:X.data instanceof URL?X.data.toString():typeof X.data==="string"?new TextDecoder().decode(l(X.data)):new TextDecoder().decode(X.data),...$};throw new T({functionality:`file part media type ${X.mediaType}`})}}}),...H});break}case"assistant":{let X="",L="",$=[];for(let J of j){let E=u(J);switch(J.type){case"text":{X+=J.text;break}case"reasoning":{L+=J.text;break}case"tool-call":{let A=(Z=(Y=J.providerOptions)==null?void 0:Y.google)==null?void 0:Z.thoughtSignature;$.push({id:J.toolCallId,type:"function",function:{name:J.toolName,arguments:JSON.stringify(J.input)},...E,...A?{extra_content:{google:{thought_signature:String(A)}}}:{}});break}}}z.push({role:"assistant",content:X,...L.length>0?{reasoning_content:L}:{},tool_calls:$.length>0?$:void 0,...H});break}case"tool":{for(let X of j){if(X.type==="tool-approval-response")continue;let L=X.output,$;switch(L.type){case"text":case"error-text":$=L.value;break;case"execution-denied":$=(U=L.reason)!=null?U:"Tool execution denied.";break;case"content":case"json":case"error-json":$=JSON.stringify(L.value);break}let J=u(X);z.push({role:"tool",tool_call_id:X.toolCallId,content:$,...J})}break}default:throw Error(`Unsupported role: ${V}`)}}return z}function LG({id:G,model:Y,created:Z}){return{id:G!=null?G:void 0,modelId:Y!=null?Y:void 0,timestamp:Z!=null?new Date(Z*1000):void 0}}function zG(G){switch(G){case"stop":return"stop";case"length":return"length";case"content_filter":return"content-filter";case"function_call":case"tool_calls":return"tool-calls";default:return"other"}}var g=Q.object({user:Q.string().optional(),reasoningEffort:Q.string().optional(),textVerbosity:Q.string().optional(),strictJsonSchema:Q.boolean().optional()});function TG({tools:G,toolChoice:Y}){G=(G==null?void 0:G.length)?G:void 0;let Z=[];if(G==null)return{tools:void 0,toolChoice:void 0,toolWarnings:Z};let U=[];for(let V of G)if(V.type==="provider")Z.push({type:"unsupported",feature:`provider-defined tool ${V.id}`});else U.push({type:"function",function:{name:V.name,description:V.description,parameters:V.inputSchema,...V.strict!=null?{strict:V.strict}:{}}});if(Y==null)return{tools:U,toolChoice:void 0,toolWarnings:Z};let z=Y.type;switch(z){case"auto":case"none":case"required":return{tools:U,toolChoice:z,toolWarnings:Z};case"tool":return{tools:U,toolChoice:{type:"function",function:{name:Y.toolName}},toolWarnings:Z};default:throw new T({functionality:`tool choice type: ${z}`})}}var bG=class{constructor(G,Y){this.specificationVersion="v3";var Z,U;this.modelId=G,this.config=Y;let z=(Z=Y.errorStructure)!=null?Z:m;this.chunkSchema=OG(z.errorSchema),this.failedResponseHandler=f(z),this.supportsStructuredOutputs=(U=Y.supportsStructuredOutputs)!=null?U:!1}get provider(){return this.config.provider}get providerOptionsName(){return this.config.provider.split(".")[0].trim()}get supportedUrls(){var G,Y,Z;return(Z=(Y=(G=this.config).supportedUrls)==null?void 0:Y.call(G))!=null?Z:{}}transformRequestBody(G){var Y,Z,U;return(U=(Z=(Y=this.config).transformRequestBody)==null?void 0:Z.call(Y,G))!=null?U:G}async getArgs({prompt:G,maxOutputTokens:Y,temperature:Z,topP:U,topK:z,frequencyPenalty:V,presencePenalty:j,providerOptions:B,stopSequences:H,responseFormat:X,seed:L,toolChoice:$,tools:J}){var E,A,P,K,W;let N=[],x=await R({provider:"openai-compatible",providerOptions:B,schema:g});if(x!=null)N.push({type:"other",message:"The 'openai-compatible' key in providerOptions is deprecated. Use 'openaiCompatible' instead."});let D=Object.assign(x!=null?x:{},(E=await R({provider:"openaiCompatible",providerOptions:B,schema:g}))!=null?E:{},(A=await R({provider:this.providerOptionsName,providerOptions:B,schema:g}))!=null?A:{},(P=await R({provider:h(this.providerOptionsName),providerOptions:B,schema:g}))!=null?P:{}),w=(K=D==null?void 0:D.strictJsonSchema)!=null?K:!0;if(z!=null)N.push({type:"unsupported",feature:"topK"});if((X==null?void 0:X.type)==="json"&&X.schema!=null&&!this.supportsStructuredOutputs)N.push({type:"unsupported",feature:"responseFormat",details:"JSON response format schema is only supported with structuredOutputs"});let{tools:q,toolChoice:I,toolWarnings:k}=TG({tools:J,toolChoice:$});return{metadataKey:MG(this.providerOptionsName,B),args:{model:this.modelId,user:D.user,max_tokens:Y,temperature:Z,top_p:U,frequency_penalty:V,presence_penalty:j,response_format:(X==null?void 0:X.type)==="json"?this.supportsStructuredOutputs===!0&&X.schema!=null?{type:"json_schema",json_schema:{schema:X.schema,strict:w,name:(W=X.name)!=null?W:"response",description:X.description}}:{type:"json_object"}:void 0,stop:H,seed:L,...Object.fromEntries(Object.entries({...B==null?void 0:B[this.providerOptionsName],...B==null?void 0:B[h(this.providerOptionsName)]}).filter(([d])=>!Object.keys(g.shape).includes(d))),reasoning_effort:D.reasoningEffort,verbosity:D.textVerbosity,messages:yG(G),tools:q,tool_choice:I},warnings:[...N,...k]}}async doGenerate(G){var Y,Z,U,z,V,j,B,H;let{args:X,warnings:L,metadataKey:$}=await this.getArgs({...G}),J=this.transformRequestBody(X),E=JSON.stringify(J),{responseHeaders:A,value:P,rawValue:K}=await b({url:this.config.url({path:"/chat/completions",modelId:this.modelId}),headers:y(this.config.headers(),G.headers),body:J,failedResponseHandler:this.failedResponseHandler,successfulResponseHandler:O(kG),abortSignal:G.abortSignal,fetch:this.config.fetch}),W=P.choices[0],N=[],x=W.message.content;if(x!=null&&x.length>0)N.push({type:"text",text:x});let D=(Y=W.message.reasoning_content)!=null?Y:W.message.reasoning;if(D!=null&&D.length>0)N.push({type:"reasoning",text:D});if(W.message.tool_calls!=null)for(let I of W.message.tool_calls){let k=(U=(Z=I.extra_content)==null?void 0:Z.google)==null?void 0:U.thought_signature;N.push({type:"tool-call",toolCallId:(z=I.id)!=null?z:_(),toolName:I.function.name,input:I.function.arguments,...k?{providerMetadata:{[$]:{thoughtSignature:k}}}:{}})}let w={[$]:{},...await((j=(V=this.config.metadataExtractor)==null?void 0:V.extractMetadata)==null?void 0:j.call(V,{parsedBody:K}))},q=(B=P.usage)==null?void 0:B.completion_tokens_details;if((q==null?void 0:q.accepted_prediction_tokens)!=null)w[$].acceptedPredictionTokens=q==null?void 0:q.accepted_prediction_tokens;if((q==null?void 0:q.rejected_prediction_tokens)!=null)w[$].rejectedPredictionTokens=q==null?void 0:q.rejected_prediction_tokens;return{content:N,finishReason:{unified:zG(W.finish_reason),raw:(H=W.finish_reason)!=null?H:void 0},usage:jG(P.usage),providerMetadata:w,request:{body:E},response:{...LG(P),headers:A,body:K},warnings:L}}async doStream(G){var Y;let{args:Z,warnings:U,metadataKey:z}=await this.getArgs({...G}),V=this.transformRequestBody({...Z,stream:!0,stream_options:this.config.includeUsage?{include_usage:!0}:void 0}),j=(Y=this.config.metadataExtractor)==null?void 0:Y.createStreamExtractor(),{responseHeaders:B,value:H}=await b({url:this.config.url({path:"/chat/completions",modelId:this.modelId}),headers:y(this.config.headers(),G.headers),body:V,failedResponseHandler:this.failedResponseHandler,successfulResponseHandler:s(this.chunkSchema),abortSignal:G.abortSignal,fetch:this.config.fetch}),X=[],L={unified:"other",raw:void 0},$=void 0,J=!0,E=z,A=!1,P=!1;return{stream:H.pipeThrough(new TransformStream({start(K){K.enqueue({type:"stream-start",warnings:U})},transform(K,W){var N,x,D,w,q,I,k,n,d,e,o,GG,QG,XG,YG,ZG,$G,JG;if(G.includeRawChunks)W.enqueue({type:"raw",rawValue:K.rawValue});if(!K.success){L={unified:"error",raw:void 0},W.enqueue({type:"error",error:K.error});return}if(j==null||j.processChunk(K.rawValue),"error"in K.value){L={unified:"error",raw:void 0},W.enqueue({type:"error",error:K.value.error.message});return}let c=K.value;if(J)J=!1,W.enqueue({type:"response-metadata",...LG(c)});if(c.usage!=null)$=c.usage;let v=c.choices[0];if((v==null?void 0:v.finish_reason)!=null)L={unified:zG(v.finish_reason),raw:(N=v.finish_reason)!=null?N:void 0};if((v==null?void 0:v.delta)==null)return;let C=v.delta,UG=(x=C.reasoning_content)!=null?x:C.reasoning;if(UG){if(!A)W.enqueue({type:"reasoning-start",id:"reasoning-0"}),A=!0;W.enqueue({type:"reasoning-delta",id:"reasoning-0",delta:UG})}if(C.content){if(A)W.enqueue({type:"reasoning-end",id:"reasoning-0"}),A=!1;if(!P)W.enqueue({type:"text-start",id:"txt-0"}),P=!0;W.enqueue({type:"text-delta",id:"txt-0",delta:C.content})}if(C.tool_calls!=null){if(A)W.enqueue({type:"reasoning-end",id:"reasoning-0"}),A=!1;for(let F of C.tool_calls){let i=(D=F.index)!=null?D:X.length;if(X[i]==null){if(F.id==null)throw new r({data:F,message:"Expected 'id' to be a string."});if(((w=F.function)==null?void 0:w.name)==null)throw new r({data:F,message:"Expected 'function.name' to be a string."});W.enqueue({type:"tool-input-start",id:F.id,toolName:F.function.name}),X[i]={id:F.id,type:"function",function:{name:F.function.name,arguments:(q=F.function.arguments)!=null?q:""},hasFinished:!1,thoughtSignature:(n=(k=(I=F.extra_content)==null?void 0:I.google)==null?void 0:k.thought_signature)!=null?n:void 0};let S=X[i];if(((d=S.function)==null?void 0:d.name)!=null&&((e=S.function)==null?void 0:e.arguments)!=null){if(S.function.arguments.length>0)W.enqueue({type:"tool-input-delta",id:S.id,delta:S.function.arguments});if(t(S.function.arguments))W.enqueue({type:"tool-input-end",id:S.id}),W.enqueue({type:"tool-call",toolCallId:(o=S.id)!=null?o:_(),toolName:S.function.name,input:S.function.arguments,...S.thoughtSignature?{providerMetadata:{[E]:{thoughtSignature:S.thoughtSignature}}}:{}}),S.hasFinished=!0}continue}let M=X[i];if(M.hasFinished)continue;if(((GG=F.function)==null?void 0:GG.arguments)!=null)M.function.arguments+=(XG=(QG=F.function)==null?void 0:QG.arguments)!=null?XG:"";if(W.enqueue({type:"tool-input-delta",id:M.id,delta:(YG=F.function.arguments)!=null?YG:""}),((ZG=M.function)==null?void 0:ZG.name)!=null&&(($G=M.function)==null?void 0:$G.arguments)!=null&&t(M.function.arguments))W.enqueue({type:"tool-input-end",id:M.id}),W.enqueue({type:"tool-call",toolCallId:(JG=M.id)!=null?JG:_(),toolName:M.function.name,input:M.function.arguments,...M.thoughtSignature?{providerMetadata:{[E]:{thoughtSignature:M.thoughtSignature}}}:{}}),M.hasFinished=!0}}},flush(K){var W,N,x,D,w;if(A)K.enqueue({type:"reasoning-end",id:"reasoning-0"});if(P)K.enqueue({type:"text-end",id:"txt-0"});for(let I of X.filter((k)=>!k.hasFinished))K.enqueue({type:"tool-input-end",id:I.id}),K.enqueue({type:"tool-call",toolCallId:(W=I.id)!=null?W:_(),toolName:I.function.name,input:I.function.arguments,...I.thoughtSignature?{providerMetadata:{[E]:{thoughtSignature:I.thoughtSignature}}}:{}});let q={[E]:{},...j==null?void 0:j.buildMetadata()};if(((N=$==null?void 0:$.completion_tokens_details)==null?void 0:N.accepted_prediction_tokens)!=null)q[E].acceptedPredictionTokens=(x=$==null?void 0:$.completion_tokens_details)==null?void 0:x.accepted_prediction_tokens;if(((D=$==null?void 0:$.completion_tokens_details)==null?void 0:D.rejected_prediction_tokens)!=null)q[E].rejectedPredictionTokens=(w=$==null?void 0:$.completion_tokens_details)==null?void 0:w.rejected_prediction_tokens;K.enqueue({type:"finish",finishReason:L,usage:jG($),providerMetadata:q})}})),request:{body:V},response:{headers:B}}}},FG=Q.looseObject({prompt_tokens:Q.number().nullish(),completion_tokens:Q.number().nullish(),total_tokens:Q.number().nullish(),prompt_tokens_details:Q.object({cached_tokens:Q.number().nullish()}).nullish(),completion_tokens_details:Q.object({reasoning_tokens:Q.number().nullish(),accepted_prediction_tokens:Q.number().nullish(),rejected_prediction_tokens:Q.number().nullish()}).nullish()}).nullish(),kG=Q.looseObject({id:Q.string().nullish(),created:Q.number().nullish(),model:Q.string().nullish(),choices:Q.array(Q.object({message:Q.object({role:Q.literal("assistant").nullish(),content:Q.string().nullish(),reasoning_content:Q.string().nullish(),reasoning:Q.string().nullish(),tool_calls:Q.array(Q.object({id:Q.string().nullish(),function:Q.object({name:Q.string(),arguments:Q.string()}),extra_content:Q.object({google:Q.object({thought_signature:Q.string().nullish()}).nullish()}).nullish()})).nullish()}),finish_reason:Q.string().nullish()})),usage:FG}),fG=Q.looseObject({id:Q.string().nullish(),created:Q.number().nullish(),model:Q.string().nullish(),choices:Q.array(Q.object({delta:Q.object({role:Q.enum(["assistant"]).nullish(),content:Q.string().nullish(),reasoning_content:Q.string().nullish(),reasoning:Q.string().nullish(),tool_calls:Q.array(Q.object({index:Q.number().nullish(),id:Q.string().nullish(),function:Q.object({name:Q.string().nullish(),arguments:Q.string().nullish()}),extra_content:Q.object({google:Q.object({thought_signature:Q.string().nullish()}).nullish()}).nullish()})).nullish()}).nullish(),finish_reason:Q.string().nullish()})),usage:FG}),OG=(G)=>Q.union([fG,G]);function BG(G){var Y,Z;if(G==null)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};let U=(Y=G.prompt_tokens)!=null?Y:0,z=(Z=G.completion_tokens)!=null?Z:0;return{inputTokens:{total:U,noCache:U,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:z,text:z,reasoning:void 0},raw:G}}function vG({prompt:G,user:Y="user",assistant:Z="assistant"}){let U="";if(G[0].role==="system")U+=`${G[0].content}
2
+ import{Aq as p,Cq as qG,Hq as NG,Jq as _,Oq as DG,cr as t,er as R,fr as b,gr as xG,mr as f,nr as s,or as O,sr as IG,tq as y,yq as l}from"./chunk-gwfx7tx7.js";import{Ar as r,Fr as PG,Hr as T,zr as AG}from"./chunk-1wpjmwnh.js";import{xv as Q}from"./chunk-tdmn21z0.js";function h(G){return G.replace(/[_-]([a-z])/g,(Y)=>Y[1].toUpperCase())}function MG(G,Y){let Z=h(G);if(Z!==G&&(Y==null?void 0:Y[Z])!=null)return Z;return G}var SG=Q.object({error:Q.object({message:Q.string(),type:Q.string().nullish(),param:Q.any().nullish(),code:Q.union([Q.string(),Q.number()]).nullish()})}),m={errorSchema:SG,errorToMessage:(G)=>G.error.message};function jG(G){var Y,Z,U,z,V,j;if(G==null)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};let B=(Y=G.prompt_tokens)!=null?Y:0,H=(Z=G.completion_tokens)!=null?Z:0,X=(z=(U=G.prompt_tokens_details)==null?void 0:U.cached_tokens)!=null?z:0,L=(j=(V=G.completion_tokens_details)==null?void 0:V.reasoning_tokens)!=null?j:0;return{inputTokens:{total:B,noCache:B-X,cacheRead:X,cacheWrite:void 0},outputTokens:{total:H,text:H-L,reasoning:L},raw:G}}function u(G){var Y,Z;return(Z=(Y=G==null?void 0:G.providerOptions)==null?void 0:Y.openaiCompatible)!=null?Z:{}}function RG(G){switch(G){case"audio/wav":return"wav";case"audio/mp3":case"audio/mpeg":return"mp3";default:return null}}function yG(G){var Y,Z,U;let z=[];for(let{role:V,content:j,...B}of G){let H=u({...B});switch(V){case"system":{z.push({role:"system",content:j,...H});break}case"user":{if(j.length===1&&j[0].type==="text"){z.push({role:"user",content:j[0].text,...u(j[0])});break}z.push({role:"user",content:j.map((X)=>{var L;let $=u(X);switch(X.type){case"text":return{type:"text",text:X.text,...$};case"file":{if(X.mediaType.startsWith("image/")){let J=X.mediaType==="image/*"?"image/jpeg":X.mediaType;return{type:"image_url",image_url:{url:X.data instanceof URL?X.data.toString():`data:${J};base64,${p(X.data)}`},...$}}if(X.mediaType.startsWith("audio/")){if(X.data instanceof URL)throw new T({functionality:"audio file parts with URLs"});let J=RG(X.mediaType);if(J===null)throw new T({functionality:`audio media type ${X.mediaType}`});return{type:"input_audio",input_audio:{data:p(X.data),format:J},...$}}if(X.mediaType==="application/pdf"){if(X.data instanceof URL)throw new T({functionality:"PDF file parts with URLs"});return{type:"file",file:{filename:(L=X.filename)!=null?L:"document.pdf",file_data:`data:application/pdf;base64,${p(X.data)}`},...$}}if(X.mediaType.startsWith("text/"))return{type:"text",text:X.data instanceof URL?X.data.toString():typeof X.data==="string"?new TextDecoder().decode(l(X.data)):new TextDecoder().decode(X.data),...$};throw new T({functionality:`file part media type ${X.mediaType}`})}}}),...H});break}case"assistant":{let X="",L="",$=[];for(let J of j){let E=u(J);switch(J.type){case"text":{X+=J.text;break}case"reasoning":{L+=J.text;break}case"tool-call":{let A=(Z=(Y=J.providerOptions)==null?void 0:Y.google)==null?void 0:Z.thoughtSignature;$.push({id:J.toolCallId,type:"function",function:{name:J.toolName,arguments:JSON.stringify(J.input)},...E,...A?{extra_content:{google:{thought_signature:String(A)}}}:{}});break}}}z.push({role:"assistant",content:X,...L.length>0?{reasoning_content:L}:{},tool_calls:$.length>0?$:void 0,...H});break}case"tool":{for(let X of j){if(X.type==="tool-approval-response")continue;let L=X.output,$;switch(L.type){case"text":case"error-text":$=L.value;break;case"execution-denied":$=(U=L.reason)!=null?U:"Tool execution denied.";break;case"content":case"json":case"error-json":$=JSON.stringify(L.value);break}let J=u(X);z.push({role:"tool",tool_call_id:X.toolCallId,content:$,...J})}break}default:throw Error(`Unsupported role: ${V}`)}}return z}function LG({id:G,model:Y,created:Z}){return{id:G!=null?G:void 0,modelId:Y!=null?Y:void 0,timestamp:Z!=null?new Date(Z*1000):void 0}}function zG(G){switch(G){case"stop":return"stop";case"length":return"length";case"content_filter":return"content-filter";case"function_call":case"tool_calls":return"tool-calls";default:return"other"}}var g=Q.object({user:Q.string().optional(),reasoningEffort:Q.string().optional(),textVerbosity:Q.string().optional(),strictJsonSchema:Q.boolean().optional()});function TG({tools:G,toolChoice:Y}){G=(G==null?void 0:G.length)?G:void 0;let Z=[];if(G==null)return{tools:void 0,toolChoice:void 0,toolWarnings:Z};let U=[];for(let V of G)if(V.type==="provider")Z.push({type:"unsupported",feature:`provider-defined tool ${V.id}`});else U.push({type:"function",function:{name:V.name,description:V.description,parameters:V.inputSchema,...V.strict!=null?{strict:V.strict}:{}}});if(Y==null)return{tools:U,toolChoice:void 0,toolWarnings:Z};let z=Y.type;switch(z){case"auto":case"none":case"required":return{tools:U,toolChoice:z,toolWarnings:Z};case"tool":return{tools:U,toolChoice:{type:"function",function:{name:Y.toolName}},toolWarnings:Z};default:throw new T({functionality:`tool choice type: ${z}`})}}var bG=class{constructor(G,Y){this.specificationVersion="v3";var Z,U;this.modelId=G,this.config=Y;let z=(Z=Y.errorStructure)!=null?Z:m;this.chunkSchema=OG(z.errorSchema),this.failedResponseHandler=f(z),this.supportsStructuredOutputs=(U=Y.supportsStructuredOutputs)!=null?U:!1}get provider(){return this.config.provider}get providerOptionsName(){return this.config.provider.split(".")[0].trim()}get supportedUrls(){var G,Y,Z;return(Z=(Y=(G=this.config).supportedUrls)==null?void 0:Y.call(G))!=null?Z:{}}transformRequestBody(G){var Y,Z,U;return(U=(Z=(Y=this.config).transformRequestBody)==null?void 0:Z.call(Y,G))!=null?U:G}async getArgs({prompt:G,maxOutputTokens:Y,temperature:Z,topP:U,topK:z,frequencyPenalty:V,presencePenalty:j,providerOptions:B,stopSequences:H,responseFormat:X,seed:L,toolChoice:$,tools:J}){var E,A,P,K,W;let N=[],x=await R({provider:"openai-compatible",providerOptions:B,schema:g});if(x!=null)N.push({type:"other",message:"The 'openai-compatible' key in providerOptions is deprecated. Use 'openaiCompatible' instead."});let D=Object.assign(x!=null?x:{},(E=await R({provider:"openaiCompatible",providerOptions:B,schema:g}))!=null?E:{},(A=await R({provider:this.providerOptionsName,providerOptions:B,schema:g}))!=null?A:{},(P=await R({provider:h(this.providerOptionsName),providerOptions:B,schema:g}))!=null?P:{}),w=(K=D==null?void 0:D.strictJsonSchema)!=null?K:!0;if(z!=null)N.push({type:"unsupported",feature:"topK"});if((X==null?void 0:X.type)==="json"&&X.schema!=null&&!this.supportsStructuredOutputs)N.push({type:"unsupported",feature:"responseFormat",details:"JSON response format schema is only supported with structuredOutputs"});let{tools:q,toolChoice:I,toolWarnings:k}=TG({tools:J,toolChoice:$});return{metadataKey:MG(this.providerOptionsName,B),args:{model:this.modelId,user:D.user,max_tokens:Y,temperature:Z,top_p:U,frequency_penalty:V,presence_penalty:j,response_format:(X==null?void 0:X.type)==="json"?this.supportsStructuredOutputs===!0&&X.schema!=null?{type:"json_schema",json_schema:{schema:X.schema,strict:w,name:(W=X.name)!=null?W:"response",description:X.description}}:{type:"json_object"}:void 0,stop:H,seed:L,...Object.fromEntries(Object.entries({...B==null?void 0:B[this.providerOptionsName],...B==null?void 0:B[h(this.providerOptionsName)]}).filter(([d])=>!Object.keys(g.shape).includes(d))),reasoning_effort:D.reasoningEffort,verbosity:D.textVerbosity,messages:yG(G),tools:q,tool_choice:I},warnings:[...N,...k]}}async doGenerate(G){var Y,Z,U,z,V,j,B,H;let{args:X,warnings:L,metadataKey:$}=await this.getArgs({...G}),J=this.transformRequestBody(X),E=JSON.stringify(J),{responseHeaders:A,value:P,rawValue:K}=await b({url:this.config.url({path:"/chat/completions",modelId:this.modelId}),headers:y(this.config.headers(),G.headers),body:J,failedResponseHandler:this.failedResponseHandler,successfulResponseHandler:O(kG),abortSignal:G.abortSignal,fetch:this.config.fetch}),W=P.choices[0],N=[],x=W.message.content;if(x!=null&&x.length>0)N.push({type:"text",text:x});let D=(Y=W.message.reasoning_content)!=null?Y:W.message.reasoning;if(D!=null&&D.length>0)N.push({type:"reasoning",text:D});if(W.message.tool_calls!=null)for(let I of W.message.tool_calls){let k=(U=(Z=I.extra_content)==null?void 0:Z.google)==null?void 0:U.thought_signature;N.push({type:"tool-call",toolCallId:(z=I.id)!=null?z:_(),toolName:I.function.name,input:I.function.arguments,...k?{providerMetadata:{[$]:{thoughtSignature:k}}}:{}})}let w={[$]:{},...await((j=(V=this.config.metadataExtractor)==null?void 0:V.extractMetadata)==null?void 0:j.call(V,{parsedBody:K}))},q=(B=P.usage)==null?void 0:B.completion_tokens_details;if((q==null?void 0:q.accepted_prediction_tokens)!=null)w[$].acceptedPredictionTokens=q==null?void 0:q.accepted_prediction_tokens;if((q==null?void 0:q.rejected_prediction_tokens)!=null)w[$].rejectedPredictionTokens=q==null?void 0:q.rejected_prediction_tokens;return{content:N,finishReason:{unified:zG(W.finish_reason),raw:(H=W.finish_reason)!=null?H:void 0},usage:jG(P.usage),providerMetadata:w,request:{body:E},response:{...LG(P),headers:A,body:K},warnings:L}}async doStream(G){var Y;let{args:Z,warnings:U,metadataKey:z}=await this.getArgs({...G}),V=this.transformRequestBody({...Z,stream:!0,stream_options:this.config.includeUsage?{include_usage:!0}:void 0}),j=(Y=this.config.metadataExtractor)==null?void 0:Y.createStreamExtractor(),{responseHeaders:B,value:H}=await b({url:this.config.url({path:"/chat/completions",modelId:this.modelId}),headers:y(this.config.headers(),G.headers),body:V,failedResponseHandler:this.failedResponseHandler,successfulResponseHandler:s(this.chunkSchema),abortSignal:G.abortSignal,fetch:this.config.fetch}),X=[],L={unified:"other",raw:void 0},$=void 0,J=!0,E=z,A=!1,P=!1;return{stream:H.pipeThrough(new TransformStream({start(K){K.enqueue({type:"stream-start",warnings:U})},transform(K,W){var N,x,D,w,q,I,k,n,d,e,o,GG,QG,XG,YG,ZG,$G,JG;if(G.includeRawChunks)W.enqueue({type:"raw",rawValue:K.rawValue});if(!K.success){L={unified:"error",raw:void 0},W.enqueue({type:"error",error:K.error});return}if(j==null||j.processChunk(K.rawValue),"error"in K.value){L={unified:"error",raw:void 0},W.enqueue({type:"error",error:K.value.error.message});return}let c=K.value;if(J)J=!1,W.enqueue({type:"response-metadata",...LG(c)});if(c.usage!=null)$=c.usage;let v=c.choices[0];if((v==null?void 0:v.finish_reason)!=null)L={unified:zG(v.finish_reason),raw:(N=v.finish_reason)!=null?N:void 0};if((v==null?void 0:v.delta)==null)return;let C=v.delta,UG=(x=C.reasoning_content)!=null?x:C.reasoning;if(UG){if(!A)W.enqueue({type:"reasoning-start",id:"reasoning-0"}),A=!0;W.enqueue({type:"reasoning-delta",id:"reasoning-0",delta:UG})}if(C.content){if(A)W.enqueue({type:"reasoning-end",id:"reasoning-0"}),A=!1;if(!P)W.enqueue({type:"text-start",id:"txt-0"}),P=!0;W.enqueue({type:"text-delta",id:"txt-0",delta:C.content})}if(C.tool_calls!=null){if(A)W.enqueue({type:"reasoning-end",id:"reasoning-0"}),A=!1;for(let F of C.tool_calls){let i=(D=F.index)!=null?D:X.length;if(X[i]==null){if(F.id==null)throw new r({data:F,message:"Expected 'id' to be a string."});if(((w=F.function)==null?void 0:w.name)==null)throw new r({data:F,message:"Expected 'function.name' to be a string."});W.enqueue({type:"tool-input-start",id:F.id,toolName:F.function.name}),X[i]={id:F.id,type:"function",function:{name:F.function.name,arguments:(q=F.function.arguments)!=null?q:""},hasFinished:!1,thoughtSignature:(n=(k=(I=F.extra_content)==null?void 0:I.google)==null?void 0:k.thought_signature)!=null?n:void 0};let S=X[i];if(((d=S.function)==null?void 0:d.name)!=null&&((e=S.function)==null?void 0:e.arguments)!=null){if(S.function.arguments.length>0)W.enqueue({type:"tool-input-delta",id:S.id,delta:S.function.arguments});if(t(S.function.arguments))W.enqueue({type:"tool-input-end",id:S.id}),W.enqueue({type:"tool-call",toolCallId:(o=S.id)!=null?o:_(),toolName:S.function.name,input:S.function.arguments,...S.thoughtSignature?{providerMetadata:{[E]:{thoughtSignature:S.thoughtSignature}}}:{}}),S.hasFinished=!0}continue}let M=X[i];if(M.hasFinished)continue;if(((GG=F.function)==null?void 0:GG.arguments)!=null)M.function.arguments+=(XG=(QG=F.function)==null?void 0:QG.arguments)!=null?XG:"";if(W.enqueue({type:"tool-input-delta",id:M.id,delta:(YG=F.function.arguments)!=null?YG:""}),((ZG=M.function)==null?void 0:ZG.name)!=null&&(($G=M.function)==null?void 0:$G.arguments)!=null&&t(M.function.arguments))W.enqueue({type:"tool-input-end",id:M.id}),W.enqueue({type:"tool-call",toolCallId:(JG=M.id)!=null?JG:_(),toolName:M.function.name,input:M.function.arguments,...M.thoughtSignature?{providerMetadata:{[E]:{thoughtSignature:M.thoughtSignature}}}:{}}),M.hasFinished=!0}}},flush(K){var W,N,x,D,w;if(A)K.enqueue({type:"reasoning-end",id:"reasoning-0"});if(P)K.enqueue({type:"text-end",id:"txt-0"});for(let I of X.filter((k)=>!k.hasFinished))K.enqueue({type:"tool-input-end",id:I.id}),K.enqueue({type:"tool-call",toolCallId:(W=I.id)!=null?W:_(),toolName:I.function.name,input:I.function.arguments,...I.thoughtSignature?{providerMetadata:{[E]:{thoughtSignature:I.thoughtSignature}}}:{}});let q={[E]:{},...j==null?void 0:j.buildMetadata()};if(((N=$==null?void 0:$.completion_tokens_details)==null?void 0:N.accepted_prediction_tokens)!=null)q[E].acceptedPredictionTokens=(x=$==null?void 0:$.completion_tokens_details)==null?void 0:x.accepted_prediction_tokens;if(((D=$==null?void 0:$.completion_tokens_details)==null?void 0:D.rejected_prediction_tokens)!=null)q[E].rejectedPredictionTokens=(w=$==null?void 0:$.completion_tokens_details)==null?void 0:w.rejected_prediction_tokens;K.enqueue({type:"finish",finishReason:L,usage:jG($),providerMetadata:q})}})),request:{body:V},response:{headers:B}}}},FG=Q.looseObject({prompt_tokens:Q.number().nullish(),completion_tokens:Q.number().nullish(),total_tokens:Q.number().nullish(),prompt_tokens_details:Q.object({cached_tokens:Q.number().nullish()}).nullish(),completion_tokens_details:Q.object({reasoning_tokens:Q.number().nullish(),accepted_prediction_tokens:Q.number().nullish(),rejected_prediction_tokens:Q.number().nullish()}).nullish()}).nullish(),kG=Q.looseObject({id:Q.string().nullish(),created:Q.number().nullish(),model:Q.string().nullish(),choices:Q.array(Q.object({message:Q.object({role:Q.literal("assistant").nullish(),content:Q.string().nullish(),reasoning_content:Q.string().nullish(),reasoning:Q.string().nullish(),tool_calls:Q.array(Q.object({id:Q.string().nullish(),function:Q.object({name:Q.string(),arguments:Q.string()}),extra_content:Q.object({google:Q.object({thought_signature:Q.string().nullish()}).nullish()}).nullish()})).nullish()}),finish_reason:Q.string().nullish()})),usage:FG}),fG=Q.looseObject({id:Q.string().nullish(),created:Q.number().nullish(),model:Q.string().nullish(),choices:Q.array(Q.object({delta:Q.object({role:Q.enum(["assistant"]).nullish(),content:Q.string().nullish(),reasoning_content:Q.string().nullish(),reasoning:Q.string().nullish(),tool_calls:Q.array(Q.object({index:Q.number().nullish(),id:Q.string().nullish(),function:Q.object({name:Q.string().nullish(),arguments:Q.string().nullish()}),extra_content:Q.object({google:Q.object({thought_signature:Q.string().nullish()}).nullish()}).nullish()})).nullish()}).nullish(),finish_reason:Q.string().nullish()})),usage:FG}),OG=(G)=>Q.union([fG,G]);function BG(G){var Y,Z;if(G==null)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};let U=(Y=G.prompt_tokens)!=null?Y:0,z=(Z=G.completion_tokens)!=null?Z:0;return{inputTokens:{total:U,noCache:U,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:z,text:z,reasoning:void 0},raw:G}}function vG({prompt:G,user:Y="user",assistant:Z="assistant"}){let U="";if(G[0].role==="system")U+=`${G[0].content}
3
3
 
4
4
  `,G=G.slice(1);for(let{role:z,content:V}of G)switch(z){case"system":throw new AG({message:"Unexpected system message in prompt: ${content}",prompt:G});case"user":{let j=V.map((B)=>{switch(B.type){case"text":return B.text}}).filter(Boolean).join("");U+=`${Y}:
5
5
  ${j}
@@ -9,4 +9,4 @@ ${j}
9
9
 
10
10
  `;break}case"tool":throw new T({functionality:"tool messages"});default:throw Error(`Unsupported role: ${z}`)}return U+=`${Z}:
11
11
  `,{prompt:U,stopSequences:[`
12
- ${Y}:`]}}function VG({id:G,model:Y,created:Z}){return{id:G!=null?G:void 0,modelId:Y!=null?Y:void 0,timestamp:Z!=null?new Date(Z*1000):void 0}}function WG(G){switch(G){case"stop":return"stop";case"length":return"length";case"content_filter":return"content-filter";case"function_call":case"tool_calls":return"tool-calls";default:return"other"}}var EG=Q.object({echo:Q.boolean().optional(),logitBias:Q.record(Q.string(),Q.number()).optional(),suffix:Q.string().optional(),user:Q.string().optional()}),CG=class{constructor(G,Y){this.specificationVersion="v3";var Z;this.modelId=G,this.config=Y;let U=(Z=Y.errorStructure)!=null?Z:m;this.chunkSchema=uG(U.errorSchema),this.failedResponseHandler=f(U)}get provider(){return this.config.provider}get providerOptionsName(){return this.config.provider.split(".")[0].trim()}get supportedUrls(){var G,Y,Z;return(Z=(Y=(G=this.config).supportedUrls)==null?void 0:Y.call(G))!=null?Z:{}}async getArgs({prompt:G,maxOutputTokens:Y,temperature:Z,topP:U,topK:z,frequencyPenalty:V,presencePenalty:j,stopSequences:B,responseFormat:H,seed:X,providerOptions:L,tools:$,toolChoice:J}){var E,A;let P=[],K=Object.assign((E=await R({provider:this.providerOptionsName,providerOptions:L,schema:EG}))!=null?E:{},(A=await R({provider:h(this.providerOptionsName),providerOptions:L,schema:EG}))!=null?A:{});if(z!=null)P.push({type:"unsupported",feature:"topK"});if($==null?void 0:$.length)P.push({type:"unsupported",feature:"tools"});if(J!=null)P.push({type:"unsupported",feature:"toolChoice"});if(H!=null&&H.type!=="text")P.push({type:"unsupported",feature:"responseFormat",details:"JSON response format is not supported."});let{prompt:W,stopSequences:N}=vG({prompt:G}),x=[...N!=null?N:[],...B!=null?B:[]];return{args:{model:this.modelId,echo:K.echo,logit_bias:K.logitBias,suffix:K.suffix,user:K.user,max_tokens:Y,temperature:Z,top_p:U,frequency_penalty:V,presence_penalty:j,seed:X,...L==null?void 0:L[this.providerOptionsName],...L==null?void 0:L[h(this.providerOptionsName)],prompt:W,stop:x.length>0?x:void 0},warnings:P}}async doGenerate(G){let{args:Y,warnings:Z}=await this.getArgs(G),{responseHeaders:U,value:z,rawValue:V}=await b({url:this.config.url({path:"/completions",modelId:this.modelId}),headers:y(this.config.headers(),G.headers),body:Y,failedResponseHandler:this.failedResponseHandler,successfulResponseHandler:O(hG),abortSignal:G.abortSignal,fetch:this.config.fetch}),j=z.choices[0],B=[];if(j.text!=null&&j.text.length>0)B.push({type:"text",text:j.text});return{content:B,usage:BG(z.usage),finishReason:{unified:WG(j.finish_reason),raw:j.finish_reason},request:{body:Y},response:{...VG(z),headers:U,body:V},warnings:Z}}async doStream(G){let{args:Y,warnings:Z}=await this.getArgs(G),U={...Y,stream:!0,stream_options:this.config.includeUsage?{include_usage:!0}:void 0},{responseHeaders:z,value:V}=await b({url:this.config.url({path:"/completions",modelId:this.modelId}),headers:y(this.config.headers(),G.headers),body:U,failedResponseHandler:this.failedResponseHandler,successfulResponseHandler:s(this.chunkSchema),abortSignal:G.abortSignal,fetch:this.config.fetch}),j={unified:"other",raw:void 0},B=void 0,H=!0;return{stream:V.pipeThrough(new TransformStream({start(X){X.enqueue({type:"stream-start",warnings:Z})},transform(X,L){var $;if(G.includeRawChunks)L.enqueue({type:"raw",rawValue:X.rawValue});if(!X.success){j={unified:"error",raw:void 0},L.enqueue({type:"error",error:X.error});return}let J=X.value;if("error"in J){j={unified:"error",raw:void 0},L.enqueue({type:"error",error:J.error});return}if(H)H=!1,L.enqueue({type:"response-metadata",...VG(J)}),L.enqueue({type:"text-start",id:"0"});if(J.usage!=null)B=J.usage;let E=J.choices[0];if((E==null?void 0:E.finish_reason)!=null)j={unified:WG(E.finish_reason),raw:($=E.finish_reason)!=null?$:void 0};if((E==null?void 0:E.text)!=null)L.enqueue({type:"text-delta",id:"0",delta:E.text})},flush(X){if(!H)X.enqueue({type:"text-end",id:"0"});X.enqueue({type:"finish",finishReason:j,usage:BG(B)})}})),request:{body:U},response:{headers:z}}}},wG=Q.object({prompt_tokens:Q.number(),completion_tokens:Q.number(),total_tokens:Q.number()}),hG=Q.object({id:Q.string().nullish(),created:Q.number().nullish(),model:Q.string().nullish(),choices:Q.array(Q.object({text:Q.string(),finish_reason:Q.string()})),usage:wG.nullish()}),uG=(G)=>Q.union([Q.object({id:Q.string().nullish(),created:Q.number().nullish(),model:Q.string().nullish(),choices:Q.array(Q.object({text:Q.string(),finish_reason:Q.string().nullish(),index:Q.number()})),usage:wG.nullish()}),G]),a=Q.object({dimensions:Q.number().optional(),user:Q.string().optional()}),gG=class{constructor(G,Y){this.specificationVersion="v3",this.modelId=G,this.config=Y}get provider(){return this.config.provider}get maxEmbeddingsPerCall(){var G;return(G=this.config.maxEmbeddingsPerCall)!=null?G:2048}get supportsParallelCalls(){var G;return(G=this.config.supportsParallelCalls)!=null?G:!0}get providerOptionsName(){return this.config.provider.split(".")[0].trim()}async doEmbed({values:G,headers:Y,abortSignal:Z,providerOptions:U}){var z,V,j;let B=[],H=await R({provider:"openai-compatible",providerOptions:U,schema:a});if(H!=null)B.push({type:"other",message:"The 'openai-compatible' key in providerOptions is deprecated. Use 'openaiCompatible' instead."});let X=Object.assign(H!=null?H:{},(z=await R({provider:"openaiCompatible",providerOptions:U,schema:a}))!=null?z:{},(V=await R({provider:this.providerOptionsName,providerOptions:U,schema:a}))!=null?V:{});if(G.length>this.maxEmbeddingsPerCall)throw new PG({provider:this.provider,modelId:this.modelId,maxEmbeddingsPerCall:this.maxEmbeddingsPerCall,values:G});let{responseHeaders:L,value:$,rawValue:J}=await b({url:this.config.url({path:"/embeddings",modelId:this.modelId}),headers:y(this.config.headers(),Y),body:{model:this.modelId,input:G,encoding_format:"float",dimensions:X.dimensions,user:X.user},failedResponseHandler:f((j=this.config.errorStructure)!=null?j:m),successfulResponseHandler:O(_G),abortSignal:Z,fetch:this.config.fetch});return{warnings:B,embeddings:$.data.map((E)=>E.embedding),usage:$.usage?{tokens:$.usage.prompt_tokens}:void 0,providerMetadata:$.providerMetadata,response:{headers:L,body:J}}}},_G=Q.object({data:Q.array(Q.object({embedding:Q.array(Q.number())})),usage:Q.object({prompt_tokens:Q.number()}).nullish(),providerMetadata:Q.record(Q.string(),Q.record(Q.string(),Q.any())).optional()}),mG=class{constructor(G,Y){this.modelId=G,this.config=Y,this.specificationVersion="v3",this.maxImagesPerCall=10}get provider(){return this.config.provider}get providerOptionsKey(){return this.config.provider.split(".")[0].trim()}getArgs(G){return{...G[this.providerOptionsKey],...G[h(this.providerOptionsKey)]}}async doGenerate({prompt:G,n:Y,size:Z,aspectRatio:U,seed:z,providerOptions:V,headers:j,abortSignal:B,files:H,mask:X}){var L,$,J,E,A;let P=[];if(U!=null)P.push({type:"unsupported",feature:"aspectRatio",details:"This model does not support aspect ratio. Use `size` instead."});if(z!=null)P.push({type:"unsupported",feature:"seed"});let K=(J=($=(L=this.config._internal)==null?void 0:L.currentDate)==null?void 0:$.call(L))!=null?J:new Date,W=this.getArgs(V);if(H!=null&&H.length>0){let{value:D,responseHeaders:w}=await xG({url:this.config.url({path:"/images/edits",modelId:this.modelId}),headers:y(this.config.headers(),j),formData:qG({model:this.modelId,prompt:G,image:await Promise.all(H.map((q)=>KG(q))),mask:X!=null?await KG(X):void 0,n:Y,size:Z,...W}),failedResponseHandler:f((E=this.config.errorStructure)!=null?E:m),successfulResponseHandler:O(HG),abortSignal:B,fetch:this.config.fetch});return{images:D.data.map((q)=>q.b64_json),warnings:P,response:{timestamp:K,modelId:this.modelId,headers:w}}}let{value:N,responseHeaders:x}=await b({url:this.config.url({path:"/images/generations",modelId:this.modelId}),headers:y(this.config.headers(),j),body:{model:this.modelId,prompt:G,n:Y,size:Z,...W,response_format:"b64_json"},failedResponseHandler:f((A=this.config.errorStructure)!=null?A:m),successfulResponseHandler:O(HG),abortSignal:B,fetch:this.config.fetch});return{images:N.data.map((D)=>D.b64_json),warnings:P,response:{timestamp:K,modelId:this.modelId,headers:x}}}},HG=Q.object({data:Q.array(Q.object({b64_json:Q.string()}))});async function KG(G){if(G.type==="url")return NG(G.url);let Y=G.data instanceof Uint8Array?G.data:l(G.data);return new Blob([Y],{type:G.mediaType})}var dG="2.0.41";function jQ(G){let Y=IG(G.baseURL),Z=G.name,U={...G.apiKey&&{Authorization:`Bearer ${G.apiKey}`},...G.headers},z=()=>DG(U,`ai-sdk/openai-compatible/${dG}`),V=(J)=>({provider:`${Z}.${J}`,url:({path:E})=>{let A=new URL(`${Y}${E}`);if(G.queryParams)A.search=new URLSearchParams(G.queryParams).toString();return A.toString()},headers:z,fetch:G.fetch}),j=(J)=>B(J),B=(J)=>new bG(J,{...V("chat"),includeUsage:G.includeUsage,supportsStructuredOutputs:G.supportsStructuredOutputs,transformRequestBody:G.transformRequestBody,metadataExtractor:G.metadataExtractor}),H=(J)=>new CG(J,{...V("completion"),includeUsage:G.includeUsage}),X=(J)=>new gG(J,{...V("embedding")}),L=(J)=>new mG(J,V("image")),$=(J)=>j(J);return $.specificationVersion="v3",$.languageModel=j,$.chatModel=B,$.completionModel=H,$.embeddingModel=X,$.textEmbeddingModel=X,$.imageModel=L,$}export{bG as jf,CG as kf,gG as lf,mG as mf,dG as nf,jQ as of};
12
+ ${Y}:`]}}function VG({id:G,model:Y,created:Z}){return{id:G!=null?G:void 0,modelId:Y!=null?Y:void 0,timestamp:Z!=null?new Date(Z*1000):void 0}}function WG(G){switch(G){case"stop":return"stop";case"length":return"length";case"content_filter":return"content-filter";case"function_call":case"tool_calls":return"tool-calls";default:return"other"}}var EG=Q.object({echo:Q.boolean().optional(),logitBias:Q.record(Q.string(),Q.number()).optional(),suffix:Q.string().optional(),user:Q.string().optional()}),CG=class{constructor(G,Y){this.specificationVersion="v3";var Z;this.modelId=G,this.config=Y;let U=(Z=Y.errorStructure)!=null?Z:m;this.chunkSchema=uG(U.errorSchema),this.failedResponseHandler=f(U)}get provider(){return this.config.provider}get providerOptionsName(){return this.config.provider.split(".")[0].trim()}get supportedUrls(){var G,Y,Z;return(Z=(Y=(G=this.config).supportedUrls)==null?void 0:Y.call(G))!=null?Z:{}}async getArgs({prompt:G,maxOutputTokens:Y,temperature:Z,topP:U,topK:z,frequencyPenalty:V,presencePenalty:j,stopSequences:B,responseFormat:H,seed:X,providerOptions:L,tools:$,toolChoice:J}){var E,A;let P=[],K=Object.assign((E=await R({provider:this.providerOptionsName,providerOptions:L,schema:EG}))!=null?E:{},(A=await R({provider:h(this.providerOptionsName),providerOptions:L,schema:EG}))!=null?A:{});if(z!=null)P.push({type:"unsupported",feature:"topK"});if($==null?void 0:$.length)P.push({type:"unsupported",feature:"tools"});if(J!=null)P.push({type:"unsupported",feature:"toolChoice"});if(H!=null&&H.type!=="text")P.push({type:"unsupported",feature:"responseFormat",details:"JSON response format is not supported."});let{prompt:W,stopSequences:N}=vG({prompt:G}),x=[...N!=null?N:[],...B!=null?B:[]];return{args:{model:this.modelId,echo:K.echo,logit_bias:K.logitBias,suffix:K.suffix,user:K.user,max_tokens:Y,temperature:Z,top_p:U,frequency_penalty:V,presence_penalty:j,seed:X,...L==null?void 0:L[this.providerOptionsName],...L==null?void 0:L[h(this.providerOptionsName)],prompt:W,stop:x.length>0?x:void 0},warnings:P}}async doGenerate(G){let{args:Y,warnings:Z}=await this.getArgs(G),{responseHeaders:U,value:z,rawValue:V}=await b({url:this.config.url({path:"/completions",modelId:this.modelId}),headers:y(this.config.headers(),G.headers),body:Y,failedResponseHandler:this.failedResponseHandler,successfulResponseHandler:O(hG),abortSignal:G.abortSignal,fetch:this.config.fetch}),j=z.choices[0],B=[];if(j.text!=null&&j.text.length>0)B.push({type:"text",text:j.text});return{content:B,usage:BG(z.usage),finishReason:{unified:WG(j.finish_reason),raw:j.finish_reason},request:{body:Y},response:{...VG(z),headers:U,body:V},warnings:Z}}async doStream(G){let{args:Y,warnings:Z}=await this.getArgs(G),U={...Y,stream:!0,stream_options:this.config.includeUsage?{include_usage:!0}:void 0},{responseHeaders:z,value:V}=await b({url:this.config.url({path:"/completions",modelId:this.modelId}),headers:y(this.config.headers(),G.headers),body:U,failedResponseHandler:this.failedResponseHandler,successfulResponseHandler:s(this.chunkSchema),abortSignal:G.abortSignal,fetch:this.config.fetch}),j={unified:"other",raw:void 0},B=void 0,H=!0;return{stream:V.pipeThrough(new TransformStream({start(X){X.enqueue({type:"stream-start",warnings:Z})},transform(X,L){var $;if(G.includeRawChunks)L.enqueue({type:"raw",rawValue:X.rawValue});if(!X.success){j={unified:"error",raw:void 0},L.enqueue({type:"error",error:X.error});return}let J=X.value;if("error"in J){j={unified:"error",raw:void 0},L.enqueue({type:"error",error:J.error});return}if(H)H=!1,L.enqueue({type:"response-metadata",...VG(J)}),L.enqueue({type:"text-start",id:"0"});if(J.usage!=null)B=J.usage;let E=J.choices[0];if((E==null?void 0:E.finish_reason)!=null)j={unified:WG(E.finish_reason),raw:($=E.finish_reason)!=null?$:void 0};if((E==null?void 0:E.text)!=null)L.enqueue({type:"text-delta",id:"0",delta:E.text})},flush(X){if(!H)X.enqueue({type:"text-end",id:"0"});X.enqueue({type:"finish",finishReason:j,usage:BG(B)})}})),request:{body:U},response:{headers:z}}}},wG=Q.object({prompt_tokens:Q.number(),completion_tokens:Q.number(),total_tokens:Q.number()}),hG=Q.object({id:Q.string().nullish(),created:Q.number().nullish(),model:Q.string().nullish(),choices:Q.array(Q.object({text:Q.string(),finish_reason:Q.string()})),usage:wG.nullish()}),uG=(G)=>Q.union([Q.object({id:Q.string().nullish(),created:Q.number().nullish(),model:Q.string().nullish(),choices:Q.array(Q.object({text:Q.string(),finish_reason:Q.string().nullish(),index:Q.number()})),usage:wG.nullish()}),G]),a=Q.object({dimensions:Q.number().optional(),user:Q.string().optional()}),gG=class{constructor(G,Y){this.specificationVersion="v3",this.modelId=G,this.config=Y}get provider(){return this.config.provider}get maxEmbeddingsPerCall(){var G;return(G=this.config.maxEmbeddingsPerCall)!=null?G:2048}get supportsParallelCalls(){var G;return(G=this.config.supportsParallelCalls)!=null?G:!0}get providerOptionsName(){return this.config.provider.split(".")[0].trim()}async doEmbed({values:G,headers:Y,abortSignal:Z,providerOptions:U}){var z,V,j;let B=[],H=await R({provider:"openai-compatible",providerOptions:U,schema:a});if(H!=null)B.push({type:"other",message:"The 'openai-compatible' key in providerOptions is deprecated. Use 'openaiCompatible' instead."});let X=Object.assign(H!=null?H:{},(z=await R({provider:"openaiCompatible",providerOptions:U,schema:a}))!=null?z:{},(V=await R({provider:this.providerOptionsName,providerOptions:U,schema:a}))!=null?V:{});if(G.length>this.maxEmbeddingsPerCall)throw new PG({provider:this.provider,modelId:this.modelId,maxEmbeddingsPerCall:this.maxEmbeddingsPerCall,values:G});let{responseHeaders:L,value:$,rawValue:J}=await b({url:this.config.url({path:"/embeddings",modelId:this.modelId}),headers:y(this.config.headers(),Y),body:{model:this.modelId,input:G,encoding_format:"float",dimensions:X.dimensions,user:X.user},failedResponseHandler:f((j=this.config.errorStructure)!=null?j:m),successfulResponseHandler:O(_G),abortSignal:Z,fetch:this.config.fetch});return{warnings:B,embeddings:$.data.map((E)=>E.embedding),usage:$.usage?{tokens:$.usage.prompt_tokens}:void 0,providerMetadata:$.providerMetadata,response:{headers:L,body:J}}}},_G=Q.object({data:Q.array(Q.object({embedding:Q.array(Q.number())})),usage:Q.object({prompt_tokens:Q.number()}).nullish(),providerMetadata:Q.record(Q.string(),Q.record(Q.string(),Q.any())).optional()}),mG=class{constructor(G,Y){this.modelId=G,this.config=Y,this.specificationVersion="v3",this.maxImagesPerCall=10}get provider(){return this.config.provider}get providerOptionsKey(){return this.config.provider.split(".")[0].trim()}getArgs(G){return{...G[this.providerOptionsKey],...G[h(this.providerOptionsKey)]}}async doGenerate({prompt:G,n:Y,size:Z,aspectRatio:U,seed:z,providerOptions:V,headers:j,abortSignal:B,files:H,mask:X}){var L,$,J,E,A;let P=[];if(U!=null)P.push({type:"unsupported",feature:"aspectRatio",details:"This model does not support aspect ratio. Use `size` instead."});if(z!=null)P.push({type:"unsupported",feature:"seed"});let K=(J=($=(L=this.config._internal)==null?void 0:L.currentDate)==null?void 0:$.call(L))!=null?J:new Date,W=this.getArgs(V);if(H!=null&&H.length>0){let{value:D,responseHeaders:w}=await xG({url:this.config.url({path:"/images/edits",modelId:this.modelId}),headers:y(this.config.headers(),j),formData:qG({model:this.modelId,prompt:G,image:await Promise.all(H.map((q)=>KG(q))),mask:X!=null?await KG(X):void 0,n:Y,size:Z,...W}),failedResponseHandler:f((E=this.config.errorStructure)!=null?E:m),successfulResponseHandler:O(HG),abortSignal:B,fetch:this.config.fetch});return{images:D.data.map((q)=>q.b64_json),warnings:P,response:{timestamp:K,modelId:this.modelId,headers:w}}}let{value:N,responseHeaders:x}=await b({url:this.config.url({path:"/images/generations",modelId:this.modelId}),headers:y(this.config.headers(),j),body:{model:this.modelId,prompt:G,n:Y,size:Z,...W,response_format:"b64_json"},failedResponseHandler:f((A=this.config.errorStructure)!=null?A:m),successfulResponseHandler:O(HG),abortSignal:B,fetch:this.config.fetch});return{images:N.data.map((D)=>D.b64_json),warnings:P,response:{timestamp:K,modelId:this.modelId,headers:x}}}},HG=Q.object({data:Q.array(Q.object({b64_json:Q.string()}))});async function KG(G){if(G.type==="url")return NG(G.url);let Y=G.data instanceof Uint8Array?G.data:l(G.data);return new Blob([Y],{type:G.mediaType})}var dG="2.0.41";function jQ(G){let Y=IG(G.baseURL),Z=G.name,U={...G.apiKey&&{Authorization:`Bearer ${G.apiKey}`},...G.headers},z=()=>DG(U,`ai-sdk/openai-compatible/${dG}`),V=(J)=>({provider:`${Z}.${J}`,url:({path:E})=>{let A=new URL(`${Y}${E}`);if(G.queryParams)A.search=new URLSearchParams(G.queryParams).toString();return A.toString()},headers:z,fetch:G.fetch}),j=(J)=>B(J),B=(J)=>new bG(J,{...V("chat"),includeUsage:G.includeUsage,supportsStructuredOutputs:G.supportsStructuredOutputs,transformRequestBody:G.transformRequestBody,metadataExtractor:G.metadataExtractor}),H=(J)=>new CG(J,{...V("completion"),includeUsage:G.includeUsage}),X=(J)=>new gG(J,{...V("embedding")}),L=(J)=>new mG(J,V("image")),$=(J)=>j(J);return $.specificationVersion="v3",$.languageModel=j,$.chatModel=B,$.completionModel=H,$.embeddingModel=X,$.textEmbeddingModel=X,$.imageModel=L,$}export{bG as hf,CG as if,gG as jf,mG as kf,dG as lf,jQ as mf};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{cv as k}from"./chunk-gmzrvxnv.js";import{$x as z,_x as j,dA as u}from"./chunk-mpygdb5a.js";import"./chunk-3k2b05fv.js";var q=(Q)=>typeof Q==="object"&&Q!==null&&("_zod"in Q),b=(Q,G,X)=>{if(!Q)return;let Y={};for(let[K,W]of Object.entries(Q))Y[K]=G.addExample(W,[...X,K]);return Y},y=(Q,G,X)=>{let{schema:Y,examples:K,...W}=Q,F=W;if(q(Y))F.schema=G.registry.addSchema(Y,[...X,"schema"],{io:G.io,source:{type:"mediaType"}});else F.schema=Y;if(K)F.examples=b(K,G.registry,[...X,"examples"]);return F},C=(Q,G,X)=>{let Y={};for(let[K,W]of Object.entries(Q))if(W)Y[K]=y(W,G,[...X,K]);return Y},E=(Q,G,X)=>{let Y=Q._zod.def;switch(Y.type){case"object":return Q;case"lazy":return E(Y.getter(),G,X);case"pipe":if(G==="input")return E(Y.in,G,X);return E(Y.out,G,X)}throw Error(`Failed to unwrap ZodObject from type: ${Q._zod.def.type} at ${X.join(" > ")}`)},f=(Q,G)=>{if(G==="input")return Q._zod.optin===void 0;return Q._zod.optout===void 0},m=(Q,G,X)=>{if(!Q)return;if(q(Q)){let Y=E(Q,"output",X),K={};for(let[W,F]of Object.entries(Y._zod.def.shape))K[W]=G.addHeader(F,[...X,W]);return K}return Q},p=(Q,G,X)=>{if(!Q)return;let Y={};for(let[K,W]of Object.entries(Q))Y[K]=G.addLink(W,[...X,K]);return Y},$=(Q,G,X)=>{if(!Q)return;let Y=[];for(let K of Q){if(q(K)){let W=G.addParameter(K,[...X,"parameters"]);Y.push(W);continue}Y.push(K)}return Y},i=(Q,G,X)=>{if(!Q)return;let Y=[];for(let[K,W]of Object.entries(Q??{})){let F=E(W,"input",X);for(let[V,L]of Object.entries(F._zod.def.shape)){let M=G.addParameter(L,[...X,K,V],{location:{in:K,name:V}});Y.push(M)}}return Y},T=(Q)=>Q.startsWith("x-"),n=(Q,G,X)=>{if(!Q)return;let Y={};for(let[K,W]of Object.entries(Q)){if(T(K)){Y[K]=W;continue}Y[K]=G.addCallback(W,[...X,K])}return Y},o=(Q,G,X)=>{if(!Q)return;let Y={};for(let[K,W]of Object.entries(Q)){if(!W)continue;if(T(K)){Y[K]=W;continue}if("$ref"in W){Y[K]=W;continue}Y[K]=G.addResponse(W,[...X,K])}return Y},c=(Q,G,X)=>{let{parameters:Y,requestParams:K,requestBody:W,responses:F,callbacks:V,...L}=Q,M=L,H=$(Y,G,[...X,"parameters"]),N=i(K,G,[...X,"requestParams"]);if(N||H)M.parameters=[...N??[],...H??[]];let A=W&&G.addRequestBody(W,X);if(A)M.requestBody=A;let Z=o(F,G,[...X,"responses"]);if(Z)M.responses=Z;let J=n(V,G,[...X,"callbacks"]);if(J)M.callbacks=J;return M},R=(Q,G,X)=>{if(!Q)return;let Y={};for(let[K,W]of Object.entries(Q)){if(T(K)){Y[K]=W;continue}Y[K]=G.addPathItem(W,[...X,K])}return Y},S=["3.0.0","3.0.1","3.0.2","3.0.3","3.1.0","3.1.1"],_=(Q,G)=>S.indexOf(Q)>=S.indexOf(G),a=(Q)=>{let G=Q.zodSchema._zod.def;switch(G.type){case"bigint":Q.jsonSchema.type="integer",Q.jsonSchema.format="int64";break;case"union":{if("discriminator"in G&&typeof G.discriminator==="string"){Q.jsonSchema.oneOf??=Q.jsonSchema.anyOf,delete Q.jsonSchema.anyOf,Q.jsonSchema.type="object",Q.jsonSchema.discriminator={propertyName:G.discriminator};let Y={};for(let[K,W]of Object.entries(Q.jsonSchema.oneOf)){let F=W.$ref;if(!F){delete Q.jsonSchema.discriminator;return}let V=G.options[Number(K)]._zod.propValues?.[G.discriminator];if(!V?.size)return;for(let L of[...V??[]]){if(typeof L!=="string"&&typeof L!=="number"&&typeof L!=="boolean")return;Y[String(L)]=F}}Q.jsonSchema.discriminator.mapping=Y}let X=z.get(Q.zodSchema);if(typeof X?.unionOneOf==="boolean"){if(X.unionOneOf)Q.jsonSchema.oneOf=Q.jsonSchema.anyOf,delete Q.jsonSchema.anyOf;delete Q.jsonSchema.unionOneOf}break}case"date":Q.jsonSchema.type="string";break;case"literal":if(G.values.includes(void 0))break;break;case"undefined":Q.jsonSchema.not={};break}},l=(Q,G,X)=>{if(X.context&&Q.zodSchema._zod.parent!==X.context.zodSchema){if(X.context.zodSchema._zod.def.type==="pipe")throw Error(`Zod transform found at ${X.context.path.join(" > ")} are not supported in output schemas. Please use \`.overwrite()\` or wrap the schema in a \`.pipe()\` or assign it manual metadata with \`.meta()\``);throw Error(`Zod schema of type \`${X.context.zodSchema._zod.def.type}\` at ${X.context?.path.join(" > ")} cannot be represented in OpenAPI. Please assign it metadata with \`.meta()\``)}if(X.context=void 0,Object.keys(Q.jsonSchema).length)return;let Y=Q.zodSchema._zod.def,K=G.allowEmptySchema?.[Y.type];if(K===!0||K?.[Q.io])return;switch(Y.type){case"optional":l({...Q,zodSchema:Y.innerType},G,X);return;case"any":return;case"unknown":return;case"pipe":if(Q.io==="output"){if(!Q.zodSchema._zod.parent){X.context=Q;return}}return;case"transform":if(Q.io==="output")return;break;case"literal":if(Y.values.includes(void 0))throw Error(`Zod literal at ${Q.path.join(" > ")} cannot include \`undefined\` as a value. Please use \`z.undefined()\` or \`.optional()\` instead.`);return;case"custom":if(!Q.zodSchema._zod.parent){X.context=Q;return}}throw Error(`Zod schema of type \`${Y.type}\` at ${Q.path.join(" > ")} cannot be represented in OpenAPI. Please assign it metadata with \`.meta()\``)},r=(Q,G,X,Y)=>{let K=new Map;if(X.io==="input")return K;let W=new Map,F=new Map;for(let[V,L]of Object.entries(Q)){let M=JSON.stringify(L),H=new RegExp(`"${Y}([^"]+)"`,"g"),N=M.matchAll(H),A=new Set;for(let Z of N){let J=Z[1];if(J!==V)A.add(J)}F.set(V,M),W.set(V,{dependencies:A})}for(let[V]of F){if(!X.registry.components.schemas.ids.get(V))continue;if(x(W,F,X.registry,V))continue;let L=G.get(V)??`${V}${X.opts.outputIdSuffix??"Output"}`;K.set(V,L),Q[L]=Q[V],delete Q[V]}return K},x=(Q,G,X,Y,K=new Set)=>{if(K.has(Y))return!0;let W=Q.get(Y);if(W.pure!==void 0)return W.pure;let F=G.get(Y),V=X.components.schemas.ids.get(Y);if(V&&F!==JSON.stringify(V))return W.pure=!1,!1;K.add(Y);let L=[...W.dependencies].every((M)=>x(Q,G,X,M,new Set(K)));return W.pure=L,L},s=(Q,G={})=>{G.registry??=P({schemas:G.schemaComponents}),G.opts??={},G.io??="output";let X=Object.fromEntries(G.registry.components.schemas[G.io]),Y={zodOpenApiCreateSchema:{zodType:Q}};Object.assign(Y,X);let K=g(Y,{registry:G.registry,io:G.io,opts:{...G.opts,schemaRefPath:G.schemaRefPath},openapiVersion:G.openapiVersion});return{schema:K.schemas.zodOpenApiCreateSchema,components:K.components}},t=["param","header","unusedIO","override","outputId"],e=(Q)=>{t.forEach((G)=>{delete Q[G]})},v=(Q)=>{delete Q.$schema,delete Q.id,delete Q.$id},g=(Q,G)=>{let X=G.opts.schemaRefPath??"#/components/schemas/",Y={};for(let[D,{zodType:w}]of Object.entries(Q))Y[D]=w;let K=j();K.add(k(Y),{id:"zodOpenApiCreateSchema"});for(let[D,{zodType:w}]of G.registry.components.schemas.manual)K.add(w,{id:D});let W=new Map,F=_(G.openapiVersion??"3.1.0","3.1.0")?"$defs":"definitions",V={},L=u(K,{override(D){let w=z.get(D.zodSchema);if(w?.outputId&&w?.id)W.set(w.id,w.outputId);if(D.jsonSchema.$ref)return;let B={...D,io:G.io};if(a(B),typeof G.opts.override==="function")G.opts.override(B);if(typeof w?.override==="function")w.override(B),delete D.jsonSchema.override;if(typeof w?.override==="object"&&w.override!==null)Object.assign(D.jsonSchema,w.override),delete D.jsonSchema.override;v(D.jsonSchema),e(D.jsonSchema),l(B,G.opts,V)},io:G.io,unrepresentable:"any",reused:G.opts.reused,cycles:G.opts.cycles,target:_(G.openapiVersion??"3.1.0","3.1.0")?void 0:"openapi-3.0",uri:(D)=>D==="__shared"?`#ZOD_OPENAPI/${D}`:`#ZOD_OPENAPI/__shared#/${F}/${D}`}),M=L.schemas.__shared?.[F]??{};L.schemas.__shared??={[F]:M};let H=new Map;for(let[D,w]of Object.entries(M))if(v(w),/^schema\d+$/.test(D)){let B=`__schema${G.registry.components.schemas.dynamicSchemaCount++}`;if(H.set(D,`"${X}${B}"`),B!==D)M[B]=w,delete M[D]}for(let[D]of G.registry.components.schemas.manual){let w=L.schemas[D];if(!w)continue;v(w)}let N={},A=JSON.parse(JSON.stringify(L).replace(/"#ZOD_OPENAPI\/__shared#\/(?:\$defs|definitions)\/([^"]+)"/g,(D,w)=>{let B=H.get(w);if(B)return B;if(G.registry.components.schemas.manual.get(w))N[w]=!0;return`"${X}${w}"`})),Z=A.schemas.__shared?.[F]??{};A.schemas.__shared??={[F]:Z};for(let[D]of G.registry.components.schemas.manual){let w=A.schemas[D];if(!w)continue;if(N[D]){if(Z[D])throw Error(`Component "${D}" is already registered as a component in the registry`);Z[D]=w}}let J=r(Z,W,G,X);if(!J.size){let D=A.schemas.zodOpenApiCreateSchema?.properties;return delete A.schemas.zodOpenApiCreateSchema,delete A.schemas.__shared,{schemas:D,components:Z,manual:A.schemas}}let U=JSON.parse(JSON.stringify(A).replace(new RegExp(`"${X}([^"]+)"`,"g"),(D,w)=>{let B=J.get(w);if(B)return`"${X}${B}"`;return`"${X}${w}"`})),I=U.schemas.zodOpenApiCreateSchema?.properties,h=U.schemas.__shared?.[F]??{};return delete U.schemas.zodOpenApiCreateSchema,delete U.schemas.__shared,{schemas:I,components:h,manual:U.schemas}},P=(Q)=>{let G={components:{schemas:{dynamicSchemaCount:0,input:new Map,output:new Map,ids:new Map,manual:new Map},headers:{ids:new Map,seen:new WeakMap},requestBodies:{ids:new Map,seen:new WeakMap},responses:{ids:new Map,seen:new WeakMap},parameters:{ids:new Map,seen:new WeakMap},callbacks:{ids:new Map,seen:new WeakMap},pathItems:{ids:new Map,seen:new WeakMap},securitySchemes:{ids:new Map,seen:new WeakMap},links:{ids:new Map,seen:new WeakMap},examples:{ids:new Map,seen:new WeakMap}},addSchema:(X,Y,K)=>{let W={};return G.components.schemas[K.io].set(Y.join(" > "),{schemaObject:W,zodType:X,source:{path:Y,...K?.source}}),W},addParameter:(X,Y,K)=>{let W=G.components.parameters.seen.get(X);if(W)return W;let F=z.get(X),V=K?.location?.name??F?.param?.name,L=K?.location?.in??F?.param?.in;if(K?.location?.name&&F?.param?.name||K?.location?.in&&F?.param?.in)throw Error(`Parameter at ${Y.join(" > ")} has both \`.meta({ param: { name, in } })\` and \`.meta({ param: { location: { in, name } } })\` information`);if(!V||!L)throw Error(`Parameter at ${Y.join(" > ")} is missing \`.meta({ param: { name, in } })\` information`);let M=G.addSchema(X,[...Y,L,V,"schema"],{io:"input",source:{type:"parameter",location:{in:L,name:V}}}),{id:H,examples:N,...A}=F?.param??{},Z={in:L,name:V,schema:M,...A},J=b(N,G,[...Y,L,V,"examples"]);if(J)Z.examples=J;if(f(X,"input"))Z.required=!0;if(!Z.description&&F?.description)Z.description=F.description;let U=H??K?.manualId;if(U){if(G.components.parameters.ids.has(U))throw Error(`Schema "${U}" at ${Y.join(" > ")} is already registered`);let I={$ref:`#/components/parameters/${U}`};if(G.components.parameters.seen.set(X,I),G.components.parameters.ids.set(U,Z),K?.manualId)return Z;return I}if(K?.location?.name||K?.location?.in)return Z;return G.components.parameters.seen.set(X,Z),Z},addHeader:(X,Y,K)=>{let W=G.components.headers.seen.get(X);if(W)return W;let F=z.get(X),{id:V,...L}=F?.header??{},M=V??K?.manualId,H=L;if(f(X,"output"))H.required=!0;if(!H.description&&F?.description)H.description=F.description;if(H.schema=G.addSchema(X,[...Y,"schema"],{io:"output",source:{type:"header"}}),M){if(G.components.schemas.ids.has(M))throw Error(`Schema "${M}" at ${Y.join(" > ")} is already registered`);let N={$ref:`#/components/headers/${M}`};if(G.components.headers.ids.set(M,H),G.components.headers.seen.set(X,N),K?.manualId)return H;return N}return G.components.headers.seen.set(X,H),H},addRequestBody:(X,Y,K)=>{let W=G.components.requestBodies.seen.get(X);if(W)return W;let{content:F,id:V,...L}=X,M={...L,content:C(F,{registry:G,io:"input"},[...Y,"content"])},H=V??K?.manualId;if(H){if(G.components.requestBodies.ids.has(H))throw Error(`RequestBody "${H}" at ${Y.join(" > ")} is already registered`);let N={$ref:`#/components/requestBodies/${H}`};if(G.components.requestBodies.ids.set(H,M),G.components.requestBodies.seen.set(X,N),K?.manualId)return M;return N}return G.components.requestBodies.seen.set(X,M),M},addPathItem:(X,Y,K)=>{let W=G.components.pathItems.seen.get(X);if(W)return W;let F={},{id:V,...L}=X,M=V??K?.manualId;for(let[H,N]of Object.entries(L)){if(T(H)){F[H]=N;continue}if(H==="get"||H==="put"||H==="post"||H==="delete"||H==="options"||H==="head"||H==="patch"||H==="trace"){F[H]=c(N,G,[...Y,H]);continue}if(H==="parameters"){F[H]=$(N,G,[...Y,H]);continue}F[H]=N}if(M){if(G.components.pathItems.ids.has(M))throw Error(`PathItem "${M}" at ${Y.join(" > ")} is already registered`);let H={$ref:`#/components/pathItems/${M}`};if(G.components.pathItems.ids.set(M,F),G.components.pathItems.seen.set(X,H),K?.manualId)return F;return H}return G.components.pathItems.seen.set(X,F),F},addResponse:(X,Y,K)=>{let W=G.components.responses.seen.get(X);if(W)return W;let{content:F,headers:V,links:L,id:M,...H}=X,N=H,A=m(V,G,[...Y,"headers"]);if(A)N.headers=A;if(F)N.content=C(F,{registry:G,io:"output"},[...Y,"content"]);if(L)N.links=p(L,G,[...Y,"links"]);let Z=M??K?.manualId;if(Z){if(G.components.responses.ids.has(Z))throw Error(`Response "${Z}" at ${Y.join(" > ")} is already registered`);let J={$ref:`#/components/responses/${Z}`};if(G.components.responses.ids.set(Z,N),G.components.responses.seen.set(X,J),K?.manualId)return N;return J}return G.components.responses.seen.set(X,N),N},addCallback:(X,Y,K)=>{let W=G.components.callbacks.seen.get(X);if(W)return W;let{id:F,...V}=X,L={};for(let[H,N]of Object.entries(V)){if(T(H)){L[H]=N;continue}L[H]=G.addPathItem(N,[...Y,H])}let M=F??K?.manualId;if(M){if(G.components.callbacks.ids.has(M))throw Error(`Callback "${M}" at ${Y.join(" > ")} is already registered`);let H={$ref:`#/components/callbacks/${M}`};if(G.components.callbacks.ids.set(M,L),G.components.callbacks.seen.set(X,H),K?.manualId)return L;return H}return G.components.callbacks.seen.set(X,L),L},addSecurityScheme:(X,Y,K)=>{let W=G.components.securitySchemes.seen.get(X);if(W)return W;let{id:F,...V}=X,L=V,M=F??K?.manualId;if(M){if(G.components.securitySchemes.ids.has(M))throw Error(`SecurityScheme "${M}" at ${Y.join(" > ")} is already registered`);let H={$ref:`#/components/securitySchemes/${M}`};if(G.components.securitySchemes.ids.set(M,L),G.components.securitySchemes.seen.set(X,H),K?.manualId)return L;return H}return G.components.securitySchemes.seen.set(X,L),L},addLink:(X,Y,K)=>{let W=G.components.links.seen.get(X);if(W)return W;let{id:F,...V}=X,L=V,M=F??K?.manualId;if(M){if(G.components.links.ids.has(M))throw Error(`Link "${M}" at ${Y.join(" > ")} is already registered`);let H={$ref:`#/components/links/${M}`};if(G.components.links.ids.set(M,L),G.components.links.seen.set(X,H),K?.manualId)return L;return H}return G.components.links.seen.set(X,L),L},addExample:(X,Y,K)=>{let W=G.components.examples.seen.get(X);if(W)return W;let{id:F,...V}=X,L=V,M=F??K?.manualId;if(M){if(G.components.examples.ids.has(M))throw Error(`Example "${M}" at ${Y.join(" > ")} is already registered`);let H={$ref:`#/components/examples/${M}`};if(G.components.examples.ids.set(M,L),G.components.examples.seen.set(X,H),K?.manualId)return L;return H}return G.components.examples.seen.set(X,L),L}};return GG(Q?.schemas,G),QG(Q?.parameters,G),XG(Q?.headers,G),YG(Q?.responses,G),FG(Q?.pathItems,G),KG(Q?.requestBodies,G),WG(Q?.callbacks,G),HG(Q?.securitySchemes,G),MG(Q?.links,G),LG(Q?.examples,G),G},GG=(Q,G)=>{if(!Q)return;for(let[X,Y]of Object.entries(Q)){if(q(Y)){let K=z.get(Y)?.id??X;G.components.schemas.manual.set(K,{input:{schemaObject:{}},output:{schemaObject:{}},zodType:Y});continue}G.components.schemas.ids.set(X,Y)}},QG=(Q,G)=>{if(!Q)return;for(let[X,Y]of Object.entries(Q)){if(q(Y)){let K=["components","parameters",X];G.addParameter(Y,K,{manualId:X});continue}G.components.parameters.ids.set(X,Y)}},XG=(Q,G)=>{if(!Q)return;for(let[X,Y]of Object.entries(Q)){if(q(Y)){let K=["components","headers",X];G.addHeader(Y,K,{manualId:X});continue}G.components.headers.ids.set(X,Y)}},YG=(Q,G)=>{if(!Q)return;for(let[X,Y]of Object.entries(Q)){let K=G.addResponse(Y,["components","responses",X],{manualId:X});G.components.responses.ids.set(X,K),G.components.responses.seen.set(Y,K)}},KG=(Q,G)=>{if(!Q)return;for(let[X,Y]of Object.entries(Q)){if(q(Y)){G.addRequestBody(Y,["components","requestBodies",X],{manualId:X});continue}G.components.requestBodies.ids.set(X,Y)}},WG=(Q,G)=>{if(!Q)return;for(let[X,Y]of Object.entries(Q))G.addCallback(Y,["components","callbacks",X],{manualId:X})},FG=(Q,G)=>{if(!Q)return;for(let[X,Y]of Object.entries(Q))G.addPathItem(Y,["components","pathItems",X],{manualId:X})},HG=(Q,G)=>{if(!Q)return;for(let[X,Y]of Object.entries(Q))G.addSecurityScheme(Y,["components","securitySchemes",X],{manualId:X})},MG=(Q,G)=>{if(!Q)return;for(let[X,Y]of Object.entries(Q))G.addLink(Y,["components","links",X],{manualId:X})},LG=(Q,G)=>{if(!Q)return;for(let[X,Y]of Object.entries(Q))G.components.examples.ids.set(X,Y)},O=(Q)=>{let{schemas:G,components:X,manual:Y}=g(Object.fromEntries(Q.registry.components.schemas[Q.io]),Q);for(let[K,W]of Object.entries(X))Q.registry.components.schemas.ids.set(K,W);for(let[K,W]of Object.entries(G)){let F=Q.registry.components.schemas[Q.io].get(K);if(F)Object.assign(F.schemaObject,W)}for(let[K,W]of Object.entries(Y)){let F=Q.registry.components.schemas.manual.get(K);if(!F)continue;if(X[K])F[Q.io].used=!0;Object.assign(F[Q.io].schemaObject,W)}},VG=(Q)=>{for(let[G,X]of Q.components.schemas.manual)if(!X.input.used){let Y=X[z.get(X.zodType)?.unusedIO??"output"].schemaObject;Q.components.schemas.ids.set(G,Y)}},d=(Q,G,X)=>{O({registry:Q,io:"input",opts:G,openapiVersion:X}),O({registry:Q,io:"output",opts:G,openapiVersion:X}),VG(Q);let Y={};if(Q.components.schemas.ids.size>0)Y.schemas=Object.fromEntries(Q.components.schemas.ids);if(Q.components.headers.ids.size>0)Y.headers=Object.fromEntries(Q.components.headers.ids);if(Q.components.requestBodies.ids.size>0)Y.requestBodies=Object.fromEntries(Q.components.requestBodies.ids);if(Q.components.responses.ids.size>0)Y.responses=Object.fromEntries(Q.components.responses.ids);if(Q.components.parameters.ids.size>0)Y.parameters=Object.fromEntries(Q.components.parameters.ids);if(Q.components.callbacks.ids.size>0)Y.callbacks=Object.fromEntries(Q.components.callbacks.ids);if(Q.components.pathItems.ids.size>0)Y.pathItems=Object.fromEntries(Q.components.pathItems.ids);if(Q.components.securitySchemes.ids.size>0)Y.securitySchemes=Object.fromEntries(Q.components.securitySchemes.ids);if(Q.components.links.ids.size>0)Y.links=Object.fromEntries(Q.components.links.ids);if(Q.components.examples.ids.size>0)Y.examples=Object.fromEntries(Q.components.examples.ids);return Y};var AG=(Q,G={})=>{let{paths:X,webhooks:Y,components:K,...W}=Q,F=W,V=P(K),L=R(X,V,["paths"]);if(L)F.paths=L;let M=R(Y,V,["webhooks"]);if(M)F.webhooks=M;let H=d(V,G,Q.openapi);if(Object.keys(H).length>0)F.components=H;return F},JG={};export{JG as oas31,s as createSchema,AG as createDocument};
2
+ import{kv as k}from"./chunk-tdmn21z0.js";import{gy as j,hy as z,lA as u}from"./chunk-s8mghr5a.js";import"./chunk-4sazy0nq.js";var q=(Q)=>typeof Q==="object"&&Q!==null&&("_zod"in Q),b=(Q,G,X)=>{if(!Q)return;let Y={};for(let[K,W]of Object.entries(Q))Y[K]=G.addExample(W,[...X,K]);return Y},y=(Q,G,X)=>{let{schema:Y,examples:K,...W}=Q,F=W;if(q(Y))F.schema=G.registry.addSchema(Y,[...X,"schema"],{io:G.io,source:{type:"mediaType"}});else F.schema=Y;if(K)F.examples=b(K,G.registry,[...X,"examples"]);return F},C=(Q,G,X)=>{let Y={};for(let[K,W]of Object.entries(Q))if(W)Y[K]=y(W,G,[...X,K]);return Y},E=(Q,G,X)=>{let Y=Q._zod.def;switch(Y.type){case"object":return Q;case"lazy":return E(Y.getter(),G,X);case"pipe":if(G==="input")return E(Y.in,G,X);return E(Y.out,G,X)}throw Error(`Failed to unwrap ZodObject from type: ${Q._zod.def.type} at ${X.join(" > ")}`)},f=(Q,G)=>{if(G==="input")return Q._zod.optin===void 0;return Q._zod.optout===void 0},m=(Q,G,X)=>{if(!Q)return;if(q(Q)){let Y=E(Q,"output",X),K={};for(let[W,F]of Object.entries(Y._zod.def.shape))K[W]=G.addHeader(F,[...X,W]);return K}return Q},p=(Q,G,X)=>{if(!Q)return;let Y={};for(let[K,W]of Object.entries(Q))Y[K]=G.addLink(W,[...X,K]);return Y},$=(Q,G,X)=>{if(!Q)return;let Y=[];for(let K of Q){if(q(K)){let W=G.addParameter(K,[...X,"parameters"]);Y.push(W);continue}Y.push(K)}return Y},i=(Q,G,X)=>{if(!Q)return;let Y=[];for(let[K,W]of Object.entries(Q??{})){let F=E(W,"input",X);for(let[V,L]of Object.entries(F._zod.def.shape)){let M=G.addParameter(L,[...X,K,V],{location:{in:K,name:V}});Y.push(M)}}return Y},T=(Q)=>Q.startsWith("x-"),n=(Q,G,X)=>{if(!Q)return;let Y={};for(let[K,W]of Object.entries(Q)){if(T(K)){Y[K]=W;continue}Y[K]=G.addCallback(W,[...X,K])}return Y},o=(Q,G,X)=>{if(!Q)return;let Y={};for(let[K,W]of Object.entries(Q)){if(!W)continue;if(T(K)){Y[K]=W;continue}if("$ref"in W){Y[K]=W;continue}Y[K]=G.addResponse(W,[...X,K])}return Y},c=(Q,G,X)=>{let{parameters:Y,requestParams:K,requestBody:W,responses:F,callbacks:V,...L}=Q,M=L,H=$(Y,G,[...X,"parameters"]),N=i(K,G,[...X,"requestParams"]);if(N||H)M.parameters=[...N??[],...H??[]];let A=W&&G.addRequestBody(W,X);if(A)M.requestBody=A;let Z=o(F,G,[...X,"responses"]);if(Z)M.responses=Z;let J=n(V,G,[...X,"callbacks"]);if(J)M.callbacks=J;return M},R=(Q,G,X)=>{if(!Q)return;let Y={};for(let[K,W]of Object.entries(Q)){if(T(K)){Y[K]=W;continue}Y[K]=G.addPathItem(W,[...X,K])}return Y},S=["3.0.0","3.0.1","3.0.2","3.0.3","3.1.0","3.1.1"],_=(Q,G)=>S.indexOf(Q)>=S.indexOf(G),a=(Q)=>{let G=Q.zodSchema._zod.def;switch(G.type){case"bigint":Q.jsonSchema.type="integer",Q.jsonSchema.format="int64";break;case"union":{if("discriminator"in G&&typeof G.discriminator==="string"){Q.jsonSchema.oneOf??=Q.jsonSchema.anyOf,delete Q.jsonSchema.anyOf,Q.jsonSchema.type="object",Q.jsonSchema.discriminator={propertyName:G.discriminator};let Y={};for(let[K,W]of Object.entries(Q.jsonSchema.oneOf)){let F=W.$ref;if(!F){delete Q.jsonSchema.discriminator;return}let V=G.options[Number(K)]._zod.propValues?.[G.discriminator];if(!V?.size)return;for(let L of[...V??[]]){if(typeof L!=="string"&&typeof L!=="number"&&typeof L!=="boolean")return;Y[String(L)]=F}}Q.jsonSchema.discriminator.mapping=Y}let X=z.get(Q.zodSchema);if(typeof X?.unionOneOf==="boolean"){if(X.unionOneOf)Q.jsonSchema.oneOf=Q.jsonSchema.anyOf,delete Q.jsonSchema.anyOf;delete Q.jsonSchema.unionOneOf}break}case"date":Q.jsonSchema.type="string";break;case"literal":if(G.values.includes(void 0))break;break;case"undefined":Q.jsonSchema.not={};break}},l=(Q,G,X)=>{if(X.context&&Q.zodSchema._zod.parent!==X.context.zodSchema){if(X.context.zodSchema._zod.def.type==="pipe")throw Error(`Zod transform found at ${X.context.path.join(" > ")} are not supported in output schemas. Please use \`.overwrite()\` or wrap the schema in a \`.pipe()\` or assign it manual metadata with \`.meta()\``);throw Error(`Zod schema of type \`${X.context.zodSchema._zod.def.type}\` at ${X.context?.path.join(" > ")} cannot be represented in OpenAPI. Please assign it metadata with \`.meta()\``)}if(X.context=void 0,Object.keys(Q.jsonSchema).length)return;let Y=Q.zodSchema._zod.def,K=G.allowEmptySchema?.[Y.type];if(K===!0||K?.[Q.io])return;switch(Y.type){case"optional":l({...Q,zodSchema:Y.innerType},G,X);return;case"any":return;case"unknown":return;case"pipe":if(Q.io==="output"){if(!Q.zodSchema._zod.parent){X.context=Q;return}}return;case"transform":if(Q.io==="output")return;break;case"literal":if(Y.values.includes(void 0))throw Error(`Zod literal at ${Q.path.join(" > ")} cannot include \`undefined\` as a value. Please use \`z.undefined()\` or \`.optional()\` instead.`);return;case"custom":if(!Q.zodSchema._zod.parent){X.context=Q;return}}throw Error(`Zod schema of type \`${Y.type}\` at ${Q.path.join(" > ")} cannot be represented in OpenAPI. Please assign it metadata with \`.meta()\``)},r=(Q,G,X,Y)=>{let K=new Map;if(X.io==="input")return K;let W=new Map,F=new Map;for(let[V,L]of Object.entries(Q)){let M=JSON.stringify(L),H=new RegExp(`"${Y}([^"]+)"`,"g"),N=M.matchAll(H),A=new Set;for(let Z of N){let J=Z[1];if(J!==V)A.add(J)}F.set(V,M),W.set(V,{dependencies:A})}for(let[V]of F){if(!X.registry.components.schemas.ids.get(V))continue;if(x(W,F,X.registry,V))continue;let L=G.get(V)??`${V}${X.opts.outputIdSuffix??"Output"}`;K.set(V,L),Q[L]=Q[V],delete Q[V]}return K},x=(Q,G,X,Y,K=new Set)=>{if(K.has(Y))return!0;let W=Q.get(Y);if(W.pure!==void 0)return W.pure;let F=G.get(Y),V=X.components.schemas.ids.get(Y);if(V&&F!==JSON.stringify(V))return W.pure=!1,!1;K.add(Y);let L=[...W.dependencies].every((M)=>x(Q,G,X,M,new Set(K)));return W.pure=L,L},s=(Q,G={})=>{G.registry??=P({schemas:G.schemaComponents}),G.opts??={},G.io??="output";let X=Object.fromEntries(G.registry.components.schemas[G.io]),Y={zodOpenApiCreateSchema:{zodType:Q}};Object.assign(Y,X);let K=g(Y,{registry:G.registry,io:G.io,opts:{...G.opts,schemaRefPath:G.schemaRefPath},openapiVersion:G.openapiVersion});return{schema:K.schemas.zodOpenApiCreateSchema,components:K.components}},t=["param","header","unusedIO","override","outputId"],e=(Q)=>{t.forEach((G)=>{delete Q[G]})},v=(Q)=>{delete Q.$schema,delete Q.id,delete Q.$id},g=(Q,G)=>{let X=G.opts.schemaRefPath??"#/components/schemas/",Y={};for(let[D,{zodType:w}]of Object.entries(Q))Y[D]=w;let K=j();K.add(k(Y),{id:"zodOpenApiCreateSchema"});for(let[D,{zodType:w}]of G.registry.components.schemas.manual)K.add(w,{id:D});let W=new Map,F=_(G.openapiVersion??"3.1.0","3.1.0")?"$defs":"definitions",V={},L=u(K,{override(D){let w=z.get(D.zodSchema);if(w?.outputId&&w?.id)W.set(w.id,w.outputId);if(D.jsonSchema.$ref)return;let B={...D,io:G.io};if(a(B),typeof G.opts.override==="function")G.opts.override(B);if(typeof w?.override==="function")w.override(B),delete D.jsonSchema.override;if(typeof w?.override==="object"&&w.override!==null)Object.assign(D.jsonSchema,w.override),delete D.jsonSchema.override;v(D.jsonSchema),e(D.jsonSchema),l(B,G.opts,V)},io:G.io,unrepresentable:"any",reused:G.opts.reused,cycles:G.opts.cycles,target:_(G.openapiVersion??"3.1.0","3.1.0")?void 0:"openapi-3.0",uri:(D)=>D==="__shared"?`#ZOD_OPENAPI/${D}`:`#ZOD_OPENAPI/__shared#/${F}/${D}`}),M=L.schemas.__shared?.[F]??{};L.schemas.__shared??={[F]:M};let H=new Map;for(let[D,w]of Object.entries(M))if(v(w),/^schema\d+$/.test(D)){let B=`__schema${G.registry.components.schemas.dynamicSchemaCount++}`;if(H.set(D,`"${X}${B}"`),B!==D)M[B]=w,delete M[D]}for(let[D]of G.registry.components.schemas.manual){let w=L.schemas[D];if(!w)continue;v(w)}let N={},A=JSON.parse(JSON.stringify(L).replace(/"#ZOD_OPENAPI\/__shared#\/(?:\$defs|definitions)\/([^"]+)"/g,(D,w)=>{let B=H.get(w);if(B)return B;if(G.registry.components.schemas.manual.get(w))N[w]=!0;return`"${X}${w}"`})),Z=A.schemas.__shared?.[F]??{};A.schemas.__shared??={[F]:Z};for(let[D]of G.registry.components.schemas.manual){let w=A.schemas[D];if(!w)continue;if(N[D]){if(Z[D])throw Error(`Component "${D}" is already registered as a component in the registry`);Z[D]=w}}let J=r(Z,W,G,X);if(!J.size){let D=A.schemas.zodOpenApiCreateSchema?.properties;return delete A.schemas.zodOpenApiCreateSchema,delete A.schemas.__shared,{schemas:D,components:Z,manual:A.schemas}}let U=JSON.parse(JSON.stringify(A).replace(new RegExp(`"${X}([^"]+)"`,"g"),(D,w)=>{let B=J.get(w);if(B)return`"${X}${B}"`;return`"${X}${w}"`})),I=U.schemas.zodOpenApiCreateSchema?.properties,h=U.schemas.__shared?.[F]??{};return delete U.schemas.zodOpenApiCreateSchema,delete U.schemas.__shared,{schemas:I,components:h,manual:U.schemas}},P=(Q)=>{let G={components:{schemas:{dynamicSchemaCount:0,input:new Map,output:new Map,ids:new Map,manual:new Map},headers:{ids:new Map,seen:new WeakMap},requestBodies:{ids:new Map,seen:new WeakMap},responses:{ids:new Map,seen:new WeakMap},parameters:{ids:new Map,seen:new WeakMap},callbacks:{ids:new Map,seen:new WeakMap},pathItems:{ids:new Map,seen:new WeakMap},securitySchemes:{ids:new Map,seen:new WeakMap},links:{ids:new Map,seen:new WeakMap},examples:{ids:new Map,seen:new WeakMap}},addSchema:(X,Y,K)=>{let W={};return G.components.schemas[K.io].set(Y.join(" > "),{schemaObject:W,zodType:X,source:{path:Y,...K?.source}}),W},addParameter:(X,Y,K)=>{let W=G.components.parameters.seen.get(X);if(W)return W;let F=z.get(X),V=K?.location?.name??F?.param?.name,L=K?.location?.in??F?.param?.in;if(K?.location?.name&&F?.param?.name||K?.location?.in&&F?.param?.in)throw Error(`Parameter at ${Y.join(" > ")} has both \`.meta({ param: { name, in } })\` and \`.meta({ param: { location: { in, name } } })\` information`);if(!V||!L)throw Error(`Parameter at ${Y.join(" > ")} is missing \`.meta({ param: { name, in } })\` information`);let M=G.addSchema(X,[...Y,L,V,"schema"],{io:"input",source:{type:"parameter",location:{in:L,name:V}}}),{id:H,examples:N,...A}=F?.param??{},Z={in:L,name:V,schema:M,...A},J=b(N,G,[...Y,L,V,"examples"]);if(J)Z.examples=J;if(f(X,"input"))Z.required=!0;if(!Z.description&&F?.description)Z.description=F.description;let U=H??K?.manualId;if(U){if(G.components.parameters.ids.has(U))throw Error(`Schema "${U}" at ${Y.join(" > ")} is already registered`);let I={$ref:`#/components/parameters/${U}`};if(G.components.parameters.seen.set(X,I),G.components.parameters.ids.set(U,Z),K?.manualId)return Z;return I}if(K?.location?.name||K?.location?.in)return Z;return G.components.parameters.seen.set(X,Z),Z},addHeader:(X,Y,K)=>{let W=G.components.headers.seen.get(X);if(W)return W;let F=z.get(X),{id:V,...L}=F?.header??{},M=V??K?.manualId,H=L;if(f(X,"output"))H.required=!0;if(!H.description&&F?.description)H.description=F.description;if(H.schema=G.addSchema(X,[...Y,"schema"],{io:"output",source:{type:"header"}}),M){if(G.components.schemas.ids.has(M))throw Error(`Schema "${M}" at ${Y.join(" > ")} is already registered`);let N={$ref:`#/components/headers/${M}`};if(G.components.headers.ids.set(M,H),G.components.headers.seen.set(X,N),K?.manualId)return H;return N}return G.components.headers.seen.set(X,H),H},addRequestBody:(X,Y,K)=>{let W=G.components.requestBodies.seen.get(X);if(W)return W;let{content:F,id:V,...L}=X,M={...L,content:C(F,{registry:G,io:"input"},[...Y,"content"])},H=V??K?.manualId;if(H){if(G.components.requestBodies.ids.has(H))throw Error(`RequestBody "${H}" at ${Y.join(" > ")} is already registered`);let N={$ref:`#/components/requestBodies/${H}`};if(G.components.requestBodies.ids.set(H,M),G.components.requestBodies.seen.set(X,N),K?.manualId)return M;return N}return G.components.requestBodies.seen.set(X,M),M},addPathItem:(X,Y,K)=>{let W=G.components.pathItems.seen.get(X);if(W)return W;let F={},{id:V,...L}=X,M=V??K?.manualId;for(let[H,N]of Object.entries(L)){if(T(H)){F[H]=N;continue}if(H==="get"||H==="put"||H==="post"||H==="delete"||H==="options"||H==="head"||H==="patch"||H==="trace"){F[H]=c(N,G,[...Y,H]);continue}if(H==="parameters"){F[H]=$(N,G,[...Y,H]);continue}F[H]=N}if(M){if(G.components.pathItems.ids.has(M))throw Error(`PathItem "${M}" at ${Y.join(" > ")} is already registered`);let H={$ref:`#/components/pathItems/${M}`};if(G.components.pathItems.ids.set(M,F),G.components.pathItems.seen.set(X,H),K?.manualId)return F;return H}return G.components.pathItems.seen.set(X,F),F},addResponse:(X,Y,K)=>{let W=G.components.responses.seen.get(X);if(W)return W;let{content:F,headers:V,links:L,id:M,...H}=X,N=H,A=m(V,G,[...Y,"headers"]);if(A)N.headers=A;if(F)N.content=C(F,{registry:G,io:"output"},[...Y,"content"]);if(L)N.links=p(L,G,[...Y,"links"]);let Z=M??K?.manualId;if(Z){if(G.components.responses.ids.has(Z))throw Error(`Response "${Z}" at ${Y.join(" > ")} is already registered`);let J={$ref:`#/components/responses/${Z}`};if(G.components.responses.ids.set(Z,N),G.components.responses.seen.set(X,J),K?.manualId)return N;return J}return G.components.responses.seen.set(X,N),N},addCallback:(X,Y,K)=>{let W=G.components.callbacks.seen.get(X);if(W)return W;let{id:F,...V}=X,L={};for(let[H,N]of Object.entries(V)){if(T(H)){L[H]=N;continue}L[H]=G.addPathItem(N,[...Y,H])}let M=F??K?.manualId;if(M){if(G.components.callbacks.ids.has(M))throw Error(`Callback "${M}" at ${Y.join(" > ")} is already registered`);let H={$ref:`#/components/callbacks/${M}`};if(G.components.callbacks.ids.set(M,L),G.components.callbacks.seen.set(X,H),K?.manualId)return L;return H}return G.components.callbacks.seen.set(X,L),L},addSecurityScheme:(X,Y,K)=>{let W=G.components.securitySchemes.seen.get(X);if(W)return W;let{id:F,...V}=X,L=V,M=F??K?.manualId;if(M){if(G.components.securitySchemes.ids.has(M))throw Error(`SecurityScheme "${M}" at ${Y.join(" > ")} is already registered`);let H={$ref:`#/components/securitySchemes/${M}`};if(G.components.securitySchemes.ids.set(M,L),G.components.securitySchemes.seen.set(X,H),K?.manualId)return L;return H}return G.components.securitySchemes.seen.set(X,L),L},addLink:(X,Y,K)=>{let W=G.components.links.seen.get(X);if(W)return W;let{id:F,...V}=X,L=V,M=F??K?.manualId;if(M){if(G.components.links.ids.has(M))throw Error(`Link "${M}" at ${Y.join(" > ")} is already registered`);let H={$ref:`#/components/links/${M}`};if(G.components.links.ids.set(M,L),G.components.links.seen.set(X,H),K?.manualId)return L;return H}return G.components.links.seen.set(X,L),L},addExample:(X,Y,K)=>{let W=G.components.examples.seen.get(X);if(W)return W;let{id:F,...V}=X,L=V,M=F??K?.manualId;if(M){if(G.components.examples.ids.has(M))throw Error(`Example "${M}" at ${Y.join(" > ")} is already registered`);let H={$ref:`#/components/examples/${M}`};if(G.components.examples.ids.set(M,L),G.components.examples.seen.set(X,H),K?.manualId)return L;return H}return G.components.examples.seen.set(X,L),L}};return GG(Q?.schemas,G),QG(Q?.parameters,G),XG(Q?.headers,G),YG(Q?.responses,G),FG(Q?.pathItems,G),KG(Q?.requestBodies,G),WG(Q?.callbacks,G),HG(Q?.securitySchemes,G),MG(Q?.links,G),LG(Q?.examples,G),G},GG=(Q,G)=>{if(!Q)return;for(let[X,Y]of Object.entries(Q)){if(q(Y)){let K=z.get(Y)?.id??X;G.components.schemas.manual.set(K,{input:{schemaObject:{}},output:{schemaObject:{}},zodType:Y});continue}G.components.schemas.ids.set(X,Y)}},QG=(Q,G)=>{if(!Q)return;for(let[X,Y]of Object.entries(Q)){if(q(Y)){let K=["components","parameters",X];G.addParameter(Y,K,{manualId:X});continue}G.components.parameters.ids.set(X,Y)}},XG=(Q,G)=>{if(!Q)return;for(let[X,Y]of Object.entries(Q)){if(q(Y)){let K=["components","headers",X];G.addHeader(Y,K,{manualId:X});continue}G.components.headers.ids.set(X,Y)}},YG=(Q,G)=>{if(!Q)return;for(let[X,Y]of Object.entries(Q)){let K=G.addResponse(Y,["components","responses",X],{manualId:X});G.components.responses.ids.set(X,K),G.components.responses.seen.set(Y,K)}},KG=(Q,G)=>{if(!Q)return;for(let[X,Y]of Object.entries(Q)){if(q(Y)){G.addRequestBody(Y,["components","requestBodies",X],{manualId:X});continue}G.components.requestBodies.ids.set(X,Y)}},WG=(Q,G)=>{if(!Q)return;for(let[X,Y]of Object.entries(Q))G.addCallback(Y,["components","callbacks",X],{manualId:X})},FG=(Q,G)=>{if(!Q)return;for(let[X,Y]of Object.entries(Q))G.addPathItem(Y,["components","pathItems",X],{manualId:X})},HG=(Q,G)=>{if(!Q)return;for(let[X,Y]of Object.entries(Q))G.addSecurityScheme(Y,["components","securitySchemes",X],{manualId:X})},MG=(Q,G)=>{if(!Q)return;for(let[X,Y]of Object.entries(Q))G.addLink(Y,["components","links",X],{manualId:X})},LG=(Q,G)=>{if(!Q)return;for(let[X,Y]of Object.entries(Q))G.components.examples.ids.set(X,Y)},O=(Q)=>{let{schemas:G,components:X,manual:Y}=g(Object.fromEntries(Q.registry.components.schemas[Q.io]),Q);for(let[K,W]of Object.entries(X))Q.registry.components.schemas.ids.set(K,W);for(let[K,W]of Object.entries(G)){let F=Q.registry.components.schemas[Q.io].get(K);if(F)Object.assign(F.schemaObject,W)}for(let[K,W]of Object.entries(Y)){let F=Q.registry.components.schemas.manual.get(K);if(!F)continue;if(X[K])F[Q.io].used=!0;Object.assign(F[Q.io].schemaObject,W)}},VG=(Q)=>{for(let[G,X]of Q.components.schemas.manual)if(!X.input.used){let Y=X[z.get(X.zodType)?.unusedIO??"output"].schemaObject;Q.components.schemas.ids.set(G,Y)}},d=(Q,G,X)=>{O({registry:Q,io:"input",opts:G,openapiVersion:X}),O({registry:Q,io:"output",opts:G,openapiVersion:X}),VG(Q);let Y={};if(Q.components.schemas.ids.size>0)Y.schemas=Object.fromEntries(Q.components.schemas.ids);if(Q.components.headers.ids.size>0)Y.headers=Object.fromEntries(Q.components.headers.ids);if(Q.components.requestBodies.ids.size>0)Y.requestBodies=Object.fromEntries(Q.components.requestBodies.ids);if(Q.components.responses.ids.size>0)Y.responses=Object.fromEntries(Q.components.responses.ids);if(Q.components.parameters.ids.size>0)Y.parameters=Object.fromEntries(Q.components.parameters.ids);if(Q.components.callbacks.ids.size>0)Y.callbacks=Object.fromEntries(Q.components.callbacks.ids);if(Q.components.pathItems.ids.size>0)Y.pathItems=Object.fromEntries(Q.components.pathItems.ids);if(Q.components.securitySchemes.ids.size>0)Y.securitySchemes=Object.fromEntries(Q.components.securitySchemes.ids);if(Q.components.links.ids.size>0)Y.links=Object.fromEntries(Q.components.links.ids);if(Q.components.examples.ids.size>0)Y.examples=Object.fromEntries(Q.components.examples.ids);return Y};var AG=(Q,G={})=>{let{paths:X,webhooks:Y,components:K,...W}=Q,F=W,V=P(K),L=R(X,V,["paths"]);if(L)F.paths=L;let M=R(Y,V,["webhooks"]);if(M)F.webhooks=M;let H=d(V,G,Q.openapi);if(Object.keys(H).length>0)F.components=H;return F},JG={};export{JG as oas31,s as createSchema,AG as createDocument};