superfactory 0.0.0-stage → 0.4.30

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 (308) hide show
  1. package/README.md +34 -2
  2. package/THIRD-PARTY-NOTICES.md +27604 -0
  3. package/bin/superfactory.js +57 -0
  4. package/cli/agent-rf446fr1.js +2 -0
  5. package/cli/agent-state-wv62c1td.js +2 -0
  6. package/cli/bin-0cvfmkhh.js +33 -0
  7. package/cli/bin-0t68hf99.js +3 -0
  8. package/cli/bin-19vpzq7g.js +4 -0
  9. package/cli/bin-37w316c6.js +3 -0
  10. package/cli/bin-3dsqxzbz.js +3 -0
  11. package/cli/bin-4j0jjd8g.js +3 -0
  12. package/cli/bin-4tdqjbbd.js +229 -0
  13. package/cli/bin-4zvje4sn.js +502 -0
  14. package/cli/bin-674kd343.js +7 -0
  15. package/cli/bin-8jdkg4ke.js +3 -0
  16. package/cli/bin-d99yte0j.js +5 -0
  17. package/cli/bin-fgvkq9cq.js +867 -0
  18. package/cli/bin-fkp3j5f3.js +3 -0
  19. package/cli/bin-fypan1f6.js +951 -0
  20. package/cli/bin-gg19acwr.js +4 -0
  21. package/cli/bin-ghp5x0x5.js +139 -0
  22. package/cli/bin-gk00mnmn.js +5 -0
  23. package/cli/bin-gne2w036.js +29 -0
  24. package/cli/bin-grxzwpe8.js +3 -0
  25. package/cli/bin-h57gajkz.js +8 -0
  26. package/cli/bin-mbpvzx2b.js +8 -0
  27. package/cli/bin-nnq8kd9z.js +4 -0
  28. package/cli/bin-ven2efjq.js +3 -0
  29. package/cli/bin-yqb1d1mw.js +22 -0
  30. package/cli/bin-z5b3tt05.js +20 -0
  31. package/cli/bin-za1by1n5.js +3 -0
  32. package/cli/bin-zpfe0pxz.js +1 -0
  33. package/cli/bin.js +3 -0
  34. package/cli/child-agent-qgeqvs03.js +4 -0
  35. package/cli/connect-chn8pxyf.js +2 -0
  36. package/cli/container-j6zr9gww.js +4 -0
  37. package/cli/dev-gsaehf19.js +7 -0
  38. package/cli/health-nqzge5kh.js +2 -0
  39. package/cli/home-lock-5seng0k3.js +2 -0
  40. package/cli/host-7dfjhf0z.js +1507 -0
  41. package/cli/index-1wseh1tm.js +2 -0
  42. package/cli/index-axfe8zef.js +2 -0
  43. package/cli/index-s9pw90xe.js +2 -0
  44. package/cli/install-17r8t45e.js +2 -0
  45. package/cli/join-551zg7yr.js +31 -0
  46. package/cli/local-server-2smsafvg.js +2 -0
  47. package/cli/machine-zfjmpw7h.js +2 -0
  48. package/cli/main-0mxhd968.js +33 -0
  49. package/cli/main-53qmhxmd.js +303 -0
  50. package/cli/move-to-xrr2b135.js +2 -0
  51. package/cli/npm-package.json +1 -0
  52. package/cli/pair-phone-070c9ztt.js +5 -0
  53. package/cli/prompt-psc4drtd.js +2 -0
  54. package/cli/reached-vwzx2cdg.js +2 -0
  55. package/cli/sessions-bm4mk37y.js +3 -0
  56. package/cli/sf-cli-s42gkp0b.js +2 -0
  57. package/cli/sf-db-r8f1a20b.js +23 -0
  58. package/cli/sf-deploy-wqaa4fdm.js +21 -0
  59. package/cli/sf-pr-rg3q3tn6.js +13 -0
  60. package/cli/sf-test-pff158qc.js +10 -0
  61. package/cli/tart-isolation-wr3xwfmw.js +3 -0
  62. package/cli/tray-4rr0y1dv.png +0 -0
  63. package/cli/tray-mac-offline-89dva0gs.png +0 -0
  64. package/cli/tray-mac-paused-hq3a1cxv.png +0 -0
  65. package/cli/tray-mac-tvtavf0g.png +0 -0
  66. package/cli/tray-offline-xj6b5ta4.png +0 -0
  67. package/cli/tray-paused-6pzdv5ze.png +0 -0
  68. package/cli/vm-keeper-p0ggcw3z.js +3 -0
  69. package/package.json +50 -4
  70. package/plugins/sf-video-review/.claude-plugin/plugin.json +17 -0
  71. package/plugins/sf-video-review/.mcp.json +9 -0
  72. package/plugins/sf-video-review/dist/video-review.mjs +135 -0
  73. package/plugins/sf-video-review/skills/video-review/SKILL.md +65 -0
  74. package/plugins/sf-video-studio/.claude-plugin/plugin.json +17 -0
  75. package/plugins/sf-video-studio/.mcp.json +19 -0
  76. package/plugins/sf-video-studio/dist/demo-video.mjs +139 -0
  77. package/plugins/sf-video-studio/dist/narration-voice.mjs +134 -0
  78. package/plugins/sf-video-studio/dist/video-generation.mjs +131 -0
  79. package/plugins/sf-video-studio/fonts/DejaVuSansMono-Bold.ttf +0 -0
  80. package/plugins/sf-video-studio/fonts/DejaVuSansMono.ttf +0 -0
  81. package/plugins/sf-video-studio/fonts/LICENSE-DejaVu +187 -0
  82. package/plugins/sf-video-studio/hooks/hooks.json +17 -0
  83. package/plugins/sf-video-studio/hooks/no-robot-voice.sh +77 -0
  84. package/plugins/sf-video-studio/kokoro/package-lock.json +1137 -0
  85. package/plugins/sf-video-studio/kokoro/package.json +11 -0
  86. package/plugins/sf-video-studio/skills/demo-video/SKILL.md +101 -0
  87. package/plugins/sf-video-studio/skills/narration-voice/SKILL.md +49 -0
  88. package/plugins/sf-video-studio/skills/video-generation/SKILL.md +30 -0
  89. package/server/dist/account.js +3 -0
  90. package/server/dist/backup-process.js +2 -0
  91. package/server/dist/backup.js +3 -0
  92. package/server/dist/chunk-0tbq288f.js +3055 -0
  93. package/server/dist/chunk-18n7tr66.js +3 -0
  94. package/server/dist/chunk-1kgfrgmv.js +3 -0
  95. package/server/dist/chunk-1rnmxaav.js +209 -0
  96. package/server/dist/chunk-26zhqbyn.js +25 -0
  97. package/server/dist/chunk-34mn2zj2.js +2 -0
  98. package/server/dist/chunk-3psgsw9t.js +2 -0
  99. package/server/dist/chunk-8zbwppny.js +391 -0
  100. package/server/dist/chunk-9pn7q001.js +3 -0
  101. package/server/dist/chunk-9y7a9gkf.js +2 -0
  102. package/server/dist/chunk-bhm6jzch.js +8 -0
  103. package/server/dist/chunk-dbzjsqvb.js +17 -0
  104. package/server/dist/chunk-fxn504n0.js +2 -0
  105. package/server/dist/chunk-g6pwaap3.js +2 -0
  106. package/server/dist/chunk-gefgv8rg.js +7 -0
  107. package/server/dist/chunk-jg8b833v.js +2 -0
  108. package/server/dist/chunk-jy148bhn.js +3 -0
  109. package/server/dist/chunk-ky4nz39j.js +7 -0
  110. package/server/dist/chunk-mbd1y9qk.js +2 -0
  111. package/server/dist/chunk-neyhk32g.js +13 -0
  112. package/server/dist/chunk-nrz953bx.js +2 -0
  113. package/server/dist/chunk-padvv31s.js +2 -0
  114. package/server/dist/chunk-q1s2ez77.js +3 -0
  115. package/server/dist/chunk-q403h2bh.js +10 -0
  116. package/server/dist/chunk-t64r6enn.js +4 -0
  117. package/server/dist/chunk-vccappg7.js +59 -0
  118. package/server/dist/chunk-vj60fbhw.js +2 -0
  119. package/server/dist/chunk-xj26rwda.js +3 -0
  120. package/server/dist/chunk-xyw98jst.js +5 -0
  121. package/server/dist/main.js +43 -0
  122. package/server/dist/move.js +3 -0
  123. package/server/drizzle/pg/0000_baseline.sql +632 -0
  124. package/server/drizzle/pg/0001_transcripts_packed.sql +2 -0
  125. package/server/drizzle/pg/0002_vm_server_origin.sql +1 -0
  126. package/server/drizzle/pg/0003_reached_machines.sql +1 -0
  127. package/server/drizzle/pg/0004_link_records.sql +2 -0
  128. package/server/drizzle/pg/0005_task_columns.sql +7 -0
  129. package/server/drizzle/pg/0006_task_bundle.sql +3 -0
  130. package/server/drizzle/pg/0007_server_log.sql +9 -0
  131. package/server/drizzle/pg/0008_notification_pauses.sql +6 -0
  132. package/server/drizzle/pg/0009_vm_replaces.sql +1 -0
  133. package/server/drizzle/pg/0010_question_told_once.sql +10 -0
  134. package/server/drizzle/pg/0011_node_next_key.sql +3 -0
  135. package/server/drizzle/pg/0012_task_work.sql +8 -0
  136. package/server/drizzle/pg/0013_task_secret_grants.sql +9 -0
  137. package/server/drizzle/pg/0014_node_paused.sql +2 -0
  138. package/server/drizzle/pg/0015_ssh_machines.sql +19 -0
  139. package/server/drizzle/pg/0016_node_wake.sql +1 -0
  140. package/server/drizzle/pg/0017_node_uninstall_key.sql +1 -0
  141. package/server/drizzle/pg/0018_release_starts.sql +6 -0
  142. package/server/drizzle/pg/0019_session_memory.sql +7 -0
  143. package/server/drizzle/pg/meta/_journal.json +146 -0
  144. package/server/drizzle/sqlite/0000_pre_drizzle_schema.sql +351 -0
  145. package/server/drizzle/sqlite/0001_cluster.sql +36 -0
  146. package/server/drizzle/sqlite/0002_task_records.sql +22 -0
  147. package/server/drizzle/sqlite/0003_indexes.sql +12 -0
  148. package/server/drizzle/sqlite/0004_project_machines.sql +19 -0
  149. package/server/drizzle/sqlite/0005_session_events.sql +7 -0
  150. package/server/drizzle/sqlite/0006_task_platforms.sql +8 -0
  151. package/server/drizzle/sqlite/0007_session_event_tags.sql +7 -0
  152. package/server/drizzle/sqlite/0008_sprints.sql +7 -0
  153. package/server/drizzle/sqlite/0009_project_vms.sql +19 -0
  154. package/server/drizzle/sqlite/0010_server_repairs.sql +4 -0
  155. package/server/drizzle/sqlite/0011_drop_todos.sql +2 -0
  156. package/server/drizzle/sqlite/0012_hypervisors.sql +14 -0
  157. package/server/drizzle/sqlite/0013_manager_leads.sql +2 -0
  158. package/server/drizzle/sqlite/0014_session_text.sql +35 -0
  159. package/server/drizzle/sqlite/0015_vm_resize_machine_instructions_access.sql +22 -0
  160. package/server/drizzle/sqlite/0016_tunnel.sql +23 -0
  161. package/server/drizzle/sqlite/0017_session_secret_grants.sql +7 -0
  162. package/server/drizzle/sqlite/0018_https.sql +18 -0
  163. package/server/drizzle/sqlite/0019_secret_grant_runs.sql +1 -0
  164. package/server/drizzle/sqlite/0020_session_transcripts.sql +16 -0
  165. package/server/drizzle/sqlite/0021_claude_signed_out.sql +2 -0
  166. package/server/drizzle/sqlite/0022_machine_disabled.sql +1 -0
  167. package/server/drizzle/sqlite/0023_machine_access_granted_by.sql +1 -0
  168. package/server/drizzle/sqlite/0024_machine_vms.sql +27 -0
  169. package/server/drizzle/sqlite/0025_machine_tunnel_fallback.sql +1 -0
  170. package/server/drizzle/sqlite/0026_tunnel_peer_linked.sql +3 -0
  171. package/server/drizzle/sqlite/0027_tunnel_upgrade_grace.sql +2 -0
  172. package/server/drizzle/sqlite/0028_dialed_machines.sql +2 -0
  173. package/server/drizzle/sqlite/0029_node_link.sql +3 -0
  174. package/server/drizzle/sqlite/0030_sprint_calendar.sql +1 -0
  175. package/server/drizzle/sqlite/0031_transcripts_packed.sql +2 -0
  176. package/server/drizzle/sqlite/0032_vm_server_origin.sql +1 -0
  177. package/server/drizzle/sqlite/meta/_journal.json +237 -0
  178. package/server/src/account.ts +2 -0
  179. package/server/src/backup.ts +2 -0
  180. package/server/src/features/backups/backup-process.ts +2 -0
  181. package/server/src/main.ts +2 -0
  182. package/server/src/move.ts +2 -0
  183. package/ui/dist/_expo/static/css/global-d378e211074d97e633bc15418ccf57d4.css +2 -0
  184. package/ui/dist/_expo/static/css/xterm-8a7c4e0dca731c11dbe6bdff98fb667c.css +1 -0
  185. package/ui/dist/_expo/static/js/web/Network-f300a5960620f5029c91c06cae29dba5.js +3 -0
  186. package/ui/dist/_expo/static/js/web/[...rest]-9e454d985f211f5c983f42bec15b6ad9.js +1 -0
  187. package/ui/dist/_expo/static/js/web/[managerId]-2580b90e8d862ad66197eecb1dc04a12.js +1 -0
  188. package/ui/dist/_expo/static/js/web/[managerId]-39308153b42eed025c0abb9242ae6c71.js +1 -0
  189. package/ui/dist/_expo/static/js/web/[managerId]-8b7a94ec818e50a371b6b2750b73df6a.js +1 -0
  190. package/ui/dist/_expo/static/js/web/[managerId]-ac3a14c7607e4576d7e6c39c1014bcaf.js +1 -0
  191. package/ui/dist/_expo/static/js/web/[managerId]-e8549b2313a119437c373e30207518c0.js +1 -0
  192. package/ui/dist/_expo/static/js/web/[ref]-9b46f1ec4348f980e9838b68d47c34bf.js +2 -0
  193. package/ui/dist/_expo/static/js/web/[sessionId]-09e376674fb8b3edc4ae8aa9b3a189d7.js +1 -0
  194. package/ui/dist/_expo/static/js/web/[sessionId]-0e5fdba25c9f78220cea4cb66227743d.js +1 -0
  195. package/ui/dist/_expo/static/js/web/[sessionId]-104af3c3885009e6a8d204b6fd6e2c3a.js +1 -0
  196. package/ui/dist/_expo/static/js/web/[sessionId]-863a34ca3835b469134ddbc4ebc6fafc.js +1 -0
  197. package/ui/dist/_expo/static/js/web/[taskId]-1218e1dd3ecf175ffb7701fc886d62c9.js +1 -0
  198. package/ui/dist/_expo/static/js/web/[taskId]-31a48c7017dbd096f8ece9dc102a9762.js +1 -0
  199. package/ui/dist/_expo/static/js/web/[taskId]-a56cf85bcfd14f2d6b5d4180ea17e8d7.js +1 -0
  200. package/ui/dist/_expo/static/js/web/[taskId]-f2a157b3cb676b3c5d04c8eadfe90cdd.js +1 -0
  201. package/ui/dist/_expo/static/js/web/__common-1ad58e53e08528a67b99f53a1690b669.js +2078 -0
  202. package/ui/dist/_expo/static/js/web/__expo-metro-runtime-1f8f5d3ca6b7f58204d51e14506d73fb.js +5 -0
  203. package/ui/dist/_expo/static/js/web/_layout-057457e97e0af20433ed41b39cb5e809.js +1 -0
  204. package/ui/dist/_expo/static/js/web/_layout-2a7d73d5356823e1f7d2dab23e440d09.js +7 -0
  205. package/ui/dist/_expo/static/js/web/_layout-42e6a6b7855655d456015ce41aefdd39.js +1 -0
  206. package/ui/dist/_expo/static/js/web/_layout-a5e5a5b2fb3bfbfcc2914131976679e7.js +1 -0
  207. package/ui/dist/_expo/static/js/web/_layout-b2cbba92506f66815a5d744fd7cd5d8c.js +1 -0
  208. package/ui/dist/_expo/static/js/web/_layout-b4d13dc52bbcb65b18b4e52813d53883.js +198 -0
  209. package/ui/dist/_expo/static/js/web/_layout-fb0f75b354800de2e1582dc963f5c148.js +1 -0
  210. package/ui/dist/_expo/static/js/web/index-41299a961569cc8e5410ec53ba2b87c4.js +4 -0
  211. package/ui/dist/_expo/static/js/web/index-6c2bb0d3b6d00c5c007a663e9f4ce108.js +1 -0
  212. package/ui/dist/_expo/static/js/web/index-70484f7d2769d9ae01dac1fdb22aef1d.js +14 -0
  213. package/ui/dist/_expo/static/js/web/index-7d764cb7cefe0a217728c24d44990057.js +14 -0
  214. package/ui/dist/_expo/static/js/web/index-a5eb3d0c6aa4c483674beb5de428634c.js +12 -0
  215. package/ui/dist/_expo/static/js/web/index-b1c2543003cba86eeb3abfa4d21fd8da.js +14 -0
  216. package/ui/dist/_expo/static/js/web/index-d200aded5448966e5e05d9ccb77b56a4.js +5 -0
  217. package/ui/dist/_expo/static/js/web/index-ea43f51ceec4a981c942fc6dce9cedc4.js +2378 -0
  218. package/ui/dist/_expo/static/js/web/index-efa68d817a7febbf8c0163303bf4cd49.js +29 -0
  219. package/ui/dist/_expo/static/js/web/licenses-30f8c0555f7f4d434a68ee4706fa433d.js +1 -0
  220. package/ui/dist/_expo/static/js/web/pair-3f6f72208023894f43f4f07db5116cca.js +1 -0
  221. package/ui/dist/_expo/static/js/web/rich-markdown-editor-dea9c0f7c0306da4146e54ee44cce173.js +228 -0
  222. package/ui/dist/_expo/static/js/web/sign-in-67d2a0c00232e0e6f40efade1a83dc4b.js +4 -0
  223. package/ui/dist/_expo/static/js/web/terminal-view-32db8e6f8a21dd073f6a310862d36db8.js +90 -0
  224. package/ui/dist/apple-touch-icon.png +0 -0
  225. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+geist-mono@0.4.3-2a25012349fb7712/node_modules/@expo-google-fonts/geist-mono/100Thin/GeistMono_100Thin.95eed4519d8c395e41b3b837ca97edea.ttf +0 -0
  226. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+geist-mono@0.4.3-2a25012349fb7712/node_modules/@expo-google-fonts/geist-mono/100Thin_Italic/GeistMono_100Thin_Italic.2e50fb9a43d70ceb4925a2c54502097c.ttf +0 -0
  227. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+geist-mono@0.4.3-2a25012349fb7712/node_modules/@expo-google-fonts/geist-mono/200ExtraLight/GeistMono_200ExtraLight.0714ea94ac265d76bc16698dd1808599.ttf +0 -0
  228. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+geist-mono@0.4.3-2a25012349fb7712/node_modules/@expo-google-fonts/geist-mono/200ExtraLight_Italic/GeistMono_200ExtraLight_Italic.107f2670e94507223548f1d38eb14087.ttf +0 -0
  229. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+geist-mono@0.4.3-2a25012349fb7712/node_modules/@expo-google-fonts/geist-mono/300Light/GeistMono_300Light.d6a3533adfd5834dd9f68ee37faa1e2d.ttf +0 -0
  230. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+geist-mono@0.4.3-2a25012349fb7712/node_modules/@expo-google-fonts/geist-mono/300Light_Italic/GeistMono_300Light_Italic.09420cdceda8d1f1612daceae1e4890e.ttf +0 -0
  231. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+geist-mono@0.4.3-2a25012349fb7712/node_modules/@expo-google-fonts/geist-mono/400Regular/GeistMono_400Regular.3656dcb247d3a6cd141f7601c2101125.ttf +0 -0
  232. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+geist-mono@0.4.3-2a25012349fb7712/node_modules/@expo-google-fonts/geist-mono/400Regular_Italic/GeistMono_400Regular_Italic.88343c321b266476ad3bc56735cc6ac7.ttf +0 -0
  233. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+geist-mono@0.4.3-2a25012349fb7712/node_modules/@expo-google-fonts/geist-mono/500Medium/GeistMono_500Medium.a298cd61aebdb709299e2a7deb73ed93.ttf +0 -0
  234. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+geist-mono@0.4.3-2a25012349fb7712/node_modules/@expo-google-fonts/geist-mono/500Medium_Italic/GeistMono_500Medium_Italic.e149441dd9360bd7dbffeb1de9aa1685.ttf +0 -0
  235. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+geist-mono@0.4.3-2a25012349fb7712/node_modules/@expo-google-fonts/geist-mono/600SemiBold/GeistMono_600SemiBold.cae945cb3b6156e396a1008b6252af21.ttf +0 -0
  236. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+geist-mono@0.4.3-2a25012349fb7712/node_modules/@expo-google-fonts/geist-mono/600SemiBold_Italic/GeistMono_600SemiBold_Italic.e939ba436795ee2f0a379e7271bb957d.ttf +0 -0
  237. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+geist-mono@0.4.3-2a25012349fb7712/node_modules/@expo-google-fonts/geist-mono/700Bold/GeistMono_700Bold.7fcc8478bc1dcadc865d97626ba3206b.ttf +0 -0
  238. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+geist-mono@0.4.3-2a25012349fb7712/node_modules/@expo-google-fonts/geist-mono/700Bold_Italic/GeistMono_700Bold_Italic.8cc57ff1f3c45e7ed84e74853c141e06.ttf +0 -0
  239. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+geist-mono@0.4.3-2a25012349fb7712/node_modules/@expo-google-fonts/geist-mono/800ExtraBold/GeistMono_800ExtraBold.b09b5457204e06ea7bacff03f0880065.ttf +0 -0
  240. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+geist-mono@0.4.3-2a25012349fb7712/node_modules/@expo-google-fonts/geist-mono/800ExtraBold_Italic/GeistMono_800ExtraBold_Italic.0b4dd8c1b0e6d8791ea34c8f1417edfd.ttf +0 -0
  241. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+geist-mono@0.4.3-2a25012349fb7712/node_modules/@expo-google-fonts/geist-mono/900Black/GeistMono_900Black.9ec025adf049c8a476588eeac81a36e4.ttf +0 -0
  242. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+geist-mono@0.4.3-2a25012349fb7712/node_modules/@expo-google-fonts/geist-mono/900Black_Italic/GeistMono_900Black_Italic.8dfe24b2fef43fb3d535316e2412be7d.ttf +0 -0
  243. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+hanken-grotesk@0.4.3-9a0105bf7cbf8f8b/node_modules/@expo-google-fonts/hanken-grotesk/100Thin/HankenGrotesk_100Thin.2d9c9415d97b66fb3bbca06b538f11d8.ttf +0 -0
  244. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+hanken-grotesk@0.4.3-9a0105bf7cbf8f8b/node_modules/@expo-google-fonts/hanken-grotesk/100Thin_Italic/HankenGrotesk_100Thin_Italic.5ad53da9f1ff702f55cf870763a159ff.ttf +0 -0
  245. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+hanken-grotesk@0.4.3-9a0105bf7cbf8f8b/node_modules/@expo-google-fonts/hanken-grotesk/200ExtraLight/HankenGrotesk_200ExtraLight.2cae1a1078b5af081aff084011b07522.ttf +0 -0
  246. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+hanken-grotesk@0.4.3-9a0105bf7cbf8f8b/node_modules/@expo-google-fonts/hanken-grotesk/200ExtraLight_Italic/HankenGrotesk_200ExtraLight_Italic.5d4eff887cdb33164b4fba2066c687e3.ttf +0 -0
  247. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+hanken-grotesk@0.4.3-9a0105bf7cbf8f8b/node_modules/@expo-google-fonts/hanken-grotesk/300Light/HankenGrotesk_300Light.2be9fd730ff95b91631e3f99bc449709.ttf +0 -0
  248. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+hanken-grotesk@0.4.3-9a0105bf7cbf8f8b/node_modules/@expo-google-fonts/hanken-grotesk/300Light_Italic/HankenGrotesk_300Light_Italic.4ae6910889ffdf69093da607b369b0a8.ttf +0 -0
  249. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+hanken-grotesk@0.4.3-9a0105bf7cbf8f8b/node_modules/@expo-google-fonts/hanken-grotesk/400Regular/HankenGrotesk_400Regular.2e544d6119b4e635f6cc5a47800523bb.ttf +0 -0
  250. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+hanken-grotesk@0.4.3-9a0105bf7cbf8f8b/node_modules/@expo-google-fonts/hanken-grotesk/400Regular_Italic/HankenGrotesk_400Regular_Italic.ed9d322cffe9e614205ce9512f144834.ttf +0 -0
  251. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+hanken-grotesk@0.4.3-9a0105bf7cbf8f8b/node_modules/@expo-google-fonts/hanken-grotesk/500Medium/HankenGrotesk_500Medium.a822d33614b51eb05478e0e29cf757f3.ttf +0 -0
  252. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+hanken-grotesk@0.4.3-9a0105bf7cbf8f8b/node_modules/@expo-google-fonts/hanken-grotesk/500Medium_Italic/HankenGrotesk_500Medium_Italic.bc71c45237e12974e52335b615fab7da.ttf +0 -0
  253. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+hanken-grotesk@0.4.3-9a0105bf7cbf8f8b/node_modules/@expo-google-fonts/hanken-grotesk/600SemiBold/HankenGrotesk_600SemiBold.b016ff502f15ce9b59c453304c74fb48.ttf +0 -0
  254. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+hanken-grotesk@0.4.3-9a0105bf7cbf8f8b/node_modules/@expo-google-fonts/hanken-grotesk/600SemiBold_Italic/HankenGrotesk_600SemiBold_Italic.94428d43b74e372dc47910fd4fc6b552.ttf +0 -0
  255. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+hanken-grotesk@0.4.3-9a0105bf7cbf8f8b/node_modules/@expo-google-fonts/hanken-grotesk/700Bold/HankenGrotesk_700Bold.14d2af6df606492d846389d2108dae50.ttf +0 -0
  256. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+hanken-grotesk@0.4.3-9a0105bf7cbf8f8b/node_modules/@expo-google-fonts/hanken-grotesk/700Bold_Italic/HankenGrotesk_700Bold_Italic.d075966aaf26126d8aaac0802735e310.ttf +0 -0
  257. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+hanken-grotesk@0.4.3-9a0105bf7cbf8f8b/node_modules/@expo-google-fonts/hanken-grotesk/800ExtraBold/HankenGrotesk_800ExtraBold.b419489745bc870b4e4288e969945f31.ttf +0 -0
  258. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+hanken-grotesk@0.4.3-9a0105bf7cbf8f8b/node_modules/@expo-google-fonts/hanken-grotesk/800ExtraBold_Italic/HankenGrotesk_800ExtraBold_Italic.ea7ac4778026e067a5d637f4a494b2d2.ttf +0 -0
  259. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+hanken-grotesk@0.4.3-9a0105bf7cbf8f8b/node_modules/@expo-google-fonts/hanken-grotesk/900Black/HankenGrotesk_900Black.55e860e6549b53fa530d9eda7c7518a2.ttf +0 -0
  260. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+hanken-grotesk@0.4.3-9a0105bf7cbf8f8b/node_modules/@expo-google-fonts/hanken-grotesk/900Black_Italic/HankenGrotesk_900Black_Italic.dcad6f722a66aae93f70a72604112754.ttf +0 -0
  261. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+newsreader@0.4.1-869d74885c3fd9d6/node_modules/@expo-google-fonts/newsreader/200ExtraLight/Newsreader_200ExtraLight.1ee07dc260606863f8bf8101308d85f2.ttf +0 -0
  262. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+newsreader@0.4.1-869d74885c3fd9d6/node_modules/@expo-google-fonts/newsreader/200ExtraLight_Italic/Newsreader_200ExtraLight_Italic.52c51abab458715d1205b8732b55735f.ttf +0 -0
  263. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+newsreader@0.4.1-869d74885c3fd9d6/node_modules/@expo-google-fonts/newsreader/300Light/Newsreader_300Light.bf0dfa126654b01f65e1c53a4507ec12.ttf +0 -0
  264. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+newsreader@0.4.1-869d74885c3fd9d6/node_modules/@expo-google-fonts/newsreader/300Light_Italic/Newsreader_300Light_Italic.03190fe46aa9b7083610981ac13b10f3.ttf +0 -0
  265. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+newsreader@0.4.1-869d74885c3fd9d6/node_modules/@expo-google-fonts/newsreader/400Regular/Newsreader_400Regular.b1d919187d5645f84124ef065868ba9e.ttf +0 -0
  266. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+newsreader@0.4.1-869d74885c3fd9d6/node_modules/@expo-google-fonts/newsreader/400Regular_Italic/Newsreader_400Regular_Italic.f7b81d92eb42d85de96b6dc1c72d2c36.ttf +0 -0
  267. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+newsreader@0.4.1-869d74885c3fd9d6/node_modules/@expo-google-fonts/newsreader/500Medium/Newsreader_500Medium.df89e83cfd4e37176dda53076a01b3b7.ttf +0 -0
  268. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+newsreader@0.4.1-869d74885c3fd9d6/node_modules/@expo-google-fonts/newsreader/500Medium_Italic/Newsreader_500Medium_Italic.fb45099c4fb3c395e8f12e181475230c.ttf +0 -0
  269. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+newsreader@0.4.1-869d74885c3fd9d6/node_modules/@expo-google-fonts/newsreader/600SemiBold/Newsreader_600SemiBold.20bce29dc5180892ce1fbf4a563737a0.ttf +0 -0
  270. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+newsreader@0.4.1-869d74885c3fd9d6/node_modules/@expo-google-fonts/newsreader/600SemiBold_Italic/Newsreader_600SemiBold_Italic.93e2816e201fa363d3289e741f757ff0.ttf +0 -0
  271. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+newsreader@0.4.1-869d74885c3fd9d6/node_modules/@expo-google-fonts/newsreader/700Bold/Newsreader_700Bold.bf7c54edbd2afe9b289d5da777f489e9.ttf +0 -0
  272. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+newsreader@0.4.1-869d74885c3fd9d6/node_modules/@expo-google-fonts/newsreader/700Bold_Italic/Newsreader_700Bold_Italic.e2f5e5260513d7d4f9f3edbdcbc9f43f.ttf +0 -0
  273. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+newsreader@0.4.1-869d74885c3fd9d6/node_modules/@expo-google-fonts/newsreader/800ExtraBold/Newsreader_800ExtraBold.702211ca77927e4c276b28169dc3694c.ttf +0 -0
  274. package/ui/dist/assets/_____.bun/install/cache/links/@expo-google-fonts+newsreader@0.4.1-869d74885c3fd9d6/node_modules/@expo-google-fonts/newsreader/800ExtraBold_Italic/Newsreader_800ExtraBold_Italic.9b9eacc7d72e5152e692cb144ef7a9fd.ttf +0 -0
  275. package/ui/dist/assets/_____.bun/install/cache/links/expo-router@57.0.24+dc951f634b001cec-a06b318b98b13101/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png +0 -0
  276. package/ui/dist/assets/_____.bun/install/cache/links/expo-router@57.0.24+dc951f634b001cec-a06b318b98b13101/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png +0 -0
  277. package/ui/dist/assets/_____.bun/install/cache/links/expo-router@57.0.24+dc951f634b001cec-a06b318b98b13101/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png +0 -0
  278. package/ui/dist/assets/_____.bun/install/cache/links/expo-router@57.0.24+dc951f634b001cec-a06b318b98b13101/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png +0 -0
  279. package/ui/dist/assets/_____.bun/install/cache/links/expo-router@57.0.24+dc951f634b001cec-a06b318b98b13101/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png +0 -0
  280. package/ui/dist/assets/_____.bun/install/cache/links/expo-router@57.0.24+dc951f634b001cec-a06b318b98b13101/node_modules/expo-router/assets/react-navigation/drawer/toggle-drawer-icon.ae74bb20586a731af545e6b00fe14a09.png +0 -0
  281. package/ui/dist/assets/_____.bun/install/cache/links/expo-router@57.0.24+dc951f634b001cec-a06b318b98b13101/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png +0 -0
  282. package/ui/dist/assets/_____.bun/install/cache/links/expo-router@57.0.24+dc951f634b001cec-a06b318b98b13101/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png +0 -0
  283. package/ui/dist/assets/_____.bun/install/cache/links/expo-router@57.0.24+dc951f634b001cec-a06b318b98b13101/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png +0 -0
  284. package/ui/dist/assets/_____.bun/install/cache/links/expo-router@57.0.24+dc951f634b001cec-a06b318b98b13101/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png +0 -0
  285. package/ui/dist/assets/_____.bun/install/cache/links/expo-router@57.0.24+dc951f634b001cec-a06b318b98b13101/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png +0 -0
  286. package/ui/dist/assets/_____.bun/install/cache/links/expo-router@57.0.24+dc951f634b001cec-a06b318b98b13101/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png +0 -0
  287. package/ui/dist/assets/_____.bun/install/cache/links/expo-router@57.0.24+dc951f634b001cec-a06b318b98b13101/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png +0 -0
  288. package/ui/dist/assets/_____.bun/install/cache/links/expo-router@57.0.24+dc951f634b001cec-a06b318b98b13101/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png +0 -0
  289. package/ui/dist/assets/_____.bun/install/cache/links/expo-router@57.0.24+dc951f634b001cec-a06b318b98b13101/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png +0 -0
  290. package/ui/dist/assets/_____.bun/install/cache/links/expo-router@57.0.24+dc951f634b001cec-a06b318b98b13101/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png +0 -0
  291. package/ui/dist/assets/_____.bun/install/cache/links/expo-router@57.0.24+dc951f634b001cec-a06b318b98b13101/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png +0 -0
  292. package/ui/dist/assets/_____.bun/install/cache/links/expo-router@57.0.24+dc951f634b001cec-a06b318b98b13101/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png +0 -0
  293. package/ui/dist/assets/_____.bun/install/cache/links/expo-router@57.0.24+dc951f634b001cec-a06b318b98b13101/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png +0 -0
  294. package/ui/dist/favicon.ico +0 -0
  295. package/ui/dist/favicon.svg +10 -0
  296. package/ui/dist/icon-192.png +0 -0
  297. package/ui/dist/icon-512.png +0 -0
  298. package/ui/dist/index.html +45 -0
  299. package/ui/dist/legal/privacy-policy.md +174 -0
  300. package/ui/dist/legal/terms-of-use.md +76 -0
  301. package/ui/dist/load-again.js +42 -0
  302. package/ui/dist/manifest.webmanifest +12 -0
  303. package/ui/dist/metadata.json +1 -0
  304. package/ui/dist/sounds/bell.wav +0 -0
  305. package/ui/dist/sounds/chime.wav +0 -0
  306. package/ui/dist/sounds/knock.wav +0 -0
  307. package/ui/dist/sounds/pop.wav +0 -0
  308. package/ui/dist/sw.js +121 -0
@@ -0,0 +1,134 @@
1
+ import{createRequire as rC}from"node:module";import{statSync as Yf,createReadStream as NC,promises as OC}from"node:fs";import{basename as MC}from"node:path";import ao,{PassThrough as op}from"node:stream";import{types as ip,deprecate as Ic,promisify as LC}from"node:util";import{Buffer as Nr}from"node:buffer";import{types as lp}from"node:util";import ya from"node:http";import{isIP as GC}from"node:net";import{format as jC}from"node:url";import{deprecate as WC}from"node:util";import XC from"node:http";import YC from"node:https";import mi from"node:zlib";import fp,{PassThrough as pp,pipeline as gi}from"node:stream";import{Buffer as Sa}from"node:buffer";import{parseArgs as OR}from"node:util";import dh from"node:process";import{createWriteStream as V$}from"fs";import*as Yl from"fs/promises";import{writeFile as j$}from"fs/promises";import{Readable as W$}from"node:stream";import{finished as J$}from"node:stream/promises";import*as OE from"path";import{rm as qH,writeFile as Og}from"node:fs/promises";import{extname as UH}from"node:path";import{existsSync as BH,realpathSync as Mg,statSync as HH}from"node:fs";import{isAbsolute as Tw,relative as zH}from"node:path";import{spawn as tz,spawnSync as aW}from"node:child_process";import{closeSync as rz,existsSync as bu,constants as La,openSync as xg,readdirSync as nz}from"node:fs";import{constants as oz,getPriority as iz,setPriority as sz}from"node:os";import{join as az}from"node:path";import{Readable as lz}from"node:stream";import{closeSync as Rz,existsSync as af,openSync as Az,readFileSync as Iw,readSync as Iz,statSync as Pz}from"node:fs";import{basename as Hc,dirname as vl,join as On}from"node:path";import{existsSync as jz,readFileSync as Wz}from"node:fs";import{mkdir as Jz}from"node:fs/promises";import{delimiter as zg,dirname as Kz,extname as yW,join as Xz,resolve as Yz}from"node:path";import{createHash as dV}from"node:crypto";import{existsSync as Tu}from"node:fs";import{mkdir as fV,mkdtemp as pV,rename as hV,rm as mV,writeFile as Va}from"node:fs/promises";import{homedir as gV}from"node:os";import{join as Vr}from"node:path";import{pathToFileURL as vV}from"node:url";import{join as OV}from"node:path";var ui=rC(import.meta.url),{create:nC,defineProperty:Cu,getOwnPropertyDescriptor:oC,getOwnPropertyNames:Ru,getPrototypeOf:iC}=Object,sC=Object.prototype.hasOwnProperty,we=((e)=>typeof ui<"u"?ui:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof ui<"u"?ui:t)[r]}):e)(function(e){if(typeof ui<"u")return ui.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),Jt=(e,t,r)=>function n(){if(r)throw r[0];try{return e&&(t=(0,e[Ru(e)[0]])(e=0)),t}catch(o){throw r=[o],o}},ye=(e,t)=>function r(){try{return t||(0,e[Ru(e)[0]])((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},Gs=(e,t)=>{for(var r in t)Cu(e,r,{get:t[r],enumerable:!0})},aC=(e,t,r,n)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let o of Ru(t))if(!sC.call(e,o)&&o!==r)Cu(e,o,{get:()=>t[o],enumerable:!(n=oC(t,o))||n.enumerable})}return e},Cr=(e,t,r)=>(r=e!=null?nC(iC(e)):{},aC(t||!e||!e.__esModule?Cu(r,"default",{value:e,enumerable:!0}):r,e)),lC=ye({"../node_modules/.bun/retry@0.13.1/node_modules/retry/lib/retry_operation.js"(e,t){function r(n,o){if(typeof o==="boolean")o={forever:o};if(this._originalTimeouts=JSON.parse(JSON.stringify(n)),this._timeouts=n,this._options=o||{},this._maxRetryTime=o&&o.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever)this._cachedTimeouts=this._timeouts.slice(0)}t.exports=r,r.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},r.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);if(this._timer)clearTimeout(this._timer);this._timeouts=[],this._cachedTimeouts=null},r.prototype.retry=function(n){if(this._timeout)clearTimeout(this._timeout);if(!n)return!1;var o=new Date().getTime();if(n&&o-this._operationStart>=this._maxRetryTime)return this._errors.push(n),this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push(n);var i=this._timeouts.shift();if(i===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),i=this._cachedTimeouts.slice(-1);else return!1;var s=this;if(this._timer=setTimeout(function(){if(s._attempts++,s._operationTimeoutCb){if(s._timeout=setTimeout(function(){s._operationTimeoutCb(s._attempts)},s._operationTimeout),s._options.unref)s._timeout.unref()}s._fn(s._attempts)},i),this._options.unref)this._timer.unref();return!0},r.prototype.attempt=function(n,o){if(this._fn=n,o){if(o.timeout)this._operationTimeout=o.timeout;if(o.cb)this._operationTimeoutCb=o.cb}var i=this;if(this._operationTimeoutCb)this._timeout=setTimeout(function(){i._operationTimeoutCb()},i._operationTimeout);this._operationStart=new Date().getTime(),this._fn(this._attempts)},r.prototype.try=function(n){console.log("Using RetryOperation.try() is deprecated"),this.attempt(n)},r.prototype.start=function(n){console.log("Using RetryOperation.start() is deprecated"),this.attempt(n)},r.prototype.start=r.prototype.try,r.prototype.errors=function(){return this._errors},r.prototype.attempts=function(){return this._attempts},r.prototype.mainError=function(){if(this._errors.length===0)return null;var n={},o=null,i=0;for(var s=0;s<this._errors.length;s++){var l=this._errors[s],a=l.message,c=(n[a]||0)+1;if(n[a]=c,c>=i)o=l,i=c}return o}}}),cC=ye({"../node_modules/.bun/retry@0.13.1/node_modules/retry/lib/retry.js"(e){var t=lC();e.operation=function(r){var n=e.timeouts(r);return new t(n,{forever:r&&(r.forever||r.retries===1/0),unref:r&&r.unref,maxRetryTime:r&&r.maxRetryTime})},e.timeouts=function(r){if(r instanceof Array)return[].concat(r);var n={retries:10,factor:2,minTimeout:1000,maxTimeout:1/0,randomize:!1};for(var o in r)n[o]=r[o];if(n.minTimeout>n.maxTimeout)throw Error("minTimeout is greater than maxTimeout");var i=[];for(var s=0;s<n.retries;s++)i.push(this.createTimeout(s,n));if(r&&r.forever&&!i.length)i.push(this.createTimeout(s,n));return i.sort(function(l,a){return l-a}),i},e.createTimeout=function(r,n){var o=n.randomize?Math.random()+1:1,i=Math.round(o*Math.max(n.minTimeout,1)*Math.pow(n.factor,r));return i=Math.min(i,n.maxTimeout),i},e.wrap=function(r,n,o){if(n instanceof Array)o=n,n=null;if(!o){o=[];for(var i in r)if(typeof r[i]==="function")o.push(i)}for(var s=0;s<o.length;s++){var l=o[s],a=r[l];r[l]=function c(u){var f=e.operation(n),h=Array.prototype.slice.call(arguments,1),g=h.pop();h.push(function(p){if(f.retry(p))return;if(p)arguments[0]=f.mainError();g.apply(this,arguments)}),f.attempt(function(){u.apply(r,h)})}.bind(r,a),r[l].options=n}}}}),uC=ye({"../node_modules/.bun/retry@0.13.1/node_modules/retry/index.js"(e,t){t.exports=cC()}}),dC=ye({"../node_modules/.bun/p-retry@4.6.2/node_modules/p-retry/index.js"(e,t){var r=uC(),n=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"],o=class extends Error{constructor(a){super();if(a instanceof Error)this.originalError=a,{message:a}=a;else this.originalError=Error(a),this.originalError.stack=this.stack;this.name="AbortError",this.message=a}},i=(a,c,u)=>{let f=u.retries-(c-1);return a.attemptNumber=c,a.retriesLeft=f,a},s=(a)=>n.includes(a),l=(a,c)=>new Promise((u,f)=>{c={onFailedAttempt:()=>{},retries:10,...c};let h=r.operation(c);h.attempt(async(g)=>{try{u(await a(g))}catch(p){if(!(p instanceof Error)){f(TypeError(`Non-error was thrown: "${p}". You should only throw errors.`));return}if(p instanceof o)h.stop(),f(p.originalError);else if(p instanceof TypeError&&!s(p.message))h.stop(),f(p);else{i(p,g,c);try{await c.onFailedAttempt(p)}catch(_){f(_);return}if(!h.retry(p))f(h.mainError())}}})});t.exports=l,t.exports.default=l,t.exports.AbortError=o}}),Jg=ye({"../node_modules/.bun/extend@3.0.2/node_modules/extend/index.js"(e,t){var r=Object.prototype.hasOwnProperty,n=Object.prototype.toString,{defineProperty:o,getOwnPropertyDescriptor:i}=Object,s=function u(f){if(typeof Array.isArray==="function")return Array.isArray(f);return n.call(f)==="[object Array]"},l=function u(f){if(!f||n.call(f)!=="[object Object]")return!1;var h=r.call(f,"constructor"),g=f.constructor&&f.constructor.prototype&&r.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!h&&!g)return!1;var p;for(p in f);return typeof p>"u"||r.call(f,p)},a=function u(f,h){if(o&&h.name==="__proto__")o(f,h.name,{enumerable:!0,configurable:!0,value:h.newValue,writable:!0});else f[h.name]=h.newValue},c=function u(f,h){if(h==="__proto__"){if(!r.call(f,h))return;else if(i)return i(f,h).value}return f[h]};t.exports=function u(){var f,h,g,p,_,y,S=arguments[0],E=1,b=arguments.length,R=!1;if(typeof S==="boolean")R=S,S=arguments[1]||{},E=2;if(S==null||typeof S!=="object"&&typeof S!=="function")S={};for(;E<b;++E)if(f=arguments[E],f!=null){for(h in f)if(g=c(S,h),p=c(f,h),S!==p){if(R&&p&&(l(p)||(_=s(p)))){if(_)_=!1,y=g&&s(g)?g:[];else y=g&&l(g)?g:{};a(S,{name:h,newValue:u(R,y,p)})}else if(typeof p<"u")a(S,{name:h,newValue:p})}}return S}}}),fC=ye({"../node_modules/.bun/gaxios@7.3.1+759ce506b1ed1a42/node_modules/gaxios/package.json"(e,t){t.exports={name:"gaxios",version:"7.3.1",description:"A simple common HTTP client specifically for Google APIs and services.",main:"build/cjs/src/index.js",types:"build/cjs/src/index.d.ts",files:["build/"],exports:{".":{import:{types:"./build/esm/src/index.d.ts",default:"./build/esm/src/index.js"},require:{types:"./build/cjs/src/index.d.ts",default:"./build/cjs/src/index.js"}}},scripts:{lint:"gts check --no-inline-config",test:"c8 mocha build/esm/test","presystem-test":"npm run compile","system-test":"mocha build/esm/system-test --timeout 80000",compile:"tsc -b ./tsconfig.json ./tsconfig.cjs.json && node utils/enable-esm.mjs",fix:"gts fix",prepare:"npm run compile",pretest:"npm run compile",webpack:"webpack","prebrowser-test":"npm run compile","browser-test":"node build/browser-test/browser-test-runner.js",docs:"jsdoc -c .jsdoc.js","samples-test":"cd samples/ && npm link ../ && npm test && cd ../",prelint:"cd samples; npm link ../; npm install",clean:"gts clean"},repository:{type:"git",directory:"core/packages/gaxios",url:"https://github.com/googleapis/google-cloud-node.git"},keywords:["google"],engines:{node:">=18"},author:"Google, LLC",license:"Apache-2.0",devDependencies:{"@babel/plugin-proposal-private-methods":"^7.18.6","@types/cors":"^2.8.6","@types/express":"^5.0.0","@types/extend":"^3.0.1","@types/mocha":"^10.0.10","@types/multiparty":"4.2.1","@types/mv":"^2.1.0","@types/ncp":"^2.0.8","@types/node":"^24.0.0","@types/sinon":"^21.0.0","@types/tmp":"^0.2.6",assert:"^2.0.0",browserify:"^17.0.0",c8:"^10.1.3",cors:"^2.8.5",express:"^5.0.0",gts:"^6.0.2","is-docker":"^3.0.0",jsdoc:"^4.0.4","jsdoc-fresh":"^5.0.0","jsdoc-region-tag":"^4.0.0",karma:"^6.0.0","karma-chrome-launcher":"^3.0.0","karma-coverage":"^2.0.0","karma-firefox-launcher":"^2.0.0","karma-mocha":"^2.0.0","karma-remap-coverage":"^0.1.5","karma-sourcemap-loader":"^0.4.0","karma-webpack":"^5.0.0",mocha:"^11.1.0",multiparty:"^4.2.1",mv:"^2.1.1",ncp:"^2.0.0",nock:"14.0.5","null-loader":"^4.0.1","pack-n-play":"^4.0.0",puppeteer:"^24.0.0",sinon:"21.0.3","stream-browserify":"^3.0.0",tmp:"0.2.7","ts-loader":"^9.5.2",typescript:"5.8.3","undici-types":"^7.24.1",webpack:"^5.97.1","webpack-cli":"^6.0.1"},dependencies:{extend:"^3.0.2","https-proxy-agent":"^7.0.1","node-fetch":"^3.3.2"},homepage:"https://github.com/googleapis/google-cloud-node/tree/main/core/packages/gaxios"}}}),pC=ye({"../node_modules/.bun/gaxios@7.3.1+759ce506b1ed1a42/node_modules/gaxios/build/cjs/src/util.cjs"(e,t){var r=fC();t.exports={pkg:r}}}),Kg=ye({"../node_modules/.bun/gaxios@7.3.1+759ce506b1ed1a42/node_modules/gaxios/build/cjs/src/common.js"(e){var t=e&&e.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(e,"__esModule",{value:!0}),e.GaxiosError=e.GAXIOS_ERROR_SYMBOL=void 0,e.defaultErrorRedactor=l;var r=t(Jg()),n=t(pC()),o=n.default.pkg;e.GAXIOS_ERROR_SYMBOL=Symbol.for(`${o.name}-gaxios-error`);var i=class a extends Error{config;response;code;status;error;[e.GAXIOS_ERROR_SYMBOL]=o.version;static[Symbol.hasInstance](c){if(c&&typeof c==="object"&&e.GAXIOS_ERROR_SYMBOL in c&&c[e.GAXIOS_ERROR_SYMBOL]===o.version)return!0;return Function.prototype[Symbol.hasInstance].call(a,c)}constructor(c,u,f,h){super(c,{cause:h});if(this.config=u,this.response=f,this.error=h instanceof Error?h:void 0,this.config=(0,r.default)(!0,{},u),this.response)this.response.config=(0,r.default)(!0,{},this.response.config);if(this.response){try{this.response.data=s(this.config.responseType,this.response?.bodyUsed?this.response?.data:void 0)}catch{}this.status=this.response.status}if(h instanceof DOMException)this.code=h.name;else if(h&&typeof h==="object"&&"code"in h&&(typeof h.code==="string"||typeof h.code==="number"))this.code=h.code}static extractAPIErrorFromResponse(c,u="The request failed"){let f=u;if(typeof c.data==="string")f=c.data;if(c.data&&typeof c.data==="object"&&"error"in c.data&&c.data.error&&!c.ok){if(typeof c.data.error==="string")return{message:c.data.error,code:c.status,status:c.statusText};if(typeof c.data.error==="object"){f="message"in c.data.error&&typeof c.data.error.message==="string"?c.data.error.message:f;let h="status"in c.data.error&&typeof c.data.error.status==="string"?c.data.error.status:c.statusText,g="code"in c.data.error&&typeof c.data.error.code==="number"?c.data.error.code:c.status;if("errors"in c.data.error&&Array.isArray(c.data.error.errors)){let p=[];for(let _ of c.data.error.errors)if(typeof _==="object"&&"message"in _&&typeof _.message==="string")p.push(_.message);return Object.assign({message:p.join(`
2
+ `)||f,code:g,status:h},c.data.error)}return Object.assign({message:f,code:g,status:h},c.data.error)}}return{message:f,code:c.status,status:c.statusText}}};e.GaxiosError=i;function s(a,c){switch(a){case"stream":return c;case"json":return JSON.parse(JSON.stringify(c));case"arraybuffer":return JSON.parse(Buffer.from(c).toString("utf8"));case"blob":return JSON.parse(c.text());default:return c}}function l(a){function u(g){if(!g)return;g.forEach((p,_)=>{if(/^authentication$/i.test(_)||/^authorization$/i.test(_)||/secret/i.test(_))g.set(_,"<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.")})}function f(g,p){if(typeof g==="object"&&g!==null&&typeof g[p]==="string"){let _=g[p];if(/grant_type=/i.test(_)||/assertion=/i.test(_)||/secret/i.test(_))g[p]="<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>."}}function h(g){if(!g||typeof g!=="object")return;else if(g instanceof FormData||g instanceof URLSearchParams||"forEach"in g&&"set"in g)g.forEach((p,_)=>{if(["grant_type","assertion"].includes(_)||/secret/.test(_))g.set(_,"<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.")});else{if("grant_type"in g)g.grant_type="<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.";if("assertion"in g)g.assertion="<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.";if("client_secret"in g)g.client_secret="<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>."}}if(a.config){if(u(a.config.headers),f(a.config,"data"),h(a.config.data),f(a.config,"body"),h(a.config.body),a.config.url.searchParams.has("token"))a.config.url.searchParams.set("token","<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.");if(a.config.url.searchParams.has("client_secret"))a.config.url.searchParams.set("client_secret","<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.")}if(a.response){if(l({config:a.response.config}),u(a.response.headers),a.response.bodyUsed)f(a.response,"data"),h(a.response.data)}return a}}}),hC=ye({"../node_modules/.bun/gaxios@7.3.1+759ce506b1ed1a42/node_modules/gaxios/build/cjs/src/retry.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getRetryConfig=t;async function t(i){let s=n(i);if(!i||!i.config||!s&&!i.config.retry)return{shouldRetry:!1};s=s||{},s.currentRetryAttempt=s.currentRetryAttempt||0,s.retry=s.retry===void 0||s.retry===null?3:s.retry,s.httpMethodsToRetry=s.httpMethodsToRetry||["GET","HEAD","PUT","OPTIONS","DELETE"],s.noResponseRetries=s.noResponseRetries===void 0||s.noResponseRetries===null?2:s.noResponseRetries,s.retryDelayMultiplier=s.retryDelayMultiplier?s.retryDelayMultiplier:2,s.timeOfFirstRequest=s.timeOfFirstRequest?s.timeOfFirstRequest:Date.now(),s.totalTimeout=s.totalTimeout?s.totalTimeout:Number.MAX_SAFE_INTEGER,s.maxRetryDelay=s.maxRetryDelay?s.maxRetryDelay:Number.MAX_SAFE_INTEGER;let l=[[100,199],[408,408],[429,429],[500,599]];if(s.statusCodesToRetry=s.statusCodesToRetry||l,i.config.retryConfig=s,!await(s.shouldRetry||r)(i))return{shouldRetry:!1,config:i.config};let c=o(s);i.config.retryConfig.currentRetryAttempt+=1;let u=s.retryBackoff?s.retryBackoff(i,c):new Promise((f)=>{setTimeout(f,c)});if(s.onRetryAttempt)await s.onRetryAttempt(i);return await u,{shouldRetry:!0,config:i.config}}function r(i){let s=n(i);if(i.config.signal?.aborted&&i.code!=="TimeoutError"||i.code==="AbortError")return!1;if(!s||s.retry===0)return!1;if(!i.response&&(s.currentRetryAttempt||0)>=s.noResponseRetries)return!1;if(!s.httpMethodsToRetry||!s.httpMethodsToRetry.includes(i.config.method?.toUpperCase()||"GET"))return!1;if(i.response&&i.response.status){let l=!1;for(let[a,c]of s.statusCodesToRetry){let u=i.response.status;if(u>=a&&u<=c){l=!0;break}}if(!l)return!1}if(s.currentRetryAttempt=s.currentRetryAttempt||0,s.currentRetryAttempt>=s.retry)return!1;return!0}function n(i){if(i&&i.config&&i.config.retryConfig)return i.config.retryConfig;return}function o(i){let l=(i.currentRetryAttempt?0:i.retryDelay??100)+(Math.pow(i.retryDelayMultiplier,i.currentRetryAttempt)-1)/2*1000,a=i.totalTimeout-(Date.now()-i.timeOfFirstRequest);return Math.min(l,a,i.maxRetryDelay)}}}),Xg=ye({"../node_modules/.bun/gaxios@7.3.1+759ce506b1ed1a42/node_modules/gaxios/build/cjs/src/interceptor.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.GaxiosInterceptorManager=void 0;var t=class extends Set{};e.GaxiosInterceptorManager=t}}),mC=ye({"../node_modules/.bun/ms@2.1.3/node_modules/ms/index.js"(e,t){var r=1000,n=r*60,o=n*60,i=o*24,s=i*7,l=i*365.25;t.exports=function(h,g){g=g||{};var p=typeof h;if(p==="string"&&h.length>0)return a(h);else if(p==="number"&&isFinite(h))return g.long?u(h):c(h);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(h))};function a(h){if(h=String(h),h.length>100)return;var g=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(h);if(!g)return;var p=parseFloat(g[1]),_=(g[2]||"ms").toLowerCase();switch(_){case"years":case"year":case"yrs":case"yr":case"y":return p*l;case"weeks":case"week":case"w":return p*s;case"days":case"day":case"d":return p*i;case"hours":case"hour":case"hrs":case"hr":case"h":return p*o;case"minutes":case"minute":case"mins":case"min":case"m":return p*n;case"seconds":case"second":case"secs":case"sec":case"s":return p*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return p;default:return}}function c(h){var g=Math.abs(h);if(g>=i)return Math.round(h/i)+"d";if(g>=o)return Math.round(h/o)+"h";if(g>=n)return Math.round(h/n)+"m";if(g>=r)return Math.round(h/r)+"s";return h+"ms"}function u(h){var g=Math.abs(h);if(g>=i)return f(h,g,i,"day");if(g>=o)return f(h,g,o,"hour");if(g>=n)return f(h,g,n,"minute");if(g>=r)return f(h,g,r,"second");return h+" ms"}function f(h,g,p,_){var y=g>=p*1.5;return Math.round(h/p)+" "+_+(y?"s":"")}}}),Yg=ye({"../node_modules/.bun/debug@4.4.3+759ce506b1ed1a42/node_modules/debug/src/common.js"(e,t){function r(n){i.debug=i,i.default=i,i.coerce=f,i.disable=c,i.enable=l,i.enabled=u,i.humanize=mC(),i.destroy=h,Object.keys(n).forEach((g)=>{i[g]=n[g]}),i.names=[],i.skips=[],i.formatters={};function o(g){let p=0;for(let _=0;_<g.length;_++)p=(p<<5)-p+g.charCodeAt(_),p|=0;return i.colors[Math.abs(p)%i.colors.length]}i.selectColor=o;function i(g){let p,_=null,y,S;function E(...b){if(!E.enabled)return;let R=E,w=Number(new Date),T=w-(p||w);if(R.diff=T,R.prev=p,R.curr=w,p=w,b[0]=i.coerce(b[0]),typeof b[0]!=="string")b.unshift("%O");let C=0;b[0]=b[0].replace(/%([a-zA-Z%])/g,(P,D)=>{if(P==="%%")return"%";C++;let N=i.formatters[D];if(typeof N==="function"){let F=b[C];P=N.call(R,F),b.splice(C,1),C--}return P}),i.formatArgs.call(R,b),(R.log||i.log).apply(R,b)}if(E.namespace=g,E.useColors=i.useColors(),E.color=i.selectColor(g),E.extend=s,E.destroy=i.destroy,Object.defineProperty(E,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(_!==null)return _;if(y!==i.namespaces)y=i.namespaces,S=i.enabled(g);return S},set:(b)=>{_=b}}),typeof i.init==="function")i.init(E);return E}function s(g,p){let _=i(this.namespace+(typeof p>"u"?":":p)+g);return _.log=this.log,_}function l(g){i.save(g),i.namespaces=g,i.names=[],i.skips=[];let p=(typeof g==="string"?g:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let _ of p)if(_[0]==="-")i.skips.push(_.slice(1));else i.names.push(_)}function a(g,p){let _=0,y=0,S=-1,E=0;while(_<g.length)if(y<p.length&&(p[y]===g[_]||p[y]==="*"))if(p[y]==="*")S=y,E=_,y++;else _++,y++;else if(S!==-1)y=S+1,E++,_=E;else return!1;while(y<p.length&&p[y]==="*")y++;return y===p.length}function c(){let g=[...i.names,...i.skips.map((p)=>"-"+p)].join(",");return i.enable(""),g}function u(g){for(let p of i.skips)if(a(g,p))return!1;for(let p of i.names)if(a(g,p))return!0;return!1}function f(g){if(g instanceof Error)return g.stack||g.message;return g}function h(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return i.enable(i.load()),i}t.exports=r}}),gC=ye({"../node_modules/.bun/debug@4.4.3+759ce506b1ed1a42/node_modules/debug/src/browser.js"(e,t){e.formatArgs=n,e.save=o,e.load=i,e.useColors=r,e.storage=s(),e.destroy=(()=>{let a=!1;return()=>{if(!a)a=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let a;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(a=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(a[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(a){if(a[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+a[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;let c="color: "+this.color;a.splice(1,0,c,"color: inherit");let u=0,f=0;a[0].replace(/%[a-zA-Z%]/g,(h)=>{if(h==="%%")return;if(u++,h==="%c")f=u}),a.splice(f,0,c)}e.log=console.debug||console.log||(()=>{});function o(a){try{if(a)e.storage.setItem("debug",a);else e.storage.removeItem("debug")}catch(c){}}function i(){let a;try{a=e.storage.getItem("debug")||e.storage.getItem("DEBUG")}catch(c){}if(!a&&typeof process<"u"&&"env"in process)a=process.env.DEBUG;return a}function s(){try{return localStorage}catch(a){}}t.exports=Yg()(e);var{formatters:l}=t.exports;l.j=function(a){try{return JSON.stringify(a)}catch(c){return"[UnexpectedJSONParseError]: "+c.message}}}}),vC=ye({"../node_modules/.bun/has-flag@4.0.0/node_modules/has-flag/index.js"(e,t){t.exports=(r,n=process.argv)=>{let o=r.startsWith("-")?"":r.length===1?"-":"--",i=n.indexOf(o+r),s=n.indexOf("--");return i!==-1&&(s===-1||i<s)}}}),_C=ye({"../node_modules/.bun/supports-color@7.2.0/node_modules/supports-color/index.js"(e,t){var r=we("os"),n=we("tty"),o=vC(),{env:i}=process,s;if(o("no-color")||o("no-colors")||o("color=false")||o("color=never"))s=0;else if(o("color")||o("colors")||o("color=true")||o("color=always"))s=1;if("FORCE_COLOR"in i)if(i.FORCE_COLOR==="true")s=1;else if(i.FORCE_COLOR==="false")s=0;else s=i.FORCE_COLOR.length===0?1:Math.min(parseInt(i.FORCE_COLOR,10),3);function l(u){if(u===0)return!1;return{level:u,hasBasic:!0,has256:u>=2,has16m:u>=3}}function a(u,f){if(s===0)return 0;if(o("color=16m")||o("color=full")||o("color=truecolor"))return 3;if(o("color=256"))return 2;if(u&&!f&&s===void 0)return 0;let h=s||0;if(i.TERM==="dumb")return h;if(process.platform==="win32"){let g=r.release().split(".");if(Number(g[0])>=10&&Number(g[2])>=10586)return Number(g[2])>=14931?3:2;return 1}if("CI"in i){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((g)=>(g in i))||i.CI_NAME==="codeship")return 1;return h}if("TEAMCITY_VERSION"in i)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(i.TEAMCITY_VERSION)?1:0;if(i.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in i){let g=parseInt((i.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(i.TERM_PROGRAM){case"iTerm.app":return g>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(i.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(i.TERM))return 1;if("COLORTERM"in i)return 1;return h}function c(u){let f=a(u,u&&u.isTTY);return l(f)}t.exports={supportsColor:c,stdout:l(a(!0,n.isatty(1))),stderr:l(a(!0,n.isatty(2)))}}}),yC=ye({"../node_modules/.bun/debug@4.4.3+759ce506b1ed1a42/node_modules/debug/src/node.js"(e,t){var r=we("tty"),n=we("util");e.init=u,e.log=l,e.formatArgs=i,e.save=a,e.load=c,e.useColors=o,e.destroy=n.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),e.colors=[6,2,3,4,5,1];try{let h=_C();if(h&&(h.stderr||h).level>=2)e.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221]}catch(h){}e.inspectOpts=Object.keys(process.env).filter((h)=>/^debug_/i.test(h)).reduce((h,g)=>{let p=g.substring(6).toLowerCase().replace(/_([a-z])/g,(y,S)=>S.toUpperCase()),_=process.env[g];if(/^(yes|on|true|enabled)$/i.test(_))_=!0;else if(/^(no|off|false|disabled)$/i.test(_))_=!1;else if(_==="null")_=null;else _=Number(_);return h[p]=_,h},{});function o(){return"colors"in e.inspectOpts?Boolean(e.inspectOpts.colors):r.isatty(process.stderr.fd)}function i(h){let{namespace:g,useColors:p}=this;if(p){let _=this.color,y="\x1B[3"+(_<8?_:"8;5;"+_),S=` ${y};1m${g} \x1B[0m`;h[0]=S+h[0].split(`
3
+ `).join(`
4
+ `+S),h.push(y+"m+"+t.exports.humanize(this.diff)+"\x1B[0m")}else h[0]=s()+g+" "+h[0]}function s(){if(e.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function l(...h){return process.stderr.write(n.formatWithOptions(e.inspectOpts,...h)+`
5
+ `)}function a(h){if(h)process.env.DEBUG=h;else delete process.env.DEBUG}function c(){return process.env.DEBUG}function u(h){h.inspectOpts={};let g=Object.keys(e.inspectOpts);for(let p=0;p<g.length;p++)h.inspectOpts[g[p]]=e.inspectOpts[g[p]]}t.exports=Yg()(e);var{formatters:f}=t.exports;f.o=function(h){return this.inspectOpts.colors=this.useColors,n.inspect(h,this.inspectOpts).split(`
6
+ `).map((g)=>g.trim()).join(" ")},f.O=function(h){return this.inspectOpts.colors=this.useColors,n.inspect(h,this.inspectOpts)}}}),Zg=ye({"../node_modules/.bun/debug@4.4.3+759ce506b1ed1a42/node_modules/debug/src/index.js"(e,t){if(typeof process>"u"||process.type==="renderer"||!1||process.__nwjs)t.exports=gC();else t.exports=yC()}}),SC=ye({"../node_modules/.bun/agent-base@7.1.4/node_modules/agent-base/dist/helpers.js"(e){var t=e&&e.__createBinding||(Object.create?function(c,u,f,h){if(h===void 0)h=f;var g=Object.getOwnPropertyDescriptor(u,f);if(!g||("get"in g?!u.__esModule:g.writable||g.configurable))g={enumerable:!0,get:function(){return u[f]}};Object.defineProperty(c,h,g)}:function(c,u,f,h){if(h===void 0)h=f;c[h]=u[f]}),r=e&&e.__setModuleDefault||(Object.create?function(c,u){Object.defineProperty(c,"default",{enumerable:!0,value:u})}:function(c,u){c.default=u}),n=e&&e.__importStar||function(c){if(c&&c.__esModule)return c;var u={};if(c!=null){for(var f in c)if(f!=="default"&&Object.prototype.hasOwnProperty.call(c,f))t(u,c,f)}return r(u,c),u};Object.defineProperty(e,"__esModule",{value:!0}),e.req=e.json=e.toBuffer=void 0;var o=n(we("http")),i=n(we("https"));async function s(c){let u=0,f=[];for await(let h of c)u+=h.length,f.push(h);return Buffer.concat(f,u)}e.toBuffer=s;async function l(c){let f=(await s(c)).toString("utf8");try{return JSON.parse(f)}catch(h){let g=h;throw g.message+=` (input: ${f})`,g}}e.json=l;function a(c,u={}){let h=((typeof c==="string"?c:c.href).startsWith("https:")?i:o).request(c,u),g=new Promise((p,_)=>{h.once("response",p).once("error",_).end()});return h.then=g.then.bind(g),h}e.req=a}}),EC=ye({"../node_modules/.bun/agent-base@7.1.4/node_modules/agent-base/dist/index.js"(e){var t=e&&e.__createBinding||(Object.create?function(u,f,h,g){if(g===void 0)g=h;var p=Object.getOwnPropertyDescriptor(f,h);if(!p||("get"in p?!f.__esModule:p.writable||p.configurable))p={enumerable:!0,get:function(){return f[h]}};Object.defineProperty(u,g,p)}:function(u,f,h,g){if(g===void 0)g=h;u[g]=f[h]}),r=e&&e.__setModuleDefault||(Object.create?function(u,f){Object.defineProperty(u,"default",{enumerable:!0,value:f})}:function(u,f){u.default=f}),n=e&&e.__importStar||function(u){if(u&&u.__esModule)return u;var f={};if(u!=null){for(var h in u)if(h!=="default"&&Object.prototype.hasOwnProperty.call(u,h))t(f,u,h)}return r(f,u),f},o=e&&e.__exportStar||function(u,f){for(var h in u)if(h!=="default"&&!Object.prototype.hasOwnProperty.call(f,h))t(f,u,h)};Object.defineProperty(e,"__esModule",{value:!0}),e.Agent=void 0;var i=n(we("net")),s=n(we("http")),l=we("https");o(SC(),e);var a=Symbol("AgentBaseInternalState"),c=class extends s.Agent{constructor(u){super(u);this[a]={}}isSecureEndpoint(u){if(u){if(typeof u.secureEndpoint==="boolean")return u.secureEndpoint;if(typeof u.protocol==="string")return u.protocol==="https:"}let{stack:f}=Error();if(typeof f!=="string")return!1;return f.split(`
7
+ `).some((h)=>h.indexOf("(https.js:")!==-1||h.indexOf("node:https:")!==-1)}incrementSockets(u){if(this.maxSockets===1/0&&this.maxTotalSockets===1/0)return null;if(!this.sockets[u])this.sockets[u]=[];let f=new i.Socket({writable:!1});return this.sockets[u].push(f),this.totalSocketCount++,f}decrementSockets(u,f){if(!this.sockets[u]||f===null)return;let h=this.sockets[u],g=h.indexOf(f);if(g!==-1){if(h.splice(g,1),this.totalSocketCount--,h.length===0)delete this.sockets[u]}}getName(u){if(this.isSecureEndpoint(u))return l.Agent.prototype.getName.call(this,u);return super.getName(u)}createSocket(u,f,h){let g={...f,secureEndpoint:this.isSecureEndpoint(f)},p=this.getName(g),_=this.incrementSockets(p);Promise.resolve().then(()=>this.connect(u,g)).then((y)=>{if(this.decrementSockets(p,_),y instanceof s.Agent)try{return y.addRequest(u,g)}catch(S){return h(S)}this[a].currentSocket=y,super.createSocket(u,f,h)},(y)=>{this.decrementSockets(p,_),h(y)})}createConnection(){let u=this[a].currentSocket;if(this[a].currentSocket=void 0,!u)throw Error("No socket was returned in the `connect()` function");return u}get defaultPort(){return this[a].defaultPort??(this.protocol==="https:"?443:80)}set defaultPort(u){if(this[a])this[a].defaultPort=u}get protocol(){return this[a].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(u){if(this[a])this[a].protocol=u}};e.Agent=c}}),bC=ye({"../node_modules/.bun/https-proxy-agent@7.0.6+759ce506b1ed1a42/node_modules/https-proxy-agent/dist/parse-proxy-response.js"(e){var t=e&&e.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(e,"__esModule",{value:!0}),e.parseProxyResponse=void 0;var r=t(Zg()),n=(0,r.default)("https-proxy-agent:parse-proxy-response");function o(i){return new Promise((s,l)=>{let a=0,c=[];function u(){let _=i.read();if(_)p(_);else i.once("readable",u)}function f(){i.removeListener("end",h),i.removeListener("error",g),i.removeListener("readable",u)}function h(){f(),n("onend"),l(Error("Proxy connection ended before receiving CONNECT response"))}function g(_){f(),n("onerror %o",_),l(_)}function p(_){c.push(_),a+=_.length;let y=Buffer.concat(c,a),S=y.indexOf(`\r
8
+ \r
9
+ `);if(S===-1){n("have not received end of HTTP headers yet..."),u();return}let E=y.slice(0,S).toString("ascii").split(`\r
10
+ `),b=E.shift();if(!b)return i.destroy(),l(Error("No header received from proxy CONNECT response"));let R=b.split(" "),w=+R[1],T=R.slice(2).join(" "),C={};for(let A of E){if(!A)continue;let P=A.indexOf(":");if(P===-1)return i.destroy(),l(Error(`Invalid header from proxy CONNECT response: "${A}"`));let D=A.slice(0,P).toLowerCase(),N=A.slice(P+1).trimStart(),F=C[D];if(typeof F==="string")C[D]=[F,N];else if(Array.isArray(F))F.push(N);else C[D]=N}n("got proxy server response: %o %o",b,C),f(),s({connect:{statusCode:w,statusText:T,headers:C},buffered:y})}i.on("error",g),i.on("end",h),u()})}e.parseProxyResponse=o}}),wC=ye({"../node_modules/.bun/https-proxy-agent@7.0.6+759ce506b1ed1a42/node_modules/https-proxy-agent/dist/index.js"(e){var t=e&&e.__createBinding||(Object.create?function(S,E,b,R){if(R===void 0)R=b;var w=Object.getOwnPropertyDescriptor(E,b);if(!w||("get"in w?!E.__esModule:w.writable||w.configurable))w={enumerable:!0,get:function(){return E[b]}};Object.defineProperty(S,R,w)}:function(S,E,b,R){if(R===void 0)R=b;S[R]=E[b]}),r=e&&e.__setModuleDefault||(Object.create?function(S,E){Object.defineProperty(S,"default",{enumerable:!0,value:E})}:function(S,E){S.default=E}),n=e&&e.__importStar||function(S){if(S&&S.__esModule)return S;var E={};if(S!=null){for(var b in S)if(b!=="default"&&Object.prototype.hasOwnProperty.call(S,b))t(E,S,b)}return r(E,S),E},o=e&&e.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(e,"__esModule",{value:!0}),e.HttpsProxyAgent=void 0;var i=n(we("net")),s=n(we("tls")),l=o(we("assert")),a=o(Zg()),c=EC(),u=we("url"),f=bC(),h=(0,a.default)("https-proxy-agent"),g=(S)=>{if(S.servername===void 0&&S.host&&!i.isIP(S.host))return{...S,servername:S.host};return S},p=class extends c.Agent{constructor(S,E){super(E);this.options={path:void 0},this.proxy=typeof S==="string"?new u.URL(S):S,this.proxyHeaders=E?.headers??{},h("Creating new HttpsProxyAgent instance: %o",this.proxy.href);let b=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),R=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...E?y(E,"headers"):null,host:b,port:R}}async connect(S,E){let{proxy:b}=this;if(!E.host)throw TypeError('No "host" provided');let R;if(b.protocol==="https:")h("Creating `tls.Socket`: %o",this.connectOpts),R=s.connect(g(this.connectOpts));else h("Creating `net.Socket`: %o",this.connectOpts),R=i.connect(this.connectOpts);let w=typeof this.proxyHeaders==="function"?this.proxyHeaders():{...this.proxyHeaders},T=i.isIPv6(E.host)?`[${E.host}]`:E.host,C=`CONNECT ${T}:${E.port} HTTP/1.1\r
11
+ `;if(b.username||b.password){let F=`${decodeURIComponent(b.username)}:${decodeURIComponent(b.password)}`;w["Proxy-Authorization"]=`Basic ${Buffer.from(F).toString("base64")}`}if(w.Host=`${T}:${E.port}`,!w["Proxy-Connection"])w["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close";for(let F of Object.keys(w))C+=`${F}: ${w[F]}\r
12
+ `;let A=(0,f.parseProxyResponse)(R);R.write(`${C}\r
13
+ `);let{connect:P,buffered:D}=await A;if(S.emit("proxyConnect",P),this.emit("proxyConnect",P,S),P.statusCode===200){if(S.once("socket",_),E.secureEndpoint)return h("Upgrading socket connection to TLS"),s.connect({...y(g(E),"host","path","port"),socket:R});return R}R.destroy();let N=new i.Socket({writable:!1});return N.readable=!0,S.once("socket",(F)=>{h("Replaying proxy buffer for failed request"),(0,l.default)(F.listenerCount("data")>0),F.push(D),F.push(null)}),N}};p.protocols=["http","https"],e.HttpsProxyAgent=p;function _(S){S.resume()}function y(S,...E){let b={},R;for(R in S)if(!E.includes(R))b[R]=S[R];return b}}});function TC(e){if(!/^data:/i.test(e))throw TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');e=e.replace(/\r?\n/g,"");let t=e.indexOf(",");if(t===-1||t<=4)throw TypeError("malformed data: URI");let r=e.substring(5,t).split(";"),n="",o=!1,i=r[0]||"text/plain",s=i;for(let u=1;u<r.length;u++)if(r[u]==="base64")o=!0;else if(r[u]){if(s+=`;${r[u]}`,r[u].indexOf("charset=")===0)n=r[u].substring(8)}if(!r[0]&&!n.length)s+=";charset=US-ASCII",n="US-ASCII";let l=o?"base64":"ascii",a=unescape(e.substring(t+1)),c=Buffer.from(a,l);return c.type=i,c.typeFull=s,c.charset=n,c}var Qg,CC=Jt({"../node_modules/.bun/data-uri-to-buffer@4.0.1/node_modules/data-uri-to-buffer/dist/index.js"(){Qg=TC}}),RC=ye({"../node_modules/.bun/web-streams-polyfill@3.3.3/node_modules/web-streams-polyfill/dist/ponyfill.es2018.js"(e,t){(function(r,n){typeof e==="object"&&typeof t<"u"?n(e):typeof define==="function"&&define.amd?define(["exports"],n):(r=typeof globalThis<"u"?globalThis:r||self,n(r.WebStreamsPolyfill={}))})(e,function(r){function n(){return}function o(v){return typeof v==="object"&&v!==null||typeof v==="function"}let i=n;function s(v,I){try{Object.defineProperty(v,"name",{value:I,configurable:!0})}catch(M){}}let l=Promise,a=Promise.prototype.then,c=Promise.reject.bind(l);function u(v){return new l(v)}function f(v){return u((I)=>I(v))}function h(v){return c(v)}function g(v,I,M){return a.call(v,I,M)}function p(v,I,M){g(g(v,I,M),void 0,i)}function _(v,I){p(v,I)}function y(v,I){p(v,void 0,I)}function S(v,I,M){return g(v,I,M)}function E(v){g(v,void 0,i)}let b=(v)=>{if(typeof queueMicrotask==="function")b=queueMicrotask;else{let I=f(void 0);b=(M)=>g(I,M)}return b(v)};function R(v,I,M){if(typeof v!=="function")throw TypeError("Argument is not a function");return Function.prototype.apply.call(v,I,M)}function w(v,I,M){try{return f(R(v,I,M))}catch(z){return h(z)}}let T=16384;class C{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(v){let I=this._back,M=I;if(I._elements.length===T-1)M={_elements:[],_next:void 0};if(I._elements.push(v),M!==I)this._back=M,I._next=M;++this._size}shift(){let v=this._front,I=v,M=this._cursor,z=M+1,re=v._elements,le=re[M];if(z===T)I=v._next,z=0;if(--this._size,this._cursor=z,v!==I)this._front=I;return re[M]=void 0,le}forEach(v){let I=this._cursor,M=this._front,z=M._elements;while(I!==z.length||M._next!==void 0){if(I===z.length){if(M=M._next,z=M._elements,I=0,z.length===0)break}v(z[I]),++I}}peek(){let v=this._front,I=this._cursor;return v._elements[I]}}let A=Symbol("[[AbortSteps]]"),P=Symbol("[[ErrorSteps]]"),D=Symbol("[[CancelSteps]]"),N=Symbol("[[PullSteps]]"),F=Symbol("[[ReleaseSteps]]");function G(v,I){if(v._ownerReadableStream=I,I._reader=v,I._state==="readable")se(v);else if(I._state==="closed")me(v);else ve(v,I._storedError)}function B(v,I){let M=v._ownerReadableStream;return Br(M,I)}function Q(v){let I=v._ownerReadableStream;if(I._state==="readable")j(v,TypeError("Reader was released and can no longer be used to monitor the stream's closedness"));else ne(v,TypeError("Reader was released and can no longer be used to monitor the stream's closedness"));I._readableStreamController[F](),I._reader=void 0,v._ownerReadableStream=void 0}function pe(v){return TypeError("Cannot "+v+" a stream using a released reader")}function se(v){v._closedPromise=u((I,M)=>{v._closedPromise_resolve=I,v._closedPromise_reject=M})}function ve(v,I){se(v),j(v,I)}function me(v){se(v),he(v)}function j(v,I){if(v._closedPromise_reject===void 0)return;E(v._closedPromise),v._closedPromise_reject(I),v._closedPromise_resolve=void 0,v._closedPromise_reject=void 0}function ne(v,I){ve(v,I)}function he(v){if(v._closedPromise_resolve===void 0)return;v._closedPromise_resolve(void 0),v._closedPromise_resolve=void 0,v._closedPromise_reject=void 0}let q=Number.isFinite||function(v){return typeof v==="number"&&isFinite(v)},K=Math.trunc||function(v){return v<0?Math.ceil(v):Math.floor(v)};function W(v){return typeof v==="object"||typeof v==="function"}function be(v,I){if(v!==void 0&&!W(v))throw TypeError(`${I} is not an object.`)}function Ce(v,I){if(typeof v!=="function")throw TypeError(`${I} is not a function.`)}function ze(v){return typeof v==="object"&&v!==null||typeof v==="function"}function Ie(v,I){if(!ze(v))throw TypeError(`${I} is not an object.`)}function je(v,I,M){if(v===void 0)throw TypeError(`Parameter ${I} is required in '${M}'.`)}function U(v,I,M){if(v===void 0)throw TypeError(`${I} is required in '${M}'.`)}function O(v){return Number(v)}function x(v){return v===0?0:v}function H(v){return x(K(v))}function J(v,I){let z=Number.MAX_SAFE_INTEGER,re=Number(v);if(re=x(re),!q(re))throw TypeError(`${I} is not a finite number`);if(re=H(re),re<0||re>z)throw TypeError(`${I} is outside the accepted range of 0 to ${z}, inclusive`);if(!q(re)||re===0)return 0;return re}function Y(v,I){if(!ro(v))throw TypeError(`${I} is not a ReadableStream.`)}function ee(v){return new V(v)}function Z(v,I){v._reader._readRequests.push(I)}function te(v,I,M){let re=v._reader._readRequests.shift();if(M)re._closeSteps();else re._chunkSteps(I)}function oe(v){return v._reader._readRequests.length}function L(v){let I=v._reader;if(I===void 0)return!1;if(!ce(I))return!1;return!0}class V{constructor(v){if(je(v,1,"ReadableStreamDefaultReader"),Y(v,"First parameter"),no(v))throw TypeError("This stream has already been locked for exclusive reading by another reader");G(this,v),this._readRequests=new C}get closed(){if(!ce(this))return h(et("closed"));return this._closedPromise}cancel(v=void 0){if(!ce(this))return h(et("cancel"));if(this._ownerReadableStream===void 0)return h(pe("cancel"));return B(this,v)}read(){if(!ce(this))return h(et("read"));if(this._ownerReadableStream===void 0)return h(pe("read from"));let v,I,M=u((re,le)=>{v=re,I=le});return ue(this,{_chunkSteps:(re)=>v({value:re,done:!1}),_closeSteps:()=>v({value:void 0,done:!0}),_errorSteps:(re)=>I(re)}),M}releaseLock(){if(!ce(this))throw et("releaseLock");if(this._ownerReadableStream===void 0)return;ge(this)}}if(Object.defineProperties(V.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),s(V.prototype.cancel,"cancel"),s(V.prototype.read,"read"),s(V.prototype.releaseLock,"releaseLock"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(V.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});function ce(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_readRequests"))return!1;return v instanceof V}function ue(v,I){let M=v._ownerReadableStream;if(M._disturbed=!0,M._state==="closed")I._closeSteps();else if(M._state==="errored")I._errorSteps(M._storedError);else M._readableStreamController[N](I)}function ge(v){Q(v);let I=TypeError("Reader was released");Ne(v,I)}function Ne(v,I){let M=v._readRequests;v._readRequests=new C,M.forEach((z)=>{z._errorSteps(I)})}function et(v){return TypeError(`ReadableStreamDefaultReader.prototype.${v} can only be used on a ReadableStreamDefaultReader`)}let He=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);class We{constructor(v,I){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=v,this._preventCancel=I}next(){let v=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?S(this._ongoingPromise,v,v):v(),this._ongoingPromise}return(v){let I=()=>this._returnSteps(v);return this._ongoingPromise?S(this._ongoingPromise,I,I):I()}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});let v=this._reader,I,M,z=u((le,_e)=>{I=le,M=_e});return ue(v,{_chunkSteps:(le)=>{this._ongoingPromise=void 0,b(()=>I({value:le,done:!1}))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,Q(v),I({value:void 0,done:!0})},_errorSteps:(le)=>{this._ongoingPromise=void 0,this._isFinished=!0,Q(v),M(le)}}),z}_returnSteps(v){if(this._isFinished)return Promise.resolve({value:v,done:!0});this._isFinished=!0;let I=this._reader;if(!this._preventCancel){let M=B(I,v);return Q(I),S(M,()=>({value:v,done:!0}))}return Q(I),f({value:v,done:!0})}}let St={next(){if(!Xt(this))return h(xt("next"));return this._asyncIteratorImpl.next()},return(v){if(!Xt(this))return h(xt("return"));return this._asyncIteratorImpl.return(v)}};Object.setPrototypeOf(St,He);function Kt(v,I){let M=ee(v),z=new We(M,I),re=Object.create(St);return re._asyncIteratorImpl=z,re}function Xt(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_asyncIteratorImpl"))return!1;try{return v._asyncIteratorImpl instanceof We}catch(I){return!1}}function xt(v){return TypeError(`ReadableStreamAsyncIterator.${v} can only be used on a ReadableSteamAsyncIterator`)}let It=Number.isNaN||function(v){return v!==v};var at,Ue,Ve;function Qe(v){return v.slice()}function or(v,I,M,z,re){new Uint8Array(v).set(new Uint8Array(M,z,re),I)}let Lt=(v)=>{if(typeof v.transfer==="function")Lt=(I)=>I.transfer();else if(typeof structuredClone==="function")Lt=(I)=>structuredClone(I,{transfer:[I]});else Lt=(I)=>I;return Lt(v)},Dt=(v)=>{if(typeof v.detached==="boolean")Dt=(I)=>I.detached;else Dt=(I)=>I.byteLength===0;return Dt(v)};function ir(v,I,M){if(v.slice)return v.slice(I,M);let z=M-I,re=new ArrayBuffer(z);return or(re,0,v,I,z),re}function sr(v,I){let M=v[I];if(M===void 0||M===null)return;if(typeof M!=="function")throw TypeError(`${String(I)} is not a function`);return M}function Rr(v){let I={[Symbol.iterator]:()=>v.iterator},M=async function*(){return yield*I}(),z=M.next;return{iterator:M,nextMethod:z,done:!1}}let Sr=(Ve=(at=Symbol.asyncIterator)!==null&&at!==void 0?at:(Ue=Symbol.for)===null||Ue===void 0?void 0:Ue.call(Symbol,"Symbol.asyncIterator"))!==null&&Ve!==void 0?Ve:"@@asyncIterator";function Er(v,I="sync",M){if(M===void 0)if(I==="async"){if(M=sr(v,Sr),M===void 0){let le=sr(v,Symbol.iterator),_e=Er(v,"sync",le);return Rr(_e)}}else M=sr(v,Symbol.iterator);if(M===void 0)throw TypeError("The object is not iterable");let z=R(M,v,[]);if(!o(z))throw TypeError("The iterator method must return an object");let re=z.next;return{iterator:z,nextMethod:re,done:!1}}function qt(v){let I=R(v.nextMethod,v.iterator,[]);if(!o(I))throw TypeError("The iterator.next() method must return an object");return I}function vo(v){return Boolean(v.done)}function Jo(v){return v.value}function Gn(v){if(typeof v!=="number")return!1;if(It(v))return!1;if(v<0)return!1;return!0}function Bn(v){let I=ir(v.buffer,v.byteOffset,v.byteOffset+v.byteLength);return new Uint8Array(I)}function pn(v){let I=v._queue.shift();if(v._queueTotalSize-=I.size,v._queueTotalSize<0)v._queueTotalSize=0;return I.value}function hn(v,I,M){if(!Gn(M)||M===1/0)throw RangeError("Size must be a finite, non-NaN, non-negative number.");v._queue.push({value:I,size:M}),v._queueTotalSize+=M}function _o(v){return v._queue.peek().value}function fr(v){v._queue=new C,v._queueTotalSize=0}function Hn(v){return v===DataView}function yo(v){return Hn(v.constructor)}function Ko(v){if(Hn(v))return 1;return v.BYTES_PER_ELEMENT}class pr{constructor(){throw TypeError("Illegal constructor")}get view(){if(!mn(this))throw eo("view");return this._view}respond(v){if(!mn(this))throw eo("respond");if(je(v,1,"respond"),v=J(v,"First parameter"),this._associatedReadableByteStreamController===void 0)throw TypeError("This BYOB request has been invalidated");if(Dt(this._view.buffer))throw TypeError("The BYOB request's buffer has been detached and so cannot be used as a response");yn(this._associatedReadableByteStreamController,v)}respondWithNewView(v){if(!mn(this))throw eo("respondWithNewView");if(je(v,1,"respondWithNewView"),!ArrayBuffer.isView(v))throw TypeError("You can only respond with array buffer views");if(this._associatedReadableByteStreamController===void 0)throw TypeError("This BYOB request has been invalidated");if(Dt(v.buffer))throw TypeError("The given view's buffer has been detached and so cannot be used as a response");Sn(this._associatedReadableByteStreamController,v)}}if(Object.defineProperties(pr.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),s(pr.prototype.respond,"respond"),s(pr.prototype.respondWithNewView,"respondWithNewView"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(pr.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class Bt{constructor(){throw TypeError("Illegal constructor")}get byobRequest(){if(!br(this))throw Fr("byobRequest");return Zn(this)}get desiredSize(){if(!br(this))throw Fr("desiredSize");return Qn(this)}close(){if(!br(this))throw Fr("close");if(this._closeRequested)throw TypeError("The stream has already been closed; do not close it again!");let v=this._controlledReadableByteStream._state;if(v!=="readable")throw TypeError(`The stream (in ${v} state) is not in the readable state and cannot be closed`);Zr(this)}enqueue(v){if(!br(this))throw Fr("enqueue");if(je(v,1,"enqueue"),!ArrayBuffer.isView(v))throw TypeError("chunk must be an array buffer view");if(v.byteLength===0)throw TypeError("chunk must have non-zero byteLength");if(v.buffer.byteLength===0)throw TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw TypeError("stream is closed or draining");let I=this._controlledReadableByteStream._state;if(I!=="readable")throw TypeError(`The stream (in ${I} state) is not in the readable state and cannot be enqueued to`);_n(this,v)}error(v=void 0){if(!br(this))throw Fr("error");Yt(this,v)}[D](v){zn(this),fr(this);let I=this._cancelAlgorithm(v);return vn(this),I}[N](v){let I=this._controlledReadableByteStream;if(this._queueTotalSize>0){So(this,v);return}let M=this._autoAllocateChunkSize;if(M!==void 0){let z;try{z=new ArrayBuffer(M)}catch(le){v._errorSteps(le);return}let re={buffer:z,bufferByteLength:M,byteOffset:0,byteLength:M,bytesFilled:0,minimumFill:1,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(re)}Z(I,v),wr(this)}[F](){if(this._pendingPullIntos.length>0){let v=this._pendingPullIntos.peek();v.readerType="none",this._pendingPullIntos=new C,this._pendingPullIntos.push(v)}}}if(Object.defineProperties(Bt.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),s(Bt.prototype.close,"close"),s(Bt.prototype.enqueue,"enqueue"),s(Bt.prototype.error,"error"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(Bt.prototype,Symbol.toStringTag,{value:"ReadableByteStreamController",configurable:!0});function br(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_controlledReadableByteStream"))return!1;return v instanceof Bt}function mn(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_associatedReadableByteStreamController"))return!1;return v instanceof pr}function wr(v){if(!Zo(v))return;if(v._pulling){v._pullAgain=!0;return}v._pulling=!0;let M=v._pullAlgorithm();p(M,()=>{if(v._pulling=!1,v._pullAgain)v._pullAgain=!1,wr(v);return null},(z)=>(Yt(v,z),null))}function zn(v){qr(v),v._pendingPullIntos=new C}function gn(v,I){let M=!1;if(v._state==="closed")M=!0;let z=Vn(I);if(I.readerType==="default")te(v,z,M);else to(v,z,M)}function Vn(v){let{bytesFilled:I,elementSize:M}=v;return new v.viewConstructor(v.buffer,v.byteOffset,I/M)}function Yr(v,I,M,z){v._queue.push({buffer:I,byteOffset:M,byteLength:z}),v._queueTotalSize+=z}function jn(v,I,M,z){let re;try{re=ir(I,M,M+z)}catch(le){throw Yt(v,le),le}Yr(v,re,0,z)}function Wn(v,I){if(I.bytesFilled>0)jn(v,I.buffer,I.byteOffset,I.bytesFilled);zt(v)}function Jn(v,I){let M=Math.min(v._queueTotalSize,I.byteLength-I.bytesFilled),z=I.bytesFilled+M,re=M,le=!1,_e=z%I.elementSize,Me=z-_e;if(Me>=I.minimumFill)re=Me-I.bytesFilled,le=!0;let qe=v._queue;while(re>0){let Je=qe.peek(),Ze=Math.min(re,Je.byteLength),lt=I.byteOffset+I.bytesFilled;if(or(I.buffer,lt,Je.buffer,Je.byteOffset,Ze),Je.byteLength===Ze)qe.shift();else Je.byteOffset+=Ze,Je.byteLength-=Ze;v._queueTotalSize-=Ze,Kn(v,Ze,I),re-=Ze}return le}function Kn(v,I,M){M.bytesFilled+=I}function Xn(v){if(v._queueTotalSize===0&&v._closeRequested)vn(v),as(v._controlledReadableByteStream);else wr(v)}function qr(v){if(v._byobRequest===null)return;v._byobRequest._associatedReadableByteStreamController=void 0,v._byobRequest._view=null,v._byobRequest=null}function Ur(v){while(v._pendingPullIntos.length>0){if(v._queueTotalSize===0)return;let I=v._pendingPullIntos.peek();if(Jn(v,I))zt(v),gn(v._controlledReadableByteStream,I)}}function Xo(v){let I=v._controlledReadableByteStream._reader;while(I._readRequests.length>0){if(v._queueTotalSize===0)return;let M=I._readRequests.shift();So(v,M)}}function Yo(v,I,M,z){let re=v._controlledReadableByteStream,le=I.constructor,_e=Ko(le),{byteOffset:Me,byteLength:qe}=I,Je=M*_e,Ze;try{Ze=Lt(I.buffer)}catch(Tt){z._errorSteps(Tt);return}let lt={buffer:Ze,bufferByteLength:Ze.byteLength,byteOffset:Me,byteLength:qe,bytesFilled:0,minimumFill:Je,elementSize:_e,viewConstructor:le,readerType:"byob"};if(v._pendingPullIntos.length>0){v._pendingPullIntos.push(lt),bn(re,z);return}if(re._state==="closed"){let Tt=new le(lt.buffer,lt.byteOffset,0);z._closeSteps(Tt);return}if(v._queueTotalSize>0){if(Jn(v,lt)){let Tt=Vn(lt);Xn(v),z._chunkSteps(Tt);return}if(v._closeRequested){let Tt=TypeError("Insufficient bytes to fill elements in the given buffer");Yt(v,Tt),z._errorSteps(Tt);return}}v._pendingPullIntos.push(lt),bn(re,z),wr(v)}function ar(v,I){if(I.readerType==="none")zt(v);let M=v._controlledReadableByteStream;if(bo(M))while(wn(M)>0){let z=zt(v);gn(M,z)}}function lr(v,I,M){if(Kn(v,I,M),M.readerType==="none"){Wn(v,M),Ur(v);return}if(M.bytesFilled<M.minimumFill)return;zt(v);let z=M.bytesFilled%M.elementSize;if(z>0){let re=M.byteOffset+M.bytesFilled;jn(v,M.buffer,re-z,z)}M.bytesFilled-=z,gn(v._controlledReadableByteStream,M),Ur(v)}function Yn(v,I){let M=v._pendingPullIntos.peek();if(qr(v),v._controlledReadableByteStream._state==="closed")ar(v,M);else lr(v,I,M);wr(v)}function zt(v){return v._pendingPullIntos.shift()}function Zo(v){let I=v._controlledReadableByteStream;if(I._state!=="readable")return!1;if(v._closeRequested)return!1;if(!v._started)return!1;if(L(I)&&oe(I)>0)return!0;if(bo(I)&&wn(I)>0)return!0;if(Qn(v)>0)return!0;return!1}function vn(v){v._pullAlgorithm=void 0,v._cancelAlgorithm=void 0}function Zr(v){let I=v._controlledReadableByteStream;if(v._closeRequested||I._state!=="readable")return;if(v._queueTotalSize>0){v._closeRequested=!0;return}if(v._pendingPullIntos.length>0){let M=v._pendingPullIntos.peek();if(M.bytesFilled%M.elementSize!==0){let z=TypeError("Insufficient bytes to fill elements in the given buffer");throw Yt(v,z),z}}vn(v),as(I)}function _n(v,I){let M=v._controlledReadableByteStream;if(v._closeRequested||M._state!=="readable")return;let{buffer:z,byteOffset:re,byteLength:le}=I;if(Dt(z))throw TypeError("chunk's buffer is detached and so cannot be enqueued");let _e=Lt(z);if(v._pendingPullIntos.length>0){let Me=v._pendingPullIntos.peek();if(Dt(Me.buffer))throw TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk");if(qr(v),Me.buffer=Lt(Me.buffer),Me.readerType==="none")Wn(v,Me)}if(L(M))if(Xo(v),oe(M)===0)Yr(v,_e,re,le);else{if(v._pendingPullIntos.length>0)zt(v);let Me=new Uint8Array(_e,re,le);te(M,Me,!1)}else if(bo(M))Yr(v,_e,re,le),Ur(v);else Yr(v,_e,re,le);wr(v)}function Yt(v,I){let M=v._controlledReadableByteStream;if(M._state!=="readable")return;zn(v),fr(v),vn(v),Nf(M,I)}function So(v,I){let M=v._queue.shift();v._queueTotalSize-=M.byteLength,Xn(v);let z=new Uint8Array(M.buffer,M.byteOffset,M.byteLength);I._chunkSteps(z)}function Zn(v){if(v._byobRequest===null&&v._pendingPullIntos.length>0){let I=v._pendingPullIntos.peek(),M=new Uint8Array(I.buffer,I.byteOffset+I.bytesFilled,I.byteLength-I.bytesFilled),z=Object.create(pr.prototype);Qo(z,v,M),v._byobRequest=z}return v._byobRequest}function Qn(v){let I=v._controlledReadableByteStream._state;if(I==="errored")return null;if(I==="closed")return 0;return v._strategyHWM-v._queueTotalSize}function yn(v,I){let M=v._pendingPullIntos.peek();if(v._controlledReadableByteStream._state==="closed"){if(I!==0)throw TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}else{if(I===0)throw TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");if(M.bytesFilled+I>M.byteLength)throw RangeError("bytesWritten out of range")}M.buffer=Lt(M.buffer),Yn(v,I)}function Sn(v,I){let M=v._pendingPullIntos.peek();if(v._controlledReadableByteStream._state==="closed"){if(I.byteLength!==0)throw TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}else if(I.byteLength===0)throw TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");if(M.byteOffset+M.bytesFilled!==I.byteOffset)throw RangeError("The region specified by view does not match byobRequest");if(M.bufferByteLength!==I.buffer.byteLength)throw RangeError("The buffer of view has different capacity than byobRequest");if(M.bytesFilled+I.byteLength>M.byteLength)throw RangeError("The region specified by view is larger than byobRequest");let re=I.byteLength;M.buffer=Lt(I.buffer),Yn(v,re)}function En(v,I,M,z,re,le,_e){I._controlledReadableByteStream=v,I._pullAgain=!1,I._pulling=!1,I._byobRequest=null,I._queue=I._queueTotalSize=void 0,fr(I),I._closeRequested=!1,I._started=!1,I._strategyHWM=le,I._pullAlgorithm=z,I._cancelAlgorithm=re,I._autoAllocateChunkSize=_e,I._pendingPullIntos=new C,v._readableStreamController=I;let Me=M();p(f(Me),()=>(I._started=!0,wr(I),null),(qe)=>(Yt(I,qe),null))}function Eo(v,I,M){let z=Object.create(Bt.prototype),re,le,_e;if(I.start!==void 0)re=()=>I.start(z);else re=()=>{return};if(I.pull!==void 0)le=()=>I.pull(z);else le=()=>f(void 0);if(I.cancel!==void 0)_e=(qe)=>I.cancel(qe);else _e=()=>f(void 0);let Me=I.autoAllocateChunkSize;if(Me===0)throw TypeError("autoAllocateChunkSize must be greater than 0");En(v,z,re,le,_e,M,Me)}function Qo(v,I,M){v._associatedReadableByteStreamController=I,v._view=M}function eo(v){return TypeError(`ReadableStreamBYOBRequest.prototype.${v} can only be used on a ReadableStreamBYOBRequest`)}function Fr(v){return TypeError(`ReadableByteStreamController.prototype.${v} can only be used on a ReadableByteStreamController`)}function Qr(v,I){be(v,I);let M=v===null||v===void 0?void 0:v.mode;return{mode:M===void 0?void 0:tr(M,`${I} has member 'mode' that`)}}function tr(v,I){if(v=`${v}`,v!=="byob")throw TypeError(`${I} '${v}' is not a valid enumeration value for ReadableStreamReaderMode`);return v}function ei(v,I){var M;be(v,I);let z=(M=v===null||v===void 0?void 0:v.min)!==null&&M!==void 0?M:1;return{min:J(z,`${I} has member 'min' that`)}}function en(v){return new Pt(v)}function bn(v,I){v._reader._readIntoRequests.push(I)}function to(v,I,M){let re=v._reader._readIntoRequests.shift();if(M)re._closeSteps(I);else re._chunkSteps(I)}function wn(v){return v._reader._readIntoRequests.length}function bo(v){let I=v._reader;if(I===void 0)return!1;if(!Et(I))return!1;return!0}class Pt{constructor(v){if(je(v,1,"ReadableStreamBYOBReader"),Y(v,"First parameter"),no(v))throw TypeError("This stream has already been locked for exclusive reading by another reader");if(!br(v._readableStreamController))throw TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");G(this,v),this._readIntoRequests=new C}get closed(){if(!Et(this))return h(wo("closed"));return this._closedPromise}cancel(v=void 0){if(!Et(this))return h(wo("cancel"));if(this._ownerReadableStream===void 0)return h(pe("cancel"));return B(this,v)}read(v,I={}){if(!Et(this))return h(wo("read"));if(!ArrayBuffer.isView(v))return h(TypeError("view must be an array buffer view"));if(v.byteLength===0)return h(TypeError("view must have non-zero byteLength"));if(v.buffer.byteLength===0)return h(TypeError("view's buffer must have non-zero byteLength"));if(Dt(v.buffer))return h(TypeError("view's buffer has been detached"));let M;try{M=ei(I,"options")}catch(qe){return h(qe)}let z=M.min;if(z===0)return h(TypeError("options.min must be greater than 0"));if(!yo(v)){if(z>v.length)return h(RangeError("options.min must be less than or equal to view's length"))}else if(z>v.byteLength)return h(RangeError("options.min must be less than or equal to view's byteLength"));if(this._ownerReadableStream===void 0)return h(pe("read from"));let re,le,_e=u((qe,Je)=>{re=qe,le=Je});return tn(this,v,z,{_chunkSteps:(qe)=>re({value:qe,done:!1}),_closeSteps:(qe)=>re({value:qe,done:!0}),_errorSteps:(qe)=>le(qe)}),_e}releaseLock(){if(!Et(this))throw wo("releaseLock");if(this._ownerReadableStream===void 0)return;Vt(this)}}if(Object.defineProperties(Pt.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),s(Pt.prototype.cancel,"cancel"),s(Pt.prototype.read,"read"),s(Pt.prototype.releaseLock,"releaseLock"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(Pt.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});function Et(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_readIntoRequests"))return!1;return v instanceof Pt}function tn(v,I,M,z){let re=v._ownerReadableStream;if(re._disturbed=!0,re._state==="errored")z._errorSteps(re._storedError);else Yo(re._readableStreamController,I,M,z)}function Vt(v){Q(v);let I=TypeError("Reader was released");ea(v,I)}function ea(v,I){let M=v._readIntoRequests;v._readIntoRequests=new C,M.forEach((z)=>{z._errorSteps(I)})}function wo(v){return TypeError(`ReadableStreamBYOBReader.prototype.${v} can only be used on a ReadableStreamBYOBReader`)}function rs(v,I){let{highWaterMark:M}=v;if(M===void 0)return I;if(It(M)||M<0)throw RangeError("Invalid highWaterMark");return M}function ta(v){let{size:I}=v;if(!I)return()=>1;return I}function ra(v,I){be(v,I);let M=v===null||v===void 0?void 0:v.highWaterMark,z=v===null||v===void 0?void 0:v.size;return{highWaterMark:M===void 0?void 0:O(M),size:z===void 0?void 0:Gw(z,`${I} has member 'size' that`)}}function Gw(v,I){return Ce(v,I),(M)=>O(v(M))}function Bw(v,I){be(v,I);let M=v===null||v===void 0?void 0:v.abort,z=v===null||v===void 0?void 0:v.close,re=v===null||v===void 0?void 0:v.start,le=v===null||v===void 0?void 0:v.type,_e=v===null||v===void 0?void 0:v.write;return{abort:M===void 0?void 0:Hw(M,v,`${I} has member 'abort' that`),close:z===void 0?void 0:zw(z,v,`${I} has member 'close' that`),start:re===void 0?void 0:Vw(re,v,`${I} has member 'start' that`),write:_e===void 0?void 0:jw(_e,v,`${I} has member 'write' that`),type:le}}function Hw(v,I,M){return Ce(v,M),(z)=>w(v,I,[z])}function zw(v,I,M){return Ce(v,M),()=>w(v,I,[])}function Vw(v,I,M){return Ce(v,M),(z)=>R(v,I,[z])}function jw(v,I,M){return Ce(v,M),(z,re)=>w(v,I,[z,re])}function uf(v,I){if(!ti(v))throw TypeError(`${I} is not a WritableStream.`)}function Ww(v){if(typeof v!=="object"||v===null)return!1;try{return typeof v.aborted==="boolean"}catch(I){return!1}}let Jw=typeof AbortController==="function";function Kw(){if(Jw)return new AbortController;return}class Tn{constructor(v={},I={}){if(v===void 0)v=null;else Ie(v,"First parameter");let M=ra(I,"Second parameter"),z=Bw(v,"First parameter");if(ff(this),z.type!==void 0)throw RangeError("Invalid type is specified");let le=ta(M),_e=rs(M,1);cT(this,z,_e,le)}get locked(){if(!ti(this))throw aa("locked");return ri(this)}abort(v=void 0){if(!ti(this))return h(aa("abort"));if(ri(this))return h(TypeError("Cannot abort a stream that already has a writer"));return na(this,v)}close(){if(!ti(this))return h(aa("close"));if(ri(this))return h(TypeError("Cannot close a stream that already has a writer"));if(rn(this))return h(TypeError("Cannot close an already-closing stream"));return pf(this)}getWriter(){if(!ti(this))throw aa("getWriter");return df(this)}}if(Object.defineProperties(Tn.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),s(Tn.prototype.abort,"abort"),s(Tn.prototype.close,"close"),s(Tn.prototype.getWriter,"getWriter"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(Tn.prototype,Symbol.toStringTag,{value:"WritableStream",configurable:!0});function df(v){return new nn(v)}function Xw(v,I,M,z,re=1,le=()=>1){let _e=Object.create(Tn.prototype);ff(_e);let Me=Object.create(Co.prototype);return yf(_e,Me,v,I,M,z,re,le),_e}function ff(v){v._state="writable",v._storedError=void 0,v._writer=void 0,v._writableStreamController=void 0,v._writeRequests=new C,v._inFlightWriteRequest=void 0,v._closeRequest=void 0,v._inFlightCloseRequest=void 0,v._pendingAbortRequest=void 0,v._backpressure=!1}function ti(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_writableStreamController"))return!1;return v instanceof Tn}function ri(v){if(v._writer===void 0)return!1;return!0}function na(v,I){var M;if(v._state==="closed"||v._state==="errored")return f(void 0);v._writableStreamController._abortReason=I,(M=v._writableStreamController._abortController)===null||M===void 0||M.abort(I);let z=v._state;if(z==="closed"||z==="errored")return f(void 0);if(v._pendingAbortRequest!==void 0)return v._pendingAbortRequest._promise;let re=!1;if(z==="erroring")re=!0,I=void 0;let le=u((_e,Me)=>{v._pendingAbortRequest={_promise:void 0,_resolve:_e,_reject:Me,_reason:I,_wasAlreadyErroring:re}});if(v._pendingAbortRequest._promise=le,!re)ic(v,I);return le}function pf(v){let I=v._state;if(I==="closed"||I==="errored")return h(TypeError(`The stream (in ${I} state) is not in the writable state and cannot be closed`));let M=u((re,le)=>{let _e={_resolve:re,_reject:le};v._closeRequest=_e}),z=v._writer;if(z!==void 0&&v._backpressure&&I==="writable")pc(z);return uT(v._writableStreamController),M}function Yw(v){return u((M,z)=>{let re={_resolve:M,_reject:z};v._writeRequests.push(re)})}function oc(v,I){if(v._state==="writable"){ic(v,I);return}sc(v)}function ic(v,I){let M=v._writableStreamController;v._state="erroring",v._storedError=I;let z=v._writer;if(z!==void 0)mf(z,I);if(!rT(v)&&M._started)sc(v)}function sc(v){v._state="errored",v._writableStreamController[P]();let I=v._storedError;if(v._writeRequests.forEach((re)=>{re._reject(I)}),v._writeRequests=new C,v._pendingAbortRequest===void 0){oa(v);return}let M=v._pendingAbortRequest;if(v._pendingAbortRequest=void 0,M._wasAlreadyErroring){M._reject(I),oa(v);return}let z=v._writableStreamController[A](M._reason);p(z,()=>(M._resolve(),oa(v),null),(re)=>(M._reject(re),oa(v),null))}function Zw(v){v._inFlightWriteRequest._resolve(void 0),v._inFlightWriteRequest=void 0}function Qw(v,I){v._inFlightWriteRequest._reject(I),v._inFlightWriteRequest=void 0,oc(v,I)}function eT(v){if(v._inFlightCloseRequest._resolve(void 0),v._inFlightCloseRequest=void 0,v._state==="erroring"){if(v._storedError=void 0,v._pendingAbortRequest!==void 0)v._pendingAbortRequest._resolve(),v._pendingAbortRequest=void 0}v._state="closed";let M=v._writer;if(M!==void 0)wf(M)}function tT(v,I){if(v._inFlightCloseRequest._reject(I),v._inFlightCloseRequest=void 0,v._pendingAbortRequest!==void 0)v._pendingAbortRequest._reject(I),v._pendingAbortRequest=void 0;oc(v,I)}function rn(v){if(v._closeRequest===void 0&&v._inFlightCloseRequest===void 0)return!1;return!0}function rT(v){if(v._inFlightWriteRequest===void 0&&v._inFlightCloseRequest===void 0)return!1;return!0}function nT(v){v._inFlightCloseRequest=v._closeRequest,v._closeRequest=void 0}function oT(v){v._inFlightWriteRequest=v._writeRequests.shift()}function oa(v){if(v._closeRequest!==void 0)v._closeRequest._reject(v._storedError),v._closeRequest=void 0;let I=v._writer;if(I!==void 0)dc(I,v._storedError)}function ac(v,I){let M=v._writer;if(M!==void 0&&I!==v._backpressure)if(I)vT(M);else pc(M);v._backpressure=I}class nn{constructor(v){if(je(v,1,"WritableStreamDefaultWriter"),uf(v,"First parameter"),ri(v))throw TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=v,v._writer=this;let I=v._state;if(I==="writable"){if(!rn(v)&&v._backpressure)ca(this);else Tf(this);la(this)}else if(I==="erroring")fc(this,v._storedError),la(this);else if(I==="closed")Tf(this),mT(this);else{let M=v._storedError;fc(this,M),bf(this,M)}}get closed(){if(!To(this))return h(Ro("closed"));return this._closedPromise}get desiredSize(){if(!To(this))throw Ro("desiredSize");if(this._ownerWritableStream===void 0)throw os("desiredSize");return lT(this)}get ready(){if(!To(this))return h(Ro("ready"));return this._readyPromise}abort(v=void 0){if(!To(this))return h(Ro("abort"));if(this._ownerWritableStream===void 0)return h(os("abort"));return iT(this,v)}close(){if(!To(this))return h(Ro("close"));let v=this._ownerWritableStream;if(v===void 0)return h(os("close"));if(rn(v))return h(TypeError("Cannot close an already-closing stream"));return hf(this)}releaseLock(){if(!To(this))throw Ro("releaseLock");if(this._ownerWritableStream===void 0)return;gf(this)}write(v=void 0){if(!To(this))return h(Ro("write"));if(this._ownerWritableStream===void 0)return h(os("write to"));return vf(this,v)}}if(Object.defineProperties(nn.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),s(nn.prototype.abort,"abort"),s(nn.prototype.close,"close"),s(nn.prototype.releaseLock,"releaseLock"),s(nn.prototype.write,"write"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(nn.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});function To(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_ownerWritableStream"))return!1;return v instanceof nn}function iT(v,I){let M=v._ownerWritableStream;return na(M,I)}function hf(v){let I=v._ownerWritableStream;return pf(I)}function sT(v){let I=v._ownerWritableStream,M=I._state;if(rn(I)||M==="closed")return f(void 0);if(M==="errored")return h(I._storedError);return hf(v)}function aT(v,I){if(v._closedPromiseState==="pending")dc(v,I);else gT(v,I)}function mf(v,I){if(v._readyPromiseState==="pending")Cf(v,I);else _T(v,I)}function lT(v){let I=v._ownerWritableStream,M=I._state;if(M==="errored"||M==="erroring")return null;if(M==="closed")return 0;return Sf(I._writableStreamController)}function gf(v){let I=v._ownerWritableStream,M=TypeError("Writer was released and can no longer be used to monitor the stream's closedness");mf(v,M),aT(v,M),I._writer=void 0,v._ownerWritableStream=void 0}function vf(v,I){let M=v._ownerWritableStream,z=M._writableStreamController,re=dT(z,I);if(M!==v._ownerWritableStream)return h(os("write to"));let le=M._state;if(le==="errored")return h(M._storedError);if(rn(M)||le==="closed")return h(TypeError("The stream is closing or closed and cannot be written to"));if(le==="erroring")return h(M._storedError);let _e=Yw(M);return fT(z,I,re),_e}let _f={};class Co{constructor(){throw TypeError("Illegal constructor")}get abortReason(){if(!lc(this))throw uc("abortReason");return this._abortReason}get signal(){if(!lc(this))throw uc("signal");if(this._abortController===void 0)throw TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(v=void 0){if(!lc(this))throw uc("error");if(this._controlledWritableStream._state!=="writable")return;Ef(this,v)}[A](v){let I=this._abortAlgorithm(v);return ia(this),I}[P](){fr(this)}}if(Object.defineProperties(Co.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),typeof Symbol.toStringTag==="symbol")Object.defineProperty(Co.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});function lc(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_controlledWritableStream"))return!1;return v instanceof Co}function yf(v,I,M,z,re,le,_e,Me){I._controlledWritableStream=v,v._writableStreamController=I,I._queue=void 0,I._queueTotalSize=void 0,fr(I),I._abortReason=void 0,I._abortController=Kw(),I._started=!1,I._strategySizeAlgorithm=Me,I._strategyHWM=_e,I._writeAlgorithm=z,I._closeAlgorithm=re,I._abortAlgorithm=le;let qe=cc(I);ac(v,qe);let Je=M(),Ze=f(Je);p(Ze,()=>(I._started=!0,sa(I),null),(lt)=>(I._started=!0,oc(v,lt),null))}function cT(v,I,M,z){let re=Object.create(Co.prototype),le,_e,Me,qe;if(I.start!==void 0)le=()=>I.start(re);else le=()=>{return};if(I.write!==void 0)_e=(Je)=>I.write(Je,re);else _e=()=>f(void 0);if(I.close!==void 0)Me=()=>I.close();else Me=()=>f(void 0);if(I.abort!==void 0)qe=(Je)=>I.abort(Je);else qe=()=>f(void 0);yf(v,re,le,_e,Me,qe,M,z)}function ia(v){v._writeAlgorithm=void 0,v._closeAlgorithm=void 0,v._abortAlgorithm=void 0,v._strategySizeAlgorithm=void 0}function uT(v){hn(v,_f,0),sa(v)}function dT(v,I){try{return v._strategySizeAlgorithm(I)}catch(M){return ns(v,M),1}}function Sf(v){return v._strategyHWM-v._queueTotalSize}function fT(v,I,M){try{hn(v,I,M)}catch(re){ns(v,re);return}let z=v._controlledWritableStream;if(!rn(z)&&z._state==="writable"){let re=cc(v);ac(z,re)}sa(v)}function sa(v){let I=v._controlledWritableStream;if(!v._started)return;if(I._inFlightWriteRequest!==void 0)return;if(I._state==="erroring"){sc(I);return}if(v._queue.length===0)return;let z=_o(v);if(z===_f)pT(v);else hT(v,z)}function ns(v,I){if(v._controlledWritableStream._state==="writable")Ef(v,I)}function pT(v){let I=v._controlledWritableStream;nT(I),pn(v);let M=v._closeAlgorithm();ia(v),p(M,()=>(eT(I),null),(z)=>(tT(I,z),null))}function hT(v,I){let M=v._controlledWritableStream;oT(M);let z=v._writeAlgorithm(I);p(z,()=>{Zw(M);let re=M._state;if(pn(v),!rn(M)&&re==="writable"){let le=cc(v);ac(M,le)}return sa(v),null},(re)=>{if(M._state==="writable")ia(v);return Qw(M,re),null})}function cc(v){return Sf(v)<=0}function Ef(v,I){let M=v._controlledWritableStream;ia(v),ic(M,I)}function aa(v){return TypeError(`WritableStream.prototype.${v} can only be used on a WritableStream`)}function uc(v){return TypeError(`WritableStreamDefaultController.prototype.${v} can only be used on a WritableStreamDefaultController`)}function Ro(v){return TypeError(`WritableStreamDefaultWriter.prototype.${v} can only be used on a WritableStreamDefaultWriter`)}function os(v){return TypeError("Cannot "+v+" a stream using a released writer")}function la(v){v._closedPromise=u((I,M)=>{v._closedPromise_resolve=I,v._closedPromise_reject=M,v._closedPromiseState="pending"})}function bf(v,I){la(v),dc(v,I)}function mT(v){la(v),wf(v)}function dc(v,I){if(v._closedPromise_reject===void 0)return;E(v._closedPromise),v._closedPromise_reject(I),v._closedPromise_resolve=void 0,v._closedPromise_reject=void 0,v._closedPromiseState="rejected"}function gT(v,I){bf(v,I)}function wf(v){if(v._closedPromise_resolve===void 0)return;v._closedPromise_resolve(void 0),v._closedPromise_resolve=void 0,v._closedPromise_reject=void 0,v._closedPromiseState="resolved"}function ca(v){v._readyPromise=u((I,M)=>{v._readyPromise_resolve=I,v._readyPromise_reject=M}),v._readyPromiseState="pending"}function fc(v,I){ca(v),Cf(v,I)}function Tf(v){ca(v),pc(v)}function Cf(v,I){if(v._readyPromise_reject===void 0)return;E(v._readyPromise),v._readyPromise_reject(I),v._readyPromise_resolve=void 0,v._readyPromise_reject=void 0,v._readyPromiseState="rejected"}function vT(v){ca(v)}function _T(v,I){fc(v,I)}function pc(v){if(v._readyPromise_resolve===void 0)return;v._readyPromise_resolve(void 0),v._readyPromise_resolve=void 0,v._readyPromise_reject=void 0,v._readyPromiseState="fulfilled"}function yT(){if(typeof globalThis<"u")return globalThis;else if(typeof self<"u")return self;else if(typeof global<"u")return global;return}let hc=yT();function ST(v){if(!(typeof v==="function"||typeof v==="object"))return!1;if(v.name!=="DOMException")return!1;try{return new v,!0}catch(I){return!1}}function ET(){let v=hc===null||hc===void 0?void 0:hc.DOMException;return ST(v)?v:void 0}function bT(){let v=function I(M,z){if(this.message=M||"",this.name=z||"Error",Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)};return s(v,"DOMException"),v.prototype=Object.create(Error.prototype),Object.defineProperty(v.prototype,"constructor",{value:v,writable:!0,configurable:!0}),v}let wT=ET()||bT();function Rf(v,I,M,z,re,le){let _e=ee(v),Me=df(I);v._disturbed=!0;let qe=!1,Je=f(void 0);return u((Ze,lt)=>{let Tt;if(le!==void 0){if(Tt=()=>{let Be=le.reason!==void 0?le.reason:new wT("Aborted","AbortError"),mt=[];if(!z)mt.push(()=>{if(I._state==="writable")return na(I,Be);return f(void 0)});if(!re)mt.push(()=>{if(v._state==="readable")return Br(v,Be);return f(void 0)});hr(()=>Promise.all(mt.map((Rt)=>Rt())),!0,Be)},le.aborted){Tt();return}le.addEventListener("abort",Tt)}function Rn(){return u((Be,mt)=>{function Rt(Tr){if(Tr)Be();else g(si(),Rt,mt)}Rt(!1)})}function si(){if(qe)return f(!0);return g(Me._readyPromise,()=>u((Be,mt)=>{ue(_e,{_chunkSteps:(Rt)=>{Je=g(vf(Me,Rt),void 0,n),Be(!1)},_closeSteps:()=>Be(!0),_errorSteps:mt})}))}if(An(v,_e._closedPromise,(Be)=>{if(!z)hr(()=>na(I,Be),!0,Be);else Ar(!0,Be);return null}),An(I,Me._closedPromise,(Be)=>{if(!re)hr(()=>Br(v,Be),!0,Be);else Ar(!0,Be);return null}),cr(v,_e._closedPromise,()=>{if(!M)hr(()=>sT(Me));else Ar();return null}),rn(I)||I._state==="closed"){let Be=TypeError("the destination writable stream closed before all data could be piped to it");if(!re)hr(()=>Br(v,Be),!0,Be);else Ar(!0,Be)}E(Rn());function oo(){let Be=Je;return g(Je,()=>Be!==Je?oo():void 0)}function An(Be,mt,Rt){if(Be._state==="errored")Rt(Be._storedError);else y(mt,Rt)}function cr(Be,mt,Rt){if(Be._state==="closed")Rt();else _(mt,Rt)}function hr(Be,mt,Rt){if(qe)return;if(qe=!0,I._state==="writable"&&!rn(I))_(oo(),Tr);else Tr();function Tr(){return p(Be(),()=>In(mt,Rt),(ai)=>In(!0,ai)),null}}function Ar(Be,mt){if(qe)return;if(qe=!0,I._state==="writable"&&!rn(I))_(oo(),()=>In(Be,mt));else In(Be,mt)}function In(Be,mt){if(gf(Me),Q(_e),le!==void 0)le.removeEventListener("abort",Tt);if(Be)lt(mt);else Ze(void 0);return null}})}class on{constructor(){throw TypeError("Illegal constructor")}get desiredSize(){if(!ua(this))throw fa("desiredSize");return mc(this)}close(){if(!ua(this))throw fa("close");if(!oi(this))throw TypeError("The stream is not in a state that permits close");Ao(this)}enqueue(v=void 0){if(!ua(this))throw fa("enqueue");if(!oi(this))throw TypeError("The stream is not in a state that permits enqueue");return ni(this,v)}error(v=void 0){if(!ua(this))throw fa("error");Gr(this,v)}[D](v){fr(this);let I=this._cancelAlgorithm(v);return da(this),I}[N](v){let I=this._controlledReadableStream;if(this._queue.length>0){let M=pn(this);if(this._closeRequested&&this._queue.length===0)da(this),as(I);else is(this);v._chunkSteps(M)}else Z(I,v),is(this)}[F](){}}if(Object.defineProperties(on.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),s(on.prototype.close,"close"),s(on.prototype.enqueue,"enqueue"),s(on.prototype.error,"error"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(on.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});function ua(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_controlledReadableStream"))return!1;return v instanceof on}function is(v){if(!Af(v))return;if(v._pulling){v._pullAgain=!0;return}v._pulling=!0;let M=v._pullAlgorithm();p(M,()=>{if(v._pulling=!1,v._pullAgain)v._pullAgain=!1,is(v);return null},(z)=>(Gr(v,z),null))}function Af(v){let I=v._controlledReadableStream;if(!oi(v))return!1;if(!v._started)return!1;if(no(I)&&oe(I)>0)return!0;if(mc(v)>0)return!0;return!1}function da(v){v._pullAlgorithm=void 0,v._cancelAlgorithm=void 0,v._strategySizeAlgorithm=void 0}function Ao(v){if(!oi(v))return;let I=v._controlledReadableStream;if(v._closeRequested=!0,v._queue.length===0)da(v),as(I)}function ni(v,I){if(!oi(v))return;let M=v._controlledReadableStream;if(no(M)&&oe(M)>0)te(M,I,!1);else{let z;try{z=v._strategySizeAlgorithm(I)}catch(re){throw Gr(v,re),re}try{hn(v,I,z)}catch(re){throw Gr(v,re),re}}is(v)}function Gr(v,I){let M=v._controlledReadableStream;if(M._state!=="readable")return;fr(v),da(v),Nf(M,I)}function mc(v){let I=v._controlledReadableStream._state;if(I==="errored")return null;if(I==="closed")return 0;return v._strategyHWM-v._queueTotalSize}function TT(v){if(Af(v))return!1;return!0}function oi(v){let I=v._controlledReadableStream._state;if(!v._closeRequested&&I==="readable")return!0;return!1}function If(v,I,M,z,re,le,_e){I._controlledReadableStream=v,I._queue=void 0,I._queueTotalSize=void 0,fr(I),I._started=!1,I._closeRequested=!1,I._pullAgain=!1,I._pulling=!1,I._strategySizeAlgorithm=_e,I._strategyHWM=le,I._pullAlgorithm=z,I._cancelAlgorithm=re,v._readableStreamController=I;let Me=M();p(f(Me),()=>(I._started=!0,is(I),null),(qe)=>(Gr(I,qe),null))}function CT(v,I,M,z){let re=Object.create(on.prototype),le,_e,Me;if(I.start!==void 0)le=()=>I.start(re);else le=()=>{return};if(I.pull!==void 0)_e=()=>I.pull(re);else _e=()=>f(void 0);if(I.cancel!==void 0)Me=(qe)=>I.cancel(qe);else Me=()=>f(void 0);If(v,re,le,_e,Me,M,z)}function fa(v){return TypeError(`ReadableStreamDefaultController.prototype.${v} can only be used on a ReadableStreamDefaultController`)}function RT(v,I){if(br(v._readableStreamController))return IT(v);return AT(v)}function AT(v,I){let M=ee(v),z=!1,re=!1,le=!1,_e=!1,Me,qe,Je,Ze,lt,Tt=u((cr)=>{lt=cr});function Rn(){if(z)return re=!0,f(void 0);return z=!0,ue(M,{_chunkSteps:(hr)=>{b(()=>{re=!1;let Ar=hr,In=hr;if(!le)ni(Je._readableStreamController,Ar);if(!_e)ni(Ze._readableStreamController,In);if(z=!1,re)Rn()})},_closeSteps:()=>{if(z=!1,!le)Ao(Je._readableStreamController);if(!_e)Ao(Ze._readableStreamController);if(!le||!_e)lt(void 0)},_errorSteps:()=>{z=!1}}),f(void 0)}function si(cr){if(le=!0,Me=cr,_e){let hr=Qe([Me,qe]),Ar=Br(v,hr);lt(Ar)}return Tt}function oo(cr){if(_e=!0,qe=cr,le){let hr=Qe([Me,qe]),Ar=Br(v,hr);lt(Ar)}return Tt}function An(){}return Je=ss(An,Rn,si),Ze=ss(An,Rn,oo),y(M._closedPromise,(cr)=>{if(Gr(Je._readableStreamController,cr),Gr(Ze._readableStreamController,cr),!le||!_e)lt(void 0);return null}),[Je,Ze]}function IT(v){let I=ee(v),M=!1,z=!1,re=!1,le=!1,_e=!1,Me,qe,Je,Ze,lt,Tt=u((Be)=>{lt=Be});function Rn(Be){y(Be._closedPromise,(mt)=>{if(Be!==I)return null;if(Yt(Je._readableStreamController,mt),Yt(Ze._readableStreamController,mt),!le||!_e)lt(void 0);return null})}function si(){if(Et(I))Q(I),I=ee(v),Rn(I);ue(I,{_chunkSteps:(mt)=>{b(()=>{z=!1,re=!1;let Rt=mt,Tr=mt;if(!le&&!_e)try{Tr=Bn(mt)}catch(ai){Yt(Je._readableStreamController,ai),Yt(Ze._readableStreamController,ai),lt(Br(v,ai));return}if(!le)_n(Je._readableStreamController,Rt);if(!_e)_n(Ze._readableStreamController,Tr);if(M=!1,z)An();else if(re)cr()})},_closeSteps:()=>{if(M=!1,!le)Zr(Je._readableStreamController);if(!_e)Zr(Ze._readableStreamController);if(Je._readableStreamController._pendingPullIntos.length>0)yn(Je._readableStreamController,0);if(Ze._readableStreamController._pendingPullIntos.length>0)yn(Ze._readableStreamController,0);if(!le||!_e)lt(void 0)},_errorSteps:()=>{M=!1}})}function oo(Be,mt){if(ce(I))Q(I),I=en(v),Rn(I);let Rt=mt?Ze:Je,Tr=mt?Je:Ze;tn(I,Be,1,{_chunkSteps:(li)=>{b(()=>{z=!1,re=!1;let ci=mt?_e:le;if(!(mt?le:_e)){let zf;try{zf=Bn(li)}catch(Sc){Yt(Rt._readableStreamController,Sc),Yt(Tr._readableStreamController,Sc),lt(Br(v,Sc));return}if(!ci)Sn(Rt._readableStreamController,li);_n(Tr._readableStreamController,zf)}else if(!ci)Sn(Rt._readableStreamController,li);if(M=!1,z)An();else if(re)cr()})},_closeSteps:(li)=>{M=!1;let ci=mt?_e:le,va=mt?le:_e;if(!ci)Zr(Rt._readableStreamController);if(!va)Zr(Tr._readableStreamController);if(li!==void 0){if(!ci)Sn(Rt._readableStreamController,li);if(!va&&Tr._readableStreamController._pendingPullIntos.length>0)yn(Tr._readableStreamController,0)}if(!ci||!va)lt(void 0)},_errorSteps:()=>{M=!1}})}function An(){if(M)return z=!0,f(void 0);M=!0;let Be=Zn(Je._readableStreamController);if(Be===null)si();else oo(Be._view,!1);return f(void 0)}function cr(){if(M)return re=!0,f(void 0);M=!0;let Be=Zn(Ze._readableStreamController);if(Be===null)si();else oo(Be._view,!0);return f(void 0)}function hr(Be){if(le=!0,Me=Be,_e){let mt=Qe([Me,qe]),Rt=Br(v,mt);lt(Rt)}return Tt}function Ar(Be){if(_e=!0,qe=Be,le){let mt=Qe([Me,qe]),Rt=Br(v,mt);lt(Rt)}return Tt}function In(){return}return Je=kf(In,An,hr),Ze=kf(In,cr,Ar),Rn(I),[Je,Ze]}function PT(v){return o(v)&&typeof v.getReader<"u"}function kT(v){if(PT(v))return OT(v.getReader());return NT(v)}function NT(v){let I,M=Er(v,"async"),z=n;function re(){let _e;try{_e=qt(M)}catch(qe){return h(qe)}let Me=f(_e);return S(Me,(qe)=>{if(!o(qe))throw TypeError("The promise returned by the iterator.next() method must fulfill with an object");if(vo(qe))Ao(I._readableStreamController);else{let Ze=Jo(qe);ni(I._readableStreamController,Ze)}})}function le(_e){let Me=M.iterator,qe;try{qe=sr(Me,"return")}catch(lt){return h(lt)}if(qe===void 0)return f(void 0);let Je;try{Je=R(qe,Me,[_e])}catch(lt){return h(lt)}let Ze=f(Je);return S(Ze,(lt)=>{if(!o(lt))throw TypeError("The promise returned by the iterator.return() method must fulfill with an object");return})}return I=ss(z,re,le,0),I}function OT(v){let I,M=n;function z(){let le;try{le=v.read()}catch(_e){return h(_e)}return S(le,(_e)=>{if(!o(_e))throw TypeError("The promise returned by the reader.read() method must fulfill with an object");if(_e.done)Ao(I._readableStreamController);else{let Me=_e.value;ni(I._readableStreamController,Me)}})}function re(le){try{return f(v.cancel(le))}catch(_e){return h(_e)}}return I=ss(M,z,re,0),I}function MT(v,I){be(v,I);let M=v,z=M===null||M===void 0?void 0:M.autoAllocateChunkSize,re=M===null||M===void 0?void 0:M.cancel,le=M===null||M===void 0?void 0:M.pull,_e=M===null||M===void 0?void 0:M.start,Me=M===null||M===void 0?void 0:M.type;return{autoAllocateChunkSize:z===void 0?void 0:J(z,`${I} has member 'autoAllocateChunkSize' that`),cancel:re===void 0?void 0:DT(re,M,`${I} has member 'cancel' that`),pull:le===void 0?void 0:$T(le,M,`${I} has member 'pull' that`),start:_e===void 0?void 0:xT(_e,M,`${I} has member 'start' that`),type:Me===void 0?void 0:LT(Me,`${I} has member 'type' that`)}}function DT(v,I,M){return Ce(v,M),(z)=>w(v,I,[z])}function $T(v,I,M){return Ce(v,M),(z)=>w(v,I,[z])}function xT(v,I,M){return Ce(v,M),(z)=>R(v,I,[z])}function LT(v,I){if(v=`${v}`,v!=="bytes")throw TypeError(`${I} '${v}' is not a valid enumeration value for ReadableStreamType`);return v}function qT(v,I){be(v,I);let M=v===null||v===void 0?void 0:v.preventCancel;return{preventCancel:Boolean(M)}}function Pf(v,I){be(v,I);let M=v===null||v===void 0?void 0:v.preventAbort,z=v===null||v===void 0?void 0:v.preventCancel,re=v===null||v===void 0?void 0:v.preventClose,le=v===null||v===void 0?void 0:v.signal;if(le!==void 0)UT(le,`${I} has member 'signal' that`);return{preventAbort:Boolean(M),preventCancel:Boolean(z),preventClose:Boolean(re),signal:le}}function UT(v,I){if(!Ww(v))throw TypeError(`${I} is not an AbortSignal.`)}function FT(v,I){be(v,I);let M=v===null||v===void 0?void 0:v.readable;U(M,"readable","ReadableWritablePair"),Y(M,`${I} has member 'readable' that`);let z=v===null||v===void 0?void 0:v.writable;return U(z,"writable","ReadableWritablePair"),uf(z,`${I} has member 'writable' that`),{readable:M,writable:z}}class Zt{constructor(v={},I={}){if(v===void 0)v=null;else Ie(v,"First parameter");let M=ra(I,"Second parameter"),z=MT(v,"First parameter");if(gc(this),z.type==="bytes"){if(M.size!==void 0)throw RangeError("The strategy for a byte stream cannot have a size function");let re=rs(M,0);Eo(this,z,re)}else{let re=ta(M),le=rs(M,1);CT(this,z,le,re)}}get locked(){if(!ro(this))throw Io("locked");return no(this)}cancel(v=void 0){if(!ro(this))return h(Io("cancel"));if(no(this))return h(TypeError("Cannot cancel a stream that already has a reader"));return Br(this,v)}getReader(v=void 0){if(!ro(this))throw Io("getReader");if(Qr(v,"First parameter").mode===void 0)return ee(this);return en(this)}pipeThrough(v,I={}){if(!ro(this))throw Io("pipeThrough");je(v,1,"pipeThrough");let M=FT(v,"First parameter"),z=Pf(I,"Second parameter");if(no(this))throw TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(ri(M.writable))throw TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");let re=Rf(this,M.writable,z.preventClose,z.preventAbort,z.preventCancel,z.signal);return E(re),M.readable}pipeTo(v,I={}){if(!ro(this))return h(Io("pipeTo"));if(v===void 0)return h("Parameter 1 is required in 'pipeTo'.");if(!ti(v))return h(TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let M;try{M=Pf(I,"Second parameter")}catch(z){return h(z)}if(no(this))return h(TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream"));if(ri(v))return h(TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream"));return Rf(this,v,M.preventClose,M.preventAbort,M.preventCancel,M.signal)}tee(){if(!ro(this))throw Io("tee");let v=RT(this);return Qe(v)}values(v=void 0){if(!ro(this))throw Io("values");let I=qT(v,"First parameter");return Kt(this,I.preventCancel)}[Sr](v){return this.values(v)}static from(v){return kT(v)}}if(Object.defineProperties(Zt,{from:{enumerable:!0}}),Object.defineProperties(Zt.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),s(Zt.from,"from"),s(Zt.prototype.cancel,"cancel"),s(Zt.prototype.getReader,"getReader"),s(Zt.prototype.pipeThrough,"pipeThrough"),s(Zt.prototype.pipeTo,"pipeTo"),s(Zt.prototype.tee,"tee"),s(Zt.prototype.values,"values"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(Zt.prototype,Symbol.toStringTag,{value:"ReadableStream",configurable:!0});Object.defineProperty(Zt.prototype,Sr,{value:Zt.prototype.values,writable:!0,configurable:!0});function ss(v,I,M,z=1,re=()=>1){let le=Object.create(Zt.prototype);gc(le);let _e=Object.create(on.prototype);return If(le,_e,v,I,M,z,re),le}function kf(v,I,M){let z=Object.create(Zt.prototype);gc(z);let re=Object.create(Bt.prototype);return En(z,re,v,I,M,0,void 0),z}function gc(v){v._state="readable",v._reader=void 0,v._storedError=void 0,v._disturbed=!1}function ro(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_readableStreamController"))return!1;return v instanceof Zt}function no(v){if(v._reader===void 0)return!1;return!0}function Br(v,I){if(v._disturbed=!0,v._state==="closed")return f(void 0);if(v._state==="errored")return h(v._storedError);as(v);let M=v._reader;if(M!==void 0&&Et(M)){let re=M._readIntoRequests;M._readIntoRequests=new C,re.forEach((le)=>{le._closeSteps(void 0)})}let z=v._readableStreamController[D](I);return S(z,n)}function as(v){v._state="closed";let I=v._reader;if(I===void 0)return;if(he(I),ce(I)){let M=I._readRequests;I._readRequests=new C,M.forEach((z)=>{z._closeSteps()})}}function Nf(v,I){v._state="errored",v._storedError=I;let M=v._reader;if(M===void 0)return;if(j(M,I),ce(M))Ne(M,I);else ea(M,I)}function Io(v){return TypeError(`ReadableStream.prototype.${v} can only be used on a ReadableStream`)}function Of(v,I){be(v,I);let M=v===null||v===void 0?void 0:v.highWaterMark;return U(M,"highWaterMark","QueuingStrategyInit"),{highWaterMark:O(M)}}let Mf=(v)=>v.byteLength;s(Mf,"size");class ls{constructor(v){je(v,1,"ByteLengthQueuingStrategy"),v=Of(v,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=v.highWaterMark}get highWaterMark(){if(!$f(this))throw Df("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!$f(this))throw Df("size");return Mf}}if(Object.defineProperties(ls.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Symbol.toStringTag==="symbol")Object.defineProperty(ls.prototype,Symbol.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});function Df(v){return TypeError(`ByteLengthQueuingStrategy.prototype.${v} can only be used on a ByteLengthQueuingStrategy`)}function $f(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_byteLengthQueuingStrategyHighWaterMark"))return!1;return v instanceof ls}let xf=()=>1;s(xf,"size");class cs{constructor(v){je(v,1,"CountQueuingStrategy"),v=Of(v,"First parameter"),this._countQueuingStrategyHighWaterMark=v.highWaterMark}get highWaterMark(){if(!qf(this))throw Lf("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!qf(this))throw Lf("size");return xf}}if(Object.defineProperties(cs.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Symbol.toStringTag==="symbol")Object.defineProperty(cs.prototype,Symbol.toStringTag,{value:"CountQueuingStrategy",configurable:!0});function Lf(v){return TypeError(`CountQueuingStrategy.prototype.${v} can only be used on a CountQueuingStrategy`)}function qf(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_countQueuingStrategyHighWaterMark"))return!1;return v instanceof cs}function GT(v,I){be(v,I);let M=v===null||v===void 0?void 0:v.cancel,z=v===null||v===void 0?void 0:v.flush,re=v===null||v===void 0?void 0:v.readableType,le=v===null||v===void 0?void 0:v.start,_e=v===null||v===void 0?void 0:v.transform,Me=v===null||v===void 0?void 0:v.writableType;return{cancel:M===void 0?void 0:VT(M,v,`${I} has member 'cancel' that`),flush:z===void 0?void 0:BT(z,v,`${I} has member 'flush' that`),readableType:re,start:le===void 0?void 0:HT(le,v,`${I} has member 'start' that`),transform:_e===void 0?void 0:zT(_e,v,`${I} has member 'transform' that`),writableType:Me}}function BT(v,I,M){return Ce(v,M),(z)=>w(v,I,[z])}function HT(v,I,M){return Ce(v,M),(z)=>R(v,I,[z])}function zT(v,I,M){return Ce(v,M),(z,re)=>w(v,I,[z,re])}function VT(v,I,M){return Ce(v,M),(z)=>w(v,I,[z])}class us{constructor(v={},I={},M={}){if(v===void 0)v=null;let z=ra(I,"Second parameter"),re=ra(M,"Third parameter"),le=GT(v,"First parameter");if(le.readableType!==void 0)throw RangeError("Invalid readableType specified");if(le.writableType!==void 0)throw RangeError("Invalid writableType specified");let _e=rs(re,0),Me=ta(re),qe=rs(z,1),Je=ta(z),Ze,lt=u((Tt)=>{Ze=Tt});if(jT(this,lt,qe,Je,_e,Me),JT(this,le),le.start!==void 0)Ze(le.start(this._transformStreamController));else Ze(void 0)}get readable(){if(!Uf(this))throw Hf("readable");return this._readable}get writable(){if(!Uf(this))throw Hf("writable");return this._writable}}if(Object.defineProperties(us.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),typeof Symbol.toStringTag==="symbol")Object.defineProperty(us.prototype,Symbol.toStringTag,{value:"TransformStream",configurable:!0});function jT(v,I,M,z,re,le){function _e(){return I}function Me(Tt){return YT(v,Tt)}function qe(Tt){return ZT(v,Tt)}function Je(){return QT(v)}v._writable=Xw(_e,Me,Je,qe,M,z);function Ze(){return eC(v)}function lt(Tt){return tC(v,Tt)}v._readable=ss(_e,Ze,lt,re,le),v._backpressure=void 0,v._backpressureChangePromise=void 0,v._backpressureChangePromise_resolve=void 0,pa(v,!0),v._transformStreamController=void 0}function Uf(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_transformStreamController"))return!1;return v instanceof us}function Ff(v,I){Gr(v._readable._readableStreamController,I),vc(v,I)}function vc(v,I){ma(v._transformStreamController),ns(v._writable._writableStreamController,I),_c(v)}function _c(v){if(v._backpressure)pa(v,!1)}function pa(v,I){if(v._backpressureChangePromise!==void 0)v._backpressureChangePromise_resolve();v._backpressureChangePromise=u((M)=>{v._backpressureChangePromise_resolve=M}),v._backpressure=I}class Cn{constructor(){throw TypeError("Illegal constructor")}get desiredSize(){if(!ha(this))throw ga("desiredSize");let v=this._controlledTransformStream._readable._readableStreamController;return mc(v)}enqueue(v=void 0){if(!ha(this))throw ga("enqueue");Gf(this,v)}error(v=void 0){if(!ha(this))throw ga("error");KT(this,v)}terminate(){if(!ha(this))throw ga("terminate");XT(this)}}if(Object.defineProperties(Cn.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),s(Cn.prototype.enqueue,"enqueue"),s(Cn.prototype.error,"error"),s(Cn.prototype.terminate,"terminate"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(Cn.prototype,Symbol.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});function ha(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_controlledTransformStream"))return!1;return v instanceof Cn}function WT(v,I,M,z,re){I._controlledTransformStream=v,v._transformStreamController=I,I._transformAlgorithm=M,I._flushAlgorithm=z,I._cancelAlgorithm=re,I._finishPromise=void 0,I._finishPromise_resolve=void 0,I._finishPromise_reject=void 0}function JT(v,I){let M=Object.create(Cn.prototype),z,re,le;if(I.transform!==void 0)z=(_e)=>I.transform(_e,M);else z=(_e)=>{try{return Gf(M,_e),f(void 0)}catch(Me){return h(Me)}};if(I.flush!==void 0)re=()=>I.flush(M);else re=()=>f(void 0);if(I.cancel!==void 0)le=(_e)=>I.cancel(_e);else le=()=>f(void 0);WT(v,M,z,re,le)}function ma(v){v._transformAlgorithm=void 0,v._flushAlgorithm=void 0,v._cancelAlgorithm=void 0}function Gf(v,I){let M=v._controlledTransformStream,z=M._readable._readableStreamController;if(!oi(z))throw TypeError("Readable side is not in a state that permits enqueue");try{ni(z,I)}catch(le){throw vc(M,le),M._readable._storedError}if(TT(z)!==M._backpressure)pa(M,!0)}function KT(v,I){Ff(v._controlledTransformStream,I)}function Bf(v,I){let M=v._transformAlgorithm(I);return S(M,void 0,(z)=>{throw Ff(v._controlledTransformStream,z),z})}function XT(v){let I=v._controlledTransformStream,M=I._readable._readableStreamController;Ao(M);let z=TypeError("TransformStream terminated");vc(I,z)}function YT(v,I){let M=v._transformStreamController;if(v._backpressure){let z=v._backpressureChangePromise;return S(z,()=>{let re=v._writable;if(re._state==="erroring")throw re._storedError;return Bf(M,I)})}return Bf(M,I)}function ZT(v,I){let M=v._transformStreamController;if(M._finishPromise!==void 0)return M._finishPromise;let z=v._readable;M._finishPromise=u((le,_e)=>{M._finishPromise_resolve=le,M._finishPromise_reject=_e});let re=M._cancelAlgorithm(I);return ma(M),p(re,()=>{if(z._state==="errored")ii(M,z._storedError);else Gr(z._readableStreamController,I),yc(M);return null},(le)=>(Gr(z._readableStreamController,le),ii(M,le),null)),M._finishPromise}function QT(v){let I=v._transformStreamController;if(I._finishPromise!==void 0)return I._finishPromise;let M=v._readable;I._finishPromise=u((re,le)=>{I._finishPromise_resolve=re,I._finishPromise_reject=le});let z=I._flushAlgorithm();return ma(I),p(z,()=>{if(M._state==="errored")ii(I,M._storedError);else Ao(M._readableStreamController),yc(I);return null},(re)=>(Gr(M._readableStreamController,re),ii(I,re),null)),I._finishPromise}function eC(v){return pa(v,!1),v._backpressureChangePromise}function tC(v,I){let M=v._transformStreamController;if(M._finishPromise!==void 0)return M._finishPromise;let z=v._writable;M._finishPromise=u((le,_e)=>{M._finishPromise_resolve=le,M._finishPromise_reject=_e});let re=M._cancelAlgorithm(I);return ma(M),p(re,()=>{if(z._state==="errored")ii(M,z._storedError);else ns(z._writableStreamController,I),_c(v),yc(M);return null},(le)=>(ns(z._writableStreamController,le),_c(v),ii(M,le),null)),M._finishPromise}function ga(v){return TypeError(`TransformStreamDefaultController.prototype.${v} can only be used on a TransformStreamDefaultController`)}function yc(v){if(v._finishPromise_resolve===void 0)return;v._finishPromise_resolve(),v._finishPromise_resolve=void 0,v._finishPromise_reject=void 0}function ii(v,I){if(v._finishPromise_reject===void 0)return;E(v._finishPromise),v._finishPromise_reject(I),v._finishPromise_resolve=void 0,v._finishPromise_reject=void 0}function Hf(v){return TypeError(`TransformStream.prototype.${v} can only be used on a TransformStream`)}r.ByteLengthQueuingStrategy=ls,r.CountQueuingStrategy=cs,r.ReadableByteStreamController=Bt,r.ReadableStream=Zt,r.ReadableStreamBYOBReader=Pt,r.ReadableStreamBYOBRequest=pr,r.ReadableStreamDefaultController=on,r.ReadableStreamDefaultReader=V,r.TransformStream=us,r.TransformStreamDefaultController=Cn,r.WritableStream=Tn,r.WritableStreamDefaultController=Co,r.WritableStreamDefaultWriter=nn})}}),AC=ye({"../node_modules/.bun/fetch-blob@3.2.0/node_modules/fetch-blob/streams.cjs"(){var e=65536;if(!globalThis.ReadableStream)try{let t=we("node:process"),{emitWarning:r}=t;try{t.emitWarning=()=>{},Object.assign(globalThis,we("node:stream/web")),t.emitWarning=r}catch(n){throw t.emitWarning=r,n}}catch(t){Object.assign(globalThis,RC())}try{let{Blob:t}=we("buffer");if(t&&!t.prototype.stream)t.prototype.stream=function r(n){let o=0,i=this;return new ReadableStream({type:"bytes",async pull(s){let a=await i.slice(o,Math.min(i.size,o+e)).arrayBuffer();if(o+=a.byteLength,s.enqueue(new Uint8Array(a)),o===i.size)s.close()}})}}catch(t){}}});async function*Ec(e,t=!0){for(let r of e)if("stream"in r)yield*r.stream();else if(ArrayBuffer.isView(r))if(t){let n=r.byteOffset,o=r.byteOffset+r.byteLength;while(n!==o){let i=Math.min(o-n,jc),s=r.buffer.slice(n,n+i);n+=s.byteLength,yield new Uint8Array(s)}}else yield r;else{let n=0,o=r;while(n!==o.size){let s=await o.slice(n,Math.min(o.size,n+jc)).arrayBuffer();n+=s.byteLength,yield new Uint8Array(s)}}}var IC,jc,bc,Vf,$o,yl=Jt({"../node_modules/.bun/fetch-blob@3.2.0/node_modules/fetch-blob/index.js"(){IC=Cr(AC(),1),jc=65536,bc=class e{#e=[];#t="";#r=0;#n="transparent";constructor(t=[],r={}){if(typeof t!=="object"||t===null)throw TypeError("Failed to construct 'Blob': The provided value cannot be converted to a sequence.");if(typeof t[Symbol.iterator]!=="function")throw TypeError("Failed to construct 'Blob': The object must have a callable @@iterator property.");if(typeof r!=="object"&&typeof r!=="function")throw TypeError("Failed to construct 'Blob': parameter 2 cannot convert to dictionary.");if(r===null)r={};let n=new TextEncoder;for(let i of t){let s;if(ArrayBuffer.isView(i))s=new Uint8Array(i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength));else if(i instanceof ArrayBuffer)s=new Uint8Array(i.slice(0));else if(i instanceof e)s=i;else s=n.encode(`${i}`);this.#r+=ArrayBuffer.isView(s)?s.byteLength:s.size,this.#e.push(s)}this.#n=`${r.endings===void 0?"transparent":r.endings}`;let o=r.type===void 0?"":String(r.type);this.#t=/^[\x20-\x7E]*$/.test(o)?o:""}get size(){return this.#r}get type(){return this.#t}async text(){let t=new TextDecoder,r="";for await(let n of Ec(this.#e,!1))r+=t.decode(n,{stream:!0});return r+=t.decode(),r}async arrayBuffer(){let t=new Uint8Array(this.size),r=0;for await(let n of Ec(this.#e,!1))t.set(n,r),r+=n.length;return t.buffer}stream(){let t=Ec(this.#e,!0);return new globalThis.ReadableStream({type:"bytes",async pull(r){let n=await t.next();n.done?r.close():r.enqueue(n.value)},async cancel(){await t.return()}})}slice(t=0,r=this.size,n=""){let{size:o}=this,i=t<0?Math.max(o+t,0):Math.min(t,o),s=r<0?Math.max(o+r,0):Math.min(r,o),l=Math.max(s-i,0),a=this.#e,c=[],u=0;for(let h of a){if(u>=l)break;let g=ArrayBuffer.isView(h)?h.byteLength:h.size;if(i&&g<=i)i-=g,s-=g;else{let p;if(ArrayBuffer.isView(h))p=h.subarray(i,Math.min(g,s)),u+=p.byteLength;else p=h.slice(i,Math.min(g,s)),u+=p.size;s-=g,c.push(p),i=0}}let f=new e([],{type:String(n).toLowerCase()});return f.#r=l,f.#e=c,f}get[Symbol.toStringTag](){return"Blob"}static[Symbol.hasInstance](t){return t&&typeof t==="object"&&typeof t.constructor==="function"&&(typeof t.stream==="function"||typeof t.arrayBuffer==="function")&&/^(Blob|File)$/.test(t[Symbol.toStringTag])}},Object.defineProperties(bc.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}}),Vf=bc,$o=Vf}}),jf,Wf,Bs,ev=Jt({"../node_modules/.bun/fetch-blob@3.2.0/node_modules/fetch-blob/file.js"(){yl(),jf=class e extends $o{#e=0;#t="";constructor(t,r,n={}){if(arguments.length<2)throw TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`);super(t,n);if(n===null)n={};let o=n.lastModified===void 0?Date.now():Number(n.lastModified);if(!Number.isNaN(o))this.#e=o;this.#t=String(r)}get name(){return this.#t}get lastModified(){return this.#e}get[Symbol.toStringTag](){return"File"}static[Symbol.hasInstance](t){return!!t&&t instanceof $o&&/^(File)$/.test(t[Symbol.toStringTag])}},Wf=jf,Bs=Wf}});function PC(e,t=$o){var r=`${Wc()}${Wc()}`.replace(/\./g,"").slice(-28).padStart(32,"-"),n=[],o=`--${r}\r
14
+ Content-Disposition: form-data; name="`;return e.forEach((i,s)=>typeof i=="string"?n.push(o+Ua(s)+`"\r
15
+ \r
16
+ ${i.replace(/\r(?!\n)|(?<!\r)\n/g,`\r
17
+ `)}\r
18
+ `):n.push(o+Ua(s)+`"; filename="${Ua(i.name,1)}"\r
19
+ Content-Type: ${i.type||"application/octet-stream"}\r
20
+ \r
21
+ `,i,`\r
22
+ `)),n.push(`--${r}--`),new t(n,{type:"multipart/form-data; boundary="+r})}var di,Jf,Kf,Wc,Xf,wc,Ua,io,wi,Au=Jt({"../node_modules/.bun/formdata-polyfill@4.0.10/node_modules/formdata-polyfill/esm.min.js"(){yl(),ev(),{toStringTag:di,iterator:Jf,hasInstance:Kf}=Symbol,Wc=Math.random,Xf="append,set,get,getAll,delete,keys,values,entries,forEach,constructor".split(","),wc=(e,t,r)=>(e+="",/^(Blob|File)$/.test(t&&t[di])?[(r=r!==void 0?r+"":t[di]=="File"?t.name:"blob",e),t.name!==r||t[di]=="blob"?new Bs([t],r,t):t]:[e,t+""]),Ua=(e,t)=>(t?e:e.replace(/\r?\n|\r/g,`\r
23
+ `)).replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),io=(e,t,r)=>{if(t.length<r)throw TypeError(`Failed to execute '${e}' on 'FormData': ${r} arguments required, but only ${t.length} present.`)},wi=class e{#e=[];constructor(...t){if(t.length)throw TypeError("Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.")}get[di](){return"FormData"}[Jf](){return this.entries()}static[Kf](t){return t&&typeof t==="object"&&t[di]==="FormData"&&!Xf.some((r)=>typeof t[r]!="function")}append(...t){io("append",arguments,2),this.#e.push(wc(...t))}delete(t){io("delete",arguments,1),t+="",this.#e=this.#e.filter(([r])=>r!==t)}get(t){io("get",arguments,1),t+="";for(var r=this.#e,n=r.length,o=0;o<n;o++)if(r[o][0]===t)return r[o][1];return null}getAll(t,r){return io("getAll",arguments,1),r=[],t+="",this.#e.forEach((n)=>n[0]===t&&r.push(n[1])),r}has(t){return io("has",arguments,1),t+="",this.#e.some((r)=>r[0]===t)}forEach(t,r){io("forEach",arguments,1);for(var[n,o]of this)t.call(r,o,n,this)}set(...t){io("set",arguments,2);var r=[],n=!0;t=wc(...t),this.#e.forEach((o)=>{o[0]===t[0]?n&&(n=!r.push(t)):r.push(o)}),n&&r.push(t),this.#e=r}*entries(){yield*this.#e}*keys(){for(var[t]of this)yield t}*values(){for(var[,t]of this)yield t}}}}),Hs,Iu=Jt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/errors/base.js"(){Hs=class extends Error{constructor(e,t){super(e);Error.captureStackTrace(this,this.constructor),this.type=t}get name(){return this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}}}}),Or,tv=Jt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/errors/fetch-error.js"(){Iu(),Or=class extends Hs{constructor(e,t,r){super(e,t);if(r)this.code=this.errno=r.code,this.erroredSysCall=r.syscall}}}}),ds,Jc,Es,rv,nv,ov,Pu=Jt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/utils/is.js"(){ds=Symbol.toStringTag,Jc=(e)=>typeof e==="object"&&typeof e.append==="function"&&typeof e.delete==="function"&&typeof e.get==="function"&&typeof e.getAll==="function"&&typeof e.has==="function"&&typeof e.set==="function"&&typeof e.sort==="function"&&e[ds]==="URLSearchParams",Es=(e)=>e&&typeof e==="object"&&typeof e.arrayBuffer==="function"&&typeof e.type==="string"&&typeof e.stream==="function"&&typeof e.constructor==="function"&&/^(Blob|File)$/.test(e[ds]),rv=(e)=>typeof e==="object"&&(e[ds]==="AbortSignal"||e[ds]==="EventTarget"),nv=(e,t)=>{let r=new URL(t).hostname,n=new URL(e).hostname;return r===n||r.endsWith(`.${n}`)},ov=(e,t)=>{let r=new URL(t).protocol,n=new URL(e).protocol;return r===n}}}),kC=ye({"../node_modules/.bun/node-domexception@1.0.0/node_modules/node-domexception/index.js"(e,t){if(!globalThis.DOMException)try{let{MessageChannel:r}=we("worker_threads"),n=new r().port1,o=new ArrayBuffer;n.postMessage(o,[o,o])}catch(r){r.constructor.name==="DOMException"&&(globalThis.DOMException=r.constructor)}t.exports=globalThis.DOMException}}),Zf,_a,iv,sv,av,lv,Tc,Cc,Rc,cv=Jt({"../node_modules/.bun/fetch-blob@3.2.0/node_modules/fetch-blob/from.js"(){Zf=Cr(kC(),1),ev(),yl(),{stat:_a}=OC,iv=(e,t)=>Tc(Yf(e),e,t),sv=(e,t)=>_a(e).then((r)=>Tc(r,e,t)),av=(e,t)=>_a(e).then((r)=>Cc(r,e,t)),lv=(e,t)=>Cc(Yf(e),e,t),Tc=(e,t,r="")=>new $o([new Rc({path:t,size:e.size,lastModified:e.mtimeMs,start:0})],{type:r}),Cc=(e,t,r="")=>new Bs([new Rc({path:t,size:e.size,lastModified:e.mtimeMs,start:0})],MC(t),{type:r,lastModified:e.mtimeMs}),Rc=class e{#e;#t;constructor(t){this.#e=t.path,this.#t=t.start,this.size=t.size,this.lastModified=t.lastModified}slice(t,r){return new e({path:this.#e,lastModified:this.lastModified,size:r-t,start:this.#t+t})}async*stream(){let{mtimeMs:t}=await _a(this.#e);if(t>this.lastModified)throw new Zf.default("The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.","NotReadableError");yield*NC(this.#e,{start:this.#t,end:this.#t+this.size-1})}get[Symbol.toStringTag](){return"Blob"}}}}),uv={};Gs(uv,{toFormData:()=>$C});function DC(e){let t=e.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);if(!t)return;let r=t[2]||t[3]||"",n=r.slice(r.lastIndexOf("\\")+1);return n=n.replace(/%22/g,'"'),n=n.replace(/&#(\d{4});/g,(o,i)=>String.fromCharCode(i)),n}async function $C(e,t){if(!/multipart/i.test(t))throw TypeError("Failed to fetch");let r=t.match(/boundary=(?:"([^"]+)"|([^;]+))/i);if(!r)throw TypeError("no or bad content-type header, no multipart boundary");let n=new dv(r[1]||r[2]),o,i,s,l,a,c,u=[],f=new wi,h=(S)=>{s+=y.decode(S,{stream:!0})},g=(S)=>{u.push(S)},p=()=>{let S=new Bs(u,c,{type:a});f.append(l,S)},_=()=>{f.append(l,s)},y=new TextDecoder("utf-8");y.decode(),n.onPartBegin=function(){n.onPartData=h,n.onPartEnd=_,o="",i="",s="",l="",a="",c=null,u.length=0},n.onHeaderField=function(S){o+=y.decode(S,{stream:!0})},n.onHeaderValue=function(S){i+=y.decode(S,{stream:!0})},n.onHeaderEnd=function(){if(i+=y.decode(),o=o.toLowerCase(),o==="content-disposition"){let S=i.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);if(S)l=S[2]||S[3]||"";if(c=DC(i),c)n.onPartData=g,n.onPartEnd=p}else if(o==="content-type")a=i;i="",o=""};for await(let S of e)n.write(S);return n.end(),f}var Hr,Ct,Ac,Pn,fs,ps,Qf,fi,ep,tp,rp,np,so,dv,xC=Jt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/utils/multipart-parser.js"(){cv(),Au(),Hr=0,Ct={START_BOUNDARY:Hr++,HEADER_FIELD_START:Hr++,HEADER_FIELD:Hr++,HEADER_VALUE_START:Hr++,HEADER_VALUE:Hr++,HEADER_VALUE_ALMOST_DONE:Hr++,HEADERS_ALMOST_DONE:Hr++,PART_DATA_START:Hr++,PART_DATA:Hr++,END:Hr++},Ac=1,Pn={PART_BOUNDARY:Ac,LAST_BOUNDARY:Ac*=2},fs=10,ps=13,Qf=32,fi=45,ep=58,tp=97,rp=122,np=(e)=>e|32,so=()=>{},dv=class{constructor(e){this.index=0,this.flags=0,this.onHeaderEnd=so,this.onHeaderField=so,this.onHeadersEnd=so,this.onHeaderValue=so,this.onPartBegin=so,this.onPartData=so,this.onPartEnd=so,this.boundaryChars={},e=`\r
24
+ --`+e;let t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r),this.boundaryChars[t[r]]=!0;this.boundary=t,this.lookbehind=new Uint8Array(this.boundary.length+8),this.state=Ct.START_BOUNDARY}write(e){let t=0,r=e.length,n=this.index,{lookbehind:o,boundary:i,boundaryChars:s,index:l,state:a,flags:c}=this,u=this.boundary.length,f=u-1,h=e.length,g,p,_=(b)=>{this[b+"Mark"]=t},y=(b)=>{delete this[b+"Mark"]},S=(b,R,w,T)=>{if(R===void 0||R!==w)this[b](T&&T.subarray(R,w))},E=(b,R)=>{let w=b+"Mark";if(!(w in this))return;if(R)S(b,this[w],t,e),delete this[w];else S(b,this[w],e.length,e),this[w]=0};for(t=0;t<r;t++)switch(g=e[t],a){case Ct.START_BOUNDARY:if(l===i.length-2){if(g===fi)c|=Pn.LAST_BOUNDARY;else if(g!==ps)return;l++;break}else if(l-1===i.length-2){if(c&Pn.LAST_BOUNDARY&&g===fi)a=Ct.END,c=0;else if(!(c&Pn.LAST_BOUNDARY)&&g===fs)l=0,S("onPartBegin"),a=Ct.HEADER_FIELD_START;else return;break}if(g!==i[l+2])l=-2;if(g===i[l+2])l++;break;case Ct.HEADER_FIELD_START:a=Ct.HEADER_FIELD,_("onHeaderField"),l=0;case Ct.HEADER_FIELD:if(g===ps){y("onHeaderField"),a=Ct.HEADERS_ALMOST_DONE;break}if(l++,g===fi)break;if(g===ep){if(l===1)return;E("onHeaderField",!0),a=Ct.HEADER_VALUE_START;break}if(p=np(g),p<tp||p>rp)return;break;case Ct.HEADER_VALUE_START:if(g===Qf)break;_("onHeaderValue"),a=Ct.HEADER_VALUE;case Ct.HEADER_VALUE:if(g===ps)E("onHeaderValue",!0),S("onHeaderEnd"),a=Ct.HEADER_VALUE_ALMOST_DONE;break;case Ct.HEADER_VALUE_ALMOST_DONE:if(g!==fs)return;a=Ct.HEADER_FIELD_START;break;case Ct.HEADERS_ALMOST_DONE:if(g!==fs)return;S("onHeadersEnd"),a=Ct.PART_DATA_START;break;case Ct.PART_DATA_START:a=Ct.PART_DATA,_("onPartData");case Ct.PART_DATA:if(n=l,l===0){t+=f;while(t<h&&!(e[t]in s))t+=u;t-=f,g=e[t]}if(l<i.length)if(i[l]===g){if(l===0)E("onPartData",!0);l++}else l=0;else if(l===i.length)if(l++,g===ps)c|=Pn.PART_BOUNDARY;else if(g===fi)c|=Pn.LAST_BOUNDARY;else l=0;else if(l-1===i.length)if(c&Pn.PART_BOUNDARY){if(l=0,g===fs){c&=~Pn.PART_BOUNDARY,S("onPartEnd"),S("onPartBegin"),a=Ct.HEADER_FIELD_START;break}}else if(c&Pn.LAST_BOUNDARY)if(g===fi)S("onPartEnd"),a=Ct.END,c=0;else l=0;else l=0;if(l>0)o[l-1]=g;else if(n>0){let b=new Uint8Array(o.buffer,o.byteOffset,o.byteLength);S("onPartData",0,n,b),n=0,_("onPartData"),t--}break;case Ct.END:break;default:throw Error(`Unexpected state entered: ${a}`)}E("onHeaderField"),E("onHeaderValue"),E("onPartData"),this.index=l,this.state=a,this.flags=c}end(){if(this.state===Ct.HEADER_FIELD_START&&this.index===0||this.state===Ct.PART_DATA&&this.index===this.boundary.length)this.onPartEnd();else if(this.state!==Ct.END)throw Error("MultipartParser.end(): stream ended unexpectedly")}}}});async function Pc(e){if(e[dr].disturbed)throw TypeError(`body used already for: ${e.url}`);if(e[dr].disturbed=!0,e[dr].error)throw e[dr].error;let{body:t}=e;if(t===null)return Nr.alloc(0);if(!(t instanceof ao))return Nr.alloc(0);let r=[],n=0;try{for await(let o of t){if(e.size>0&&n+o.length>e.size){let i=new Or(`content size at ${e.url} over limit: ${e.size}`,"max-size");throw t.destroy(i),i}n+=o.length,r.push(o)}}catch(o){throw o instanceof Hs?o:new Or(`Invalid response body while trying to fetch ${e.url}: ${o.message}`,"system",o)}if(t.readableEnded===!0||t._readableState.ended===!0)try{if(r.every((o)=>typeof o==="string"))return Nr.from(r.join(""));return Nr.concat(r,n)}catch(o){throw new Or(`Could not create Buffer from response body for ${e.url}: ${o.message}`,"system",o)}else throw new Or(`Premature close of server response while trying to fetch ${e.url}`)}var sp,dr,Si,Sl,ap,ku,fv,pv,Nu=Jt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/body.js"(){yl(),Au(),tv(),Iu(),Pu(),sp=LC(ao.pipeline),dr=Symbol("Body internals"),Si=class{constructor(e,{size:t=0}={}){let r=null;if(e===null)e=null;else if(Jc(e))e=Nr.from(e.toString());else if(Es(e));else if(Nr.isBuffer(e));else if(ip.isAnyArrayBuffer(e))e=Nr.from(e);else if(ArrayBuffer.isView(e))e=Nr.from(e.buffer,e.byteOffset,e.byteLength);else if(e instanceof ao);else if(e instanceof wi)e=PC(e),r=e.type.split("=")[1];else e=Nr.from(String(e));let n=e;if(Nr.isBuffer(e))n=ao.Readable.from(e);else if(Es(e))n=ao.Readable.from(e.stream());if(this[dr]={body:e,stream:n,boundary:r,disturbed:!1,error:null},this.size=t,e instanceof ao)e.on("error",(o)=>{let i=o instanceof Hs?o:new Or(`Invalid response body while trying to fetch ${this.url}: ${o.message}`,"system",o);this[dr].error=i})}get body(){return this[dr].stream}get bodyUsed(){return this[dr].disturbed}async arrayBuffer(){let{buffer:e,byteOffset:t,byteLength:r}=await Pc(this);return e.slice(t,t+r)}async formData(){let e=this.headers.get("content-type");if(e.startsWith("application/x-www-form-urlencoded")){let r=new wi,n=new URLSearchParams(await this.text());for(let[o,i]of n)r.append(o,i);return r}let{toFormData:t}=await Promise.resolve().then(()=>(xC(),uv));return t(this.body,e)}async blob(){let e=this.headers&&this.headers.get("content-type")||this[dr].body&&this[dr].body.type||"",t=await this.arrayBuffer();return new $o([t],{type:e})}async json(){let e=await this.text();return JSON.parse(e)}async text(){let e=await Pc(this);return new TextDecoder().decode(e)}buffer(){return Pc(this)}},Si.prototype.buffer=Ic(Si.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer"),Object.defineProperties(Si.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:Ic(()=>{},"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}}),Sl=(e,t)=>{let r,n,{body:o}=e[dr];if(e.bodyUsed)throw Error("cannot clone body after it is used");if(o instanceof ao&&typeof o.getBoundary!=="function")r=new op({highWaterMark:t}),n=new op({highWaterMark:t}),o.pipe(r),o.pipe(n),e[dr].stream=r,o=n;return o},ap=Ic((e)=>e.getBoundary(),"form-data doesn't follow the spec and requires special treatment. Use alternative package","https://github.com/node-fetch/node-fetch/issues/1167"),ku=(e,t)=>{if(e===null)return null;if(typeof e==="string")return"text/plain;charset=UTF-8";if(Jc(e))return"application/x-www-form-urlencoded;charset=UTF-8";if(Es(e))return e.type||null;if(Nr.isBuffer(e)||ip.isAnyArrayBuffer(e)||ArrayBuffer.isView(e))return null;if(e instanceof wi)return`multipart/form-data; boundary=${t[dr].boundary}`;if(e&&typeof e.getBoundary==="function")return`multipart/form-data;boundary=${ap(e)}`;if(e instanceof ao)return null;return"text/plain;charset=UTF-8"},fv=(e)=>{let{body:t}=e[dr];if(t===null)return 0;if(Es(t))return t.size;if(Nr.isBuffer(t))return t.length;if(t&&typeof t.getLengthSync==="function")return t.hasKnownLength&&t.hasKnownLength()?t.getLengthSync():null;return null},pv=async(e,{body:t})=>{if(t===null)e.end();else await sp(t,e)}}});function qC(e=[]){return new Mn(e.reduce((t,r,n,o)=>{if(n%2===0)t.push(o.slice(n,n+2));return t},[]).filter(([t,r])=>{try{return bs(t),Fa(t,String(r)),!0}catch{return!1}}))}var bs,Fa,Mn,Ou=Jt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/headers.js"(){bs=typeof ya.validateHeaderName==="function"?ya.validateHeaderName:(e)=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(e)){let t=TypeError(`Header name must be a valid HTTP token [${e}]`);throw Object.defineProperty(t,"code",{value:"ERR_INVALID_HTTP_TOKEN"}),t}},Fa=typeof ya.validateHeaderValue==="function"?ya.validateHeaderValue:(e,t)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(t)){let r=TypeError(`Invalid character in header content ["${e}"]`);throw Object.defineProperty(r,"code",{value:"ERR_INVALID_CHAR"}),r}},Mn=class e extends URLSearchParams{constructor(t){let r=[];if(t instanceof e){let n=t.raw();for(let[o,i]of Object.entries(n))r.push(...i.map((s)=>[o,s]))}else if(t==null);else if(typeof t==="object"&&!lp.isBoxedPrimitive(t)){let n=t[Symbol.iterator];if(n==null)r.push(...Object.entries(t));else{if(typeof n!=="function")throw TypeError("Header pairs must be iterable");r=[...t].map((o)=>{if(typeof o!=="object"||lp.isBoxedPrimitive(o))throw TypeError("Each header pair must be an iterable object");return[...o]}).map((o)=>{if(o.length!==2)throw TypeError("Each header pair must be a name/value tuple");return[...o]})}}else throw TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)");r=r.length>0?r.map(([n,o])=>(bs(n),Fa(n,String(o)),[String(n).toLowerCase(),String(o)])):void 0;super(r);return new Proxy(this,{get(n,o,i){switch(o){case"append":case"set":return(s,l)=>(bs(s),Fa(s,String(l)),URLSearchParams.prototype[o].call(n,String(s).toLowerCase(),String(l)));case"delete":case"has":case"getAll":return(s)=>(bs(s),URLSearchParams.prototype[o].call(n,String(s).toLowerCase()));case"keys":return()=>(n.sort(),new Set(URLSearchParams.prototype.keys.call(n)).keys());default:return Reflect.get(n,o,i)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get(t){let r=this.getAll(t);if(r.length===0)return null;let n=r.join(", ");if(/^content-encoding$/i.test(t))n=n.toLowerCase();return n}forEach(t,r=void 0){for(let n of this.keys())Reflect.apply(t,r,[this.get(n),n,this])}*values(){for(let t of this.keys())yield this.get(t)}*entries(){for(let t of this.keys())yield[t,this.get(t)]}[Symbol.iterator](){return this.entries()}raw(){return[...this.keys()].reduce((t,r)=>(t[r]=this.getAll(r),t),{})}[Symbol.for("nodejs.util.inspect.custom")](){return[...this.keys()].reduce((t,r)=>{let n=this.getAll(r);if(r==="host")t[r]=n[0];else t[r]=n.length>1?n:n[0];return t},{})}},Object.defineProperties(Mn.prototype,["get","entries","forEach","values"].reduce((e,t)=>(e[t]={enumerable:!0},e),{}))}}),cp,El,hv=Jt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/utils/is-redirect.js"(){cp=new Set([301,302,303,307,308]),El=(e)=>cp.has(e)}}),Ir,an,UC=Jt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/response.js"(){Ou(),Nu(),hv(),Ir=Symbol("Response internals"),an=class e extends Si{constructor(t=null,r={}){super(t,r);let n=r.status!=null?r.status:200,o=new Mn(r.headers);if(t!==null&&!o.has("Content-Type")){let i=ku(t,this);if(i)o.append("Content-Type",i)}this[Ir]={type:"default",url:r.url,status:n,statusText:r.statusText||"",headers:o,counter:r.counter,highWaterMark:r.highWaterMark}}get type(){return this[Ir].type}get url(){return this[Ir].url||""}get status(){return this[Ir].status}get ok(){return this[Ir].status>=200&&this[Ir].status<300}get redirected(){return this[Ir].counter>0}get statusText(){return this[Ir].statusText}get headers(){return this[Ir].headers}get highWaterMark(){return this[Ir].highWaterMark}clone(){return new e(Sl(this,this.highWaterMark),{type:this.type,url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected,size:this.size,highWaterMark:this.highWaterMark})}static redirect(t,r=302){if(!El(r))throw RangeError('Failed to execute "redirect" on "response": Invalid status code');return new e(null,{headers:{location:new URL(t).toString()},status:r})}static error(){let t=new e(null,{status:0,statusText:""});return t[Ir].type="error",t}static json(t=void 0,r={}){let n=JSON.stringify(t);if(n===void 0)throw TypeError("data is not JSON serializable");let o=new Mn(r&&r.headers);if(!o.has("content-type"))o.set("content-type","application/json");return new e(n,{...r,headers:o})}get[Symbol.toStringTag](){return"Response"}},Object.defineProperties(an.prototype,{type:{enumerable:!0},url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}})}}),mv,FC=Jt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/utils/get-search.js"(){mv=(e)=>{if(e.search)return e.search;let t=e.href.length-1,r=e.hash||(e.href[t]==="#"?"#":"");return e.href[t-r.length]==="?"?"?":""}}});function up(e,t=!1){if(e==null)return"no-referrer";if(e=new URL(e),/^(about|blob|data):$/.test(e.protocol))return"no-referrer";if(e.username="",e.password="",e.hash="",t)e.pathname="",e.search="";return e}function BC(e){if(!Mu.has(e))throw TypeError(`Invalid referrerPolicy: ${e}`);return e}function HC(e){if(/^(http|ws)s:$/.test(e.protocol))return!0;let t=e.host.replace(/(^\[)|(]$)/g,""),r=GC(t);if(r===4&&/^127\./.test(t))return!0;if(r===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(t))return!0;if(e.host==="localhost"||e.host.endsWith(".localhost"))return!1;if(e.protocol==="file:")return!0;return!1}function pi(e){if(/^about:(blank|srcdoc)$/.test(e))return!0;if(e.protocol==="data:")return!0;if(/^(blob|filesystem):$/.test(e.protocol))return!0;return HC(e)}function zC(e,{referrerURLCallback:t,referrerOriginCallback:r}={}){if(e.referrer==="no-referrer"||e.referrerPolicy==="")return null;let n=e.referrerPolicy;if(e.referrer==="about:client")return"no-referrer";let o=e.referrer,i=up(o),s=up(o,!0);if(i.toString().length>4096)i=s;if(t)i=t(i);if(r)s=r(s);let l=new URL(e.url);switch(n){case"no-referrer":return"no-referrer";case"origin":return s;case"unsafe-url":return i;case"strict-origin":if(pi(i)&&!pi(l))return"no-referrer";return s.toString();case"strict-origin-when-cross-origin":if(i.origin===l.origin)return i;if(pi(i)&&!pi(l))return"no-referrer";return s;case"same-origin":if(i.origin===l.origin)return i;return"no-referrer";case"origin-when-cross-origin":if(i.origin===l.origin)return i;return s;case"no-referrer-when-downgrade":if(pi(i)&&!pi(l))return"no-referrer";return i;default:throw TypeError(`Invalid referrerPolicy: ${n}`)}}function VC(e){let t=(e.get("referrer-policy")||"").split(/[,\s]+/),r="";for(let n of t)if(n&&Mu.has(n))r=n;return r}var Mu,gv,vv=Jt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/utils/referrer.js"(){Mu=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]),gv="strict-origin-when-cross-origin"}}),Ht,hi,dp,Ns,_v,JC=Jt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/request.js"(){Ou(),Nu(),Pu(),FC(),vv(),Ht=Symbol("Request internals"),hi=(e)=>typeof e==="object"&&typeof e[Ht]==="object",dp=WC(()=>{},".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)"),Ns=class e extends Si{constructor(t,r={}){let n;if(hi(t))n=new URL(t.url);else n=new URL(t),t={};if(n.username!==""||n.password!=="")throw TypeError(`${n} is an url with embedded credentials.`);let o=r.method||t.method||"GET";if(/^(delete|get|head|options|post|put)$/i.test(o))o=o.toUpperCase();if(!hi(r)&&"data"in r)dp();if((r.body!=null||hi(t)&&t.body!==null)&&(o==="GET"||o==="HEAD"))throw TypeError("Request with GET/HEAD method cannot have body");let i=r.body?r.body:hi(t)&&t.body!==null?Sl(t):null;super(i,{size:r.size||t.size||0});let s=new Mn(r.headers||t.headers||{});if(i!==null&&!s.has("Content-Type")){let c=ku(i,this);if(c)s.set("Content-Type",c)}let l=hi(t)?t.signal:null;if("signal"in r)l=r.signal;if(l!=null&&!rv(l))throw TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");let a=r.referrer==null?t.referrer:r.referrer;if(a==="")a="no-referrer";else if(a){let c=new URL(a);a=/^about:(\/\/)?client$/.test(c)?"client":c}else a=void 0;this[Ht]={method:o,redirect:r.redirect||t.redirect||"follow",headers:s,parsedURL:n,signal:l,referrer:a},this.follow=r.follow===void 0?t.follow===void 0?20:t.follow:r.follow,this.compress=r.compress===void 0?t.compress===void 0?!0:t.compress:r.compress,this.counter=r.counter||t.counter||0,this.agent=r.agent||t.agent,this.highWaterMark=r.highWaterMark||t.highWaterMark||16384,this.insecureHTTPParser=r.insecureHTTPParser||t.insecureHTTPParser||!1,this.referrerPolicy=r.referrerPolicy||t.referrerPolicy||""}get method(){return this[Ht].method}get url(){return jC(this[Ht].parsedURL)}get headers(){return this[Ht].headers}get redirect(){return this[Ht].redirect}get signal(){return this[Ht].signal}get referrer(){if(this[Ht].referrer==="no-referrer")return"";if(this[Ht].referrer==="client")return"about:client";if(this[Ht].referrer)return this[Ht].referrer.toString();return}get referrerPolicy(){return this[Ht].referrerPolicy}set referrerPolicy(t){this[Ht].referrerPolicy=BC(t)}clone(){return new e(this)}get[Symbol.toStringTag](){return"Request"}},Object.defineProperties(Ns.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0},referrer:{enumerable:!0},referrerPolicy:{enumerable:!0}}),_v=(e)=>{let{parsedURL:t}=e[Ht],r=new Mn(e[Ht].headers);if(!r.has("Accept"))r.set("Accept","*/*");let n=null;if(e.body===null&&/^(post|put)$/i.test(e.method))n="0";if(e.body!==null){let l=fv(e);if(typeof l==="number"&&!Number.isNaN(l))n=String(l)}if(n)r.set("Content-Length",n);if(e.referrerPolicy==="")e.referrerPolicy=gv;if(e.referrer&&e.referrer!=="no-referrer")e[Ht].referrer=zC(e);else e[Ht].referrer="no-referrer";if(e[Ht].referrer instanceof URL)r.set("Referer",e.referrer);if(!r.has("User-Agent"))r.set("User-Agent","node-fetch");if(e.compress&&!r.has("Accept-Encoding"))r.set("Accept-Encoding","gzip, deflate, br");let{agent:o}=e;if(typeof o==="function")o=o(t);let i=mv(t),s={path:t.pathname+i,method:e.method,headers:r[Symbol.for("nodejs.util.inspect.custom")](),insecureHTTPParser:e.insecureHTTPParser,agent:o};return{parsedURL:t,options:s}}}}),Du,KC=Jt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/errors/abort-error.js"(){Iu(),Du=class extends Hs{constructor(e,t="aborted"){super(e,t)}}}}),yv={};Gs(yv,{AbortError:()=>Du,Blob:()=>$o,FetchError:()=>Or,File:()=>Bs,FormData:()=>wi,Headers:()=>Mn,Request:()=>Ns,Response:()=>an,blobFrom:()=>sv,blobFromSync:()=>iv,default:()=>Sv,fileFrom:()=>av,fileFromSync:()=>lv,isRedirect:()=>El});async function Sv(e,t){return new Promise((r,n)=>{let o=new Ns(e,t),{parsedURL:i,options:s}=_v(o);if(!Ev.has(i.protocol))throw TypeError(`node-fetch cannot load ${e}. URL scheme "${i.protocol.replace(/:$/,"")}" is not supported.`);if(i.protocol==="data:"){let p=Qg(o.url),_=new an(p,{headers:{"Content-Type":p.typeFull}});r(_);return}let l=(i.protocol==="https:"?YC:XC).request,{signal:a}=o,c=null,u=()=>{let p=new Du("The operation was aborted.");if(n(p),o.body&&o.body instanceof fp.Readable)o.body.destroy(p);if(!c||!c.body)return;c.body.emit("error",p)};if(a&&a.aborted){u();return}let f=()=>{u(),g()},h=l(i.toString(),s);if(a)a.addEventListener("abort",f);let g=()=>{if(h.abort(),a)a.removeEventListener("abort",f)};if(h.on("error",(p)=>{n(new Or(`request to ${o.url} failed, reason: ${p.message}`,"system",p)),g()}),ZC(h,(p)=>{if(c&&c.body)c.body.destroy(p)}),process.version<"v14")h.on("socket",(p)=>{let _;p.prependListener("end",()=>{_=p._eventsCount}),p.prependListener("close",(y)=>{if(c&&_<p._eventsCount&&!y){let S=Error("Premature close");S.code="ERR_STREAM_PREMATURE_CLOSE",c.body.emit("error",S)}})});h.on("response",(p)=>{h.setTimeout(0);let _=qC(p.rawHeaders);if(El(p.statusCode)){let R=_.get("Location"),w=null;try{w=R===null?null:new URL(R,o.url)}catch{if(o.redirect!=="manual"){n(new Or(`uri requested responds with an invalid redirect URL: ${R}`,"invalid-redirect")),g();return}}switch(o.redirect){case"error":n(new Or(`uri requested responds with a redirect, redirect mode is set to error: ${o.url}`,"no-redirect")),g();return;case"manual":break;case"follow":{if(w===null)break;if(o.counter>=o.follow){n(new Or(`maximum redirect reached at: ${o.url}`,"max-redirect")),g();return}let T={headers:new Mn(o.headers),follow:o.follow,counter:o.counter+1,agent:o.agent,compress:o.compress,method:o.method,body:Sl(o),signal:o.signal,size:o.size,referrer:o.referrer,referrerPolicy:o.referrerPolicy};if(!nv(o.url,w)||!ov(o.url,w))for(let A of["authorization","www-authenticate","cookie","cookie2"])T.headers.delete(A);if(p.statusCode!==303&&o.body&&t.body instanceof fp.Readable){n(new Or("Cannot follow redirect with body being a readable stream","unsupported-redirect")),g();return}if(p.statusCode===303||(p.statusCode===301||p.statusCode===302)&&o.method==="POST")T.method="GET",T.body=void 0,T.headers.delete("content-length");let C=VC(_);if(C)T.referrerPolicy=C;r(Sv(new Ns(w,T))),g();return}default:return n(TypeError(`Redirect option '${o.redirect}' is not a valid value of RequestRedirect`))}}if(a)p.once("end",()=>{a.removeEventListener("abort",f)});let y=gi(p,new pp,(R)=>{if(R)n(R)});if(process.version<"v12.10")p.on("aborted",f);let S={url:o.url,status:p.statusCode,statusText:p.statusMessage,headers:_,size:o.size,counter:o.counter,highWaterMark:o.highWaterMark},E=_.get("Content-Encoding");if(!o.compress||o.method==="HEAD"||E===null||p.statusCode===204||p.statusCode===304){c=new an(y,S),r(c);return}let b={flush:mi.Z_SYNC_FLUSH,finishFlush:mi.Z_SYNC_FLUSH};if(E==="gzip"||E==="x-gzip"){y=gi(y,mi.createGunzip(b),(R)=>{if(R)n(R)}),c=new an(y,S),r(c);return}if(E==="deflate"||E==="x-deflate"){let R=gi(p,new pp,(w)=>{if(w)n(w)});R.once("data",(w)=>{if((w[0]&15)===8)y=gi(y,mi.createInflate(),(T)=>{if(T)n(T)});else y=gi(y,mi.createInflateRaw(),(T)=>{if(T)n(T)});c=new an(y,S),r(c)}),R.once("end",()=>{if(!c)c=new an(y,S),r(c)});return}if(E==="br"){y=gi(y,mi.createBrotliDecompress(),(R)=>{if(R)n(R)}),c=new an(y,S),r(c);return}c=new an(y,S),r(c)}),pv(h,o).catch(n)})}function ZC(e,t){let r=Sa.from(`0\r
25
+ \r
26
+ `),n=!1,o=!1,i;e.on("response",(s)=>{let{headers:l}=s;n=l["transfer-encoding"]==="chunked"&&!l["content-length"]}),e.on("socket",(s)=>{let l=()=>{if(n&&!o){let c=Error("Premature close");c.code="ERR_STREAM_PREMATURE_CLOSE",t(c)}},a=(c)=>{if(o=Sa.compare(c.slice(-5),r)===0,!o&&i)o=Sa.compare(i.slice(-3),r.slice(0,3))===0&&Sa.compare(c.slice(-2),r.slice(3))===0;i=c};s.prependListener("close",l),s.on("data",a),e.on("close",()=>{s.removeListener("close",l),s.removeListener("data",a)})})}var Ev,QC=Jt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/index.js"(){CC(),Nu(),UC(),Ou(),JC(),tv(),KC(),hv(),Au(),Pu(),vv(),cv(),Ev=new Set(["data:","http:","https:"])}}),eR=ye({"../node_modules/.bun/gaxios@7.3.1+759ce506b1ed1a42/node_modules/gaxios/build/cjs/src/gaxios.js"(e){var t=e&&e.__importDefault||function(h){return h&&h.__esModule?h:{default:h}},r;Object.defineProperty(e,"__esModule",{value:!0}),e.Gaxios=void 0;var n=t(Jg()),o=we("https"),i=Kg(),s=hC(),l=we("stream"),a=Xg(),c=async()=>globalThis.crypto?.randomUUID()||(await import("crypto")).randomUUID(),u=204,f=class{agentCache=new Map;defaults;interceptors;constructor(h){this.defaults=h||{},this.interceptors={request:new a.GaxiosInterceptorManager,response:new a.GaxiosInterceptorManager}}fetch(...h){let g=h[0],p=h[1],_=void 0,y=new Headers;if(typeof g==="string")_=new URL(g);else if(g instanceof URL)_=g;else if(g&&g.url)_=new URL(g.url);if(g&&typeof g==="object"&&"headers"in g)r.mergeHeaders(y,g.headers);if(p)r.mergeHeaders(y,new Headers(p.headers));if(typeof g==="object"&&!(g instanceof URL))return this.request({...p,...g,headers:y,url:_});else return this.request({...p,headers:y,url:_})}async request(h={}){let g=await this.#n(h);return g=await this.#t(g),this.#r(this._request(g))}async _defaultAdapter(h){let g=h.fetchImplementation||this.defaults.fetchImplementation||await r.#l(),p={...h};delete p.data;let _=await g(h.url,p),y=await this.getResponseData(h,_);if(!Object.getOwnPropertyDescriptor(_,"data")?.configurable)Object.defineProperties(_,{data:{configurable:!0,writable:!0,enumerable:!0,value:y}});return Object.assign(_,{config:h,data:y})}async _request(h){try{let g;if(h.adapter)g=await h.adapter(h,this._defaultAdapter.bind(this));else g=await this._defaultAdapter(h);if(!h.validateStatus(g.status)){if(h.responseType==="stream"){let _=[];for await(let y of g.data)_.push(y);g.data=Buffer.concat(_.map((y)=>typeof y==="string"?Buffer.from(y):y)).toString("utf8")}let p=i.GaxiosError.extractAPIErrorFromResponse(g,`Request failed with status code ${g.status}`);throw new i.GaxiosError(p?.message,h,g,p)}return g}catch(g){let p;if(g instanceof i.GaxiosError)p=g;else if(g instanceof Error)p=new i.GaxiosError(g.message,h,void 0,g);else p=new i.GaxiosError("Unexpected Gaxios Error",h,void 0,g);let{shouldRetry:_,config:y}=await(0,s.getRetryConfig)(p);if(_&&y)return p.config.retryConfig.currentRetryAttempt=y.retryConfig.currentRetryAttempt,h.retryConfig=p.config?.retryConfig,this.#o(h),this._request(h);if(h.errorRedactor)h.errorRedactor(p);throw p}}async getResponseData(h,g){if(g.status===u)return"";if(h.maxContentLength&&g.headers.has("content-length")&&h.maxContentLength<Number.parseInt(g.headers?.get("content-length")||""))throw new i.GaxiosError("Response's `Content-Length` is over the limit.",h,Object.assign(g,{config:h}));switch(h.responseType){case"stream":return g.body;case"json":{let p=await g.text();try{return JSON.parse(p)}catch{return p}}case"arraybuffer":return g.arrayBuffer();case"blob":return g.blob();case"text":return g.text();default:return this.getResponseDataFromContentType(g)}}#e(h,g=[]){let p=new URL(h),_=[...g],y=(process.env.NO_PROXY??process.env.no_proxy)?.split(",")||[];for(let S of y)_.push(S.trim());for(let S of _)if(S instanceof RegExp){if(S.test(p.toString()))return!1}else if(S instanceof URL){if(S.origin===p.origin)return!1}else if(S.startsWith("*.")||S.startsWith(".")){let E=S.replace(/^\*\./,".");if(p.hostname.endsWith(E))return!1}else if(S===p.origin||S===p.hostname||S===p.href)return!1;return!0}async#t(h){let g=Promise.resolve(h);for(let p of this.interceptors.request.values())if(p)g=g.then(p.resolved,p.rejected);return g}async#r(h){let g=Promise.resolve(h);for(let p of this.interceptors.response.values())if(p)g=g.then(p.resolved,p.rejected);return g}async#n(h){let g=new Headers(this.defaults.headers);r.mergeHeaders(g,h.headers);let p=(0,n.default)(!0,{},this.defaults,h);if(!p.url)throw Error("URL is required.");if(p.baseURL)p.url=new URL(p.url,p.baseURL);if(p.url=new URL(p.url),p.params)if(p.paramsSerializer){let S=p.paramsSerializer(p.params);if(S.startsWith("?"))S=S.slice(1);let E=p.url.toString().includes("?")?"&":"?";p.url=p.url+E+S}else{let S=p.url instanceof URL?p.url:new URL(p.url);for(let[E,b]of new URLSearchParams(p.params))S.searchParams.append(E,b);p.url=S}if(typeof h.maxContentLength==="number")p.size=h.maxContentLength;if(typeof h.maxRedirects==="number")p.follow=h.maxRedirects;let _=typeof p.data==="string"||p.data instanceof ArrayBuffer||p.data instanceof Blob||globalThis.File&&p.data instanceof File||p.data instanceof FormData||p.data instanceof l.Readable||p.data instanceof ReadableStream||p.data instanceof String||p.data instanceof URLSearchParams||ArrayBuffer.isView(p.data)||["Blob","File","FormData"].includes(p.data?.constructor?.name||"");if(p.multipart?.length){let S=await c();g.set("content-type",`multipart/related; boundary=${S}`),p.body=l.Readable.from(this.getMultipartRequest(p.multipart,S))}else if(_)p.body=p.data;else if(typeof p.data==="object")if(g.get("Content-Type")==="application/x-www-form-urlencoded")p.body=p.paramsSerializer?p.paramsSerializer(p.data):new URLSearchParams(p.data);else{if(!g.has("content-type"))g.set("content-type","application/json");p.body=JSON.stringify(p.data)}else if(p.data)p.body=p.data;if(p.validateStatus=p.validateStatus||this.validateStatus,p.responseType=p.responseType||"unknown",!g.has("accept")&&p.responseType==="json")g.set("accept","application/json");let y=p.proxy||process?.env?.HTTPS_PROXY||process?.env?.https_proxy||process?.env?.HTTP_PROXY||process?.env?.http_proxy;if(p.agent);else if(y&&this.#e(p.url,p.noProxy)){let S=await r.#a();if(this.agentCache.has(y))p.agent=this.agentCache.get(y);else p.agent=new S(y,{cert:p.cert,key:p.key}),this.agentCache.set(y,p.agent)}else if(p.cert&&p.key)if(this.agentCache.has(p.key))p.agent=this.agentCache.get(p.key);else p.agent=new o.Agent({cert:p.cert,key:p.key}),this.agentCache.set(p.key,p.agent);if(typeof p.errorRedactor!=="function"&&p.errorRedactor!==!1)p.errorRedactor=i.defaultErrorRedactor;if(p.body&&!("duplex"in p))p.duplex="half";return this.#o(p),Object.assign(p,{headers:g,url:p.url instanceof URL?p.url:new URL(p.url)})}#o(h){if(h.timeout){let g=AbortSignal.timeout(h.timeout);if(h.signal&&!h.signal.aborted)h.signal=AbortSignal.any([h.signal,g]);else h.signal=g}}validateStatus(h){return h>=200&&h<300}async getResponseDataFromContentType(h){let g=h.headers.get("Content-Type");if(g===null)return h.text();if(g=g.toLowerCase(),g.includes("application/json")){let p=await h.text();try{p=JSON.parse(p)}catch{}return p}else if(g.match(/^text\//))return h.text();else return h.blob()}async*getMultipartRequest(h,g){let p=`--${g}--`;for(let _ of h){let y=_.headers.get("Content-Type")||"application/octet-stream";if(yield`--${g}\r
27
+ Content-Type: ${y}\r
28
+ \r
29
+ `,typeof _.content==="string")yield _.content;else yield*_.content;yield`\r
30
+ `}yield p}static#i;static#s;static async#a(){return this.#i||=(await Promise.resolve().then(()=>Cr(wC()))).HttpsProxyAgent,this.#i}static async#l(){let h=typeof window<"u"&&!!window;return this.#s||=h?window.fetch:(await Promise.resolve().then(()=>(QC(),yv))).default,this.#s}static mergeHeaders(h,...g){h=h instanceof Headers?h:new Headers(h);for(let p of g)(p instanceof Headers?p:new Headers(p)).forEach((y,S)=>{S==="set-cookie"?h.append(S,y):h.set(S,y)});return h}};e.Gaxios=f,r=f}}),rr=ye({"../node_modules/.bun/gaxios@7.3.1+759ce506b1ed1a42/node_modules/gaxios/build/cjs/src/index.js"(e){var t=e&&e.__createBinding||(Object.create?function(s,l,a,c){if(c===void 0)c=a;var u=Object.getOwnPropertyDescriptor(l,a);if(!u||("get"in u?!l.__esModule:u.writable||u.configurable))u={enumerable:!0,get:function(){return l[a]}};Object.defineProperty(s,c,u)}:function(s,l,a,c){if(c===void 0)c=a;s[c]=l[a]}),r=e&&e.__exportStar||function(s,l){for(var a in s)if(a!=="default"&&!Object.prototype.hasOwnProperty.call(l,a))t(l,s,a)};Object.defineProperty(e,"__esModule",{value:!0}),e.instance=e.Gaxios=e.GaxiosError=void 0,e.request=i;var n=eR();Object.defineProperty(e,"Gaxios",{enumerable:!0,get:function(){return n.Gaxios}});var o=Kg();Object.defineProperty(e,"GaxiosError",{enumerable:!0,get:function(){return o.GaxiosError}}),r(Xg(),e),e.instance=new n.Gaxios;async function i(s){return e.instance.request(s)}}}),bv=ye({"../node_modules/.bun/bignumber.js@9.3.1/node_modules/bignumber.js/bignumber.js"(e,t){(function(r){var n,o=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,{ceil:i,floor:s}=Math,l="[BigNumber Error] ",a=l+"Number primitive has more than 15 significant digits: ",c=100000000000000,u=14,f=9007199254740991,h=[1,10,100,1000,1e4,1e5,1e6,1e7,1e8,1e9,10000000000,100000000000,1000000000000,10000000000000],g=1e7,p=1e9;function _(C){var A,P,D,N=W.prototype={constructor:W,toString:null,valueOf:null},F=new W(1),G=20,B=4,Q=-7,pe=21,se=-1e7,ve=1e7,me=!1,j=1,ne=0,he={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},q="0123456789abcdefghijklmnopqrstuvwxyz",K=!0;function W(U,O){var x,H,J,Y,ee,Z,te,oe,L=this;if(!(L instanceof W))return new W(U,O);if(O==null){if(U&&U._isBigNumber===!0){if(L.s=U.s,!U.c||U.e>ve)L.c=L.e=null;else if(U.e<se)L.c=[L.e=0];else L.e=U.e,L.c=U.c.slice();return}if((Z=typeof U=="number")&&U*0==0){if(L.s=1/U<0?(U=-U,-1):1,U===~~U){for(Y=0,ee=U;ee>=10;ee/=10,Y++);if(Y>ve)L.c=L.e=null;else L.e=Y,L.c=[U];return}oe=String(U)}else{if(!o.test(oe=String(U)))return D(L,oe,Z);L.s=oe.charCodeAt(0)==45?(oe=oe.slice(1),-1):1}if((Y=oe.indexOf("."))>-1)oe=oe.replace(".","");if((ee=oe.search(/e/i))>0){if(Y<0)Y=ee;Y+=+oe.slice(ee+1),oe=oe.substring(0,ee)}else if(Y<0)Y=oe.length}else{if(b(O,2,q.length,"Base"),O==10&&K)return L=new W(U),Ie(L,G+L.e+1,B);if(oe=String(U),Z=typeof U=="number"){if(U*0!=0)return D(L,oe,Z,O);if(L.s=1/U<0?(oe=oe.slice(1),-1):1,W.DEBUG&&oe.replace(/^0\.0*|\./,"").length>15)throw Error(a+U)}else L.s=oe.charCodeAt(0)===45?(oe=oe.slice(1),-1):1;x=q.slice(0,O),Y=ee=0;for(te=oe.length;ee<te;ee++)if(x.indexOf(H=oe.charAt(ee))<0){if(H=="."){if(ee>Y){Y=te;continue}}else if(!J){if(oe==oe.toUpperCase()&&(oe=oe.toLowerCase())||oe==oe.toLowerCase()&&(oe=oe.toUpperCase())){J=!0,ee=-1,Y=0;continue}}return D(L,String(U),Z,O)}if(Z=!1,oe=P(oe,O,10,L.s),(Y=oe.indexOf("."))>-1)oe=oe.replace(".","");else Y=oe.length}for(ee=0;oe.charCodeAt(ee)===48;ee++);for(te=oe.length;oe.charCodeAt(--te)===48;);if(oe=oe.slice(ee,++te)){if(te-=ee,Z&&W.DEBUG&&te>15&&(U>f||U!==s(U)))throw Error(a+L.s*U);if((Y=Y-ee-1)>ve)L.c=L.e=null;else if(Y<se)L.c=[L.e=0];else{if(L.e=Y,L.c=[],ee=(Y+1)%u,Y<0)ee+=u;if(ee<te){if(ee)L.c.push(+oe.slice(0,ee));for(te-=u;ee<te;)L.c.push(+oe.slice(ee,ee+=u));ee=u-(oe=oe.slice(ee)).length}else ee-=te;for(;ee--;oe+="0");L.c.push(+oe)}}else L.c=[L.e=0]}W.clone=_,W.ROUND_UP=0,W.ROUND_DOWN=1,W.ROUND_CEIL=2,W.ROUND_FLOOR=3,W.ROUND_HALF_UP=4,W.ROUND_HALF_DOWN=5,W.ROUND_HALF_EVEN=6,W.ROUND_HALF_CEIL=7,W.ROUND_HALF_FLOOR=8,W.EUCLID=9,W.config=W.set=function(U){var O,x;if(U!=null)if(typeof U=="object"){if(U.hasOwnProperty(O="DECIMAL_PLACES"))x=U[O],b(x,0,p,O),G=x;if(U.hasOwnProperty(O="ROUNDING_MODE"))x=U[O],b(x,0,8,O),B=x;if(U.hasOwnProperty(O="EXPONENTIAL_AT"))if(x=U[O],x&&x.pop)b(x[0],-p,0,O),b(x[1],0,p,O),Q=x[0],pe=x[1];else b(x,-p,p,O),Q=-(pe=x<0?-x:x);if(U.hasOwnProperty(O="RANGE"))if(x=U[O],x&&x.pop)b(x[0],-p,-1,O),b(x[1],1,p,O),se=x[0],ve=x[1];else if(b(x,-p,p,O),x)se=-(ve=x<0?-x:x);else throw Error(l+O+" cannot be zero: "+x);if(U.hasOwnProperty(O="CRYPTO"))if(x=U[O],x===!!x)if(x)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))me=x;else throw me=!x,Error(l+"crypto unavailable");else me=x;else throw Error(l+O+" not true or false: "+x);if(U.hasOwnProperty(O="MODULO_MODE"))x=U[O],b(x,0,9,O),j=x;if(U.hasOwnProperty(O="POW_PRECISION"))x=U[O],b(x,0,p,O),ne=x;if(U.hasOwnProperty(O="FORMAT"))if(x=U[O],typeof x=="object")he=x;else throw Error(l+O+" not an object: "+x);if(U.hasOwnProperty(O="ALPHABET"))if(x=U[O],typeof x=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(x))K=x.slice(0,10)=="0123456789",q=x;else throw Error(l+O+" invalid: "+x)}else throw Error(l+"Object expected: "+U);return{DECIMAL_PLACES:G,ROUNDING_MODE:B,EXPONENTIAL_AT:[Q,pe],RANGE:[se,ve],CRYPTO:me,MODULO_MODE:j,POW_PRECISION:ne,FORMAT:he,ALPHABET:q}},W.isBigNumber=function(U){if(!U||U._isBigNumber!==!0)return!1;if(!W.DEBUG)return!0;var O,x,{c:H,e:J,s:Y}=U;e:if({}.toString.call(H)=="[object Array]"){if((Y===1||Y===-1)&&J>=-p&&J<=p&&J===s(J)){if(H[0]===0){if(J===0&&H.length===1)return!0;break e}if(O=(J+1)%u,O<1)O+=u;if(String(H[0]).length==O){for(O=0;O<H.length;O++)if(x=H[O],x<0||x>=c||x!==s(x))break e;if(x!==0)return!0}}}else if(H===null&&J===null&&(Y===null||Y===1||Y===-1))return!0;throw Error(l+"Invalid BigNumber: "+U)},W.maximum=W.max=function(){return Ce(arguments,-1)},W.minimum=W.min=function(){return Ce(arguments,1)},W.random=function(){var U=9007199254740992,O=Math.random()*U&2097151?function(){return s(Math.random()*U)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(x){var H,J,Y,ee,Z,te=0,oe=[],L=new W(F);if(x==null)x=G;else b(x,0,p);if(ee=i(x/u),me)if(crypto.getRandomValues){H=crypto.getRandomValues(new Uint32Array(ee*=2));for(;te<ee;)if(Z=H[te]*131072+(H[te+1]>>>11),Z>=9000000000000000)J=crypto.getRandomValues(new Uint32Array(2)),H[te]=J[0],H[te+1]=J[1];else oe.push(Z%100000000000000),te+=2;te=ee/2}else if(crypto.randomBytes){H=crypto.randomBytes(ee*=7);for(;te<ee;)if(Z=(H[te]&31)*281474976710656+H[te+1]*1099511627776+H[te+2]*4294967296+H[te+3]*16777216+(H[te+4]<<16)+(H[te+5]<<8)+H[te+6],Z>=9000000000000000)crypto.randomBytes(7).copy(H,te);else oe.push(Z%100000000000000),te+=7;te=ee/7}else throw me=!1,Error(l+"crypto unavailable");if(!me){for(;te<ee;)if(Z=O(),Z<9000000000000000)oe[te++]=Z%100000000000000}if(ee=oe[--te],x%=u,ee&&x)Z=h[u-x],oe[te]=s(ee/Z)*Z;for(;oe[te]===0;oe.pop(),te--);if(te<0)oe=[Y=0];else{for(Y=-1;oe[0]===0;oe.splice(0,1),Y-=u);for(te=1,Z=oe[0];Z>=10;Z/=10,te++);if(te<u)Y-=u-te}return L.e=Y,L.c=oe,L}}(),W.sum=function(){var U=1,O=arguments,x=new W(O[0]);for(;U<O.length;)x=x.plus(O[U++]);return x},P=function(){var U="0123456789";function O(x,H,J,Y){var ee,Z=[0],te,oe=0,L=x.length;for(;oe<L;){for(te=Z.length;te--;Z[te]*=H);Z[0]+=Y.indexOf(x.charAt(oe++));for(ee=0;ee<Z.length;ee++)if(Z[ee]>J-1){if(Z[ee+1]==null)Z[ee+1]=0;Z[ee+1]+=Z[ee]/J|0,Z[ee]%=J}}return Z.reverse()}return function(x,H,J,Y,ee){var Z,te,oe,L,V,ce,ue,ge,Ne=x.indexOf("."),et=G,He=B;if(Ne>=0)L=ne,ne=0,x=x.replace(".",""),ge=new W(H),ce=ge.pow(x.length-Ne),ne=L,ge.c=O(T(S(ce.c),ce.e,"0"),10,J,U),ge.e=ge.c.length;ue=O(x,H,J,ee?(Z=q,U):(Z=U,q)),oe=L=ue.length;for(;ue[--L]==0;ue.pop());if(!ue[0])return Z.charAt(0);if(Ne<0)--oe;else ce.c=ue,ce.e=oe,ce.s=Y,ce=A(ce,ge,et,He,J),ue=ce.c,V=ce.r,oe=ce.e;if(te=oe+et+1,Ne=ue[te],L=J/2,V=V||te<0||ue[te+1]!=null,V=He<4?(Ne!=null||V)&&(He==0||He==(ce.s<0?3:2)):Ne>L||Ne==L&&(He==4||V||He==6&&ue[te-1]&1||He==(ce.s<0?8:7)),te<1||!ue[0])x=V?T(Z.charAt(1),-et,Z.charAt(0)):Z.charAt(0);else{if(ue.length=te,V){for(--J;++ue[--te]>J;)if(ue[te]=0,!te)++oe,ue=[1].concat(ue)}for(L=ue.length;!ue[--L];);for(Ne=0,x="";Ne<=L;x+=Z.charAt(ue[Ne++]));x=T(x,oe,Z.charAt(0))}return x}}(),A=function(){function U(H,J,Y){var ee,Z,te,oe,L=0,V=H.length,ce=J%g,ue=J/g|0;for(H=H.slice();V--;)te=H[V]%g,oe=H[V]/g|0,ee=ue*te+oe*ce,Z=ce*te+ee%g*g+L,L=(Z/Y|0)+(ee/g|0)+ue*oe,H[V]=Z%Y;if(L)H=[L].concat(H);return H}function O(H,J,Y,ee){var Z,te;if(Y!=ee)te=Y>ee?1:-1;else for(Z=te=0;Z<Y;Z++)if(H[Z]!=J[Z]){te=H[Z]>J[Z]?1:-1;break}return te}function x(H,J,Y,ee){var Z=0;for(;Y--;)H[Y]-=Z,Z=H[Y]<J[Y]?1:0,H[Y]=Z*ee+H[Y]-J[Y];for(;!H[0]&&H.length>1;H.splice(0,1));}return function(H,J,Y,ee,Z){var te,oe,L,V,ce,ue,ge,Ne,et,He,We,St,Kt,Xt,xt,It,at,Ue=H.s==J.s?1:-1,Ve=H.c,Qe=J.c;if(!Ve||!Ve[0]||!Qe||!Qe[0])return new W(!H.s||!J.s||(Ve?Qe&&Ve[0]==Qe[0]:!Qe)?NaN:Ve&&Ve[0]==0||!Qe?Ue*0:Ue/0);if(Ne=new W(Ue),et=Ne.c=[],oe=H.e-J.e,Ue=Y+oe+1,!Z)Z=c,oe=y(H.e/u)-y(J.e/u),Ue=Ue/u|0;for(L=0;Qe[L]==(Ve[L]||0);L++);if(Qe[L]>(Ve[L]||0))oe--;if(Ue<0)et.push(1),V=!0;else{if(Xt=Ve.length,It=Qe.length,L=0,Ue+=2,ce=s(Z/(Qe[0]+1)),ce>1)Qe=U(Qe,ce,Z),Ve=U(Ve,ce,Z),It=Qe.length,Xt=Ve.length;Kt=It,He=Ve.slice(0,It),We=He.length;for(;We<It;He[We++]=0);if(at=Qe.slice(),at=[0].concat(at),xt=Qe[0],Qe[1]>=Z/2)xt++;do{if(ce=0,te=O(Qe,He,It,We),te<0){if(St=He[0],It!=We)St=St*Z+(He[1]||0);if(ce=s(St/xt),ce>1){if(ce>=Z)ce=Z-1;ue=U(Qe,ce,Z),ge=ue.length,We=He.length;while(O(ue,He,ge,We)==1)ce--,x(ue,It<ge?at:Qe,ge,Z),ge=ue.length,te=1}else{if(ce==0)te=ce=1;ue=Qe.slice(),ge=ue.length}if(ge<We)ue=[0].concat(ue);if(x(He,ue,We,Z),We=He.length,te==-1)while(O(Qe,He,It,We)<1)ce++,x(He,It<We?at:Qe,We,Z),We=He.length}else if(te===0)ce++,He=[0];if(et[L++]=ce,He[0])He[We++]=Ve[Kt]||0;else He=[Ve[Kt]],We=1}while((Kt++<Xt||He[0]!=null)&&Ue--);if(V=He[0]!=null,!et[0])et.splice(0,1)}if(Z==c){for(L=1,Ue=et[0];Ue>=10;Ue/=10,L++);Ie(Ne,Y+(Ne.e=L+oe*u-1)+1,ee,V)}else Ne.e=oe,Ne.r=+V;return Ne}}();function be(U,O,x,H){var J,Y,ee,Z,te;if(x==null)x=B;else b(x,0,8);if(!U.c)return U.toString();if(J=U.c[0],ee=U.e,O==null)te=S(U.c),te=H==1||H==2&&(ee<=Q||ee>=pe)?w(te,ee):T(te,ee,"0");else if(U=Ie(new W(U),O,x),Y=U.e,te=S(U.c),Z=te.length,H==1||H==2&&(O<=Y||Y<=Q)){for(;Z<O;te+="0",Z++);te=w(te,Y)}else if(O-=ee+(H===2&&Y>ee),te=T(te,Y,"0"),Y+1>Z){if(--O>0)for(te+=".";O--;te+="0");}else if(O+=Y-Z,O>0){if(Y+1==Z)te+=".";for(;O--;te+="0");}return U.s<0&&J?"-"+te:te}function Ce(U,O){var x,H,J=1,Y=new W(U[0]);for(;J<U.length;J++)if(H=new W(U[J]),!H.s||(x=E(Y,H))===O||x===0&&Y.s===O)Y=H;return Y}function ze(U,O,x){var H=1,J=O.length;for(;!O[--J];O.pop());for(J=O[0];J>=10;J/=10,H++);if((x=H+x*u-1)>ve)U.c=U.e=null;else if(x<se)U.c=[U.e=0];else U.e=x,U.c=O;return U}D=function(){var U=/^(-?)0([xbo])(?=\w[\w.]*$)/i,O=/^([^.]+)\.$/,x=/^\.([^.]+)$/,H=/^-?(Infinity|NaN)$/,J=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(Y,ee,Z,te){var oe,L=Z?ee:ee.replace(J,"");if(H.test(L))Y.s=isNaN(L)?null:L<0?-1:1;else{if(!Z){if(L=L.replace(U,function(V,ce,ue){return oe=(ue=ue.toLowerCase())=="x"?16:ue=="b"?2:8,!te||te==oe?ce:V}),te)oe=te,L=L.replace(O,"$1").replace(x,"0.$1");if(ee!=L)return new W(L,oe)}if(W.DEBUG)throw Error(l+"Not a"+(te?" base "+te:"")+" number: "+ee);Y.s=null}Y.c=Y.e=null}}();function Ie(U,O,x,H){var J,Y,ee,Z,te,oe,L,V=U.c,ce=h;if(V){e:{for(J=1,Z=V[0];Z>=10;Z/=10,J++);if(Y=O-J,Y<0)Y+=u,ee=O,te=V[oe=0],L=s(te/ce[J-ee-1]%10);else if(oe=i((Y+1)/u),oe>=V.length)if(H){for(;V.length<=oe;V.push(0));te=L=0,J=1,Y%=u,ee=Y-u+1}else break e;else{te=Z=V[oe];for(J=1;Z>=10;Z/=10,J++);Y%=u,ee=Y-u+J,L=ee<0?0:s(te/ce[J-ee-1]%10)}if(H=H||O<0||V[oe+1]!=null||(ee<0?te:te%ce[J-ee-1]),H=x<4?(L||H)&&(x==0||x==(U.s<0?3:2)):L>5||L==5&&(x==4||H||x==6&&(Y>0?ee>0?te/ce[J-ee]:0:V[oe-1])%10&1||x==(U.s<0?8:7)),O<1||!V[0]){if(V.length=0,H)O-=U.e+1,V[0]=ce[(u-O%u)%u],U.e=-O||0;else V[0]=U.e=0;return U}if(Y==0)V.length=oe,Z=1,oe--;else V.length=oe+1,Z=ce[u-Y],V[oe]=ee>0?s(te/ce[J-ee]%ce[ee])*Z:0;if(H)for(;;)if(oe==0){for(Y=1,ee=V[0];ee>=10;ee/=10,Y++);ee=V[0]+=Z;for(Z=1;ee>=10;ee/=10,Z++);if(Y!=Z){if(U.e++,V[0]==c)V[0]=1}break}else{if(V[oe]+=Z,V[oe]!=c)break;V[oe--]=0,Z=1}for(Y=V.length;V[--Y]===0;V.pop());}if(U.e>ve)U.c=U.e=null;else if(U.e<se)U.c=[U.e=0]}return U}function je(U){var O,x=U.e;if(x===null)return U.toString();return O=S(U.c),O=x<=Q||x>=pe?w(O,x):T(O,x,"0"),U.s<0?"-"+O:O}if(N.absoluteValue=N.abs=function(){var U=new W(this);if(U.s<0)U.s=1;return U},N.comparedTo=function(U,O){return E(this,new W(U,O))},N.decimalPlaces=N.dp=function(U,O){var x,H,J,Y=this;if(U!=null){if(b(U,0,p),O==null)O=B;else b(O,0,8);return Ie(new W(Y),U+Y.e+1,O)}if(!(x=Y.c))return null;if(H=((J=x.length-1)-y(this.e/u))*u,J=x[J])for(;J%10==0;J/=10,H--);if(H<0)H=0;return H},N.dividedBy=N.div=function(U,O){return A(this,new W(U,O),G,B)},N.dividedToIntegerBy=N.idiv=function(U,O){return A(this,new W(U,O),0,1)},N.exponentiatedBy=N.pow=function(U,O){var x,H,J,Y,ee,Z,te,oe,L,V=this;if(U=new W(U),U.c&&!U.isInteger())throw Error(l+"Exponent not an integer: "+je(U));if(O!=null)O=new W(O);if(Z=U.e>14,!V.c||!V.c[0]||V.c[0]==1&&!V.e&&V.c.length==1||!U.c||!U.c[0])return L=new W(Math.pow(+je(V),Z?U.s*(2-R(U)):+je(U))),O?L.mod(O):L;if(te=U.s<0,O){if(O.c?!O.c[0]:!O.s)return new W(NaN);if(H=!te&&V.isInteger()&&O.isInteger(),H)V=V.mod(O)}else if(U.e>9&&(V.e>0||V.e<-1||(V.e==0?V.c[0]>1||Z&&V.c[1]>=240000000:V.c[0]<80000000000000||Z&&V.c[0]<=99999750000000))){if(Y=V.s<0&&R(U)?-0:0,V.e>-1)Y=1/Y;return new W(te?1/Y:Y)}else if(ne)Y=i(ne/u+2);if(Z){if(x=new W(0.5),te)U.s=1;oe=R(U)}else J=Math.abs(+je(U)),oe=J%2;L=new W(F);for(;;){if(oe){if(L=L.times(V),!L.c)break;if(Y){if(L.c.length>Y)L.c.length=Y}else if(H)L=L.mod(O)}if(J){if(J=s(J/2),J===0)break;oe=J%2}else if(U=U.times(x),Ie(U,U.e+1,1),U.e>14)oe=R(U);else{if(J=+je(U),J===0)break;oe=J%2}if(V=V.times(V),Y){if(V.c&&V.c.length>Y)V.c.length=Y}else if(H)V=V.mod(O)}if(H)return L;if(te)L=F.div(L);return O?L.mod(O):Y?Ie(L,ne,B,ee):L},N.integerValue=function(U){var O=new W(this);if(U==null)U=B;else b(U,0,8);return Ie(O,O.e+1,U)},N.isEqualTo=N.eq=function(U,O){return E(this,new W(U,O))===0},N.isFinite=function(){return!!this.c},N.isGreaterThan=N.gt=function(U,O){return E(this,new W(U,O))>0},N.isGreaterThanOrEqualTo=N.gte=function(U,O){return(O=E(this,new W(U,O)))===1||O===0},N.isInteger=function(){return!!this.c&&y(this.e/u)>this.c.length-2},N.isLessThan=N.lt=function(U,O){return E(this,new W(U,O))<0},N.isLessThanOrEqualTo=N.lte=function(U,O){return(O=E(this,new W(U,O)))===-1||O===0},N.isNaN=function(){return!this.s},N.isNegative=function(){return this.s<0},N.isPositive=function(){return this.s>0},N.isZero=function(){return!!this.c&&this.c[0]==0},N.minus=function(U,O){var x,H,J,Y,ee=this,Z=ee.s;if(U=new W(U,O),O=U.s,!Z||!O)return new W(NaN);if(Z!=O)return U.s=-O,ee.plus(U);var te=ee.e/u,oe=U.e/u,L=ee.c,V=U.c;if(!te||!oe){if(!L||!V)return L?(U.s=-O,U):new W(V?ee:NaN);if(!L[0]||!V[0])return V[0]?(U.s=-O,U):new W(L[0]?ee:B==3?-0:0)}if(te=y(te),oe=y(oe),L=L.slice(),Z=te-oe){if(Y=Z<0)Z=-Z,J=L;else oe=te,J=V;J.reverse();for(O=Z;O--;J.push(0));J.reverse()}else{H=(Y=(Z=L.length)<(O=V.length))?Z:O;for(Z=O=0;O<H;O++)if(L[O]!=V[O]){Y=L[O]<V[O];break}}if(Y)J=L,L=V,V=J,U.s=-U.s;if(O=(H=V.length)-(x=L.length),O>0)for(;O--;L[x++]=0);O=c-1;for(;H>Z;){if(L[--H]<V[H]){for(x=H;x&&!L[--x];L[x]=O);--L[x],L[H]+=c}L[H]-=V[H]}for(;L[0]==0;L.splice(0,1),--oe);if(!L[0])return U.s=B==3?-1:1,U.c=[U.e=0],U;return ze(U,L,oe)},N.modulo=N.mod=function(U,O){var x,H,J=this;if(U=new W(U,O),!J.c||!U.s||U.c&&!U.c[0])return new W(NaN);else if(!U.c||J.c&&!J.c[0])return new W(J);if(j==9)H=U.s,U.s=1,x=A(J,U,0,3),U.s=H,x.s*=H;else x=A(J,U,0,j);if(U=J.minus(x.times(U)),!U.c[0]&&j==1)U.s=J.s;return U},N.multipliedBy=N.times=function(U,O){var x,H,J,Y,ee,Z,te,oe,L,V,ce,ue,ge,Ne,et,He=this,We=He.c,St=(U=new W(U,O)).c;if(!We||!St||!We[0]||!St[0]){if(!He.s||!U.s||We&&!We[0]&&!St||St&&!St[0]&&!We)U.c=U.e=U.s=null;else if(U.s*=He.s,!We||!St)U.c=U.e=null;else U.c=[0],U.e=0;return U}if(H=y(He.e/u)+y(U.e/u),U.s*=He.s,te=We.length,V=St.length,te<V)ge=We,We=St,St=ge,J=te,te=V,V=J;for(J=te+V,ge=[];J--;ge.push(0));Ne=c,et=g;for(J=V;--J>=0;){x=0,ce=St[J]%et,ue=St[J]/et|0;for(ee=te,Y=J+ee;Y>J;)oe=We[--ee]%et,L=We[ee]/et|0,Z=ue*oe+L*ce,oe=ce*oe+Z%et*et+ge[Y]+x,x=(oe/Ne|0)+(Z/et|0)+ue*L,ge[Y--]=oe%Ne;ge[Y]=x}if(x)++H;else ge.splice(0,1);return ze(U,ge,H)},N.negated=function(){var U=new W(this);return U.s=-U.s||null,U},N.plus=function(U,O){var x,H=this,J=H.s;if(U=new W(U,O),O=U.s,!J||!O)return new W(NaN);if(J!=O)return U.s=-O,H.minus(U);var Y=H.e/u,ee=U.e/u,Z=H.c,te=U.c;if(!Y||!ee){if(!Z||!te)return new W(J/0);if(!Z[0]||!te[0])return te[0]?U:new W(Z[0]?H:J*0)}if(Y=y(Y),ee=y(ee),Z=Z.slice(),J=Y-ee){if(J>0)ee=Y,x=te;else J=-J,x=Z;x.reverse();for(;J--;x.push(0));x.reverse()}if(J=Z.length,O=te.length,J-O<0)x=te,te=Z,Z=x,O=J;for(J=0;O;)J=(Z[--O]=Z[O]+te[O]+J)/c|0,Z[O]=c===Z[O]?0:Z[O]%c;if(J)Z=[J].concat(Z),++ee;return ze(U,Z,ee)},N.precision=N.sd=function(U,O){var x,H,J,Y=this;if(U!=null&&U!==!!U){if(b(U,1,p),O==null)O=B;else b(O,0,8);return Ie(new W(Y),U,O)}if(!(x=Y.c))return null;if(J=x.length-1,H=J*u+1,J=x[J]){for(;J%10==0;J/=10,H--);for(J=x[0];J>=10;J/=10,H++);}if(U&&Y.e+1>H)H=Y.e+1;return H},N.shiftedBy=function(U){return b(U,-f,f),this.times("1e"+U)},N.squareRoot=N.sqrt=function(){var U,O,x,H,J,Y=this,{c:ee,s:Z,e:te}=Y,oe=G+4,L=new W("0.5");if(Z!==1||!ee||!ee[0])return new W(!Z||Z<0&&(!ee||ee[0])?NaN:ee?Y:1/0);if(Z=Math.sqrt(+je(Y)),Z==0||Z==1/0){if(O=S(ee),(O.length+te)%2==0)O+="0";if(Z=Math.sqrt(+O),te=y((te+1)/2)-(te<0||te%2),Z==1/0)O="5e"+te;else O=Z.toExponential(),O=O.slice(0,O.indexOf("e")+1)+te;x=new W(O)}else x=new W(Z+"");if(x.c[0]){if(te=x.e,Z=te+oe,Z<3)Z=0;for(;;)if(J=x,x=L.times(J.plus(A(Y,J,oe,1))),S(J.c).slice(0,Z)===(O=S(x.c)).slice(0,Z)){if(x.e<te)--Z;if(O=O.slice(Z-3,Z+1),O=="9999"||!H&&O=="4999"){if(!H){if(Ie(J,J.e+G+2,0),J.times(J).eq(Y)){x=J;break}}oe+=4,Z+=4,H=1}else{if(!+O||!+O.slice(1)&&O.charAt(0)=="5")Ie(x,x.e+G+2,1),U=!x.times(x).eq(Y);break}}}return Ie(x,x.e+G+1,B,U)},N.toExponential=function(U,O){if(U!=null)b(U,0,p),U++;return be(this,U,O,1)},N.toFixed=function(U,O){if(U!=null)b(U,0,p),U=U+this.e+1;return be(this,U,O)},N.toFormat=function(U,O,x){var H,J=this;if(x==null)if(U!=null&&O&&typeof O=="object")x=O,O=null;else if(U&&typeof U=="object")x=U,U=O=null;else x=he;else if(typeof x!="object")throw Error(l+"Argument not an object: "+x);if(H=J.toFixed(U,O),J.c){var Y,ee=H.split("."),Z=+x.groupSize,te=+x.secondaryGroupSize,oe=x.groupSeparator||"",L=ee[0],V=ee[1],ce=J.s<0,ue=ce?L.slice(1):L,ge=ue.length;if(te)Y=Z,Z=te,te=Y,ge-=Y;if(Z>0&&ge>0){Y=ge%Z||Z,L=ue.substr(0,Y);for(;Y<ge;Y+=Z)L+=oe+ue.substr(Y,Z);if(te>0)L+=oe+ue.slice(Y);if(ce)L="-"+L}H=V?L+(x.decimalSeparator||"")+((te=+x.fractionGroupSize)?V.replace(new RegExp("\\d{"+te+"}\\B","g"),"$&"+(x.fractionGroupSeparator||"")):V):L}return(x.prefix||"")+H+(x.suffix||"")},N.toFraction=function(U){var O,x,H,J,Y,ee,Z,te,oe,L,V,ce,ue=this,ge=ue.c;if(U!=null){if(Z=new W(U),!Z.isInteger()&&(Z.c||Z.s!==1)||Z.lt(F))throw Error(l+"Argument "+(Z.isInteger()?"out of range: ":"not an integer: ")+je(Z))}if(!ge)return new W(ue);O=new W(F),oe=x=new W(F),H=te=new W(F),ce=S(ge),Y=O.e=ce.length-ue.e-1,O.c[0]=h[(ee=Y%u)<0?u+ee:ee],U=!U||Z.comparedTo(O)>0?Y>0?O:oe:Z,ee=ve,ve=1/0,Z=new W(ce),te.c[0]=0;for(;;){if(L=A(Z,O,0,1),J=x.plus(L.times(H)),J.comparedTo(U)==1)break;x=H,H=J,oe=te.plus(L.times(J=oe)),te=J,O=Z.minus(L.times(J=O)),Z=J}return J=A(U.minus(x),H,0,1),te=te.plus(J.times(oe)),x=x.plus(J.times(H)),te.s=oe.s=ue.s,Y=Y*2,V=A(oe,H,Y,B).minus(ue).abs().comparedTo(A(te,x,Y,B).minus(ue).abs())<1?[oe,H]:[te,x],ve=ee,V},N.toNumber=function(){return+je(this)},N.toPrecision=function(U,O){if(U!=null)b(U,1,p);return be(this,U,O,2)},N.toString=function(U){var O,x=this,H=x.s,J=x.e;if(J===null)if(H){if(O="Infinity",H<0)O="-"+O}else O="NaN";else{if(U==null)O=J<=Q||J>=pe?w(S(x.c),J):T(S(x.c),J,"0");else if(U===10&&K)x=Ie(new W(x),G+J+1,B),O=T(S(x.c),x.e,"0");else b(U,2,q.length,"Base"),O=P(T(S(x.c),J,"0"),10,U,H,!0);if(H<0&&x.c[0])O="-"+O}return O},N.valueOf=N.toJSON=function(){return je(this)},N._isBigNumber=!0,C!=null)W.set(C);return W}function y(C){var A=C|0;return C>0||C===A?A:A-1}function S(C){var A,P,D=1,N=C.length,F=C[0]+"";for(;D<N;){A=C[D++]+"",P=u-A.length;for(;P--;A="0"+A);F+=A}for(N=F.length;F.charCodeAt(--N)===48;);return F.slice(0,N+1||1)}function E(C,A){var P,D,N=C.c,F=A.c,G=C.s,B=A.s,Q=C.e,pe=A.e;if(!G||!B)return null;if(P=N&&!N[0],D=F&&!F[0],P||D)return P?D?0:-B:G;if(G!=B)return G;if(P=G<0,D=Q==pe,!N||!F)return D?0:!N^P?1:-1;if(!D)return Q>pe^P?1:-1;B=(Q=N.length)<(pe=F.length)?Q:pe;for(G=0;G<B;G++)if(N[G]!=F[G])return N[G]>F[G]^P?1:-1;return Q==pe?0:Q>pe^P?1:-1}function b(C,A,P,D){if(C<A||C>P||C!==s(C))throw Error(l+(D||"Argument")+(typeof C=="number"?C<A||C>P?" out of range: ":" not an integer: ":" not a primitive number: ")+String(C))}function R(C){var A=C.c.length-1;return y(C.e/u)==A&&C.c[A]%2!=0}function w(C,A){return(C.length>1?C.charAt(0)+"."+C.slice(1):C)+(A<0?"e":"e+")+A}function T(C,A,P){var D,N;if(A<0){for(N=P+".";++A;N+=P);C=N+C}else if(D=C.length,++A>D){for(N=P,A-=D;--A;N+=P);C+=N}else if(A<D)C=C.slice(0,A)+"."+C.slice(A);return C}if(n=_(),n.default=n.BigNumber=n,typeof define=="function"&&define.amd)define(function(){return n});else if(typeof t<"u"&&t.exports)t.exports=n;else{if(!r)r=typeof self<"u"&&self?self:window;r.BigNumber=n}})(e)}}),tR=ye({"../node_modules/.bun/json-bigint@1.0.0/node_modules/json-bigint/lib/stringify.js"(e,t){var r=bv(),n=t.exports;(function(){function o(g){return g<10?"0"+g:g}var i=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,s=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,l,a,c={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':"\\\"","\\":"\\\\"},u;function f(g){return s.lastIndex=0,s.test(g)?'"'+g.replace(s,function(p){var _=c[p];return typeof _==="string"?_:"\\u"+("0000"+p.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+g+'"'}function h(g,p){var _,y,S,E,b=l,R,w=p[g],T=w!=null&&(w instanceof r||r.isBigNumber(w));if(w&&typeof w==="object"&&typeof w.toJSON==="function")w=w.toJSON(g);if(typeof u==="function")w=u.call(p,g,w);switch(typeof w){case"string":if(T)return w;else return f(w);case"number":return isFinite(w)?String(w):"null";case"boolean":case"null":case"bigint":return String(w);case"object":if(!w)return"null";if(l+=a,R=[],Object.prototype.toString.apply(w)==="[object Array]"){E=w.length;for(_=0;_<E;_+=1)R[_]=h(_,w)||"null";return S=R.length===0?"[]":l?`[
31
+ `+l+R.join(`,
32
+ `+l)+`
33
+ `+b+"]":"["+R.join(",")+"]",l=b,S}if(u&&typeof u==="object"){E=u.length;for(_=0;_<E;_+=1)if(typeof u[_]==="string"){if(y=u[_],S=h(y,w),S)R.push(f(y)+(l?": ":":")+S)}}else Object.keys(w).forEach(function(C){var A=h(C,w);if(A)R.push(f(C)+(l?": ":":")+A)});return S=R.length===0?"{}":l?`{
34
+ `+l+R.join(`,
35
+ `+l)+`
36
+ `+b+"}":"{"+R.join(",")+"}",l=b,S}}if(typeof n.stringify!=="function")n.stringify=function(g,p,_){var y;if(l="",a="",typeof _==="number")for(y=0;y<_;y+=1)a+=" ";else if(typeof _==="string")a=_;if(u=p,p&&typeof p!=="function"&&(typeof p!=="object"||typeof p.length!=="number"))throw Error("JSON.stringify");return h("",{"":g})}})()}}),rR=ye({"../node_modules/.bun/json-bigint@1.0.0/node_modules/json-bigint/lib/parse.js"(e,t){var r=null,n=/(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])/,o=/(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)/,i=function(s){var l={strict:!1,storeAsString:!1,alwaysParseAsBig:!1,useNativeBigInt:!1,protoAction:"error",constructorAction:"error"};if(s!==void 0&&s!==null){if(s.strict===!0)l.strict=!0;if(s.storeAsString===!0)l.storeAsString=!0;if(l.alwaysParseAsBig=s.alwaysParseAsBig===!0?s.alwaysParseAsBig:!1,l.useNativeBigInt=s.useNativeBigInt===!0?s.useNativeBigInt:!1,typeof s.constructorAction<"u")if(s.constructorAction==="error"||s.constructorAction==="ignore"||s.constructorAction==="preserve")l.constructorAction=s.constructorAction;else throw Error(`Incorrect value for constructorAction option, must be "error", "ignore" or undefined but passed ${s.constructorAction}`);if(typeof s.protoAction<"u")if(s.protoAction==="error"||s.protoAction==="ignore"||s.protoAction==="preserve")l.protoAction=s.protoAction;else throw Error(`Incorrect value for protoAction option, must be "error", "ignore" or undefined but passed ${s.protoAction}`)}var a,c,u={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
37
+ `,r:"\r",t:"\t"},f,h=function(w){throw{name:"SyntaxError",message:w,at:a,text:f}},g=function(w){if(w&&w!==c)h("Expected '"+w+"' instead of '"+c+"'");return c=f.charAt(a),a+=1,c},p=function(){var w,T="";if(c==="-")T="-",g("-");while(c>="0"&&c<="9")T+=c,g();if(c==="."){T+=".";while(g()&&c>="0"&&c<="9")T+=c}if(c==="e"||c==="E"){if(T+=c,g(),c==="-"||c==="+")T+=c,g();while(c>="0"&&c<="9")T+=c,g()}if(w=+T,!isFinite(w))h("Bad number");else{if(r==null)r=bv();if(T.length>15)return l.storeAsString?T:l.useNativeBigInt?BigInt(T):new r(T);else return!l.alwaysParseAsBig?w:l.useNativeBigInt?BigInt(w):new r(w)}},_=function(){var w,T,C="",A;if(c==='"'){var P=a;while(g()){if(c==='"'){if(a-1>P)C+=f.substring(P,a-1);return g(),C}if(c==="\\"){if(a-1>P)C+=f.substring(P,a-1);if(g(),c==="u"){A=0;for(T=0;T<4;T+=1){if(w=parseInt(g(),16),!isFinite(w))break;A=A*16+w}C+=String.fromCharCode(A)}else if(typeof u[c]==="string")C+=u[c];else break;P=a}}}h("Bad string")},y=function(){while(c&&c<=" ")g()},S=function(){switch(c){case"t":return g("t"),g("r"),g("u"),g("e"),!0;case"f":return g("f"),g("a"),g("l"),g("s"),g("e"),!1;case"n":return g("n"),g("u"),g("l"),g("l"),null}h("Unexpected '"+c+"'")},E,b=function(){var w=[];if(c==="["){if(g("["),y(),c==="]")return g("]"),w;while(c){if(w.push(E()),y(),c==="]")return g("]"),w;g(","),y()}}h("Bad array")},R=function(){var w,T=Object.create(null);if(c==="{"){if(g("{"),y(),c==="}")return g("}"),T;while(c){if(w=_(),y(),g(":"),l.strict===!0&&Object.hasOwnProperty.call(T,w))h('Duplicate key "'+w+'"');if(n.test(w)===!0)if(l.protoAction==="error")h("Object contains forbidden prototype property");else if(l.protoAction==="ignore")E();else T[w]=E();else if(o.test(w)===!0)if(l.constructorAction==="error")h("Object contains forbidden constructor property");else if(l.constructorAction==="ignore")E();else T[w]=E();else T[w]=E();if(y(),c==="}")return g("}"),T;g(","),y()}}h("Bad object")};return E=function(){switch(y(),c){case"{":return R();case"[":return b();case'"':return _();case"-":return p();default:return c>="0"&&c<="9"?p():S()}},function(w,T){var C;if(f=w+"",a=0,c=" ",C=E(),y(),c)h("Syntax error");return typeof T==="function"?function A(P,D){var N,F,G=P[D];if(G&&typeof G==="object")Object.keys(G).forEach(function(B){if(F=A(G,B),F!==void 0)G[B]=F;else delete G[B]});return T.call(P,D,G)}({"":C},""):C}};t.exports=i}}),nR=ye({"../node_modules/.bun/json-bigint@1.0.0/node_modules/json-bigint/index.js"(e,t){var r=tR().stringify,n=rR();t.exports=function(o){return{parse:n(o),stringify:r}},t.exports.parse=n(),t.exports.stringify=r}}),hp=ye({"../node_modules/.bun/gcp-metadata@8.1.2+759ce506b1ed1a42/node_modules/gcp-metadata/build/src/gcp-residency.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.GCE_LINUX_BIOS_PATHS=void 0,e.isGoogleCloudServerless=o,e.isGoogleComputeEngineLinux=i,e.isGoogleComputeEngineMACAddress=s,e.isGoogleComputeEngine=l,e.detectGCPResidency=a;var t=we("fs"),r=we("os");e.GCE_LINUX_BIOS_PATHS={BIOS_DATE:"/sys/class/dmi/id/bios_date",BIOS_VENDOR:"/sys/class/dmi/id/bios_vendor"};var n=/^42:01/;function o(){return!!(process.env.CLOUD_RUN_JOB||process.env.FUNCTION_NAME||process.env.K_SERVICE)}function i(){if((0,r.platform)()!=="linux")return!1;try{(0,t.statSync)(e.GCE_LINUX_BIOS_PATHS.BIOS_DATE);let c=(0,t.readFileSync)(e.GCE_LINUX_BIOS_PATHS.BIOS_VENDOR,"utf8");return/Google/.test(c)}catch{return!1}}function s(){let c=(0,r.networkInterfaces)();for(let u of Object.values(c)){if(!u)continue;for(let{mac:f}of u)if(n.test(f))return!0}return!1}function l(){return i()||s()}function a(){return o()||l()}}}),oR=ye({"../node_modules/.bun/google-logging-utils@1.1.3/node_modules/google-logging-utils/build/src/colours.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Colours=void 0;var t=class r{static isEnabled(n){return n&&n.isTTY&&(typeof n.getColorDepth==="function"?n.getColorDepth()>2:!0)}static refresh(){if(r.enabled=r.isEnabled(process===null||process===void 0?void 0:process.stderr),!this.enabled)r.reset="",r.bright="",r.dim="",r.red="",r.green="",r.yellow="",r.blue="",r.magenta="",r.cyan="",r.white="",r.grey="";else r.reset="\x1B[0m",r.bright="\x1B[1m",r.dim="\x1B[2m",r.red="\x1B[31m",r.green="\x1B[32m",r.yellow="\x1B[33m",r.blue="\x1B[34m",r.magenta="\x1B[35m",r.cyan="\x1B[36m",r.white="\x1B[37m",r.grey="\x1B[90m"}};e.Colours=t,t.enabled=!1,t.reset="",t.bright="",t.dim="",t.red="",t.green="",t.yellow="",t.blue="",t.magenta="",t.cyan="",t.white="",t.grey="",t.refresh()}}),iR=ye({"../node_modules/.bun/google-logging-utils@1.1.3/node_modules/google-logging-utils/build/src/logging-utils.js"(e){var t=e&&e.__createBinding||(Object.create?function(w,T,C,A){if(A===void 0)A=C;var P=Object.getOwnPropertyDescriptor(T,C);if(!P||("get"in P?!T.__esModule:P.writable||P.configurable))P={enumerable:!0,get:function(){return T[C]}};Object.defineProperty(w,A,P)}:function(w,T,C,A){if(A===void 0)A=C;w[A]=T[C]}),r=e&&e.__setModuleDefault||(Object.create?function(w,T){Object.defineProperty(w,"default",{enumerable:!0,value:T})}:function(w,T){w.default=T}),n=e&&e.__importStar||function(){var w=function(T){return w=Object.getOwnPropertyNames||function(C){var A=[];for(var P in C)if(Object.prototype.hasOwnProperty.call(C,P))A[A.length]=P;return A},w(T)};return function(T){if(T&&T.__esModule)return T;var C={};if(T!=null){for(var A=w(T),P=0;P<A.length;P++)if(A[P]!=="default")t(C,T,A[P])}return r(C,T),C}}();Object.defineProperty(e,"__esModule",{value:!0}),e.env=e.DebugLogBackendBase=e.placeholder=e.AdhocDebugLogger=e.LogSeverity=void 0,e.getNodeBackend=h,e.getDebugBackend=p,e.getStructuredBackend=y,e.setBackend=b,e.log=R;var o=we("events"),i=n(we("process")),s=n(we("util")),l=oR(),a;(function(w){w.DEFAULT="DEFAULT",w.DEBUG="DEBUG",w.INFO="INFO",w.WARNING="WARNING",w.ERROR="ERROR"})(a||(e.LogSeverity=a={}));var c=class extends o.EventEmitter{constructor(w,T){super();this.namespace=w,this.upstream=T,this.func=Object.assign(this.invoke.bind(this),{instance:this,on:(C,A)=>this.on(C,A)}),this.func.debug=(...C)=>this.invokeSeverity(a.DEBUG,...C),this.func.info=(...C)=>this.invokeSeverity(a.INFO,...C),this.func.warn=(...C)=>this.invokeSeverity(a.WARNING,...C),this.func.error=(...C)=>this.invokeSeverity(a.ERROR,...C),this.func.sublog=(C)=>R(C,this.func)}invoke(w,...T){if(this.upstream)try{this.upstream(w,...T)}catch(C){}try{this.emit("log",w,T)}catch(C){}}invokeSeverity(w,...T){this.invoke({severity:w},...T)}};e.AdhocDebugLogger=c,e.placeholder=new c("",()=>{}).func;var u=class{constructor(){var w;this.cached=new Map,this.filters=[],this.filtersSet=!1;let T=(w=i.env[e.env.nodeEnables])!==null&&w!==void 0?w:"*";if(T==="all")T="*";this.filters=T.split(",")}log(w,T,...C){try{if(!this.filtersSet)this.setFilters(),this.filtersSet=!0;let A=this.cached.get(w);if(!A)A=this.makeLogger(w),this.cached.set(w,A);A(T,...C)}catch(A){console.error(A)}}};e.DebugLogBackendBase=u;var f=class extends u{constructor(){super(...arguments);this.enabledRegexp=/.*/g}isEnabled(w){return this.enabledRegexp.test(w)}makeLogger(w){if(!this.enabledRegexp.test(w))return()=>{};return(T,...C)=>{var A;let P=`${l.Colours.green}${w}${l.Colours.reset}`,D=`${l.Colours.yellow}${i.pid}${l.Colours.reset}`,N;switch(T.severity){case a.ERROR:N=`${l.Colours.red}${T.severity}${l.Colours.reset}`;break;case a.INFO:N=`${l.Colours.magenta}${T.severity}${l.Colours.reset}`;break;case a.WARNING:N=`${l.Colours.yellow}${T.severity}${l.Colours.reset}`;break;default:N=(A=T.severity)!==null&&A!==void 0?A:a.DEFAULT;break}let F=s.formatWithOptions({colors:l.Colours.enabled},...C),G=Object.assign({},T);delete G.severity;let B=Object.getOwnPropertyNames(G).length?JSON.stringify(G):"",Q=B?`${l.Colours.grey}${B}${l.Colours.reset}`:"";console.error("%s [%s|%s] %s%s",D,P,N,F,B?` ${Q}`:"")}}setFilters(){let T=this.filters.join(",").replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^");this.enabledRegexp=new RegExp(`^${T}$`,"i")}};function h(){return new f}var g=class extends u{constructor(w){super();this.debugPkg=w}makeLogger(w){let T=this.debugPkg(w);return(C,...A)=>{T(A[0],...A.slice(1))}}setFilters(){var w;let T=(w=i.env.NODE_DEBUG)!==null&&w!==void 0?w:"";i.env.NODE_DEBUG=`${T}${T?",":""}${this.filters.join(",")}`}};function p(w){return new g(w)}var _=class extends u{constructor(w){var T;super();this.upstream=(T=w)!==null&&T!==void 0?T:void 0}makeLogger(w){var T;let C=(T=this.upstream)===null||T===void 0?void 0:T.makeLogger(w);return(A,...P)=>{var D;let N=(D=A.severity)!==null&&D!==void 0?D:a.INFO,F=Object.assign({severity:N,message:s.format(...P)},A),G=JSON.stringify(F);if(C)C(A,G);else console.log("%s",G)}}setFilters(){var w;(w=this.upstream)===null||w===void 0||w.setFilters()}};function y(w){return new _(w)}e.env={nodeEnables:"GOOGLE_SDK_NODE_LOGGING"};var S=new Map,E=void 0;function b(w){E=w,S.clear()}function R(w,T){if(!E){if(!i.env[e.env.nodeEnables])return e.placeholder}if(!w)return e.placeholder;if(T)w=`${T.instance.namespace}:${w}`;let C=S.get(w);if(C)return C.func;if(E===null)return e.placeholder;else if(E===void 0)E=h();let A=(()=>{let P=void 0;return new c(w,(N,...F)=>{if(P!==E){if(E===null)return;else if(E===void 0)E=h();P=E}E===null||E===void 0||E.log(w,N,...F)})})();return S.set(w,A),A.func}}}),wv=ye({"../node_modules/.bun/google-logging-utils@1.1.3/node_modules/google-logging-utils/build/src/index.js"(e){var t=e&&e.__createBinding||(Object.create?function(n,o,i,s){if(s===void 0)s=i;var l=Object.getOwnPropertyDescriptor(o,i);if(!l||("get"in l?!o.__esModule:l.writable||l.configurable))l={enumerable:!0,get:function(){return o[i]}};Object.defineProperty(n,s,l)}:function(n,o,i,s){if(s===void 0)s=i;n[s]=o[i]}),r=e&&e.__exportStar||function(n,o){for(var i in n)if(i!=="default"&&!Object.prototype.hasOwnProperty.call(o,i))t(o,n,i)};Object.defineProperty(e,"__esModule",{value:!0}),r(iR(),e)}}),bl=ye({"../node_modules/.bun/gcp-metadata@8.1.2+759ce506b1ed1a42/node_modules/gcp-metadata/build/src/index.js"(e){var t=e&&e.__createBinding||(Object.create?function(P,D,N,F){if(F===void 0)F=N;var G=Object.getOwnPropertyDescriptor(D,N);if(!G||("get"in G?!D.__esModule:G.writable||G.configurable))G={enumerable:!0,get:function(){return D[N]}};Object.defineProperty(P,F,G)}:function(P,D,N,F){if(F===void 0)F=N;P[F]=D[N]}),r=e&&e.__setModuleDefault||(Object.create?function(P,D){Object.defineProperty(P,"default",{enumerable:!0,value:D})}:function(P,D){P.default=D}),n=e&&e.__importStar||function(){var P=function(D){return P=Object.getOwnPropertyNames||function(N){var F=[];for(var G in N)if(Object.prototype.hasOwnProperty.call(N,G))F[F.length]=G;return F},P(D)};return function(D){if(D&&D.__esModule)return D;var N={};if(D!=null){for(var F=P(D),G=0;G<F.length;G++)if(F[G]!=="default")t(N,D,F[G])}return r(N,D),N}}(),o=e&&e.__exportStar||function(P,D){for(var N in P)if(N!=="default"&&!Object.prototype.hasOwnProperty.call(D,N))t(D,P,N)};Object.defineProperty(e,"__esModule",{value:!0}),e.gcpResidencyCache=e.METADATA_SERVER_DETECTION=e.HEADERS=e.HEADER_VALUE=e.HEADER_NAME=e.SECONDARY_HOST_ADDRESS=e.HOST_ADDRESS=e.BASE_PATH=void 0,e.instance=p,e.project=_,e.universe=y,e.bulk=S,e.isAvailable=R,e.resetIsAvailableCache=w,e.getGCPResidency=T,e.setGCPResidency=C,e.requestTimeout=A;var i=rr(),s=nR(),l=hp(),a=n(wv());e.BASE_PATH="/computeMetadata/v1",e.HOST_ADDRESS="http://169.254.169.254",e.SECONDARY_HOST_ADDRESS="http://metadata.google.internal.",e.HEADER_NAME="Metadata-Flavor",e.HEADER_VALUE="Google",e.HEADERS=Object.freeze({[e.HEADER_NAME]:e.HEADER_VALUE});var c=a.log("gcp-metadata");e.METADATA_SERVER_DETECTION=Object.freeze({"assume-present":"don't try to ping the metadata server, but assume it's present",none:"don't try to ping the metadata server, but don't try to use it either","bios-only":"treat the result of a BIOS probe as canonical (don't fall back to pinging)","ping-only":"skip the BIOS probe, and go straight to pinging"});function u(P){if(!P)P=process.env.GCE_METADATA_IP||process.env.GCE_METADATA_HOST||e.HOST_ADDRESS;if(!/^https?:\/\//.test(P))P=`http://${P}`;return new URL(e.BASE_PATH,P).href}function f(P){Object.keys(P).forEach((D)=>{switch(D){case"params":case"property":case"headers":break;case"qs":throw Error("'qs' is not a valid configuration option. Please use 'params' instead.");default:throw Error(`'${D}' is not a valid configuration option.`)}})}async function h(P,D={},N=3,F=!1){let G=new Headers(e.HEADERS),B="",Q={};if(typeof P==="object"){let j=P;new Headers(j.headers).forEach((ne,he)=>G.set(he,ne)),B=j.metadataKey,Q=j.params||Q,N=j.noResponseRetries||N,F=j.fastFail||F}else B=P;if(typeof D==="string")B+=`/${D}`;else{if(f(D),D.property)B+=`/${D.property}`;new Headers(D.headers).forEach((j,ne)=>G.set(ne,j)),Q=D.params||Q}let pe=F?g:i.request,se={url:`${u()}/${B}`,headers:G,retryConfig:{noResponseRetries:N},params:Q,responseType:"text",timeout:A()};c.info("instance request %j",se);let ve=await pe(se);c.info("instance metadata is %s",ve.data);let me=ve.headers.get(e.HEADER_NAME);if(me!==e.HEADER_VALUE)throw RangeError(`Invalid response from metadata service: incorrect ${e.HEADER_NAME} header. Expected '${e.HEADER_VALUE}', got ${me?`'${me}'`:"no header"}`);if(typeof ve.data==="string")try{return s.parse(ve.data)}catch{}return ve.data}async function g(P){let D={...P,url:P.url?.toString().replace(u(),u(e.SECONDARY_HOST_ADDRESS))},N=(0,i.request)(P),F=(0,i.request)(D);return Promise.any([N,F])}function p(P){return h("instance",P)}function _(P){return h("project",P)}function y(P){return h("universe",P)}async function S(P){let D={};return await Promise.all(P.map((N)=>(async()=>{let F=await h(N),G=N.metadataKey;D[G]=F})())),D}function E(){return process.env.DETECT_GCP_RETRIES?Number(process.env.DETECT_GCP_RETRIES):0}var b;async function R(){if(process.env.METADATA_SERVER_DETECTION){let P=process.env.METADATA_SERVER_DETECTION.trim().toLocaleLowerCase();if(!(P in e.METADATA_SERVER_DETECTION))throw RangeError(`Unknown \`METADATA_SERVER_DETECTION\` env variable. Got \`${P}\`, but it should be \`${Object.keys(e.METADATA_SERVER_DETECTION).join("`, `")}\`, or unset`);switch(P){case"assume-present":return!0;case"none":return!1;case"bios-only":return T();case"ping-only":}}try{if(b===void 0)b=h("instance",void 0,E(),!(process.env.GCE_METADATA_IP||process.env.GCE_METADATA_HOST));return await b,!0}catch(P){let D=P;if(process.env.DEBUG_AUTH)console.info(D);if(D.type==="request-timeout")return!1;if(D.response&&D.response.status===404)return!1;else{if(!(D.response&&D.response.status===404)&&(!D.code||!["EHOSTDOWN","EHOSTUNREACH","ENETUNREACH","ENOENT","ENOTFOUND","ECONNREFUSED"].includes(D.code.toString()))){let N="UNKNOWN";if(D.code)N=D.code.toString();process.emitWarning(`received unexpected error = ${D.message} code = ${N}`,"MetadataLookupWarning")}return!1}}}function w(){b=void 0}e.gcpResidencyCache=null;function T(){if(e.gcpResidencyCache===null)C();return e.gcpResidencyCache}function C(P=null){e.gcpResidencyCache=P!==null?P:(0,l.detectGCPResidency)()}function A(){return T()?0:3000}o(hp(),e)}}),sR=ye({"../node_modules/.bun/base64-js@1.5.1/node_modules/base64-js/index.js"(e){e.byteLength=a,e.toByteArray=u,e.fromByteArray=g;var t=[],r=[],n=typeof Uint8Array<"u"?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(i=0,s=o.length;i<s;++i)t[i]=o[i],r[o.charCodeAt(i)]=i;var i,s;r[45]=62,r[95]=63;function l(p){var _=p.length;if(_%4>0)throw Error("Invalid string. Length must be a multiple of 4");var y=p.indexOf("=");if(y===-1)y=_;var S=y===_?0:4-y%4;return[y,S]}function a(p){var _=l(p),y=_[0],S=_[1];return(y+S)*3/4-S}function c(p,_,y){return(_+y)*3/4-y}function u(p){var _,y=l(p),S=y[0],E=y[1],b=new n(c(p,S,E)),R=0,w=E>0?S-4:S,T;for(T=0;T<w;T+=4)_=r[p.charCodeAt(T)]<<18|r[p.charCodeAt(T+1)]<<12|r[p.charCodeAt(T+2)]<<6|r[p.charCodeAt(T+3)],b[R++]=_>>16&255,b[R++]=_>>8&255,b[R++]=_&255;if(E===2)_=r[p.charCodeAt(T)]<<2|r[p.charCodeAt(T+1)]>>4,b[R++]=_&255;if(E===1)_=r[p.charCodeAt(T)]<<10|r[p.charCodeAt(T+1)]<<4|r[p.charCodeAt(T+2)]>>2,b[R++]=_>>8&255,b[R++]=_&255;return b}function f(p){return t[p>>18&63]+t[p>>12&63]+t[p>>6&63]+t[p&63]}function h(p,_,y){var S,E=[];for(var b=_;b<y;b+=3)S=(p[b]<<16&16711680)+(p[b+1]<<8&65280)+(p[b+2]&255),E.push(f(S));return E.join("")}function g(p){var _,y=p.length,S=y%3,E=[],b=16383;for(var R=0,w=y-S;R<w;R+=b)E.push(h(p,R,R+b>w?w:R+b));if(S===1)_=p[y-1],E.push(t[_>>2]+t[_<<4&63]+"==");else if(S===2)_=(p[y-2]<<8)+p[y-1],E.push(t[_>>10]+t[_>>4&63]+t[_<<2&63]+"=");return E.join("")}}}),Tv=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/crypto/shared.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.fromArrayBufferToHex=t;function t(r){return Array.from(new Uint8Array(r)).map((o)=>o.toString(16).padStart(2,"0")).join("")}}}),aR=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/crypto/browser/crypto.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.BrowserCrypto=void 0;var t=sR(),r=Tv(),n=class o{constructor(){if(typeof window>"u"||window.crypto===void 0||window.crypto.subtle===void 0)throw Error("SubtleCrypto not found. Make sure it's an https:// website.")}async sha256DigestBase64(i){let s=new TextEncoder().encode(i),l=await window.crypto.subtle.digest("SHA-256",s);return t.fromByteArray(new Uint8Array(l))}randomBytesBase64(i){let s=new Uint8Array(i);return window.crypto.getRandomValues(s),t.fromByteArray(s)}static padBase64(i){while(i.length%4!==0)i+="=";return i}async verify(i,s,l){let a={name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},c=new TextEncoder().encode(s),u=t.toByteArray(o.padBase64(l)),f=await window.crypto.subtle.importKey("jwk",i,a,!0,["verify"]);return await window.crypto.subtle.verify(a,f,Buffer.from(u),c)}async sign(i,s){let l={name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},a=new TextEncoder().encode(s),c=await window.crypto.subtle.importKey("jwk",i,l,!0,["sign"]),u=await window.crypto.subtle.sign(l,c,a);return t.fromByteArray(new Uint8Array(u))}decodeBase64StringUtf8(i){let s=t.toByteArray(o.padBase64(i));return new TextDecoder().decode(s)}encodeBase64StringUtf8(i){let s=new TextEncoder().encode(i);return t.fromByteArray(s)}async sha256DigestHex(i){let s=new TextEncoder().encode(i),l=await window.crypto.subtle.digest("SHA-256",s);return(0,r.fromArrayBufferToHex)(l)}async signWithHmacSha256(i,s){let l=typeof i==="string"?i:String.fromCharCode(...new Uint16Array(i)),a=new TextEncoder,c=await window.crypto.subtle.importKey("raw",a.encode(l),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return window.crypto.subtle.sign("HMAC",c,a.encode(s))}};e.BrowserCrypto=n}}),lR=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/crypto/node/crypto.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.NodeCrypto=void 0;var t=we("crypto"),r=class{async sha256DigestBase64(i){return t.createHash("sha256").update(i).digest("base64")}randomBytesBase64(i){return t.randomBytes(i).toString("base64")}async verify(i,s,l){let a=t.createVerify("RSA-SHA256");return a.update(s),a.end(),a.verify(i,l,"base64")}async sign(i,s){let l=t.createSign("RSA-SHA256");return l.update(s),l.end(),l.sign(i,"base64")}decodeBase64StringUtf8(i){return Buffer.from(i,"base64").toString("utf-8")}encodeBase64StringUtf8(i){return Buffer.from(i,"utf-8").toString("base64")}async sha256DigestHex(i){return t.createHash("sha256").update(i).digest("hex")}async signWithHmacSha256(i,s){let l=typeof i==="string"?i:o(i);return n(t.createHmac("sha256",l).update(s).digest())}};e.NodeCrypto=r;function n(i){let s=new ArrayBuffer(i.length),l=new Uint8Array(s);for(let a=0;a<i.length;++a)l[a]=i[a];return s}function o(i){return Buffer.from(i)}}}),wl=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/crypto/crypto.js"(e){var t=e&&e.__createBinding||(Object.create?function(l,a,c,u){if(u===void 0)u=c;var f=Object.getOwnPropertyDescriptor(a,c);if(!f||("get"in f?!a.__esModule:f.writable||f.configurable))f={enumerable:!0,get:function(){return a[c]}};Object.defineProperty(l,u,f)}:function(l,a,c,u){if(u===void 0)u=c;l[u]=a[c]}),r=e&&e.__exportStar||function(l,a){for(var c in l)if(c!=="default"&&!Object.prototype.hasOwnProperty.call(a,c))t(a,l,c)};Object.defineProperty(e,"__esModule",{value:!0}),e.createCrypto=i,e.hasBrowserCrypto=s;var n=aR(),o=lR();r(Tv(),e);function i(){if(s())return new n.BrowserCrypto;return new o.NodeCrypto}function s(){return typeof window<"u"&&typeof window.crypto<"u"&&typeof window.crypto.subtle<"u"}}}),zs=ye({"../node_modules/.bun/safe-buffer@5.2.1/node_modules/safe-buffer/index.js"(e,t){var r=we("buffer"),n=r.Buffer;function o(s,l){for(var a in s)l[a]=s[a]}if(n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow)t.exports=r;else o(r,e),e.Buffer=i;function i(s,l,a){return n(s,l,a)}i.prototype=Object.create(n.prototype),o(n,i),i.from=function(s,l,a){if(typeof s==="number")throw TypeError("Argument must not be a number");return n(s,l,a)},i.alloc=function(s,l,a){if(typeof s!=="number")throw TypeError("Argument must be a number");var c=n(s);if(l!==void 0)if(typeof a==="string")c.fill(l,a);else c.fill(l);else c.fill(0);return c},i.allocUnsafe=function(s){if(typeof s!=="number")throw TypeError("Argument must be a number");return n(s)},i.allocUnsafeSlow=function(s){if(typeof s!=="number")throw TypeError("Argument must be a number");return r.SlowBuffer(s)}}}),cR=ye({"../node_modules/.bun/ecdsa-sig-formatter@1.0.11/node_modules/ecdsa-sig-formatter/src/param-bytes-for-alg.js"(e,t){function r(i){var s=(i/8|0)+(i%8===0?0:1);return s}var n={ES256:r(256),ES384:r(384),ES512:r(521)};function o(i){var s=n[i];if(s)return s;throw Error('Unknown algorithm "'+i+'"')}t.exports=o}}),Cv=ye({"../node_modules/.bun/ecdsa-sig-formatter@1.0.11/node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.js"(e,t){var r=zs().Buffer,n=cR(),o=128,i=0,s=32,l=16,a=2,c=l|s|i<<6,u=a|i<<6;function f(y){return y.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function h(y){if(r.isBuffer(y))return y;else if(typeof y==="string")return r.from(y,"base64");throw TypeError("ECDSA signature must be a Base64 string or a Buffer")}function g(y,S){y=h(y);var E=n(S),b=E+1,R=y.length,w=0;if(y[w++]!==c)throw Error('Could not find expected "seq"');var T=y[w++];if(T===(o|1))T=y[w++];if(R-w<T)throw Error('"seq" specified length of "'+T+'", only "'+(R-w)+'" remaining');if(y[w++]!==u)throw Error('Could not find expected "int" for "r"');var C=y[w++];if(R-w-2<C)throw Error('"r" specified length of "'+C+'", only "'+(R-w-2)+'" available');if(b<C)throw Error('"r" specified length of "'+C+'", max of "'+b+'" is acceptable');var A=w;if(w+=C,y[w++]!==u)throw Error('Could not find expected "int" for "s"');var P=y[w++];if(R-w!==P)throw Error('"s" specified length of "'+P+'", expected "'+(R-w)+'"');if(b<P)throw Error('"s" specified length of "'+P+'", max of "'+b+'" is acceptable');var D=w;if(w+=P,w!==R)throw Error('Expected to consume entire buffer, but "'+(R-w)+'" bytes remain');var N=E-C,F=E-P,G=r.allocUnsafe(N+C+F+P);for(w=0;w<N;++w)G[w]=0;y.copy(G,w,A+Math.max(-N,0),A+C),w=E;for(var B=w;w<B+F;++w)G[w]=0;return y.copy(G,w,D+Math.max(-F,0),D+P),G=G.toString("base64"),G=f(G),G}function p(y,S,E){var b=0;while(S+b<E&&y[S+b]===0)++b;var R=y[S+b]>=o;if(R)--b;return b}function _(y,S){y=h(y);var E=n(S),b=y.length;if(b!==E*2)throw TypeError('"'+S+'" signatures must be "'+E*2+'" bytes, saw "'+b+'"');var R=p(y,0,E),w=p(y,E,y.length),T=E-R,C=E-w,A=2+T+1+1+C,P=A<o,D=r.allocUnsafe((P?2:3)+A),N=0;if(D[N++]=c,P)D[N++]=A;else D[N++]=o|1,D[N++]=A&255;if(D[N++]=u,D[N++]=T,R<0)D[N++]=0,N+=y.copy(D,N,0,E);else N+=y.copy(D,N,R,E);if(D[N++]=u,D[N++]=C,w<0)D[N++]=0,y.copy(D,N,E);else y.copy(D,N,E+w);return D}t.exports={derToJose:g,joseToDer:_}}}),un=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/util.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.LRUCache=void 0,e.snakeToCamel=s,e.originalOrCamelOptions=l,e.removeUndefinedValuesInObject=c,e.isValidFile=u,e.getWellKnownCertificateConfigFileLocation=f;var t=we("fs"),r=we("os"),n=we("path"),o="certificate_config.json",i="gcloud";function s(g){return g.replace(/([_][^_])/g,(p)=>p.slice(1).toUpperCase())}function l(g){function p(_){let y=g||{};return y[_]??y[s(_)]}return{get:p}}var a=class{capacity;#e=new Map;maxAge;constructor(g){this.capacity=g.capacity,this.maxAge=g.maxAge}#t(g,p){this.#e.delete(g),this.#e.set(g,{value:p,lastAccessed:Date.now()})}set(g,p){this.#t(g,p),this.#r()}get(g){let p=this.#e.get(g);if(!p)return;return this.#t(g,p.value),this.#r(),p.value}#r(){let g=this.maxAge?Date.now()-this.maxAge:0,p=this.#e.entries().next();while(!p.done&&(this.#e.size>this.capacity||p.value[1].lastAccessed<g))this.#e.delete(p.value[0]),p=this.#e.entries().next()}};e.LRUCache=a;function c(g){return Object.entries(g).forEach(([p,_])=>{if(_===void 0||_==="undefined")delete g[p]}),g}async function u(g){try{return(await t.promises.lstat(g)).isFile()}catch(p){return!1}}function f(){let g=process.env.CLOUDSDK_CONFIG||(h()?n.join(process.env.APPDATA||"",i):n.join(process.env.HOME||"",".config",i));return n.join(g,o)}function h(){return r.platform().startsWith("win")}}}),uR=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/package.json"(e,t){t.exports={name:"google-auth-library",version:"10.9.1",author:"Google Inc.",description:"Google APIs Authentication Client Library for Node.js",engines:{node:">=18"},main:"./build/src/index.js",types:"./build/src/index.d.ts",repository:{type:"git",directory:"core/packages/google-auth-library-nodejs",url:"https://github.com/googleapis/google-cloud-node.git"},keywords:["google","api","google apis","client","client library"],dependencies:{"base64-js":"^1.3.0","ecdsa-sig-formatter":"^1.0.11",gaxios:"^7.1.4","gcp-metadata":"8.1.2","google-logging-utils":"1.1.3",jws:"^4.0.0"},devDependencies:{"@types/base64-js":"^1.2.5","@types/jws":"^3.1.0","@types/mocha":"^10.0.10","@types/mv":"^2.1.0","@types/ncp":"^2.0.8","@types/node":"^24.0.0","@types/sinon":"^21.0.0","assert-rejects":"^1.0.0",c8:"^10.1.3",codecov:"^3.8.3",gts:"^6.0.2","is-docker":"^3.0.0",jsdoc:"^4.0.4","jsdoc-fresh":"^5.0.0","jsdoc-region-tag":"^4.0.0",karma:"^6.0.0","karma-chrome-launcher":"^3.0.0","karma-coverage":"^2.0.0","karma-firefox-launcher":"^2.0.0","karma-mocha":"^2.0.0","karma-sourcemap-loader":"^0.4.0","karma-webpack":"^5.0.1",keypair:"^1.0.4",mocha:"^11.1.0",mv:"^2.1.1",ncp:"^2.0.0",nock:"^14.0.5","null-loader":"^4.0.1",puppeteer:"^24.0.0",sinon:"21.0.3","ts-loader":"^9.5.2",typescript:"5.8.3",webpack:"^5.97.1","webpack-cli":"^6.0.1"},files:["build/src","!build/src/**/*.map"],scripts:{test:"c8 mocha build/test",clean:"gts clean",prepare:"npm run compile",lint:"gts check --no-inline-config",compile:"tsc -p .",fix:"gts fix",pretest:"npm run compile -- --sourceMap",docs:"jsdoc -c .jsdoc.js","samples-setup":"cd samples/ && npm link ../ && npm run setup && cd ../","samples-test":"cd samples/ && npm link ../ && npm test && cd ../","system-test":"mocha build/system-test --timeout 60000","presystem-test":"npm run compile -- --sourceMap",webpack:"webpack","browser-test":"karma start",prelint:"cd samples; npm link ../; npm install"},license:"Apache-2.0",homepage:"https://github.com/googleapis/google-cloud-node/tree/main/core/packages/google-auth-library-nodejs"}}}),Rv=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/shared.cjs"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.USER_AGENT=e.PRODUCT_NAME=e.pkg=void 0;var t=uR();e.pkg=t;var r="google-api-nodejs-client";e.PRODUCT_NAME=r;var n=`${r}/${t.version}`;e.USER_AGENT=n}}),Mr=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/authclient.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.AuthClient=e.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS=e.DEFAULT_UNIVERSE=void 0;var t=we("events"),r=rr(),n=un(),o=wv(),i=Rv();e.DEFAULT_UNIVERSE="googleapis.com",e.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS=300000;var s=class l extends t.EventEmitter{apiKey;projectId;quotaProjectId;transporter;credentials={};eagerRefreshThresholdMillis=e.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS;forceRefreshOnFailure=!1;universeDomain=e.DEFAULT_UNIVERSE;static RequestMethodNameSymbol=Symbol("request method name");static RequestLogIdSymbol=Symbol("request log id");constructor(a={}){super();let c=(0,n.originalOrCamelOptions)(a);if(this.apiKey=a.apiKey,this.projectId=c.get("project_id")??null,this.quotaProjectId=c.get("quota_project_id"),this.credentials=c.get("credentials")??{},this.universeDomain=c.get("universe_domain")??e.DEFAULT_UNIVERSE,this.transporter=a.transporter??new r.Gaxios(a.transporterOptions),c.get("useAuthRequestParameters")!==!1)this.transporter.interceptors.request.add(l.DEFAULT_REQUEST_INTERCEPTOR),this.transporter.interceptors.response.add(l.DEFAULT_RESPONSE_INTERCEPTOR);if(a.eagerRefreshThresholdMillis)this.eagerRefreshThresholdMillis=a.eagerRefreshThresholdMillis;this.forceRefreshOnFailure=a.forceRefreshOnFailure??!1}fetch(...a){let c=a[0],u=a[1],f=void 0,h=new Headers;if(typeof c==="string")f=new URL(c);else if(c instanceof URL)f=c;else if(c&&c.url)f=new URL(c.url);if(c&&typeof c==="object"&&"headers"in c)r.Gaxios.mergeHeaders(h,c.headers);if(u)r.Gaxios.mergeHeaders(h,new Headers(u.headers));if(typeof c==="object"&&!(c instanceof URL))return this.request({...u,...c,headers:h,url:f});else return this.request({...u,headers:h,url:f})}setCredentials(a){this.credentials=a}addSharedMetadataHeaders(a){if(!a.has("x-goog-user-project")&&this.quotaProjectId)a.set("x-goog-user-project",this.quotaProjectId);return a}addUserProjectAndAuthHeaders(a,c){let u=c.get("x-goog-user-project"),f=c.get("authorization");if(u)a.set("x-goog-user-project",u);if(f)a.set("authorization",f);return a}static log=(0,o.log)("auth");static DEFAULT_REQUEST_INTERCEPTOR={resolved:async(a)=>{if(!a.headers.has("x-goog-api-client")){let u=process.version.replace(/^v/,"");a.headers.set("x-goog-api-client",`gl-node/${u}`)}let c=a.headers.get("User-Agent");if(!c)a.headers.set("User-Agent",i.USER_AGENT);else if(!c.includes(`${i.PRODUCT_NAME}/`))a.headers.set("User-Agent",`${c} ${i.USER_AGENT}`);try{let u=a,f=u[l.RequestMethodNameSymbol],h=`${Math.floor(Math.random()*1000)}`;u[l.RequestLogIdSymbol]=h;let g={url:a.url,headers:a.headers};if(f)l.log.info("%s [%s] request %j",f,h,g);else l.log.info("[%s] request %j",h,g)}catch(u){}return a}};static DEFAULT_RESPONSE_INTERCEPTOR={resolved:async(a)=>{try{let c=a.config,u=c[l.RequestMethodNameSymbol],f=c[l.RequestLogIdSymbol];if(u)l.log.info("%s [%s] response %j",u,f,a.data);else l.log.info("[%s] response %j",f,a.data)}catch(c){}return a},rejected:async(a)=>{try{let c=a.config,u=c[l.RequestMethodNameSymbol],f=c[l.RequestLogIdSymbol];if(u)l.log.info("%s [%s] error %j",u,f,a.response?.data);else l.log.error("[%s] error %j",f,a.response?.data)}catch(c){}throw a}};static setMethodName(a,c){try{let u=a;u[l.RequestMethodNameSymbol]=c}catch(u){}}static get RETRY_CONFIG(){return{retry:!0,retryConfig:{httpMethodsToRetry:["GET","PUT","POST","HEAD","OPTIONS","DELETE"]}}}};e.AuthClient=s}}),Av=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/loginticket.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.LoginTicket=void 0;var t=class{envelope;payload;constructor(r,n){this.envelope=r,this.payload=n}getEnvelope(){return this.envelope}getPayload(){return this.payload}getUserId(){let r=this.getPayload();if(r&&r.sub)return r.sub;return null}getAttributes(){return{envelope:this.getEnvelope(),payload:this.getPayload()}}};e.LoginTicket=t}}),Ho=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/oauth2client.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.OAuth2Client=e.ClientAuthentication=e.CertificateFormat=e.CodeChallengeMethod=void 0;var t=rr(),r=we("querystring"),n=we("stream"),o=Cv(),i=un(),s=wl(),l=Mr(),a=Av(),c;(function(g){g.Plain="plain",g.S256="S256"})(c||(e.CodeChallengeMethod=c={}));var u;(function(g){g.PEM="PEM",g.JWK="JWK"})(u||(e.CertificateFormat=u={}));var f;(function(g){g.ClientSecretPost="ClientSecretPost",g.ClientSecretBasic="ClientSecretBasic",g.None="None"})(f||(e.ClientAuthentication=f={}));var h=class g extends l.AuthClient{redirectUri;certificateCache={};certificateExpiry=null;certificateCacheFormat=u.PEM;refreshTokenPromises=new Map;endpoints;issuers;clientAuthentication;_clientId;_clientSecret;refreshHandler;constructor(p={},_,y){super(typeof p==="object"?p:{});if(typeof p!=="object")p={clientId:p,clientSecret:_,redirectUri:y};this._clientId=p.clientId||p.client_id,this._clientSecret=p.clientSecret||p.client_secret,this.redirectUri=p.redirectUri||p.redirect_uris?.[0],this.endpoints={tokenInfoUrl:"https://oauth2.googleapis.com/tokeninfo",oauth2AuthBaseUrl:"https://accounts.google.com/o/oauth2/v2/auth",oauth2TokenUrl:"https://oauth2.googleapis.com/token",oauth2RevokeUrl:"https://oauth2.googleapis.com/revoke",oauth2FederatedSignonPemCertsUrl:"https://www.googleapis.com/oauth2/v1/certs",oauth2FederatedSignonJwkCertsUrl:"https://www.googleapis.com/oauth2/v3/certs",oauth2IapPublicKeyUrl:"https://www.gstatic.com/iap/verify/public_key",...p.endpoints},this.clientAuthentication=p.clientAuthentication||f.ClientSecretPost,this.issuers=p.issuers||["accounts.google.com","https://accounts.google.com",this.universeDomain]}static GOOGLE_TOKEN_INFO_URL="https://oauth2.googleapis.com/tokeninfo";static CLOCK_SKEW_SECS_=300;static DEFAULT_MAX_TOKEN_LIFETIME_SECS_=86400;generateAuthUrl(p={}){if(p.code_challenge_method&&!p.code_challenge)throw Error("If a code_challenge_method is provided, code_challenge must be included.");if(p.response_type=p.response_type||"code",p.client_id=p.client_id||this._clientId,p.redirect_uri=p.redirect_uri||this.redirectUri,Array.isArray(p.scope))p.scope=p.scope.join(" ");return this.endpoints.oauth2AuthBaseUrl.toString()+"?"+r.stringify(p)}generateCodeVerifier(){throw Error("generateCodeVerifier is removed, please use generateCodeVerifierAsync instead.")}async generateCodeVerifierAsync(){let p=(0,s.createCrypto)(),y=p.randomBytesBase64(96).replace(/\+/g,"~").replace(/=/g,"_").replace(/\//g,"-"),E=(await p.sha256DigestBase64(y)).split("=")[0].replace(/\+/g,"-").replace(/\//g,"_");return{codeVerifier:y,codeChallenge:E}}getToken(p,_){let y=typeof p==="string"?{code:p}:p;if(_)this.getTokenAsync(y).then((S)=>_(null,S.tokens,S.res),(S)=>_(S,null,S.response));else return this.getTokenAsync(y)}async getTokenAsync(p){let _=this.endpoints.oauth2TokenUrl.toString(),y=new Headers,S={client_id:p.client_id||this._clientId,code_verifier:p.codeVerifier,code:p.code,grant_type:"authorization_code",redirect_uri:p.redirect_uri||this.redirectUri};if(this.clientAuthentication===f.ClientSecretBasic){let w=Buffer.from(`${this._clientId}:${this._clientSecret}`);y.set("authorization",`Basic ${w.toString("base64")}`)}if(this.clientAuthentication===f.ClientSecretPost)S.client_secret=this._clientSecret;let E={...g.RETRY_CONFIG,method:"POST",url:_,data:new URLSearchParams((0,i.removeUndefinedValuesInObject)(S)),headers:y};l.AuthClient.setMethodName(E,"getTokenAsync");let b=await this.transporter.request(E),R=b.data;if(b.data&&b.data.expires_in)R.expiry_date=new Date().getTime()+b.data.expires_in*1000,delete R.expires_in;return this.emit("tokens",R),{tokens:R,res:b}}async refreshToken(p){if(!p)return this.refreshTokenNoCache(p);if(this.refreshTokenPromises.has(p))return this.refreshTokenPromises.get(p);let _=this.refreshTokenNoCache(p).then((y)=>(this.refreshTokenPromises.delete(p),y),(y)=>{throw this.refreshTokenPromises.delete(p),y});return this.refreshTokenPromises.set(p,_),_}async refreshTokenNoCache(p){if(!p)throw Error("No refresh token is set.");let _=this.endpoints.oauth2TokenUrl.toString(),y={refresh_token:p,client_id:this._clientId,client_secret:this._clientSecret,grant_type:"refresh_token"},S;try{let b={...g.RETRY_CONFIG,method:"POST",url:_,data:new URLSearchParams((0,i.removeUndefinedValuesInObject)(y))};l.AuthClient.setMethodName(b,"refreshTokenNoCache"),S=await this.transporter.request(b)}catch(b){if(b instanceof t.GaxiosError&&b.message==="invalid_grant"&&b.response?.data&&/ReAuth/i.test(b.response.data.error_description))b.message=JSON.stringify(b.response.data);throw b}let E=S.data;if(S.data&&S.data.expires_in)E.expiry_date=new Date().getTime()+S.data.expires_in*1000,delete E.expires_in;return this.emit("tokens",E),{tokens:E,res:S}}refreshAccessToken(p){if(p)this.refreshAccessTokenAsync().then((_)=>p(null,_.credentials,_.res),p);else return this.refreshAccessTokenAsync()}async refreshAccessTokenAsync(){let p=await this.refreshToken(this.credentials.refresh_token),_=p.tokens;return _.refresh_token=this.credentials.refresh_token,this.credentials=_,{credentials:this.credentials,res:p.res}}getAccessToken(p){if(p)this.getAccessTokenAsync().then((_)=>p(null,_.token,_.res),p);else return this.getAccessTokenAsync()}async getAccessTokenAsync(){if(!this.credentials.access_token||this.isTokenExpiring()){if(!this.credentials.refresh_token)if(this.refreshHandler){let y=await this.processAndValidateRefreshHandler();if(y?.access_token)return this.setCredentials(y),{token:this.credentials.access_token}}else throw Error("No refresh token or refresh handler callback is set.");let _=await this.refreshAccessTokenAsync();if(!_.credentials||_.credentials&&!_.credentials.access_token)throw Error("Could not refresh access token.");return{token:_.credentials.access_token,res:_.res}}else return{token:this.credentials.access_token}}async getRequestHeaders(p){return(await this.getRequestMetadataAsync(p)).headers}async getRequestMetadataAsync(p){let _=this.credentials;if(!_.access_token&&!_.refresh_token&&!this.apiKey&&!this.refreshHandler)throw Error("No access, refresh token, API key or refresh handler callback is set.");if(_.access_token&&!this.isTokenExpiring()){_.token_type=_.token_type||"Bearer";let R=new Headers({authorization:_.token_type+" "+_.access_token});return{headers:this.addSharedMetadataHeaders(R)}}if(this.refreshHandler){let R=await this.processAndValidateRefreshHandler();if(R?.access_token){this.setCredentials(R);let w=new Headers({authorization:"Bearer "+this.credentials.access_token});return{headers:this.addSharedMetadataHeaders(w)}}}if(this.apiKey)return{headers:new Headers({"X-Goog-Api-Key":this.apiKey})};let y=null,S=null;try{y=await this.refreshToken(_.refresh_token),S=y.tokens}catch(R){let w=R;if(w.response&&(w.response.status===403||w.response.status===404))w.message=`Could not refresh access token: ${w.message}`;throw w}let E=this.credentials;E.token_type=E.token_type||"Bearer",S.refresh_token=E.refresh_token,this.credentials=S;let b=new Headers({authorization:E.token_type+" "+S.access_token});return{headers:this.addSharedMetadataHeaders(b),res:y.res}}static getRevokeTokenUrl(p){return new g().getRevokeTokenURL(p).toString()}getRevokeTokenURL(p){let _=new URL(this.endpoints.oauth2RevokeUrl);return _.searchParams.append("token",p),_}revokeToken(p,_){let y={...g.RETRY_CONFIG,url:this.getRevokeTokenURL(p).toString(),method:"POST"};if(l.AuthClient.setMethodName(y,"revokeToken"),_)this.transporter.request(y).then((S)=>_(null,S),_);else return this.transporter.request(y)}revokeCredentials(p){if(p)this.revokeCredentialsAsync().then((_)=>p(null,_),p);else return this.revokeCredentialsAsync()}async revokeCredentialsAsync(){let p=this.credentials.access_token;if(this.credentials={},p)return this.revokeToken(p);else throw Error("No access token to revoke.")}request(p,_){if(_)this.requestAsync(p).then((y)=>_(null,y),(y)=>_(y,y.response));else return this.requestAsync(p)}async requestAsync(p,_=!1){try{let y=await this.getRequestMetadataAsync();if(p.headers=t.Gaxios.mergeHeaders(p.headers),this.addUserProjectAndAuthHeaders(p.headers,y.headers),this.apiKey)p.headers.set("X-Goog-Api-Key",this.apiKey);return await this.transporter.request(p)}catch(y){let S=y.response;if(S){let E=S.status,b=this.credentials&&this.credentials.access_token&&this.credentials.refresh_token&&(!this.credentials.expiry_date||this.forceRefreshOnFailure),R=this.credentials&&this.credentials.access_token&&!this.credentials.refresh_token&&(!this.credentials.expiry_date||this.forceRefreshOnFailure)&&this.refreshHandler,w=S.config.data instanceof n.Readable,T=E===401||E===403;if(!_&&T&&!w&&b)return await this.refreshAccessTokenAsync(),this.requestAsync(p,!0);else if(!_&&T&&!w&&R){let C=await this.processAndValidateRefreshHandler();if(C?.access_token)this.setCredentials(C);return this.requestAsync(p,!0)}}throw y}}verifyIdToken(p,_){if(_&&typeof _!=="function")throw Error("This method accepts an options object as the first parameter, which includes the idToken, audience, and maxExpiry.");if(_)this.verifyIdTokenAsync(p).then((y)=>_(null,y),_);else return this.verifyIdTokenAsync(p)}async verifyIdTokenAsync(p){if(!p.idToken)throw Error("The verifyIdToken method requires an ID Token");let _=await this.getFederatedSignonCertsAsync();return await this.verifySignedJwtWithCertsAsync(p.idToken,_.certs,p.audience,this.issuers,p.maxExpiry)}async getTokenInfo(p){let{data:_}=await this.transporter.request({...g.RETRY_CONFIG,method:"POST",headers:{"content-type":"application/x-www-form-urlencoded;charset=UTF-8",authorization:`Bearer ${p}`},url:this.endpoints.tokenInfoUrl.toString()}),y=Object.assign({expiry_date:new Date().getTime()+_.expires_in*1000,scopes:_.scope.split(" ")},_);return delete y.expires_in,delete y.scope,y}getFederatedSignonCerts(p){if(p)this.getFederatedSignonCertsAsync().then((_)=>p(null,_.certs,_.res),p);else return this.getFederatedSignonCertsAsync()}async getFederatedSignonCertsAsync(){let p=new Date().getTime(),_=(0,s.hasBrowserCrypto)()?u.JWK:u.PEM;if(this.certificateExpiry&&p<this.certificateExpiry.getTime()&&this.certificateCacheFormat===_)return{certs:this.certificateCache,format:_};let y,S;switch(_){case u.PEM:S=this.endpoints.oauth2FederatedSignonPemCertsUrl.toString();break;case u.JWK:S=this.endpoints.oauth2FederatedSignonJwkCertsUrl.toString();break;default:throw Error(`Unsupported certificate format ${_}`)}try{let T={...g.RETRY_CONFIG,url:S};l.AuthClient.setMethodName(T,"getFederatedSignonCertsAsync"),y=await this.transporter.request(T)}catch(T){if(T instanceof Error)T.message=`Failed to retrieve verification certificates: ${T.message}`;throw T}let E=y?.headers.get("cache-control"),b=-1;if(E){let T=/max-age=(?<maxAge>[0-9]+)/.exec(E)?.groups?.maxAge;if(T)b=Number(T)*1000}let R={};switch(_){case u.PEM:R=y.data;break;case u.JWK:for(let T of y.data.keys)R[T.kid]=T;break;default:throw Error(`Unsupported certificate format ${_}`)}let w=new Date;return this.certificateExpiry=b===-1?null:new Date(w.getTime()+b),this.certificateCache=R,this.certificateCacheFormat=_,{certs:R,format:_,res:y}}getIapPublicKeys(p){if(p)this.getIapPublicKeysAsync().then((_)=>p(null,_.pubkeys,_.res),p);else return this.getIapPublicKeysAsync()}async getIapPublicKeysAsync(){let p,_=this.endpoints.oauth2IapPublicKeyUrl.toString();try{let y={...g.RETRY_CONFIG,url:_};l.AuthClient.setMethodName(y,"getIapPublicKeysAsync"),p=await this.transporter.request(y)}catch(y){if(y instanceof Error)y.message=`Failed to retrieve verification certificates: ${y.message}`;throw y}return{pubkeys:p.data,res:p}}verifySignedJwtWithCerts(){throw Error("verifySignedJwtWithCerts is removed, please use verifySignedJwtWithCertsAsync instead.")}async verifySignedJwtWithCertsAsync(p,_,y,S,E){let b=(0,s.createCrypto)();if(!E)E=g.DEFAULT_MAX_TOKEN_LIFETIME_SECS_;let R=p.split(".");if(R.length!==3)throw Error("Wrong number of segments in token: "+p);let w=R[0]+"."+R[1],T=R[2],C,A;try{C=JSON.parse(b.decodeBase64StringUtf8(R[0]))}catch(pe){if(pe instanceof Error)pe.message=`Can't parse token envelope: ${R[0]}': ${pe.message}`;throw pe}if(!C)throw Error("Can't parse token envelope: "+R[0]);try{A=JSON.parse(b.decodeBase64StringUtf8(R[1]))}catch(pe){if(pe instanceof Error)pe.message=`Can't parse token payload '${R[0]}`;throw pe}if(!A)throw Error("Can't parse token payload: "+R[1]);if(!Object.prototype.hasOwnProperty.call(_,C.kid))throw Error("No pem found for envelope: "+JSON.stringify(C));let P=_[C.kid];if(C.alg==="ES256")T=o.joseToDer(T,"ES256").toString("base64");if(!await b.verify(P,w,T))throw Error("Invalid token signature: "+p);if(!A.iat)throw Error("No issue time in token: "+JSON.stringify(A));if(!A.exp)throw Error("No expiration time in token: "+JSON.stringify(A));let N=Number(A.iat);if(isNaN(N))throw Error("iat field using invalid format");let F=Number(A.exp);if(isNaN(F))throw Error("exp field using invalid format");let G=new Date().getTime()/1000;if(F>=G+E)throw Error("Expiration time too far in future: "+JSON.stringify(A));let B=N-g.CLOCK_SKEW_SECS_,Q=F+g.CLOCK_SKEW_SECS_;if(G<B)throw Error("Token used too early, "+G+" < "+B+": "+JSON.stringify(A));if(G>Q)throw Error("Token used too late, "+G+" > "+Q+": "+JSON.stringify(A));if(S&&S.indexOf(A.iss)<0)throw Error("Invalid issuer, expected one of ["+S+"], but got "+A.iss);if(typeof y<"u"&&y!==null){let pe=A.aud,se=!1;if(y.constructor===Array)se=y.indexOf(pe)>-1;else se=pe===y;if(!se)throw Error("Wrong recipient, payload audience != requiredAudience")}return new a.LoginTicket(C,A)}async processAndValidateRefreshHandler(){if(this.refreshHandler){let p=await this.refreshHandler();if(!p.access_token)throw Error("No access token is returned by the refreshHandler callback.");return p}return}isTokenExpiring(){let p=this.credentials.expiry_date;return p?p<=new Date().getTime()+this.eagerRefreshThresholdMillis:!1}};e.OAuth2Client=h}}),Iv=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/computeclient.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Compute=void 0;var t=rr(),r=bl(),n=Ho(),o=class extends n.OAuth2Client{serviceAccountEmail;scopes;constructor(i={}){super(i);this.credentials={expiry_date:1,refresh_token:"compute-placeholder"},this.serviceAccountEmail=i.serviceAccountEmail||"default",this.scopes=Array.isArray(i.scopes)?i.scopes:i.scopes?[i.scopes]:[]}async refreshTokenNoCache(){let i=`service-accounts/${this.serviceAccountEmail}/token`,s;try{let a={property:i};if(this.scopes.length>0)a.params={scopes:this.scopes.join(",")};s=await r.instance(a)}catch(a){if(a instanceof t.GaxiosError)a.message=`Could not refresh access token: ${a.message}`,this.wrapError(a);throw a}let l=s;if(s&&s.expires_in)l.expiry_date=new Date().getTime()+s.expires_in*1000,delete l.expires_in;return this.emit("tokens",l),{tokens:l,res:null}}async fetchIdToken(i){let s=`service-accounts/${this.serviceAccountEmail}/identity?format=full&audience=${i}`,l;try{let a={property:s};l=await r.instance(a)}catch(a){if(a instanceof Error)a.message=`Could not fetch ID token: ${a.message}`;throw a}return l}wrapError(i){let s=i.response;if(s&&s.status){if(i.status=s.status,s.status===403)i.message="A Forbidden error was returned while attempting to retrieve an access token for the Compute Engine built-in service account. This may be because the Compute Engine instance does not have the correct permission scopes specified: "+i.message;else if(s.status===404)i.message="A Not Found error was returned while attempting to retrieve an accesstoken for the Compute Engine built-in service account. This may be because the Compute Engine instance does not have any permission scopes specified: "+i.message}}};e.Compute=o}}),Pv=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/idtokenclient.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.IdTokenClient=void 0;var t=Ho(),r=class extends t.OAuth2Client{targetAudience;idTokenProvider;constructor(n){super(n);this.targetAudience=n.targetAudience,this.idTokenProvider=n.idTokenProvider}async getRequestMetadataAsync(){if(!this.credentials.id_token||!this.credentials.expiry_date||this.isTokenExpiring()){let o=await this.idTokenProvider.fetchIdToken(this.targetAudience);this.credentials={id_token:o,expiry_date:this.getIdTokenExpiryDate(o)}}return{headers:new Headers({authorization:"Bearer "+this.credentials.id_token})}}getIdTokenExpiryDate(n){let o=n.split(".")[1];if(o)return JSON.parse(Buffer.from(o,"base64").toString("ascii")).exp*1000}};e.IdTokenClient=r}}),kv=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/envDetect.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.GCPEnv=void 0,e.clear=o,e.getEnv=i;var t=bl(),r;(function(g){g.APP_ENGINE="APP_ENGINE",g.KUBERNETES_ENGINE="KUBERNETES_ENGINE",g.CLOUD_FUNCTIONS="CLOUD_FUNCTIONS",g.COMPUTE_ENGINE="COMPUTE_ENGINE",g.CLOUD_RUN="CLOUD_RUN",g.CLOUD_RUN_JOBS="CLOUD_RUN_JOBS",g.NONE="NONE"})(r||(e.GCPEnv=r={}));var n;function o(){n=void 0}async function i(){if(n)return n;return n=s(),n}async function s(){let g=r.NONE;if(l())g=r.APP_ENGINE;else if(a())g=r.CLOUD_FUNCTIONS;else if(await h())if(await f())g=r.KUBERNETES_ENGINE;else if(c())g=r.CLOUD_RUN;else if(u())g=r.CLOUD_RUN_JOBS;else g=r.COMPUTE_ENGINE;else g=r.NONE;return g}function l(){return!!(process.env.GAE_SERVICE||process.env.GAE_MODULE_NAME)}function a(){return!!(process.env.FUNCTION_NAME||process.env.FUNCTION_TARGET)}function c(){return!!process.env.K_CONFIGURATION}function u(){return!!process.env.CLOUD_RUN_JOB}async function f(){try{return await t.instance("attributes/cluster-name"),!0}catch(g){return!1}}async function h(){return t.isAvailable()}}}),Nv=ye({"../node_modules/.bun/jws@4.0.1/node_modules/jws/lib/data-stream.js"(e,t){var r=zs().Buffer,n=we("stream"),o=we("util");function i(s){if(this.buffer=null,this.writable=!0,this.readable=!0,!s)return this.buffer=r.alloc(0),this;if(typeof s.pipe==="function")return this.buffer=r.alloc(0),s.pipe(this),this;if(s.length||typeof s==="object")return this.buffer=s,this.writable=!1,process.nextTick(function(){this.emit("end",s),this.readable=!1,this.emit("close")}.bind(this)),this;throw TypeError("Unexpected data type ("+typeof s+")")}o.inherits(i,n),i.prototype.write=function s(l){this.buffer=r.concat([this.buffer,r.from(l)]),this.emit("data",l)},i.prototype.end=function s(l){if(l)this.write(l);this.emit("end",l),this.emit("close"),this.writable=!1,this.readable=!1},t.exports=i}}),dR=ye({"../node_modules/.bun/buffer-equal-constant-time@1.0.1/node_modules/buffer-equal-constant-time/index.js"(e,t){var r=we("buffer").Buffer,n=we("buffer").SlowBuffer;t.exports=o;function o(l,a){if(!r.isBuffer(l)||!r.isBuffer(a))return!1;if(l.length!==a.length)return!1;var c=0;for(var u=0;u<l.length;u++)c|=l[u]^a[u];return c===0}o.install=function(){r.prototype.equal=n.prototype.equal=function l(a){return o(this,a)}};var i=r.prototype.equal,s=n.prototype.equal;o.restore=function(){r.prototype.equal=i,n.prototype.equal=s}}}),Ov=ye({"../node_modules/.bun/jwa@2.0.1/node_modules/jwa/index.js"(e,t){var r=zs().Buffer,n=we("crypto"),o=Cv(),i=we("util"),s=`"%s" is not a valid algorithm.
38
+ Supported algorithms are:
39
+ "HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".`,l="secret must be a string or buffer",a="key must be a string or a buffer",c="key must be a string, a buffer or an object",u=typeof n.createPublicKey==="function";if(u)a+=" or a KeyObject",l+="or a KeyObject";function f(Q){if(r.isBuffer(Q))return;if(typeof Q==="string")return;if(!u)throw y(a);if(typeof Q!=="object")throw y(a);if(typeof Q.type!=="string")throw y(a);if(typeof Q.asymmetricKeyType!=="string")throw y(a);if(typeof Q.export!=="function")throw y(a)}function h(Q){if(r.isBuffer(Q))return;if(typeof Q==="string")return;if(typeof Q==="object")return;throw y(c)}function g(Q){if(r.isBuffer(Q))return;if(typeof Q==="string")return Q;if(!u)throw y(l);if(typeof Q!=="object")throw y(l);if(Q.type!=="secret")throw y(l);if(typeof Q.export!=="function")throw y(l)}function p(Q){return Q.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function _(Q){Q=Q.toString();var pe=4-Q.length%4;if(pe!==4)for(var se=0;se<pe;++se)Q+="=";return Q.replace(/\-/g,"+").replace(/_/g,"/")}function y(Q){var pe=[].slice.call(arguments,1),se=i.format.bind(i,Q).apply(null,pe);return TypeError(se)}function S(Q){return r.isBuffer(Q)||typeof Q==="string"}function E(Q){if(!S(Q))Q=JSON.stringify(Q);return Q}function b(Q){return function pe(se,ve){g(ve),se=E(se);var me=n.createHmac("sha"+Q,ve),j=(me.update(se),me.digest("base64"));return p(j)}}var R,w="timingSafeEqual"in n?function Q(pe,se){if(pe.byteLength!==se.byteLength)return!1;return n.timingSafeEqual(pe,se)}:function Q(pe,se){if(!R)R=dR();return R(pe,se)};function T(Q){return function pe(se,ve,me){var j=b(Q)(se,me);return w(r.from(ve),r.from(j))}}function C(Q){return function pe(se,ve){h(ve),se=E(se);var me=n.createSign("RSA-SHA"+Q),j=(me.update(se),me.sign(ve,"base64"));return p(j)}}function A(Q){return function pe(se,ve,me){f(me),se=E(se),ve=_(ve);var j=n.createVerify("RSA-SHA"+Q);return j.update(se),j.verify(me,ve,"base64")}}function P(Q){return function pe(se,ve){h(ve),se=E(se);var me=n.createSign("RSA-SHA"+Q),j=(me.update(se),me.sign({key:ve,padding:n.constants.RSA_PKCS1_PSS_PADDING,saltLength:n.constants.RSA_PSS_SALTLEN_DIGEST},"base64"));return p(j)}}function D(Q){return function pe(se,ve,me){f(me),se=E(se),ve=_(ve);var j=n.createVerify("RSA-SHA"+Q);return j.update(se),j.verify({key:me,padding:n.constants.RSA_PKCS1_PSS_PADDING,saltLength:n.constants.RSA_PSS_SALTLEN_DIGEST},ve,"base64")}}function N(Q){var pe=C(Q);return function se(){var ve=pe.apply(null,arguments);return ve=o.derToJose(ve,"ES"+Q),ve}}function F(Q){var pe=A(Q);return function se(ve,me,j){me=o.joseToDer(me,"ES"+Q).toString("base64");var ne=pe(ve,me,j);return ne}}function G(){return function Q(){return""}}function B(){return function Q(pe,se){return se===""}}t.exports=function Q(pe){var se={hs:b,rs:C,ps:P,es:N,none:G},ve={hs:T,rs:A,ps:D,es:F,none:B},me=pe.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/);if(!me)throw y(s,pe);var j=(me[1]||me[3]).toLowerCase(),ne=me[2];return{sign:se[j](ne),verify:ve[j](ne)}}}}),Mv=ye({"../node_modules/.bun/jws@4.0.1/node_modules/jws/lib/tostring.js"(e,t){var r=we("buffer").Buffer;t.exports=function n(o){if(typeof o==="string")return o;if(typeof o==="number"||r.isBuffer(o))return o.toString();return JSON.stringify(o)}}}),fR=ye({"../node_modules/.bun/jws@4.0.1/node_modules/jws/lib/sign-stream.js"(e,t){var r=zs().Buffer,n=Nv(),o=Ov(),i=we("stream"),s=Mv(),l=we("util");function a(h,g){return r.from(h,g).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function c(h,g,p){p=p||"utf8";var _=a(s(h),"binary"),y=a(s(g),p);return l.format("%s.%s",_,y)}function u(h){var{header:g,payload:p}=h,_=h.secret||h.privateKey,y=h.encoding,S=o(g.alg),E=c(g,p,y),b=S.sign(E,_);return l.format("%s.%s",E,b)}function f(h){var g=h.secret;if(g=g==null?h.privateKey:g,g=g==null?h.key:g,/^hs/i.test(h.header.alg)===!0&&g==null)throw TypeError("secret must be a string or buffer or a KeyObject");var p=new n(g);this.readable=!0,this.header=h.header,this.encoding=h.encoding,this.secret=this.privateKey=this.key=p,this.payload=new n(h.payload),this.secret.once("close",function(){if(!this.payload.writable&&this.readable)this.sign()}.bind(this)),this.payload.once("close",function(){if(!this.secret.writable&&this.readable)this.sign()}.bind(this))}l.inherits(f,i),f.prototype.sign=function h(){try{var g=u({header:this.header,payload:this.payload.buffer,secret:this.secret.buffer,encoding:this.encoding});return this.emit("done",g),this.emit("data",g),this.emit("end"),this.readable=!1,g}catch(p){this.readable=!1,this.emit("error",p),this.emit("close")}},f.sign=u,t.exports=f}}),pR=ye({"../node_modules/.bun/jws@4.0.1/node_modules/jws/lib/verify-stream.js"(e,t){var r=zs().Buffer,n=Nv(),o=Ov(),i=we("stream"),s=Mv(),l=we("util"),a=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function c(b){return Object.prototype.toString.call(b)==="[object Object]"}function u(b){if(c(b))return b;try{return JSON.parse(b)}catch(R){return}}function f(b){var R=b.split(".",1)[0];return u(r.from(R,"base64").toString("binary"))}function h(b){return b.split(".",2).join(".")}function g(b){return b.split(".")[2]}function p(b,R){R=R||"utf8";var w=b.split(".")[1];return r.from(w,"base64").toString(R)}function _(b){return a.test(b)&&!!f(b)}function y(b,R,w){if(!R){var T=Error("Missing algorithm parameter for jws.verify");throw T.code="MISSING_ALGORITHM",T}b=s(b);var C=g(b),A=h(b),P=o(R);return P.verify(A,C,w)}function S(b,R){if(R=R||{},b=s(b),!_(b))return null;var w=f(b);if(!w)return null;var T=p(b);if(w.typ==="JWT"||R.json)T=JSON.parse(T,R.encoding);return{header:w,payload:T,signature:g(b)}}function E(b){b=b||{};var R=b.secret;if(R=R==null?b.publicKey:R,R=R==null?b.key:R,/^hs/i.test(b.algorithm)===!0&&R==null)throw TypeError("secret must be a string or buffer or a KeyObject");var w=new n(R);this.readable=!0,this.algorithm=b.algorithm,this.encoding=b.encoding,this.secret=this.publicKey=this.key=w,this.signature=new n(b.signature),this.secret.once("close",function(){if(!this.signature.writable&&this.readable)this.verify()}.bind(this)),this.signature.once("close",function(){if(!this.secret.writable&&this.readable)this.verify()}.bind(this))}l.inherits(E,i),E.prototype.verify=function b(){try{var R=y(this.signature.buffer,this.algorithm,this.key.buffer),w=S(this.signature.buffer,this.encoding);return this.emit("done",R,w),this.emit("data",R),this.emit("end"),this.readable=!1,R}catch(T){this.readable=!1,this.emit("error",T),this.emit("close")}},E.decode=S,E.isValid=_,E.verify=y,t.exports=E}}),Dv=ye({"../node_modules/.bun/jws@4.0.1/node_modules/jws/index.js"(e){var t=fR(),r=pR(),n=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"];e.ALGORITHMS=n,e.sign=t.sign,e.verify=r.verify,e.decode=r.decode,e.isValid=r.isValid,e.createSign=function o(i){return new t(i)},e.createVerify=function o(i){return new r(i)}}}),hR=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/gtoken/jwsSign.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.buildPayloadForJwsSign=o,e.getJwsSign=i;var t=Dv(),r="RS256",n="https://oauth2.googleapis.com/token";function o(s){let l=Math.floor(new Date().getTime()/1000);return{iss:s.iss,scope:s.scope,aud:n,exp:l+3600,iat:l,sub:s.sub,...s.additionalClaims}}function i(s){let l=o(s);return(0,t.sign)({header:{alg:r},payload:l,secret:s.key})}}}),mR=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/gtoken/getToken.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getToken=i;var t=hR(),r="https://oauth2.googleapis.com/token",n="urn:ietf:params:oauth:grant-type:jwt-bearer",o=(s)=>({method:"POST",url:r,data:new URLSearchParams({grant_type:n,assertion:(0,t.getJwsSign)(s)}),responseType:"json",retryConfig:{httpMethodsToRetry:["POST"]}});async function i(s){if(!s.transporter)throw Error("No transporter set.");try{let l=o(s);return(await s.transporter.request(l)).data}catch(l){let a=l,c=a.response?.data;if(c?.error)a.message=`${c.error}: ${c.error_description}`;throw a}}}}),gR=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/gtoken/errorWithCode.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ErrorWithCode=void 0;var t=class extends Error{code;constructor(r,n){super(r);this.code=n}};e.ErrorWithCode=t}}),$v=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/gtoken/getCredentials.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getCredentials=f;var t=we("path"),r=we("fs"),n=we("util"),o=gR(),i=r.readFile?(0,n.promisify)(r.readFile):async()=>{throw new o.ErrorWithCode("use key rather than keyFile.","MISSING_CREDENTIALS")},s;(function(h){h.JSON=".json",h.DER=".der",h.CRT=".crt",h.PEM=".pem",h.P12=".p12",h.PFX=".pfx"})(s||(s={}));var l=class{keyFilePath;constructor(h){this.keyFilePath=h}async getCredentials(){let h=await i(this.keyFilePath,"utf8"),g;try{g=JSON.parse(h)}catch(y){throw Error(`Invalid JSON key file: ${y.message}`)}let p=g.private_key,_=g.client_email;if(!p||!_)throw new o.ErrorWithCode("private_key and client_email are required.","MISSING_CREDENTIALS");return{privateKey:p,clientEmail:_}}},a=class{keyFilePath;constructor(h){this.keyFilePath=h}async getCredentials(){return{privateKey:await i(this.keyFilePath,"utf8")}}},c=class{async getCredentials(){throw new o.ErrorWithCode("*.p12 certificates are not supported after v6.1.2. Consider utilizing *.json format or converting *.p12 to *.pem using the OpenSSL CLI.","UNKNOWN_CERTIFICATE_TYPE")}},u=class{static create(h){switch(t.extname(h)){case s.JSON:return new l(h);case s.DER:case s.CRT:case s.PEM:return new a(h);case s.P12:case s.PFX:return new c;default:throw new o.ErrorWithCode("Unknown certificate type. Type is determined based on file extension. Current supported extensions are *.json, and *.pem.","UNKNOWN_CERTIFICATE_TYPE")}}};async function f(h){return u.create(h).getCredentials()}}}),vR=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/gtoken/tokenHandler.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TokenHandler=void 0;var t=mR(),r=$v(),n=class{token;tokenExpiresAt;inFlightRequest;tokenOptions;constructor(o){this.tokenOptions=o}async processCredentials(){if(!this.tokenOptions.key&&!this.tokenOptions.keyFile)throw Error("No key or keyFile set.");if(!this.tokenOptions.key&&this.tokenOptions.keyFile){let o=await(0,r.getCredentials)(this.tokenOptions.keyFile);this.tokenOptions.key=o.privateKey,this.tokenOptions.email=o.clientEmail}}isTokenExpiring(){if(!this.token||!this.tokenExpiresAt)return!0;let o=new Date().getTime(),i=this.tokenOptions.eagerRefreshThresholdMillis??0;return this.tokenExpiresAt<=o+i}hasExpired(){let o=new Date().getTime();if(this.token&&this.tokenExpiresAt)return new Date().getTime()>=this.tokenExpiresAt;return!0}async getToken(o){if(await this.processCredentials(),this.inFlightRequest&&!o)return this.inFlightRequest;if(this.token&&!this.isTokenExpiring()&&!o)return this.token;try{this.inFlightRequest=(0,t.getToken)(this.tokenOptions);let i=await this.inFlightRequest;return this.token=i,this.tokenExpiresAt=new Date().getTime()+(i.expires_in??0)*1000,i}finally{this.inFlightRequest=void 0}}};e.TokenHandler=n}}),_R=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/gtoken/revokeToken.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.revokeToken=n;var t="https://oauth2.googleapis.com/revoke?token=",r=!0;async function n(o,i){let s=t+o;return await i.request({url:s,retry:r})}}}),xv=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/gtoken/googleToken.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.GoogleToken=void 0;var t=rr(),r=vR(),n=_R(),o=class{tokenOptions;tokenHandler;constructor(i){if(this.tokenOptions=i||{},this.tokenOptions.transporter=this.tokenOptions.transporter||{request:(s)=>(0,t.request)(s)},!this.tokenOptions.iss)this.tokenOptions.iss=this.tokenOptions.email;if(typeof this.tokenOptions.scope==="object")this.tokenOptions.scope=this.tokenOptions.scope.join(" ");this.tokenHandler=new r.TokenHandler(this.tokenOptions)}get expiresAt(){return this.tokenHandler.tokenExpiresAt}get accessToken(){return this.tokenHandler.token?.access_token}get idToken(){return this.tokenHandler.token?.id_token}get tokenType(){return this.tokenHandler.token?.token_type}get refreshToken(){return this.tokenHandler.token?.refresh_token}hasExpired(){return this.tokenHandler.hasExpired()}isTokenExpiring(){return this.tokenHandler.isTokenExpiring()}getToken(i,s={forceRefresh:!1}){let l;if(typeof i==="function")l=i;else if(typeof i==="object")s=i;let a=this.tokenHandler.getToken(s.forceRefresh??!1);if(l)a.then((c)=>l(null,c),l);return a}revokeToken(i){if(!this.accessToken)return Promise.reject(Error("No token to revoke."));let s=(0,n.revokeToken)(this.accessToken,this.tokenOptions.transporter);if(i)s.then(()=>i(),i);this.tokenHandler=new r.TokenHandler(this.tokenOptions)}get googleTokenOptions(){return this.tokenOptions}};e.GoogleToken=o}}),Lv=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/jwtaccess.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.JWTAccess=void 0;var t=Dv(),r=un(),n={alg:"RS256",typ:"JWT"},o=class i{email;key;keyId;projectId;eagerRefreshThresholdMillis;cache=new r.LRUCache({capacity:500,maxAge:3600000});constructor(s,l,a,c){this.email=s,this.key=l,this.keyId=a,this.eagerRefreshThresholdMillis=c??300000}getCachedKey(s,l){let a=s;if(l&&Array.isArray(l)&&l.length)a=s?`${s}_${l.join("_")}`:`${l.join("_")}`;else if(typeof l==="string")a=s?`${s}_${l}`:l;if(!a)throw Error("Scopes or url must be provided");return a}getRequestHeaders(s,l,a){let c=this.getCachedKey(s,a),u=this.cache.get(c),f=Date.now();if(u&&u.expiration-f>this.eagerRefreshThresholdMillis)return new Headers(u.headers);let h=Math.floor(Date.now()/1000),g=i.getExpirationTime(h),p;if(Array.isArray(a))a=a.join(" ");if(a)p={iss:this.email,sub:this.email,scope:a,exp:g,iat:h};else p={iss:this.email,sub:this.email,aud:s,exp:g,iat:h};if(l){for(let b in p)if(l[b])throw Error(`The '${b}' property is not allowed when passing additionalClaims. This claim is included in the JWT by default.`)}let _=this.keyId?{...n,kid:this.keyId}:n,y=Object.assign(p,l),S=t.sign({header:_,payload:y,secret:this.key}),E=new Headers({authorization:`Bearer ${S}`});return this.cache.set(c,{expiration:g*1000,headers:E}),E}static getExpirationTime(s){return s+3600}fromJSON(s){if(!s)throw Error("Must pass in a JSON object containing the service account auth settings.");if(!s.client_email)throw Error("The incoming JSON object does not contain a client_email field");if(!s.private_key)throw Error("The incoming JSON object does not contain a private_key field");this.email=s.client_email,this.key=s.private_key,this.keyId=s.private_key_id,this.projectId=s.project_id}fromStream(s,l){if(l)this.fromStreamAsync(s).then(()=>l(),l);else return this.fromStreamAsync(s)}fromStreamAsync(s){return new Promise((l,a)=>{if(!s)a(Error("Must pass in a stream containing the service account auth settings."));let c="";s.setEncoding("utf8").on("data",(u)=>c+=u).on("error",a).on("end",()=>{try{let u=JSON.parse(c);this.fromJSON(u),l()}catch(u){a(u)}})})}};e.JWTAccess=o}}),qv=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/jwtclient.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.JWT=void 0;var t=xv(),r=$v(),n=Lv(),o=Ho(),i=Mr(),s=class l extends o.OAuth2Client{email;keyFile;key;keyId;defaultScopes;scopes;scope;subject;gtoken;additionalClaims;useJWTAccessWithScope;defaultServicePath;access;constructor(a={}){super(a);this.email=a.email,this.keyFile=a.keyFile,this.key=a.key,this.keyId=a.keyId,this.scopes=a.scopes,this.subject=a.subject,this.additionalClaims=a.additionalClaims,this.credentials={refresh_token:"jwt-placeholder",expiry_date:1}}createScoped(a){let c=new l(this);return c.scopes=a,c}async getRequestMetadataAsync(a){a=this.defaultServicePath?`https://${this.defaultServicePath}/`:a;let c=!this.hasUserScopes()&&a||this.useJWTAccessWithScope&&this.hasAnyScopes()||this.universeDomain!==i.DEFAULT_UNIVERSE;if(this.subject&&this.universeDomain!==i.DEFAULT_UNIVERSE)throw RangeError(`Service Account user is configured for the credential. Domain-wide delegation is not supported in universes other than ${i.DEFAULT_UNIVERSE}`);if(!this.apiKey&&c)if(this.additionalClaims&&this.additionalClaims.target_audience){let{tokens:u}=await this.refreshToken();return{headers:this.addSharedMetadataHeaders(new Headers({authorization:`Bearer ${u.id_token}`}))}}else{if(!this.access)this.access=new n.JWTAccess(this.email,this.key,this.keyId,this.eagerRefreshThresholdMillis);let u;if(this.hasUserScopes())u=this.scopes;else if(!a)u=this.defaultScopes;let f=this.useJWTAccessWithScope||this.universeDomain!==i.DEFAULT_UNIVERSE,h=await this.access.getRequestHeaders(a??void 0,this.additionalClaims,f?u:void 0);return{headers:this.addSharedMetadataHeaders(h)}}else if(this.hasAnyScopes()||this.apiKey)return super.getRequestMetadataAsync(a);else return{headers:new Headers}}async fetchIdToken(a){let c=new t.GoogleToken({iss:this.email,sub:this.subject,scope:this.scopes||this.defaultScopes,keyFile:this.keyFile,key:this.key,additionalClaims:{target_audience:a},transporter:this.transporter});if(await c.getToken({forceRefresh:!0}),!c.idToken)throw Error("Unknown error: Failed to fetch ID token");return c.idToken}hasUserScopes(){if(!this.scopes)return!1;return this.scopes.length>0}hasAnyScopes(){if(this.scopes&&this.scopes.length>0)return!0;if(this.defaultScopes&&this.defaultScopes.length>0)return!0;return!1}authorize(a){if(a)this.authorizeAsync().then((c)=>a(null,c),a);else return this.authorizeAsync()}async authorizeAsync(){let a=await this.refreshToken();if(!a)throw Error("No result returned");return this.credentials=a.tokens,this.credentials.refresh_token="jwt-placeholder",this.key=this.gtoken.googleTokenOptions?.key,this.email=this.gtoken.googleTokenOptions?.iss,a.tokens}async refreshTokenNoCache(){let a=this.createGToken(),u={access_token:(await a.getToken({forceRefresh:this.isTokenExpiring()})).access_token,token_type:"Bearer",expiry_date:a.expiresAt,id_token:a.idToken};return this.emit("tokens",u),{res:null,tokens:u}}createGToken(){if(!this.gtoken)this.gtoken=new t.GoogleToken({iss:this.email,sub:this.subject,scope:this.scopes||this.defaultScopes,keyFile:this.keyFile,key:this.key,additionalClaims:this.additionalClaims,transporter:this.transporter});return this.gtoken}fromJSON(a){if(!a)throw Error("Must pass in a JSON object containing the service account auth settings.");if(!a.client_email)throw Error("The incoming JSON object does not contain a client_email field");if(!a.private_key)throw Error("The incoming JSON object does not contain a private_key field");this.email=a.client_email,this.key=a.private_key,this.keyId=a.private_key_id,this.projectId=a.project_id,this.quotaProjectId=a.quota_project_id,this.universeDomain=a.universe_domain||this.universeDomain}fromStream(a,c){if(c)this.fromStreamAsync(a).then(()=>c(),c);else return this.fromStreamAsync(a)}fromStreamAsync(a){return new Promise((c,u)=>{if(!a)throw Error("Must pass in a stream containing the service account auth settings.");let f="";a.setEncoding("utf8").on("error",u).on("data",(h)=>f+=h).on("end",()=>{try{let h=JSON.parse(f);this.fromJSON(h),c()}catch(h){u(h)}})})}fromAPIKey(a){if(typeof a!=="string")throw Error("Must provide an API Key string.");this.apiKey=a}async getCredentials(){if(this.key)return{private_key:this.key,client_email:this.email};else if(this.keyFile){let a=this.createGToken(),c=await(0,r.getCredentials)(this.keyFile);return{private_key:c.privateKey,client_email:c.clientEmail}}throw Error("A key or a keyFile must be provided to getCredentials.")}};e.JWT=s}}),Uv=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/refreshclient.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.UserRefreshClient=e.USER_REFRESH_ACCOUNT_TYPE=void 0;var t=Ho(),r=Mr();e.USER_REFRESH_ACCOUNT_TYPE="authorized_user";var n=class o extends t.OAuth2Client{_refreshToken;constructor(i,s,l,a,c){let u=i&&typeof i==="object"?i:{clientId:i,clientSecret:s,refreshToken:l,eagerRefreshThresholdMillis:a,forceRefreshOnFailure:c};super(u);this._refreshToken=u.refreshToken,this.credentials.refresh_token=u.refreshToken}async refreshTokenNoCache(){return super.refreshTokenNoCache(this._refreshToken)}async fetchIdToken(i){let s={...o.RETRY_CONFIG,url:this.endpoints.oauth2TokenUrl,method:"POST",data:new URLSearchParams({client_id:this._clientId,client_secret:this._clientSecret,grant_type:"refresh_token",refresh_token:this._refreshToken,target_audience:i}),responseType:"json"};return r.AuthClient.setMethodName(s,"fetchIdToken"),(await this.transporter.request(s)).data.id_token}fromJSON(i){if(!i)throw Error("Must pass in a JSON object containing the user refresh token");if(i.type!=="authorized_user")throw Error('The incoming JSON object does not have the "authorized_user" type');if(!i.client_id)throw Error("The incoming JSON object does not contain a client_id field");if(!i.client_secret)throw Error("The incoming JSON object does not contain a client_secret field");if(!i.refresh_token)throw Error("The incoming JSON object does not contain a refresh_token field");this._clientId=i.client_id,this._clientSecret=i.client_secret,this._refreshToken=i.refresh_token,this.credentials.refresh_token=i.refresh_token,this.quotaProjectId=i.quota_project_id,this.universeDomain=i.universe_domain||this.universeDomain}fromStream(i,s){if(s)this.fromStreamAsync(i).then(()=>s(),s);else return this.fromStreamAsync(i)}async fromStreamAsync(i){return new Promise((s,l)=>{if(!i)return l(Error("Must pass in a stream containing the user refresh token."));let a="";i.setEncoding("utf8").on("error",l).on("data",(c)=>a+=c).on("end",()=>{try{let c=JSON.parse(a);return this.fromJSON(c),s()}catch(c){return l(c)}})})}static fromJSON(i){let s=new o;return s.fromJSON(i),s}};e.UserRefreshClient=n}}),Fv=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/impersonated.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Impersonated=e.IMPERSONATED_ACCOUNT_TYPE=void 0;var t=Ho(),r=rr(),n=un();e.IMPERSONATED_ACCOUNT_TYPE="impersonated_service_account";var o=class i extends t.OAuth2Client{sourceClient;targetPrincipal;targetScopes;delegates;lifetime;endpoint;constructor(s={}){super(s);if(this.credentials={expiry_date:1,refresh_token:"impersonated-placeholder"},this.sourceClient=s.sourceClient??new t.OAuth2Client,this.targetPrincipal=s.targetPrincipal??"",this.delegates=s.delegates??[],this.targetScopes=s.targetScopes??[],this.lifetime=s.lifetime??3600,!(0,n.originalOrCamelOptions)(s).get("universe_domain"))this.universeDomain=this.sourceClient.universeDomain;else if(this.sourceClient.universeDomain!==this.universeDomain)throw RangeError(`Universe domain ${this.sourceClient.universeDomain} in source credentials does not match ${this.universeDomain} universe domain set for impersonated credentials.`);this.endpoint=s.endpoint??`https://iamcredentials.${this.universeDomain}`}async sign(s){await this.sourceClient.getAccessToken();let l=`projects/-/serviceAccounts/${this.targetPrincipal}`,a=`${this.endpoint}/v1/${l}:signBlob`,c={delegates:this.delegates,payload:Buffer.from(s).toString("base64")};return(await this.sourceClient.request({...i.RETRY_CONFIG,url:a,data:c,method:"POST"})).data}getTargetPrincipal(){return this.targetPrincipal}async refreshToken(){try{await this.sourceClient.getAccessToken();let s="projects/-/serviceAccounts/"+this.targetPrincipal,l=`${this.endpoint}/v1/${s}:generateAccessToken`,a={delegates:this.delegates,scope:this.targetScopes,lifetime:this.lifetime+"s"},c=await this.sourceClient.request({...i.RETRY_CONFIG,url:l,data:a,method:"POST"}),u=c.data;return this.credentials.access_token=u.accessToken,this.credentials.expiry_date=Date.parse(u.expireTime),{tokens:this.credentials,res:c}}catch(s){if(!(s instanceof Error))throw s;let l=0,a="";if(s instanceof r.GaxiosError)l=s?.response?.data?.error?.status,a=s?.response?.data?.error?.message;if(l&&a)throw s.message=`${l}: unable to impersonate: ${a}`,s;else throw s.message=`unable to impersonate: ${s}`,s}}async fetchIdToken(s,l){await this.sourceClient.getAccessToken();let a=`projects/-/serviceAccounts/${this.targetPrincipal}`,c=`${this.endpoint}/v1/${a}:generateIdToken`,u={delegates:this.delegates,audience:s,includeEmail:l?.includeEmail??!0,useEmailAzp:l?.includeEmail??!0};return(await this.sourceClient.request({...i.RETRY_CONFIG,url:c,data:u,method:"POST"})).data.token}};e.Impersonated=o}}),Gv=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/oauth2common.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.OAuthClientAuthHandler=void 0,e.getErrorFromOAuthErrorResponse=i;var t=rr(),r=wl(),n=["PUT","POST","PATCH"],o=class{#e=(0,r.createCrypto)();#t;transporter;constructor(s){if(s&&"clientId"in s)this.#t=s,this.transporter=new t.Gaxios;else this.#t=s?.clientAuthentication,this.transporter=s?.transporter||new t.Gaxios}applyClientAuthenticationOptions(s,l){if(s.headers=t.Gaxios.mergeHeaders(s.headers),this.injectAuthenticatedHeaders(s,l),!l)this.injectAuthenticatedRequestBody(s)}injectAuthenticatedHeaders(s,l){if(l)s.headers=t.Gaxios.mergeHeaders(s.headers,{authorization:`Bearer ${l}`});else if(this.#t?.confidentialClientType==="basic"){s.headers=t.Gaxios.mergeHeaders(s.headers);let a=this.#t.clientId,c=this.#t.clientSecret||"",u=this.#e.encodeBase64StringUtf8(`${a}:${c}`);t.Gaxios.mergeHeaders(s.headers,{authorization:`Basic ${u}`})}}injectAuthenticatedRequestBody(s){if(this.#t?.confidentialClientType==="request-body"){let l=(s.method||"GET").toUpperCase();if(!n.includes(l))throw Error(`${l} HTTP method does not support ${this.#t.confidentialClientType} client authentication`);let c=new Headers(s.headers).get("content-type");if(c?.startsWith("application/x-www-form-urlencoded")||s.data instanceof URLSearchParams){let u=new URLSearchParams(s.data??"");u.append("client_id",this.#t.clientId),u.append("client_secret",this.#t.clientSecret||""),s.data=u}else if(c?.startsWith("application/json"))s.data=s.data||{},Object.assign(s.data,{client_id:this.#t.clientId,client_secret:this.#t.clientSecret||""});else throw Error(`${c} content-types are not supported with ${this.#t.confidentialClientType} client authentication`)}}static get RETRY_CONFIG(){return{retry:!0,retryConfig:{httpMethodsToRetry:["GET","PUT","POST","HEAD","OPTIONS","DELETE"]}}}};e.OAuthClientAuthHandler=o;function i(s,l){let{error:a,error_description:c,error_uri:u}=s,f=`Error code ${a}`;if(typeof c<"u")f+=`: ${c}`;if(typeof u<"u")f+=` - ${u}`;let h=Error(f);if(l){let g=Object.keys(l);if(l.stack)g.push("stack");g.forEach((p)=>{if(p!=="message")Object.defineProperty(h,p,{value:l[p],writable:!1,enumerable:!0})})}return h}}}),$u=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/stscredentials.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.StsCredentials=void 0;var t=rr(),r=Mr(),n=Gv(),o=un(),i=class s extends n.OAuthClientAuthHandler{#e;constructor(l={tokenExchangeEndpoint:""},a){if(typeof l!=="object"||l instanceof URL)l={tokenExchangeEndpoint:l,clientAuthentication:a};super(l);this.#e=l.tokenExchangeEndpoint}async exchangeToken(l,a,c){let u={grant_type:l.grantType,resource:l.resource,audience:l.audience,scope:l.scope?.join(" "),requested_token_type:l.requestedTokenType,subject_token:l.subjectToken,subject_token_type:l.subjectTokenType,actor_token:l.actingParty?.actorToken,actor_token_type:l.actingParty?.actorTokenType,options:c&&JSON.stringify(c)},f={...s.RETRY_CONFIG,url:this.#e.toString(),method:"POST",headers:a,data:new URLSearchParams((0,o.removeUndefinedValuesInObject)(u)),responseType:"json"};r.AuthClient.setMethodName(f,"exchangeToken"),this.applyClientAuthenticationOptions(f);try{let h=await this.transporter.request(f),g=h.data;return g.res=h,g}catch(h){if(h instanceof t.GaxiosError&&h.response)throw(0,n.getErrorFromOAuthErrorResponse)(h.response.data,h);throw h}}};e.StsCredentials=i}}),zo=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/baseexternalclient.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.BaseExternalAccountClient=e.CLOUD_RESOURCE_MANAGER=e.EXTERNAL_ACCOUNT_TYPE=e.EXPIRATION_TIME_OFFSET=void 0;var t=rr(),r=we("stream"),n=Mr(),o=$u(),i=un(),s=Rv(),l="urn:ietf:params:oauth:grant-type:token-exchange",a="urn:ietf:params:oauth:token-type:access_token",c="https://www.googleapis.com/auth/cloud-platform",u=3600;e.EXPIRATION_TIME_OFFSET=300000,e.EXTERNAL_ACCOUNT_TYPE="external_account",e.CLOUD_RESOURCE_MANAGER="https://cloudresourcemanager.googleapis.com/v1/projects/";var f="//iam\\.googleapis\\.com/locations/[^/]+/workforcePools/[^/]+/providers/.+",h="https://sts.{universeDomain}/v1/token",g=class p extends n.AuthClient{scopes;projectNumber;audience;subjectTokenType;stsCredential;clientAuth;credentialSourceType;cachedAccessToken;serviceAccountImpersonationUrl;serviceAccountImpersonationLifetime;workforcePoolUserProject;configLifetimeRequested;tokenUrl;cloudResourceManagerURL;supplierContext;#e=null;constructor(_){super(_);let y=(0,i.originalOrCamelOptions)(_),S=y.get("type");if(S&&S!==e.EXTERNAL_ACCOUNT_TYPE)throw Error(`Expected "${e.EXTERNAL_ACCOUNT_TYPE}" type but received "${_.type}"`);let E=y.get("client_id"),b=y.get("client_secret");this.tokenUrl=y.get("token_url")??h.replace("{universeDomain}",this.universeDomain);let R=y.get("subject_token_type"),w=y.get("workforce_pool_user_project"),T=y.get("service_account_impersonation_url"),C=y.get("service_account_impersonation"),A=(0,i.originalOrCamelOptions)(C).get("token_lifetime_seconds");if(this.cloudResourceManagerURL=new URL(y.get("cloud_resource_manager_url")||`https://cloudresourcemanager.${this.universeDomain}/v1/projects/`),E)this.clientAuth={confidentialClientType:"basic",clientId:E,clientSecret:b};this.stsCredential=new o.StsCredentials({tokenExchangeEndpoint:this.tokenUrl,clientAuthentication:this.clientAuth}),this.scopes=y.get("scopes")||[c],this.cachedAccessToken=null,this.audience=y.get("audience"),this.subjectTokenType=R,this.workforcePoolUserProject=w;let P=new RegExp(f);if(this.workforcePoolUserProject&&!this.audience.match(P))throw Error("workforcePoolUserProject should not be set for non-workforce pool credentials.");if(this.serviceAccountImpersonationUrl=T,this.serviceAccountImpersonationLifetime=A,this.serviceAccountImpersonationLifetime)this.configLifetimeRequested=!0;else this.configLifetimeRequested=!1,this.serviceAccountImpersonationLifetime=u;this.projectNumber=this.getProjectNumber(this.audience),this.supplierContext={audience:this.audience,subjectTokenType:this.subjectTokenType,transporter:this.transporter}}getServiceAccountEmail(){if(this.serviceAccountImpersonationUrl){if(this.serviceAccountImpersonationUrl.length>256)throw RangeError(`URL is too long: ${this.serviceAccountImpersonationUrl}`);return/serviceAccounts\/(?<email>[^:]+):generateAccessToken$/.exec(this.serviceAccountImpersonationUrl)?.groups?.email||null}return null}setCredentials(_){super.setCredentials(_),this.cachedAccessToken=_}async getAccessToken(){if(!this.cachedAccessToken||this.isExpired(this.cachedAccessToken))await this.refreshAccessTokenAsync();return{token:this.cachedAccessToken.access_token,res:this.cachedAccessToken.res}}async getRequestHeaders(){let _=await this.getAccessToken(),y=new Headers({authorization:`Bearer ${_.token}`});return this.addSharedMetadataHeaders(y)}request(_,y){if(y)this.requestAsync(_).then((S)=>y(null,S),(S)=>y(S,S.response));else return this.requestAsync(_)}async getProjectId(){let _=this.projectNumber||this.workforcePoolUserProject;if(this.projectId)return this.projectId;else if(_){let y=await this.getRequestHeaders(),S={...p.RETRY_CONFIG,headers:y,url:`${this.cloudResourceManagerURL.toString()}${_}`,responseType:"json"};n.AuthClient.setMethodName(S,"getProjectId");let E=await this.transporter.request(S);return this.projectId=E.data.projectId,this.projectId}return null}async requestAsync(_,y=!1){let S;try{let E=await this.getRequestHeaders();_.headers=t.Gaxios.mergeHeaders(_.headers),this.addUserProjectAndAuthHeaders(_.headers,E),S=await this.transporter.request(_)}catch(E){let b=E.response;if(b){let R=b.status,w=b.config.data instanceof r.Readable;if(!y&&(R===401||R===403)&&!w&&this.forceRefreshOnFailure)return await this.refreshAccessTokenAsync(),await this.requestAsync(_,!0)}throw E}return S}async refreshAccessTokenAsync(){this.#e=this.#e||this.#t();try{return await this.#e}finally{this.#e=null}}async#t(){let _=await this.retrieveSubjectToken(),y={grantType:l,audience:this.audience,requestedTokenType:a,subjectToken:_,subjectTokenType:this.subjectTokenType,scope:this.serviceAccountImpersonationUrl?[c]:this.getScopesArray()},S=!this.clientAuth&&this.workforcePoolUserProject?{userProject:this.workforcePoolUserProject}:void 0,E=new Headers({"x-goog-api-client":this.getMetricsHeaderValue()}),b=await this.stsCredential.exchangeToken(y,E,S);if(this.serviceAccountImpersonationUrl)this.cachedAccessToken=await this.getImpersonatedAccessToken(b.access_token);else if(b.expires_in)this.cachedAccessToken={access_token:b.access_token,expiry_date:new Date().getTime()+b.expires_in*1000,res:b.res};else this.cachedAccessToken={access_token:b.access_token,res:b.res};return this.credentials={},Object.assign(this.credentials,this.cachedAccessToken),delete this.credentials.res,this.emit("tokens",{refresh_token:null,expiry_date:this.cachedAccessToken.expiry_date,access_token:this.cachedAccessToken.access_token,token_type:"Bearer",id_token:null}),this.cachedAccessToken}getProjectNumber(_){let y=_.match(/\/projects\/([^/]+)/);if(!y)return null;return y[1]}async getImpersonatedAccessToken(_){let y={...p.RETRY_CONFIG,url:this.serviceAccountImpersonationUrl,method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${_}`},data:{scope:this.getScopesArray(),lifetime:this.serviceAccountImpersonationLifetime+"s"},responseType:"json"};n.AuthClient.setMethodName(y,"getImpersonatedAccessToken");let S=await this.transporter.request(y),E=S.data;return{access_token:E.accessToken,expiry_date:new Date(E.expireTime).getTime(),res:S}}isExpired(_){let y=new Date().getTime();return _.expiry_date?y>=_.expiry_date-this.eagerRefreshThresholdMillis:!1}getScopesArray(){if(typeof this.scopes==="string")return[this.scopes];return this.scopes||[c]}getMetricsHeaderValue(){let _=process.version.replace(/^v/,""),y=this.serviceAccountImpersonationUrl!==void 0,S=this.credentialSourceType?this.credentialSourceType:"unknown";return`gl-node/${_} auth/${s.pkg.version} google-byoid-sdk source/${S} sa-impersonation/${y} config-lifetime/${this.configLifetimeRequested}`}getTokenUrl(){return this.tokenUrl}};e.BaseExternalAccountClient=g}}),yR=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/filesubjecttokensupplier.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.FileSubjectTokenSupplier=void 0;var t=we("util"),r=we("fs"),n=(0,t.promisify)(r.readFile??(()=>{})),o=(0,t.promisify)(r.realpath??(()=>{})),i=(0,t.promisify)(r.lstat??(()=>{})),s=class{filePath;formatType;subjectTokenFieldName;constructor(l){this.filePath=l.filePath,this.formatType=l.formatType,this.subjectTokenFieldName=l.subjectTokenFieldName}async getSubjectToken(){let l=this.filePath;try{if(l=await o(l),!(await i(l)).isFile())throw Error()}catch(u){if(u instanceof Error)u.message=`The file at ${l} does not exist, or it is not a file. ${u.message}`;throw u}let a,c=await n(l,{encoding:"utf8"});if(this.formatType==="text")a=c;else if(this.formatType==="json"&&this.subjectTokenFieldName)a=JSON.parse(c)[this.subjectTokenFieldName];if(!a)throw Error("Unable to parse the subject_token from the credential_source file");return a}};e.FileSubjectTokenSupplier=s}}),SR=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/urlsubjecttokensupplier.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.UrlSubjectTokenSupplier=void 0;var t=Mr(),r=class{url;headers;formatType;subjectTokenFieldName;additionalGaxiosOptions;constructor(n){this.url=n.url,this.formatType=n.formatType,this.subjectTokenFieldName=n.subjectTokenFieldName,this.headers=n.headers,this.additionalGaxiosOptions=n.additionalGaxiosOptions}async getSubjectToken(n){let o={...this.additionalGaxiosOptions,url:this.url,method:"GET",headers:this.headers,responseType:this.formatType};t.AuthClient.setMethodName(o,"getSubjectToken");let i;if(this.formatType==="text")i=(await n.transporter.request(o)).data;else if(this.formatType==="json"&&this.subjectTokenFieldName)i=(await n.transporter.request(o)).data[this.subjectTokenFieldName];if(!i)throw Error("Unable to parse the subject_token from the credential_source URL");return i}};e.UrlSubjectTokenSupplier=r}}),ER=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/certificatesubjecttokensupplier.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CertificateSubjectTokenSupplier=e.InvalidConfigurationError=e.CertificateSourceUnavailableError=e.CERTIFICATE_CONFIGURATION_ENV_VARIABLE=void 0;var t=un(),r=we("fs"),n=we("crypto"),o=we("https");e.CERTIFICATE_CONFIGURATION_ENV_VARIABLE="GOOGLE_API_CERTIFICATE_CONFIG";var i=class extends Error{constructor(a){super(a);this.name="CertificateSourceUnavailableError"}};e.CertificateSourceUnavailableError=i;var s=class extends Error{constructor(a){super(a);this.name="InvalidConfigurationError"}};e.InvalidConfigurationError=s;var l=class{certificateConfigPath;trustChainPath;cert;key;constructor(a){if(!a.useDefaultCertificateConfig&&!a.certificateConfigLocation)throw new s("Either `useDefaultCertificateConfig` must be true or a `certificateConfigLocation` must be provided.");if(a.useDefaultCertificateConfig&&a.certificateConfigLocation)throw new s("Both `useDefaultCertificateConfig` and `certificateConfigLocation` cannot be provided.");this.trustChainPath=a.trustChainPath,this.certificateConfigPath=a.certificateConfigLocation??""}async createMtlsHttpsAgent(){if(!this.key||!this.cert)throw new s("Cannot create mTLS Agent with missing certificate or key");return new o.Agent({key:this.key,cert:this.cert})}async getSubjectToken(){this.certificateConfigPath=await this.#e();let{certPath:a,keyPath:c}=await this.#t();return{cert:this.cert,key:this.key}=await this.#r(a,c),await this.#n(this.cert)}async#e(){let a=this.certificateConfigPath;if(a){if(await(0,t.isValidFile)(a))return a;throw new i(`Provided certificate config path is invalid: ${a}`)}let c=process.env[e.CERTIFICATE_CONFIGURATION_ENV_VARIABLE];if(c){if(await(0,t.isValidFile)(c))return c;throw new i(`Path from environment variable "${e.CERTIFICATE_CONFIGURATION_ENV_VARIABLE}" is invalid: ${c}`)}let u=(0,t.getWellKnownCertificateConfigFileLocation)();if(await(0,t.isValidFile)(u))return u;throw new i(`Could not find certificate configuration file. Searched override path, the "${e.CERTIFICATE_CONFIGURATION_ENV_VARIABLE}" env var, and the gcloud path (${u}).`)}async#t(){let a=this.certificateConfigPath,c;try{c=await r.promises.readFile(a,"utf8")}catch(u){throw new i(`Failed to read certificate config file at: ${a}`)}try{let u=JSON.parse(c),f=u?.cert_configs?.workload?.cert_path,h=u?.cert_configs?.workload?.key_path;if(!f||!h)throw new s(`Certificate config file (${a}) is missing required "cert_path" or "key_path" in the workload config.`);return{certPath:f,keyPath:h}}catch(u){if(u instanceof s)throw u;throw new s(`Failed to parse certificate config from ${a}: ${u.message}`)}}async#r(a,c){let u,f;try{u=await r.promises.readFile(a),new n.X509Certificate(u)}catch(h){let g=h instanceof Error?h.message:String(h);throw new i(`Failed to read certificate file at ${a}: ${g}`)}try{f=await r.promises.readFile(c),(0,n.createPrivateKey)(f)}catch(h){let g=h instanceof Error?h.message:String(h);throw new i(`Failed to read private key file at ${c}: ${g}`)}return{cert:u,key:f}}async#n(a){let c=new n.X509Certificate(a);if(!this.trustChainPath)return JSON.stringify([c.raw.toString("base64")]);try{let h=((await r.promises.readFile(this.trustChainPath,"utf8")).match(/-----BEGIN CERTIFICATE-----[^-]+-----END CERTIFICATE-----/g)??[]).map((_,y)=>{try{return new n.X509Certificate(_)}catch(S){let E=S instanceof Error?S.message:String(S);throw new s(`Failed to parse certificate at index ${y} in trust chain file ${this.trustChainPath}: ${E}`)}}),g=h.findIndex((_)=>c.raw.equals(_.raw)),p;if(g===-1)p=[c,...h];else if(g===0)p=h;else throw new s(`Leaf certificate exists in the trust chain but is not the first entry (found at index ${g}).`);return JSON.stringify(p.map((_)=>_.raw.toString("base64")))}catch(u){if(u instanceof s)throw u;let f=u instanceof Error?u.message:String(u);throw new i(`Failed to process certificate chain from ${this.trustChainPath}: ${f}`)}}};e.CertificateSubjectTokenSupplier=l}}),Bv=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/identitypoolclient.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.IdentityPoolClient=void 0;var t=zo(),r=un(),n=yR(),o=SR(),i=ER(),s=$u(),l=rr(),a=class c extends t.BaseExternalAccountClient{subjectTokenSupplier;constructor(u){super(u);let f=(0,r.originalOrCamelOptions)(u),h=f.get("credential_source"),g=f.get("subject_token_supplier");if(!h&&!g)throw Error("A credential source or subject token supplier must be specified.");if(h&&g)throw Error("Only one of credential source or subject token supplier can be specified.");if(g)this.subjectTokenSupplier=g,this.credentialSourceType="programmatic";else{let p=(0,r.originalOrCamelOptions)(h),_=(0,r.originalOrCamelOptions)(p.get("format")),y=_.get("type")||"text",S=_.get("subject_token_field_name");if(y!=="json"&&y!=="text")throw Error(`Invalid credential_source format "${y}"`);if(y==="json"&&!S)throw Error("Missing subject_token_field_name for JSON credential_source format");let E=p.get("file"),b=p.get("url"),R=p.get("certificate"),w=p.get("headers");if(E&&b||b&&R||E&&R)throw Error('No valid Identity Pool "credential_source" provided, must be either file, url, or certificate.');else if(E)this.credentialSourceType="file",this.subjectTokenSupplier=new n.FileSubjectTokenSupplier({filePath:E,formatType:y,subjectTokenFieldName:S});else if(b)this.credentialSourceType="url",this.subjectTokenSupplier=new o.UrlSubjectTokenSupplier({url:b,formatType:y,subjectTokenFieldName:S,headers:w,additionalGaxiosOptions:c.RETRY_CONFIG});else if(R){this.credentialSourceType="certificate";let T=new i.CertificateSubjectTokenSupplier({useDefaultCertificateConfig:R.use_default_certificate_config,certificateConfigLocation:R.certificate_config_location,trustChainPath:R.trust_chain_path});this.subjectTokenSupplier=T}else throw Error('No valid Identity Pool "credential_source" provided, must be either file, url, or certificate.')}}async retrieveSubjectToken(){let u=await this.subjectTokenSupplier.getSubjectToken(this.supplierContext);if(this.subjectTokenSupplier instanceof i.CertificateSubjectTokenSupplier){let f=await this.subjectTokenSupplier.createMtlsHttpsAgent();this.stsCredential=new s.StsCredentials({tokenExchangeEndpoint:this.getTokenUrl(),clientAuthentication:this.clientAuth,transporter:new l.Gaxios({agent:f})}),this.transporter=new l.Gaxios({...this.transporter.defaults||{},agent:f})}return u}};e.IdentityPoolClient=a}}),Hv=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/awsrequestsigner.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.AwsRequestSigner=void 0;var t=rr(),r=wl(),n="AWS4-HMAC-SHA256",o="aws4_request",i=class{getCredentials;region;crypto;constructor(c,u){this.getCredentials=c,this.region=u,this.crypto=(0,r.createCrypto)()}async getRequestOptions(c){if(!c.url)throw RangeError('"url" is required in "amzOptions"');let u=typeof c.data==="object"?JSON.stringify(c.data):c.data,f=c.url,h=c.method||"GET",g=c.body||u,p=c.headers,_=await this.getCredentials(),y=new URL(f);if(typeof g!=="string"&&g!==void 0)throw TypeError(`'requestPayload' is expected to be a string if provided. Got: ${g}`);let S=await a({crypto:this.crypto,host:y.host,canonicalUri:y.pathname,canonicalQuerystring:y.search.slice(1),method:h,region:this.region,securityCredentials:_,requestPayload:g,additionalAmzHeaders:p}),E=t.Gaxios.mergeHeaders(S.amzDate?{"x-amz-date":S.amzDate}:{},{authorization:S.authorizationHeader,host:y.host},p||{});if(_.token)t.Gaxios.mergeHeaders(E,{"x-amz-security-token":_.token});let b={url:f,method:h,headers:E};if(g!==void 0)b.body=g;return b}};e.AwsRequestSigner=i;async function s(c,u,f){return await c.signWithHmacSha256(u,f)}async function l(c,u,f,h,g){let p=await s(c,`AWS4${u}`,f),_=await s(c,p,h),y=await s(c,_,g);return await s(c,y,"aws4_request")}async function a(c){let u=t.Gaxios.mergeHeaders(c.additionalAmzHeaders),f=c.requestPayload||"",h=c.host.split(".")[0],g=new Date,p=g.toISOString().replace(/[-:]/g,"").replace(/\.[0-9]+/,""),_=g.toISOString().replace(/[-]/g,"").replace(/T.*/,"");if(c.securityCredentials.token)u.set("x-amz-security-token",c.securityCredentials.token);let y=t.Gaxios.mergeHeaders({host:c.host},u.has("date")?{}:{"x-amz-date":p},u),S="",E=[...y.keys()].sort();E.forEach((N)=>{S+=`${N}:${y.get(N)}
40
+ `});let b=E.join(";"),R=await c.crypto.sha256DigestHex(f),w=`${c.method.toUpperCase()}
41
+ ${c.canonicalUri}
42
+ ${c.canonicalQuerystring}
43
+ ${S}
44
+ ${b}
45
+ ${R}`,T=`${_}/${c.region}/${h}/${o}`,C=`${n}
46
+ ${p}
47
+ ${T}
48
+ `+await c.crypto.sha256DigestHex(w),A=await l(c.crypto,c.securityCredentials.secretAccessKey,_,c.region,h),P=await s(c.crypto,A,C),D=`${n} Credential=${c.securityCredentials.accessKeyId}/${T}, SignedHeaders=${b}, Signature=${(0,r.fromArrayBufferToHex)(P)}`;return{amzDate:u.has("date")?void 0:p,authorizationHeader:D,canonicalQuerystring:c.canonicalQuerystring}}}}),bR=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/defaultawssecuritycredentialssupplier.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DefaultAwsSecurityCredentialsSupplier=void 0;var t=Mr(),r=class{regionUrl;securityCredentialsUrl;imdsV2SessionTokenUrl;additionalGaxiosOptions;constructor(n){this.regionUrl=n.regionUrl,this.securityCredentialsUrl=n.securityCredentialsUrl,this.imdsV2SessionTokenUrl=n.imdsV2SessionTokenUrl,this.additionalGaxiosOptions=n.additionalGaxiosOptions}async getAwsRegion(n){if(this.#n)return this.#n;let o=new Headers;if(!this.#n&&this.imdsV2SessionTokenUrl)o.set("x-aws-ec2-metadata-token",await this.#e(n.transporter));if(!this.regionUrl)throw RangeError('Unable to determine AWS region due to missing "options.credential_source.region_url"');let i={...this.additionalGaxiosOptions,url:this.regionUrl,method:"GET",responseType:"text",headers:o};t.AuthClient.setMethodName(i,"getAwsRegion");let s=await n.transporter.request(i);return s.data.substr(0,s.data.length-1)}async getAwsSecurityCredentials(n){if(this.#o)return this.#o;let o=new Headers;if(this.imdsV2SessionTokenUrl)o.set("x-aws-ec2-metadata-token",await this.#e(n.transporter));let i=await this.#t(o,n.transporter),s=await this.#r(i,o,n.transporter);return{accessKeyId:s.AccessKeyId,secretAccessKey:s.SecretAccessKey,token:s.Token}}async#e(n){let o={...this.additionalGaxiosOptions,url:this.imdsV2SessionTokenUrl,method:"PUT",responseType:"text",headers:{"x-aws-ec2-metadata-token-ttl-seconds":"300"}};return t.AuthClient.setMethodName(o,"#getImdsV2SessionToken"),(await n.request(o)).data}async#t(n,o){if(!this.securityCredentialsUrl)throw Error('Unable to determine AWS role name due to missing "options.credential_source.url"');let i={...this.additionalGaxiosOptions,url:this.securityCredentialsUrl,method:"GET",responseType:"text",headers:n};return t.AuthClient.setMethodName(i,"#getAwsRoleName"),(await o.request(i)).data}async#r(n,o,i){let s={...this.additionalGaxiosOptions,url:`${this.securityCredentialsUrl}/${n}`,headers:o,responseType:"json"};return t.AuthClient.setMethodName(s,"#retrieveAwsSecurityCredentials"),(await i.request(s)).data}get#n(){return process.env.AWS_REGION||process.env.AWS_DEFAULT_REGION||null}get#o(){if(process.env.AWS_ACCESS_KEY_ID&&process.env.AWS_SECRET_ACCESS_KEY)return{accessKeyId:process.env.AWS_ACCESS_KEY_ID,secretAccessKey:process.env.AWS_SECRET_ACCESS_KEY,token:process.env.AWS_SESSION_TOKEN};return null}};e.DefaultAwsSecurityCredentialsSupplier=r}}),zv=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/awsclient.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.AwsClient=void 0;var t=Hv(),r=zo(),n=bR(),o=un(),i=rr(),s=class l extends r.BaseExternalAccountClient{environmentId;awsSecurityCredentialsSupplier;regionalCredVerificationUrl;awsRequestSigner;region;static#e="https://sts.{region}.amazonaws.com?Action=GetCallerIdentity&Version=2011-06-15";static AWS_EC2_METADATA_IPV4_ADDRESS="169.254.169.254";static AWS_EC2_METADATA_IPV6_ADDRESS="fd00:ec2::254";constructor(a){super(a);let c=(0,o.originalOrCamelOptions)(a),u=c.get("credential_source"),f=c.get("aws_security_credentials_supplier");if(!u&&!f)throw Error("A credential source or AWS security credentials supplier must be specified.");if(u&&f)throw Error("Only one of credential source or AWS security credentials supplier can be specified.");if(f)this.awsSecurityCredentialsSupplier=f,this.regionalCredVerificationUrl=l.#e,this.credentialSourceType="programmatic";else{let h=(0,o.originalOrCamelOptions)(u);this.environmentId=h.get("environment_id");let g=h.get("region_url"),p=h.get("url"),_=h.get("imdsv2_session_token_url");this.awsSecurityCredentialsSupplier=new n.DefaultAwsSecurityCredentialsSupplier({regionUrl:g,securityCredentialsUrl:p,imdsV2SessionTokenUrl:_}),this.regionalCredVerificationUrl=h.get("regional_cred_verification_url"),this.credentialSourceType="aws",this.validateEnvironmentId()}this.awsRequestSigner=null,this.region=""}validateEnvironmentId(){let a=this.environmentId?.match(/^(aws)(\d+)$/);if(!a||!this.regionalCredVerificationUrl)throw Error('No valid AWS "credential_source" provided');else if(parseInt(a[2],10)!==1)throw Error(`aws version "${a[2]}" is not supported in the current build.`)}async retrieveSubjectToken(){if(!this.awsRequestSigner)this.region=await this.awsSecurityCredentialsSupplier.getAwsRegion(this.supplierContext),this.awsRequestSigner=new t.AwsRequestSigner(async()=>this.awsSecurityCredentialsSupplier.getAwsSecurityCredentials(this.supplierContext),this.region);let a=await this.awsRequestSigner.getRequestOptions({...l.RETRY_CONFIG,url:this.regionalCredVerificationUrl.replace("{region}",this.region),method:"POST"}),c=[];return i.Gaxios.mergeHeaders({"x-goog-cloud-target-resource":this.audience},a.headers).forEach((f,h)=>c.push({key:h,value:f})),encodeURIComponent(JSON.stringify({url:a.url,method:a.method,headers:c}))}};e.AwsClient=s}}),Vv=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/executable-response.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.InvalidSubjectTokenError=e.InvalidMessageFieldError=e.InvalidCodeFieldError=e.InvalidTokenTypeFieldError=e.InvalidExpirationTimeFieldError=e.InvalidSuccessFieldError=e.InvalidVersionFieldError=e.ExecutableResponseError=e.ExecutableResponse=void 0;var t="urn:ietf:params:oauth:token-type:saml2",r="urn:ietf:params:oauth:token-type:id_token",n="urn:ietf:params:oauth:token-type:jwt",o=class{version;success;expirationTime;tokenType;errorCode;errorMessage;subjectToken;constructor(g){if(!g.version)throw new s("Executable response must contain a 'version' field.");if(g.success===void 0)throw new l("Executable response must contain a 'success' field.");if(this.version=g.version,this.success=g.success,this.success){if(this.expirationTime=g.expiration_time,this.tokenType=g.token_type,this.tokenType!==t&&this.tokenType!==r&&this.tokenType!==n)throw new c(`Executable response must contain a 'token_type' field when successful and it must be one of ${r}, ${n}, or ${t}.`);if(this.tokenType===t){if(!g.saml_response)throw new h(`Executable response must contain a 'saml_response' field when token_type=${t}.`);this.subjectToken=g.saml_response}else{if(!g.id_token)throw new h(`Executable response must contain a 'id_token' field when token_type=${r} or ${n}.`);this.subjectToken=g.id_token}}else{if(!g.code)throw new u("Executable response must contain a 'code' field when unsuccessful.");if(!g.message)throw new f("Executable response must contain a 'message' field when unsuccessful.");this.errorCode=g.code,this.errorMessage=g.message}}isValid(){return!this.isExpired()&&this.success}isExpired(){return this.expirationTime!==void 0&&this.expirationTime<Math.round(Date.now()/1000)}};e.ExecutableResponse=o;var i=class extends Error{constructor(g){super(g);Object.setPrototypeOf(this,new.target.prototype)}};e.ExecutableResponseError=i;var s=class extends i{};e.InvalidVersionFieldError=s;var l=class extends i{};e.InvalidSuccessFieldError=l;var a=class extends i{};e.InvalidExpirationTimeFieldError=a;var c=class extends i{};e.InvalidTokenTypeFieldError=c;var u=class extends i{};e.InvalidCodeFieldError=u;var f=class extends i{};e.InvalidMessageFieldError=f;var h=class extends i{};e.InvalidSubjectTokenError=h}}),mp=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/pluggable-auth-handler.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PluggableAuthHandler=e.ExecutableError=void 0;var t=Vv(),r=we("child_process"),n=we("fs"),o=class extends Error{code;constructor(s,l){super(`The executable failed with exit code: ${l} and error message: ${s}.`);this.code=l,Object.setPrototypeOf(this,new.target.prototype)}};e.ExecutableError=o;var i=class s{commandComponents;timeoutMillis;outputFile;constructor(l){if(!l.command)throw Error("No command provided.");if(this.commandComponents=s.parseCommand(l.command),this.timeoutMillis=l.timeoutMillis,!this.timeoutMillis)throw Error("No timeoutMillis provided.");this.outputFile=l.outputFile}retrieveResponseFromExecutable(l){return new Promise((a,c)=>{let u=r.spawn(this.commandComponents[0],this.commandComponents.slice(1),{env:{...process.env,...Object.fromEntries(l)}}),f="";u.stdout.on("data",(g)=>{f+=g}),u.stderr.on("data",(g)=>{f+=g});let h=setTimeout(()=>(u.removeAllListeners(),u.kill(),c(Error("The executable failed to finish within the timeout specified."))),this.timeoutMillis);u.on("close",(g)=>{if(clearTimeout(h),g===0)try{let p=JSON.parse(f),_=new t.ExecutableResponse(p);return a(_)}catch(p){if(p instanceof t.ExecutableResponseError)return c(p);return c(new t.ExecutableResponseError(`The executable returned an invalid response: ${f}`))}else return c(new o(f,g.toString()))})})}async retrieveCachedResponse(){if(!this.outputFile||this.outputFile.length===0)return;let l;try{l=await n.promises.realpath(this.outputFile)}catch{return}if(!(await n.promises.lstat(l)).isFile())return;let a=await n.promises.readFile(l,{encoding:"utf8"});if(a==="")return;try{let c=JSON.parse(a);if(new t.ExecutableResponse(c).isValid())return new t.ExecutableResponse(c);return}catch(c){if(c instanceof t.ExecutableResponseError)throw c;throw new t.ExecutableResponseError(`The output file contained an invalid response: ${a}`)}}static parseCommand(l){let a=l.match(/(?:[^\s"]+|"[^"]*")+/g);if(!a)throw Error(`Provided command: "${l}" could not be parsed.`);for(let c=0;c<a.length;c++)if(a[c][0]==='"'&&a[c].slice(-1)==='"')a[c]=a[c].slice(1,-1);return a}};e.PluggableAuthHandler=i}}),jv=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/pluggable-auth-client.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PluggableAuthClient=e.ExecutableError=void 0;var t=zo(),r=Vv(),n=mp(),o=mp();Object.defineProperty(e,"ExecutableError",{enumerable:!0,get:function(){return o.ExecutableError}});var i=30000,s=5000,l=120000,a="GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES",c=1,u=class extends t.BaseExternalAccountClient{command;timeoutMillis;outputFile;handler;constructor(f){super(f);if(!f.credential_source.executable)throw Error('No valid Pluggable Auth "credential_source" provided.');if(this.command=f.credential_source.executable.command,!this.command)throw Error('No valid Pluggable Auth "credential_source" provided.');if(f.credential_source.executable.timeout_millis===void 0)this.timeoutMillis=i;else if(this.timeoutMillis=f.credential_source.executable.timeout_millis,this.timeoutMillis<s||this.timeoutMillis>l)throw Error(`Timeout must be between ${s} and ${l} milliseconds.`);this.outputFile=f.credential_source.executable.output_file,this.handler=new n.PluggableAuthHandler({command:this.command,timeoutMillis:this.timeoutMillis,outputFile:this.outputFile}),this.credentialSourceType="executable"}async retrieveSubjectToken(){if(process.env[a]!=="1")throw Error("Pluggable Auth executables need to be explicitly allowed to run by setting the GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES environment Variable to 1.");let f=void 0;if(this.outputFile)f=await this.handler.retrieveCachedResponse();if(!f){let h=new Map;if(h.set("GOOGLE_EXTERNAL_ACCOUNT_AUDIENCE",this.audience),h.set("GOOGLE_EXTERNAL_ACCOUNT_TOKEN_TYPE",this.subjectTokenType),h.set("GOOGLE_EXTERNAL_ACCOUNT_INTERACTIVE","0"),this.outputFile)h.set("GOOGLE_EXTERNAL_ACCOUNT_OUTPUT_FILE",this.outputFile);let g=this.getServiceAccountEmail();if(g)h.set("GOOGLE_EXTERNAL_ACCOUNT_IMPERSONATED_EMAIL",g);f=await this.handler.retrieveResponseFromExecutable(h)}if(f.version>c)throw Error(`Version of executable is not currently supported, maximum supported version is ${c}.`);if(!f.success)throw new n.ExecutableError(f.errorMessage,f.errorCode);if(this.outputFile){if(!f.expirationTime)throw new r.InvalidExpirationTimeFieldError("The executable response must contain the `expiration_time` field for successful responses when an output_file has been specified in the configuration.")}if(f.isExpired())throw Error("Executable response is expired.");return f.subjectToken}};e.PluggableAuthClient=u}}),Wv=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/externalclient.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ExternalAccountClient=void 0;var t=zo(),r=Bv(),n=zv(),o=jv(),i=class{constructor(){throw Error("ExternalAccountClients should be initialized via: ExternalAccountClient.fromJSON(), directly via explicit constructors, eg. new AwsClient(options), new IdentityPoolClient(options), newPluggableAuthClientOptions, or via new GoogleAuth(options).getClient()")}static fromJSON(s){if(s&&s.type===t.EXTERNAL_ACCOUNT_TYPE)if(s.credential_source?.environment_id)return new n.AwsClient(s);else if(s.credential_source?.executable)return new o.PluggableAuthClient(s);else return new r.IdentityPoolClient(s);else return null}};e.ExternalAccountClient=i}}),Jv=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/externalAccountAuthorizedUserClient.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ExternalAccountAuthorizedUserClient=e.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE=void 0;var t=Mr(),r=Gv(),n=rr(),o=we("stream"),i=zo();e.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE="external_account_authorized_user";var s="https://sts.{universeDomain}/v1/oauthtoken",l=class c extends r.OAuthClientAuthHandler{#e;constructor(u){super(u);this.#e=u.tokenRefreshEndpoint}async refreshToken(u,f){let h={...c.RETRY_CONFIG,url:this.#e,method:"POST",headers:f,data:new URLSearchParams({grant_type:"refresh_token",refresh_token:u}),responseType:"json"};t.AuthClient.setMethodName(h,"refreshToken"),this.applyClientAuthenticationOptions(h);try{let g=await this.transporter.request(h),p=g.data;return p.res=g,p}catch(g){if(g instanceof n.GaxiosError&&g.response)throw(0,r.getErrorFromOAuthErrorResponse)(g.response.data,g);throw g}}},a=class extends t.AuthClient{cachedAccessToken;externalAccountAuthorizedUserHandler;refreshToken;constructor(c){super(c);if(c.universe_domain)this.universeDomain=c.universe_domain;this.refreshToken=c.refresh_token;let u={confidentialClientType:"basic",clientId:c.client_id,clientSecret:c.client_secret};if(this.externalAccountAuthorizedUserHandler=new l({tokenRefreshEndpoint:c.token_url??s.replace("{universeDomain}",this.universeDomain),transporter:this.transporter,clientAuthentication:u}),this.cachedAccessToken=null,this.quotaProjectId=c.quota_project_id,typeof c?.eagerRefreshThresholdMillis!=="number")this.eagerRefreshThresholdMillis=i.EXPIRATION_TIME_OFFSET;else this.eagerRefreshThresholdMillis=c.eagerRefreshThresholdMillis;this.forceRefreshOnFailure=!!c?.forceRefreshOnFailure}async getAccessToken(){if(!this.cachedAccessToken||this.isExpired(this.cachedAccessToken))await this.refreshAccessTokenAsync();return{token:this.cachedAccessToken.access_token,res:this.cachedAccessToken.res}}async getRequestHeaders(){let c=await this.getAccessToken(),u=new Headers({authorization:`Bearer ${c.token}`});return this.addSharedMetadataHeaders(u)}request(c,u){if(u)this.requestAsync(c).then((f)=>u(null,f),(f)=>u(f,f.response));else return this.requestAsync(c)}async requestAsync(c,u=!1){let f;try{let h=await this.getRequestHeaders();c.headers=n.Gaxios.mergeHeaders(c.headers),this.addUserProjectAndAuthHeaders(c.headers,h),f=await this.transporter.request(c)}catch(h){let g=h.response;if(g){let p=g.status,_=g.config.data instanceof o.Readable;if(!u&&(p===401||p===403)&&!_&&this.forceRefreshOnFailure)return await this.refreshAccessTokenAsync(),await this.requestAsync(c,!0)}throw h}return f}async refreshAccessTokenAsync(){let c=await this.externalAccountAuthorizedUserHandler.refreshToken(this.refreshToken);if(this.cachedAccessToken={access_token:c.access_token,expiry_date:new Date().getTime()+c.expires_in*1000,res:c.res},c.refresh_token!==void 0)this.refreshToken=c.refresh_token;return this.cachedAccessToken}isExpired(c){let u=new Date().getTime();return c.expiry_date?u>=c.expiry_date-this.eagerRefreshThresholdMillis:!1}};e.ExternalAccountAuthorizedUserClient=a}}),Kv=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/gdchclient.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.GdchClient=e.GDCH_SERVICE_ACCOUNT_TYPE=void 0;var t=we("crypto"),r=we("fs"),n=we("https"),o=Ho(),i=3600;e.GDCH_SERVICE_ACCOUNT_TYPE="gdch_service_account";var s=class l extends o.OAuth2Client{projectId;privateKeyId;privateKey;serviceIdentityName;tokenServerUri;caCertPath;apiAudience;lifetime;gdchOptions;caAgentPromise;cachedCaCertPath;lastCaCertReadTime=0;CA_CERT_TTL_MS=300000;constructor(a={}){super(a);this.gdchOptions=a,this.projectId=a.projectId||void 0,this.privateKeyId=a.privateKeyId,this.privateKey=a.privateKey,this.serviceIdentityName=a.serviceIdentityName,this.tokenServerUri=a.tokenServerUri,this.caCertPath=a.caCertPath,this.apiAudience=a.apiAudience,this.lifetime=a.lifetime||i,this.credentials={refresh_token:"gdch-placeholder",expiry_date:1}}createWithGdchAudience(a){if(!a)throw Error("Audience cannot be null or empty for GDCH service account credentials.");return new l({...this.gdchOptions,projectId:this.projectId,privateKeyId:this.privateKeyId,privateKey:this.privateKey,serviceIdentityName:this.serviceIdentityName,tokenServerUri:this.tokenServerUri,caCertPath:this.caCertPath,lifetime:this.lifetime,apiAudience:a})}fromJSON(a){if(!a)throw Error("Must pass in a JSON object containing the GDCH credentials settings.");if(a.type!==e.GDCH_SERVICE_ACCOUNT_TYPE)throw Error(`The incoming JSON object does not have the "${e.GDCH_SERVICE_ACCOUNT_TYPE}" type`);if(a.format_version!=="1")throw Error("Only format version 1 is supported.");if(!a.project)throw Error("The incoming JSON object does not contain a project field");if(!a.private_key_id)throw Error("The incoming JSON object does not contain a private_key_id field");if(!a.private_key)throw Error("The incoming JSON object does not contain a private_key field");if(!a.name)throw Error("The incoming JSON object does not contain a name field");if(!a.token_uri)throw Error("The incoming JSON object does not contain a token_uri field");this.projectId=a.project,this.privateKeyId=a.private_key_id,this.privateKey=a.private_key,this.serviceIdentityName=a.name,this.tokenServerUri=a.token_uri,this.caCertPath=a.ca_cert_path,this.gdchOptions={...this.gdchOptions,projectId:a.project,privateKeyId:a.private_key_id,privateKey:a.private_key,serviceIdentityName:a.name,tokenServerUri:a.token_uri,caCertPath:a.ca_cert_path}}async refreshTokenNoCache(){if(!this.apiAudience)throw Error("Audience cannot be null or empty for GDCH service account credentials. Specify the audience by calling createWithGdchAudience.");if(!this.privateKey)throw Error("Private key is not configured for GDCH credentials.");if(!this.privateKeyId)throw Error("Private key ID is not configured for GDCH credentials.");if(!this.projectId)throw Error("Project is not configured for GDCH credentials.");if(!this.serviceIdentityName)throw Error("Service identity name is not configured for GDCH credentials.");if(!this.tokenServerUri)throw Error("Token server URI is not configured for GDCH credentials.");let a=this.createAssertion(),c={audience:this.apiAudience,grant_type:"urn:ietf:params:oauth:token-type:token-exchange",requested_token_type:"urn:ietf:params:oauth:token-type:access_token",subject_token:a,subject_token_type:"urn:k8s:params:oauth:token-type:serviceaccount"},u={url:this.tokenServerUri,method:"POST",headers:{"Content-Type":"application/json"},data:c,responseType:"json",timeout:1e4,retry:!0,retryConfig:{httpMethodsToRetry:["POST"],statusCodesToRetry:[[500,599]],noResponseRetries:3}};if(this.caCertPath)u.agent=await this.getCaAgent();try{let f=await this.transporter.request(u),h=f.data;if(!h.access_token)throw Error("Token response did not contain an access_token.");if(!h.expires_in)throw Error("Token response did not contain an expires_in field.");let g={access_token:h.access_token,token_type:"STS-Bearer",expiry_date:Date.now()+h.expires_in*1000};return this.emit("tokens",g),{res:f,tokens:g}}catch(f){if(f&&f.config&&f.config.data)try{if(typeof f.config.data==="string"){let h=JSON.parse(f.config.data);if(h.subject_token)h.subject_token="***REDACTED***",f.config.data=JSON.stringify(h)}else if(typeof f.config.data==="object"&&f.config.data.subject_token)f.config.data.subject_token="***REDACTED***"}catch{}if(f instanceof Error)f.message=`Error getting access token for GDCH service account: ${f.message}, iss: ${this.serviceIdentityName}`;throw f}}createAssertion(){let a={alg:"ES256",typ:"JWT",kid:this.privateKeyId},c=`system:serviceaccount:${this.projectId}:${this.serviceIdentityName}`,u=Math.floor(Date.now()/1000),f={iss:c,sub:c,iat:u,exp:u+this.lifetime,aud:this.tokenServerUri},h=this.base64UrlEncode(JSON.stringify(a)),g=this.base64UrlEncode(JSON.stringify(f)),p=`${h}.${g}`,_=t.sign("sha256",Buffer.from(p),{key:this.privateKey,dsaEncoding:"ieee-p1363"}),y=this.base64UrlEncode(_);return`${p}.${y}`}async requestAsync(a,c=!1){if(this.caCertPath&&!a.agent){let u=(a.url||"").toString();if(!u.includes("googleapis.com")&&!u.includes("google.com"))a.agent=await this.getCaAgent()}return super.requestAsync(a,c)}getCaAgent(){if(!this.caCertPath){this.caAgentPromise=void 0,this.cachedCaCertPath=void 0,this.lastCaCertReadTime=0;return}let a=Date.now(),c=a-this.lastCaCertReadTime>this.CA_CERT_TTL_MS;if(this.caAgentPromise&&this.caCertPath===this.cachedCaCertPath&&!c)return this.caAgentPromise;this.cachedCaCertPath=this.caCertPath,this.lastCaCertReadTime=a;let u=this.caCertPath;return this.caAgentPromise=(async()=>{try{let f=await r.promises.readFile(u);return new n.Agent({ca:f})}catch(f){if(this.cachedCaCertPath===u)this.caAgentPromise=void 0,this.cachedCaCertPath=void 0,this.lastCaCertReadTime=0;if(f instanceof Error)f.message=`Error reading certificate file from CA cert path, value '${u}': ${f.message}`;throw f}})(),this.caAgentPromise}toJSON(){return{...this,privateKey:this.privateKey?"***REDACTED***":void 0,_clientSecret:this._clientSecret?"***REDACTED***":void 0,apiKey:this.apiKey?"***REDACTED***":void 0,gdchOptions:this.gdchOptions?{...this.gdchOptions,privateKey:this.gdchOptions.privateKey?"***REDACTED***":void 0,clientSecret:this.gdchOptions.clientSecret?"***REDACTED***":void 0,client_secret:this.gdchOptions.client_secret?"***REDACTED***":void 0,apiKey:this.gdchOptions.apiKey?"***REDACTED***":void 0,credentials:this.gdchOptions.credentials?{...this.gdchOptions.credentials,access_token:this.gdchOptions.credentials.access_token?"***REDACTED***":void 0,refresh_token:this.gdchOptions.credentials.refresh_token?"***REDACTED***":void 0}:void 0}:void 0,credentials:{...this.credentials,access_token:this.credentials?.access_token?"***REDACTED***":void 0,refresh_token:this.credentials?.refresh_token?"***REDACTED***":void 0}}}[Symbol.for("nodejs.util.inspect.custom")](){return this.toJSON()}base64UrlEncode(a){return(typeof a==="string"?Buffer.from(a):a).toString("base64url")}};e.GdchClient=s}}),wR=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/googleauth.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.GoogleAuth=e.GoogleAuthExceptionMessages=void 0;var t=we("child_process"),r=we("fs"),n=rr(),o=bl(),i=we("os"),s=we("path"),l=wl(),a=Iv(),c=Pv(),u=kv(),f=qv(),h=Uv(),g=Fv(),p=Wv(),_=zo(),y=Mr(),S=Jv(),E=Kv(),b=un();e.GoogleAuthExceptionMessages={API_KEY_WITH_CREDENTIALS:"API Keys and Credentials are mutually exclusive authentication methods and cannot be used together.",NO_PROJECT_ID_FOUND:`Unable to detect a Project Id in the current environment.
49
+ To learn more about authentication and Google APIs, visit:
50
+ https://cloud.google.com/docs/authentication/getting-started`,NO_CREDENTIALS_FOUND:`Unable to find credentials in current environment.
51
+ To learn more about authentication and Google APIs, visit:
52
+ https://cloud.google.com/docs/authentication/getting-started`,NO_ADC_FOUND:"Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information.",NO_UNIVERSE_DOMAIN_FOUND:`Unable to detect a Universe Domain in the current environment.
53
+ To learn more about Universe Domain retrieval, visit:
54
+ https://cloud.google.com/compute/docs/metadata/predefined-metadata-keys`};var R=class{checkIsGCE=void 0;useJWTAccessWithScope;defaultServicePath;get isGCE(){return this.checkIsGCE}_findProjectIdPromise;_cachedProjectId;jsonContent=null;apiKey;cachedCredential=null;#e=null;defaultScopes;keyFilename;scopes;clientOptions={};constructor(w={}){if(this._cachedProjectId=w.projectId||null,this.cachedCredential=w.authClient||null,this.keyFilename=w.keyFilename||w.keyFile,this.scopes=w.scopes,this.clientOptions=w.clientOptions||{},this.jsonContent=w.credentials||null,this.apiKey=w.apiKey||this.clientOptions.apiKey||null,this.apiKey&&(this.jsonContent||this.clientOptions.credentials))throw RangeError(e.GoogleAuthExceptionMessages.API_KEY_WITH_CREDENTIALS);if(w.universeDomain)this.clientOptions.universeDomain=w.universeDomain}setGapicJWTValues(w){w.defaultServicePath=this.defaultServicePath,w.useJWTAccessWithScope=this.useJWTAccessWithScope,w.defaultScopes=this.defaultScopes}getProjectId(w){if(w)this.getProjectIdAsync().then((T)=>w(null,T),w);else return this.getProjectIdAsync()}async getProjectIdOptional(){try{return await this.getProjectId()}catch(w){if(w instanceof Error&&w.message===e.GoogleAuthExceptionMessages.NO_PROJECT_ID_FOUND)return null;else throw w}}async findAndCacheProjectId(){let w=null;if(w||=await this.getProductionProjectId(),w||=await this.getFileProjectId(),w||=await this.getDefaultServiceProjectId(),w||=await this.getGCEProjectId(),w||=await this.getExternalAccountClientProjectId(),w)return this._cachedProjectId=w,w;else throw Error(e.GoogleAuthExceptionMessages.NO_PROJECT_ID_FOUND)}async getProjectIdAsync(){if(this._cachedProjectId)return this._cachedProjectId;if(!this._findProjectIdPromise)this._findProjectIdPromise=this.findAndCacheProjectId();return this._findProjectIdPromise}async getUniverseDomainFromMetadataServer(){let w;try{w=await o.universe("universe-domain"),w||=y.DEFAULT_UNIVERSE}catch(T){if(T&&T?.response?.status===404)w=y.DEFAULT_UNIVERSE;else throw T}return w}async getUniverseDomain(){let w=(0,b.originalOrCamelOptions)(this.clientOptions).get("universe_domain");try{w??=(await this.getClient()).universeDomain}catch{w??=y.DEFAULT_UNIVERSE}return w}getAnyScopes(){return this.scopes||this.defaultScopes}getApplicationDefault(w={},T){let C;if(typeof w==="function")T=w;else C=w;if(T)this.getApplicationDefaultAsync(C).then((A)=>T(null,A.credential,A.projectId),T);else return this.getApplicationDefaultAsync(C)}async getApplicationDefaultAsync(w={}){if(this.cachedCredential)return await this.#t(this.cachedCredential,null);let T;if(T=await this._tryGetApplicationCredentialsFromEnvironmentVariable(w),T){if(T instanceof f.JWT)T.scopes=this.scopes;else if(T instanceof _.BaseExternalAccountClient)T.scopes=this.getAnyScopes();return await this.#t(T)}if(T=await this._tryGetApplicationCredentialsFromWellKnownFile(w),T){if(T instanceof f.JWT)T.scopes=this.scopes;else if(T instanceof _.BaseExternalAccountClient)T.scopes=this.getAnyScopes();return await this.#t(T)}if(await this._checkIsGCE())return w.scopes=this.getAnyScopes(),await this.#t(new a.Compute(w));throw Error(e.GoogleAuthExceptionMessages.NO_ADC_FOUND)}async#t(w,T=process.env.GOOGLE_CLOUD_QUOTA_PROJECT||null){let C=await this.getProjectIdOptional();if(T)w.quotaProjectId=T;return this.cachedCredential=w,{credential:w,projectId:C}}async _checkIsGCE(){if(this.checkIsGCE===void 0)this.checkIsGCE=o.getGCPResidency()||await o.isAvailable();return this.checkIsGCE}async _tryGetApplicationCredentialsFromEnvironmentVariable(w){let T=process.env.GOOGLE_APPLICATION_CREDENTIALS||process.env.google_application_credentials;if(!T||T.length===0)return null;try{return await this._getApplicationCredentialsFromFilePath(T,w)}catch(C){if(C instanceof Error)C.message=`Unable to read the credential file specified by the GOOGLE_APPLICATION_CREDENTIALS environment variable: ${C.message}`;throw C}}async _tryGetApplicationCredentialsFromWellKnownFile(w){let T=process.env.CLOUDSDK_CONFIG;if(!T)if(this._isWindows()){if(process.env.APPDATA)T=s.join(process.env.APPDATA,"gcloud")}else{let P=process.env.HOME;if(P)T=s.join(P,".config","gcloud")}if(!T)return null;let C=s.join(T,"application_default_credentials.json");if(!r.existsSync(C))return null;return await this._getApplicationCredentialsFromFilePath(C,w)}async _getApplicationCredentialsFromFilePath(w,T={}){if(!w||w.length===0)throw Error("The file path is invalid.");try{if(w=r.realpathSync(w),!r.lstatSync(w).isFile())throw Error()}catch(A){if(A instanceof Error)A.message=`The file at ${w} does not exist, or it is not a file. ${A.message}`;throw A}let C=r.createReadStream(w);return this.fromStream(C,T)}fromImpersonatedJSON(w){if(!w)throw Error("Must pass in a JSON object containing an impersonated refresh token");if(w.type!==g.IMPERSONATED_ACCOUNT_TYPE)throw Error(`The incoming JSON object does not have the "${g.IMPERSONATED_ACCOUNT_TYPE}" type`);if(!w.source_credentials)throw Error("The incoming JSON object does not contain a source_credentials field");if(!w.service_account_impersonation_url)throw Error("The incoming JSON object does not contain a service_account_impersonation_url field");let T=this.fromJSON(w.source_credentials);if(w.service_account_impersonation_url?.length>256)throw RangeError(`Target principal is too long: ${w.service_account_impersonation_url}`);let C=/(?<target>[^/]+):(generateAccessToken|generateIdToken)$/.exec(w.service_account_impersonation_url)?.groups?.target;if(!C)throw RangeError(`Cannot extract target principal from ${w.service_account_impersonation_url}`);let A=(this.scopes||w.scopes||this.defaultScopes)??[];return new g.Impersonated({...w,sourceClient:T,targetPrincipal:C,targetScopes:Array.isArray(A)?A:[A]})}fromJSON(w,T={}){let C,A=(0,b.originalOrCamelOptions)(T).get("universe_domain");if(w.type===h.USER_REFRESH_ACCOUNT_TYPE)C=new h.UserRefreshClient(T),C.fromJSON(w);else if(w.type===g.IMPERSONATED_ACCOUNT_TYPE)C=this.fromImpersonatedJSON(w);else if(w.type===_.EXTERNAL_ACCOUNT_TYPE)C=p.ExternalAccountClient.fromJSON({...w,...T}),C.scopes=this.getAnyScopes();else if(w.type===S.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE)C=new S.ExternalAccountAuthorizedUserClient({...w,...T});else if(w.type===E.GDCH_SERVICE_ACCOUNT_TYPE)C=new E.GdchClient(T),C.fromJSON(w);else T.scopes=this.scopes,C=new f.JWT(T),this.setGapicJWTValues(C),C.fromJSON(w);if(A)C.universeDomain=A;return C}_cacheClientFromJSON(w,T){let C=this.fromJSON(w,T);return this.jsonContent=w,this.cachedCredential=C,C}fromStream(w,T={},C){let A={};if(typeof T==="function")C=T;else A=T;if(C)this.fromStreamAsync(w,A).then((P)=>C(null,P),C);else return this.fromStreamAsync(w,A)}fromStreamAsync(w,T){return new Promise((C,A)=>{if(!w)throw Error("Must pass in a stream containing the Google auth settings.");let P=[];w.setEncoding("utf8").on("error",A).on("data",(D)=>P.push(D)).on("end",()=>{try{try{let D=JSON.parse(P.join("")),N=this._cacheClientFromJSON(D,T);return C(N)}catch(D){if(!this.keyFilename)throw D;let N=new f.JWT({...this.clientOptions,keyFile:this.keyFilename});return this.cachedCredential=N,this.setGapicJWTValues(N),C(N)}}catch(D){return A(D)}})})}fromAPIKey(w,T={}){return new f.JWT({...T,apiKey:w})}_isWindows(){let w=i.platform();if(w&&w.length>=3){if(w.substring(0,3).toLowerCase()==="win")return!0}return!1}async getDefaultServiceProjectId(){return new Promise((w)=>{(0,t.exec)("gcloud config config-helper --format json",(T,C)=>{if(!T&&C)try{let A=JSON.parse(C).configuration.properties.core.project;w(A);return}catch(A){}w(null)})})}getProductionProjectId(){return process.env.GCLOUD_PROJECT||process.env.GOOGLE_CLOUD_PROJECT||process.env.gcloud_project||process.env.google_cloud_project}async getFileProjectId(){if(this.cachedCredential)return this.cachedCredential.projectId;if(this.keyFilename){let T=await this.getClient();if(T&&T.projectId)return T.projectId}let w=await this._tryGetApplicationCredentialsFromEnvironmentVariable();if(w)return w.projectId;else return null}async getExternalAccountClientProjectId(){if(!this.jsonContent||this.jsonContent.type!==_.EXTERNAL_ACCOUNT_TYPE)return null;return await(await this.getClient()).getProjectId()}async getGCEProjectId(){try{return await o.project("project-id")}catch(w){return null}}getCredentials(w){if(w)this.getCredentialsAsync().then((T)=>w(null,T),w);else return this.getCredentialsAsync()}async getCredentialsAsync(){let w=await this.getClient();if(w instanceof g.Impersonated)return{client_email:w.getTargetPrincipal()};if(w instanceof _.BaseExternalAccountClient){let T=w.getServiceAccountEmail();if(T)return{client_email:T,universe_domain:w.universeDomain}}if(this.jsonContent)return{client_email:this.jsonContent.client_email,private_key:this.jsonContent.private_key,universe_domain:this.jsonContent.universe_domain};if(await this._checkIsGCE()){let[T,C]=await Promise.all([o.instance("service-accounts/default/email"),this.getUniverseDomain()]);return{client_email:T,universe_domain:C}}throw Error(e.GoogleAuthExceptionMessages.NO_CREDENTIALS_FOUND)}async getClient(){if(this.cachedCredential)return this.cachedCredential;this.#e=this.#e||this.#r();try{let w=await this.#e;if(w instanceof E.GdchClient&&!w.apiAudience){let T=this.clientOptions,C=T.apiEndpoint||T.servicePath;if(C){let P=`${C.startsWith("http")?"":"https://"}${C}`.replace(/\/+$/,""),D=w.createWithGdchAudience(P);return this.cachedCredential=D,D}}return w}finally{this.#e=null}}async#r(){if(this.jsonContent)return this._cacheClientFromJSON(this.jsonContent,this.clientOptions);else if(this.keyFilename){let w=s.resolve(this.keyFilename),T=r.createReadStream(w);return await this.fromStreamAsync(T,this.clientOptions)}else if(this.apiKey){let w=await this.fromAPIKey(this.apiKey,this.clientOptions);w.scopes=this.scopes;let{credential:T}=await this.#t(w);return T}else{let{credential:w}=await this.getApplicationDefaultAsync(this.clientOptions);return w}}async getIdTokenClient(w){let T=await this.getClient();if(!("fetchIdToken"in T))throw Error("Cannot fetch ID token in this environment, use GCE or set the GOOGLE_APPLICATION_CREDENTIALS environment variable to a service account credentials JSON file.");return new c.IdTokenClient({targetAudience:w,idTokenProvider:T})}async getAccessToken(){return(await(await this.getClient()).getAccessToken()).token}async getRequestHeaders(w){return(await this.getClient()).getRequestHeaders(w)}async authorizeRequest(w={}){let T=w.url,A=await(await this.getClient()).getRequestHeaders(T);return w.headers=n.Gaxios.mergeHeaders(w.headers,A),w}async fetch(...w){return(await this.getClient()).fetch(...w)}async request(w){return(await this.getClient()).request(w)}getEnv(){return(0,u.getEnv)()}async sign(w,T){let C=await this.getClient(),A=await this.getUniverseDomain();if(T=T||`https://iamcredentials.${A}/v1/projects/-/serviceAccounts/`,C instanceof g.Impersonated)return(await C.sign(w)).signedBlob;let P=(0,l.createCrypto)();if(C instanceof f.JWT&&C.key)return await P.sign(C.key,w);let D=await this.getCredentials();if(!D.client_email)throw Error("Cannot sign data without `client_email`.");return this.signBlob(P,D.client_email,w,T)}async signBlob(w,T,C,A){let P=new URL(A+`${T}:signBlob`);return(await this.request({method:"POST",url:P.href,data:{payload:w.encodeBase64StringUtf8(C)},retry:!0,retryConfig:{httpMethodsToRetry:["POST"]}})).data.signedBlob}};e.GoogleAuth=R}}),TR=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/iam.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.IAMAuth=void 0;var t=class{selector;token;constructor(r,n){this.selector=r,this.token=n,this.selector=r,this.token=n}getRequestHeaders(){return{"x-goog-iam-authority-selector":this.selector,"x-goog-iam-authorization-token":this.token}}};e.IAMAuth=t}}),CR=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/downscopedclient.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DownscopedClient=e.EXPIRATION_TIME_OFFSET=e.MAX_ACCESS_BOUNDARY_RULES_COUNT=void 0;var t=rr(),r=we("stream"),n=Mr(),o=$u(),i="urn:ietf:params:oauth:grant-type:token-exchange",s="urn:ietf:params:oauth:token-type:access_token",l="urn:ietf:params:oauth:token-type:access_token";e.MAX_ACCESS_BOUNDARY_RULES_COUNT=10,e.EXPIRATION_TIME_OFFSET=300000;var a=class extends n.AuthClient{authClient;credentialAccessBoundary;cachedDownscopedAccessToken;stsCredential;constructor(c,u={accessBoundary:{accessBoundaryRules:[]}}){super(c instanceof n.AuthClient?{}:c);if(c instanceof n.AuthClient)this.authClient=c,this.credentialAccessBoundary=u;else this.authClient=c.authClient,this.credentialAccessBoundary=c.credentialAccessBoundary;if(this.credentialAccessBoundary.accessBoundary.accessBoundaryRules.length===0)throw Error("At least one access boundary rule needs to be defined.");else if(this.credentialAccessBoundary.accessBoundary.accessBoundaryRules.length>e.MAX_ACCESS_BOUNDARY_RULES_COUNT)throw Error(`The provided access boundary has more than ${e.MAX_ACCESS_BOUNDARY_RULES_COUNT} access boundary rules.`);for(let f of this.credentialAccessBoundary.accessBoundary.accessBoundaryRules)if(f.availablePermissions.length===0)throw Error("At least one permission should be defined in access boundary rules.");this.stsCredential=new o.StsCredentials({tokenExchangeEndpoint:`https://sts.${this.universeDomain}/v1/token`}),this.cachedDownscopedAccessToken=null}setCredentials(c){if(!c.expiry_date)throw Error("The access token expiry_date field is missing in the provided credentials.");super.setCredentials(c),this.cachedDownscopedAccessToken=c}async getAccessToken(){if(!this.cachedDownscopedAccessToken||this.isExpired(this.cachedDownscopedAccessToken))await this.refreshAccessTokenAsync();return{token:this.cachedDownscopedAccessToken.access_token,expirationTime:this.cachedDownscopedAccessToken.expiry_date,res:this.cachedDownscopedAccessToken.res}}async getRequestHeaders(){let c=await this.getAccessToken(),u=new Headers({authorization:`Bearer ${c.token}`});return this.addSharedMetadataHeaders(u)}request(c,u){if(u)this.requestAsync(c).then((f)=>u(null,f),(f)=>u(f,f.response));else return this.requestAsync(c)}async requestAsync(c,u=!1){let f;try{let h=await this.getRequestHeaders();c.headers=t.Gaxios.mergeHeaders(c.headers),this.addUserProjectAndAuthHeaders(c.headers,h),f=await this.transporter.request(c)}catch(h){let g=h.response;if(g){let p=g.status,_=g.config.data instanceof r.Readable;if(!u&&(p===401||p===403)&&!_&&this.forceRefreshOnFailure)return await this.refreshAccessTokenAsync(),await this.requestAsync(c,!0)}throw h}return f}async refreshAccessTokenAsync(){let c=(await this.authClient.getAccessToken()).token,u={grantType:i,requestedTokenType:s,subjectToken:c,subjectTokenType:l},f=await this.stsCredential.exchangeToken(u,void 0,this.credentialAccessBoundary),h=this.authClient.credentials?.expiry_date||null,g=f.expires_in?new Date().getTime()+f.expires_in*1000:h;return this.cachedDownscopedAccessToken={access_token:f.access_token,expiry_date:g,res:f.res},this.credentials={},Object.assign(this.credentials,this.cachedDownscopedAccessToken),delete this.credentials.res,this.emit("tokens",{refresh_token:null,expiry_date:this.cachedDownscopedAccessToken.expiry_date,access_token:this.cachedDownscopedAccessToken.access_token,token_type:"Bearer",id_token:null}),this.cachedDownscopedAccessToken}isExpired(c){let u=new Date().getTime();return c.expiry_date?u>=c.expiry_date-this.eagerRefreshThresholdMillis:!1}};e.DownscopedClient=a}}),RR=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/auth/passthrough.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PassThroughClient=void 0;var t=Mr(),r=class extends t.AuthClient{async request(n){return this.transporter.request(n)}async getAccessToken(){return{}}async getRequestHeaders(){return new Headers}};e.PassThroughClient=r}}),AR=ye({"../node_modules/.bun/google-auth-library@10.9.1+759ce506b1ed1a42/node_modules/google-auth-library/build/src/index.js"(e){var t=e&&e.__createBinding||(Object.create?function(D,N,F,G){if(G===void 0)G=F;var B=Object.getOwnPropertyDescriptor(N,F);if(!B||("get"in B?!N.__esModule:B.writable||B.configurable))B={enumerable:!0,get:function(){return N[F]}};Object.defineProperty(D,G,B)}:function(D,N,F,G){if(G===void 0)G=F;D[G]=N[F]}),r=e&&e.__exportStar||function(D,N){for(var F in D)if(F!=="default"&&!Object.prototype.hasOwnProperty.call(N,F))t(N,D,F)};Object.defineProperty(e,"__esModule",{value:!0}),e.GoogleAuth=e.auth=e.GDCH_SERVICE_ACCOUNT_TYPE=e.GdchClient=e.PassThroughClient=e.ExternalAccountAuthorizedUserClient=e.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE=e.ExecutableError=e.PluggableAuthClient=e.DownscopedClient=e.BaseExternalAccountClient=e.ExternalAccountClient=e.IdentityPoolClient=e.AwsRequestSigner=e.AwsClient=e.UserRefreshClient=e.LoginTicket=e.ClientAuthentication=e.OAuth2Client=e.CodeChallengeMethod=e.Impersonated=e.JWT=e.JWTAccess=e.IdTokenClient=e.IAMAuth=e.GCPEnv=e.Compute=e.DEFAULT_UNIVERSE=e.AuthClient=e.gaxios=e.gcpMetadata=void 0;var n=wR();Object.defineProperty(e,"GoogleAuth",{enumerable:!0,get:function(){return n.GoogleAuth}}),e.gcpMetadata=bl(),e.gaxios=rr();var o=Mr();Object.defineProperty(e,"AuthClient",{enumerable:!0,get:function(){return o.AuthClient}}),Object.defineProperty(e,"DEFAULT_UNIVERSE",{enumerable:!0,get:function(){return o.DEFAULT_UNIVERSE}});var i=Iv();Object.defineProperty(e,"Compute",{enumerable:!0,get:function(){return i.Compute}});var s=kv();Object.defineProperty(e,"GCPEnv",{enumerable:!0,get:function(){return s.GCPEnv}});var l=TR();Object.defineProperty(e,"IAMAuth",{enumerable:!0,get:function(){return l.IAMAuth}});var a=Pv();Object.defineProperty(e,"IdTokenClient",{enumerable:!0,get:function(){return a.IdTokenClient}});var c=Lv();Object.defineProperty(e,"JWTAccess",{enumerable:!0,get:function(){return c.JWTAccess}});var u=qv();Object.defineProperty(e,"JWT",{enumerable:!0,get:function(){return u.JWT}});var f=Fv();Object.defineProperty(e,"Impersonated",{enumerable:!0,get:function(){return f.Impersonated}});var h=Ho();Object.defineProperty(e,"CodeChallengeMethod",{enumerable:!0,get:function(){return h.CodeChallengeMethod}}),Object.defineProperty(e,"OAuth2Client",{enumerable:!0,get:function(){return h.OAuth2Client}}),Object.defineProperty(e,"ClientAuthentication",{enumerable:!0,get:function(){return h.ClientAuthentication}});var g=Av();Object.defineProperty(e,"LoginTicket",{enumerable:!0,get:function(){return g.LoginTicket}});var p=Uv();Object.defineProperty(e,"UserRefreshClient",{enumerable:!0,get:function(){return p.UserRefreshClient}});var _=zv();Object.defineProperty(e,"AwsClient",{enumerable:!0,get:function(){return _.AwsClient}});var y=Hv();Object.defineProperty(e,"AwsRequestSigner",{enumerable:!0,get:function(){return y.AwsRequestSigner}});var S=Bv();Object.defineProperty(e,"IdentityPoolClient",{enumerable:!0,get:function(){return S.IdentityPoolClient}});var E=Wv();Object.defineProperty(e,"ExternalAccountClient",{enumerable:!0,get:function(){return E.ExternalAccountClient}});var b=zo();Object.defineProperty(e,"BaseExternalAccountClient",{enumerable:!0,get:function(){return b.BaseExternalAccountClient}});var R=CR();Object.defineProperty(e,"DownscopedClient",{enumerable:!0,get:function(){return R.DownscopedClient}});var w=jv();Object.defineProperty(e,"PluggableAuthClient",{enumerable:!0,get:function(){return w.PluggableAuthClient}}),Object.defineProperty(e,"ExecutableError",{enumerable:!0,get:function(){return w.ExecutableError}});var T=Jv();Object.defineProperty(e,"EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE",{enumerable:!0,get:function(){return T.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE}}),Object.defineProperty(e,"ExternalAccountAuthorizedUserClient",{enumerable:!0,get:function(){return T.ExternalAccountAuthorizedUserClient}});var C=RR();Object.defineProperty(e,"PassThroughClient",{enumerable:!0,get:function(){return C.PassThroughClient}});var A=Kv();Object.defineProperty(e,"GdchClient",{enumerable:!0,get:function(){return A.GdchClient}}),Object.defineProperty(e,"GDCH_SERVICE_ACCOUNT_TYPE",{enumerable:!0,get:function(){return A.GDCH_SERVICE_ACCOUNT_TYPE}}),r(xv(),e);var P=new n.GoogleAuth;e.auth=P}}),go=ye({"../node_modules/.bun/ws@8.23.0/node_modules/ws/lib/constants.js"(e,t){var r=["nodebuffer","arraybuffer","fragments"],n=typeof Blob<"u";if(n)r.push("blob");t.exports={BINARY_TYPES:r,CLOSE_TIMEOUT:30000,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:n,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}}}),Tl=ye({"../node_modules/.bun/ws@8.23.0/node_modules/ws/lib/buffer-util.js"(e,t){var{websocketMask:r,websocketUnmask:n}=we("http"),{EMPTY_BUFFER:o}=go(),i=Buffer[Symbol.species];function s(f,h){if(f.length===0)return o;if(f.length===1)return f[0];let g=Buffer.allocUnsafe(h),p=0;for(let _=0;_<f.length;_++){let y=f[_];g.set(y,p),p+=y.length}if(p<h)return new i(g.buffer,g.byteOffset,p);return g}function l(f,h,g,p,_){for(let y=0;y<_;y++)g[p+y]=f[y]^h[y&3]}function a(f,h){for(let g=0;g<f.length;g++)f[g]^=h[g&3]}function c(f){if(f.length===f.buffer.byteLength)return f.buffer;return f.buffer.slice(f.byteOffset,f.byteOffset+f.length)}function u(f){if(u.readOnly=!0,Buffer.isBuffer(f))return f;let h;if(f instanceof ArrayBuffer)h=new i(f);else if(ArrayBuffer.isView(f))h=new i(f.buffer,f.byteOffset,f.byteLength);else h=Buffer.from(f),u.readOnly=!1;return h}if(t.exports={concat:s,mask:l,toArrayBuffer:c,toBuffer:u,unmask:a},r)t.exports.mask=function(f,h,g,p,_){if(_<24)l(f,h,g,p,_);else r(f,h,g,p,_)},t.exports.unmask=function(f,h){if(f.length<24)a(f,h);else n(f,h)};else if(!process.env.WS_NO_BUFFER_UTIL)try{let f=we("bufferutil");t.exports.mask=function(h,g,p,_,y){if(y<48)l(h,g,p,_,y);else f.mask(h,g,p,_,y)},t.exports.unmask=function(h,g){if(h.length<32)a(h,g);else f.unmask(h,g)}}catch(f){}}}),IR=ye({"../node_modules/.bun/ws@8.23.0/node_modules/ws/lib/limiter.js"(e,t){var r=Symbol("kDone"),n=Symbol("kRun"),o=class{constructor(i){this[r]=()=>{this.pending--,this[n]()},this.concurrency=i||1/0,this.jobs=[],this.pending=0}add(i){this.jobs.push(i),this[n]()}[n](){if(this.pending===this.concurrency)return;if(this.jobs.length){let i=this.jobs.shift();this.pending++,i(this[r])}}};t.exports=o}}),Vs=ye({"../node_modules/.bun/ws@8.23.0/node_modules/ws/lib/permessage-deflate.js"(e,t){var r=we("zlib"),n=Tl(),o=IR(),{kStatusCode:i}=go(),s=Buffer[Symbol.species],l=Buffer.from([0,0,255,255]),a=Symbol("permessage-deflate"),c=Symbol("total-length"),u=Symbol("callback"),f=Symbol("buffers"),h=Symbol("error"),g,p=class{constructor(E){if(this._options=E||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!g){let b=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;g=new o(b)}}static get extensionName(){return"permessage-deflate"}offer(){let E={};if(this._options.serverNoContextTakeover)E.server_no_context_takeover=!0;if(this._options.clientNoContextTakeover)E.client_no_context_takeover=!0;if(this._options.serverMaxWindowBits)E.server_max_window_bits=this._options.serverMaxWindowBits;if(this._options.clientMaxWindowBits)E.client_max_window_bits=this._options.clientMaxWindowBits;else if(this._options.clientMaxWindowBits==null)E.client_max_window_bits=!0;return E}accept(E){return E=this.normalizeParams(E),this.params=this._isServer?this.acceptAsServer(E):this.acceptAsClient(E),this.params}cleanup(){if(this._inflate)this._inflate.close(),this._inflate=null;if(this._deflate){let E=this._deflate[u];if(this._deflate.close(),this._deflate=null,E)E(Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(E){let b=this._options,R=E.find((w)=>{if(b.serverNoContextTakeover===!1&&w.server_no_context_takeover||w.server_max_window_bits&&(b.serverMaxWindowBits===!1||typeof b.serverMaxWindowBits==="number"&&b.serverMaxWindowBits>w.server_max_window_bits)||typeof b.clientMaxWindowBits==="number"&&(typeof w.client_max_window_bits==="number"?b.clientMaxWindowBits>w.client_max_window_bits:!w.client_max_window_bits))return!1;return!0});if(!R)throw Error("None of the extension offers can be accepted");if(b.serverNoContextTakeover)R.server_no_context_takeover=!0;if(b.clientNoContextTakeover)R.client_no_context_takeover=!0;if(typeof b.serverMaxWindowBits==="number")R.server_max_window_bits=b.serverMaxWindowBits;if(typeof b.clientMaxWindowBits==="number")R.client_max_window_bits=b.clientMaxWindowBits;else if(R.client_max_window_bits===!0||b.clientMaxWindowBits===!1)delete R.client_max_window_bits;return R}acceptAsClient(E){let b=E[0];if(this._options.clientNoContextTakeover===!1&&b.client_no_context_takeover)throw Error('Unexpected parameter "client_no_context_takeover"');if(!b.client_max_window_bits){if(typeof this._options.clientMaxWindowBits==="number")b.client_max_window_bits=this._options.clientMaxWindowBits}else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==="number"&&b.client_max_window_bits>this._options.clientMaxWindowBits)throw Error('Unexpected or invalid parameter "client_max_window_bits"');return b}normalizeParams(E){return E.forEach((b)=>{Object.keys(b).forEach((R)=>{let w=b[R];if(w.length>1)throw Error(`Parameter "${R}" must have only a single value`);if(w=w[0],R==="client_max_window_bits"){if(w!==!0){let T=+w;if(!Number.isInteger(T)||T<8||T>15)throw TypeError(`Invalid value for parameter "${R}": ${w}`);w=T}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${R}": ${w}`)}else if(R==="server_max_window_bits"){let T=+w;if(!Number.isInteger(T)||T<8||T>15)throw TypeError(`Invalid value for parameter "${R}": ${w}`);w=T}else if(R==="client_no_context_takeover"||R==="server_no_context_takeover"){if(w!==!0)throw TypeError(`Invalid value for parameter "${R}": ${w}`)}else throw Error(`Unknown parameter "${R}"`);b[R]=w})}),E}decompress(E,b,R){g.add((w)=>{this._decompress(E,b,(T,C)=>{w(),R(T,C)})})}compress(E,b,R){g.add((w)=>{this._compress(E,b,(T,C)=>{w(),R(T,C)})})}_decompress(E,b,R){let w=this._isServer?"client":"server";if(!this._inflate){let T=`${w}_max_window_bits`,C=typeof this.params[T]!=="number"?r.Z_DEFAULT_WINDOWBITS:this.params[T];this._inflate=r.createInflateRaw({...this._options.zlibInflateOptions,windowBits:C}),this._inflate[a]=this,this._inflate[c]=0,this._inflate[f]=[],this._inflate.on("error",S),this._inflate.on("data",y)}if(this._inflate[u]=R,this._inflate.write(E),b)this._inflate.write(l);this._inflate.flush(()=>{let T=this._inflate[h];if(T){this._inflate.close(),this._inflate=null,R(T);return}let C=n.concat(this._inflate[f],this._inflate[c]);if(this._inflate._readableState.endEmitted)this._inflate.close(),this._inflate=null;else if(this._inflate[c]=0,this._inflate[f]=[],b&&this.params[`${w}_no_context_takeover`])this._inflate.reset();R(null,C)})}_compress(E,b,R){let w=this._isServer?"server":"client";if(!this._deflate){let T=`${w}_max_window_bits`,C=typeof this.params[T]!=="number"?r.Z_DEFAULT_WINDOWBITS:this.params[T];this._deflate=r.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:C}),this._deflate[c]=0,this._deflate[f]=[],this._deflate.on("data",_)}this._deflate[u]=R,this._deflate.write(E),this._deflate.flush(r.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let T=n.concat(this._deflate[f],this._deflate[c]);if(b)T=new s(T.buffer,T.byteOffset,T.length-4);if(this._deflate[u]=null,this._deflate[c]=0,this._deflate[f]=[],b&&this.params[`${w}_no_context_takeover`])this._deflate.reset();R(null,T)})}};t.exports=p;function _(E){this[f].push(E),this[c]+=E.length}function y(E){if(this[c]+=E.length,this[a]._maxPayload<1||this[c]<=this[a]._maxPayload){this[f].push(E);return}this[h]=RangeError("Max payload size exceeded"),this[h].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[h][i]=1009,this.removeListener("data",y),this.reset()}function S(E){if(this[a]._inflate=null,this[h]){this[u](this[h]);return}E[i]=1007,this[u](E)}}}),js=ye({"../node_modules/.bun/ws@8.23.0/node_modules/ws/lib/validation.js"(e,t){var{isUtf8:r}=we("buffer"),{hasBlob:n}=go(),o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function i(a){return a>=1000&&a<=1014&&a!==1004&&a!==1005&&a!==1006||a>=3000&&a<=4999}function s(a){let c=a.length,u=0;while(u<c)if((a[u]&128)===0)u++;else if((a[u]&224)===192){if(u+1===c||(a[u+1]&192)!==128||(a[u]&254)===192)return!1;u+=2}else if((a[u]&240)===224){if(u+2>=c||(a[u+1]&192)!==128||(a[u+2]&192)!==128||a[u]===224&&(a[u+1]&224)===128||a[u]===237&&(a[u+1]&224)===160)return!1;u+=3}else if((a[u]&248)===240){if(u+3>=c||(a[u+1]&192)!==128||(a[u+2]&192)!==128||(a[u+3]&192)!==128||a[u]===240&&(a[u+1]&240)===128||a[u]===244&&a[u+1]>143||a[u]>244)return!1;u+=4}else return!1;return!0}function l(a){return n&&typeof a==="object"&&typeof a.arrayBuffer==="function"&&typeof a.type==="string"&&typeof a.stream==="function"&&(a[Symbol.toStringTag]==="Blob"||a[Symbol.toStringTag]==="File")}if(t.exports={isBlob:l,isValidStatusCode:i,isValidUTF8:s,tokenChars:o},r)t.exports.isValidUTF8=function(a){return a.length<24?s(a):r(a)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let a=we("utf-8-validate");t.exports.isValidUTF8=function(c){return c.length<32?s(c):a(c)}}catch(a){}}}),Xv=ye({"../node_modules/.bun/ws@8.23.0/node_modules/ws/lib/receiver.js"(e,t){var{Writable:r}=we("stream"),n=Vs(),{BINARY_TYPES:o,EMPTY_BUFFER:i,kStatusCode:s,kWebSocket:l}=go(),{concat:a,toArrayBuffer:c,unmask:u}=Tl(),{isValidStatusCode:f,isValidUTF8:h}=js(),g=Buffer[Symbol.species],p=0,_=1,y=2,S=3,E=4,b=5,R=6,w=class extends r{constructor(T={}){super();this._allowSynchronousEvents=T.allowSynchronousEvents!==void 0?T.allowSynchronousEvents:!0,this._binaryType=T.binaryType||o[0],this._extensions=T.extensions||{},this._isServer=!!T.isServer,this._maxBufferedChunks=T.maxBufferedChunks|0,this._maxFragments=T.maxFragments|0,this._maxPayload=T.maxPayload|0,this._skipUTF8Validation=!!T.skipUTF8Validation,this[l]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._numFragments=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=p}_write(T,C,A){if(this._opcode===8&&this._state==p)return A();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){A(this.createError(RangeError,"Too many buffered chunks",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));return}this._bufferedBytes+=T.length,this._buffers.push(T),this.startLoop(A)}consume(T){if(this._bufferedBytes-=T,T===this._buffers[0].length)return this._buffers.shift();if(T<this._buffers[0].length){let A=this._buffers[0];return this._buffers[0]=new g(A.buffer,A.byteOffset+T,A.length-T),new g(A.buffer,A.byteOffset,T)}let C=Buffer.allocUnsafe(T);do{let A=this._buffers[0],P=C.length-T;if(T>=A.length)C.set(this._buffers.shift(),P);else C.set(new Uint8Array(A.buffer,A.byteOffset,T),P),this._buffers[0]=new g(A.buffer,A.byteOffset+T,A.length-T);T-=A.length}while(T>0);return C}startLoop(T){this._loop=!0;do switch(this._state){case p:this.getInfo(T);break;case _:this.getPayloadLength16(T);break;case y:this.getPayloadLength64(T);break;case S:this.getMask();break;case E:this.getData(T);break;case b:case R:this._loop=!1;return}while(this._loop);if(!this._errored)T()}getInfo(T){if(this._bufferedBytes<2){this._loop=!1;return}let C=this.consume(2);if((C[0]&48)!==0){let P=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");T(P);return}let A=(C[0]&64)===64;if(A&&!this._extensions[n.extensionName]){let P=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");T(P);return}if(this._fin=(C[0]&128)===128,this._opcode=C[0]&15,this._payloadLength=C[1]&127,this._opcode===0){if(A){let P=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");T(P);return}if(!this._fragmented){let P=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");T(P);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let P=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");T(P);return}this._compressed=A}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let P=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");T(P);return}if(A){let P=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");T(P);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let P=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");T(P);return}}else{let P=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");T(P);return}if(!this._fin&&!this._fragmented)this._fragmented=this._opcode;if(this._masked=(C[1]&128)===128,this._isServer){if(!this._masked){let P=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");T(P);return}}else if(this._masked){let P=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");T(P);return}if(this._payloadLength===126)this._state=_;else if(this._payloadLength===127)this._state=y;else this.haveLength(T)}getPayloadLength16(T){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(T)}getPayloadLength64(T){if(this._bufferedBytes<8){this._loop=!1;return}let C=this.consume(8),A=C.readUInt32BE(0);if(A>Math.pow(2,21)-1){let P=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");T(P);return}this._payloadLength=A*Math.pow(2,32)+C.readUInt32BE(4),this.haveLength(T)}haveLength(T){if(this._payloadLength&&this._opcode<8){if(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0){let C=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");T(C);return}}if(this._masked)this._state=S;else this._state=E}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=E}getData(T){let C=i;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}if(C=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0)u(C,this._mask)}if(this._mask=void 0,this._opcode>7){this.controlMessage(C,T);return}if(this._maxFragments>0&&++this._numFragments>this._maxFragments){let A=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");T(A);return}if(this._compressed){this._state=b,this.decompress(C,T);return}if(C.length)this._messageLength=this._totalPayloadLength,this._fragments.push(C);this.dataMessage(T)}decompress(T,C){this._extensions[n.extensionName].decompress(T,this._fin,(P,D)=>{if(P)return C(P);if(D.length){if(this._messageLength+=D.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let N=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");C(N);return}this._fragments.push(D)}if(this.dataMessage(C),this._state===p)this.startLoop(C)})}dataMessage(T){if(!this._fin){this._state=p;return}let C=this._messageLength,A=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._numFragments=0,this._fragments=[],this._opcode===2){let P;if(this._binaryType==="nodebuffer")P=a(A,C);else if(this._binaryType==="arraybuffer")P=c(a(A,C));else if(this._binaryType==="blob")P=new Blob(A);else P=A;if(this._allowSynchronousEvents)this.emit("message",P,!0),this._state=p;else this._state=R,setImmediate(()=>{this.emit("message",P,!0),this._state=p,this.startLoop(T)})}else{let P=a(A,C);if(!this._skipUTF8Validation&&!h(P)){let D=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");T(D);return}if(this._state===b||this._allowSynchronousEvents)this.emit("message",P,!1),this._state=p;else this._state=R,setImmediate(()=>{this.emit("message",P,!1),this._state=p,this.startLoop(T)})}}controlMessage(T,C){if(this._opcode===8){if(T.length===0)this._loop=!1,this.emit("conclude",1005,i),this.end();else{let A=T.readUInt16BE(0);if(!f(A)){let D=this.createError(RangeError,`invalid status code ${A}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");C(D);return}let P=new g(T.buffer,T.byteOffset+2,T.length-2);if(!this._skipUTF8Validation&&!h(P)){let D=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");C(D);return}this._loop=!1,this.emit("conclude",A,P),this.end()}this._state=p;return}if(this._allowSynchronousEvents)this.emit(this._opcode===9?"ping":"pong",T),this._state=p;else this._state=R,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",T),this._state=p,this.startLoop(C)})}createError(T,C,A,P,D){this._loop=!1,this._errored=!0;let N=new T(A?`Invalid WebSocket frame: ${C}`:C);return Error.captureStackTrace(N,this.createError),N.code=D,N[s]=P,N}};t.exports=w}}),Yv=ye({"../node_modules/.bun/ws@8.23.0/node_modules/ws/lib/sender.js"(e,t){var{Duplex:r}=we("stream"),{randomFillSync:n}=we("crypto"),{types:{isUint8Array:o}}=we("util"),i=Vs(),{EMPTY_BUFFER:s,kWebSocket:l,NOOP:a}=go(),{isBlob:c,isValidStatusCode:u}=js(),{mask:f,toBuffer:h}=Tl(),g=Symbol("kByteLength"),p=Buffer.alloc(4),_=8192,y,S=_,E=0,b=1,R=2,w=class A{constructor(P,D,N){if(this._extensions=D||{},N)this._generateMask=N,this._maskBuffer=Buffer.alloc(4);this._socket=P,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=E,this.onerror=a,this[l]=void 0}static frame(P,D){let N,F=!1,G=2,B=!1;if(D.mask){if(N=D.maskBuffer||p,D.generateMask)D.generateMask(N);else{if(S===_){if(y===void 0)y=Buffer.alloc(_);n(y,0,_),S=0}N[0]=y[S++],N[1]=y[S++],N[2]=y[S++],N[3]=y[S++]}B=(N[0]|N[1]|N[2]|N[3])===0,G=6}let Q;if(typeof P==="string")if((!D.mask||B)&&D[g]!==void 0)Q=D[g];else P=Buffer.from(P),Q=P.length;else Q=P.length,F=D.mask&&D.readOnly&&!B;let pe=Q;if(Q>=65536)G+=8,pe=127;else if(Q>125)G+=2,pe=126;let se=Buffer.allocUnsafe(F?Q+G:G);if(se[0]=D.fin?D.opcode|128:D.opcode,D.rsv1)se[0]|=64;if(se[1]=pe,pe===126)se.writeUInt16BE(Q,2);else if(pe===127)se[2]=se[3]=0,se.writeUIntBE(Q,4,6);if(!D.mask)return Q?[se,P]:[se];if(se[1]|=128,se[G-4]=N[0],se[G-3]=N[1],se[G-2]=N[2],se[G-1]=N[3],!Q)return[se];if(B)return[se,P];if(F)return f(P,N,se,G,Q),[se];return f(P,N,P,0,Q),[se,P]}close(P,D,N,F){let G;if(P===void 0)G=s;else if(typeof P!=="number"||!u(P))throw TypeError("First argument must be a valid error code number");else if(D===void 0||!D.length)G=Buffer.allocUnsafe(2),G.writeUInt16BE(P,0);else{let Q=Buffer.byteLength(D);if(Q>123)throw RangeError("The message must not be greater than 123 bytes");if(G=Buffer.allocUnsafe(2+Q),G.writeUInt16BE(P,0),typeof D==="string")G.write(D,2);else if(o(D))G.set(D,2);else throw TypeError("Second argument must be a string or a Uint8Array")}let B={[g]:G.length,fin:!0,generateMask:this._generateMask,mask:N,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};if(this._state!==E)this.enqueue([this.dispatch,G,!1,B,F]);else this.sendFrame(A.frame(G,B),F)}ping(P,D,N){let F,G;if(typeof P==="string")F=Buffer.byteLength(P),G=!1;else if(c(P))F=P.size,G=!1;else P=h(P),F=P.length,G=h.readOnly;if(F>125)throw RangeError("The data size must not be greater than 125 bytes");let B={[g]:F,fin:!0,generateMask:this._generateMask,mask:D,maskBuffer:this._maskBuffer,opcode:9,readOnly:G,rsv1:!1};if(c(P))if(this._state!==E)this.enqueue([this.getBlobData,P,!1,B,N]);else this.getBlobData(P,!1,B,N);else if(this._state!==E)this.enqueue([this.dispatch,P,!1,B,N]);else this.sendFrame(A.frame(P,B),N)}pong(P,D,N){let F,G;if(typeof P==="string")F=Buffer.byteLength(P),G=!1;else if(c(P))F=P.size,G=!1;else P=h(P),F=P.length,G=h.readOnly;if(F>125)throw RangeError("The data size must not be greater than 125 bytes");let B={[g]:F,fin:!0,generateMask:this._generateMask,mask:D,maskBuffer:this._maskBuffer,opcode:10,readOnly:G,rsv1:!1};if(c(P))if(this._state!==E)this.enqueue([this.getBlobData,P,!1,B,N]);else this.getBlobData(P,!1,B,N);else if(this._state!==E)this.enqueue([this.dispatch,P,!1,B,N]);else this.sendFrame(A.frame(P,B),N)}send(P,D,N){let F=this._extensions[i.extensionName],G=D.binary?2:1,B=D.compress,Q,pe;if(typeof P==="string")Q=Buffer.byteLength(P),pe=!1;else if(c(P))Q=P.size,pe=!1;else P=h(P),Q=P.length,pe=h.readOnly;if(this._firstFragment){if(this._firstFragment=!1,B&&F&&F.params[F._isServer?"server_no_context_takeover":"client_no_context_takeover"])B=Q>=F._threshold;this._compress=B}else B=!1,G=0;if(D.fin)this._firstFragment=!0;let se={[g]:Q,fin:D.fin,generateMask:this._generateMask,mask:D.mask,maskBuffer:this._maskBuffer,opcode:G,readOnly:pe,rsv1:B};if(c(P))if(this._state!==E)this.enqueue([this.getBlobData,P,this._compress,se,N]);else this.getBlobData(P,this._compress,se,N);else if(this._state!==E)this.enqueue([this.dispatch,P,this._compress,se,N]);else this.dispatch(P,this._compress,se,N)}getBlobData(P,D,N,F){this._bufferedBytes+=N[g],this._state=R,P.arrayBuffer().then((G)=>{if(this._socket.destroyed){let Q=Error("The socket was closed while the blob was being read");process.nextTick(T,this,Q,F);return}this._bufferedBytes-=N[g];let B=h(G);if(!D)this._state=E,this.sendFrame(A.frame(B,N),F),this.dequeue();else this.dispatch(B,D,N,F)}).catch((G)=>{process.nextTick(C,this,G,F)})}dispatch(P,D,N,F){if(!D){this.sendFrame(A.frame(P,N),F);return}let G=this._extensions[i.extensionName];this._bufferedBytes+=N[g],this._state=b,G.compress(P,N.fin,(B,Q)=>{if(this._socket.destroyed){let pe=Error("The socket was closed while data was being compressed");T(this,pe,F);return}this._bufferedBytes-=N[g],this._state=E,N.readOnly=!1,this.sendFrame(A.frame(Q,N),F),this.dequeue()})}dequeue(){while(this._state===E&&this._queue.length){let P=this._queue.shift();this._bufferedBytes-=P[3][g],Reflect.apply(P[0],this,P.slice(1))}}enqueue(P){this._bufferedBytes+=P[3][g],this._queue.push(P)}sendFrame(P,D){if(P.length===2)this._socket.cork(),this._socket.write(P[0]),this._socket.write(P[1],D),this._socket.uncork();else this._socket.write(P[0],D)}};t.exports=w;function T(A,P,D){if(typeof D==="function")D(P);for(let N=0;N<A._queue.length;N++){let F=A._queue[N],G=F[F.length-1];if(typeof G==="function")G(P)}}function C(A,P,D){T(A,P,D),A.onerror(P)}}}),PR=ye({"../node_modules/.bun/ws@8.23.0/node_modules/ws/lib/event-target.js"(e,t){var{kForOnEventAttribute:r,kListener:n}=go(),o=Symbol("kCode"),i=Symbol("kData"),s=Symbol("kError"),l=Symbol("kMessage"),a=Symbol("kReason"),c=Symbol("kTarget"),u=Symbol("kType"),f=Symbol("kWasClean"),h=class{constructor(E){this[c]=null,this[u]=E}get target(){return this[c]}get type(){return this[u]}};Object.defineProperty(h.prototype,"target",{enumerable:!0}),Object.defineProperty(h.prototype,"type",{enumerable:!0});var g=class extends h{constructor(E,b={}){super(E);this[o]=b.code===void 0?0:b.code,this[a]=b.reason===void 0?"":b.reason,this[f]=b.wasClean===void 0?!1:b.wasClean}get code(){return this[o]}get reason(){return this[a]}get wasClean(){return this[f]}};Object.defineProperty(g.prototype,"code",{enumerable:!0}),Object.defineProperty(g.prototype,"reason",{enumerable:!0}),Object.defineProperty(g.prototype,"wasClean",{enumerable:!0});var p=class extends h{constructor(E,b={}){super(E);this[s]=b.error===void 0?null:b.error,this[l]=b.message===void 0?"":b.message}get error(){return this[s]}get message(){return this[l]}};Object.defineProperty(p.prototype,"error",{enumerable:!0}),Object.defineProperty(p.prototype,"message",{enumerable:!0});var _=class extends h{constructor(E,b={}){super(E);this[i]=b.data===void 0?null:b.data}get data(){return this[i]}};Object.defineProperty(_.prototype,"data",{enumerable:!0});var y={addEventListener(E,b,R={}){for(let T of this.listeners(E))if(!R[r]&&T[n]===b&&!T[r])return;let w;if(E==="message")w=function T(C,A){let P=new _("message",{data:A?C:C.toString()});P[c]=this,S(b,this,P)};else if(E==="close")w=function T(C,A){let P=new g("close",{code:C,reason:A.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});P[c]=this,S(b,this,P)};else if(E==="error")w=function T(C){let A=new p("error",{error:C,message:C.message});A[c]=this,S(b,this,A)};else if(E==="open")w=function T(){let C=new h("open");C[c]=this,S(b,this,C)};else return;if(w[r]=!!R[r],w[n]=b,R.once)this.once(E,w);else this.on(E,w)},removeEventListener(E,b){for(let R of this.listeners(E))if(R[n]===b&&!R[r]){this.removeListener(E,R);break}}};t.exports={CloseEvent:g,ErrorEvent:p,Event:h,EventTarget:y,MessageEvent:_};function S(E,b,R){if(typeof E==="object"&&E.handleEvent)E.handleEvent.call(E,R);else E.call(b,R)}}}),xu=ye({"../node_modules/.bun/ws@8.23.0/node_modules/ws/lib/extension.js"(e,t){var{tokenChars:r}=js();function n(s,l,a){if(s[l]===void 0)s[l]=[a];else s[l].push(a)}function o(s){let l=Object.create(null),a=Object.create(null),c=!1,u=!1,f=!1,h,g,p=-1,_=-1,y=-1,S=0;for(;S<s.length;S++)if(_=s.charCodeAt(S),h===void 0)if(y===-1&&r[_]===1){if(p===-1)p=S}else if(S!==0&&(_===32||_===9)){if(y===-1&&p!==-1)y=S}else if(_===59||_===44){if(p===-1)throw SyntaxError(`Unexpected character at index ${S}`);if(y===-1)y=S;let b=s.slice(p,y);if(_===44)n(l,b,a),a=Object.create(null);else h=b;p=y=-1}else throw SyntaxError(`Unexpected character at index ${S}`);else if(g===void 0)if(y===-1&&r[_]===1){if(p===-1)p=S}else if(_===32||_===9){if(y===-1&&p!==-1)y=S}else if(_===59||_===44){if(p===-1)throw SyntaxError(`Unexpected character at index ${S}`);if(y===-1)y=S;if(n(a,s.slice(p,y),!0),_===44)n(l,h,a),a=Object.create(null),h=void 0;p=y=-1}else if(_===61&&p!==-1&&y===-1)g=s.slice(p,S),p=y=-1;else throw SyntaxError(`Unexpected character at index ${S}`);else if(u){if(r[_]!==1)throw SyntaxError(`Unexpected character at index ${S}`);if(p===-1)p=S;else if(!c)c=!0;u=!1}else if(f)if(r[_]===1){if(p===-1)p=S}else if(_===34&&p!==-1)f=!1,y=S;else if(_===92)u=!0;else throw SyntaxError(`Unexpected character at index ${S}`);else if(_===34&&s.charCodeAt(S-1)===61)f=!0;else if(y===-1&&r[_]===1){if(p===-1)p=S}else if(p!==-1&&(_===32||_===9)){if(y===-1)y=S}else if(_===59||_===44){if(p===-1)throw SyntaxError(`Unexpected character at index ${S}`);if(y===-1)y=S;let b=s.slice(p,y);if(c)b=b.replace(/\\/g,""),c=!1;if(n(a,g,b),_===44)n(l,h,a),a=Object.create(null),h=void 0;g=void 0,p=y=-1}else throw SyntaxError(`Unexpected character at index ${S}`);if(p===-1||f||_===32||_===9)throw SyntaxError("Unexpected end of input");if(y===-1)y=S;let E=s.slice(p,y);if(h===void 0)n(l,E,a);else{if(g===void 0)n(a,E,!0);else if(c)n(a,g,E.replace(/\\/g,""));else n(a,g,E);n(l,h,a)}return l}function i(s){return Object.keys(s).map((l)=>{let a=s[l];if(!Array.isArray(a))a=[a];return a.map((c)=>[l].concat(Object.keys(c).map((u)=>{let f=c[u];if(!Array.isArray(f))f=[f];return f.map((h)=>h===!0?u:`${u}=${h}`).join("; ")})).join("; ")).join(", ")}).join(", ")}t.exports={format:i,parse:o}}}),Lu=ye({"../node_modules/.bun/ws@8.23.0/node_modules/ws/lib/websocket.js"(e,t){var r=we("events"),n=we("https"),o=we("http"),i=we("net"),s=we("querystring"),l=we("tls"),{randomBytes:a,createHash:c}=we("crypto"),{Duplex:u,Readable:f}=we("stream"),{URL:h}=we("url"),g=Vs(),p=Xv(),_=Yv(),{isBlob:y}=js(),{BINARY_TYPES:S,CLOSE_TIMEOUT:E,EMPTY_BUFFER:b,GUID:R,kForOnEventAttribute:w,kListener:T,kStatusCode:C,kWebSocket:A,NOOP:P}=go(),{EventTarget:{addEventListener:D,removeEventListener:N}}=PR(),{format:F,parse:G}=xu(),{toBuffer:B}=Tl(),Q=Symbol("kAborted"),pe=[8,13],se=["CONNECTING","OPEN","CLOSING","CLOSED"],ve=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,me=class L extends r{constructor(V,ce,ue){super();if(this._binaryType=S[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=b,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=L.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,V!==null){if(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,ce===void 0)if(!ue||ue.protocols===void 0)ce=[];else if(Array.isArray(ue.protocols))ce=ue.protocols;else ce=[ue.protocols];else if(!Array.isArray(ce))if(typeof ce==="object"&&ce!==null)if(ue=ce,ue.protocols===void 0)ce=[];else if(Array.isArray(ue.protocols))ce=ue.protocols;else ce=[ue.protocols];else ce=[ce];ue=j(this,V,ce,ue)}else this._isServer=!0;if(ue.autoPong)this._autoPong=!0,this._autoPongComplete=()=>O(this),this._pendingAutoPongs=0,this._maxPendingAutoPongs=ue.maxPendingAutoPongs|0;this._closeTimeout=ue.closeTimeout}get binaryType(){return this._binaryType}set binaryType(V){if(!S.includes(V))return;if(this._binaryType=V,this._receiver)this._receiver._binaryType=V}get bufferedAmount(){if(!this._socket)return this._bufferedAmount;return this._socket._writableState.length+this._sender._bufferedBytes}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(V,ce,ue){let ge=new p({allowSynchronousEvents:ue.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:ue.maxBufferedChunks,maxFragments:ue.maxFragments,maxPayload:ue.maxPayload,skipUTF8Validation:ue.skipUTF8Validation}),Ne=new _(V,this._extensions,ue.generateMask);if(this._receiver=ge,this._sender=Ne,this._socket=V,ge[A]=this,Ne[A]=this,V[A]=this,ge.on("conclude",be),ge.on("drain",Ce),ge.on("error",ze),ge.on("message",je),ge.on("ping",U),ge.on("pong",x),Ne.onerror=J,V.setTimeout)V.setTimeout(0);if(V.setNoDelay)V.setNoDelay();if(ce.length>0)V.unshift(ce);V.on("close",ee),V.on("data",Z),V.on("end",te),V.on("error",oe),this._readyState=L.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=L.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}if(this._extensions[g.extensionName])this._extensions[g.extensionName].cleanup();this._receiver.removeAllListeners(),this._readyState=L.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(V,ce){if(this.readyState===L.CLOSED)return;if(this.readyState===L.CONNECTING){K(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===L.CLOSING){if(this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted))this._socket.end();return}this._sender.close(V,ce,!this._isServer,(ue)=>{if(ue)return;if(this._closeFrameSent=!0,this._closeFrameReceived||this._receiver._writableState.errorEmitted)this._socket.end()}),this._readyState=L.CLOSING,Y(this)}pause(){if(this.readyState===L.CONNECTING||this.readyState===L.CLOSED)return;this._paused=!0,this._socket.pause()}ping(V,ce,ue){if(this.readyState===L.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof V==="function")ue=V,V=ce=void 0;else if(typeof ce==="function")ue=ce,ce=void 0;if(typeof V==="number")V=V.toString();if(this.readyState!==L.OPEN){W(this,V,ue);return}if(ce===void 0)ce=!this._isServer;this._sender.ping(V||b,ce,ue)}pong(V,ce,ue){if(this.readyState===L.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof V==="function")ue=V,V=ce=void 0;else if(typeof ce==="function")ue=ce,ce=void 0;if(typeof V==="number")V=V.toString();if(this.readyState!==L.OPEN){W(this,V,ue);return}if(ce===void 0)ce=!this._isServer;this._sender.pong(V||b,ce,ue)}resume(){if(this.readyState===L.CONNECTING||this.readyState===L.CLOSED)return;if(this._paused=!1,!this._receiver._writableState.needDrain)this._socket.resume()}send(V,ce,ue){if(this.readyState===L.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof ce==="function")ue=ce,ce={};if(typeof V==="number")V=V.toString();if(this.readyState!==L.OPEN){W(this,V,ue);return}let ge={binary:typeof V!=="string",mask:!this._isServer,compress:!0,fin:!0,...ce};if(!this._extensions[g.extensionName])ge.compress=!1;this._sender.send(V||b,ge,ue)}terminate(){if(this.readyState===L.CLOSED)return;if(this.readyState===L.CONNECTING){K(this,this._req,"WebSocket was closed before the connection was established");return}if(this._socket)this._readyState=L.CLOSING,this._socket.destroy()}};Object.defineProperty(me,"CONNECTING",{enumerable:!0,value:se.indexOf("CONNECTING")}),Object.defineProperty(me.prototype,"CONNECTING",{enumerable:!0,value:se.indexOf("CONNECTING")}),Object.defineProperty(me,"OPEN",{enumerable:!0,value:se.indexOf("OPEN")}),Object.defineProperty(me.prototype,"OPEN",{enumerable:!0,value:se.indexOf("OPEN")}),Object.defineProperty(me,"CLOSING",{enumerable:!0,value:se.indexOf("CLOSING")}),Object.defineProperty(me.prototype,"CLOSING",{enumerable:!0,value:se.indexOf("CLOSING")}),Object.defineProperty(me,"CLOSED",{enumerable:!0,value:se.indexOf("CLOSED")}),Object.defineProperty(me.prototype,"CLOSED",{enumerable:!0,value:se.indexOf("CLOSED")}),["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach((L)=>{Object.defineProperty(me.prototype,L,{enumerable:!0})}),["open","error","close","message"].forEach((L)=>{Object.defineProperty(me.prototype,`on${L}`,{enumerable:!0,get(){for(let V of this.listeners(L))if(V[w])return V[T];return null},set(V){for(let ce of this.listeners(L))if(ce[w]){this.removeListener(L,ce);break}if(typeof V!=="function")return;this.addEventListener(L,V,{[w]:!0})}})}),me.prototype.addEventListener=D,me.prototype.removeEventListener=N,t.exports=me;function j(L,V,ce,ue){let ge={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:E,protocolVersion:pe[1],maxBufferedChunks:262144,maxFragments:16384,maxPayload:104857600,maxPendingAutoPongs:60,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...ue,socketPath:void 0,hostname:void 0,protocol:void 0,protocols:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(!pe.includes(ge.protocolVersion))throw RangeError(`Unsupported protocol version: ${ge.protocolVersion} (supported versions: ${pe.join(", ")})`);let Ne;if(V instanceof h)Ne=V;else try{Ne=new h(V)}catch{throw SyntaxError(`Invalid URL: ${V}`)}if(Ne.protocol==="http:"||Ne.protocol==="https:")Ne=new h(Ne),Ne.protocol=Ne.protocol==="http:"?"ws:":"wss:";L._url=Ne.href;let et=Ne.protocol==="wss:",He=Ne.protocol==="ws+unix:",We;if(Ne.protocol!=="ws:"&&!et&&!He)We=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`;else if(He&&!Ne.pathname)We="The URL's pathname is empty";else if(Ne.hash)We="The URL contains a fragment identifier";if(We){let Ue=SyntaxError(We);if(L._redirects===0)throw Ue;else{ne(L,Ue);return}}let St=et?443:80,Kt=a(16).toString("base64"),Xt=et?n.request:o.request,xt=new Set,It;if(ge.createConnection=ge.createConnection||(et?q:he),ge.defaultPort=ge.defaultPort||St,ge.port=Ne.port||St,ge.host=Ne.hostname.startsWith("[")?Ne.hostname.slice(1,-1):Ne.hostname,ge.headers={...ge.headers,"Sec-WebSocket-Version":ge.protocolVersion,"Sec-WebSocket-Key":Kt,Connection:"Upgrade",Upgrade:"websocket"},ge.path=Ne.pathname+Ne.search,ge.timeout=ge.handshakeTimeout,ge.perMessageDeflate)It=new g({...ge.perMessageDeflate,isServer:!1,maxPayload:ge.maxPayload}),ge.headers["Sec-WebSocket-Extensions"]=F({[g.extensionName]:It.offer()});if(ce.length){for(let Ue of ce){if(typeof Ue!=="string"||!ve.test(Ue)||xt.has(Ue))throw SyntaxError("An invalid or duplicated subprotocol was specified");xt.add(Ue)}ge.headers["Sec-WebSocket-Protocol"]=ce.join(",")}if(ge.origin)if(ge.protocolVersion<13)ge.headers["Sec-WebSocket-Origin"]=ge.origin;else ge.headers.Origin=ge.origin;if(Ne.username||Ne.password){let Ue=s.unescape(Ne.username),Ve=s.unescape(Ne.password);ge.auth=`${Ue}:${Ve}`}if(He){let Ue=ge.path.indexOf(":");if(Ue===-1)ge.socketPath=ge.path,ge.path="";else ge.socketPath=ge.path.slice(0,Ue),ge.path=ge.path.slice(Ue+1)}let at;if(ge.followRedirects){if(L._redirects===0){L._originalIpc=He,L._originalSecure=et,L._originalHostOrSocketPath=He?ge.socketPath:Ne.host;let Ue=ue&&ue.headers;if(ue={...ue,headers:{}},Ue)for(let[Ve,Qe]of Object.entries(Ue))ue.headers[Ve.toLowerCase()]=Qe}else if(L.listenerCount("redirect")===0){let Ue=He?L._originalIpc?ge.socketPath===L._originalHostOrSocketPath:!1:L._originalIpc?!1:Ne.host===L._originalHostOrSocketPath;if(!Ue||L._originalSecure&&!et){if(delete ge.headers.authorization,delete ge.headers.cookie,!Ue)delete ge.headers.host;ge.auth=void 0}}if(ge.auth&&!ue.headers.authorization)ue.headers.authorization="Basic "+Buffer.from(ge.auth).toString("base64");if(at=L._req=Xt(ge),L._redirects)L.emit("redirect",L.url,at)}else at=L._req=Xt(ge);if(ge.timeout)at.on("timeout",()=>{K(L,at,"Opening handshake has timed out")});if(at.on("error",(Ue)=>{if(at===null||at[Q])return;at=L._req=null,ne(L,Ue)}),at.on("response",(Ue)=>{let Ve=Ue.headers.location,Qe=Ue.statusCode;if(Ve&&ge.followRedirects&&Qe>=300&&Qe<400){if(++L._redirects>ge.maxRedirects){K(L,at,"Maximum redirects exceeded");return}at.abort();let or;try{or=new h(Ve,V)}catch(Lt){let Dt=SyntaxError(`Invalid URL: ${Ve}`);ne(L,Dt);return}j(L,or,ce,ue)}else if(!L.emit("unexpected-response",at,Ue))K(L,at,`Unexpected server response: ${Ue.statusCode}`)}),at.on("upgrade",(Ue,Ve,Qe)=>{if(L.emit("upgrade",Ue),L.readyState!==me.CONNECTING)return;at=L._req=null;let or=Ue.headers.upgrade;if(or===void 0||or.toLowerCase()!=="websocket"){K(L,Ve,"Invalid Upgrade header");return}let Lt=c("sha1").update(Kt+R).digest("base64");if(Ue.headers["sec-websocket-accept"]!==Lt){K(L,Ve,"Invalid Sec-WebSocket-Accept header");return}let Dt=Ue.headers["sec-websocket-protocol"],ir;if(Dt!==void 0){if(!xt.size)ir="Server sent a subprotocol but none was requested";else if(!xt.has(Dt))ir="Server sent an invalid subprotocol"}else if(xt.size)ir="Server sent no subprotocol";if(ir){K(L,Ve,ir);return}if(Dt)L._protocol=Dt;let sr=Ue.headers["sec-websocket-extensions"];if(sr!==void 0){if(!It){K(L,Ve,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let Rr;try{Rr=G(sr)}catch(Er){K(L,Ve,"Invalid Sec-WebSocket-Extensions header");return}let Sr=Object.keys(Rr);if(Sr.length!==1||Sr[0]!==g.extensionName){K(L,Ve,"Server indicated an extension that was not requested");return}try{It.accept(Rr[g.extensionName])}catch(Er){K(L,Ve,"Invalid Sec-WebSocket-Extensions header");return}L._extensions[g.extensionName]=It}L.setSocket(Ve,Qe,{allowSynchronousEvents:ge.allowSynchronousEvents,generateMask:ge.generateMask,maxBufferedChunks:ge.maxBufferedChunks,maxFragments:ge.maxFragments,maxPayload:ge.maxPayload,skipUTF8Validation:ge.skipUTF8Validation})}),ge.finishRequest)ge.finishRequest(at,L);else at.end();return ge}function ne(L,V){L._readyState=me.CLOSING,L._errorEmitted=!0,L.emit("error",V),L.emitClose()}function he(L){return L.path=L.socketPath,i.connect(L)}function q(L){if(L.path=void 0,!L.servername&&L.servername!=="")L.servername=i.isIP(L.host)?"":L.host;return l.connect(L)}function K(L,V,ce){L._readyState=me.CLOSING;let ue=Error(ce);if(Error.captureStackTrace(ue,K),V.setHeader){if(V[Q]=!0,V.abort(),V.socket&&!V.socket.destroyed)V.socket.destroy();process.nextTick(ne,L,ue)}else V.destroy(ue),V.once("error",L.emit.bind(L,"error")),V.once("close",L.emitClose.bind(L))}function W(L,V,ce){if(V){let ue=y(V)?V.size:B(V).length;if(L._socket)L._sender._bufferedBytes+=ue;else L._bufferedAmount+=ue}if(ce){let ue=Error(`WebSocket is not open: readyState ${L.readyState} (${se[L.readyState]})`);process.nextTick(ce,ue)}}function be(L,V){let ce=this[A];if(ce._closeFrameReceived=!0,ce._closeCode=L,V.length===0)ce._closeMessage=b;else ce._closeMessage=Buffer.allocUnsafeSlow(V.length),ce._closeMessage.set(V);if(ce._socket[A]===void 0)return;if(ce._socket.removeListener("data",Z),process.nextTick(H,ce._socket),L===1005)ce.close();else ce.close(L,V)}function Ce(){let L=this[A];if(!L.isPaused)L._socket.resume()}function ze(L){let V=this[A];if(V._socket[A]!==void 0)V._socket.removeListener("data",Z),process.nextTick(H,V._socket),V.close(L[C]);if(!V._errorEmitted)V._errorEmitted=!0,V.emit("error",L)}function Ie(){this[A].emitClose()}function je(L,V){this[A].emit("message",L,V)}function U(L){let V=this[A];if(V._autoPong&&V.readyState===me.OPEN)if(V._maxPendingAutoPongs>0&&V._pendingAutoPongs>=V._maxPendingAutoPongs)V.terminate();else V._pendingAutoPongs++,V.pong(L,!this._isServer,V._autoPongComplete);V.emit("ping",L)}function O(L){L._pendingAutoPongs--}function x(L){this[A].emit("pong",L)}function H(L){L.resume()}function J(L){let V=this[A];if(V.readyState===me.CLOSED)return;if(V.readyState===me.OPEN)V._readyState=me.CLOSING,Y(V);if(this._socket.end(),!V._errorEmitted)V._errorEmitted=!0,V.emit("error",L)}function Y(L){L._closeTimer=setTimeout(L._socket.destroy.bind(L._socket),L._closeTimeout)}function ee(){let L=this[A];if(this.removeListener("close",ee),this.removeListener("data",Z),this.removeListener("end",te),L._readyState=me.CLOSING,!this._readableState.endEmitted&&!L._closeFrameReceived&&!L._receiver._writableState.errorEmitted&&this._readableState.length!==0){let V=this.read(this._readableState.length);L._receiver.write(V)}if(L._receiver.end(),this[A]=void 0,clearTimeout(L._closeTimer),L._receiver._writableState.finished||L._receiver._writableState.errorEmitted)L.emitClose();else L._receiver.on("error",Ie),L._receiver.on("finish",Ie)}function Z(L){if(!this[A]._receiver.write(L))this.pause()}function te(){let L=this[A];L._readyState=me.CLOSING,L._receiver.end(),this.end()}function oe(){let L=this[A];if(this.removeListener("error",oe),this.on("error",P),L)L._readyState=me.CLOSING,this.destroy()}}}),kR=ye({"../node_modules/.bun/ws@8.23.0/node_modules/ws/lib/stream.js"(e,t){var r=Lu(),{Duplex:n}=we("stream");function o(a){a.emit("close")}function i(){if(!this.destroyed&&this._writableState.finished)this.destroy()}function s(a){if(this.removeListener("error",s),this.destroy(),this.listenerCount("error")===0)this.emit("error",a)}function l(a,c){let u=!0,f=new n({...c,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return a.on("message",function h(g,p){let _=!p&&f._readableState.objectMode?g.toString():g;if(!f.push(_))a.pause()}),a.once("error",function h(g){if(f.destroyed)return;u=!1,f.destroy(g)}),a.once("close",function h(){if(f.destroyed)return;f.push(null)}),f._destroy=function(h,g){if(a.readyState===a.CLOSED){g(h),process.nextTick(o,f);return}let p=!1;if(a.once("error",function _(y){p=!0,g(y)}),a.once("close",function _(){if(!p)g(h);process.nextTick(o,f)}),u)a.terminate()},f._final=function(h){if(a.readyState===a.CONNECTING){a.once("open",function g(){f._final(h)});return}if(a._socket===null)return;if(a._socket._writableState.finished){if(h(),f._readableState.endEmitted)f.destroy()}else a._socket.once("finish",function g(){h()}),a.close()},f._read=function(){if(a.isPaused)a.resume()},f._write=function(h,g,p){if(a.readyState===a.CONNECTING){a.once("open",function _(){f._write(h,g,p)});return}a.send(h,p)},f.on("end",i),f.on("error",s),f}t.exports=l}}),Zv=ye({"../node_modules/.bun/ws@8.23.0/node_modules/ws/lib/subprotocol.js"(e,t){var{tokenChars:r}=js();function n(o){let i=new Set,s=-1,l=-1,a=0;for(a;a<o.length;a++){let u=o.charCodeAt(a);if(l===-1&&r[u]===1){if(s===-1)s=a}else if(a!==0&&(u===32||u===9)){if(l===-1&&s!==-1)l=a}else if(u===44){if(s===-1)throw SyntaxError(`Unexpected character at index ${a}`);if(l===-1)l=a;let f=o.slice(s,l);if(i.has(f))throw SyntaxError(`The "${f}" subprotocol is duplicated`);i.add(f),s=l=-1}else throw SyntaxError(`Unexpected character at index ${a}`)}if(s===-1||l!==-1)throw SyntaxError("Unexpected end of input");let c=o.slice(s,a);if(i.has(c))throw SyntaxError(`The "${c}" subprotocol is duplicated`);return i.add(c),i}t.exports={parse:n}}}),NR=ye({"../node_modules/.bun/ws@8.23.0/node_modules/ws/lib/websocket-server.js"(e,t){var r=we("events"),n=we("http"),{Duplex:o}=we("stream"),{createHash:i}=we("crypto"),s=xu(),l=Vs(),a=Zv(),c=Lu(),{CLOSE_TIMEOUT:u,GUID:f,kWebSocket:h}=go(),g=/^[+/0-9A-Za-z]{22}==$/,p=0,_=1,y=2,S=class extends r{constructor(C,A){super();if(C={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:262144,maxFragments:16384,maxPayload:104857600,maxPendingAutoPongs:60,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:u,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:c,...C},C.port==null&&!C.server&&!C.noServer||C.port!=null&&(C.server||C.noServer)||C.server&&C.noServer)throw TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(C.port!=null)this._server=n.createServer((P,D)=>{let N=n.STATUS_CODES[426];D.writeHead(426,{"Content-Length":N.length,"Content-Type":"text/plain"}),D.end(N)}),this._server.listen(C.port,C.host,C.backlog,A);else if(C.server)this._server=C.server;if(this._server){let P=this.emit.bind(this,"connection");this._removeListeners=E(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(D,N,F)=>{this.handleUpgrade(D,N,F,P)}})}if(C.perMessageDeflate===!0)C.perMessageDeflate={};if(C.clientTracking)this.clients=new Set,this._shouldEmitClose=!1;this.options=C,this._state=p}address(){if(this.options.noServer)throw Error('The server is operating in "noServer" mode');if(!this._server)return null;return this._server.address()}close(C){if(this._state===y){if(C)this.once("close",()=>{C(Error("The server is not running"))});process.nextTick(b,this);return}if(C)this.once("close",C);if(this._state===_)return;if(this._state=_,this.options.noServer||this.options.server){if(this._server)this._removeListeners(),this._removeListeners=this._server=null;if(this.clients)if(!this.clients.size)process.nextTick(b,this);else this._shouldEmitClose=!0;else process.nextTick(b,this)}else{let A=this._server;this._removeListeners(),this._removeListeners=this._server=null,A.close(()=>{b(this)})}}shouldHandle(C){if(this.options.path){let A=C.url.indexOf("?");if((A!==-1?C.url.slice(0,A):C.url)!==this.options.path)return!1}return!0}handleUpgrade(C,A,P,D){A.on("error",R);let N=C.headers["sec-websocket-key"],F=C.headers.upgrade,G=+C.headers["sec-websocket-version"];if(C.method!=="GET"){T(this,C,A,405,"Invalid HTTP method");return}if(F===void 0||F.toLowerCase()!=="websocket"){T(this,C,A,400,"Invalid Upgrade header");return}if(N===void 0||!g.test(N)){T(this,C,A,400,"Missing or invalid Sec-WebSocket-Key header");return}if(G!==13&&G!==8){T(this,C,A,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(C)){w(A,400);return}let B=C.headers["sec-websocket-protocol"],Q=new Set;if(B!==void 0)try{Q=a.parse(B)}catch(ve){T(this,C,A,400,"Invalid Sec-WebSocket-Protocol header");return}let pe=C.headers["sec-websocket-extensions"],se={};if(this.options.perMessageDeflate&&pe!==void 0){let ve=new l({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let me=s.parse(pe);if(me[l.extensionName])ve.accept(me[l.extensionName]),se[l.extensionName]=ve}catch(me){T(this,C,A,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let ve={origin:C.headers[`${G===8?"sec-websocket-origin":"origin"}`],secure:!!(C.socket.authorized||C.socket.encrypted),req:C};if(this.options.verifyClient.length===2){this.options.verifyClient(ve,(me,j,ne,he)=>{if(!me)return w(A,j||401,ne,he);this.completeUpgrade(se,N,Q,C,A,P,D)});return}if(!this.options.verifyClient(ve))return w(A,401)}this.completeUpgrade(se,N,Q,C,A,P,D)}completeUpgrade(C,A,P,D,N,F,G){if(!N.readable||!N.writable)return N.destroy();if(N[h])throw Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>p)return w(N,503);let Q=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${i("sha1").update(A+f).digest("base64")}`],pe=new this.options.WebSocket(null,void 0,this.options);if(P.size){let se=this.options.handleProtocols?this.options.handleProtocols(P,D):P.values().next().value;if(se)Q.push(`Sec-WebSocket-Protocol: ${se}`),pe._protocol=se}if(C[l.extensionName]){let se=C[l.extensionName].params,ve=s.format({[l.extensionName]:[se]});Q.push(`Sec-WebSocket-Extensions: ${ve}`),pe._extensions=C}if(this.emit("headers",Q,D),N.write(Q.concat(`\r
55
+ `).join(`\r
56
+ `)),N.removeListener("error",R),pe.setSocket(N,F,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxBufferedChunks:this.options.maxBufferedChunks,maxFragments:this.options.maxFragments,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients)this.clients.add(pe),pe.on("close",()=>{if(this.clients.delete(pe),this._shouldEmitClose&&!this.clients.size)process.nextTick(b,this)});G(pe,D)}};t.exports=S;function E(C,A){for(let P of Object.keys(A))C.on(P,A[P]);return function P(){for(let D of Object.keys(A))C.removeListener(D,A[D])}}function b(C){C._state=y,C.emit("close")}function R(){this.destroy()}function w(C,A,P,D){P=P||n.STATUS_CODES[A],D={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(P),...D},C.once("finish",C.destroy),C.end(`HTTP/1.1 ${A} ${n.STATUS_CODES[A]}\r
57
+ `+Object.keys(D).map((N)=>`${N}: ${D[N]}`).join(`\r
58
+ `)+`\r
59
+ \r
60
+ `+P)}function T(C,A,P,D,N,F){if(C.listenerCount("wsClientError")){let G=Error(N);Error.captureStackTrace(G,T),C.emit("wsClientError",G,P,A)}else w(P,D,N,F)}}}),{create:MR,defineProperty:Wa,getOwnPropertyDescriptor:DR,getOwnPropertyNames:$R,getPrototypeOf:xR}=Object,LR=Object.prototype.hasOwnProperty,Se=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),qR=(e,t)=>{let r={};for(var n in e)Wa(r,n,{get:e[n],enumerable:!0});if(t)Wa(r,Symbol.toStringTag,{value:"Module"});return r},UR=(e,t,r,n)=>{if(t&&typeof t==="object"||typeof t==="function"){for(var o=$R(t),i=0,s=o.length,l;i<s;i++)if(l=o[i],!LR.call(e,l)&&l!==r)Wa(e,l,{get:((a)=>t[a]).bind(null,l),enumerable:!(n=DR(t,l))||n.enumerable})}return e},Qv=(e,t,r)=>(r=e!=null?MR(xR(e)):{},UR(t||!e||!e.__esModule?Wa(r,"default",{value:e,enumerable:!0}):r,e)),FR=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),e_=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),GR=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),BR=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function HR(e){return typeof e==="string"&&e_.has(e.replace(/#$/,""))}function zR(e,t){if(!("$schema"in e)||typeof e.$schema!=="string")return"2020-12";let r=e.$schema.replace(/#$/,"");if(FR.has(r))return"2020-12";if(e_.has(r))return"2019-09";if(GR.has(r)||BR.has(r))return"draft-7";throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${e.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${t}`)}var rt={};Gs(rt,{BIGINT_FORMAT_RANGES:()=>d_,CONSTANT_CATCH:()=>y_,Class:()=>wA,NUMBER_FORMAT_RANGES:()=>Fu,aborted:()=>ln,allowsEval:()=>l_,assert:()=>XR,assertEqual:()=>VR,assertIs:()=>JR,assertNever:()=>KR,assertNotEqual:()=>jR,assignProp:()=>Wr,attachSchema:()=>Xa,base64ToUint8Array:()=>m_,base64urlToUint8Array:()=>yA,cached:()=>Ws,captureStackTrace:()=>qu,cleanEnum:()=>_A,cleanRegex:()=>Cl,clone:()=>qn,cloneDef:()=>eA,codePointLength:()=>Il,constantCatch:()=>PA,createTransparentProxy:()=>lA,defineLazy:()=>n_,defineLazyInternal:()=>gt,derived:()=>TA,esc:()=>s_,escapeRegex:()=>qo,explicitlyAborted:()=>p_,extend:()=>dA,finalizeIssue:()=>$n,floatSafeRemainder:()=>r_,getElementAtPath:()=>tA,getEnumValues:()=>Ja,getLengthableOrigin:()=>Pl,getParsedType:()=>sA,getSizableOrigin:()=>gA,hexToUint8Array:()=>EA,hide:()=>__,installLazyProp:()=>IA,isObject:()=>ki,isPlainObject:()=>Lo,issue:()=>Ya,joinValues:()=>Kc,jsonStringifyReplacer:()=>Ka,members:()=>v_,merge:()=>pA,mergeDefs:()=>Ln,normalizeParams:()=>Fe,nullish:()=>t_,numKeys:()=>iA,objectClone:()=>ZR,omit:()=>uA,optionalKeys:()=>u_,own:()=>Uo,parsedType:()=>h_,partial:()=>hA,pick:()=>cA,prefixIssues:()=>Po,primitiveTypes:()=>aA,promiseAllObject:()=>rA,propertyKeyTypes:()=>c_,randomString:()=>nA,rawShape:()=>Rl,required:()=>mA,safeExtend:()=>fA,shallowClone:()=>oA,sizeCaps:()=>Xc,slugify:()=>a_,stringifyPrimitive:()=>Uu,toZod:()=>WR,uint8ArrayToBase64:()=>g_,uint8ArrayToBase64url:()=>SA,uint8ArrayToHex:()=>bA,unwrapMessage:()=>vi});function VR(e){return e}function jR(e){return e}function WR(){return(e)=>e}function JR(e){}function KR(e){throw Error("Unexpected value in exhaustive check")}function XR(e){}function Ja(e){let t=Object.values(e).filter((n)=>typeof n==="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Kc(e,t="|"){return e.map((r)=>Uu(r)).join(t)}function Ka(e,t){if(typeof t==="bigint")return t.toString();return t}var YR=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}};function Ws(e){return new YR(e)}function t_(e){return e===null||e===void 0}function Cl(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function r_(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-n)<o)return 0;return r-n}var gp=Symbol("evaluating");function n_(e,t,r){let n=void 0;Object.defineProperty(e,t,{get(){if(n===gp)return;if(n===void 0)n=gp,n=r();return n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function ZR(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Wr(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Rl(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function Dn(e){return Rl(e._zod.def)??e._zod.def.shape}function o_(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return Wr(this,t,n),n},enumerable:!0,configurable:!0})}function i_(e,t,r){if(t in e)Wr(e,t,r);else e[t]=r}function xo(e,t,r,n){let o=Dn(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(o,i);if(!s.enumerable)continue;if(s.get)o_(e,i,()=>{let l=t._zod.def.shape[i];return n?n(l,i):l});else i_(e,i,n?n(s.value,i):s.value)}}function QR(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);if(!n.enumerable)continue;if(n.get)o_(e,r,()=>t[r]);else i_(e,r,n.value)}}function Ln(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function eA(e){return Ln(e._zod.def)}function tA(e,t){if(!t)return e;return t.reduce((r,n)=>r?.[n],e)}function rA(e){let t=Object.keys(e),r=t.map((n)=>e[n]);return Promise.all(r).then((n)=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=n[i];return o})}function nA(e=10){let r="";for(let n=0;n<e;n++)r+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return r}function s_(e){return JSON.stringify(e)}function a_(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var qu="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ki(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var l_=Ws(()=>{if(jr.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Lo(e){if(ki(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(ki(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function oA(e){if(Lo(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}function iA(e){let t=0;for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r))t++;return t}var sA=(e)=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(e))return"array";if(e===null)return"null";if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return"promise";if(typeof Map<"u"&&e instanceof Map)return"map";if(typeof Set<"u"&&e instanceof Set)return"set";if(typeof Date<"u"&&e instanceof Date)return"date";if(typeof File<"u"&&e instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${t}`)}},c_=new Set(["string","number","symbol"]),aA=new Set(["string","number","bigint","boolean","symbol","undefined"]);function qo(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function qn(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function Fe(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function lA(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function Uu(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function u_(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Fu=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),d_={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function cA(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i={};return xo(i,e,Al(e,t)),qn(e,Ln(r,{shape:i,checks:[]}))}function Al(e,t){let r=Dn(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw Error(`Unrecognized key: "${String(o)}"`);if(t[o])n.push(o)}return n}function uA(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(Al(e,t)),s={};return xo(s,e,Reflect.ownKeys(Dn(e)).filter((l)=>!i.has(l))),qn(e,Ln(r,{shape:s,checks:[]}))}function dA(e,t){if(!Lo(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=Dn(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return qn(e,Ln(e._zod.def,{shape:f_(e,t)}))}function f_(e,t){let r={};return xo(r,e,Reflect.ownKeys(Dn(e))),QR(r,t),r}function fA(e,t){if(!Lo(t))throw Error("Invalid input to safeExtend: expected a plain object");return qn(e,Ln(e._zod.def,{shape:f_(e,t)}))}function pA(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};xo(r,e,Reflect.ownKeys(Dn(e))),xo(r,t,Reflect.ownKeys(Dn(t)));let n=Ln(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return qn(e,n)}function hA(e,t,r,n="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${n}() cannot be used on object schemas containing refinements`);let l=r?new Set(Al(t,r)):void 0,a={};return xo(a,t,Reflect.ownKeys(Dn(t)),e&&((c,u)=>l&&!l.has(u)?c:new e({type:"optional",innerType:c}))),qn(t,Ln(t._zod.def,{shape:a,checks:[]}))}function mA(e,t,r){let n=r?new Set(Al(t,r)):void 0,o={};return xo(o,t,Reflect.ownKeys(Dn(t)),(i,s)=>n&&!n.has(s)?i:new e({type:"nonoptional",innerType:i})),qn(t,Ln(t._zod.def,{shape:o}))}function ln(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function p_(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function Po(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function vi(e){return typeof e==="string"?e:e?.message}function Xc(e){let t=[];for(let r of e??[]){let n=r._zod.def;if(!/_(length|size)$|_equals$/.test(n.check))break;let o=n.maximum??n.length??n.size;if(o>=0)t.push([o,r])}return t}function Xa(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function $n(e,t,r){var n;let o=e.inst?._zod?.traits;if(o?.has("$ZodType"))if(o.has("$ZodCheck"))(n=e).schema??(n.schema=e.inst);else e.schema=e.inst;let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:vi(e.inst?._zod.def?.error?.(e))??vi(i?.(e))??vi(t?.error?.(e))??vi(r.customError?.(e))??vi(r.localeError?.(e))??"Invalid input",l={};for(let a of Object.keys(e)){if(a==="inst"||a==="schema"||a==="continue"||a==="input"||a==="__proto__")continue;l[a]=e[a]}if(l.path??(l.path=[]),l.message=s,t?.reportInput)l.input=e.input;return l}function gA(e){if(e instanceof Set)return"set";if(e instanceof Map)return"map";if(e instanceof File)return"file";return"unknown"}var vA=/[\uD800-\uDBFF]/;function Il(e){let t=e.length;if(!vA.test(e))return t;let r=t;for(let n=0;n<t-1;n++)if((e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320)r--,n++;return r}function Pl(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function h_(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Ya(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}function _A(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map((t)=>t[1])}function m_(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function g_(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function yA(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return m_(t+r)}function SA(e){return g_(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function EA(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function bA(e){return Array.from(e).map((t)=>t.toString(16).padStart(2,"0")).join("")}var wA=class{constructor(...e){}};function v_(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);if(n.get)Object.defineProperty(e,r,{...n,enumerable:!1});else CA(e,r,n.value)}}function Uo(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function __(e,t,r){return Uo(e,t,r,!1)}function TA(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return Uo(this,r,n(this))},set(o){Uo(this,r,o)}})}return t}function CA(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:Uo(this,t,r.bind(this))},set(n){Uo(this,t,n)}})}function RA(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var kc,lo=!1,AA={configurable:!0,get(){lo=!0;return}};function gt(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&kc!==e._zod){kc=void 0;return}kc=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,AA);let o=lo;lo=!1;try{let i=r(this);if(lo)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i});return lo=lo||o,i}catch(i){throw delete this[t],lo=lo||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function IA(e,t,r,n){let o=RA(e,t);if(!o)return;Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,i),i.value=r(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:i})}})}var y_="~constantCatch";function PA(e){let t=()=>e;return t[y_]=!0,t}var vp,kA=Object.freeze({status:"aborted"}),Nc={value:void 0,enumerable:!1},_p="captureStackTrace"in Error?Error:null;function NA(e){let t=_p;if(t){let r=t.stackTraceLimit;if(typeof r==="number"){try{t.stackTraceLimit=0}catch{return _p=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function fe(e,t,r,n){let o={};function i(h){this.def=h,this.constr=f,this.traits=new Set}i.prototype=o;let s=r,l=s&&new WeakSet;function a(h,g){if(!h._zod){Nc.value=new i(g);try{Object.defineProperty(h,"_zod",Nc)}finally{Nc.value=void 0}}else if(h._zod.traits.has(e))return;if(h._zod.traits.add(e),t(h,g),l){let _=Object.getPrototypeOf(h),y=h._zod.constr.prototype,S=_;while(S&&S!==y)S=Object.getPrototypeOf(S);let E=S??_;if(!l.has(E))l.add(E),v_(E,s)}let p=f.prototype;for(let _ in p){if(!Object.prototype.hasOwnProperty.call(p,_))continue;if(!(_ in h))h[_]=p[_].bind(h)}}let c=n?.Parent??Object;class u extends c{}Object.defineProperty(u,"name",{value:e});function f(h){let g=n?.Parent?NA(u):this;a(g,h);let p=g._zod.deferred;if(p){for(let y of p)y();g._zod.deferred=void 0}let _=globalThis.__zod_globalConfig?.postProcessor;if(_)_(g);return g}return Object.defineProperty(f,"init",{value:a}),Object.defineProperty(f,Symbol.hasInstance,{value:(h)=>{if(n?.Parent&&h instanceof n.Parent)return!0;return h?._zod?.traits?.has(e)}}),Object.defineProperty(f,"name",{value:e}),f}var Oo=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},S_=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}};(vp=globalThis).__zod_globalConfig??(vp.__zod_globalConfig={});var jr=globalThis.__zod_globalConfig;function cn(e){if(e)Object.assign(jr,e);return jr}function OA(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Ka,2)),e.message}function MA(e){this._zod.message=e}var DA={get:OA,set:MA,enumerable:!0,configurable:!0},Oc={value:void 0,enumerable:!1},yp=new WeakSet([Object.prototype,Error.prototype]),E_=(e,t)=>{e.name="$ZodError",Oc.value=t,Object.defineProperty(e,"issues",Oc),Oc.value=void 0,Object.defineProperty(e,"message",DA);let r=Object.getPrototypeOf(e);if(!yp.has(r))yp.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}})},$A=fe("$ZodError",E_),rj=fe("$ZodError",E_,void 0,{Parent:Error});function xA(e,t,r){if(!Object.prototype.hasOwnProperty.call(e,t))if(t==="__proto__")Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0});else e[t]=r();return e[t]}function LA(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)xA(r,o.path[0],()=>[]).push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function qA(e,t=(r)=>r.message){let r={_errors:[]},n=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((l)=>n({issues:l},[...i,...s.path]));else if(s.code==="invalid_key")n({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")n({issues:s.issues},[...i,...s.path]);else{let l=[...i,...s.path];if(l.length===0)r._errors.push(t(s));else{let a=r,c=0;while(c<l.length){let u=l[c],f=c===l.length-1;if(u==="_errors"){if(f)a._errors.push(t(s));c++;continue}if(!Object.prototype.hasOwnProperty.call(a,u))Object.defineProperty(a,u,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let h=a[u];if(f)h._errors.push(t(s));a=h,c++}}}};return n(e),r}function kl(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Gu=(e)=>{let t=(r,n,o,i)=>{let s=o?{...o,async:!1}:{async:!1},l=r._zod.run({value:n,issues:[]},s);if(l instanceof Promise)throw new Oo;if(l.issues.length){let a=new(i?.Err??e)(l.issues.map((c)=>$n(c,s,cn())));throw qu(a,i?.callee??t),a}return l.value};return t},Bu=(e)=>{let t=async(r,n,o,i)=>{let s=o?{...o,async:!0}:{async:!0},l=r._zod.run({value:n,issues:[]},s);if(l instanceof Promise)l=await l;if(l.issues.length){let a=new(i?.Err??e)(l.issues.map((c)=>$n(c,s,cn())));throw qu(a,i?.callee??t),a}return l.value};return t},Hu=(e)=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new Oo;return i.issues.length?b_(e,i.issues,o):{success:!0,data:i.value}};function b_(e,t,r){let n;return{success:!1,get error(){if(!n)n=new e(t.map((o)=>$n(o,r,cn()))),t=void 0,r=void 0;return n},set error(o){n=o,t=void 0,r=void 0}}}var zu=(e)=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)i=await i;return i.issues.length?b_(e,i.issues,o):{success:!0,data:i.value}},UA=Symbol.for("zod.compile.invalid"),FA=Symbol.for("zod.compile.fallback"),GA=(e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==UA)return!0;if(n.definite===!0&&r===void 0)return!1}return BA(e,t,r)};function BA(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o)n[FA]=!0,i=o({value:t,issues:[]},n);else i=e._zod.run({value:t,issues:[]},n);if(i instanceof Promise)throw new Oo;return i.issues.length===0}var HA=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);if(o instanceof Promise)o=await o;return o.issues.length===0},zA=(e)=>{let t=Gu(e),r=(n,o,i,s)=>{let l=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,l,kl(r,s))};return r},VA=(e)=>{let t=Gu(e),r=(n,o,i,s)=>t(n,o,i,kl(r,s));return r},jA=(e)=>{let t=Bu(e),r=async(n,o,i,s)=>{let l=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,l,kl(r,s))};return r},WA=(e)=>{let t=Bu(e),r=async(n,o,i,s)=>await t(n,o,i,kl(r,s));return r},JA=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Hu(e)(t,r,o)},KA=(e)=>(t,r,n)=>Hu(e)(t,r,n),XA=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return zu(e)(t,r,o)},YA=(e)=>async(t,r,n)=>zu(e)(t,r,n),ZA=/^[cC][0-9a-z]{6,}$/,QA=/^[0-9a-z]+$/,eI=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,tI=/^[0-9a-vA-V]{20}$/,rI=/^[A-Za-z0-9]{27}$/,nI=/^[a-zA-Z0-9_-]{21}$/;function oI(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var iI=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,sI=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Sp=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},aI=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,lI="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function cI(){return new RegExp(lI,"u")}var uI=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,dI=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,fI=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,pI=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,hI=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,mI=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,gI=/^https?$/,vI=/^\+[1-9]\d{6,14}$/,w_="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function _I(e){return new RegExp(`^${e}$`)}var yI=_I(w_);function Yc(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function SI(e){return new RegExp(`^${Yc(e)}$`)}function EI(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${Yc({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${Yc({precision:e.precision})}`:r;return new RegExp(`^${w_}T(?:${n})$`)}var bI=/^[\s\S]{0,}$/,wI=/^-?\d+n?$/,TI=/^-?\d+$/,Vu=/^-?\d+(?:\.\d+)?$/,CI=/^(?:true|false)$/i,RI=/^null$/i,AI=/^[^A-Z]*$/,II=/^[^a-z]*$/,vr=fe("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),ju=(e)=>{let t=e.value;return!t_(t)&&t.length!==void 0},Za={number:"number",bigint:"bigint",object:"date"},T_=fe("$ZodCheckLessThan",(e,t)=>{vr.init(e,t);let r=Za[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value<=t.value:n.value<t.value)return;n.issues.push({origin:Za[typeof n.value]??r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),C_=fe("$ZodCheckGreaterThan",(e,t)=>{vr.init(e,t);let r=Za[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value>=t.value:n.value>t.value)return;n.issues.push({origin:Za[typeof n.value]??r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),PI=fe("$ZodCheckMultipleOf",(e,t)=>{vr.init(e,t),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):r_(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),kI=fe("$ZodCheckNumberFormat",(e,t)=>{vr.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Fu[t.format];e._zod.check=(s)=>{let l=s.value;if(r){if(!Number.isInteger(l)){s.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:l,inst:e});return}if(!Number.isSafeInteger(l)){if(l>0)s.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});else s.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}if(l<o)s.issues.push({origin:"number",input:l,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort});if(l>i)s.issues.push({origin:"number",input:l,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),NI=fe("$ZodCheckMaxLength",(e,t)=>{var r;vr.init(e,t),(r=e._zod.def).when??(r.when=ju),e._zod.check=(n)=>{let o=n.value,i=o.length;if((typeof o==="string"&&i>t.maximum?Il(o):i)<=t.maximum)return;let l=Pl(o);n.issues.push({origin:l,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),OI=fe("$ZodCheckMinLength",(e,t)=>{var r;vr.init(e,t),(r=e._zod.def).when??(r.when=ju),e._zod.check=(n)=>{let o=n.value,i=o.length;if((typeof o==="string"&&i>=t.minimum&&i<t.minimum*2?Il(o):i)>=t.minimum)return;let l=Pl(o);n.issues.push({origin:l,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),MI=fe("$ZodCheckLengthEquals",(e,t)=>{var r;vr.init(e,t),(r=e._zod.def).when??(r.when=ju),e._zod.check=(n)=>{let o=n.value,i=o.length,s=typeof o==="string"&&i>=t.length&&i<=t.length*2?Il(o):i;if(s===t.length)return;let l=Pl(o),a=s>t.length;n.issues.push({origin:l,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Nl=fe("$ZodCheckStringFormat",(e,t)=>{var r,n;if(vr.init(e,t),t.pattern)(r=e._zod).check??(r.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(n=e._zod).check??(n.check=()=>{})}),DI=fe("$ZodCheckRegex",(e,t)=>{Nl.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),$I=fe("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=AI),Nl.init(e,t)}),xI=fe("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=II),Nl.init(e,t)}),LI=fe("$ZodCheckIncludes",(e,t)=>{vr.init(e,t);let r=qo(t.includes),n=new RegExp(typeof t.position==="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),qI=fe("$ZodCheckStartsWith",(e,t)=>{vr.init(e,t);let r=new RegExp(`^${qo(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.startsWith(t.prefix))return;n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),UI=fe("$ZodCheckEndsWith",(e,t)=>{vr.init(e,t);let r=new RegExp(`.*${qo(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.endsWith(t.suffix))return;n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),FI=fe("$ZodCheckOverwrite",(e,t)=>{vr.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}}),GI=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
61
+ `).filter((i)=>i),n=Math.min(...r.map((i)=>i.length-i.trimStart().length)),o=r.map((i)=>i.slice(n)).map((i)=>" ".repeat(this.indent*2)+i);for(let i of o)this.content.push(i)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
62
+ ${t.join(`
63
+ `)}
64
+ };`)(...Object.values(this.closed))}},BI={major:4,minor:6,patch:7},bt=fe("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=BI;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(l,a,c)=>{if(l.memo)return l;let u=ln(l),f;for(let h of a){if(h._zod.def.when){if(p_(l))continue;if(!h._zod.def.when(l))continue}else if(u)continue;let g=l.issues.length,p=h._zod.check(l);if(p instanceof Promise&&c?.async===!1)throw new Oo;if(f||p instanceof Promise)f=(f??Promise.resolve()).then(async()=>{if(await p,l.issues.length===g)return;if(Xa(l.issues,g,e),!u)u=ln(l,g)});else{if(l.issues.length===g)continue;if(Xa(l.issues,g,e),!u)u=ln(l,g)}}if(f)return f.then(()=>l);return l},s=(l,a,c)=>{if(ln(l))return l.aborted=!0,l;let u=i(a,o,c);if(u instanceof Promise){if(c.async===!1)throw new Oo;return u.then((f)=>e._zod.parse(f,c))}return e._zod.parse(u,c)};e._zod.run=(l,a)=>{if(a.skipChecks)return e._zod.parse(l,a);if(a.direction==="backward"){let u=e._zod.parse({value:l.value,issues:[]},{...a,skipChecks:!0});if(u instanceof Promise)return u.then((f)=>s(f,l,a));return s(u,l,a)}let c=e._zod.parse(l,a);if(c instanceof Promise){if(a.async===!1)throw new Oo;return c.then((u)=>i(u,o,a))}return i(c,o,a)}}},{get "~standard"(){return __(this,"~standard",A_(this))},set "~standard"(e){Uo(this,"~standard",e)}}),R_=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>$n(r,t,cn()))}:{value:e.value};async function HI(e,t){let r={async:!0};return R_(await e._zod.run({value:t,issues:[]},r),r)}function A_(e){return{validate:(t)=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return R_(n,r)}catch(n){}return HI(e,t)},vendor:"zod",version:1}}var Wu=fe("$ZodString",(e,t)=>{bt.init(e,t),e._zod.pattern=t.pattern??bI,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(o){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Nt=fe("$ZodStringFormat",(e,t)=>{Nl.init(e,t),Wu.init(e,t)}),zI=fe("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=sI),Nt.init(e,t)}),VI=fe("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Sp(n))}else t.pattern??(t.pattern=Sp());Nt.init(e,t)}),jI=fe("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=aI),Nt.init(e,t)}),I_=1,Qa=2;function P_(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function WI(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return P_(e)||Qa;return JI(e,t)}function JI(e,t){if(!t.normalize&&t.protocol?.source===gI.source&&!/^https?:\/\//i.test(e))return I_;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse==="function")return r.parse(e)??Qa}return new URL(e)}catch{return Qa}}var KI=/[\t\n\r]/g;function Ep(e){return e.replace(KI,"")}function XI(e,t){return t.lastIndex=0,t.test(e.hostname)}function YI(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var ZI=fe("$ZodURL",(e,t)=>{Nt.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim(),o=WI(n,t);if(o===I_){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===Qa){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=Ep(n);return}if(t.hostname&&!XI(o,t.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort});if(t.protocol&&!YI(o,t.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort});r.value=t.normalize?o.href:Ep(n);return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),QI=fe("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=cI()),Nt.init(e,t)}),eP=fe("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?nI:oI(t.length)),Nt.init(e,t)}),tP=fe("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=ZA),Nt.init(e,t)}),rP=fe("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=QA),Nt.init(e,t)}),nP=fe("$ZodULID",(e,t)=>{t.pattern??(t.pattern=eI),Nt.init(e,t)}),oP=fe("$ZodXID",(e,t)=>{t.pattern??(t.pattern=tI),Nt.init(e,t)}),iP=fe("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=rI),Nt.init(e,t)}),sP=fe("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=EI(t)),Nt.init(e,t)}),aP=fe("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=yI),Nt.init(e,t)}),lP=fe("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=SI(t)),Nt.init(e,t)}),cP=fe("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=iI),Nt.init(e,t)}),uP=fe("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=uI),Nt.init(e,t)}),dP=/^[0-9a-fA-F:.]+$/;function k_(e){if(!dP.test(e))return!1;return P_(`http://[${e}]`)}var fP=fe("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=dI),Nt.init(e,t),e._zod.check=(r)=>{if(!k_(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}),pP=fe("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=fI),Nt.init(e,t)});function hP(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);if(`${o}`!==n)return!1;if(o<0||o>128)return!1;return k_(r)}var mP=fe("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=pI),Nt.init(e,t),e._zod.check=(r)=>{if(!hP(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function N_(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var O_=/^[0-9a-zA-Z+/]*={0,2}$/,gP=fe("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=O_),Nt.init(e,t),e._zod.check=(r)=>{if(N_(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),Ju=/^[A-Za-z0-9_-]*$/;function vP(e){if(!Ju.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return N_(r)}var _P=fe("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ju),Nt.init(e,t),e._zod.check=(r)=>{if(vP(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),yP=fe("$ZodE164",(e,t)=>{t.pattern??(t.pattern=vI),Nt.init(e,t)});function SP(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&(!("alg"in o)||o.alg!==t))return!1;return!0}catch{return!1}}var EP=fe("$ZodJWT",(e,t)=>{Nt.init(e,t),e._zod.check=(r)=>{if(SP(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),M_=fe("$ZodNumber",(e,t)=>{bt.init(e,t),e._zod.pattern=Vu,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(s){}let o=r.value;if(typeof o==="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o==="number"?Number.isNaN(o)?"NaN":!Number.isFinite(o)?String(o):void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),bP=fe("$ZodNumberFormat",(e,t)=>{kI.init(e,t),M_.init(e,t)}),wP=fe("$ZodBoolean",(e,t)=>{bt.init(e,t),e._zod.pattern=CI,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(i){}let o=r.value;if(typeof o==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),TP=fe("$ZodBigInt",(e,t)=>{bt.init(e,t),e._zod.pattern=wI,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch(o){}if(typeof r.value==="bigint")return r;return r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),CP=fe("$ZodNull",(e,t)=>{bt.init(e,t),e._zod.pattern=RI,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;if(o===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),RP=fe("$ZodAny",(e,t)=>{bt.init(e,t),e._zod.parse=(r)=>r}),AP=fe("$ZodUnknown",(e,t)=>{bt.init(e,t),e._zod.parse=(r)=>r}),IP=fe("$ZodNever",(e,t)=>{bt.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),PP=fe("$ZodDate",(e,t)=>{bt.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch(l){}let o=r.value,i=o instanceof Date;if(i&&!Number.isNaN(o.getTime()))return r;return r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),r}});function kP(e,t){let r=Xc(e._zod.def.checks);if(!r.length)return;let n=Math.min(...r.map((i)=>i[0])),o=e._zod.parse;e._zod.parse=(i,s)=>{let l=t(i.value);if(l>n&&!s?.skipChecks&&s?.direction!=="backward"){for(let[a,c]of Xc(e._zod.def.checks))if(l>a&&c._zod.def.when(i)){let u=i.issues.length;return c._zod.check(i),i.issues[u].continue=!1,Xa(i.issues,u,e),i}}return o(i,s)}}var NP=(e)=>Array.isArray(e)?e.length:-1;function bp(e,t,r){if(e.issues.length)t.issues.push(...Po(r,e.issues));t.value[r]=e.value}var OP=fe("$ZodArray",(e,t)=>{bt.init(e,t);let r=jr.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=r?r.alloc(e,n,Array(i.length),o):Array(i.length);let s=[],l=o?.abortEarly;for(let a=0;a<i.length;a++){let c=i[a],u=t.element._zod.run({value:c,issues:[]},o);if(u instanceof Promise)s.push(u.then((f)=>bp(f,n,a)));else if(bp(u,n,a),l&&u.issues.length!==0&&ln(u))break}if(s.length)return Promise.all(s).then(()=>n);return n},kP(e,NP)});function el(e,t,r,n,o,i){let s=r in n,l=i==="optional";if(!s&&l&&o==="optional")return;if(e.issues.length){if(o!==void 0&&l&&!s)return;t.issues.push(...Po(r,e.issues))}if(!s&&o===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(s||o==="defaulted"&&!l)t.value[r]=void 0}else t.value[r]=e.value}var MP=[];function D_(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:MP,o=n.length?[...t,...n]:t;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=u_(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function $_(e,t,r,n,o,i,s){let l=[],a=o.keySet,c=o.catchall._zod,u=c.def.type,{optin:f,optout:h}=c,g=0;for(let p in t){if(s&&r.issues.length!==g){if(ln(r,g))break;g=r.issues.length}if(a.has(p))continue;if(p==="__proto__"){if(u==="never")l.push(p);continue}if(u==="never"){l.push(p);continue}let _=c.run({value:t[p],issues:[]},n);if(_ instanceof Promise)e.push(_.then((y)=>el(y,r,p,t,f,h)));else el(_,r,p,t,f,h)}if(l.length)r.issues.push({code:"unrecognized_keys",keys:l,input:t,inst:i,continue:!0});if(!e.length)return r;return Promise.all(e).then(()=>r)}var DP=fe("$ZodObject",(e,t)=>{bt.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let c=()=>{let u={...n};return Object.defineProperty(t,"shape",{value:u}),c.raw=u,u};c.raw=n,Object.defineProperty(t,"shape",{get:c})}let o=Ws(()=>D_(t));gt(e,"propValues",(c)=>{let u=c.def.shape,f={};for(let h in u){let g=u[h]._zod;if(g.values){if(!Object.prototype.hasOwnProperty.call(f,h))Wr(f,h,new Set);for(let p of g.values)f[h].add(p);if(g.optin!==void 0)f[h].add(void 0)}}return f});let i=ki,s=t.catchall,l,a=jr.memoizer;a?.attach(e),e._zod.parse=(c,u)=>{l??(l=o.value);let f=c.value;if(!i(f))return c.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),c;c.value=a?a.alloc(e,c,{},u):{};let h=[],g=l.shape,p=u?.abortEarly,_=c.issues.length;for(let y of l.allKeys){if(p&&c.issues.length!==_){if(ln(c,_))break;_=c.issues.length}if(y==="__proto__")continue;let S=g[y],E=S._zod.optin,b=S._zod.optout,R=S._zod.run({value:f[y],issues:[]},u);if(R instanceof Promise)h.push(R.then((w)=>el(w,c,y,f,E,b)));else el(R,c,y,f,E,b)}if(!s)return h.length?Promise.all(h).then(()=>c):c;return $_(h,f,c,u,o.value,e,p===!0)}}),$P=fe("$ZodObjectJIT",(e,t)=>{DP.init(e,t);let r=e._zod.parse,n=Ws(()=>D_(t)),o=jr.memoizer,i=(g)=>{let p=n.value,_=p.symbolKeys,y=new GI(["payload","ctx"],{shape:g,inst:e,memo:o,syms:_}),S=(w)=>`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`,E=(w,T)=>`
65
+ let ${w}_ab = false;
66
+ for (let i = 0; i < ${w}.issues.length; i++) {
67
+ const iss = ${w}.issues[i];
68
+ iss.path = iss.path ? [${T}, ...iss.path] : [${T}];
69
+ payload.issues.push(iss);
70
+ if (iss.continue !== true) ${w}_ab = true;
71
+ }
72
+ if (${w}_ab && ctx && ctx.abortEarly) {
73
+ payload.value = newResult;
74
+ return payload;
75
+ }`;y.write("const input = payload.value;");let b=Object.create(null),R=0;for(let w of p.allKeys)b[w]=`key_${R++}`;y.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let w of p.allKeys){if(w==="__proto__")continue;let T=b[w],C=typeof w==="symbol"?`syms[${_.indexOf(w)}]`:s_(w),A=`${C} in input`,P=g[w],D=P?._zod?.optin,N=D!==void 0,F=P?._zod?.optout==="optional";if(y.write(`const ${T} = ${S(C)};`),N&&F){let G=D==="optional"?`${T}_present`:`${T}.value !== undefined || ${T}_present`;y.write(`
76
+ const ${T}_present = ${A};
77
+ if (!${T}.issues.length || ${T}_present) {
78
+ if (${T}.issues.length) {${E(T,C)}
79
+ }
80
+
81
+ if (${G}) {
82
+ newResult[${C}] = ${T}.value;
83
+ }
84
+ }
85
+
86
+ `)}else if(!N)y.write(`
87
+ const ${T}_present = ${A};
88
+ if (${T}.issues.length) {${E(T,C)}
89
+ }
90
+ if (!${T}_present && !${T}.issues.length) {
91
+ payload.issues.push({
92
+ code: "invalid_type",
93
+ expected: "nonoptional",
94
+ input: undefined,
95
+ path: [${C}]
96
+ });
97
+ if (ctx && ctx.abortEarly) {
98
+ payload.value = newResult;
99
+ return payload;
100
+ }
101
+ }
102
+
103
+ if (${T}_present) {
104
+ newResult[${C}] = ${T}.value;
105
+ }
106
+
107
+ `);else if(y.write(`
108
+ if (${T}.issues.length) {${E(T,C)}
109
+ }
110
+ `),D==="defaulted")y.write(`newResult[${C}] = ${T}.value;`);else y.write(`
111
+ if (${T}.value !== undefined || ${A}) {
112
+ newResult[${C}] = ${T}.value;
113
+ }
114
+ `)}return y.write("payload.value = newResult;"),y.write("return payload;"),y.compile()},s,l=ki,a=!jr.jitless,u=a&&l_.value,f=t.catchall,h;e._zod.parse=(g,p)=>{h??(h=n.value);let _=g.value;if(!l(_))return g.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),g;if(a&&u&&p?.async===!1&&p.jitless!==!0){if(!s)s=i(t.shape);if(g=s(g,p),!f)return g;return $_([],_,g,p,h,e,p?.abortEarly===!0)}return r(g,p)}});function wp(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter((i)=>!ln(i));if(o.length===1)return t.value=o[0].value,o[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((i)=>i.issues.map((s)=>$n(s,n,cn())))}),t}var x_=fe("$ZodUnion",(e,t)=>{bt.init(e,t),gt(e,"optin",(n)=>n.def.options.some((o)=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some((o)=>o._zod.optin!==void 0)?"optional":void 0),gt(e,"optout",(n)=>n.def.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),gt(e,"values",(n)=>{if(n.def.options.every((o)=>o._zod.values))return new Set(n.def.options.flatMap((o)=>Array.from(o._zod.values)));return}),gt(e,"pattern",(n)=>{if(n.def.options.every((o)=>o._zod.pattern)){let o=n.def.options.map((i)=>i._zod.pattern);return new RegExp(`^(${o.map((i)=>Cl(i.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1,s=[];for(let l of t.options){let a=l._zod.run({value:n.value,issues:[]},o);if(a instanceof Promise)s.push(a),i=!0;else{if(a.issues.length===0)return a;s.push(a)}}if(!i)return wp(s,n,e,o);return Promise.all(s).then((l)=>wp(l,n,e,o))}});function xP(e){let t=new Map;for(let r of e.options){let n=r._zod.propValues?.[e.discriminator];if(!n||n.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let o of n)if(t.has(o)){if(o!==void 0)throw Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,r)}return t}var LP=fe("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,x_.init(e,t);let r=e._zod.parse;gt(e,"propValues",(o)=>{let i={},s=0;for(let l of o.def.options){let a=l._zod.propValues;if(!a||Object.keys(a).length===0)throw Error(`Invalid discriminated union option at index "${o.def.options.indexOf(l)}"`);if(a[o.def.discriminator]?.has(void 0))s++;for(let[c,u]of Object.entries(a)){if(!Object.prototype.hasOwnProperty.call(i,c))Wr(i,c,new Set);for(let f of u)i[c].add(f)}}if(!o.def.unionFallback&&s>1)i[o.def.discriminator]?.delete(void 0);return i}),t.options.forEach((o,i)=>{let s=Rl(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw Error(`Invalid discriminated union option at index "${i}"`)});let n=Ws(()=>xP(t));e._zod.parse=(o,i)=>{let s=o.value;if(!ki(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;let l=s?.[t.discriminator],a=n.value.get(l);if(a&&(l!==void 0||i.direction!=="backward"))return a._zod.run(o,i);if(t.unionFallback||i.direction==="backward")return r(o,i);return o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter((c)=>n.value.get(c)!==null),input:s,path:[t.discriminator],inst:e}),o}}),qP=fe("$ZodIntersection",(e,t)=>{bt.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),s=t.right._zod.run({value:o,issues:[]},n);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([a,c])=>Tp(r,a,c));return Tp(r,i,s)}});function Zc(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(Lo(e)&&Lo(t)){let r=Object.keys(t),n=Object.keys(e).filter((i)=>r.indexOf(i)!==-1),o={...e,...t};if(Object.prototype.hasOwnProperty.call(o,"__proto__"))delete o.__proto__;for(let i of n){if(i==="__proto__")continue;let s=Zc(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],s=Zc(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Tp(e,t,r){let n=new Map,o,i=new Map,s=(c,u)=>{let f;if(c.code==="unrecognized_keys"&&!c.path?.length)o??(o=c),f=c.keys;else if(c.code==="invalid_key"&&c.origin==="record"&&c.path?.length===1){let h=String(c.path[0]);if(!i.has(h))i.set(h,c);f=[h]}else return!1;for(let h of f){if(!n.has(h))n.set(h,{});n.get(h)[u]=!0}return!0};for(let c of t.issues)if(!s(c,"l"))e.issues.push(c);for(let c of r.issues)if(!s(c,"r"))e.issues.push(c);let l=[...n].filter(([,c])=>c.l&&c.r).map(([c])=>c);if(l.length){let c=o?l.filter((u)=>o.keys.includes(u)):[];if(c.length)e.issues.push({...o,keys:c});for(let u of l)if(!c.includes(u)&&i.has(u))e.issues.push(i.get(u))}let a=Zc(t.value,r.value);if(!a.valid){if(ln(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`)}return e.value=a.data,e}var UP=fe("$ZodRecord",(e,t)=>{bt.init(e,t);let r=jr.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Lo(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;let s=[],l=t.keyType._zod.values;if(l&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let a=new Set;for(let u of l)if(typeof u==="string"||typeof u==="number"||typeof u==="symbol"){if(a.add(typeof u==="number"?u.toString():u),u==="__proto__")continue;let f=t.keyType._zod.run({value:u,issues:[]},o);if(f instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(f.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map((p)=>$n(p,o,cn())),input:u,path:[u],inst:e});continue}let h=f.value;if(h==="__proto__")continue;let g=t.valueType._zod.run({value:i[u],issues:[]},o);if(g instanceof Promise)s.push(g.then((p)=>{if(p.issues.length)n.issues.push(...Po(u,p.issues));n.value[h]=p.value}));else{if(g.issues.length)n.issues.push(...Po(u,g.issues));n.value[h]=g.value}}let c;for(let u in i)if(!a.has(u))if(t.mode==="loose"){if(u==="__proto__")continue;n.value[u]=i[u]}else c=c??[],c.push(u);if(c&&c.length>0)n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let a;for(let c of Reflect.ownKeys(i)){if(c==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(i,c))continue;let u=t.keyType._zod.run({value:c,issues:[]},o);if(u instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof c==="string"&&Vu.test(c)&&u.issues.length){let p=t.keyType._zod.run({value:Number(c),issues:[]},o);if(p instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(p.issues.length===0)u=p}if(u.issues.length){if(t.mode==="loose")n.value[c]=i[c];else if(l)a=a??[],a.push(c);else n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map((p)=>$n(p,o,cn())),input:c,path:[c],inst:e});continue}let h=u.value;if(h==="__proto__")continue;let g=t.valueType._zod.run({value:i[c],issues:[]},o);if(g instanceof Promise)s.push(g.then((p)=>{if(p.issues.length)n.issues.push(...Po(c,p.issues));n.value[h]=p.value}));else{if(g.issues.length)n.issues.push(...Po(c,g.issues));n.value[h]=g.value}}if(a&&a.length>0)n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:a,continue:!0})}if(s.length)return Promise.all(s).then(()=>n);return n}}),FP=fe("$ZodEnum",(e,t)=>{bt.init(e,t);let r=Ja(t.entries),n=new Set(r);e._zod.values=n,gt(e,"pattern",(o)=>{let i=Ja(o.def.entries).filter((s)=>c_.has(typeof s));return new RegExp(i.length?`^(${i.map((s)=>qo(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;if(n.has(s))return o;return o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}}),GP=fe("$ZodLiteral",(e,t)=>{bt.init(e,t);let r=new Set(t.values);e._zod.values=r,gt(e,"pattern",(n)=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map((i)=>typeof i==="string"?qo(i):i?qo(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let i=n.value;if(r.has(i))return n;return n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}}),BP=fe("$ZodTransform",(e,t)=>{bt.init(e,t),e._zod.optin="optional",jr.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new S_(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then((s)=>(r.value=s,r));if(o instanceof Promise)throw new Oo;return r.value=o,r}});function Cp(e,t){return e.value=t.issues.length?void 0:t.value,e}var L_=fe("$ZodOptional",(e,t)=>{bt.init(e,t),gt(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",gt(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),gt(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Cl(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((i)=>Cp(r,i));return Cp(r,o)}return t.innerType._zod.run(r,n)}}),HP=fe("$ZodExactOptional",(e,t)=>{L_.init(e,t),gt(e,"values",(r)=>r.def.innerType._zod.values),gt(e,"pattern",(r)=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),zP=fe("$ZodNullable",(e,t)=>{bt.init(e,t),gt(e,"optin",(r)=>r.def.innerType._zod.optin),gt(e,"optout",(r)=>r.def.innerType._zod.optout),gt(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Cl(n.source)}|null)$`):void 0}),gt(e,"values",(r)=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>{if(r.value===null)return r;return t.innerType._zod.run(r,n)}}),VP=fe("$ZodDefault",(e,t)=>{bt.init(e,t),e._zod.optin="defaulted",gt(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>Rp(i,t));return Rp(o,t)}});function Rp(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var jP=fe("$ZodPrefault",(e,t)=>{bt.init(e,t),e._zod.optin="defaulted",gt(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,n)}}),WP=fe("$ZodNonOptional",(e,t)=>{bt.init(e,t),gt(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>Ap(i,e));return Ap(o,e)}});function Ap(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}function Ip(e,t,r,n){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map((o)=>$n(o,n,cn()))},input:e.value}),e}var JP=fe("$ZodCatch",(e,t)=>{bt.init(e,t),gt(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),gt(e,"optout",(r)=>r.def.innerType._zod.optout),gt(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((i)=>Ip(r,i,t,n));return Ip(r,o,t,n)}}),q_=fe("$ZodPipe",(e,t)=>{bt.init(e,t),gt(e,"values",(r)=>r.def.in._zod.values),gt(e,"optin",(r)=>r.def.in._zod.optin),gt(e,"optout",(r)=>r.def.out._zod.optout),gt(e,"propValues",(r)=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);if(i instanceof Promise)return i.then((s)=>Ea(s,t.in,n));return Ea(i,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>Ea(i,t.out,n));return Ea(o,t.out,n)}});function Ea(e,t,r){if(e.issues.some((n)=>n.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}var KP=fe("$ZodPreprocess",(e,t)=>{q_.init(e,t)}),XP=fe("$ZodReadonly",(e,t)=>{bt.init(e,t),gt(e,"propValues",(r)=>r.def.innerType._zod.propValues),gt(e,"values",(r)=>r.def.innerType._zod.values),gt(e,"optin",(r)=>r.def.innerType?._zod?.optin),gt(e,"optout",(r)=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then(Pp);return Pp(o)}});function Pp(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var YP=fe("$ZodLazy",(e,t)=>{bt.init(e,t),n_(e._zod,"innerType",()=>{let r=t;if(!r._cachedInner)r._cachedInner=t.getter();return r._cachedInner}),gt(e,"pattern",(r)=>r.innerType?._zod?.pattern),gt(e,"propValues",(r)=>r.innerType?._zod?.propValues),gt(e,"optin",(r)=>r.innerType?._zod?.optin??void 0),gt(e,"optout",(r)=>r.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),ZP=fe("$ZodCustom",(e,t)=>{vr.init(e,t),bt.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=(r)=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then((i)=>kp(i,r,n,e));kp(o,r,n,e);return}});function kp(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};if(n._zod.def.params)o.params=n._zod.def.params;t.issues.push(Ya(o))}}var QP=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}},Qc="~memo",Np=[];function U_(e){return e!==null&&typeof e==="object"}function Mc(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var F_=new WeakMap,ws=0,Ga=1,Rs=2;function Ba(e,t,r){let n=F_.get(e);if(n!==void 0)return n?Rs:ws;if(t.has(e))return Rs;t.add(e);let o=ws,i=(u)=>{if(o!==Rs&&u?._zod){let f=Ba(u,t,r);if(f>o)o=f}},s=(u,f)=>{let h=ws;for(let g of Reflect.ownKeys(u)){let p=Object.getOwnPropertyDescriptor(u,g);if(f&&!p.enumerable)continue;let _=p.get?Ga:p.value?._zod?Ba(p.value,t,r):ws;if(_>h)h=_}return h},l=(u)=>{if(u>o)o=u},a=e._zod.def,c=a.type;switch(c){case"object":{let u=Rl(a);l(u?s(u,!0):Ga),i(a.catchall);break}case"array":i(a.element);break;case"tuple":for(let u of a.items)i(u);i(a.rest);break;case"record":case"map":i(a.keyType),i(a.valueType);break;case"set":i(a.valueType);break;case"union":for(let u of a.options)i(u);break;case"intersection":i(a.left),i(a.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(a.innerType);break;case"pipe":i(a.in),i(a.out);break;case"function":i(a.input),i(a.output);break;case"lazy":{let u=a._cachedInner??(r?e._zod.innerType:void 0);l(u?Ba(u,t,!1):Ga);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let u in a){let f=Object.getOwnPropertyDescriptor(a,u);if(!f||f.get)continue;let h=f.value;if(!h||typeof h!=="object")continue;if(h._zod)i(h);else if(Array.isArray(h))for(let g of h)i(g)}}return t.delete(e),ek(e,o)}function ek(e,t){if(t!==Ga)F_.set(e,t===Rs);return t}function tk(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var ba,wa=[],rk={alloc(e,t,r){let n=ba;if(!n)return r;ba=void 0;let o={value:r,issues:null};return n.set(t.value,o),wa.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(o,i)=>{if(i.direction!=="backward"&&ok(i,o.value))throw new QP;return r(o,i)};if(e._zod.parse=n,e._zod.run===r)e._zod.run=n})},attach(e){var t;let r,n=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,l=(a,c)=>{if(r===void 0){let S=Ba(e,new Set,!1);if(S===ws){if(e._zod.parse=s,e._zod.run===l)e._zod.run=s;return s(a,c)}if(S===Rs||n)r=!0;else n=!0}let u=a.value;if(!U_(u))return s(a,c);let f=c[Qc];if(!f)f={buckets:new WeakMap,backEdges:void 0},c[Qc]=f;let h;if(o===c)h=i;else h=tk(f,e),o=c,i=h;let g=h.get(u);if(g){if(a.value=g.value,g.issues){if(g.issues.length)a.issues.push(...Mc(g.issues))}else a.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(g.value);return a}ba=h;let p=wa.length,_=s(a,c);ba=void 0;let y=wa.length>p?wa.pop():void 0;if(_ instanceof Promise)return _.then((S)=>{if(y)y.issues=S.issues.length?Mc(S.issues):Np;return S});if(y)y.issues=_.issues.length?Mc(_.issues):Np;return _};if(e._zod.parse=l,e._zod.run===s)e._zod.run=l})}};function nk(){return rk}function ok(e,t){let r=e[Qc]?.backEdges;return r!==void 0&&U_(t)&&r.has(t)}var ik=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function o(i,s){if(i==="number"&&typeof s==="number"&&!Number.isFinite(s))return String(s);return n[i]??i}return(i)=>{switch(i.code){case"invalid_type":{let s=o(i.expected),l=h_(i.input),a=o(l,i.input);return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":if(i.values.length===1)return`Invalid input: expected ${Uu(i.values[0])}`;return`Invalid option: expected one of ${Kc(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",l=t(i.origin);if(l)return`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${l.unit??"elements"}`;return`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",l=t(i.origin);if(l)return`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${l.unit}`;return`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;if(s.format==="starts_with")return`Invalid string: must start with "${s.prefix}"`;if(s.format==="ends_with")return`Invalid string: must end with "${s.suffix}"`;if(s.format==="includes")return`Invalid string: must include "${s.includes}"`;if(s.format==="regex")return`Invalid string: must match pattern ${s.pattern}`;return`Invalid ${r[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${Kc(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":if(i.options&&Array.isArray(i.options)&&i.options.length>0)return`Invalid discriminator value. Expected ${i.options.map((l)=>`'${l}'`).join(" | ")}`;if(i.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function sk(){return{localeError:ik()}}var Op,ak=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function lk(){return new ak}(Op=globalThis).__zod_globalRegistry??(Op.__zod_globalRegistry=lk());var Ts=globalThis.__zod_globalRegistry;function Ol(e){if(e.checks)e.checks=[...e.checks];return e}function ck(e,t){return new e(Ol({type:"string",...Fe(t)}))}function uk(e,t){return new e(Ol({type:"string",coerce:!0,...Fe(t)}))}function G_(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Fe(t)})}function dk(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Fe(t)})}function fk(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Fe(t)})}function pk(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Fe(t)})}function hk(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Fe(t)})}function mk(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Fe(t)})}function B_(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Fe(t)})}function gk(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Fe(t)})}function vk(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Fe(t)})}function _k(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Fe(t)})}function yk(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Fe(t)})}function Sk(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Fe(t)})}function Ek(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Fe(t)})}function bk(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Fe(t)})}function wk(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Fe(t)})}function Tk(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Fe(t)})}function Ck(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Fe(t)})}function Rk(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Fe(t)})}function Ak(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Fe(t)})}function Ik(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Fe(t)})}function Pk(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Fe(t)})}function kk(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Fe(t)})}function H_(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Fe(t)})}function z_(e,t){return new e({type:"string",format:"date",check:"string_format",...Fe(t)})}function V_(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Fe(t)})}function j_(e,t){return new e({type:"string",format:"duration",check:"string_format",...Fe(t)})}function Nk(e,t){return new e(Ol({type:"number",checks:[],...Fe(t)}))}function Ok(e,t){return new e(Ol({type:"number",coerce:!0,checks:[],...Fe(t)}))}function Mk(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Fe(t)})}function Dk(e,t){return new e({type:"boolean",...Fe(t)})}function $k(e,t){return new e({type:"boolean",coerce:!0,...Fe(t)})}function xk(e,t){return new e({type:"bigint",coerce:!0,...Fe(t)})}function Lk(e,t){return new e({type:"null",...Fe(t)})}function qk(e){return new e({type:"any"})}function Uk(e){return new e({type:"unknown"})}function Fk(e,t){return new e({type:"never",...Fe(t)})}function Gk(e,t){return new e({type:"date",coerce:!0,...Fe(t)})}function tl(e,t){return new T_({check:"less_than",...Fe(t),value:e,inclusive:!1})}function Mo(e,t){return new T_({check:"less_than",...Fe(t),value:e,inclusive:!0})}function rl(e,t){return new C_({check:"greater_than",...Fe(t),value:e,inclusive:!1})}function Do(e,t){return new C_({check:"greater_than",...Fe(t),value:e,inclusive:!0})}function eu(e,t){return new PI({check:"multiple_of",...Fe(t),value:e})}function W_(e,t){return new NI({check:"max_length",...Fe(t),maximum:e})}function nl(e,t){return new OI({check:"min_length",...Fe(t),minimum:e})}function J_(e,t){return new MI({check:"length_equals",...Fe(t),length:e})}function Bk(e,t){return new DI({check:"string_format",format:"regex",...Fe(t),pattern:e})}function Hk(e){return new $I({check:"string_format",format:"lowercase",...Fe(e)})}function zk(e){return new xI({check:"string_format",format:"uppercase",...Fe(e)})}function Vk(e,t){return new LI({check:"string_format",format:"includes",...Fe(t),includes:e})}function jk(e,t){return new qI({check:"string_format",format:"starts_with",...Fe(t),prefix:e})}function Wk(e,t){return new UI({check:"string_format",format:"ends_with",...Fe(t),suffix:e})}function Ui(e){return new FI({check:"overwrite",tx:e})}function Jk(e){return Ui((t)=>t.normalize(e))}function Kk(){return Ui((e)=>e.trim())}function Xk(){return Ui((e)=>e.toLowerCase())}function Yk(){return Ui((e)=>e.toUpperCase())}function Zk(){return Ui((e)=>a_(e))}function Qk(e,t,r){return new e({type:"array",element:t,...Fe(r)})}function eN(e,t,r){return new e({type:"custom",check:"custom",fn:t,...Fe(r)})}function tN(e,t){let r=rN((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(Ya(o,n.value,r._zod.def));else{let i=o;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=n.value;i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),n.issues.push(Ya(i))}},e(n.value,n)),t);return r}function rN(e,t){let r=new vr({check:"custom",...Fe(t)});return r._zod.check=e,r}function As(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))if(Object.prototype.propertyIsEnumerable.call(r,n))Wr(e,n,r[n]);return e}function ol(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??Ts,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function er(e,t,r,n,o){let i=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw Error(o);return Object.assign(r,i),!0}function At(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i){if(i.count++,r.schemaPath.includes(e))i.cycle=r.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let l=e._zod.toJSONSchema?.();if(l)s.schema=l;else{let u={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,u);else{let h=s.schema,g=t.processors[o.type];if(!g)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);g(e,t,h,u)}let f=e._zod.parent;if(f){if(!s.ref)s.ref=f;At(f,t,u),t.seen.get(f).isParent=!0}}let a=t.metadataRegistry.get(e);if(a)As(s.schema,a);if(t.io==="input"&&ur(e))delete s.schema.examples,delete s.schema.default;if(t.io==="input"&&"_prefault"in s.schema)(n=s.schema).default??(n.default=s.schema._prefault);return delete s.schema._prefault,t.seen.get(e).schema}function Mp(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function il(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let s of e.seen.entries()){let l=e.metadataRegistry.get(s[0])?.id;if(l){let a=n.get(l);if(a&&a!==s[0])throw Error(`Duplicate schema id "${l}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(l,s[0])}}let o=(s)=>{let l=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(s[0])?.id,h=e.external.uri??((p)=>p);if(f)return{ref:h(f)};let g=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=g,{defId:g,ref:`${h("__shared")}#/${l}/${Mp(g)}`}}let a="#",c=`${a}/${l}/`;if(s[1]===r&&!s[1].schema.id)return{ref:a};let u=s[1].schema.id??`__schema${e.counter++}`;return{defId:u,ref:c+Mp(u)}},i=(s)=>{if(s[1].schema.$ref)return;let l=s[1],{ref:a,defId:c}=o(s);if(l.def={...l.schema},c)l.defId=c;let u=l.schema;for(let f in u)delete u[f];u.$ref=a};if(e.cycles==="throw")for(let s of e.seen.entries()){let l=s[1];if(l.cycle)throw Error(`Cycle detected: #/${l.cycle?.join("/")}/<root>
115
+
116
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let l=s[1];if(t===s[0]){i(s);continue}if(e.external){let c=e.external.registry.get(s[0])?.id;if(t!==s[0]&&c){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(l.cycle){i(s);continue}if(l.count>1){if(e.reused==="ref")i(s)}}if(e.external)e.sharedDefsExtractedFor=e.external}function K_(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!=="object")return;K_(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let i=n.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!=="string")return;if(!r.includes(s))r.push(s)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var X_=new Set(["type","properties","required","additionalProperties"]),Dp=["oneOf","anyOf"];function $p(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function tu(e){let t=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let s in i)if(!X_.has(s))return null;t.push(i)}let r={},n=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(r,s))continue;let l=[];for(let c of t){let u=c.properties?.[s]??$p(c);if(u===null||u===void 0)continue;if(!l.some((f)=>JSON.stringify(f)===JSON.stringify(u)))l.push(u)}let a=l.length===1?l[0]:tu(l)??{allOf:l};Wr(r,s,a)}for(let s of i.required??[])n.add(s)}let o={type:"object",properties:r};if(n.size)o.required=[...n];if(t.every((i)=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of t){let l=$p(s);if(l&&!i.some((a)=>JSON.stringify(a)===JSON.stringify(l)))i.push(l)}if(i.length===1)o.additionalProperties=i[0];else if(i.length>1)o.additionalProperties={allOf:i}}return o}function nN(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of X_)if(o in e)return;let r=t.filter((o)=>Dp.some((i)=>Array.isArray(o[i]))),n=null;if(!r.length)n=tu(t);else{let o=r[0],i=Dp.find((a)=>Array.isArray(o[a]));if(Object.keys(o).length!==1)return;let s=t.filter((a)=>a!==o),l=o[i].map((a)=>tu([...s,a]));if(l.some((a)=>!a))return;n={[i]:l}}if(!n)return;delete e.allOf,As(e,n)}function sl(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(l)=>{let a=e.seen.get(l);if(a.ref===null)return;let c=a.def??a.schema,u={...c},f=a.ref;if(a.ref=null,f){n(f);let g=e.seen.get(f),p=g.schema;if(p.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))c.allOf=c.allOf??[],c.allOf.push(p);else As(c,p);if(As(c,u),l._zod.parent===f)for(let y in c){if(y==="$ref"||y==="allOf")continue;if(!(y in u))delete c[y]}if(p.$ref&&g.def)for(let y in c){if(y==="$ref"||y==="allOf")continue;if(y in g.def&&JSON.stringify(c[y])===JSON.stringify(g.def[y]))delete c[y]}}let h=l._zod.parent;if(h&&h!==f){n(h);let g=e.seen.get(h);if(g?.schema.$ref){if(c.$ref=g.schema.$ref,g.def)for(let p in c){if(p==="$ref"||p==="allOf")continue;if(p in g.def&&JSON.stringify(c[p])===JSON.stringify(g.def[p]))delete c[p]}}}e.override({zodSchema:l,jsonSchema:c,path:a.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let l of[...e.seen.entries()].reverse())n(l[0]);if(e.target!=="openapi-3.0")for(let l of e.seen.entries())K_(l[1].def??l[1].schema);for(let l of e.deferred)l();if(e.intersections.length){let l=new Map;for(let a of e.seen.values())for(let c of[a.schema,a.def]){let u=c?.allOf;if(!Array.isArray(u))continue;let f=l.get(u);if(f)f.push(c);else l.set(u,[c])}for(let a of e.intersections)for(let c of l.get(a)??[])nN(c)}}let o={};if(e.target==="draft-2020-12")o.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")o.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")o.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let l=e.external.registry.get(t)?.id;if(!l)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(l)}As(o,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&o.id===i)delete o.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let l of e.seen.entries()){let a=l[1];if(a.def&&a.defId){if(a.def.id===a.defId)delete a.def.id;Wr(s,a.defId,a.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")o.$defs=s;else o.definitions=s;try{let l=JSON.parse(JSON.stringify(o));return Object.defineProperty(l,"~standard",{value:{...t["~standard"],jsonSchema:{input:al(t,"input",e.processors),output:al(t,"output",e.processors)}},enumerable:!1,writable:!1}),l}catch(l){throw Error("Error converting schema to JSON.")}}function ur(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return ur(n.element,r);if(n.type==="set")return ur(n.valueType,r);if(n.type==="lazy")return ur(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return ur(n.innerType,r);if(n.type==="intersection")return ur(n.left,r)||ur(n.right,r);if(n.type==="record"||n.type==="map")return ur(n.keyType,r)||ur(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return ur(n.in,r)||ur(n.out,r)}if(n.type==="object"){for(let o in n.shape)if(ur(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(ur(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(ur(o,r))return!0;if(n.rest&&ur(n.rest,r))return!0;return!1}return!1}var oN=(e,t={})=>(r)=>{let n=ol({...r,processors:t});return At(e,n),il(n,e),sl(n,e)},al=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:i}=n??{},s=ol({...o??{},target:i,io:t,processors:r});return At(e,s),il(s,e),sl(s,e)},Ni=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},Oi=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},xp=(e,t)=>{Ni(e,"minimum",t),Oi(e,"maximum",t)},Y_=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},Z_=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Q_=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},ey=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},Lp=(e,t)=>Ni(e,"minimum",t.minimum),qp=(e,t)=>Oi(e,"maximum",t.maximum),Up=(e)=>(t,r)=>{ey(t,r.format);let[n,o]=e[r.format];Ni(t,"minimum",n),Oi(t,"maximum",o)},iN={greater_than:(e,t)=>Ni(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Oi(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Y_(e,t.value),number_format:Up(Fu),bigint_format:Up(d_),min_length:Lp,max_length:qp,length_equals:(e,t)=>xp(e,t.length),min_size:Lp,max_size:qp,size_equals:(e,t)=>xp(e,t.size),string_format:(e,t)=>{if(ey(e,t.format),t.pattern)Z_(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>Q_(e,t.mime)};function jt(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)iN[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)Ni(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)Ni(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)Oi(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)Oi(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)Y_(t,o.multipleOf);if(o.format!==void 0){if(t.format??(t.format=o.format),o.format.includes("int"))t.isInt=!0}if(o.mime)Q_(t,o.mime);for(let i of o.patterns??[])Z_(t,i);return t}var sN={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},aN=new Map([[O_,hI],[Ju,mI]]),ty=(e)=>aN.get(e)??e,ry=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:s,format:l,patterns:a,contentEncoding:c,laxFormat:u}=jt(e);if(typeof i==="number")o.minLength=i;if(typeof s==="number")o.maxLength=s;if(l){if(o.format=sN[l]??l,o.format==="")delete o.format;if(l==="time"||u)delete o.format}if(c)o.contentEncoding=c;if(a&&a.size>0){let f=[...a].map(ty);if(f.length===1)o.pattern=f[0].source;else if(f.length>1)o.allOf=[...f.map((h)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))]}},ny=(e,t,r,n)=>{let o=r,{minimum:i,maximum:s,multipleOf:l,exclusiveMaximum:a,exclusiveMinimum:c,isInt:u}=jt(e);o.type=u?"integer":"number";let f=typeof c==="number"&&c>=(i??Number.NEGATIVE_INFINITY),h=typeof a==="number"&&a<=(s??Number.POSITIVE_INFINITY),g=t.target==="draft-04"||t.target==="openapi-3.0";if(f)if(g)o.minimum=c,o.exclusiveMinimum=!0;else o.exclusiveMinimum=c;else if(typeof i==="number")o.minimum=i;if(h)if(g)o.maximum=a,o.exclusiveMaximum=!0;else o.exclusiveMaximum=a;else if(typeof s==="number")o.maximum=s;if(l){let p=new Set;for(let S of l)if(Number.isFinite(S)&&S!==0)p.add(Math.abs(S));else er(e,t,o,n,`A multipleOf divisor of ${S} cannot be represented in JSON Schema`);let[_,...y]=p;if(_!==void 0)o.multipleOf=_;if(y.length)o.allOf=[...o.allOf??[],...y.map((S)=>({multipleOf:S}))]}},oy=(e,t,r,n)=>{r.type="boolean"},iy=(e,t,r,n)=>{er(e,t,r,n,"BigInt cannot be represented in JSON Schema")},lN=(e,t,r,n)=>{er(e,t,r,n,"Symbols cannot be represented in JSON Schema")},sy=(e,t,r,n)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"},cN=(e,t,r,n)=>{er(e,t,r,n,"Undefined cannot be represented in JSON Schema")},uN=(e,t,r,n)=>{er(e,t,r,n,"Void cannot be represented in JSON Schema")},ay=(e,t,r,n)=>{r.not={}},ly=(e,t,r,n)=>{},cy=(e,t,r,n)=>{},uy=(e,t,r,n)=>{er(e,t,r,n,"Date cannot be represented in JSON Schema")},dy=(e,t,r,n)=>{let o=e._zod.def,i=Ja(o.entries);if(i.length===0){r.not={};return}if(i.every((s)=>typeof s==="number"))r.type="number";if(i.every((s)=>typeof s==="string"))r.type="string";r.enum=i},fy=(e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let i=[];for(let s of o.values)if(s===void 0){if(er(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s==="bigint"){if(er(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length===0);else if(i.length===1){let s=i[0];if(r.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[s];else r.const=s}else{if(i.every((s)=>typeof s==="number"))r.type="number";if(i.every((s)=>typeof s==="string"))r.type="string";if(i.every((s)=>typeof s==="boolean"))r.type="boolean";if(i.every((s)=>s===null))r.type="null";r.enum=i}},dN=(e,t,r,n)=>{er(e,t,r,n,"NaN cannot be represented in JSON Schema")},fN=(e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},pN=(e,t,r,n)=>{let o=r;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:s,mime:l}=jt(e);if(i!==void 0)o.minLength=i;if(s!==void 0)o.maxLength=s;if(!l)return;if(l.length===0)o.not={};else if(l.length===1)o.contentMediaType=l[0];else o.anyOf=l.map((a)=>({contentMediaType:a}))},hN=(e,t,r,n)=>{r.type="boolean"},py=(e,t,r,n)=>{er(e,t,r,n,"Custom types cannot be represented in JSON Schema")},mN=(e,t,r,n)=>{er(e,t,r,n,"Function types cannot be represented in JSON Schema")},hy=(e,t,r,n)=>{er(e,t,r,n,"Transforms cannot be represented in JSON Schema")},gN=(e,t,r,n)=>{er(e,t,r,n,"Map cannot be represented in JSON Schema")},vN=(e,t,r,n)=>{er(e,t,r,n,"Set cannot be represented in JSON Schema")},my=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:s,maximum:l}=jt(e);if(typeof s==="number")o.minItems=s;if(typeof l==="number")o.maxItems=l;o.type="array",o.items=At(i.element,t,{...n,path:[...n.path,"items"]})};function Os(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return Os(t.out);if(t.type==="catch")return Os(t.innerType);return e._zod.optin}var gy=(e,t,r,n)=>{let o=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&er(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let c in s)Wr(o.properties,c,At(s[c],t,{...n,path:[...n.path,"properties",c]}));let a=[];for(let c of Object.keys(s)){let u=i.shape[c];if(t.io==="input"?Os(u)===void 0:u._zod.optout===void 0)a.push(c)}if(a.length>0)o.required=a;if(i.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")o.additionalProperties=!1}else if(i.catchall)o.additionalProperties=At(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})},vy=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((l,a)=>At(l,t,{...n,path:[...n.path,i?"oneOf":"anyOf",a]}));if(i)r.oneOf=s;else r.anyOf=s},_y=(e,t,r,n)=>{let o=e._zod.def,i=At(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=At(o.right,t,{...n,path:[...n.path,"allOf",1]}),l=(c)=>("allOf"in c)&&Object.keys(c).length===1,a=[...l(i)?i.allOf:[i],...l(s)?s.allOf:[s]];r.allOf=a,t.intersections.push(a)},_N=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",l=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",a=i.items.map((_,y)=>At(_,t,{...n,path:[...n.path,s,y]})),c=i.rest?At(i.rest,t,{...n,path:[...n.path,l,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,u=i.items.length;while(u>0){let _=i.items[u-1];if(!(t.io==="input"?Os(_)!==void 0:_._zod.optout==="optional"))break;u--}let f=i.items.length,h=!i.rest;if(t.target==="draft-2020-12"){if(o.prefixItems=a,h)o.items=!1;else if(c)o.items=c;if(u>0)o.minItems=u;if(h)o.maxItems=f}else if(t.target==="openapi-3.0"){if(o.items={anyOf:a},c)o.items.anyOf.push(c);if(u>0)o.minItems=u;if(h)o.maxItems=f}else{if(o.items=a,h)o.additionalItems=!1;else if(c)o.additionalItems=c;if(u>0)o.minItems=u;if(h)o.maxItems=f}let{minimum:g,maximum:p}=jt(e);if(typeof g==="number")o.minItems=g;if(typeof p==="number")o.maxItems=p};function ru(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let p=e.get(t)?.def;if(!p)return t;let _=ru(e,p,r);return _===p?t:_}for(let p of["anyOf","oneOf"]){let _=t[p];if(!Array.isArray(_))continue;let y=_.map((S)=>ru(e,S,r));if(y.some((S,E)=>S!==_[E]))t={...t,[p]:y}}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some((p)=>p==="number"||p==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some((p)=>typeof p==="number"))return t;let{minimum:s,maximum:l,exclusiveMinimum:a,exclusiveMaximum:c,multipleOf:u,format:f,id:h,...g}=t;if(g.enum)g.enum=g.enum.map((p)=>typeof p==="number"?String(p):p);else if(typeof g.const==="number")g.const=String(g.const);if(!o)return g;if(g.type="string",!i)g.pattern=(n.includes("number")?Vu:TI).source;return g}var nu=new WeakMap;function yN(e){let t=new Map;for(let n of e.seen.values())if(n.def&&!t.has(n.schema))t.set(n.schema,n);let r=new Map;for(let n of nu.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let s=ru(t,i,new Set);if(s!==i)r.set(i,s)}if(!r.size)return;for(let n of e.seen.values())for(let o of[n.schema,n.def]){let i=o&&r.get(o.propertyNames);if(i)o.propertyNames=i}}var yy=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let s=i.keyType,l=jt(s).patterns;if(i.mode==="loose"&&l&&l.size>0){let u=At(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let f of l)Wr(o.patternProperties,ty(f).source,u)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=At(i.keyType,t,{...n,path:[...n.path,"propertyNames"]});let u=nu.get(t);if(!u)u=[],nu.set(t,u),t.deferred.push(()=>yN(t));u.push(e)}o.additionalProperties=At(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let a=s._zod.values,c=t.io==="input"&&Os(i.valueType)!==void 0;if(a&&!i.partial&&!c){let u=[...a].filter((f)=>typeof f==="string"||typeof f==="number");if(u.length>0)o.required=u.map(String)}},Sy=(e,t,r,n)=>{let o=e._zod.def,i=At(o.innerType,t,n),s=t.seen.get(e);if(t.target==="openapi-3.0")s.ref=o.innerType,r.nullable=!0;else r.anyOf=[i,{type:"null"}]},Ey=(e,t,r,n)=>{let o=e._zod.def;At(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Ku=Symbol();function by(e,t,r,n,o){let i=!1,s=JSON.stringify(e,(l,a)=>{if(typeof a!=="bigint")return a;return i=!0,null});if(!i)return JSON.parse(s);return er(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),Ku}var wy=(e,t,r,n)=>{let o=e._zod.def;At(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s=by(o.defaultValue,e,t,r,n);if(s!==Ku)r.default=s},Ty=(e,t,r,n)=>{let o=e._zod.def;At(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=by(o.defaultValue,e,t,r,n);if(s!==Ku)r._prefault=s},Cy=(e,t,r,n)=>{let o=e._zod.def;At(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{er(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},Ry=(e,t,r,n)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;At(s,t,n);let l=t.seen.get(e);l.ref=s},Ay=(e,t,r,n)=>{let o=e._zod.def;At(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},SN=(e,t,r,n)=>{let o=e._zod.def;At(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Xu=(e,t,r,n)=>{let o=e._zod.def;At(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Iy=(e,t,r,n)=>{let o=e._zod.innerType;At(o,t,n);let i=t.seen.get(e);i.ref=o},Fp={string:ry,number:ny,boolean:oy,bigint:iy,symbol:lN,null:sy,undefined:cN,void:uN,never:ay,any:ly,unknown:cy,date:uy,enum:dy,literal:fy,nan:dN,template_literal:fN,file:pN,success:hN,custom:py,function:mN,transform:hy,map:gN,set:vN,array:my,object:gy,union:vy,intersection:_y,tuple:_N,record:yy,nullable:Sy,nonoptional:Ey,default:wy,prefault:Ty,catch:Cy,pipe:Ry,readonly:Ay,promise:SN,optional:Xu,lazy:Iy};function Py(e,t){if("_idmap"in e){let n=e,o=ol({...t,processors:Fp}),i={};for(let a of n._idmap.entries()){let[c,u]=a;At(u,o)}let s={},l={registry:n,uri:t?.uri,defs:i};o.external=l;for(let a of n._idmap.entries()){let[c,u]=a;il(o,u),Wr(s,c,sl(o,u))}if(Object.keys(i).length>0){let a=o.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[a]:i}}return{schemas:s}}let r=ol({...t,processors:Fp});return At(e,r),il(r,e),sl(r,e)}var Gp=new WeakSet([Object.prototype,Error.prototype]);function Ta(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var EN=(e,t)=>{$A.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(Gp.has(r))return;Gp.add(r),Ta(r,"format",(n)=>(o)=>qA(n,o)),Ta(r,"flatten",(n)=>(o)=>LA(n,o)),Ta(r,"addIssue",(n)=>(o)=>{n.issues.push(o),n.message=JSON.stringify(n.issues,Ka,2)}),Ta(r,"addIssues",(n)=>(o)=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,Ka,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})},Dr=fe("ZodError",EN,void 0,{Parent:Error}),bN=Gu(Dr),wN=Bu(Dr),ky=Hu(Dr),TN=zu(Dr),CN=zA(Dr),RN=VA(Dr),AN=jA(Dr),IN=WA(Dr),PN=JA(Dr),kN=KA(Dr),NN=XA(Dr),ON=YA(Dr);function MN(){if(!jr.localeError)cn(sk())}function Ml(){if(!jr.memoizer)cn({memoizer:nk()})}var wt=fe("ZodType",(e,t)=>(MN(),bt.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(rt.mergeDefs(t,{checks:[...t.checks??[],...e.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return qn(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(CO(e,t))},superRefine(e,t){return this.check(RO(e,t))},overwrite(e){return this.check(Ui(e))},optional(){return $e(this)},exactOptional(){return dO(this)},nullable(){return zp(this)},nullish(){return $e(zp(this))},nonoptional(e){return vO(this,e)},array(){return ie(this)},or(e){return ke([this,e])},and(e){return Fo(this,e)},transform(e){return Vp(this,Uy(e))},default(e){return hO(this,e)},prefault(e){return gO(this,e)},catch(e){return yO(this,e)},pipe(e){return Vp(this,e)},readonly(){return bO(this)},describe(e){let t=this.clone();return Ts.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ts.get(this);let t=this.clone();return Ts.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get "~standard"(){return rt.hide(this,"~standard",{...A_(this),jsonSchema:{input:al(this,"input"),output:al(this,"output")}})},set "~standard"(e){rt.own(this,"~standard",e)},parse:function e(t,r){return bN(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await wN(this,t,r,{callee:e})},safeParse(e,t){return ky(this,e,t)},async safeParseAsync(e,t){return TN(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){rt.own(this,"spa",e)},validate(e,t){return GA(this,e,t)},validateAsync(e,t){return HA(this,e,t)},encode:function e(t,r){return CN(this,t,r,{callee:e})},decode:function e(t,r){return RN(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await AN(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await IN(this,t,r,{callee:e})},safeEncode(e,t){return PN(this,e,t)},safeDecode(e,t){return kN(this,e,t)},async safeEncodeAsync(e,t){return NN(this,e,t)},async safeDecodeAsync(e,t){return ON(this,e,t)},toJSONSchema(e){return oN(this,{})(e)},get description(){return Ts.get(this)?.description},get _def(){return this._zod.def}}),Ny=fe("_ZodString",(e,t)=>{Wu.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ry(e,r,n,o)},rt.derived({format:(e)=>jt(e).format??null,minLength:(e)=>jt(e).minimum??null,maxLength:(e)=>jt(e).maximum??null},{regex(...e){return this.check(Bk(...e))},includes(...e){return this.check(Vk(...e))},startsWith(...e){return this.check(jk(...e))},endsWith(...e){return this.check(Wk(...e))},min(...e){return this.check(nl(...e))},max(...e){return this.check(W_(...e))},length(...e){return this.check(J_(...e))},nonempty(...e){return this.check(nl(1,...e))},lowercase(e){return this.check(Hk(e))},uppercase(e){return this.check(zk(e))},trim(){return this.check(Kk())},normalize(...e){return this.check(Jk(...e))},toLowerCase(){return this.check(Xk())},toUpperCase(){return this.check(Yk())},slugify(){return this.check(Zk())}})),Oy=fe("ZodString",(e,t)=>{Wu.init(e,t),Ny.init(e,t)},{email(e){return this.check(G_(My,e))},url(e){return this.check(B_(Dy,e))},jwt(e){return this.check(kk(XN,e))},emoji(e){return this.check(gk(xN,e))},guid(e){return this.check(dk($N,e))},uuid(e){return this.check(fk(Ca,e))},uuidv4(e){return this.check(pk(Ca,e))},uuidv6(e){return this.check(hk(Ca,e))},uuidv7(e){return this.check(mk(Ca,e))},nanoid(e){return this.check(vk(LN,e))},cuid(e){return this.check(_k(qN,e))},cuid2(e){return this.check(yk(UN,e))},ulid(e){return this.check(Sk(FN,e))},base64(e){return this.check(Ak(WN,e))},base64url(e){return this.check(Ik(JN,e))},xid(e){return this.check(Ek(GN,e))},ksuid(e){return this.check(bk(BN,e))},ipv4(e){return this.check(wk(HN,e))},ipv6(e){return this.check(Tk(zN,e))},cidrv4(e){return this.check(Ck(VN,e))},cidrv6(e){return this.check(Rk(jN,e))},e164(e){return this.check(Pk(KN,e))},datetime(e){return this.check(H_(Yu,e))},date(e){return this.check(z_(Zu,e))},time(e){return this.check(V_(Qu,e))},duration(e){return this.check(j_(ed,e))}});function k(e){return ck(Oy,e)}var Mt=fe("ZodStringFormat",(e,t)=>{Nt.init(e,t),Ny.init(e,t)}),Yu=fe("ZodISODateTime",(e,t)=>{sP.init(e,t),Mt.init(e,t)}),Zu=fe("ZodISODate",(e,t)=>{aP.init(e,t),Mt.init(e,t)}),Qu=fe("ZodISOTime",(e,t)=>{lP.init(e,t),Mt.init(e,t)}),ed=fe("ZodISODuration",(e,t)=>{cP.init(e,t),Mt.init(e,t)}),My=fe("ZodEmail",(e,t)=>{jI.init(e,t),Mt.init(e,t)});function DN(e){return G_(My,e)}var $N=fe("ZodGUID",(e,t)=>{zI.init(e,t),Mt.init(e,t)}),Ca=fe("ZodUUID",(e,t)=>{VI.init(e,t),Mt.init(e,t)}),Dy=fe("ZodURL",(e,t)=>{ZI.init(e,t),Mt.init(e,t)});function $y(e){return B_(Dy,e)}var xN=fe("ZodEmoji",(e,t)=>{QI.init(e,t),Mt.init(e,t)}),LN=fe("ZodNanoID",(e,t)=>{eP.init(e,t),Mt.init(e,t)}),qN=fe("ZodCUID",(e,t)=>{tP.init(e,t),Mt.init(e,t)}),UN=fe("ZodCUID2",(e,t)=>{rP.init(e,t),Mt.init(e,t)}),FN=fe("ZodULID",(e,t)=>{nP.init(e,t),Mt.init(e,t)}),GN=fe("ZodXID",(e,t)=>{oP.init(e,t),Mt.init(e,t)}),BN=fe("ZodKSUID",(e,t)=>{iP.init(e,t),Mt.init(e,t)}),HN=fe("ZodIPv4",(e,t)=>{uP.init(e,t),Mt.init(e,t)}),zN=fe("ZodIPv6",(e,t)=>{fP.init(e,t),Mt.init(e,t)}),VN=fe("ZodCIDRv4",(e,t)=>{pP.init(e,t),Mt.init(e,t)}),jN=fe("ZodCIDRv6",(e,t)=>{mP.init(e,t),Mt.init(e,t)}),WN=fe("ZodBase64",(e,t)=>{gP.init(e,t),Mt.init(e,t)}),JN=fe("ZodBase64URL",(e,t)=>{_P.init(e,t),Mt.init(e,t)}),KN=fe("ZodE164",(e,t)=>{yP.init(e,t),Mt.init(e,t)}),XN=fe("ZodJWT",(e,t)=>{EP.init(e,t),Mt.init(e,t)}),td=fe("ZodNumber",(e,t)=>{M_.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ny(e,r,n,o),e.isFinite=!0},rt.derived({minValue:(e)=>{let{minimum:t,exclusiveMinimum:r}=jt(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:r}=jt(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:r}=jt(e);return!!t||!!r?.some(Number.isSafeInteger)},format:(e)=>jt(e).format??null},{gt(e,t){return this.check(rl(e,t))},gte(e,t){return this.check(Do(e,t))},min(e,t){return this.check(Do(e,t))},lt(e,t){return this.check(tl(e,t))},lte(e,t){return this.check(Mo(e,t))},max(e,t){return this.check(Mo(e,t))},int(e){return this.check(Bp(e))},safe(e){return this.check(Bp(e))},positive(e){return this.check(rl(0,e))},nonnegative(e){return this.check(Do(0,e))},negative(e){return this.check(tl(0,e))},nonpositive(e){return this.check(Mo(0,e))},multipleOf(e,t){return this.check(eu(e,t))},step(e,t){return this.check(eu(e,t))},finite(){return this}}));function Ee(e){return Nk(td,e)}var YN=fe("ZodNumberFormat",(e,t)=>{bP.init(e,t),td.init(e,t)});function Bp(e){return Mk(YN,e)}var xy=fe("ZodBoolean",(e,t)=>{wP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>oy(e,r,n,o)});function Pe(e){return Dk(xy,e)}var ZN=fe("ZodBigInt",(e,t)=>{TP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>iy(e,r,n,o)},rt.derived({minValue:(e)=>jt(e).minimum??null,maxValue:(e)=>jt(e).maximum??null,format:(e)=>jt(e).format??null},{gte(e,t){return this.check(Do(e,t))},min(e,t){return this.check(Do(e,t))},gt(e,t){return this.check(rl(e,t))},lt(e,t){return this.check(tl(e,t))},lte(e,t){return this.check(Mo(e,t))},max(e,t){return this.check(Mo(e,t))},positive(e){return this.check(rl(BigInt(0),e))},negative(e){return this.check(tl(BigInt(0),e))},nonpositive(e){return this.check(Mo(BigInt(0),e))},nonnegative(e){return this.check(Do(BigInt(0),e))},multipleOf(e,t){return this.check(eu(e,t))}})),QN=fe("ZodNull",(e,t)=>{CP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sy(e,r,n,o)});function Ms(e){return Lk(QN,e)}var eO=fe("ZodAny",(e,t)=>{RP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ly(e,r,n,o)});function tO(){return qk(eO)}var rO=fe("ZodUnknown",(e,t)=>{AP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>cy(e,r,n,o)});function xe(){return Uk(rO)}var nO=fe("ZodNever",(e,t)=>{IP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ay(e,r,n,o)});function oO(e){return Fk(nO,e)}var iO=fe("ZodDate",(e,t)=>{PP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>uy(e,r,n,o),e.min=(r,n)=>e.check(Do(r,n)),e.max=(r,n)=>e.check(Mo(r,n))},rt.derived({minDate:(e)=>{let{minimum:t}=jt(e);return t?new Date(t):null},maxDate:(e)=>{let{maximum:t}=jt(e);return t?new Date(t):null}},{})),sO=fe("ZodArray",(e,t)=>{Ml(),OP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>my(e,r,n,o),e.element=t.element},{min(e,t){return this.check(nl(e,t))},nonempty(e){return this.check(nl(1,e))},max(e,t){return this.check(W_(e,t))},length(e,t){return this.check(J_(e,t))},unwrap(){return this.element}});function ie(e,t){return Qk(sO,e,t)}var Ly=fe("ZodObject",(e,t)=>{Ml(),$P.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gy(e,r,n,o),rt.installLazyProp(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return Ke(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(rt.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(rt.mergeDefs(this._zod.def,{catchall:xe()}))},loose(){return this.clone(rt.mergeDefs(this._zod.def,{catchall:xe()}))},strict(){return this.clone(rt.mergeDefs(this._zod.def,{catchall:oO()}))},strip(){return this.clone(rt.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return rt.extend(this,e)},safeExtend(e){return rt.safeExtend(this,e)},merge(e){return rt.merge(this,e)},pick(e){return rt.pick(this,e)},omit(e){return rt.omit(this,e)},partial(...e){return rt.partial(Fy,this,e[0])},exactPartial(...e){return rt.partial(Gy,this,e[0],"exactPartial")},required(...e){return rt.required(By,this,e[0])}});function X(e,t){let r={type:"object",shape:e??{},...rt.normalizeParams(t)};return new Ly(r)}function Ge(e,t){return new Ly({type:"object",shape:e,catchall:xe(),...rt.normalizeParams(t)})}var qy=fe("ZodUnion",(e,t)=>{x_.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vy(e,r,n,o),e.options=t.options});function ke(e,t){return new qy({type:"union",options:e,...rt.normalizeParams(t)})}var aO=fe("ZodDiscriminatedUnion",(e,t)=>{qy.init(e,t),LP.init(e,t)});function ll(e,t,r){return new aO({type:"union",options:t,discriminator:e,...rt.normalizeParams(r)})}var lO=fe("ZodIntersection",(e,t)=>{qP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_y(e,r,n,o)});function Fo(e,t){return new lO({type:"intersection",left:e,right:t})}var Hp=fe("ZodRecord",(e,t)=>{Ml(),UP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yy(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function Re(e,t,r){if(!t||!t._zod)return new Hp({type:"record",keyType:k(),valueType:e,...rt.normalizeParams(t)});return new Hp({type:"record",keyType:e,valueType:t,...rt.normalizeParams(r)})}var ou=fe("ZodEnum",(e,t)=>{FP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(n,o,i)=>dy(e,n,o,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let s of n)if(r.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new ou({...t,checks:[],...rt.normalizeParams(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let s of n)if(r.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new ou({...t,checks:[],...rt.normalizeParams(o),entries:i})}});function Ke(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new ou({type:"enum",entries:r,...rt.normalizeParams(t)})}var cO=fe("ZodLiteral",(e,t)=>{GP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fy(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function ae(e,t){return new cO({type:"literal",values:Array.isArray(e)?e:[e],...rt.normalizeParams(t)})}var uO=fe("ZodTransform",(e,t)=>{Ml(),BP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hy(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new S_(e.constructor.name);r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(rt.issue(i,r.value,t));else{let s=i;if(s.fatal)s.continue=!1;if(s.code??(s.code="custom"),!("input"in s))s.input=r.value;s.inst??(s.inst=e),r.issues.push(rt.issue(s))}};let o=t.transform(r.value,r);if(o instanceof Promise)return o.then((i)=>(r.value=i,r));return r.value=o,r}});function Uy(e){return new uO({type:"transform",transform:e})}var Fy=fe("ZodOptional",(e,t)=>{L_.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xu(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function $e(e){return new Fy({type:"optional",innerType:e})}var Gy=fe("ZodExactOptional",(e,t)=>{HP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xu(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function dO(e){return new Gy({type:"optional",innerType:e})}var fO=fe("ZodNullable",(e,t)=>{zP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sy(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function zp(e){return new fO({type:"nullable",innerType:e})}var pO=fe("ZodDefault",(e,t)=>{VP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wy(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function hO(e,t){return new pO({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():rt.shallowClone(t)}})}var mO=fe("ZodPrefault",(e,t)=>{jP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ty(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function gO(e,t){return new mO({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():rt.shallowClone(t)}})}var By=fe("ZodNonOptional",(e,t)=>{WP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ey(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function vO(e,t){return new By({type:"nonoptional",innerType:e,...rt.normalizeParams(t)})}var _O=fe("ZodCatch",(e,t)=>{JP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Cy(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function yO(e,t){return new _O({type:"catch",innerType:e,catchValue:typeof t==="function"?t:rt.constantCatch(t)})}var Hy=fe("ZodPipe",(e,t)=>{q_.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ry(e,r,n,o),e.in=t.in,e.out=t.out});function Vp(e,t){return new Hy({type:"pipe",in:e,out:t})}var SO=fe("ZodPreprocess",(e,t)=>{Hy.init(e,t),KP.init(e,t)}),EO=fe("ZodReadonly",(e,t)=>{XP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ay(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function bO(e){return new EO({type:"readonly",innerType:e})}var wO=fe("ZodLazy",(e,t)=>{YP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Iy(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function rd(e){return new wO({type:"lazy",getter:e})}var TO=fe("ZodCustom",(e,t)=>{ZP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>py(e,r,n,o)});function CO(e,t={}){return eN(TO,e,t)}function RO(e,t){return tN(e,t)}function Ds(e,t){return new SO({type:"pipe",in:Uy(e),out:t})}var AO={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"},jp;jp||(jp={});var Fi={};Gs(Fi,{ZodISODate:()=>Zu,ZodISODateTime:()=>Yu,ZodISODuration:()=>ed,ZodISOTime:()=>Qu,date:()=>PO,datetime:()=>IO,duration:()=>NO,time:()=>kO});function IO(e){return H_(Yu,e)}function PO(e){return z_(Zu,e)}function kO(e){return V_(Qu,e)}function NO(e){return j_(ed,e)}var zy={};Gs(zy,{bigint:()=>$O,boolean:()=>DO,date:()=>xO,number:()=>MO,string:()=>OO});function OO(e){return uk(Oy,e)}function MO(e){return Ok(td,e)}function DO(e){return $k(xy,e)}function $O(e){return xk(ZN,e)}function xO(e){return Gk(iO,e)}var iu="2025-11-25",LO=[iu,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],qO="io.modelcontextprotocol/related-task",Gi="io.modelcontextprotocol/protocolVersion",nd="io.modelcontextprotocol/clientInfo",Ti="io.modelcontextprotocol/serverInfo",Js="io.modelcontextprotocol/clientCapabilities",od="io.modelcontextprotocol/subscriptionId",Dl="io.modelcontextprotocol/logLevel",$l="2.0",Mi=rd(()=>ke([k(),Ee(),Pe(),Ms(),Re(k(),Mi),ie(Mi)])),Ut=Re(k(),Mi),UO=ie(Mi),id=ke([k(),Ee().int()]),sd=k(),Vy=X({ttl:Ee().optional()}),jy=X({taskId:k()}),ad=Ge({progressToken:id.optional(),[qO]:jy.optional()}),nr=X({_meta:ad.optional()}),Ks=nr.extend({task:Vy.optional()}),Ft=X({method:k(),params:nr.loose().optional()}),_r=X({_meta:ad.optional()}),yr=X({method:k(),params:_r.loose().optional()}),ld=Ge({get[Ti](){return ql.optional().catch(void 0)}}),Gt=Ge({_meta:ld.optional()}),Bi=ke([k(),Ee().int()]),cd=X({jsonrpc:ae($l),id:Bi,...Ft.shape}).strict(),ud=X({jsonrpc:ae($l),...yr.shape}).strict(),xl=X({jsonrpc:ae($l),id:Bi,result:Gt}).strict(),Ll=X({jsonrpc:ae($l),id:Bi.optional(),error:X({code:Ee().int(),message:k(),data:xe().optional()})}).strict(),Wy=ke([cd,ud,xl,Ll]),FO=ke([xl,Ll]),dd=Gt.strict(),Jy=_r.extend({requestId:Bi.optional(),reason:k().optional()}),fd=yr.extend({method:ae("notifications/cancelled"),params:Jy}),Ky=X({src:k(),mimeType:k().optional(),sizes:ie(k()).optional(),theme:Ke(["light","dark"]).optional()}),Hi=X({icons:ie(Ky).optional()}),Go=X({name:k(),title:k().optional()}),ql=Go.extend({...Go.shape,...Hi.shape,version:k(),websiteUrl:k().optional(),description:k().optional()}),GO=Fo(X({applyDefaults:Pe().optional()}),Ut),BO=Ds((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)&&Object.keys(e).length===0)return{form:{}};return e},Fo(X({form:GO.optional(),url:Ut.optional()}),Ut.optional())),Xy=Ge({list:Ut.optional(),cancel:Ut.optional(),requests:Ge({sampling:Ge({createMessage:Ut.optional()}).optional(),elicitation:Ge({create:Ut.optional()}).optional()}).optional()}),Yy=Ge({list:Ut.optional(),cancel:Ut.optional(),requests:Ge({tools:Ge({call:Ut.optional()}).optional()}).optional()}),Zy=X({experimental:Re(k(),Ut).optional(),sampling:X({context:Ut.optional(),tools:Ut.optional()}).optional(),elicitation:BO.optional(),roots:X({listChanged:Pe().optional()}).optional(),tasks:Xy.optional(),extensions:Re(k(),Ut).optional()}),Qy=nr.extend({protocolVersion:k(),capabilities:Zy,clientInfo:ql}),e0=Ft.extend({method:ae("initialize"),params:Qy}),pd=X({experimental:Re(k(),Ut).optional(),logging:Ut.optional(),completions:Ut.optional(),prompts:X({listChanged:Pe().optional()}).optional(),resources:X({subscribe:Pe().optional(),listChanged:Pe().optional()}).optional(),tools:X({listChanged:Pe().optional()}).optional(),tasks:Yy.optional(),extensions:Re(k(),Ut).optional()}),t0=Gt.extend({protocolVersion:k(),capabilities:pd,serverInfo:ql,instructions:k().optional()}),r0=yr.extend({method:ae("notifications/initialized"),params:_r.optional()}),n0=Ft.extend({method:ae("server/discover"),params:nr.optional()}),o0=Gt.extend({supportedVersions:ie(k()),capabilities:pd,instructions:k().optional()}),hd=Ft.extend({method:ae("ping"),params:nr.optional()}),i0=X({progress:Ee(),total:$e(Ee()),message:$e(k())}),s0=X({..._r.shape,...i0.shape,progressToken:id}),md=yr.extend({method:ae("notifications/progress"),params:s0}),a0=nr.extend({cursor:sd.optional()}),zi=Ft.extend({params:a0.optional()}),Vi=Gt.extend({nextCursor:sd.optional()}),gd=X({uri:k(),mimeType:$e(k()),_meta:Re(k(),xe()).optional()}),vd=gd.extend({text:k()}),_d=k().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),yd=gd.extend({blob:_d}),ji=Ke(["user","assistant"]),Vo=X({audience:ie(ji).optional(),priority:Ee().min(0).max(1).optional(),lastModified:Fi.datetime({offset:!0}).optional()}),Sd=X({...Go.shape,...Hi.shape,uri:k(),description:$e(k()),mimeType:$e(k()),size:$e(Ee()),annotations:Vo.optional(),_meta:$e(Ge({}))}),l0=X({...Go.shape,...Hi.shape,uriTemplate:k(),description:$e(k()),mimeType:$e(k()),annotations:Vo.optional(),_meta:$e(Ge({}))}),c0=zi.extend({method:ae("resources/list")}),u0=Vi.extend({resources:ie(Sd)}),d0=zi.extend({method:ae("resources/templates/list")}),f0=Vi.extend({resourceTemplates:ie(l0)}),Ul=nr.extend({uri:k()}),p0=Ul,h0=Ft.extend({method:ae("resources/read"),params:p0}),m0=Gt.extend({contents:ie(ke([vd,yd]))}),g0=yr.extend({method:ae("notifications/resources/list_changed"),params:_r.optional()}),v0=Ul,_0=Ft.extend({method:ae("resources/subscribe"),params:v0}),y0=Ul,S0=Ft.extend({method:ae("resources/unsubscribe"),params:y0}),Ed=X({toolsListChanged:Pe().optional(),promptsListChanged:Pe().optional(),resourcesListChanged:Pe().optional(),resourceSubscriptions:ie(k()).optional()}),E0=nr.extend({notifications:Ed}),b0=Ft.extend({method:ae("subscriptions/listen"),params:E0}),w0=_r.extend({notifications:Ed}),T0=yr.extend({method:ae("notifications/subscriptions/acknowledged"),params:w0}),C0=ld.extend({[od]:Bi}),R0=Gt.extend({_meta:C0}),A0=_r.extend({uri:k()}),I0=yr.extend({method:ae("notifications/resources/updated"),params:A0}),P0=X({name:k(),description:$e(k()),required:$e(Pe())}),k0=X({...Go.shape,...Hi.shape,description:$e(k()),arguments:$e(ie(P0)),_meta:$e(Ge({}))}),N0=zi.extend({method:ae("prompts/list")}),O0=Vi.extend({prompts:ie(k0)}),M0=nr.extend({name:k(),arguments:Re(k(),k()).optional()}),D0=Ft.extend({method:ae("prompts/get"),params:M0}),Fl=X({type:ae("text"),text:k(),annotations:Vo.optional(),_meta:Re(k(),xe()).optional()}),Gl=X({type:ae("image"),data:_d,mimeType:k(),annotations:Vo.optional(),_meta:Re(k(),xe()).optional()}),Bl=X({type:ae("audio"),data:_d,mimeType:k(),annotations:Vo.optional(),_meta:Re(k(),xe()).optional()}),$0=X({type:ae("tool_use"),name:k(),id:k(),input:Re(k(),xe()),_meta:Re(k(),xe()).optional()}),x0=X({type:ae("resource"),resource:ke([vd,yd]),annotations:Vo.optional(),_meta:Re(k(),xe()).optional()}),L0=Sd.extend({type:ae("resource_link")}),Hl=ke([Fl,Gl,Bl,L0,x0]),q0=X({role:ji,content:Hl}),U0=Gt.extend({description:k().optional(),messages:ie(q0)}),F0=yr.extend({method:ae("notifications/prompts/list_changed"),params:_r.optional()}),G0=X({title:k().optional(),readOnlyHint:Pe().optional(),destructiveHint:Pe().optional(),idempotentHint:Pe().optional(),openWorldHint:Pe().optional()}),B0=X({taskSupport:Ke(["required","optional","forbidden"]).optional()}),bd=X({...Go.shape,...Hi.shape,description:k().optional(),inputSchema:X({type:ae("object"),properties:Re(k(),Mi).optional(),required:ie(k()).optional()}).catchall(xe()),outputSchema:Ge({$schema:k().optional()}).optional(),annotations:G0.optional(),execution:B0.optional(),_meta:Re(k(),xe()).optional()}),H0=zi.extend({method:ae("tools/list")}),z0=Vi.extend({tools:ie(bd)}),wd=Gt.extend({content:ie(Hl).default([]),structuredContent:xe().optional(),isError:Pe().optional()}),HO=wd.or(Gt.extend({toolResult:xe()})),V0=Ks.extend({name:k(),arguments:Re(k(),xe()).optional()}),j0=Ft.extend({method:ae("tools/call"),params:V0}),W0=yr.extend({method:ae("notifications/tools/list_changed"),params:_r.optional()}),zO=X({autoRefresh:Pe().default(!0),debounceMs:Ee().int().nonnegative().default(300)}),$s=Ke(["debug","info","notice","warning","error","critical","alert","emergency"]),J0=nr.extend({level:$s}),K0=Ft.extend({method:ae("logging/setLevel"),params:J0}),X0=_r.extend({level:$s,logger:k().optional(),data:xe()}),Y0=yr.extend({method:ae("notifications/message"),params:X0}),Z0=X({name:k().optional()}),Q0=X({hints:ie(Z0).optional(),costPriority:Ee().min(0).max(1).optional(),speedPriority:Ee().min(0).max(1).optional(),intelligencePriority:Ee().min(0).max(1).optional()}),eS=X({mode:Ke(["auto","required","none"]).optional()}),tS=X({type:ae("tool_result"),toolUseId:k().describe("The unique identifier for the corresponding tool call."),content:ie(Hl),structuredContent:xe().optional(),isError:Pe().optional(),_meta:Re(k(),xe()).optional()}),rS=ll("type",[Fl,Gl,Bl]),xs=ll("type",[Fl,Gl,Bl,$0,tS]),nS=X({role:ji,content:ke([xs,ie(xs)]),_meta:Re(k(),xe()).optional()}),oS=Ks.extend({messages:ie(nS),modelPreferences:Q0.optional(),systemPrompt:k().optional(),includeContext:Ke(["none","thisServer","allServers"]).optional(),temperature:Ee().optional(),maxTokens:Ee().int(),stopSequences:ie(k()).optional(),metadata:Ut.optional(),tools:ie(bd).optional(),toolChoice:eS.optional()}),iS=Ft.extend({method:ae("sampling/createMessage"),params:oS}),sS=Gt.extend({model:k(),stopReason:$e(Ke(["endTurn","stopSequence","maxTokens"]).or(k())),role:ji,content:rS}),aS=Gt.extend({model:k(),stopReason:$e(Ke(["endTurn","stopSequence","maxTokens","toolUse"]).or(k())),role:ji,content:ke([xs,ie(xs)])}),Td=X({type:ae("boolean"),title:k().optional(),description:k().optional(),default:Pe().optional()}),zl=X({type:ae("string"),title:k().optional(),description:k().optional(),minLength:Ee().optional(),maxLength:Ee().optional(),format:Ke(["email","uri","date","date-time"]).optional(),default:k().optional()}),cl=X({type:Ke(["number","integer"]),title:k().optional(),description:k().optional(),minimum:Ee().optional(),maximum:Ee().optional(),default:Ee().optional()}),Cd=X({type:ae("string"),title:k().optional(),description:k().optional(),enum:ie(k()),default:k().optional()}),Rd=X({type:ae("string"),title:k().optional(),description:k().optional(),oneOf:ie(X({const:k(),title:k()})),default:k().optional()}),Ad=X({type:ae("string"),title:k().optional(),description:k().optional(),enum:ie(k()),enumNames:ie(k()).optional(),default:k().optional()}),lS=ke([Cd,Rd]),Id=X({type:ae("array"),title:k().optional(),description:k().optional(),minItems:Ee().optional(),maxItems:Ee().optional(),items:X({type:ae("string"),enum:ie(k())}),default:ie(k()).optional()}),Pd=X({type:ae("array"),title:k().optional(),description:k().optional(),minItems:Ee().optional(),maxItems:Ee().optional(),items:X({anyOf:ie(X({const:k(),title:k()}))}),default:ie(k()).optional()}),cS=ke([Id,Pd]),uS=ke([Ad,lS,cS]),kd=ke([uS,Td,zl,cl]),Vl=Ks.extend({mode:ae("form").optional(),message:k(),requestedSchema:X({type:ae("object"),properties:Re(k(),kd),required:ie(k()).optional()}).catchall(xe())}),dS=Ks.extend({mode:ae("url"),message:k(),elicitationId:k(),url:k().url()}),fS=ke([Vl,dS]),pS=Ft.extend({method:ae("elicitation/create"),params:fS}),hS=_r.extend({elicitationId:k()}),mS=yr.extend({method:ae("notifications/elicitation/complete"),params:hS}),gS=Gt.extend({action:Ke(["accept","decline","cancel"]),content:Ds((e)=>e===null?void 0:e,Re(k(),ke([k(),Ee(),Pe(),ie(k())])).optional())}),vS=X({type:ae("ref/resource"),uri:k()}),_S=X({type:ae("ref/prompt"),name:k()}),yS=nr.extend({ref:ke([_S,vS]),argument:X({name:k(),value:k()}),context:X({arguments:Re(k(),k()).optional()}).optional()}),SS=Ft.extend({method:ae("completion/complete"),params:yS}),ES=Gt.extend({completion:Ge({values:ie(k()).max(100),total:$e(Ee().int()),hasMore:$e(Pe())})}),bS=X({uri:k().startsWith("file://"),name:k().optional(),_meta:Re(k(),xe()).optional()}),wS=Ft.extend({method:ae("roots/list"),params:nr.optional()}),TS=Gt.extend({roots:ie(bS)}),CS=yr.extend({method:ae("notifications/roots/list_changed"),params:_r.optional()}),VO=Ge({ttl:Ee().optional(),pollInterval:Ee().optional()}),RS=Ke(["working","input_required","completed","failed","cancelled"]),Wi=X({taskId:k(),status:RS,ttl:ke([Ee(),Ms()]),createdAt:k(),lastUpdatedAt:k(),pollInterval:$e(Ee()),statusMessage:$e(k())}),jO=Gt.extend({task:Wi}),AS=_r.merge(Wi),WO=yr.extend({method:ae("notifications/tasks/status"),params:AS}),JO=Ft.extend({method:ae("tasks/get"),params:nr.extend({taskId:k()})}),KO=Gt.merge(Wi),XO=Ft.extend({method:ae("tasks/result"),params:nr.extend({taskId:k()})}),YO=Gt.loose(),ZO=zi.extend({method:ae("tasks/list")}),QO=Vi.extend({tasks:ie(Wi)}),e1=Ft.extend({method:ae("tasks/cancel"),params:nr.extend({taskId:k()})}),t1=Gt.merge(Wi),r1=ke([hd,e0,n0,SS,K0,D0,N0,c0,d0,h0,_0,S0,b0,j0,H0]),n1=ke([fd,md,r0,CS]),o1=ke([dd,sS,aS,gS,TS]),i1=ke([hd,iS,pS,wS]),s1=ke([fd,md,Y0,I0,g0,W0,F0,T0,mS]),a1=ke([dd,t0,o0,ES,U0,O0,u0,f0,m0,wd,z0,R0]),Qt=$y().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:AO.custom,message:"URL must be parseable",fatal:!0}),kA}).refine((e)=>{let t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),l1=Ge({resource:k().url(),authorization_servers:ie(Qt).optional(),jwks_uri:k().url().optional(),scopes_supported:ie(k()).optional(),bearer_methods_supported:ie(k()).optional(),resource_signing_alg_values_supported:ie(k()).optional(),resource_name:k().optional(),resource_documentation:k().optional(),resource_policy_uri:k().url().optional(),resource_tos_uri:k().url().optional(),tls_client_certificate_bound_access_tokens:Pe().optional(),authorization_details_types_supported:ie(k()).optional(),dpop_signing_alg_values_supported:ie(k()).optional(),dpop_bound_access_tokens_required:Pe().optional()}),IS=Ge({issuer:k(),authorization_endpoint:Qt,token_endpoint:Qt,registration_endpoint:Qt.optional(),scopes_supported:ie(k()).optional(),response_types_supported:ie(k()),response_modes_supported:ie(k()).optional(),grant_types_supported:ie(k()).optional(),token_endpoint_auth_methods_supported:ie(k()).optional(),token_endpoint_auth_signing_alg_values_supported:ie(k()).optional(),service_documentation:Qt.optional(),revocation_endpoint:Qt.optional(),revocation_endpoint_auth_methods_supported:ie(k()).optional(),revocation_endpoint_auth_signing_alg_values_supported:ie(k()).optional(),introspection_endpoint:k().optional(),introspection_endpoint_auth_methods_supported:ie(k()).optional(),introspection_endpoint_auth_signing_alg_values_supported:ie(k()).optional(),code_challenge_methods_supported:ie(k()).optional(),client_id_metadata_document_supported:Pe().optional(),authorization_response_iss_parameter_supported:Pe().optional().catch(void 0),dpop_signing_alg_values_supported:ie(k()).optional()}),PS=Ge({issuer:k(),authorization_endpoint:Qt,token_endpoint:Qt,userinfo_endpoint:Qt.optional(),jwks_uri:Qt,registration_endpoint:Qt.optional(),scopes_supported:ie(k()).optional(),response_types_supported:ie(k()),response_modes_supported:ie(k()).optional(),grant_types_supported:ie(k()).optional(),acr_values_supported:ie(k()).optional(),subject_types_supported:ie(k()),id_token_signing_alg_values_supported:ie(k()),id_token_encryption_alg_values_supported:ie(k()).optional(),id_token_encryption_enc_values_supported:ie(k()).optional(),userinfo_signing_alg_values_supported:ie(k()).optional(),userinfo_encryption_alg_values_supported:ie(k()).optional(),userinfo_encryption_enc_values_supported:ie(k()).optional(),request_object_signing_alg_values_supported:ie(k()).optional(),request_object_encryption_alg_values_supported:ie(k()).optional(),request_object_encryption_enc_values_supported:ie(k()).optional(),token_endpoint_auth_methods_supported:ie(k()).optional(),token_endpoint_auth_signing_alg_values_supported:ie(k()).optional(),display_values_supported:ie(k()).optional(),claim_types_supported:ie(k()).optional(),claims_supported:ie(k()).optional(),service_documentation:k().optional(),claims_locales_supported:ie(k()).optional(),ui_locales_supported:ie(k()).optional(),claims_parameter_supported:Pe().optional(),request_parameter_supported:Pe().optional(),request_uri_parameter_supported:Pe().optional(),require_request_uri_registration:Pe().optional(),op_policy_uri:Qt.optional(),op_tos_uri:Qt.optional(),client_id_metadata_document_supported:Pe().optional(),authorization_response_iss_parameter_supported:Pe().optional().catch(void 0)}),c1=X({...PS.shape,...IS.pick({code_challenge_methods_supported:!0}).shape}),u1=X({access_token:k(),id_token:k().optional(),token_type:k(),expires_in:zy.number().optional(),scope:k().optional(),refresh_token:k().optional(),issuer:k().optional().catch(void 0)}).strip(),d1=X({issued_token_type:ae("urn:ietf:params:oauth:token-type:id-jag"),access_token:k(),token_type:k().optional(),expires_in:Ee().optional(),scope:k().optional()}).strip(),f1=X({error:k(),error_description:k().optional(),error_uri:k().optional()}),Wp=Qt.optional().or(ae("").transform(()=>{return})),kS=X({redirect_uris:ie(Qt),token_endpoint_auth_method:k().optional(),grant_types:ie(k()).optional(),response_types:ie(k()).optional(),application_type:k().optional(),client_name:k().optional(),client_uri:Qt.optional(),logo_uri:Wp,scope:k().optional(),contacts:ie(k()).optional(),tos_uri:Wp,policy_uri:k().optional(),jwks_uri:Qt.optional(),jwks:tO().optional(),software_id:k().optional(),software_version:k().optional(),software_statement:k().optional()}).strip(),NS=X({client_id:k(),client_secret:k().optional(),client_id_issued_at:Ee().optional(),client_secret_expires_at:Ee().optional(),issuer:k().optional().catch(void 0)}).strip(),p1=kS.merge(NS),h1=X({error:k(),error_description:k().optional()}).strip(),m1=X({token:k(),token_type_hint:k().optional()}).strip(),su=Symbol.for("mcp.sdk.errorBrands");function Nd(e,t){let r=new Set,n=t;while(typeof n==="function"){let o=n.mcpBrand;if(Object.prototype.hasOwnProperty.call(n,"mcpBrand")&&typeof o==="string")r.add(o);n=Object.getPrototypeOf(n)}if(r.size===0)return;Object.defineProperty(e,su,{value:r,enumerable:!1,configurable:!0})}function Di(e,t){try{if(typeof t==="object"&&t!==null&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&typeof e.mcpBrand==="string"&&Object.prototype.hasOwnProperty.call(t,su)){let r=t[su];if(r&&typeof r.has==="function"&&r.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var nj=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return Di(this,t)}static isInstance(t){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Di(this,t)}constructor(t,r,n){super(r);this.code=t,this.errorUri=n,this.name="OAuthError",Nd(this,new.target)}toResponseObject(){let t={error:this.code,error_description:this.message};if(this.errorUri)t.error_uri=this.errorUri;return t}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}},tt=function(e){return e.NotConnected="NOT_CONNECTED",e.AlreadyConnected="ALREADY_CONNECTED",e.NotInitialized="NOT_INITIALIZED",e.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",e.RequestTimeout="REQUEST_TIMEOUT",e.ConnectionClosed="CONNECTION_CLOSED",e.SendFailed="SEND_FAILED",e.InvalidResult="INVALID_RESULT",e.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",e.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",e.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",e.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",e.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",e.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",e.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",e.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",e.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",e.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",e.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",e}({}),Ye=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return Di(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Di(this,e)}constructor(e,t,r,n){super(t,n);this.code=e,this.data=r,this.name="SdkError",Nd(this,new.target)}},oj=class extends Ye{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(e,t,r,n){super(e,t,r,n);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};function Jp(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function g1(e,t,r){return e==="elicitation"&&t==="form"&&r.form===void 0&&r.url===void 0}function v1(e){switch(e.method){case"elicitation/create":if(e.params?.mode==="url")return{elicitation:{url:{}}};return{elicitation:{form:{}}};case"sampling/createMessage":{let t=e.params;if(t!==void 0&&(t.tools!==void 0||t.toolChoice!==void 0))return{sampling:{tools:{}}};return{sampling:{}}}case"roots/list":return{roots:{}};default:return}}function OS(e,t){let r={};for(let[n,o]of Object.entries(e)){if(o===void 0)continue;let i=t===void 0?void 0:t[n];if(i===void 0){r[n]=o;continue}if(Jp(o)&&Jp(i)){let s={};for(let[l,a]of Object.entries(o))if(a!==void 0&&i[l]===void 0&&!g1(n,l,i))s[l]=a;if(Object.keys(s).length>0)r[n]=s}}return Object.keys(r).length>0?r:void 0}var MS="2026-07-28",_i=[MS];function Xs(e){return e>=MS}function _1(e){return e.filter((t)=>!Xs(t))}function Kp(e){return e.filter((t)=>Xs(t))}function DS(e){let t=e.structuredContent;if(t===void 0)return e;if(!(typeof t!=="object"||t===null||Array.isArray(t)))return e;if(e.content?.some((r)=>r.type==="text")??!1)return e;return{...e,content:[...e.content??[],{type:"text",text:JSON.stringify(t)}]}}var $S=["task","inputRequests","requestState"];function xS(e){if(e===null||typeof e!=="object"||Array.isArray(e)||e.content!==void 0||$S.some((t)=>(t in e)))return e;return{...e,content:[]}}function y1(){let e=rd(()=>ke([k(),Ee(),Pe(),Ms(),Re(k(),e),ie(e)])),t=Re(k(),e),r=ke([k(),Ee().int()]),n=k(),o=X({ttl:Ee().optional()}),i=X({taskId:k()}),s=Ge({progressToken:r.optional(),"io.modelcontextprotocol/related-task":i.optional()}),l=X({_meta:s.optional()}),a=l.extend({task:o.optional()}),c=X({method:k(),params:l.loose().optional()}),u=X({_meta:s.optional()}),f=X({method:k(),params:u.loose().optional()}),h=Ge({_meta:s.optional()}),g=ke([k(),Ee().int()]),p=h.strict(),_=u.extend({requestId:g.optional(),reason:k().optional()}),y=f.extend({method:ae("notifications/cancelled"),params:_}),S=X({src:k(),mimeType:k().optional(),sizes:ie(k()).optional(),theme:Ke(["light","dark"]).optional()}),E=X({icons:ie(S).optional()}),b=X({name:k(),title:k().optional()}),R=b.extend({...b.shape,...E.shape,version:k(),websiteUrl:k().optional(),description:k().optional()}),w=Fo(X({applyDefaults:Pe().optional()}),t),T=Ds((Vt)=>{if(Vt&&typeof Vt==="object"&&!Array.isArray(Vt)&&Object.keys(Vt).length===0)return{form:{}};return Vt},Fo(X({form:w.optional(),url:t.optional()}),t.optional())),C=Ge({list:t.optional(),cancel:t.optional(),requests:Ge({sampling:Ge({createMessage:t.optional()}).optional(),elicitation:Ge({create:t.optional()}).optional()}).optional()}),A=Ge({list:t.optional(),cancel:t.optional(),requests:Ge({tools:Ge({call:t.optional()}).optional()}).optional()}),P=X({experimental:Re(k(),t).optional(),sampling:X({context:t.optional(),tools:t.optional()}).optional(),elicitation:T.optional(),roots:X({listChanged:Pe().optional()}).optional(),tasks:C.optional(),extensions:Re(k(),t).optional()}),D=l.extend({protocolVersion:k(),capabilities:P,clientInfo:R}),N=c.extend({method:ae("initialize"),params:D}),F=X({experimental:Re(k(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:X({listChanged:Pe().optional()}).optional(),resources:X({subscribe:Pe().optional(),listChanged:Pe().optional()}).optional(),tools:X({listChanged:Pe().optional()}).optional(),tasks:A.optional(),extensions:Re(k(),t).optional()}),G=h.extend({protocolVersion:k(),capabilities:F,serverInfo:R,instructions:k().optional()}),B=f.extend({method:ae("notifications/initialized"),params:u.optional()}),Q=c.extend({method:ae("ping"),params:l.optional()}),pe=X({progress:Ee(),total:$e(Ee()),message:$e(k())}),se=X({...u.shape,...pe.shape,progressToken:r}),ve=f.extend({method:ae("notifications/progress"),params:se}),me=l.extend({cursor:n.optional()}),j=c.extend({params:me.optional()}),ne=h.extend({nextCursor:n.optional()}),he=X({uri:k(),mimeType:$e(k()),_meta:Re(k(),xe()).optional()}),q=he.extend({text:k()}),K=k().refine((Vt)=>{try{return atob(Vt),!0}catch{return!1}},{message:"Invalid Base64 string"}),W=he.extend({blob:K}),be=Ke(["user","assistant"]),Ce=X({audience:ie(be).optional(),priority:Ee().min(0).max(1).optional(),lastModified:Fi.datetime({offset:!0}).optional()}),ze=X({...b.shape,...E.shape,uri:k(),description:$e(k()),mimeType:$e(k()),size:$e(Ee()),annotations:Ce.optional(),_meta:$e(Ge({}))}),Ie=X({...b.shape,...E.shape,uriTemplate:k(),description:$e(k()),mimeType:$e(k()),annotations:Ce.optional(),_meta:$e(Ge({}))}),je=j.extend({method:ae("resources/list")}),U=ne.extend({resources:ie(ze)}),O=j.extend({method:ae("resources/templates/list")}),x=ne.extend({resourceTemplates:ie(Ie)}),H=l.extend({uri:k()}),J=H,Y=c.extend({method:ae("resources/read"),params:J}),ee=h.extend({contents:ie(ke([q,W]))}),Z=f.extend({method:ae("notifications/resources/list_changed"),params:u.optional()}),te=H,oe=c.extend({method:ae("resources/subscribe"),params:te}),L=H,V=c.extend({method:ae("resources/unsubscribe"),params:L}),ce=u.extend({uri:k()}),ue=f.extend({method:ae("notifications/resources/updated"),params:ce}),ge=X({name:k(),description:$e(k()),required:$e(Pe())}),Ne=X({...b.shape,...E.shape,description:$e(k()),arguments:$e(ie(ge)),_meta:$e(Ge({}))}),et=j.extend({method:ae("prompts/list")}),He=ne.extend({prompts:ie(Ne)}),We=l.extend({name:k(),arguments:Re(k(),k()).optional()}),St=c.extend({method:ae("prompts/get"),params:We}),Kt=X({type:ae("text"),text:k(),annotations:Ce.optional(),_meta:Re(k(),xe()).optional()}),Xt=X({type:ae("image"),data:K,mimeType:k(),annotations:Ce.optional(),_meta:Re(k(),xe()).optional()}),xt=X({type:ae("audio"),data:K,mimeType:k(),annotations:Ce.optional(),_meta:Re(k(),xe()).optional()}),It=X({type:ae("tool_use"),name:k(),id:k(),input:Re(k(),xe()),_meta:Re(k(),xe()).optional()}),at=X({type:ae("resource"),resource:ke([q,W]),annotations:Ce.optional(),_meta:Re(k(),xe()).optional()}),Ue=ze.extend({type:ae("resource_link")}),Ve=ke([Kt,Xt,xt,Ue,at]),Qe=X({role:be,content:Ve}),or=h.extend({description:k().optional(),messages:ie(Qe)}),Lt=f.extend({method:ae("notifications/prompts/list_changed"),params:u.optional()}),Dt=X({title:k().optional(),readOnlyHint:Pe().optional(),destructiveHint:Pe().optional(),idempotentHint:Pe().optional(),openWorldHint:Pe().optional()}),ir=X({taskSupport:Ke(["required","optional","forbidden"]).optional()}),sr=X({...b.shape,...E.shape,description:k().optional(),inputSchema:X({type:ae("object"),properties:Re(k(),e).optional(),required:ie(k()).optional()}).catchall(xe()),outputSchema:X({type:ae("object"),properties:Re(k(),e).optional(),required:ie(k()).optional()}).catchall(xe()).optional(),annotations:Dt.optional(),execution:ir.optional(),_meta:Re(k(),xe()).optional()}),Rr=j.extend({method:ae("tools/list")}),Sr=ne.extend({tools:ie(sr)}),Er=h.extend({content:ie(Ve),structuredContent:Re(k(),xe()).optional(),isError:Pe().optional()}),qt=a.extend({name:k(),arguments:Re(k(),xe()).optional()}),vo=c.extend({method:ae("tools/call"),params:qt}),Jo=f.extend({method:ae("notifications/tools/list_changed"),params:u.optional()}),Gn=Ke(["debug","info","notice","warning","error","critical","alert","emergency"]),Bn=l.extend({level:Gn}),pn=c.extend({method:ae("logging/setLevel"),params:Bn}),hn=u.extend({level:Gn,logger:k().optional(),data:xe()}),_o=f.extend({method:ae("notifications/message"),params:hn}),fr=X({name:k().optional()}),Hn=X({hints:ie(fr).optional(),costPriority:Ee().min(0).max(1).optional(),speedPriority:Ee().min(0).max(1).optional(),intelligencePriority:Ee().min(0).max(1).optional()}),yo=X({mode:Ke(["auto","required","none"]).optional()}),Ko=X({type:ae("tool_result"),toolUseId:k().describe("The unique identifier for the corresponding tool call."),content:ie(Ve),structuredContent:X({}).loose().optional(),isError:Pe().optional(),_meta:Re(k(),xe()).optional()}),pr=ll("type",[Kt,Xt,xt]),Bt=ll("type",[Kt,Xt,xt,It,Ko]),br=X({role:be,content:ke([Bt,ie(Bt)]),_meta:Re(k(),xe()).optional()}),mn=a.extend({messages:ie(br),modelPreferences:Hn.optional(),systemPrompt:k().optional(),includeContext:Ke(["none","thisServer","allServers"]).optional(),temperature:Ee().optional(),maxTokens:Ee().int(),stopSequences:ie(k()).optional(),metadata:t.optional(),tools:ie(sr).optional(),toolChoice:yo.optional()}),wr=c.extend({method:ae("sampling/createMessage"),params:mn}),zn=h.extend({model:k(),stopReason:$e(Ke(["endTurn","stopSequence","maxTokens"]).or(k())),role:be,content:pr}),gn=h.extend({model:k(),stopReason:$e(Ke(["endTurn","stopSequence","maxTokens","toolUse"]).or(k())),role:be,content:ke([Bt,ie(Bt)])}),Vn=X({type:ae("boolean"),title:k().optional(),description:k().optional(),default:Pe().optional()}),Yr=X({type:ae("string"),title:k().optional(),description:k().optional(),minLength:Ee().optional(),maxLength:Ee().optional(),format:Ke(["email","uri","date","date-time"]).optional(),default:k().optional()}),jn=X({type:Ke(["number","integer"]),title:k().optional(),description:k().optional(),minimum:Ee().optional(),maximum:Ee().optional(),default:Ee().optional()}),Wn=X({type:ae("string"),title:k().optional(),description:k().optional(),enum:ie(k()),default:k().optional()}),Jn=X({type:ae("string"),title:k().optional(),description:k().optional(),oneOf:ie(X({const:k(),title:k()})),default:k().optional()}),Kn=X({type:ae("string"),title:k().optional(),description:k().optional(),enum:ie(k()),enumNames:ie(k()).optional(),default:k().optional()}),Xn=ke([Wn,Jn]),qr=X({type:ae("array"),title:k().optional(),description:k().optional(),minItems:Ee().optional(),maxItems:Ee().optional(),items:X({type:ae("string"),enum:ie(k())}),default:ie(k()).optional()}),Ur=X({type:ae("array"),title:k().optional(),description:k().optional(),minItems:Ee().optional(),maxItems:Ee().optional(),items:X({anyOf:ie(X({const:k(),title:k()}))}),default:ie(k()).optional()}),Xo=ke([qr,Ur]),Yo=ke([Kn,Xn,Xo]),ar=ke([Yo,Vn,Yr,jn]),lr=a.extend({mode:ae("form").optional(),message:k(),requestedSchema:X({type:ae("object"),properties:Re(k(),ar),required:ie(k()).optional()}).catchall(xe())}),Yn=a.extend({mode:ae("url"),message:k(),elicitationId:k(),url:k().url()}),zt=ke([lr,Yn]),Zo=c.extend({method:ae("elicitation/create"),params:zt}),vn=u.extend({elicitationId:k()}),Zr=f.extend({method:ae("notifications/elicitation/complete"),params:vn}),_n=h.extend({action:Ke(["accept","decline","cancel"]),content:Ds((Vt)=>Vt===null?void 0:Vt,Re(k(),ke([k(),Ee(),Pe(),ie(k())])).optional())}),Yt=X({type:ae("ref/resource"),uri:k()}),So=X({type:ae("ref/prompt"),name:k()}),Zn=l.extend({ref:ke([So,Yt]),argument:X({name:k(),value:k()}),context:X({arguments:Re(k(),k()).optional()}).optional()}),Qn=c.extend({method:ae("completion/complete"),params:Zn}),yn=h.extend({completion:Ge({values:ie(k()).max(100),total:$e(Ee().int()),hasMore:$e(Pe())})}),Sn=X({uri:k().startsWith("file://"),name:k().optional(),_meta:Re(k(),xe()).optional()}),En=c.extend({method:ae("roots/list"),params:l.optional()}),Eo=h.extend({roots:ie(Sn)}),Qo=f.extend({method:ae("notifications/roots/list_changed"),params:u.optional()}),eo=Ge({ttl:Ee().optional(),pollInterval:Ee().optional()}),Fr=Ke(["working","input_required","completed","failed","cancelled"]),Qr=X({taskId:k(),status:Fr,ttl:ke([Ee(),Ms()]),createdAt:k(),lastUpdatedAt:k(),pollInterval:$e(Ee()),statusMessage:$e(k())}),tr=h.extend({task:Qr}),ei=u.merge(Qr),en=f.extend({method:ae("notifications/tasks/status"),params:ei}),bn=c.extend({method:ae("tasks/get"),params:l.extend({taskId:k()})}),to=h.merge(Qr),wn=c.extend({method:ae("tasks/result"),params:l.extend({taskId:k()})}),bo=h.loose(),Pt=j.extend({method:ae("tasks/list")}),Et=ne.extend({tasks:ie(Qr)}),tn=c.extend({method:ae("tasks/cancel"),params:l.extend({taskId:k()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:n,TaskMetadataSchema:o,RelatedTaskMetadataSchema:i,RequestMetaSchema:s,BaseRequestParamsSchema:l,TaskAugmentedRequestParamsSchema:a,RequestSchema:c,NotificationsParamsSchema:u,NotificationSchema:f,ResultSchema:h,RequestIdSchema:g,EmptyResultSchema:p,CancelledNotificationParamsSchema:_,CancelledNotificationSchema:y,IconSchema:S,IconsSchema:E,BaseMetadataSchema:b,ImplementationSchema:R,ClientTasksCapabilitySchema:C,ServerTasksCapabilitySchema:A,ClientCapabilitiesSchema:P,InitializeRequestParamsSchema:D,InitializeRequestSchema:N,ServerCapabilitiesSchema:F,InitializeResultSchema:G,InitializedNotificationSchema:B,PingRequestSchema:Q,ProgressSchema:pe,ProgressNotificationParamsSchema:se,ProgressNotificationSchema:ve,PaginatedRequestParamsSchema:me,PaginatedRequestSchema:j,PaginatedResultSchema:ne,ResourceContentsSchema:he,TextResourceContentsSchema:q,BlobResourceContentsSchema:W,RoleSchema:be,AnnotationsSchema:Ce,ResourceSchema:ze,ResourceTemplateSchema:Ie,ListResourcesRequestSchema:je,ListResourcesResultSchema:U,ListResourceTemplatesRequestSchema:O,ListResourceTemplatesResultSchema:x,ResourceRequestParamsSchema:H,ReadResourceRequestParamsSchema:J,ReadResourceRequestSchema:Y,ReadResourceResultSchema:ee,ResourceListChangedNotificationSchema:Z,SubscribeRequestParamsSchema:te,SubscribeRequestSchema:oe,UnsubscribeRequestParamsSchema:L,UnsubscribeRequestSchema:V,ResourceUpdatedNotificationParamsSchema:ce,ResourceUpdatedNotificationSchema:ue,PromptArgumentSchema:ge,PromptSchema:Ne,ListPromptsRequestSchema:et,ListPromptsResultSchema:He,GetPromptRequestParamsSchema:We,GetPromptRequestSchema:St,TextContentSchema:Kt,ImageContentSchema:Xt,AudioContentSchema:xt,ToolUseContentSchema:It,EmbeddedResourceSchema:at,ResourceLinkSchema:Ue,ContentBlockSchema:Ve,PromptMessageSchema:Qe,GetPromptResultSchema:or,PromptListChangedNotificationSchema:Lt,ToolAnnotationsSchema:Dt,ToolExecutionSchema:ir,ToolSchema:sr,ListToolsRequestSchema:Rr,ListToolsResultSchema:Sr,CallToolResultSchema:Er,CallToolRequestParamsSchema:qt,CallToolRequestSchema:vo,ToolListChangedNotificationSchema:Jo,LoggingLevelSchema:Gn,SetLevelRequestParamsSchema:Bn,SetLevelRequestSchema:pn,LoggingMessageNotificationParamsSchema:hn,LoggingMessageNotificationSchema:_o,ModelHintSchema:fr,ModelPreferencesSchema:Hn,ToolChoiceSchema:yo,ToolResultContentSchema:Ko,SamplingContentSchema:pr,SamplingMessageContentBlockSchema:Bt,SamplingMessageSchema:br,CreateMessageRequestParamsSchema:mn,CreateMessageRequestSchema:wr,CreateMessageResultSchema:zn,CreateMessageResultWithToolsSchema:gn,BooleanSchemaSchema:Vn,StringSchemaSchema:Yr,NumberSchemaSchema:jn,UntitledSingleSelectEnumSchemaSchema:Wn,TitledSingleSelectEnumSchemaSchema:Jn,LegacyTitledEnumSchemaSchema:Kn,SingleSelectEnumSchemaSchema:Xn,UntitledMultiSelectEnumSchemaSchema:qr,TitledMultiSelectEnumSchemaSchema:Ur,MultiSelectEnumSchemaSchema:Xo,EnumSchemaSchema:Yo,PrimitiveSchemaDefinitionSchema:ar,ElicitRequestFormParamsSchema:lr,ElicitRequestURLParamsSchema:Yn,ElicitRequestParamsSchema:zt,ElicitRequestSchema:Zo,ElicitationCompleteNotificationParamsSchema:vn,ElicitationCompleteNotificationSchema:Zr,ElicitResultSchema:_n,ResourceTemplateReferenceSchema:Yt,PromptReferenceSchema:So,CompleteRequestParamsSchema:Zn,CompleteRequestSchema:Qn,CompleteResultSchema:yn,RootSchema:Sn,ListRootsRequestSchema:En,ListRootsResultSchema:Eo,RootsListChangedNotificationSchema:Qo,TaskCreationParamsSchema:eo,TaskStatusSchema:Fr,TaskSchema:Qr,CreateTaskResultSchema:tr,TaskStatusNotificationParamsSchema:ei,TaskStatusNotificationSchema:en,GetTaskRequestSchema:bn,GetTaskResultSchema:to,GetTaskPayloadRequestSchema:wn,GetTaskPayloadResultSchema:bo,ListTasksRequestSchema:Pt,ListTasksResultSchema:Et,CancelTaskRequestSchema:tn,CancelTaskResultSchema:h.merge(Qr),ClientRequestSchema:ke([Q,N,Qn,pn,St,et,je,O,Y,oe,V,vo,Rr,bn,wn,Pt,tn]),ClientNotificationSchema:ke([y,ve,B,Qo,en]),ClientResultSchema:ke([p,zn,gn,_n,Eo,to,Et,tr]),ServerRequestSchema:ke([Q,wr,Zo,En,bn,wn,Pt,tn]),ServerNotificationSchema:ke([y,ve,_o,ue,Z,Jo,Lt,en,Zr]),ServerResultSchema:ke([p,G,yn,or,He,U,x,ee,Er,Sr,to,Et,tr]),CallToolResultWireSchema:xe().superRefine((Vt,ea)=>{if(typeof Vt!=="object"||Vt===null||Array.isArray(Vt)||Vt.content!==void 0)return;for(let wo of $S)if(wo in Vt){ea.addIssue({code:"custom",message:`content is required when the body carries '${wo}' — another result family cannot default into an empty tools/call success`});return}}).transform(xS).pipe(Er)}}var S1;function LS(){return S1??=y1()}function qS(e){return e.type!=="object"}var E1=new Set(["const","enum","default","examples"]),b1=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function Xp(e){return e!==void 0&&!(typeof e==="string"&&e.startsWith("#"))}function w1(e){let t=typeof e.$schema==="string"?e.$schema:void 0;if(Xp(e.$id))return{...t!==void 0&&{$schema:t},type:"object",properties:{result:e},required:["result"]};let r=HR(e.$schema)&&e.$recursiveAnchor!==!0,n=(o,i)=>{if(Array.isArray(o))return o.map((a)=>n(a,!1));if(o===null||typeof o!=="object")return o;if(!i&&Xp(o.$id))return o;let s={},l=!1;for(let[a,c]of Object.entries(o))if(i)s[a]=n(c,!1);else if((a==="$ref"||a==="$dynamicRef")&&typeof c==="string")s[a]=c==="#"?"#/properties/result":c.startsWith("#/")?`#/properties/result${c.slice(1)}`:c;else if(a==="$recursiveRef"&&c==="#"&&r)l=!0;else if(E1.has(a))s[a]=c;else if(b1.has(a))s[a]=n(c,!0);else s[a]=n(c,!1);if(l)if("$ref"in s)s.allOf=[...Array.isArray(s.allOf)?s.allOf:[],{$ref:"#/properties/result"}];else s.$ref="#/properties/result";return s};return{...t!==void 0&&{$schema:t},type:"object",properties:{result:n(e,!1)},required:["result"]}}var US={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},FS={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},T1={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Ra;function Od(){if(Ra)return Ra;let e=LS();return Ra={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},Ra}function GS(e){return Object.prototype.hasOwnProperty.call(US,e)}function BS(e){return Object.prototype.hasOwnProperty.call(FS,e)}function C1(e){return Object.prototype.hasOwnProperty.call(T1,e)}function R1(e){return C1(e)?Od().resultSchemas[e]:void 0}function A1(e){return GS(e)?Od().requestSchemas[e]:void 0}function I1(e){return BS(e)?Od().notificationSchemas[e]:void 0}var ij=Object.keys(US),sj=Object.keys(FS);function au(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Aa(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var Yp={ok:!1,reason:"not-in-era"};function Zp(e){return au(e)&&au(e.outputSchema)&&qS(e.outputSchema)}function Qp(e){return e}var Md={era:"2025-11-25",hasRequestMethod:GS,hasNotificationMethod:BS,validateRequest:(e,t)=>Aa(A1(e),t),validateResult:(e,t)=>Aa(R1(e),t),validateNotification:(e,t)=>Aa(I1(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Yp,validateInputResponse:()=>Yp,samplingResultVariant:(e,t)=>{let r=LS();return Aa(e?r.CreateMessageResultWithToolsSchema:r.CreateMessageResultSchema,t)},outboundEnvelope:(e)=>{return},validateEnvelopeMeta:(e)=>[],projectCallToolResult(e,t){let r=DS(e),n=r.structuredContent;if(n===void 0)return r;let o=typeof n!=="object"||n===null||Array.isArray(n),i=t!==void 0&&qS(t);if(!o&&!i)return r;return{...r,structuredContent:{result:n}}},decodeResult(e,t){if(au(t)&&"resultType"in t){let r={...t};return delete r.resultType,{kind:"complete",result:Qp(r)}}return{kind:"complete",result:Qp(t)}},encodeResult(e,t){if(e!=="tools/list")return t;let r=t.tools;if(!Array.isArray(r)||!r.some((n)=>Zp(n)))return t;return{...t,tools:r.map((n)=>Zp(n)?{...n,outputSchema:w1(n.outputSchema)}:n)}},encodeErrorCode:(e)=>e===-32002?-32602:e,checkInboundEnvelope:(e)=>{return}};function P1(){let e=rd(()=>ke([k(),Ee(),Pe(),Ms(),Re(k(),e),ie(e)])),t=Re(k(),e),r=ke([k(),Ee().int()]),n=k(),o=ke([k(),Ee().int()]),i=Ke(["user","assistant"]),s=Ke(["debug","info","notice","warning","error","critical","alert","emergency"]),l=k().refine((Et)=>{try{return atob(Et),!0}catch{return!1}},{message:"Invalid Base64 string"}),a=X({ttl:Ee().optional()}),c=X({taskId:k()}),u=Ge({progressToken:r.optional(),"io.modelcontextprotocol/related-task":c.optional()}),f=X({_meta:u.optional()}),h=f.extend({task:a.optional()}),g=X({_meta:u.optional()}),p=X({method:k(),params:g.loose().optional()}),_=X({src:k(),mimeType:k().optional(),sizes:ie(k()).optional(),theme:Ke(["light","dark"]).optional()}),y=X({icons:ie(_).optional()}),S=X({name:k(),title:k().optional()}),E=S.extend({...S.shape,...y.shape,version:k(),websiteUrl:k().optional(),description:k().optional()}),b=Fo(X({applyDefaults:Pe().optional()}),t),R=Ds((Et)=>{if(Et&&typeof Et==="object"&&!Array.isArray(Et)&&Object.keys(Et).length===0)return{form:{}};return Et},Fo(X({form:b.optional(),url:t.optional()}),t.optional())),w=Ge({list:t.optional(),cancel:t.optional(),requests:Ge({sampling:Ge({createMessage:t.optional()}).optional(),elicitation:Ge({create:t.optional()}).optional()}).optional()}),T=Ge({list:t.optional(),cancel:t.optional(),requests:Ge({tools:Ge({call:t.optional()}).optional()}).optional()}),C=X({experimental:Re(k(),t).optional(),sampling:X({context:t.optional(),tools:t.optional()}).optional(),elicitation:R.optional(),roots:X({listChanged:Pe().optional()}).optional(),tasks:w.optional(),extensions:Re(k(),t).optional()}),A=X({experimental:Re(k(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:X({listChanged:Pe().optional()}).optional(),resources:X({subscribe:Pe().optional(),listChanged:Pe().optional()}).optional(),tools:X({listChanged:Pe().optional()}).optional(),tasks:T.optional(),extensions:Re(k(),t).optional()}),P=X({progress:Ee(),total:$e(Ee()),message:$e(k())}),D=X({...g.shape,...P.shape,progressToken:r}),N=p.extend({method:ae("notifications/progress"),params:D}),F=g.extend({level:s,logger:k().optional(),data:xe()}),G=p.extend({method:ae("notifications/message"),params:F}),B=X({uri:k(),mimeType:$e(k()),_meta:Re(k(),xe()).optional()}),Q=B.extend({text:k()}),pe=B.extend({blob:l}),se=X({audience:ie(i).optional(),priority:Ee().min(0).max(1).optional(),lastModified:Fi.datetime({offset:!0}).optional()}),ve=X({...S.shape,...y.shape,uri:k(),description:$e(k()),mimeType:$e(k()),size:$e(Ee()),annotations:se.optional(),_meta:$e(Ge({}))}),me=X({...S.shape,...y.shape,uriTemplate:k(),description:$e(k()),mimeType:$e(k()),annotations:se.optional(),_meta:$e(Ge({}))}),j=p.extend({method:ae("notifications/resources/list_changed"),params:g.optional()}),ne=g.extend({uri:k()}),he=p.extend({method:ae("notifications/resources/updated"),params:ne}),q=X({name:k(),description:$e(k()),required:$e(Pe())}),K=X({...S.shape,...y.shape,description:$e(k()),arguments:$e(ie(q)),_meta:$e(Ge({}))}),W=p.extend({method:ae("notifications/prompts/list_changed"),params:g.optional()}),be=X({type:ae("text"),text:k(),annotations:se.optional(),_meta:Re(k(),xe()).optional()}),Ce=X({type:ae("image"),data:l,mimeType:k(),annotations:se.optional(),_meta:Re(k(),xe()).optional()}),ze=X({type:ae("audio"),data:l,mimeType:k(),annotations:se.optional(),_meta:Re(k(),xe()).optional()}),Ie=X({type:ae("tool_use"),name:k(),id:k(),input:Re(k(),xe()),_meta:Re(k(),xe()).optional()}),je=X({type:ae("resource"),resource:ke([Q,pe]),annotations:se.optional(),_meta:Re(k(),xe()).optional()}),U=ve.extend({type:ae("resource_link")}),O=ke([be,Ce,ze,U,je]),x=X({role:i,content:O}),H=X({title:k().optional(),readOnlyHint:Pe().optional(),destructiveHint:Pe().optional(),idempotentHint:Pe().optional(),openWorldHint:Pe().optional()}),J=p.extend({method:ae("notifications/tools/list_changed"),params:g.optional()}),Y=X({name:k().optional()}),ee=X({hints:ie(Y).optional(),costPriority:Ee().min(0).max(1).optional(),speedPriority:Ee().min(0).max(1).optional(),intelligencePriority:Ee().min(0).max(1).optional()}),Z=X({mode:Ke(["auto","required","none"]).optional()}),te=X({type:ae("boolean"),title:k().optional(),description:k().optional(),default:Pe().optional()}),oe=X({type:ae("string"),title:k().optional(),description:k().optional(),minLength:Ee().optional(),maxLength:Ee().optional(),format:Ke(["email","uri","date","date-time"]).optional(),default:k().optional()}),L=X({type:Ke(["number","integer"]),title:k().optional(),description:k().optional(),minimum:Ee().optional(),maximum:Ee().optional(),default:Ee().optional()}),V=X({type:ae("string"),title:k().optional(),description:k().optional(),enum:ie(k()),default:k().optional()}),ce=X({type:ae("string"),title:k().optional(),description:k().optional(),oneOf:ie(X({const:k(),title:k()})),default:k().optional()}),ue=X({type:ae("string"),title:k().optional(),description:k().optional(),enum:ie(k()),enumNames:ie(k()).optional(),default:k().optional()}),ge=ke([V,ce]),Ne=X({type:ae("array"),title:k().optional(),description:k().optional(),minItems:Ee().optional(),maxItems:Ee().optional(),items:X({type:ae("string"),enum:ie(k())}),default:ie(k()).optional()}),et=X({type:ae("array"),title:k().optional(),description:k().optional(),minItems:Ee().optional(),maxItems:Ee().optional(),items:X({anyOf:ie(X({const:k(),title:k()}))}),default:ie(k()).optional()}),He=ke([Ne,et]),We=ke([ue,ge,He]),St=ke([We,te,oe,L]),Kt=h.extend({mode:ae("form").optional(),message:k(),requestedSchema:X({type:ae("object"),properties:Re(k(),St),required:ie(k()).optional()}).catchall(xe())}),Xt=X({type:ae("ref/resource"),uri:k()}),xt=X({type:ae("ref/prompt"),name:k()}),It=X({uri:k().startsWith("file://"),name:k().optional(),_meta:Re(k(),xe()).optional()}),at=C.shape,Ue=X({experimental:at.experimental,sampling:at.sampling,elicitation:at.elicitation,roots:at.roots,extensions:at.extensions}),Ve=A.shape,Qe=X({experimental:Ve.experimental,logging:Ve.logging,completions:Ve.completions,prompts:Ve.prompts,resources:Ve.resources,tools:Ve.tools,extensions:Ve.extensions}),or=Ge({progressToken:r.optional(),[Gi]:k(),[nd]:E.optional(),[Js]:Ue,[Dl]:s.optional()}),Lt=X({...S.shape,...y.shape,description:k().optional(),inputSchema:Ge({$schema:k().optional(),type:ae("object")}),outputSchema:Ge({$schema:k().optional()}).optional(),annotations:H.optional(),_meta:Re(k(),xe()).optional()}),Dt=X({type:ae("tool_result"),toolUseId:k(),content:ie(O),structuredContent:xe().optional(),isError:Pe().optional(),_meta:Re(k(),xe()).optional()}),ir=ke([be,Ce,ze,Ie,Dt]),sr=X({role:i,content:ke([ir,ie(ir)]),_meta:Re(k(),xe()).optional()}),Rr=k(),Sr=Ge({[Ti]:E.optional().catch(void 0)}),Er=Sr.optional();function qt(Et){return Ge({_meta:Er,resultType:Rr.default("complete"),...Et})}let vo=qt({}),Jo=qt({nextCursor:n.optional()}),Gn=qt({content:ie(O),structuredContent:xe().optional(),isError:Pe().optional()}),Bn=qt({ttlMs:Ee().int().min(0),cacheScope:Ke(["public","private"]),tools:ie(Lt),nextCursor:n.optional()}),pn=qt({ttlMs:Ee().int().min(0),cacheScope:Ke(["public","private"]),prompts:ie(K),nextCursor:n.optional()}),hn=qt({description:k().optional(),messages:ie(x)}),_o=qt({ttlMs:Ee().int().min(0),cacheScope:Ke(["public","private"]),resources:ie(ve),nextCursor:n.optional()}),fr=qt({ttlMs:Ee().int().min(0),cacheScope:Ke(["public","private"]),resourceTemplates:ie(me),nextCursor:n.optional()}),Hn=qt({ttlMs:Ee().int().min(0),cacheScope:Ke(["public","private"]),contents:ie(ke([Q,pe]))}),yo=qt({completion:X({values:ie(k()).max(100),total:Ee().int().optional(),hasMore:Pe().optional()}).loose()}),Ko=qt({ttlMs:Ee().int().min(0),cacheScope:Ke(["public","private"])}),pr=qt({ttlMs:Ee().int().min(0).catch(0),cacheScope:Ke(["public","private"]).catch("private"),supportedVersions:ie(k()),capabilities:Qe,instructions:k().optional()}),Bt=X({messages:ie(sr),modelPreferences:ee.optional(),systemPrompt:k().optional(),includeContext:Ke(["none","thisServer","allServers"]).optional(),temperature:Ee().optional(),maxTokens:Ee().int(),stopSequences:ie(k()).optional(),metadata:t.optional(),tools:ie(Lt).optional(),toolChoice:Z.optional()}),br=X({method:ae("sampling/createMessage"),params:Bt}),mn=X({method:ae("roots/list"),params:X({_meta:Re(k(),xe()).optional()}).optional()}),wr=X({...sr.shape,model:k(),stopReason:k().optional()}),zn=X({roots:ie(It)}),gn=X({action:Ke(["accept","decline","cancel"]),content:Re(k(),ke([k(),Ee(),Pe(),ie(k())])).optional()}),Vn=X({mode:ae("url"),message:k(),url:k().url()}),Yr=ke([Kt,Vn]),jn=X({method:ae("elicitation/create"),params:Yr}),Wn=ke([br,mn,jn]),Jn=ke([wr,zn,gn]),Kn=Re(k(),Wn),Xn=Re(k(),Jn),qr=qt({inputRequests:Kn.optional(),requestState:k().optional()}),Ur={inputResponses:Xn.optional(),requestState:k().optional()},Xo=X({_meta:or,...Ur}),Yo=Ge({progressToken:r.optional()});function ar(Et,tn){return X({method:ae(Et),params:X({_meta:or,...tn})})}function lr(Et,tn){return X({method:ae(Et),params:X({_meta:Yo.optional(),...tn}).optional()})}let Yn={name:k(),arguments:Re(k(),xe()).optional(),...Ur},zt={cursor:n.optional()},Zo=ar("tools/call",Yn),vn=ar("tools/list",zt),Zr=ar("prompts/list",zt),_n=ar("prompts/get",{name:k(),arguments:Re(k(),k()).optional(),...Ur}),Yt=ar("resources/list",zt),So=ar("resources/templates/list",zt),Zn=ar("resources/read",{uri:k(),...Ur}),Qn={ref:ke([xt,Xt]),argument:X({name:k(),value:k()}),context:X({arguments:Re(k(),k()).optional()}).optional()},yn=ar("completion/complete",Qn),Sn=ar("server/discover",{}),En=X({toolsListChanged:Pe().optional(),promptsListChanged:Pe().optional(),resourcesListChanged:Pe().optional(),resourceSubscriptions:ie(k()).optional()}),Eo={notifications:En},Qo=ar("subscriptions/listen",Eo),eo=Sr.extend({"io.modelcontextprotocol/subscriptionId":o}),Fr=Ge({_meta:eo,resultType:Rr.default("complete")}),Qr={"tools/call":lr("tools/call",Yn),"tools/list":lr("tools/list",zt),"prompts/get":lr("prompts/get",{name:k(),arguments:Re(k(),k()).optional()}),"prompts/list":lr("prompts/list",zt),"resources/list":lr("resources/list",zt),"resources/templates/list":lr("resources/templates/list",zt),"resources/read":lr("resources/read",{uri:k()}),"completion/complete":lr("completion/complete",Qn),"server/discover":lr("server/discover",{}),"subscriptions/listen":lr("subscriptions/listen",Eo)};function tr(Et){return Ge({_meta:Er,...Et})}let ei={"tools/call":tr({content:ie(O),structuredContent:xe().optional(),isError:Pe().optional()}),"tools/list":tr({ttlMs:Ee().int().min(0),cacheScope:Ke(["public","private"]),tools:ie(Lt),nextCursor:n.optional()}),"prompts/get":tr({description:k().optional(),messages:ie(x)}),"prompts/list":tr({ttlMs:Ee().int().min(0),cacheScope:Ke(["public","private"]),prompts:ie(K),nextCursor:n.optional()}),"resources/list":tr({ttlMs:Ee().int().min(0),cacheScope:Ke(["public","private"]),resources:ie(ve),nextCursor:n.optional()}),"resources/templates/list":tr({ttlMs:Ee().int().min(0),cacheScope:Ke(["public","private"]),resourceTemplates:ie(me),nextCursor:n.optional()}),"resources/read":tr({ttlMs:Ee().int().min(0),cacheScope:Ke(["public","private"]),contents:ie(ke([Q,pe]))}),"completion/complete":tr({completion:X({values:ie(k()).max(100),total:Ee().int().optional(),hasMore:Pe().optional()}).loose()}),"server/discover":tr({ttlMs:Ee().int().min(0).catch(0),cacheScope:Ke(["public","private"]).catch("private"),supportedVersions:ie(k()),capabilities:Qe,instructions:k().optional()}),"subscriptions/listen":tr({})},en=Ge({"io.modelcontextprotocol/subscriptionId":o.optional()}),bn=X({method:ae("notifications/subscriptions/acknowledged"),params:X({_meta:en.optional(),notifications:En})}),to=X({_meta:en.optional(),requestId:o,reason:k().optional()}),wn=X({method:ae("notifications/cancelled"),params:to}),bo={"notifications/cancelled":wn,"notifications/progress":N,"notifications/message":G,"notifications/resources/updated":he,"notifications/resources/list_changed":j,"notifications/tools/list_changed":J,"notifications/prompts/list_changed":W,"notifications/subscriptions/acknowledged":bn},Pt=(Et)=>X({jsonrpc:ae("2.0"),id:ke([k(),Ee().int()]),result:Et}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:n,RequestIdSchema:o,RoleSchema:i,LoggingLevelSchema:s,TaskMetadataSchema:a,RelatedTaskMetadataSchema:c,RequestMetaSchema:u,BaseRequestParamsSchema:f,TaskAugmentedRequestParamsSchema:h,NotificationsParamsSchema:g,NotificationSchema:p,IconSchema:_,IconsSchema:y,BaseMetadataSchema:S,ImplementationSchema:E,ClientTasksCapabilitySchema:w,ServerTasksCapabilitySchema:T,ClientCapabilitiesSchema:C,ServerCapabilitiesSchema:A,ProgressSchema:P,ProgressNotificationParamsSchema:D,ProgressNotificationSchema:N,LoggingMessageNotificationParamsSchema:F,LoggingMessageNotificationSchema:G,ResourceContentsSchema:B,TextResourceContentsSchema:Q,BlobResourceContentsSchema:pe,AnnotationsSchema:se,ResourceSchema:ve,ResourceTemplateSchema:me,ResourceListChangedNotificationSchema:j,ResourceUpdatedNotificationParamsSchema:ne,ResourceUpdatedNotificationSchema:he,PromptArgumentSchema:q,PromptSchema:K,PromptListChangedNotificationSchema:W,TextContentSchema:be,ImageContentSchema:Ce,AudioContentSchema:ze,ToolUseContentSchema:Ie,EmbeddedResourceSchema:je,ResourceLinkSchema:U,ContentBlockSchema:O,PromptMessageSchema:x,ToolAnnotationsSchema:H,ToolListChangedNotificationSchema:J,ModelHintSchema:Y,ModelPreferencesSchema:ee,ToolChoiceSchema:Z,BooleanSchemaSchema:te,StringSchemaSchema:oe,NumberSchemaSchema:L,UntitledSingleSelectEnumSchemaSchema:V,TitledSingleSelectEnumSchemaSchema:ce,LegacyTitledEnumSchemaSchema:ue,SingleSelectEnumSchemaSchema:ge,UntitledMultiSelectEnumSchemaSchema:Ne,TitledMultiSelectEnumSchemaSchema:et,MultiSelectEnumSchemaSchema:He,EnumSchemaSchema:We,PrimitiveSchemaDefinitionSchema:St,ElicitRequestFormParamsSchema:Kt,ResourceTemplateReferenceSchema:Xt,PromptReferenceSchema:xt,RootSchema:It,ClientCapabilities2026Schema:Ue,ServerCapabilities2026Schema:Qe,RequestMetaEnvelopeSchema:or,ToolSchema:Lt,ToolResultContentSchema:Dt,SamplingMessageContentBlockSchema:ir,SamplingMessageSchema:sr,ResultTypeSchema:Rr,ResultMetaSchema:Sr,ResultSchema:vo,PaginatedResultSchema:Jo,CallToolResultSchema:Gn,ListToolsResultSchema:Bn,ListPromptsResultSchema:pn,GetPromptResultSchema:hn,ListResourcesResultSchema:_o,ListResourceTemplatesResultSchema:fr,ReadResourceResultSchema:Hn,CompleteResultSchema:yo,CacheableResultSchema:Ko,DiscoverResultSchema:pr,CreateMessageRequestParamsSchema:Bt,CreateMessageRequestSchema:br,ListRootsRequestSchema:mn,CreateMessageResultSchema:wr,ListRootsResultSchema:zn,ElicitResultSchema:gn,ElicitRequestURLParamsSchema:Vn,ElicitRequestParamsSchema:Yr,ElicitRequestSchema:jn,InputRequestSchema:Wn,InputResponseSchema:Jn,InputRequestsSchema:Kn,InputResponsesSchema:Xn,InputRequiredResultSchema:qr,InputResponseRequestParamsSchema:Xo,CallToolRequestSchema:Zo,ListToolsRequestSchema:vn,ListPromptsRequestSchema:Zr,GetPromptRequestSchema:_n,ListResourcesRequestSchema:Yt,ListResourceTemplatesRequestSchema:So,ReadResourceRequestSchema:Zn,CompleteRequestSchema:yn,DiscoverRequestSchema:Sn,SubscriptionFilterSchema:En,SubscriptionsListenRequestSchema:Qo,SubscriptionsListenResultMetaSchema:eo,SubscriptionsListenResultSchema:Fr,dispatchRequestSchemas:Qr,dispatchResultSchemas:ei,NotificationMetaSchema:en,SubscriptionsAcknowledgedNotificationSchema:bn,CancelledNotificationParamsSchema:to,CancelledNotificationSchema:wn,notificationSchemas2026:bo,JSONRPCResultResponseSchema:Pt(vo),CallToolResultResponseSchema:Pt(ke([Gn,qr])),ListToolsResultResponseSchema:Pt(Bn),ListPromptsResultResponseSchema:Pt(pn),GetPromptResultResponseSchema:Pt(ke([hn,qr])),ListResourcesResultResponseSchema:Pt(_o),ListResourceTemplatesResultResponseSchema:Pt(fr),ReadResourceResultResponseSchema:Pt(ke([Hn,qr])),CompleteResultResponseSchema:Pt(yo),DiscoverResultResponseSchema:Pt(pr),SubscriptionsListenResultResponseSchema:Pt(Fr)}}var k1;function po(){return k1??=P1()}var N1=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function O1(e){return N1.includes(e)}var Ci=Symbol("modelcontextprotocol.resultCacheHintFallback");function lu(e,t){if(t===void 0)return e;let r=e[Ci];if(r===void 0)return{...e,[Ci]:t};let n={},o=r.ttlMs??t.ttlMs;if(o!==void 0)n.ttlMs=o;let i=r.cacheScope??t.cacheScope;if(i!==void 0)n.cacheScope=i;return{...e,[Ci]:n}}function M1(e){return e[Ci]}function Dd(e){return typeof e==="number"&&Number.isSafeInteger(e)&&e>=0}function $d(e){return e==="public"||e==="private"}function HS(e,t){if(e.ttlMs!==void 0&&!Dd(e.ttlMs))throw RangeError(`Invalid cache hint for ${t}: ttlMs must be a non-negative safe integer (got ${String(e.ttlMs)})`);if(e.cacheScope!==void 0&&!$d(e.cacheScope))throw RangeError(`Invalid cache hint for ${t}: cacheScope must be 'public' or 'private' (got ${String(e.cacheScope)})`)}var Te=function(e){return e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.ResourceNotFound=-32002]="ResourceNotFound",e[e.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",e[e.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired",e}({}),Le=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return Di(this,t)}static isInstance(t){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Di(this,t)}constructor(t,r,n){super(r);this.code=t,this.data=n,this.name="ProtocolError",Nd(this,new.target)}static fromError(t,r,n){if(t===Te.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new D1(o.elicitations,r)}if(t===Te.UnsupportedProtocolVersion&&n){let o=n;if(Array.isArray(o.supported)&&typeof o.requested==="string")return new ul({supported:o.supported,requested:o.requested},r)}if(t===Te.InvalidParams||t===Te.ResourceNotFound){let o=n;if(typeof o?.uri==="string"&&(t===Te.ResourceNotFound||Object.keys(o).length===1))return new zS(o.uri,r)}if(t===Te.MissingRequiredClientCapability&&n){let o=n;if(o.requiredCapabilities!==null&&typeof o.requiredCapabilities==="object"&&!Array.isArray(o.requiredCapabilities))return new VS({requiredCapabilities:o.requiredCapabilities},r)}return new e(t,r,n)}},zS=class extends Le{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(Te.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},D1=class extends Le{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(Te.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},ul=class extends Le{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(Te.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},VS=class extends Le{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(Te.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},$1=0,x1="private",L1=["tools/call","prompts/get","resources/read"];function q1(e,t){let r=t.resultType;if(r===void 0)return{...t,resultType:"complete"};if(r==="complete")return t;if(L1.includes(e))return t;throw new Le(Te.InternalError,`Handler for ${e} returned resultType '${String(r)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function U1(e,t){let r=M1(t);if(t.resultType!=="complete"||!O1(e))return r===void 0?t:z1(t);let n=t,o=Dd(n.ttlMs)?n.ttlMs:B1(r),i=$d(n.cacheScope)?n.cacheScope:H1(r),s={...n,ttlMs:o,cacheScope:i};return delete s[Ci],s}function F1(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function G1(e,t){if(t===void 0)return e;let r=e._meta;if(r===void 0)return{...e,_meta:{[Ti]:t}};if(!F1(r))return e;if(r[Ti]!==void 0)return e;return{...e,_meta:{...r,[Ti]:t}}}function B1(e){return e!==void 0&&Dd(e.ttlMs)?e.ttlMs:$1}function H1(e){return e!==void 0&&$d(e.cacheScope)?e.cacheScope:x1}function z1(e){let t={...e};return delete t[Ci],t}var V1=["elicitation/create","sampling/createMessage","roots/list"],Ia;function jS(){if(Ia)return Ia;let e=po();return Ia={request:{"elicitation/create":X({method:ae("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":X({method:ae("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":X({method:ae("roots/list"),params:Ge({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},Ia}function WS(e){return V1.includes(e)}function Dc(e){return WS(e)?jS().request[e]:void 0}function j1(e){return WS(e)?jS().response[e]:void 0}var xd={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},JS={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function KS(e){return Object.prototype.hasOwnProperty.call(xd,e)}function XS(e){return Object.prototype.hasOwnProperty.call(JS,e)}function W1(e){return Object.prototype.hasOwnProperty.call(xd,e)}function J1(e){return KS(e)?po().dispatchRequestSchemas[e]:void 0}function K1(e){return W1(e)?po().dispatchResultSchemas[e]:void 0}function X1(e){return XS(e)?po().notificationSchemas2026[e]:void 0}var aj=Object.keys(xd),lj=Object.keys(JS);function Is(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function hs(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var Y1={ok:!1,reason:"not-in-era"},Z1=[Gi,Js];function Q1(e,t){let r=t,n=!1,o=()=>{if(!n)r={...r},n=!0;return r},i=t.tools;if(e==="tools/list"&&Array.isArray(i)&&i.some((l)=>Is(l)&&("execution"in l)))o().tools=i.map((l)=>{if(!Is(l)||!("execution"in l))return l;let a={...l};return delete a.execution,a});let s=t.capabilities;if(Is(s)&&"tasks"in s){let l={...s};delete l.tasks,o().capabilities=l}return r}var Ld={era:"2026-07-28",hasRequestMethod:KS,hasNotificationMethod:XS,hasInputRequestMethod:(e)=>Dc(e)!==void 0,validateRequest:(e,t)=>hs(J1(e),t),validateResult:(e,t)=>hs(K1(e),t),validateNotification:(e,t)=>hs(X1(e),t),validateInputRequest:(e,t)=>hs(Dc(e),t),validateInputResponse:(e,t)=>hs(j1(e),t),samplingResultVariant:()=>Y1,outboundEnvelope(e){return{[Gi]:e.protocolVersion,[nd]:e.clientInfo,[Js]:e.clientCapabilities,...e.logLevel!==void 0&&{[Dl]:e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of Z1)if(!(n in e))t.push({key:n,problem:"missing"});let r=po().RequestMetaEnvelopeSchema.safeParse(e);if(!r.success)for(let n of r.error.issues){let o=n.path.map(String),i=o.length>0?o.join("."):"_meta";if(o.length===1&&t.some((s)=>s.key===i&&s.problem==="missing"))continue;t.push({key:i,problem:n.message})}return t},projectCallToolResult:(e)=>DS(e),inputRequestSchema:Dc,decodeResult(e,t){if(!Is(t))return{kind:"invalid",error:new Ye(tt.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let r=t.resultType;if(r===void 0)return{kind:"invalid",error:new Ye(tt.InvalidResult,`Invalid result for ${e}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:"missing-resultType"})};if(typeof r!=="string")return{kind:"invalid",error:new Ye(tt.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:r})};if(r==="input_required"){let s=t.inputRequests,l=Is(s)?s:{},a=t.requestState,c=t._meta===void 0?void 0:po().ResultMetaSchema.safeParse(t._meta),u=c?.success?c.data:void 0;if(Object.keys(l).length===0&&typeof a!=="string")return{kind:"invalid",error:new Ye(tt.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:"input-required-missing-both"})};return{kind:"input_required",inputRequests:l,...typeof a==="string"&&{requestState:a},...u!==void 0&&{_meta:u}}}if(r!=="complete")return{kind:"invalid",error:new Ye(tt.UnsupportedResultType,`Unsupported result type '${r}' for ${e}`,{resultType:r,method:e})};let n=eM(),o=Object.hasOwn(n,e)?n[e]:void 0;if(o!==void 0){let s=o.safeParse(t);if(!s.success)return{kind:"invalid",error:new Ye(tt.InvalidResult,`Invalid result for ${e}: ${s.error}`,{method:e})}}let i={...t};return delete i.resultType,{kind:"complete",result:i}},encodeResult(e,t,r){return G1(U1(e,q1(e,Q1(e,t))),r)},encodeErrorCode:(e)=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let t=po().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map((r)=>r.message).join("; ")}`}},Pa;function eM(){if(Pa)return Pa;let e=po();return Pa={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},Pa}var jl="2026-07-28";function Bo(e){return e!==void 0&&Xs(e)?Ld:Md}function eh(e){if(e.revision!==void 0)return Bo(e.revision).era;return e.era==="modern"?Ld.era:Md.era}function $c(e){return YS.some((t)=>t.hasRequestMethod(e))}function xc(e){return YS.some((t)=>t.hasNotificationMethod(e))}function th(e){return e==="tasks/get"||e==="tasks/cancel"}var YS=[Md,Ld];function rh(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Ys(e){if(!rh(e))return;let t=e._meta;return rh(t)?t:void 0}function qd(e){let t=Ys(e);return t!==void 0&&Gi in t}function Ud(e){let t=Ys(e)?.[Gi];return typeof t==="string"?t:void 0}function Fd(e){return Bo(jl).validateEnvelopeMeta(e)}var tM=qR({AnnotationsSchema:()=>Vo,AudioContentSchema:()=>Bl,BaseMetadataSchema:()=>Go,BaseRequestParamsSchema:()=>nr,BlobResourceContentsSchema:()=>yd,BooleanSchemaSchema:()=>Td,CallToolRequestParamsSchema:()=>V0,CallToolRequestSchema:()=>j0,CallToolResultSchema:()=>wd,CancelTaskRequestSchema:()=>e1,CancelTaskResultSchema:()=>t1,CancelledNotificationParamsSchema:()=>Jy,CancelledNotificationSchema:()=>fd,ClientCapabilitiesSchema:()=>Zy,ClientNotificationSchema:()=>n1,ClientRequestSchema:()=>r1,ClientResultSchema:()=>o1,ClientTasksCapabilitySchema:()=>Xy,CompatibilityCallToolResultSchema:()=>HO,CompleteRequestParamsSchema:()=>yS,CompleteRequestSchema:()=>SS,CompleteResultSchema:()=>ES,ContentBlockSchema:()=>Hl,CreateMessageRequestParamsSchema:()=>oS,CreateMessageRequestSchema:()=>iS,CreateMessageResultSchema:()=>sS,CreateMessageResultWithToolsSchema:()=>aS,CreateTaskResultSchema:()=>jO,CursorSchema:()=>sd,DiscoverRequestSchema:()=>n0,DiscoverResultSchema:()=>o0,ElicitRequestFormParamsSchema:()=>Vl,ElicitRequestParamsSchema:()=>fS,ElicitRequestSchema:()=>pS,ElicitRequestURLParamsSchema:()=>dS,ElicitResultSchema:()=>gS,ElicitationCompleteNotificationParamsSchema:()=>hS,ElicitationCompleteNotificationSchema:()=>mS,EmbeddedResourceSchema:()=>x0,EmptyResultSchema:()=>dd,EnumSchemaSchema:()=>uS,GetPromptRequestParamsSchema:()=>M0,GetPromptRequestSchema:()=>D0,GetPromptResultSchema:()=>U0,GetTaskPayloadRequestSchema:()=>XO,GetTaskPayloadResultSchema:()=>YO,GetTaskRequestSchema:()=>JO,GetTaskResultSchema:()=>KO,IconSchema:()=>Ky,IconsSchema:()=>Hi,ImageContentSchema:()=>Gl,ImplementationSchema:()=>ql,InitializeRequestParamsSchema:()=>Qy,InitializeRequestSchema:()=>e0,InitializeResultSchema:()=>t0,InitializedNotificationSchema:()=>r0,JSONArraySchema:()=>UO,JSONObjectSchema:()=>Ut,JSONRPCErrorResponseSchema:()=>Ll,JSONRPCMessageSchema:()=>Wy,JSONRPCNotificationSchema:()=>ud,JSONRPCRequestSchema:()=>cd,JSONRPCResponseSchema:()=>FO,JSONRPCResultResponseSchema:()=>xl,JSONValueSchema:()=>Mi,LegacyTitledEnumSchemaSchema:()=>Ad,ListChangedOptionsBaseSchema:()=>zO,ListPromptsRequestSchema:()=>N0,ListPromptsResultSchema:()=>O0,ListResourceTemplatesRequestSchema:()=>d0,ListResourceTemplatesResultSchema:()=>f0,ListResourcesRequestSchema:()=>c0,ListResourcesResultSchema:()=>u0,ListRootsRequestSchema:()=>wS,ListRootsResultSchema:()=>TS,ListTasksRequestSchema:()=>ZO,ListTasksResultSchema:()=>QO,ListToolsRequestSchema:()=>H0,ListToolsResultSchema:()=>z0,LoggingLevelSchema:()=>$s,LoggingMessageNotificationParamsSchema:()=>X0,LoggingMessageNotificationSchema:()=>Y0,ModelHintSchema:()=>Z0,ModelPreferencesSchema:()=>Q0,MultiSelectEnumSchemaSchema:()=>cS,NotificationSchema:()=>yr,NotificationsParamsSchema:()=>_r,NumberSchemaSchema:()=>cl,PaginatedRequestParamsSchema:()=>a0,PaginatedRequestSchema:()=>zi,PaginatedResultSchema:()=>Vi,PingRequestSchema:()=>hd,PrimitiveSchemaDefinitionSchema:()=>kd,ProgressNotificationParamsSchema:()=>s0,ProgressNotificationSchema:()=>md,ProgressSchema:()=>i0,ProgressTokenSchema:()=>id,PromptArgumentSchema:()=>P0,PromptListChangedNotificationSchema:()=>F0,PromptMessageSchema:()=>q0,PromptReferenceSchema:()=>_S,PromptSchema:()=>k0,ReadResourceRequestParamsSchema:()=>p0,ReadResourceRequestSchema:()=>h0,ReadResourceResultSchema:()=>m0,RelatedTaskMetadataSchema:()=>jy,RequestIdSchema:()=>Bi,RequestMetaSchema:()=>ad,RequestSchema:()=>Ft,ResourceContentsSchema:()=>gd,ResourceLinkSchema:()=>L0,ResourceListChangedNotificationSchema:()=>g0,ResourceRequestParamsSchema:()=>Ul,ResourceSchema:()=>Sd,ResourceTemplateReferenceSchema:()=>vS,ResourceTemplateSchema:()=>l0,ResourceUpdatedNotificationParamsSchema:()=>A0,ResourceUpdatedNotificationSchema:()=>I0,ResultMetaObjectSchema:()=>ld,ResultSchema:()=>Gt,RoleSchema:()=>ji,RootSchema:()=>bS,RootsListChangedNotificationSchema:()=>CS,SamplingContentSchema:()=>rS,SamplingMessageContentBlockSchema:()=>xs,SamplingMessageSchema:()=>nS,ServerCapabilitiesSchema:()=>pd,ServerNotificationSchema:()=>s1,ServerRequestSchema:()=>i1,ServerResultSchema:()=>a1,ServerTasksCapabilitySchema:()=>Yy,SetLevelRequestParamsSchema:()=>J0,SetLevelRequestSchema:()=>K0,SingleSelectEnumSchemaSchema:()=>lS,StringSchemaSchema:()=>zl,SubscribeRequestParamsSchema:()=>v0,SubscribeRequestSchema:()=>_0,SubscriptionFilterSchema:()=>Ed,SubscriptionsAcknowledgedNotificationParamsSchema:()=>w0,SubscriptionsAcknowledgedNotificationSchema:()=>T0,SubscriptionsListenRequestParamsSchema:()=>E0,SubscriptionsListenRequestSchema:()=>b0,SubscriptionsListenResultMetaSchema:()=>C0,SubscriptionsListenResultSchema:()=>R0,TaskAugmentedRequestParamsSchema:()=>Ks,TaskCreationParamsSchema:()=>VO,TaskMetadataSchema:()=>Vy,TaskSchema:()=>Wi,TaskStatusNotificationParamsSchema:()=>AS,TaskStatusNotificationSchema:()=>WO,TaskStatusSchema:()=>RS,TextContentSchema:()=>Fl,TextResourceContentsSchema:()=>vd,TitledMultiSelectEnumSchemaSchema:()=>Pd,TitledSingleSelectEnumSchemaSchema:()=>Rd,ToolAnnotationsSchema:()=>G0,ToolChoiceSchema:()=>eS,ToolExecutionSchema:()=>B0,ToolListChangedNotificationSchema:()=>W0,ToolResultContentSchema:()=>tS,ToolSchema:()=>bd,ToolUseContentSchema:()=>$0,UnsubscribeRequestParamsSchema:()=>y0,UnsubscribeRequestSchema:()=>S0,UntitledMultiSelectEnumSchemaSchema:()=>Id,UntitledSingleSelectEnumSchemaSchema:()=>Cd}),sn=(e)=>cd.safeParse(e).success,Ei=(e)=>ud.safeParse(e).success,cu=(e)=>xl.safeParse(e).success,ZS=(e)=>Ll.safeParse(e).success,ko=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)&&e.resultType==="input_required";function rM(e){if(e.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function nM(e){if(e.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var nh="x-mcp-header",oM=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,iM=new Set(["string","integer","boolean","number"]);function sM(e){let t=[],r=new Map,n=(i,s,l)=>{if(i===null||typeof i!=="object")return;let a=i;if(nh in a){if(!l||s.length===0)return`${ka(s)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let u=a[nh];if(typeof u!=="string"||u.length===0)return`${ka(s)}: x-mcp-header MUST be a non-empty string`;if(!oM.test(u))return`${ka(s)}: x-mcp-header '${u}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let f=typeof a.type==="string"?a.type:void 0;if(f===void 0||!iM.has(f))return`${ka(s)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${f??"<none>"}`;let h=u.toLowerCase(),g=r.get(h);if(g!==void 0)return`x-mcp-header '${u}' is not case-insensitively unique (also declared as '${g}')`;r.set(h,u),t.push({path:s,headerName:u,type:f})}let c=a.properties;if(c!==null&&typeof c==="object")for(let[u,f]of Object.entries(c)){let h=n(f,[...s,u],l);if(h!==void 0)return h}for(let u of aM){let f=a[u];if(f===void 0)continue;let h=Array.isArray(f)?f:f!==null&&typeof f==="object"&&lM.has(u)?Object.values(f):[f];for(let g of h){let p=n(g,[...s,`<${u}>`],!1);if(p!==void 0)return p}}},o=n(e,[],!0);return o===void 0?{valid:!0,declarations:t}:{valid:!1,reason:o}}var aM=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],lM=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function ka(e){return e.length===0?"<root>":e.join(".")}var Ha=-32020,cj=[{rung:"http-method",order:1,evaluatedAt:"edge",codes:[-32000],conformance:[],rationale:"The modern era is POST-only; GET/DELETE are body-less 2025-era session operations and are method-routed to legacy serving (405 when legacy serving is not configured), before any body is read."},{rung:"jsonrpc-shape",order:2,evaluatedAt:"edge",codes:[Te.InvalidRequest],conformance:["server-stateless"],rationale:"The body must be a JSON-RPC request or notification: posted responses and batch arrays containing a modern or invalid element are rejected before classification (element-wise batch rule); all-legacy arrays stay legacy traffic."},{rung:"era-classification",order:3,evaluatedAt:"edge",codes:[Ha,Te.UnsupportedProtocolVersion],conformance:["server-stateless","http-header-validation","http-custom-header-server-validation"],rationale:"Body-primary era classification with the protocol-version header as a cross-check; a header/body disagreement is rejected with -32020 (HeaderMismatch), and an envelope-less request on a modern-only endpoint is answered with the unsupported-protocol-version error naming the supported revisions."},{rung:"envelope",order:4,evaluatedAt:"edge",codes:[Te.InvalidParams],conformance:["server-stateless"],rationale:"A present envelope claim with a malformed envelope — and a missing envelope on a request whose protocol-version header names a modern revision — is an invalid-params rejection naming the offending or missing key(s); never a silent fall back to legacy handling. This is the only place an invalid-params rejection maps to HTTP 400."},{rung:"method-registry",order:5,evaluatedAt:"dispatch",codes:[Te.MethodNotFound],conformance:["server-stateless"],rationale:"Method existence outranks parameter validity: a method absent from the negotiated revision’s registry (or with no handler installed) answers method-not-found before params or capabilities are looked at."},{rung:"request-params",order:6,evaluatedAt:"dispatch",codes:[Te.InvalidParams],conformance:[],rationale:"Per-method params validation; emitted in-band by the dispatch layer (HTTP 200), never via the ladder status table."},{rung:"standard-header-validation",order:7,evaluatedAt:"pre-dispatch",codes:[Ha],conformance:["http-header-validation"],rationale:"SEP-2243 standard `MCP-Protocol-Version` / `Mcp-Method` / `Mcp-Name` headers — presence, sentinel decoding, and `Mcp-Name` ↔ body cross-check — are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The spec requires `MCP-Protocol-Version` and `Mcp-Method` on every modern *request* POST (`Mcp-Name` only for the methods that mirror `params.name` / `params.uri` / `params.taskId`, see `MCP_NAME_HEADER_SOURCE`) and names them in that order, so a request missing several is answered by the earliest. Notification POSTs are exempt: the presence half runs on requests only, so a modern-enveloped notification is dispatched even with no standard headers at all. The classifier’s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge `era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half — including the missing `MCP-Protocol-Version` cell, which cannot live on the edge rung without breaking body-primary classification. Evaluated before the capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5–6) are consulted."},{rung:"client-capabilities",order:8,evaluatedAt:"pre-dispatch",codes:[Te.MissingRequiredClientCapability],conformance:["server-stateless"],rationale:"The capability requirement is checked by the HTTP entry, pre-dispatch, against the validated envelope the classifier produced — pinning the spec-mandated HTTP 400 independently of how dispatch- and handler-produced errors are mapped. The documented order (after method resolution and params validation) is preserved observably only while the requirement table is empty: once a served method gains a requirement entry, a request that is missing the capability and would also fail a dispatch rung is answered by this gate first, so the entry must consult the method registry before the gate if the documented precedence is to stay observable."},{rung:"param-header-validation",order:9,evaluatedAt:"pre-dispatch",codes:[Ha],conformance:["http-custom-header-server-validation"],rationale:"SEP-2243 `Mcp-Param-*` headers are validated against the named tool’s `x-mcp-header` declarations and the body `arguments` after the tool registry is known and before dispatch reaches the handler; a missing/disagreeing/malformed header is rejected 400 / -32020 with the same shape as the standard-header cross-checks. The documented order (after method resolution and params validation) is preserved observably only when the body `arguments` would otherwise validate: the check runs pre-dispatch, so a `tools/call` that fails BOTH this rung and a dispatch-time rung (e.g. order-6 `request-params`, -32602) is answered by this gate first with 400 / -32020, not by the earlier-ordered rung."}],uj={[Te.ParseError]:400,[Te.InvalidRequest]:400,[Te.MethodNotFound]:404,[Te.UnsupportedProtocolVersion]:400,[Te.MissingRequiredClientCapability]:400,[Ha]:400};function Na(e,t,r,n,o){return{kind:"reject",rung:e,cell:t,httpStatus:r,code:n.code,message:n.message,...n.data!==void 0&&{data:n.data},settled:o}}function QS(e){if(!qd(e))return!1;let t=Ud(e);if(t===void 0||!Xs(t))return!1;let r=Ys(e);return r!==void 0&&Fd(r).length===0}function cM(e,t){switch(e.reason){case"http-method":return Na("http-method","modern-only-method-not-allowed",405,new Le(-32000,"Method not allowed."),!0);case"batch":return Na("jsonrpc-shape","modern-only-batch-not-supported",400,new Le(Te.InvalidRequest,"Bad Request: JSON-RPC batches are not supported by this endpoint"),!0);case"response":return Na("jsonrpc-shape","modern-only-response-post",400,new Le(Te.InvalidRequest,"Bad Request: JSON-RPC responses cannot be posted to this endpoint"),!0);case"notification":return;case"initialize":case"no-claim":{let r=e.requestedVersion;return Na("era-classification","modern-only-missing-envelope",400,r===void 0?new Le(Te.UnsupportedProtocolVersion,"Unsupported protocol version: the request did not name a protocol version",{supported:[...t]}):new ul({supported:[...t],requested:r}),!0)}}}function Gd(e,t){return ky(e,t)}function ms(e){return new Set(e.flatMap((t)=>Object.keys(t.shape)))}function $i(e){if(e==null)return!1;let t=typeof e;if(t!=="object"&&t!=="function")return!1;if(!("~standard"in e))return!1;return typeof e["~standard"]?.validate==="function"}var oh=!1,uu="draft-2020-12";function xi(e,t="input"){let r=e["~standard"],n;if(r.jsonSchema)n=r.jsonSchema[t]({target:uu});else if(r.vendor==="zod"){if(!("_zod"in e))throw Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");if(!oh)oh=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.");n=Py(e,{target:uu,io:t})}else throw Error(`Schema library "${r.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t==="output"){if(n.type!==void 0)return n;return eE(n)?{type:"object",...n}:n}if(n.type!==void 0&&n.type!=="object")throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(n.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...n}}function eE(e){if("properties"in e||"patternProperties"in e||"additionalProperties"in e||"required"in e)return!0;for(let t of["oneOf","anyOf","allOf"]){let r=e[t];if(Array.isArray(r)&&r.length>0)return r.every((n)=>n!==null&&typeof n==="object"&&(n.type==="object"||eE(n)))}return!1}function uM(e){if(!e.path?.length)return e.message;return`${e.path.map((t)=>String(typeof t==="object"?t.key:t)).join(".")}: ${e.message}`}async function Ri(e,t){let r=await e["~standard"].validate(t);if(r.issues&&r.issues.length>0)return{success:!1,error:r.issues.map((n)=>uM(n)).join(", ")};return{success:!0,data:r.value}}function dM(e){let t=Py(e,{target:uu,io:"input"});return typeof t.pattern==="string"?t.pattern:void 0}var fM=/\\\.\\d\{(\d+)\}/;function pM(e){let t=fM.exec(e),r=[void 0,-1,0];if(t)r.push(Number(t[1]));return[!1,!0].flatMap((n)=>[!1,!0].flatMap((o)=>r.map((i)=>Fi.datetime({local:n,offset:o,precision:i}))))}function hM(e,t){let r;switch(e){case"email":r=[DN()];break;case"uri":r=[$y()];break;case"date":r=[Fi.date()];break;case"date-time":r=pM(t);break}return new Set(r.map((n)=>dM(n)).filter((n)=>n!==void 0))}function mM(e,t,r){if(r!=="zod")return!0;return hM(e,t).has(t)}function gM(e){let t=xi(e,"input"),r=t.properties||{},n=t.required||[];return Object.entries(r).map(([o,i])=>({name:o,description:i?.description,required:n.includes(o)}))}function Ls(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function vM(e){try{return xi(e,"input")}catch(t){let r=t instanceof Error?t.message:String(t);throw new Le(Te.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${r}`)}}var _M=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function Bd(e){return _M.has(e)||e.startsWith("x-")}var yM=new Set(["$schema",...Object.keys(Vl.shape.requestedSchema.shape)]),ih={string:ms([zl,Cd,Rd,Ad]),number:ms([cl]),integer:ms([cl]),boolean:ms([Td]),array:ms([Id,Pd])},SM=new Set(zl.shape.format.unwrap().options);function EM(e,t,r,n){if(!Ls(e))return e;let o=typeof e.type==="string"&&Object.hasOwn(ih,e.type)?ih[e.type]:void 0;if(o===void 0)return e;let i={};for(let[s,l]of Object.entries(e))if(o.has(s)||Bd(s))i[s]=l;else if(s==="pattern"&&e.type==="string"&&typeof e.format==="string"){if(!SM.has(e.format))i[s]=l;else if(typeof l!=="string"||!mM(e.format,l,r))n.push(`${t}.${s}`)}else n.push(`${t}.${s}`);return i}function bM(e,t){let r={},n=[];for(let[o,i]of Object.entries(e))if(o==="properties"&&Ls(i))r[o]=Object.fromEntries(Object.entries(i).map(([s,l])=>[s,EM(l,`properties.${s}`,t,n)]));else if(yM.has(o))r[o]=i;else if(!Bd(o))n.push(o);if(n.length>0)throw new Le(Te.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);return r}function wM(e,t){if(!Ls(e.properties))return t;let r=Object.entries(e.properties).filter(([,n])=>!Gd(kd,n).success).map(([n])=>`properties.${n}`);return r.length>0?r.join(", "):t}function du(e,t,r=""){if(Array.isArray(e)&&Array.isArray(t))return e.flatMap((n,o)=>du(n,t[o],`${r}[${o}]`));if(!Ls(e)||!Ls(t))return[];return Object.entries(e).flatMap(([n,o])=>{let i=r?`${r}.${n}`:n;if(!Object.prototype.hasOwnProperty.call(t,n))return Bd(n)?[]:[i];return du(o,t[n],i)})}function TM(e){if(!$i(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let t=e.requestedSchema["~standard"].vendor,r=bM(vM(e.requestedSchema),t),n=Gd(Vl.shape.requestedSchema,r);if(!n.success)throw new Le(Te.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${wM(r,n.error.message)}`);let o=du(r,n.data);if(o.length>0)throw new Le(Te.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${o.join(", ")}`);let i=(n.data.required??[]).filter((s)=>!Object.prototype.hasOwnProperty.call(n.data.properties,s));if(i.length>0)throw new Le(Te.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${i.join(", ")}`);return{...e,mode:"form",requestedSchema:n.data}}function CM(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,r=typeof e.requestState==="string";if(!t&&!r)throw TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}var dj=Object.assign(CM,{elicit(e){try{return{method:"elicitation/create",params:TM(e)}}catch(t){throw t instanceof Le?TypeError(t.message,{cause:t}):t}},elicitUrl(e){return{method:"elicitation/create",params:{...e,mode:"url"}}},createMessage(e){return{method:"sampling/createMessage",params:e}},listRoots(){return{method:"roots/list"}}}),RM=250;function AM(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function IM(e,t){return new Promise((r,n)=>{if(t?.aborted){n(t.reason instanceof Ye?t.reason:new Ye(tt.RequestTimeout,String(t.reason)));return}let o=setTimeout(()=>{t?.removeEventListener("abort",i),r()},e),i=()=>{clearTimeout(o),n(t?.reason instanceof Ye?t.reason:new Ye(tt.RequestTimeout,String(t?.reason)))};t?.addEventListener("abort",i,{once:!0})})}function PM(e){let t=new AbortController,r=()=>t.abort(e?.reason);if(e?.addEventListener("abort",r,{once:!0}),e?.aborted)t.abort(e.reason);return{signal:t.signal,abort:(n)=>t.abort(n),dispose:()=>e?.removeEventListener("abort",r)}}var kM=["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"],NM={IdJagTokenExchangeResponseSchema:d1,OAuthClientInformationFullSchema:p1,OAuthClientInformationSchema:NS,OAuthClientMetadataSchema:kS,OAuthClientRegistrationErrorSchema:h1,OAuthErrorResponseSchema:f1,OAuthMetadataSchema:IS,OAuthProtectedResourceMetadataSchema:l1,OAuthTokenRevocationRequestSchema:m1,OAuthTokensSchema:u1,OpenIdProviderDiscoveryMetadataSchema:c1,OpenIdProviderMetadataSchema:PS},tE={},rE={};function nE(e,t){let r=e.slice(0,-6);tE[r]=t,rE[r]=(n)=>t.safeParse(n).success}for(let e of kM)nE(e,tM[e]);for(let[e,t]of Object.entries(NM))nE(e,t);var fj=Object.freeze(tE),pj=Object.freeze(rE);function OM(e){switch(e){case"initialize":case"notifications/initialized":return Bo(void 0);case"server/discover":return Bo(jl);default:return}}var MM=60000,DM=[Gi,nd,Js,Dl],$M=["inputResponses","requestState"];function sh(e,t){let r=e.params;if(!Ps(r))return{message:e,lifted:{}};let n=r._meta,o=Ps(n)?DM.filter((a)=>(a in n)):[],i=t==="request"?$M.filter((a)=>(a in r)):[];if(o.length===0&&i.length===0)return{message:e,lifted:{}};let s={},l={...r};if(o.length>0&&Ps(n)){let a={},c={...n};for(let u of o)a[u]=n[u],delete c[u];if(s.envelope=a,Object.keys(c).length>0)l._meta=c;else delete l._meta}for(let a of i){if(a==="inputResponses")s.inputResponses=l[a];if(a==="requestState")s.requestState=l[a];delete l[a]}return{message:{...e,params:l},lifted:s}}function ah(e,t){let r=e.validateResult(t,void 0);if(!r.ok&&r.reason==="not-in-era")return;return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(n){let o=e.validateResult(t,n);if(o.ok)return{value:o.value};return{issues:[{message:o.reason==="invalid"?o.message:`not-in-era: ${t}`}]}}}}}function Wl(e){return()=>e}var xM=Wl(void 0);function oE(e,t){return{...e,mcpReq:{...e.mcpReq,requestState:Wl(t)}}}var iE;function LM(e,t){iE(e,t)}var qM=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_customSchemaRequestMethods=new Set;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;static{iE=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??LO,this.setNotificationHandler("notifications/cancelled",(t)=>{this._oncancel(t)}),this.setNotificationHandler("notifications/progress",(t)=>{this._onprogress(t)}),this.setRequestHandler("ping",(t)=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let r=e.params??{};return{...e,params:{...r,_meta:{...t,...r._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new Ye(tt.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){if(e.params.requestId===void 0)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,n,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:o,onTimeout:n})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new Ye(tt.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);if(t)clearTimeout(t.timeoutId),this._timeoutInfo.delete(e)}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{this._onclose()}};let r=this.transport?.onerror;this._transport.onerror=(o)=>{r?.(o),this._onerror(o)};let n=this._transport?.onmessage;this._transport.onmessage=(o,i)=>{if(n?.(o,i),cu(o)||ZS(o))this._onresponse(o);else if(sn(o))this._onrequest(o,i);else if(Ei(o))this._onnotification(o,i);else this._onerror(Error(`Unknown message type: ${JSON.stringify(o)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._timeoutInfo.values())clearTimeout(n.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let r=new Ye(tt.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let n of e.values())n(r);for(let n of t.values())n.abort(r)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:r}=sh(e,"notification"),n=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop")return;if(t?.classification!==void 0){let s=eh(t.classification);if(s!==n.era){this._onerror(Error(`Era mismatch on inbound notification '${r.method}': classified as ${s} but this instance serves ${n.era}`));return}}if(xc(r.method)&&!n.hasNotificationMethod(r.method))return;let o=this._notificationHandlers.get(r.method),i=this.fallbackNotificationHandler;if(o===void 0&&i===void 0)return;Promise.resolve().then(()=>o===void 0?i(r):o(r,n)).catch((s)=>this._onerror(Error(`Uncaught error in notification handler: ${s}`)))}_onrequest(e,t){let{message:r,lifted:n}=sh(e,"request"),o=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop"){this._onerror(Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let i=this._transport,s=(_,y,S)=>{let E={jsonrpc:"2.0",id:r.id,error:{code:_,message:y,...S!==void 0&&{data:S}}};i?.send(E).catch((b)=>this._onerror(Error(`Failed to send an error response: ${b}`)))};if(t?.classification!==void 0){let _=eh(t.classification);if(_!==o.era){this._onerror(Error(`Era mismatch on inbound request '${r.method}': classified as ${_} but this instance serves ${o.era}`));let y=t.classification.revision??_;s(Te.UnsupportedProtocolVersion,`Unsupported protocol version: ${y}`,{supported:this._supportedProtocolVersions,requested:y});return}}if($c(r.method)&&!o.hasRequestMethod(r.method)&&!(th(r.method)&&this._customSchemaRequestMethods.has(r.method))){s(Te.MethodNotFound,"Method not found");return}let l=this._requestHandlers.get(r.method)??this.fallbackRequestHandler;if(l===void 0){s(Te.MethodNotFound,"Method not found");return}let a=o.checkInboundEnvelope(n);if(a!==void 0){s(Te.InvalidParams,a);return}let c=(_,y)=>this._notificationViaCodec(this._resolveOutboundCodec(_.method),_,{...y,relatedRequestId:r.id}),u=(_,y,S)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(_.method),_,y,{...S,relatedRequestId:r.id}),f=new AbortController;this._requestHandlerAbortControllers.set(r.id,f);let h=n.inputResponses===void 0?void 0:FM(n.inputResponses),g={sessionId:i?.sessionId,mcpReq:{id:r.id,method:r.method,_meta:r.params?._meta,...n.envelope!==void 0&&{envelope:n.envelope},...h!==void 0&&{inputResponses:h.accepted},...h!==void 0&&h.droppedKeys.length>0&&{droppedInputResponseKeys:h.droppedKeys},requestState:n.requestState===void 0?xM:Wl(n.requestState),signal:f.signal,send:(_,y,S)=>{let E=this._resolveOutboundCodec(_.method);if(this._assertOutboundRequestInEra(E,_.method),$i(y))return u(_,y,S);let b=ah(E,_.method);if(b===void 0)throw TypeError(`'${_.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return u(_,b,y)},notify:c},http:t?.authInfo?{authInfo:t.authInfo}:void 0},p=this.buildContext(g,t);Promise.resolve().then(()=>l(r,p)).then(async(_)=>{if(f.signal.aborted)return;let y;try{y=o.encodeResult(r.method,_,this._outboundServerInfo())}catch(E){this._onerror(Error(`Failed to encode result for ${r.method}: ${E}`)),s(Te.InternalError,"Internal error");return}let S={result:y,jsonrpc:"2.0",id:r.id};await i?.send(S)},async(_)=>{if(f.signal.aborted)return;let y=Number.isSafeInteger(_.code)?_.code:Te.InternalError,S={jsonrpc:"2.0",id:r.id,error:{code:o.encodeErrorCode(y),message:_.message??"Internal error",..._.data!==void 0&&{data:_.data}}};await i?.send(S)}).catch((_)=>this._onerror(Error(`Failed to send response: ${_}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(r.id)===f)this._requestHandlerAbortControllers.delete(r.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,n=Number(t),o=this._progressHandlers.get(n);if(!o){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(n),s=this._timeoutInfo.get(n);if(s&&i&&s.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(l){this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),i(l);return}o(r)}_onresponse(e){let t=Number(e.id),r=this._responseHandlers.get(t);if(r===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),cu(e))r(e);else r(Le.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,r){let n=this._resolveOutboundCodec(e.method);if($i(t)){if(!th(e.method))this._assertOutboundRequestInEra(n,e.method);return this._requestWithSchemaViaCodec(n,e,t,r)}this._assertOutboundRequestInEra(n,e.method);let o=ah(n,e.method);if(o===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(n,e,o,t)}_negotiatedWireCodec(){return Bo(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=OM(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if($c(t)&&!e.hasRequestMethod(t))throw new Ye(tt.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,r){let n=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(n,e.method),this._requestWithSchemaViaCodec(n,e,t,r)}_requestWithSchemaViaCodec(e,t,r,n){let{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s,headers:l}=n??{},a=Date.now(),c,u;return new Promise((f,h)=>{let g=(T)=>{h(T)};if(!this._transport){g(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(T){g(T);return}if(n?.signal?.aborted){let T=n.signal.reason;throw T instanceof Ye?T:new Ye(tt.RequestTimeout,String(T))}let p=e.era===jl&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,_=this._requestMessageId++;u=_;let y={...t,jsonrpc:"2.0",id:_};if(n?.onprogress)this._progressHandlers.set(_,n.onprogress),y.params={...t.params,_meta:{...t.params?._meta,progressToken:_}};let S=this._envelopeOutbound(y),E=!1,b=(T)=>{if(E)return;if(this._progressHandlers.delete(_),p===void 0){if(t.method!=="initialize")this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:_,reason:String(T)}}),{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s}).catch((C)=>this._onerror(Error(`Failed to send cancellation: ${C}`)))}else p.abort();h(T instanceof Ye?T:new Ye(tt.RequestTimeout,String(T)))};this._responseHandlers.set(_,(T)=>{if(n?.signal?.aborted)return;if(E=!0,T instanceof Error)return h(T);let C;try{C=e.decodeResult(t.method,T.result)}catch(P){return h(P instanceof Error?P:Error(String(P)))}if(C.kind==="invalid")return h(C.error);if(C.kind==="input_required"){if(n?.allowInputRequired===!0)return f(GM(C));let P={codec:e,request:t,resultSchema:r,options:n,flowStartedAt:a,retry:(D,N)=>this._requestWithSchemaViaCodec(e,D===void 0?{method:t.method}:{method:t.method,params:D},r,N)};return f(this._resolveNonCompleteResult(C,P))}let A=C.result;Ri(r,A).then((P)=>{if(P.success)f(P.data);else h(new Ye(tt.InvalidResult,`Invalid result for ${t.method}: ${P.error}`))},h)}),c=()=>b(n?.signal?.reason),n?.signal?.addEventListener("abort",c,{once:!0});let R=n?.timeout??MM,w=()=>b(new Ye(tt.RequestTimeout,"Request timed out",{timeout:R}));this._setupTimeout(_,R,n?.maxTotalTimeout,w,n?.resetTimeoutOnProgress??!1),this._transport.send(S,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s,headers:l,requestSignal:p?.signal}).catch((T)=>{this._progressHandlers.delete(_),h(T)})}).finally(()=>{if(c)n?.signal?.removeEventListener("abort",c);if(u!==void 0)this._responseHandlers.delete(u),this._cleanupTimeout(u)})}async notification(e,t){return await this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,r){if(!this._transport)throw new Ye(tt.NotConnected,"Not connected");if(xc(t.method)&&!e.hasNotificationMethod(t.method))throw new Ye(tt.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let n=this._envelopeOutbound({jsonrpc:"2.0",...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&r?.relatedRequestId===void 0){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;this._transport?.send(n,r).catch((o)=>this._onerror(o))});return}await this._transport.send(n,r)}setRequestHandler(e,t,r){this.assertRequestHandlerCapability(e);let n;if(typeof t==="function"){if(!$c(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);n=(o,i)=>{let s=this._negotiatedWireCodec(),l=s.validateRequest(e,o);if(!l.ok&&l.reason==="not-in-era")l=s.validateInputRequest(e,o);if(!l.ok){if(l.reason==="not-in-era")throw new Le(Te.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(l.message)}return Promise.resolve(t(l.value,i))}}else if(r)n=async(o,i)=>{let s=await Ri(t.params,{...o.params});if(!s.success)throw new Le(Te.InvalidParams,`Invalid params for ${e}: ${s.error}`);return r(s.data,i)};else throw TypeError("setRequestHandler: handler is required");if(typeof t==="function")this._customSchemaRequestMethods.delete(e);else this._customSchemaRequestMethods.add(e);this._requestHandlers.set(e,this._wrapHandler(e,n))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e),this._customSchemaRequestMethods.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,r){if(typeof t==="function"){if(!xc(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(n,o)=>{let i=o.validateNotification(e,n);if(!i.ok){if(i.reason==="not-in-era")throw new Le(Te.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(i.message)}return Promise.resolve(t(i.value))});return}if(!r)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(e,async(n)=>{let o=await Ri(t.params,{...n.params});if(!o.success)throw new Le(Te.InvalidParams,`Invalid params for notification ${e}: ${o.error}`);await r(o.data,n)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Ps(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function UM(e,t){let r={...e};for(let n in t){let o=n,i=t[o];if(i===void 0)continue;let s=r[o];r[o]=Ps(s)&&Ps(i)?{...s,...i}:i}return r}function lh(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function FM(e){let t={},r=[];if(!lh(e))return{accepted:t,droppedKeys:r};for(let[n,o]of Object.entries(e)){if(!lh(o)||"method"in o||"result"in o){r.push(n);continue}t[n]=o}return{accepted:t,droppedKeys:r}}function GM(e){return{resultType:"input_required",inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}var BM=Se((e)=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,r=/\\([\u000b\u0020-\u00ff])/g,n=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=o;function o(l){if(!l)throw TypeError("argument string is required");var a=typeof l==="object"?i(l):l;if(typeof a!=="string")throw TypeError("argument string is required to be a string");var c=a.indexOf(";"),u=c!==-1?a.slice(0,c).trim():a.trim();if(!n.test(u))throw TypeError("invalid media type");var f=new s(u.toLowerCase());if(c!==-1){var h,g,p;t.lastIndex=c;while(g=t.exec(a)){if(g.index!==c)throw TypeError("invalid parameter format");if(c+=g[0].length,h=g[1].toLowerCase(),p=g[2],p.charCodeAt(0)===34){if(p=p.slice(1,-1),p.indexOf("\\")!==-1)p=p.replace(r,"$1")}f.parameters[h]=p}if(c!==a.length)throw TypeError("invalid parameter format")}return f}function i(l){var a;if(typeof l.getHeader==="function")a=l.getHeader("content-type");else if(typeof l.headers==="object")a=l.headers&&l.headers["content-type"];if(typeof a!=="string")throw TypeError("content-type header is missing from object");return a}function s(l){this.parameters=Object.create(null),this.type=l}}),hj=Qv(BM(),1),HM=10485760,zM=class{_buffer;_maxBufferSize;constructor(e){this._maxBufferSize=e?.maxBufferSize??HM}append(e){if((this._buffer?.length??0)+e.length>this._maxBufferSize)throw this.clear(),Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){while(this._buffer){let e=this._buffer.indexOf(`
117
+ `);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");this._buffer=this._buffer.subarray(e+1);try{return VM(t)}catch(r){if(r instanceof SyntaxError)continue;throw r}}return null}clear(){this._buffer=void 0}};function VM(e){return Wy.parse(JSON.parse(e))}function jM(e){return JSON.stringify(e)+`
118
+ `}var WM=/^[A-Za-z0-9._-]{1,128}$/;function JM(e){let t=[];if(e.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" "))t.push("Tool name contains spaces, which may cause parsing issues");if(e.includes(","))t.push("Tool name contains commas, which may cause parsing issues");if(e.startsWith("-")||e.endsWith("-"))t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");if(e.startsWith(".")||e.endsWith("."))t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");if(!WM.test(e)){let r=[...e].filter((n)=>!/[A-Za-z0-9._-]/.test(n)).filter((n,o,i)=>i.indexOf(n)===o);return t.push(`Tool name contains invalid characters: ${r.map((n)=>`"${n}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}function KM(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(let r of t)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function ch(e){let t=JM(e);return KM(e,t.warnings),t.isValid}function XM(e){return typeof e==="object"&&e!==null&&"_zod"in e}function YM(e){return typeof e==="object"&&e!==null&&!("_zod"in e)&&"_def"in e&&typeof e._def?.typeName==="string"}function ZM(e){if(typeof e!=="object"||e===null)return!1;if($i(e))return!1;let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return!1;return Object.values(e).every((r)=>XM(r))}function Lc(e){if(e===void 0)return;if(ZM(e))return X(e);if(typeof e==="object"&&e!==null&&!$i(e)&&Object.values(e).some((t)=>YM(t)))throw TypeError("Raw-shape inputSchema/outputSchema/argsSchema fields must be Zod v4 schemas. Got a Zod v3 field schema. Import from `zod/v4` (or upgrade your zod import), or wrap with `z.object({...})` yourself.");if(!$i(e))throw TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return e}var dl=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var r=class extends t{constructor(S){super();if(!e.IDENTIFIER.test(S))throw Error("CodeGen: name must be a valid identifier");this.str=S}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=r;var n=class extends t{constructor(S){super();this._items=typeof S==="string"?[S]:S}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let S=this._items[0];return S===""||S==='""'}get str(){var S;return(S=this._str)!==null&&S!==void 0?S:this._str=this._items.reduce((E,b)=>`${E}${b}`,"")}get names(){var S;return(S=this._names)!==null&&S!==void 0?S:this._names=this._items.reduce((E,b)=>{if(b instanceof r)E[b.str]=(E[b.str]||0)+1;return E},{})}};e._Code=n,e.nil=new n("");function o(S,...E){let b=[S[0]],R=0;while(R<E.length)l(b,E[R]),b.push(S[++R]);return new n(b)}e._=o;let i=new n("+");function s(S,...E){let b=[g(S[0])],R=0;while(R<E.length)b.push(i),l(b,E[R]),b.push(i,g(S[++R]));return a(b),new n(b)}e.str=s;function l(S,E){if(E instanceof n)S.push(...E._items);else if(E instanceof r)S.push(E);else S.push(f(E))}e.addCodeArg=l;function a(S){let E=1;while(E<S.length-1){if(S[E]===i){let b=c(S[E-1],S[E+1]);if(b!==void 0){S.splice(E-1,3,b);continue}S[E++]="+"}E++}}function c(S,E){if(E==='""')return S;if(S==='""')return E;if(typeof S=="string"){if(E instanceof r||S[S.length-1]!=='"')return;if(typeof E!="string")return`${S.slice(0,-1)}${E}"`;if(E[0]==='"')return S.slice(0,-1)+E.slice(1);return}if(typeof E=="string"&&E[0]==='"'&&!(S instanceof r))return`"${S}${E.slice(1)}`}function u(S,E){return E.emptyStr()?S:S.emptyStr()?E:s`${S}${E}`}e.strConcat=u;function f(S){return typeof S=="number"||typeof S=="boolean"||S===null?S:g(Array.isArray(S)?S.join(","):S)}function h(S){return new n(g(S))}e.stringify=h;function g(S){return JSON.stringify(S).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=g;function p(S){return typeof S=="string"&&e.IDENTIFIER.test(S)?new n(`.${S}`):o`[${S}]`}e.getProperty=p;function _(S){if(typeof S=="string"&&e.IDENTIFIER.test(S))return new n(`${S}`);throw Error(`CodeGen: invalid export name: ${S}, use explicit $id name mapping`)}e.getEsmExportName=_;function y(S){return new n(S.toString())}e.regexpCode=y}),uh=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;let t=dl();var r=class extends Error{constructor(a){super(`CodeGen: "code" for ${a} not defined`);this.value=a.value}},n;(function(a){a[a.Started=0]="Started",a[a.Completed=1]="Completed"})(n||(e.UsedValueState=n={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};var o=class{constructor({prefixes:a,parent:c}={}){this._names={},this._prefixes=a,this._parent=c}toName(a){return a instanceof t.Name?a:this.name(a)}name(a){return new t.Name(this._newName(a))}_newName(a){let c=this._names[a]||this._nameGroup(a);return`${a}${c.index++}`}_nameGroup(a){var c,u;if(((u=(c=this._parent)===null||c===void 0?void 0:c._prefixes)===null||u===void 0?void 0:u.has(a))||this._prefixes&&!this._prefixes.has(a))throw Error(`CodeGen: prefix "${a}" is not allowed in this scope`);return this._names[a]={prefix:a,index:0}}};e.Scope=o;var i=class extends t.Name{constructor(a,c){super(c);this.prefix=a}setValue(a,{property:c,itemIndex:u}){this.value=a,this.scopePath=t._`.${new t.Name(c)}[${u}]`}};e.ValueScopeName=i;let s=t._`\n`;var l=class extends o{constructor(a){super(a);this._values={},this._scope=a.scope,this.opts={...a,_n:a.lines?s:t.nil}}get(){return this._scope}name(a){return new i(a,this._newName(a))}value(a,c){var u;if(c.ref===void 0)throw Error("CodeGen: ref must be passed in value");let f=this.toName(a),{prefix:h}=f,g=(u=c.key)!==null&&u!==void 0?u:c.ref,p=this._values[h];if(p){let S=p.get(g);if(S)return S}else p=this._values[h]=new Map;p.set(g,f);let _=this._scope[h]||(this._scope[h]=[]),y=_.length;return _[y]=c.ref,f.setValue(c,{property:h,itemIndex:y}),f}getValue(a,c){let u=this._values[a];if(!u)return;return u.get(c)}scopeRefs(a,c=this._values){return this._reduceValues(c,(u)=>{if(u.scopePath===void 0)throw Error(`CodeGen: name "${u}" has no value`);return t._`${a}${u.scopePath}`})}scopeCode(a=this._values,c,u){return this._reduceValues(a,(f)=>{if(f.value===void 0)throw Error(`CodeGen: name "${f}" has no value`);return f.value.code},c,u)}_reduceValues(a,c,u={},f){let h=t.nil;for(let g in a){let p=a[g];if(!p)continue;let _=u[g]=u[g]||new Map;p.forEach((y)=>{if(_.has(y))return;_.set(y,n.Started);let S=c(y);if(S){let E=this.opts.es5?e.varKinds.var:e.varKinds.const;h=t._`${h}${E} ${y} = ${S};${this.opts._n}`}else if(S=f===null||f===void 0?void 0:f(y))h=t._`${h}${S}${this.opts._n}`;else throw new r(y);_.set(y,n.Completed)})}return h}};e.ValueScope=l}),Xe=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;let t=dl(),r=uh();var n=dl();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}});var o=uh();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return o.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return o.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return o.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return o.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};var i=class{optimizeNodes(){return this}optimizeNames(q,K){return this}},s=class extends i{constructor(q,K,W){super();this.varKind=q,this.name=K,this.rhs=W}render({es5:q,_n:K}){let W=q?r.varKinds.var:this.varKind,be=this.rhs===void 0?"":` = ${this.rhs}`;return`${W} ${this.name}${be};`+K}optimizeNames(q,K){if(!q[this.name.str])return;if(this.rhs)this.rhs=B(this.rhs,q,K);return this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},l=class extends i{constructor(q,K,W){super();this.lhs=q,this.rhs=K,this.sideEffects=W}render({_n:q}){return`${this.lhs} = ${this.rhs};`+q}optimizeNames(q,K){if(this.lhs instanceof t.Name&&!q[this.lhs.str]&&!this.sideEffects)return;return this.rhs=B(this.rhs,q,K),this}get names(){return G(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},a=class extends l{constructor(q,K,W,be){super(q,W,be);this.op=K}render({_n:q}){return`${this.lhs} ${this.op}= ${this.rhs};`+q}},c=class extends i{constructor(q){super();this.label=q,this.names={}}render({_n:q}){return`${this.label}:`+q}},u=class extends i{constructor(q){super();this.label=q,this.names={}}render({_n:q}){return`break${this.label?` ${this.label}`:""};`+q}},f=class extends i{constructor(q){super();this.error=q}render({_n:q}){return`throw ${this.error};`+q}get names(){return this.error.names}},h=class extends i{constructor(q){super();this.code=q}render({_n:q}){return`${this.code};`+q}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(q,K){return this.code=B(this.code,q,K),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},g=class extends i{constructor(q=[]){super();this.nodes=q}render(q){return this.nodes.reduce((K,W)=>K+W.render(q),"")}optimizeNodes(){let{nodes:q}=this,K=q.length;while(K--){let W=q[K].optimizeNodes();if(Array.isArray(W))q.splice(K,1,...W);else if(W)q[K]=W;else q.splice(K,1)}return q.length>0?this:void 0}optimizeNames(q,K){let{nodes:W}=this,be=W.length;while(be--){let Ce=W[be];if(Ce.optimizeNames(q,K))continue;Q(q,Ce.names),W.splice(be,1)}return W.length>0?this:void 0}get names(){return this.nodes.reduce((q,K)=>F(q,K.names),{})}},p=class extends g{render(q){return"{"+q._n+super.render(q)+"}"+q._n}},_=class extends g{},y=class extends p{};y.kind="else";var S=class q extends p{constructor(K,W){super(W);this.condition=K}render(K){let W=`if(${this.condition})`+super.render(K);if(this.else)W+="else "+this.else.render(K);return W}optimizeNodes(){super.optimizeNodes();let K=this.condition;if(K===!0)return this.nodes;let W=this.else;if(W){let be=W.optimizeNodes();W=this.else=Array.isArray(be)?new y(be):be}if(W){if(K===!1)return W instanceof q?W:W.nodes;if(this.nodes.length)return this;return new q(pe(K),W instanceof q?[W]:W.nodes)}if(K===!1||!this.nodes.length)return;return this}optimizeNames(K,W){var be;if(this.else=(be=this.else)===null||be===void 0?void 0:be.optimizeNames(K,W),!(super.optimizeNames(K,W)||this.else))return;return this.condition=B(this.condition,K,W),this}get names(){let K=super.names;if(G(K,this.condition),this.else)F(K,this.else.names);return K}};S.kind="if";var E=class extends p{};E.kind="for";var b=class extends E{constructor(q){super();this.iteration=q}render(q){return`for(${this.iteration})`+super.render(q)}optimizeNames(q,K){if(!super.optimizeNames(q,K))return;return this.iteration=B(this.iteration,q,K),this}get names(){return F(super.names,this.iteration.names)}},R=class extends E{constructor(q,K,W,be){super();this.varKind=q,this.name=K,this.from=W,this.to=be}render(q){let K=q.es5?r.varKinds.var:this.varKind,{name:W,from:be,to:Ce}=this;return`for(${K} ${W}=${be}; ${W}<${Ce}; ${W}++)`+super.render(q)}get names(){return G(G(super.names,this.from),this.to)}},w=class extends E{constructor(q,K,W,be){super();this.loop=q,this.varKind=K,this.name=W,this.iterable=be}render(q){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(q)}optimizeNames(q,K){if(!super.optimizeNames(q,K))return;return this.iterable=B(this.iterable,q,K),this}get names(){return F(super.names,this.iterable.names)}},T=class extends p{constructor(q,K,W){super();this.name=q,this.args=K,this.async=W}render(q){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(q)}};T.kind="func";var C=class extends g{render(q){return"return "+super.render(q)}};C.kind="return";var A=class extends p{render(q){let K="try"+super.render(q);if(this.catch)K+=this.catch.render(q);if(this.finally)K+=this.finally.render(q);return K}optimizeNodes(){var q,K;return super.optimizeNodes(),(q=this.catch)===null||q===void 0||q.optimizeNodes(),(K=this.finally)===null||K===void 0||K.optimizeNodes(),this}optimizeNames(q,K){var W,be;return super.optimizeNames(q,K),(W=this.catch)===null||W===void 0||W.optimizeNames(q,K),(be=this.finally)===null||be===void 0||be.optimizeNames(q,K),this}get names(){let q=super.names;if(this.catch)F(q,this.catch.names);if(this.finally)F(q,this.finally.names);return q}},P=class extends p{constructor(q){super();this.error=q}render(q){return`catch(${this.error})`+super.render(q)}};P.kind="catch";var D=class extends p{render(q){return"finally"+super.render(q)}};D.kind="finally";var N=class{constructor(q,K={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...K,_n:K.lines?`
119
+ `:""},this._extScope=q,this._scope=new r.Scope({parent:q}),this._nodes=[new _]}toString(){return this._root.render(this.opts)}name(q){return this._scope.name(q)}scopeName(q){return this._extScope.name(q)}scopeValue(q,K){let W=this._extScope.value(q,K);return(this._values[W.prefix]||(this._values[W.prefix]=new Set)).add(W),W}getScopeValue(q,K){return this._extScope.getValue(q,K)}scopeRefs(q){return this._extScope.scopeRefs(q,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(q,K,W,be){let Ce=this._scope.toName(K);if(W!==void 0&&be)this._constants[Ce.str]=W;return this._leafNode(new s(q,Ce,W)),Ce}const(q,K,W){return this._def(r.varKinds.const,q,K,W)}let(q,K,W){return this._def(r.varKinds.let,q,K,W)}var(q,K,W){return this._def(r.varKinds.var,q,K,W)}assign(q,K,W){return this._leafNode(new l(q,K,W))}add(q,K){return this._leafNode(new a(q,e.operators.ADD,K))}code(q){if(typeof q=="function")q();else if(q!==t.nil)this._leafNode(new h(q));return this}object(...q){let K=["{"];for(let[W,be]of q){if(K.length>1)K.push(",");if(K.push(W),W!==be||this.opts.es5)K.push(":"),(0,t.addCodeArg)(K,be)}return K.push("}"),new t._Code(K)}if(q,K,W){if(this._blockNode(new S(q)),K&&W)this.code(K).else().code(W).endIf();else if(K)this.code(K).endIf();else if(W)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(q){return this._elseNode(new S(q))}else(){return this._elseNode(new y)}endIf(){return this._endBlockNode(S,y)}_for(q,K){if(this._blockNode(q),K)this.code(K).endFor();return this}for(q,K){return this._for(new b(q),K)}forRange(q,K,W,be,Ce=this.opts.es5?r.varKinds.var:r.varKinds.let){let ze=this._scope.toName(q);return this._for(new R(Ce,ze,K,W),()=>be(ze))}forOf(q,K,W,be=r.varKinds.const){let Ce=this._scope.toName(q);if(this.opts.es5){let ze=K instanceof t.Name?K:this.var("_arr",K);return this.forRange("_i",0,t._`${ze}.length`,(Ie)=>{this.var(Ce,t._`${ze}[${Ie}]`),W(Ce)})}return this._for(new w("of",be,Ce,K),()=>W(Ce))}forIn(q,K,W,be=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(q,t._`Object.keys(${K})`,W);let Ce=this._scope.toName(q);return this._for(new w("in",be,Ce,K),()=>W(Ce))}endFor(){return this._endBlockNode(E)}label(q){return this._leafNode(new c(q))}break(q){return this._leafNode(new u(q))}return(q){let K=new C;if(this._blockNode(K),this.code(q),K.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(C)}try(q,K,W){if(!K&&!W)throw Error('CodeGen: "try" without "catch" and "finally"');let be=new A;if(this._blockNode(be),this.code(q),K){let Ce=this.name("e");this._currNode=be.catch=new P(Ce),K(Ce)}if(W)this._currNode=be.finally=new D,this.code(W);return this._endBlockNode(P,D)}throw(q){return this._leafNode(new f(q))}block(q,K){if(this._blockStarts.push(this._nodes.length),q)this.code(q).endBlock(K);return this}endBlock(q){let K=this._blockStarts.pop();if(K===void 0)throw Error("CodeGen: not in self-balancing block");let W=this._nodes.length-K;if(W<0||q!==void 0&&W!==q)throw Error(`CodeGen: wrong number of nodes: ${W} vs ${q} expected`);return this._nodes.length=K,this}func(q,K=t.nil,W,be){if(this._blockNode(new T(q,K,W)),be)this.code(be).endFunc();return this}endFunc(){return this._endBlockNode(T)}optimize(q=1){while(q-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(q){return this._currNode.nodes.push(q),this}_blockNode(q){this._currNode.nodes.push(q),this._nodes.push(q)}_endBlockNode(q,K){let W=this._currNode;if(W instanceof q||K&&W instanceof K)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${K?`${q.kind}/${K.kind}`:q.kind}"`)}_elseNode(q){let K=this._currNode;if(!(K instanceof S))throw Error('CodeGen: "else" without "if"');return this._currNode=K.else=q,this}get _root(){return this._nodes[0]}get _currNode(){let q=this._nodes;return q[q.length-1]}set _currNode(q){let K=this._nodes;K[K.length-1]=q}};e.CodeGen=N;function F(q,K){for(let W in K)q[W]=(q[W]||0)+(K[W]||0);return q}function G(q,K){return K instanceof t._CodeOrName?F(q,K.names):q}function B(q,K,W){if(q instanceof t.Name)return be(q);if(!Ce(q))return q;return new t._Code(q._items.reduce((ze,Ie)=>{if(Ie instanceof t.Name)Ie=be(Ie);if(Ie instanceof t._Code)ze.push(...Ie._items);else ze.push(Ie);return ze},[]));function be(ze){let Ie=W[ze.str];if(Ie===void 0||K[ze.str]!==1)return ze;return delete K[ze.str],Ie}function Ce(ze){return ze instanceof t._Code&&ze._items.some((Ie)=>Ie instanceof t.Name&&K[Ie.str]===1&&W[Ie.str]!==void 0)}}function Q(q,K){for(let W in K)q[W]=(q[W]||0)-(K[W]||0)}function pe(q){return typeof q=="boolean"||typeof q=="number"||q===null?!q:t._`!${he(q)}`}e.not=pe;let se=ne(e.operators.AND);function ve(...q){return q.reduce(se)}e.and=ve;let me=ne(e.operators.OR);function j(...q){return q.reduce(me)}e.or=j;function ne(q){return(K,W)=>K===t.nil?W:W===t.nil?K:t._`${he(K)} ${q} ${he(W)}`}function he(q){return q instanceof t.Name?q:t._`(${q})`}}),ut=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;let t=Xe(),r=dl();function n(T){let C={};for(let A of T)C[A]=!0;return C}e.toHash=n;function o(T,C){if(typeof C=="boolean")return C;if(Object.keys(C).length===0)return!0;return i(T,C),!s(C,T.self.RULES.all)}e.alwaysValidSchema=o;function i(T,C=T.schema){let{opts:A,self:P}=T;if(!A.strictSchema)return;if(typeof C==="boolean")return;let D=P.RULES.keywords;for(let N in C)if(!D[N])w(T,`unknown keyword: "${N}"`)}e.checkUnknownRules=i;function s(T,C){if(typeof T=="boolean")return!T;for(let A in T)if(C[A])return!0;return!1}e.schemaHasRules=s;function l(T,C){if(typeof T=="boolean")return!T;for(let A in T)if(A!=="$ref"&&C.all[A])return!0;return!1}e.schemaHasRulesButRef=l;function a({topSchemaRef:T,schemaPath:C},A,P,D){if(!D){if(typeof A=="number"||typeof A=="boolean")return A;if(typeof A=="string")return t._`${A}`}return t._`${T}${C}${(0,t.getProperty)(P)}`}e.schemaRefOrVal=a;function c(T){return h(decodeURIComponent(T))}e.unescapeFragment=c;function u(T){return encodeURIComponent(f(T))}e.escapeFragment=u;function f(T){if(typeof T=="number")return`${T}`;return T.replace(/~/g,"~0").replace(/\//g,"~1")}e.escapeJsonPointer=f;function h(T){return T.replace(/~1/g,"/").replace(/~0/g,"~")}e.unescapeJsonPointer=h;function g(T,C){if(Array.isArray(T))for(let A of T)C(A);else C(T)}e.eachItem=g;function p({mergeNames:T,mergeToName:C,mergeValues:A,resultToName:P}){return(D,N,F,G)=>{let B=F===void 0?N:F instanceof t.Name?(N instanceof t.Name?T(D,N,F):C(D,N,F),F):N instanceof t.Name?(C(D,F,N),N):A(N,F);return G===t.Name&&!(B instanceof t.Name)?P(D,B):B}}e.mergeEvaluated={props:p({mergeNames:(T,C,A)=>T.if(t._`${A} !== true && ${C} !== undefined`,()=>{T.if(t._`${C} === true`,()=>T.assign(A,!0),()=>T.assign(A,t._`${A} || {}`).code(t._`Object.assign(${A}, ${C})`))}),mergeToName:(T,C,A)=>T.if(t._`${A} !== true`,()=>{if(C===!0)T.assign(A,!0);else T.assign(A,t._`${A} || {}`),y(T,A,C)}),mergeValues:(T,C)=>T===!0?!0:{...T,...C},resultToName:_}),items:p({mergeNames:(T,C,A)=>T.if(t._`${A} !== true && ${C} !== undefined`,()=>T.assign(A,t._`${C} === true ? true : ${A} > ${C} ? ${A} : ${C}`)),mergeToName:(T,C,A)=>T.if(t._`${A} !== true`,()=>T.assign(A,C===!0?!0:t._`${A} > ${C} ? ${A} : ${C}`)),mergeValues:(T,C)=>T===!0?!0:Math.max(T,C),resultToName:(T,C)=>T.var("items",C)})};function _(T,C){if(C===!0)return T.var("props",!0);let A=T.var("props",t._`{}`);if(C!==void 0)y(T,A,C);return A}e.evaluatedPropsToName=_;function y(T,C,A){Object.keys(A).forEach((P)=>T.assign(t._`${C}${(0,t.getProperty)(P)}`,!0))}e.setEvaluated=y;let S={};function E(T,C){return T.scopeValue("func",{ref:C,code:S[C.code]||(S[C.code]=new r._Code(C.code))})}e.useFunc=E;var b;(function(T){T[T.Num=0]="Num",T[T.Str=1]="Str"})(b||(e.Type=b={}));function R(T,C,A){if(T instanceof t.Name){let P=C===b.Num;return A?P?t._`"[" + ${T} + "]"`:t._`"['" + ${T} + "']"`:P?t._`"/" + ${T}`:t._`"/" + ${T}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return A?(0,t.getProperty)(T).toString():"/"+f(T)}e.getErrorPath=R;function w(T,C,A=T.opts.strictSchema){if(!A)return;if(C=`strict mode: ${C}`,A===!0)throw Error(C);T.self.logger.warn(C)}e.checkStrictMode=w}),Jr=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r={data:new t.Name("data"),valCxt:new t.Name("valCxt"),instancePath:new t.Name("instancePath"),parentData:new t.Name("parentData"),parentDataProperty:new t.Name("parentDataProperty"),rootData:new t.Name("rootData"),dynamicAnchors:new t.Name("dynamicAnchors"),vErrors:new t.Name("vErrors"),errors:new t.Name("errors"),this:new t.Name("this"),self:new t.Name("self"),scope:new t.Name("scope"),json:new t.Name("json"),jsonPos:new t.Name("jsonPos"),jsonLen:new t.Name("jsonLen"),jsonPart:new t.Name("jsonPart")};e.default=r}),Jl=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;let t=Xe(),r=ut(),n=Jr();e.keywordError={message:({keyword:y})=>t.str`must pass "${y}" keyword validation`},e.keyword$DataError={message:({keyword:y,schemaType:S})=>S?t.str`"${y}" keyword must be ${S} ($data)`:t.str`"${y}" keyword is invalid ($data)`};function o(y,S=e.keywordError,E,b){let{it:R}=y,{gen:w,compositeRule:T,allErrors:C}=R,A=f(y,S,E);if(b!==null&&b!==void 0?b:T||C)a(w,A);else c(R,t._`[${A}]`)}e.reportError=o;function i(y,S=e.keywordError,E){let{it:b}=y,{gen:R,compositeRule:w,allErrors:T}=b;if(a(R,f(y,S,E)),!(w||T))c(b,n.default.vErrors)}e.reportExtraError=i;function s(y,S){y.assign(n.default.errors,S),y.if(t._`${n.default.vErrors} !== null`,()=>y.if(S,()=>y.assign(t._`${n.default.vErrors}.length`,S),()=>y.assign(n.default.vErrors,null)))}e.resetErrorsCount=s;function l({gen:y,keyword:S,schemaValue:E,data:b,errsCount:R,it:w}){if(R===void 0)throw Error("ajv implementation error");let T=y.name("err");y.forRange("i",R,n.default.errors,(C)=>{if(y.const(T,t._`${n.default.vErrors}[${C}]`),y.if(t._`${T}.instancePath === undefined`,()=>y.assign(t._`${T}.instancePath`,(0,t.strConcat)(n.default.instancePath,w.errorPath))),y.assign(t._`${T}.schemaPath`,t.str`${w.errSchemaPath}/${S}`),w.opts.verbose)y.assign(t._`${T}.schema`,E),y.assign(t._`${T}.data`,b)})}e.extendErrors=l;function a(y,S){let E=y.const("err",S);y.if(t._`${n.default.vErrors} === null`,()=>y.assign(n.default.vErrors,t._`[${E}]`),t._`${n.default.vErrors}.push(${E})`),y.code(t._`${n.default.errors}++`)}function c(y,S){let{gen:E,validateName:b,schemaEnv:R}=y;if(R.$async)E.throw(t._`new ${y.ValidationError}(${S})`);else E.assign(t._`${b}.errors`,S),E.return(!1)}let u={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function f(y,S,E){let{createErrors:b}=y.it;if(b===!1)return t._`{}`;return h(y,S,E)}function h(y,S,E={}){let{gen:b,it:R}=y,w=[g(R,E),p(y,E)];return _(y,S,w),b.object(...w)}function g({errorPath:y},{instancePath:S}){let E=S?t.str`${y}${(0,r.getErrorPath)(S,r.Type.Str)}`:y;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,E)]}function p({keyword:y,it:{errSchemaPath:S}},{schemaPath:E,parentSchema:b}){let R=b?S:t.str`${S}/${y}`;if(E)R=t.str`${R}${(0,r.getErrorPath)(E,r.Type.Str)}`;return[u.schemaPath,R]}function _(y,{params:S,message:E},b){let{keyword:R,data:w,schemaValue:T,it:C}=y,{opts:A,propertyName:P,topSchemaRef:D,schemaPath:N}=C;if(b.push([u.keyword,R],[u.params,typeof S=="function"?S(y):S||t._`{}`]),A.messages)b.push([u.message,typeof E=="function"?E(y):E]);if(A.verbose)b.push([u.schema,T],[u.parentSchema,t._`${D}${N}`],[n.default.data,w]);if(P)b.push([u.propertyName,P])}}),QM=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;let t=Jl(),r=Xe(),n=Jr(),o={message:"boolean schema is false"};function i(a){let{gen:c,schema:u,validateName:f}=a;if(u===!1)l(a,!1);else if(typeof u=="object"&&u.$async===!0)c.return(n.default.data);else c.assign(r._`${f}.errors`,null),c.return(!0)}e.topBoolOrEmptySchema=i;function s(a,c){let{gen:u,schema:f}=a;if(f===!1)u.var(c,!1),l(a);else u.var(c,!0)}e.boolOrEmptySchema=s;function l(a,c){let{gen:u,data:f}=a,h={gen:u,keyword:"false schema",data:f,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:a};(0,t.reportError)(h,o,void 0,c)}}),sE=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;let t=new Set(["string","number","integer","boolean","null","object","array"]);function r(o){return typeof o=="string"&&t.has(o)}e.isJSONType=r;function n(){let o={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...o,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},o.number,o.string,o.array,o.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=n}),aE=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:o,self:i},s){let l=i.RULES.types[s];return l&&l!==!0&&r(o,l)}e.schemaHasRulesForType=t;function r(o,i){return i.rules.some((s)=>n(o,s))}e.shouldUseGroup=r;function n(o,i){var s;return o[i.keyword]!==void 0||((s=i.definition.implements)===null||s===void 0?void 0:s.some((l)=>o[l]!==void 0))}e.shouldUseRule=n}),fl=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;let t=sE(),r=aE(),n=Jl(),o=Xe(),i=ut();var s;(function(b){b[b.Correct=0]="Correct",b[b.Wrong=1]="Wrong"})(s||(e.DataType=s={}));function l(b){let R=a(b.type);if(R.includes("null")){if(b.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!R.length&&b.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(b.nullable===!0)R.push("null")}return R}e.getSchemaTypes=l;function a(b){let R=Array.isArray(b)?b:b?[b]:[];if(R.every(t.isJSONType))return R;throw Error("type must be JSONType or JSONType[]: "+R.join(","))}e.getJSONTypes=a;function c(b,R){let{gen:w,data:T,opts:C}=b,A=f(R,C.coerceTypes),P=R.length>0&&!(A.length===0&&R.length===1&&(0,r.schemaHasRulesForType)(b,R[0]));if(P){let D=_(R,T,C.strictNumbers,s.Wrong);w.if(D,()=>{if(A.length)h(b,R,A);else S(b)})}return P}e.coerceAndCheckDataType=c;let u=new Set(["string","number","integer","boolean","null"]);function f(b,R){return R?b.filter((w)=>u.has(w)||R==="array"&&w==="array"):[]}function h(b,R,w){let{gen:T,data:C,opts:A}=b,P=T.let("dataType",o._`typeof ${C}`),D=T.let("coerced",o._`undefined`);if(A.coerceTypes==="array")T.if(o._`${P} == 'object' && Array.isArray(${C}) && ${C}.length == 1`,()=>T.assign(C,o._`${C}[0]`).assign(P,o._`typeof ${C}`).if(_(R,C,A.strictNumbers),()=>T.assign(D,C)));T.if(o._`${D} !== undefined`);for(let F of w)if(u.has(F)||F==="array"&&A.coerceTypes==="array")N(F);T.else(),S(b),T.endIf(),T.if(o._`${D} !== undefined`,()=>{T.assign(C,D),g(b,D)});function N(F){switch(F){case"string":T.elseIf(o._`${P} == "number" || ${P} == "boolean"`).assign(D,o._`"" + ${C}`).elseIf(o._`${C} === null`).assign(D,o._`""`);return;case"number":T.elseIf(o._`${P} == "boolean" || ${C} === null
120
+ || (${P} == "string" && ${C} && ${C} == +${C})`).assign(D,o._`+${C}`);return;case"integer":T.elseIf(o._`${P} === "boolean" || ${C} === null
121
+ || (${P} === "string" && ${C} && ${C} == +${C} && !(${C} % 1))`).assign(D,o._`+${C}`);return;case"boolean":T.elseIf(o._`${C} === "false" || ${C} === 0 || ${C} === null`).assign(D,!1).elseIf(o._`${C} === "true" || ${C} === 1`).assign(D,!0);return;case"null":T.elseIf(o._`${C} === "" || ${C} === 0 || ${C} === false`),T.assign(D,null);return;case"array":T.elseIf(o._`${P} === "string" || ${P} === "number"
122
+ || ${P} === "boolean" || ${C} === null`).assign(D,o._`[${C}]`)}}}function g({gen:b,parentData:R,parentDataProperty:w},T){b.if(o._`${R} !== undefined`,()=>b.assign(o._`${R}[${w}]`,T))}function p(b,R,w,T=s.Correct){let C=T===s.Correct?o.operators.EQ:o.operators.NEQ,A;switch(b){case"null":return o._`${R} ${C} null`;case"array":A=o._`Array.isArray(${R})`;break;case"object":A=o._`${R} && typeof ${R} == "object" && !Array.isArray(${R})`;break;case"integer":A=P(o._`!(${R} % 1) && !isNaN(${R})`);break;case"number":A=P();break;default:return o._`typeof ${R} ${C} ${b}`}return T===s.Correct?A:(0,o.not)(A);function P(D=o.nil){return(0,o.and)(o._`typeof ${R} == "number"`,D,w?o._`isFinite(${R})`:o.nil)}}e.checkDataType=p;function _(b,R,w,T){if(b.length===1)return p(b[0],R,w,T);let C,A=(0,i.toHash)(b);if(A.array&&A.object){let P=o._`typeof ${R} != "object"`;C=A.null?P:o._`!${R} || ${P}`,delete A.null,delete A.array,delete A.object}else C=o.nil;if(A.number)delete A.integer;for(let P in A)C=(0,o.and)(C,p(P,R,w,T));return C}e.checkDataTypes=_;let y={message:({schema:b})=>`must be ${b}`,params:({schema:b,schemaValue:R})=>typeof b=="string"?o._`{type: ${b}}`:o._`{type: ${R}}`};function S(b){let R=E(b);(0,n.reportError)(R,y)}e.reportTypeError=S;function E(b){let{gen:R,data:w,schema:T}=b,C=(0,i.schemaRefOrVal)(b,T,"type");return{gen:R,keyword:"type",data:w,schema:T.type,schemaCode:C,schemaValue:C,parentSchema:T,params:{},it:b}}}),eD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;let t=Xe(),r=ut();function n(i,s){let{properties:l,items:a}=i.schema;if(s==="object"&&l)for(let c in l)o(i,c,l[c].default);else if(s==="array"&&Array.isArray(a))a.forEach((c,u)=>o(i,u,c.default))}e.assignDefaults=n;function o(i,s,l){let{gen:a,compositeRule:c,data:u,opts:f}=i;if(l===void 0)return;let h=t._`${u}${(0,t.getProperty)(s)}`;if(c){(0,r.checkStrictMode)(i,`default is ignored for: ${h}`);return}let g=t._`${h} === undefined`;if(f.useDefaults==="empty")g=t._`${g} || ${h} === null || ${h} === ""`;a.if(g,t._`${h} = ${(0,t.stringify)(l)}`)}}),Kr=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;let t=Xe(),r=ut(),n=Jr(),o=ut();function i(b,R){let{gen:w,data:T,it:C}=b;w.if(f(w,T,R,C.opts.ownProperties),()=>{b.setParams({missingProperty:t._`${R}`},!0),b.error()})}e.checkReportMissingProp=i;function s({gen:b,data:R,it:{opts:w}},T,C){return(0,t.or)(...T.map((A)=>(0,t.and)(f(b,R,A,w.ownProperties),t._`${C} = ${A}`)))}e.checkMissingProp=s;function l(b,R){b.setParams({missingProperty:R},!0),b.error()}e.reportMissingProp=l;function a(b){return b.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:t._`Object.prototype.hasOwnProperty`})}e.hasPropFunc=a;function c(b,R,w){return t._`${a(b)}.call(${R}, ${w})`}e.isOwnProperty=c;function u(b,R,w,T){let C=t._`${R}${(0,t.getProperty)(w)} !== undefined`;return T?t._`${C} && ${c(b,R,w)}`:C}e.propertyInData=u;function f(b,R,w,T){let C=t._`${R}${(0,t.getProperty)(w)} === undefined`;return T?(0,t.or)(C,(0,t.not)(c(b,R,w))):C}e.noPropertyInData=f;function h(b){return b?Object.keys(b).filter((R)=>R!=="__proto__"):[]}e.allSchemaProperties=h;function g(b,R){return h(R).filter((w)=>!(0,r.alwaysValidSchema)(b,R[w]))}e.schemaProperties=g;function p({schemaCode:b,data:R,it:{gen:w,topSchemaRef:T,schemaPath:C,errorPath:A},it:P},D,N,F){let G=F?t._`${b}, ${R}, ${T}${C}`:R,B=[[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,A)],[n.default.parentData,P.parentData],[n.default.parentDataProperty,P.parentDataProperty],[n.default.rootData,n.default.rootData]];if(P.opts.dynamicRef)B.push([n.default.dynamicAnchors,n.default.dynamicAnchors]);let Q=t._`${G}, ${w.object(...B)}`;return N!==t.nil?t._`${D}.call(${N}, ${Q})`:t._`${D}(${Q})`}e.callValidateCode=p;let _=t._`new RegExp`;function y({gen:b,it:{opts:R}},w){let T=R.unicodeRegExp?"u":"",{regExp:C}=R.code,A=C(w,T);return b.scopeValue("pattern",{key:A.toString(),ref:A,code:t._`${C.code==="new RegExp"?_:(0,o.useFunc)(b,C)}(${w}, ${T})`})}e.usePattern=y;function S(b){let{gen:R,data:w,keyword:T,it:C}=b,A=R.name("valid");if(C.allErrors){let D=R.let("valid",!0);return P(()=>R.assign(D,!1)),D}return R.var(A,!0),P(()=>R.break()),A;function P(D){let N=R.const("len",t._`${w}.length`);R.forRange("i",0,N,(F)=>{b.subschema({keyword:T,dataProp:F,dataPropType:r.Type.Num},A),R.if((0,t.not)(A),D)})}}e.validateArray=S;function E(b){let{gen:R,schema:w,keyword:T,it:C}=b;if(!Array.isArray(w))throw Error("ajv implementation error");if(w.some((D)=>(0,r.alwaysValidSchema)(C,D))&&!C.opts.unevaluated)return;let A=R.let("valid",!1),P=R.name("_valid");R.block(()=>w.forEach((D,N)=>{let F=b.subschema({keyword:T,schemaProp:N,compositeRule:!0},P);if(R.assign(A,t._`${A} || ${P}`),!b.mergeValidEvaluated(F,P))R.if((0,t.not)(A))})),b.result(A,()=>b.reset(),()=>b.error(!0))}e.validateUnion=E}),tD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;let t=Xe(),r=Jr(),n=Kr(),o=Jl();function i(g,p){let{gen:_,keyword:y,schema:S,parentSchema:E,it:b}=g,R=p.macro.call(b.self,S,E,b),w=u(_,y,R);if(b.opts.validateSchema!==!1)b.self.validateSchema(R,!0);let T=_.name("valid");g.subschema({schema:R,schemaPath:t.nil,errSchemaPath:`${b.errSchemaPath}/${y}`,topSchemaRef:w,compositeRule:!0},T),g.pass(T,()=>g.error(!0))}e.macroKeywordCode=i;function s(g,p){var _;let{gen:y,keyword:S,schema:E,parentSchema:b,$data:R,it:w}=g;c(w,p);let T=u(y,S,!R&&p.compile?p.compile.call(w.self,E,b,w):p.validate),C=y.let("valid");g.block$data(C,A),g.ok((_=p.valid)!==null&&_!==void 0?_:C);function A(){if(p.errors===!1){if(N(),p.modifying)l(g);F(()=>g.error())}else{let G=p.async?P():D();if(p.modifying)l(g);F(()=>a(g,G))}}function P(){let G=y.let("ruleErrs",null);return y.try(()=>N(t._`await `),(B)=>y.assign(C,!1).if(t._`${B} instanceof ${w.ValidationError}`,()=>y.assign(G,t._`${B}.errors`),()=>y.throw(B))),G}function D(){let G=t._`${T}.errors`;return y.assign(G,null),N(t.nil),G}function N(G=p.async?t._`await `:t.nil){let B=w.opts.passContext?r.default.this:r.default.self,Q=!(("compile"in p)&&!R||p.schema===!1);y.assign(C,t._`${G}${(0,n.callValidateCode)(g,T,B,Q)}`,p.modifying)}function F(G){var B;y.if((0,t.not)((B=p.valid)!==null&&B!==void 0?B:C),G)}}e.funcKeywordCode=s;function l(g){let{gen:p,data:_,it:y}=g;p.if(y.parentData,()=>p.assign(_,t._`${y.parentData}[${y.parentDataProperty}]`))}function a(g,p){let{gen:_}=g;_.if(t._`Array.isArray(${p})`,()=>{_.assign(r.default.vErrors,t._`${r.default.vErrors} === null ? ${p} : ${r.default.vErrors}.concat(${p})`).assign(r.default.errors,t._`${r.default.vErrors}.length`),(0,o.extendErrors)(g)},()=>g.error())}function c({schemaEnv:g},p){if(p.async&&!g.$async)throw Error("async keyword in sync schema")}function u(g,p,_){if(_===void 0)throw Error(`keyword "${p}" failed to compile`);return g.scopeValue("keyword",typeof _=="function"?{ref:_}:{ref:_,code:(0,t.stringify)(_)})}function f(g,p,_=!1){return!p.length||p.some((y)=>y==="array"?Array.isArray(g):y==="object"?g&&typeof g=="object"&&!Array.isArray(g):typeof g==y||_&&typeof g>"u")}e.validSchemaType=f;function h({schema:g,opts:p,self:_,errSchemaPath:y},S,E){if(Array.isArray(S.keyword)?!S.keyword.includes(E):S.keyword!==E)throw Error("ajv implementation error");let b=S.dependencies;if(b===null||b===void 0?void 0:b.some((R)=>!Object.prototype.hasOwnProperty.call(g,R)))throw Error(`parent schema must have dependencies of ${E}: ${b.join(",")}`);if(S.validateSchema){if(!S.validateSchema(g[E])){let R=`keyword "${E}" value is invalid at path "${y}": `+_.errorsText(S.validateSchema.errors);if(p.validateSchema==="log")_.logger.error(R);else throw Error(R)}}}e.validateKeywordUsage=h}),rD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;let t=Xe(),r=ut();function n(s,{keyword:l,schemaProp:a,schema:c,schemaPath:u,errSchemaPath:f,topSchemaRef:h}){if(l!==void 0&&c!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(l!==void 0){let g=s.schema[l];return a===void 0?{schema:g,schemaPath:t._`${s.schemaPath}${(0,t.getProperty)(l)}`,errSchemaPath:`${s.errSchemaPath}/${l}`}:{schema:g[a],schemaPath:t._`${s.schemaPath}${(0,t.getProperty)(l)}${(0,t.getProperty)(a)}`,errSchemaPath:`${s.errSchemaPath}/${l}/${(0,r.escapeFragment)(a)}`}}if(c!==void 0){if(u===void 0||f===void 0||h===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:c,schemaPath:u,topSchemaRef:h,errSchemaPath:f}}throw Error('either "keyword" or "schema" must be passed')}e.getSubschema=n;function o(s,l,{dataProp:a,dataPropType:c,data:u,dataTypes:f,propertyName:h}){if(u!==void 0&&a!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:g}=l;if(a!==void 0){let{errorPath:_,dataPathArr:y,opts:S}=l;p(g.let("data",t._`${l.data}${(0,t.getProperty)(a)}`,!0)),s.errorPath=t.str`${_}${(0,r.getErrorPath)(a,c,S.jsPropertySyntax)}`,s.parentDataProperty=t._`${a}`,s.dataPathArr=[...y,s.parentDataProperty]}if(u!==void 0){if(p(u instanceof t.Name?u:g.let("data",u,!0)),h!==void 0)s.propertyName=h}if(f)s.dataTypes=f;function p(_){s.data=_,s.dataLevel=l.dataLevel+1,s.dataTypes=[],l.definedProperties=new Set,s.parentData=l.data,s.dataNames=[...l.dataNames,_]}}e.extendSubschemaData=o;function i(s,{jtdDiscriminator:l,jtdMetadata:a,compositeRule:c,createErrors:u,allErrors:f}){if(c!==void 0)s.compositeRule=c;if(u!==void 0)s.createErrors=u;if(f!==void 0)s.allErrors=f;s.jtdDiscriminator=l,s.jtdMetadata=a}e.extendSubschemaMode=i}),lE=Se((e,t)=>{t.exports=function r(n,o){if(n===o)return!0;if(n&&o&&typeof n=="object"&&typeof o=="object"){if(n.constructor!==o.constructor)return!1;var i,s,l;if(Array.isArray(n)){if(i=n.length,i!=o.length)return!1;for(s=i;s--!==0;)if(!r(n[s],o[s]))return!1;return!0}if(n.constructor===RegExp)return n.source===o.source&&n.flags===o.flags;if(n.valueOf!==Object.prototype.valueOf)return n.valueOf()===o.valueOf();if(n.toString!==Object.prototype.toString)return n.toString()===o.toString();if(l=Object.keys(n),i=l.length,i!==Object.keys(o).length)return!1;for(s=i;s--!==0;)if(!Object.prototype.hasOwnProperty.call(o,l[s]))return!1;for(s=i;s--!==0;){var a=l[s];if(!r(n[a],o[a]))return!1}return!0}return n!==n&&o!==o}}),nD=Se((e,t)=>{var r=t.exports=function(i,s,l){if(typeof s=="function")l=s,s={};l=s.cb||l;var a=typeof l=="function"?l:l.pre||function(){},c=l.post||function(){};n(s,a,c,i,"",i)};r.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},r.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},r.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},r.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function n(i,s,l,a,c,u,f,h,g,p){if(a&&typeof a=="object"&&!Array.isArray(a)){s(a,c,u,f,h,g,p);for(var _ in a){var y=a[_];if(Array.isArray(y)){if(_ in r.arrayKeywords)for(var S=0;S<y.length;S++)n(i,s,l,y[S],c+"/"+_+"/"+S,u,c,_,a,S)}else if(_ in r.propsKeywords){if(y&&typeof y=="object")for(var E in y)n(i,s,l,y[E],c+"/"+_+"/"+o(E),u,c,_,a,E)}else if(_ in r.keywords||i.allKeys&&!(_ in r.skipKeywords))n(i,s,l,y,c+"/"+_,u,c,_,a)}l(a,c,u,f,h,g,p)}}function o(i){return i.replace(/~/g,"~0").replace(/\//g,"~1")}}),Kl=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;let t=ut(),r=lE(),n=nD(),o=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function i(y,S=!0){if(typeof y=="boolean")return!0;if(S===!0)return!l(y);if(!S)return!1;return a(y)<=S}e.inlineRef=i;let s=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function l(y){for(let S in y){if(s.has(S))return!0;let E=y[S];if(Array.isArray(E)&&E.some(l))return!0;if(typeof E=="object"&&l(E))return!0}return!1}function a(y){let S=0;for(let E in y){if(E==="$ref")return 1/0;if(S++,o.has(E))continue;if(typeof y[E]=="object")(0,t.eachItem)(y[E],(b)=>S+=a(b));if(S===1/0)return 1/0}return S}function c(y,S="",E){if(E!==!1)S=h(S);return u(y,y.parse(S))}e.getFullPath=c;function u(y,S){return y.serialize(S).split("#")[0]+"#"}e._getFullPath=u;let f=/#\/?$/;function h(y){return y?y.replace(f,""):""}e.normalizeId=h;function g(y,S,E){return E=h(E),y.resolve(S,E)}e.resolveUrl=g;let p=/^[a-z_][-a-z0-9._]*$/i;function _(y,S){if(typeof y=="boolean")return{};let{schemaId:E,uriResolver:b}=this.opts,R=h(y[E]||S),w={"":R},T=c(b,R,!1),C={},A=new Set;return n(y,{allKeys:!0},(N,F,G,B)=>{if(B===void 0)return;let Q=T+F,pe=w[B];if(typeof N[E]=="string")pe=se.call(this,N[E]);ve.call(this,N.$anchor),ve.call(this,N.$dynamicAnchor),w[F]=pe;function se(me){let j=this.opts.uriResolver.resolve;if(me=h(pe?j(pe,me):me),A.has(me))throw D(me);A.add(me);let ne=this.refs[me];if(typeof ne=="string")ne=this.refs[ne];if(typeof ne=="object")P(N,ne.schema,me);else if(me!==h(Q))if(me[0]==="#")P(N,C[me],me),C[me]=N;else this.refs[me]=Q;return me}function ve(me){if(typeof me=="string"){if(!p.test(me))throw Error(`invalid anchor "${me}"`);se.call(this,`#${me}`)}}}),C;function P(N,F,G){if(F!==void 0&&!r(N,F))throw D(G)}function D(N){return Error(`reference "${N}" resolves to more than one schema`)}}e.getSchemaRefs=_}),Ji=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;let t=QM(),r=fl(),n=aE(),o=fl(),i=eD(),s=tD(),l=rD(),a=Xe(),c=Jr(),u=Kl(),f=ut(),h=Jl();function g(O){if(T(O)){if(A(O),w(O)){S(O);return}}p(O,()=>(0,t.topBoolOrEmptySchema)(O))}e.validateFunctionCode=g;function p({gen:O,validateName:x,schema:H,schemaEnv:J,opts:Y},ee){if(Y.code.es5)O.func(x,a._`${c.default.data}, ${c.default.valCxt}`,J.$async,()=>{O.code(a._`"use strict"; ${b(H,Y)}`),y(O,Y),O.code(ee)});else O.func(x,a._`${c.default.data}, ${_(Y)}`,J.$async,()=>O.code(b(H,Y)).code(ee))}function _(O){return a._`{${c.default.instancePath}="", ${c.default.parentData}, ${c.default.parentDataProperty}, ${c.default.rootData}=${c.default.data}${O.dynamicRef?a._`, ${c.default.dynamicAnchors}={}`:a.nil}}={}`}function y(O,x){O.if(c.default.valCxt,()=>{if(O.var(c.default.instancePath,a._`${c.default.valCxt}.${c.default.instancePath}`),O.var(c.default.parentData,a._`${c.default.valCxt}.${c.default.parentData}`),O.var(c.default.parentDataProperty,a._`${c.default.valCxt}.${c.default.parentDataProperty}`),O.var(c.default.rootData,a._`${c.default.valCxt}.${c.default.rootData}`),x.dynamicRef)O.var(c.default.dynamicAnchors,a._`${c.default.valCxt}.${c.default.dynamicAnchors}`)},()=>{if(O.var(c.default.instancePath,a._`""`),O.var(c.default.parentData,a._`undefined`),O.var(c.default.parentDataProperty,a._`undefined`),O.var(c.default.rootData,c.default.data),x.dynamicRef)O.var(c.default.dynamicAnchors,a._`{}`)})}function S(O){let{schema:x,opts:H,gen:J}=O;p(O,()=>{if(H.$comment&&x.$comment)B(O);if(N(O),J.let(c.default.vErrors,null),J.let(c.default.errors,0),H.unevaluated)E(O);P(O),Q(O)})}function E(O){let{gen:x,validateName:H}=O;O.evaluated=x.const("evaluated",a._`${H}.evaluated`),x.if(a._`${O.evaluated}.dynamicProps`,()=>x.assign(a._`${O.evaluated}.props`,a._`undefined`)),x.if(a._`${O.evaluated}.dynamicItems`,()=>x.assign(a._`${O.evaluated}.items`,a._`undefined`))}function b(O,x){let H=typeof O=="object"&&O[x.schemaId];return H&&(x.code.source||x.code.process)?a._`/*# sourceURL=${H} */`:a.nil}function R(O,x){if(T(O)){if(A(O),w(O)){C(O,x);return}}(0,t.boolOrEmptySchema)(O,x)}function w({schema:O,self:x}){if(typeof O=="boolean")return!O;for(let H in O)if(x.RULES.all[H])return!0;return!1}function T(O){return typeof O.schema!="boolean"}function C(O,x){let{schema:H,gen:J,opts:Y}=O;if(Y.$comment&&H.$comment)B(O);F(O),G(O);let ee=J.const("_errs",c.default.errors);P(O,ee),J.var(x,a._`${ee} === ${c.default.errors}`)}function A(O){(0,f.checkUnknownRules)(O),D(O)}function P(O,x){if(O.opts.jtd)return se(O,[],!1,x);let H=(0,r.getSchemaTypes)(O.schema);se(O,H,!(0,r.coerceAndCheckDataType)(O,H),x)}function D(O){let{schema:x,errSchemaPath:H,opts:J,self:Y}=O;if(x.$ref&&J.ignoreKeywordsWithRef&&(0,f.schemaHasRulesButRef)(x,Y.RULES))Y.logger.warn(`$ref: keywords ignored in schema at path "${H}"`)}function N(O){let{schema:x,opts:H}=O;if(x.default!==void 0&&H.useDefaults&&H.strictSchema)(0,f.checkStrictMode)(O,"default is ignored in the schema root")}function F(O){let x=O.schema[O.opts.schemaId];if(x)O.baseId=(0,u.resolveUrl)(O.opts.uriResolver,O.baseId,x)}function G(O){if(O.schema.$async&&!O.schemaEnv.$async)throw Error("async schema in sync schema")}function B({gen:O,schemaEnv:x,schema:H,errSchemaPath:J,opts:Y}){let ee=H.$comment;if(Y.$comment===!0)O.code(a._`${c.default.self}.logger.log(${ee})`);else if(typeof Y.$comment=="function"){let Z=a.str`${J}/$comment`,te=O.scopeValue("root",{ref:x.root});O.code(a._`${c.default.self}.opts.$comment(${ee}, ${Z}, ${te}.schema)`)}}function Q(O){let{gen:x,schemaEnv:H,validateName:J,ValidationError:Y,opts:ee}=O;if(H.$async)x.if(a._`${c.default.errors} === 0`,()=>x.return(c.default.data),()=>x.throw(a._`new ${Y}(${c.default.vErrors})`));else{if(x.assign(a._`${J}.errors`,c.default.vErrors),ee.unevaluated)pe(O);x.return(a._`${c.default.errors} === 0`)}}function pe({gen:O,evaluated:x,props:H,items:J}){if(H instanceof a.Name)O.assign(a._`${x}.props`,H);if(J instanceof a.Name)O.assign(a._`${x}.items`,J)}function se(O,x,H,J){let{gen:Y,schema:ee,data:Z,allErrors:te,opts:oe,self:L}=O,{RULES:V}=L;if(ee.$ref&&(oe.ignoreKeywordsWithRef||!(0,f.schemaHasRulesButRef)(ee,V))){Y.block(()=>ze(O,"$ref",V.all.$ref.definition));return}if(!oe.jtd)me(O,x);Y.block(()=>{for(let ue of V.rules)ce(ue);ce(V.post)});function ce(ue){if(!(0,n.shouldUseGroup)(ee,ue))return;if(ue.type){if(Y.if((0,o.checkDataType)(ue.type,Z,oe.strictNumbers)),ve(O,ue),x.length===1&&x[0]===ue.type&&H)Y.else(),(0,o.reportTypeError)(O);Y.endIf()}else ve(O,ue);if(!te)Y.if(a._`${c.default.errors} === ${J||0}`)}}function ve(O,x){let{gen:H,schema:J,opts:{useDefaults:Y}}=O;if(Y)(0,i.assignDefaults)(O,x.type);H.block(()=>{for(let ee of x.rules)if((0,n.shouldUseRule)(J,ee))ze(O,ee.keyword,ee.definition,x.type)})}function me(O,x){if(O.schemaEnv.meta||!O.opts.strictTypes)return;if(j(O,x),!O.opts.allowUnionTypes)ne(O,x);he(O,O.dataTypes)}function j(O,x){if(!x.length)return;if(!O.dataTypes.length){O.dataTypes=x;return}x.forEach((H)=>{if(!K(O.dataTypes,H))be(O,`type "${H}" not allowed by context "${O.dataTypes.join(",")}"`)}),W(O,x)}function ne(O,x){if(x.length>1&&!(x.length===2&&x.includes("null")))be(O,"use allowUnionTypes to allow union type keyword")}function he(O,x){let H=O.self.RULES.all;for(let J in H){let Y=H[J];if(typeof Y=="object"&&(0,n.shouldUseRule)(O.schema,Y)){let{type:ee}=Y.definition;if(ee.length&&!ee.some((Z)=>q(x,Z)))be(O,`missing type "${ee.join(",")}" for keyword "${J}"`)}}}function q(O,x){return O.includes(x)||x==="number"&&O.includes("integer")}function K(O,x){return O.includes(x)||x==="integer"&&O.includes("number")}function W(O,x){let H=[];for(let J of O.dataTypes)if(K(x,J))H.push(J);else if(x.includes("integer")&&J==="number")H.push("integer");O.dataTypes=H}function be(O,x){let H=O.schemaEnv.baseId+O.errSchemaPath;x+=` at "${H}" (strictTypes)`,(0,f.checkStrictMode)(O,x,O.opts.strictTypes)}var Ce=class{constructor(O,x,H){if((0,s.validateKeywordUsage)(O,x,H),this.gen=O.gen,this.allErrors=O.allErrors,this.keyword=H,this.data=O.data,this.schema=O.schema[H],this.$data=x.$data&&O.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,f.schemaRefOrVal)(O,this.schema,H,this.$data),this.schemaType=x.schemaType,this.parentSchema=O.schema,this.params={},this.it=O,this.def=x,this.$data)this.schemaCode=O.gen.const("vSchema",U(this.$data,O));else if(this.schemaCode=this.schemaValue,!(0,s.validSchemaType)(this.schema,x.schemaType,x.allowUndefined))throw Error(`${H} value must be ${JSON.stringify(x.schemaType)}`);if("code"in x?x.trackErrors:x.errors!==!1)this.errsCount=O.gen.const("_errs",c.default.errors)}result(O,x,H){this.failResult((0,a.not)(O),x,H)}failResult(O,x,H){if(this.gen.if(O),H)H();else this.error();if(x){if(this.gen.else(),x(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(O,x){this.failResult((0,a.not)(O),void 0,x)}fail(O){if(O===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(O),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(O){if(!this.$data)return this.fail(O);let{schemaCode:x}=this;this.fail(a._`${x} !== undefined && (${(0,a.or)(this.invalid$data(),O)})`)}error(O,x,H){if(x){this.setParams(x),this._error(O,H),this.setParams({});return}this._error(O,H)}_error(O,x){(O?h.reportExtraError:h.reportError)(this,this.def.error,x)}$dataError(){(0,h.reportError)(this,this.def.$dataError||h.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,h.resetErrorsCount)(this.gen,this.errsCount)}ok(O){if(!this.allErrors)this.gen.if(O)}setParams(O,x){if(x)Object.assign(this.params,O);else this.params=O}block$data(O,x,H=a.nil){this.gen.block(()=>{this.check$data(O,H),x()})}check$data(O=a.nil,x=a.nil){if(!this.$data)return;let{gen:H,schemaCode:J,schemaType:Y,def:ee}=this;if(H.if((0,a.or)(a._`${J} === undefined`,x)),O!==a.nil)H.assign(O,!0);if(Y.length||ee.validateSchema){if(H.elseIf(this.invalid$data()),this.$dataError(),O!==a.nil)H.assign(O,!1)}H.else()}invalid$data(){let{gen:O,schemaCode:x,schemaType:H,def:J,it:Y}=this;return(0,a.or)(ee(),Z());function ee(){if(H.length){if(!(x instanceof a.Name))throw Error("ajv implementation error");let te=Array.isArray(H)?H:[H];return a._`${(0,o.checkDataTypes)(te,x,Y.opts.strictNumbers,o.DataType.Wrong)}`}return a.nil}function Z(){if(J.validateSchema){let te=O.scopeValue("validate$data",{ref:J.validateSchema});return a._`!${te}(${x})`}return a.nil}}subschema(O,x){let H=(0,l.getSubschema)(this.it,O);(0,l.extendSubschemaData)(H,this.it,O),(0,l.extendSubschemaMode)(H,O);let J={...this.it,...H,items:void 0,props:void 0};return R(J,x),J}mergeEvaluated(O,x){let{it:H,gen:J}=this;if(!H.opts.unevaluated)return;if(H.props!==!0&&O.props!==void 0)H.props=f.mergeEvaluated.props(J,O.props,H.props,x);if(H.items!==!0&&O.items!==void 0)H.items=f.mergeEvaluated.items(J,O.items,H.items,x)}mergeValidEvaluated(O,x){let{it:H,gen:J}=this;if(H.opts.unevaluated&&(H.props!==!0||H.items!==!0))return J.if(x,()=>this.mergeEvaluated(O,a.Name)),!0}};e.KeywordCxt=Ce;function ze(O,x,H,J){let Y=new Ce(O,H,x);if("code"in H)H.code(Y,J);else if(Y.$data&&H.validate)(0,s.funcKeywordCode)(Y,H);else if("macro"in H)(0,s.macroKeywordCode)(Y,H);else if(H.compile||H.validate)(0,s.funcKeywordCode)(Y,H)}let Ie=/^\/(?:[^~]|~0|~1)*$/,je=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function U(O,{dataLevel:x,dataNames:H,dataPathArr:J}){let Y,ee;if(O==="")return c.default.rootData;if(O[0]==="/"){if(!Ie.test(O))throw Error(`Invalid JSON-pointer: ${O}`);Y=O,ee=c.default.rootData}else{let L=je.exec(O);if(!L)throw Error(`Invalid JSON-pointer: ${O}`);let V=+L[1];if(Y=L[2],Y==="#"){if(V>=x)throw Error(oe("property/index",V));return J[x-V]}if(V>x)throw Error(oe("data",V));if(ee=H[x-V],!Y)return ee}let Z=ee,te=Y.split("/");for(let L of te)if(L)ee=a._`${ee}${(0,a.getProperty)((0,f.unescapeJsonPointer)(L))}`,Z=a._`${Z} && ${ee}`;return Z;function oe(L,V){return`Cannot access ${L} ${V} levels up, current level is ${x}`}}e.getData=U}),Zs=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});var t=class extends Error{constructor(r){super("validation failed");this.errors=r,this.ajv=this.validation=!0}};e.default=t}),Ki=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Kl();var r=class extends Error{constructor(n,o,i,s){super(s||`can't resolve reference ${i} from id ${o}`);this.missingRef=(0,t.resolveUrl)(n,o,i),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(n,this.missingRef))}};e.default=r}),Xl=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;let t=Xe(),r=Zs(),n=Jr(),o=Kl(),i=ut(),s=Ji();var l=class{constructor(S){var E;this.refs={},this.dynamicAnchors={};let b;if(typeof S.schema=="object")b=S.schema;this.schema=S.schema,this.schemaId=S.schemaId,this.root=S.root||this,this.baseId=(E=S.baseId)!==null&&E!==void 0?E:(0,o.normalizeId)(b===null||b===void 0?void 0:b[S.schemaId||"$id"]),this.schemaPath=S.schemaPath,this.localRefs=S.localRefs,this.meta=S.meta,this.$async=b===null||b===void 0?void 0:b.$async,this.refs={}}};e.SchemaEnv=l;function a(S){let E=f.call(this,S);if(E)return E;let b=(0,o.getFullPath)(this.opts.uriResolver,S.root.baseId),{es5:R,lines:w}=this.opts.code,{ownProperties:T}=this.opts,C=new t.CodeGen(this.scope,{es5:R,lines:w,ownProperties:T}),A;if(S.$async)A=C.scopeValue("Error",{ref:r.default,code:t._`require("ajv/dist/runtime/validation_error").default`});let P=C.scopeName("validate");S.validateName=P;let D={gen:C,allErrors:this.opts.allErrors,data:n.default.data,parentData:n.default.parentData,parentDataProperty:n.default.parentDataProperty,dataNames:[n.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:C.scopeValue("schema",this.opts.code.source===!0?{ref:S.schema,code:(0,t.stringify)(S.schema)}:{ref:S.schema}),validateName:P,ValidationError:A,schema:S.schema,schemaEnv:S,rootId:b,baseId:S.baseId||b,schemaPath:t.nil,errSchemaPath:S.schemaPath||(this.opts.jtd?"":"#"),errorPath:t._`""`,opts:this.opts,self:this},N;try{this._compilations.add(S),(0,s.validateFunctionCode)(D),C.optimize(this.opts.code.optimize);let F=C.toString();if(N=`${C.scopeRefs(n.default.scope)}return ${F}`,this.opts.code.process)N=this.opts.code.process(N,S);let G=Function(`${n.default.self}`,`${n.default.scope}`,N)(this,this.scope.get());if(this.scope.value(P,{ref:G}),G.errors=null,G.schema=S.schema,G.schemaEnv=S,S.$async)G.$async=!0;if(this.opts.code.source===!0)G.source={validateName:P,validateCode:F,scopeValues:C._values};if(this.opts.unevaluated){let{props:B,items:Q}=D;if(G.evaluated={props:B instanceof t.Name?void 0:B,items:Q instanceof t.Name?void 0:Q,dynamicProps:B instanceof t.Name,dynamicItems:Q instanceof t.Name},G.source)G.source.evaluated=(0,t.stringify)(G.evaluated)}return S.validate=G,S}catch(F){if(delete S.validate,delete S.validateName,N)this.logger.error("Error compiling schema, function code:",N);throw F}finally{this._compilations.delete(S)}}e.compileSchema=a;function c(S,E,b){var R;b=(0,o.resolveUrl)(this.opts.uriResolver,E,b);let w=S.refs[b];if(w)return w;let T=g.call(this,S,b);if(T===void 0){let C=(R=S.localRefs)===null||R===void 0?void 0:R[b],{schemaId:A}=this.opts;if(C)T=new l({schema:C,schemaId:A,root:S,baseId:E})}if(T===void 0)return;return S.refs[b]=u.call(this,T)}e.resolveRef=c;function u(S){if((0,o.inlineRef)(S.schema,this.opts.inlineRefs))return S.schema;return S.validate?S:a.call(this,S)}function f(S){for(let E of this._compilations)if(h(E,S))return E}e.getCompilingSchema=f;function h(S,E){return S.schema===E.schema&&S.root===E.root&&S.baseId===E.baseId}function g(S,E){let b;while(typeof(b=this.refs[E])=="string")E=b;return b||this.schemas[E]||p.call(this,S,E)}function p(S,E){let b=this.opts.uriResolver.parse(E),R=(0,o._getFullPath)(this.opts.uriResolver,b),w=(0,o.getFullPath)(this.opts.uriResolver,S.baseId,void 0);if(Object.keys(S.schema).length>0&&R===w)return y.call(this,b,S);let T=(0,o.normalizeId)(R),C=this.refs[T]||this.schemas[T];if(typeof C=="string"){let A=p.call(this,S,C);if(typeof(A===null||A===void 0?void 0:A.schema)!=="object")return;return y.call(this,b,A)}if(typeof(C===null||C===void 0?void 0:C.schema)!=="object")return;if(!C.validate)a.call(this,C);if(T===(0,o.normalizeId)(E)){let{schema:A}=C,{schemaId:P}=this.opts,D=A[P];if(D)w=(0,o.resolveUrl)(this.opts.uriResolver,w,D);return new l({schema:A,schemaId:P,root:S,baseId:w})}return y.call(this,b,C)}e.resolveSchema=p;let _=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function y(S,{baseId:E,schema:b,root:R}){var w;if(((w=S.fragment)===null||w===void 0?void 0:w[0])!=="/")return;for(let A of S.fragment.slice(1).split("/")){if(typeof b==="boolean")return;let P=b[(0,i.unescapeFragment)(A)];if(P===void 0)return;b=P;let D=typeof b==="object"&&b[this.opts.schemaId];if(!_.has(A)&&D)E=(0,o.resolveUrl)(this.opts.uriResolver,E,D)}let T;if(typeof b!="boolean"&&b.$ref&&!(0,i.schemaHasRulesButRef)(b,this.RULES)){let A=(0,o.resolveUrl)(this.opts.uriResolver,E,b.$ref);T=p.call(this,R,A)}let{schemaId:C}=this.opts;if(T=T||new l({schema:b,schemaId:C,root:R,baseId:E}),T.schema!==T.root.schema)return T}}),oD=Se((e,t)=>{t.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}}),cE=Se((e,t)=>{let r=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),n=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function o(p){let _="",y=0,S=0;for(S=0;S<p.length;S++){if(y=p[S].charCodeAt(0),y===48)continue;if(!(y>=48&&y<=57||y>=65&&y<=70||y>=97&&y<=102))return"";_+=p[S];break}for(S+=1;S<p.length;S++){if(y=p[S].charCodeAt(0),!(y>=48&&y<=57||y>=65&&y<=70||y>=97&&y<=102))return"";_+=p[S]}return _}let i=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function s(p){return p.length=0,!0}function l(p,_,y){if(p.length){let S=o(p);if(S!=="")_.push(S);else return y.error=!0,!1;p.length=0}return!0}function a(p){let _=0,y={error:!1,address:"",zone:""},S=[],E=[],b=!1,R=!1,w=l;for(let T=0;T<p.length;T++){let C=p[T];if(C==="["||C==="]")continue;if(C===":"){if(b===!0)R=!0;if(!w(E,S,y))break;if(++_>7){y.error=!0;break}if(T>0&&p[T-1]===":")b=!0;S.push(":");continue}else if(C==="%"){if(!w(E,S,y))break;w=s}else{E.push(C);continue}}if(E.length)if(w===s)y.zone=E.join("");else if(R)S.push(E.join(""));else S.push(o(E));return y.address=S.join(""),y}function c(p){if(u(p,":")<2)return{host:p,isIPV6:!1};let _=a(p);if(!_.error){let{address:y,address:S}=_;if(_.zone)y+="%"+_.zone,S+="%25"+_.zone;return{host:y,isIPV6:!0,escapedHost:S}}else return{host:p,isIPV6:!1}}function u(p,_){let y=0;for(let S=0;S<p.length;S++)if(p[S]===_)y++;return y}function f(p){let _=p,y=[],S=-1,E=0;while(E=_.length){if(E===1)if(_===".")break;else if(_==="/"){y.push("/");break}else{y.push(_);break}else if(E===2){if(_[0]==="."){if(_[1]===".")break;else if(_[1]==="/"){_=_.slice(2);continue}}else if(_[0]==="/"){if(_[1]==="."||_[1]==="/"){y.push("/");break}}}else if(E===3){if(_==="/.."){if(y.length!==0)y.pop();y.push("/");break}}if(_[0]==="."){if(_[1]==="."){if(_[2]==="/"){_=_.slice(3);continue}}else if(_[1]==="/"){_=_.slice(2);continue}}else if(_[0]==="/"){if(_[1]==="."){if(_[2]==="/"){_=_.slice(2);continue}else if(_[2]==="."){if(_[3]==="/"){if(_=_.slice(3),y.length!==0)y.pop();continue}}}}if((S=_.indexOf("/",1))===-1){y.push(_);break}else y.push(_.slice(0,S)),_=_.slice(S)}return y.join("")}function h(p,_){let y=_!==!0?escape:unescape;if(p.scheme!==void 0)p.scheme=y(p.scheme);if(p.userinfo!==void 0)p.userinfo=y(p.userinfo);if(p.host!==void 0)p.host=y(p.host);if(p.path!==void 0)p.path=y(p.path);if(p.query!==void 0)p.query=y(p.query);if(p.fragment!==void 0)p.fragment=y(p.fragment);return p}function g(p){let _=[];if(p.userinfo!==void 0)_.push(p.userinfo),_.push("@");if(p.host!==void 0){let y=unescape(p.host);if(!n(y)){let S=c(y);if(S.isIPV6===!0)y=`[${S.escapedHost}]`;else y=p.host}_.push(y)}if(typeof p.port==="number"||typeof p.port==="string")_.push(":"),_.push(String(p.port));return _.length?_.join(""):void 0}t.exports={nonSimpleDomain:i,recomposeAuthority:g,normalizeComponentEncoding:h,removeDotSegments:f,isIPv4:n,isUUID:r,normalizeIPv6:c,stringArrayToHexStripped:o}}),iD=Se((e,t)=>{let{isUUID:r}=cE(),n=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,o=["http","https","ws","wss","urn","urn:uuid"];function i(C){return o.indexOf(C)!==-1}function s(C){if(C.secure===!0)return!0;else if(C.secure===!1)return!1;else if(C.scheme)return C.scheme.length===3&&(C.scheme[0]==="w"||C.scheme[0]==="W")&&(C.scheme[1]==="s"||C.scheme[1]==="S")&&(C.scheme[2]==="s"||C.scheme[2]==="S");else return!1}function l(C){if(!C.host)C.error=C.error||"HTTP URIs must have a host.";return C}function a(C){let A=String(C.scheme).toLowerCase()==="https";if(C.port===(A?443:80)||C.port==="")C.port=void 0;if(!C.path)C.path="/";return C}function c(C){return C.secure=s(C),C.resourceName=(C.path||"/")+(C.query?"?"+C.query:""),C.path=void 0,C.query=void 0,C}function u(C){if(C.port===(s(C)?443:80)||C.port==="")C.port=void 0;if(typeof C.secure==="boolean")C.scheme=C.secure?"wss":"ws",C.secure=void 0;if(C.resourceName){let[A,P]=C.resourceName.split("?");C.path=A&&A!=="/"?A:void 0,C.query=P,C.resourceName=void 0}return C.fragment=void 0,C}function f(C,A){if(!C.path)return C.error="URN can not be parsed",C;let P=C.path.match(n);if(P){let D=A.scheme||C.scheme||"urn";C.nid=P[1].toLowerCase(),C.nss=P[2];let N=T(`${D}:${A.nid||C.nid}`);if(C.path=void 0,N)C=N.parse(C,A)}else C.error=C.error||"URN can not be parsed.";return C}function h(C,A){if(C.nid===void 0)throw Error("URN without nid cannot be serialized");let P=A.scheme||C.scheme||"urn",D=C.nid.toLowerCase(),N=T(`${P}:${A.nid||D}`);if(N)C=N.serialize(C,A);let F=C,G=C.nss;return F.path=`${D||A.nid}:${G}`,A.skipEscape=!0,F}function g(C,A){let P=C;if(P.uuid=P.nss,P.nss=void 0,!A.tolerant&&(!P.uuid||!r(P.uuid)))P.error=P.error||"UUID is not valid.";return P}function p(C){let A=C;return A.nss=(C.uuid||"").toLowerCase(),A}let _={scheme:"http",domainHost:!0,parse:l,serialize:a},y={scheme:"https",domainHost:_.domainHost,parse:l,serialize:a},S={scheme:"ws",domainHost:!0,parse:c,serialize:u},E={scheme:"wss",domainHost:S.domainHost,parse:S.parse,serialize:S.serialize},w={http:_,https:y,ws:S,wss:E,urn:{scheme:"urn",parse:f,serialize:h,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:g,serialize:p,skipNormalize:!0}};Object.setPrototypeOf(w,null);function T(C){return C&&(w[C]||w[C.toLowerCase()])||void 0}t.exports={wsIsSecure:s,SCHEMES:w,isValidSchemeName:i,getSchemeHandler:T}}),sD=Se((e,t)=>{let{normalizeIPv6:r,removeDotSegments:n,recomposeAuthority:o,normalizeComponentEncoding:i,isIPv4:s,nonSimpleDomain:l}=cE(),{SCHEMES:a,getSchemeHandler:c}=iD();function u(E,b){if(typeof E==="string")E=p(y(E,b),b);else if(typeof E==="object")E=y(p(E,b),b);return E}function f(E,b,R){let w=R?Object.assign({scheme:"null"},R):{scheme:"null"},T=h(y(E,w),y(b,w),w,!0);return w.skipEscape=!0,p(T,w)}function h(E,b,R,w){let T={};if(!w)E=y(p(E,R),R),b=y(p(b,R),R);if(R=R||{},!R.tolerant&&b.scheme)T.scheme=b.scheme,T.userinfo=b.userinfo,T.host=b.host,T.port=b.port,T.path=n(b.path||""),T.query=b.query;else{if(b.userinfo!==void 0||b.host!==void 0||b.port!==void 0)T.userinfo=b.userinfo,T.host=b.host,T.port=b.port,T.path=n(b.path||""),T.query=b.query;else{if(!b.path)if(T.path=E.path,b.query!==void 0)T.query=b.query;else T.query=E.query;else{if(b.path[0]==="/")T.path=n(b.path);else{if((E.userinfo!==void 0||E.host!==void 0||E.port!==void 0)&&!E.path)T.path="/"+b.path;else if(!E.path)T.path=b.path;else T.path=E.path.slice(0,E.path.lastIndexOf("/")+1)+b.path;T.path=n(T.path)}T.query=b.query}T.userinfo=E.userinfo,T.host=E.host,T.port=E.port}T.scheme=E.scheme}return T.fragment=b.fragment,T}function g(E,b,R){if(typeof E==="string")E=unescape(E),E=p(i(y(E,R),!0),{...R,skipEscape:!0});else if(typeof E==="object")E=p(i(E,!0),{...R,skipEscape:!0});if(typeof b==="string")b=unescape(b),b=p(i(y(b,R),!0),{...R,skipEscape:!0});else if(typeof b==="object")b=p(i(b,!0),{...R,skipEscape:!0});return E.toLowerCase()===b.toLowerCase()}function p(E,b){let R={host:E.host,scheme:E.scheme,userinfo:E.userinfo,port:E.port,path:E.path,query:E.query,nid:E.nid,nss:E.nss,uuid:E.uuid,fragment:E.fragment,reference:E.reference,resourceName:E.resourceName,secure:E.secure,error:""},w=Object.assign({},b),T=[],C=c(w.scheme||R.scheme);if(C&&C.serialize)C.serialize(R,w);if(R.path!==void 0)if(!w.skipEscape){if(R.path=escape(R.path),R.scheme!==void 0)R.path=R.path.split("%3A").join(":")}else R.path=unescape(R.path);if(w.reference!=="suffix"&&R.scheme)T.push(R.scheme,":");let A=o(R);if(A!==void 0){if(w.reference!=="suffix")T.push("//");if(T.push(A),R.path&&R.path[0]!=="/")T.push("/")}if(R.path!==void 0){let P=R.path;if(!w.absolutePath&&(!C||!C.absolutePath))P=n(P);if(A===void 0&&P[0]==="/"&&P[1]==="/")P="/%2F"+P.slice(2);T.push(P)}if(R.query!==void 0)T.push("?",R.query);if(R.fragment!==void 0)T.push("#",R.fragment);return T.join("")}let _=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function y(E,b){let R=Object.assign({},b),w={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},T=!1;if(R.reference==="suffix")if(R.scheme)E=R.scheme+":"+E;else E="//"+E;let C=E.match(_);if(C){if(w.scheme=C[1],w.userinfo=C[3],w.host=C[4],w.port=parseInt(C[5],10),w.path=C[6]||"",w.query=C[7],w.fragment=C[8],isNaN(w.port))w.port=C[5];if(w.host)if(s(w.host)===!1){let P=r(w.host);w.host=P.host.toLowerCase(),T=P.isIPV6}else T=!0;if(w.scheme===void 0&&w.userinfo===void 0&&w.host===void 0&&w.port===void 0&&w.query===void 0&&!w.path)w.reference="same-document";else if(w.scheme===void 0)w.reference="relative";else if(w.fragment===void 0)w.reference="absolute";else w.reference="uri";if(R.reference&&R.reference!=="suffix"&&R.reference!==w.reference)w.error=w.error||"URI is not a "+R.reference+" reference.";let A=c(R.scheme||w.scheme);if(!R.unicodeSupport&&(!A||!A.unicodeSupport)){if(w.host&&(R.domainHost||A&&A.domainHost)&&T===!1&&l(w.host))try{w.host=URL.domainToASCII(w.host.toLowerCase())}catch(P){w.error=w.error||"Host's domain name can not be converted to ASCII: "+P}}if(!A||A&&!A.skipNormalize){if(E.indexOf("%")!==-1){if(w.scheme!==void 0)w.scheme=unescape(w.scheme);if(w.host!==void 0)w.host=unescape(w.host)}if(w.path)w.path=escape(unescape(w.path));if(w.fragment)w.fragment=encodeURI(decodeURIComponent(w.fragment))}if(A&&A.parse)A.parse(w,R)}else w.error=w.error||"URI can not be parsed.";return w}let S={SCHEMES:a,normalize:u,resolve:f,resolveComponent:h,equal:g,serialize:p,parse:y};t.exports=S,t.exports.default=S,t.exports.fastUri=S}),aD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=sD();t.code='require("ajv/dist/runtime/uri").default',e.default=t}),Hd=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=Ji();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=Xe();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});let n=Zs(),o=Ki(),i=sE(),s=Xl(),l=Xe(),a=Kl(),c=fl(),u=ut(),f=oD(),h=aD(),g=(j,ne)=>new RegExp(j,ne);g.code="new RegExp";let p=["removeAdditional","useDefaults","coerceTypes"],_=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),y={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},S={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},E=200;function b(j){var ne,he,q,K,W,be,Ce,ze,Ie,je,U,O,x,H,J,Y,ee,Z,te,oe,L,V,ce,ue,ge;let Ne=j.strict,et=(ne=j.code)===null||ne===void 0?void 0:ne.optimize,He=et===!0||et===void 0?1:et||0,We=(q=(he=j.code)===null||he===void 0?void 0:he.regExp)!==null&&q!==void 0?q:g,St=(K=j.uriResolver)!==null&&K!==void 0?K:h.default;return{strictSchema:(be=(W=j.strictSchema)!==null&&W!==void 0?W:Ne)!==null&&be!==void 0?be:!0,strictNumbers:(ze=(Ce=j.strictNumbers)!==null&&Ce!==void 0?Ce:Ne)!==null&&ze!==void 0?ze:!0,strictTypes:(je=(Ie=j.strictTypes)!==null&&Ie!==void 0?Ie:Ne)!==null&&je!==void 0?je:"log",strictTuples:(O=(U=j.strictTuples)!==null&&U!==void 0?U:Ne)!==null&&O!==void 0?O:"log",strictRequired:(H=(x=j.strictRequired)!==null&&x!==void 0?x:Ne)!==null&&H!==void 0?H:!1,code:j.code?{...j.code,optimize:He,regExp:We}:{optimize:He,regExp:We},loopRequired:(J=j.loopRequired)!==null&&J!==void 0?J:E,loopEnum:(Y=j.loopEnum)!==null&&Y!==void 0?Y:E,meta:(ee=j.meta)!==null&&ee!==void 0?ee:!0,messages:(Z=j.messages)!==null&&Z!==void 0?Z:!0,inlineRefs:(te=j.inlineRefs)!==null&&te!==void 0?te:!0,schemaId:(oe=j.schemaId)!==null&&oe!==void 0?oe:"$id",addUsedSchema:(L=j.addUsedSchema)!==null&&L!==void 0?L:!0,validateSchema:(V=j.validateSchema)!==null&&V!==void 0?V:!0,validateFormats:(ce=j.validateFormats)!==null&&ce!==void 0?ce:!0,unicodeRegExp:(ue=j.unicodeRegExp)!==null&&ue!==void 0?ue:!0,int32range:(ge=j.int32range)!==null&&ge!==void 0?ge:!0,uriResolver:St}}var R=class{constructor(j={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,j=this.opts={...j,...b(j)};let{es5:ne,lines:he}=this.opts.code;this.scope=new l.ValueScope({scope:{},prefixes:_,es5:ne,lines:he}),this.logger=F(j.logger);let q=j.validateFormats;if(j.validateFormats=!1,this.RULES=(0,i.getRules)(),w.call(this,y,j,"NOT SUPPORTED"),w.call(this,S,j,"DEPRECATED","warn"),this._metaOpts=D.call(this),j.formats)A.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),j.keywords)P.call(this,j.keywords);if(typeof j.meta=="object")this.addMetaSchema(j.meta);C.call(this),j.validateFormats=q}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:j,meta:ne,schemaId:he}=this.opts,q=f;if(he==="id")q={...f},q.id=q.$id,delete q.$id;if(ne&&j)this.addMetaSchema(q,q[he],!1)}defaultMeta(){let{meta:j,schemaId:ne}=this.opts;return this.opts.defaultMeta=typeof j=="object"?j[ne]||j:void 0}validate(j,ne){let he;if(typeof j=="string"){if(he=this.getSchema(j),!he)throw Error(`no schema with key or ref "${j}"`)}else he=this.compile(j);let q=he(ne);if(!("$async"in he))this.errors=he.errors;return q}compile(j,ne){let he=this._addSchema(j,ne);return he.validate||this._compileSchemaEnv(he)}compileAsync(j,ne){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:he}=this.opts;return q.call(this,j,ne);async function q(Ie,je){await K.call(this,Ie.$schema);let U=this._addSchema(Ie,je);return U.validate||W.call(this,U)}async function K(Ie){if(Ie&&!this.getSchema(Ie))await q.call(this,{$ref:Ie},!0)}async function W(Ie){try{return this._compileSchemaEnv(Ie)}catch(je){if(!(je instanceof o.default))throw je;return be.call(this,je),await Ce.call(this,je.missingSchema),W.call(this,Ie)}}function be({missingSchema:Ie,missingRef:je}){if(this.refs[Ie])throw Error(`AnySchema ${Ie} is loaded but ${je} cannot be resolved`)}async function Ce(Ie){let je=await ze.call(this,Ie);if(!this.refs[Ie])await K.call(this,je.$schema);if(!this.refs[Ie])this.addSchema(je,Ie,ne)}async function ze(Ie){let je=this._loading[Ie];if(je)return je;try{return await(this._loading[Ie]=he(Ie))}finally{delete this._loading[Ie]}}}addSchema(j,ne,he,q=this.opts.validateSchema){if(Array.isArray(j)){for(let W of j)this.addSchema(W,void 0,he,q);return this}let K;if(typeof j==="object"){let{schemaId:W}=this.opts;if(K=j[W],K!==void 0&&typeof K!="string")throw Error(`schema ${W} must be string`)}return ne=(0,a.normalizeId)(ne||K),this._checkUnique(ne),this.schemas[ne]=this._addSchema(j,he,ne,q,!0),this}addMetaSchema(j,ne,he=this.opts.validateSchema){return this.addSchema(j,ne,!0,he),this}validateSchema(j,ne){if(typeof j=="boolean")return!0;let he;if(he=j.$schema,he!==void 0&&typeof he!="string")throw Error("$schema must be a string");if(he=he||this.opts.defaultMeta||this.defaultMeta(),!he)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let q=this.validate(he,j);if(!q&&ne){let K="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(K);else throw Error(K)}return q}getSchema(j){let ne;while(typeof(ne=T.call(this,j))=="string")j=ne;if(ne===void 0){let{schemaId:he}=this.opts,q=new s.SchemaEnv({schema:{},schemaId:he});if(ne=s.resolveSchema.call(this,q,j),!ne)return;this.refs[j]=ne}return ne.validate||this._compileSchemaEnv(ne)}removeSchema(j){if(j instanceof RegExp)return this._removeAllSchemas(this.schemas,j),this._removeAllSchemas(this.refs,j),this;switch(typeof j){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let ne=T.call(this,j);if(typeof ne=="object")this._cache.delete(ne.schema);return delete this.schemas[j],delete this.refs[j],this}case"object":{let ne=j;this._cache.delete(ne);let he=j[this.opts.schemaId];if(he)he=(0,a.normalizeId)(he),delete this.schemas[he],delete this.refs[he];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(j){for(let ne of j)this.addKeyword(ne);return this}addKeyword(j,ne){let he;if(typeof j=="string"){if(he=j,typeof ne=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),ne.keyword=he}else if(typeof j=="object"&&ne===void 0){if(ne=j,he=ne.keyword,Array.isArray(he)&&!he.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(B.call(this,he,ne),!ne)return(0,u.eachItem)(he,(K)=>Q.call(this,K)),this;se.call(this,ne);let q={...ne,type:(0,c.getJSONTypes)(ne.type),schemaType:(0,c.getJSONTypes)(ne.schemaType)};return(0,u.eachItem)(he,q.type.length===0?(K)=>Q.call(this,K,q):(K)=>q.type.forEach((W)=>Q.call(this,K,q,W))),this}getKeyword(j){let ne=this.RULES.all[j];return typeof ne=="object"?ne.definition:!!ne}removeKeyword(j){let{RULES:ne}=this;delete ne.keywords[j],delete ne.all[j];for(let he of ne.rules){let q=he.rules.findIndex((K)=>K.keyword===j);if(q>=0)he.rules.splice(q,1)}return this}addFormat(j,ne){if(typeof ne=="string")ne=new RegExp(ne);return this.formats[j]=ne,this}errorsText(j=this.errors,{separator:ne=", ",dataVar:he="data"}={}){if(!j||j.length===0)return"No errors";return j.map((q)=>`${he}${q.instancePath} ${q.message}`).reduce((q,K)=>q+ne+K)}$dataMetaSchema(j,ne){let he=this.RULES.all;j=JSON.parse(JSON.stringify(j));for(let q of ne){let K=q.split("/").slice(1),W=j;for(let be of K)W=W[be];for(let be in he){let Ce=he[be];if(typeof Ce!="object")continue;let{$data:ze}=Ce.definition,Ie=W[be];if(ze&&Ie)W[be]=me(Ie)}}return j}_removeAllSchemas(j,ne){for(let he in j){let q=j[he];if(!ne||ne.test(he)){if(typeof q=="string")delete j[he];else if(q&&!q.meta)this._cache.delete(q.schema),delete j[he]}}}_addSchema(j,ne,he,q=this.opts.validateSchema,K=this.opts.addUsedSchema){let W,{schemaId:be}=this.opts;if(typeof j=="object")W=j[be];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof j!="boolean")throw Error("schema must be object or boolean");let Ce=this._cache.get(j);if(Ce!==void 0)return Ce;he=(0,a.normalizeId)(W||he);let ze=a.getSchemaRefs.call(this,j,he);if(Ce=new s.SchemaEnv({schema:j,schemaId:be,meta:ne,baseId:he,localRefs:ze}),this._cache.set(Ce.schema,Ce),K&&!he.startsWith("#")){if(he)this._checkUnique(he);this.refs[he]=Ce}if(q)this.validateSchema(j,!0);return Ce}_checkUnique(j){if(this.schemas[j]||this.refs[j])throw Error(`schema with key or id "${j}" already exists`)}_compileSchemaEnv(j){if(j.meta)this._compileMetaSchema(j);else s.compileSchema.call(this,j);if(!j.validate)throw Error("ajv implementation error");return j.validate}_compileMetaSchema(j){let ne=this.opts;this.opts=this._metaOpts;try{s.compileSchema.call(this,j)}finally{this.opts=ne}}};R.ValidationError=n.default,R.MissingRefError=o.default,e.default=R;function w(j,ne,he,q="error"){for(let K in j){let W=K;if(W in ne)this.logger[q](`${he}: option ${K}. ${j[W]}`)}}function T(j){return j=(0,a.normalizeId)(j),this.schemas[j]||this.refs[j]}function C(){let j=this.opts.schemas;if(!j)return;if(Array.isArray(j))this.addSchema(j);else for(let ne in j)this.addSchema(j[ne],ne)}function A(){for(let j in this.opts.formats){let ne=this.opts.formats[j];if(ne)this.addFormat(j,ne)}}function P(j){if(Array.isArray(j)){this.addVocabulary(j);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let ne in j){let he=j[ne];if(!he.keyword)he.keyword=ne;this.addKeyword(he)}}function D(){let j={...this.opts};for(let ne of p)delete j[ne];return j}let N={log(){},warn(){},error(){}};function F(j){if(j===!1)return N;if(j===void 0)return console;if(j.log&&j.warn&&j.error)return j;throw Error("logger must implement log, warn and error methods")}let G=/^[a-z_$][a-z0-9_$:-]*$/i;function B(j,ne){let{RULES:he}=this;if((0,u.eachItem)(j,(q)=>{if(he.keywords[q])throw Error(`Keyword ${q} is already defined`);if(!G.test(q))throw Error(`Keyword ${q} has invalid name`)}),!ne)return;if(ne.$data&&!(("code"in ne)||("validate"in ne)))throw Error('$data keyword must have "code" or "validate" function')}function Q(j,ne,he){var q;let K=ne===null||ne===void 0?void 0:ne.post;if(he&&K)throw Error('keyword with "post" flag cannot have "type"');let{RULES:W}=this,be=K?W.post:W.rules.find(({type:ze})=>ze===he);if(!be)be={type:he,rules:[]},W.rules.push(be);if(W.keywords[j]=!0,!ne)return;let Ce={keyword:j,definition:{...ne,type:(0,c.getJSONTypes)(ne.type),schemaType:(0,c.getJSONTypes)(ne.schemaType)}};if(ne.before)pe.call(this,be,Ce,ne.before);else be.rules.push(Ce);W.all[j]=Ce,(q=ne.implements)===null||q===void 0||q.forEach((ze)=>this.addKeyword(ze))}function pe(j,ne,he){let q=j.rules.findIndex((K)=>K.keyword===he);if(q>=0)j.rules.splice(q,0,ne);else j.rules.push(ne),this.logger.warn(`rule ${he} is not defined`)}function se(j){let{metaSchema:ne}=j;if(ne===void 0)return;if(j.$data&&this.opts.$data)ne=me(ne);j.validateSchema=this.compile(ne,!0)}let ve={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function me(j){return{anyOf:[j,ve]}}}),lD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};e.default=t}),zd=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;let t=Ki(),r=Kr(),n=Xe(),o=Jr(),i=Xl(),s=ut(),l={keyword:"$ref",schemaType:"string",code(u){let{gen:f,schema:h,it:g}=u,{baseId:p,schemaEnv:_,validateName:y,opts:S,self:E}=g,{root:b}=_;if((h==="#"||h==="#/")&&p===b.baseId)return w();let R=i.resolveRef.call(E,b,p,h);if(R===void 0)throw new t.default(g.opts.uriResolver,p,h);if(R instanceof i.SchemaEnv)return T(R);return C(R);function w(){if(_===b)return c(u,y,_,_.$async);let A=f.scopeValue("root",{ref:b});return c(u,n._`${A}.validate`,b,b.$async)}function T(A){c(u,a(u,A),A,A.$async)}function C(A){let P=f.scopeValue("schema",S.code.source===!0?{ref:A,code:(0,n.stringify)(A)}:{ref:A}),D=f.name("valid"),N=u.subschema({schema:A,dataTypes:[],schemaPath:n.nil,topSchemaRef:P,errSchemaPath:h},D);u.mergeEvaluated(N),u.ok(D)}}};function a(u,f){let{gen:h}=u;return f.validate?h.scopeValue("validate",{ref:f.validate}):n._`${h.scopeValue("wrapper",{ref:f})}.validate`}e.getValidate=a;function c(u,f,h,g){let{gen:p,it:_}=u,{allErrors:y,schemaEnv:S,opts:E}=_,b=E.passContext?o.default.this:n.nil;if(g)R();else w();function R(){if(!S.$async)throw Error("async schema referenced by sync schema");let A=p.let("valid");p.try(()=>{if(p.code(n._`await ${(0,r.callValidateCode)(u,f,b)}`),C(f),!y)p.assign(A,!0)},(P)=>{if(p.if(n._`!(${P} instanceof ${_.ValidationError})`,()=>p.throw(P)),T(P),!y)p.assign(A,!1)}),u.ok(A)}function w(){u.result((0,r.callValidateCode)(u,f,b),()=>C(f),()=>T(f))}function T(A){let P=n._`${A}.errors`;p.assign(o.default.vErrors,n._`${o.default.vErrors} === null ? ${P} : ${o.default.vErrors}.concat(${P})`),p.assign(o.default.errors,n._`${o.default.vErrors}.length`)}function C(A){var P;if(!_.opts.unevaluated)return;let D=(P=h===null||h===void 0?void 0:h.validate)===null||P===void 0?void 0:P.evaluated;if(_.props!==!0)if(D&&!D.dynamicProps){if(D.props!==void 0)_.props=s.mergeEvaluated.props(p,D.props,_.props)}else{let N=p.var("props",n._`${A}.evaluated.props`);_.props=s.mergeEvaluated.props(p,N,_.props,n.Name)}if(_.items!==!0)if(D&&!D.dynamicItems){if(D.items!==void 0)_.items=s.mergeEvaluated.items(p,D.items,_.items)}else{let N=p.var("items",n._`${A}.evaluated.items`);_.items=s.mergeEvaluated.items(p,N,_.items,n.Name)}}}e.callRef=c,e.default=l}),uE=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=lD(),r=zd(),n=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,r.default];e.default=n}),cD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r=t.operators,n={maximum:{okStr:"<=",ok:r.LTE,fail:r.GT},minimum:{okStr:">=",ok:r.GTE,fail:r.LT},exclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},exclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}},o={keyword:Object.keys(n),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:i,schemaCode:s})=>t.str`must be ${n[i].okStr} ${s}`,params:({keyword:i,schemaCode:s})=>t._`{comparison: ${n[i].okStr}, limit: ${s}}`},code(i){let{keyword:s,data:l,schemaCode:a}=i;i.fail$data(t._`${l} ${n[s].fail} ${a} || isNaN(${l})`)}};e.default=o}),uD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:n})=>t.str`must be multiple of ${n}`,params:({schemaCode:n})=>t._`{multipleOf: ${n}}`},code(n){let{gen:o,data:i,schemaCode:s,it:l}=n,a=l.opts.multipleOfPrecision,c=o.let("res"),u=a?t._`Math.abs(Math.round(${c}) - ${c}) > 1e-${a}`:t._`${c} !== parseInt(${c})`;n.fail$data(t._`(${s} === 0 || (${c} = ${i}/${s}, ${u}))`)}};e.default=r}),dD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});function t(r){let n=r.length,o=0,i=0,s;while(i<n)if(o++,s=r.charCodeAt(i++),s>=55296&&s<=56319&&i<n){if(s=r.charCodeAt(i),(s&64512)===56320)i++}return o}e.default=t,t.code='require("ajv/dist/runtime/ucs2length").default'}),fD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r=ut(),n=dD(),o={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:i,schemaCode:s}){let l=i==="maxLength"?"more":"fewer";return t.str`must NOT have ${l} than ${s} characters`},params:({schemaCode:i})=>t._`{limit: ${i}}`},code(i){let{keyword:s,data:l,schemaCode:a,it:c}=i,u=s==="maxLength"?t.operators.GT:t.operators.LT,f=c.opts.unicode===!1?t._`${l}.length`:t._`${(0,r.useFunc)(i.gen,n.default)}(${l})`;i.fail$data(t._`${f} ${u} ${a}`)}};e.default=o}),pD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Kr(),r=ut(),n=Xe(),o={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:i})=>n.str`must match pattern "${i}"`,params:({schemaCode:i})=>n._`{pattern: ${i}}`},code(i){let{gen:s,data:l,$data:a,schema:c,schemaCode:u,it:f}=i,h=f.opts.unicodeRegExp?"u":"";if(a){let{regExp:g}=f.opts.code,p=g.code==="new RegExp"?n._`new RegExp`:(0,r.useFunc)(s,g),_=s.let("valid");s.try(()=>s.assign(_,n._`${p}(${u}, ${h}).test(${l})`),()=>s.assign(_,!1)),i.fail$data(n._`!${_}`)}else{let g=(0,t.usePattern)(i,c);i.fail$data(n._`!${g}.test(${l})`)}}};e.default=o}),hD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:n,schemaCode:o}){let i=n==="maxProperties"?"more":"fewer";return t.str`must NOT have ${i} than ${o} properties`},params:({schemaCode:n})=>t._`{limit: ${n}}`},code(n){let{keyword:o,data:i,schemaCode:s}=n,l=o==="maxProperties"?t.operators.GT:t.operators.LT;n.fail$data(t._`Object.keys(${i}).length ${l} ${s}`)}};e.default=r}),mD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Kr(),r=Xe(),n=ut(),o={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:i}})=>r.str`must have required property '${i}'`,params:({params:{missingProperty:i}})=>r._`{missingProperty: ${i}}`},code(i){let{gen:s,schema:l,schemaCode:a,data:c,$data:u,it:f}=i,{opts:h}=f;if(!u&&l.length===0)return;let g=l.length>=h.loopRequired;if(f.allErrors)p();else _();if(h.strictRequired){let E=i.parentSchema.properties,{definedProperties:b}=i.it;for(let R of l)if((E===null||E===void 0?void 0:E[R])===void 0&&!b.has(R)){let w=`required property "${R}" is not defined at "${f.schemaEnv.baseId+f.errSchemaPath}" (strictRequired)`;(0,n.checkStrictMode)(f,w,f.opts.strictRequired)}}function p(){if(g||u)i.block$data(r.nil,y);else for(let E of l)(0,t.checkReportMissingProp)(i,E)}function _(){let E=s.let("missing");if(g||u){let b=s.let("valid",!0);i.block$data(b,()=>S(E,b)),i.ok(b)}else s.if((0,t.checkMissingProp)(i,l,E)),(0,t.reportMissingProp)(i,E),s.else()}function y(){s.forOf("prop",a,(E)=>{i.setParams({missingProperty:E}),s.if((0,t.noPropertyInData)(s,c,E,h.ownProperties),()=>i.error())})}function S(E,b){i.setParams({missingProperty:E}),s.forOf(E,a,()=>{s.assign(b,(0,t.propertyInData)(s,c,E,h.ownProperties)),s.if((0,r.not)(b),()=>{i.error(),s.break()})},r.nil)}}};e.default=o}),gD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:n,schemaCode:o}){let i=n==="maxItems"?"more":"fewer";return t.str`must NOT have ${i} than ${o} items`},params:({schemaCode:n})=>t._`{limit: ${n}}`},code(n){let{keyword:o,data:i,schemaCode:s}=n,l=o==="maxItems"?t.operators.GT:t.operators.LT;n.fail$data(t._`${i}.length ${l} ${s}`)}};e.default=r}),Vd=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=lE();t.code='require("ajv/dist/runtime/equal").default',e.default=t}),vD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=fl(),r=Xe(),n=ut(),o=Vd(),i={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:s,j:l}})=>r.str`must NOT have duplicate items (items ## ${l} and ${s} are identical)`,params:({params:{i:s,j:l}})=>r._`{i: ${s}, j: ${l}}`},code(s){let{gen:l,data:a,$data:c,schema:u,parentSchema:f,schemaCode:h,it:g}=s;if(!c&&!u)return;let p=l.let("valid"),_=f.items?(0,t.getSchemaTypes)(f.items):[];s.block$data(p,y,r._`${h} === false`),s.ok(p);function y(){let R=l.let("i",r._`${a}.length`),w=l.let("j");s.setParams({i:R,j:w}),l.assign(p,!0),l.if(r._`${R} > 1`,()=>(S()?E:b)(R,w))}function S(){return _.length>0&&!_.some((R)=>R==="object"||R==="array")}function E(R,w){let T=l.name("item"),C=(0,t.checkDataTypes)(_,T,g.opts.strictNumbers,t.DataType.Wrong),A=l.const("indices",r._`{}`);l.for(r._`;${R}--;`,()=>{if(l.let(T,r._`${a}[${R}]`),l.if(C,r._`continue`),_.length>1)l.if(r._`typeof ${T} == "string"`,r._`${T} += "_"`);l.if(r._`typeof ${A}[${T}] == "number"`,()=>{l.assign(w,r._`${A}[${T}]`),s.error(),l.assign(p,!1).break()}).code(r._`${A}[${T}] = ${R}`)})}function b(R,w){let T=(0,n.useFunc)(l,o.default),C=l.name("outer");l.label(C).for(r._`;${R}--;`,()=>l.for(r._`${w} = ${R}; ${w}--;`,()=>l.if(r._`${T}(${a}[${R}], ${a}[${w}])`,()=>{s.error(),l.assign(p,!1).break(C)})))}}};e.default=i}),_D=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r=ut(),n=Vd(),o={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:i})=>t._`{allowedValue: ${i}}`},code(i){let{gen:s,data:l,$data:a,schemaCode:c,schema:u}=i;if(a||u&&typeof u=="object")i.fail$data(t._`!${(0,r.useFunc)(s,n.default)}(${l}, ${c})`);else i.fail(t._`${u} !== ${l}`)}};e.default=o}),yD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r=ut(),n=Vd(),o={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:i})=>t._`{allowedValues: ${i}}`},code(i){let{gen:s,data:l,$data:a,schema:c,schemaCode:u,it:f}=i;if(!a&&c.length===0)throw Error("enum must have non-empty array");let h=c.length>=f.opts.loopEnum,g,p=()=>g!==null&&g!==void 0?g:g=(0,r.useFunc)(s,n.default),_;if(h||a)_=s.let("valid"),i.block$data(_,y);else{if(!Array.isArray(c))throw Error("ajv implementation error");let E=s.const("vSchema",u);_=(0,t.or)(...c.map((b,R)=>S(E,R)))}i.pass(_);function y(){s.assign(_,!1),s.forOf("v",u,(E)=>s.if(t._`${p()}(${l}, ${E})`,()=>s.assign(_,!0).break()))}function S(E,b){let R=c[b];return typeof R==="object"&&R!==null?t._`${p()}(${l}, ${E}[${b}])`:t._`${l} === ${R}`}}};e.default=o}),dE=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cD(),r=uD(),n=fD(),o=pD(),i=hD(),s=mD(),l=gD(),a=vD(),c=_D(),u=yD(),f=[t.default,r.default,n.default,o.default,i.default,s.default,l.default,a.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},c.default,u.default];e.default=f}),fE=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;let t=Xe(),r=ut(),n={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:i}})=>t.str`must NOT have more than ${i} items`,params:({params:{len:i}})=>t._`{limit: ${i}}`},code(i){let{parentSchema:s,it:l}=i,{items:a}=s;if(!Array.isArray(a)){(0,r.checkStrictMode)(l,'"additionalItems" is ignored when "items" is not an array of schemas');return}o(i,a)}};function o(i,s){let{gen:l,schema:a,data:c,keyword:u,it:f}=i;f.items=!0;let h=l.const("len",t._`${c}.length`);if(a===!1)i.setParams({len:s.length}),i.pass(t._`${h} <= ${s.length}`);else if(typeof a=="object"&&!(0,r.alwaysValidSchema)(f,a)){let p=l.var("valid",t._`${h} <= ${s.length}`);l.if((0,t.not)(p),()=>g(p)),i.ok(p)}function g(p){l.forRange("i",s.length,h,(_)=>{if(i.subschema({keyword:u,dataProp:_,dataPropType:r.Type.Num},p),!f.allErrors)l.if((0,t.not)(p),()=>l.break())})}}e.validateAdditionalItems=o,e.default=n}),pE=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;let t=Xe(),r=ut(),n=Kr(),o={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(s){let{schema:l,it:a}=s;if(Array.isArray(l))return i(s,"additionalItems",l);if(a.items=!0,(0,r.alwaysValidSchema)(a,l))return;s.ok((0,n.validateArray)(s))}};function i(s,l,a=s.schema){let{gen:c,parentSchema:u,data:f,keyword:h,it:g}=s;if(y(u),g.opts.unevaluated&&a.length&&g.items!==!0)g.items=r.mergeEvaluated.items(c,a.length,g.items);let p=c.name("valid"),_=c.const("len",t._`${f}.length`);a.forEach((S,E)=>{if((0,r.alwaysValidSchema)(g,S))return;c.if(t._`${_} > ${E}`,()=>s.subschema({keyword:h,schemaProp:E,dataProp:E},p)),s.ok(p)});function y(S){let{opts:E,errSchemaPath:b}=g,R=a.length,w=R===S.minItems&&(R===S.maxItems||S[l]===!1);if(E.strictTuples&&!w){let T=`"${h}" is ${R}-tuple, but minItems or maxItems/${l} are not specified or different at path "${b}"`;(0,r.checkStrictMode)(g,T,E.strictTuples)}}}e.validateTuple=i,e.default=o}),SD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=pE(),r={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(n)=>(0,t.validateTuple)(n,"items")};e.default=r}),ED=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r=ut(),n=Kr(),o=fE(),i={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:s}})=>t.str`must NOT have more than ${s} items`,params:({params:{len:s}})=>t._`{limit: ${s}}`},code(s){let{schema:l,parentSchema:a,it:c}=s,{prefixItems:u}=a;if(c.items=!0,(0,r.alwaysValidSchema)(c,l))return;if(u)(0,o.validateAdditionalItems)(s,u);else s.ok((0,n.validateArray)(s))}};e.default=i}),bD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r=ut(),n={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:o,max:i}})=>i===void 0?t.str`must contain at least ${o} valid item(s)`:t.str`must contain at least ${o} and no more than ${i} valid item(s)`,params:({params:{min:o,max:i}})=>i===void 0?t._`{minContains: ${o}}`:t._`{minContains: ${o}, maxContains: ${i}}`},code(o){let{gen:i,schema:s,parentSchema:l,data:a,it:c}=o,u,f,{minContains:h,maxContains:g}=l;if(c.opts.next)u=h===void 0?1:h,f=g;else u=1;let p=i.const("len",t._`${a}.length`);if(o.setParams({min:u,max:f}),f===void 0&&u===0){(0,r.checkStrictMode)(c,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(f!==void 0&&u>f){(0,r.checkStrictMode)(c,'"minContains" > "maxContains" is always invalid'),o.fail();return}if((0,r.alwaysValidSchema)(c,s)){let b=t._`${p} >= ${u}`;if(f!==void 0)b=t._`${b} && ${p} <= ${f}`;o.pass(b);return}c.items=!0;let _=i.name("valid");if(f===void 0&&u===1)S(_,()=>i.if(_,()=>i.break()));else if(u===0){if(i.let(_,!0),f!==void 0)i.if(t._`${a}.length > 0`,y)}else i.let(_,!1),y();o.result(_,()=>o.reset());function y(){let b=i.name("_valid"),R=i.let("count",0);S(b,()=>i.if(b,()=>E(R)))}function S(b,R){i.forRange("i",0,p,(w)=>{o.subschema({keyword:"contains",dataProp:w,dataPropType:r.Type.Num,compositeRule:!0},b),R()})}function E(b){if(i.code(t._`${b}++`),f===void 0)i.if(t._`${b} >= ${u}`,()=>i.assign(_,!0).break());else if(i.if(t._`${b} > ${f}`,()=>i.assign(_,!1).break()),u===1)i.assign(_,!0);else i.if(t._`${b} >= ${u}`,()=>i.assign(_,!0))}}};e.default=n}),jd=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;let t=Xe(),r=ut(),n=Kr();e.error={message:({params:{property:a,depsCount:c,deps:u}})=>{let f=c===1?"property":"properties";return t.str`must have ${f} ${u} when property ${a} is present`},params:({params:{property:a,depsCount:c,deps:u,missingProperty:f}})=>t._`{property: ${a},
123
+ missingProperty: ${f},
124
+ depsCount: ${c},
125
+ deps: ${u}}`};let o={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(a){let[c,u]=i(a);s(a,c),l(a,u)}};function i({schema:a}){let c={},u={};for(let f in a){if(f==="__proto__")continue;let h=Array.isArray(a[f])?c:u;h[f]=a[f]}return[c,u]}function s(a,c=a.schema){let{gen:u,data:f,it:h}=a;if(Object.keys(c).length===0)return;let g=u.let("missing");for(let p in c){let _=c[p];if(_.length===0)continue;let y=(0,n.propertyInData)(u,f,p,h.opts.ownProperties);if(a.setParams({property:p,depsCount:_.length,deps:_.join(", ")}),h.allErrors)u.if(y,()=>{for(let S of _)(0,n.checkReportMissingProp)(a,S)});else u.if(t._`${y} && (${(0,n.checkMissingProp)(a,_,g)})`),(0,n.reportMissingProp)(a,g),u.else()}}e.validatePropertyDeps=s;function l(a,c=a.schema){let{gen:u,data:f,keyword:h,it:g}=a,p=u.name("valid");for(let _ in c){if((0,r.alwaysValidSchema)(g,c[_]))continue;u.if((0,n.propertyInData)(u,f,_,g.opts.ownProperties),()=>{let y=a.subschema({keyword:h,schemaProp:_},p);a.mergeValidEvaluated(y,p)},()=>u.var(p,!0)),a.ok(p)}}e.validateSchemaDeps=l,e.default=o}),wD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r=ut(),n={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:o})=>t._`{propertyName: ${o.propertyName}}`},code(o){let{gen:i,schema:s,data:l,it:a}=o;if((0,r.alwaysValidSchema)(a,s))return;let c=i.name("valid");i.forIn("key",l,(u)=>{o.setParams({propertyName:u}),o.subschema({keyword:"propertyNames",data:u,dataTypes:["string"],propertyName:u,compositeRule:!0},c),i.if((0,t.not)(c),()=>{if(o.error(!0),!a.allErrors)i.break()})}),o.ok(c)}};e.default=n}),hE=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Kr(),r=Xe(),n=Jr(),o=ut(),i={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:s})=>r._`{additionalProperty: ${s.additionalProperty}}`},code(s){let{gen:l,schema:a,parentSchema:c,data:u,errsCount:f,it:h}=s;if(!f)throw Error("ajv implementation error");let{allErrors:g,opts:p}=h;if(h.props=!0,p.removeAdditional!=="all"&&(0,o.alwaysValidSchema)(h,a))return;let _=(0,t.allSchemaProperties)(c.properties),y=(0,t.allSchemaProperties)(c.patternProperties);S(),s.ok(r._`${f} === ${n.default.errors}`);function S(){l.forIn("key",u,(T)=>{if(!_.length&&!y.length)R(T);else l.if(E(T),()=>R(T))})}function E(T){let C;if(_.length>8){let A=(0,o.schemaRefOrVal)(h,c.properties,"properties");C=(0,t.isOwnProperty)(l,A,T)}else if(_.length)C=(0,r.or)(..._.map((A)=>r._`${T} === ${A}`));else C=r.nil;if(y.length)C=(0,r.or)(C,...y.map((A)=>r._`${(0,t.usePattern)(s,A)}.test(${T})`));return(0,r.not)(C)}function b(T){l.code(r._`delete ${u}[${T}]`)}function R(T){if(p.removeAdditional==="all"||p.removeAdditional&&a===!1){b(T);return}if(a===!1){if(s.setParams({additionalProperty:T}),s.error(),!g)l.break();return}if(typeof a=="object"&&!(0,o.alwaysValidSchema)(h,a)){let C=l.name("valid");if(p.removeAdditional==="failing")w(T,C,!1),l.if((0,r.not)(C),()=>{s.reset(),b(T)});else if(w(T,C),!g)l.if((0,r.not)(C),()=>l.break())}}function w(T,C,A){let P={keyword:"additionalProperties",dataProp:T,dataPropType:o.Type.Str};if(A===!1)Object.assign(P,{compositeRule:!0,createErrors:!1,allErrors:!1});s.subschema(P,C)}}};e.default=i}),TD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Ji(),r=Kr(),n=ut(),o=hE(),i={keyword:"properties",type:"object",schemaType:"object",code(s){let{gen:l,schema:a,parentSchema:c,data:u,it:f}=s;if(f.opts.removeAdditional==="all"&&c.additionalProperties===void 0)o.default.code(new t.KeywordCxt(f,o.default,"additionalProperties"));let h=(0,r.allSchemaProperties)(a);for(let S of h)f.definedProperties.add(S);if(f.opts.unevaluated&&h.length&&f.props!==!0)f.props=n.mergeEvaluated.props(l,(0,n.toHash)(h),f.props);let g=h.filter((S)=>!(0,n.alwaysValidSchema)(f,a[S]));if(g.length===0)return;let p=l.name("valid");for(let S of g){if(_(S))y(S);else{if(l.if((0,r.propertyInData)(l,u,S,f.opts.ownProperties)),y(S),!f.allErrors)l.else().var(p,!0);l.endIf()}s.it.definedProperties.add(S),s.ok(p)}function _(S){return f.opts.useDefaults&&!f.compositeRule&&a[S].default!==void 0}function y(S){s.subschema({keyword:"properties",schemaProp:S,dataProp:S},p)}}};e.default=i}),CD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Kr(),r=Xe(),n=ut(),o=ut(),i={keyword:"patternProperties",type:"object",schemaType:"object",code(s){let{gen:l,schema:a,data:c,parentSchema:u,it:f}=s,{opts:h}=f,g=(0,t.allSchemaProperties)(a),p=g.filter((w)=>(0,n.alwaysValidSchema)(f,a[w]));if(g.length===0||p.length===g.length&&(!f.opts.unevaluated||f.props===!0))return;let _=h.strictSchema&&!h.allowMatchingProperties&&u.properties,y=l.name("valid");if(f.props!==!0&&!(f.props instanceof r.Name))f.props=(0,o.evaluatedPropsToName)(l,f.props);let{props:S}=f;E();function E(){for(let w of g){if(_)b(w);if(f.allErrors)R(w);else l.var(y,!0),R(w),l.if(y)}}function b(w){for(let T in _)if(new RegExp(w).test(T))(0,n.checkStrictMode)(f,`property ${T} matches pattern ${w} (use allowMatchingProperties)`)}function R(w){l.forIn("key",c,(T)=>{l.if(r._`${(0,t.usePattern)(s,w)}.test(${T})`,()=>{let C=p.includes(w);if(!C)s.subschema({keyword:"patternProperties",schemaProp:w,dataProp:T,dataPropType:o.Type.Str},y);if(f.opts.unevaluated&&S!==!0)l.assign(r._`${S}[${T}]`,!0);else if(!C&&!f.allErrors)l.if((0,r.not)(y),()=>l.break())})})}}};e.default=i}),RD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ut(),r={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(n){let{gen:o,schema:i,it:s}=n;if((0,t.alwaysValidSchema)(s,i)){n.fail();return}let l=o.name("valid");n.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},l),n.failResult(l,()=>n.reset(),()=>n.error())},error:{message:"must NOT be valid"}};e.default=r}),AD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Kr().validateUnion,error:{message:"must match a schema in anyOf"}};e.default=t}),ID=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r=ut(),n={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:o})=>t._`{passingSchemas: ${o.passing}}`},code(o){let{gen:i,schema:s,parentSchema:l,it:a}=o;if(!Array.isArray(s))throw Error("ajv implementation error");if(a.opts.discriminator&&l.discriminator)return;let c=s,u=i.let("valid",!1),f=i.let("passing",null),h=i.name("_valid");o.setParams({passing:f}),i.block(g),o.result(u,()=>o.reset(),()=>o.error(!0));function g(){c.forEach((p,_)=>{let y;if((0,r.alwaysValidSchema)(a,p))i.var(h,!0);else y=o.subschema({keyword:"oneOf",schemaProp:_,compositeRule:!0},h);if(_>0)i.if(t._`${h} && ${u}`).assign(u,!1).assign(f,t._`[${f}, ${_}]`).else();i.if(h,()=>{if(i.assign(u,!0),i.assign(f,_),y)o.mergeEvaluated(y,t.Name)})})}}};e.default=n}),PD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ut(),r={keyword:"allOf",schemaType:"array",code(n){let{gen:o,schema:i,it:s}=n;if(!Array.isArray(i))throw Error("ajv implementation error");let l=o.name("valid");i.forEach((a,c)=>{if((0,t.alwaysValidSchema)(s,a))return;let u=n.subschema({keyword:"allOf",schemaProp:c},l);n.ok(l),n.mergeEvaluated(u)})}};e.default=r}),kD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r=ut(),n={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:i})=>t.str`must match "${i.ifClause}" schema`,params:({params:i})=>t._`{failingKeyword: ${i.ifClause}}`},code(i){let{gen:s,parentSchema:l,it:a}=i;if(l.then===void 0&&l.else===void 0)(0,r.checkStrictMode)(a,'"if" without "then" and "else" is ignored');let c=o(a,"then"),u=o(a,"else");if(!c&&!u)return;let f=s.let("valid",!0),h=s.name("_valid");if(g(),i.reset(),c&&u){let _=s.let("ifClause");i.setParams({ifClause:_}),s.if(h,p("then",_),p("else",_))}else if(c)s.if(h,p("then"));else s.if((0,t.not)(h),p("else"));i.pass(f,()=>i.error(!0));function g(){let _=i.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},h);i.mergeEvaluated(_)}function p(_,y){return()=>{let S=i.subschema({keyword:_},h);if(s.assign(f,h),i.mergeValidEvaluated(S,f),y)s.assign(y,t._`${_}`);else i.setParams({ifClause:_})}}}};function o(i,s){let l=i.schema[s];return l!==void 0&&!(0,r.alwaysValidSchema)(i,l)}e.default=n}),ND=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ut(),r={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:n,parentSchema:o,it:i}){if(o.if===void 0)(0,t.checkStrictMode)(i,`"${n}" without "if" is ignored`)}};e.default=r}),mE=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=fE(),r=SD(),n=pE(),o=ED(),i=bD(),s=jd(),l=wD(),a=hE(),c=TD(),u=CD(),f=RD(),h=AD(),g=ID(),p=PD(),_=kD(),y=ND();function S(E=!1){let b=[f.default,h.default,g.default,p.default,_.default,y.default,l.default,a.default,s.default,c.default,u.default];if(E)b.push(r.default,o.default);else b.push(t.default,n.default);return b.push(i.default),b}e.default=S}),OD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:n})=>t.str`must match format "${n}"`,params:({schemaCode:n})=>t._`{format: ${n}}`},code(n,o){let{gen:i,data:s,$data:l,schema:a,schemaCode:c,it:u}=n,{opts:f,errSchemaPath:h,schemaEnv:g,self:p}=u;if(!f.validateFormats)return;if(l)_();else y();function _(){let S=i.scopeValue("formats",{ref:p.formats,code:f.code.formats}),E=i.const("fDef",t._`${S}[${c}]`),b=i.let("fType"),R=i.let("format");i.if(t._`typeof ${E} == "object" && !(${E} instanceof RegExp)`,()=>i.assign(b,t._`${E}.type || "string"`).assign(R,t._`${E}.validate`),()=>i.assign(b,t._`"string"`).assign(R,E)),n.fail$data((0,t.or)(w(),T()));function w(){if(f.strictSchema===!1)return t.nil;return t._`${c} && !${R}`}function T(){let C=g.$async?t._`(${E}.async ? await ${R}(${s}) : ${R}(${s}))`:t._`${R}(${s})`,A=t._`(typeof ${R} == "function" ? ${C} : ${R}.test(${s}))`;return t._`${R} && ${R} !== true && ${b} === ${o} && !${A}`}}function y(){let S=p.formats[a];if(!S){w();return}if(S===!0)return;let[E,b,R]=T(S);if(E===o)n.pass(C());function w(){if(f.strictSchema===!1){p.logger.warn(A());return}throw Error(A());function A(){return`unknown format "${a}" ignored in schema at path "${h}"`}}function T(A){let P=A instanceof RegExp?(0,t.regexpCode)(A):f.code.formats?t._`${f.code.formats}${(0,t.getProperty)(a)}`:void 0,D=i.scopeValue("formats",{key:a,ref:A,code:P});if(typeof A=="object"&&!(A instanceof RegExp))return[A.type||"string",A.validate,t._`${D}.validate`];return["string",A,D]}function C(){if(typeof S=="object"&&!(S instanceof RegExp)&&S.async){if(!g.$async)throw Error("async format in sync schema");return t._`await ${R}(${s})`}return typeof b=="function"?t._`${R}(${s})`:t._`${R}.test(${s})`}}}};e.default=r}),gE=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=[OD().default];e.default=t}),vE=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],e.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),_E=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uE(),r=dE(),n=mE(),o=gE(),i=vE(),s=[t.default,r.default,(0,n.default)(),o.default,i.metadataVocabulary,i.contentVocabulary];e.default=s}),MD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0;var t;(function(r){r.Tag="tag",r.Mapping="mapping"})(t||(e.DiscrError=t={}))}),Wd=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r=MD(),n=Xl(),o=Ki(),i=ut(),s={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:l,tagName:a}})=>l===r.DiscrError.Tag?`tag "${a}" must be string`:`value of tag "${a}" must be in oneOf`,params:({params:{discrError:l,tag:a,tagName:c}})=>t._`{error: ${l}, tag: ${c}, tagValue: ${a}}`},code(l){let{gen:a,data:c,schema:u,parentSchema:f,it:h}=l,{oneOf:g}=f;if(!h.opts.discriminator)throw Error("discriminator: requires discriminator option");let p=u.propertyName;if(typeof p!="string")throw Error("discriminator: requires propertyName");if(u.mapping)throw Error("discriminator: mapping is not supported");if(!g)throw Error("discriminator: requires oneOf keyword");let _=a.let("valid",!1),y=a.const("tag",t._`${c}${(0,t.getProperty)(p)}`);a.if(t._`typeof ${y} == "string"`,()=>S(),()=>l.error(!1,{discrError:r.DiscrError.Tag,tag:y,tagName:p})),l.ok(_);function S(){let R=b();a.if(!1);for(let w in R)a.elseIf(t._`${y} === ${w}`),a.assign(_,E(R[w]));a.else(),l.error(!1,{discrError:r.DiscrError.Mapping,tag:y,tagName:p}),a.endIf()}function E(R){let w=a.name("valid"),T=l.subschema({keyword:"oneOf",schemaProp:R},w);return l.mergeEvaluated(T,t.Name),w}function b(){var R;let w={},T=A(f),C=!0;for(let N=0;N<g.length;N++){let F=g[N];if((F===null||F===void 0?void 0:F.$ref)&&!(0,i.schemaHasRulesButRef)(F,h.self.RULES)){let B=F.$ref;if(F=n.resolveRef.call(h.self,h.schemaEnv.root,h.baseId,B),F instanceof n.SchemaEnv)F=F.schema;if(F===void 0)throw new o.default(h.opts.uriResolver,h.baseId,B)}let G=(R=F===null||F===void 0?void 0:F.properties)===null||R===void 0?void 0:R[p];if(typeof G!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${p}"`);C=C&&(T||A(F)),P(G,N)}if(!C)throw Error(`discriminator: "${p}" must be required`);return w;function A({required:N}){return Array.isArray(N)&&N.includes(p)}function P(N,F){if(N.const)D(N.const,F);else if(N.enum)for(let G of N.enum)D(G,F);else throw Error(`discriminator: "properties/${p}" must have "const" or "enum"`)}function D(N,F){if(typeof N!="string"||N in w)throw Error(`discriminator: "${p}" values must be unique strings`);w[N]=F}}}};e.default=s}),DD=Se((e,t)=>{t.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}}),yE=Se((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;let r=Hd(),n=_E(),o=Wd(),i=DD(),s=["/properties"],l="http://json-schema.org/draft-07/schema";var a=class extends r.default{_addVocabularies(){if(super._addVocabularies(),n.default.forEach((g)=>this.addVocabulary(g)),this.opts.discriminator)this.addKeyword(o.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let g=this.opts.$data?this.$dataMetaSchema(i,s):i;this.addMetaSchema(g,l,!1),this.refs["http://json-schema.org/schema"]=l}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l)?l:void 0)}};e.Ajv=a,t.exports=e=a,t.exports.Ajv=a,Object.defineProperty(e,"__esModule",{value:!0}),e.default=a;var c=Ji();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=Xe();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var f=Zs();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return f.default}});var h=Ki();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return h.default}})}),SE=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicAnchor=void 0;let t=Xe(),r=Jr(),n=Xl(),o=zd(),i={keyword:"$dynamicAnchor",schemaType:"string",code:(a)=>s(a,a.schema)};function s(a,c){let{gen:u,it:f}=a;f.schemaEnv.root.dynamicAnchors[c]=!0;let h=t._`${r.default.dynamicAnchors}${(0,t.getProperty)(c)}`,g=f.errSchemaPath==="#"?f.validateName:l(a);u.if(t._`!${h}`,()=>u.assign(h,g))}e.dynamicAnchor=s;function l(a){let{schemaEnv:c,schema:u,self:f}=a.it,{root:h,baseId:g,localRefs:p,meta:_}=c.root,{schemaId:y}=f.opts,S=new n.SchemaEnv({schema:u,schemaId:y,root:h,baseId:g,localRefs:p,meta:_});return n.compileSchema.call(f,S),(0,o.getValidate)(a,S)}e.default=i}),EE=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicRef=void 0;let t=Xe(),r=Jr(),n=zd(),o={keyword:"$dynamicRef",schemaType:"string",code:(s)=>i(s,s.schema)};function i(s,l){let{gen:a,keyword:c,it:u}=s;if(l[0]!=="#")throw Error(`"${c}" only supports hash fragment reference`);let f=l.slice(1);if(u.allErrors)h();else{let p=a.let("valid",!1);h(p),s.ok(p)}function h(p){if(u.schemaEnv.root.dynamicAnchors[f]){let _=a.let("_v",t._`${r.default.dynamicAnchors}${(0,t.getProperty)(f)}`);a.if(_,g(_,p),g(u.validateName,p))}else g(u.validateName,p)()}function g(p,_){return _?()=>a.block(()=>{(0,n.callRef)(s,p),a.let(_,!0)}):()=>(0,n.callRef)(s,p)}}e.dynamicRef=i,e.default=o}),$D=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=SE(),r=ut(),n={keyword:"$recursiveAnchor",schemaType:"boolean",code(o){if(o.schema)(0,t.dynamicAnchor)(o,"");else(0,r.checkStrictMode)(o.it,"$recursiveAnchor: false is ignored")}};e.default=n}),xD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=EE(),r={keyword:"$recursiveRef",schemaType:"string",code:(n)=>(0,t.dynamicRef)(n,n.schema)};e.default=r}),bE=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=SE(),r=EE(),n=$D(),o=xD(),i=[t.default,r.default,n.default,o.default];e.default=i}),LD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=jd(),r={keyword:"dependentRequired",type:"object",schemaType:"object",error:t.error,code:(n)=>(0,t.validatePropertyDeps)(n)};e.default=r}),qD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=jd(),r={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(n)=>(0,t.validateSchemaDeps)(n)};e.default=r}),UD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ut(),r={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:n,parentSchema:o,it:i}){if(o.contains===void 0)(0,t.checkStrictMode)(i,`"${n}" without "contains" is ignored`)}};e.default=r}),wE=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=LD(),r=qD(),n=UD(),o=[t.default,r.default,n.default];e.default=o}),FD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r=ut(),n=Jr(),o={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:i})=>t._`{unevaluatedProperty: ${i.unevaluatedProperty}}`},code(i){let{gen:s,schema:l,data:a,errsCount:c,it:u}=i;if(!c)throw Error("ajv implementation error");let{allErrors:f,props:h}=u;if(h instanceof t.Name)s.if(t._`${h} !== true`,()=>s.forIn("key",a,(y)=>s.if(p(h,y),()=>g(y))));else if(h!==!0)s.forIn("key",a,(y)=>h===void 0?g(y):s.if(_(h,y),()=>g(y)));u.props=!0,i.ok(t._`${c} === ${n.default.errors}`);function g(y){if(l===!1){if(i.setParams({unevaluatedProperty:y}),i.error(),!f)s.break();return}if(!(0,r.alwaysValidSchema)(u,l)){let S=s.name("valid");if(i.subschema({keyword:"unevaluatedProperties",dataProp:y,dataPropType:r.Type.Str},S),!f)s.if((0,t.not)(S),()=>s.break())}}function p(y,S){return t._`!${y} || !${y}[${S}]`}function _(y,S){let E=[];for(let b in y)if(y[b]===!0)E.push(t._`${S} !== ${b}`);return(0,t.and)(...E)}}};e.default=o}),GD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r=ut(),n={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:o}})=>t.str`must NOT have more than ${o} items`,params:({params:{len:o}})=>t._`{limit: ${o}}`},code(o){let{gen:i,schema:s,data:l,it:a}=o,c=a.items||0;if(c===!0)return;let u=i.const("len",t._`${l}.length`);if(s===!1)o.setParams({len:c}),o.fail(t._`${u} > ${c}`);else if(typeof s=="object"&&!(0,r.alwaysValidSchema)(a,s)){let h=i.var("valid",t._`${u} <= ${c}`);i.if((0,t.not)(h),()=>f(h,c)),o.ok(h)}a.items=!0;function f(h,g){i.forRange("i",g,u,(p)=>{if(o.subschema({keyword:"unevaluatedItems",dataProp:p,dataPropType:r.Type.Num},h),!a.allErrors)i.if((0,t.not)(h),()=>i.break())})}}};e.default=n}),TE=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=FD(),r=GD(),n=[t.default,r.default];e.default=n}),BD=Se((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/schema",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0,"https://json-schema.org/draft/2019-09/vocab/applicator":!0,"https://json-schema.org/draft/2019-09/vocab/validation":!0,"https://json-schema.org/draft/2019-09/vocab/meta-data":!0,"https://json-schema.org/draft/2019-09/vocab/format":!1,"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format"},{$ref:"meta/content"}],type:["object","boolean"],properties:{definitions:{$comment:"While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.",type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},dependencies:{$comment:'"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"',type:"object",additionalProperties:{anyOf:[{$recursiveRef:"#"},{$ref:"meta/validation#/$defs/stringArray"}]}}}}}),HD=Se((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/applicator":!0},$recursiveAnchor:!0,title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{additionalItems:{$recursiveRef:"#"},unevaluatedItems:{$recursiveRef:"#"},items:{anyOf:[{$recursiveRef:"#"},{$ref:"#/$defs/schemaArray"}]},contains:{$recursiveRef:"#"},additionalProperties:{$recursiveRef:"#"},unevaluatedProperties:{$recursiveRef:"#"},properties:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$recursiveRef:"#"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$recursiveRef:"#"}},propertyNames:{$recursiveRef:"#"},if:{$recursiveRef:"#"},then:{$recursiveRef:"#"},else:{$recursiveRef:"#"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$recursiveRef:"#"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$recursiveRef:"#"}}}}}),zD=Se((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/content",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentMediaType:{type:"string"},contentEncoding:{type:"string"},contentSchema:{$recursiveRef:"#"}}}}),VD=Se((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/core",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0},$recursiveAnchor:!0,title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{type:"string",format:"uri"},$anchor:{type:"string",pattern:"^[A-Za-z][-A-Za-z0-9.:_]*$"},$ref:{type:"string",format:"uri-reference"},$recursiveRef:{type:"string",format:"uri-reference"},$recursiveAnchor:{type:"boolean",default:!1},$vocabulary:{type:"object",propertyNames:{type:"string",format:"uri"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}}}}}),jD=Se((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/format",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/format":!0},$recursiveAnchor:!0,title:"Format vocabulary meta-schema",type:["object","boolean"],properties:{format:{type:"string"}}}}),WD=Se((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/meta-data":!0},$recursiveAnchor:!0,title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),JD=Se((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/validation",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/validation":!0},$recursiveAnchor:!0,title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}},const:!0,enum:{type:"array",items:!0},type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),KD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=BD(),r=HD(),n=zD(),o=VD(),i=jD(),s=WD(),l=JD(),a=["/properties"];function c(u){return[t,r,n,o,f(this,i),s,f(this,l)].forEach((h)=>this.addMetaSchema(h,void 0,!1)),this;function f(h,g){return u?h.$dataMetaSchema(g,a):g}}e.default=c}),XD=Se((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2019=void 0;let r=Hd(),n=_E(),o=bE(),i=wE(),s=TE(),l=Wd(),a=KD(),c="https://json-schema.org/draft/2019-09/schema";var u=class extends r.default{constructor(_={}){super({..._,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),this.addVocabulary(o.default),n.default.forEach((_)=>this.addVocabulary(_)),this.addVocabulary(i.default),this.addVocabulary(s.default),this.opts.discriminator)this.addKeyword(l.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:_,meta:y}=this.opts;if(!y)return;a.default.call(this,_),this.refs["http://json-schema.org/schema"]=c}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(c)?c:void 0)}};e.Ajv2019=u,t.exports=e=u,t.exports.Ajv2019=u,Object.defineProperty(e,"__esModule",{value:!0}),e.default=u;var f=Ji();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return f.KeywordCxt}});var h=Xe();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return h._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return h.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return h.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return h.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return h.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return h.CodeGen}});var g=Zs();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return g.default}});var p=Ki();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}),YD=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uE(),r=dE(),n=mE(),o=bE(),i=wE(),s=TE(),l=gE(),a=vE(),c=[o.default,t.default,r.default,(0,n.default)(!0),l.default,a.metadataVocabulary,a.contentVocabulary,i.default,s.default];e.default=c}),ZD=Se((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}}),QD=Se((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}}),e$=Se((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}}),t$=Se((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}}),r$=Se((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}}),n$=Se((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}}),o$=Se((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),i$=Se((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),s$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ZD(),r=QD(),n=e$(),o=t$(),i=r$(),s=n$(),l=o$(),a=i$(),c=["/properties"];function u(f){return[t,r,n,o,i,h(this,s),l,h(this,a)].forEach((g)=>this.addMetaSchema(g,void 0,!1)),this;function h(g,p){return f?g.$dataMetaSchema(p,c):p}}e.default=u}),a$=Se((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2020=void 0;let r=Hd(),n=YD(),o=Wd(),i=s$(),s="https://json-schema.org/draft/2020-12/schema";var l=class extends r.default{constructor(h={}){super({...h,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),n.default.forEach((h)=>this.addVocabulary(h)),this.opts.discriminator)this.addKeyword(o.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:h,meta:g}=this.opts;if(!g)return;i.default.call(this,h),this.refs["http://json-schema.org/schema"]=s}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}};e.Ajv2020=l,t.exports=e=l,t.exports.Ajv2020=l,Object.defineProperty(e,"__esModule",{value:!0}),e.default=l;var a=Ji();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return a.KeywordCxt}});var c=Xe();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return c._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return c.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return c.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return c.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return c.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return c.CodeGen}});var u=Zs();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return u.default}});var f=Ki();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return f.default}})}),l$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(N,F){return{validate:N,compare:F}}e.fullFormats={date:t(i,s),time:t(a(!0),c),"date-time":t(h(!0),g),"iso-time":t(a(),u),"iso-date-time":t(h(),p),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:S,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:D,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:b,int32:{type:"number",validate:T},int64:{type:"number",validate:C},float:{type:"number",validate:A},double:{type:"number",validate:A},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,s),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,c),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,g),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,p),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function r(N){return N%4===0&&(N%100!==0||N%400===0)}let n=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,o=[0,31,28,31,30,31,30,31,31,30,31,30,31];function i(N){let F=n.exec(N);if(!F)return!1;let G=+F[1],B=+F[2],Q=+F[3];return B>=1&&B<=12&&Q>=1&&Q<=(B===2&&r(G)?29:o[B])}function s(N,F){if(!(N&&F))return;if(N>F)return 1;if(N<F)return-1;return 0}let l=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function a(N){return function F(G){let B=l.exec(G);if(!B)return!1;let Q=+B[1],pe=+B[2],se=+B[3],ve=B[4],me=B[5]==="-"?-1:1,j=+(B[6]||0),ne=+(B[7]||0);if(j>23||ne>59||N&&!ve)return!1;if(Q<=23&&pe<=59&&se<60)return!0;let he=pe-ne*me,q=Q-j*me-(he<0?1:0);return(q===23||q===-1)&&(he===59||he===-1)&&se<61}}function c(N,F){if(!(N&&F))return;let G=new Date("2020-01-01T"+N).valueOf(),B=new Date("2020-01-01T"+F).valueOf();if(!(G&&B))return;return G-B}function u(N,F){if(!(N&&F))return;let G=l.exec(N),B=l.exec(F);if(!(G&&B))return;if(N=G[1]+G[2]+G[3],F=B[1]+B[2]+B[3],N>F)return 1;if(N<F)return-1;return 0}let f=/t|\s/i;function h(N){let F=a(N);return function G(B){let Q=B.split(f);return Q.length===2&&i(Q[0])&&F(Q[1])}}function g(N,F){if(!(N&&F))return;let G=new Date(N).valueOf(),B=new Date(F).valueOf();if(!(G&&B))return;return G-B}function p(N,F){if(!(N&&F))return;let[G,B]=N.split(f),[Q,pe]=F.split(f),se=s(G,Q);if(se===void 0)return;return se||c(B,pe)}let _=/\/|:/,y=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function S(N){return _.test(N)&&y.test(N)}let E=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function b(N){return E.lastIndex=0,E.test(N)}let R=-2147483648,w=2147483647;function T(N){return Number.isInteger(N)&&N<=w&&N>=R}function C(N){return Number.isInteger(N)}function A(){return!0}let P=/[^\\]\\Z/;function D(N){if(P.test(N))return!1;try{return new RegExp(N),!0}catch(F){return!1}}}),c$=Se((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;let t=yE(),r=Xe(),n=r.operators,o={formatMaximum:{okStr:"<=",ok:n.LTE,fail:n.GT},formatMinimum:{okStr:">=",ok:n.GTE,fail:n.LT},formatExclusiveMaximum:{okStr:"<",ok:n.LT,fail:n.GTE},formatExclusiveMinimum:{okStr:">",ok:n.GT,fail:n.LTE}},i={message:({keyword:l,schemaCode:a})=>r.str`should be ${o[l].okStr} ${a}`,params:({keyword:l,schemaCode:a})=>r._`{comparison: ${o[l].okStr}, limit: ${a}}`};e.formatLimitDefinition={keyword:Object.keys(o),type:"string",schemaType:"string",$data:!0,error:i,code(l){let{gen:a,data:c,schemaCode:u,keyword:f,it:h}=l,{opts:g,self:p}=h;if(!g.validateFormats)return;let _=new t.KeywordCxt(h,p.RULES.all.format.definition,"format");if(_.$data)y();else S();function y(){let b=a.scopeValue("formats",{ref:p.formats,code:g.code.formats}),R=a.const("fmt",r._`${b}[${_.schemaCode}]`);l.fail$data((0,r.or)(r._`typeof ${R} != "object"`,r._`${R} instanceof RegExp`,r._`typeof ${R}.compare != "function"`,E(R)))}function S(){let b=_.schema,R=p.formats[b];if(!R||R===!0)return;if(typeof R!="object"||R instanceof RegExp||typeof R.compare!="function")throw Error(`"${f}": format "${b}" does not define "compare" function`);let w=a.scopeValue("formats",{key:b,ref:R,code:g.code.formats?r._`${g.code.formats}${(0,r.getProperty)(b)}`:void 0});l.fail$data(E(w))}function E(b){return r._`${b}.compare(${c}, ${u}) ${o[f].fail} 0`}},dependencies:["format"]};let s=(l)=>(l.addKeyword(e.formatLimitDefinition),l);e.default=s}),u$=Se((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});let r=l$(),n=c$(),o=Xe(),i=new o.Name("fullFormats"),s=new o.Name("fastFormats"),l=(c,u={keywords:!0})=>{if(Array.isArray(u))return a(c,u,r.fullFormats,i),c;let[f,h]=u.mode==="fast"?[r.fastFormats,s]:[r.fullFormats,i];if(a(c,u.formats||r.formatNames,f,h),u.keywords)(0,n.default)(c);return c};l.get=(c,u="full")=>{let f=(u==="fast"?r.fastFormats:r.fullFormats)[c];if(!f)throw Error(`Unknown format "${c}"`);return f};function a(c,u,f,h){var g,p;(g=(p=c.opts.code).formats)!==null&&g!==void 0||(p.formats=o._`require("ajv-formats/dist/formats").${h}`);for(let _ of u)c.addFormat(_,f[_])}t.exports=e=l,Object.defineProperty(e,"__esModule",{value:!0}),e.default=l}),CE=yE(),d$=XD(),f$=a$(),p$=Qv(u$(),1),h$=p$.default;function qc(e){let t=new e({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return h$(t),t}var m$=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(e){this._userAjv=e!==void 0,this._ajv=e}get ajv(){return this._ajv??=qc(f$.Ajv2020)}_engineFor(e){if(this._userAjv)return this.ajv;let t=zR(e,"pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.");if(t==="2020-12")return this.ajv;if(t==="2019-09")return this._ajv2019??=qc(d$.Ajv2019);return this._ajvDraft7??=qc(CE.Ajv)}getValidator(e){let t=this._engineFor(e),r="$id"in e&&typeof e.$id==="string"?t.getSchema(e.$id)??t.compile(e):t.compile(e);return(n)=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:t.errorsText(r.errors)}}},mj=CE.Ajv,RE=Symbol.for("mcp.completable");function fh(e){return!!e&&typeof e==="object"&&RE in e}function g$(e){return e[RE]?.complete}function v$(e,t){switch(t.kind){case"tools_list_changed":return e.toolsListChanged===!0;case"prompts_list_changed":return e.promptsListChanged===!0;case"resources_list_changed":return e.resourcesListChanged===!0;case"resource_updated":return e.resourceSubscriptions!==void 0&&e.resourceSubscriptions.includes(t.uri)}}function _$(e,t){let r={},n=(o)=>t===void 0||o===!0;if(e.toolsListChanged===!0&&n(t?.tools?.listChanged))r.toolsListChanged=!0;if(e.promptsListChanged===!0&&n(t?.prompts?.listChanged))r.promptsListChanged=!0;if(e.resourcesListChanged===!0&&n(t?.resources?.listChanged))r.resourcesListChanged=!0;if(e.resourceSubscriptions!==void 0&&e.resourceSubscriptions.length>0&&n(t?.resources?.subscribe))r.resourceSubscriptions=[...e.resourceSubscriptions];return r}var AE=1024;function ph(e,t){return{method:e.method,params:{...e.params,_meta:{...e.params?._meta,[od]:t}}}}function y$(e){let t=Bo(jl).validateRequest("subscriptions/listen",e);return t.ok?t.value.params?.notifications:void 0}var S$=new Set(["notifications/tools/list_changed","notifications/prompts/list_changed","notifications/resources/list_changed","notifications/resources/updated"]),E$=class{_subs=new Map;_serverCapabilities;_serverInfo;constructor(e=AE,t,r){this._maxSubscriptions=e,this._serverCapabilities=t,this._serverInfo=r}setServerCapabilities(e,t){if(this._serverCapabilities=e,t!==void 0)this._serverInfo=t}has(e){return this._subs.has(e)}serve(e){if(this._serverCapabilities===void 0)throw Error("StdioListenRouter.serve() called before setServerCapabilities(); refusing to honor a filter without capabilities");if(this._subs.size>=this._maxSubscriptions)return{jsonrpc:"2.0",id:e.id,error:{code:-32603,message:"Subscription limit reached"}};let t=y$(e);if(t===void 0)return{jsonrpc:"2.0",id:e.id,error:{code:-32602,message:"Invalid params: 'notifications' is required and must be a valid SubscriptionFilter"}};let r=_$(t,this._serverCapabilities);return this._subs.set(e.id,r),ph({method:"notifications/subscriptions/acknowledged",params:{notifications:r}},e.id)}cancel(e){return this._subs.delete(e)}routeOutbound(e){if(!S$.has(e.method))return"passthrough";let t=e.params?.uri,r=typeof t==="string"?t:void 0,n=b$(e.method,r),o=[];for(let[i,s]of this._subs)if(v$(s,n))o.push(ph({method:e.method,params:e.params??{}},i));return o}teardownAll(){let e=[];for(let t of this._subs.keys())e.push({jsonrpc:"2.0",id:t,result:{resultType:"complete",_meta:{[od]:t,...this._serverInfo!==void 0&&{[Ti]:this._serverInfo}}}});return this._subs.clear(),e}};function b$(e,t){switch(e){case"notifications/tools/list_changed":return{kind:"tools_list_changed"};case"notifications/prompts/list_changed":return{kind:"prompts_list_changed"};case"notifications/resources/list_changed":return{kind:"resources_list_changed"};default:return{kind:"resource_updated",uri:t??""}}}function w$(e){return typeof e==="object"&&e!==null&&"setScopeChallengeResolver"in e&&typeof e.setScopeChallengeResolver==="function"}var T$=8,C$=600000;function R$(e){if(e?.maxRounds!==void 0&&(!Number.isInteger(e.maxRounds)||e.maxRounds<1))throw RangeError(`inputRequired.maxRounds must be a positive integer (got ${e.maxRounds})`);if(e?.roundTimeoutMs!==void 0&&(!Number.isFinite(e.roundTimeoutMs)||e.roundTimeoutMs<=0))throw RangeError(`inputRequired.roundTimeoutMs must be a positive number (got ${e.roundTimeoutMs})`);return{maxRounds:e?.maxRounds??T$,roundTimeoutMs:e?.roundTimeoutMs??C$,legacyShim:e?.legacyShim??!0}}function IE(e,t,r){if(r===null||typeof r!=="object"||typeof r.method!=="string")throw new Le(Te.InternalError,`Handler for ${e} returned an invalid input request '${t}': each inputRequests entry must be an embedded elicitation/create, sampling/createMessage, or roots/list request`);let n=r,o=v1(n);if(o===void 0)throw new Le(Te.InternalError,`Handler for ${e} returned an input request '${t}' of kind '${n.method}', which is not an embedded request the 2026-07-28 revision defines`);return{embedded:n,required:o}}function A$(){let e=globalThis.crypto;if(e?.randomUUID!==void 0)return e.randomUUID();let t=new Uint8Array(16);e.getRandomValues(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128;let r=[...t].map((n)=>n.toString(16).padStart(2,"0")).join("");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}function Uc(e,t){if(e==="tools/call")return{content:[{type:"text",text:t}],isError:!0};throw new Le(Te.InternalError,t)}var I$=class{constructor(e){this._host=e}async fulfill(e,t,r,n,o){let{maxRounds:i,roundTimeoutMs:s}=this._host,l=n.mcpReq.signal,a=o,c=0;while(!0){if(c+=1,c>i)return Uc(e,AM(e,i));let u=a.inputRequests,f=u!=null&&Object.keys(u).length>0,h=typeof a.requestState==="string"?a.requestState:void 0;if(!f&&h===void 0)throw new Le(Te.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);let g;if(f){let y=this._host.resolvedClientCapabilities(n),S=[];for(let[b,R]of Object.entries(u)){let{embedded:w,required:T}=IE(e,b,R);if(w.method!=="roots/list"&&w.params===void 0)throw new Le(Te.InternalError,`Handler for ${e} returned an input request '${b}' of kind '${w.method}' without params`);if(OS(T,y)!==void 0)return Uc(e,`Cannot request input '${b}' (${w.method}): the client on this 2025-era connection did not declare the required capability${y===void 0?" (no client capabilities are available on this connection — per-request legacy serving cannot receive server-to-client requests)":""}`);S.push([b,w])}let E=PM(l);try{let b={relatedRequestId:n.mcpReq.id,timeout:s,resetTimeoutOnProgress:!0,onprogress:()=>{},signal:E.signal},R=await Promise.all(S.map(async([w,T])=>{try{return[w,await this._dispatchLeg(T,b)]}catch(C){throw E.abort(C),C}}));g=Object.fromEntries(R)}catch(b){if(l.aborted)throw b;return Uc(e,`Fulfilling input required by '${e}' failed: ${b instanceof Error?b.message:String(b)}`)}finally{E.dispose()}}else await IM(RM,l);let p={...n,mcpReq:{...n.mcpReq,inputResponses:g,droppedInputResponseKeys:void 0,requestState:Wl(h)}};if(h!==void 0){let y=await this._host.verifyRequestState(h,p,e);if(y!==void 0)p=oE(p,y)}let _=await t(r,p);if(!ko(_))return _;a=_}}async _dispatchLeg(e,t){switch(e.method){case"elicitation/create":{let r=e.params;if(r.mode==="url"&&r.elicitationId===void 0)r={...r,elicitationId:A$()};return await this._host.sendElicitation(r,t)}case"sampling/createMessage":return await this._host.sendSampling(e.params,t);case"roots/list":return await this._host.listRoots(e.params,t)}}},P$=new Set(["tools/call","prompts/get","resources/read"]),k$,PE,kE;function N$(e,t){PE(e,t)}function O$(e){return kE(e)}var M$=class extends qM{_clientCapabilities;_clientVersion;static{k$=(e,t)=>{if(t.clientCapabilities!==void 0)e._clientCapabilities=t.clientCapabilities;if(t.clientInfo!==void 0)e._clientVersion=t.clientInfo},PE=(e,t)=>{let r=t.filter((n)=>!e._supportedProtocolVersions.includes(n));if(r.length>0)e._supportedProtocolVersions=[...e._supportedProtocolVersions,...r];e.setRequestHandler("server/discover",()=>e._ondiscover())},kE=(e)=>e._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_legacyInputRequiredShim(){return this._legacyShim??=new I$({maxRounds:this._inputRequiredServing.maxRounds,roundTimeoutMs:this._inputRequiredServing.roundTimeoutMs,resolvedClientCapabilities:(e)=>this._inputRequestCapabilityView(e),verifyRequestState:(e,t,r)=>this._verifyRequestState(e,t,r),sendElicitation:(e,t)=>this._sendElicitationLeg(e,t,{validateAcceptedContent:!1}),sendSampling:(e,t)=>this.createMessage(e,t),listRoots:(e,t)=>this.listRoots(e,t)})}oninitialized;constructor(e,t){super(t);if(this._serverInfo=e,this._capabilities=t?.capabilities?{...t.capabilities}:{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new m$,this._requestStateVerify=t?.requestState?.verify,this._inputRequiredServing=R$(t?.inputRequired),t?.cacheHints!==void 0){for(let[r,n]of Object.entries(t.cacheHints))if(n!==void 0)HS(n,`cacheHints['${r}']`);this._cacheHints=t.cacheHints}if(this.setRequestHandler("initialize",(r)=>this._oninitialize(r)),this.setNotificationHandler("notifications/initialized",()=>this.oninitialized?.()),Kp(this._supportedProtocolVersions).length>0)this.setRequestHandler("server/discover",()=>this._ondiscover());if(this._capabilities.logging)this._registerLoggingHandler()}async connect(e){if(this.transport!==void 0)throw new Ye(tt.AlreadyConnected,"Use a separate Server instance per connection: this instance is already connected to a transport. To connect it to a new transport, call close() first.");await super.connect(e)}_registerLoggingHandler(){this.setRequestHandler("logging/setLevel",async(e,t)=>{let r=t.sessionId||t.http?.req?.headers.get("mcp-session-id")||void 0,{level:n}=e.params,o=Gd($s,n);if(o.success)this._loggingLevels.set(r,o.data);return{}})}buildContext(e,t){let r=e.http||t?.request||t?.closeSSEStream||t?.closeStandaloneSSEStream;return{...e,mcpReq:{...e.mcpReq,log:(n,o,i)=>{if(!this._capabilities.logging)return Promise.resolve();let s;if(this._servedModernEra()){if(s=e.mcpReq.envelope?.[Dl],s===void 0)return Promise.resolve()}else s=this._loggingLevels.get(e.sessionId)??this._loggingLevels.get(void 0);if(s!==void 0&&this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(s))return Promise.resolve();return e.mcpReq.notify({method:"notifications/message",params:{level:n,data:o,logger:i}})},elicitInput:(n,o)=>this.elicitInput(n,o),requestSampling:(n,o)=>this.createMessage(n,o)},http:r?{...e.http,req:t?.request,closeSSE:t?.closeSSEStream,closeStandaloneSSE:t?.closeStandaloneSSEStream}:void 0}}_loggingLevels=new Map;LOG_LEVEL_SEVERITY=new Map($s.options.map((e,t)=>[e,t]));isMessageIgnored=(e,t)=>{let r=this._loggingLevels.get(t);return r?this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(r):!1};registerCapabilities(e){if(this.transport)throw new Ye(tt.AlreadyConnected,"Cannot register capabilities after connecting to transport");let t=!!this._capabilities.logging;if(this._capabilities=UM(this._capabilities,e),!t&&this._capabilities.logging)this._registerLoggingHandler()}_wrapHandler(e,t){if(e!=="tools/call"){let r=this._cacheHints?.[e],n=P$.has(e);if(r===void 0&&!n)return async(o,i)=>{let s=await t(o,i);if(ko(s))throw new Le(Te.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return s};return async(o,i)=>{let s=n?await this._invokeInputRequiredCapableHandler(e,t,o,i):await t(o,i);if(ko(s)){if(!n)throw new Le(Te.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return s}return r===void 0?s:lu(s,r)}}return async(r,n)=>{let o=Bo(this._negotiatedProtocolVersion),i=o.validateRequest("tools/call",r);if(!i.ok)throw new Le(i.reason==="not-in-era"?Te.InternalError:Te.InvalidParams,i.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call request: ${i.message}`);let s=await this._invokeInputRequiredCapableHandler("tools/call",t,r,n);if(ko(s))return s;let l=xS(s),a=o.validateResult("tools/call",l);if(!a.ok)throw new Le(a.reason==="not-in-era"?Te.InternalError:Te.InvalidParams,a.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call result: ${a.message}`);return a.value}}_servedModernEra(){return this._negotiatedProtocolVersion!==void 0&&Xs(this._negotiatedProtocolVersion)}async _invokeInputRequiredCapableHandler(e,t,r,n){let o=this._servedModernEra(),i=n.mcpReq.requestState();if(i!==void 0&&typeof i!=="string")throw new Le(Te.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"});let s=n;if(typeof i==="string"){let f=await this._verifyRequestState(i,n,e);if(f!==void 0)s=oE(n,f)}let l;try{l=await t(r,s)}catch(f){if(f instanceof Le&&f.code===Te.UrlElicitationRequired){if(!o)throw f;throw new Le(Te.InternalError,`URL elicitation cannot be signalled by throwing UrlElicitationRequiredError on protocol revision ${this._negotiatedProtocolVersion}: return inputRequired({ inputRequests: { …: inputRequired.elicitUrl(...) } }) from the handler instead. The urlElicitationRequired error (-32042) of earlier revisions is not available on this revision.`)}throw f}if(!ko(l))return l;if(!o){if(!this._inputRequiredServing.legacyShim)throw new Le(Te.InternalError,`Handler for ${e} returned an input-required result, but this request is served on protocol revision ${this._negotiatedProtocolVersion??iu}, which has no input_required vocabulary`);return await this._legacyInputRequiredShim().fulfill(e,t,r,s,l)}let a=l.inputRequests,c=a!=null&&Object.keys(a).length>0,u=typeof l.requestState==="string";if(!c&&!u)throw new Le(Te.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(c){let f=this._inputRequestCapabilityView(n);for(let[h,g]of Object.entries(a)){let{embedded:p,required:_}=IE(e,h,g),y=OS(_,f);if(y!==void 0)throw new VS({requiredCapabilities:y},`Cannot request input '${h}' (${p.method}): the request's client capabilities do not declare the required capability`)}}return l}async _verifyRequestState(e,t,r){if(this._requestStateVerify===void 0)return;try{return await this._requestStateVerify(e,t)}catch(n){throw this.onerror?.(Error(`requestState verification rejected ${r}: ${n instanceof Error?n.message:String(n)}`)),new Le(Te.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"})}}_inputRequestCapabilityView(e){return this._servedModernEra()?e.mcpReq.envelope?.[Js]:this._clientCapabilities}_assertPushApiInServedEra(e){if(this._servedModernEra())throw new Ye(tt.MethodNotSupportedByProtocolVersion,`Server-to-client requests are not available on protocol revision ${this._negotiatedProtocolVersion}: '${e}' cannot be sent while serving a request on that revision. Return inputRequired({ ... }) from the handler instead — the client fulfils the embedded requests and retries the original request (multi round-trip requests).`,{method:e,era:"2026-07-28"})}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Ye(tt.CapabilityNotSupported,`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Ye(tt.CapabilityNotSupported,`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Ye(tt.CapabilityNotSupported,`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Ye(tt.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Ye(tt.CapabilityNotSupported,`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Ye(tt.CapabilityNotSupported,`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Ye(tt.CapabilityNotSupported,`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Ye(tt.CapabilityNotSupported,`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Ye(tt.CapabilityNotSupported,`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Ye(tt.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Ye(tt.CapabilityNotSupported,`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Ye(tt.CapabilityNotSupported,`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Ye(tt.CapabilityNotSupported,`Server does not support tools (required for ${e})`);break;case"ping":case"initialize":break}}async _oninitialize(e){let t=e.params.protocolVersion;this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo;let r=_1(this._supportedProtocolVersions),n=r.includes(t)?t:r[0]??iu;return this._negotiatedProtocolVersion=n,this.transport?.setProtocolVersion?.(n),{protocolVersion:n,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:Kp(this._supportedProtocolVersions),capabilities:D$(this.getCapabilities()),...this._instructions&&{instructions:this._instructions}}}_outboundServerInfo(){return this._serverInfo}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}projectCallToolResult(e,t){return this._wireCodec().projectCallToolResult(e,t)}getCapabilities(){return this._capabilities}async ping(){return this._assertPushApiInServedEra("ping"),this.request({method:"ping"})}async createMessage(e,t){if(this._assertPushApiInServedEra("sampling/createMessage"),(e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Ye(tt.CapabilityNotSupported,"Client does not support sampling tools capability.");if(e.messages.length>0){let i=e.messages.at(-1),s=Array.isArray(i.content)?i.content:[i.content],l=s.some((f)=>f.type==="tool_result"),a=e.messages.length>1?e.messages.at(-2):void 0,c=a?Array.isArray(a.content)?a.content:[a.content]:[],u=c.some((f)=>f.type==="tool_use");if(l){if(s.some((f)=>f.type!=="tool_result"))throw new Le(Te.InvalidParams,"The last message must contain only tool_result content if any is present");if(!u)throw new Le(Te.InvalidParams,"tool_result blocks are not matching any tool_use from the previous message")}if(u){let f=new Set(c.filter((g)=>g.type==="tool_use").map((g)=>g.id)),h=new Set(s.filter((g)=>g.type==="tool_result").map((g)=>g.toolUseId));if(f.size!==h.size||![...f].every((g)=>h.has(g)))throw new Le(Te.InvalidParams,"ids of tool_result blocks and tool_use blocks from previous message do not match")}}let r=Boolean(e.tools||e.toolChoice),n=await this.request({method:"sampling/createMessage",params:e},t),o=this._wireCodec().samplingResultVariant(r,n);if(!o.ok)throw new Ye(tt.InvalidResult,`Invalid sampling/createMessage result: ${o.reason==="invalid"?o.message:o.reason}`);return o.value}async elicitInput(e,t){switch(this._assertPushApiInServedEra("elicitation/create"),e.mode??"form"){case"url":if(!this._clientCapabilities?.elicitation?.url)throw new Ye(tt.CapabilityNotSupported,"Client does not support url elicitation.");break;case"form":if(!this._clientCapabilities?.elicitation?.form)throw new Ye(tt.CapabilityNotSupported,"Client does not support form elicitation.");break}return this._sendElicitationLeg(e,t)}async _sendElicitationLeg(e,t,r){let n=e.mode??"form",o=r?.validateAcceptedContent??!0;switch(n){case"url":{let i=e;return this.request({method:"elicitation/create",params:i},t)}case"form":{let i=e.mode==="form"?e:{...e,mode:"form"},s=await this.request({method:"elicitation/create",params:i},t);if(o&&s.action==="accept"&&s.content&&i.requestedSchema)try{let l=this._jsonSchemaValidator.getValidator(i.requestedSchema)(s.content);if(!l.valid)throw new Le(Te.InvalidParams,`Elicitation response content does not match requested schema: ${l.errorMessage}`)}catch(l){if(l instanceof Le)throw l;throw new Le(Te.InternalError,`Error validating elicitation response: ${l instanceof Error?l.message:String(l)}`)}return s}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw new Ye(tt.CapabilityNotSupported,"Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this._assertPushApiInServedEra("roots/list"),this.request({method:"roots/list",params:e},t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};function D$(e){return{...e}}function $$(e,t){let r=0,n=[e];while(n.length>0){let o=n.pop();if(o===null||typeof o!=="object")continue;if(Array.isArray(o))for(let i of o){if(++r>t)return r;if(i!==null&&typeof i==="object")n.push(i)}else for(let i in o){if(!Object.prototype.hasOwnProperty.call(o,i))continue;if(++r>t)return r;let s=o[i];if(s!==null&&typeof s==="object")n.push(s)}}return r}function x$(e){if(e===void 0||e===1/0)return;if(typeof e!=="number"||Number.isNaN(e)||e<1)throw RangeError(`maxToolInputElements must be a number of at least 1, or Infinity, got ${String(e)}`);return e}var NE=class{server;_maxToolInputElements;_registeredResources={};_registeredResourceTemplates={};_registeredTools={};_registeredPrompts={};_toolInputSchemaJson={};toolInputSchemaJson(e){let t=this._registeredTools[e];if(t===void 0||!t.enabled)return;if(Object.hasOwn(this._toolInputSchemaJson,e))return this._toolInputSchemaJson[e];if(t.inputSchema===void 0)return mh;try{let r=xi(t.inputSchema,"input");return this._toolInputSchemaJson[e]=r,r}catch{return}}constructor(e,t){if(this.server=new M$(e,t),this._maxToolInputElements=x$(t?.maxToolInputElements),t?.capabilities?.tools)this.setToolRequestHandlers();if(t?.capabilities?.resources)this.setResourceRequestHandlers();if(t?.capabilities?.prompts)this.setPromptRequestHandlers()}async connect(e){if(w$(e))e.setScopeChallengeResolver((t)=>this.resolveScopeChallenge(t));return await this.server.connect(e)}async close(){await this.server.close()}resolveScopeChallenge=(e)=>{switch(e.request.method){case"tools/call":{let t=e.request.params?.name;if(typeof t!=="string")return;let r=this._registeredTools[t];if(r===void 0||!r.enabled)return;return r.scopeChallenge?.(e)}case"resources/read":{let t=e.request.params?.uri;if(typeof t!=="string")return;let r;try{r=new URL(t)}catch{return}let n=this._registeredResources[r.toString()];if(n!==void 0)return n.enabled?n.scopeChallenge?.(e):void 0;for(let o of Object.values(this._registeredResourceTemplates))if(o.resourceTemplate.uriTemplate.match(r.toString()))return o.enabled?o.scopeChallenge?.(e):void 0;return}case"prompts/get":{let t=e.request.params?.name;if(typeof t!=="string")return;let r=this._registeredPrompts[t];if(r===void 0||!r.enabled)return;return r.scopeChallenge?.(e)}default:return}};_toolHandlersInitialized=!1;setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler("tools/list"),this.server.assertCanSetRequestHandler("tools/call"),this.server.registerCapabilities({tools:{listChanged:this.server.getCapabilities().tools?.listChanged??!0}}),this.server.setRequestHandler("tools/list",()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let r={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?L$(e,t.inputSchema):mh,annotations:t.annotations,icons:t.icons,execution:t.execution,_meta:t._meta};if(t.outputSchema)r.outputSchema=xi(t.outputSchema,"output");return r})})),this.server.setRequestHandler("tools/call",async(e,t)=>{let r=this._registeredTools[e.params.name];if(!r)throw new Le(Te.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new Le(Te.InvalidParams,`Tool ${e.params.name} disabled`);try{let n=await this.validateToolInput(r,e.params.arguments,e.params.name),o=await this.executeToolHandler(r,n,t);if(await this.validateToolOutput(r,o,e.params.name),ko(o))return o;return this.server.projectCallToolResult(o,r.outputSchemaJson)}catch(n){if(n instanceof Le&&n.code===Te.UrlElicitationRequired)throw n;return this.createToolError(n instanceof Error?n.message:String(n))}}),this._toolHandlersInitialized=!0}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,t,r){if(this._maxToolInputElements!==void 0&&$$(t,this._maxToolInputElements)>this._maxToolInputElements)throw new Le(Te.InvalidParams,`Invalid arguments for tool ${r}: arguments contain more than the maximum of ${this._maxToolInputElements} elements`);if(!e.inputSchema)return;let n=await Ri(e.inputSchema,t??{});if(!n.success)throw new Le(Te.InvalidParams,`Input validation error: Invalid arguments for tool ${r}: ${n.error}`);return n.data}async validateToolOutput(e,t,r){if(!e.outputSchema)return;if(ko(t))return;if(t.isError)return;if(t.structuredContent===void 0)throw new Le(Te.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let n=await Ri(e.outputSchema,t.structuredContent);if(!n.success)throw new Le(Te.InvalidParams,`Output validation error: Invalid structured content for tool ${r}: ${n.error}`)}async executeToolHandler(e,t,r){return e.executor(t,r)}_completionHandlerInitialized=!1;setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler("completion/complete"),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler("completion/complete",async(e)=>{switch(e.params.ref.type){case"ref/prompt":return rM(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return nM(e),this.handleResourceCompletion(e,e.params.ref);default:throw new Le(Te.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion(e,t){let r=this._registeredPrompts[t.name];if(!r)throw new Le(Te.InvalidParams,`Prompt ${t.name} not found`);if(!r.enabled)throw new Le(Te.InvalidParams,`Prompt ${t.name} disabled`);if(!r.argsSchema)return gs;let n=Sh(yh(r.argsSchema)?.[e.params.argument.name]);if(!fh(n))return gs;let o=g$(n);if(!o)return gs;return _h(await o(e.params.argument.value,e.params.context))}async handleResourceCompletion(e,t){let r=Object.values(this._registeredResourceTemplates).find((o)=>o.resourceTemplate.uriTemplate.toString()===t.uri);if(!r){if(this._registeredResources[t.uri])return gs;throw new Le(Te.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let n=r.resourceTemplate.completeCallback(e.params.argument.name);if(!n)return gs;return _h(await n(e.params.argument.value,e.params.context))}_resourceHandlersInitialized=!1;setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler("resources/list"),this.server.assertCanSetRequestHandler("resources/templates/list"),this.server.assertCanSetRequestHandler("resources/read"),this.server.registerCapabilities({resources:{listChanged:this.server.getCapabilities().resources?.listChanged??!0}}),this.server.setRequestHandler("resources/list",async(e,t)=>{let r=Object.entries(this._registeredResources).filter(([o,i])=>i.enabled).map(([o,i])=>({uri:o,name:i.name,...i.metadata})),n=[];for(let o of Object.values(this._registeredResourceTemplates)){if(!o.resourceTemplate.listCallback)continue;let i=await o.resourceTemplate.listCallback(t);for(let s of i.resources)n.push({...o.metadata,...s})}return{resources:[...r,...n]}}),this.server.setRequestHandler("resources/templates/list",async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([e,t])=>({name:e,uriTemplate:t.resourceTemplate.uriTemplate.toString(),...t.metadata}))})),this.server.setRequestHandler("resources/read",async(e,t)=>{let r;try{r=new URL(e.params.uri)}catch{throw new Le(Te.InvalidParams,`Resource URI ${e.params.uri} is invalid`,{uri:e.params.uri,reason:"invalid_uri"})}let n=this._registeredResources[r.toString()];if(n){if(!n.enabled)throw new Le(Te.InvalidParams,`Resource ${r} disabled`);return lu(await n.readCallback(r,t),n.cacheHint)}for(let o of Object.values(this._registeredResourceTemplates)){let i=o.resourceTemplate.uriTemplate.match(r.toString());if(i){if(!o.enabled)throw new Le(Te.InvalidParams,`Resource template ${o.resourceTemplate.uriTemplate} disabled`);return lu(await o.readCallback(r,i,t),o.cacheHint)}}throw new zS(e.params.uri)}),this._resourceHandlersInitialized=!0}_promptHandlersInitialized=!1;setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler("prompts/list"),this.server.assertCanSetRequestHandler("prompts/get"),this.server.registerCapabilities({prompts:{listChanged:this.server.getCapabilities().prompts?.listChanged??!0}}),this.server.setRequestHandler("prompts/list",()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>({name:e,title:t.title,description:t.description,arguments:t.argsSchema?gM(t.argsSchema):void 0,icons:t.icons,_meta:t._meta}))})),this.server.setRequestHandler("prompts/get",async(e,t)=>{let r=this._registeredPrompts[e.params.name];if(!r)throw new Le(Te.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new Le(Te.InvalidParams,`Prompt ${e.params.name} disabled`);return r.handler(e.params.arguments,t)}),this._promptHandlersInitialized=!0}registerResource(e,t,r,n){let{cacheHint:o,scopeChallenge:i,...s}=r,l=s;if(o!==void 0)HS(o,`resource ${e}`);if(typeof t==="string"){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let a=this._createRegisteredResource(e,r.title,t,l,i,n);if(o!==void 0)a.cacheHint=o;return this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let a=this._createRegisteredResourceTemplate(e,r.title,t,l,i,n);if(o!==void 0)a.cacheHint=o;return this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}}_createRegisteredResource(e,t,r,n,o,i){let s={name:e,title:t,metadata:n,readCallback:i,scopeChallenge:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({uri:null}),update:(l)=>{if(l.uri!==void 0&&l.uri!==r){if(delete this._registeredResources[r],l.uri)this._registeredResources[l.uri]=s}if(l.name!==void 0)s.name=l.name;if(l.title!==void 0)s.title=l.title;if(l.metadata!==void 0)s.metadata=l.metadata;if(l.callback!==void 0)s.readCallback=l.callback;if(l.scopeChallenge!==void 0)s.scopeChallenge=l.scopeChallenge===null?void 0:l.scopeChallenge;if(l.enabled!==void 0)s.enabled=l.enabled;this.sendResourceListChanged()}};return this._registeredResources[r]=s,s}_createRegisteredResourceTemplate(e,t,r,n,o,i){let s={resourceTemplate:r,title:t,metadata:n,readCallback:i,scopeChallenge:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:(a)=>{if(a.name!==void 0&&a.name!==e){if(delete this._registeredResourceTemplates[e],a.name)this._registeredResourceTemplates[a.name]=s}if(a.title!==void 0)s.title=a.title;if(a.template!==void 0)s.resourceTemplate=a.template;if(a.metadata!==void 0)s.metadata=a.metadata;if(a.callback!==void 0)s.readCallback=a.callback;if(a.scopeChallenge!==void 0)s.scopeChallenge=a.scopeChallenge===null?void 0:a.scopeChallenge;if(a.enabled!==void 0)s.enabled=a.enabled;this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=s;let l=r.uriTemplate.variableNames;if(Array.isArray(l)&&l.some((a)=>!!r.completeCallback(a)))this.setCompletionRequestHandler();return s}_createRegisteredPrompt(e,t,r,n,o,i,s,l){let a=n,c=o,u={title:t,description:r,argsSchema:n,icons:i,scopeChallenge:s,_meta:l,handler:vh(e,n,o),enabled:!0,disable:()=>u.update({enabled:!1}),enable:()=>u.update({enabled:!0}),remove:()=>u.update({name:null}),update:(f)=>{if(f.name!==void 0&&f.name!==e){if(delete this._registeredPrompts[e],f.name)this._registeredPrompts[f.name]=u}if(f.title!==void 0)u.title=f.title;if(f.description!==void 0)u.description=f.description;if(f.icons!==void 0)u.icons=f.icons;if(f.scopeChallenge!==void 0)u.scopeChallenge=f.scopeChallenge===null?void 0:f.scopeChallenge;if(f._meta!==void 0)u._meta=f._meta;let h=!1;if(f.argsSchema!==void 0)u.argsSchema=f.argsSchema,a=f.argsSchema,h=!0;if(f.callback!==void 0)c=f.callback,h=!0;if(h)u.handler=vh(e,a,c);if(f.enabled!==void 0)u.enabled=f.enabled;this.sendPromptListChanged()}};if(this._registeredPrompts[e]=u,n){let f=yh(n);if(f){if(Object.values(f).some((h)=>fh(Sh(h))))this.setCompletionRequestHandler()}}return u}_createRegisteredTool(e,t,r,n,o,i,s,l,a,c,u){ch(e);let f=u,h,g={title:t,description:r,inputSchema:n,outputSchema:o,get outputSchemaJson(){return h??=gh(g.outputSchema)},set outputSchemaJson(p){h=p},annotations:i,icons:s,execution:l,scopeChallenge:a,_meta:c,handler:u,executor:hh(n,u),enabled:!0,disable:()=>g.update({enabled:!1}),enable:()=>g.update({enabled:!0}),remove:()=>g.update({name:null}),update:(p)=>{if(p.name!==void 0&&p.name!==e){if(typeof p.name==="string")ch(p.name);if(delete this._registeredTools[e],delete this._toolInputSchemaJson[e],p.name)delete this._toolInputSchemaJson[p.name],this._registeredTools[p.name]=g,e=p.name}if(p.title!==void 0)g.title=p.title;if(p.description!==void 0)g.description=p.description;let _=!1;if(p.paramsSchema!==void 0)g.inputSchema=p.paramsSchema,delete this._toolInputSchemaJson[e],_=!0;if(p.callback!==void 0)g.handler=p.callback,f=p.callback,_=!0;if(_)g.executor=hh(g.inputSchema,f);if(p.outputSchema!==void 0)g.outputSchema=p.outputSchema,g.outputSchemaJson=gh(p.outputSchema);if(p.annotations!==void 0)g.annotations=p.annotations;if(p.icons!==void 0)g.icons=p.icons;if(p.scopeChallenge!==void 0)g.scopeChallenge=p.scopeChallenge===null?void 0:p.scopeChallenge;if(p._meta!==void 0)g._meta=p._meta;if(p.enabled!==void 0)g.enabled=p.enabled;this.sendToolListChanged()}};return this._registeredTools[e]=g,this.setToolRequestHandlers(),this.sendToolListChanged(),g}registerTool(e,t,r){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let{title:n,description:o,inputSchema:i,outputSchema:s,annotations:l,icons:a,scopeChallenge:c,_meta:u}=t;return this._createRegisteredTool(e,n,o,Lc(i),Lc(s),l,a,void 0,c,u,r)}registerPrompt(e,t,r){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let{title:n,description:o,argsSchema:i,icons:s,scopeChallenge:l,_meta:a}=t,c=this._createRegisteredPrompt(e,n,o,Lc(i),r,s,l,a);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),c}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){if(this.isConnected())this.server.sendResourceListChanged()}sendToolListChanged(){if(this.isConnected())this.server.sendToolListChanged()}sendPromptListChanged(){if(this.isConnected())this.server.sendPromptListChanged()}};function hh(e,t){if(e){let n=t;return async(o,i)=>n(o,i)}let r=t;return async(n,o)=>r(o)}var mh={type:"object",properties:{}};function L$(e,t){let r=xi(t,"input"),n=sM(r);if(!n.valid)console.warn(`[mcp-sdk] tool '${e}' carries an invalid x-mcp-header declaration and will be excluded by conforming Streamable HTTP clients: ${n.reason}`);return r}function gh(e){if(e===void 0)return;try{return xi(e,"output")}catch{return}}function vh(e,t,r){if(t){let n=r;return async(o,i)=>{let s=await Ri(t,o??{});if(!s.success)throw new Le(Te.InvalidParams,`Invalid arguments for prompt ${e}: ${s.error}`);return n(s.data,i)}}else{let n=r;return async(o,i)=>n(i)}}function _h(e){return{completion:{values:e.map(String).slice(0,100),total:e.length,hasMore:e.length>100}}}var gs={completion:{values:[],hasMore:!1}};function yh(e){let t=e;if(t.shape&&typeof t.shape==="object")return t.shape}function q$(e){return e?.type==="optional"}function Sh(e){if(!q$(e))return e;return e.def?.innerType??e}var Eh=Symbol("swallowsErrorsAfterClose"),U$=class{_readBuffer;_started=!1;_closed=!1;constructor(e=dh.stdin,t=dh.stdout,r){this._stdin=e,this._stdout=t,this._readBuffer=new zM({maxBufferSize:r?.maxBufferSize})}onclose;onerror;onmessage;_ondata=(e)=>{try{this._readBuffer.append(e),this.processReadBuffer()}catch(t){this.onerror?.(t),this.close().catch(()=>{})}};_onerror=(e)=>{this.onerror?.(e)};_onstdouterror=(e)=>{if(this._closed)return;this.onerror?.(e),this.close().catch(()=>{})};_onstdinclose=()=>{this.close().catch(()=>{})};async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0;for(let e of this._stdout.listeners("error"))if(e[Eh])this._stdout.off("error",e);if(this._stdin.readableEnded||this._stdin.destroyed)setImmediate(this._onstdinclose);this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror),this._stdin.on("end",this._onstdinclose),this._stdin.on("close",this._onstdinclose),this._stdout.on("error",this._onstdouterror)}processReadBuffer(){while(!0)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){if(this._closed)return;if(this._closed=!0,this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.off("end",this._onstdinclose),this._stdin.off("close",this._onstdinclose),this._onstdouterror[Eh]=!0,this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(e){if(this._closed)return Promise.reject(Error("StdioServerTransport is closed"));return new Promise((t,r)=>{let n=jM(e),o=!1,i=(l)=>{if(o)return;o=!0,this._stdout.off("error",i),this._stdout.off("drain",s),r(l)},s=()=>{if(o)return;o=!0,this._stdout.off("error",i),this._stdout.off("drain",s),t()};if(this._stdout.once("error",i),this._stdout.write(n)){if(o)return;o=!0,this._stdout.off("error",i),t()}else if(!o)this._stdout.once("drain",s)})}},bh=3000,F$=class{onclose;onerror;onmessage;_closed=!1;_pendingRequests=new Set;_drainWaiters=[];constructor(e,t,r){this._wire=e,this._onInstanceClose=t,this._outboundIntercept=r}async start(){}async send(e,t){if(cu(e)||ZS(e)){let{id:r}=e;if(r!==void 0)this._settle(r)}if(this._closed)return;if(this._outboundIntercept?.(e)==="handled")return;return this._wire.send(e,t)}setProtocolVersion=(e)=>{this._wire.setProtocolVersion?.(e)};deliver(e,t){if(this._closed)return;if(sn(e))this._pendingRequests.add(e.id);else if(Ei(e)&&e.method==="notifications/cancelled"){let r=e.params?.requestId;if(r!==void 0)this._settle(r)}this.onmessage?.(e,t)}async whenRequestsAnswered(e){if(this._closed||this._pendingRequests.size===0)return!0;return await new Promise((t)=>{let r=()=>{clearTimeout(n),t(!0)},n=setTimeout(()=>{this._drainWaiters=this._drainWaiters.filter((o)=>o!==r),t(!1)},e);this._drainWaiters.push(r)})}async close(){if(this._closed)return;this._closed=!0,this._pendingRequests.clear(),this._releaseDrainWaiters();try{this._onInstanceClose()}finally{this.onclose?.()}}_settle(e){if(this._pendingRequests.delete(e),this._pendingRequests.size===0)this._releaseDrainWaiters()}_releaseDrainWaiters(){let e=this._drainWaiters;this._drainWaiters=[];for(let t of e)t()}};function G$(e){let t=e.params;if(e.method==="initialize"&&!QS(t)){let i=t!==null&&typeof t==="object"&&typeof t.protocolVersion==="string"?t.protocolVersion:void 0;return{kind:"legacy",reason:"initialize",...i!==void 0&&{requestedVersion:i}}}if(!qd(t))return{kind:"legacy",reason:"no-claim"};let r=Ys(t),n=(r===void 0?[]:Fd(r))[0];if(n!==void 0)return{kind:"invalid-envelope",issue:n};let o=Ud(t);if(o===void 0||!_i.includes(o))return{kind:"unsupported-revision",requested:o??"unknown"};return{kind:"modern",revision:o,classification:{era:"modern",revision:o}}}function B$(e,t={}){let r=t.legacy??"serve",n=t.transport??new U$,o={phase:"opening"},i,s=!1,l=()=>s||o.phase==="closed",a=(A)=>{try{t.onerror?.(A)}catch{}},c=(A,P,D,N)=>n.send({jsonrpc:"2.0",id:A,error:{code:P,message:D,...N!==void 0&&{data:N}}}).catch((F)=>a(zr(F))),u=new E$(t.maxSubscriptions??AE),f=(A)=>{if(!Ei(A))return;let P=u.routeOutbound(A);if(P==="passthrough")return;for(let D of P)n.send({jsonrpc:"2.0",...D}).catch((N)=>a(zr(N)));return"handled"},h=async(A)=>{if(sn(A)&&A.method==="subscriptions/listen"){let P=Ys(A.params),D=qd(A.params)?(P===void 0?[]:Fd(P))[0]:{key:"_meta",problem:"the per-request envelope is required on protocol revision 2026-07-28"},N=Ud(A.params),F;if(D!==void 0)F={jsonrpc:"2.0",id:A.id,error:{code:-32602,message:`Invalid _meta envelope: ${D.key}: ${D.problem}`}};else if(N===void 0||!_i.includes(N)){let G=new ul({supported:[..._i],requested:N??"unknown"});F={jsonrpc:"2.0",id:A.id,error:{code:G.code,message:G.message,data:G.data}}}else F=u.serve(A);return await n.send("error"in F?F:{jsonrpc:"2.0",method:F.method,params:F.params}).catch((G)=>a(zr(G))),!0}if(Ei(A)&&A.method==="notifications/cancelled"){let P=A.params?.requestId;if(P!==void 0&&u.cancel(P))return!0}return!1},g=(A,P,D)=>{let N=cM({kind:"legacy",reason:P,...D!==void 0&&{requestedVersion:D}},_i);if(N===void 0)return Promise.resolve();return a(Error(`Rejected 2025-era request on a modern-only stdio connection (${N.cell}): ${N.message}`)),c(A.id,N.code,N.message,N.data)},p=(A)=>{if(s||A===i)return;T()},_=async(A,P)=>{let D=await e({era:A}),N=D instanceof NE?D.server:D;if(A==="modern")LM(N,P),N$(N,_i),u.setServerCapabilities(N.getCapabilities(),O$(N));let F=new F$(n,()=>p(F),A==="modern"?f:void 0);return await D.connect(F),{product:D,channel:F}},y=(A)=>A.product.close().catch((P)=>a(zr(P))),S=async(A)=>{i=A.channel;try{if(!await A.channel.whenRequestsAnswered(bh))a(Error(`Discarded the probe instance with requests still unanswered after ${bh}ms; continuing with the fallback`));await A.product.close()}catch(P){a(zr(P))}finally{i=void 0}},E=async(A)=>{if(o.phase==="closed")return;if(o.phase==="pinned"){if(o.era==="modern"&&sn(A)&&A.method==="initialize"&&!QS(A.params)){await g(A,"initialize",A.params!==null&&typeof A.params==="object"&&typeof A.params.protocolVersion==="string"?A.params.protocolVersion:void 0);return}if(o.era==="modern"&&await h(A))return;if(l())return;o.instance.channel.deliver(A);return}if(!sn(A)&&!Ei(A)){a(Error("Discarded a JSON-RPC response received before the connection negotiated an era"));return}let P=G$(A);switch(P.kind){case"invalid-envelope":{let D=`Invalid _meta envelope for protocol revision 2026-07-28: ${P.issue.key}: ${P.issue.problem}`;if(sn(A))await c(A.id,Te.InvalidParams,D,{envelope:P.issue});else a(Error(`Discarded a notification with a malformed envelope: ${D}`));return}case"unsupported-revision":if(sn(A)){let D=new ul({supported:[..._i],requested:P.requested});a(D),await c(A.id,D.code,D.message,D.data)}else a(Error(`Discarded a notification claiming unsupported protocol revision ${P.requested}`));return;case"modern":if(sn(A)&&A.method==="server/discover"){if(o.phase==="probe"){o.instance.channel.deliver(A,{classification:P.classification});return}let D=await _("modern",P.revision);if(l()){await y(D);return}o={phase:"probe",instance:D},D.channel.deliver(A,{classification:P.classification});return}if(o.phase==="probe"){if(Ei(A)){o.instance.channel.deliver(A,{classification:P.classification});return}o={phase:"pinned",era:"modern",instance:o.instance}}else{let D=await _("modern",P.revision);if(l()){await y(D);return}o={phase:"pinned",era:"modern",instance:D}}if(await h(A))return;if(l())return;o.instance.channel.deliver(A,{classification:P.classification});return;case"legacy":{if(r==="reject"){if(sn(A))await g(A,P.reason,P.requestedVersion);return}if(o.phase==="probe"){if(await S(o.instance),l())return;o={phase:"opening"}}let D=await _("legacy");if(l()){await y(D);return}o={phase:"pinned",era:"legacy",instance:D},o.instance.channel.deliver(A);return}}},b=[],R=!1,w=async()=>{if(R)return;R=!0;try{while(b.length>0){let A=b.shift();try{await E(A)}catch(P){if(sn(A))await c(A.id,Te.InternalError,"Internal server error");a(zr(P))}}}finally{R=!1}},T=async()=>{if(s||o.phase==="closed")return;s=!0;let A=o;o={phase:"closed"};for(let P of u.teardownAll())await n.send(P).catch((D)=>a(zr(D)));if(A.phase==="probe"||A.phase==="pinned")await A.instance.product.close().catch((P)=>a(zr(P)));await n.close().catch((P)=>a(zr(P)))};n.onmessage=(A)=>{b.push(A),w()},n.onerror=(A)=>{if(a(A),o.phase==="probe"||o.phase==="pinned")o.instance.channel.onerror?.(A)},n.onclose=()=>{if(s||o.phase==="closed")return;s=!0;let A=o;if(o={phase:"closed"},A.phase==="probe"||A.phase==="pinned")A.instance.product.close().catch((P)=>a(zr(P)))};let C=n.start().catch((A)=>{throw a(zr(A)),A});return C.catch(()=>{}),{close:async()=>{await C.catch(()=>{}),await T()}}}function zr(e){return e instanceof Error?e:Error(String(e))}var H$=Cr(dC(),1),z$=Cr(AR(),1),Ej=Cr(kR(),1),bj=Cr(xu(),1),wj=Cr(Vs(),1),Tj=Cr(Xv(),1),Cj=Cr(Yv(),1),Rj=Cr(Zv(),1),K$=Cr(Lu(),1),Aj=Cr(NR(),1),X$=void 0,Y$=void 0;function Z$(){return{geminiUrl:X$,vertexUrl:Y$}}function Q$(e,t,r,n){var o,i;if(!(e===null||e===void 0?void 0:e.baseUrl)){let s=Z$();if(t)return(o=s.vertexUrl)!==null&&o!==void 0?o:r;else return(i=s.geminiUrl)!==null&&i!==void 0?i:n}return e.baseUrl}var Un=class{};function Ae(e,t){let r=/\{([^}]+)\}/g;return e.replace(r,(n,o)=>{if(Object.prototype.hasOwnProperty.call(t,o)){let i=t[o];return i!==void 0&&i!==null?String(i):""}else throw Error(`Key '${o}' not found in valueMap.`)})}function m(e,t,r){for(let i=0;i<t.length-1;i++){let s=t[i];if(s.endsWith("[]")){let l=s.slice(0,-2);if(!(l in e))if(Array.isArray(r))e[l]=Array.from({length:r.length},()=>({}));else throw Error(`Value must be a list given an array path ${s}`);if(Array.isArray(e[l])){let a=e[l];if(Array.isArray(r))for(let c=0;c<a.length;c++){let u=a[c];m(u,t.slice(i+1),r[c])}else for(let c of a)m(c,t.slice(i+1),r)}return}else if(s.endsWith("[0]")){let l=s.slice(0,-3);if(!(l in e))e[l]=[{}];let a=e[l];m(a[0],t.slice(i+1),r);return}if(!e[s]||typeof e[s]!=="object")e[s]={};e=e[s]}let n=t[t.length-1],o=e[n];if(o!==void 0){if(!r||typeof r==="object"&&Object.keys(r).length===0)return;if(r===o)return;if(typeof o==="object"&&typeof r==="object"&&o!==null&&r!==null)Object.assign(o,r);else throw Error(`Cannot set value for an existing key. Key: ${n}`)}else if(n==="_self"&&typeof r==="object"&&r!==null&&!Array.isArray(r))Object.assign(e,r);else e[n]=r}function d(e,t,r=void 0){try{if(t.length===1&&t[0]==="_self")return e;for(let n=0;n<t.length;n++){if(typeof e!=="object"||e===null)return r;let o=t[n];if(o.endsWith("[]")){let i=o.slice(0,-2);if(i in e){let s=e[i];if(!Array.isArray(s))return r;return s.map((l)=>d(l,t.slice(n+1),r))}else return r}else e=e[o]}return e}catch(n){if(n instanceof TypeError)return r;throw n}}function ex(e,t){for(let[r,n]of Object.entries(t)){let o=r.split("."),i=n.split("."),s=new Set,l=-1;for(let a=0;a<o.length;a++)if(o[a]==="*"){l=a;break}if(l!==-1&&i.length>l)for(let a=l;a<i.length;a++){let c=i[a];if(c!=="*"&&!c.endsWith("[]")&&!c.endsWith("[0]"))s.add(c)}fu(e,o,i,0,s)}}function fu(e,t,r,n,o){if(n>=t.length)return;if(typeof e!=="object"||e===null)return;let i=t[n];if(i.endsWith("[]")){let s=i.slice(0,-2),l=e;if(s in l&&Array.isArray(l[s]))for(let a of l[s])fu(a,t,r,n+1,o)}else if(i==="*"){if(typeof e==="object"&&e!==null&&!Array.isArray(e)){let s=e,l=Object.keys(s).filter((c)=>!c.startsWith("_")&&!o.has(c)),a={};for(let c of l)a[c]=s[c];for(let[c,u]of Object.entries(a)){let f=[];for(let h of r.slice(n))if(h==="*")f.push(c);else f.push(h);m(s,f,u)}for(let c of l)delete s[c]}}else{let s=e;if(i in s)fu(s[i],t,r,n+1,o)}}function Jd(e){if(typeof e!=="string")throw Error("fromImageBytes must be a string");return e}function tx(e){let t={},r=d(e,["operationName"]);if(r!=null)m(t,["operationName"],r);let n=d(e,["resourceName"]);if(n!=null)m(t,["_url","resourceName"],n);return t}function rx(e){let t={},r=d(e,["name"]);if(r!=null)m(t,["name"],r);let n=d(e,["metadata"]);if(n!=null)m(t,["metadata"],n);let o=d(e,["done"]);if(o!=null)m(t,["done"],o);let i=d(e,["error"]);if(i!=null)m(t,["error"],i);let s=d(e,["response","generateVideoResponse"]);if(s!=null)m(t,["response"],ox(s));return t}function nx(e){let t={},r=d(e,["name"]);if(r!=null)m(t,["name"],r);let n=d(e,["metadata"]);if(n!=null)m(t,["metadata"],n);let o=d(e,["done"]);if(o!=null)m(t,["done"],o);let i=d(e,["error"]);if(i!=null)m(t,["error"],i);let s=d(e,["response"]);if(s!=null)m(t,["response"],ix(s));return t}function ox(e){let t={},r=d(e,["generatedSamples"]);if(r!=null){let i=r;if(Array.isArray(i))i=i.map((s)=>sx(s));m(t,["generatedVideos"],i)}let n=d(e,["raiMediaFilteredCount"]);if(n!=null)m(t,["raiMediaFilteredCount"],n);let o=d(e,["raiMediaFilteredReasons"]);if(o!=null)m(t,["raiMediaFilteredReasons"],o);return t}function ix(e){let t={},r=d(e,["videos"]);if(r!=null){let i=r;if(Array.isArray(i))i=i.map((s)=>ax(s));m(t,["generatedVideos"],i)}let n=d(e,["raiMediaFilteredCount"]);if(n!=null)m(t,["raiMediaFilteredCount"],n);let o=d(e,["raiMediaFilteredReasons"]);if(o!=null)m(t,["raiMediaFilteredReasons"],o);return t}function sx(e){let t={},r=d(e,["video"]);if(r!=null)m(t,["video"],px(r));return t}function ax(e){let t={},r=d(e,["_self"]);if(r!=null)m(t,["video"],hx(r));return t}function lx(e){let t={},r=d(e,["operationName"]);if(r!=null)m(t,["_url","operationName"],r);return t}function cx(e){let t={},r=d(e,["operationName"]);if(r!=null)m(t,["_url","operationName"],r);return t}function ux(e){let t={},r=d(e,["name"]);if(r!=null)m(t,["name"],r);let n=d(e,["metadata"]);if(n!=null)m(t,["metadata"],n);let o=d(e,["done"]);if(o!=null)m(t,["done"],o);let i=d(e,["error"]);if(i!=null)m(t,["error"],i);let s=d(e,["response"]);if(s!=null)m(t,["response"],dx(s));return t}function dx(e){let t={},r=d(e,["sdkHttpResponse"]);if(r!=null)m(t,["sdkHttpResponse"],r);let n=d(e,["parent"]);if(n!=null)m(t,["parent"],n);let o=d(e,["documentName"]);if(o!=null)m(t,["documentName"],o);return t}function Kd(e){let t={},r=d(e,["name"]);if(r!=null)m(t,["name"],r);let n=d(e,["metadata"]);if(n!=null)m(t,["metadata"],n);let o=d(e,["done"]);if(o!=null)m(t,["done"],o);let i=d(e,["error"]);if(i!=null)m(t,["error"],i);let s=d(e,["response"]);if(s!=null)m(t,["response"],fx(s));return t}function fx(e){let t={},r=d(e,["sdkHttpResponse"]);if(r!=null)m(t,["sdkHttpResponse"],r);let n=d(e,["parent"]);if(n!=null)m(t,["parent"],n);let o=d(e,["documentName"]);if(o!=null)m(t,["documentName"],o);return t}function px(e){let t={},r=d(e,["uri"]);if(r!=null)m(t,["uri"],r);let n=d(e,["encodedVideo"]);if(n!=null)m(t,["videoBytes"],Jd(n));let o=d(e,["encoding"]);if(o!=null)m(t,["mimeType"],o);return t}function hx(e){let t={},r=d(e,["gcsUri"]);if(r!=null)m(t,["uri"],r);let n=d(e,["bytesBase64Encoded"]);if(n!=null)m(t,["videoBytes"],Jd(n));let o=d(e,["mimeType"]);if(o!=null)m(t,["mimeType"],o);return t}var wh;(function(e){e.MEDIA_PROCESSING_UNSPECIFIED="MEDIA_PROCESSING_UNSPECIFIED",e.STATIC="STATIC",e.AGENTIC="AGENTIC"})(wh||(wh={}));var Th;(function(e){e.OUTCOME_UNSPECIFIED="OUTCOME_UNSPECIFIED",e.OUTCOME_OK="OUTCOME_OK",e.OUTCOME_FAILED="OUTCOME_FAILED",e.OUTCOME_DEADLINE_EXCEEDED="OUTCOME_DEADLINE_EXCEEDED"})(Th||(Th={}));var Ch;(function(e){e.LANGUAGE_UNSPECIFIED="LANGUAGE_UNSPECIFIED",e.PYTHON="PYTHON"})(Ch||(Ch={}));var Rh;(function(e){e.SCHEDULING_UNSPECIFIED="SCHEDULING_UNSPECIFIED",e.SILENT="SILENT",e.WHEN_IDLE="WHEN_IDLE",e.INTERRUPT="INTERRUPT"})(Rh||(Rh={}));var co;(function(e){e.TYPE_UNSPECIFIED="TYPE_UNSPECIFIED",e.STRING="STRING",e.NUMBER="NUMBER",e.INTEGER="INTEGER",e.BOOLEAN="BOOLEAN",e.ARRAY="ARRAY",e.OBJECT="OBJECT",e.NULL="NULL"})(co||(co={}));var Ah;(function(e){e.AUTH_TYPE_UNSPECIFIED="AUTH_TYPE_UNSPECIFIED",e.NO_AUTH="NO_AUTH",e.API_KEY_AUTH="API_KEY_AUTH",e.HTTP_BASIC_AUTH="HTTP_BASIC_AUTH",e.GOOGLE_SERVICE_ACCOUNT_AUTH="GOOGLE_SERVICE_ACCOUNT_AUTH",e.OAUTH="OAUTH",e.OIDC_AUTH="OIDC_AUTH"})(Ah||(Ah={}));var Ih;(function(e){e.HTTP_IN_UNSPECIFIED="HTTP_IN_UNSPECIFIED",e.HTTP_IN_QUERY="HTTP_IN_QUERY",e.HTTP_IN_HEADER="HTTP_IN_HEADER",e.HTTP_IN_PATH="HTTP_IN_PATH",e.HTTP_IN_BODY="HTTP_IN_BODY",e.HTTP_IN_COOKIE="HTTP_IN_COOKIE"})(Ih||(Ih={}));var Ph;(function(e){e.API_SPEC_UNSPECIFIED="API_SPEC_UNSPECIFIED",e.SIMPLE_SEARCH="SIMPLE_SEARCH",e.ELASTIC_SEARCH="ELASTIC_SEARCH"})(Ph||(Ph={}));var kh;(function(e){e.ENVIRONMENT_UNSPECIFIED="ENVIRONMENT_UNSPECIFIED",e.ENVIRONMENT_BROWSER="ENVIRONMENT_BROWSER",e.ENVIRONMENT_MOBILE="ENVIRONMENT_MOBILE",e.ENVIRONMENT_DESKTOP="ENVIRONMENT_DESKTOP"})(kh||(kh={}));var Nh;(function(e){e.SAFETY_POLICY_UNSPECIFIED="SAFETY_POLICY_UNSPECIFIED",e.FINANCIAL_TRANSACTIONS="FINANCIAL_TRANSACTIONS",e.SENSITIVE_DATA_MODIFICATION="SENSITIVE_DATA_MODIFICATION",e.COMMUNICATION_TOOL="COMMUNICATION_TOOL",e.ACCOUNT_CREATION="ACCOUNT_CREATION",e.DATA_MODIFICATION="DATA_MODIFICATION",e.USER_CONSENT_MANAGEMENT="USER_CONSENT_MANAGEMENT",e.LEGAL_TERMS_AND_AGREEMENTS="LEGAL_TERMS_AND_AGREEMENTS"})(Nh||(Nh={}));var Oh;(function(e){e.PHISH_BLOCK_THRESHOLD_UNSPECIFIED="PHISH_BLOCK_THRESHOLD_UNSPECIFIED",e.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",e.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",e.BLOCK_HIGH_AND_ABOVE="BLOCK_HIGH_AND_ABOVE",e.BLOCK_HIGHER_AND_ABOVE="BLOCK_HIGHER_AND_ABOVE",e.BLOCK_VERY_HIGH_AND_ABOVE="BLOCK_VERY_HIGH_AND_ABOVE",e.BLOCK_ONLY_EXTREMELY_HIGH="BLOCK_ONLY_EXTREMELY_HIGH"})(Oh||(Oh={}));var Mh;(function(e){e.UNSPECIFIED="UNSPECIFIED",e.BLOCKING="BLOCKING",e.NON_BLOCKING="NON_BLOCKING"})(Mh||(Mh={}));var Dh;(function(e){e.MODE_UNSPECIFIED="MODE_UNSPECIFIED",e.MODE_DYNAMIC="MODE_DYNAMIC"})(Dh||(Dh={}));var $h;(function(e){e.THINKING_LEVEL_UNSPECIFIED="THINKING_LEVEL_UNSPECIFIED",e.MINIMAL="MINIMAL",e.LOW="LOW",e.MEDIUM="MEDIUM",e.HIGH="HIGH"})($h||($h={}));var xh;(function(e){e.DONT_ALLOW="DONT_ALLOW",e.ALLOW_ADULT="ALLOW_ADULT",e.ALLOW_ALL="ALLOW_ALL"})(xh||(xh={}));var Lh;(function(e){e.PROMINENT_PEOPLE_UNSPECIFIED="PROMINENT_PEOPLE_UNSPECIFIED",e.ALLOW_PROMINENT_PEOPLE="ALLOW_PROMINENT_PEOPLE",e.BLOCK_PROMINENT_PEOPLE="BLOCK_PROMINENT_PEOPLE"})(Lh||(Lh={}));var qh;(function(e){e.HARM_CATEGORY_UNSPECIFIED="HARM_CATEGORY_UNSPECIFIED",e.HARM_CATEGORY_HARASSMENT="HARM_CATEGORY_HARASSMENT",e.HARM_CATEGORY_HATE_SPEECH="HARM_CATEGORY_HATE_SPEECH",e.HARM_CATEGORY_SEXUALLY_EXPLICIT="HARM_CATEGORY_SEXUALLY_EXPLICIT",e.HARM_CATEGORY_DANGEROUS_CONTENT="HARM_CATEGORY_DANGEROUS_CONTENT",e.HARM_CATEGORY_CIVIC_INTEGRITY="HARM_CATEGORY_CIVIC_INTEGRITY",e.HARM_CATEGORY_JAILBREAK="HARM_CATEGORY_JAILBREAK",e.HARM_CATEGORY_IMAGE_HATE="HARM_CATEGORY_IMAGE_HATE",e.HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT="HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT",e.HARM_CATEGORY_IMAGE_HARASSMENT="HARM_CATEGORY_IMAGE_HARASSMENT",e.HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT="HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT"})(qh||(qh={}));var Uh;(function(e){e.HARM_BLOCK_METHOD_UNSPECIFIED="HARM_BLOCK_METHOD_UNSPECIFIED",e.SEVERITY="SEVERITY",e.PROBABILITY="PROBABILITY"})(Uh||(Uh={}));var Fh;(function(e){e.HARM_BLOCK_THRESHOLD_UNSPECIFIED="HARM_BLOCK_THRESHOLD_UNSPECIFIED",e.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",e.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",e.BLOCK_ONLY_HIGH="BLOCK_ONLY_HIGH",e.BLOCK_NONE="BLOCK_NONE",e.OFF="OFF"})(Fh||(Fh={}));var Gh;(function(e){e.MODE_UNSPECIFIED="MODE_UNSPECIFIED",e.AUTO="AUTO",e.ANY="ANY",e.NONE="NONE",e.VALIDATED="VALIDATED"})(Gh||(Gh={}));var Bh;(function(e){e.MODE_UNSPECIFIED="MODE_UNSPECIFIED",e.VERBATIM="VERBATIM",e.SMART="SMART"})(Bh||(Bh={}));var Hh;(function(e){e.FINISH_REASON_UNSPECIFIED="FINISH_REASON_UNSPECIFIED",e.STOP="STOP",e.MAX_TOKENS="MAX_TOKENS",e.SAFETY="SAFETY",e.RECITATION="RECITATION",e.LANGUAGE="LANGUAGE",e.OTHER="OTHER",e.BLOCKLIST="BLOCKLIST",e.PROHIBITED_CONTENT="PROHIBITED_CONTENT",e.SPII="SPII",e.MALFORMED_FUNCTION_CALL="MALFORMED_FUNCTION_CALL",e.IMAGE_SAFETY="IMAGE_SAFETY",e.UNEXPECTED_TOOL_CALL="UNEXPECTED_TOOL_CALL",e.TOO_MANY_TOOL_CALLS="TOO_MANY_TOOL_CALLS",e.IMAGE_PROHIBITED_CONTENT="IMAGE_PROHIBITED_CONTENT",e.NO_IMAGE="NO_IMAGE",e.IMAGE_RECITATION="IMAGE_RECITATION",e.IMAGE_OTHER="IMAGE_OTHER",e.CONTINUATION="CONTINUATION"})(Hh||(Hh={}));var zh;(function(e){e.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",e.NEGLIGIBLE="NEGLIGIBLE",e.LOW="LOW",e.MEDIUM="MEDIUM",e.HIGH="HIGH"})(zh||(zh={}));var Vh;(function(e){e.HARM_SEVERITY_UNSPECIFIED="HARM_SEVERITY_UNSPECIFIED",e.HARM_SEVERITY_NEGLIGIBLE="HARM_SEVERITY_NEGLIGIBLE",e.HARM_SEVERITY_LOW="HARM_SEVERITY_LOW",e.HARM_SEVERITY_MEDIUM="HARM_SEVERITY_MEDIUM",e.HARM_SEVERITY_HIGH="HARM_SEVERITY_HIGH"})(Vh||(Vh={}));var jh;(function(e){e.URL_RETRIEVAL_STATUS_UNSPECIFIED="URL_RETRIEVAL_STATUS_UNSPECIFIED",e.URL_RETRIEVAL_STATUS_SUCCESS="URL_RETRIEVAL_STATUS_SUCCESS",e.URL_RETRIEVAL_STATUS_ERROR="URL_RETRIEVAL_STATUS_ERROR",e.URL_RETRIEVAL_STATUS_PAYWALL="URL_RETRIEVAL_STATUS_PAYWALL",e.URL_RETRIEVAL_STATUS_UNSAFE="URL_RETRIEVAL_STATUS_UNSAFE"})(jh||(jh={}));var Wh;(function(e){e.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",e.SAFETY="SAFETY",e.OTHER="OTHER",e.BLOCKLIST="BLOCKLIST",e.PROHIBITED_CONTENT="PROHIBITED_CONTENT",e.IMAGE_SAFETY="IMAGE_SAFETY",e.MODEL_ARMOR="MODEL_ARMOR",e.JAILBREAK="JAILBREAK"})(Wh||(Wh={}));var Jh;(function(e){e.TRAFFIC_TYPE_UNSPECIFIED="TRAFFIC_TYPE_UNSPECIFIED",e.ON_DEMAND="ON_DEMAND",e.ON_DEMAND_PRIORITY="ON_DEMAND_PRIORITY",e.ON_DEMAND_FLEX="ON_DEMAND_FLEX",e.ON_DEMAND_OFFPEAK="ON_DEMAND_OFFPEAK",e.PROVISIONED_THROUGHPUT="PROVISIONED_THROUGHPUT"})(Jh||(Jh={}));var Kh;(function(e){e.MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",e.TEXT="TEXT",e.IMAGE="IMAGE",e.VIDEO="VIDEO",e.AUDIO="AUDIO",e.DOCUMENT="DOCUMENT"})(Kh||(Kh={}));var Xh;(function(e){e.MODEL_STAGE_UNSPECIFIED="MODEL_STAGE_UNSPECIFIED",e.UNSTABLE_EXPERIMENTAL="UNSTABLE_EXPERIMENTAL",e.EXPERIMENTAL="EXPERIMENTAL",e.PREVIEW="PREVIEW",e.STABLE="STABLE",e.LEGACY="LEGACY",e.DEPRECATED="DEPRECATED",e.RETIRED="RETIRED"})(Xh||(Xh={}));var Yh;(function(e){e.MEDIA_RESOLUTION_UNSPECIFIED="MEDIA_RESOLUTION_UNSPECIFIED",e.MEDIA_RESOLUTION_LOW="MEDIA_RESOLUTION_LOW",e.MEDIA_RESOLUTION_MEDIUM="MEDIA_RESOLUTION_MEDIUM",e.MEDIA_RESOLUTION_HIGH="MEDIA_RESOLUTION_HIGH"})(Yh||(Yh={}));var qs;(function(e){e.MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",e.TEXT="TEXT",e.IMAGE="IMAGE",e.AUDIO="AUDIO",e.VIDEO="VIDEO"})(qs||(qs={}));var Zh;(function(e){e.DELIVERY_UNSPECIFIED="DELIVERY_UNSPECIFIED",e.INLINE="INLINE",e.URI="URI"})(Zh||(Zh={}));var Qh;(function(e){e.ASPECT_RATIO_UNSPECIFIED="ASPECT_RATIO_UNSPECIFIED",e.ASPECT_RATIO_ONE_BY_ONE="ASPECT_RATIO_ONE_BY_ONE",e.ASPECT_RATIO_TWO_BY_THREE="ASPECT_RATIO_TWO_BY_THREE",e.ASPECT_RATIO_THREE_BY_TWO="ASPECT_RATIO_THREE_BY_TWO",e.ASPECT_RATIO_THREE_BY_FOUR="ASPECT_RATIO_THREE_BY_FOUR",e.ASPECT_RATIO_FOUR_BY_THREE="ASPECT_RATIO_FOUR_BY_THREE",e.ASPECT_RATIO_FOUR_BY_FIVE="ASPECT_RATIO_FOUR_BY_FIVE",e.ASPECT_RATIO_FIVE_BY_FOUR="ASPECT_RATIO_FIVE_BY_FOUR",e.ASPECT_RATIO_NINE_BY_SIXTEEN="ASPECT_RATIO_NINE_BY_SIXTEEN",e.ASPECT_RATIO_SIXTEEN_BY_NINE="ASPECT_RATIO_SIXTEEN_BY_NINE",e.ASPECT_RATIO_TWENTY_ONE_BY_NINE="ASPECT_RATIO_TWENTY_ONE_BY_NINE",e.ASPECT_RATIO_ONE_BY_EIGHT="ASPECT_RATIO_ONE_BY_EIGHT",e.ASPECT_RATIO_EIGHT_BY_ONE="ASPECT_RATIO_EIGHT_BY_ONE",e.ASPECT_RATIO_ONE_BY_FOUR="ASPECT_RATIO_ONE_BY_FOUR",e.ASPECT_RATIO_FOUR_BY_ONE="ASPECT_RATIO_FOUR_BY_ONE"})(Qh||(Qh={}));var em;(function(e){e.IMAGE_SIZE_UNSPECIFIED="IMAGE_SIZE_UNSPECIFIED",e.IMAGE_SIZE_FIVE_TWELVE="IMAGE_SIZE_FIVE_TWELVE",e.IMAGE_SIZE_ONE_K="IMAGE_SIZE_ONE_K",e.IMAGE_SIZE_TWO_K="IMAGE_SIZE_TWO_K",e.IMAGE_SIZE_FOUR_K="IMAGE_SIZE_FOUR_K"})(em||(em={}));var tm;(function(e){e.TUNING_MODE_UNSPECIFIED="TUNING_MODE_UNSPECIFIED",e.TUNING_MODE_FULL="TUNING_MODE_FULL",e.TUNING_MODE_PEFT_ADAPTER="TUNING_MODE_PEFT_ADAPTER"})(tm||(tm={}));var rm;(function(e){e.ADAPTER_SIZE_UNSPECIFIED="ADAPTER_SIZE_UNSPECIFIED",e.ADAPTER_SIZE_ONE="ADAPTER_SIZE_ONE",e.ADAPTER_SIZE_TWO="ADAPTER_SIZE_TWO",e.ADAPTER_SIZE_FOUR="ADAPTER_SIZE_FOUR",e.ADAPTER_SIZE_EIGHT="ADAPTER_SIZE_EIGHT",e.ADAPTER_SIZE_SIXTEEN="ADAPTER_SIZE_SIXTEEN",e.ADAPTER_SIZE_THIRTY_TWO="ADAPTER_SIZE_THIRTY_TWO"})(rm||(rm={}));var nm;(function(e){e.RESPONSE_PARSE_TYPE_UNSPECIFIED="RESPONSE_PARSE_TYPE_UNSPECIFIED",e.IDENTITY="IDENTITY",e.REGEX_EXTRACT="REGEX_EXTRACT"})(nm||(nm={}));var om;(function(e){e.MATCH_OPERATION_UNSPECIFIED="MATCH_OPERATION_UNSPECIFIED",e.REGEX_CONTAINS="REGEX_CONTAINS",e.PARTIAL_MATCH="PARTIAL_MATCH",e.EXACT_MATCH="EXACT_MATCH"})(om||(om={}));var im;(function(e){e.REINFORCEMENT_TUNING_THINKING_LEVEL_UNSPECIFIED="REINFORCEMENT_TUNING_THINKING_LEVEL_UNSPECIFIED",e.MINIMAL="MINIMAL",e.HIGH="HIGH"})(im||(im={}));var pu;(function(e){e.JOB_STATE_UNSPECIFIED="JOB_STATE_UNSPECIFIED",e.JOB_STATE_QUEUED="JOB_STATE_QUEUED",e.JOB_STATE_PENDING="JOB_STATE_PENDING",e.JOB_STATE_RUNNING="JOB_STATE_RUNNING",e.JOB_STATE_SUCCEEDED="JOB_STATE_SUCCEEDED",e.JOB_STATE_FAILED="JOB_STATE_FAILED",e.JOB_STATE_CANCELLING="JOB_STATE_CANCELLING",e.JOB_STATE_CANCELLED="JOB_STATE_CANCELLED",e.JOB_STATE_PAUSED="JOB_STATE_PAUSED",e.JOB_STATE_EXPIRED="JOB_STATE_EXPIRED",e.JOB_STATE_UPDATING="JOB_STATE_UPDATING",e.JOB_STATE_PARTIALLY_SUCCEEDED="JOB_STATE_PARTIALLY_SUCCEEDED"})(pu||(pu={}));var sm;(function(e){e.TUNING_JOB_STATE_UNSPECIFIED="TUNING_JOB_STATE_UNSPECIFIED",e.TUNING_JOB_STATE_WAITING_FOR_QUOTA="TUNING_JOB_STATE_WAITING_FOR_QUOTA",e.TUNING_JOB_STATE_PROCESSING_DATASET="TUNING_JOB_STATE_PROCESSING_DATASET",e.TUNING_JOB_STATE_WAITING_FOR_CAPACITY="TUNING_JOB_STATE_WAITING_FOR_CAPACITY",e.TUNING_JOB_STATE_TUNING="TUNING_JOB_STATE_TUNING",e.TUNING_JOB_STATE_POST_PROCESSING="TUNING_JOB_STATE_POST_PROCESSING"})(sm||(sm={}));var am;(function(e){e.AGGREGATION_METRIC_UNSPECIFIED="AGGREGATION_METRIC_UNSPECIFIED",e.AVERAGE="AVERAGE",e.MODE="MODE",e.STANDARD_DEVIATION="STANDARD_DEVIATION",e.VARIANCE="VARIANCE",e.MINIMUM="MINIMUM",e.MAXIMUM="MAXIMUM",e.MEDIAN="MEDIAN",e.PERCENTILE_P90="PERCENTILE_P90",e.PERCENTILE_P95="PERCENTILE_P95",e.PERCENTILE_P99="PERCENTILE_P99"})(am||(am={}));var lm;(function(e){e.PAIRWISE_CHOICE_UNSPECIFIED="PAIRWISE_CHOICE_UNSPECIFIED",e.BASELINE="BASELINE",e.CANDIDATE="CANDIDATE",e.TIE="TIE"})(lm||(lm={}));var cm;(function(e){e.VIDEO_ORIENTATION_UNSPECIFIED="VIDEO_ORIENTATION_UNSPECIFIED",e.LANDSCAPE="LANDSCAPE",e.PORTRAIT="PORTRAIT"})(cm||(cm={}));var um;(function(e){e.TUNING_SPEED_UNSPECIFIED="TUNING_SPEED_UNSPECIFIED",e.REGULAR="REGULAR",e.FAST="FAST"})(um||(um={}));var dm;(function(e){e.TUNING_TASK_UNSPECIFIED="TUNING_TASK_UNSPECIFIED",e.TUNING_TASK_I2V="TUNING_TASK_I2V",e.TUNING_TASK_T2V="TUNING_TASK_T2V",e.TUNING_TASK_R2V="TUNING_TASK_R2V"})(dm||(dm={}));var fm;(function(e){e.STATE_UNSPECIFIED="STATE_UNSPECIFIED",e.STATE_PENDING="STATE_PENDING",e.STATE_ACTIVE="STATE_ACTIVE",e.STATE_FAILED="STATE_FAILED"})(fm||(fm={}));var pm;(function(e){e.UNSPECIFIED="unspecified",e.FLEX="flex",e.STANDARD="standard",e.PRIORITY="priority"})(pm||(pm={}));var hm;(function(e){e.MEDIA_RESOLUTION_UNSPECIFIED="MEDIA_RESOLUTION_UNSPECIFIED",e.MEDIA_RESOLUTION_LOW="MEDIA_RESOLUTION_LOW",e.MEDIA_RESOLUTION_MEDIUM="MEDIA_RESOLUTION_MEDIUM",e.MEDIA_RESOLUTION_HIGH="MEDIA_RESOLUTION_HIGH",e.MEDIA_RESOLUTION_ULTRA_HIGH="MEDIA_RESOLUTION_ULTRA_HIGH"})(hm||(hm={}));var mm;(function(e){e.TOOL_TYPE_UNSPECIFIED="TOOL_TYPE_UNSPECIFIED",e.GOOGLE_SEARCH_WEB="GOOGLE_SEARCH_WEB",e.GOOGLE_SEARCH_IMAGE="GOOGLE_SEARCH_IMAGE",e.URL_CONTEXT="URL_CONTEXT",e.GOOGLE_MAPS="GOOGLE_MAPS",e.FILE_SEARCH="FILE_SEARCH",e.MEDIA_PROCESSING="MEDIA_PROCESSING"})(mm||(mm={}));var hu;(function(e){e.COLLECTION="COLLECTION"})(hu||(hu={}));var gm;(function(e){e.FEATURE_SELECTION_PREFERENCE_UNSPECIFIED="FEATURE_SELECTION_PREFERENCE_UNSPECIFIED",e.PRIORITIZE_QUALITY="PRIORITIZE_QUALITY",e.BALANCED="BALANCED",e.PRIORITIZE_COST="PRIORITIZE_COST"})(gm||(gm={}));var pl;(function(e){e.PREDICT="PREDICT",e.EMBED_CONTENT="EMBED_CONTENT"})(pl||(pl={}));var vm;(function(e){e.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",e.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",e.BLOCK_ONLY_HIGH="BLOCK_ONLY_HIGH",e.BLOCK_NONE="BLOCK_NONE"})(vm||(vm={}));var _m;(function(e){e.auto="auto",e.en="en",e.ja="ja",e.ko="ko",e.hi="hi",e.zh="zh",e.pt="pt",e.es="es"})(_m||(_m={}));var ym;(function(e){e.MASK_MODE_DEFAULT="MASK_MODE_DEFAULT",e.MASK_MODE_USER_PROVIDED="MASK_MODE_USER_PROVIDED",e.MASK_MODE_BACKGROUND="MASK_MODE_BACKGROUND",e.MASK_MODE_FOREGROUND="MASK_MODE_FOREGROUND",e.MASK_MODE_SEMANTIC="MASK_MODE_SEMANTIC"})(ym||(ym={}));var Sm;(function(e){e.CONTROL_TYPE_DEFAULT="CONTROL_TYPE_DEFAULT",e.CONTROL_TYPE_CANNY="CONTROL_TYPE_CANNY",e.CONTROL_TYPE_SCRIBBLE="CONTROL_TYPE_SCRIBBLE",e.CONTROL_TYPE_FACE_MESH="CONTROL_TYPE_FACE_MESH"})(Sm||(Sm={}));var Em;(function(e){e.SUBJECT_TYPE_DEFAULT="SUBJECT_TYPE_DEFAULT",e.SUBJECT_TYPE_PERSON="SUBJECT_TYPE_PERSON",e.SUBJECT_TYPE_ANIMAL="SUBJECT_TYPE_ANIMAL",e.SUBJECT_TYPE_PRODUCT="SUBJECT_TYPE_PRODUCT"})(Em||(Em={}));var bm;(function(e){e.EDIT_MODE_DEFAULT="EDIT_MODE_DEFAULT",e.EDIT_MODE_INPAINT_REMOVAL="EDIT_MODE_INPAINT_REMOVAL",e.EDIT_MODE_INPAINT_INSERTION="EDIT_MODE_INPAINT_INSERTION",e.EDIT_MODE_OUTPAINT="EDIT_MODE_OUTPAINT",e.EDIT_MODE_CONTROLLED_EDITING="EDIT_MODE_CONTROLLED_EDITING",e.EDIT_MODE_STYLE="EDIT_MODE_STYLE",e.EDIT_MODE_BGSWAP="EDIT_MODE_BGSWAP",e.EDIT_MODE_PRODUCT_IMAGE="EDIT_MODE_PRODUCT_IMAGE"})(bm||(bm={}));var wm;(function(e){e.FOREGROUND="FOREGROUND",e.BACKGROUND="BACKGROUND",e.PROMPT="PROMPT",e.SEMANTIC="SEMANTIC",e.INTERACTIVE="INTERACTIVE"})(wm||(wm={}));var Tm;(function(e){e.ASSET="ASSET",e.STYLE="STYLE"})(Tm||(Tm={}));var Cm;(function(e){e.INSERT="INSERT",e.REMOVE="REMOVE",e.REMOVE_STATIC="REMOVE_STATIC",e.OUTPAINT="OUTPAINT"})(Cm||(Cm={}));var Rm;(function(e){e.OPTIMIZED="OPTIMIZED",e.LOSSLESS="LOSSLESS"})(Rm||(Rm={}));var Am;(function(e){e.CROP="CROP",e.PAD="PAD"})(Am||(Am={}));var Im;(function(e){e.SUPERVISED_FINE_TUNING="SUPERVISED_FINE_TUNING",e.PREFERENCE_TUNING="PREFERENCE_TUNING",e.DISTILLATION="DISTILLATION",e.REINFORCEMENT_TUNING="REINFORCEMENT_TUNING"})(Im||(Im={}));var Pm;(function(e){e.STATE_UNSPECIFIED="STATE_UNSPECIFIED",e.PROCESSING="PROCESSING",e.ACTIVE="ACTIVE",e.FAILED="FAILED"})(Pm||(Pm={}));var km;(function(e){e.SOURCE_UNSPECIFIED="SOURCE_UNSPECIFIED",e.UPLOADED="UPLOADED",e.GENERATED="GENERATED",e.REGISTERED="REGISTERED"})(km||(km={}));var Nm;(function(e){e.TURN_COMPLETE_REASON_UNSPECIFIED="TURN_COMPLETE_REASON_UNSPECIFIED",e.MALFORMED_FUNCTION_CALL="MALFORMED_FUNCTION_CALL",e.RESPONSE_REJECTED="RESPONSE_REJECTED",e.NEED_MORE_INPUT="NEED_MORE_INPUT",e.PROHIBITED_INPUT_CONTENT="PROHIBITED_INPUT_CONTENT",e.IMAGE_PROHIBITED_INPUT_CONTENT="IMAGE_PROHIBITED_INPUT_CONTENT",e.INPUT_TEXT_CONTAIN_PROMINENT_PERSON_PROHIBITED="INPUT_TEXT_CONTAIN_PROMINENT_PERSON_PROHIBITED",e.INPUT_IMAGE_CELEBRITY="INPUT_IMAGE_CELEBRITY",e.INPUT_IMAGE_PHOTO_REALISTIC_CHILD_PROHIBITED="INPUT_IMAGE_PHOTO_REALISTIC_CHILD_PROHIBITED",e.INPUT_TEXT_NCII_PROHIBITED="INPUT_TEXT_NCII_PROHIBITED",e.INPUT_OTHER="INPUT_OTHER",e.INPUT_IP_PROHIBITED="INPUT_IP_PROHIBITED",e.BLOCKLIST="BLOCKLIST",e.UNSAFE_PROMPT_FOR_IMAGE_GENERATION="UNSAFE_PROMPT_FOR_IMAGE_GENERATION",e.GENERATED_IMAGE_SAFETY="GENERATED_IMAGE_SAFETY",e.GENERATED_CONTENT_SAFETY="GENERATED_CONTENT_SAFETY",e.GENERATED_AUDIO_SAFETY="GENERATED_AUDIO_SAFETY",e.GENERATED_VIDEO_SAFETY="GENERATED_VIDEO_SAFETY",e.GENERATED_CONTENT_PROHIBITED="GENERATED_CONTENT_PROHIBITED",e.GENERATED_CONTENT_BLOCKLIST="GENERATED_CONTENT_BLOCKLIST",e.GENERATED_IMAGE_PROHIBITED="GENERATED_IMAGE_PROHIBITED",e.GENERATED_IMAGE_CELEBRITY="GENERATED_IMAGE_CELEBRITY",e.GENERATED_IMAGE_PROMINENT_PEOPLE_DETECTED_BY_REWRITER="GENERATED_IMAGE_PROMINENT_PEOPLE_DETECTED_BY_REWRITER",e.GENERATED_IMAGE_IDENTIFIABLE_PEOPLE="GENERATED_IMAGE_IDENTIFIABLE_PEOPLE",e.GENERATED_IMAGE_MINORS="GENERATED_IMAGE_MINORS",e.OUTPUT_IMAGE_IP_PROHIBITED="OUTPUT_IMAGE_IP_PROHIBITED",e.GENERATED_OTHER="GENERATED_OTHER",e.MAX_REGENERATION_REACHED="MAX_REGENERATION_REACHED"})(Nm||(Nm={}));var Om;(function(e){e.INTERACTION_STATUS_UNSPECIFIED="INTERACTION_STATUS_UNSPECIFIED",e.IN_PROGRESS="IN_PROGRESS",e.REQUIRES_ACTION="REQUIRES_ACTION",e.IDLE="IDLE"})(Om||(Om={}));var Mm;(function(e){e.VAD_SIGNAL_TYPE_UNSPECIFIED="VAD_SIGNAL_TYPE_UNSPECIFIED",e.VAD_SIGNAL_TYPE_SOS="VAD_SIGNAL_TYPE_SOS",e.VAD_SIGNAL_TYPE_EOS="VAD_SIGNAL_TYPE_EOS"})(Mm||(Mm={}));var Dm;(function(e){e.TYPE_UNSPECIFIED="TYPE_UNSPECIFIED",e.ACTIVITY_START="ACTIVITY_START",e.ACTIVITY_END="ACTIVITY_END"})(Dm||(Dm={}));var $m;(function(e){e.START_SENSITIVITY_UNSPECIFIED="START_SENSITIVITY_UNSPECIFIED",e.START_SENSITIVITY_HIGH="START_SENSITIVITY_HIGH",e.START_SENSITIVITY_LOW="START_SENSITIVITY_LOW"})($m||($m={}));var xm;(function(e){e.END_SENSITIVITY_UNSPECIFIED="END_SENSITIVITY_UNSPECIFIED",e.END_SENSITIVITY_HIGH="END_SENSITIVITY_HIGH",e.END_SENSITIVITY_LOW="END_SENSITIVITY_LOW"})(xm||(xm={}));var Lm;(function(e){e.ACTIVITY_HANDLING_UNSPECIFIED="ACTIVITY_HANDLING_UNSPECIFIED",e.START_OF_ACTIVITY_INTERRUPTS="START_OF_ACTIVITY_INTERRUPTS",e.NO_INTERRUPTION="NO_INTERRUPTION"})(Lm||(Lm={}));var qm;(function(e){e.TURN_COVERAGE_UNSPECIFIED="TURN_COVERAGE_UNSPECIFIED",e.TURN_INCLUDES_ONLY_ACTIVITY="TURN_INCLUDES_ONLY_ACTIVITY",e.TURN_INCLUDES_ALL_INPUT="TURN_INCLUDES_ALL_INPUT",e.TURN_INCLUDES_AUDIO_ACTIVITY_AND_ALL_VIDEO="TURN_INCLUDES_AUDIO_ACTIVITY_AND_ALL_VIDEO"})(qm||(qm={}));var Um;(function(e){e.SCALE_UNSPECIFIED="SCALE_UNSPECIFIED",e.C_MAJOR_A_MINOR="C_MAJOR_A_MINOR",e.D_FLAT_MAJOR_B_FLAT_MINOR="D_FLAT_MAJOR_B_FLAT_MINOR",e.D_MAJOR_B_MINOR="D_MAJOR_B_MINOR",e.E_FLAT_MAJOR_C_MINOR="E_FLAT_MAJOR_C_MINOR",e.E_MAJOR_D_FLAT_MINOR="E_MAJOR_D_FLAT_MINOR",e.F_MAJOR_D_MINOR="F_MAJOR_D_MINOR",e.G_FLAT_MAJOR_E_FLAT_MINOR="G_FLAT_MAJOR_E_FLAT_MINOR",e.G_MAJOR_E_MINOR="G_MAJOR_E_MINOR",e.A_FLAT_MAJOR_F_MINOR="A_FLAT_MAJOR_F_MINOR",e.A_MAJOR_G_FLAT_MINOR="A_MAJOR_G_FLAT_MINOR",e.B_FLAT_MAJOR_G_MINOR="B_FLAT_MAJOR_G_MINOR",e.B_MAJOR_A_FLAT_MINOR="B_MAJOR_A_FLAT_MINOR"})(Um||(Um={}));var Fm;(function(e){e.MUSIC_GENERATION_MODE_UNSPECIFIED="MUSIC_GENERATION_MODE_UNSPECIFIED",e.QUALITY="QUALITY",e.DIVERSITY="DIVERSITY",e.VOCALIZATION="VOCALIZATION"})(Fm||(Fm={}));var bi;(function(e){e.PLAYBACK_CONTROL_UNSPECIFIED="PLAYBACK_CONTROL_UNSPECIFIED",e.PLAY="PLAY",e.PAUSE="PAUSE",e.STOP="STOP",e.RESET_CONTEXT="RESET_CONTEXT"})(bi||(bi={}));var Li=class{constructor(e){let t={};for(let r of e.headers.entries())t[r[0]]=r[1];this.headers=t,this.responseInternal=e}json(){return this.responseInternal.json()}},vs=class{get text(){var e,t,r,n,o,i,s,l;if(((n=(r=(t=(e=this.candidates)===null||e===void 0?void 0:e[0])===null||t===void 0?void 0:t.content)===null||r===void 0?void 0:r.parts)===null||n===void 0?void 0:n.length)===0)return;if(this.candidates&&this.candidates.length>1)console.warn("there are multiple candidates in the response, returning text from the first one.");let a="",c=!1,u=[];for(let f of(l=(s=(i=(o=this.candidates)===null||o===void 0?void 0:o[0])===null||i===void 0?void 0:i.content)===null||s===void 0?void 0:s.parts)!==null&&l!==void 0?l:[]){for(let[h,g]of Object.entries(f))if(h!=="text"&&h!=="thought"&&h!=="thoughtSignature"&&(g!==null||g!==void 0))u.push(h);if(typeof f.text==="string"){if(typeof f.thought==="boolean"&&f.thought)continue;c=!0,a+=f.text}}if(u.length>0)console.warn(`there are non-text parts ${u} in the response, returning concatenation of all text parts. Please refer to the non text parts for a full response from model.`);return c?a:void 0}get data(){var e,t,r,n,o,i,s,l;if(((n=(r=(t=(e=this.candidates)===null||e===void 0?void 0:e[0])===null||t===void 0?void 0:t.content)===null||r===void 0?void 0:r.parts)===null||n===void 0?void 0:n.length)===0)return;if(this.candidates&&this.candidates.length>1)console.warn("there are multiple candidates in the response, returning data from the first one.");let a="",c=[];for(let u of(l=(s=(i=(o=this.candidates)===null||o===void 0?void 0:o[0])===null||i===void 0?void 0:i.content)===null||s===void 0?void 0:s.parts)!==null&&l!==void 0?l:[]){for(let[f,h]of Object.entries(u))if(f!=="inlineData"&&(h!==null||h!==void 0))c.push(f);if(u.inlineData&&typeof u.inlineData.data==="string")a+=atob(u.inlineData.data)}if(c.length>0)console.warn(`there are non-data parts ${c} in the response, returning concatenation of all data parts. Please refer to the non data parts for a full response from model.`);return a.length>0?btoa(a):void 0}get functionCalls(){var e,t,r,n,o,i,s,l;if(((n=(r=(t=(e=this.candidates)===null||e===void 0?void 0:e[0])===null||t===void 0?void 0:t.content)===null||r===void 0?void 0:r.parts)===null||n===void 0?void 0:n.length)===0)return;if(this.candidates&&this.candidates.length>1)console.warn("there are multiple candidates in the response, returning function calls from the first one.");let a=(l=(s=(i=(o=this.candidates)===null||o===void 0?void 0:o[0])===null||i===void 0?void 0:i.content)===null||s===void 0?void 0:s.parts)===null||l===void 0?void 0:l.filter((c)=>c.functionCall).map((c)=>c.functionCall).filter((c)=>c!==void 0);if((a===null||a===void 0?void 0:a.length)===0)return;return a}get executableCode(){var e,t,r,n,o,i,s,l,a;if(((n=(r=(t=(e=this.candidates)===null||e===void 0?void 0:e[0])===null||t===void 0?void 0:t.content)===null||r===void 0?void 0:r.parts)===null||n===void 0?void 0:n.length)===0)return;if(this.candidates&&this.candidates.length>1)console.warn("there are multiple candidates in the response, returning executable code from the first one.");let c=(l=(s=(i=(o=this.candidates)===null||o===void 0?void 0:o[0])===null||i===void 0?void 0:i.content)===null||s===void 0?void 0:s.parts)===null||l===void 0?void 0:l.filter((u)=>u.executableCode).map((u)=>u.executableCode).filter((u)=>u!==void 0);if((c===null||c===void 0?void 0:c.length)===0)return;return(a=c===null||c===void 0?void 0:c[0])===null||a===void 0?void 0:a.code}get codeExecutionResult(){var e,t,r,n,o,i,s,l,a;if(((n=(r=(t=(e=this.candidates)===null||e===void 0?void 0:e[0])===null||t===void 0?void 0:t.content)===null||r===void 0?void 0:r.parts)===null||n===void 0?void 0:n.length)===0)return;if(this.candidates&&this.candidates.length>1)console.warn("there are multiple candidates in the response, returning code execution result from the first one.");let c=(l=(s=(i=(o=this.candidates)===null||o===void 0?void 0:o[0])===null||i===void 0?void 0:i.content)===null||s===void 0?void 0:s.parts)===null||l===void 0?void 0:l.filter((u)=>u.codeExecutionResult).map((u)=>u.codeExecutionResult).filter((u)=>u!==void 0);if((c===null||c===void 0?void 0:c.length)===0)return;return(a=c===null||c===void 0?void 0:c[0])===null||a===void 0?void 0:a.output}},Gm=class{},mx=class{},gx=class{},vx=class{},_x=class{},yx=class{},Bm=class{},Hm=class{},zm=class{},Sx=class{},Vm=class e{_fromAPIResponse({apiResponse:t,_isVertexAI:r}){let n=new e,o,i=t;if(r)o=nx(i);else o=rx(i);return Object.assign(n,o),n}},Ex=class{},jm=class{},bx=class{},Wm=class{},Jm=class{},wx=class{},Tx=class{},Cx=class{},Rx=class e{_fromAPIResponse({apiResponse:t,_isVertexAI:r}){let n=new e,i=ux(t);return Object.assign(n,i),n}},Ax=class{},Ix=class{},Px=class{},kx=class{},Km=class{},Nx=class{get text(){var e,t,r;let n="",o=!1,i=[];for(let s of(r=(t=(e=this.serverContent)===null||e===void 0?void 0:e.modelTurn)===null||t===void 0?void 0:t.parts)!==null&&r!==void 0?r:[]){for(let[l,a]of Object.entries(s))if(l!=="text"&&l!=="thought"&&a!==null)i.push(l);if(typeof s.text==="string"){if(typeof s.thought==="boolean"&&s.thought)continue;o=!0,n+=s.text}}if(i.length>0)console.warn(`there are non-text parts ${i} in the response, returning concatenation of all text parts. Please refer to the non text parts for a full response from model.`);return o?n:void 0}get data(){var e,t,r;let n="",o=[];for(let i of(r=(t=(e=this.serverContent)===null||e===void 0?void 0:e.modelTurn)===null||t===void 0?void 0:t.parts)!==null&&r!==void 0?r:[]){for(let[s,l]of Object.entries(i))if(s!=="inlineData"&&l!==null)o.push(s);if(i.inlineData&&typeof i.inlineData.data==="string")n+=atob(i.inlineData.data)}if(o.length>0)console.warn(`there are non-data parts ${o} in the response, returning concatenation of all data parts. Please refer to the non data parts for a full response from model.`);return n.length>0?btoa(n):void 0}},Ox=class{get audioChunk(){if(this.serverContent&&this.serverContent.audioChunks&&this.serverContent.audioChunks.length>0)return this.serverContent.audioChunks[0];return}},ME=class e{_fromAPIResponse({apiResponse:t,_isVertexAI:r}){let n=new e,i=Kd(t);return Object.assign(n,i),n}};function yt(e,t){if(!t||typeof t!=="string")throw Error("model is required and must be a string");if(t.includes("..")||t.includes("?")||t.includes("&"))throw Error("invalid model parameter");if(e.isVertexAI())if(t.startsWith("publishers/")||t.startsWith("projects/")||t.startsWith("models/"))return t;else if(t.indexOf("/")>=0){let r=t.split("/",2);return`publishers/${r[0]}/models/${r[1]}`}else return`publishers/google/models/${t}`;else if(t.startsWith("models/")||t.startsWith("tunedModels/"))return t;else return`models/${t}`}function DE(e,t){let r=yt(e,t);if(!r)return"";if(r.startsWith("publishers/")&&e.isVertexAI())return`projects/${e.getProject()}/locations/${e.getLocation()}/${r}`;else if(r.startsWith("models/")&&e.isVertexAI())return`projects/${e.getProject()}/locations/${e.getLocation()}/publishers/google/${r}`;else return r}function $E(e){if(Array.isArray(e))return e.map((t)=>hl(t));else return[hl(e)]}function hl(e){if(typeof e==="object"&&e!==null)return e;throw Error(`Could not parse input as Blob. Unsupported blob type: ${typeof e}`)}function xE(e){let t=hl(e);if(t.mimeType&&t.mimeType.startsWith("image/"))return t;throw Error(`Unsupported mime type: ${t.mimeType}`)}function LE(e){let t=hl(e);if(t.mimeType&&t.mimeType.startsWith("audio/"))return t;throw Error(`Unsupported mime type: ${t.mimeType}`)}function Xm(e){if(e===null||e===void 0)throw Error("PartUnion is required");if(typeof e==="object")return e;if(typeof e==="string")return{text:e};throw Error(`Unsupported part type: ${typeof e}`)}function qE(e){if(e===null||e===void 0||Array.isArray(e)&&e.length===0)throw Error("PartListUnion is required");if(Array.isArray(e))return e.map((t)=>Xm(t));return[Xm(e)]}function mu(e){return e!==null&&e!==void 0&&typeof e==="object"&&"parts"in e&&Array.isArray(e.parts)}function Ym(e){return e!==null&&e!==void 0&&typeof e==="object"&&"functionCall"in e}function Zm(e){return e!==null&&e!==void 0&&typeof e==="object"&&"functionResponse"in e}function Wt(e){if(e===null||e===void 0)throw Error("ContentUnion is required");if(mu(e))return e;return{role:"user",parts:qE(e)}}function Xd(e,t){if(!t)return[];if(e.isVertexAI()&&Array.isArray(t))return t.flatMap((r)=>{let n=Wt(r);if(n.parts&&n.parts.length>0&&n.parts[0].text!==void 0)return[n.parts[0].text];return[]});else if(e.isVertexAI()){let r=Wt(t);if(r.parts&&r.parts.length>0&&r.parts[0].text!==void 0)return[r.parts[0].text];return[]}if(Array.isArray(t))return t.map((r)=>Wt(r));return[Wt(t)]}function mr(e){if(e===null||e===void 0||Array.isArray(e)&&e.length===0)throw Error("contents are required");if(!Array.isArray(e)){if(Ym(e)||Zm(e))throw Error("To specify functionCall or functionResponse parts, please wrap them in a Content object, specifying the role for them");return[Wt(e)]}let t=[],r=[],n=mu(e[0]);for(let o of e){let i=mu(o);if(i!=n)throw Error("Mixing Content and Parts is not supported, please group the parts into a the appropriate Content objects and specify the roles for them");if(i)t.push(o);else if(Ym(o)||Zm(o))throw Error("To specify functionCall or functionResponse parts, please wrap them, and any other parts, in Content objects as appropriate, specifying the role for them");else r.push(o)}if(!n)t.push({role:"user",parts:qE(r)});return t}function Mx(e,t){if(e.includes("null"))t.nullable=!0;let r=e.filter((n)=>n!=="null");if(r.length===1)t.type=Object.values(co).includes(r[0].toUpperCase())?r[0].toUpperCase():co.TYPE_UNSPECIFIED;else{t.anyOf=[];for(let n of r)t.anyOf.push({type:Object.values(co).includes(n.toUpperCase())?n.toUpperCase():co.TYPE_UNSPECIFIED})}}function Ai(e){let t={},r=["items"],n=["anyOf"],o=["properties"];if(e.type&&e.anyOf)throw Error("type and anyOf cannot be both populated.");let i=e.anyOf;if(i!=null&&i.length==2){if(i[0].type==="null")t.nullable=!0,e=i[1];else if(i[1].type==="null")t.nullable=!0,e=i[0]}if(e.type instanceof Array)Mx(e.type,t);for(let[s,l]of Object.entries(e)){if(l==null)continue;if(s=="type"){if(l==="null")throw Error("type: null can not be the only possible type for the field.");if(l instanceof Array)continue;t.type=Object.values(co).includes(l.toUpperCase())?l.toUpperCase():co.TYPE_UNSPECIFIED}else if(r.includes(s))t[s]=Ai(l);else if(n.includes(s)){let a=[];for(let c of l){if(c.type=="null"){t.nullable=!0;continue}a.push(Ai(c))}t[s]=a}else if(o.includes(s)){let a={};for(let[c,u]of Object.entries(l))a[c]=Ai(u);t[s]=a}else{if(s==="additionalProperties")continue;t[s]=l}}return t}function Yd(e){return Ai(e)}function Xi(e){return e}function Zd(e){if(typeof e==="object")return e;else if(typeof e==="string")return{voiceConfig:{prebuiltVoiceConfig:{voiceName:e}}};else throw Error(`Unsupported speechConfig type: ${typeof e}`)}function Qd(e){if("multiSpeakerVoiceConfig"in e)throw Error("multiSpeakerVoiceConfig is not supported in the live API.");return e}function Yi(e){if(e.functionDeclarations)for(let t of e.functionDeclarations){if(t.parameters){if(!Object.keys(t.parameters).includes("$schema"))t.parameters=Ai(t.parameters);else if(!t.parametersJsonSchema)t.parametersJsonSchema=t.parameters,delete t.parameters}if(t.response){if(!Object.keys(t.response).includes("$schema"))t.response=Ai(t.response);else if(!t.responseJsonSchema)t.responseJsonSchema=t.response,delete t.response}}return e}function Zi(e){if(e===void 0||e===null)throw Error("tools is required");if(!Array.isArray(e))throw Error("tools is required and must be an array of Tools");let t=[];for(let r of e)t.push(r);return t}function Dx(e,t,r,n=1){let o=!t.startsWith(`${r}/`)&&t.split("/").length===n;if(e.isVertexAI())if(t.startsWith("projects/"))return t;else if(t.startsWith("locations/"))return`projects/${e.getProject()}/${t}`;else if(t.startsWith(`${r}/`))return`projects/${e.getProject()}/locations/${e.getLocation()}/${t}`;else if(o)return`projects/${e.getProject()}/locations/${e.getLocation()}/${r}/${t}`;else return t;if(o)return`${r}/${t}`;return t}function Fn(e,t){if(typeof t!=="string")throw Error("name must be a string");return Dx(e,t,"cachedContents")}function UE(e){switch(e){case"STATE_UNSPECIFIED":return"JOB_STATE_UNSPECIFIED";case"CREATING":return"JOB_STATE_RUNNING";case"ACTIVE":return"JOB_STATE_SUCCEEDED";case"FAILED":return"JOB_STATE_FAILED";default:return e}}function jo(e){return Jd(e)}function $x(e){return e!==null&&e!==void 0&&typeof e==="object"&&"name"in e}function FE(e){return e!==null&&e!==void 0&&typeof e==="object"&&"video"in e}function GE(e){return e!==null&&e!==void 0&&typeof e==="object"&&"uri"in e}function ef(e){var t;let r;if($x(e))r=e.name;if(GE(e)){if(r=e.uri,r===void 0)return}if(FE(e)){if(r=(t=e.video)===null||t===void 0?void 0:t.uri,r===void 0)return}if(typeof e==="string")r=e;if(r===void 0)throw Error("Could not extract file name from the provided input.");if(r.startsWith("https://")){let o=r.split("files/")[1].match(/[a-z0-9]+/);if(o===null)throw Error(`Could not extract file name from URI ${r}`);r=o[0]}else if(r.startsWith("files/"))r=r.split("files/")[1];return r}function BE(e,t){let r;if(e.isVertexAI())r=t?"publishers/google/models":"models";else r=t?"models":"tunedModels";return r}function HE(e){for(let t of["models","tunedModels","publisherModels"])if(xx(e,t))return e[t];return[]}function xx(e,t){return e!==null&&typeof e==="object"&&t in e}function Lx(e,t={}){let r=e,n={name:r.name,description:r.description,parametersJsonSchema:r.inputSchema};if(r.outputSchema)n.responseJsonSchema=r.outputSchema;if(t.behavior)n.behavior=t.behavior;return{functionDeclarations:[n]}}function qx(e,t={}){let r=[],n=new Set;for(let o of e){let i=o.name;if(n.has(i))throw Error(`Duplicate function name ${i} found in MCP tools. Please ensure function names are unique.`);n.add(i);let s=Lx(o,t);if(s.functionDeclarations)r.push(...s.functionDeclarations)}return{functionDeclarations:r}}function zE(e,t){let r;if(typeof t==="string")if(e.isVertexAI())if(t.startsWith("gs://"))r={format:"jsonl",gcsUri:[t]};else if(t.startsWith("bq://"))r={format:"bigquery",bigqueryUri:t};else if(/^projects\/[^/]+\/locations\/[^/]+\/datasets\/[^/]+$/.test(t))r={format:"vertex-dataset",vertexDatasetName:t};else throw Error(`Unsupported string source for Vertex AI: ${t}`);else if(t.startsWith("files/"))r={fileName:t};else throw Error(`Unsupported string source for Gemini API: ${t}`);else if(Array.isArray(t)){if(e.isVertexAI())throw Error("InlinedRequest[] is not supported in Vertex AI.");r={inlinedRequests:t}}else r=t;let n=[r.gcsUri,r.bigqueryUri,r.vertexDatasetName].filter(Boolean).length,o=[r.inlinedRequests,r.fileName].filter(Boolean).length;if(e.isVertexAI()){if(o>0||n!==1)throw Error("Exactly one of `gcsUri`, `bigqueryUri`, or `vertexDatasetName` must be set for Vertex AI.")}else if(n>0||o!==1)throw Error("Exactly one of `inlinedRequests`, `fileName`, must be set for Gemini API.");return r}function Ux(e){if(typeof e!=="string")return e;let t=e;if(t.startsWith("gs://"))return{format:"jsonl",gcsUri:t};else if(t.startsWith("bq://"))return{format:"bigquery",bigqueryUri:t};else throw Error(`Unsupported destination: ${t}`)}function VE(e){if(typeof e!=="object"||e===null)return{};let t=e,r=t.inlinedResponses;if(typeof r!=="object"||r===null)return e;let o=r.inlinedResponses;if(!Array.isArray(o)||o.length===0)return e;let i=!1;for(let s of o){if(typeof s!=="object"||s===null)continue;let a=s.response;if(typeof a!=="object"||a===null)continue;if(a.embedding!==void 0){i=!0;break}}if(i)t.inlinedEmbedContentResponses=t.inlinedResponses,delete t.inlinedResponses;return e}function Qi(e,t){let r=t;if(!e.isVertexAI())if(/batches\/[^/]+$/.test(r))return r.split("/").pop();else throw Error(`Invalid batch job name: ${r}.`);if(/^projects\/[^/]+\/locations\/[^/]+\/batchPredictionJobs\/[^/]+$/.test(r))return r.split("/").pop();else if(/^\d+$/.test(r))return r;else throw Error(`Invalid batch job name: ${r}.`)}function jE(e){let t=e;if(t==="BATCH_STATE_UNSPECIFIED")return"JOB_STATE_UNSPECIFIED";else if(t==="BATCH_STATE_PENDING")return"JOB_STATE_PENDING";else if(t==="BATCH_STATE_RUNNING")return"JOB_STATE_RUNNING";else if(t==="BATCH_STATE_SUCCEEDED")return"JOB_STATE_SUCCEEDED";else if(t==="BATCH_STATE_FAILED")return"JOB_STATE_FAILED";else if(t==="BATCH_STATE_CANCELLED")return"JOB_STATE_CANCELLED";else if(t==="BATCH_STATE_EXPIRED")return"JOB_STATE_EXPIRED";else return t}function Fx(e){return e.includes("gemini")&&e!=="gemini-embedding-001"||e.includes("maas")}function Gx(e){let t={},r=d(e,["apiKey"]);if(r!=null)m(t,["apiKey"],r);if(d(e,["apiKeyConfig"])!==void 0)throw Error("apiKeyConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["authType"])!==void 0)throw Error("authType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["googleServiceAccountConfig"])!==void 0)throw Error("googleServiceAccountConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["httpBasicAuthConfig"])!==void 0)throw Error("httpBasicAuthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["oauthConfig"])!==void 0)throw Error("oauthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["oidcConfig"])!==void 0)throw Error("oidcConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}function Bx(e){let t={},r=d(e,["responsesFile"]);if(r!=null)m(t,["fileName"],r);let n=d(e,["inlinedResponses","inlinedResponses"]);if(n!=null){let i=n;if(Array.isArray(i))i=i.map((s)=>SL(s));m(t,["inlinedResponses"],i)}let o=d(e,["inlinedEmbedContentResponses","inlinedResponses"]);if(o!=null){let i=o;if(Array.isArray(i))i=i.map((s)=>s);m(t,["inlinedEmbedContentResponses"],i)}return t}function Hx(e){let t={},r=d(e,["predictionsFormat"]);if(r!=null)m(t,["format"],r);let n=d(e,["gcsDestination","outputUriPrefix"]);if(n!=null)m(t,["gcsUri"],n);let o=d(e,["bigqueryDestination","outputUri"]);if(o!=null)m(t,["bigqueryUri"],o);let i=d(e,["vertexMultimodalDatasetDestination"]);if(i!=null)m(t,["vertexDataset"],NL(i));return t}function zx(e){let t={},r=d(e,["format"]);if(r!=null)m(t,["predictionsFormat"],r);let n=d(e,["gcsUri"]);if(n!=null)m(t,["gcsDestination","outputUriPrefix"],n);let o=d(e,["bigqueryUri"]);if(o!=null)m(t,["bigqueryDestination","outputUri"],o);let i=d(e,["vertexDataset"]);if(i!=null)m(t,["vertexMultimodalDatasetDestination"],OL(i));if(d(e,["fileName"])!==void 0)throw Error("fileName parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(d(e,["inlinedResponses"])!==void 0)throw Error("inlinedResponses parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(d(e,["inlinedEmbedContentResponses"])!==void 0)throw Error("inlinedEmbedContentResponses parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return t}function za(e){let t={},r=d(e,["name"]);if(r!=null)m(t,["name"],r);let n=d(e,["metadata","displayName"]);if(n!=null)m(t,["displayName"],n);let o=d(e,["metadata","state"]);if(o!=null)m(t,["state"],jE(o));let i=d(e,["metadata","createTime"]);if(i!=null)m(t,["createTime"],i);let s=d(e,["metadata","endTime"]);if(s!=null)m(t,["endTime"],s);let l=d(e,["metadata","updateTime"]);if(l!=null)m(t,["updateTime"],l);let a=d(e,["metadata","model"]);if(a!=null)m(t,["model"],a);let c=d(e,["metadata","output"]);if(c!=null)m(t,["dest"],Bx(VE(c)));return t}function gu(e){let t={},r=d(e,["name"]);if(r!=null)m(t,["name"],r);let n=d(e,["displayName"]);if(n!=null)m(t,["displayName"],n);let o=d(e,["state"]);if(o!=null)m(t,["state"],jE(o));let i=d(e,["error"]);if(i!=null)m(t,["error"],i);let s=d(e,["createTime"]);if(s!=null)m(t,["createTime"],s);let l=d(e,["startTime"]);if(l!=null)m(t,["startTime"],l);let a=d(e,["endTime"]);if(a!=null)m(t,["endTime"],a);let c=d(e,["updateTime"]);if(c!=null)m(t,["updateTime"],c);let u=d(e,["model"]);if(u!=null)m(t,["model"],u);let f=d(e,["inputConfig"]);if(f!=null)m(t,["src"],Vx(f));let h=d(e,["outputConfig"]);if(h!=null)m(t,["dest"],Hx(VE(h)));let g=d(e,["outputInfo"]);if(g!=null)m(t,["outputInfo"],g);let p=d(e,["completionStats"]);if(p!=null)m(t,["completionStats"],p);return t}function Vx(e){let t={},r=d(e,["instancesFormat"]);if(r!=null)m(t,["format"],r);let n=d(e,["gcsSource","uris"]);if(n!=null)m(t,["gcsUri"],n);let o=d(e,["bigquerySource","inputUri"]);if(o!=null)m(t,["bigqueryUri"],o);let i=d(e,["vertexMultimodalDatasetSource","datasetName"]);if(i!=null)m(t,["vertexDatasetName"],i);return t}function jx(e,t){let r={};if(d(t,["format"])!==void 0)throw Error("format parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(t,["gcsUri"])!==void 0)throw Error("gcsUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(t,["bigqueryUri"])!==void 0)throw Error("bigqueryUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(t,["vertexDatasetName"])!==void 0)throw Error("vertexDatasetName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let n=d(t,["fileName"]);if(n!=null)m(r,["fileName"],n);let o=d(t,["inlinedRequests"]);if(o!=null){let i=o;if(Array.isArray(i))i=i.map((s)=>yL(e,s));m(r,["requests","requests"],i)}return r}function Wx(e){let t={},r=d(e,["format"]);if(r!=null)m(t,["instancesFormat"],r);let n=d(e,["gcsUri"]);if(n!=null)m(t,["gcsSource","uris"],n);let o=d(e,["bigqueryUri"]);if(o!=null)m(t,["bigquerySource","inputUri"],o);let i=d(e,["vertexDatasetName"]);if(i!=null)m(t,["vertexMultimodalDatasetSource","datasetName"],i);if(d(e,["fileName"])!==void 0)throw Error("fileName parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(d(e,["inlinedRequests"])!==void 0)throw Error("inlinedRequests parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return t}function Jx(e,t){let r={},n=d(t,["name"]);if(n!=null)m(r,["_url","name"],Qi(e,n));return r}function Kx(e,t){let r={},n=d(t,["name"]);if(n!=null)m(r,["_url","name"],Qi(e,n));return r}function Xx(e){let t={},r=d(e,["content"]);if(r!=null)m(t,["content"],r);let n=d(e,["citationMetadata"]);if(n!=null)m(t,["citationMetadata"],Yx(n));let o=d(e,["tokenCount"]);if(o!=null)m(t,["tokenCount"],o);let i=d(e,["finishReason"]);if(i!=null)m(t,["finishReason"],i);let s=d(e,["groundingMetadata"]);if(s!=null)m(t,["groundingMetadata"],s);let l=d(e,["avgLogprobs"]);if(l!=null)m(t,["avgLogprobs"],l);let a=d(e,["index"]);if(a!=null)m(t,["index"],a);let c=d(e,["logprobsResult"]);if(c!=null)m(t,["logprobsResult"],c);let u=d(e,["safetyRatings"]);if(u!=null){let g=u;if(Array.isArray(g))g=g.map((p)=>p);m(t,["safetyRatings"],g)}let f=d(e,["urlContextMetadata"]);if(f!=null)m(t,["urlContextMetadata"],f);let h=d(e,["continuationToken"]);if(h!=null)m(t,["continuationToken"],h);return t}function Yx(e){let t={},r=d(e,["citationSources"]);if(r!=null){let n=r;if(Array.isArray(n))n=n.map((o)=>o);m(t,["citations"],n)}return t}function WE(e){let t={},r=d(e,["parts"]);if(r!=null){let o=r;if(Array.isArray(o))o=o.map((i)=>AL(i));m(t,["parts"],o)}let n=d(e,["role"]);if(n!=null)m(t,["role"],n);return t}function Zx(e,t){let r={},n=d(e,["displayName"]);if(t!==void 0&&n!=null)m(t,["batch","displayName"],n);if(d(e,["dest"])!==void 0)throw Error("dest parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let o=d(e,["webhookConfig"]);if(t!==void 0&&o!=null)m(t,["batch","webhookConfig"],o);return r}function Qx(e,t){let r={},n=d(e,["displayName"]);if(t!==void 0&&n!=null)m(t,["displayName"],n);let o=d(e,["dest"]);if(t!==void 0&&o!=null)m(t,["outputConfig"],zx(Ux(o)));if(d(e,["webhookConfig"])!==void 0)throw Error("webhookConfig parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return r}function Qm(e,t){let r={},n=d(t,["model"]);if(n!=null)m(r,["_url","model"],yt(e,n));let o=d(t,["src"]);if(o!=null)m(r,["batch","inputConfig"],jx(e,zE(e,o)));let i=d(t,["config"]);if(i!=null)Zx(i,r);return r}function eL(e,t){let r={},n=d(t,["model"]);if(n!=null)m(r,["model"],yt(e,n));let o=d(t,["src"]);if(o!=null)m(r,["inputConfig"],Wx(zE(e,o)));let i=d(t,["config"]);if(i!=null)Qx(i,r);return r}function tL(e,t){let r={},n=d(e,["displayName"]);if(t!==void 0&&n!=null)m(t,["batch","displayName"],n);return r}function rL(e,t){let r={},n=d(t,["model"]);if(n!=null)m(r,["_url","model"],yt(e,n));let o=d(t,["src"]);if(o!=null)m(r,["batch","inputConfig"],cL(e,o));let i=d(t,["config"]);if(i!=null)tL(i,r);return r}function nL(e,t){let r={},n=d(t,["name"]);if(n!=null)m(r,["_url","name"],Qi(e,n));return r}function oL(e,t){let r={},n=d(t,["name"]);if(n!=null)m(r,["_url","name"],Qi(e,n));return r}function iL(e){let t={},r=d(e,["sdkHttpResponse"]);if(r!=null)m(t,["sdkHttpResponse"],r);let n=d(e,["name"]);if(n!=null)m(t,["name"],n);let o=d(e,["done"]);if(o!=null)m(t,["done"],o);let i=d(e,["error"]);if(i!=null)m(t,["error"],i);return t}function sL(e){let t={},r=d(e,["sdkHttpResponse"]);if(r!=null)m(t,["sdkHttpResponse"],r);let n=d(e,["name"]);if(n!=null)m(t,["name"],n);let o=d(e,["done"]);if(o!=null)m(t,["done"],o);let i=d(e,["error"]);if(i!=null)m(t,["error"],i);return t}function aL(e,t){let r={},n=d(t,["contents"]);if(n!=null){let i=Xd(e,n);if(Array.isArray(i))i=i.map((s)=>s);m(r,["requests[]","request","content"],i)}let o=d(t,["config"]);if(o!=null)m(r,["_self"],lL(o,r)),ex(r,{"requests[].*":"requests[].request.*"});return r}function lL(e,t){let r={},n=d(e,["taskType"]);if(t!==void 0&&n!=null)m(t,["requests[]","taskType"],n);let o=d(e,["title"]);if(t!==void 0&&o!=null)m(t,["requests[]","title"],o);let i=d(e,["outputDimensionality"]);if(t!==void 0&&i!=null)m(t,["requests[]","outputDimensionality"],i);if(d(e,["mimeType"])!==void 0)throw Error("mimeType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["autoTruncate"])!==void 0)throw Error("autoTruncate parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["documentOcr"])!==void 0)throw Error("documentOcr parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["audioTrackExtraction"])!==void 0)throw Error("audioTrackExtraction parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return r}function cL(e,t){let r={},n=d(t,["fileName"]);if(n!=null)m(r,["file_name"],n);let o=d(t,["inlinedRequests"]);if(o!=null)m(r,["requests"],aL(e,o));return r}function uL(e){let t={},r=d(e,["args"]);if(r!=null)m(t,["args"],r);let n=d(e,["id"]);if(n!=null)m(t,["id"],n);let o=d(e,["name"]);if(o!=null)m(t,["name"],o);if(d(e,["partialArgs"])!==void 0)throw Error("partialArgs parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["willContinue"])!==void 0)throw Error("willContinue parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}function dL(e){let t={},r=d(e,["allowedFunctionNames"]);if(r!=null)m(t,["allowedFunctionNames"],r);let n=d(e,["mode"]);if(n!=null)m(t,["mode"],n);if(d(e,["streamFunctionCallArguments"])!==void 0)throw Error("streamFunctionCallArguments parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}function fL(e,t,r){let n={},o=d(t,["serviceTier"]);if(r!==void 0&&o!=null)m(r,["serviceTier"],o);let i=d(t,["systemInstruction"]);if(r!==void 0&&i!=null)m(r,["systemInstruction"],WE(Wt(i)));let s=d(t,["temperature"]);if(s!=null)m(n,["temperature"],s);let l=d(t,["topP"]);if(l!=null)m(n,["topP"],l);let a=d(t,["topK"]);if(a!=null)m(n,["topK"],a);let c=d(t,["candidateCount"]);if(c!=null)m(n,["candidateCount"],c);let u=d(t,["maxOutputTokens"]);if(u!=null)m(n,["maxOutputTokens"],u);let f=d(t,["stopSequences"]);if(f!=null)m(n,["stopSequences"],f);let h=d(t,["responseLogprobs"]);if(h!=null)m(n,["responseLogprobs"],h);let g=d(t,["logprobs"]);if(g!=null)m(n,["logprobs"],g);let p=d(t,["presencePenalty"]);if(p!=null)m(n,["presencePenalty"],p);let _=d(t,["frequencyPenalty"]);if(_!=null)m(n,["frequencyPenalty"],_);let y=d(t,["seed"]);if(y!=null)m(n,["seed"],y);let S=d(t,["responseMimeType"]);if(S!=null)m(n,["responseMimeType"],S);let E=d(t,["responseSchema"]);if(E!=null)m(n,["responseSchema"],Yd(E));let b=d(t,["responseJsonSchema"]);if(b!=null)m(n,["responseJsonSchema"],Xi(b));if(d(t,["routingConfig"])!==void 0)throw Error("routingConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(t,["modelSelectionConfig"])!==void 0)throw Error("modelSelectionConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let R=d(t,["safetySettings"]);if(r!==void 0&&R!=null){let se=R;if(Array.isArray(se))se=se.map((ve)=>IL(ve));m(r,["safetySettings"],se)}let w=d(t,["tools"]);if(r!==void 0&&w!=null){let se=Zi(w);if(Array.isArray(se))se=se.map((ve)=>kL(Yi(ve)));m(r,["tools"],se)}let T=d(t,["toolConfig"]);if(r!==void 0&&T!=null)m(r,["toolConfig"],PL(T));let C=d(t,["labels"]);if(r!==void 0&&C!=null)m(r,["labels"],C);let A=d(t,["cachedContent"]);if(r!==void 0&&A!=null)m(r,["cachedContent"],Fn(e,A));let P=d(t,["responseModalities"]);if(P!=null)m(n,["responseModalities"],P);let D=d(t,["mediaResolution"]);if(D!=null)m(n,["mediaResolution"],D);let N=d(t,["speechConfig"]);if(N!=null)m(n,["speechConfig"],Zd(N));if(d(t,["audioTimestamp"])!==void 0)throw Error("audioTimestamp parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let F=d(t,["thinkingConfig"]);if(F!=null)m(n,["thinkingConfig"],F);let G=d(t,["audioTranscriptionConfig"]);if(G!=null)m(n,["audioTranscriptionConfig"],G);let B=d(t,["imageConfig"]);if(B!=null)m(n,["imageConfig"],_L(B));let Q=d(t,["enableEnhancedCivicAnswers"]);if(Q!=null)m(n,["enableEnhancedCivicAnswers"],Q);if(d(t,["modelArmorConfig"])!==void 0)throw Error("modelArmorConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let pe=d(t,["continuationToken"]);if(r!==void 0&&pe!=null)m(r,["continuationToken"],pe);return n}function pL(e){let t={},r=d(e,["sdkHttpResponse"]);if(r!=null)m(t,["sdkHttpResponse"],r);let n=d(e,["candidates"]);if(n!=null){let c=n;if(Array.isArray(c))c=c.map((u)=>Xx(u));m(t,["candidates"],c)}let o=d(e,["modelVersion"]);if(o!=null)m(t,["modelVersion"],o);let i=d(e,["promptFeedback"]);if(i!=null)m(t,["promptFeedback"],i);let s=d(e,["responseId"]);if(s!=null)m(t,["responseId"],s);let l=d(e,["usageMetadata"]);if(l!=null)m(t,["usageMetadata"],l);let a=d(e,["modelStatus"]);if(a!=null)m(t,["modelStatus"],a);return t}function hL(e,t){let r={},n=d(t,["name"]);if(n!=null)m(r,["_url","name"],Qi(e,n));return r}function mL(e,t){let r={},n=d(t,["name"]);if(n!=null)m(r,["_url","name"],Qi(e,n));return r}function gL(e){let t={},r=d(e,["authConfig"]);if(r!=null)m(t,["authConfig"],Gx(r));let n=d(e,["enableWidget"]);if(n!=null)m(t,["enableWidget"],n);if(d(e,["groundingTypes"])!==void 0)throw Error("groundingTypes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}function vL(e){let t={};if(d(e,["blockingConfidence"])!==void 0)throw Error("blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["excludeDomains"])!==void 0)throw Error("excludeDomains parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let r=d(e,["searchTypes"]);if(r!=null)m(t,["searchTypes"],r);let n=d(e,["timeRangeFilter"]);if(n!=null)m(t,["timeRangeFilter"],n);return t}function _L(e){let t={},r=d(e,["aspectRatio"]);if(r!=null)m(t,["aspectRatio"],r);let n=d(e,["imageSize"]);if(n!=null)m(t,["imageSize"],n);if(d(e,["personGeneration"])!==void 0)throw Error("personGeneration parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["outputMimeType"])!==void 0)throw Error("outputMimeType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["outputCompressionQuality"])!==void 0)throw Error("outputCompressionQuality parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["imageOutputOptions"])!==void 0)throw Error("imageOutputOptions parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["prominentPeople"])!==void 0)throw Error("prominentPeople parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}function yL(e,t){let r={},n=d(t,["model"]);if(n!=null)m(r,["request","model"],yt(e,n));let o=d(t,["contents"]);if(o!=null){let l=mr(o);if(Array.isArray(l))l=l.map((a)=>WE(a));m(r,["request","contents"],l)}let i=d(t,["metadata"]);if(i!=null)m(r,["metadata"],i);let s=d(t,["config"]);if(s!=null)m(r,["request","generationConfig"],fL(e,s,d(r,["request"],{})));return r}function SL(e){let t={},r=d(e,["response"]);if(r!=null)m(t,["response"],pL(r));let n=d(e,["metadata"]);if(n!=null)m(t,["metadata"],n);let o=d(e,["error"]);if(o!=null)m(t,["error"],o);return t}function EL(e,t){let r={},n=d(e,["pageSize"]);if(t!==void 0&&n!=null)m(t,["_query","pageSize"],n);let o=d(e,["pageToken"]);if(t!==void 0&&o!=null)m(t,["_query","pageToken"],o);if(d(e,["filter"])!==void 0)throw Error("filter parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return r}function bL(e,t){let r={},n=d(e,["pageSize"]);if(t!==void 0&&n!=null)m(t,["_query","pageSize"],n);let o=d(e,["pageToken"]);if(t!==void 0&&o!=null)m(t,["_query","pageToken"],o);let i=d(e,["filter"]);if(t!==void 0&&i!=null)m(t,["_query","filter"],i);return r}function wL(e){let t={},r=d(e,["config"]);if(r!=null)EL(r,t);return t}function TL(e){let t={},r=d(e,["config"]);if(r!=null)bL(r,t);return t}function CL(e){let t={},r=d(e,["sdkHttpResponse"]);if(r!=null)m(t,["sdkHttpResponse"],r);let n=d(e,["nextPageToken"]);if(n!=null)m(t,["nextPageToken"],n);let o=d(e,["operations"]);if(o!=null){let i=o;if(Array.isArray(i))i=i.map((s)=>za(s));m(t,["batchJobs"],i)}return t}function RL(e){let t={},r=d(e,["sdkHttpResponse"]);if(r!=null)m(t,["sdkHttpResponse"],r);let n=d(e,["nextPageToken"]);if(n!=null)m(t,["nextPageToken"],n);let o=d(e,["batchPredictionJobs"]);if(o!=null){let i=o;if(Array.isArray(i))i=i.map((s)=>gu(s));m(t,["batchJobs"],i)}return t}function AL(e){let t={},r=d(e,["mediaResolution"]);if(r!=null)m(t,["mediaResolution"],r);let n=d(e,["toolCall"]);if(n!=null)m(t,["toolCall"],n);let o=d(e,["toolResponse"]);if(o!=null)m(t,["toolResponse"],o);let i=d(e,["audioTranscription"]);if(i!=null)m(t,["audioTranscription"],i);let s=d(e,["codeExecutionResult"]);if(s!=null)m(t,["codeExecutionResult"],s);let l=d(e,["executableCode"]);if(l!=null)m(t,["executableCode"],l);let a=d(e,["fileData"]);if(a!=null)m(t,["fileData"],a);let c=d(e,["functionCall"]);if(c!=null)m(t,["functionCall"],uL(c));let u=d(e,["functionResponse"]);if(u!=null)m(t,["functionResponse"],u);let f=d(e,["inlineData"]);if(f!=null)m(t,["inlineData"],f);let h=d(e,["text"]);if(h!=null)m(t,["text"],h);let g=d(e,["thought"]);if(g!=null)m(t,["thought"],g);let p=d(e,["thoughtSignature"]);if(p!=null)m(t,["thoughtSignature"],p);let _=d(e,["videoMetadata"]);if(_!=null)m(t,["videoMetadata"],_);let y=d(e,["partMetadata"]);if(y!=null)m(t,["partMetadata"],y);let S=d(e,["mediaProcessing"]);if(S!=null)m(t,["mediaProcessing"],S);let E=d(e,["speechMetadata"]);if(E!=null)m(t,["speechMetadata"],E);return t}function IL(e){let t={},r=d(e,["category"]);if(r!=null)m(t,["category"],r);if(d(e,["method"])!==void 0)throw Error("method parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let n=d(e,["threshold"]);if(n!=null)m(t,["threshold"],n);return t}function PL(e){let t={},r=d(e,["functionCallingConfig"]);if(r!=null)m(t,["functionCallingConfig"],dL(r));let n=d(e,["retrievalConfig"]);if(n!=null)m(t,["retrievalConfig"],n);let o=d(e,["includeServerSideToolInvocations"]);if(o!=null)m(t,["includeServerSideToolInvocations"],o);return t}function kL(e){let t={};if(d(e,["retrieval"])!==void 0)throw Error("retrieval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let r=d(e,["googleMaps"]);if(r!=null)m(t,["googleMaps"],gL(r));let n=d(e,["mcpServers"]);if(n!=null){let f=n;if(Array.isArray(f))f=f.map((h)=>h);m(t,["mcpServers"],f)}let o=d(e,["codeExecution"]);if(o!=null)m(t,["codeExecution"],o);let i=d(e,["computerUse"]);if(i!=null)m(t,["computerUse"],i);if(d(e,["enterpriseWebSearch"])!==void 0)throw Error("enterpriseWebSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["exaAiSearch"])!==void 0)throw Error("exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let s=d(e,["functionDeclarations"]);if(s!=null){let f=s;if(Array.isArray(f))f=f.map((h)=>h);m(t,["functionDeclarations"],f)}let l=d(e,["googleSearch"]);if(l!=null)m(t,["googleSearch"],vL(l));let a=d(e,["googleSearchRetrieval"]);if(a!=null)m(t,["googleSearchRetrieval"],a);if(d(e,["parallelAiSearch"])!==void 0)throw Error("parallelAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let c=d(e,["urlContext"]);if(c!=null)m(t,["urlContext"],c);let u=d(e,["fileSearch"]);if(u!=null)m(t,["fileSearch"],u);return t}function NL(e){let t={},r=d(e,["bigqueryDestination","outputUri"]);if(r!=null)m(t,["bigqueryDestination"],r);let n=d(e,["displayName"]);if(n!=null)m(t,["displayName"],n);return t}function OL(e){let t={},r=d(e,["bigqueryDestination"]);if(r!=null)m(t,["bigqueryDestination","outputUri"],r);let n=d(e,["displayName"]);if(n!=null)m(t,["displayName"],n);return t}var xn;(function(e){e.PAGED_ITEM_BATCH_JOBS="batchJobs",e.PAGED_ITEM_MODELS="models",e.PAGED_ITEM_TUNING_JOBS="tuningJobs",e.PAGED_ITEM_FILES="files",e.PAGED_ITEM_CACHED_CONTENTS="cachedContents",e.PAGED_ITEM_FILE_SEARCH_STORES="fileSearchStores",e.PAGED_ITEM_DOCUMENTS="documents",e.PAGED_ITEM_SKILLS="skills"})(xn||(xn={}));var Wo=class{constructor(e,t,r,n){this.pageInternal=[],this.paramsInternal={},this.requestInternal=t,this.init(e,r,n)}init(e,t,r){var n,o;this.nameInternal=e,this.pageInternal=t[this.nameInternal]||[],this.sdkHttpResponseInternal=t===null||t===void 0?void 0:t.sdkHttpResponse,this.idxInternal=0;let i={config:{}};if(!r||Object.keys(r).length===0)i={config:{}};else if(typeof r==="object")i=Object.assign({},r);else i=r;if(i.config)i.config.pageToken=t.nextPageToken;this.paramsInternal=i,this.pageInternalSize=(o=(n=i.config)===null||n===void 0?void 0:n.pageSize)!==null&&o!==void 0?o:this.pageInternal.length}initNextPage(e){this.init(this.nameInternal,e,this.paramsInternal)}get page(){return this.pageInternal}get name(){return this.nameInternal}get pageSize(){return this.pageInternalSize}get sdkHttpResponse(){return this.sdkHttpResponseInternal}get params(){return this.paramsInternal}get pageLength(){return this.pageInternal.length}getItem(e){return this.pageInternal[e]}[Symbol.asyncIterator](){return{next:async()=>{if(this.idxInternal>=this.pageLength)if(this.hasNextPage())await this.nextPage();else return{value:void 0,done:!0};let e=this.getItem(this.idxInternal);return this.idxInternal+=1,{value:e,done:!1}},return:async()=>({value:void 0,done:!0})}}async nextPage(){if(!this.hasNextPage())throw Error("No more pages to fetch.");let e=await this.requestInternal(this.params);return this.initNextPage(e),this.page}hasNextPage(){var e;if(((e=this.params.config)===null||e===void 0?void 0:e.pageToken)!==void 0)return!0;return!1}},ML=class extends Un{constructor(e){super();this.apiClient=e,this.list=async(t={})=>new Wo(xn.PAGED_ITEM_BATCH_JOBS,(r)=>this.listInternal(r),await this.listInternal(t),t),this.create=async(t)=>{if(this.apiClient.isVertexAI())t.config=this.formatDestination(t.src,t.config);return this.createInternal(t)},this.createEmbeddings=async(t)=>{if(console.warn("batches.createEmbeddings() is experimental and may change without notice."),this.apiClient.isVertexAI())throw Error("Gemini Enterprise Agent Platform (previously known as Vertex AI) does not support batches.createEmbeddings.");return this.createEmbeddingsInternal(t)}}createInlinedGenerateContentRequest(e){let t=Qm(this.apiClient,e),r=t._url,n=Ae("{model}:batchGenerateContent",r),s=t.batch.inputConfig.requests,l=s.requests,a=[];for(let c of l){let u=Object.assign({},c);if(u.systemInstruction){let f=u.systemInstruction;delete u.systemInstruction;let h=u.request;h.systemInstruction=f,u.request=h}a.push(u)}return s.requests=a,delete t.config,delete t._url,delete t._query,{path:n,body:t}}getGcsUri(e){if(typeof e==="string")return e.startsWith("gs://")?e:void 0;if(!Array.isArray(e)&&e.gcsUri&&e.gcsUri.length>0)return e.gcsUri[0];return}getBigqueryUri(e){if(typeof e==="string")return e.startsWith("bq://")?e:void 0;if(!Array.isArray(e))return e.bigqueryUri;return}formatDestination(e,t){let r=t?Object.assign({},t):{},n=Date.now().toString();if(!r.displayName)r.displayName=`genaiBatchJob_${n}`;if(r.dest===void 0){let o=this.getGcsUri(e),i=this.getBigqueryUri(e);if(o)if(o.endsWith(".jsonl"))r.dest=`${o.slice(0,-6)}/dest`;else r.dest=`${o}_dest_${n}`;else if(i)r.dest=`${i}_dest_${n}`;else throw Error("Unsupported source for Gemini Enterprise Agent Platform (previously known as Vertex AI): No GCS or BigQuery URI found.")}return r}async createInternal(e){var t,r,n,o;let i,s="",l={};if(this.apiClient.isVertexAI()){let a=eL(this.apiClient,e);return s=Ae("batchPredictionJobs",a._url),l=a._query,delete a._url,delete a._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(a),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then((c)=>c.json()),i.then((c)=>gu(c))}else{let a=Qm(this.apiClient,e);return s=Ae("{model}:batchGenerateContent",a._url),l=a._query,delete a._url,delete a._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(a),httpMethod:"POST",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then((c)=>c.json()),i.then((c)=>za(c))}}async createEmbeddingsInternal(e){var t,r;let n,o="",i={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");else{let s=rL(this.apiClient,e);return o=Ae("{model}:asyncBatchEmbedContent",s._url),i=s._query,delete s._url,delete s._query,n=this.apiClient.request({path:o,queryParams:i,body:JSON.stringify(s),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then((l)=>l.json()),n.then((l)=>za(l))}}async get(e){var t,r,n,o;let i,s="",l={};if(this.apiClient.isVertexAI()){let a=mL(this.apiClient,e);return s=Ae("batchPredictionJobs/{name}",a._url),l=a._query,delete a._url,delete a._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(a),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then((c)=>c.json()),i.then((c)=>gu(c))}else{let a=hL(this.apiClient,e);return s=Ae("batches/{name}",a._url),l=a._query,delete a._url,delete a._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(a),httpMethod:"GET",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then((c)=>c.json()),i.then((c)=>za(c))}}async cancel(e){var t,r,n,o;let i="",s={};if(this.apiClient.isVertexAI()){let l=Kx(this.apiClient,e);i=Ae("batchPredictionJobs/{name}:cancel",l._url),s=l._query,delete l._url,delete l._query,await this.apiClient.request({path:i,queryParams:s,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal})}else{let l=Jx(this.apiClient,e);i=Ae("batches/{name}:cancel",l._url),s=l._query,delete l._url,delete l._query,await this.apiClient.request({path:i,queryParams:s,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal})}}async listInternal(e){var t,r,n,o;let i,s="",l={};if(this.apiClient.isVertexAI()){let a=TL(e);return s=Ae("batchPredictionJobs",a._url),l=a._query,delete a._url,delete a._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(a),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then((c)=>c.json().then((u)=>{let f=u;return f.sdkHttpResponse={headers:c.headers},f})),i.then((c)=>{let u=RL(c),f=new Km;return Object.assign(f,u),f})}else{let a=wL(e);return s=Ae("batches",a._url),l=a._query,delete a._url,delete a._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(a),httpMethod:"GET",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then((c)=>c.json().then((u)=>{let f=u;return f.sdkHttpResponse={headers:c.headers},f})),i.then((c)=>{let u=CL(c),f=new Km;return Object.assign(f,u),f})}}async delete(e){var t,r,n,o;let i,s="",l={};if(this.apiClient.isVertexAI()){let a=oL(this.apiClient,e);return s=Ae("batchPredictionJobs/{name}",a._url),l=a._query,delete a._url,delete a._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(a),httpMethod:"DELETE",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then((c)=>c.json().then((u)=>{let f=u;return f.sdkHttpResponse={headers:c.headers},f})),i.then((c)=>sL(c))}else{let a=nL(this.apiClient,e);return s=Ae("batches/{name}",a._url),l=a._query,delete a._url,delete a._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(a),httpMethod:"DELETE",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then((c)=>c.json().then((u)=>{let f=u;return f.sdkHttpResponse={headers:c.headers},f})),i.then((c)=>iL(c))}}};function DL(e){let t={},r=d(e,["apiKey"]);if(r!=null)m(t,["apiKey"],r);if(d(e,["apiKeyConfig"])!==void 0)throw Error("apiKeyConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["authType"])!==void 0)throw Error("authType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["googleServiceAccountConfig"])!==void 0)throw Error("googleServiceAccountConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["httpBasicAuthConfig"])!==void 0)throw Error("httpBasicAuthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["oauthConfig"])!==void 0)throw Error("oauthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["oidcConfig"])!==void 0)throw Error("oidcConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}function $L(e){let t={},r=d(e,["enablePromptInjectionDetection"]);if(r!=null)m(t,["enablePromptInjectionDetection"],r);let n=d(e,["environment"]);if(n!=null)m(t,["environment"],n);let o=d(e,["excludedPredefinedFunctions"]);if(o!=null)m(t,["excludedPredefinedFunctions"],o);if(d(e,["disabledSafetyPolicies"])!==void 0)throw Error("disabledSafetyPolicies parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return t}function eg(e){let t={},r=d(e,["parts"]);if(r!=null){let o=r;if(Array.isArray(o))o=o.map((i)=>nq(i));m(t,["parts"],o)}let n=d(e,["role"]);if(n!=null)m(t,["role"],n);return t}function tg(e){let t={},r=d(e,["parts"]);if(r!=null){let o=r;if(Array.isArray(o))o=o.map((i)=>oq(i));m(t,["parts"],o)}let n=d(e,["role"]);if(n!=null)m(t,["role"],n);return t}function xL(e,t){let r={},n=d(e,["ttl"]);if(t!==void 0&&n!=null)m(t,["ttl"],n);let o=d(e,["expireTime"]);if(t!==void 0&&o!=null)m(t,["expireTime"],o);let i=d(e,["displayName"]);if(t!==void 0&&i!=null)m(t,["displayName"],i);let s=d(e,["contents"]);if(t!==void 0&&s!=null){let u=mr(s);if(Array.isArray(u))u=u.map((f)=>eg(f));m(t,["contents"],u)}let l=d(e,["systemInstruction"]);if(t!==void 0&&l!=null)m(t,["systemInstruction"],eg(Wt(l)));let a=d(e,["tools"]);if(t!==void 0&&a!=null){let u=a;if(Array.isArray(u))u=u.map((f)=>aq(f));m(t,["tools"],u)}let c=d(e,["toolConfig"]);if(t!==void 0&&c!=null)m(t,["toolConfig"],iq(c));if(d(e,["kmsKeyName"])!==void 0)throw Error("kmsKeyName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return r}function LL(e,t){let r={},n=d(e,["ttl"]);if(t!==void 0&&n!=null)m(t,["ttl"],n);let o=d(e,["expireTime"]);if(t!==void 0&&o!=null)m(t,["expireTime"],o);let i=d(e,["displayName"]);if(t!==void 0&&i!=null)m(t,["displayName"],i);let s=d(e,["contents"]);if(t!==void 0&&s!=null){let f=mr(s);if(Array.isArray(f))f=f.map((h)=>tg(h));m(t,["contents"],f)}let l=d(e,["systemInstruction"]);if(t!==void 0&&l!=null)m(t,["systemInstruction"],tg(Wt(l)));let a=d(e,["tools"]);if(t!==void 0&&a!=null){let f=a;if(Array.isArray(f))f=f.map((h)=>lq(h));m(t,["tools"],f)}let c=d(e,["toolConfig"]);if(t!==void 0&&c!=null)m(t,["toolConfig"],sq(c));let u=d(e,["kmsKeyName"]);if(t!==void 0&&u!=null)m(t,["encryption_spec","kmsKeyName"],u);return r}function qL(e,t){let r={},n=d(t,["model"]);if(n!=null)m(r,["model"],DE(e,n));let o=d(t,["config"]);if(o!=null)xL(o,r);return r}function UL(e,t){let r={},n=d(t,["model"]);if(n!=null)m(r,["model"],DE(e,n));let o=d(t,["config"]);if(o!=null)LL(o,r);return r}function FL(e,t){let r={},n=d(t,["name"]);if(n!=null)m(r,["_url","name"],Fn(e,n));return r}function GL(e,t){let r={},n=d(t,["name"]);if(n!=null)m(r,["_url","name"],Fn(e,n));return r}function BL(e){let t={},r=d(e,["sdkHttpResponse"]);if(r!=null)m(t,["sdkHttpResponse"],r);return t}function HL(e){let t={},r=d(e,["sdkHttpResponse"]);if(r!=null)m(t,["sdkHttpResponse"],r);return t}function zL(e){let t={},r=d(e,["args"]);if(r!=null)m(t,["args"],r);let n=d(e,["id"]);if(n!=null)m(t,["id"],n);let o=d(e,["name"]);if(o!=null)m(t,["name"],o);if(d(e,["partialArgs"])!==void 0)throw Error("partialArgs parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["willContinue"])!==void 0)throw Error("willContinue parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}function VL(e){let t={},r=d(e,["allowedFunctionNames"]);if(r!=null)m(t,["allowedFunctionNames"],r);let n=d(e,["mode"]);if(n!=null)m(t,["mode"],n);if(d(e,["streamFunctionCallArguments"])!==void 0)throw Error("streamFunctionCallArguments parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}function jL(e,t){let r={},n=d(t,["name"]);if(n!=null)m(r,["_url","name"],Fn(e,n));return r}function WL(e,t){let r={},n=d(t,["name"]);if(n!=null)m(r,["_url","name"],Fn(e,n));return r}function JL(e){let t={},r=d(e,["authConfig"]);if(r!=null)m(t,["authConfig"],DL(r));let n=d(e,["enableWidget"]);if(n!=null)m(t,["enableWidget"],n);if(d(e,["groundingTypes"])!==void 0)throw Error("groundingTypes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}function KL(e){let t={};if(d(e,["blockingConfidence"])!==void 0)throw Error("blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["excludeDomains"])!==void 0)throw Error("excludeDomains parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let r=d(e,["searchTypes"]);if(r!=null)m(t,["searchTypes"],r);let n=d(e,["timeRangeFilter"]);if(n!=null)m(t,["timeRangeFilter"],n);return t}function XL(e,t){let r={},n=d(e,["pageSize"]);if(t!==void 0&&n!=null)m(t,["_query","pageSize"],n);let o=d(e,["pageToken"]);if(t!==void 0&&o!=null)m(t,["_query","pageToken"],o);return r}function YL(e,t){let r={},n=d(e,["pageSize"]);if(t!==void 0&&n!=null)m(t,["_query","pageSize"],n);let o=d(e,["pageToken"]);if(t!==void 0&&o!=null)m(t,["_query","pageToken"],o);return r}function ZL(e){let t={},r=d(e,["config"]);if(r!=null)XL(r,t);return t}function QL(e){let t={},r=d(e,["config"]);if(r!=null)YL(r,t);return t}function eq(e){let t={},r=d(e,["sdkHttpResponse"]);if(r!=null)m(t,["sdkHttpResponse"],r);let n=d(e,["nextPageToken"]);if(n!=null)m(t,["nextPageToken"],n);let o=d(e,["cachedContents"]);if(o!=null){let i=o;if(Array.isArray(i))i=i.map((s)=>s);m(t,["cachedContents"],i)}return t}function tq(e){let t={},r=d(e,["sdkHttpResponse"]);if(r!=null)m(t,["sdkHttpResponse"],r);let n=d(e,["nextPageToken"]);if(n!=null)m(t,["nextPageToken"],n);let o=d(e,["cachedContents"]);if(o!=null){let i=o;if(Array.isArray(i))i=i.map((s)=>s);m(t,["cachedContents"],i)}return t}function rq(e){let t={};if(d(e,["name"])!==void 0)throw Error("name parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(d(e,["streamableHttpTransport"])!==void 0)throw Error("streamableHttpTransport parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return t}function nq(e){let t={},r=d(e,["mediaResolution"]);if(r!=null)m(t,["mediaResolution"],r);let n=d(e,["toolCall"]);if(n!=null)m(t,["toolCall"],n);let o=d(e,["toolResponse"]);if(o!=null)m(t,["toolResponse"],o);let i=d(e,["audioTranscription"]);if(i!=null)m(t,["audioTranscription"],i);let s=d(e,["codeExecutionResult"]);if(s!=null)m(t,["codeExecutionResult"],s);let l=d(e,["executableCode"]);if(l!=null)m(t,["executableCode"],l);let a=d(e,["fileData"]);if(a!=null)m(t,["fileData"],a);let c=d(e,["functionCall"]);if(c!=null)m(t,["functionCall"],zL(c));let u=d(e,["functionResponse"]);if(u!=null)m(t,["functionResponse"],u);let f=d(e,["inlineData"]);if(f!=null)m(t,["inlineData"],f);let h=d(e,["text"]);if(h!=null)m(t,["text"],h);let g=d(e,["thought"]);if(g!=null)m(t,["thought"],g);let p=d(e,["thoughtSignature"]);if(p!=null)m(t,["thoughtSignature"],p);let _=d(e,["videoMetadata"]);if(_!=null)m(t,["videoMetadata"],_);let y=d(e,["partMetadata"]);if(y!=null)m(t,["partMetadata"],y);let S=d(e,["mediaProcessing"]);if(S!=null)m(t,["mediaProcessing"],S);let E=d(e,["speechMetadata"]);if(E!=null)m(t,["speechMetadata"],E);return t}function oq(e){let t={},r=d(e,["mediaResolution"]);if(r!=null)m(t,["mediaResolution"],r);if(d(e,["toolCall"])!==void 0)throw Error("toolCall parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(d(e,["toolResponse"])!==void 0)throw Error("toolResponse parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let n=d(e,["audioTranscription"]);if(n!=null)m(t,["audioTranscription"],n);let o=d(e,["codeExecutionResult"]);if(o!=null)m(t,["codeExecutionResult"],o);let i=d(e,["executableCode"]);if(i!=null)m(t,["executableCode"],i);let s=d(e,["fileData"]);if(s!=null)m(t,["fileData"],s);let l=d(e,["functionCall"]);if(l!=null)m(t,["functionCall"],l);let a=d(e,["functionResponse"]);if(a!=null)m(t,["functionResponse"],a);let c=d(e,["inlineData"]);if(c!=null)m(t,["inlineData"],c);let u=d(e,["text"]);if(u!=null)m(t,["text"],u);let f=d(e,["thought"]);if(f!=null)m(t,["thought"],f);let h=d(e,["thoughtSignature"]);if(h!=null)m(t,["thoughtSignature"],h);let g=d(e,["videoMetadata"]);if(g!=null)m(t,["videoMetadata"],g);if(d(e,["partMetadata"])!==void 0)throw Error("partMetadata parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let p=d(e,["mediaProcessing"]);if(p!=null)m(t,["mediaProcessing"],p);let _=d(e,["speechMetadata"]);if(_!=null)m(t,["speechMetadata"],_);return t}function iq(e){let t={},r=d(e,["functionCallingConfig"]);if(r!=null)m(t,["functionCallingConfig"],VL(r));let n=d(e,["retrievalConfig"]);if(n!=null)m(t,["retrievalConfig"],n);let o=d(e,["includeServerSideToolInvocations"]);if(o!=null)m(t,["includeServerSideToolInvocations"],o);return t}function sq(e){let t={},r=d(e,["functionCallingConfig"]);if(r!=null)m(t,["functionCallingConfig"],r);let n=d(e,["retrievalConfig"]);if(n!=null)m(t,["retrievalConfig"],n);if(d(e,["includeServerSideToolInvocations"])!==void 0)throw Error("includeServerSideToolInvocations parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return t}function aq(e){let t={};if(d(e,["retrieval"])!==void 0)throw Error("retrieval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let r=d(e,["googleMaps"]);if(r!=null)m(t,["googleMaps"],JL(r));let n=d(e,["mcpServers"]);if(n!=null){let f=n;if(Array.isArray(f))f=f.map((h)=>h);m(t,["mcpServers"],f)}let o=d(e,["codeExecution"]);if(o!=null)m(t,["codeExecution"],o);let i=d(e,["computerUse"]);if(i!=null)m(t,["computerUse"],i);if(d(e,["enterpriseWebSearch"])!==void 0)throw Error("enterpriseWebSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["exaAiSearch"])!==void 0)throw Error("exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let s=d(e,["functionDeclarations"]);if(s!=null){let f=s;if(Array.isArray(f))f=f.map((h)=>h);m(t,["functionDeclarations"],f)}let l=d(e,["googleSearch"]);if(l!=null)m(t,["googleSearch"],KL(l));let a=d(e,["googleSearchRetrieval"]);if(a!=null)m(t,["googleSearchRetrieval"],a);if(d(e,["parallelAiSearch"])!==void 0)throw Error("parallelAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let c=d(e,["urlContext"]);if(c!=null)m(t,["urlContext"],c);let u=d(e,["fileSearch"]);if(u!=null)m(t,["fileSearch"],u);return t}function lq(e){let t={},r=d(e,["retrieval"]);if(r!=null)m(t,["retrieval"],r);let n=d(e,["googleMaps"]);if(n!=null)m(t,["googleMaps"],n);let o=d(e,["mcpServers"]);if(o!=null){let p=o;if(Array.isArray(p))p=p.map((_)=>rq(_));m(t,["mcpServers"],p)}let i=d(e,["codeExecution"]);if(i!=null)m(t,["codeExecution"],i);let s=d(e,["computerUse"]);if(s!=null)m(t,["computerUse"],$L(s));let l=d(e,["enterpriseWebSearch"]);if(l!=null)m(t,["enterpriseWebSearch"],l);let a=d(e,["exaAiSearch"]);if(a!=null)m(t,["exaAiSearch"],a);let c=d(e,["functionDeclarations"]);if(c!=null){let p=c;if(Array.isArray(p))p=p.map((_)=>_);m(t,["functionDeclarations"],p)}let u=d(e,["googleSearch"]);if(u!=null)m(t,["googleSearch"],u);let f=d(e,["googleSearchRetrieval"]);if(f!=null)m(t,["googleSearchRetrieval"],f);let h=d(e,["parallelAiSearch"]);if(h!=null)m(t,["parallelAiSearch"],h);let g=d(e,["urlContext"]);if(g!=null)m(t,["urlContext"],g);if(d(e,["fileSearch"])!==void 0)throw Error("fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return t}function cq(e,t){let r={},n=d(e,["ttl"]);if(t!==void 0&&n!=null)m(t,["ttl"],n);let o=d(e,["expireTime"]);if(t!==void 0&&o!=null)m(t,["expireTime"],o);return r}function uq(e,t){let r={},n=d(e,["ttl"]);if(t!==void 0&&n!=null)m(t,["ttl"],n);let o=d(e,["expireTime"]);if(t!==void 0&&o!=null)m(t,["expireTime"],o);return r}function dq(e,t){let r={},n=d(t,["name"]);if(n!=null)m(r,["_url","name"],Fn(e,n));let o=d(t,["config"]);if(o!=null)cq(o,r);return r}function fq(e,t){let r={},n=d(t,["name"]);if(n!=null)m(r,["_url","name"],Fn(e,n));let o=d(t,["config"]);if(o!=null)uq(o,r);return r}var pq=class extends Un{constructor(e){super();this.apiClient=e,this.list=async(t={})=>new Wo(xn.PAGED_ITEM_CACHED_CONTENTS,(r)=>this.listInternal(r),await this.listInternal(t),t)}async create(e){var t,r,n,o;let i,s="",l={};if(this.apiClient.isVertexAI()){let a=UL(this.apiClient,e);return s=Ae("cachedContents",a._url),l=a._query,delete a._url,delete a._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(a),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then((c)=>c.json()),i.then((c)=>c)}else{let a=qL(this.apiClient,e);return s=Ae("cachedContents",a._url),l=a._query,delete a._url,delete a._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(a),httpMethod:"POST",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then((c)=>c.json()),i.then((c)=>c)}}async get(e){var t,r,n,o;let i,s="",l={};if(this.apiClient.isVertexAI()){let a=WL(this.apiClient,e);return s=Ae("{name}",a._url),l=a._query,delete a._url,delete a._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(a),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then((c)=>c.json()),i.then((c)=>c)}else{let a=jL(this.apiClient,e);return s=Ae("{name}",a._url),l=a._query,delete a._url,delete a._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(a),httpMethod:"GET",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then((c)=>c.json()),i.then((c)=>c)}}async delete(e){var t,r,n,o;let i,s="",l={};if(this.apiClient.isVertexAI()){let a=GL(this.apiClient,e);return s=Ae("{name}",a._url),l=a._query,delete a._url,delete a._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(a),httpMethod:"DELETE",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then((c)=>c.json().then((u)=>{let f=u;return f.sdkHttpResponse={headers:c.headers},f})),i.then((c)=>{let u=HL(c),f=new Wm;return Object.assign(f,u),f})}else{let a=FL(this.apiClient,e);return s=Ae("{name}",a._url),l=a._query,delete a._url,delete a._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(a),httpMethod:"DELETE",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then((c)=>c.json().then((u)=>{let f=u;return f.sdkHttpResponse={headers:c.headers},f})),i.then((c)=>{let u=BL(c),f=new Wm;return Object.assign(f,u),f})}}async update(e){var t,r,n,o;let i,s="",l={};if(this.apiClient.isVertexAI()){let a=fq(this.apiClient,e);return s=Ae("{name}",a._url),l=a._query,delete a._url,delete a._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(a),httpMethod:"PATCH",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then((c)=>c.json()),i.then((c)=>c)}else{let a=dq(this.apiClient,e);return s=Ae("{name}",a._url),l=a._query,delete a._url,delete a._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(a),httpMethod:"PATCH",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then((c)=>c.json()),i.then((c)=>c)}}async listInternal(e){var t,r,n,o;let i,s="",l={};if(this.apiClient.isVertexAI()){let a=QL(e);return s=Ae("cachedContents",a._url),l=a._query,delete a._url,delete a._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(a),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then((c)=>c.json().then((u)=>{let f=u;return f.sdkHttpResponse={headers:c.headers},f})),i.then((c)=>{let u=tq(c),f=new Jm;return Object.assign(f,u),f})}else{let a=ZL(e);return s=Ae("cachedContents",a._url),l=a._query,delete a._url,delete a._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(a),httpMethod:"GET",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then((c)=>c.json().then((u)=>{let f=u;return f.sdkHttpResponse={headers:c.headers},f})),i.then((c)=>{let u=eq(c),f=new Jm;return Object.assign(f,u),f})}}};function $t(e,t){var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0)r[n]=e[n];if(e!=null&&typeof Object.getOwnPropertySymbols==="function"){for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)if(t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o]))r[n[o]]=e[n[o]]}return r}function rg(e){var t=typeof Symbol==="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length==="number")return{next:function(){if(e&&n>=e.length)e=void 0;return{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function kt(e){return this instanceof kt?(this.v=e,this):new kt(e)}function Ii(e,t,r){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),o,i=[];return o=Object.create((typeof AsyncIterator==="function"?AsyncIterator:Object).prototype),l("next"),l("throw"),l("return",s),o[Symbol.asyncIterator]=function(){return this},o;function s(g){return function(p){return Promise.resolve(p).then(g,f)}}function l(g,p){if(n[g]){if(o[g]=function(_){return new Promise(function(y,S){i.push([g,_,y,S])>1||a(g,_)})},p)o[g]=p(o[g])}}function a(g,p){try{c(n[g](p))}catch(_){h(i[0][3],_)}}function c(g){g.value instanceof kt?Promise.resolve(g.value.v).then(u,f):h(i[0][2],g)}function u(g){a("next",g)}function f(g){a("throw",g)}function h(g,p){if(g(p),i.shift(),i.length)a(i[0][0],i[0][1])}}function ks(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof rg==="function"?rg(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=e[i]&&function(s){return new Promise(function(l,a){s=e[i](s),o(l,a,s.done,s.value)})}}function o(i,s,l,a){Promise.resolve(a).then(function(c){i({value:c,done:l})},s)}}function hq(e){var t;if(e.candidates==null||e.candidates.length===0)return!1;let r=(t=e.candidates[0])===null||t===void 0?void 0:t.content;if(r===void 0)return!1;return JE(r)}function JE(e){if(e.parts===void 0||e.parts.length===0)return!1;for(let t of e.parts)if(t===void 0||Object.keys(t).length===0)return!1;return!0}function mq(e){if(e.length===0)return;for(let t of e)if(t.role!=="user"&&t.role!=="model")throw Error(`Role must be user or model, but got ${t.role}.`)}function ng(e){if(e===void 0||e.length===0)return[];let t=[],r=e.length,n=0;while(n<r)if(e[n].role==="user")t.push(e[n]),n++;else{let o=[],i=!0;while(n<r&&e[n].role==="model"){if(o.push(e[n]),i&&!JE(e[n]))i=!1;n++}if(i)t.push(...o);else t.pop()}return t}var gq=class{constructor(e,t){this.modelsModule=e,this.apiClient=t}create(e){return new vq(this.apiClient,this.modelsModule,e.model,e.config,structuredClone(e.history))}},vq=class{constructor(e,t,r,n={},o=[]){this.apiClient=e,this.modelsModule=t,this.model=r,this.config=n,this.history=o,this.sendPromise=Promise.resolve(),mq(o)}async sendMessage(e){var t;await this.sendPromise;let r=Wt(e.message),n=this.modelsModule.generateContent({model:this.model,contents:this.getHistory(!0).concat(r),config:(t=e.config)!==null&&t!==void 0?t:this.config});return this.sendPromise=(async()=>{var o,i,s;let l=await n,a=(i=(o=l.candidates)===null||o===void 0?void 0:o[0])===null||i===void 0?void 0:i.content,c=l.automaticFunctionCallingHistory,u=this.getHistory(!0).length,f=[];if(c!=null)f=(s=c.slice(u))!==null&&s!==void 0?s:[];let h=a?[a]:[];this.recordHistory(r,h,f);return})(),await this.sendPromise.catch(()=>{this.sendPromise=Promise.resolve()}),n}async sendMessageStream(e){var t;await this.sendPromise;let r=Wt(e.message),n=this.modelsModule.generateContentStream({model:this.model,contents:this.getHistory(!0).concat(r),config:(t=e.config)!==null&&t!==void 0?t:this.config});this.sendPromise=n.then(()=>{return}).catch(()=>{return});let o=await n;return this.processStreamResponse(o,r)}getHistory(e=!1){let t=e?ng(this.history):this.history;return structuredClone(t)}processStreamResponse(e,t){return Ii(this,arguments,function*r(){var n,o,i,s,l,a;let c=[];try{for(var u=!0,f=ks(e),h;h=yield kt(f.next()),n=h.done,!n;u=!0){s=h.value,u=!1;let g=s;if(hq(g)){let p=(a=(l=g.candidates)===null||l===void 0?void 0:l[0])===null||a===void 0?void 0:a.content;if(p!==void 0)c.push(p)}yield yield kt(g)}}catch(g){o={error:g}}finally{try{if(!u&&!n&&(i=f.return))yield kt(i.call(f))}finally{if(o)throw o.error}}this.recordHistory(t,c)})}recordHistory(e,t,r){let n=[];if(t.length>0&&t.every((o)=>o.role!==void 0))n=t;else n.push({role:"model",parts:[]});if(r&&r.length>0)this.history.push(...ng(r));else this.history.push(e);this.history.push(...n)}},KE=class e extends Error{constructor(t){super(t.message);this.name="ApiError",this.status=t.status,Object.setPrototypeOf(this,e.prototype)}};function _q(e){let t={},r=d(e,["file"]);if(r!=null)m(t,["file"],r);return t}function yq(e){let t={},r=d(e,["sdkHttpResponse"]);if(r!=null)m(t,["sdkHttpResponse"],r);return t}function Sq(e){let t={},r=d(e,["name"]);if(r!=null)m(t,["_url","file"],ef(r));return t}function Eq(e){let t={},r=d(e,["sdkHttpResponse"]);if(r!=null)m(t,["sdkHttpResponse"],r);return t}function bq(e){let t={},r=d(e,["name"]);if(r!=null)m(t,["_url","file"],ef(r));return t}function wq(e){let t={},r=d(e,["uris"]);if(r!=null)m(t,["uris"],r);return t}function Tq(e,t){let r={},n=d(e,["pageSize"]);if(t!==void 0&&n!=null)m(t,["_query","pageSize"],n);let o=d(e,["pageToken"]);if(t!==void 0&&o!=null)m(t,["_query","pageToken"],o);return r}function Cq(e){let t={},r=d(e,["config"]);if(r!=null)Tq(r,t);return t}function Rq(e){let t={},r=d(e,["sdkHttpResponse"]);if(r!=null)m(t,["sdkHttpResponse"],r);let n=d(e,["nextPageToken"]);if(n!=null)m(t,["nextPageToken"],n);let o=d(e,["files"]);if(o!=null){let i=o;if(Array.isArray(i))i=i.map((s)=>s);m(t,["files"],i)}return t}function Aq(e){let t={},r=d(e,["sdkHttpResponse"]);if(r!=null)m(t,["sdkHttpResponse"],r);let n=d(e,["files"]);if(n!=null){let o=n;if(Array.isArray(o))o=o.map((i)=>i);m(t,["files"],o)}return t}var Iq=class e extends Un{constructor(t){super();this.apiClient=t,this.list=async(r={})=>new Wo(xn.PAGED_ITEM_FILES,(n)=>this.listInternal(n),await this.listInternal(r),r)}async upload(t){if(this.apiClient.isVertexAI())throw Error("Gemini Enterprise Agent Platform (previously known as Vertex AI) does not support uploading files. You can share files through a GCS bucket.");return this.apiClient.uploadFile(t.file,t.config).then((r)=>r)}async download(t){await this.apiClient.downloadFile(t)}async registerFiles(t){throw Error("registerFiles is only supported in Node.js environments.")}async _registerFiles(t){return this.registerFilesInternal(t)}async listInternal(t){var r,n;let o,i="",s={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");else{let l=Cq(t);return i=Ae("files",l._url),s=l._query,delete l._url,delete l._query,o=this.apiClient.request({path:i,queryParams:s,body:JSON.stringify(l),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(n=t.config)===null||n===void 0?void 0:n.abortSignal}).then((a)=>a.json().then((c)=>{let u=c;return u.sdkHttpResponse={headers:a.headers},u})),o.then((a)=>{let c=Rq(a),u=new Ax;return Object.assign(u,c),u})}}async createInternal(t){var r,n;let o,i="",s={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");else{let l=_q(t);return i=Ae("upload/v1beta/files",l._url),s=l._query,delete l._url,delete l._query,o=this.apiClient.request({path:i,queryParams:s,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(n=t.config)===null||n===void 0?void 0:n.abortSignal}).then((a)=>a.json()),o.then((a)=>{let c=yq(a),u=new Ix;return Object.assign(u,c),u})}}async get(t){var r,n;let o,i="",s={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");else{let l=bq(t);return i=Ae("files/{file}",l._url),s=l._query,delete l._url,delete l._query,o=this.apiClient.request({path:i,queryParams:s,body:JSON.stringify(l),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(n=t.config)===null||n===void 0?void 0:n.abortSignal}).then((a)=>a.json()),o.then((a)=>a)}}async delete(t){var r,n;let o,i="",s={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");else{let l=Sq(t);return i=Ae("files/{file}",l._url),s=l._query,delete l._url,delete l._query,o=this.apiClient.request({path:i,queryParams:s,body:JSON.stringify(l),httpMethod:"DELETE",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(n=t.config)===null||n===void 0?void 0:n.abortSignal}).then((a)=>a.json().then((c)=>{let u=c;return u.sdkHttpResponse={headers:a.headers},u})),o.then((a)=>{let c=Eq(a),u=new Px;return Object.assign(u,c),u})}}async registerFilesInternal(t){var r,n;let o,i="",s={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");else{let l=wq(t);return i=Ae("files:register",l._url),s=l._query,delete l._url,delete l._query,o=this.apiClient.request({path:i,queryParams:s,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(n=t.config)===null||n===void 0?void 0:n.abortSignal}).then((a)=>a.json()),o.then((a)=>{let c=Aq(a),u=new kx;return Object.assign(u,c),u})}}};function Pq(e){let t={},r=d(e,["apiKey"]);if(r!=null)m(t,["apiKey"],r);if(d(e,["apiKeyConfig"])!==void 0)throw Error("apiKeyConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["authType"])!==void 0)throw Error("authType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["googleServiceAccountConfig"])!==void 0)throw Error("googleServiceAccountConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["httpBasicAuthConfig"])!==void 0)throw Error("httpBasicAuthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["oauthConfig"])!==void 0)throw Error("oauthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["oidcConfig"])!==void 0)throw Error("oidcConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}function kq(e){let t={},r=d(e,["enablePromptInjectionDetection"]);if(r!=null)m(t,["enablePromptInjectionDetection"],r);let n=d(e,["environment"]);if(n!=null)m(t,["environment"],n);let o=d(e,["excludedPredefinedFunctions"]);if(o!=null)m(t,["excludedPredefinedFunctions"],o);if(d(e,["disabledSafetyPolicies"])!==void 0)throw Error("disabledSafetyPolicies parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return t}function Nq(e){let t={},r=d(e,["parts"]);if(r!=null){let o=r;if(Array.isArray(o))o=o.map((i)=>Jq(i));m(t,["parts"],o)}let n=d(e,["role"]);if(n!=null)m(t,["role"],n);return t}function Oq(e){let t={},r=d(e,["parts"]);if(r!=null){let o=r;if(Array.isArray(o))o=o.map((i)=>Kq(i));m(t,["parts"],o)}let n=d(e,["role"]);if(n!=null)m(t,["role"],n);return t}function Mq(e){let t={},r=d(e,["args"]);if(r!=null)m(t,["args"],r);let n=d(e,["id"]);if(n!=null)m(t,["id"],n);let o=d(e,["name"]);if(o!=null)m(t,["name"],o);if(d(e,["partialArgs"])!==void 0)throw Error("partialArgs parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["willContinue"])!==void 0)throw Error("willContinue parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}function Dq(e){let t={},r=d(e,["modelSelectionConfig"]);if(r!=null)m(t,["modelConfig"],r);let n=d(e,["responseJsonSchema"]);if(n!=null)m(t,["responseJsonSchema"],Xi(n));let o=d(e,["audioTranscriptionConfig"]);if(o!=null)m(t,["audioTranscriptionConfig"],o);let i=d(e,["audioTimestamp"]);if(i!=null)m(t,["audioTimestamp"],i);let s=d(e,["candidateCount"]);if(s!=null)m(t,["candidateCount"],s);let l=d(e,["enableAffectiveDialog"]);if(l!=null)m(t,["enableAffectiveDialog"],l);let a=d(e,["frequencyPenalty"]);if(a!=null)m(t,["frequencyPenalty"],a);let c=d(e,["logprobs"]);if(c!=null)m(t,["logprobs"],c);let u=d(e,["maxOutputTokens"]);if(u!=null)m(t,["maxOutputTokens"],u);let f=d(e,["mediaResolution"]);if(f!=null)m(t,["mediaResolution"],f);let h=d(e,["presencePenalty"]);if(h!=null)m(t,["presencePenalty"],h);let g=d(e,["responseFormat"]);if(g!=null){let N=g;if(Array.isArray(N))N=N.map((F)=>F);m(t,["responseFormat"],N)}let p=d(e,["responseLogprobs"]);if(p!=null)m(t,["responseLogprobs"],p);let _=d(e,["responseMimeType"]);if(_!=null)m(t,["responseMimeType"],_);let y=d(e,["responseModalities"]);if(y!=null)m(t,["responseModalities"],y);let S=d(e,["responseSchema"]);if(S!=null)m(t,["responseSchema"],S);let E=d(e,["routingConfig"]);if(E!=null)m(t,["routingConfig"],E);let b=d(e,["seed"]);if(b!=null)m(t,["seed"],b);let R=d(e,["speechConfig"]);if(R!=null)m(t,["speechConfig"],XE(R));let w=d(e,["stopSequences"]);if(w!=null)m(t,["stopSequences"],w);let T=d(e,["temperature"]);if(T!=null)m(t,["temperature"],T);let C=d(e,["thinkingConfig"]);if(C!=null)m(t,["thinkingConfig"],C);let A=d(e,["topK"]);if(A!=null)m(t,["topK"],A);let P=d(e,["topP"]);if(P!=null)m(t,["topP"],P);if(d(e,["enableEnhancedCivicAnswers"])!==void 0)throw Error("enableEnhancedCivicAnswers parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let D=d(e,["translationConfig"]);if(D!=null)m(t,["translationConfig"],D);return t}function $q(e){let t={},r=d(e,["authConfig"]);if(r!=null)m(t,["authConfig"],Pq(r));let n=d(e,["enableWidget"]);if(n!=null)m(t,["enableWidget"],n);if(d(e,["groundingTypes"])!==void 0)throw Error("groundingTypes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}function xq(e){let t={};if(d(e,["blockingConfidence"])!==void 0)throw Error("blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["excludeDomains"])!==void 0)throw Error("excludeDomains parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let r=d(e,["searchTypes"]);if(r!=null)m(t,["searchTypes"],r);let n=d(e,["timeRangeFilter"]);if(n!=null)m(t,["timeRangeFilter"],n);return t}function Lq(e,t){let r={},n=d(e,["generationConfig"]);if(t!==void 0&&n!=null)m(t,["setup","generationConfig"],n);let o=d(e,["responseModalities"]);if(t!==void 0&&o!=null)m(t,["setup","generationConfig","responseModalities"],o);let i=d(e,["temperature"]);if(t!==void 0&&i!=null)m(t,["setup","generationConfig","temperature"],i);let s=d(e,["topP"]);if(t!==void 0&&s!=null)m(t,["setup","generationConfig","topP"],s);let l=d(e,["topK"]);if(t!==void 0&&l!=null)m(t,["setup","generationConfig","topK"],l);let a=d(e,["maxOutputTokens"]);if(t!==void 0&&a!=null)m(t,["setup","generationConfig","maxOutputTokens"],a);let c=d(e,["mediaResolution"]);if(t!==void 0&&c!=null)m(t,["setup","generationConfig","mediaResolution"],c);let u=d(e,["seed"]);if(t!==void 0&&u!=null)m(t,["setup","generationConfig","seed"],u);let f=d(e,["speechConfig"]);if(t!==void 0&&f!=null)m(t,["setup","generationConfig","speechConfig"],Qd(f));let h=d(e,["thinkingConfig"]);if(t!==void 0&&h!=null)m(t,["setup","generationConfig","thinkingConfig"],h);let g=d(e,["enableAffectiveDialog"]);if(t!==void 0&&g!=null)m(t,["setup","generationConfig","enableAffectiveDialog"],g);let p=d(e,["systemInstruction"]);if(t!==void 0&&p!=null)m(t,["setup","systemInstruction"],Nq(Wt(p)));let _=d(e,["tools"]);if(t!==void 0&&_!=null){let P=Zi(_);if(Array.isArray(P))P=P.map((D)=>eU(Yi(D)));m(t,["setup","tools"],P)}let y=d(e,["sessionResumption"]);if(t!==void 0&&y!=null)m(t,["setup","sessionResumption"],Zq(y));let S=d(e,["inputAudioTranscription"]);if(t!==void 0&&S!=null)m(t,["setup","inputAudioTranscription"],S);let E=d(e,["outputAudioTranscription"]);if(t!==void 0&&E!=null)m(t,["setup","outputAudioTranscription"],E);let b=d(e,["realtimeInputConfig"]);if(t!==void 0&&b!=null)m(t,["setup","realtimeInputConfig"],b);let R=d(e,["contextWindowCompression"]);if(t!==void 0&&R!=null)m(t,["setup","contextWindowCompression"],R);let w=d(e,["proactivity"]);if(t!==void 0&&w!=null)m(t,["setup","proactivity"],w);if(d(e,["explicitVadSignal"])!==void 0)throw Error("explicitVadSignal parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let T=d(e,["avatarConfig"]);if(t!==void 0&&T!=null)m(t,["setup","avatarConfig"],T);let C=d(e,["safetySettings"]);if(t!==void 0&&C!=null){let P=C;if(Array.isArray(P))P=P.map((D)=>Yq(D));m(t,["setup","safetySettings"],P)}let A=d(e,["translationConfig"]);if(t!==void 0&&A!=null)m(t,["setup","generationConfig","translationConfig"],A);return r}function qq(e,t){let r={},n=d(e,["generationConfig"]);if(t!==void 0&&n!=null)m(t,["setup","generationConfig"],Dq(n));let o=d(e,["responseModalities"]);if(t!==void 0&&o!=null)m(t,["setup","generationConfig","responseModalities"],o);let i=d(e,["temperature"]);if(t!==void 0&&i!=null)m(t,["setup","generationConfig","temperature"],i);let s=d(e,["topP"]);if(t!==void 0&&s!=null)m(t,["setup","generationConfig","topP"],s);let l=d(e,["topK"]);if(t!==void 0&&l!=null)m(t,["setup","generationConfig","topK"],l);let a=d(e,["maxOutputTokens"]);if(t!==void 0&&a!=null)m(t,["setup","generationConfig","maxOutputTokens"],a);let c=d(e,["mediaResolution"]);if(t!==void 0&&c!=null)m(t,["setup","generationConfig","mediaResolution"],c);let u=d(e,["seed"]);if(t!==void 0&&u!=null)m(t,["setup","generationConfig","seed"],u);let f=d(e,["speechConfig"]);if(t!==void 0&&f!=null)m(t,["setup","generationConfig","speechConfig"],XE(Qd(f)));let h=d(e,["thinkingConfig"]);if(t!==void 0&&h!=null)m(t,["setup","generationConfig","thinkingConfig"],h);let g=d(e,["enableAffectiveDialog"]);if(t!==void 0&&g!=null)m(t,["setup","generationConfig","enableAffectiveDialog"],g);let p=d(e,["systemInstruction"]);if(t!==void 0&&p!=null)m(t,["setup","systemInstruction"],Oq(Wt(p)));let _=d(e,["tools"]);if(t!==void 0&&_!=null){let D=Zi(_);if(Array.isArray(D))D=D.map((N)=>tU(Yi(N)));m(t,["setup","tools"],D)}let y=d(e,["sessionResumption"]);if(t!==void 0&&y!=null)m(t,["setup","sessionResumption"],y);let S=d(e,["inputAudioTranscription"]);if(t!==void 0&&S!=null)m(t,["setup","inputAudioTranscription"],S);let E=d(e,["outputAudioTranscription"]);if(t!==void 0&&E!=null)m(t,["setup","outputAudioTranscription"],E);let b=d(e,["realtimeInputConfig"]);if(t!==void 0&&b!=null)m(t,["setup","realtimeInputConfig"],b);let R=d(e,["contextWindowCompression"]);if(t!==void 0&&R!=null)m(t,["setup","contextWindowCompression"],R);let w=d(e,["proactivity"]);if(t!==void 0&&w!=null)m(t,["setup","proactivity"],w);let T=d(e,["explicitVadSignal"]);if(t!==void 0&&T!=null)m(t,["setup","explicitVadSignal"],T);let C=d(e,["avatarConfig"]);if(t!==void 0&&C!=null)m(t,["setup","avatarConfig"],C);let A=d(e,["safetySettings"]);if(t!==void 0&&A!=null){let D=A;if(Array.isArray(D))D=D.map((N)=>N);m(t,["setup","safetySettings"],D)}let P=d(e,["translationConfig"]);if(t!==void 0&&P!=null)m(t,["setup","generationConfig","translationConfig"],P);return r}function Uq(e,t){let r={},n=d(t,["model"]);if(n!=null)m(r,["setup","model"],yt(e,n));let o=d(t,["config"]);if(o!=null)m(r,["config"],Lq(o,r));return r}function Fq(e,t){let r={},n=d(t,["model"]);if(n!=null)m(r,["setup","model"],yt(e,n));let o=d(t,["config"]);if(o!=null)m(r,["config"],qq(o,r));return r}function Gq(e){let t={},r=d(e,["musicGenerationConfig"]);if(r!=null)m(t,["musicGenerationConfig"],r);return t}function Bq(e){let t={},r=d(e,["weightedPrompts"]);if(r!=null){let n=r;if(Array.isArray(n))n=n.map((o)=>o);m(t,["weightedPrompts"],n)}return t}function Hq(e){let t={},r=d(e,["media"]);if(r!=null){let c=$E(r);if(Array.isArray(c))c=c.map((u)=>u);m(t,["mediaChunks"],c)}let n=d(e,["audio"]);if(n!=null)m(t,["audio"],LE(n));let o=d(e,["audioStreamEnd"]);if(o!=null)m(t,["audioStreamEnd"],o);let i=d(e,["video"]);if(i!=null)m(t,["video"],xE(i));let s=d(e,["text"]);if(s!=null)m(t,["text"],s);let l=d(e,["activityStart"]);if(l!=null)m(t,["activityStart"],l);let a=d(e,["activityEnd"]);if(a!=null)m(t,["activityEnd"],a);return t}function zq(e){let t={},r=d(e,["media"]);if(r!=null){let c=$E(r);if(Array.isArray(c))c=c.map((u)=>u);m(t,["mediaChunks"],c)}let n=d(e,["audio"]);if(n!=null)m(t,["audio"],LE(n));let o=d(e,["audioStreamEnd"]);if(o!=null)m(t,["audioStreamEnd"],o);let i=d(e,["video"]);if(i!=null)m(t,["video"],xE(i));let s=d(e,["text"]);if(s!=null)m(t,["text"],s);let l=d(e,["activityStart"]);if(l!=null)m(t,["activityStart"],l);let a=d(e,["activityEnd"]);if(a!=null)m(t,["activityEnd"],a);return t}function Vq(e){let t={},r=d(e,["setupComplete"]);if(r!=null)m(t,["setupComplete"],r);let n=d(e,["serverContent"]);if(n!=null)m(t,["serverContent"],n);let o=d(e,["toolCall"]);if(o!=null)m(t,["toolCall"],o);let i=d(e,["toolCallCancellation"]);if(i!=null)m(t,["toolCallCancellation"],i);let s=d(e,["usageMetadata"]);if(s!=null)m(t,["usageMetadata"],rU(s));let l=d(e,["goAway"]);if(l!=null)m(t,["goAway"],l);let a=d(e,["sessionResumptionUpdate"]);if(a!=null)m(t,["sessionResumptionUpdate"],a);let c=d(e,["voiceActivityDetectionSignal"]);if(c!=null)m(t,["voiceActivityDetectionSignal"],c);let u=d(e,["voiceActivity"]);if(u!=null)m(t,["voiceActivity"],nU(u));return t}function jq(e){let t={};if(d(e,["name"])!==void 0)throw Error("name parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(d(e,["streamableHttpTransport"])!==void 0)throw Error("streamableHttpTransport parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return t}function Wq(e){let t={},r=d(e,["speakerVoiceConfigs"]);if(r!=null){let n=r;if(Array.isArray(n))n=n.map((o)=>Qq(o));m(t,["speakerVoiceConfigs"],n)}return t}function Jq(e){let t={},r=d(e,["mediaResolution"]);if(r!=null)m(t,["mediaResolution"],r);let n=d(e,["toolCall"]);if(n!=null)m(t,["toolCall"],n);let o=d(e,["toolResponse"]);if(o!=null)m(t,["toolResponse"],o);let i=d(e,["audioTranscription"]);if(i!=null)m(t,["audioTranscription"],i);let s=d(e,["codeExecutionResult"]);if(s!=null)m(t,["codeExecutionResult"],s);let l=d(e,["executableCode"]);if(l!=null)m(t,["executableCode"],l);let a=d(e,["fileData"]);if(a!=null)m(t,["fileData"],a);let c=d(e,["functionCall"]);if(c!=null)m(t,["functionCall"],Mq(c));let u=d(e,["functionResponse"]);if(u!=null)m(t,["functionResponse"],u);let f=d(e,["inlineData"]);if(f!=null)m(t,["inlineData"],f);let h=d(e,["text"]);if(h!=null)m(t,["text"],h);let g=d(e,["thought"]);if(g!=null)m(t,["thought"],g);let p=d(e,["thoughtSignature"]);if(p!=null)m(t,["thoughtSignature"],p);let _=d(e,["videoMetadata"]);if(_!=null)m(t,["videoMetadata"],_);let y=d(e,["partMetadata"]);if(y!=null)m(t,["partMetadata"],y);let S=d(e,["mediaProcessing"]);if(S!=null)m(t,["mediaProcessing"],S);let E=d(e,["speechMetadata"]);if(E!=null)m(t,["speechMetadata"],E);return t}function Kq(e){let t={},r=d(e,["mediaResolution"]);if(r!=null)m(t,["mediaResolution"],r);if(d(e,["toolCall"])!==void 0)throw Error("toolCall parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(d(e,["toolResponse"])!==void 0)throw Error("toolResponse parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let n=d(e,["audioTranscription"]);if(n!=null)m(t,["audioTranscription"],n);let o=d(e,["codeExecutionResult"]);if(o!=null)m(t,["codeExecutionResult"],o);let i=d(e,["executableCode"]);if(i!=null)m(t,["executableCode"],i);let s=d(e,["fileData"]);if(s!=null)m(t,["fileData"],s);let l=d(e,["functionCall"]);if(l!=null)m(t,["functionCall"],l);let a=d(e,["functionResponse"]);if(a!=null)m(t,["functionResponse"],a);let c=d(e,["inlineData"]);if(c!=null)m(t,["inlineData"],c);let u=d(e,["text"]);if(u!=null)m(t,["text"],u);let f=d(e,["thought"]);if(f!=null)m(t,["thought"],f);let h=d(e,["thoughtSignature"]);if(h!=null)m(t,["thoughtSignature"],h);let g=d(e,["videoMetadata"]);if(g!=null)m(t,["videoMetadata"],g);if(d(e,["partMetadata"])!==void 0)throw Error("partMetadata parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let p=d(e,["mediaProcessing"]);if(p!=null)m(t,["mediaProcessing"],p);let _=d(e,["speechMetadata"]);if(_!=null)m(t,["speechMetadata"],_);return t}function Xq(e){let t={},r=d(e,["mimeType"]);if(r!=null)m(t,["mimeType"],r);let n=d(e,["voiceSampleAudio"]);if(n!=null)m(t,["voiceSampleAudio"],n);if(d(e,["consentAudio"])!==void 0)throw Error("consentAudio parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(d(e,["voiceConsentSignature"])!==void 0)throw Error("voiceConsentSignature parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return t}function Yq(e){let t={},r=d(e,["category"]);if(r!=null)m(t,["category"],r);if(d(e,["method"])!==void 0)throw Error("method parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let n=d(e,["threshold"]);if(n!=null)m(t,["threshold"],n);return t}function Zq(e){let t={},r=d(e,["handle"]);if(r!=null)m(t,["handle"],r);if(d(e,["transparent"])!==void 0)throw Error("transparent parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}function Qq(e){let t={},r=d(e,["speaker"]);if(r!=null)m(t,["speaker"],r);let n=d(e,["voiceConfig"]);if(n!=null)m(t,["voiceConfig"],YE(n));return t}function XE(e){let t={},r=d(e,["voiceConfig"]);if(r!=null)m(t,["voiceConfig"],YE(r));let n=d(e,["languageCode"]);if(n!=null)m(t,["languageCode"],n);let o=d(e,["multiSpeakerVoiceConfig"]);if(o!=null)m(t,["multiSpeakerVoiceConfig"],Wq(o));return t}function eU(e){let t={};if(d(e,["retrieval"])!==void 0)throw Error("retrieval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let r=d(e,["googleMaps"]);if(r!=null)m(t,["googleMaps"],$q(r));let n=d(e,["mcpServers"]);if(n!=null){let f=n;if(Array.isArray(f))f=f.map((h)=>h);m(t,["mcpServers"],f)}let o=d(e,["codeExecution"]);if(o!=null)m(t,["codeExecution"],o);let i=d(e,["computerUse"]);if(i!=null)m(t,["computerUse"],i);if(d(e,["enterpriseWebSearch"])!==void 0)throw Error("enterpriseWebSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["exaAiSearch"])!==void 0)throw Error("exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let s=d(e,["functionDeclarations"]);if(s!=null){let f=s;if(Array.isArray(f))f=f.map((h)=>h);m(t,["functionDeclarations"],f)}let l=d(e,["googleSearch"]);if(l!=null)m(t,["googleSearch"],xq(l));let a=d(e,["googleSearchRetrieval"]);if(a!=null)m(t,["googleSearchRetrieval"],a);if(d(e,["parallelAiSearch"])!==void 0)throw Error("parallelAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let c=d(e,["urlContext"]);if(c!=null)m(t,["urlContext"],c);let u=d(e,["fileSearch"]);if(u!=null)m(t,["fileSearch"],u);return t}function tU(e){let t={},r=d(e,["retrieval"]);if(r!=null)m(t,["retrieval"],r);let n=d(e,["googleMaps"]);if(n!=null)m(t,["googleMaps"],n);let o=d(e,["mcpServers"]);if(o!=null){let p=o;if(Array.isArray(p))p=p.map((_)=>jq(_));m(t,["mcpServers"],p)}let i=d(e,["codeExecution"]);if(i!=null)m(t,["codeExecution"],i);let s=d(e,["computerUse"]);if(s!=null)m(t,["computerUse"],kq(s));let l=d(e,["enterpriseWebSearch"]);if(l!=null)m(t,["enterpriseWebSearch"],l);let a=d(e,["exaAiSearch"]);if(a!=null)m(t,["exaAiSearch"],a);let c=d(e,["functionDeclarations"]);if(c!=null){let p=c;if(Array.isArray(p))p=p.map((_)=>_);m(t,["functionDeclarations"],p)}let u=d(e,["googleSearch"]);if(u!=null)m(t,["googleSearch"],u);let f=d(e,["googleSearchRetrieval"]);if(f!=null)m(t,["googleSearchRetrieval"],f);let h=d(e,["parallelAiSearch"]);if(h!=null)m(t,["parallelAiSearch"],h);let g=d(e,["urlContext"]);if(g!=null)m(t,["urlContext"],g);if(d(e,["fileSearch"])!==void 0)throw Error("fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return t}function rU(e){let t={},r=d(e,["candidatesTokenCount"]);if(r!=null)m(t,["responseTokenCount"],r);let n=d(e,["candidatesTokensDetails"]);if(n!=null){let g=n;if(Array.isArray(g))g=g.map((p)=>p);m(t,["responseTokensDetails"],g)}let o=d(e,["cacheTokensDetails"]);if(o!=null){let g=o;if(Array.isArray(g))g=g.map((p)=>p);m(t,["cacheTokensDetails"],g)}let i=d(e,["cachedContentTokenCount"]);if(i!=null)m(t,["cachedContentTokenCount"],i);let s=d(e,["promptTokenCount"]);if(s!=null)m(t,["promptTokenCount"],s);let l=d(e,["promptTokensDetails"]);if(l!=null){let g=l;if(Array.isArray(g))g=g.map((p)=>p);m(t,["promptTokensDetails"],g)}let a=d(e,["thoughtsTokenCount"]);if(a!=null)m(t,["thoughtsTokenCount"],a);let c=d(e,["toolUsePromptTokenCount"]);if(c!=null)m(t,["toolUsePromptTokenCount"],c);let u=d(e,["toolUsePromptTokensDetails"]);if(u!=null){let g=u;if(Array.isArray(g))g=g.map((p)=>p);m(t,["toolUsePromptTokensDetails"],g)}let f=d(e,["totalTokenCount"]);if(f!=null)m(t,["totalTokenCount"],f);let h=d(e,["trafficType"]);if(h!=null)m(t,["trafficType"],h);return t}function nU(e){let t={},r=d(e,["type"]);if(r!=null)m(t,["voiceActivityType"],r);let n=d(e,["audioOffset"]);if(n!=null)m(t,["audioOffset"],n);return t}function YE(e){let t={},r=d(e,["replicatedVoiceConfig"]);if(r!=null)m(t,["replicatedVoiceConfig"],Xq(r));let n=d(e,["prebuiltVoiceConfig"]);if(n!=null)m(t,["prebuiltVoiceConfig"],n);let o=d(e,["voice"]);if(o!=null)m(t,["voice"],o);return t}function oU(e,t){let r={},n=d(e,["apiKey"]);if(n!=null)m(r,["apiKey"],n);if(d(e,["apiKeyConfig"])!==void 0)throw Error("apiKeyConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["authType"])!==void 0)throw Error("authType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["googleServiceAccountConfig"])!==void 0)throw Error("googleServiceAccountConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["httpBasicAuthConfig"])!==void 0)throw Error("httpBasicAuthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["oauthConfig"])!==void 0)throw Error("oauthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["oidcConfig"])!==void 0)throw Error("oidcConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return r}function iU(e,t){let r={},n=d(e,["content"]);if(n!=null)m(r,["content"],n);let o=d(e,["citationMetadata"]);if(o!=null)m(r,["citationMetadata"],sU(o));let i=d(e,["tokenCount"]);if(i!=null)m(r,["tokenCount"],i);let s=d(e,["finishReason"]);if(s!=null)m(r,["finishReason"],s);let l=d(e,["groundingMetadata"]);if(l!=null)m(r,["groundingMetadata"],l);let a=d(e,["avgLogprobs"]);if(a!=null)m(r,["avgLogprobs"],a);let c=d(e,["index"]);if(c!=null)m(r,["index"],c);let u=d(e,["logprobsResult"]);if(u!=null)m(r,["logprobsResult"],u);let f=d(e,["safetyRatings"]);if(f!=null){let p=f;if(Array.isArray(p))p=p.map((_)=>_);m(r,["safetyRatings"],p)}let h=d(e,["urlContextMetadata"]);if(h!=null)m(r,["urlContextMetadata"],h);let g=d(e,["continuationToken"]);if(g!=null)m(r,["continuationToken"],g);return r}function sU(e,t){let r={},n=d(e,["citationSources"]);if(n!=null){let o=n;if(Array.isArray(o))o=o.map((i)=>i);m(r,["citations"],o)}return r}function aU(e,t,r){let n={},o=d(t,["model"]);if(o!=null)m(n,["_url","model"],yt(e,o));let i=d(t,["contents"]);if(i!=null){let s=mr(i);if(Array.isArray(s))s=s.map((l)=>es(l));m(n,["contents"],s)}return n}function lU(e,t){let r={},n=d(e,["sdkHttpResponse"]);if(n!=null)m(r,["sdkHttpResponse"],n);let o=d(e,["tokensInfo"]);if(o!=null){let i=o;if(Array.isArray(i))i=i.map((s)=>s);m(r,["tokensInfo"],i)}return r}function cU(e,t){let r={},n=d(e,["enablePromptInjectionDetection"]);if(n!=null)m(r,["enablePromptInjectionDetection"],n);let o=d(e,["environment"]);if(o!=null)m(r,["environment"],o);let i=d(e,["excludedPredefinedFunctions"]);if(i!=null)m(r,["excludedPredefinedFunctions"],i);if(d(e,["disabledSafetyPolicies"])!==void 0)throw Error("disabledSafetyPolicies parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return r}function uU(e,t){let r={},n=d(e,["values"]);if(n!=null)m(r,["values"],n);let o=d(e,["statistics"]);if(o!=null)m(r,["statistics"],dU(o));return r}function dU(e,t){let r={},n=d(e,["truncated"]);if(n!=null)m(r,["truncated"],n);let o=d(e,["token_count"]);if(o!=null)m(r,["tokenCount"],o);let i=d(e,["tokensDetails"]);if(i!=null){let s=i;if(Array.isArray(s))s=s.map((l)=>l);m(r,["tokensDetails"],s)}return r}function Qs(e,t){let r={},n=d(e,["parts"]);if(n!=null){let i=n;if(Array.isArray(i))i=i.map((s)=>mF(s));m(r,["parts"],i)}let o=d(e,["role"]);if(o!=null)m(r,["role"],o);return r}function es(e,t){let r={},n=d(e,["parts"]);if(n!=null){let i=n;if(Array.isArray(i))i=i.map((s)=>gF(s));m(r,["parts"],i)}let o=d(e,["role"]);if(o!=null)m(r,["role"],o);return r}function fU(e,t){let r={},n=d(e,["controlType"]);if(n!=null)m(r,["controlType"],n);let o=d(e,["enableControlImageComputation"]);if(o!=null)m(r,["computeControl"],o);return r}function pU(e,t){let r={};if(d(e,["systemInstruction"])!==void 0)throw Error("systemInstruction parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["tools"])!==void 0)throw Error("tools parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["generationConfig"])!==void 0)throw Error("generationConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return r}function hU(e,t,r){let n={},o=d(e,["systemInstruction"]);if(t!==void 0&&o!=null)m(t,["systemInstruction"],es(Wt(o)));let i=d(e,["tools"]);if(t!==void 0&&i!=null){let l=i;if(Array.isArray(l))l=l.map((a)=>tb(a));m(t,["tools"],l)}let s=d(e,["generationConfig"]);if(t!==void 0&&s!=null)m(t,["generationConfig"],QU(s));return n}function mU(e,t,r){let n={},o=d(t,["model"]);if(o!=null)m(n,["_url","model"],yt(e,o));let i=d(t,["contents"]);if(i!=null){let l=mr(i);if(Array.isArray(l))l=l.map((a)=>Qs(a));m(n,["contents"],l)}let s=d(t,["config"]);if(s!=null)pU(s);return n}function gU(e,t,r){let n={},o=d(t,["model"]);if(o!=null)m(n,["_url","model"],yt(e,o));let i=d(t,["contents"]);if(i!=null){let l=mr(i);if(Array.isArray(l))l=l.map((a)=>es(a));m(n,["contents"],l)}let s=d(t,["config"]);if(s!=null)hU(s,n);return n}function vU(e,t){let r={},n=d(e,["sdkHttpResponse"]);if(n!=null)m(r,["sdkHttpResponse"],n);let o=d(e,["totalTokens"]);if(o!=null)m(r,["totalTokens"],o);let i=d(e,["cachedContentTokenCount"]);if(i!=null)m(r,["cachedContentTokenCount"],i);return r}function _U(e,t){let r={},n=d(e,["sdkHttpResponse"]);if(n!=null)m(r,["sdkHttpResponse"],n);let o=d(e,["totalTokens"]);if(o!=null)m(r,["totalTokens"],o);return r}function yU(e,t,r){let n={},o=d(t,["model"]);if(o!=null)m(n,["_url","name"],yt(e,o));return n}function SU(e,t,r){let n={},o=d(t,["model"]);if(o!=null)m(n,["_url","name"],yt(e,o));return n}function EU(e,t){let r={},n=d(e,["sdkHttpResponse"]);if(n!=null)m(r,["sdkHttpResponse"],n);return r}function bU(e,t){let r={},n=d(e,["sdkHttpResponse"]);if(n!=null)m(r,["sdkHttpResponse"],n);return r}function wU(e,t,r){let n={},o=d(e,["outputGcsUri"]);if(t!==void 0&&o!=null)m(t,["parameters","storageUri"],o);let i=d(e,["negativePrompt"]);if(t!==void 0&&i!=null)m(t,["parameters","negativePrompt"],i);let s=d(e,["numberOfImages"]);if(t!==void 0&&s!=null)m(t,["parameters","sampleCount"],s);let l=d(e,["aspectRatio"]);if(t!==void 0&&l!=null)m(t,["parameters","aspectRatio"],l);let a=d(e,["guidanceScale"]);if(t!==void 0&&a!=null)m(t,["parameters","guidanceScale"],a);let c=d(e,["seed"]);if(t!==void 0&&c!=null)m(t,["parameters","seed"],c);let u=d(e,["safetyFilterLevel"]);if(t!==void 0&&u!=null)m(t,["parameters","safetySetting"],u);let f=d(e,["personGeneration"]);if(t!==void 0&&f!=null)m(t,["parameters","personGeneration"],f);let h=d(e,["includeSafetyAttributes"]);if(t!==void 0&&h!=null)m(t,["parameters","includeSafetyAttributes"],h);let g=d(e,["includeRaiReason"]);if(t!==void 0&&g!=null)m(t,["parameters","includeRaiReason"],g);let p=d(e,["language"]);if(t!==void 0&&p!=null)m(t,["parameters","language"],p);let _=d(e,["outputMimeType"]);if(t!==void 0&&_!=null)m(t,["parameters","outputOptions","mimeType"],_);let y=d(e,["outputCompressionQuality"]);if(t!==void 0&&y!=null)m(t,["parameters","outputOptions","compressionQuality"],y);let S=d(e,["addWatermark"]);if(t!==void 0&&S!=null)m(t,["parameters","addWatermark"],S);let E=d(e,["labels"]);if(t!==void 0&&E!=null)m(t,["labels"],E);let b=d(e,["editMode"]);if(t!==void 0&&b!=null)m(t,["parameters","editMode"],b);let R=d(e,["baseSteps"]);if(t!==void 0&&R!=null)m(t,["parameters","editConfig","baseSteps"],R);return n}function TU(e,t,r){let n={},o=d(t,["model"]);if(o!=null)m(n,["_url","model"],yt(e,o));let i=d(t,["prompt"]);if(i!=null)m(n,["instances[0]","prompt"],i);let s=d(t,["referenceImages"]);if(s!=null){let a=s;if(Array.isArray(a))a=a.map((c)=>bF(c));m(n,["instances[0]","referenceImages"],a)}let l=d(t,["config"]);if(l!=null)wU(l,n);return n}function CU(e,t){let r={},n=d(e,["sdkHttpResponse"]);if(n!=null)m(r,["sdkHttpResponse"],n);let o=d(e,["predictions"]);if(o!=null){let i=o;if(Array.isArray(i))i=i.map((s)=>Zl(s));m(r,["generatedImages"],i)}return r}function RU(e,t,r){let n={},o=d(e,["taskType"]);if(t!==void 0&&o!=null)m(t,["requests[]","taskType"],o);let i=d(e,["title"]);if(t!==void 0&&i!=null)m(t,["requests[]","title"],i);let s=d(e,["outputDimensionality"]);if(t!==void 0&&s!=null)m(t,["requests[]","outputDimensionality"],s);if(d(e,["mimeType"])!==void 0)throw Error("mimeType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["autoTruncate"])!==void 0)throw Error("autoTruncate parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["documentOcr"])!==void 0)throw Error("documentOcr parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["audioTrackExtraction"])!==void 0)throw Error("audioTrackExtraction parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return n}function AU(e,t,r){let n={},o=d(r,["embeddingApiType"]);if(o===void 0)o="PREDICT";if(o==="PREDICT"){let f=d(e,["taskType"]);if(t!==void 0&&f!=null)m(t,["instances[]","task_type"],f)}else if(o==="EMBED_CONTENT"){let f=d(e,["taskType"]);if(t!==void 0&&f!=null)m(t,["embedContentConfig","taskType"],f)}let i=d(r,["embeddingApiType"]);if(i===void 0)i="PREDICT";if(i==="PREDICT"){let f=d(e,["title"]);if(t!==void 0&&f!=null)m(t,["instances[]","title"],f)}else if(i==="EMBED_CONTENT"){let f=d(e,["title"]);if(t!==void 0&&f!=null)m(t,["embedContentConfig","title"],f)}let s=d(r,["embeddingApiType"]);if(s===void 0)s="PREDICT";if(s==="PREDICT"){let f=d(e,["outputDimensionality"]);if(t!==void 0&&f!=null)m(t,["parameters","outputDimensionality"],f)}else if(s==="EMBED_CONTENT"){let f=d(e,["outputDimensionality"]);if(t!==void 0&&f!=null)m(t,["embedContentConfig","outputDimensionality"],f)}let l=d(r,["embeddingApiType"]);if(l===void 0)l="PREDICT";if(l==="PREDICT"){let f=d(e,["mimeType"]);if(t!==void 0&&f!=null)m(t,["instances[]","mimeType"],f)}let a=d(r,["embeddingApiType"]);if(a===void 0)a="PREDICT";if(a==="PREDICT"){let f=d(e,["autoTruncate"]);if(t!==void 0&&f!=null)m(t,["parameters","autoTruncate"],f)}else if(a==="EMBED_CONTENT"){let f=d(e,["autoTruncate"]);if(t!==void 0&&f!=null)m(t,["embedContentConfig","autoTruncate"],f)}let c=d(r,["embeddingApiType"]);if(c===void 0)c="PREDICT";if(c==="EMBED_CONTENT"){let f=d(e,["documentOcr"]);if(t!==void 0&&f!=null)m(t,["embedContentConfig","documentOcr"],f)}let u=d(r,["embeddingApiType"]);if(u===void 0)u="PREDICT";if(u==="EMBED_CONTENT"){let f=d(e,["audioTrackExtraction"]);if(t!==void 0&&f!=null)m(t,["embedContentConfig","audioTrackExtraction"],f)}return n}function IU(e,t,r){let n={},o=d(t,["model"]);if(o!=null)m(n,["_url","model"],yt(e,o));let i=d(t,["contents"]);if(i!=null){let c=Xd(e,i);if(Array.isArray(c))c=c.map((u)=>u);m(n,["requests[]","content"],c)}let s=d(t,["content"]);if(s!=null)Qs(Wt(s));let l=d(t,["config"]);if(l!=null)RU(l,n);let a=d(t,["model"]);if(a!==void 0)m(n,["requests[]","model"],yt(e,a));return n}function PU(e,t,r){let n={},o=d(t,["model"]);if(o!=null)m(n,["_url","model"],yt(e,o));let i=d(r,["embeddingApiType"]);if(i===void 0)i="PREDICT";if(i==="PREDICT"){let a=d(t,["contents"]);if(a!=null){let c=Xd(e,a);if(Array.isArray(c))c=c.map((u)=>u);m(n,["instances[]","content"],c)}}let s=d(r,["embeddingApiType"]);if(s===void 0)s="PREDICT";if(s==="EMBED_CONTENT"){let a=d(t,["content"]);if(a!=null)m(n,["content"],es(Wt(a)))}let l=d(t,["config"]);if(l!=null)AU(l,n,r);return n}function kU(e,t){let r={},n=d(e,["sdkHttpResponse"]);if(n!=null)m(r,["sdkHttpResponse"],n);let o=d(e,["embeddings"]);if(o!=null){let s=o;if(Array.isArray(s))s=s.map((l)=>l);m(r,["embeddings"],s)}let i=d(e,["metadata"]);if(i!=null)m(r,["metadata"],i);return r}function NU(e,t){let r={},n=d(e,["sdkHttpResponse"]);if(n!=null)m(r,["sdkHttpResponse"],n);let o=d(e,["predictions[]","embeddings"]);if(o!=null){let s=o;if(Array.isArray(s))s=s.map((l)=>uU(l));m(r,["embeddings"],s)}let i=d(e,["metadata"]);if(i!=null)m(r,["metadata"],i);if(t&&d(t,["embeddingApiType"])==="EMBED_CONTENT"){let s=d(e,["embedding"]),l=d(e,["usageMetadata"]),a=d(e,["truncated"]);if(s){let c={};if(l&&l.promptTokenCount)c.tokenCount=l.promptTokenCount;if(l&&l.promptTokensDetails)c.tokensDetails=l.promptTokensDetails;if(a)c.truncated=a;s.statistics=c,m(r,["embeddings"],[s])}}return r}function OU(e,t){let r={},n=d(e,["endpoint"]);if(n!=null)m(r,["name"],n);let o=d(e,["deployedModelId"]);if(o!=null)m(r,["deployedModelId"],o);return r}function MU(e,t){let r={},n=d(e,["args"]);if(n!=null)m(r,["args"],n);let o=d(e,["id"]);if(o!=null)m(r,["id"],o);let i=d(e,["name"]);if(i!=null)m(r,["name"],i);if(d(e,["partialArgs"])!==void 0)throw Error("partialArgs parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["willContinue"])!==void 0)throw Error("willContinue parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return r}function DU(e,t){let r={},n=d(e,["allowedFunctionNames"]);if(n!=null)m(r,["allowedFunctionNames"],n);let o=d(e,["mode"]);if(o!=null)m(r,["mode"],o);if(d(e,["streamFunctionCallArguments"])!==void 0)throw Error("streamFunctionCallArguments parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return r}function $U(e,t,r,n){let o={},i=d(t,["serviceTier"]);if(r!==void 0&&i!=null)m(r,["serviceTier"],i);let s=d(t,["systemInstruction"]);if(r!==void 0&&s!=null)m(r,["systemInstruction"],Qs(Wt(s)));let l=d(t,["temperature"]);if(l!=null)m(o,["temperature"],l);let a=d(t,["topP"]);if(a!=null)m(o,["topP"],a);let c=d(t,["topK"]);if(c!=null)m(o,["topK"],c);let u=d(t,["candidateCount"]);if(u!=null)m(o,["candidateCount"],u);let f=d(t,["maxOutputTokens"]);if(f!=null)m(o,["maxOutputTokens"],f);let h=d(t,["stopSequences"]);if(h!=null)m(o,["stopSequences"],h);let g=d(t,["responseLogprobs"]);if(g!=null)m(o,["responseLogprobs"],g);let p=d(t,["logprobs"]);if(p!=null)m(o,["logprobs"],p);let _=d(t,["presencePenalty"]);if(_!=null)m(o,["presencePenalty"],_);let y=d(t,["frequencyPenalty"]);if(y!=null)m(o,["frequencyPenalty"],y);let S=d(t,["seed"]);if(S!=null)m(o,["seed"],S);let E=d(t,["responseMimeType"]);if(E!=null)m(o,["responseMimeType"],E);let b=d(t,["responseSchema"]);if(b!=null)m(o,["responseSchema"],Yd(b));let R=d(t,["responseJsonSchema"]);if(R!=null)m(o,["responseJsonSchema"],Xi(R));if(d(t,["routingConfig"])!==void 0)throw Error("routingConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(t,["modelSelectionConfig"])!==void 0)throw Error("modelSelectionConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let w=d(t,["safetySettings"]);if(r!==void 0&&w!=null){let ve=w;if(Array.isArray(ve))ve=ve.map((me)=>TF(me));m(r,["safetySettings"],ve)}let T=d(t,["tools"]);if(r!==void 0&&T!=null){let ve=Zi(T);if(Array.isArray(ve))ve=ve.map((me)=>MF(Yi(me)));m(r,["tools"],ve)}let C=d(t,["toolConfig"]);if(r!==void 0&&C!=null)m(r,["toolConfig"],NF(C));let A=d(t,["labels"]);if(r!==void 0&&A!=null)m(r,["labels"],A);let P=d(t,["cachedContent"]);if(r!==void 0&&P!=null)m(r,["cachedContent"],Fn(e,P));let D=d(t,["responseModalities"]);if(D!=null)m(o,["responseModalities"],D);let N=d(t,["mediaResolution"]);if(N!=null)m(o,["mediaResolution"],N);let F=d(t,["speechConfig"]);if(F!=null)m(o,["speechConfig"],Zd(F));if(d(t,["audioTimestamp"])!==void 0)throw Error("audioTimestamp parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let G=d(t,["thinkingConfig"]);if(G!=null)m(o,["thinkingConfig"],G);let B=d(t,["audioTranscriptionConfig"]);if(B!=null)m(o,["audioTranscriptionConfig"],B);let Q=d(t,["imageConfig"]);if(Q!=null)m(o,["imageConfig"],oF(Q));let pe=d(t,["enableEnhancedCivicAnswers"]);if(pe!=null)m(o,["enableEnhancedCivicAnswers"],pe);if(d(t,["modelArmorConfig"])!==void 0)throw Error("modelArmorConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let se=d(t,["continuationToken"]);if(r!==void 0&&se!=null)m(r,["continuationToken"],se);return o}function xU(e,t,r,n){let o={},i=d(t,["serviceTier"]);if(r!==void 0&&i!=null)m(r,["serviceTier"],i);let s=d(t,["systemInstruction"]);if(r!==void 0&&s!=null)m(r,["systemInstruction"],es(Wt(s)));let l=d(t,["temperature"]);if(l!=null)m(o,["temperature"],l);let a=d(t,["topP"]);if(a!=null)m(o,["topP"],a);let c=d(t,["topK"]);if(c!=null)m(o,["topK"],c);let u=d(t,["candidateCount"]);if(u!=null)m(o,["candidateCount"],u);let f=d(t,["maxOutputTokens"]);if(f!=null)m(o,["maxOutputTokens"],f);let h=d(t,["stopSequences"]);if(h!=null)m(o,["stopSequences"],h);let g=d(t,["responseLogprobs"]);if(g!=null)m(o,["responseLogprobs"],g);let p=d(t,["logprobs"]);if(p!=null)m(o,["logprobs"],p);let _=d(t,["presencePenalty"]);if(_!=null)m(o,["presencePenalty"],_);let y=d(t,["frequencyPenalty"]);if(y!=null)m(o,["frequencyPenalty"],y);let S=d(t,["seed"]);if(S!=null)m(o,["seed"],S);let E=d(t,["responseMimeType"]);if(E!=null)m(o,["responseMimeType"],E);let b=d(t,["responseSchema"]);if(b!=null)m(o,["responseSchema"],Yd(b));let R=d(t,["responseJsonSchema"]);if(R!=null)m(o,["responseJsonSchema"],Xi(R));let w=d(t,["routingConfig"]);if(w!=null)m(o,["routingConfig"],w);let T=d(t,["modelSelectionConfig"]);if(T!=null)m(o,["modelConfig"],T);let C=d(t,["safetySettings"]);if(r!==void 0&&C!=null){let ne=C;if(Array.isArray(ne))ne=ne.map((he)=>he);m(r,["safetySettings"],ne)}let A=d(t,["tools"]);if(r!==void 0&&A!=null){let ne=Zi(A);if(Array.isArray(ne))ne=ne.map((he)=>tb(Yi(he)));m(r,["tools"],ne)}let P=d(t,["toolConfig"]);if(r!==void 0&&P!=null)m(r,["toolConfig"],OF(P));let D=d(t,["labels"]);if(r!==void 0&&D!=null)m(r,["labels"],D);let N=d(t,["cachedContent"]);if(r!==void 0&&N!=null)m(r,["cachedContent"],Fn(e,N));let F=d(t,["responseModalities"]);if(F!=null)m(o,["responseModalities"],F);let G=d(t,["mediaResolution"]);if(G!=null)m(o,["mediaResolution"],G);let B=d(t,["speechConfig"]);if(B!=null)m(o,["speechConfig"],eb(Zd(B)));let Q=d(t,["audioTimestamp"]);if(Q!=null)m(o,["audioTimestamp"],Q);let pe=d(t,["thinkingConfig"]);if(pe!=null)m(o,["thinkingConfig"],pe);let se=d(t,["audioTranscriptionConfig"]);if(se!=null)m(o,["audioTranscriptionConfig"],se);let ve=d(t,["imageConfig"]);if(ve!=null)m(o,["imageConfig"],iF(ve));if(d(t,["enableEnhancedCivicAnswers"])!==void 0)throw Error("enableEnhancedCivicAnswers parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let me=d(t,["modelArmorConfig"]);if(r!==void 0&&me!=null)m(r,["modelArmorConfig"],me);let j=d(t,["continuationToken"]);if(r!==void 0&&j!=null)m(r,["continuationToken"],j);return o}function og(e,t,r){let n={},o=d(t,["model"]);if(o!=null)m(n,["_url","model"],yt(e,o));let i=d(t,["contents"]);if(i!=null){let l=mr(i);if(Array.isArray(l))l=l.map((a)=>Qs(a));m(n,["contents"],l)}let s=d(t,["config"]);if(s!=null)m(n,["generationConfig"],$U(e,s,n));return n}function ig(e,t,r){let n={},o=d(t,["model"]);if(o!=null)m(n,["_url","model"],yt(e,o));let i=d(t,["contents"]);if(i!=null){let l=mr(i);if(Array.isArray(l))l=l.map((a)=>es(a));m(n,["contents"],l)}let s=d(t,["config"]);if(s!=null)m(n,["generationConfig"],xU(e,s,n));return n}function sg(e,t){let r={},n=d(e,["sdkHttpResponse"]);if(n!=null)m(r,["sdkHttpResponse"],n);let o=d(e,["candidates"]);if(o!=null){let u=o;if(Array.isArray(u))u=u.map((f)=>iU(f));m(r,["candidates"],u)}let i=d(e,["modelVersion"]);if(i!=null)m(r,["modelVersion"],i);let s=d(e,["promptFeedback"]);if(s!=null)m(r,["promptFeedback"],s);let l=d(e,["responseId"]);if(l!=null)m(r,["responseId"],l);let a=d(e,["usageMetadata"]);if(a!=null)m(r,["usageMetadata"],a);let c=d(e,["modelStatus"]);if(c!=null)m(r,["modelStatus"],c);return r}function ag(e,t){let r={},n=d(e,["sdkHttpResponse"]);if(n!=null)m(r,["sdkHttpResponse"],n);let o=d(e,["candidates"]);if(o!=null){let u=o;if(Array.isArray(u))u=u.map((f)=>f);m(r,["candidates"],u)}let i=d(e,["createTime"]);if(i!=null)m(r,["createTime"],i);let s=d(e,["modelVersion"]);if(s!=null)m(r,["modelVersion"],s);let l=d(e,["promptFeedback"]);if(l!=null)m(r,["promptFeedback"],l);let a=d(e,["responseId"]);if(a!=null)m(r,["responseId"],a);let c=d(e,["usageMetadata"]);if(c!=null)m(r,["usageMetadata"],c);return r}function LU(e,t,r){let n={},o=d(e,["outputGcsUri"]);if(t!==void 0&&o!=null)m(t,["parameters","storageUri"],o);let i=d(e,["negativePrompt"]);if(t!==void 0&&i!=null)m(t,["parameters","negativePrompt"],i);let s=d(e,["numberOfImages"]);if(t!==void 0&&s!=null)m(t,["parameters","sampleCount"],s);let l=d(e,["aspectRatio"]);if(t!==void 0&&l!=null)m(t,["parameters","aspectRatio"],l);let a=d(e,["guidanceScale"]);if(t!==void 0&&a!=null)m(t,["parameters","guidanceScale"],a);let c=d(e,["seed"]);if(t!==void 0&&c!=null)m(t,["parameters","seed"],c);let u=d(e,["safetyFilterLevel"]);if(t!==void 0&&u!=null)m(t,["parameters","safetySetting"],u);let f=d(e,["personGeneration"]);if(t!==void 0&&f!=null)m(t,["parameters","personGeneration"],f);let h=d(e,["includeSafetyAttributes"]);if(t!==void 0&&h!=null)m(t,["parameters","includeSafetyAttributes"],h);let g=d(e,["includeRaiReason"]);if(t!==void 0&&g!=null)m(t,["parameters","includeRaiReason"],g);let p=d(e,["language"]);if(t!==void 0&&p!=null)m(t,["parameters","language"],p);let _=d(e,["outputMimeType"]);if(t!==void 0&&_!=null)m(t,["parameters","outputOptions","mimeType"],_);let y=d(e,["outputCompressionQuality"]);if(t!==void 0&&y!=null)m(t,["parameters","outputOptions","compressionQuality"],y);let S=d(e,["addWatermark"]);if(t!==void 0&&S!=null)m(t,["parameters","addWatermark"],S);let E=d(e,["labels"]);if(t!==void 0&&E!=null)m(t,["labels"],E);let b=d(e,["imageSize"]);if(t!==void 0&&b!=null)m(t,["parameters","sampleImageSize"],b);let R=d(e,["enhancePrompt"]);if(t!==void 0&&R!=null)m(t,["parameters","enhancePrompt"],R);return n}function qU(e,t,r){let n={},o=d(t,["model"]);if(o!=null)m(n,["_url","model"],yt(e,o));let i=d(t,["prompt"]);if(i!=null)m(n,["instances[0]","prompt"],i);let s=d(t,["config"]);if(s!=null)LU(s,n);return n}function UU(e,t){let r={},n=d(e,["sdkHttpResponse"]);if(n!=null)m(r,["sdkHttpResponse"],n);let o=d(e,["predictions"]);if(o!=null){let s=o;if(Array.isArray(s))s=s.map((l)=>Zl(l));m(r,["generatedImages"],s)}let i=d(e,["positivePromptSafetyAttributes"]);if(i!=null)m(r,["positivePromptSafetyAttributes"],QE(i));return r}function FU(e,t,r){let n={},o=d(e,["numberOfVideos"]);if(t!==void 0&&o!=null)m(t,["parameters","sampleCount"],o);if(d(e,["outputGcsUri"])!==void 0)throw Error("outputGcsUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["fps"])!==void 0)throw Error("fps parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let i=d(e,["durationSeconds"]);if(t!==void 0&&i!=null)m(t,["parameters","durationSeconds"],i);if(d(e,["seed"])!==void 0)throw Error("seed parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let s=d(e,["aspectRatio"]);if(t!==void 0&&s!=null)m(t,["parameters","aspectRatio"],s);let l=d(e,["resolution"]);if(t!==void 0&&l!=null)m(t,["parameters","resolution"],l);let a=d(e,["personGeneration"]);if(t!==void 0&&a!=null)m(t,["parameters","personGeneration"],a);if(d(e,["pubsubTopic"])!==void 0)throw Error("pubsubTopic parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let c=d(e,["negativePrompt"]);if(t!==void 0&&c!=null)m(t,["parameters","negativePrompt"],c);let u=d(e,["enhancePrompt"]);if(t!==void 0&&u!=null)m(t,["parameters","enhancePrompt"],u);if(d(e,["generateAudio"])!==void 0)throw Error("generateAudio parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let f=d(e,["lastFrame"]);if(t!==void 0&&f!=null)m(t,["instances[0]","lastFrame"],Ql(f));let h=d(e,["referenceImages"]);if(t!==void 0&&h!=null){let p=h;if(Array.isArray(p))p=p.map((_)=>jF(_));m(t,["instances[0]","referenceImages"],p)}if(d(e,["mask"])!==void 0)throw Error("mask parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["compressionQuality"])!==void 0)throw Error("compressionQuality parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["labels"])!==void 0)throw Error("labels parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let g=d(e,["webhookConfig"]);if(t!==void 0&&g!=null)m(t,["webhookConfig"],g);if(d(e,["resizeMode"])!==void 0)throw Error("resizeMode parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return n}function GU(e,t,r){let n={},o=d(e,["numberOfVideos"]);if(t!==void 0&&o!=null)m(t,["parameters","sampleCount"],o);let i=d(e,["outputGcsUri"]);if(t!==void 0&&i!=null)m(t,["parameters","storageUri"],i);let s=d(e,["fps"]);if(t!==void 0&&s!=null)m(t,["parameters","fps"],s);let l=d(e,["durationSeconds"]);if(t!==void 0&&l!=null)m(t,["parameters","durationSeconds"],l);let a=d(e,["seed"]);if(t!==void 0&&a!=null)m(t,["parameters","seed"],a);let c=d(e,["aspectRatio"]);if(t!==void 0&&c!=null)m(t,["parameters","aspectRatio"],c);let u=d(e,["resolution"]);if(t!==void 0&&u!=null)m(t,["parameters","resolution"],u);let f=d(e,["personGeneration"]);if(t!==void 0&&f!=null)m(t,["parameters","personGeneration"],f);let h=d(e,["pubsubTopic"]);if(t!==void 0&&h!=null)m(t,["parameters","pubsubTopic"],h);let g=d(e,["negativePrompt"]);if(t!==void 0&&g!=null)m(t,["parameters","negativePrompt"],g);let p=d(e,["enhancePrompt"]);if(t!==void 0&&p!=null)m(t,["parameters","enhancePrompt"],p);let _=d(e,["generateAudio"]);if(t!==void 0&&_!=null)m(t,["parameters","generateAudio"],_);let y=d(e,["lastFrame"]);if(t!==void 0&&y!=null)m(t,["instances[0]","lastFrame"],Xr(y));let S=d(e,["referenceImages"]);if(t!==void 0&&S!=null){let T=S;if(Array.isArray(T))T=T.map((C)=>WF(C));m(t,["instances[0]","referenceImages"],T)}let E=d(e,["mask"]);if(t!==void 0&&E!=null)m(t,["instances[0]","mask"],VF(E));let b=d(e,["compressionQuality"]);if(t!==void 0&&b!=null)m(t,["parameters","compressionQuality"],b);let R=d(e,["labels"]);if(t!==void 0&&R!=null)m(t,["labels"],R);if(d(e,["webhookConfig"])!==void 0)throw Error("webhookConfig parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let w=d(e,["resizeMode"]);if(t!==void 0&&w!=null)m(t,["parameters","resizeMode"],w);return n}function BU(e,t){let r={},n=d(e,["name"]);if(n!=null)m(r,["name"],n);let o=d(e,["metadata"]);if(o!=null)m(r,["metadata"],o);let i=d(e,["done"]);if(i!=null)m(r,["done"],i);let s=d(e,["error"]);if(s!=null)m(r,["error"],s);let l=d(e,["response","generateVideoResponse"]);if(l!=null)m(r,["response"],jU(l));return r}function HU(e,t){let r={},n=d(e,["name"]);if(n!=null)m(r,["name"],n);let o=d(e,["metadata"]);if(o!=null)m(r,["metadata"],o);let i=d(e,["done"]);if(i!=null)m(r,["done"],i);let s=d(e,["error"]);if(s!=null)m(r,["error"],s);let l=d(e,["response"]);if(l!=null)m(r,["response"],WU(l));return r}function zU(e,t,r){let n={},o=d(t,["model"]);if(o!=null)m(n,["_url","model"],yt(e,o));let i=d(t,["prompt"]);if(i!=null)m(n,["instances[0]","prompt"],i);let s=d(t,["image"]);if(s!=null)m(n,["instances[0]","image"],Ql(s));let l=d(t,["video"]);if(l!=null)m(n,["instances[0]","video"],rb(l));let a=d(t,["source"]);if(a!=null)JU(a,n);let c=d(t,["config"]);if(c!=null)FU(c,n);return n}function VU(e,t,r){let n={},o=d(t,["model"]);if(o!=null)m(n,["_url","model"],yt(e,o));let i=d(t,["prompt"]);if(i!=null)m(n,["instances[0]","prompt"],i);let s=d(t,["image"]);if(s!=null)m(n,["instances[0]","image"],Xr(s));let l=d(t,["video"]);if(l!=null)m(n,["instances[0]","video"],nb(l));let a=d(t,["source"]);if(a!=null)KU(a,n);let c=d(t,["config"]);if(c!=null)GU(c,n);return n}function jU(e,t){let r={},n=d(e,["generatedSamples"]);if(n!=null){let s=n;if(Array.isArray(s))s=s.map((l)=>YU(l));m(r,["generatedVideos"],s)}let o=d(e,["raiMediaFilteredCount"]);if(o!=null)m(r,["raiMediaFilteredCount"],o);let i=d(e,["raiMediaFilteredReasons"]);if(i!=null)m(r,["raiMediaFilteredReasons"],i);return r}function WU(e,t){let r={},n=d(e,["videos"]);if(n!=null){let s=n;if(Array.isArray(s))s=s.map((l)=>ZU(l));m(r,["generatedVideos"],s)}let o=d(e,["raiMediaFilteredCount"]);if(o!=null)m(r,["raiMediaFilteredCount"],o);let i=d(e,["raiMediaFilteredReasons"]);if(i!=null)m(r,["raiMediaFilteredReasons"],i);return r}function JU(e,t,r){let n={},o=d(e,["prompt"]);if(t!==void 0&&o!=null)m(t,["instances[0]","prompt"],o);let i=d(e,["image"]);if(t!==void 0&&i!=null)m(t,["instances[0]","image"],Ql(i));let s=d(e,["video"]);if(t!==void 0&&s!=null)m(t,["instances[0]","video"],rb(s));return n}function KU(e,t,r){let n={},o=d(e,["prompt"]);if(t!==void 0&&o!=null)m(t,["instances[0]","prompt"],o);let i=d(e,["image"]);if(t!==void 0&&i!=null)m(t,["instances[0]","image"],Xr(i));let s=d(e,["video"]);if(t!==void 0&&s!=null)m(t,["instances[0]","video"],nb(s));return n}function Zl(e,t){let r={},n=d(e,["_self"]);if(n!=null)m(r,["image"],ZE(n));let o=d(e,["raiFilteredReason"]);if(o!=null)m(r,["raiFilteredReason"],o);let i=d(e,["_self"]);if(i!=null)m(r,["safetyAttributes"],QE(i));let s=d(e,["prompt"]);if(s!=null)m(r,["enhancedPrompt"],s);return r}function XU(e,t){let r={},n=d(e,["_self"]);if(n!=null)m(r,["mask"],ZE(n));let o=d(e,["labels"]);if(o!=null){let i=o;if(Array.isArray(i))i=i.map((s)=>s);m(r,["labels"],i)}return r}function YU(e,t){let r={},n=d(e,["video"]);if(n!=null)m(r,["video"],HF(n));return r}function ZU(e,t){let r={},n=d(e,["_self"]);if(n!=null)m(r,["video"],zF(n));return r}function QU(e,t){let r={},n=d(e,["modelSelectionConfig"]);if(n!=null)m(r,["modelConfig"],n);let o=d(e,["responseJsonSchema"]);if(o!=null)m(r,["responseJsonSchema"],Xi(o));let i=d(e,["audioTranscriptionConfig"]);if(i!=null)m(r,["audioTranscriptionConfig"],i);let s=d(e,["audioTimestamp"]);if(s!=null)m(r,["audioTimestamp"],s);let l=d(e,["candidateCount"]);if(l!=null)m(r,["candidateCount"],l);let a=d(e,["enableAffectiveDialog"]);if(a!=null)m(r,["enableAffectiveDialog"],a);let c=d(e,["frequencyPenalty"]);if(c!=null)m(r,["frequencyPenalty"],c);let u=d(e,["logprobs"]);if(u!=null)m(r,["logprobs"],u);let f=d(e,["maxOutputTokens"]);if(f!=null)m(r,["maxOutputTokens"],f);let h=d(e,["mediaResolution"]);if(h!=null)m(r,["mediaResolution"],h);let g=d(e,["presencePenalty"]);if(g!=null)m(r,["presencePenalty"],g);let p=d(e,["responseFormat"]);if(p!=null){let F=p;if(Array.isArray(F))F=F.map((G)=>G);m(r,["responseFormat"],F)}let _=d(e,["responseLogprobs"]);if(_!=null)m(r,["responseLogprobs"],_);let y=d(e,["responseMimeType"]);if(y!=null)m(r,["responseMimeType"],y);let S=d(e,["responseModalities"]);if(S!=null)m(r,["responseModalities"],S);let E=d(e,["responseSchema"]);if(E!=null)m(r,["responseSchema"],E);let b=d(e,["routingConfig"]);if(b!=null)m(r,["routingConfig"],b);let R=d(e,["seed"]);if(R!=null)m(r,["seed"],R);let w=d(e,["speechConfig"]);if(w!=null)m(r,["speechConfig"],eb(w));let T=d(e,["stopSequences"]);if(T!=null)m(r,["stopSequences"],T);let C=d(e,["temperature"]);if(C!=null)m(r,["temperature"],C);let A=d(e,["thinkingConfig"]);if(A!=null)m(r,["thinkingConfig"],A);let P=d(e,["topK"]);if(P!=null)m(r,["topK"],P);let D=d(e,["topP"]);if(D!=null)m(r,["topP"],D);if(d(e,["enableEnhancedCivicAnswers"])!==void 0)throw Error("enableEnhancedCivicAnswers parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let N=d(e,["translationConfig"]);if(N!=null)m(r,["translationConfig"],N);return r}function eF(e,t,r){let n={},o=d(t,["model"]);if(o!=null)m(n,["_url","name"],yt(e,o));return n}function tF(e,t,r){let n={},o=d(t,["model"]);if(o!=null)m(n,["_url","name"],yt(e,o));return n}function rF(e,t){let r={},n=d(e,["authConfig"]);if(n!=null)m(r,["authConfig"],oU(n));let o=d(e,["enableWidget"]);if(o!=null)m(r,["enableWidget"],o);if(d(e,["groundingTypes"])!==void 0)throw Error("groundingTypes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return r}function nF(e,t){let r={};if(d(e,["blockingConfidence"])!==void 0)throw Error("blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["excludeDomains"])!==void 0)throw Error("excludeDomains parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let n=d(e,["searchTypes"]);if(n!=null)m(r,["searchTypes"],n);let o=d(e,["timeRangeFilter"]);if(o!=null)m(r,["timeRangeFilter"],o);return r}function oF(e,t){let r={},n=d(e,["aspectRatio"]);if(n!=null)m(r,["aspectRatio"],n);let o=d(e,["imageSize"]);if(o!=null)m(r,["imageSize"],o);if(d(e,["personGeneration"])!==void 0)throw Error("personGeneration parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["outputMimeType"])!==void 0)throw Error("outputMimeType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["outputCompressionQuality"])!==void 0)throw Error("outputCompressionQuality parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["imageOutputOptions"])!==void 0)throw Error("imageOutputOptions parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["prominentPeople"])!==void 0)throw Error("prominentPeople parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return r}function iF(e,t){let r={},n=d(e,["aspectRatio"]);if(n!=null)m(r,["aspectRatio"],n);let o=d(e,["imageSize"]);if(o!=null)m(r,["imageSize"],o);let i=d(e,["personGeneration"]);if(i!=null)m(r,["personGeneration"],i);let s=d(e,["outputMimeType"]);if(s!=null)m(r,["imageOutputOptions","mimeType"],s);let l=d(e,["outputCompressionQuality"]);if(l!=null)m(r,["imageOutputOptions","compressionQuality"],l);let a=d(e,["imageOutputOptions"]);if(a!=null)m(r,["imageOutputOptions"],a);let c=d(e,["prominentPeople"]);if(c!=null)m(r,["prominentPeople"],c);return r}function ZE(e,t){let r={},n=d(e,["gcsUri"]);if(n!=null)m(r,["gcsUri"],n);let o=d(e,["bytesBase64Encoded"]);if(o!=null)m(r,["imageBytes"],jo(o));let i=d(e,["mimeType"]);if(i!=null)m(r,["mimeType"],i);return r}function Ql(e,t){let r={};if(d(e,["gcsUri"])!==void 0)throw Error("gcsUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let n=d(e,["imageBytes"]);if(n!=null)m(r,["bytesBase64Encoded"],jo(n));let o=d(e,["mimeType"]);if(o!=null)m(r,["mimeType"],o);return r}function Xr(e,t){let r={},n=d(e,["gcsUri"]);if(n!=null)m(r,["gcsUri"],n);let o=d(e,["imageBytes"]);if(o!=null)m(r,["bytesBase64Encoded"],jo(o));let i=d(e,["mimeType"]);if(i!=null)m(r,["mimeType"],i);return r}function sF(e,t,r,n){let o={},i=d(t,["pageSize"]);if(r!==void 0&&i!=null)m(r,["_query","pageSize"],i);let s=d(t,["pageToken"]);if(r!==void 0&&s!=null)m(r,["_query","pageToken"],s);let l=d(t,["filter"]);if(r!==void 0&&l!=null)m(r,["_query","filter"],l);let a=d(t,["queryBase"]);if(r!==void 0&&a!=null)m(r,["_url","models_url"],BE(e,a));return o}function aF(e,t,r,n){let o={},i=d(t,["pageSize"]);if(r!==void 0&&i!=null)m(r,["_query","pageSize"],i);let s=d(t,["pageToken"]);if(r!==void 0&&s!=null)m(r,["_query","pageToken"],s);let l=d(t,["filter"]);if(r!==void 0&&l!=null)m(r,["_query","filter"],l);let a=d(t,["queryBase"]);if(r!==void 0&&a!=null)m(r,["_url","models_url"],BE(e,a));return o}function lF(e,t,r){let n={},o=d(t,["config"]);if(o!=null)sF(e,o,n);return n}function cF(e,t,r){let n={},o=d(t,["config"]);if(o!=null)aF(e,o,n);return n}function uF(e,t){let r={},n=d(e,["sdkHttpResponse"]);if(n!=null)m(r,["sdkHttpResponse"],n);let o=d(e,["nextPageToken"]);if(o!=null)m(r,["nextPageToken"],o);let i=d(e,["_self"]);if(i!=null){let s=HE(i);if(Array.isArray(s))s=s.map((l)=>vu(l));m(r,["models"],s)}return r}function dF(e,t){let r={},n=d(e,["sdkHttpResponse"]);if(n!=null)m(r,["sdkHttpResponse"],n);let o=d(e,["nextPageToken"]);if(o!=null)m(r,["nextPageToken"],o);let i=d(e,["_self"]);if(i!=null){let s=HE(i);if(Array.isArray(s))s=s.map((l)=>_u(l));m(r,["models"],s)}return r}function fF(e,t){let r={},n=d(e,["maskMode"]);if(n!=null)m(r,["maskMode"],n);let o=d(e,["segmentationClasses"]);if(o!=null)m(r,["maskClasses"],o);let i=d(e,["maskDilation"]);if(i!=null)m(r,["dilation"],i);return r}function pF(e,t){let r={};if(d(e,["name"])!==void 0)throw Error("name parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(d(e,["streamableHttpTransport"])!==void 0)throw Error("streamableHttpTransport parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return r}function vu(e,t){let r={},n=d(e,["name"]);if(n!=null)m(r,["name"],n);let o=d(e,["displayName"]);if(o!=null)m(r,["displayName"],o);let i=d(e,["description"]);if(i!=null)m(r,["description"],i);let s=d(e,["version"]);if(s!=null)m(r,["version"],s);let l=d(e,["_self"]);if(l!=null)m(r,["tunedModelInfo"],DF(l));let a=d(e,["inputTokenLimit"]);if(a!=null)m(r,["inputTokenLimit"],a);let c=d(e,["outputTokenLimit"]);if(c!=null)m(r,["outputTokenLimit"],c);let u=d(e,["supportedGenerationMethods"]);if(u!=null)m(r,["supportedActions"],u);let f=d(e,["temperature"]);if(f!=null)m(r,["temperature"],f);let h=d(e,["maxTemperature"]);if(h!=null)m(r,["maxTemperature"],h);let g=d(e,["topP"]);if(g!=null)m(r,["topP"],g);let p=d(e,["topK"]);if(p!=null)m(r,["topK"],p);let _=d(e,["thinking"]);if(_!=null)m(r,["thinking"],_);return r}function _u(e,t){let r={},n=d(e,["name"]);if(n!=null)m(r,["name"],n);let o=d(e,["displayName"]);if(o!=null)m(r,["displayName"],o);let i=d(e,["description"]);if(i!=null)m(r,["description"],i);let s=d(e,["versionId"]);if(s!=null)m(r,["version"],s);let l=d(e,["deployedModels"]);if(l!=null){let h=l;if(Array.isArray(h))h=h.map((g)=>OU(g));m(r,["endpoints"],h)}let a=d(e,["labels"]);if(a!=null)m(r,["labels"],a);let c=d(e,["_self"]);if(c!=null)m(r,["tunedModelInfo"],$F(c));let u=d(e,["defaultCheckpointId"]);if(u!=null)m(r,["defaultCheckpointId"],u);let f=d(e,["checkpoints"]);if(f!=null){let h=f;if(Array.isArray(h))h=h.map((g)=>g);m(r,["checkpoints"],h)}return r}function hF(e,t){let r={},n=d(e,["speakerVoiceConfigs"]);if(n!=null){let o=n;if(Array.isArray(o))o=o.map((i)=>kF(i));m(r,["speakerVoiceConfigs"],o)}return r}function mF(e,t){let r={},n=d(e,["mediaResolution"]);if(n!=null)m(r,["mediaResolution"],n);let o=d(e,["toolCall"]);if(o!=null)m(r,["toolCall"],o);let i=d(e,["toolResponse"]);if(i!=null)m(r,["toolResponse"],i);let s=d(e,["audioTranscription"]);if(s!=null)m(r,["audioTranscription"],s);let l=d(e,["codeExecutionResult"]);if(l!=null)m(r,["codeExecutionResult"],l);let a=d(e,["executableCode"]);if(a!=null)m(r,["executableCode"],a);let c=d(e,["fileData"]);if(c!=null)m(r,["fileData"],c);let u=d(e,["functionCall"]);if(u!=null)m(r,["functionCall"],MU(u));let f=d(e,["functionResponse"]);if(f!=null)m(r,["functionResponse"],f);let h=d(e,["inlineData"]);if(h!=null)m(r,["inlineData"],h);let g=d(e,["text"]);if(g!=null)m(r,["text"],g);let p=d(e,["thought"]);if(p!=null)m(r,["thought"],p);let _=d(e,["thoughtSignature"]);if(_!=null)m(r,["thoughtSignature"],_);let y=d(e,["videoMetadata"]);if(y!=null)m(r,["videoMetadata"],y);let S=d(e,["partMetadata"]);if(S!=null)m(r,["partMetadata"],S);let E=d(e,["mediaProcessing"]);if(E!=null)m(r,["mediaProcessing"],E);let b=d(e,["speechMetadata"]);if(b!=null)m(r,["speechMetadata"],b);return r}function gF(e,t){let r={},n=d(e,["mediaResolution"]);if(n!=null)m(r,["mediaResolution"],n);if(d(e,["toolCall"])!==void 0)throw Error("toolCall parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(d(e,["toolResponse"])!==void 0)throw Error("toolResponse parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let o=d(e,["audioTranscription"]);if(o!=null)m(r,["audioTranscription"],o);let i=d(e,["codeExecutionResult"]);if(i!=null)m(r,["codeExecutionResult"],i);let s=d(e,["executableCode"]);if(s!=null)m(r,["executableCode"],s);let l=d(e,["fileData"]);if(l!=null)m(r,["fileData"],l);let a=d(e,["functionCall"]);if(a!=null)m(r,["functionCall"],a);let c=d(e,["functionResponse"]);if(c!=null)m(r,["functionResponse"],c);let u=d(e,["inlineData"]);if(u!=null)m(r,["inlineData"],u);let f=d(e,["text"]);if(f!=null)m(r,["text"],f);let h=d(e,["thought"]);if(h!=null)m(r,["thought"],h);let g=d(e,["thoughtSignature"]);if(g!=null)m(r,["thoughtSignature"],g);let p=d(e,["videoMetadata"]);if(p!=null)m(r,["videoMetadata"],p);if(d(e,["partMetadata"])!==void 0)throw Error("partMetadata parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let _=d(e,["mediaProcessing"]);if(_!=null)m(r,["mediaProcessing"],_);let y=d(e,["speechMetadata"]);if(y!=null)m(r,["speechMetadata"],y);return r}function vF(e,t){let r={},n=d(e,["productImage"]);if(n!=null)m(r,["image"],Xr(n));return r}function _F(e,t,r){let n={},o=d(e,["numberOfImages"]);if(t!==void 0&&o!=null)m(t,["parameters","sampleCount"],o);let i=d(e,["baseSteps"]);if(t!==void 0&&i!=null)m(t,["parameters","baseSteps"],i);let s=d(e,["outputGcsUri"]);if(t!==void 0&&s!=null)m(t,["parameters","storageUri"],s);let l=d(e,["seed"]);if(t!==void 0&&l!=null)m(t,["parameters","seed"],l);let a=d(e,["safetyFilterLevel"]);if(t!==void 0&&a!=null)m(t,["parameters","safetySetting"],a);let c=d(e,["personGeneration"]);if(t!==void 0&&c!=null)m(t,["parameters","personGeneration"],c);let u=d(e,["addWatermark"]);if(t!==void 0&&u!=null)m(t,["parameters","addWatermark"],u);let f=d(e,["outputMimeType"]);if(t!==void 0&&f!=null)m(t,["parameters","outputOptions","mimeType"],f);let h=d(e,["outputCompressionQuality"]);if(t!==void 0&&h!=null)m(t,["parameters","outputOptions","compressionQuality"],h);let g=d(e,["enhancePrompt"]);if(t!==void 0&&g!=null)m(t,["parameters","enhancePrompt"],g);let p=d(e,["labels"]);if(t!==void 0&&p!=null)m(t,["labels"],p);return n}function yF(e,t,r){let n={},o=d(t,["model"]);if(o!=null)m(n,["_url","model"],yt(e,o));let i=d(t,["source"]);if(i!=null)EF(i,n);let s=d(t,["config"]);if(s!=null)_F(s,n);return n}function SF(e,t){let r={},n=d(e,["predictions"]);if(n!=null){let o=n;if(Array.isArray(o))o=o.map((i)=>Zl(i));m(r,["generatedImages"],o)}return r}function EF(e,t,r){let n={},o=d(e,["prompt"]);if(t!==void 0&&o!=null)m(t,["instances[0]","prompt"],o);let i=d(e,["personImage"]);if(t!==void 0&&i!=null)m(t,["instances[0]","personImage","image"],Xr(i));let s=d(e,["productImages"]);if(t!==void 0&&s!=null){let l=s;if(Array.isArray(l))l=l.map((a)=>vF(a));m(t,["instances[0]","productImages"],l)}return n}function bF(e,t){let r={},n=d(e,["referenceImage"]);if(n!=null)m(r,["referenceImage"],Xr(n));let o=d(e,["referenceId"]);if(o!=null)m(r,["referenceId"],o);let i=d(e,["referenceType"]);if(i!=null)m(r,["referenceType"],i);let s=d(e,["maskImageConfig"]);if(s!=null)m(r,["maskImageConfig"],fF(s));let l=d(e,["controlImageConfig"]);if(l!=null)m(r,["controlImageConfig"],fU(l));let a=d(e,["styleImageConfig"]);if(a!=null)m(r,["styleImageConfig"],a);let c=d(e,["subjectImageConfig"]);if(c!=null)m(r,["subjectImageConfig"],c);return r}function wF(e,t){let r={},n=d(e,["mimeType"]);if(n!=null)m(r,["mimeType"],n);let o=d(e,["voiceSampleAudio"]);if(o!=null)m(r,["voiceSampleAudio"],o);if(d(e,["consentAudio"])!==void 0)throw Error("consentAudio parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(d(e,["voiceConsentSignature"])!==void 0)throw Error("voiceConsentSignature parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return r}function QE(e,t){let r={},n=d(e,["safetyAttributes","categories"]);if(n!=null)m(r,["categories"],n);let o=d(e,["safetyAttributes","scores"]);if(o!=null)m(r,["scores"],o);let i=d(e,["contentType"]);if(i!=null)m(r,["contentType"],i);return r}function TF(e,t){let r={},n=d(e,["category"]);if(n!=null)m(r,["category"],n);if(d(e,["method"])!==void 0)throw Error("method parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let o=d(e,["threshold"]);if(o!=null)m(r,["threshold"],o);return r}function CF(e,t){let r={},n=d(e,["image"]);if(n!=null)m(r,["image"],Xr(n));return r}function RF(e,t,r){let n={},o=d(e,["mode"]);if(t!==void 0&&o!=null)m(t,["parameters","mode"],o);let i=d(e,["maxPredictions"]);if(t!==void 0&&i!=null)m(t,["parameters","maxPredictions"],i);let s=d(e,["confidenceThreshold"]);if(t!==void 0&&s!=null)m(t,["parameters","confidenceThreshold"],s);let l=d(e,["maskDilation"]);if(t!==void 0&&l!=null)m(t,["parameters","maskDilation"],l);let a=d(e,["binaryColorThreshold"]);if(t!==void 0&&a!=null)m(t,["parameters","binaryColorThreshold"],a);let c=d(e,["labels"]);if(t!==void 0&&c!=null)m(t,["labels"],c);return n}function AF(e,t,r){let n={},o=d(t,["model"]);if(o!=null)m(n,["_url","model"],yt(e,o));let i=d(t,["source"]);if(i!=null)PF(i,n);let s=d(t,["config"]);if(s!=null)RF(s,n);return n}function IF(e,t){let r={},n=d(e,["predictions"]);if(n!=null){let o=n;if(Array.isArray(o))o=o.map((i)=>XU(i));m(r,["generatedMasks"],o)}return r}function PF(e,t,r){let n={},o=d(e,["prompt"]);if(t!==void 0&&o!=null)m(t,["instances[0]","prompt"],o);let i=d(e,["image"]);if(t!==void 0&&i!=null)m(t,["instances[0]","image"],Xr(i));let s=d(e,["scribbleImage"]);if(t!==void 0&&s!=null)m(t,["instances[0]","scribble"],CF(s));return n}function kF(e,t){let r={},n=d(e,["speaker"]);if(n!=null)m(r,["speaker"],n);let o=d(e,["voiceConfig"]);if(o!=null)m(r,["voiceConfig"],ob(o));return r}function eb(e,t){let r={},n=d(e,["voiceConfig"]);if(n!=null)m(r,["voiceConfig"],ob(n));let o=d(e,["languageCode"]);if(o!=null)m(r,["languageCode"],o);let i=d(e,["multiSpeakerVoiceConfig"]);if(i!=null)m(r,["multiSpeakerVoiceConfig"],hF(i));return r}function NF(e,t){let r={},n=d(e,["functionCallingConfig"]);if(n!=null)m(r,["functionCallingConfig"],DU(n));let o=d(e,["retrievalConfig"]);if(o!=null)m(r,["retrievalConfig"],o);let i=d(e,["includeServerSideToolInvocations"]);if(i!=null)m(r,["includeServerSideToolInvocations"],i);return r}function OF(e,t){let r={},n=d(e,["functionCallingConfig"]);if(n!=null)m(r,["functionCallingConfig"],n);let o=d(e,["retrievalConfig"]);if(o!=null)m(r,["retrievalConfig"],o);if(d(e,["includeServerSideToolInvocations"])!==void 0)throw Error("includeServerSideToolInvocations parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return r}function MF(e,t){let r={};if(d(e,["retrieval"])!==void 0)throw Error("retrieval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let n=d(e,["googleMaps"]);if(n!=null)m(r,["googleMaps"],rF(n));let o=d(e,["mcpServers"]);if(o!=null){let h=o;if(Array.isArray(h))h=h.map((g)=>g);m(r,["mcpServers"],h)}let i=d(e,["codeExecution"]);if(i!=null)m(r,["codeExecution"],i);let s=d(e,["computerUse"]);if(s!=null)m(r,["computerUse"],s);if(d(e,["enterpriseWebSearch"])!==void 0)throw Error("enterpriseWebSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["exaAiSearch"])!==void 0)throw Error("exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let l=d(e,["functionDeclarations"]);if(l!=null){let h=l;if(Array.isArray(h))h=h.map((g)=>g);m(r,["functionDeclarations"],h)}let a=d(e,["googleSearch"]);if(a!=null)m(r,["googleSearch"],nF(a));let c=d(e,["googleSearchRetrieval"]);if(c!=null)m(r,["googleSearchRetrieval"],c);if(d(e,["parallelAiSearch"])!==void 0)throw Error("parallelAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let u=d(e,["urlContext"]);if(u!=null)m(r,["urlContext"],u);let f=d(e,["fileSearch"]);if(f!=null)m(r,["fileSearch"],f);return r}function tb(e,t){let r={},n=d(e,["retrieval"]);if(n!=null)m(r,["retrieval"],n);let o=d(e,["googleMaps"]);if(o!=null)m(r,["googleMaps"],o);let i=d(e,["mcpServers"]);if(i!=null){let _=i;if(Array.isArray(_))_=_.map((y)=>pF(y));m(r,["mcpServers"],_)}let s=d(e,["codeExecution"]);if(s!=null)m(r,["codeExecution"],s);let l=d(e,["computerUse"]);if(l!=null)m(r,["computerUse"],cU(l));let a=d(e,["enterpriseWebSearch"]);if(a!=null)m(r,["enterpriseWebSearch"],a);let c=d(e,["exaAiSearch"]);if(c!=null)m(r,["exaAiSearch"],c);let u=d(e,["functionDeclarations"]);if(u!=null){let _=u;if(Array.isArray(_))_=_.map((y)=>y);m(r,["functionDeclarations"],_)}let f=d(e,["googleSearch"]);if(f!=null)m(r,["googleSearch"],f);let h=d(e,["googleSearchRetrieval"]);if(h!=null)m(r,["googleSearchRetrieval"],h);let g=d(e,["parallelAiSearch"]);if(g!=null)m(r,["parallelAiSearch"],g);let p=d(e,["urlContext"]);if(p!=null)m(r,["urlContext"],p);if(d(e,["fileSearch"])!==void 0)throw Error("fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return r}function DF(e,t){let r={},n=d(e,["baseModel"]);if(n!=null)m(r,["baseModel"],n);let o=d(e,["createTime"]);if(o!=null)m(r,["createTime"],o);let i=d(e,["updateTime"]);if(i!=null)m(r,["updateTime"],i);return r}function $F(e,t){let r={},n=d(e,["labels","google-vertex-llm-tuning-base-model-id"]);if(n!=null)m(r,["baseModel"],n);let o=d(e,["createTime"]);if(o!=null)m(r,["createTime"],o);let i=d(e,["updateTime"]);if(i!=null)m(r,["updateTime"],i);return r}function xF(e,t,r){let n={},o=d(e,["displayName"]);if(t!==void 0&&o!=null)m(t,["displayName"],o);let i=d(e,["description"]);if(t!==void 0&&i!=null)m(t,["description"],i);let s=d(e,["defaultCheckpointId"]);if(t!==void 0&&s!=null)m(t,["defaultCheckpointId"],s);return n}function LF(e,t,r){let n={},o=d(e,["displayName"]);if(t!==void 0&&o!=null)m(t,["displayName"],o);let i=d(e,["description"]);if(t!==void 0&&i!=null)m(t,["description"],i);let s=d(e,["defaultCheckpointId"]);if(t!==void 0&&s!=null)m(t,["defaultCheckpointId"],s);return n}function qF(e,t,r){let n={},o=d(t,["model"]);if(o!=null)m(n,["_url","name"],yt(e,o));let i=d(t,["config"]);if(i!=null)xF(i,n);return n}function UF(e,t,r){let n={},o=d(t,["model"]);if(o!=null)m(n,["_url","model"],yt(e,o));let i=d(t,["config"]);if(i!=null)LF(i,n);return n}function FF(e,t,r){let n={},o=d(e,["outputGcsUri"]);if(t!==void 0&&o!=null)m(t,["parameters","storageUri"],o);let i=d(e,["safetyFilterLevel"]);if(t!==void 0&&i!=null)m(t,["parameters","safetySetting"],i);let s=d(e,["personGeneration"]);if(t!==void 0&&s!=null)m(t,["parameters","personGeneration"],s);let l=d(e,["includeRaiReason"]);if(t!==void 0&&l!=null)m(t,["parameters","includeRaiReason"],l);let a=d(e,["outputMimeType"]);if(t!==void 0&&a!=null)m(t,["parameters","outputOptions","mimeType"],a);let c=d(e,["outputCompressionQuality"]);if(t!==void 0&&c!=null)m(t,["parameters","outputOptions","compressionQuality"],c);let u=d(e,["enhanceInputImage"]);if(t!==void 0&&u!=null)m(t,["parameters","upscaleConfig","enhanceInputImage"],u);let f=d(e,["imagePreservationFactor"]);if(t!==void 0&&f!=null)m(t,["parameters","upscaleConfig","imagePreservationFactor"],f);let h=d(e,["labels"]);if(t!==void 0&&h!=null)m(t,["labels"],h);let g=d(e,["numberOfImages"]);if(t!==void 0&&g!=null)m(t,["parameters","sampleCount"],g);let p=d(e,["mode"]);if(t!==void 0&&p!=null)m(t,["parameters","mode"],p);return n}function GF(e,t,r){let n={},o=d(t,["model"]);if(o!=null)m(n,["_url","model"],yt(e,o));let i=d(t,["image"]);if(i!=null)m(n,["instances[0]","image"],Xr(i));let s=d(t,["upscaleFactor"]);if(s!=null)m(n,["parameters","upscaleConfig","upscaleFactor"],s);let l=d(t,["config"]);if(l!=null)FF(l,n);return n}function BF(e,t){let r={},n=d(e,["sdkHttpResponse"]);if(n!=null)m(r,["sdkHttpResponse"],n);let o=d(e,["predictions"]);if(o!=null){let i=o;if(Array.isArray(i))i=i.map((s)=>Zl(s));m(r,["generatedImages"],i)}return r}function HF(e,t){let r={},n=d(e,["uri"]);if(n!=null)m(r,["uri"],n);let o=d(e,["encodedVideo"]);if(o!=null)m(r,["videoBytes"],jo(o));let i=d(e,["encoding"]);if(i!=null)m(r,["mimeType"],i);return r}function zF(e,t){let r={},n=d(e,["gcsUri"]);if(n!=null)m(r,["uri"],n);let o=d(e,["bytesBase64Encoded"]);if(o!=null)m(r,["videoBytes"],jo(o));let i=d(e,["mimeType"]);if(i!=null)m(r,["mimeType"],i);return r}function VF(e,t){let r={},n=d(e,["image"]);if(n!=null)m(r,["_self"],Xr(n));let o=d(e,["maskMode"]);if(o!=null)m(r,["maskMode"],o);return r}function jF(e,t){let r={},n=d(e,["image"]);if(n!=null)m(r,["image"],Ql(n));let o=d(e,["referenceType"]);if(o!=null)m(r,["referenceType"],o);return r}function WF(e,t){let r={},n=d(e,["image"]);if(n!=null)m(r,["image"],Xr(n));let o=d(e,["referenceType"]);if(o!=null)m(r,["referenceType"],o);return r}function rb(e,t){let r={},n=d(e,["uri"]);if(n!=null)m(r,["uri"],n);let o=d(e,["videoBytes"]);if(o!=null)m(r,["encodedVideo"],jo(o));let i=d(e,["mimeType"]);if(i!=null)m(r,["encoding"],i);return r}function nb(e,t){let r={},n=d(e,["uri"]);if(n!=null)m(r,["gcsUri"],n);let o=d(e,["videoBytes"]);if(o!=null)m(r,["bytesBase64Encoded"],jo(o));let i=d(e,["mimeType"]);if(i!=null)m(r,["mimeType"],i);return r}function ob(e,t){let r={},n=d(e,["replicatedVoiceConfig"]);if(n!=null)m(r,["replicatedVoiceConfig"],wF(n));let o=d(e,["prebuiltVoiceConfig"]);if(o!=null)m(r,["prebuiltVoiceConfig"],o);let i=d(e,["voice"]);if(i!=null)m(r,["voice"],i);return r}function JF(e,t,r){let n={},o=d(t,["displayName"]);if(r!==void 0&&o!=null)m(r,["displayName"],o);let i=d(t,["embeddingModel"]);if(r!==void 0&&i!=null)m(r,["embeddingModel"],yt(e,i));return n}function KF(e,t){let r={},n=d(t,["config"]);if(n!=null)JF(e,n,r);return r}function XF(e,t){let r={},n=d(e,["force"]);if(t!==void 0&&n!=null)m(t,["_query","force"],n);return r}function YF(e){let t={},r=d(e,["name"]);if(r!=null)m(t,["_url","name"],r);let n=d(e,["config"]);if(n!=null)XF(n,t);return t}function ZF(e){let t={},r=d(e,["name"]);if(r!=null)m(t,["_url","name"],r);return t}function QF(e,t){let r={},n=d(e,["customMetadata"]);if(t!==void 0&&n!=null){let i=n;if(Array.isArray(i))i=i.map((s)=>s);m(t,["customMetadata"],i)}let o=d(e,["chunkingConfig"]);if(t!==void 0&&o!=null)m(t,["chunkingConfig"],o);return r}function eG(e){let t={},r=d(e,["name"]);if(r!=null)m(t,["name"],r);let n=d(e,["metadata"]);if(n!=null)m(t,["metadata"],n);let o=d(e,["done"]);if(o!=null)m(t,["done"],o);let i=d(e,["error"]);if(i!=null)m(t,["error"],i);let s=d(e,["response"]);if(s!=null)m(t,["response"],rG(s));return t}function tG(e){let t={},r=d(e,["fileSearchStoreName"]);if(r!=null)m(t,["_url","file_search_store_name"],r);let n=d(e,["fileName"]);if(n!=null)m(t,["fileName"],n);let o=d(e,["config"]);if(o!=null)QF(o,t);return t}function rG(e){let t={},r=d(e,["sdkHttpResponse"]);if(r!=null)m(t,["sdkHttpResponse"],r);let n=d(e,["parent"]);if(n!=null)m(t,["parent"],n);let o=d(e,["documentName"]);if(o!=null)m(t,["documentName"],o);return t}function nG(e,t){let r={},n=d(e,["pageSize"]);if(t!==void 0&&n!=null)m(t,["_query","pageSize"],n);let o=d(e,["pageToken"]);if(t!==void 0&&o!=null)m(t,["_query","pageToken"],o);return r}function oG(e){let t={},r=d(e,["config"]);if(r!=null)nG(r,t);return t}function iG(e){let t={},r=d(e,["sdkHttpResponse"]);if(r!=null)m(t,["sdkHttpResponse"],r);let n=d(e,["nextPageToken"]);if(n!=null)m(t,["nextPageToken"],n);let o=d(e,["fileSearchStores"]);if(o!=null){let i=o;if(Array.isArray(i))i=i.map((s)=>s);m(t,["fileSearchStores"],i)}return t}function ib(e,t){let r={},n=d(e,["mimeType"]);if(t!==void 0&&n!=null)m(t,["mimeType"],n);let o=d(e,["displayName"]);if(t!==void 0&&o!=null)m(t,["displayName"],o);let i=d(e,["customMetadata"]);if(t!==void 0&&i!=null){let l=i;if(Array.isArray(l))l=l.map((a)=>a);m(t,["customMetadata"],l)}let s=d(e,["chunkingConfig"]);if(t!==void 0&&s!=null)m(t,["chunkingConfig"],s);return r}function sG(e){let t={},r=d(e,["fileSearchStoreName"]);if(r!=null)m(t,["_url","file_search_store_name"],r);let n=d(e,["config"]);if(n!=null)ib(n,t);return t}function aG(e){let t={},r=d(e,["sdkHttpResponse"]);if(r!=null)m(t,["sdkHttpResponse"],r);return t}var lG="Content-Type",cG="X-Server-Timeout",uG="User-Agent",yu="x-goog-api-client",dG="2.26.0",fG=`google-genai-sdk/${dG}`,pG="v1beta1",hG="v1beta",mG=new Set(["us","eu"]);function gG(e){let r=globalThis[Symbol.for("undici.globalDispatcher.1")];if(!r)return;for(let n of Object.getOwnPropertySymbols(r)){let o=n.description;if((o===null||o===void 0?void 0:o.includes("headers timeout"))||(o===null||o===void 0?void 0:o.includes("body timeout"))){let i=r[n];if(typeof i==="number")r[n]=Math.max(i,e)}}}function vG(e,t){let r=()=>{};if(!(e&&e>0)&&!t)return{signal:void 0,dispose:r};let n=new AbortController,o;if(e&&e>0){if(o=setTimeout(()=>n.abort(),e),o&&typeof o.unref==="function")o.unref()}let i=()=>n.abort();if(t)if(t.aborted)n.abort();else t.addEventListener("abort",i);return{signal:n.signal,dispose:()=>{if(o!==void 0)clearTimeout(o);t===null||t===void 0||t.removeEventListener("abort",i)}}}var _G=5,yG=1,SG=60,EG=2,bG=1,wG=[408,429,500,502,503,504],TG=class{constructor(e){var t,r,n;this.clientOptions=Object.assign({},e),this.customBaseUrl=(t=e.httpOptions)===null||t===void 0?void 0:t.baseUrl;let o={};if(this.clientOptions.vertexai){if(!this.clientOptions.location&&!this.clientOptions.apiKey&&!this.customBaseUrl)this.clientOptions.location="global";if(!(this.clientOptions.project&&this.clientOptions.location||this.clientOptions.apiKey)&&!this.customBaseUrl)throw Error("Authentication is not set up. Please provide either a project and location, or an API key, or a custom base URL.");let s=e.project&&e.location||!!e.apiKey;if(this.customBaseUrl&&!s)o.baseUrl=this.customBaseUrl,this.clientOptions.project=void 0,this.clientOptions.location=void 0;else if(this.clientOptions.apiKey&&!this.clientOptions.project||this.clientOptions.location==="global")o.baseUrl="https://aiplatform.googleapis.com/";else if(this.clientOptions.project&&this.clientOptions.location&&mG.has(this.clientOptions.location))o.baseUrl=`https://aiplatform.${this.clientOptions.location}.rep.googleapis.com/`;else if(this.clientOptions.project&&this.clientOptions.location)o.baseUrl=`https://${this.clientOptions.location}-aiplatform.googleapis.com/`;o.apiVersion=(r=this.clientOptions.apiVersion)!==null&&r!==void 0?r:pG}else{if(!this.clientOptions.apiKey)console.warn("API key should be set when using the Gemini API.");o.apiVersion=(n=this.clientOptions.apiVersion)!==null&&n!==void 0?n:hG,o.baseUrl="https://generativelanguage.googleapis.com/"}if(o.headers=this.getDefaultHeaders(),this.clientOptions.httpOptions=o,e.httpOptions)this.clientOptions.httpOptions=this.patchHttpOptions(o,e.httpOptions)}isVertexAI(){var e;return(e=this.clientOptions.vertexai)!==null&&e!==void 0?e:!1}getProject(){return this.clientOptions.project}getLocation(){return this.clientOptions.location}getCustomBaseUrl(){return this.customBaseUrl}async getAuthHeaders(){let e=new Headers;return await this.clientOptions.auth.addAuthHeaders(e),e}getApiVersion(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.apiVersion!==void 0)return this.clientOptions.httpOptions.apiVersion;throw Error("API version is not set.")}getBaseUrl(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.baseUrl!==void 0)return this.clientOptions.httpOptions.baseUrl;throw Error("Base URL is not set.")}getRequestUrl(){return this.getRequestUrlInternal(this.clientOptions.httpOptions)}getHeaders(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.headers!==void 0)return this.clientOptions.httpOptions.headers;else throw Error("Headers are not set.")}getFetch(){var e;return(e=this.clientOptions.httpOptions)===null||e===void 0?void 0:e.fetch}getRequestUrlInternal(e){if(!e||e.baseUrl===void 0||e.apiVersion===void 0)throw Error("HTTP options are not correctly set.");let r=[e.baseUrl.endsWith("/")?e.baseUrl.slice(0,-1):e.baseUrl];if(e.apiVersion&&e.apiVersion!=="")r.push(e.apiVersion);return r.join("/")}getBaseResourcePath(){return`projects/${this.clientOptions.project}/locations/${this.clientOptions.location}`}getApiKey(){return this.clientOptions.apiKey}getWebsocketBaseUrl(){let e=this.getBaseUrl(),t=new URL(e);return t.protocol=t.protocol=="http:"?"ws":"wss",t.toString()}setBaseUrl(e){if(this.clientOptions.httpOptions)this.clientOptions.httpOptions.baseUrl=e;else throw Error("HTTP options are not correctly set.")}constructUrl(e,t,r){let n=[this.getRequestUrlInternal(t)];if(r)n.push(this.getBaseResourcePath());if(e!=="")n.push(e);return new URL(`${n.join("/")}`)}shouldPrependVertexProjectPath(e,t){if(t.baseUrl&&t.baseUrlResourceScope===hu.COLLECTION)return!1;if(!this.clientOptions.vertexai)return!1;if(!this.clientOptions.project||!this.clientOptions.location)return!1;if(e.path.startsWith("projects/"))return!1;if(e.httpMethod==="GET"&&e.path.startsWith("publishers/google/models"))return!1;return!0}async request(e){let t=this.clientOptions.httpOptions;if(e.httpOptions)t=this.patchHttpOptions(this.clientOptions.httpOptions,e.httpOptions);let r=this.shouldPrependVertexProjectPath(e,t),n=this.constructUrl(e.path,t,r);if(e.queryParams)for(let[i,s]of Object.entries(e.queryParams))n.searchParams.append(i,String(s));let o={};if(e.httpMethod==="GET"){if(e.body&&e.body!=="{}")throw Error("Request body should be empty for GET request, but got non empty request body")}else o.body=e.body;return o=await this.includeExtraHttpOptionsToRequestInit(o,t,n.toString()),this.unaryApiCall(n,o,e.httpMethod,t.retryOptions,t.timeout,e.abortSignal,t.fetch)}patchHttpOptions(e,t){let r=JSON.parse(JSON.stringify(e));if(e.fetch)r.fetch=e.fetch;for(let[n,o]of Object.entries(t))if(typeof o==="object")r[n]=Object.assign(Object.assign({},r[n]),o);else if(o!==void 0)r[n]=o;return r}async requestStream(e){let t=this.clientOptions.httpOptions;if(e.httpOptions)t=this.patchHttpOptions(this.clientOptions.httpOptions,e.httpOptions);let r=this.shouldPrependVertexProjectPath(e,t),n=this.constructUrl(e.path,t,r);if(!n.searchParams.has("alt")||n.searchParams.get("alt")!=="sse")n.searchParams.set("alt","sse");let o={};return o.body=e.body,o=await this.includeExtraHttpOptionsToRequestInit(o,t,n.toString()),this.streamApiCall(n,o,e.httpMethod,t.retryOptions,t.timeout,e.abortSignal,t.fetch)}async includeExtraHttpOptionsToRequestInit(e,t,r){if((t===null||t===void 0?void 0:t.timeout)&&t.timeout>0)gG(t.timeout);if(t&&t.extraBody!==null)CG(e,t.extraBody);return e.headers=await this.getHeadersInternal(t,r),e}async unaryApiCall(e,t,r,n,o,i,s){return this.apiCall(e.toString(),Object.assign(Object.assign({},t),{method:r}),n,o,i,s).then(async(l)=>(await Fc(l),new Li(l))).catch((l)=>{if(l instanceof Error)throw l;else throw Error(`exception ${l} sending request`,{cause:l})})}async streamApiCall(e,t,r,n,o,i,s){return this.apiCall(e.toString(),Object.assign(Object.assign({},t),{method:r}),n,o,i,s).then(async(l)=>(await Fc(l),this.processStreamResponse(l))).catch((l)=>{if(l instanceof Error)throw l;else throw Error(`exception ${l} sending request`,{cause:l})})}processStreamResponse(e){return Ii(this,arguments,function*t(){var r;let n=(r=e===null||e===void 0?void 0:e.body)===null||r===void 0?void 0:r.getReader(),o=new TextDecoder("utf-8");if(!n)throw Error("Response body is empty");try{let i="",s="data:",l=[`
126
+
127
+ `,"\r\r",`\r
128
+ \r
129
+ `];while(!0){let{done:a,value:c}=yield kt(n.read());if(a){if(i.trim().length>0)throw Error("Incomplete JSON segment at the end");break}let u=o.decode(c,{stream:!0});try{let g=JSON.parse(u);if("error"in g){let p=JSON.parse(JSON.stringify(g.error)),{status:_,code:y}=p,S=`got status: ${_}. ${JSON.stringify(g)}`;if(y>=400&&y<600)throw new KE({message:S,status:y})}}catch(g){if(g.name==="ApiError")throw g}i+=u;let f=-1,h=0;while(!0){f=-1,h=0;for(let _ of l){let y=i.indexOf(_);if(y!==-1&&(f===-1||y<f))f=y,h=_.length}if(f===-1)break;let g=i.substring(0,f);i=i.substring(f+h);let p=g.trim();if(p.startsWith(s)){let _=p.substring(s.length).trim();try{let y=new Response(_,{headers:e===null||e===void 0?void 0:e.headers,status:e===null||e===void 0?void 0:e.status,statusText:e===null||e===void 0?void 0:e.statusText});yield yield kt(new Li(y))}catch(y){throw Error(`exception parsing stream chunk ${_}. ${y}`)}}}}}finally{n.releaseLock()}})}async apiCall(e,t,r,n,o,i){var s,l,a,c,u,f;let h=i!==null&&i!==void 0?i:fetch,g=(s=r===null||r===void 0?void 0:r.httpStatusCodes)!==null&&s!==void 0?s:wG,p=async()=>{let E=vG(n,o),b;try{b=await h(e,Object.assign(Object.assign({},t),{signal:E.signal}))}catch(R){throw E.dispose(),R}if(!r||b.ok||!g.includes(b.status))return b;try{await Fc(b)}finally{E.dispose()}return b};if(!r)return p();let _=Math.max(1,(l=r.attempts)!==null&&l!==void 0?l:_G),y=Math.round(((a=r.initialDelay)!==null&&a!==void 0?a:yG)*1000),S=Math.max(y,Math.round(((c=r.maxDelay)!==null&&c!==void 0?c:SG)*1000));return(0,H$.default)(p,{retries:_-1,factor:(u=r.expBase)!==null&&u!==void 0?u:EG,minTimeout:y,maxTimeout:S,randomize:((f=r.jitter)!==null&&f!==void 0?f:bG)>0,onFailedAttempt:(E)=>{var b;if(o===null||o===void 0?void 0:o.aborted)throw(b=E.error)!==null&&b!==void 0?b:E}})}getDefaultHeaders(){let e={},t=fG+" "+this.clientOptions.userAgentExtra;return e[uG]=t,e[yu]=t,e[lG]="application/json",e}async getHeadersInternal(e,t){let r=new Headers;if(e&&e.headers)for(let[n,o]of Object.entries(e.headers))r.append(n,o);if((e===null||e===void 0?void 0:e.timeout)&&e.timeout>0)r.append(cG,String(Math.ceil(e.timeout/1000)));return await this.clientOptions.auth.addAuthHeaders(r,t),r}getFileName(e){var t;let r="";if(typeof e==="string")r=e.replace(/[/\\]+$/,""),r=(t=r.split(/[/\\]/).pop())!==null&&t!==void 0?t:"";return r}async uploadFile(e,t){var r;let n={};if(t!=null)n.mimeType=t.mimeType,n.name=t.name,n.displayName=t.displayName;if(n.name&&!n.name.startsWith("files/"))n.name=`files/${n.name}`;let o=this.clientOptions.uploader,i=await o.stat(e);n.sizeBytes=String(i.size);let s=(r=t===null||t===void 0?void 0:t.mimeType)!==null&&r!==void 0?r:i.type;if(s===void 0||s==="")throw Error("Can not determine mimeType. Please provide mimeType in the config.");n.mimeType=s;let l={file:n},a=this.getFileName(e),c=Ae("upload/v1beta/files",l._url),u=await this.fetchUploadUrl(c,n.sizeBytes,n.mimeType,a,l,t===null||t===void 0?void 0:t.httpOptions);return o.upload(e,u,this)}async uploadFileToFileSearchStore(e,t,r){var n;let o=this.clientOptions.uploader,i=await o.stat(t),s=String(i.size),l=(n=r===null||r===void 0?void 0:r.mimeType)!==null&&n!==void 0?n:i.type;if(l===void 0||l==="")throw Error("Can not determine mimeType. Please provide mimeType in the config.");let a=`upload/v1beta/${e}:uploadToFileSearchStore`,c=this.getFileName(t),u={};if(r!=null)ib(r,u);let f=await this.fetchUploadUrl(a,s,l,c,u,r===null||r===void 0?void 0:r.httpOptions);return o.uploadToFileSearchStore(t,f,this)}async downloadFile(e){await this.clientOptions.downloader.download(e,this)}async fetchUploadUrl(e,t,r,n,o,i){var s;let l={};if(i)l=i;else l={apiVersion:"",headers:Object.assign({"Content-Type":"application/json","X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${t}`,"X-Goog-Upload-Header-Content-Type":`${r}`},n?{"X-Goog-Upload-File-Name":n}:{})};let a=await this.request({path:e,body:JSON.stringify(o),httpMethod:"POST",httpOptions:l});if(!a||!(a===null||a===void 0?void 0:a.headers))throw Error("Server did not return an HttpResponse or the returned HttpResponse did not have headers.");let c=(s=a===null||a===void 0?void 0:a.headers)===null||s===void 0?void 0:s["x-goog-upload-url"];if(c===void 0)throw Error("Failed to get upload url. Server did not return the x-google-upload-url in the headers");return c}};async function Fc(e){var t;if(e===void 0)throw Error("response is undefined");if(!e.ok){let r=e.status,n;if((t=e.headers.get("content-type"))===null||t===void 0?void 0:t.includes("application/json"))n=await e.json();else n={error:{message:await e.text(),code:e.status,status:e.statusText}};let o=JSON.stringify(n);if(r>=400&&r<600)throw new KE({message:o,status:r});throw Error(o)}}function CG(e,t){if(!t||Object.keys(t).length===0)return;if(e.body instanceof Blob){console.warn("includeExtraBodyToRequestInit: extraBody provided but current request body is a Blob. extraBody will be ignored as merging is not supported for Blob bodies.");return}let r={};if(typeof e.body==="string"&&e.body.length>0)try{let i=JSON.parse(e.body);if(typeof i==="object"&&i!==null&&!Array.isArray(i))r=i;else{console.warn("includeExtraBodyToRequestInit: Original request body is valid JSON but not a non-array object. Skip applying extraBody to the request body.");return}}catch(i){console.warn("includeExtraBodyToRequestInit: Original request body is not valid JSON. Skip applying extraBody to the request body.");return}function n(i,s){let l=Object.assign({},i);for(let a in s)if(Object.prototype.hasOwnProperty.call(s,a)){let c=s[a],u=l[a];if(c&&typeof c==="object"&&!Array.isArray(c)&&u&&typeof u==="object"&&!Array.isArray(u))l[a]=n(u,c);else{if(u&&c&&typeof u!==typeof c)console.warn(`includeExtraBodyToRequestInit:deepMerge: Type mismatch for key "${a}". Original type: ${typeof u}, New type: ${typeof c}. Overwriting.`);l[a]=c}}return l}let o=n(r,t);e.body=JSON.stringify(o)}var RG="mcp_used/unknown",AG=!1;function sb(e){for(let t of e){if(IG(t))return!0;if(typeof t==="object"&&"inputSchema"in t)return!0}return AG}function ab(e){var t;let r=(t=e[yu])!==null&&t!==void 0?t:"";e[yu]=(r+` ${RG}`).trimStart()}function IG(e){return e!==null&&typeof e==="object"&&e instanceof kG}function PG(e){return Ii(this,arguments,function*t(r,n=100){let o=void 0,i=0;while(i<n){let s=yield kt(r.listTools({cursor:o}));for(let l of s.tools)yield yield kt(l),i++;if(!s.nextCursor)break;o=s.nextCursor}})}var kG=class e{constructor(t=[],r){this.mcpTools=[],this.functionNameToMcpClient={},this.mcpClients=t,this.config=r}static create(t,r){return new e(t,r)}async initialize(){var t,r,n,o;if(this.mcpTools.length>0)return;let i={},s=[];for(let u of this.mcpClients)try{for(var l=!0,a=(r=void 0,ks(PG(u))),c;c=await a.next(),t=c.done,!t;l=!0){o=c.value,l=!1;let f=o;s.push(f);let h=f.name;if(i[h])throw Error(`Duplicate function name ${h} found in MCP tools. Please ensure function names are unique.`);i[h]=u}}catch(f){r={error:f}}finally{try{if(!l&&!t&&(n=a.return))await n.call(a)}finally{if(r)throw r.error}}this.mcpTools=s,this.functionNameToMcpClient=i}async tool(){return await this.initialize(),qx(this.mcpTools,this.config)}async callTool(t){await this.initialize();let r=[];for(let n of t)if(n.name in this.functionNameToMcpClient){let o=this.functionNameToMcpClient[n.name],i=void 0;if(this.config.timeout)i={timeout:this.config.timeout};let s=await o.callTool({name:n.name,arguments:n.args},void 0,i);r.push({functionResponse:{name:n.name,response:s.isError?{error:s}:s}})}return r}};async function NG(e,t,r){let n=new Ox,o;if(r.data instanceof Blob)o=JSON.parse(await r.data.text());else o=JSON.parse(r.data);Object.assign(n,o),t(n)}var OG=class{constructor(e,t,r){this.apiClient=e,this.auth=t,this.webSocketFactory=r}async connect(e){var t,r;if(this.apiClient.isVertexAI())throw Error("Live music is not supported for Vertex AI.");console.warn("Live music generation is experimental and may change in future versions.");let n=this.apiClient.getWebsocketBaseUrl(),o=this.apiClient.getApiVersion(),i=$G(this.apiClient.getDefaultHeaders()),s=this.apiClient.getApiKey(),l=`${n}/ws/google.ai.generativelanguage.${o}.GenerativeService.BidiGenerateMusic?key=${s}`,a=()=>{},c=new Promise((E)=>{a=E}),u=e.callbacks,f=function(){a({})},h=this.apiClient,g={onopen:f,onmessage:(E)=>{NG(h,u.onmessage,E)},onerror:(t=u===null||u===void 0?void 0:u.onerror)!==null&&t!==void 0?t:function(E){},onclose:(r=u===null||u===void 0?void 0:u.onclose)!==null&&r!==void 0?r:function(E){}},p=this.webSocketFactory.create(l,DG(i),g);p.connect(),await c;let S={setup:{model:yt(this.apiClient,e.model)}};return p.send(JSON.stringify(S)),new MG(p,this.apiClient)}},MG=class{constructor(e,t){this.conn=e,this.apiClient=t}async setWeightedPrompts(e){if(!e.weightedPrompts||Object.keys(e.weightedPrompts).length===0)throw Error("Weighted prompts must be set and contain at least one entry.");let t=Bq(e);this.conn.send(JSON.stringify({clientContent:t}))}async setMusicGenerationConfig(e){if(!e.musicGenerationConfig)e.musicGenerationConfig={};let t=Gq(e);this.conn.send(JSON.stringify(t))}sendPlaybackControl(e){let t={playbackControl:e};this.conn.send(JSON.stringify(t))}play(){this.sendPlaybackControl(bi.PLAY)}pause(){this.sendPlaybackControl(bi.PAUSE)}stop(){this.sendPlaybackControl(bi.STOP)}resetContext(){this.sendPlaybackControl(bi.RESET_CONTEXT)}close(){this.conn.close()}};function DG(e){let t={};return e.forEach((r,n)=>{t[n]=r}),t}function $G(e){let t=new Headers;for(let[r,n]of Object.entries(e))t.append(r,n);return t}var xG="FunctionResponse request must have an `id` field from the response of a ToolCall.FunctionalCalls in Google AI.";async function LG(e,t,r){let n=new Nx,o;if(r.data instanceof Blob)o=await r.data.text();else if(r.data instanceof ArrayBuffer)o=new TextDecoder().decode(r.data);else o=r.data;let i=JSON.parse(o);if(e.isVertexAI()){let s=Vq(i);Object.assign(n,s)}else Object.assign(n,i);t(n)}var qG=class{constructor(e,t,r){this.apiClient=e,this.auth=t,this.webSocketFactory=r,this.music=new OG(this.apiClient,this.auth,this.webSocketFactory)}async connect(e){var t,r,n,o,i,s;if(e.config&&e.config.httpOptions)throw Error("The Live module does not support httpOptions at request-level in LiveConnectConfig yet. Please use the client-level httpOptions configuration instead.");let l=this.apiClient.getWebsocketBaseUrl(),a=this.apiClient.getApiVersion(),c,u=this.apiClient.getHeaders();if(e.config&&e.config.tools&&sb(e.config.tools))ab(u);let f=BG(u);if(this.apiClient.isVertexAI()){let G=this.apiClient.getProject(),B=this.apiClient.getLocation(),Q=this.apiClient.getApiKey(),pe=!!G&&!!B||!!Q;if(this.apiClient.getCustomBaseUrl()&&!pe)c=l;else c=`${l}/ws/google.cloud.aiplatform.${a}.LlmBidiService/BidiGenerateContent`,await this.auth.addAuthHeaders(f,c)}else{let G=this.apiClient.getApiKey(),B="BidiGenerateContent",Q="key";if(G===null||G===void 0?void 0:G.startsWith("auth_tokens/")){if(console.warn("Warning: Ephemeral token support is experimental and may change in future versions."),a!=="v1alpha")console.warn("Warning: The SDK's ephemeral token support is in v1alpha only. Please use const ai = new GoogleGenAI({apiKey: token.name, httpOptions: { apiVersion: 'v1alpha' }}); before session connection.");B="BidiGenerateContentConstrained",Q="access_token"}c=`${l}/ws/google.ai.generativelanguage.${a}.GenerativeService.${B}?${Q}=${G}`}let h=()=>{},g=new Promise((G)=>{h=G}),p=e.callbacks,_=function(){var G;(G=p===null||p===void 0?void 0:p.onopen)===null||G===void 0||G.call(p),h({})},y=this.apiClient,S=!1,E=[],b=()=>{},R=new Promise((G)=>{b=G}),w={onopen:_,onmessage:(G)=>{LG(y,(B)=>{if(B.setupComplete&&!F.setupComplete)F.setupComplete=B.setupComplete,b({});if(S)p.onmessage(B);else E.push(B)},G)},onerror:(t=p===null||p===void 0?void 0:p.onerror)!==null&&t!==void 0?t:function(G){},onclose:(r=p===null||p===void 0?void 0:p.onclose)!==null&&r!==void 0?r:function(G){}},T=this.webSocketFactory.create(c,GG(f),w);T.connect(),await g;let C=yt(this.apiClient,e.model);if(this.apiClient.isVertexAI()&&C.startsWith("publishers/")){let G=this.apiClient.getProject(),B=this.apiClient.getLocation();if(G&&B)C=`projects/${G}/locations/${B}/`+C}let A={};if(this.apiClient.isVertexAI()&&((n=e.config)===null||n===void 0?void 0:n.responseModalities)===void 0)if(e.config===void 0)e.config={responseModalities:[qs.AUDIO]};else e.config.responseModalities=[qs.AUDIO];if((o=e.config)===null||o===void 0?void 0:o.generationConfig)console.warn("Setting `LiveConnectConfig.generation_config` is deprecated, please set the fields on `LiveConnectConfig` directly. It will be removed in the next major version (not before 7/31/2026).");let P=(s=(i=e.config)===null||i===void 0?void 0:i.tools)!==null&&s!==void 0?s:[],D=[];for(let G of P)if(this.isCallableTool(G)){let B=G;D.push(await B.tool())}else D.push(G);if(D.length>0)e.config.tools=D;let N={model:C,config:e.config,callbacks:e.callbacks};if(this.apiClient.isVertexAI())A=Fq(this.apiClient,N);else A=Uq(this.apiClient,N);delete A.config;let F=new FG(T,this.apiClient);T.send(JSON.stringify(A)),await R,S=!0;for(let G of E)p.onmessage(G);return F}isCallableTool(e){return"callTool"in e&&typeof e.callTool==="function"}},UG={turnComplete:!0},FG=class{constructor(e,t){this.conn=e,this.apiClient=t}tLiveClientContent(e,t){if(t.turns!==null&&t.turns!==void 0){let r=[];try{if(r=mr(t.turns),!e.isVertexAI())r=r.map((n)=>Qs(n))}catch(n){throw Error(`Failed to parse client content "turns", type: '${typeof t.turns}'`)}return{clientContent:{turns:r,turnComplete:t.turnComplete}}}return{clientContent:{turnComplete:t.turnComplete}}}tLiveClienttToolResponse(e,t){let r=[];if(t.functionResponses==null)throw Error("functionResponses is required.");if(!Array.isArray(t.functionResponses))r=[t.functionResponses];else r=t.functionResponses;if(r.length===0)throw Error("functionResponses is required.");for(let o of r){if(typeof o!=="object"||o===null||!("name"in o)||!("response"in o))throw Error(`Could not parse function response, type '${typeof o}'.`);if(!e.isVertexAI()&&!("id"in o))throw Error(xG)}return{toolResponse:{functionResponses:r}}}sendClientContent(e){e=Object.assign(Object.assign({},UG),e);let t=this.tLiveClientContent(this.apiClient,e);this.conn.send(JSON.stringify(t))}sendRealtimeInput(e){let t={};if(this.apiClient.isVertexAI())t={realtimeInput:zq(e)};else t={realtimeInput:Hq(e)};this.conn.send(JSON.stringify(t))}sendToolResponse(e){if(e.functionResponses==null)throw Error("Tool response parameters are required.");let t=this.tLiveClienttToolResponse(this.apiClient,e);this.conn.send(JSON.stringify(t))}close(){this.conn.close()}};function GG(e){let t={};return e.forEach((r,n)=>{t[n]=r}),t}function BG(e){let t=new Headers;for(let[r,n]of Object.entries(e))t.append(r,n);return t}var lg=10;function cg(e){var t,r,n;if((t=e===null||e===void 0?void 0:e.automaticFunctionCalling)===null||t===void 0?void 0:t.disable)return!0;let o=!1;for(let s of(r=e===null||e===void 0?void 0:e.tools)!==null&&r!==void 0?r:[])if(Pi(s)){o=!0;break}if(!o)return!0;let i=(n=e===null||e===void 0?void 0:e.automaticFunctionCalling)===null||n===void 0?void 0:n.maximumRemoteCalls;if(i&&(i<0||!Number.isInteger(i))||i==0)return console.warn("Invalid maximumRemoteCalls value provided for automatic function calling. Disabled automatic function calling. Please provide a valid integer value greater than 0. maximumRemoteCalls provided:",i),!0;return!1}function Pi(e){return"callTool"in e&&typeof e.callTool==="function"}function HG(e){var t,r,n;return(n=(r=(t=e.config)===null||t===void 0?void 0:t.tools)===null||r===void 0?void 0:r.some((o)=>Pi(o)))!==null&&n!==void 0?n:!1}function ug(e){var t;let r=[];if(!((t=e===null||e===void 0?void 0:e.config)===null||t===void 0?void 0:t.tools))return r;return e.config.tools.forEach((n,o)=>{if(Pi(n))return;let i=n;if(i.functionDeclarations&&i.functionDeclarations.length>0)r.push(o)}),r}function dg(e){var t;return!((t=e===null||e===void 0?void 0:e.automaticFunctionCalling)===null||t===void 0?void 0:t.ignoreCallHistory)}var ec=class e extends Un{constructor(t){super();this.apiClient=t,this.embedContent=async(r)=>{if(!this.apiClient.isVertexAI()){if(r.model.includes("gemini-embedding-2"))r.contents=mr(r.contents);return await this.embedContentInternal(r)}if(r.model.includes("gemini")&&r.model!=="gemini-embedding-001"||r.model.includes("maas")){let o=mr(r.contents);if(o.length>1)throw Error("The embedContent API for this model only supports one content at a time.");let i=Object.assign(Object.assign({},r),{content:o[0],embeddingApiType:pl.EMBED_CONTENT});return await this.embedContentInternal(i)}else{let o=Object.assign(Object.assign({},r),{embeddingApiType:pl.PREDICT});return await this.embedContentInternal(o)}},this.generateContent=async(r)=>{var n,o,i,s,l;let a=await this.processParamsMaybeAddMcpUsage(r);if(this.maybeMoveToResponseJsonSchema(r),!HG(r)||cg(r.config))return await this.generateContentInternal(a);let c=ug(r);if(c.length>0){let _=c.map((y)=>`tools[${y}]`).join(", ");throw Error(`Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations is not yet supported. Incompatible tools found at ${_}.`)}let u,f,h=mr(a.contents),g=(i=(o=(n=a.config)===null||n===void 0?void 0:n.automaticFunctionCalling)===null||o===void 0?void 0:o.maximumRemoteCalls)!==null&&i!==void 0?i:lg,p=0;while(p<g){if(u=await this.generateContentInternal(a),!u.functionCalls||u.functionCalls.length===0)break;let _=u.candidates[0].content,y=[];for(let S of(l=(s=r.config)===null||s===void 0?void 0:s.tools)!==null&&l!==void 0?l:[])if(Pi(S)){let b=await S.callTool(u.functionCalls);y.push(...b)}if(p++,f={role:"user",parts:y},a.contents=mr(a.contents),a.contents.push(_),a.contents.push(f),dg(a.config))h.push(_),h.push(f)}if(dg(a.config))u.automaticFunctionCallingHistory=h;return u},this.generateContentStream=async(r)=>{var n,o,i,s,l;if(this.maybeMoveToResponseJsonSchema(r),cg(r.config)){let f=await this.processParamsMaybeAddMcpUsage(r);return await this.generateContentStreamInternal(f)}let a=ug(r);if(a.length>0){let f=a.map((h)=>`tools[${h}]`).join(", ");throw Error(`Incompatible tools found at ${f}. Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations" is not yet supported.`)}let c=(i=(o=(n=r===null||r===void 0?void 0:r.config)===null||n===void 0?void 0:n.toolConfig)===null||o===void 0?void 0:o.functionCallingConfig)===null||i===void 0?void 0:i.streamFunctionCallArguments,u=(l=(s=r===null||r===void 0?void 0:r.config)===null||s===void 0?void 0:s.automaticFunctionCalling)===null||l===void 0?void 0:l.disable;if(c&&!u)throw Error("Running in streaming mode with 'streamFunctionCallArguments' enabled, this feature is not compatible with automatic function calling (AFC). Please set 'config.automaticFunctionCalling.disable' to true to disable AFC or leave 'config.toolConfig.functionCallingConfig.streamFunctionCallArguments' to be undefined or set to false to disable streaming function call arguments feature.");return await this.processAfcStream(r)},this.generateImages=async(r)=>{if(!e.loggedGenerateImagesWarning)e.loggedGenerateImagesWarning=!0,console.warn("The generateImages method is deprecated and will be removed in the next major release (not before Jan. 1 2027). Please use the generateContent method with image models instead. See https://ai.google.dev/gemini-api/docs/deprecations#imagen-models and https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/capabilities/image-generation#generate-images");return await this.generateImagesInternal(r).then((n)=>{var o;let i,s=[];if(n===null||n===void 0?void 0:n.generatedImages)for(let a of n.generatedImages)if(a&&(a===null||a===void 0?void 0:a.safetyAttributes)&&((o=a===null||a===void 0?void 0:a.safetyAttributes)===null||o===void 0?void 0:o.contentType)==="Positive Prompt")i=a===null||a===void 0?void 0:a.safetyAttributes;else s.push(a);let l;if(i)l={generatedImages:s,positivePromptSafetyAttributes:i,sdkHttpResponse:n.sdkHttpResponse};else l={generatedImages:s,sdkHttpResponse:n.sdkHttpResponse};return l})},this.list=async(r)=>{var n;let s={config:Object.assign(Object.assign({},{queryBase:!0}),r===null||r===void 0?void 0:r.config)};if(this.apiClient.isVertexAI()){if(!s.config.queryBase)if((n=s.config)===null||n===void 0?void 0:n.filter)throw Error("Filtering tuned models list is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");else s.config.filter="labels.tune-type:*"}return new Wo(xn.PAGED_ITEM_MODELS,(l)=>this.listInternal(l),await this.listInternal(s),s)},this.editImage=async(r)=>{if(!e.loggedEditImageWarning)e.loggedEditImageWarning=!0,console.warn("The editImage method is deprecated and will be removed in the next major release (not before Jan. 1 2027). Please use the generateContent method with image models instead. See https://ai.google.dev/gemini-api/docs/deprecations#imagen-models and https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/capabilities/gemini-edit-images#edit-an-image");let n={model:r.model,prompt:r.prompt,referenceImages:[],config:r.config};if(r.referenceImages){if(r.referenceImages)n.referenceImages=r.referenceImages.map((o)=>o.toReferenceImageAPI())}return await this.editImageInternal(n)},this.upscaleImage=async(r)=>{let n={numberOfImages:1,mode:"upscale"};if(r.config)n=Object.assign(Object.assign({},n),r.config);let o={model:r.model,image:r.image,upscaleFactor:r.upscaleFactor,config:n};return await this.upscaleImageInternal(o)},this.generateVideos=async(r)=>{var n,o,i,s,l,a;if((r.prompt||r.image||r.video)&&r.source)throw Error("Source and prompt/image/video are mutually exclusive. Please only use source.");if(r.prompt||r.image||r.video){if(!e.loggedGenerateVideosWarning)e.loggedGenerateVideosWarning=!0,console.warn("The generateVideos method with prompt/image/video arguments is deprecated and will be removed in a future major release (not before 2026-07-31). Please use the source argument instead.")}if(!this.apiClient.isVertexAI()){if(((n=r.video)===null||n===void 0?void 0:n.uri)&&((o=r.video)===null||o===void 0?void 0:o.videoBytes))r.video={uri:r.video.uri,mimeType:r.video.mimeType};else if(((s=(i=r.source)===null||i===void 0?void 0:i.video)===null||s===void 0?void 0:s.uri)&&((a=(l=r.source)===null||l===void 0?void 0:l.video)===null||a===void 0?void 0:a.videoBytes))r.source.video={uri:r.source.video.uri,mimeType:r.source.video.mimeType}}return await this.generateVideosInternal(r)}}maybeMoveToResponseJsonSchema(t){if(t.config&&t.config.responseSchema){if(!t.config.responseJsonSchema){if(Object.keys(t.config.responseSchema).includes("$schema"))t.config.responseJsonSchema=t.config.responseSchema,delete t.config.responseSchema}}return}async processParamsMaybeAddMcpUsage(t){var r,n,o;let i=(r=t.config)===null||r===void 0?void 0:r.tools;if(!i)return t;let s=await Promise.all(i.map(async(a)=>{if(Pi(a))return await a.tool();return a})),l={model:t.model,contents:t.contents,config:Object.assign(Object.assign({},t.config),{tools:s})};if(l.config.tools=s,t.config&&t.config.tools&&sb(t.config.tools)){let a=(o=(n=t.config.httpOptions)===null||n===void 0?void 0:n.headers)!==null&&o!==void 0?o:{},c=Object.assign({},a);if(Object.keys(c).length===0)c=this.apiClient.getDefaultHeaders();ab(c),l.config.httpOptions=Object.assign(Object.assign({},t.config.httpOptions),{headers:c})}return l}async initAfcToolsMap(t){var r,n,o;let i=new Map;for(let s of(n=(r=t.config)===null||r===void 0?void 0:r.tools)!==null&&n!==void 0?n:[])if(Pi(s)){let l=s,a=await l.tool();for(let c of(o=a.functionDeclarations)!==null&&o!==void 0?o:[]){if(!c.name)throw Error("Function declaration name is required.");if(i.has(c.name))throw Error(`Duplicate tool declaration name: ${c.name}`);i.set(c.name,l)}}return i}async processAfcStream(t){var r,n,o;let i=(o=(n=(r=t.config)===null||r===void 0?void 0:r.automaticFunctionCalling)===null||n===void 0?void 0:n.maximumRemoteCalls)!==null&&o!==void 0?o:lg,s=!1,l=0,a=await this.initAfcToolsMap(t);return function(c,u,f){return Ii(this,arguments,function*(){var h,g,p,_,y,S;while(l<i){if(s)l++,s=!1;let w=yield kt(c.processParamsMaybeAddMcpUsage(f)),T=yield kt(c.generateContentStreamInternal(w)),C=[],A=[];try{for(var E=!0,b=(g=void 0,ks(T)),R;R=yield kt(b.next()),h=R.done,!h;E=!0){_=R.value,E=!1;let P=_;if(yield yield kt(P),P.candidates&&((y=P.candidates[0])===null||y===void 0?void 0:y.content)){A.push(P.candidates[0].content);for(let D of(S=P.candidates[0].content.parts)!==null&&S!==void 0?S:[])if(l<i&&D.functionCall){if(!D.functionCall.name)throw Error("Function call name was not returned by the model.");if(!u.has(D.functionCall.name))throw Error(`Automatic function calling was requested, but not all the tools the model used implement the CallableTool interface. Available tools: ${u.keys()}, missing tool: ${D.functionCall.name}`);else{let N=yield kt(u.get(D.functionCall.name).callTool([D.functionCall]));C.push(...N)}}}}}catch(P){g={error:P}}finally{try{if(!E&&!h&&(p=b.return))yield kt(p.call(b))}finally{if(g)throw g.error}}if(C.length>0){s=!0;let P=new vs;P.candidates=[{content:{role:"user",parts:C}}],yield yield kt(P);let D=[];D.push(...A),D.push({role:"user",parts:C});let N=mr(f.contents).concat(D);f.contents=N}else break}})}(this,a,t)}async generateContentInternal(t){var r,n,o,i;let s,l="",a={};if(this.apiClient.isVertexAI()){let c=ig(this.apiClient,t);return l=Ae("{model}:generateContent",c._url),a=c._query,delete c._url,delete c._query,s=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(n=t.config)===null||n===void 0?void 0:n.abortSignal}).then((u)=>u.json().then((f)=>{let h=f;return h.sdkHttpResponse={headers:u.headers},h})),s.then((u)=>{let f=ag(u),h=new vs;return Object.assign(h,f),h})}else{let c=og(this.apiClient,t);return l=Ae("{model}:generateContent",c._url),a=c._query,delete c._url,delete c._query,s=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then((u)=>u.json().then((f)=>{let h=f;return h.sdkHttpResponse={headers:u.headers},h})),s.then((u)=>{let f=sg(u),h=new vs;return Object.assign(h,f),h})}}async generateContentStreamInternal(t){var r,n,o,i;let s,l="",a={};if(this.apiClient.isVertexAI()){let c=ig(this.apiClient,t);return l=Ae("{model}:streamGenerateContent?alt=sse",c._url),a=c._query,delete c._url,delete c._query,s=this.apiClient.requestStream({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(n=t.config)===null||n===void 0?void 0:n.abortSignal}),s.then(function(f){return Ii(this,arguments,function*(){var h,g,p,_;try{for(var y=!0,S=ks(f),E;E=yield kt(S.next()),h=E.done,!h;y=!0){_=E.value,y=!1;let b=_,R=ag(yield kt(b.json()),t);R.sdkHttpResponse={headers:b.headers};let w=new vs;Object.assign(w,R),yield yield kt(w)}}catch(b){g={error:b}}finally{try{if(!y&&!h&&(p=S.return))yield kt(p.call(S))}finally{if(g)throw g.error}}})})}else{let c=og(this.apiClient,t);return l=Ae("{model}:streamGenerateContent?alt=sse",c._url),a=c._query,delete c._url,delete c._query,s=this.apiClient.requestStream({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}),s.then(function(f){return Ii(this,arguments,function*(){var h,g,p,_;try{for(var y=!0,S=ks(f),E;E=yield kt(S.next()),h=E.done,!h;y=!0){_=E.value,y=!1;let b=_,R=sg(yield kt(b.json()),t);R.sdkHttpResponse={headers:b.headers};let w=new vs;Object.assign(w,R),yield yield kt(w)}}catch(b){g={error:b}}finally{try{if(!y&&!h&&(p=S.return))yield kt(p.call(S))}finally{if(g)throw g.error}}})})}}async embedContentInternal(t){var r,n,o,i;let s,l="",a={};if(this.apiClient.isVertexAI()){let c=PU(this.apiClient,t,t),u=Fx(t.model)?"{model}:embedContent":"{model}:predict";return l=Ae(u,c._url),a=c._query,delete c._url,delete c._query,s=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(n=t.config)===null||n===void 0?void 0:n.abortSignal}).then((f)=>f.json().then((h)=>{let g=h;return g.sdkHttpResponse={headers:f.headers},g})),s.then((f)=>{let h=NU(f,t),g=new Gm;return Object.assign(g,h),g})}else{let c=IU(this.apiClient,t);return l=Ae("{model}:batchEmbedContents",c._url),a=c._query,delete c._url,delete c._query,s=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then((u)=>u.json().then((f)=>{let h=f;return h.sdkHttpResponse={headers:u.headers},h})),s.then((u)=>{let f=kU(u),h=new Gm;return Object.assign(h,f),h})}}async generateImagesInternal(t){var r,n;let o,i="",s={};if(this.apiClient.isVertexAI()){let l=qU(this.apiClient,t);return i=Ae("{model}:predict",l._url),s=l._query,delete l._url,delete l._query,o=this.apiClient.request({path:i,queryParams:s,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(n=t.config)===null||n===void 0?void 0:n.abortSignal}).then((a)=>a.json().then((c)=>{let u=c;return u.sdkHttpResponse={headers:a.headers},u})),o.then((a)=>{let c=UU(a),u=new mx;return Object.assign(u,c),u})}else throw Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async editImageInternal(t){var r,n;let o,i="",s={};if(this.apiClient.isVertexAI()){let l=TU(this.apiClient,t);return i=Ae("{model}:predict",l._url),s=l._query,delete l._url,delete l._query,o=this.apiClient.request({path:i,queryParams:s,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(n=t.config)===null||n===void 0?void 0:n.abortSignal}).then((a)=>a.json().then((c)=>{let u=c;return u.sdkHttpResponse={headers:a.headers},u})),o.then((a)=>{let c=CU(a),u=new gx;return Object.assign(u,c),u})}else throw Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async upscaleImageInternal(t){var r,n;let o,i="",s={};if(this.apiClient.isVertexAI()){let l=GF(this.apiClient,t);return i=Ae("{model}:predict",l._url),s=l._query,delete l._url,delete l._query,o=this.apiClient.request({path:i,queryParams:s,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(n=t.config)===null||n===void 0?void 0:n.abortSignal}).then((a)=>a.json().then((c)=>{let u=c;return u.sdkHttpResponse={headers:a.headers},u})),o.then((a)=>{let c=BF(a),u=new vx;return Object.assign(u,c),u})}else throw Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async recontextImage(t){var r,n;let o,i="",s={};if(this.apiClient.isVertexAI()){let l=yF(this.apiClient,t);return i=Ae("{model}:predict",l._url),s=l._query,delete l._url,delete l._query,o=this.apiClient.request({path:i,queryParams:s,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(n=t.config)===null||n===void 0?void 0:n.abortSignal}).then((a)=>a.json()),o.then((a)=>{let c=SF(a),u=new _x;return Object.assign(u,c),u})}else throw Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async segmentImage(t){var r,n;let o,i="",s={};if(this.apiClient.isVertexAI()){let l=AF(this.apiClient,t);return i=Ae("{model}:predict",l._url),s=l._query,delete l._url,delete l._query,o=this.apiClient.request({path:i,queryParams:s,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(n=t.config)===null||n===void 0?void 0:n.abortSignal}).then((a)=>a.json()),o.then((a)=>{let c=IF(a),u=new yx;return Object.assign(u,c),u})}else throw Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async get(t){var r,n,o,i;let s,l="",a={};if(this.apiClient.isVertexAI()){let c=tF(this.apiClient,t);return l=Ae("{name}",c._url),a=c._query,delete c._url,delete c._query,s=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(n=t.config)===null||n===void 0?void 0:n.abortSignal}).then((u)=>u.json()),s.then((u)=>_u(u))}else{let c=eF(this.apiClient,t);return l=Ae("{name}",c._url),a=c._query,delete c._url,delete c._query,s=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then((u)=>u.json()),s.then((u)=>vu(u))}}async listInternal(t){var r,n,o,i;let s,l="",a={};if(this.apiClient.isVertexAI()){let c=cF(this.apiClient,t);return l=Ae("{models_url}",c._url),a=c._query,delete c._url,delete c._query,s=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(n=t.config)===null||n===void 0?void 0:n.abortSignal}).then((u)=>u.json().then((f)=>{let h=f;return h.sdkHttpResponse={headers:u.headers},h})),s.then((u)=>{let f=dF(u),h=new Bm;return Object.assign(h,f),h})}else{let c=lF(this.apiClient,t);return l=Ae("{models_url}",c._url),a=c._query,delete c._url,delete c._query,s=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then((u)=>u.json().then((f)=>{let h=f;return h.sdkHttpResponse={headers:u.headers},h})),s.then((u)=>{let f=uF(u),h=new Bm;return Object.assign(h,f),h})}}async update(t){var r,n,o,i;let s,l="",a={};if(this.apiClient.isVertexAI()){let c=UF(this.apiClient,t);return l=Ae("{model}",c._url),a=c._query,delete c._url,delete c._query,s=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"PATCH",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(n=t.config)===null||n===void 0?void 0:n.abortSignal}).then((u)=>u.json()),s.then((u)=>_u(u))}else{let c=qF(this.apiClient,t);return l=Ae("{name}",c._url),a=c._query,delete c._url,delete c._query,s=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"PATCH",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then((u)=>u.json()),s.then((u)=>vu(u))}}async delete(t){var r,n,o,i;let s,l="",a={};if(this.apiClient.isVertexAI()){let c=SU(this.apiClient,t);return l=Ae("{name}",c._url),a=c._query,delete c._url,delete c._query,s=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"DELETE",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(n=t.config)===null||n===void 0?void 0:n.abortSignal}).then((u)=>u.json().then((f)=>{let h=f;return h.sdkHttpResponse={headers:u.headers},h})),s.then((u)=>{let f=bU(u),h=new Hm;return Object.assign(h,f),h})}else{let c=yU(this.apiClient,t);return l=Ae("{name}",c._url),a=c._query,delete c._url,delete c._query,s=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"DELETE",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then((u)=>u.json().then((f)=>{let h=f;return h.sdkHttpResponse={headers:u.headers},h})),s.then((u)=>{let f=EU(u),h=new Hm;return Object.assign(h,f),h})}}async countTokens(t){var r,n,o,i;let s,l="",a={};if(this.apiClient.isVertexAI()){let c=gU(this.apiClient,t);return l=Ae("{model}:countTokens",c._url),a=c._query,delete c._url,delete c._query,s=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(n=t.config)===null||n===void 0?void 0:n.abortSignal}).then((u)=>u.json().then((f)=>{let h=f;return h.sdkHttpResponse={headers:u.headers},h})),s.then((u)=>{let f=_U(u),h=new zm;return Object.assign(h,f),h})}else{let c=mU(this.apiClient,t);return l=Ae("{model}:countTokens",c._url),a=c._query,delete c._url,delete c._query,s=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then((u)=>u.json().then((f)=>{let h=f;return h.sdkHttpResponse={headers:u.headers},h})),s.then((u)=>{let f=vU(u),h=new zm;return Object.assign(h,f),h})}}async computeTokens(t){var r,n;let o,i="",s={};if(this.apiClient.isVertexAI()){let l=aU(this.apiClient,t);return i=Ae("{model}:computeTokens",l._url),s=l._query,delete l._url,delete l._query,o=this.apiClient.request({path:i,queryParams:s,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(n=t.config)===null||n===void 0?void 0:n.abortSignal}).then((a)=>a.json().then((c)=>{let u=c;return u.sdkHttpResponse={headers:a.headers},u})),o.then((a)=>{let c=lU(a),u=new Sx;return Object.assign(u,c),u})}else throw Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async generateVideosInternal(t){var r,n,o,i;let s,l="",a={};if(this.apiClient.isVertexAI()){let c=VU(this.apiClient,t);return l=Ae("{model}:predictLongRunning",c._url),a=c._query,delete c._url,delete c._query,s=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(n=t.config)===null||n===void 0?void 0:n.abortSignal}).then((u)=>u.json()),s.then((u)=>{let f=HU(u),h=new Vm;return Object.assign(h,f),h})}else{let c=zU(this.apiClient,t);return l=Ae("{model}:predictLongRunning",c._url),a=c._query,delete c._url,delete c._query,s=this.apiClient.request({path:l,queryParams:a,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(i=t.config)===null||i===void 0?void 0:i.abortSignal}).then((u)=>u.json()),s.then((u)=>{let f=BU(u),h=new Vm;return Object.assign(h,f),h})}}};ec.loggedGenerateImagesWarning=!1;ec.loggedEditImageWarning=!1;ec.loggedGenerateVideosWarning=!1;var zG=class extends Un{constructor(e){super();this.apiClient=e}async getVideosOperation(e){let{operation:t,config:r}=e;if(t.name===void 0||t.name==="")throw Error("Operation name is required.");if(this.apiClient.isVertexAI()){let n=t.name.split("/operations/")[0],o=void 0;if(r&&"httpOptions"in r)o=r.httpOptions;let i=await this.fetchPredictVideosOperationInternal({operationName:t.name,resourceName:n,config:{httpOptions:o}});return t._fromAPIResponse({apiResponse:i,_isVertexAI:!0})}else{let n=await this.getVideosOperationInternal({operationName:t.name,config:r});return t._fromAPIResponse({apiResponse:n,_isVertexAI:!1})}}async get(e){let{operation:t,config:r}=e;if(t.name===void 0||t.name==="")throw Error("Operation name is required.");if(this.apiClient.isVertexAI()){let n=t.name.split("/operations/")[0],o=void 0;if(r&&"httpOptions"in r)o=r.httpOptions;let i=await this.fetchPredictVideosOperationInternal({operationName:t.name,resourceName:n,config:{httpOptions:o}});return t._fromAPIResponse({apiResponse:i,_isVertexAI:!0})}else{let n=await this.getVideosOperationInternal({operationName:t.name,config:r});return t._fromAPIResponse({apiResponse:n,_isVertexAI:!1})}}async getVideosOperationInternal(e){var t,r,n,o;let i,s="",l={};if(this.apiClient.isVertexAI()){let a=cx(e);return s=Ae("{operationName}",a._url),l=a._query,delete a._url,delete a._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(a),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then((c)=>c.json()),i}else{let a=lx(e);return s=Ae("{operationName}",a._url),l=a._query,delete a._url,delete a._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(a),httpMethod:"GET",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then((c)=>c.json()),i}}async fetchPredictVideosOperationInternal(e){var t,r;let n,o="",i={};if(this.apiClient.isVertexAI()){let s=tx(e);return o=Ae("{resourceName}:fetchPredictOperation",s._url),i=s._query,delete s._url,delete s._query,n=this.apiClient.request({path:o,queryParams:i,body:JSON.stringify(s),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then((l)=>l.json()),n}else throw Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}};function VG(e){let t={},r=d(e,["apiKey"]);if(r!=null)m(t,["apiKey"],r);if(d(e,["apiKeyConfig"])!==void 0)throw Error("apiKeyConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["authType"])!==void 0)throw Error("authType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["googleServiceAccountConfig"])!==void 0)throw Error("googleServiceAccountConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["httpBasicAuthConfig"])!==void 0)throw Error("httpBasicAuthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["oauthConfig"])!==void 0)throw Error("oauthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["oidcConfig"])!==void 0)throw Error("oidcConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}function jG(e){let t={},r=d(e,["parts"]);if(r!=null){let o=r;if(Array.isArray(o))o=o.map((i)=>eB(i));m(t,["parts"],o)}let n=d(e,["role"]);if(n!=null)m(t,["role"],n);return t}function WG(e,t,r){let n={},o=d(t,["expireTime"]);if(r!==void 0&&o!=null)m(r,["expireTime"],o);let i=d(t,["newSessionExpireTime"]);if(r!==void 0&&i!=null)m(r,["newSessionExpireTime"],i);let s=d(t,["uses"]);if(r!==void 0&&s!=null)m(r,["uses"],s);let l=d(t,["liveConnectConstraints"]);if(r!==void 0&&l!=null)m(r,["bidiGenerateContentSetup"],QG(e,l));let a=d(t,["lockAdditionalFields"]);if(r!==void 0&&a!=null)m(r,["fieldMask"],a);return n}function JG(e,t){let r={},n=d(t,["config"]);if(n!=null)m(r,["config"],WG(e,n,r));return r}function KG(e){let t={},r=d(e,["args"]);if(r!=null)m(t,["args"],r);let n=d(e,["id"]);if(n!=null)m(t,["id"],n);let o=d(e,["name"]);if(o!=null)m(t,["name"],o);if(d(e,["partialArgs"])!==void 0)throw Error("partialArgs parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["willContinue"])!==void 0)throw Error("willContinue parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}function XG(e){let t={},r=d(e,["authConfig"]);if(r!=null)m(t,["authConfig"],VG(r));let n=d(e,["enableWidget"]);if(n!=null)m(t,["enableWidget"],n);if(d(e,["groundingTypes"])!==void 0)throw Error("groundingTypes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}function YG(e){let t={};if(d(e,["blockingConfidence"])!==void 0)throw Error("blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["excludeDomains"])!==void 0)throw Error("excludeDomains parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let r=d(e,["searchTypes"]);if(r!=null)m(t,["searchTypes"],r);let n=d(e,["timeRangeFilter"]);if(n!=null)m(t,["timeRangeFilter"],n);return t}function ZG(e,t){let r={},n=d(e,["generationConfig"]);if(t!==void 0&&n!=null)m(t,["setup","generationConfig"],n);let o=d(e,["responseModalities"]);if(t!==void 0&&o!=null)m(t,["setup","generationConfig","responseModalities"],o);let i=d(e,["temperature"]);if(t!==void 0&&i!=null)m(t,["setup","generationConfig","temperature"],i);let s=d(e,["topP"]);if(t!==void 0&&s!=null)m(t,["setup","generationConfig","topP"],s);let l=d(e,["topK"]);if(t!==void 0&&l!=null)m(t,["setup","generationConfig","topK"],l);let a=d(e,["maxOutputTokens"]);if(t!==void 0&&a!=null)m(t,["setup","generationConfig","maxOutputTokens"],a);let c=d(e,["mediaResolution"]);if(t!==void 0&&c!=null)m(t,["setup","generationConfig","mediaResolution"],c);let u=d(e,["seed"]);if(t!==void 0&&u!=null)m(t,["setup","generationConfig","seed"],u);let f=d(e,["speechConfig"]);if(t!==void 0&&f!=null)m(t,["setup","generationConfig","speechConfig"],Qd(f));let h=d(e,["thinkingConfig"]);if(t!==void 0&&h!=null)m(t,["setup","generationConfig","thinkingConfig"],h);let g=d(e,["enableAffectiveDialog"]);if(t!==void 0&&g!=null)m(t,["setup","generationConfig","enableAffectiveDialog"],g);let p=d(e,["systemInstruction"]);if(t!==void 0&&p!=null)m(t,["setup","systemInstruction"],jG(Wt(p)));let _=d(e,["tools"]);if(t!==void 0&&_!=null){let P=Zi(_);if(Array.isArray(P))P=P.map((D)=>nB(Yi(D)));m(t,["setup","tools"],P)}let y=d(e,["sessionResumption"]);if(t!==void 0&&y!=null)m(t,["setup","sessionResumption"],rB(y));let S=d(e,["inputAudioTranscription"]);if(t!==void 0&&S!=null)m(t,["setup","inputAudioTranscription"],S);let E=d(e,["outputAudioTranscription"]);if(t!==void 0&&E!=null)m(t,["setup","outputAudioTranscription"],E);let b=d(e,["realtimeInputConfig"]);if(t!==void 0&&b!=null)m(t,["setup","realtimeInputConfig"],b);let R=d(e,["contextWindowCompression"]);if(t!==void 0&&R!=null)m(t,["setup","contextWindowCompression"],R);let w=d(e,["proactivity"]);if(t!==void 0&&w!=null)m(t,["setup","proactivity"],w);if(d(e,["explicitVadSignal"])!==void 0)throw Error("explicitVadSignal parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let T=d(e,["avatarConfig"]);if(t!==void 0&&T!=null)m(t,["setup","avatarConfig"],T);let C=d(e,["safetySettings"]);if(t!==void 0&&C!=null){let P=C;if(Array.isArray(P))P=P.map((D)=>tB(D));m(t,["setup","safetySettings"],P)}let A=d(e,["translationConfig"]);if(t!==void 0&&A!=null)m(t,["setup","generationConfig","translationConfig"],A);return r}function QG(e,t){let r={},n=d(t,["model"]);if(n!=null)m(r,["setup","model"],yt(e,n));let o=d(t,["config"]);if(o!=null)m(r,["config"],ZG(o,r));return r}function eB(e){let t={},r=d(e,["mediaResolution"]);if(r!=null)m(t,["mediaResolution"],r);let n=d(e,["toolCall"]);if(n!=null)m(t,["toolCall"],n);let o=d(e,["toolResponse"]);if(o!=null)m(t,["toolResponse"],o);let i=d(e,["audioTranscription"]);if(i!=null)m(t,["audioTranscription"],i);let s=d(e,["codeExecutionResult"]);if(s!=null)m(t,["codeExecutionResult"],s);let l=d(e,["executableCode"]);if(l!=null)m(t,["executableCode"],l);let a=d(e,["fileData"]);if(a!=null)m(t,["fileData"],a);let c=d(e,["functionCall"]);if(c!=null)m(t,["functionCall"],KG(c));let u=d(e,["functionResponse"]);if(u!=null)m(t,["functionResponse"],u);let f=d(e,["inlineData"]);if(f!=null)m(t,["inlineData"],f);let h=d(e,["text"]);if(h!=null)m(t,["text"],h);let g=d(e,["thought"]);if(g!=null)m(t,["thought"],g);let p=d(e,["thoughtSignature"]);if(p!=null)m(t,["thoughtSignature"],p);let _=d(e,["videoMetadata"]);if(_!=null)m(t,["videoMetadata"],_);let y=d(e,["partMetadata"]);if(y!=null)m(t,["partMetadata"],y);let S=d(e,["mediaProcessing"]);if(S!=null)m(t,["mediaProcessing"],S);let E=d(e,["speechMetadata"]);if(E!=null)m(t,["speechMetadata"],E);return t}function tB(e){let t={},r=d(e,["category"]);if(r!=null)m(t,["category"],r);if(d(e,["method"])!==void 0)throw Error("method parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let n=d(e,["threshold"]);if(n!=null)m(t,["threshold"],n);return t}function rB(e){let t={},r=d(e,["handle"]);if(r!=null)m(t,["handle"],r);if(d(e,["transparent"])!==void 0)throw Error("transparent parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return t}function nB(e){let t={};if(d(e,["retrieval"])!==void 0)throw Error("retrieval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let r=d(e,["googleMaps"]);if(r!=null)m(t,["googleMaps"],XG(r));let n=d(e,["mcpServers"]);if(n!=null){let f=n;if(Array.isArray(f))f=f.map((h)=>h);m(t,["mcpServers"],f)}let o=d(e,["codeExecution"]);if(o!=null)m(t,["codeExecution"],o);let i=d(e,["computerUse"]);if(i!=null)m(t,["computerUse"],i);if(d(e,["enterpriseWebSearch"])!==void 0)throw Error("enterpriseWebSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["exaAiSearch"])!==void 0)throw Error("exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let s=d(e,["functionDeclarations"]);if(s!=null){let f=s;if(Array.isArray(f))f=f.map((h)=>h);m(t,["functionDeclarations"],f)}let l=d(e,["googleSearch"]);if(l!=null)m(t,["googleSearch"],YG(l));let a=d(e,["googleSearchRetrieval"]);if(a!=null)m(t,["googleSearchRetrieval"],a);if(d(e,["parallelAiSearch"])!==void 0)throw Error("parallelAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let c=d(e,["urlContext"]);if(c!=null)m(t,["urlContext"],c);let u=d(e,["fileSearch"]);if(u!=null)m(t,["fileSearch"],u);return t}function oB(e){let t=[];for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)){let n=e[r];if(typeof n==="object"&&n!=null&&Object.keys(n).length>0){let o=Object.keys(n).map((i)=>`${r}.${i}`);t.push(...o)}else t.push(r)}return t.join(",")}function iB(e,t){let r=null,n=e.bidiGenerateContentSetup;if(typeof n==="object"&&n!==null&&"setup"in n){let i=n.setup;if(typeof i==="object"&&i!==null)e.bidiGenerateContentSetup=i,r=i;else delete e.bidiGenerateContentSetup}else if(n!==void 0)delete e.bidiGenerateContentSetup;let o=e.fieldMask;if(r){let i=oB(r);if(Array.isArray(t===null||t===void 0?void 0:t.lockAdditionalFields)&&(t===null||t===void 0?void 0:t.lockAdditionalFields.length)===0)if(i)e.fieldMask=i;else delete e.fieldMask;else if((t===null||t===void 0?void 0:t.lockAdditionalFields)&&t.lockAdditionalFields.length>0&&o!==null&&Array.isArray(o)&&o.length>0){let s=["temperature","topK","topP","maxOutputTokens","responseModalities","seed","speechConfig"],l=[];if(o.length>0)l=o.map((c)=>{if(s.includes(c))return`generationConfig.${c}`;return c});let a=[];if(i)a.push(i);if(l.length>0)a.push(...l);if(a.length>0)e.fieldMask=a.join(",");else delete e.fieldMask}else delete e.fieldMask}else if(o!==null&&Array.isArray(o)&&o.length>0)e.fieldMask=o.join(",");else delete e.fieldMask;return e}var sB=class extends Un{constructor(e){super();this.apiClient=e}async create(e){var t,r;let n,o="",i={};if(this.apiClient.isVertexAI())throw Error("The client.tokens.create method is only supported by the Gemini Developer API.");else{let s=JG(this.apiClient,e);o=Ae("auth_tokens",s._url),i=s._query,delete s.config,delete s._url,delete s._query;let l=iB(s,e.config);return n=this.apiClient.request({path:o,queryParams:i,body:JSON.stringify(l),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then((a)=>a.json()),n.then((a)=>a)}}};function aB(e,t){let r={},n=d(e,["force"]);if(t!==void 0&&n!=null)m(t,["_query","force"],n);return r}function lB(e){let t={},r=d(e,["name"]);if(r!=null)m(t,["_url","name"],r);let n=d(e,["config"]);if(n!=null)aB(n,t);return t}function cB(e){let t={},r=d(e,["name"]);if(r!=null)m(t,["_url","name"],r);return t}function uB(e,t){let r={},n=d(e,["pageSize"]);if(t!==void 0&&n!=null)m(t,["_query","pageSize"],n);let o=d(e,["pageToken"]);if(t!==void 0&&o!=null)m(t,["_query","pageToken"],o);return r}function dB(e){let t={},r=d(e,["parent"]);if(r!=null)m(t,["_url","parent"],r);let n=d(e,["config"]);if(n!=null)uB(n,t);return t}function fB(e){let t={},r=d(e,["sdkHttpResponse"]);if(r!=null)m(t,["sdkHttpResponse"],r);let n=d(e,["nextPageToken"]);if(n!=null)m(t,["nextPageToken"],n);let o=d(e,["documents"]);if(o!=null){let i=o;if(Array.isArray(i))i=i.map((s)=>s);m(t,["documents"],i)}return t}var pB=class extends Un{constructor(e){super();this.apiClient=e,this.list=async(t)=>new Wo(xn.PAGED_ITEM_DOCUMENTS,(r)=>this.listInternal({parent:t.parent,config:r.config}),await this.listInternal(t),t)}async get(e){var t,r;let n,o="",i={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");else{let s=cB(e);return o=Ae("{name}",s._url),i=s._query,delete s._url,delete s._query,n=this.apiClient.request({path:o,queryParams:i,body:JSON.stringify(s),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then((l)=>l.json()),n.then((l)=>l)}}async delete(e){var t,r;let n="",o={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");else{let i=lB(e);n=Ae("{name}",i._url),o=i._query,delete i._url,delete i._query,await this.apiClient.request({path:n,queryParams:o,body:JSON.stringify(i),httpMethod:"DELETE",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal})}}async listInternal(e){var t,r;let n,o="",i={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");else{let s=dB(e);return o=Ae("{parent}/documents",s._url),i=s._query,delete s._url,delete s._query,n=this.apiClient.request({path:o,queryParams:i,body:JSON.stringify(s),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then((l)=>l.json()),n.then((l)=>{let a=fB(l),c=new wx;return Object.assign(c,a),c})}}},hB=class extends Un{constructor(e,t=new pB(e)){super();this.apiClient=e,this.documents=t,this.list=async(r={})=>new Wo(xn.PAGED_ITEM_FILE_SEARCH_STORES,(n)=>this.listInternal(n),await this.listInternal(r),r)}async uploadToFileSearchStore(e){if(this.apiClient.isVertexAI())throw Error("Gemini Enterprise Agent Platform (previously known as Vertex AI) does not support uploading files to a file search store.");return this.apiClient.uploadFileToFileSearchStore(e.fileSearchStoreName,e.file,e.config)}async downloadMedia(e,t){if(this.apiClient.isVertexAI())throw Error("This method is only supported in the Gemini Developer client.");let r=new URL(e,"http://dummy.com"),n=r.pathname;if(n.startsWith("/"))n=n.slice(1);if(!n.includes("/media/"))throw Error(`Invalid uri format: ${e}. Expected to contain /media/`);let o={};r.searchParams.forEach((l,a)=>{o[a]=l}),o.alt="media";let i=Object.assign({},t===null||t===void 0?void 0:t.httpOptions),s=await this.apiClient.request({path:n,httpMethod:"GET",queryParams:o,httpOptions:i});if(s instanceof Li){let l=await s.responseInternal.arrayBuffer();return new Uint8Array(l)}else throw Error("Unexpected response type from downloadMedia")}async create(e){var t,r;let n,o="",i={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");else{let s=KF(this.apiClient,e);return o=Ae("fileSearchStores",s._url),i=s._query,delete s._url,delete s._query,n=this.apiClient.request({path:o,queryParams:i,body:JSON.stringify(s),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then((l)=>l.json()),n.then((l)=>l)}}async get(e){var t,r;let n,o="",i={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");else{let s=ZF(e);return o=Ae("{name}",s._url),i=s._query,delete s._url,delete s._query,n=this.apiClient.request({path:o,queryParams:i,body:JSON.stringify(s),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then((l)=>l.json()),n.then((l)=>l)}}async delete(e){var t,r;let n="",o={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");else{let i=YF(e);n=Ae("{name}",i._url),o=i._query,delete i._url,delete i._query,await this.apiClient.request({path:n,queryParams:o,body:JSON.stringify(i),httpMethod:"DELETE",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal})}}async listInternal(e){var t,r;let n,o="",i={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");else{let s=oG(e);return o=Ae("fileSearchStores",s._url),i=s._query,delete s._url,delete s._query,n=this.apiClient.request({path:o,queryParams:i,body:JSON.stringify(s),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then((l)=>l.json()),n.then((l)=>{let a=iG(l),c=new Tx;return Object.assign(c,a),c})}}async uploadToFileSearchStoreInternal(e){var t,r;let n,o="",i={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");else{let s=sG(e);return o=Ae("upload/v1beta/{file_search_store_name}:uploadToFileSearchStore",s._url),i=s._query,delete s._url,delete s._query,n=this.apiClient.request({path:o,queryParams:i,body:JSON.stringify(s),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then((l)=>l.json()),n.then((l)=>{let a=aG(l),c=new Cx;return Object.assign(c,a),c})}}async importFile(e){var t,r;let n,o="",i={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");else{let s=tG(e);return o=Ae("{file_search_store_name}:importFile",s._url),i=s._query,delete s._url,delete s._query,n=this.apiClient.request({path:o,queryParams:i,body:JSON.stringify(s),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then((l)=>l.json()),n.then((l)=>{let a=eG(l),c=new Rx;return Object.assign(c,a),c})}}};function mB(){if("Deno"in globalThis)return!0;return!1}var Oa=void 0;function Us(){var e,t,r,n,o,i;if(Oa)return Oa;let s=globalThis,l={};if(mB())l=(n=(r=(t=(e=s.Deno)===null||e===void 0?void 0:e.env)===null||t===void 0?void 0:t.toObject)===null||r===void 0?void 0:r.call(t))!==null&&n!==void 0?n:{};else l=(i=(o=s.process)===null||o===void 0?void 0:o.env)!==null&&i!==void 0?i:{};return Oa=l,Oa}function gB(e){var t,r;let n=Object.assign({},e),o=Us();if(typeof o.GOOGLE_GENAI_API_VERSION<"u")(t=n.api_version)!==null&&t!==void 0||(n.api_version=o.GOOGLE_GENAI_API_VERSION);if(typeof o.GOOGLE_GENAI_USER_PROJECT<"u")(r=n.user_project)!==null&&r!==void 0||(n.user_project=o.GOOGLE_GENAI_USER_PROJECT);return n}var vB=class{constructor(e){this.options=e}getDefaultHeaders(){return this.options.defaultHeaders}async resolveGoogleGenAISecurity(e){return bB(await this.options.getAuthHeaders(e))}},_B=class{beforeCreateRequest(e,t){return Object.assign(Object.assign({},t),{url:yB(t.url)})}async beforeRequest(e,t){if(pg(t.headers,EB(e.security_source)),wB(e,t.headers),CB(t.headers))return t;let r=await SB(e.security_source,t.url);return pg(t.headers,r===null||r===void 0?void 0:r.default_headers),TB(t.headers,r),t}};function yB(e){let[,t,...r]=e.pathname.split("/");if(!t)return e;let n=decodeURIComponent(t);if(!n.includes("/"))return e;let o=new URL(e);return o.pathname=`/${n}/${r.join("/")}`,o}async function SB(e,t){if(cb(e))return e.resolveGoogleGenAISecurity(t);let r=typeof e==="function"?await e():e;if(lb(r))return fg(r);return fg(void 0)}function EB(e){var t,r;if(cb(e))return(r=(t=e.getDefaultHeaders)===null||t===void 0?void 0:t.call(e))!==null&&r!==void 0?r:e.defaultHeaders;if(lb(e))return e.default_headers;return}function fg(e){var t,r;let n=Us(),o=Object.assign(Object.assign({},e),{api_key:(t=e===null||e===void 0?void 0:e.api_key)!==null&&t!==void 0?t:n.GOOGLE_GENAI_API_KEY,access_token:(r=e===null||e===void 0?void 0:e.access_token)!==null&&r!==void 0?r:n.GOOGLE_GENAI_ACCESS_TOKEN});return ub(o)?o:void 0}function bB(e){var t,r;let n={};for(let[i,s]of e){let l=i.toLowerCase();if(l!=="authorization"&&l!=="x-goog-api-key")n[i]=s}let o={access_token:(t=e.get("authorization"))!==null&&t!==void 0?t:void 0,api_key:(r=e.get("x-goog-api-key"))!==null&&r!==void 0?r:void 0,default_headers:Object.keys(n).length?n:void 0};return ub(o)?o:void 0}function pg(e,t){if(!t)return;for(let[r,n]of new Headers(t))if(e.get(r)===null)e.set(r,n)}function wB(e,t){if(e.options.user_project!==void 0&&t.get("x-goog-user-project")===null)t.set("x-goog-user-project",e.options.user_project)}function TB(e,t){if(!t)return;if(t.api_key){e.set("x-goog-api-key",t.api_key);return}if(t.access_token)e.set("Authorization",RB(t.access_token))}function CB(e){return e.get("authorization")!==null||e.get("x-goog-api-key")!==null}function RB(e){return e.slice(0,7).toLowerCase()==="bearer "?e:`Bearer ${e}`}function lb(e){return typeof e==="object"&&e!==null}function cb(e){return typeof e==="object"&&e!==null&&"resolveGoogleGenAISecurity"in e&&typeof e.resolveGoogleGenAISecurity==="function"}function ub(e){return e.api_key!==void 0||e.access_token!==void 0||e.default_headers!==void 0}var ts=class extends Error{constructor(e,t){let r=e;if(t===null||t===void 0?void 0:t.cause)r+=`: ${t.cause}`;super(r,t);if(this.name="HTTPClientError",typeof this.cause>"u")this.cause=t===null||t===void 0?void 0:t.cause}},hg=class extends ts{constructor(){super(...arguments);this.name="UnexpectedClientError"}},Ma=class extends ts{constructor(){super(...arguments);this.name="InvalidRequestError"}},db=class extends ts{constructor(){super(...arguments);this.name="RequestAbortedError"}},fb=class extends ts{constructor(){super(...arguments);this.name="RequestTimeoutError"}},pb=class extends ts{constructor(){super(...arguments);this.name="ConnectionError"}},dn=class extends Error{constructor(e,t){var r,n,o,i;super(e);this.statusCode=(r=t===null||t===void 0?void 0:t.response)===null||r===void 0?void 0:r.status,this.body=(n=t===null||t===void 0?void 0:t.body)!==null&&n!==void 0?n:"",this.headers=(o=t===null||t===void 0?void 0:t.response)===null||o===void 0?void 0:o.headers,this.contentType=((i=t===null||t===void 0?void 0:t.response)===null||i===void 0?void 0:i.headers.get("content-type"))||"",this.rawResponse=t===null||t===void 0?void 0:t.response,this.name="GoogleGenAiError"}},AB=class extends Error{},$r=class e extends AB{constructor(t,r,n,o){super(e.makeMessage(t,r,n));this.status=t,this.headers=o,this.error=r,this.statusCode=t,this.body=gg(r),this.contentType=(o===null||o===void 0?void 0:o.get("content-type"))||"",this.rawResponse=void 0,this.cause=void 0,this.name=this.constructor.name,Object.setPrototypeOf(this,new.target.prototype)}static makeMessage(t,r,n){var o;let i=r&&GB(r)&&typeof r.message==="string"?r.message:void 0,s=gg(r),l=(o=i!==null&&i!==void 0?i:n)!==null&&o!==void 0?o:s||"An error occurred";return`${t?`${t} `:""}${l}`}static generate(t,r,n,o){if(!t||!o)return new ml({message:n,cause:r instanceof Error?r:void 0});if(t===400)return new kB(t,r,n,o);if(t===401)return new NB(t,r,n,o);if(t===403)return new OB(t,r,n,o);if(t===404)return new MB(t,r,n,o);if(t===409)return new DB(t,r,n,o);if(t===422)return new $B(t,r,n,o);if(t===429)return new xB(t,r,n,o);if(t>=500)return new LB(t,r,n,o);return new e(t,r,n,o)}},IB=class extends $r{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},ml=class extends $r{constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0);this.cause=t}},PB=class extends ml{constructor({message:e}={}){super({message:e||"Request timed out. This is a client-side timeout. You can increase the timeout by setting the `timeout` argument in your request or client http options."})}},kB=class extends $r{},NB=class extends $r{},OB=class extends $r{},MB=class extends $r{},DB=class extends $r{},$B=class extends $r{},xB=class extends $r{},LB=class extends $r{};function No(e){if(BB(e))return e;if(e instanceof dn)return qB(e);if(e instanceof ts)return UB(e);return e}function qB(e){let t=FB(e),r=$r.generate(e.statusCode,t,e.message,e.headers);return _s(r,"body",e.body),_s(r,"contentType",e.contentType),_s(r,"rawResponse",e.rawResponse),_s(r,"statusCode",e.statusCode),_s(r,"cause",e),r}function UB(e){if(e instanceof fb)return new PB({message:e.message});if(e instanceof db)return new IB({message:e.message});if(e instanceof pb)return new ml({message:e.message,cause:e});return new ml({message:e.message,cause:e})}function FB(e){let t=mg(e,"data$");if(t&&typeof t==="object")return t;try{let n=JSON.parse(e.body);if(n&&typeof n==="object")return n}catch(n){}let r=mg(e,"error");return r&&typeof r==="object"?r:void 0}function mg(e,t){return e&&typeof e==="object"?e[t]:void 0}function gg(e){if(!e)return"";try{return JSON.stringify(e)}catch(t){return String(e)}}function GB(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function BB(e){return typeof e==="object"&&e!==null?$r.prototype.isPrototypeOf(e):!1}function _s(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:r,writable:!1})}var HB=(e,t)=>{if(t==null)return fetch(e);else return fetch(e,t)},hb=class e{constructor(t={}){this.requestHooks=[],this.requestErrorHooks=[],this.responseHooks=[],this.options=t,this.fetcher=t.fetcher||HB}async request(t){let r=t;for(let n of this.requestHooks){let o=await n(r);if(o)r=o}try{let n=await this.fetcher(r);for(let o of this.responseHooks)await o(n,r);return n}catch(n){for(let o of this.requestErrorHooks)await o(n,r);throw n}}addHook(...t){if(t[0]==="beforeRequest")this.requestHooks.push(t[1]);else if(t[0]==="requestError")this.requestErrorHooks.push(t[1]);else if(t[0]==="response")this.responseHooks.push(t[1]);else throw Error(`Invalid hook type: ${t[0]}`);return this}removeHook(...t){let r;if(t[0]==="beforeRequest")r=this.requestHooks;else if(t[0]==="requestError")r=this.requestErrorHooks;else if(t[0]==="response")r=this.responseHooks;else throw Error(`Invalid hook type: ${t[0]}`);let n=r.findIndex((o)=>o===t[1]);if(n>=0)r.splice(n,1);return this}clone(){let t=new e(this.options);return t.requestHooks=this.requestHooks.slice(),t.requestErrorHooks=this.requestErrorHooks.slice(),t.responseHooks=this.responseHooks.slice(),t}},vg=/\s*;\s*/g;function yi(e,t){var r;if(t==="*")return!0;let n=((r=e.headers.get("content-type"))===null||r===void 0?void 0:r.trim())||"application/octet-stream";n=n.toLowerCase();let o=t.toLowerCase().trim().split(vg),[i="",...s]=o;if(i.split("/").length!==2)return!1;let l=n.split(vg),[a="",...c]=l,[u="",f=""]=a.split("/");if(!u||!f)return!1;if(i!=="*/*"&&a!==i&&`${u}/*`!==i&&`*/${f}`!==i)return!1;if(c.length<s.length)return!1;let h=new Set(c);for(let g of s)if(!h.has(g))return!1;return!0}var zB=new RegExp("^[0-9]xx$","i");function ot(e,t){let r=`${e.status}`,n=Array.isArray(t)?t:[t];if(!n.length)return!1;return n.some((o)=>{let i=`${o}`;if(i==="default")return!0;if(!zB.test(`${i}`))return i===r;let s=i.charAt(0);if(!s)throw Error("Invalid status code range");let l=r.charAt(0);if(!l)throw Error(`Invalid response status code: ${r}`);return l===s})}function VB(e,t,r){return ot(e,t)&&yi(e,r)}function mb(e){if(typeof e!=="object"||e==null)return!1;let t=e instanceof TypeError&&e.message.toLowerCase().startsWith("failed to fetch"),r=e instanceof TypeError&&e.message.toLowerCase().startsWith("fetch failed"),n="name"in e&&e.name==="ConnectionError",o="code"in e&&typeof e.code==="string"&&e.code.toLowerCase()==="econnreset";return t||r||o||n}function gb(e){if(typeof e!=="object"||e==null)return!1;let t="name"in e&&e.name==="TimeoutError",r="code"in e&&e.code===23,n="code"in e&&typeof e.code==="string"&&e.code.toLowerCase()==="econnaborted";return t||r||n}function jB(e){if(typeof e!=="object"||e==null)return!1;let t="name"in e&&e.name==="AbortError",r="code"in e&&e.code===20,n="code"in e&&typeof e.code==="string"&&e.code.toLowerCase()==="econnaborted";return t||r||n}function WB(e){let t=new _B;e.registerBeforeCreateRequestHook(t),e.registerBeforeRequestHook(t)}var _g=class{constructor(){this.sdkInitHooks=[],this.beforeCreateRequestHooks=[],this.beforeRequestHooks=[],this.afterSuccessHooks=[],this.afterErrorHooks=[];let e=[];for(let t of e){if("sdkInit"in t)this.registerSDKInitHook(t);if("beforeCreateRequest"in t)this.registerBeforeCreateRequestHook(t);if("beforeRequest"in t)this.registerBeforeRequestHook(t);if("afterSuccess"in t)this.registerAfterSuccessHook(t);if("afterError"in t)this.registerAfterErrorHook(t)}WB(this)}registerSDKInitHook(e){this.sdkInitHooks.push(e)}registerBeforeCreateRequestHook(e){this.beforeCreateRequestHooks.push(e)}registerBeforeRequestHook(e){this.beforeRequestHooks.push(e)}registerAfterSuccessHook(e){this.afterSuccessHooks.push(e)}registerAfterErrorHook(e){this.afterErrorHooks.push(e)}sdkInit(e){return this.sdkInitHooks.reduce((t,r)=>r.sdkInit(t),e)}beforeCreateRequest(e,t){let r=t;for(let n of this.beforeCreateRequestHooks)r=n.beforeCreateRequest(e,r);return r}async beforeRequest(e,t){let r=t;for(let n of this.beforeRequestHooks)r=await n.beforeRequest(e,r);return r}async afterSuccess(e,t){let r=t;for(let n of this.afterSuccessHooks)r=await n.afterSuccess(e,r);return r}async afterError(e,t,r){let n=t,o=r;for(let i of this.afterErrorHooks){let s=await i.afterError(e,n,o);n=s.response,o=s.error}return{response:n,error:o}}};function yg(e){return{ok:!0,value:e}}function kn(e){return{ok:!1,error:e}}function tf(e){return btoa(String.fromCodePoint(...e))}function JB(e){return new TextEncoder().encode(e)}function KB(e){return tf(JB(e))}var XB=Object.prototype.hasOwnProperty;function it(e,t){let r=/\{([a-zA-Z0-9_][a-zA-Z0-9_-]*?)\}/g;return function n(o={}){return e.replace(r,function(i,s){if(!XB.call(o,s))throw Error(`Parameter '${s}' is required`);let l=o[s];if(typeof l!=="string"&&typeof l!=="number")throw Error(`Parameter '${s}' must be a string or number`);return`${l}`}).replace(/^\/+/,"")}}var Sg=["https://generativelanguage.googleapis.com"];function YB(e){var t;let r=e.server_url,n={};if(!r){let i=(t=e.server_idx)!==null&&t!==void 0?t:0;if(i<0||i>=Sg.length)throw Error(`Invalid server index ${i}`);r=Sg[i]||""}let o=it(r)(n);return new URL(o)}var ZB={userAgent:"speakeasy-sdk/typescript 2.4.1-preview.4 internal v1beta @google/genai"};function QB(...e){let t=[];for(let r of e)if(r)t.push(r);switch(t.length){case 0:case 1:return t[0]||null;default:if("any"in AbortSignal&&typeof AbortSignal.any==="function")return AbortSignal.any(t);return e4(t)}}function e4(e){let t=new AbortController,r=t.signal;if(!e.length)return t.signal;if(e.length===1)return e[0]||t.signal;for(let s of e)if(s.aborted)return s;function n(){t.abort(this.reason),i()}let o=[];function i(){for(let s of o){let l=s.deref();if(l)l.removeEventListener("abort",n)}}for(let s of e)o.push(new WeakRef(s)),s.addEventListener("abort",n);return r}function dt(e){let t={};for(let[r,n]of Object.entries(e))if(typeof n<"u")t[r]=n;return t}function ho(e){if(e===null||typeof e!=="object")return!1;if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;try{return Object.getPrototypeOf(t)===null}catch(r){return!1}}var t4=/%(2[346bcf]|3[abdf]|40|5[bd])/gi;function vb(e,t){return tc(e,t==="percentExceptReserved"?"percent":t)}function tc(e,t){switch(t){case"percent":return encodeURIComponent(e);case"percentExceptReserved":return encodeURIComponent(e).replace(t4,(r)=>decodeURIComponent(r));default:return e}}function r4(e){return(t,r,n)=>{let o="",i=(n===null||n===void 0?void 0:n.explode)?yb(t,r):[[t,r]];if(i.every(([c,u])=>u==null))return;let s=(c)=>tc(c,n===null||n===void 0?void 0:n.charEncoding),l=(c)=>s(Sb(c)),a=s(e);return i.forEach(([c,u])=>{var f,h;let g="",p=null;if(u==null)return;else if(Array.isArray(u))p=(f=bb(u,(_)=>`${l(_)}`))===null||f===void 0?void 0:f.join(a);else if(ho(u))p=(h=wb(Object.entries(u),([_,y])=>`${s(_)}${a}${l(y)}`))===null||h===void 0?void 0:h.join(a);else p=`${l(u)}`;if(p==null)return;if(g=`${vb(c,n===null||n===void 0?void 0:n.charEncoding)}=${p}`,!g||g==="=")return;o+=`&${g}`}),o.slice(1)}}var _b=r4(",");function xr(e,t,r){if(typeof t>"u")return;let o=((i)=>tc(i,r===null||r===void 0?void 0:r.charEncoding))(JSON.stringify(t,Eb));return(r===null||r===void 0?void 0:r.explode)?o:`${vb(e,r===null||r===void 0?void 0:r.charEncoding)}=${o}`}var Oe=(e,t,r)=>{let n="",o=(r===null||r===void 0?void 0:r.explode)?yb(e,t):[[e,t]];if(o.every(([l,a])=>a==null))return;let i=(l)=>tc(l,r===null||r===void 0?void 0:r.charEncoding),s=(l)=>i(Sb(l));return o.forEach(([l,a])=>{var c;let u="";if(a==null)return;else if(Array.isArray(a))u=(c=bb(a,(f)=>`${s(f)}`))===null||c===void 0?void 0:c.join(",");else if(ho(a)){let f=wb(Object.entries(a),([h,g])=>`,${i(h)},${s(g)}`);u=f===null||f===void 0?void 0:f.join("").slice(1)}else u=`${(r===null||r===void 0?void 0:r.explode)&&ho(t)?`${l}=`:""}${s(a)}`;n+=u?`,${u}`:""}),n.slice(1)};function yb(e,t){if(Array.isArray(t))return t.map((r)=>[e,r]);else if(ho(t))return Object.entries(t!==null&&t!==void 0?t:{}).map(([n,o])=>[n,o]);else return[[e,t]]}function Sb(e){if(e==null)return"";else if(e instanceof Date)return e.toISOString();else if(e instanceof Uint8Array)return tf(e);else if(typeof e==="object")return JSON.stringify(e,Eb);return`${e}`}function Eb(e,t){if(t instanceof Uint8Array)return tf(t);else return t}function bb(e,t){let r=e.reduce((n,o)=>{if(o==null)return n;let i=t(o);if(i==null)return n;return n.push(i),n},[]);return r.length?r:null}function wb(e,t){let r=[];for(let[n,o]of e){if(o==null)continue;let i=t([n,o]);if(i==null)continue;r.push(i)}return r.length?r:null}function n4(...e){return e.filter(Boolean).join("&")}function o4(e){return function(r,n){var o,i,s;let l=Object.assign(Object.assign({},n),{explode:(o=n===null||n===void 0?void 0:n.explode)!==null&&o!==void 0?o:!0,charEncoding:(i=n===null||n===void 0?void 0:n.charEncoding)!==null&&i!==void 0?i:"percent"}),a=new Set((s=n===null||n===void 0?void 0:n.allowEmptyValue)!==null&&s!==void 0?s:[]),c=Object.entries(r).map(([u,f])=>{if(a.has(u)){if(f===void 0||f===null||f===""||Array.isArray(f)&&f.length===0)return`${encodeURIComponent(u)}=`}return e(u,f,l)});return n4(...c)}}var Lr=o4(_b),Eg={initialInterval:500,maxInterval:60000,exponent:1.5,maxElapsedTime:3600000},rf=class e extends Error{constructor(t,r){let n=t;if(r===null||r===void 0?void 0:r.cause)n+=`: ${r.cause}`;super(n,r);if(this.name="PermanentError",typeof this.cause>"u")this.cause=r===null||r===void 0?void 0:r.cause;Object.setPrototypeOf(this,e.prototype)}},qi=class e extends Error{constructor(t,r){super(t);this.response=r,this.name="TemporaryError",Object.setPrototypeOf(this,e.prototype)}};async function i4(e,t){var r;switch(t.config.strategy){case"backoff":return l4(bg(e,{statusCodes:t.statusCodes,retryConnectionErrors:!!t.config.retryConnectionErrors}),(r=t.config.backoff)!==null&&r!==void 0?r:Eg);case"attempt-count-backoff":return c4(bg(e,{statusCodes:t.statusCodes,retryConnectionErrors:!!t.config.retryConnectionErrors}),Object.assign(Object.assign({},Eg),t.config.backoff),t.config);default:return await e(0)}}function bg(e,t){return async(r)=>{try{let n=await e(r);if(a4(n,t.statusCodes))throw new qi("Response failed with retryable status code",n);return n}catch(n){if(n instanceof qi)throw n;if(t.retryConnectionErrors&&(gb(n)||mb(n)))throw n;throw new rf("Permanent error",{cause:n})}}}var s4=new RegExp("^[0-9]xx$","i");function a4(e,t){let r=`${e.status}`;return t.some((n)=>{if(!s4.test(n))return n===r;let o=n.charAt(0);if(!o)throw Error("Invalid status code range");let i=r.charAt(0);if(!i)throw Error(`Invalid response status code: ${r}`);return i===o})}async function l4(e,t){let{maxElapsedTime:r,initialInterval:n,exponent:o,maxInterval:i}=t,s=Date.now(),l=0;while(!0)try{return await e(l)}catch(a){if(a instanceof rf)throw a.cause;if(Date.now()-s>r){if(a instanceof qi)return a.response;throw a}let u=0;if(a instanceof qi)u=Tb(a.response);if(u<=0)u=n*Math.pow(l,o)+Math.random()*1000;let f=Math.min(u,i);await Cb(f),l++}}async function c4(e,t,r){let n=0;while(!0)try{return await e(n)}catch(o){if(o instanceof rf)throw o.cause;if(n>=r.maxRetries){if(o instanceof qi)return o.response;throw o}let i=0;if(o instanceof qi)i=Tb(o.response);if(i<=0)i=t.initialInterval*Math.pow(t.exponent,n)*(1-Math.random()*0.25);let s=Math.min(i,t.maxInterval);await Cb(s),n++}}function Tb(e){let t=e.headers.get("retry-after-ms");if(t){let i=Number(t);if(Number.isFinite(i)&&i>=0)return i}let r=e.headers.get("retry-after")||"";if(!r)return 0;let n=Number(r);if(Number.isInteger(n))return n*1000;let o=Date.parse(r);if(Number.isInteger(o)){let i=o-Date.now();return i>0?Math.ceil(i):0}return 0}async function Cb(e){return new Promise((t)=>setTimeout(t,e))}var Da=typeof globalThis>"u"?null:globalThis,u4=typeof Da==="object"&&Da!=null&&"importScripts"in Da&&typeof Da.importScripts==="function",d4=u4||typeof navigator<"u"&&"serviceWorker"in navigator||typeof window==="object"&&typeof window.document<"u",fn=class{constructor(e={}){let t=e;if(typeof t==="object"&&t!=null&&"hooks"in t&&t.hooks instanceof _g)this._hooks=t.hooks;else this._hooks=new _g;let r=new hb;e.http_client=e.http_client||r,e=this._hooks.sdkInit(e);let n=YB(e);if(n)n.pathname=n.pathname.replace(/\/+$/,"")+"/";if(this._baseURL=n,this._httpClient=e.http_client||r,this._options=Object.assign(Object.assign({},gB(e)),{hooks:this._hooks}),this._logger=this._options.debug_logger,!this._logger&&Us().GOOGLE_GENAI_DEBUG)this._logger=console}_createRequest(e,t,r){var n,o,i,s,l;let{method:a,path:c,query:u,headers:f,security:h}=t,g=(n=t.baseURL)!==null&&n!==void 0?n:this._baseURL;if(!g)return kn(new Ma("No base URL provided for operation"));let p=new URL(g),_;if(c){if(p.pathname=p.pathname.replace(/\/+$/,"")+"/",_=new URL(c,p),!_.search&&p.search)_.search=p.search}else _=p;_.hash="";let y=(G,B)=>{if(!B)return G;let Q=new Set(B.split("&").filter((se)=>se!=="").map((se)=>{var ve;return(ve=se.split("=")[0])!==null&&ve!==void 0?ve:""}));return[...G.split("&").filter((se)=>{var ve;return se!==""&&!Q.has((ve=se.split("=")[0])!==null&&ve!==void 0?ve:"")}),B].join("&")},S=(G)=>Object.entries(G).map(([B,Q])=>{if(Q==null)return;let pe=ho(Q)?JSON.stringify(Q):Q;return _b(B,pe,{explode:Array.isArray(pe),charEncoding:"percent"})}).filter((B)=>typeof B<"u").join("&"),E=[u||"",S((r===null||r===void 0?void 0:r.extra_query)||{}),S((h===null||h===void 0?void 0:h.queryParams)||{})].reduce(y,_.search.slice(1));if(E)_.search=`?${E}`;let b=new Headers(f),R=h===null||h===void 0?void 0:h.basic.username,w=h===null||h===void 0?void 0:h.basic.password;if(R!=null||w!=null){let G=KB([R||"",w||""].join(":"));b.set("Authorization",`Basic ${G}`)}let T=new Headers((h===null||h===void 0?void 0:h.headers)||{});for(let[G,B]of T)b.set(G,B);let C=b.get("cookie")||"";for(let[G,B]of Object.entries((h===null||h===void 0?void 0:h.cookies)||{}))C+=`; ${G}=${B}`;C=C.startsWith("; ")?C.slice(2):C,b.set("cookie",C);let A=new Headers((o=r===null||r===void 0?void 0:r.headers)!==null&&o!==void 0?o:(i=r===null||r===void 0?void 0:r.fetch_options)===null||i===void 0?void 0:i.headers);for(let[G,B]of A)b.set(G,B);if(!d4)b.set((s=t.uaHeader)!==null&&s!==void 0?s:"user-agent",(l=t.userAgent)!==null&&l!==void 0?l:ZB.userAgent);let P=t.body,D=Object.fromEntries(Object.entries((r===null||r===void 0?void 0:r.extra_body)||{}).filter(([,G])=>typeof G<"u"));if(Object.keys(D).length>0){let G=new Headers(f).get("content-type")||"";if(!/^(application|text)\/([^+]+\+)*json/.test(G)||typeof P!=="string"&&P!=null)return kn(new Ma("extra_body can only be merged into JSON object request bodies"));let Q;try{Q=P?JSON.parse(P):{}}catch(pe){return kn(new Ma("extra_body can only be merged into JSON object request bodies",{cause:pe}))}if(!ho(Q))return kn(new Ma("extra_body can only be merged into JSON object request bodies"));P=JSON.stringify(Object.assign(Object.assign({},Q),D)),b.delete("content-length")}let N=Object.assign(Object.assign({},r===null||r===void 0?void 0:r.fetch_options),r);if(!(N===null||N===void 0?void 0:N.signal)&&t.timeout_ms!=null&&t.timeout_ms>0)e.timeout_ms=t.timeout_ms;if(t.body instanceof ReadableStream)Object.assign(N,{duplex:"half"});let F;try{F=this._hooks.beforeCreateRequest(e,{url:_,options:Object.assign(Object.assign({},N),{body:P!==null&&P!==void 0?P:null,headers:b,method:a})})}catch(G){return kn(new hg("Create request hook failed to execute",{cause:G}))}return yg(new Request(F.url,F.options))}async _do(e,t){let{context:r,isErrorStatusCode:n}=t,o=r.timeout_ms;return i4(async()=>{var i;let s=e.clone(),l=s;if(o!=null&&o>0){let u=AbortSignal.timeout(o),f=(i=QB(s.signal,u))!==null&&i!==void 0?i:u;l=new Request(s,{signal:f})}let a=await this._hooks.beforeRequest(r,l);await f4(this._logger,a).catch((u)=>{var f;return(f=this._logger)===null||f===void 0?void 0:f.log("Failed to log request:",u)});let c=await this._httpClient.request(a);try{if(n(c.status)){let u=await this._hooks.afterError(r,c,null);if(u.error)throw u.error;c=u.response||c}else c=await this._hooks.afterSuccess(r,c)}finally{await p4(this._logger,c,a).catch((u)=>{var f;return(f=this._logger)===null||f===void 0?void 0:f.log("Failed to log response:",u)})}return c},{config:t.retryConfig,statusCodes:t.retryCodes}).then((i)=>yg(i),(i)=>{switch(!0){case jB(i):return kn(new db("Request aborted by client",{cause:i}));case gb(i):return kn(new fb("Request timed out",{cause:i}));case mb(i):return kn(new pb("Unable to make request",{cause:i}));default:return kn(new hg("Unexpected HTTP client error",{cause:i}))}})}},Rb=/^(application|text)\/([^+]+\+)*json.*/,wg=/^(application|text)\/([^+]+\+)*(jsonl|x-ndjson)\b.*/;async function f4(e,t){if(!e)return;let r=t.headers.get("content-type"),n=(r===null||r===void 0?void 0:r.split(";")[0])||"";e.group(`> Request: ${t.method} ${t.url}`),e.group("Headers:");for(let[o,i]of t.headers.entries())e.log(`${o}: ${i}`);switch(e.groupEnd(),e.group("Body:"),!0){case Rb.test(n):e.log(await t.clone().json());break;case n.startsWith("text/"):e.log(await t.clone().text());break;case n==="multipart/form-data":{let o=await t.clone().formData();for(let[i,s]of o){let l=s instanceof Blob?"<Blob>":s;e.log(`${i}: ${l}`)}break}default:e.log(`<${r}>`);break}e.groupEnd(),e.groupEnd()}async function p4(e,t,r){if(!e)return;let n=t.headers.get("content-type"),o=(n===null||n===void 0?void 0:n.split(";")[0])||"";e.group(`< Response: ${r.method} ${r.url}`),e.log("Status Code:",t.status,t.statusText),e.group("Headers:");for(let[i,s]of t.headers.entries())e.log(`${i}: ${s}`);switch(e.groupEnd(),e.group("Body:"),!0){case(yi(t,"application/json")||Rb.test(o)&&!wg.test(o)):e.log(await t.clone().json());break;case(yi(t,"application/jsonl")||wg.test(o)):case yi(t,"text/event-stream"):e.log(`<${n}>`);break;case yi(t,"text/*"):e.log(await t.clone().text());break;case yi(t,"multipart/form-data"):{let i=await t.clone().formData();for(let[s,l]of i){let a=l instanceof Blob?"<Blob>":l;e.log(`${s}: ${a}`)}break}default:e.log(`<${n}>`);break}e.groupEnd(),e.groupEnd()}var Tg=class extends dn{constructor(e,t){if(e)e+=": ";e+=`Status ${t.response.status}`;let r=t.response.headers.get("content-type")||'""';if(r!=="application/json")e+=` Content-Type ${r.includes(" ")?`"${r}"`:r}`;let n=t.body||'""';e+=n.length>100?`
130
+ `:". ";let o=n;if(n.length>1e4){let i=n.substring(0,1e4),s=n.length-1e4;o=`${i}...and ${s} more chars`}e+=`Body: ${o}`,e=e.trim();super(e,t);this.name="GoogleGenAiDefaultError"}};function Cg(e){try{return JSON.parse(e)}catch(t){return e}}function h4(e,t={}){var r,n;let o=t.flattened===!0,i=(r=t.sentinel)!==null&&r!==void 0?r:"";return new m4(e,(s)=>{if(i!==""&&s.data===i)return{done:!0,value:void 0};if(o)return{done:!1,value:s.data==null?void 0:Cg(s.data)};return{done:!1,value:Object.assign(Object.assign({},s),{data:s.data==null?s.data:Cg(s.data)})}},{dataRequired:(n=t.dataRequired)!==null&&n!==void 0?n:!0})}var m4=class extends ReadableStream{constructor(e,t,r){var n;let o=e.getReader(),i=new Uint8Array(4096),s=0,l=0,a={eventId:void 0},c=(n=r===null||r===void 0?void 0:r.dataRequired)!==null&&n!==void 0?n:!0;super({async pull(u){try{while(!0){let f=v4(i,s,l);if(!f){l=Math.max(0,s-g4+1);let p=await o.read();if(p.done)return u.close();if(s+p.value.length>i.length){let _=new Uint8Array(Math.max(i.length*2,s+p.value.length));_.set(i.subarray(0,s)),i=_}i.set(p.value,s),s+=p.value.length;continue}let h=i.slice(0,f.index);if(i.copyWithin(0,f.index+f.length,s),s-=f.index+f.length,i.length>4096&&s<=i.length>>2){let p=new Uint8Array(Math.max(4096,s*2));p.set(i.subarray(0,s)),i=p}l=0;let g=_4(h,t,a,c);if(g&&!g.done)return u.enqueue(g.value);if(g===null||g===void 0?void 0:g.done)return await o.cancel("done"),u.close()}}catch(f){u.error(f),await o.cancel(f)}},cancel:(u)=>o.cancel(u)})}[Symbol.asyncIterator](e){let t=ReadableStream.prototype[Symbol.asyncIterator];if(typeof t==="function")return t.call(this,e);let r=this.getReader(),n={next:async()=>{let i=await r.read();if(i.done)return r.releaseLock(),{done:!0,value:void 0};return{done:!1,value:i.value}},throw:async(i)=>(await r.cancel(i),r.releaseLock(),{done:!0,value:void 0}),return:async()=>(await r.cancel("done"),r.releaseLock(),{done:!0,value:void 0}),[Symbol.asyncIterator](){return this}},o=Symbol.asyncDispose;if(o)n[o]=async()=>{var i;await((i=n.return)===null||i===void 0?void 0:i.call(n))};return n}values(e){return this[Symbol.asyncIterator](e)}},Pr=13,kr=10,Ab=[[Pr,kr,Pr,kr],[Pr,kr,Pr],[Pr,kr,kr],[Pr,Pr,kr],[kr,Pr,kr],[Pr,Pr],[kr,Pr],[kr,kr]],g4=Ab.reduce((e,t)=>Math.max(e,t.length),0);function v4(e,t,r){for(let n=r;n<t;n++){if(e[n]!==Pr&&e[n]!==kr)continue;for(let o of Ab){if(n+o.length>t)continue;let i=!0;for(let s=0;s<o.length;s++)if(e[n+s]!==o[s]){i=!1;break}if(i)return{index:n,length:o.length}}}return null}function _4(e,t,r,n){let i=new TextDecoder().decode(e).split(/\r\n|\r|\n/),s=[],l={},a=!0;for(let c of i){if(!c||c.startsWith(":"))continue;a=!1;let u=c.indexOf(":"),f=c,h="";if(u>0)f=c.slice(0,u),h=c[u+1]===" "?c.slice(u+2):c.slice(u+1);if(f==="data")s.push(h);else if(f==="event")l.event=h;else if(f==="id"&&!h.includes("\x00"))r.eventId=h;else if(f==="retry"&&/^\d+$/.test(h))l.retry=Number(h)}if(a)return;if(l.id=r.eventId,s.length)l.data=s.join(`
131
+ `);else if(n)return;return t(l)}var y4={jsonl:"application/jsonl",json:"application/json",text:"text/plain",bytes:"application/octet-stream",stream:"application/octet-stream",sse:"text/event-stream",nil:"*",fail:"*"};function mo(e,t,r){return Object.assign(Object.assign({},r),{err:!0,enc:"json",codes:e,errorClass:t})}function _t(e,t){return Object.assign(Object.assign({},t),{enc:"json",codes:e})}function Ib(e,t,r){return Object.assign(Object.assign(Object.assign({},r),{enc:"sse",codes:e}),t?{sse:t}:{})}function Pb(e,t){return Object.assign(Object.assign({},t),{enc:"nil",codes:e})}function De(e){return{enc:"fail",codes:e}}function ft(...e){return async function t(r,n,o){let i,s;for(let h of e){let{codes:g}=h,p="ctype"in h?h.ctype:y4[h.enc];if(p&&VB(r,g,p)){s=h;break}else if(!p&&ot(r,g)){s=h;break}}if(!s)return[{ok:!1,error:new Tg("Unexpected Status or Content-Type",{response:r,request:n,body:await r.text().catch(()=>"")})},i];let l=s.enc,a="";switch(l){case"json":a=await r.text();try{i=JSON.parse(a)}catch(h){if(!("err"in s))throw h;i=a}break;case"jsonl":i=r.body;break;case"bytes":i=new Uint8Array(await r.arrayBuffer());break;case"stream":i=r.body;break;case"text":a=await r.text(),i=a;break;case"sse":if(r.body){let h="sse"in s&&s.sse||{};i=h4(r.body,h)}else i=null;break;case"nil":a=await r.text(),i=void 0;break;case"fail":a=await r.text(),i=a;break;default:throw Error(`Unsupported response type: ${l}`)}if(s.enc==="fail")return[{ok:!1,error:new Tg("API error occurred",{request:n,response:r,body:a})},i];let c=s.key||(o===null||o===void 0?void 0:o.resultKey),u,f=s.hdrs?{headers:E4(r.headers)}:null;if("err"in s)u=Object.assign(Object.assign(Object.assign({},o===null||o===void 0?void 0:o.extraFields),f),ho(i)?i:null);else if(c)u=Object.assign(Object.assign(Object.assign({},o===null||o===void 0?void 0:o.extraFields),f),{[c]:i});else if(s.hdrs)u=Object.assign(Object.assign(Object.assign({},o===null||o===void 0?void 0:o.extraFields),f),ho(i)?i:null);else u=i;if("err"in s)return[{ok:!1,error:s.errorClass?new s.errorClass(u,{request:n,response:r,body:a}):u},i];return[{ok:!0,value:u},i]}}var S4=/, */;function E4(e){let t={};for(let[r,n]of e.entries())t[r]=n.split(S4);return t}var Rg={Incomplete:"incomplete",UnrecognisedSecurityType:"unrecognized_security_type"},b4=class e extends Error{constructor(t,r){super(r);this.code=t,this.name="SecurityError"}static incomplete(){return new e(Rg.Incomplete,"Security requirements not met in order to perform the operation")}static unrecognizedType(t){return new e(Rg.UnrecognisedSecurityType,`Unrecognised security type: ${t}`)}};function w4(...e){let t={basic:{},headers:{},queryParams:{},cookies:{},oauth2:{type:"none"}},r=e.find((n)=>n.every((o)=>{if(o.value==null)return!1;else if(o.type==="http:basic")return o.value.username!=null||o.value.password!=null;else if(o.type==="http:custom")return null;else if(o.type==="oauth2:password")return typeof o.value==="string"&&!!o.value;else if(o.type==="oauth2:client_credentials"){if(typeof o.value=="string")return!!o.value;return o.value.client_id!=null||o.value.client_secret!=null}else if(typeof o.value==="string")return!!o.value;else throw Error(`Unrecognized security type: ${o.type} (value type: ${typeof o.value})`)}));if(r==null)return null;return r.forEach((n)=>{if(n.value==null)return;let{type:o}=n;switch(o){case"apiKey:header":t.headers[n.fieldName]=n.value;break;case"apiKey:query":t.queryParams[n.fieldName]=n.value;break;case"apiKey:cookie":t.cookies[n.fieldName]=n.value;break;case"http:basic":T4(t,n);break;case"http:custom":break;case"http:bearer":$a(t,n);break;case"oauth2":$a(t,n);break;case"oauth2:password":$a(t,n);break;case"oauth2:client_credentials":break;case"openIdConnect":$a(t,n);break;default:throw b4.unrecognizedType(o)}}),t}function T4(e,t){if(t.value==null)return;e.basic=t.value}function $a(e,t){if(typeof t.value!=="string"||!t.value)return;let r=t.value;if(r.slice(0,7).toLowerCase()!=="bearer ")r=`Bearer ${r}`;if(t.fieldName!==void 0)e.headers[t.fieldName]=r}function pt(e,t){var r,n;let o=[[{fieldName:"accessToken",type:"http:custom",value:(r=e===null||e===void 0?void 0:e.access_token)!==null&&r!==void 0?r:Us().GOOGLE_GENAI_ACCESS_TOKEN},{fieldName:"apiKey",type:"http:custom",value:(n=e===null||e===void 0?void 0:e.api_key)!==null&&n!==void 0?n:Us().GOOGLE_GENAI_API_KEY},{fieldName:"defaultHeaders",type:"http:custom",value:e===null||e===void 0?void 0:e.default_headers}]];return w4(...o)}async function ht(e){if(e==null)return;return typeof e==="function"?e():e}var kb,st=class e{constructor(t,r){this[kb]="APIPromise",this._promise=t instanceof Promise?t:Promise.resolve(t),this._unwrapped=t instanceof Promise?null:Promise.resolve(t[0]),this._callSource=r!==null&&r!==void 0?r:null}_getUnwrapped(){var t;return(t=this._unwrapped)!==null&&t!==void 0?t:this._unwrapped=this._promise.then(([r])=>r)}then(t,r){return this._promise.then(t?([n])=>t(n):void 0,r)}catch(t){return this._getUnwrapped().catch(t)}finally(t){return this._getUnwrapped().finally(t)}$inspect(){return this._promise}asResponse(){var t;return((t=this._callSource)!==null&&t!==void 0?t:this._callSource=this._promise.then(([,n])=>n)).then((n)=>{if(!n.response)throw Error("APIPromise.asResponse: response unavailable");return n.response})}async withResponse(){let[[t],r]=await Promise.all([this._promise,this.asResponse()]);return{data:t,response:r}}_thenUnwrap(t){var r;let n=this._promise.then(([o,i])=>[t(o),i]);return n.catch(()=>{}),new e(n,(r=this._callSource)!==null&&r!==void 0?r:void 0)}};kb=Symbol.toStringTag;function ct(e){let t=e.$inspect(),r=t.then(([o,i])=>{if(!o.ok)throw o.error;return[o.value,i]}),n=t.then(([o,i])=>{var s;if(!o.ok&&!((s=i.response)===null||s===void 0?void 0:s.ok))throw o.error;return i});return r.catch(()=>{}),n.catch(()=>{}),new st(r,n)}function Nb(e,t,r,n){return new st(C4(e,t,r,n))}async function C4(e,t,r,n){var o,i,s;let a={body:t,api_version:r},c=xr("body",a.body,{explode:!0}),u={api_version:Oe("api_version",(o=a.api_version)!==null&&o!==void 0?o:e._options.api_version,{explode:!1,charEncoding:"percent"})},f=it("/{api_version}/agents")(u),h=new Headers(dt({"Content-Type":"application/json",Accept:"application/json"})),g=await ht(e._options.security),p=pt(g),_={options:e._options,base_url:(s=(i=n===null||n===void 0?void 0:n.server_url)!==null&&i!==void 0?i:e._baseURL)!==null&&s!==void 0?s:"",operation_id:"CreateAgent",o_auth2_scopes:null,resolved_security:p,security_source:e._options.security,retry_config:(n===null||n===void 0?void 0:n.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(n===null||n===void 0?void 0:n.retry_codes)||["408","409","429","5XX"]},y=e._createRequest(_,{security:p,method:"POST",baseURL:n===null||n===void 0?void 0:n.server_url,path:f,headers:h,body:c,userAgent:e._options.user_agent,timeout_ms:(n===null||n===void 0?void 0:n.timeout_ms)||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let S=y.value,E=await e._do(S,{context:_,isErrorStatusCode:(w)=>ot({status:w},["4XX","5XX"]),retryConfig:_.retry_config,retryCodes:_.retry_codes});if(!E.ok)return[E,{status:"request-error",request:S}];let b=E.value,[R]=await ft(De("4XX"),De("5XX"),_t("default"))(b,S);if(!R.ok)return[R,{status:"complete",request:S,response:b}];return[R,{status:"complete",request:S,response:b}]}function Ob(e,t,r,n){return new st(R4(e,t,r,n))}async function R4(e,t,r,n){var o,i,s;let a={id:t,api_version:r},c=null,u={api_version:Oe("api_version",(o=a.api_version)!==null&&o!==void 0?o:e._options.api_version,{explode:!1,charEncoding:"percent"}),agentsId:Oe("agentsId",a.id,{explode:!1,charEncoding:"percent"})},f=it("/{api_version}/agents/{agentsId}")(u),h=new Headers(dt({Accept:"application/json"})),g=await ht(e._options.security),p=pt(g),_={options:e._options,base_url:(s=(i=n===null||n===void 0?void 0:n.server_url)!==null&&i!==void 0?i:e._baseURL)!==null&&s!==void 0?s:"",operation_id:"DeleteAgent",o_auth2_scopes:null,resolved_security:p,security_source:e._options.security,retry_config:(n===null||n===void 0?void 0:n.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(n===null||n===void 0?void 0:n.retry_codes)||["408","409","429","5XX"]},y=e._createRequest(_,{security:p,method:"DELETE",baseURL:n===null||n===void 0?void 0:n.server_url,path:f,headers:h,body:null,userAgent:e._options.user_agent,timeout_ms:(n===null||n===void 0?void 0:n.timeout_ms)||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let S=y.value,E=await e._do(S,{context:_,isErrorStatusCode:(w)=>ot({status:w},["4XX","5XX"]),retryConfig:_.retry_config,retryCodes:_.retry_codes});if(!E.ok)return[E,{status:"request-error",request:S}];let b=E.value,[R]=await ft(De("4XX"),De("5XX"),_t("default"))(b,S);if(!R.ok)return[R,{status:"complete",request:S,response:b}];return[R,{status:"complete",request:S,response:b}]}function Mb(e,t,r,n){return new st(A4(e,t,r,n))}async function A4(e,t,r,n){var o,i,s;let a={id:t,api_version:r},c=null,u={api_version:Oe("api_version",(o=a.api_version)!==null&&o!==void 0?o:e._options.api_version,{explode:!1,charEncoding:"percent"}),agentsId:Oe("agentsId",a.id,{explode:!1,charEncoding:"percent"})},f=it("/{api_version}/agents/{agentsId}")(u),h=new Headers(dt({Accept:"application/json"})),g=await ht(e._options.security),p=pt(g),_={options:e._options,base_url:(s=(i=n===null||n===void 0?void 0:n.server_url)!==null&&i!==void 0?i:e._baseURL)!==null&&s!==void 0?s:"",operation_id:"GetAgent",o_auth2_scopes:null,resolved_security:p,security_source:e._options.security,retry_config:(n===null||n===void 0?void 0:n.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(n===null||n===void 0?void 0:n.retry_codes)||["408","409","429","5XX"]},y=e._createRequest(_,{security:p,method:"GET",baseURL:n===null||n===void 0?void 0:n.server_url,path:f,headers:h,body:null,userAgent:e._options.user_agent,timeout_ms:(n===null||n===void 0?void 0:n.timeout_ms)||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let S=y.value,E=await e._do(S,{context:_,isErrorStatusCode:(w)=>ot({status:w},["4XX","5XX"]),retryConfig:_.retry_config,retryCodes:_.retry_codes});if(!E.ok)return[E,{status:"request-error",request:S}];let b=E.value,[R]=await ft(De("4XX"),De("5XX"),_t("default"))(b,S);if(!R.ok)return[R,{status:"complete",request:S,response:b}];return[R,{status:"complete",request:S,response:b}]}function Db(e,t,r,n,o,i){return new st(I4(e,t,r,n,o,i))}async function I4(e,t,r,n,o,i){var s,l,a;let u={api_version:t,page_size:r,page_token:n,parent:o},f=null,h={api_version:Oe("api_version",(s=u===null||u===void 0?void 0:u.api_version)!==null&&s!==void 0?s:e._options.api_version,{explode:!1,charEncoding:"percent"})},g=it("/{api_version}/agents")(h),p=Lr({page_size:u===null||u===void 0?void 0:u.page_size,page_token:u===null||u===void 0?void 0:u.page_token,parent:u===null||u===void 0?void 0:u.parent}),_=new Headers(dt({Accept:"application/json"})),y=await ht(e._options.security),S=pt(y),E={options:e._options,base_url:(a=(l=i===null||i===void 0?void 0:i.server_url)!==null&&l!==void 0?l:e._baseURL)!==null&&a!==void 0?a:"",operation_id:"ListAgents",o_auth2_scopes:null,resolved_security:S,security_source:e._options.security,retry_config:(i===null||i===void 0?void 0:i.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(i===null||i===void 0?void 0:i.retry_codes)||["408","409","429","5XX"]},b=e._createRequest(E,{security:S,method:"GET",baseURL:i===null||i===void 0?void 0:i.server_url,path:g,headers:_,query:p,body:null,userAgent:e._options.user_agent,timeout_ms:(i===null||i===void 0?void 0:i.timeout_ms)||e._options.timeout_ms||-1},i);if(!b.ok)return[b,{status:"invalid"}];let R=b.value,w=await e._do(R,{context:E,isErrorStatusCode:(A)=>ot({status:A},["4XX","5XX"]),retryConfig:E.retry_config,retryCodes:E.retry_codes});if(!w.ok)return[w,{status:"request-error",request:R}];let T=w.value,[C]=await ft(De("4XX"),De("5XX"),_t("default"))(T,R);if(!C.ok)return[C,{status:"complete",request:R,response:T}];return[C,{status:"complete",request:R,response:T}]}var P4=class extends fn{list(e,t){return ct(Db(this,e===null||e===void 0?void 0:e.api_version,e===null||e===void 0?void 0:e.page_size,e===null||e===void 0?void 0:e.page_token,e===null||e===void 0?void 0:e.parent,t))}create(e,t){let{api_version:r}=e,n=$t(e,["api_version"]);return ct(Nb(this,n,r,t))}delete(e,t,r){return ct(Ob(this,e,t===null||t===void 0?void 0:t.api_version,r))}get(e,t,r){return ct(Mb(this,e,t===null||t===void 0?void 0:t.api_version,r))}};function $b(e,t,r,n){return new st(k4(e,t,r,n))}async function k4(e,t,r,n){var o,i,s;let a={body:t,api_version:r},c=xr("body",a.body,{explode:!0}),u={api_version:Oe("api_version",(o=a.api_version)!==null&&o!==void 0?o:e._options.api_version,{explode:!1,charEncoding:"percent"})},f=it("/{api_version}/credentials")(u),h=new Headers(dt({"Content-Type":"application/json",Accept:"application/json"})),g=await ht(e._options.security),p=pt(g),_={options:e._options,base_url:(s=(i=n===null||n===void 0?void 0:n.server_url)!==null&&i!==void 0?i:e._baseURL)!==null&&s!==void 0?s:"",operation_id:"CreateCredential",o_auth2_scopes:null,resolved_security:p,security_source:e._options.security,retry_config:(n===null||n===void 0?void 0:n.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(n===null||n===void 0?void 0:n.retry_codes)||["408","409","429","5XX"]},y=e._createRequest(_,{security:p,method:"POST",baseURL:n===null||n===void 0?void 0:n.server_url,path:f,headers:h,body:c,userAgent:e._options.user_agent,timeout_ms:(n===null||n===void 0?void 0:n.timeout_ms)||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let S=y.value,E=await e._do(S,{context:_,isErrorStatusCode:(w)=>ot({status:w},["4XX","5XX"]),retryConfig:_.retry_config,retryCodes:_.retry_codes});if(!E.ok)return[E,{status:"request-error",request:S}];let b=E.value,[R]=await ft(De("4XX"),De("5XX"),_t("default"))(b,S);if(!R.ok)return[R,{status:"complete",request:S,response:b}];return[R,{status:"complete",request:S,response:b}]}function xb(e,t,r,n){return new st(N4(e,t,r,n))}async function N4(e,t,r,n){var o,i,s;let a={id:t,api_version:r},c=null,u={api_version:Oe("api_version",(o=a.api_version)!==null&&o!==void 0?o:e._options.api_version,{explode:!1,charEncoding:"percent"}),id:Oe("id",a.id,{explode:!1,charEncoding:"percent"})},f=it("/{api_version}/credentials/{id}")(u),h=new Headers(dt({Accept:"application/json"})),g=await ht(e._options.security),p=pt(g),_={options:e._options,base_url:(s=(i=n===null||n===void 0?void 0:n.server_url)!==null&&i!==void 0?i:e._baseURL)!==null&&s!==void 0?s:"",operation_id:"DeleteCredential",o_auth2_scopes:null,resolved_security:p,security_source:e._options.security,retry_config:(n===null||n===void 0?void 0:n.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(n===null||n===void 0?void 0:n.retry_codes)||["408","409","429","5XX"]},y=e._createRequest(_,{security:p,method:"DELETE",baseURL:n===null||n===void 0?void 0:n.server_url,path:f,headers:h,body:null,userAgent:e._options.user_agent,timeout_ms:(n===null||n===void 0?void 0:n.timeout_ms)||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let S=y.value,E=await e._do(S,{context:_,isErrorStatusCode:(w)=>ot({status:w},["4XX","5XX"]),retryConfig:_.retry_config,retryCodes:_.retry_codes});if(!E.ok)return[E,{status:"request-error",request:S}];let b=E.value,[R]=await ft(De("4XX"),De("5XX"),_t("default"))(b,S);if(!R.ok)return[R,{status:"complete",request:S,response:b}];return[R,{status:"complete",request:S,response:b}]}function Lb(e,t,r,n){return new st(O4(e,t,r,n))}async function O4(e,t,r,n){var o,i,s;let a={id:t,api_version:r},c=null,u={api_version:Oe("api_version",(o=a.api_version)!==null&&o!==void 0?o:e._options.api_version,{explode:!1,charEncoding:"percent"}),id:Oe("id",a.id,{explode:!1,charEncoding:"percent"})},f=it("/{api_version}/credentials/{id}")(u),h=new Headers(dt({Accept:"application/json"})),g=await ht(e._options.security),p=pt(g),_={options:e._options,base_url:(s=(i=n===null||n===void 0?void 0:n.server_url)!==null&&i!==void 0?i:e._baseURL)!==null&&s!==void 0?s:"",operation_id:"GetCredential",o_auth2_scopes:null,resolved_security:p,security_source:e._options.security,retry_config:(n===null||n===void 0?void 0:n.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(n===null||n===void 0?void 0:n.retry_codes)||["408","409","429","5XX"]},y=e._createRequest(_,{security:p,method:"GET",baseURL:n===null||n===void 0?void 0:n.server_url,path:f,headers:h,body:null,userAgent:e._options.user_agent,timeout_ms:(n===null||n===void 0?void 0:n.timeout_ms)||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let S=y.value,E=await e._do(S,{context:_,isErrorStatusCode:(w)=>ot({status:w},["4XX","5XX"]),retryConfig:_.retry_config,retryCodes:_.retry_codes});if(!E.ok)return[E,{status:"request-error",request:S}];let b=E.value,[R]=await ft(De("4XX"),De("5XX"),_t("default"))(b,S);if(!R.ok)return[R,{status:"complete",request:S,response:b}];return[R,{status:"complete",request:S,response:b}]}function qb(e,t,r,n,o){return new st(M4(e,t,r,n,o))}async function M4(e,t,r,n,o){var i,s,l;let c={api_version:t,page_size:r,page_token:n},u=null,f={api_version:Oe("api_version",(i=c===null||c===void 0?void 0:c.api_version)!==null&&i!==void 0?i:e._options.api_version,{explode:!1,charEncoding:"percent"})},h=it("/{api_version}/credentials")(f),g=Lr({page_size:c===null||c===void 0?void 0:c.page_size,page_token:c===null||c===void 0?void 0:c.page_token}),p=new Headers(dt({Accept:"application/json"})),_=await ht(e._options.security),y=pt(_),S={options:e._options,base_url:(l=(s=o===null||o===void 0?void 0:o.server_url)!==null&&s!==void 0?s:e._baseURL)!==null&&l!==void 0?l:"",operation_id:"ListCredentials",o_auth2_scopes:null,resolved_security:y,security_source:e._options.security,retry_config:(o===null||o===void 0?void 0:o.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(o===null||o===void 0?void 0:o.retry_codes)||["408","409","429","5XX"]},E=e._createRequest(S,{security:y,method:"GET",baseURL:o===null||o===void 0?void 0:o.server_url,path:h,headers:p,query:g,body:null,userAgent:e._options.user_agent,timeout_ms:(o===null||o===void 0?void 0:o.timeout_ms)||e._options.timeout_ms||-1},o);if(!E.ok)return[E,{status:"invalid"}];let b=E.value,R=await e._do(b,{context:S,isErrorStatusCode:(C)=>ot({status:C},["4XX","5XX"]),retryConfig:S.retry_config,retryCodes:S.retry_codes});if(!R.ok)return[R,{status:"request-error",request:b}];let w=R.value,[T]=await ft(De("4XX"),De("5XX"),_t("default"))(w,b);if(!T.ok)return[T,{status:"complete",request:b,response:w}];return[T,{status:"complete",request:b,response:w}]}function Ub(e,t,r,n,o,i){return new st(D4(e,t,r,n,o,i))}async function D4(e,t,r,n,o,i){var s,l,a;let u={id:t,body:r,api_version:n,update_mask:o},f=xr("body",u.body,{explode:!0}),h={api_version:Oe("api_version",(s=u.api_version)!==null&&s!==void 0?s:e._options.api_version,{explode:!1,charEncoding:"percent"}),id:Oe("id",u.id,{explode:!1,charEncoding:"percent"})},g=it("/{api_version}/credentials/{id}")(h),p=Lr({update_mask:u.update_mask}),_=new Headers(dt({"Content-Type":"application/json",Accept:"application/json"})),y=await ht(e._options.security),S=pt(y),E={options:e._options,base_url:(a=(l=i===null||i===void 0?void 0:i.server_url)!==null&&l!==void 0?l:e._baseURL)!==null&&a!==void 0?a:"",operation_id:"UpdateCredential",o_auth2_scopes:null,resolved_security:S,security_source:e._options.security,retry_config:(i===null||i===void 0?void 0:i.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(i===null||i===void 0?void 0:i.retry_codes)||["408","409","429","5XX"]},b=e._createRequest(E,{security:S,method:"PATCH",baseURL:i===null||i===void 0?void 0:i.server_url,path:g,headers:_,query:p,body:f,userAgent:e._options.user_agent,timeout_ms:(i===null||i===void 0?void 0:i.timeout_ms)||e._options.timeout_ms||-1},i);if(!b.ok)return[b,{status:"invalid"}];let R=b.value,w=await e._do(R,{context:E,isErrorStatusCode:(A)=>ot({status:A},["4XX","5XX"]),retryConfig:E.retry_config,retryCodes:E.retry_codes});if(!w.ok)return[w,{status:"request-error",request:R}];let T=w.value,[C]=await ft(De("4XX"),De("5XX"),_t("default"))(T,R);if(!C.ok)return[C,{status:"complete",request:R,response:T}];return[C,{status:"complete",request:R,response:T}]}var $4=class extends fn{list(e,t){return ct(qb(this,e===null||e===void 0?void 0:e.api_version,e===null||e===void 0?void 0:e.page_size,e===null||e===void 0?void 0:e.page_token,t))}create(e,t){let{api_version:r}=e,n=$t(e,["api_version"]);return ct($b(this,n,r,t))}delete(e,t,r){return ct(xb(this,e,t===null||t===void 0?void 0:t.api_version,r))}get(e,t,r){return ct(Lb(this,e,t===null||t===void 0?void 0:t.api_version,r))}update(e,t,r){let{api_version:n,update_mask:o}=t,i=$t(t,["api_version","update_mask"]);return ct(Ub(this,e,i,n,o,r))}};function Fb(e,t,r,n){return new st(x4(e,t,r,n))}async function x4(e,t,r,n){var o,i,s;let a={body:t,api_version:r},c=xr("body",a.body,{explode:!0}),u={api_version:Oe("api_version",(o=a.api_version)!==null&&o!==void 0?o:e._options.api_version,{explode:!1,charEncoding:"percent"})},f=it("/{api_version}/environments")(u),h=new Headers(dt({"Content-Type":"application/json",Accept:"application/json"})),g=await ht(e._options.security),p=pt(g),_={options:e._options,base_url:(s=(i=n===null||n===void 0?void 0:n.server_url)!==null&&i!==void 0?i:e._baseURL)!==null&&s!==void 0?s:"",operation_id:"CreateEnvironment",o_auth2_scopes:null,resolved_security:p,security_source:e._options.security,retry_config:(n===null||n===void 0?void 0:n.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(n===null||n===void 0?void 0:n.retry_codes)||["408","409","429","5XX"]},y=e._createRequest(_,{security:p,method:"POST",baseURL:n===null||n===void 0?void 0:n.server_url,path:f,headers:h,body:c,userAgent:e._options.user_agent,timeout_ms:(n===null||n===void 0?void 0:n.timeout_ms)||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let S=y.value,E=await e._do(S,{context:_,isErrorStatusCode:(w)=>ot({status:w},["4XX","5XX"]),retryConfig:_.retry_config,retryCodes:_.retry_codes});if(!E.ok)return[E,{status:"request-error",request:S}];let b=E.value,[R]=await ft(De("4XX"),De("5XX"),_t("default"))(b,S);if(!R.ok)return[R,{status:"complete",request:S,response:b}];return[R,{status:"complete",request:S,response:b}]}function Gb(e,t,r,n){return new st(L4(e,t,r,n))}async function L4(e,t,r,n){var o,i,s;let a={id:t,api_version:r},c=null,u={api_version:Oe("api_version",(o=a.api_version)!==null&&o!==void 0?o:e._options.api_version,{explode:!1,charEncoding:"percent"}),id:Oe("id",a.id,{explode:!1,charEncoding:"percent"})},f=it("/{api_version}/environments/{id}")(u),h=new Headers(dt({Accept:"application/json"})),g=await ht(e._options.security),p=pt(g),_={options:e._options,base_url:(s=(i=n===null||n===void 0?void 0:n.server_url)!==null&&i!==void 0?i:e._baseURL)!==null&&s!==void 0?s:"",operation_id:"DeleteEnvironment",o_auth2_scopes:null,resolved_security:p,security_source:e._options.security,retry_config:(n===null||n===void 0?void 0:n.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(n===null||n===void 0?void 0:n.retry_codes)||["408","409","429","5XX"]},y=e._createRequest(_,{security:p,method:"DELETE",baseURL:n===null||n===void 0?void 0:n.server_url,path:f,headers:h,body:null,userAgent:e._options.user_agent,timeout_ms:(n===null||n===void 0?void 0:n.timeout_ms)||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let S=y.value,E=await e._do(S,{context:_,isErrorStatusCode:(w)=>ot({status:w},["4XX","5XX"]),retryConfig:_.retry_config,retryCodes:_.retry_codes});if(!E.ok)return[E,{status:"request-error",request:S}];let b=E.value,[R]=await ft(De("4XX"),De("5XX"),_t("default"))(b,S);if(!R.ok)return[R,{status:"complete",request:S,response:b}];return[R,{status:"complete",request:S,response:b}]}function Bb(e,t,r,n){return new st(q4(e,t,r,n))}async function q4(e,t,r,n){var o,i,s;let a={id:t,api_version:r},c=null,u={api_version:Oe("api_version",(o=a.api_version)!==null&&o!==void 0?o:e._options.api_version,{explode:!1,charEncoding:"percent"}),id:Oe("id",a.id,{explode:!1,charEncoding:"percent"})},f=it("/{api_version}/environments/{id}")(u),h=new Headers(dt({Accept:"application/json"})),g=await ht(e._options.security),p=pt(g),_={options:e._options,base_url:(s=(i=n===null||n===void 0?void 0:n.server_url)!==null&&i!==void 0?i:e._baseURL)!==null&&s!==void 0?s:"",operation_id:"GetEnvironment",o_auth2_scopes:null,resolved_security:p,security_source:e._options.security,retry_config:(n===null||n===void 0?void 0:n.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(n===null||n===void 0?void 0:n.retry_codes)||["408","409","429","5XX"]},y=e._createRequest(_,{security:p,method:"GET",baseURL:n===null||n===void 0?void 0:n.server_url,path:f,headers:h,body:null,userAgent:e._options.user_agent,timeout_ms:(n===null||n===void 0?void 0:n.timeout_ms)||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let S=y.value,E=await e._do(S,{context:_,isErrorStatusCode:(w)=>ot({status:w},["4XX","5XX"]),retryConfig:_.retry_config,retryCodes:_.retry_codes});if(!E.ok)return[E,{status:"request-error",request:S}];let b=E.value,[R]=await ft(De("4XX"),De("5XX"),_t("default"))(b,S);if(!R.ok)return[R,{status:"complete",request:S,response:b}];return[R,{status:"complete",request:S,response:b}]}function Hb(e,t,r,n,o){return new st(U4(e,t,r,n,o))}async function U4(e,t,r,n,o){var i,s,l;let c={api_version:t,page_size:r,page_token:n},u=null,f={api_version:Oe("api_version",(i=c===null||c===void 0?void 0:c.api_version)!==null&&i!==void 0?i:e._options.api_version,{explode:!1,charEncoding:"percent"})},h=it("/{api_version}/environments")(f),g=Lr({page_size:c===null||c===void 0?void 0:c.page_size,page_token:c===null||c===void 0?void 0:c.page_token}),p=new Headers(dt({Accept:"application/json"})),_=await ht(e._options.security),y=pt(_),S={options:e._options,base_url:(l=(s=o===null||o===void 0?void 0:o.server_url)!==null&&s!==void 0?s:e._baseURL)!==null&&l!==void 0?l:"",operation_id:"ListEnvironments",o_auth2_scopes:null,resolved_security:y,security_source:e._options.security,retry_config:(o===null||o===void 0?void 0:o.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(o===null||o===void 0?void 0:o.retry_codes)||["408","409","429","5XX"]},E=e._createRequest(S,{security:y,method:"GET",baseURL:o===null||o===void 0?void 0:o.server_url,path:h,headers:p,query:g,body:null,userAgent:e._options.user_agent,timeout_ms:(o===null||o===void 0?void 0:o.timeout_ms)||e._options.timeout_ms||-1},o);if(!E.ok)return[E,{status:"invalid"}];let b=E.value,R=await e._do(b,{context:S,isErrorStatusCode:(C)=>ot({status:C},["4XX","5XX"]),retryConfig:S.retry_config,retryCodes:S.retry_codes});if(!R.ok)return[R,{status:"request-error",request:b}];let w=R.value,[T]=await ft(De("4XX"),De("5XX"),_t("default"))(w,b);if(!T.ok)return[T,{status:"complete",request:b,response:w}];return[T,{status:"complete",request:b,response:w}]}function zb(e,t,r,n,o,i,s,l){return new st(F4(e,t,r,n,o,i,s,l))}async function F4(e,t,r,n,o,i,s,l){var a,c,u;let h={environment:t,path:r,api_version:n,page_size:o,page_token:i,recursive:s},g=null,p={api_version:Oe("api_version",(a=h.api_version)!==null&&a!==void 0?a:e._options.api_version,{explode:!1,charEncoding:"percent"}),environment:Oe("environment",h.environment,{explode:!1,charEncoding:"percent"}),path:Oe("path",h.path,{explode:!1,charEncoding:"percentExceptReserved"})},_=it("/{api_version}/environments/{environment}/files/{path}")(p),y=Lr({page_size:h.page_size,page_token:h.page_token,recursive:h.recursive}),S=new Headers(dt({Accept:"application/json"})),E=await ht(e._options.security),b=pt(E),R={options:e._options,base_url:(u=(c=l===null||l===void 0?void 0:l.server_url)!==null&&c!==void 0?c:e._baseURL)!==null&&u!==void 0?u:"",operation_id:"GetEnvironmentFiles",o_auth2_scopes:null,resolved_security:b,security_source:e._options.security,retry_config:(l===null||l===void 0?void 0:l.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(l===null||l===void 0?void 0:l.retry_codes)||["408","409","429","5XX"]},w=e._createRequest(R,{security:b,method:"GET",baseURL:l===null||l===void 0?void 0:l.server_url,path:_,headers:S,query:y,body:null,userAgent:e._options.user_agent,timeout_ms:(l===null||l===void 0?void 0:l.timeout_ms)||e._options.timeout_ms||-1},l);if(!w.ok)return[w,{status:"invalid"}];let T=w.value,C=await e._do(T,{context:R,isErrorStatusCode:(D)=>ot({status:D},["4XX","5XX"]),retryConfig:R.retry_config,retryCodes:R.retry_codes});if(!C.ok)return[C,{status:"request-error",request:T}];let A=C.value,[P]=await ft(_t(200),De("4XX"),De("5XX"))(A,T);if(!P.ok)return[P,{status:"complete",request:T,response:A}];return[P,{status:"complete",request:T,response:A}]}var G4=class extends fn{list(e,t,r,n){return ct(zb(this,e,t,r===null||r===void 0?void 0:r.api_version,r===null||r===void 0?void 0:r.page_size,r===null||r===void 0?void 0:r.page_token,r===null||r===void 0?void 0:r.recursive,n))}};function Vb(e,t,r,n,o,i,s,l,a,c,u){return new st(B4(e,t,r,n,o,i,s,l,a,c,u))}async function B4(e,t,r,n,o,i,s,l,a,c,u){var f,h,g;let _={environment:t,path:r,"X-Goog-Upload-Command":n,"X-Goog-Upload-Header-Content-Length":o,"X-Goog-Upload-Header-Content-Type":i,"X-Goog-Upload-Protocol":s,api_version:l,extract:a,overwrite:c},y=null,S={api_version:Oe("api_version",(f=_.api_version)!==null&&f!==void 0?f:e._options.api_version,{explode:!1,charEncoding:"percent"}),environment:Oe("environment",_.environment,{explode:!1,charEncoding:"percent"}),path:Oe("path",_.path,{explode:!1,charEncoding:"percentExceptReserved"})},E=it("/upload/{api_version}/environments/{environment}/files/{path}")(S),b=Lr({extract:_.extract,overwrite:_.overwrite}),R=new Headers(dt({Accept:"*/*","X-Goog-Upload-Command":Oe("X-Goog-Upload-Command",_["X-Goog-Upload-Command"],{explode:!1,charEncoding:"none"}),"X-Goog-Upload-Header-Content-Length":Oe("X-Goog-Upload-Header-Content-Length",_["X-Goog-Upload-Header-Content-Length"],{explode:!1,charEncoding:"none"}),"X-Goog-Upload-Header-Content-Type":Oe("X-Goog-Upload-Header-Content-Type",_["X-Goog-Upload-Header-Content-Type"],{explode:!1,charEncoding:"none"}),"X-Goog-Upload-Protocol":Oe("X-Goog-Upload-Protocol",_["X-Goog-Upload-Protocol"],{explode:!1,charEncoding:"none"})})),w=await ht(e._options.security),T=pt(w),C={options:e._options,base_url:(g=(h=u===null||u===void 0?void 0:u.server_url)!==null&&h!==void 0?h:e._baseURL)!==null&&g!==void 0?g:"",operation_id:"StartEnvironmentFileUpload",o_auth2_scopes:null,resolved_security:T,security_source:e._options.security,retry_config:(u===null||u===void 0?void 0:u.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(u===null||u===void 0?void 0:u.retry_codes)||["408","409","429","5XX"]},A=e._createRequest(C,{security:T,method:"PUT",baseURL:u===null||u===void 0?void 0:u.server_url,path:E,headers:R,query:b,body:null,userAgent:e._options.user_agent,timeout_ms:(u===null||u===void 0?void 0:u.timeout_ms)||e._options.timeout_ms||-1},u);if(!A.ok)return[A,{status:"invalid"}];let P=A.value,D=await e._do(P,{context:C,isErrorStatusCode:(B)=>ot({status:B},["4XX","5XX"]),retryConfig:C.retry_config,retryCodes:C.retry_codes});if(!D.ok)return[D,{status:"request-error",request:P}];let N=D.value,F={httpMeta:{response:N,request:P}},[G]=await ft(Pb(200,{hdrs:!0}),De("4XX"),De("5XX"))(N,P,{extraFields:F});if(!G.ok)return[G,{status:"complete",request:P,response:N}];return[G,{status:"complete",request:P,response:N}]}var H4=class extends fn{startUpload(e,t,r,n){return ct(Vb(this,e,t,r["X-Goog-Upload-Command"],r["X-Goog-Upload-Header-Content-Length"],r["X-Goog-Upload-Header-Content-Type"],r["X-Goog-Upload-Protocol"],r.api_version,r.extract,r.overwrite,n))}},z4=class extends fn{get internal(){var e;return(e=this._internal)!==null&&e!==void 0?e:this._internal=new H4(this._options)}get files(){var e;return(e=this._files)!==null&&e!==void 0?e:this._files=new G4(this._options)}listEnvironments(e,t){return ct(Hb(this,e===null||e===void 0?void 0:e.api_version,e===null||e===void 0?void 0:e.page_size,e===null||e===void 0?void 0:e.page_token,t))}createEnvironment(e,t,r){return ct(Fb(this,e,t,r))}deleteEnvironment(e,t,r){return ct(Gb(this,e,t===null||t===void 0?void 0:t.api_version,r))}getEnvironment(e,t,r){return ct(Bb(this,e,t===null||t===void 0?void 0:t.api_version,r))}},V4=class extends dn{constructor(e,t){var r;let n=((r=e.error)===null||r===void 0?void 0:r.message)||`API error occurred: ${JSON.stringify(e)}`;super(n,t);this.data$=e,this.error=e.error,this.name="CancelInteractionByIdServerError"}},j4=class extends dn{constructor(e,t){var r;let n=((r=e.error)===null||r===void 0?void 0:r.message)||`API error occurred: ${JSON.stringify(e)}`;super(n,t);this.data$=e,this.error=e.error,this.name="CancelInteractionByIdClientError"}},W4=class extends dn{constructor(e,t){var r;let n=((r=e.error)===null||r===void 0?void 0:r.message)||`API error occurred: ${JSON.stringify(e)}`;super(n,t);this.data$=e,this.error=e.error,this.name="CreateInteractionServerError"}},J4=class extends dn{constructor(e,t){var r;let n=((r=e.error)===null||r===void 0?void 0:r.message)||`API error occurred: ${JSON.stringify(e)}`;super(n,t);this.data$=e,this.error=e.error,this.name="CreateInteractionClientError"}},K4=class extends dn{constructor(e,t){var r;let n=((r=e.error)===null||r===void 0?void 0:r.message)||`API error occurred: ${JSON.stringify(e)}`;super(n,t);this.data$=e,this.error=e.error,this.name="DeleteInteractionServerError"}},X4=class extends dn{constructor(e,t){var r;let n=((r=e.error)===null||r===void 0?void 0:r.message)||`API error occurred: ${JSON.stringify(e)}`;super(n,t);this.data$=e,this.error=e.error,this.name="DeleteInteractionClientError"}},Y4=class extends dn{constructor(e,t){var r;let n=((r=e.error)===null||r===void 0?void 0:r.message)||`API error occurred: ${JSON.stringify(e)}`;super(n,t);this.data$=e,this.error=e.error,this.name="GetInteractionByIdServerError"}},Z4=class extends dn{constructor(e,t){var r;let n=((r=e.error)===null||r===void 0?void 0:r.message)||`API error occurred: ${JSON.stringify(e)}`;super(n,t);this.data$=e,this.error=e.error,this.name="GetInteractionByIdClientError"}};function jb(e,t,r,n){return new st(Q4(e,t,r,n))}async function Q4(e,t,r,n){var o,i,s;let a={id:t,api_version:r},c=null,u={api_version:Oe("api_version",(o=a.api_version)!==null&&o!==void 0?o:e._options.api_version,{explode:!1,charEncoding:"percent"}),interactionsId:Oe("interactionsId",a.id,{explode:!1,charEncoding:"percent"})},f=it("/{api_version}/interactions/{interactionsId}/cancel")(u),h=new Headers(dt({Accept:"application/json"})),g=await ht(e._options.security),p=pt(g),_={options:e._options,base_url:(s=(i=n===null||n===void 0?void 0:n.server_url)!==null&&i!==void 0?i:e._baseURL)!==null&&s!==void 0?s:"",operation_id:"cancelInteractionById",o_auth2_scopes:null,resolved_security:p,security_source:e._options.security,retry_config:(n===null||n===void 0?void 0:n.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(n===null||n===void 0?void 0:n.retry_codes)||["408","409","429","5XX"]},y=e._createRequest(_,{security:p,method:"POST",baseURL:n===null||n===void 0?void 0:n.server_url,path:f,headers:h,body:null,userAgent:e._options.user_agent,timeout_ms:(n===null||n===void 0?void 0:n.timeout_ms)||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let S=y.value,E=await e._do(S,{context:_,isErrorStatusCode:(T)=>ot({status:T},["4XX","5XX"]),retryConfig:_.retry_config,retryCodes:_.retry_codes});if(!E.ok)return[E,{status:"request-error",request:S}];let b=E.value,R={httpMeta:{response:b,request:S}},[w]=await ft(_t(200),mo("4XX",j4),mo("5XX",V4))(b,S,{extraFields:R});if(!w.ok)return[w,{status:"complete",request:S,response:b}];return[w,{status:"complete",request:S,response:b}]}function Wb(e,t,r,n){return new st(e2(e,t,r,n))}async function e2(e,t,r,n){var o,i,s,l;let a={body:t,api_version:r},c=a,u=xr("body",c.body,{explode:!0}),f={api_version:Oe("api_version",(o=c.api_version)!==null&&o!==void 0?o:e._options.api_version,{explode:!1,charEncoding:"percent"})},h=it("/{api_version}/interactions")(f),g=new Headers(dt({"Content-Type":"application/json",Accept:((i=a===null||a===void 0?void 0:a.body)===null||i===void 0?void 0:i.stream)?"text/event-stream":"application/json"})),p=await ht(e._options.security),_=pt(p),y={options:e._options,base_url:(l=(s=n===null||n===void 0?void 0:n.server_url)!==null&&s!==void 0?s:e._baseURL)!==null&&l!==void 0?l:"",operation_id:"CreateInteraction",o_auth2_scopes:null,resolved_security:_,security_source:e._options.security,retry_config:(n===null||n===void 0?void 0:n.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(n===null||n===void 0?void 0:n.retry_codes)||["408","409","429","5XX"]},S=e._createRequest(y,{security:_,method:"POST",baseURL:n===null||n===void 0?void 0:n.server_url,path:h,headers:g,body:u,userAgent:e._options.user_agent,timeout_ms:(n===null||n===void 0?void 0:n.timeout_ms)||e._options.timeout_ms||-1},n);if(!S.ok)return[S,{status:"invalid"}];let E=S.value,b=await e._do(E,{context:y,isErrorStatusCode:(C)=>ot({status:C},["4XX","5XX"]),retryConfig:y.retry_config,retryCodes:y.retry_codes});if(!b.ok)return[b,{status:"request-error",request:E}];let R=b.value,w={httpMeta:{response:R,request:E}},[T]=await ft(_t(200),Ib(200,{sentinel:"[DONE]",flattened:!0}),mo("4XX",J4),mo("5XX",W4))(R,E,{extraFields:w});if(!T.ok)return[T,{status:"complete",request:E,response:R}];return[T,{status:"complete",request:E,response:R}]}function t2(e,t,r,n){return new st(r2(e,t,r,n))}async function r2(e,t,r,n){var o,i,s;let a={id:t,api_version:r},c=null,u={api_version:Oe("api_version",(o=a.api_version)!==null&&o!==void 0?o:e._options.api_version,{explode:!1,charEncoding:"percent"}),interactionsId:Oe("interactionsId",a.id,{explode:!1,charEncoding:"percent"})},f=it("/{api_version}/interactions/{interactionsId}")(u),h=new Headers(dt({Accept:"application/json"})),g=await ht(e._options.security),p=pt(g),_={options:e._options,base_url:(s=(i=n===null||n===void 0?void 0:n.server_url)!==null&&i!==void 0?i:e._baseURL)!==null&&s!==void 0?s:"",operation_id:"deleteInteraction",o_auth2_scopes:null,resolved_security:p,security_source:e._options.security,retry_config:(n===null||n===void 0?void 0:n.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(n===null||n===void 0?void 0:n.retry_codes)||["408","409","429","5XX"]},y=e._createRequest(_,{security:p,method:"DELETE",baseURL:n===null||n===void 0?void 0:n.server_url,path:f,headers:h,body:null,userAgent:e._options.user_agent,timeout_ms:(n===null||n===void 0?void 0:n.timeout_ms)||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let S=y.value,E=await e._do(S,{context:_,isErrorStatusCode:(T)=>ot({status:T},["4XX","5XX"]),retryConfig:_.retry_config,retryCodes:_.retry_codes});if(!E.ok)return[E,{status:"request-error",request:S}];let b=E.value,R={httpMeta:{response:b,request:S}},[w]=await ft(Pb(200),mo("4XX",X4),mo("5XX",K4))(b,S,{extraFields:R});if(!w.ok)return[w,{status:"complete",request:S,response:b}];return[w,{status:"complete",request:S,response:b}]}function Jb(e,t,r,n,o,i,s){return new st(n2(e,t,r,n,o,i,s))}async function n2(e,t,r,n,o,i,s){var l,a,c;let u={id:t,api_version:r,include_input:n,last_event_id:o,stream:i},f=u,h=null,g={api_version:Oe("api_version",(l=f.api_version)!==null&&l!==void 0?l:e._options.api_version,{explode:!1,charEncoding:"percent"}),interactionsId:Oe("interactionsId",f.id,{explode:!1,charEncoding:"percent"})},p=it("/{api_version}/interactions/{interactionsId}")(g),_=Lr({include_input:f.include_input,last_event_id:f.last_event_id,stream:f.stream}),y=new Headers(dt({Accept:(u===null||u===void 0?void 0:u.stream)?"text/event-stream":"application/json"})),S=await ht(e._options.security),E=pt(S),b={options:e._options,base_url:(c=(a=s===null||s===void 0?void 0:s.server_url)!==null&&a!==void 0?a:e._baseURL)!==null&&c!==void 0?c:"",operation_id:"getInteractionById",o_auth2_scopes:null,resolved_security:E,security_source:e._options.security,retry_config:(s===null||s===void 0?void 0:s.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(s===null||s===void 0?void 0:s.retry_codes)||["408","409","429","5XX"]},R=e._createRequest(b,{security:E,method:"GET",baseURL:s===null||s===void 0?void 0:s.server_url,path:p,headers:y,query:_,body:null,userAgent:e._options.user_agent,timeout_ms:(s===null||s===void 0?void 0:s.timeout_ms)||e._options.timeout_ms||-1},s);if(!R.ok)return[R,{status:"invalid"}];let w=R.value,T=await e._do(w,{context:b,isErrorStatusCode:(D)=>ot({status:D},["4XX","5XX"]),retryConfig:b.retry_config,retryCodes:b.retry_codes});if(!T.ok)return[T,{status:"request-error",request:w}];let C=T.value,A={httpMeta:{response:C,request:w}},[P]=await ft(_t(200),Ib(200,{sentinel:"[DONE]",flattened:!0}),mo("4XX",Z4),mo("5XX",Y4))(C,w,{extraFields:A});if(!P.ok)return[P,{status:"complete",request:w,response:C}];return[P,{status:"complete",request:w,response:C}]}var o2=class extends fn{create(e,t){let{api_version:r}=e,n=$t(e,["api_version"]);return ct(Wb(this,n,r,t))}delete(e,t,r){return ct(t2(this,e,t===null||t===void 0?void 0:t.api_version,r))}get(e,t,r){return ct(Jb(this,e,t===null||t===void 0?void 0:t.api_version,t===null||t===void 0?void 0:t.include_input,t===null||t===void 0?void 0:t.last_event_id,t===null||t===void 0?void 0:t.stream,r))}cancel(e,t,r){return ct(jb(this,e,t===null||t===void 0?void 0:t.api_version,r))}};function Kb(e,t,r,n){return new st(i2(e,t,r,n))}async function i2(e,t,r,n){var o,i,s;let a={body:t,api_version:r},c=xr("body",a.body,{explode:!0}),u={api_version:Oe("api_version",(o=a.api_version)!==null&&o!==void 0?o:e._options.api_version,{explode:!1,charEncoding:"percent"})},f=it("/{api_version}/triggers")(u),h=new Headers(dt({"Content-Type":"application/json",Accept:"application/json"})),g=await ht(e._options.security),p=pt(g),_={options:e._options,base_url:(s=(i=n===null||n===void 0?void 0:n.server_url)!==null&&i!==void 0?i:e._baseURL)!==null&&s!==void 0?s:"",operation_id:"CreateTrigger",o_auth2_scopes:null,resolved_security:p,security_source:e._options.security,retry_config:(n===null||n===void 0?void 0:n.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(n===null||n===void 0?void 0:n.retry_codes)||["408","409","429","5XX"]},y=e._createRequest(_,{security:p,method:"POST",baseURL:n===null||n===void 0?void 0:n.server_url,path:f,headers:h,body:c,userAgent:e._options.user_agent,timeout_ms:(n===null||n===void 0?void 0:n.timeout_ms)||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let S=y.value,E=await e._do(S,{context:_,isErrorStatusCode:(w)=>ot({status:w},["4XX","5XX"]),retryConfig:_.retry_config,retryCodes:_.retry_codes});if(!E.ok)return[E,{status:"request-error",request:S}];let b=E.value,[R]=await ft(De("4XX"),De("5XX"),_t("default"))(b,S);if(!R.ok)return[R,{status:"complete",request:S,response:b}];return[R,{status:"complete",request:S,response:b}]}function Xb(e,t,r,n){return new st(s2(e,t,r,n))}async function s2(e,t,r,n){var o,i,s;let a={id:t,api_version:r},c=null,u={api_version:Oe("api_version",(o=a.api_version)!==null&&o!==void 0?o:e._options.api_version,{explode:!1,charEncoding:"percent"}),id:Oe("id",a.id,{explode:!1,charEncoding:"percent"})},f=it("/{api_version}/triggers/{id}")(u),h=new Headers(dt({Accept:"application/json"})),g=await ht(e._options.security),p=pt(g),_={options:e._options,base_url:(s=(i=n===null||n===void 0?void 0:n.server_url)!==null&&i!==void 0?i:e._baseURL)!==null&&s!==void 0?s:"",operation_id:"DeleteTrigger",o_auth2_scopes:null,resolved_security:p,security_source:e._options.security,retry_config:(n===null||n===void 0?void 0:n.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(n===null||n===void 0?void 0:n.retry_codes)||["408","409","429","5XX"]},y=e._createRequest(_,{security:p,method:"DELETE",baseURL:n===null||n===void 0?void 0:n.server_url,path:f,headers:h,body:null,userAgent:e._options.user_agent,timeout_ms:(n===null||n===void 0?void 0:n.timeout_ms)||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let S=y.value,E=await e._do(S,{context:_,isErrorStatusCode:(w)=>ot({status:w},["4XX","5XX"]),retryConfig:_.retry_config,retryCodes:_.retry_codes});if(!E.ok)return[E,{status:"request-error",request:S}];let b=E.value,[R]=await ft(De("4XX"),De("5XX"),_t("default"))(b,S);if(!R.ok)return[R,{status:"complete",request:S,response:b}];return[R,{status:"complete",request:S,response:b}]}function Yb(e,t,r,n){return new st(a2(e,t,r,n))}async function a2(e,t,r,n){var o,i,s;let a={id:t,api_version:r},c=null,u={api_version:Oe("api_version",(o=a.api_version)!==null&&o!==void 0?o:e._options.api_version,{explode:!1,charEncoding:"percent"}),id:Oe("id",a.id,{explode:!1,charEncoding:"percent"})},f=it("/{api_version}/triggers/{id}")(u),h=new Headers(dt({Accept:"application/json"})),g=await ht(e._options.security),p=pt(g),_={options:e._options,base_url:(s=(i=n===null||n===void 0?void 0:n.server_url)!==null&&i!==void 0?i:e._baseURL)!==null&&s!==void 0?s:"",operation_id:"GetTrigger",o_auth2_scopes:null,resolved_security:p,security_source:e._options.security,retry_config:(n===null||n===void 0?void 0:n.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(n===null||n===void 0?void 0:n.retry_codes)||["408","409","429","5XX"]},y=e._createRequest(_,{security:p,method:"GET",baseURL:n===null||n===void 0?void 0:n.server_url,path:f,headers:h,body:null,userAgent:e._options.user_agent,timeout_ms:(n===null||n===void 0?void 0:n.timeout_ms)||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let S=y.value,E=await e._do(S,{context:_,isErrorStatusCode:(w)=>ot({status:w},["4XX","5XX"]),retryConfig:_.retry_config,retryCodes:_.retry_codes});if(!E.ok)return[E,{status:"request-error",request:S}];let b=E.value,[R]=await ft(De("4XX"),De("5XX"),_t("default"))(b,S);if(!R.ok)return[R,{status:"complete",request:S,response:b}];return[R,{status:"complete",request:S,response:b}]}function Zb(e,t,r,n,o,i){return new st(l2(e,t,r,n,o,i))}async function l2(e,t,r,n,o,i){var s,l,a;let u={trigger_id:t,api_version:r,page_size:n,page_token:o},f=null,h={api_version:Oe("api_version",(s=u.api_version)!==null&&s!==void 0?s:e._options.api_version,{explode:!1,charEncoding:"percent"}),triggerId:Oe("triggerId",u.trigger_id,{explode:!1,charEncoding:"percent"})},g=it("/{api_version}/triggers/{triggerId}/executions")(h),p=Lr({page_size:u.page_size,page_token:u.page_token}),_=new Headers(dt({Accept:"application/json"})),y=await ht(e._options.security),S=pt(y),E={options:e._options,base_url:(a=(l=i===null||i===void 0?void 0:i.server_url)!==null&&l!==void 0?l:e._baseURL)!==null&&a!==void 0?a:"",operation_id:"ListTriggerExecutions",o_auth2_scopes:null,resolved_security:S,security_source:e._options.security,retry_config:(i===null||i===void 0?void 0:i.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(i===null||i===void 0?void 0:i.retry_codes)||["408","409","429","5XX"]},b=e._createRequest(E,{security:S,method:"GET",baseURL:i===null||i===void 0?void 0:i.server_url,path:g,headers:_,query:p,body:null,userAgent:e._options.user_agent,timeout_ms:(i===null||i===void 0?void 0:i.timeout_ms)||e._options.timeout_ms||-1},i);if(!b.ok)return[b,{status:"invalid"}];let R=b.value,w=await e._do(R,{context:E,isErrorStatusCode:(A)=>ot({status:A},["4XX","5XX"]),retryConfig:E.retry_config,retryCodes:E.retry_codes});if(!w.ok)return[w,{status:"request-error",request:R}];let T=w.value,[C]=await ft(De("4XX"),De("5XX"),_t("default"))(T,R);if(!C.ok)return[C,{status:"complete",request:R,response:T}];return[C,{status:"complete",request:R,response:T}]}function Qb(e,t,r,n,o,i){return new st(c2(e,t,r,n,o,i))}async function c2(e,t,r,n,o,i){var s,l,a;let u={api_version:t,filter:r,page_size:n,page_token:o},f=null,h={api_version:Oe("api_version",(s=u===null||u===void 0?void 0:u.api_version)!==null&&s!==void 0?s:e._options.api_version,{explode:!1,charEncoding:"percent"})},g=it("/{api_version}/triggers")(h),p=Lr({filter:u===null||u===void 0?void 0:u.filter,page_size:u===null||u===void 0?void 0:u.page_size,page_token:u===null||u===void 0?void 0:u.page_token}),_=new Headers(dt({Accept:"application/json"})),y=await ht(e._options.security),S=pt(y),E={options:e._options,base_url:(a=(l=i===null||i===void 0?void 0:i.server_url)!==null&&l!==void 0?l:e._baseURL)!==null&&a!==void 0?a:"",operation_id:"ListTriggers",o_auth2_scopes:null,resolved_security:S,security_source:e._options.security,retry_config:(i===null||i===void 0?void 0:i.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(i===null||i===void 0?void 0:i.retry_codes)||["408","409","429","5XX"]},b=e._createRequest(E,{security:S,method:"GET",baseURL:i===null||i===void 0?void 0:i.server_url,path:g,headers:_,query:p,body:null,userAgent:e._options.user_agent,timeout_ms:(i===null||i===void 0?void 0:i.timeout_ms)||e._options.timeout_ms||-1},i);if(!b.ok)return[b,{status:"invalid"}];let R=b.value,w=await e._do(R,{context:E,isErrorStatusCode:(A)=>ot({status:A},["4XX","5XX"]),retryConfig:E.retry_config,retryCodes:E.retry_codes});if(!w.ok)return[w,{status:"request-error",request:R}];let T=w.value,[C]=await ft(De("4XX"),De("5XX"),_t("default"))(T,R);if(!C.ok)return[C,{status:"complete",request:R,response:T}];return[C,{status:"complete",request:R,response:T}]}function ew(e,t,r,n){return new st(u2(e,t,r,n))}async function u2(e,t,r,n){var o,i,s;let a={trigger_id:t,api_version:r},c=null,u={api_version:Oe("api_version",(o=a.api_version)!==null&&o!==void 0?o:e._options.api_version,{explode:!1,charEncoding:"percent"}),triggerId:Oe("triggerId",a.trigger_id,{explode:!1,charEncoding:"percent"})},f=it("/{api_version}/triggers/{triggerId}/executions")(u),h=new Headers(dt({Accept:"application/json"})),g=await ht(e._options.security),p=pt(g),_={options:e._options,base_url:(s=(i=n===null||n===void 0?void 0:n.server_url)!==null&&i!==void 0?i:e._baseURL)!==null&&s!==void 0?s:"",operation_id:"RunTrigger",o_auth2_scopes:null,resolved_security:p,security_source:e._options.security,retry_config:(n===null||n===void 0?void 0:n.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(n===null||n===void 0?void 0:n.retry_codes)||["408","409","429","5XX"]},y=e._createRequest(_,{security:p,method:"POST",baseURL:n===null||n===void 0?void 0:n.server_url,path:f,headers:h,body:null,userAgent:e._options.user_agent,timeout_ms:(n===null||n===void 0?void 0:n.timeout_ms)||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let S=y.value,E=await e._do(S,{context:_,isErrorStatusCode:(w)=>ot({status:w},["4XX","5XX"]),retryConfig:_.retry_config,retryCodes:_.retry_codes});if(!E.ok)return[E,{status:"request-error",request:S}];let b=E.value,[R]=await ft(De("4XX"),De("5XX"),_t("default"))(b,S);if(!R.ok)return[R,{status:"complete",request:S,response:b}];return[R,{status:"complete",request:S,response:b}]}function tw(e,t,r,n,o){return new st(d2(e,t,r,n,o))}async function d2(e,t,r,n,o){var i,s,l;let c={id:t,body:r,api_version:n},u=xr("body",c.body,{explode:!0}),f={api_version:Oe("api_version",(i=c.api_version)!==null&&i!==void 0?i:e._options.api_version,{explode:!1,charEncoding:"percent"}),id:Oe("id",c.id,{explode:!1,charEncoding:"percent"})},h=it("/{api_version}/triggers/{id}")(f),g=new Headers(dt({"Content-Type":"application/json",Accept:"application/json"})),p=await ht(e._options.security),_=pt(p),y={options:e._options,base_url:(l=(s=o===null||o===void 0?void 0:o.server_url)!==null&&s!==void 0?s:e._baseURL)!==null&&l!==void 0?l:"",operation_id:"UpdateTrigger",o_auth2_scopes:null,resolved_security:_,security_source:e._options.security,retry_config:(o===null||o===void 0?void 0:o.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(o===null||o===void 0?void 0:o.retry_codes)||["408","409","429","5XX"]},S=e._createRequest(y,{security:_,method:"PATCH",baseURL:o===null||o===void 0?void 0:o.server_url,path:h,headers:g,body:u,userAgent:e._options.user_agent,timeout_ms:(o===null||o===void 0?void 0:o.timeout_ms)||e._options.timeout_ms||-1},o);if(!S.ok)return[S,{status:"invalid"}];let E=S.value,b=await e._do(E,{context:y,isErrorStatusCode:(T)=>ot({status:T},["4XX","5XX"]),retryConfig:y.retry_config,retryCodes:y.retry_codes});if(!b.ok)return[b,{status:"request-error",request:E}];let R=b.value,[w]=await ft(De("4XX"),De("5XX"),_t("default"))(R,E);if(!w.ok)return[w,{status:"complete",request:E,response:R}];return[w,{status:"complete",request:E,response:R}]}var f2=class extends fn{list(e,t){return ct(Qb(this,e===null||e===void 0?void 0:e.api_version,e===null||e===void 0?void 0:e.filter,e===null||e===void 0?void 0:e.page_size,e===null||e===void 0?void 0:e.page_token,t))}create(e,t){let{api_version:r}=e,n=$t(e,["api_version"]);return ct(Kb(this,n,r,t))}delete(e,t,r){return ct(Xb(this,e,t===null||t===void 0?void 0:t.api_version,r))}get(e,t,r){return ct(Yb(this,e,t===null||t===void 0?void 0:t.api_version,r))}update(e,t,r){let{api_version:n}=t,o=$t(t,["api_version"]);return ct(tw(this,e,o,n,r))}listExecutions(e,t,r){return ct(Zb(this,e,t===null||t===void 0?void 0:t.api_version,t===null||t===void 0?void 0:t.page_size,t===null||t===void 0?void 0:t.page_token,r))}run(e,t,r){return ct(ew(this,e,t===null||t===void 0?void 0:t.api_version,r))}};function rw(e,t,r,n){return new st(p2(e,t,r,n))}async function p2(e,t,r,n){var o,i,s;let a={body:t,api_version:r},c=xr("body",a.body,{explode:!0}),u={api_version:Oe("api_version",(o=a.api_version)!==null&&o!==void 0?o:e._options.api_version,{explode:!1,charEncoding:"percent"})},f=it("/{api_version}/voices")(u),h=new Headers(dt({"Content-Type":"application/json",Accept:"application/json"})),g=await ht(e._options.security),p=pt(g),_={options:e._options,base_url:(s=(i=n===null||n===void 0?void 0:n.server_url)!==null&&i!==void 0?i:e._baseURL)!==null&&s!==void 0?s:"",operation_id:"CreateVoice",o_auth2_scopes:null,resolved_security:p,security_source:e._options.security,retry_config:(n===null||n===void 0?void 0:n.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(n===null||n===void 0?void 0:n.retry_codes)||["408","409","429","5XX"]},y=e._createRequest(_,{security:p,method:"POST",baseURL:n===null||n===void 0?void 0:n.server_url,path:f,headers:h,body:c,userAgent:e._options.user_agent,timeout_ms:(n===null||n===void 0?void 0:n.timeout_ms)||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let S=y.value,E=await e._do(S,{context:_,isErrorStatusCode:(w)=>ot({status:w},["4XX","5XX"]),retryConfig:_.retry_config,retryCodes:_.retry_codes});if(!E.ok)return[E,{status:"request-error",request:S}];let b=E.value,[R]=await ft(De("4XX"),De("5XX"),_t("default"))(b,S);if(!R.ok)return[R,{status:"complete",request:S,response:b}];return[R,{status:"complete",request:S,response:b}]}function nw(e,t,r,n){return new st(h2(e,t,r,n))}async function h2(e,t,r,n){var o,i,s;let a={id:t,api_version:r},c=null,u={api_version:Oe("api_version",(o=a.api_version)!==null&&o!==void 0?o:e._options.api_version,{explode:!1,charEncoding:"percent"}),voicesId:Oe("voicesId",a.id,{explode:!1,charEncoding:"percent"})},f=it("/{api_version}/voices/{voicesId}")(u),h=new Headers(dt({Accept:"application/json"})),g=await ht(e._options.security),p=pt(g),_={options:e._options,base_url:(s=(i=n===null||n===void 0?void 0:n.server_url)!==null&&i!==void 0?i:e._baseURL)!==null&&s!==void 0?s:"",operation_id:"DeleteVoice",o_auth2_scopes:null,resolved_security:p,security_source:e._options.security,retry_config:(n===null||n===void 0?void 0:n.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(n===null||n===void 0?void 0:n.retry_codes)||["408","409","429","5XX"]},y=e._createRequest(_,{security:p,method:"DELETE",baseURL:n===null||n===void 0?void 0:n.server_url,path:f,headers:h,body:null,userAgent:e._options.user_agent,timeout_ms:(n===null||n===void 0?void 0:n.timeout_ms)||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let S=y.value,E=await e._do(S,{context:_,isErrorStatusCode:(w)=>ot({status:w},["4XX","5XX"]),retryConfig:_.retry_config,retryCodes:_.retry_codes});if(!E.ok)return[E,{status:"request-error",request:S}];let b=E.value,[R]=await ft(De("4XX"),De("5XX"),_t("default"))(b,S);if(!R.ok)return[R,{status:"complete",request:S,response:b}];return[R,{status:"complete",request:S,response:b}]}function ow(e,t,r,n){return new st(m2(e,t,r,n))}async function m2(e,t,r,n){var o,i,s;let a={id:t,api_version:r},c=null,u={api_version:Oe("api_version",(o=a.api_version)!==null&&o!==void 0?o:e._options.api_version,{explode:!1,charEncoding:"percent"}),voicesId:Oe("voicesId",a.id,{explode:!1,charEncoding:"percent"})},f=it("/{api_version}/voices/{voicesId}")(u),h=new Headers(dt({Accept:"application/json"})),g=await ht(e._options.security),p=pt(g),_={options:e._options,base_url:(s=(i=n===null||n===void 0?void 0:n.server_url)!==null&&i!==void 0?i:e._baseURL)!==null&&s!==void 0?s:"",operation_id:"GetVoice",o_auth2_scopes:null,resolved_security:p,security_source:e._options.security,retry_config:(n===null||n===void 0?void 0:n.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(n===null||n===void 0?void 0:n.retry_codes)||["408","409","429","5XX"]},y=e._createRequest(_,{security:p,method:"GET",baseURL:n===null||n===void 0?void 0:n.server_url,path:f,headers:h,body:null,userAgent:e._options.user_agent,timeout_ms:(n===null||n===void 0?void 0:n.timeout_ms)||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let S=y.value,E=await e._do(S,{context:_,isErrorStatusCode:(w)=>ot({status:w},["4XX","5XX"]),retryConfig:_.retry_config,retryCodes:_.retry_codes});if(!E.ok)return[E,{status:"request-error",request:S}];let b=E.value,[R]=await ft(De("4XX"),De("5XX"),_t("default"))(b,S);if(!R.ok)return[R,{status:"complete",request:S,response:b}];return[R,{status:"complete",request:S,response:b}]}function iw(e,t,r,n,o,i,s,l,a,c,u,f,h,g){return new st(g2(e,t,r,n,o,i,s,l,a,c,u,f,h,g))}async function g2(e,t,r,n,o,i,s,l,a,c,u,f,h,g){var p,_,y;let E={api_version:t,accent:r,contexts:n,gender:o,language_code:i,page_size:s,page_token:l,persona:a,pitch:c,region_code:u,search:f,type:h},b=null,R={api_version:Oe("api_version",(p=E===null||E===void 0?void 0:E.api_version)!==null&&p!==void 0?p:e._options.api_version,{explode:!1,charEncoding:"percent"})},w=it("/{api_version}/voices")(R),T=Lr({accent:E===null||E===void 0?void 0:E.accent,context:E===null||E===void 0?void 0:E.contexts,gender:E===null||E===void 0?void 0:E.gender,language_code:E===null||E===void 0?void 0:E.language_code,page_size:E===null||E===void 0?void 0:E.page_size,page_token:E===null||E===void 0?void 0:E.page_token,persona:E===null||E===void 0?void 0:E.persona,pitch:E===null||E===void 0?void 0:E.pitch,region_code:E===null||E===void 0?void 0:E.region_code,search:E===null||E===void 0?void 0:E.search,type:E===null||E===void 0?void 0:E.type}),C=new Headers(dt({Accept:"application/json"})),A=await ht(e._options.security),P=pt(A),D={options:e._options,base_url:(y=(_=g===null||g===void 0?void 0:g.server_url)!==null&&_!==void 0?_:e._baseURL)!==null&&y!==void 0?y:"",operation_id:"ListVoices",o_auth2_scopes:null,resolved_security:P,security_source:e._options.security,retry_config:(g===null||g===void 0?void 0:g.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(g===null||g===void 0?void 0:g.retry_codes)||["408","409","429","5XX"]},N=e._createRequest(D,{security:P,method:"GET",baseURL:g===null||g===void 0?void 0:g.server_url,path:w,headers:C,query:T,body:null,userAgent:e._options.user_agent,timeout_ms:(g===null||g===void 0?void 0:g.timeout_ms)||e._options.timeout_ms||-1},g);if(!N.ok)return[N,{status:"invalid"}];let F=N.value,G=await e._do(F,{context:D,isErrorStatusCode:(pe)=>ot({status:pe},["4XX","5XX"]),retryConfig:D.retry_config,retryCodes:D.retry_codes});if(!G.ok)return[G,{status:"request-error",request:F}];let B=G.value,[Q]=await ft(De("4XX"),De("5XX"),_t("default"))(B,F);if(!Q.ok)return[Q,{status:"complete",request:F,response:B}];return[Q,{status:"complete",request:F,response:B}]}var v2=class extends fn{list(e,t){return ct(iw(this,e===null||e===void 0?void 0:e.api_version,e===null||e===void 0?void 0:e.accent,e===null||e===void 0?void 0:e.contexts,e===null||e===void 0?void 0:e.gender,e===null||e===void 0?void 0:e.language_code,e===null||e===void 0?void 0:e.page_size,e===null||e===void 0?void 0:e.page_token,e===null||e===void 0?void 0:e.persona,e===null||e===void 0?void 0:e.pitch,e===null||e===void 0?void 0:e.region_code,e===null||e===void 0?void 0:e.search,e===null||e===void 0?void 0:e.type,t))}create(e,t,r){return ct(rw(this,e,t,r))}delete(e,t,r){return ct(nw(this,e,t===null||t===void 0?void 0:t.api_version,r))}get(e,t,r){return ct(ow(this,e,t===null||t===void 0?void 0:t.api_version,r))}};function sw(e,t,r,n){return new st(_2(e,t,r,n))}async function _2(e,t,r,n){var o,i,s;let a={body:t,api_version:r},c=xr("body",a.body,{explode:!0}),u={api_version:Oe("api_version",(o=a.api_version)!==null&&o!==void 0?o:e._options.api_version,{explode:!1,charEncoding:"percent"})},f=it("/{api_version}/webhooks")(u),h=new Headers(dt({"Content-Type":"application/json",Accept:"application/json"})),g=await ht(e._options.security),p=pt(g),_={options:e._options,base_url:(s=(i=n===null||n===void 0?void 0:n.server_url)!==null&&i!==void 0?i:e._baseURL)!==null&&s!==void 0?s:"",operation_id:"CreateWebhook",o_auth2_scopes:null,resolved_security:p,security_source:e._options.security,retry_config:(n===null||n===void 0?void 0:n.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(n===null||n===void 0?void 0:n.retry_codes)||["408","409","429","5XX"]},y=e._createRequest(_,{security:p,method:"POST",baseURL:n===null||n===void 0?void 0:n.server_url,path:f,headers:h,body:c,userAgent:e._options.user_agent,timeout_ms:(n===null||n===void 0?void 0:n.timeout_ms)||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let S=y.value,E=await e._do(S,{context:_,isErrorStatusCode:(w)=>ot({status:w},["4XX","5XX"]),retryConfig:_.retry_config,retryCodes:_.retry_codes});if(!E.ok)return[E,{status:"request-error",request:S}];let b=E.value,[R]=await ft(De("4XX"),De("5XX"),_t("default"))(b,S);if(!R.ok)return[R,{status:"complete",request:S,response:b}];return[R,{status:"complete",request:S,response:b}]}function aw(e,t,r,n){return new st(y2(e,t,r,n))}async function y2(e,t,r,n){var o,i,s;let a={id:t,api_version:r},c=null,u={api_version:Oe("api_version",(o=a.api_version)!==null&&o!==void 0?o:e._options.api_version,{explode:!1,charEncoding:"percent"}),id:Oe("id",a.id,{explode:!1,charEncoding:"percent"})},f=it("/{api_version}/webhooks/{id}")(u),h=new Headers(dt({Accept:"application/json"})),g=await ht(e._options.security),p=pt(g),_={options:e._options,base_url:(s=(i=n===null||n===void 0?void 0:n.server_url)!==null&&i!==void 0?i:e._baseURL)!==null&&s!==void 0?s:"",operation_id:"DeleteWebhook",o_auth2_scopes:null,resolved_security:p,security_source:e._options.security,retry_config:(n===null||n===void 0?void 0:n.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(n===null||n===void 0?void 0:n.retry_codes)||["408","409","429","5XX"]},y=e._createRequest(_,{security:p,method:"DELETE",baseURL:n===null||n===void 0?void 0:n.server_url,path:f,headers:h,body:null,userAgent:e._options.user_agent,timeout_ms:(n===null||n===void 0?void 0:n.timeout_ms)||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let S=y.value,E=await e._do(S,{context:_,isErrorStatusCode:(w)=>ot({status:w},["4XX","5XX"]),retryConfig:_.retry_config,retryCodes:_.retry_codes});if(!E.ok)return[E,{status:"request-error",request:S}];let b=E.value,[R]=await ft(De("4XX"),De("5XX"),_t("default"))(b,S);if(!R.ok)return[R,{status:"complete",request:S,response:b}];return[R,{status:"complete",request:S,response:b}]}function lw(e,t,r,n){return new st(S2(e,t,r,n))}async function S2(e,t,r,n){var o,i,s;let a={id:t,api_version:r},c=null,u={api_version:Oe("api_version",(o=a.api_version)!==null&&o!==void 0?o:e._options.api_version,{explode:!1,charEncoding:"percent"}),id:Oe("id",a.id,{explode:!1,charEncoding:"percent"})},f=it("/{api_version}/webhooks/{id}")(u),h=new Headers(dt({Accept:"application/json"})),g=await ht(e._options.security),p=pt(g),_={options:e._options,base_url:(s=(i=n===null||n===void 0?void 0:n.server_url)!==null&&i!==void 0?i:e._baseURL)!==null&&s!==void 0?s:"",operation_id:"GetWebhook",o_auth2_scopes:null,resolved_security:p,security_source:e._options.security,retry_config:(n===null||n===void 0?void 0:n.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(n===null||n===void 0?void 0:n.retry_codes)||["408","409","429","5XX"]},y=e._createRequest(_,{security:p,method:"GET",baseURL:n===null||n===void 0?void 0:n.server_url,path:f,headers:h,body:null,userAgent:e._options.user_agent,timeout_ms:(n===null||n===void 0?void 0:n.timeout_ms)||e._options.timeout_ms||-1},n);if(!y.ok)return[y,{status:"invalid"}];let S=y.value,E=await e._do(S,{context:_,isErrorStatusCode:(w)=>ot({status:w},["4XX","5XX"]),retryConfig:_.retry_config,retryCodes:_.retry_codes});if(!E.ok)return[E,{status:"request-error",request:S}];let b=E.value,[R]=await ft(De("4XX"),De("5XX"),_t("default"))(b,S);if(!R.ok)return[R,{status:"complete",request:S,response:b}];return[R,{status:"complete",request:S,response:b}]}function cw(e,t,r,n,o){return new st(E2(e,t,r,n,o))}async function E2(e,t,r,n,o){var i,s,l;let c={api_version:t,page_size:r,page_token:n},u=null,f={api_version:Oe("api_version",(i=c===null||c===void 0?void 0:c.api_version)!==null&&i!==void 0?i:e._options.api_version,{explode:!1,charEncoding:"percent"})},h=it("/{api_version}/webhooks")(f),g=Lr({page_size:c===null||c===void 0?void 0:c.page_size,page_token:c===null||c===void 0?void 0:c.page_token}),p=new Headers(dt({Accept:"application/json"})),_=await ht(e._options.security),y=pt(_),S={options:e._options,base_url:(l=(s=o===null||o===void 0?void 0:o.server_url)!==null&&s!==void 0?s:e._baseURL)!==null&&l!==void 0?l:"",operation_id:"ListWebhooks",o_auth2_scopes:null,resolved_security:y,security_source:e._options.security,retry_config:(o===null||o===void 0?void 0:o.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(o===null||o===void 0?void 0:o.retry_codes)||["408","409","429","5XX"]},E=e._createRequest(S,{security:y,method:"GET",baseURL:o===null||o===void 0?void 0:o.server_url,path:h,headers:p,query:g,body:null,userAgent:e._options.user_agent,timeout_ms:(o===null||o===void 0?void 0:o.timeout_ms)||e._options.timeout_ms||-1},o);if(!E.ok)return[E,{status:"invalid"}];let b=E.value,R=await e._do(b,{context:S,isErrorStatusCode:(C)=>ot({status:C},["4XX","5XX"]),retryConfig:S.retry_config,retryCodes:S.retry_codes});if(!R.ok)return[R,{status:"request-error",request:b}];let w=R.value,[T]=await ft(De("4XX"),De("5XX"),_t("default"))(w,b);if(!T.ok)return[T,{status:"complete",request:b,response:w}];return[T,{status:"complete",request:b,response:w}]}function uw(e,t,r,n,o){return new st(b2(e,t,r,n,o))}async function b2(e,t,r,n,o){var i,s,l;let c={id:t,api_version:r,body:n},u=xr("body",c.body,{explode:!0}),f={api_version:Oe("api_version",(i=c.api_version)!==null&&i!==void 0?i:e._options.api_version,{explode:!1,charEncoding:"percent"}),id:Oe("id",c.id,{explode:!1,charEncoding:"percent"})},h=it("/{api_version}/webhooks/{id}:ping")(f),g=new Headers(dt({"Content-Type":"application/json",Accept:"application/json"})),p=await ht(e._options.security),_=pt(p),y={options:e._options,base_url:(l=(s=o===null||o===void 0?void 0:o.server_url)!==null&&s!==void 0?s:e._baseURL)!==null&&l!==void 0?l:"",operation_id:"PingWebhook",o_auth2_scopes:null,resolved_security:_,security_source:e._options.security,retry_config:(o===null||o===void 0?void 0:o.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(o===null||o===void 0?void 0:o.retry_codes)||["408","409","429","5XX"]},S=e._createRequest(y,{security:_,method:"POST",baseURL:o===null||o===void 0?void 0:o.server_url,path:h,headers:g,body:u,userAgent:e._options.user_agent,timeout_ms:(o===null||o===void 0?void 0:o.timeout_ms)||e._options.timeout_ms||-1},o);if(!S.ok)return[S,{status:"invalid"}];let E=S.value,b=await e._do(E,{context:y,isErrorStatusCode:(T)=>ot({status:T},["4XX","5XX"]),retryConfig:y.retry_config,retryCodes:y.retry_codes});if(!b.ok)return[b,{status:"request-error",request:E}];let R=b.value,[w]=await ft(De("4XX"),De("5XX"),_t("default"))(R,E);if(!w.ok)return[w,{status:"complete",request:E,response:R}];return[w,{status:"complete",request:E,response:R}]}function dw(e,t,r,n,o){return new st(w2(e,t,r,n,o))}async function w2(e,t,r,n,o){var i,s,l;let c={id:t,api_version:r,body:n},u=xr("body",c.body,{explode:!0}),f={api_version:Oe("api_version",(i=c.api_version)!==null&&i!==void 0?i:e._options.api_version,{explode:!1,charEncoding:"percent"}),id:Oe("id",c.id,{explode:!1,charEncoding:"percent"})},h=it("/{api_version}/webhooks/{id}:rotateSigningSecret")(f),g=new Headers(dt({"Content-Type":"application/json",Accept:"application/json"})),p=await ht(e._options.security),_=pt(p),y={options:e._options,base_url:(l=(s=o===null||o===void 0?void 0:o.server_url)!==null&&s!==void 0?s:e._baseURL)!==null&&l!==void 0?l:"",operation_id:"RotateSigningSecret",o_auth2_scopes:null,resolved_security:_,security_source:e._options.security,retry_config:(o===null||o===void 0?void 0:o.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(o===null||o===void 0?void 0:o.retry_codes)||["408","409","429","5XX"]},S=e._createRequest(y,{security:_,method:"POST",baseURL:o===null||o===void 0?void 0:o.server_url,path:h,headers:g,body:u,userAgent:e._options.user_agent,timeout_ms:(o===null||o===void 0?void 0:o.timeout_ms)||e._options.timeout_ms||-1},o);if(!S.ok)return[S,{status:"invalid"}];let E=S.value,b=await e._do(E,{context:y,isErrorStatusCode:(T)=>ot({status:T},["4XX","5XX"]),retryConfig:y.retry_config,retryCodes:y.retry_codes});if(!b.ok)return[b,{status:"request-error",request:E}];let R=b.value,[w]=await ft(De("4XX"),De("5XX"),_t("default"))(R,E);if(!w.ok)return[w,{status:"complete",request:E,response:R}];return[w,{status:"complete",request:E,response:R}]}function fw(e,t,r,n,o,i){return new st(T2(e,t,r,n,o,i))}async function T2(e,t,r,n,o,i){var s,l,a;let u={id:t,api_version:r,update_mask:n,body:o},f=xr("body",u.body,{explode:!0}),h={api_version:Oe("api_version",(s=u.api_version)!==null&&s!==void 0?s:e._options.api_version,{explode:!1,charEncoding:"percent"}),id:Oe("id",u.id,{explode:!1,charEncoding:"percent"})},g=it("/{api_version}/webhooks/{id}")(h),p=Lr({update_mask:u.update_mask}),_=new Headers(dt({"Content-Type":"application/json",Accept:"application/json"})),y=await ht(e._options.security),S=pt(y),E={options:e._options,base_url:(a=(l=i===null||i===void 0?void 0:i.server_url)!==null&&l!==void 0?l:e._baseURL)!==null&&a!==void 0?a:"",operation_id:"UpdateWebhook",o_auth2_scopes:null,resolved_security:S,security_source:e._options.security,retry_config:(i===null||i===void 0?void 0:i.retries)||e._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8000,exponent:2,maxElapsedTime:30000},retryConnectionErrors:!0,maxRetries:4},retry_codes:(i===null||i===void 0?void 0:i.retry_codes)||["408","409","429","5XX"]},b=e._createRequest(E,{security:S,method:"PATCH",baseURL:i===null||i===void 0?void 0:i.server_url,path:g,headers:_,query:p,body:f,userAgent:e._options.user_agent,timeout_ms:(i===null||i===void 0?void 0:i.timeout_ms)||e._options.timeout_ms||-1},i);if(!b.ok)return[b,{status:"invalid"}];let R=b.value,w=await e._do(R,{context:E,isErrorStatusCode:(A)=>ot({status:A},["4XX","5XX"]),retryConfig:E.retry_config,retryCodes:E.retry_codes});if(!w.ok)return[w,{status:"request-error",request:R}];let T=w.value,[C]=await ft(De("4XX"),De("5XX"),_t("default"))(T,R);if(!C.ok)return[C,{status:"complete",request:R,response:T}];return[C,{status:"complete",request:R,response:T}]}var C2=class extends fn{list(e,t){return ct(cw(this,e===null||e===void 0?void 0:e.api_version,e===null||e===void 0?void 0:e.page_size,e===null||e===void 0?void 0:e.page_token,t))}create(e,t){let{api_version:r}=e,n=$t(e,["api_version"]);return ct(sw(this,n,r,t))}delete(e,t,r){return ct(aw(this,e,t===null||t===void 0?void 0:t.api_version,r))}get(e,t,r){return ct(lw(this,e,t===null||t===void 0?void 0:t.api_version,r))}update(e,t,r){let n=t!==null&&t!==void 0?t:{},{api_version:o,update_mask:i}=n,s=$t(n,["api_version","update_mask"]),l=t===void 0||Object.keys(s).length===0?void 0:s;return ct(fw(this,e,o,i,l,r))}ping(e,t,r,n){return ct(uw(this,e,t,r,n))}rotateSigningSecret(e,t,r,n){return ct(dw(this,e,t,r,n))}},R2=class e extends fn{get environments(){var t;return(t=this._environments)!==null&&t!==void 0?t:this._environments=new z4(this._options)}get agents(){var t;return(t=this._agents)!==null&&t!==void 0?t:this._agents=new P4(this._options)}get credentials(){var t;return(t=this._credentials)!==null&&t!==void 0?t:this._credentials=new $4(this._options)}get interactions(){var t;return(t=this._interactions)!==null&&t!==void 0?t:this._interactions=new o2(this._options)}get triggers(){var t;return(t=this._triggers)!==null&&t!==void 0?t:this._triggers=new f2(this._options)}get voices(){var t;return(t=this._voices)!==null&&t!==void 0?t:this._voices=new v2(this._options)}get webhooks(){var t;return(t=this._webhooks)!==null&&t!==void 0?t:this._webhooks=new C2(this._options)}},A2=new Set(["lyria-3-pro-preview","lyria-3-clip-preview"]);function I2(e){let t=e.getBaseUrl();if(!t)throw Error("Base URL must be set.");return t.replace(/\/+$/,"")}function P2(e){let t=D2(e.getApiVersion()),r=e.getProject(),n=e.getLocation();if(e.isVertexAI()&&t&&r&&n)return`${t}/projects/${encodeURIComponent(r)}/locations/${encodeURIComponent(n)}`;return t}function gr(e,t={}){var r,n,o,i,s,l,a;let c=t.http_client?void 0:(r=e.getFetch)===null||r===void 0?void 0:r.call(e),u=(n=t.http_client)!==null&&n!==void 0?n:c?new hb({fetcher:c}):void 0;return new R2(Object.assign(Object.assign({},t),{http_client:u,api_version:(o=t.api_version)!==null&&o!==void 0?o:P2(e),security:(i=t.security)!==null&&i!==void 0?i:new vB({defaultHeaders:Object.assign(Object.assign({},(s=e.getDefaultHeaders)===null||s===void 0?void 0:s.call(e)),(l=e.getHeaders)===null||l===void 0?void 0:l.call(e)),getAuthHeaders:(h)=>e.getAuthHeaders(h)}),server_url:(a=t.server_url)!==null&&a!==void 0?a:I2(e)}))}var k2=class{constructor(e){this.parentClient=e}async create(e,t){let{api_version:r}=e,n=$t(e,["api_version"]);if(n.stream===!0){let i=await Gc(()=>this.getClient(r).interactions.create(Object.assign(Object.assign({},n),{stream:!0,api_version:r}),nt(t,!0)));return Ig(i)}let o=await vt(Wb(this.getClient(r),n,r,nt(t)));return Bc(o)}async get(e,t={},r){let{api_version:n,stream:o=!1,last_event_id:i,include_input:s}=t!==null&&t!==void 0?t:{};if(o===!0){let a=await Gc(()=>this.getClient(n).interactions.get(e,{stream:o,last_event_id:i,include_input:s,api_version:n},nt(r,!0)));return Ig(a)}let l=await vt(Jb(this.getClient(n),e,n,s,i,o,nt(r)));return Bc(l)}async delete(e,t={},r){return Gc(()=>this.getClient(t===null||t===void 0?void 0:t.api_version).interactions.delete(e,{api_version:t===null||t===void 0?void 0:t.api_version},nt(r)))}async cancel(e,t={},r){return Bc(await vt(jb(this.getClient(t===null||t===void 0?void 0:t.api_version),e,t===null||t===void 0?void 0:t.api_version,nt(r))))}getClient(e){var t;if(e)return gr(this.parentClient,{api_version:e});return(t=this.sdk)!==null&&t!==void 0||(this.sdk=gr(this.parentClient)),this.sdk}},N2=class{constructor(e){this.parentClient=e}async create(e={},t){let r=e!==null&&e!==void 0?e:{},{api_version:n}=r,o=$t(r,["api_version"]);return vt(Nb(this.getClient(n),o,n,nt(t)))}async list(e={},t){let{api_version:r,page_size:n,page_token:o,parent:i}=e!==null&&e!==void 0?e:{};return vt(Db(this.getClient(r),r,n,o,i,nt(t)))}async get(e,t={},r){return vt(Mb(this.getClient(t===null||t===void 0?void 0:t.api_version),e,t===null||t===void 0?void 0:t.api_version,nt(r)))}async delete(e,t={},r){return vt(Ob(this.getClient(t===null||t===void 0?void 0:t.api_version),e,t===null||t===void 0?void 0:t.api_version,nt(r)))}getClient(e){var t;if(e)return gr(this.parentClient,{api_version:e});return(t=this.sdk)!==null&&t!==void 0||(this.sdk=gr(this.parentClient)),this.sdk}},O2=class{constructor(e){this.parentClient=e}async create(e,t){let{api_version:r}=e,n=$t(e,["api_version"]);return vt(sw(this.getClient(),n,r,nt(t)))}async list(e={},t){let{api_version:r,page_size:n,page_token:o}=e!==null&&e!==void 0?e:{};return vt(cw(this.getClient(),r,n,o,nt(t)))}async get(e,t={},r){return vt(lw(this.getClient(),e,t===null||t===void 0?void 0:t.api_version,nt(r)))}async update(e,t={},r){let n=t!==null&&t!==void 0?t:{},{api_version:o,update_mask:i}=n,s=$t(n,["api_version","update_mask"]);return vt(fw(this.getClient(),e,o,i,s,nt(r)))}async delete(e,t={},r){return vt(aw(this.getClient(),e,t===null||t===void 0?void 0:t.api_version,nt(r)))}async rotateSigningSecret(e,t={},r){let n=t!==null&&t!==void 0?t:{},{api_version:o}=n,i=$t(n,["api_version"]);return vt(dw(this.getClient(),e,o,i,nt(r)))}async ping(e,t=void 0,r){let{api_version:n,body:o}=t!==null&&t!==void 0?t:{};return vt(uw(this.getClient(),e,n,o,nt(r)))}getClient(){var e;return(e=this.sdk)!==null&&e!==void 0||(this.sdk=gr(this.parentClient)),this.sdk}},M2=class{constructor(e){this.parentClient=e}async create(e,t){let{api_version:r}=e,n=$t(e,["api_version"]);return vt(Kb(this.getClient(r),n,r,nt(t)))}async list(e={},t){let{api_version:r,filter:n,page_size:o,page_token:i}=e!==null&&e!==void 0?e:{};return vt(Qb(this.getClient(r),r,n,o,i,nt(t)))}async get(e,t={},r){return vt(Yb(this.getClient(t===null||t===void 0?void 0:t.api_version),e,t===null||t===void 0?void 0:t.api_version,nt(r)))}async update(e,t,r){let{api_version:n}=t,o=$t(t,["api_version"]);return vt(tw(this.getClient(n),e,o,n,nt(r)))}async delete(e,t={},r){return vt(Xb(this.getClient(t===null||t===void 0?void 0:t.api_version),e,t===null||t===void 0?void 0:t.api_version,nt(r)))}async run(e,t={},r){return vt(ew(this.getClient(t===null||t===void 0?void 0:t.api_version),e,t===null||t===void 0?void 0:t.api_version,nt(r)))}async listExecutions(e,t={},r){let{api_version:n,page_size:o,page_token:i}=t!==null&&t!==void 0?t:{};return vt(Zb(this.getClient(n),e,n,o,i,nt(r)))}getClient(e){var t;if(e)return gr(this.parentClient,{api_version:e});return(t=this.sdk)!==null&&t!==void 0||(this.sdk=gr(this.parentClient)),this.sdk}};function D2(e){return e.replace(/^\/+|\/+$/g,"")}function nt(e,t=!1){var r,n,o,i;if(!e&&!t)return;let s=e!==null&&e!==void 0?e:{},{timeout:l,maxRetries:a,defaultBaseURL:c,query:u,body:f,fetchOptions:h}=s,g=$t(s,["timeout","maxRetries","defaultBaseURL","query","body","fetchOptions"]),p=Object.assign({},g);if(gl(u))p.extra_query=u;else Ag("query",u);if(gl(f))p.extra_body=f;else Ag("body",f);let _=(r=g.fetch_options)!==null&&r!==void 0?r:h;if(_)p.fetch_options=_;let y=(n=g.server_url)!==null&&n!==void 0?n:c;if(y)p.server_url=y;let S=(o=g.timeout_ms)!==null&&o!==void 0?o:l;if(S!==void 0)p.timeout_ms=S;if(a!==void 0)p.retries={strategy:"attempt-count-backoff",retryConnectionErrors:!0,maxRetries:a};if(t){let E=new Headers((i=p.headers)!==null&&i!==void 0?i:_===null||_===void 0?void 0:_.headers);E.set("Accept","text/event-stream"),p.headers=E}return p}function Ag(e,t){if(t!==void 0&&t!==null)console.warn(`GoogleGenAI.interactions: request option ${e} is not supported by the Google GenAI interactions bridge and will be ignored.`)}async function vt(e){let[t,r]=await e.$inspect();if(!t.ok)throw No(t.error);return $2(t.value,r)}async function Gc(e){try{return await e()}catch(t){throw No(t)}}function Ig(e){let t=e;return new Proxy(e,{get(r,n){if(n!==Symbol.asyncIterator){let o=Reflect.get(r,n,r);return typeof o==="function"?o.bind(r):o}return function o(){let i=t[Symbol.asyncIterator]();return{async next(...s){try{return await i.next(...s)}catch(l){throw No(l)}},async return(s){if(!i.return)return{done:!0,value:s};try{return await i.return(s)}catch(l){throw No(l)}},async throw(s){if(!i.throw)throw No(s);try{return await i.throw(s)}catch(l){throw No(l)}},[Symbol.asyncIterator](){return this}}}}})}function $2(e,t){if(!gl(e)||t.status!=="complete")return e;return Object.assign(Object.assign({},e),{sdkHttpResponse:x2(t.response,e)})}function x2(e,t){let r={};for(let[n,o]of e.headers.entries())r[n]=o;return{headers:r,responseInternal:e,json:async()=>t}}function Bc(e){let t=L2(e);if(!t)return e;return U2(t)}function L2(e){if(!gl(e))return;if(Array.isArray(e.steps))return e;if(q2(e)){let t=e.outputs;if(Array.isArray(t)){let{outputs:r}=e,n=$t(e,["outputs"]);return Object.assign(Object.assign({},n),{steps:[{type:"model_output",content:t}]})}}return Object.assign(Object.assign({},e),{steps:[]})}function q2(e){let t=e.model;return typeof t==="string"&&A2.has(t)}function gl(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function U2(e){var t,r;let n=F2(e),o=(t=n.steps)!==null&&t!==void 0?t:[],i=[],s=!1;e:for(let f=o.length-1;f>=0;f--){let h=o[f];if(h.type==="user_input")break;if(h.type!=="model_output"||!h.content){if(s)break;continue}let g=h.content;for(let p=g.length-1;p>=0;p--){let _=g[p];if(_.type==="text")s=!0,i.push((r=_.text)!==null&&r!==void 0?r:"");else if(s)break e}}let l,a,c;for(let f=o.length-1;f>=0;f--){let h=o[f];if(h.type==="user_input")break;if(h.type==="model_output"&&h.content)for(let g=h.content.length-1;g>=0;g--){let p=h.content[g];if(p.type==="image"&&!l)l=p;if(p.type==="audio"&&!a)a=p;if(p.type==="video"&&!c)c=p}}let u=i.reverse().join("");return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},n),u&&{output_text:u}),l?{output_image:l}:{}),a?{output_audio:a}:{}),c?{output_video:c}:{})}function F2(e){return Object.assign(Object.assign({},e),{created:Pg(e.created),updated:Pg(e.updated)})}function Pg(e){return e instanceof Date?e.toISOString():e}function G2(e){let t=e.slice(e.lastIndexOf(".")+1).toLowerCase();return{txt:"text/plain",json:"application/json",js:"text/javascript",mjs:"text/javascript",ts:"text/plain",py:"text/x-python",html:"text/html",htm:"text/html",css:"text/css",csv:"text/csv",xml:"application/xml",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",pdf:"application/pdf",zip:"application/zip",tar:"application/x-tar",gz:"application/gzip"}[t]}var B2=class{constructor(e,t){this.resolveClient=e,this.parentClient=t}async list(e,t){return vt(zb(this.resolveClient(e.api_version),e.environment,e.path,e.api_version,e.page_size,e.page_token,e.recursive,nt(t)))}async download(e,t){var r,n;let o=e.environment;if(!o)throw Error("environment is required.");let i=o.startsWith("environments/")?o:`environments/${o}`,s=e.path.replace(/^\/+/,""),l=`${i}/files/${s}`,a=this.parentClient;if(!a||typeof a.request!=="function")throw Error("apiClient is required to download files.");let c=await a.request({path:l,httpMethod:"GET",queryParams:{alt:"media"},httpOptions:Object.assign(Object.assign({},t===null||t===void 0?void 0:t.httpOptions),{apiVersion:(r=e.api_version)!==null&&r!==void 0?r:(n=t===null||t===void 0?void 0:t.httpOptions)===null||n===void 0?void 0:n.apiVersion})});if(c&&c.responseInternal&&typeof c.responseInternal.arrayBuffer==="function"){let u=await c.responseInternal.arrayBuffer();return new Uint8Array(u)}throw Error("Unexpected response type from download")}async upload(e,t){var r,n,o,i,s,l,a,c;let u=e.environment;if(!u)throw Error("environment is required.");u.startsWith("environments/")||`environments/${u}`;let f=e.path.replace(/^\/+/,""),h=this.parentClient;if(!h||typeof h.request!=="function")throw Error("apiClient is required to upload files.");let g,p=0,_=e.mime_type;if(typeof e.file==="string"){let P;try{let D=globalThis.require;if(D)P=D("fs").readFileSync(e.file)}catch(D){}if(!P&&typeof globalThis.process<"u")try{let D=(n=(r=globalThis.process.mainModule)===null||r===void 0?void 0:r.require)!==null&&n!==void 0?n:globalThis.require;if(D)P=D("fs").readFileSync(e.file)}catch(D){}if(P)g=new Uint8Array(P.buffer,P.byteOffset,P.byteLength),p=g.byteLength;else throw Error(`Unable to read file from path "${e.file}". File path string inputs are only supported in Node.js environments.`);if(!_)_=G2(e.file)}else if(typeof Blob<"u"&&e.file instanceof Blob){if(g=e.file,p=e.file.size,!_&&e.file.type)_=e.file.type}else if(e.file instanceof Uint8Array||e.file instanceof ArrayBuffer)g=e.file instanceof ArrayBuffer?new Uint8Array(e.file):e.file,p=g.byteLength;else if(typeof globalThis.Buffer<"u"&&typeof globalThis.Buffer.isBuffer==="function"&&globalThis.Buffer.isBuffer(e.file)){let P=e.file;g=new Uint8Array(P.buffer,P.byteOffset,P.byteLength),p=g.byteLength}else throw Error("Unsupported file type for upload.");if(!_)_="application/octet-stream";let y=u.startsWith("environments/")?u.replace(/^environments\//,""):u,[S,E]=await Vb(this.resolveClient(e.api_version),y,f,"start",p,_,"resumable",e.api_version,e.extract,e.overwrite,nt(t)).$inspect();if(!S.ok)throw No(S.error);let b=E.status==="complete"?(s=(i=(o=E.response)===null||o===void 0?void 0:o.headers)===null||i===void 0?void 0:i.get("x-goog-upload-url"))!==null&&s!==void 0?s:(a=(l=E.response)===null||l===void 0?void 0:l.headers)===null||a===void 0?void 0:a.get("X-Goog-Upload-URL"):void 0;if(!b)throw Error("Failed to get upload URL from upload handshake response.");let R=8388608,w=0,T,C=g instanceof Blob?g:new Blob([g]);while(w<p||p===0&&w===0){let P=Math.min(w+R,p),D=C.slice(w,P),N=P>=p,F=N?"upload, finalize":"upload";if(T=await h.request({path:"",body:D,httpMethod:"POST",httpOptions:Object.assign(Object.assign({},t===null||t===void 0?void 0:t.httpOptions),{apiVersion:"",baseUrl:b,headers:Object.assign(Object.assign({},((c=t===null||t===void 0?void 0:t.httpOptions)===null||c===void 0?void 0:c.headers)||{}),{"X-Goog-Upload-Command":F,"X-Goog-Upload-Offset":`${w}`})})}),w=P,N)break}let A;if(T&&typeof T.json==="function")A=await T.json();else if(T&&T.responseInternal&&typeof T.responseInternal.json==="function")A=await T.responseInternal.json();if(A&&typeof A==="object"){if(Array.isArray(A.files))return A;if(A.name||A.path)return{files:[A]};if(A.file&&typeof A.file==="object")return{files:[A.file]}}return A}},H2=class{constructor(e){this.parentClient=e,this.files=new B2((t)=>this.getClient(t),this.parentClient)}async create(e,t){let{api_version:r}=e,n=$t(e,["api_version"]);return vt(Fb(this.getClient(r),n,r,nt(t)))}async list(e={},t){let{api_version:r,page_size:n,page_token:o}=e!==null&&e!==void 0?e:{};return vt(Hb(this.getClient(r),r,n,o,nt(t)))}async get(e,t={},r){return vt(Bb(this.getClient(t===null||t===void 0?void 0:t.api_version),e,t===null||t===void 0?void 0:t.api_version,nt(r)))}async delete(e,t={},r){return vt(Gb(this.getClient(t===null||t===void 0?void 0:t.api_version),e,t===null||t===void 0?void 0:t.api_version,nt(r)))}getClient(e){var t;if(e)return gr(this.parentClient,{api_version:e});return(t=this.sdk)!==null&&t!==void 0||(this.sdk=gr(this.parentClient)),this.sdk}},z2=class{constructor(e){this.parentClient=e}async create(e,t){let{api_version:r}=e,n=$t(e,["api_version"]);return vt($b(this.getClient(r),n,r,nt(t)))}async list(e={},t){let{api_version:r,page_size:n,page_token:o}=e!==null&&e!==void 0?e:{};return vt(qb(this.getClient(r),r,n,o,nt(t)))}async get(e,t={},r){return vt(Lb(this.getClient(t===null||t===void 0?void 0:t.api_version),e,t===null||t===void 0?void 0:t.api_version,nt(r)))}async update(e,t,r){let{api_version:n,update_mask:o}=t,i=$t(t,["api_version","update_mask"]);return vt(Ub(this.getClient(n),e,i,n,o,nt(r)))}async delete(e,t={},r){return vt(xb(this.getClient(t===null||t===void 0?void 0:t.api_version),e,t===null||t===void 0?void 0:t.api_version,nt(r)))}getClient(e){var t;if(e)return gr(this.parentClient,{api_version:e});return(t=this.sdk)!==null&&t!==void 0||(this.sdk=gr(this.parentClient)),this.sdk}},V2=class{constructor(e){this.parentClient=e}async create(e,t){let{api_version:r}=e,n=$t(e,["api_version"]);return vt(rw(this.getClient(r),n,r,nt(t)))}async list(e={},t){let{api_version:r,accent:n,contexts:o,gender:i,language_code:s,page_size:l,page_token:a,persona:c,pitch:u,region_code:f,search:h,type:g}=e!==null&&e!==void 0?e:{};return vt(iw(this.getClient(r),r,n,o,i,s,l,a,c,u,f,h,g,nt(t)))}async get(e,t={},r){return vt(ow(this.getClient(t===null||t===void 0?void 0:t.api_version),e,t===null||t===void 0?void 0:t.api_version,nt(r)))}async delete(e,t={},r){return vt(nw(this.getClient(t===null||t===void 0?void 0:t.api_version),e,t===null||t===void 0?void 0:t.api_version,nt(r)))}getClient(e){var t;if(e)return gr(this.parentClient,{api_version:e});return(t=this.sdk)!==null&&t!==void 0||(this.sdk=gr(this.parentClient)),this.sdk}},kg="x-goog-api-key",ys="https://www.googleapis.com/auth/cloud-platform",j2=class{constructor(e){if(e.apiKey!==void 0){this.apiKey=e.apiKey;return}let t=W2(e.googleAuthOptions);this.googleAuth=new z$.GoogleAuth(t)}async addAuthHeaders(e,t){if(this.apiKey!==void 0){if(this.apiKey.startsWith("auth_tokens/"))throw Error("Ephemeral tokens are only supported by the live API.");this.addKeyHeader(e);return}return this.addGoogleAuthHeaders(e,t)}addKeyHeader(e){if(e.get(kg)!==null)return;if(this.apiKey===void 0)throw Error("Trying to set API key header but apiKey is not set");e.append(kg,this.apiKey)}async addGoogleAuthHeaders(e,t){if(this.googleAuth===void 0)throw Error("Trying to set google-auth headers but googleAuth is unset");let r=await this.googleAuth.getRequestHeaders(t);for(let[n,o]of r){if(e.get(n)!==null)continue;e.append(n,o)}}};function W2(e){let t;if(!e)return t={scopes:[ys]},t;else{if(t=e,!t.scopes)return t.scopes=[ys],t;else if(typeof t.scopes==="string"&&t.scopes!==ys||Array.isArray(t.scopes)&&t.scopes.indexOf(ys)<0)throw Error(`Invalid auth scopes. Scopes must include: ${ys}`);return t}}var J2=class{async download(e,t){if(e.downloadPath){let r=await K2(e,t);if(r instanceof Li){let n=V$(e.downloadPath);W$.fromWeb(r.responseInternal.body).pipe(n),await J$(n)}else try{await j$(e.downloadPath,r,{encoding:"base64"})}catch(n){throw Error(`Failed to write file to ${e.downloadPath}: ${n}`)}}}};async function K2(e,t){var r,n,o;let i=ef(e.file);if(i!==void 0)return await t.request({path:`files/${i}:download`,httpMethod:"GET",queryParams:{alt:"media"},httpOptions:(r=e.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(n=e.config)===null||n===void 0?void 0:n.abortSignal});else if(FE(e.file)){let s=(o=e.file.video)===null||o===void 0?void 0:o.videoBytes;if(typeof s==="string")return s;else throw Error("Failed to download generated video, Uri or videoBytes not found.")}else if(GE(e.file)){let s=e.file.videoBytes;if(typeof s==="string")return s;else throw Error("Failed to download video, Uri or videoBytes not found.")}else throw Error("Unsupported file type")}var X2=class{create(e,t,r){return new Y2(e,t,r)}},Y2=class{constructor(e,t,r){this.url=e,this.headers=t,this.callbacks=r}connect(){this.ws=new K$.default(this.url,{headers:this.headers}),this.ws.onopen=this.callbacks.onopen,this.ws.onerror=this.callbacks.onerror,this.ws.onclose=this.callbacks.onclose,this.ws.onmessage=this.callbacks.onmessage}send(e){if(this.ws===void 0)throw Error("WebSocket is not connected");this.ws.send(e)}close(){if(this.ws===void 0)throw Error("WebSocket is not connected");this.ws.close()}};function Z2(e,t){let r={},n=d(e,["name"]);if(n!=null)m(r,["_url","name"],n);return r}function Q2(e,t){let r={},n=d(e,["name"]);if(n!=null)m(r,["_url","name"],n);return r}function eH(e,t){let r={},n=d(e,["sdkHttpResponse"]);if(n!=null)m(r,["sdkHttpResponse"],n);return r}function tH(e,t){let r={},n=d(e,["sdkHttpResponse"]);if(n!=null)m(r,["sdkHttpResponse"],n);return r}function rH(e,t){let r={},n=d(e,["enablePromptInjectionDetection"]);if(n!=null)m(r,["enablePromptInjectionDetection"],n);let o=d(e,["environment"]);if(o!=null)m(r,["environment"],o);let i=d(e,["excludedPredefinedFunctions"]);if(i!=null)m(r,["excludedPredefinedFunctions"],i);if(d(e,["disabledSafetyPolicies"])!==void 0)throw Error("disabledSafetyPolicies parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return r}function Su(e,t){let r={},n=d(e,["parts"]);if(n!=null){let i=n;if(Array.isArray(i))i=i.map((s)=>gH(s));m(r,["parts"],i)}let o=d(e,["role"]);if(o!=null)m(r,["role"],o);return r}function nH(e,t,r){let n={};if(d(e,["validationDataset"])!==void 0)throw Error("validationDataset parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let o=d(e,["tunedModelDisplayName"]);if(t!==void 0&&o!=null)m(t,["displayName"],o);if(d(e,["description"])!==void 0)throw Error("description parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let i=d(e,["epochCount"]);if(t!==void 0&&i!=null)m(t,["tuningTask","hyperparameters","epochCount"],i);let s=d(e,["learningRateMultiplier"]);if(s!=null)m(n,["tuningTask","hyperparameters","learningRateMultiplier"],s);if(d(e,["exportLastCheckpointOnly"])!==void 0)throw Error("exportLastCheckpointOnly parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["preTunedModelCheckpointId"])!==void 0)throw Error("preTunedModelCheckpointId parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["adapterSize"])!==void 0)throw Error("adapterSize parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["tuningMode"])!==void 0)throw Error("tuningMode parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["customBaseModel"])!==void 0)throw Error("customBaseModel parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let l=d(e,["batchSize"]);if(t!==void 0&&l!=null)m(t,["tuningTask","hyperparameters","batchSize"],l);let a=d(e,["learningRate"]);if(t!==void 0&&a!=null)m(t,["tuningTask","hyperparameters","learningRate"],a);if(d(e,["labels"])!==void 0)throw Error("labels parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["beta"])!==void 0)throw Error("beta parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["baseTeacherModel"])!==void 0)throw Error("baseTeacherModel parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["tunedTeacherModelSource"])!==void 0)throw Error("tunedTeacherModelSource parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["sftLossWeightMultiplier"])!==void 0)throw Error("sftLossWeightMultiplier parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["outputUri"])!==void 0)throw Error("outputUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["rewardConfig"])!==void 0)throw Error("rewardConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["compositeRewardConfig"])!==void 0)throw Error("compositeRewardConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["samplesPerPrompt"])!==void 0)throw Error("samplesPerPrompt parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["evaluateInterval"])!==void 0)throw Error("evaluateInterval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["checkpointInterval"])!==void 0)throw Error("checkpointInterval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["maxOutputTokens"])!==void 0)throw Error("maxOutputTokens parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["thinkingLevel"])!==void 0)throw Error("thinkingLevel parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["validationDatasetUri"])!==void 0)throw Error("validationDatasetUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["encryptionSpec"])!==void 0)throw Error("encryptionSpec parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return n}function oH(e,t,r){let n={},o=d(r,["config","method"]);if(o===void 0)o="SUPERVISED_FINE_TUNING";if(o==="SUPERVISED_FINE_TUNING"){let B=d(e,["validationDataset"]);if(t!==void 0&&B!=null)m(t,["supervisedTuningSpec"],xa(B))}else if(o==="PREFERENCE_TUNING"){let B=d(e,["validationDataset"]);if(t!==void 0&&B!=null)m(t,["preferenceOptimizationSpec"],xa(B))}else if(o==="DISTILLATION"){let B=d(e,["validationDataset"]);if(t!==void 0&&B!=null)m(t,["distillationSpec"],xa(B))}else if(o==="REINFORCEMENT_TUNING"){let B=d(e,["validationDataset"]);if(t!==void 0&&B!=null)m(t,["reinforcementTuningSpec"],xa(B))}let i=d(e,["tunedModelDisplayName"]);if(t!==void 0&&i!=null)m(t,["tunedModelDisplayName"],i);let s=d(e,["description"]);if(t!==void 0&&s!=null)m(t,["description"],s);let l=d(r,["config","method"]);if(l===void 0)l="SUPERVISED_FINE_TUNING";if(l==="SUPERVISED_FINE_TUNING"){let B=d(e,["epochCount"]);if(t!==void 0&&B!=null)m(t,["supervisedTuningSpec","hyperParameters","epochCount"],B)}else if(l==="PREFERENCE_TUNING"){let B=d(e,["epochCount"]);if(t!==void 0&&B!=null)m(t,["preferenceOptimizationSpec","hyperParameters","epochCount"],B)}else if(l==="DISTILLATION"){let B=d(e,["epochCount"]);if(t!==void 0&&B!=null)m(t,["distillationSpec","hyperParameters","epochCount"],B)}else if(l==="REINFORCEMENT_TUNING"){let B=d(e,["epochCount"]);if(t!==void 0&&B!=null)m(t,["reinforcementTuningSpec","hyperParameters","epochCount"],B)}let a=d(r,["config","method"]);if(a===void 0)a="SUPERVISED_FINE_TUNING";if(a==="SUPERVISED_FINE_TUNING"){let B=d(e,["learningRateMultiplier"]);if(t!==void 0&&B!=null)m(t,["supervisedTuningSpec","hyperParameters","learningRateMultiplier"],B)}else if(a==="PREFERENCE_TUNING"){let B=d(e,["learningRateMultiplier"]);if(t!==void 0&&B!=null)m(t,["preferenceOptimizationSpec","hyperParameters","learningRateMultiplier"],B)}else if(a==="DISTILLATION"){let B=d(e,["learningRateMultiplier"]);if(t!==void 0&&B!=null)m(t,["distillationSpec","hyperParameters","learningRateMultiplier"],B)}else if(a==="REINFORCEMENT_TUNING"){let B=d(e,["learningRateMultiplier"]);if(t!==void 0&&B!=null)m(t,["reinforcementTuningSpec","hyperParameters","learningRateMultiplier"],B)}let c=d(r,["config","method"]);if(c===void 0)c="SUPERVISED_FINE_TUNING";if(c==="SUPERVISED_FINE_TUNING"){let B=d(e,["exportLastCheckpointOnly"]);if(t!==void 0&&B!=null)m(t,["supervisedTuningSpec","exportLastCheckpointOnly"],B)}else if(c==="PREFERENCE_TUNING"){let B=d(e,["exportLastCheckpointOnly"]);if(t!==void 0&&B!=null)m(t,["preferenceOptimizationSpec","exportLastCheckpointOnly"],B)}else if(c==="DISTILLATION"){let B=d(e,["exportLastCheckpointOnly"]);if(t!==void 0&&B!=null)m(t,["distillationSpec","exportLastCheckpointOnly"],B)}let u=d(r,["config","method"]);if(u===void 0)u="SUPERVISED_FINE_TUNING";if(u==="SUPERVISED_FINE_TUNING"){let B=d(e,["adapterSize"]);if(t!==void 0&&B!=null)m(t,["supervisedTuningSpec","hyperParameters","adapterSize"],B)}else if(u==="PREFERENCE_TUNING"){let B=d(e,["adapterSize"]);if(t!==void 0&&B!=null)m(t,["preferenceOptimizationSpec","hyperParameters","adapterSize"],B)}else if(u==="DISTILLATION"){let B=d(e,["adapterSize"]);if(t!==void 0&&B!=null)m(t,["distillationSpec","hyperParameters","adapterSize"],B)}else if(u==="REINFORCEMENT_TUNING"){let B=d(e,["adapterSize"]);if(t!==void 0&&B!=null)m(t,["reinforcementTuningSpec","hyperParameters","adapterSize"],B)}let f=d(r,["config","method"]);if(f===void 0)f="SUPERVISED_FINE_TUNING";if(f==="SUPERVISED_FINE_TUNING"){let B=d(e,["tuningMode"]);if(t!==void 0&&B!=null)m(t,["supervisedTuningSpec","tuningMode"],B)}else if(f==="DISTILLATION"){let B=d(e,["tuningMode"]);if(t!==void 0&&B!=null)m(t,["distillationSpec","tuningMode"],B)}let h=d(e,["customBaseModel"]);if(t!==void 0&&h!=null)m(t,["customBaseModel"],h);let g=d(r,["config","method"]);if(g===void 0)g="SUPERVISED_FINE_TUNING";if(g==="SUPERVISED_FINE_TUNING"){let B=d(e,["batchSize"]);if(t!==void 0&&B!=null)m(t,["supervisedTuningSpec","hyperParameters","batchSize"],B)}else if(g==="DISTILLATION"){let B=d(e,["batchSize"]);if(t!==void 0&&B!=null)m(t,["distillationSpec","hyperParameters","batchSize"],B)}else if(g==="REINFORCEMENT_TUNING"){let B=d(e,["batchSize"]);if(t!==void 0&&B!=null)m(t,["reinforcementTuningSpec","hyperParameters","batchSize"],B)}let p=d(r,["config","method"]);if(p===void 0)p="SUPERVISED_FINE_TUNING";if(p==="SUPERVISED_FINE_TUNING"){let B=d(e,["learningRate"]);if(t!==void 0&&B!=null)m(t,["supervisedTuningSpec","hyperParameters","learningRate"],B)}else if(p==="DISTILLATION"){let B=d(e,["learningRate"]);if(t!==void 0&&B!=null)m(t,["distillationSpec","hyperParameters","learningRate"],B)}let _=d(e,["labels"]);if(t!==void 0&&_!=null)m(t,["labels"],_);let y=d(e,["beta"]);if(t!==void 0&&y!=null)m(t,["preferenceOptimizationSpec","hyperParameters","beta"],y);let S=d(e,["baseTeacherModel"]);if(t!==void 0&&S!=null)m(t,["distillationSpec","baseTeacherModel"],S);let E=d(e,["tunedTeacherModelSource"]);if(t!==void 0&&E!=null)m(t,["distillationSpec","tunedTeacherModelSource"],E);let b=d(e,["sftLossWeightMultiplier"]);if(t!==void 0&&b!=null)m(t,["distillationSpec","hyperParameters","sftLossWeightMultiplier"],b);let R=d(e,["outputUri"]);if(t!==void 0&&R!=null)m(t,["outputUri"],R);let w=d(e,["rewardConfig"]);if(t!==void 0&&w!=null)m(t,["reinforcementTuningSpec","singleRewardConfig"],w);let T=d(e,["compositeRewardConfig"]);if(t!==void 0&&T!=null)m(t,["reinforcementTuningSpec","compositeRewardConfig"],T);let C=d(e,["samplesPerPrompt"]);if(t!==void 0&&C!=null)m(t,["reinforcementTuningSpec","hyperParameters","samplesPerPrompt"],C);let A=d(e,["evaluateInterval"]);if(t!==void 0&&A!=null)m(t,["reinforcementTuningSpec","hyperParameters","evaluateInterval"],A);let P=d(e,["checkpointInterval"]);if(t!==void 0&&P!=null)m(t,["reinforcementTuningSpec","hyperParameters","checkpointInterval"],P);let D=d(e,["maxOutputTokens"]);if(t!==void 0&&D!=null)m(t,["reinforcementTuningSpec","hyperParameters","maxOutputTokens"],D);let N=d(e,["thinkingLevel"]);if(t!==void 0&&N!=null)m(t,["reinforcementTuningSpec","hyperParameters","thinkingLevel"],N);let F=d(e,["validationDatasetUri"]);if(t!==void 0&&F!=null)m(t,["reinforcementTuningSpec","validationDatasetUri"],F);let G=d(e,["encryptionSpec"]);if(t!==void 0&&G!=null)m(t,["encryptionSpec"],G);return n}function iH(e,t){let r={},n=d(e,["baseModel"]);if(n!=null)m(r,["baseModel"],n);let o=d(e,["preTunedModel"]);if(o!=null)m(r,["preTunedModel"],o);let i=d(e,["trainingDataset"]);if(i!=null)SH(i);let s=d(e,["config"]);if(s!=null)nH(s,r);return r}function sH(e,t){let r={},n=d(e,["baseModel"]);if(n!=null)m(r,["baseModel"],n);let o=d(e,["preTunedModel"]);if(o!=null)m(r,["preTunedModel"],o);let i=d(e,["trainingDataset"]);if(i!=null)EH(i,r,t);let s=d(e,["config"]);if(s!=null)oH(s,r,t);return r}function pw(e,t){let r={},n=d(e,["epochCount"]);if(n!=null)m(r,["epochCount"],n);let o=d(e,["learningRateMultiplier"]);if(o!=null)m(r,["learningRateMultiplier"],o);let i=d(e,["adapterSize"]);if(i!=null)m(r,["adapterSize"],i);let s=d(e,["batchSize"]);if(s!=null)m(r,["batchSize"],s);let l=d(e,["learningRate"]);if(l!=null)m(r,["learningRate"],l);let a=d(e,["generationConfig"]);if(a!=null)m(r,["generationConfig"],cH(a));return r}function aH(e,t){let r={},n=d(e,["promptDatasetUri"]);if(n!=null)m(r,["promptDatasetUri"],n);let o=d(e,["validationDatasetUri"]);if(o!=null)m(r,["validationDatasetUri"],o);let i=d(e,["baseTeacherModel"]);if(i!=null)m(r,["baseTeacherModel"],i);let s=d(e,["tunedTeacherModelSource"]);if(s!=null)m(r,["tunedTeacherModelSource"],s);let l=d(e,["hyperparameters"]);if(l!=null)m(r,["hyperparameters"],pw(l));return r}function lH(e,t){let r={},n=d(e,["baseTeacherModel"]);if(n!=null)m(r,["baseTeacherModel"],n);let o=d(e,["hyperParameters"]);if(o!=null)m(r,["hyperParameters"],pw(o));let i=d(e,["pipelineRootDirectory"]);if(i!=null)m(r,["pipelineRootDirectory"],i);let s=d(e,["promptDatasetUri"]);if(s!=null)m(r,["promptDatasetUri"],s);let l=d(e,["studentModel"]);if(l!=null)m(r,["studentModel"],l);let a=d(e,["trainingDatasetUri"]);if(a!=null)m(r,["trainingDatasetUri"],a);let c=d(e,["tunedTeacherModelSource"]);if(c!=null)m(r,["tunedTeacherModelSource"],c);let u=d(e,["tuningMode"]);if(u!=null)m(r,["tuningMode"],u);let f=d(e,["validationDatasetUri"]);if(f!=null)m(r,["validationDatasetUri"],f);return r}function cH(e,t){let r={},n=d(e,["modelConfig"]);if(n!=null)m(r,["modelSelectionConfig"],n);let o=d(e,["responseJsonSchema"]);if(o!=null)m(r,["responseJsonSchema"],Xi(o));let i=d(e,["audioTranscriptionConfig"]);if(i!=null)m(r,["audioTranscriptionConfig"],i);let s=d(e,["audioTimestamp"]);if(s!=null)m(r,["audioTimestamp"],s);let l=d(e,["candidateCount"]);if(l!=null)m(r,["candidateCount"],l);let a=d(e,["enableAffectiveDialog"]);if(a!=null)m(r,["enableAffectiveDialog"],a);let c=d(e,["frequencyPenalty"]);if(c!=null)m(r,["frequencyPenalty"],c);let u=d(e,["logprobs"]);if(u!=null)m(r,["logprobs"],u);let f=d(e,["maxOutputTokens"]);if(f!=null)m(r,["maxOutputTokens"],f);let h=d(e,["mediaResolution"]);if(h!=null)m(r,["mediaResolution"],h);let g=d(e,["presencePenalty"]);if(g!=null)m(r,["presencePenalty"],g);let p=d(e,["responseFormat"]);if(p!=null){let F=p;if(Array.isArray(F))F=F.map((G)=>G);m(r,["responseFormat"],F)}let _=d(e,["responseLogprobs"]);if(_!=null)m(r,["responseLogprobs"],_);let y=d(e,["responseMimeType"]);if(y!=null)m(r,["responseMimeType"],y);let S=d(e,["responseModalities"]);if(S!=null)m(r,["responseModalities"],S);let E=d(e,["responseSchema"]);if(E!=null)m(r,["responseSchema"],E);let b=d(e,["routingConfig"]);if(b!=null)m(r,["routingConfig"],b);let R=d(e,["seed"]);if(R!=null)m(r,["seed"],R);let w=d(e,["speechConfig"]);if(w!=null)m(r,["speechConfig"],w);let T=d(e,["stopSequences"]);if(T!=null)m(r,["stopSequences"],T);let C=d(e,["temperature"]);if(C!=null)m(r,["temperature"],C);let A=d(e,["thinkingConfig"]);if(A!=null)m(r,["thinkingConfig"],A);let P=d(e,["topK"]);if(P!=null)m(r,["topK"],P);let D=d(e,["topP"]);if(D!=null)m(r,["topP"],D);let N=d(e,["translationConfig"]);if(N!=null)m(r,["translationConfig"],N);return r}function uH(e,t){let r={},n=d(e,["name"]);if(n!=null)m(r,["_url","name"],n);return r}function dH(e,t){let r={},n=d(e,["name"]);if(n!=null)m(r,["_url","name"],n);return r}function fH(e,t,r){let n={},o=d(e,["pageSize"]);if(t!==void 0&&o!=null)m(t,["_query","pageSize"],o);let i=d(e,["pageToken"]);if(t!==void 0&&i!=null)m(t,["_query","pageToken"],i);let s=d(e,["filter"]);if(t!==void 0&&s!=null)m(t,["_query","filter"],s);return n}function pH(e,t){let r={},n=d(e,["config"]);if(n!=null)fH(n,r);return r}function hH(e,t){let r={},n=d(e,["sdkHttpResponse"]);if(n!=null)m(r,["sdkHttpResponse"],n);let o=d(e,["nextPageToken"]);if(o!=null)m(r,["nextPageToken"],o);let i=d(e,["tuningJobs"]);if(i!=null){let s=i;if(Array.isArray(s))s=s.map((l)=>Eu(l));m(r,["tuningJobs"],s)}return r}function mH(e,t){let r={};if(d(e,["name"])!==void 0)throw Error("name parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(d(e,["streamableHttpTransport"])!==void 0)throw Error("streamableHttpTransport parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return r}function gH(e,t){let r={},n=d(e,["mediaResolution"]);if(n!=null)m(r,["mediaResolution"],n);if(d(e,["toolCall"])!==void 0)throw Error("toolCall parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(d(e,["toolResponse"])!==void 0)throw Error("toolResponse parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let o=d(e,["audioTranscription"]);if(o!=null)m(r,["audioTranscription"],o);let i=d(e,["codeExecutionResult"]);if(i!=null)m(r,["codeExecutionResult"],i);let s=d(e,["executableCode"]);if(s!=null)m(r,["executableCode"],s);let l=d(e,["fileData"]);if(l!=null)m(r,["fileData"],l);let a=d(e,["functionCall"]);if(a!=null)m(r,["functionCall"],a);let c=d(e,["functionResponse"]);if(c!=null)m(r,["functionResponse"],c);let u=d(e,["inlineData"]);if(u!=null)m(r,["inlineData"],u);let f=d(e,["text"]);if(f!=null)m(r,["text"],f);let h=d(e,["thought"]);if(h!=null)m(r,["thought"],h);let g=d(e,["thoughtSignature"]);if(g!=null)m(r,["thoughtSignature"],g);let p=d(e,["videoMetadata"]);if(p!=null)m(r,["videoMetadata"],p);if(d(e,["partMetadata"])!==void 0)throw Error("partMetadata parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let _=d(e,["mediaProcessing"]);if(_!=null)m(r,["mediaProcessing"],_);let y=d(e,["speechMetadata"]);if(y!=null)m(r,["speechMetadata"],y);return r}function vH(e,t){let r={},n=d(e,["references"]);if(n!=null)m(r,["references"],n);let o=d(e,["contents"]);if(o!=null){let l=o;if(Array.isArray(l))l=l.map((a)=>Su(a));m(r,["contents"],l)}let i=d(e,["systemInstruction"]);if(i!=null)m(r,["systemInstruction"],Su(i));let s=d(e,["tools"]);if(s!=null){let l=s;if(Array.isArray(l))l=l.map((a)=>_H(a));m(r,["tools"],l)}return r}function _H(e,t){let r={},n=d(e,["retrieval"]);if(n!=null)m(r,["retrieval"],n);let o=d(e,["googleMaps"]);if(o!=null)m(r,["googleMaps"],o);let i=d(e,["mcpServers"]);if(i!=null){let _=i;if(Array.isArray(_))_=_.map((y)=>mH(y));m(r,["mcpServers"],_)}let s=d(e,["codeExecution"]);if(s!=null)m(r,["codeExecution"],s);let l=d(e,["computerUse"]);if(l!=null)m(r,["computerUse"],rH(l));let a=d(e,["enterpriseWebSearch"]);if(a!=null)m(r,["enterpriseWebSearch"],a);let c=d(e,["exaAiSearch"]);if(c!=null)m(r,["exaAiSearch"],c);let u=d(e,["functionDeclarations"]);if(u!=null){let _=u;if(Array.isArray(_))_=_.map((y)=>y);m(r,["functionDeclarations"],_)}let f=d(e,["googleSearch"]);if(f!=null)m(r,["googleSearch"],f);let h=d(e,["googleSearchRetrieval"]);if(h!=null)m(r,["googleSearchRetrieval"],h);let g=d(e,["parallelAiSearch"]);if(g!=null)m(r,["parallelAiSearch"],g);let p=d(e,["urlContext"]);if(p!=null)m(r,["urlContext"],p);if(d(e,["fileSearch"])!==void 0)throw Error("fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return r}function yH(e,t){let r={},n=d(e,["name"]);if(n!=null)m(r,["model"],n);let o=d(e,["name"]);if(o!=null)m(r,["endpoint"],o);return r}function SH(e,t){let r={};if(d(e,["gcsUri"])!==void 0)throw Error("gcsUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(d(e,["vertexDatasetResource"])!==void 0)throw Error("vertexDatasetResource parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let n=d(e,["examples"]);if(n!=null){let o=n;if(Array.isArray(o))o=o.map((i)=>i);m(r,["examples","examples"],o)}return r}function EH(e,t,r){let n={},o=d(r,["config","method"]);if(o===void 0)o="SUPERVISED_FINE_TUNING";if(o==="SUPERVISED_FINE_TUNING"){let s=d(e,["gcsUri"]);if(t!==void 0&&s!=null)m(t,["supervisedTuningSpec","trainingDatasetUri"],s)}else if(o==="PREFERENCE_TUNING"){let s=d(e,["gcsUri"]);if(t!==void 0&&s!=null)m(t,["preferenceOptimizationSpec","trainingDatasetUri"],s)}else if(o==="DISTILLATION"){let s=d(e,["gcsUri"]);if(t!==void 0&&s!=null)m(t,["distillationSpec","promptDatasetUri"],s)}else if(o==="REINFORCEMENT_TUNING"){let s=d(e,["gcsUri"]);if(t!==void 0&&s!=null)m(t,["reinforcementTuningSpec","trainingDatasetUri"],s)}let i=d(r,["config","method"]);if(i===void 0)i="SUPERVISED_FINE_TUNING";if(i==="SUPERVISED_FINE_TUNING"){let s=d(e,["vertexDatasetResource"]);if(t!==void 0&&s!=null)m(t,["supervisedTuningSpec","trainingDatasetUri"],s)}else if(i==="PREFERENCE_TUNING"){let s=d(e,["vertexDatasetResource"]);if(t!==void 0&&s!=null)m(t,["preferenceOptimizationSpec","trainingDatasetUri"],s)}else if(i==="DISTILLATION"){let s=d(e,["vertexDatasetResource"]);if(t!==void 0&&s!=null)m(t,["distillationSpec","promptDatasetUri"],s)}else if(i==="REINFORCEMENT_TUNING"){let s=d(e,["vertexDatasetResource"]);if(t!==void 0&&s!=null)m(t,["reinforcementTuningSpec","trainingDatasetUri"],s)}if(d(e,["examples"])!==void 0)throw Error("examples parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return n}function bH(e,t){let r={},n=d(e,["sdkHttpResponse"]);if(n!=null)m(r,["sdkHttpResponse"],n);let o=d(e,["name"]);if(o!=null)m(r,["name"],o);let i=d(e,["state"]);if(i!=null)m(r,["state"],UE(i));let s=d(e,["createTime"]);if(s!=null)m(r,["createTime"],s);let l=d(e,["tuningTask","startTime"]);if(l!=null)m(r,["startTime"],l);let a=d(e,["tuningTask","completeTime"]);if(a!=null)m(r,["endTime"],a);let c=d(e,["updateTime"]);if(c!=null)m(r,["updateTime"],c);let u=d(e,["description"]);if(u!=null)m(r,["description"],u);let f=d(e,["baseModel"]);if(f!=null)m(r,["baseModel"],f);let h=d(e,["_self"]);if(h!=null)m(r,["tunedModel"],yH(h));return r}function Eu(e,t){let r={},n=d(e,["sdkHttpResponse"]);if(n!=null)m(r,["sdkHttpResponse"],n);let o=d(e,["name"]);if(o!=null)m(r,["name"],o);let i=d(e,["state"]);if(i!=null)m(r,["state"],UE(i));let s=d(e,["createTime"]);if(s!=null)m(r,["createTime"],s);let l=d(e,["startTime"]);if(l!=null)m(r,["startTime"],l);let a=d(e,["endTime"]);if(a!=null)m(r,["endTime"],a);let c=d(e,["updateTime"]);if(c!=null)m(r,["updateTime"],c);let u=d(e,["error"]);if(u!=null)m(r,["error"],u);let f=d(e,["description"]);if(f!=null)m(r,["description"],f);let h=d(e,["baseModel"]);if(h!=null)m(r,["baseModel"],h);let g=d(e,["tunedModel"]);if(g!=null)m(r,["tunedModel"],g);let p=d(e,["preTunedModel"]);if(p!=null)m(r,["preTunedModel"],p);let _=d(e,["supervisedTuningSpec"]);if(_!=null)m(r,["supervisedTuningSpec"],_);let y=d(e,["preferenceOptimizationSpec"]);if(y!=null)m(r,["preferenceOptimizationSpec"],y);let S=d(e,["distillationSamplingSpec"]);if(S!=null)m(r,["distillationSamplingSpec"],aH(S));let E=d(e,["distillationSpec"]);if(E!=null)m(r,["distillationSpec"],lH(E));let b=d(e,["reinforcementTuningSpec"]);if(b!=null)m(r,["reinforcementTuningSpec"],b);let R=d(e,["tuningDataStats"]);if(R!=null)m(r,["tuningDataStats"],R);let w=d(e,["encryptionSpec"]);if(w!=null)m(r,["encryptionSpec"],w);let T=d(e,["partnerModelTuningSpec"]);if(T!=null)m(r,["partnerModelTuningSpec"],T);let C=d(e,["customBaseModel"]);if(C!=null)m(r,["customBaseModel"],C);let A=d(e,["evaluateDatasetRuns"]);if(A!=null){let ne=A;if(Array.isArray(ne))ne=ne.map((he)=>he);m(r,["evaluateDatasetRuns"],ne)}let P=d(e,["experiment"]);if(P!=null)m(r,["experiment"],P);let D=d(e,["fullFineTuningSpec"]);if(D!=null)m(r,["fullFineTuningSpec"],D);let N=d(e,["labels"]);if(N!=null)m(r,["labels"],N);let F=d(e,["outputUri"]);if(F!=null)m(r,["outputUri"],F);let G=d(e,["pipelineJob"]);if(G!=null)m(r,["pipelineJob"],G);let B=d(e,["serviceAccount"]);if(B!=null)m(r,["serviceAccount"],B);let Q=d(e,["tunedModelDisplayName"]);if(Q!=null)m(r,["tunedModelDisplayName"],Q);let pe=d(e,["tuningJobMetadata"]);if(pe!=null)m(r,["tuningJobMetadata"],pe);let se=d(e,["tuningJobState"]);if(se!=null)m(r,["tuningJobState"],se);let ve=d(e,["veoLoraTuningSpec"]);if(ve!=null)m(r,["veoLoraTuningSpec"],ve);let me=d(e,["veoTuningSpec"]);if(me!=null)m(r,["veoTuningSpec"],me);let j=d(e,["gcsMetricsUri"]);if(j!=null)m(r,["gcsMetricsUri"],j);return r}function wH(e,t){let r={},n=d(e,["sdkHttpResponse"]);if(n!=null)m(r,["sdkHttpResponse"],n);let o=d(e,["name"]);if(o!=null)m(r,["name"],o);let i=d(e,["metadata"]);if(i!=null)m(r,["metadata"],i);let s=d(e,["done"]);if(s!=null)m(r,["done"],s);let l=d(e,["error"]);if(l!=null)m(r,["error"],l);return r}function xa(e,t){let r={},n=d(e,["gcsUri"]);if(n!=null)m(r,["validationDatasetUri"],n);let o=d(e,["vertexDatasetResource"]);if(o!=null)m(r,["validationDatasetUri"],o);return r}function TH(e,t){let r={},n=d(e,["parent"]);if(n!=null)m(r,["_url","parent"],n);let o=d(e,["sampleResponse"]);if(o!=null)m(r,["sampleResponse"],Su(o));let i=d(e,["example"]);if(i!=null)m(r,["example"],vH(i));let s=d(e,["singleRewardConfig"]);if(s!=null)m(r,["singleRewardConfig"],s);let l=d(e,["compositeRewardConfig"]);if(l!=null)m(r,["compositeRewardConfig"],l);return r}function CH(e,t){let r={},n=d(e,["sdkHttpResponse"]);if(n!=null)m(r,["sdkHttpResponse"],n);let o=d(e,["overallReward"]);if(o!=null)m(r,["overallReward"],o);let i=d(e,["error"]);if(i!=null)m(r,["error"],i);let s=d(e,["rewardInfoDetails"]);if(s!=null)m(r,["rewardInfoDetails"],s);return r}var RH=class extends Un{constructor(e){super();this.apiClient=e,this.list=async(t={})=>new Wo(xn.PAGED_ITEM_TUNING_JOBS,(r)=>this.listInternal(r),await this.listInternal(t),t),this.get=async(t)=>await this.getInternal(t),this.tune=async(t)=>{var r;if(this.apiClient.isVertexAI())if(t.baseModel.startsWith("projects/")){let n={tunedModelName:t.baseModel};if((r=t.config)===null||r===void 0?void 0:r.preTunedModelCheckpointId)n.checkpointId=t.config.preTunedModelCheckpointId;let o=Object.assign(Object.assign({},t),{preTunedModel:n});return o.baseModel=void 0,await this.tuneInternal(o)}else{let n=Object.assign({},t);return await this.tuneInternal(n)}else{let n=Object.assign({},t),o=await this.tuneMldevInternal(n),i="";if(o.metadata!==void 0&&o.metadata.tunedModel!==void 0)i=o.metadata.tunedModel;else if(o.name!==void 0&&o.name.includes("/operations/"))i=o.name.split("/operations/")[0];return{name:i,state:pu.JOB_STATE_QUEUED}}}}async getInternal(e){var t,r,n,o;let i,s="",l={};if(this.apiClient.isVertexAI()){let a=dH(e);return s=Ae("{name}",a._url),l=a._query,delete a._url,delete a._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(a),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then((c)=>c.json().then((u)=>{let f=u;return f.sdkHttpResponse={headers:c.headers},f})),i.then((c)=>Eu(c))}else{let a=uH(e);return s=Ae("{name}",a._url),l=a._query,delete a._url,delete a._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(a),httpMethod:"GET",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then((c)=>c.json().then((u)=>{let f=u;return f.sdkHttpResponse={headers:c.headers},f})),i.then((c)=>bH(c))}}async listInternal(e){var t,r;let n,o="",i={};if(this.apiClient.isVertexAI()){let s=pH(e);return o=Ae("tuningJobs",s._url),i=s._query,delete s._url,delete s._query,n=this.apiClient.request({path:o,queryParams:i,body:JSON.stringify(s),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then((l)=>l.json().then((a)=>{let c=a;return c.sdkHttpResponse={headers:l.headers},c})),n.then((l)=>{let a=hH(l),c=new Ex;return Object.assign(c,a),c})}else throw Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async cancel(e){var t,r,n,o;let i,s="",l={};if(this.apiClient.isVertexAI()){let a=Q2(e);return s=Ae("{name}:cancel",a._url),l=a._query,delete a._url,delete a._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(a),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then((c)=>c.json().then((u)=>{let f=u;return f.sdkHttpResponse={headers:c.headers},f})),i.then((c)=>{let u=tH(c),f=new jm;return Object.assign(f,u),f})}else{let a=Z2(e);return s=Ae("{name}:cancel",a._url),l=a._query,delete a._url,delete a._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(a),httpMethod:"POST",httpOptions:(n=e.config)===null||n===void 0?void 0:n.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then((c)=>c.json().then((u)=>{let f=u;return f.sdkHttpResponse={headers:c.headers},f})),i.then((c)=>{let u=eH(c),f=new jm;return Object.assign(f,u),f})}}async tuneInternal(e){var t,r;let n,o="",i={};if(this.apiClient.isVertexAI()){let s=sH(e,e);return o=Ae("tuningJobs",s._url),i=s._query,delete s._url,delete s._query,n=this.apiClient.request({path:o,queryParams:i,body:JSON.stringify(s),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then((l)=>l.json().then((a)=>{let c=a;return c.sdkHttpResponse={headers:l.headers},c})),n.then((l)=>Eu(l))}else throw Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async tuneMldevInternal(e){var t,r;let n,o="",i={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");else{let s=iH(e);return o=Ae("tunedModels",s._url),i=s._query,delete s._url,delete s._query,n=this.apiClient.request({path:o,queryParams:i,body:JSON.stringify(s),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then((l)=>l.json().then((a)=>{let c=a;return c.sdkHttpResponse={headers:l.headers},c})),n.then((l)=>wH(l))}}async validateReward(e){var t,r;let n,o="",i={};if(this.apiClient.isVertexAI()){let s=TH(e);return o=Ae("{parent}/tuningJobs:validateReinforcementTuningReward",s._url),i=s._query,delete s._url,delete s._query,n=this.apiClient.request({path:o,queryParams:i,body:JSON.stringify(s),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(r=e.config)===null||r===void 0?void 0:r.abortSignal}).then((l)=>l.json().then((a)=>{let c=a;return c.sdkHttpResponse={headers:l.headers},c})),n.then((l)=>{let a=CH(l),c=new bx;return Object.assign(c,a),c})}else throw Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}},hw=8388608,mw=3,gw=1000,vw=2,uo="x-goog-upload-status";async function AH(e,t,r,n){var o;let i=await _w(e,t,r,n),s=await(i===null||i===void 0?void 0:i.json());if(((o=i===null||i===void 0?void 0:i.headers)===null||o===void 0?void 0:o[uo])!=="final")throw Error("Failed to upload file: Upload status is not finalized.");return s.file}async function IH(e,t,r,n){var o;let i=await _w(e,t,r,n),s=await(i===null||i===void 0?void 0:i.json());if(((o=i===null||i===void 0?void 0:i.headers)===null||o===void 0?void 0:o[uo])!=="final")throw Error("Failed to upload file: Upload status is not finalized.");let l=Kd(s),a=new ME;return Object.assign(a,l),a}async function _w(e,t,r,n){var o,i,s;let l=t,a=(n===null||n===void 0?void 0:n.baseUrl)||((o=r.clientOptions.httpOptions)===null||o===void 0?void 0:o.baseUrl);if(a){let g=new URL(a),p=new URL(t);p.protocol=g.protocol,p.host=g.host,p.port=g.port,l=p.toString()}let c=0,u=0,f=new Li(new Response),h="upload";c=e.size;while(u<c){let g=Math.min(hw,c-u),p=e.slice(u,u+g);if(u+g>=c)h+=", finalize";let _=0,y=gw;while(_<mw){let S=Object.assign(Object.assign({},(n===null||n===void 0?void 0:n.headers)||{}),{"X-Goog-Upload-Command":h,"X-Goog-Upload-Offset":String(u)});if(f=await r.request({path:"",body:p,httpMethod:"POST",httpOptions:Object.assign(Object.assign({},n),{apiVersion:"",baseUrl:l,headers:S})}),(i=f===null||f===void 0?void 0:f.headers)===null||i===void 0?void 0:i[uo])break;_++,await yw(y),y=y*vw}if(u+=g,((s=f===null||f===void 0?void 0:f.headers)===null||s===void 0?void 0:s[uo])!=="active")break;if(c<=u)throw Error("All content has been uploaded, but the upload status is not finalized.")}return f}async function PH(e){return{size:e.size,type:e.type}}function yw(e){return new Promise((t)=>setTimeout(t,e))}var kH=class{async stat(e){let t={size:0,type:void 0};if(typeof e==="string"){let r=await Yl.stat(e);return t.size=r.size,t.type=this.inferMimeType(e),t}else return await PH(e)}async upload(e,t,r,n){if(typeof e==="string")return await this.uploadFileFromPath(e,t,r,n);else return AH(e,t,r,n)}async uploadToFileSearchStore(e,t,r,n){if(typeof e==="string")return await this.uploadFileToFileSearchStoreFromPath(e,t,r,n);else return IH(e,t,r,n)}inferMimeType(e){let t=e.slice(e.lastIndexOf(".")+1);return{aac:"audio/aac",abw:"application/x-abiword",arc:"application/x-freearc",avi:"video/x-msvideo",azw:"application/vnd.amazon.ebook",bin:"application/octet-stream",bmp:"image/bmp",bz:"application/x-bzip",bz2:"application/x-bzip2",csh:"application/x-csh",css:"text/css",csv:"text/csv",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",eot:"application/vnd.ms-fontobject",epub:"application/epub+zip",gz:"application/gzip",gif:"image/gif",htm:"text/html",html:"text/html",ico:"image/vnd.microsoft.icon",ics:"text/calendar",jar:"application/java-archive",jpeg:"image/jpeg",jpg:"image/jpeg",js:"text/javascript",json:"application/json",jsonld:"application/ld+json",kml:"application/vnd.google-earth.kml+xml",kmz:"application/vnd.google-earth.kmz+xml",mjs:"text/javascript",mp3:"audio/mpeg",mp4:"video/mp4",mpeg:"video/mpeg",mpkg:"application/vnd.apple.installer+xml",odt:"application/vnd.oasis.opendocument.text",oga:"audio/ogg",ogv:"video/ogg",ogx:"application/ogg",opus:"audio/opus",otf:"font/otf",png:"image/png",pdf:"application/pdf",php:"application/x-httpd-php",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",rar:"application/vnd.rar",rtf:"application/rtf",sh:"application/x-sh",svg:"image/svg+xml",swf:"application/x-shockwave-flash",tar:"application/x-tar",tif:"image/tiff",tiff:"image/tiff",ts:"video/mp2t",ttf:"font/ttf",txt:"text/plain",vsd:"application/vnd.visio",wav:"audio/wav",weba:"audio/webm",webm:"video/webm",webp:"image/webp",woff:"font/woff",woff2:"font/woff2",xhtml:"application/xhtml+xml",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xml:"application/xml",xul:"application/vnd.mozilla.xul+xml",zip:"application/zip","3gp":"video/3gpp","3g2":"video/3gpp2","7z":"application/x-7z-compressed"}[t.toLowerCase()]}async uploadFileFromPath(e,t,r,n){var o;let i=await this.uploadFileFromPathInternal(e,t,r,n),s=await(i===null||i===void 0?void 0:i.json());if(((o=i===null||i===void 0?void 0:i.headers)===null||o===void 0?void 0:o[uo])!=="final")throw Error("Failed to upload file: Upload status is not finalized.");return s.file}async uploadFileToFileSearchStoreFromPath(e,t,r,n){var o;let i=await this.uploadFileFromPathInternal(e,t,r,n),s=await(i===null||i===void 0?void 0:i.json());if(((o=i===null||i===void 0?void 0:i.headers)===null||o===void 0?void 0:o[uo])!=="final")throw Error("Failed to upload file: Upload status is not finalized.");let l=Kd(s),a=new ME;return Object.assign(a,l),a}async uploadFileFromPathInternal(e,t,r,n){var o,i,s;let l=t,a=(n===null||n===void 0?void 0:n.baseUrl)||((o=r.clientOptions.httpOptions)===null||o===void 0?void 0:o.baseUrl);if(a){let _=new URL(a),y=new URL(t);y.protocol=_.protocol,y.host=_.host,y.port=_.port,l=y.toString()}let c=0,u=0,f=new Li(new Response),h="upload",g,p=OE.basename(e);try{if(g=await Yl.open(e,"r"),!g)throw Error("Failed to open file");c=(await g.stat()).size;while(u<c){let _=Math.min(hw,c-u);if(u+_>=c)h+=", finalize";let y=new Uint8Array(_),{bytesRead:S}=await g.read(y,0,_,u);if(S!==_)throw Error(`Failed to read ${_} bytes from file at offset ${u}. bytes actually read: ${S}`);let E=new Blob([y]),b=0,R=gw;while(b<mw){let w=Object.assign(Object.assign({},(n===null||n===void 0?void 0:n.headers)||{}),{"X-Goog-Upload-Command":h,"X-Goog-Upload-Offset":String(u),"X-Goog-Upload-File-Name":p});if(f=await r.request({path:"",body:E,httpMethod:"POST",httpOptions:Object.assign(Object.assign({},n),{apiVersion:"",baseUrl:l,headers:w})}),(i=f===null||f===void 0?void 0:f.headers)===null||i===void 0?void 0:i[uo])break;b++,await yw(R),R=R*vw}if(u+=S,((s=f===null||f===void 0?void 0:f.headers)===null||s===void 0?void 0:s[uo])!=="active")break;if(c<=u)throw Error("All content has been uploaded, but the upload status is not finalized.")}return f}finally{if(g)await g.close()}}},NH=class extends Iq{async registerFiles(e){if(typeof process>"u"||!process.versions||!process.versions.node)throw Error("registerFiles is only supported in Node.js environments.");let r=await e.auth.getRequestHeaders(),n=e.config||{},o=n.httpOptions||{},i=Object.assign({},o.headers||{});if(r)if(typeof r[Symbol.iterator]==="function")for(let[s,l]of r)i[s]=l;else for(let[s,l]of Object.entries(r))i[s]=l;return this._registerFiles({uris:e.uris,config:Object.assign(Object.assign({},n),{httpOptions:Object.assign(Object.assign({},o),{headers:i})})})}},OH="gl-node/";function MH(e){var t;if(e&&(e.enterprise!==void 0||e.vertexai!==void 0)){if(e.enterprise!==void 0&&e.vertexai!==void 0&&e.enterprise!==e.vertexai)throw Error("enterprise and vertexAI flags have conflicting values, please set enterprise value only.");return(t=e.enterprise)!==null&&t!==void 0?t:e.vertexai}let r=fo("GOOGLE_GENAI_USE_ENTERPRISE"),n=fo("GOOGLE_GENAI_USE_VERTEXAI"),o=Ng(r),i=Ng(n);if(r!==void 0&&n!==void 0&&o!==i)console.warn("Warning: Both GOOGLE_GENAI_USE_ENTERPRISE and GOOGLE_GENAI_USE_VERTEXAI are set with conflicting values. The value of GOOGLE_GENAI_USE_ENTERPRISE will be used.");if(r!==void 0)return o;if(n!==void 0)return i;return!1}var DH=class{getNextGenClient(){let e=this.httpOptions;if(this._nextGenClient===void 0)this._nextGenClient=gr(this.apiClient,{timeout_ms:e===null||e===void 0?void 0:e.timeout});if(e===null||e===void 0?void 0:e.extraBody)console.warn("GoogleGenAI: Client level httpOptions.extraBody is not supported by the Gemini NextGen client and will be ignored.");return this._nextGenClient}get interactions(){if(this._interactions!==void 0)return this._interactions;return this._interactions=new k2(this.apiClient),this._interactions}get webhooks(){if(this._webhooks!==void 0)return this._webhooks;return this._webhooks=new O2(this.apiClient),this._webhooks}get agents(){if(this._agents!==void 0)return this._agents;return console.warn("GoogleGenAI.agents: Agents usage is experimental and may change in future versions."),this._agents=new N2(this.apiClient),this._agents}get triggers(){if(this._triggers!==void 0)return this._triggers;return console.warn("GoogleGenAI.triggers: Triggers usage is experimental and may change in future versions."),this._triggers=new M2(this.apiClient),this._triggers}get environments(){if(this._environments!==void 0)return this._environments;return console.warn("GoogleGenAI.environments: Environments usage is experimental and may change in future versions."),this._environments=new H2(this.apiClient),this._environments}get credentials(){if(this._credentials!==void 0)return this._credentials;return console.warn("GoogleGenAI.credentials: Credentials usage is experimental and may change in future versions."),this._credentials=new z2(this.apiClient),this._credentials}get voices(){if(this._voices!==void 0)return this._voices;return this._voices=new V2(this.apiClient),this._voices}constructor(e={}){var t,r,n,o;if(this.vertexai=MH(e),(e.project||e.location)&&!this.vertexai)throw Error("Project and location are not supported for Gemini API backend.");let i=$H(),s=fo("GOOGLE_CLOUD_PROJECT"),l=fo("GOOGLE_CLOUD_LOCATION");if(this.apiKey=(t=e.apiKey)!==null&&t!==void 0?t:i,this.project=(r=e.project)!==null&&r!==void 0?r:s,this.location=(n=e.location)!==null&&n!==void 0?n:l,!this.vertexai&&!this.apiKey)console.warn("API key should be set when using the Gemini API.");if(this.vertexai){if((o=e.googleAuthOptions)===null||o===void 0?void 0:o.credentials)console.debug("The user provided Google Cloud credentials will take precedence over the API key from the environment variable."),this.apiKey=void 0;if(!e.project&&!e.location&&(s||l)&&e.apiKey)console.debug("The user provided Vertex AI API key will take precedence over the project/location from the environment variables."),this.project=void 0,this.location=void 0;else if((e.project||e.location)&&!e.apiKey&&i)console.debug("The user provided project/location will take precedence over the API key from the environment variables."),this.apiKey=void 0;else if(!e.project&&!e.location&&!e.apiKey&&(s||l)&&i)console.debug("The project/location from the environment variables will take precedence over the API key from the environment variables."),this.apiKey=void 0;if(!this.location&&!this.apiKey)this.location="global"}let a=Q$(e.httpOptions,this.vertexai,fo("GOOGLE_VERTEX_BASE_URL"),fo("GOOGLE_GEMINI_BASE_URL"));if(a)if(e.httpOptions)e.httpOptions.baseUrl=a;else e.httpOptions={baseUrl:a};this.apiVersion=e.apiVersion,this.httpOptions=e.httpOptions;let c=new j2({apiKey:this.apiKey,googleAuthOptions:e.googleAuthOptions});this.apiClient=new TG({auth:c,project:this.project,location:this.location,apiVersion:this.apiVersion,apiKey:this.apiKey,vertexai:this.vertexai,httpOptions:this.httpOptions,userAgentExtra:OH+process.version,uploader:new kH,downloader:new J2}),this.models=new ec(this.apiClient),this.live=new qG(this.apiClient,c,new X2),this.batches=new ML(this.apiClient),this.chats=new gq(this.models,this.apiClient),this.caches=new pq(this.apiClient),this.files=new NH(this.apiClient),this.operations=new zG(this.apiClient),this.authTokens=new sB(this.apiClient),this.tunings=new RH(this.apiClient),this.fileSearchStores=new hB(this.apiClient)}};function fo(e){var t,r,n;return(n=(r=(t=process===null||process===void 0?void 0:process.env)===null||t===void 0?void 0:t[e])===null||r===void 0?void 0:r.trim())!==null&&n!==void 0?n:void 0}function Ng(e){if(e===void 0)return!1;return e.toLowerCase()==="true"}function $H(){let e=fo("GOOGLE_API_KEY"),t=fo("GEMINI_API_KEY");if(e&&t)console.warn("Both GOOGLE_API_KEY and GEMINI_API_KEY are set. Using GOOGLE_API_KEY.");return e||t||void 0}var xH="No Gemini API key. Set it with `claude plugin configure <plugin>` (gemini_api_key) or export GEMINI_API_KEY before starting Claude Code. Get one at https://aistudio.google.com/apikey.";function Sw(e=process.env){let t;return()=>{let r=Ew(e);if(!r)throw Error(xH);return t??=new DH({apiKey:r}),t}}function Ew(e){let t=e.SF_GEMINI_API_KEY?.trim();if(t&&!t.startsWith("${"))return t;return e.GEMINI_API_KEY?.trim()||void 0}function LH(e,t,r=process.env){return r[e]?.trim()||t}var de=(e)=>e,kj=de({program:"claude",subcommands:["setup-token","update"],flags:{"--version":"bool","-p":"bool","--add-dir":"value","--allowedTools":"value","--disallowedTools":"value","--append-system-prompt":"value","--append-system-prompt-file":"value","--effort":"value","--include-hook-events":"bool","--include-partial-messages":"bool","--input-format":"value","--json":"bool","--mcp-config":"value","--model":"value","--name":"value","--output-format":"value","--permission-mode":"value","--plugin-dir":"value","--permission-prompt-tool":"value","--resume":"value","--session-id":"value","--setting-sources":"value","--settings":"value","--strict-mcp-config":"bool","--system-prompt-snapshot":"value","--verbose":"bool"},endOfOptions:!0,inheritEnv:["ANTHROPIC_*","CLAUDE_*","AWS_*","GOOGLE_*","CLOUD_ML_*","VERTEX_*","HTTP_PROXY","HTTPS_PROXY","NO_PROXY","NODE_EXTRA_CA_CERTS","XDG_*","SSH_AUTH_SOCK","COLORTERM","GIT_CONFIG_GLOBAL","GIT_CONFIG_SYSTEM","GIT_CONFIG_NOSYSTEM"],overridable:!0}),Nj=de({program:"cloudflared",subcommands:["tunnel"],flags:{"--no-autoupdate":"bool"},endOfOptions:!1,overridable:!0}),FH="io.bringes.superfactory.agent",Oj=`designated => identifier "${FH}"`,Mj=de({program:"codesign",subcommands:[],flags:{"--force":"bool","--sign":"value","--identifier":"value","--requirements":"value"},endOfOptions:!1}),Dj=de({program:"container",subcommands:["build","exec","image inspect","inspect","ls","network create","network delete","network inspect","network ls","rm","run","stop","system status","volume create","volume delete"],flags:{"--all":"bool","--cap-add":"value","--cpus":"value","--force":"bool","--format":"value","--label":"value","--memory":"value","--mount":"value","--name":"value","--network":"value","--tag":"value","--user":"value","-d":"bool","-e":"separate","-i":"bool","-v":"separate","-w":"separate"},endOfOptions:!1,wraps:!0}),$j=de({program:"tauri",subcommands:["build","signer sign"],flags:{"--bundles":"separate","--config":"separate","--private-key-path":"separate","--app-version":"separate"},endOfOptions:!1,inheritEnv:["*"],excludeEnv:["APPLE_*","TAURI_SIGNING_*"],overridable:!0}),xj=de({program:"codesign",subcommands:[],flags:{"--force":"bool","--options":"value","--timestamp":"bool","--entitlements":"value","--sign":"value","--verify":"bool","--deep":"bool","--strict":"bool"},endOfOptions:!1}),Lj=de({program:"xcrun",subcommands:["notarytool submit","notarytool log","notarytool history","stapler staple","stapler validate"],flags:{"--keychain-profile":"separate","--wait":"bool","--timeout":"separate","--output-format":"separate"},endOfOptions:!1,inheritEnv:["DEVELOPER_DIR"]}),qj=de({program:"spctl",subcommands:[],flags:{"-a":"bool","-vv":"bool","-t":"separate","--context":"separate"},endOfOptions:!1}),Uj=de({program:"ditto",subcommands:[],flags:{"-c":"bool","-k":"bool","--keepParent":"bool"},endOfOptions:!1}),Fj=de({program:"hdiutil",subcommands:["create","makehybrid"],flags:{"-volname":"separate","-srcfolder":"separate","-ov":"bool","-format":"separate","-iso":"bool","-joliet":"bool","-default-volume-name":"separate","-o":"separate"},flagSubcommands:{"-iso":["makehybrid"],"-joliet":["makehybrid"],"-default-volume-name":["makehybrid"],"-o":["makehybrid"]},endOfOptions:!1}),Gj=de({program:"tar",subcommands:[],flags:{"-czf":"separate","-C":"separate"},endOfOptions:!1,inheritEnv:["COPYFILE_DISABLE"]}),Bj=de({program:"lsregister",subcommands:[],flags:{"-dump":"bool","-u":"separate","-f":"bool"},endOfOptions:!1,overridable:!0}),Hj=de({program:"findmnt",subcommands:[],flags:{"-n":"bool","-b":"bool","-o":"separate"},endOfOptions:!1}),zj=de({program:"lsblk",subcommands:[],flags:{"-n":"bool","-b":"bool","-d":"bool","-o":"separate"},endOfOptions:!1}),Vj=de({program:"growpart",subcommands:[],flags:{},endOfOptions:!1}),jj=de({program:"resize2fs",subcommands:[],flags:{},endOfOptions:!1}),Wj=de({program:"docker",subcommands:["build","builder prune","buildx imagetools create","buildx imagetools inspect","context inspect","cp","exec","image inspect","image ls","image prune","image rm","info","inspect","logs","network connect","network create","network disconnect","network inspect","network ls","network rm","port","ps","push","restart","rm","run","start","stop","system df","volume create","volume ls","volume prune","volume rm"],flags:{"--version":"bool","--all":"bool","--annotation":"value","--build-arg":"value","--build-context":"value","--cap-add":"value","--cgroupns":"value","--cpus":"value","--env-file":"value","--file":"value","--filter":"value","--force":"bool","--format":"value","--keep-storage":"value","--label":"value","--max-used-space":"value","--memory":"value","--mount":"value","--name":"value","--network":"value","--opt":"value","--platform":"value","--privileged":"bool","--progress":"value","--restart":"value","--rm":"bool","--shm-size":"value","--tag":"value","--user":"value","--volumes":"bool","-d":"bool","-e":"separate","-i":"bool","-p":"separate","-v":"separate","-w":"separate"},flagSubcommands:{"--privileged":["exec"],"--cap-add":["run"],"--cgroupns":["run"],"--volumes":["rm"],"--opt":["network create"]},endOfOptions:!1,inheritEnv:["DOCKER_*","SSH_AUTH_SOCK","XDG_CONFIG_HOME"],overridable:!0,wraps:!0}),GH=de({program:"ffmpeg",subcommands:[],flags:{"-y":"bool","-re":"bool","-shortest":"bool","-hide_banner":"bool","-loglevel":"separate","-pix_fmt":"separate","-f":"separate","-protocol_whitelist":"separate","-i":"separate","-vf":"separate","-af":"separate","-vn":"bool","-framerate":"separate","-video_size":"separate","-loop":"separate","-capture_cursor":"separate","-c:v":"separate","-q:v":"separate","-frames:v":"separate","-c:a":"separate","-b:a":"separate","-q:a":"separate","-map":"separate","-map_chapters":"separate","-map_metadata":"separate","-movflags":"separate","-filter_complex":"separate","-safe":"separate","-c":"separate","-crf":"separate","-preset":"separate","-t":"separate","-ss":"separate","-sseof":"separate","-to":"separate","-threads":"separate"},endOfOptions:!1,inheritEnv:["DISPLAY","XAUTHORITY"]}),Jj=de({program:"ffprobe",subcommands:[],flags:{"-v":"separate","-select_streams":"separate","-show_entries":"separate","-of":"separate"},endOfOptions:!1}),nf={GIT_TERMINAL_PROMPT:"0",GCM_INTERACTIVE:"never",GIT_ASKPASS:"false",SSH_ASKPASS:"false",SSH_ASKPASS_REQUIRE:"force"},bw=["GIT_DIR","GIT_WORK_TREE","GIT_IMPLICIT_WORK_TREE","GIT_COMMON_DIR","GIT_INDEX_FILE","GIT_OBJECT_DIRECTORY","GIT_ALTERNATE_OBJECT_DIRECTORIES","GIT_GRAFT_FILE","GIT_SHALLOW_FILE","GIT_NO_REPLACE_OBJECTS","GIT_REPLACE_REF_BASE","GIT_PREFIX","GIT_NAMESPACE"],Kj=de({program:"git",subcommands:["add","branch","cat-file","check-ignore","bundle create","checkout","clean","clone","commit","commit-tree","config","diff","fetch","for-each-ref","grep","init","log","ls-files","ls-remote","ls-tree","hash-object","merge","merge-base","merge-tree","mv","pull","push","read-tree","remote","remote add","remote remove","reset","rev-list","rev-parse","show","status","tag","update-ref","worktree add","worktree list","worktree move","worktree prune","worktree remove","write-tree"],flags:{"-C":"separate","-c":"separate","-q":"bool","--quiet":"bool","-b":"value","-M":"bool","-z":"bool","-r":"bool","-1":"bool","-5":"bool","--modified":"bool","--version":"bool","--all":"bool","--abbrev-ref":"bool","--exclude-standard":"bool","--force":"bool","--file":"value","--cached":"bool","--no-color":"bool","--untracked":"bool","--untracked-files":"value","-e":"pattern","-F":"bool","-I":"bool","-i":"bool","-n":"bool","--max-count":"value","--delete":"bool","--add":"bool","--format":"value","--ff-only":"bool","--no-ff":"bool","--abort":"bool","--name-only":"bool","--diff-filter":"value","--git-common-dir":"bool","--absolute-git-dir":"bool","--heads":"bool","--is-inside-work-tree":"bool","--message":"value","--name-status":"bool","--no-index":"bool","--no-renames":"bool","--no-ext-diff":"bool","--no-textconv":"bool","--upload-pack":"value","--depth":"value","--receive-pack":"value","--show-scope":"bool","--numstat":"bool","--oneline":"bool","--others":"bool","--ignored":"bool","--directory":"bool","--path-format":"value","--porcelain":"bool","--symref":"bool","--set-upstream":"bool","--show-current":"bool","--show-toplevel":"bool","--verify":"bool","--hard":"bool","--keep":"bool","--detach":"bool","--no-track":"bool","--count":"bool","--first-parent":"bool","--is-ancestor":"bool","--reverse":"bool","--write-tree":"bool","--allow-unrelated-histories":"bool","--max-parents":"value","--left-right":"bool","--cherry-pick":"bool","--right-only":"bool","--list":"bool","--annotate":"bool","--sort":"value","--merged":"value","--not":"bool","--remotes":"bool","--exclude":"value","--branches":"bool","--no-verify":"bool","--bare":"bool","-d":"bool","-p":"separate","-m":"separate"},endOfOptions:!0,inheritEnv:["GIT_*","SSH_AUTH_SOCK","GPG_TTY","XDG_CONFIG_HOME"],excludeEnv:bw,env:nf}),Xj=de({program:"pre-push",subcommands:[],flags:{},endOfOptions:!1,overridable:!0}),Yj=de({program:"gh",subcommands:["api","auth status","pr close","pr create","pr edit","pr list","pr merge","pr ready","pr view","release create","release view","repo create","repo list","repo view"],flags:{"--version":"bool","--admin":"bool","--auto":"bool","--attach":"value","--base":"value","--body":"value","--body-file":"value","--comment":"value","--delete-branch":"bool","--draft":"bool","--head":"value","--header":"value","--input":"value","--latest":"bool","--notes-file":"value","--jq":"value","--json":"value","--limit":"value","--match-head-commit":"value","--merge":"bool","--method":"value","--paginate":"bool","--private":"bool","--rebase":"bool","--repo":"value","--search":"value","--squash":"bool","--state":"value","--target":"value","--title":"value","--verify-tag":"bool","--yes":"bool","-f":"separate","-F":"separate"},endOfOptions:!0,inheritEnv:["GH_*","GITHUB_TOKEN","GIT_*","SSH_AUTH_SOCK","XDG_CONFIG_HOME","NO_COLOR"],excludeEnv:bw,env:nf,overridable:!0}),Zj=de({program:"caffeinate",subcommands:[],flags:{"-i":"bool","-s":"bool","-w":"separate"},endOfOptions:!1}),Qj=de({program:"pmset",subcommands:["displaysleepnow"],flags:{},endOfOptions:!1}),e3=de({program:"ioreg",subcommands:[],flags:{"-r":"bool","-c":"separate","-k":"separate","-d":"separate"},endOfOptions:!1}),rc=(e)=>de({program:e,subcommands:["run"],flags:{},endOfOptions:!0}),t3=rc("pnpm"),r3=rc("npm"),n3=rc("yarn"),o3=rc("bun"),i3=de({program:"openssl",subcommands:["req","x509"],flags:{"-x509":"bool","-new":"bool","-req":"bool","-in":"separate","-newkey":"separate","-nodes":"bool","-pkeyopt":"separate","-keyout":"separate","-key":"separate","-CA":"separate","-CAkey":"separate","-set_serial":"separate","-sha256":"bool","-extfile":"separate","-out":"separate","-days":"separate","-subj":"separate","-addext":"separate"},endOfOptions:!1}),s3=de({program:"security",subcommands:["add-trusted-cert"],flags:{"-r":"separate","-p":"separate","-k":"separate"},endOfOptions:!1,overridable:!0}),a3=de({program:"ping",subcommands:[],flags:{"-c":"separate","-t":"separate","-W":"separate"},endOfOptions:!1}),nc=["npm_config_*","NPM_CONFIG_*","NPM_TOKEN","NODE_AUTH_TOKEN","BUN_CONFIG_*","BUN_INSTALL*","PNPM_HOME","YARN_*","COREPACK_*","XDG_CACHE_HOME","XDG_DATA_HOME","NODE_EXTRA_CA_CERTS","HTTP_PROXY","HTTPS_PROXY","NO_PROXY"],l3=de({program:"bun",subcommands:["install"],flags:{"--frozen-lockfile":"bool"},endOfOptions:!1,inheritEnv:nc}),c3=de({program:"pnpm",subcommands:["install"],flags:{"--frozen-lockfile":"bool","--prefer-offline":"bool"},endOfOptions:!1,inheritEnv:nc}),u3=de({program:"yarn",subcommands:["install"],flags:{"--frozen-lockfile":"bool","--prefer-offline":"bool","--immutable":"bool"},endOfOptions:!1,inheritEnv:nc}),d3=de({program:"npm",subcommands:["ci","install"],flags:{"--prefer-offline":"bool","--no-audit":"bool","--no-fund":"bool"},endOfOptions:!1,inheritEnv:nc}),f3=de({program:"bun",subcommands:[],flags:{"--version":"bool"},endOfOptions:!1,overridable:!0}),p3=de({program:"colima",subcommands:["start"],flags:{"--version":"bool"},endOfOptions:!1}),h3=de({program:"brew",subcommands:["install","uninstall","upgrade"],flags:{"--version":"bool","--cask":"bool","--formula":"bool"},endOfOptions:!0,inheritEnv:["HOMEBREW_*"],overridable:!0}),m3=de({program:"sudo",subcommands:[],flags:{"-n":"bool","-u":"separate"},endOfOptions:!0,wraps:!0}),g3=de({program:"superfactory-root",overridable:!0,subcommands:[],flags:{"-c":"script"},endOfOptions:!1}),v3=de({program:"apt-get",subcommands:["install","update","remove"],flags:{"-y":"bool","-q":"bool","--no-install-recommends":"bool","-o":"separate"},endOfOptions:!0}),_3=de({program:"env",subcommands:[],flags:{"-i":"bool","--chdir":"value"},endOfOptions:!1,wraps:!0}),y3=de({program:"rustup-init",subcommands:[],flags:{"-y":"bool","--no-modify-path":"bool","--profile":"value","--default-toolchain":"value"},endOfOptions:!0,overridable:!0}),S3=de({program:"npm",subcommands:["install"],flags:{"-g":"bool","--no-audit":"bool","--no-fund":"bool","--registry":"value","--prefix":"value"},endOfOptions:!0,inheritEnv:["HTTP_PROXY","HTTPS_PROXY","NO_PROXY"]}),E3=de({program:"ln",subcommands:[],flags:{"-s":"bool","-f":"bool","-n":"bool"},endOfOptions:!0}),b3=de({program:"mv",subcommands:[],flags:{"-f":"bool","-T":"bool"},endOfOptions:!0}),w3=de({program:"rm",subcommands:[],flags:{"-r":"bool","-f":"bool"},endOfOptions:!0}),T3=de({program:"kill",subcommands:[],flags:{"-s":"separate"},endOfOptions:!0}),C3=de({program:"systemctl",subcommands:["start","daemon-reload","show-environment","show"],flags:{"--user":"bool","-p":"separate","--value":"bool"},endOfOptions:!0,inheritEnv:["XDG_RUNTIME_DIR","DBUS_SESSION_BUS_ADDRESS","USER","LOGNAME"]}),R3=de({program:"open",subcommands:[],flags:{"-a":"separate"},endOfOptions:!1,overridable:!0}),A3=de({program:"xdg-open",subcommands:[],flags:{},endOfOptions:!1,overridable:!0}),I3=de({program:"bun",subcommands:["build","run","test"],flags:{"-e":"separate","-t":"separate","--bail":"bool","--compile":"bool","--watch":"bool","--define":"value","--loader":"value","--asset-naming":"value","--outfile":"value","--parallel":"value","--preload":"value","--target":"value","--timeout":"value"},endOfOptions:!1,inheritEnv:["*"],overridable:!0}),P3=de({program:"expo",subcommands:["start"],flags:{"--localhost":"bool","--port":"value"},endOfOptions:!1,inheritEnv:["*"],overridable:!0}),k3=de({program:"bun",subcommands:[],flags:{"--smol":"bool"},endOfOptions:!1,inheritEnv:["SF_*","DATABASE_URL"],overridable:!0}),N3=de({program:"superfactory-agent",subcommands:["run","agent run","session-host","agent session-host"],flags:{"--version":"bool"},endOfOptions:!1,inheritEnv:["*"],overridable:!0}),O3=de({program:"superfactory",subcommands:["finish-setup"],flags:{},endOfOptions:!1,inheritEnv:["*"],overridable:!0}),M3=de({program:"cat",subcommands:[],flags:{},endOfOptions:!0}),D3=de({program:"sleep",subcommands:[],flags:{},endOfOptions:!1}),$3=de({program:"setpriv",subcommands:[],flags:{"--no-new-privs":"bool"},endOfOptions:!1,wraps:!0}),x3=de({program:"true",subcommands:[],flags:{},endOfOptions:!1}),L3=de({program:"system_profiler",subcommands:[],flags:{"-json":"bool"},endOfOptions:!1}),q3=de({program:"sysctl",subcommands:[],flags:{"-n":"bool"},endOfOptions:!1}),U3=de({program:"vm_stat",subcommands:[],flags:{},endOfOptions:!1}),F3=de({program:"systemd-detect-virt",subcommands:[],flags:{"--vm":"bool"},endOfOptions:!1}),G3=de({program:"powershell",subcommands:[],flags:{"-NoProfile":"bool","-NonInteractive":"bool","-Command":"script"},endOfOptions:!1}),B3=de({program:"powershell",subcommands:[],flags:{"-NoProfile":"bool","-NonInteractive":"bool","-Command":"script"},endOfOptions:!1,inheritEnv:["SF_LISTEN_PORT"]}),H3=de({program:"powershell",subcommands:[],flags:{"-NoProfile":"bool","-NonInteractive":"bool","-Command":"script"},endOfOptions:!1}),z3=de({program:"ipcrm",subcommands:[],flags:{"-m":"separate"},endOfOptions:!1}),V3=de({program:"ipcs",subcommands:[],flags:{"-m":"bool","-p":"bool","-a":"bool"},endOfOptions:!1}),j3=de({program:"ps",subcommands:[],flags:{"-axww":"bool","-o":"separate","-p":"separate","-E":"bool"},endOfOptions:!1}),W3=de({program:"log",subcommands:["show"],flags:{"--style":"separate","--predicate":"separate","--start":"separate","--end":"separate"},endOfOptions:!1}),J3=de({program:"lsof",subcommands:[],flags:{"-a":"bool","-p":"separate","-d":"separate","-Fn":"bool","-Fu":"bool","-iTCP":"bool","-i":"separate","-sTCP:LISTEN":"bool","-nP":"bool"},endOfOptions:!1}),K3=de({program:"curl",subcommands:[],flags:{"-s":"bool","-X":"separate","-H":"separate","-d":"separate"},endOfOptions:!1}),X3=de({program:"networksetup",subcommands:[],flags:{"-listallhardwareports":"bool"},endOfOptions:!1}),Y3=de({program:"scutil",subcommands:[],flags:{"--get":"separate"},endOfOptions:!1}),Z3=de({program:"yq",subcommands:[],flags:{"-i":"bool"},endOfOptions:!1,overridable:!0}),Q3=de({program:"install",subcommands:[],flags:{"-D":"bool","-m":"separate"},endOfOptions:!0}),e5=de({program:"unshare",subcommands:[],flags:{"--mount":"bool","--pid":"bool","--fork":"bool","--mount-proc":"bool","--propagation":"value"},endOfOptions:!1,wraps:!0}),t5=de({program:"sh",subcommands:[],flags:{"-c":"script"},endOfOptions:!1,wraps:!0}),r5=de({program:"sh",subcommands:[],flags:{"-c":"script"},endOfOptions:!1,wraps:!0}),n5=de({program:"sh",subcommands:[],flags:{"-c":"script"},endOfOptions:!1}),o5=de({program:"sh",subcommands:[],flags:{"-c":"script"},endOfOptions:!1,wraps:!0}),i5=de({program:"chmod",subcommands:[],flags:{"-R":"bool","+a":"separate","-a":"separate"},endOfOptions:!0}),s5=de({program:"setfacl",subcommands:[],flags:{"-R":"bool","-P":"bool","-d":"bool","-m":"separate","-x":"separate"},endOfOptions:!0}),a5=de({program:"pgrep",subcommands:[],flags:{"-U":"separate","-x":"bool"},endOfOptions:!1}),l5=de({program:"afplay",subcommands:[],flags:{"-v":"separate"},endOfOptions:!1}),c5=de({program:"usermod",subcommands:[],flags:{"--append":"bool","--groups":"value"},endOfOptions:!0}),u5=de({program:"useradd",subcommands:[],flags:{"--system":"bool","--user-group":"bool","--no-create-home":"bool","--home-dir":"value","--shell":"value"},endOfOptions:!0}),d5=de({program:"powershell",subcommands:[],flags:{"-NoProfile":"bool","-NonInteractive":"bool","-Command":"script"},endOfOptions:!1}),f5=de({program:"osascript",subcommands:[],flags:{"-l":"separate","-e":"script"},endOfOptions:!1}),of={inheritEnv:["*"],excludeEnv:["SUPERFACTORY_*","SF_*"],env:nf,overridable:!0},p5=de({program:"bash",subcommands:[],flags:{"-l":"bool","-c":"script"},endOfOptions:!1,...of}),h5=de({program:"powershell",subcommands:[],flags:{"-NoProfile":"bool","-NonInteractive":"bool","-ExecutionPolicy":"value","-Command":"script"},endOfOptions:!1,...of}),m5=de({program:"cmd",subcommands:[],flags:{"/d":"bool","/s":"bool","/c":"script"},endOfOptions:!1,...of}),g5=de({program:"initdb",subcommands:[],flags:{"--pgdata":"value","--username":"value","--pwfile":"value","--auth":"value","--encoding":"value","--locale-provider":"value","--builtin-locale":"value","--locale":"value","--no-instructions":"bool"},endOfOptions:!0,overridable:!0}),v5=de({program:"postgres",subcommands:[],flags:{"-D":"separate","-p":"separate","-c":"separate"},endOfOptions:!1,overridable:!0}),_5=de({program:"pg_ctl",subcommands:["start","stop"],flags:{"-D":"separate","-o":"pattern","-l":"separate","-m":"separate","-t":"separate","-w":"bool","-W":"bool","-s":"bool"},flagSubcommands:{"-o":["start"],"-l":["start"],"-m":["stop"]},endOfOptions:!1,overridable:!0}),y5=de({program:"gitleaks",subcommands:["git"],flags:{"--log-opts":"value","--no-banner":"bool","--redact":"bool","--exit-code":"value"},endOfOptions:!0}),S5=de({program:"bun",subcommands:["audit"],flags:{"--prod":"bool","--audit-level":"value","--ignore":"value"},endOfOptions:!1,inheritEnv:["npm_config_*","NPM_CONFIG_*","HTTP_PROXY","HTTPS_PROXY","NO_PROXY"]}),E5=de({program:"semgrep",subcommands:["scan"],flags:{"--config":"value","--error":"bool","--quiet":"bool","--metrics":"value","--disable-version-check":"bool","--exclude":"value","--json":"bool"},endOfOptions:!0,inheritEnv:["SEMGREP_*"]}),b5=de({program:"sf-tunnel",subcommands:[],flags:{"--version":"bool"},endOfOptions:!1,overridable:!0}),w5=de({program:"cargo",subcommands:["build","zigbuild"],flags:{"--release":"bool","--locked":"bool","--target":"separate"},endOfOptions:!1,inheritEnv:["PATH","HOME","CARGO_*","RUSTUP_*"],overridable:!0}),T5=de({program:"rustup",subcommands:["target list"],flags:{"--installed":"bool"},endOfOptions:!1,inheritEnv:["PATH","HOME","CARGO_*","RUSTUP_*"],overridable:!0}),C5=de({program:"sh",subcommands:[],flags:{"-c":"script"},endOfOptions:!1}),R5=de({program:"sh",subcommands:[],flags:{"-s":"bool"},endOfOptions:!1}),A5=de({program:"sh",subcommands:[],flags:{"-l":"bool"},endOfOptions:!1,inheritEnv:["*"],excludeEnv:["SUPERFACTORY_*","SF_*"],overridable:!0}),I5=de({program:"sh",subcommands:[],flags:{"-c":"script"},endOfOptions:!1,inheritEnv:["*"]}),P5=de({program:"ssh",subcommands:[],flags:{"-F":"separate","-L":"separate","-N":"bool","-o":"separate","-p":"separate"},endOfOptions:!0}),k5=de({program:"ssh",subcommands:[],flags:{"-F":"separate","-o":"separate","-p":"separate","-T":"bool"},endOfOptions:!0,inheritEnv:["SSH_AUTH_SOCK"]}),N5=de({program:"ssh",subcommands:[],flags:{"-N":"bool","-T":"bool","-o":"separate","-p":"separate","-R":"separate"},endOfOptions:!0}),O5=de({program:"scp",subcommands:[],flags:{"-B":"bool","-q":"bool","-r":"bool","-o":"separate","-P":"separate"},endOfOptions:!0}),M5=de({program:"tar",subcommands:[],flags:{"-c":"bool","--directory":"value","--files-from":"value","--null":"bool","--extract":"bool","--xz":"bool","--gzip":"bool","--no-same-owner":"bool","--file":"value","--strip-components":"value"},endOfOptions:!1}),D5=de({program:"tart",subcommands:["clone","delete","exec","get","ip","list","rename","run","set","stop"],flags:{"--version":"bool","--cpu":"value","--disk-size":"value","--format":"value","--memory":"value","--no-graphics":"bool","--resolver":"value","--timeout":"value","--vnc-experimental":"bool","--wait":"value","-i":"bool","--dir":"value","--disk":"value","--graphics":"bool","--nested":"bool","--net-bridged":"value","--net-host":"bool","--net-softnet":"bool","--net-softnet-allow":"value","--no-audio":"bool","--no-clipboard":"bool","--rosetta":"value","--suspendable":"bool","--vnc":"bool"},flagSubcommands:{"--dir":["run"],"--disk":["run"],"--graphics":["run"],"--nested":["run"],"--net-bridged":["run"],"--net-host":["run"],"--net-softnet":["run"],"--net-softnet-allow":["run"],"--no-audio":["run"],"--no-clipboard":["run"],"--rosetta":["run"],"--suspendable":["run"],"--vnc":["run"]},endOfOptions:!0,wraps:!0}),$5=de({program:"powershell",subcommands:[],flags:{"-NoProfile":"bool","-NonInteractive":"bool","-STA":"bool","-ExecutionPolicy":"separate","-WindowStyle":"separate","-File":"separate"},endOfOptions:!1}),x5=de({program:"osascript",subcommands:[],flags:{"-l":"separate"},endOfOptions:!1}),L5=de({program:"python3",subcommands:[],flags:{"-I":"bool"},endOfOptions:!1,inheritEnv:["DISPLAY","WAYLAND_DISPLAY","XAUTHORITY","DBUS_SESSION_BUS_ADDRESS","XDG_*"]}),q5=de({program:"superfactory-tray",subcommands:[],flags:{},endOfOptions:!1,overridable:!0}),U5=de({program:"explorer",subcommands:[],flags:{},endOfOptions:!1}),F5=de({program:"journalctl",subcommands:[],flags:{"--user":"bool","-u":"separate","-n":"separate","--no-pager":"bool","-o":"separate"},endOfOptions:!1,inheritEnv:["XDG_RUNTIME_DIR","DBUS_SESSION_BUS_ADDRESS"]}),ww=["XDG_RUNTIME_DIR","DBUS_SESSION_BUS_ADDRESS","USER","LOGNAME"],G5=de({program:"sh",subcommands:[],flags:{},endOfOptions:!1,inheritEnv:ww}),B5=de({program:"systemd-run",subcommands:[],flags:{"--user":"bool","--collect":"bool","--quiet":"bool"},endOfOptions:!0,inheritEnv:ww}),H5=de({program:"systemd-run",subcommands:[],flags:{"--unit":"value","--collect":"bool","--quiet":"bool","--wait":"bool","--service-type":"value","--property":"value","--setenv":"value"},endOfOptions:!0}),z5=de({program:"powershell",subcommands:[],flags:{"-NoProfile":"bool","-NonInteractive":"bool","-Command":"script"},endOfOptions:!1}),V5=de({program:"vncdo",subcommands:[],flags:{"-s":"separate"},endOfOptions:!1}),j5=de({program:"taskkill",subcommands:[],flags:{"/F":"bool","/PID":"separate","/T":"bool"},endOfOptions:!1}),W5=de({program:"powershell",subcommands:[],flags:{"-NoProfile":"bool","-NonInteractive":"bool","-ExecutionPolicy":"value","-Command":"script"},endOfOptions:!1,inheritEnv:["SF_SESSION_*"]}),J5=de({program:"icacls",subcommands:[],flags:{"/grant":"separate","/grant:r":"separate","/deny":"separate","/setowner":"separate","/T":"bool","/remove:g":"separate","/inheritance:d":"bool","/inheritance:r":"bool","/C":"bool","/Q":"bool"},endOfOptions:!1}),K5=de({program:"schtasks",subcommands:[],flags:{"/run":"bool","/tn":"separate"},endOfOptions:!1}),X5=de({program:"Xvfb",subcommands:[],flags:{"-displayfd":"separate","-screen":"separate","-nolisten":"separate","-auth":"separate"},endOfOptions:!1,overridable:!0}),Y5=de({program:"fluxbox",subcommands:[],flags:{"-display":"separate","-rc":"separate"},endOfOptions:!1,overridable:!0}),Z5=de({program:"x11vnc",subcommands:[],flags:{"-display":"separate","-rfbport":"separate","-passwdfile":"separate","-localhost":"bool","-forever":"bool","-shared":"bool","-threads":"bool","-quiet":"bool","-noshm":"bool","-noremote":"bool"},endOfOptions:!1,overridable:!0}),Q5=de({program:"xcrun",subcommands:["simctl io","simctl shutdown","simctl push","simctl launch","simctl terminate","simctl list","simctl erase","simctl delete","devicectl list devices","devicectl device install app","devicectl device process launch"],flags:{"--quiet":"bool","--json-output":"separate","--device":"separate","--payload-url":"separate","--terminate-existing":"bool","--codec":"value","--force":"bool","-j":"bool"},endOfOptions:!1,inheritEnv:["DEVELOPER_DIR"],secretFlags:["--payload-url"]}),eW=de({program:"axe",subcommands:["describe-ui","tap","button"],flags:{"--udid":"separate","-x":"separate","-y":"separate"},endOfOptions:!1}),tW=de({program:"xcodebuild",subcommands:["build"],flags:{"-workspace":"separate","-scheme":"separate","-configuration":"separate","-destination":"separate","-derivedDataPath":"separate","-allowProvisioningUpdates":"bool","-allowProvisioningDeviceRegistration":"bool","-quiet":"bool"},endOfOptions:!1,inheritEnv:["*"]}),rW=de({program:"swiftc",subcommands:[],flags:{"-Onone":"bool","-o":"separate"},endOfOptions:!1,inheritEnv:["DEVELOPER_DIR","TMPDIR"]}),nW=de({program:"adb",subcommands:["devices","shell am start"],flags:{"-a":"separate","-d":"separate"},endOfOptions:!1,inheritEnv:["ANDROID_SERIAL","ANDROID_ADB_SERVER_PORT","ANDROID_HOME","ANDROID_SDK_ROOT"],secretFlags:["-d"]});function VH(e){return typeof e==="object"&&e!==null&&e.__script===!0}var Ot=class extends Error{name="UnsafeCommand"};function Dg(e,t){if(/[\0\r\n]/.test(e))throw new Ot(`${t} has a line break or NUL`);return e}var jH=["CLAUDECODE","CLAUDE_PID","CLAUDE_EFFORT","CLAUDE_CODE_SESSION_*","CLAUDE_CODE_CHILD_SESSION","CLAUDE_CODE_MESSAGING_*","CLAUDE_CODE_BRIDGE_*","CLAUDE_CODE_ENTRYPOINT","CLAUDE_CODE_EXECPATH","CLAUDE_CODE_INVOKED_SKILLS","AI_AGENT","TRACEPARENT"],WH=["PATH","HOME","USER","LOGNAME","SHELL","LANG","LC_ALL","LC_CTYPE","TMPDIR","TERM","TZ","SF_E2E_RUN_ID","SF_E2E_SUITE"],Cw=["SystemRoot","SystemDrive","windir","ComSpec","PATHEXT","TEMP","TMP","USERPROFILE","USERNAME","USERDOMAIN","HOMEDRIVE","HOMEPATH","APPDATA","LOCALAPPDATA","ProgramData","ProgramFiles","ProgramFiles(x86)","ProgramW6432","CommonProgramFiles","CommonProgramFiles(x86)","CommonProgramW6432","PUBLIC","ALLUSERSPROFILE","COMPUTERNAME","OS","NUMBER_OF_PROCESSORS","PROCESSOR_ARCHITECTURE"],$g=process.platform==="win32";function JH(e){return/^[A-Za-z_]\w*$/.test(e)||KH.has(e)}var KH=new Set(Cw.filter((e)=>!/^[A-Za-z_]\w*$/.test(e))),XH=600000,YH=67108864,ZH=class{constructor(e){this.schema=e,this.path=e.program}schema;args=[];ended=!1;hasSub=!1;subWords="";wrapped;dir;vars={};secrets=[];timeout=XH;maxOutput=YH;who;path;low=!1;unprivileged=!1;sub(e){if(this.hasSub||this.args.length)throw new Ot(`${this.schema.program}: the subcommand comes first`);if(!this.schema.subcommands.includes(e))throw new Ot(`${this.schema.program} has no subcommand "${e}"`);return this.args.push(...e.split(" ")),this.hasSub=!0,this.subWords=e,this}flag(e,t){if(this.wrapped)throw new Ot(`${this.schema.program}: nothing goes after the program it runs`);let r=this.schema.flags[e];if(!r)throw new Ot(`${this.schema.program} has no flag ${e}`);let n=this.schema.flagSubcommands?.[e];if(n&&!n.includes(this.subWords))throw new Ot(`${this.schema.program} ${e} goes only with ${n.join(", ")}`);if(this.ended)throw new Ot(`${this.schema.program}: ${e} after "--"`);if(r==="bool"){if(t!==void 0)throw new Ot(`${this.schema.program} ${e} takes no value`);return this.args.push(e),this}if(t===void 0)throw new Ot(`${this.schema.program} ${e} needs a value`);if(r==="script")throw new Ot(`${this.schema.program} ${e} takes a script: use .script()`);let o=Dg(String(t),`${this.schema.program} ${e}`);if(r==="pattern")return this.args.push(e,o),this;if(r==="value"&&e.startsWith("--"))return this.args.push(`${e}=${o}`),this;if(o.startsWith("-")&&!/^-\d/.test(o))throw new Ot(`${this.schema.program} ${e}: the value "${o}" starts with "-"`);return this.args.push(e,o),this}script(e,t){if(this.schema.flags[e]!=="script")throw new Ot(`${this.schema.program} ${e} isn't a script flag`);if(!VH(t))throw new Ot(`${this.schema.program} ${e}: a script must come from script\`…\``);return this.args.push(e,t.text),this}flags(e,t){for(let r of t)this.flag(e,r);return this}arg(e){if(this.wrapped)throw new Ot(`${this.schema.program}: nothing goes after the program it runs`);let t=Dg(String(e),`${this.schema.program} operand`);if(t.startsWith("-")&&!this.ended){if(!this.schema.endOfOptions)throw new Ot(`${this.schema.program}: the operand "${t}" starts with "-"`);this.args.push("--"),this.ended=!0}return this.args.push(t),this}argsOf(e){for(let t of e)this.arg(t);return this}wrap(e){if(!this.schema.wraps)throw new Ot(`${this.schema.program} doesn't run another program`);if(this.wrapped)throw new Ot(`${this.schema.program} already runs ${this.wrapped}`);this.args.push(e.program,...e.argv),this.wrapped=e.program;for(let t of e.secretValues)this.secrets.push(t);return this}endOptions(){if(!this.schema.endOfOptions)throw new Ot(`${this.schema.program} doesn't read "--"`);if(!this.ended)this.args.push("--");return this.ended=!0,this}in(e,t){if(!Tw(e)||!BH(e)||!HH(e).isDirectory())throw new Ot(`${e} isn't an existing absolute folder`);let r=Mg(e);if(t&&!t.some((n)=>ez(Mg(n),r)))throw new Ot(`${e} is outside the folders this command may run in`);return this.dir=r,this}env(e){for(let[t,r]of Object.entries(e)){if(r===void 0)continue;if(r.includes("\x00")||!JH(t))throw new Ot(`bad variable ${t}`);this.vars[t]=r}return this}secretEnv(e){for(let t of Object.values(e))if(t)this.secrets.push(t);return this.env(e)}secret(e){return this.secrets.push(e),this}timeoutMs(e){return this.timeout=e,this}maxOutputBytes(e){return this.maxOutput=e,this}by(e){return this.who=e,this}lowPriority(){return this.low=!0,this}noNewPrivileges(e=!0){return this.unprivileged=e,this}programPath(e){if(!e)return this;if(!this.schema.overridable)throw new Ot(`${this.schema.program}'s path can't be changed`);if(e.startsWith("-")||/(^|\/)\.\.(\/|$)/.test(e)||/[\0\r\n]/.test(e))throw new Ot(`${e} isn't a usable path to ${this.schema.program}`);return this.path=e,this}build(){let{env:e,dropped:t}=QH(this.schema);return{program:this.path,schema:this.schema,argv:[...this.args],cwd:this.dir,env:{...e,...this.schema.env,...this.vars},droppedEnv:t.filter((r)=>!(r in this.vars)),secretValues:[...this.secrets],timeoutMs:this.timeout,maxOutputBytes:this.maxOutput,caller:this.who,lowPriority:this.low,noNewPrivileges:this.unprivileged}}};function Rw(e){return new ZH(e)}function QH(e){let t=[...WH,...$g?Cw:[],...e.inheritEnv??[]],r=$g?(s,l)=>s.toUpperCase()===l.toUpperCase():(s,l)=>s===l,n=(s,l)=>l.some((a)=>a.endsWith("*")?r(s.slice(0,a.length-1),a.slice(0,-1)):r(s,a)),o={},i=[];for(let[s,l]of Object.entries(process.env)){if(l===void 0||n(s,e.excludeEnv??[])||!n(s,t))continue;if(n(s,jH))i.push(s);else o[s]=l}return{env:o,dropped:i}}function ez(e,t){let r=zH(e,t);return r===""||!r.startsWith("..")&&!Tw(r)}var Lg=64,qg=16384,cz=1,uz=256,dz=512,fz=4096,pz=32,hz=2048,mz=9,Ug=144,gz=16,vz=56,_z=2,yz=-1,Fg=568,Sz=8,Ez=32,Gg=new Set,Cs,fW=process.platform==="win32"&&globalThis.Bun?import(["bun","ffi"].join(":")).then((e)=>{Cs=e},(e)=>Fs(`bun:ffi isn't there (${e.message}): programs keep the agent's priority`)):Promise.resolve(),Ss,sf,Nn;function Fs(e){if(Gg.has(e))return;Gg.add(e),console.warn(`priority: ${e}`)}function bz(){if(Ss!==void 0)return Ss;if(!Cs)return null;Ss=null;try{let{FFIType:e}=Cs,t=e.i64_fast,{symbols:r}=Cs.dlopen("kernel32.dll",{GetCurrentProcess:{args:[],returns:t},GetPriorityClass:{args:[t],returns:e.u32},SetPriorityClass:{args:[t,e.u32],returns:e.i32},OpenProcess:{args:[e.u32,e.i32,e.u32],returns:t},CloseHandle:{args:[t],returns:e.i32},CreateJobObjectW:{args:[e.ptr,e.ptr],returns:t},SetInformationJobObject:{args:[t,e.i32,e.ptr,e.u32],returns:e.i32},AssignProcessToJobObject:{args:[t,t],returns:e.i32},CreateToolhelp32Snapshot:{args:[e.u32,e.u32],returns:t},Process32FirstW:{args:[t,e.ptr],returns:e.i32},Process32NextW:{args:[t,e.ptr],returns:e.i32},GetLastError:{args:[],returns:e.u32}}),n=Cs;sf=(o)=>n.ptr(o),Ss=r}catch(e){Fs(`kernel32 isn't reachable (${e.message}): programs keep the agent's priority`)}return Ss}function Aw(e){let t=e.GetPriorityClass(e.GetCurrentProcess());return t===qg||t===Lg?Lg:qg}function wz(e){if(Nn!==void 0)return Nn;if(Nn=e.CreateJobObjectW(null,null),!Nn)return Fs(`can't make a job object (error ${e.GetLastError()})`),Nn;let t=new Uint8Array(Ug),r=new DataView(t.buffer);if(r.setUint32(gz,pz|hz,!0),r.setUint32(vz,Aw(e),!0),!e.SetInformationJobObject(Nn,mz,sf?.(t)??0,Ug))Fs(`can't set the job's priority (error ${e.GetLastError()})`),e.CloseHandle(Nn),Nn=null;return Nn}function Tz(e,t){let r=e.CreateToolhelp32Snapshot(_z,0);if(!r||r===yz)return[];let n=new Map;try{let s=new Uint8Array(Fg),l=new DataView(s.buffer);l.setUint32(0,Fg,!0);let a=sf?.(s)??0;for(let c=e.Process32FirstW(r,a);c;c=e.Process32NextW(r,a)){let u=l.getUint32(Sz,!0),f=l.getUint32(Ez,!0);if(u===f)continue;n.set(f,[...n.get(f)??[],u])}}finally{e.CloseHandle(r)}let o=[],i=[t];while(i.length>0)for(let s of n.get(i.pop())??[]){if(o.includes(s))continue;o.push(s),i.push(s)}return o}function Bg(e,t,r){let n=uz|cz|dz|fz,o=e.OpenProcess(n,0,t);if(!o)return!1;try{let i=wz(e);if(i&&e.AssignProcessToJobObject(i,o))return!0;return Fs(`can't put a program in the low-priority job (error ${e.GetLastError()}): it's lowered alone`),e.SetPriorityClass(o,r)!==0}finally{e.CloseHandle(o)}}function Cz(e){let t=bz();if(!t)return!1;let r=Aw(t),n=Bg(t,e,r);for(let o of Tz(t,e))Bg(t,o,r);return n}var kz=[".exe",".com",".cmd",".bat"];function Nz(e,t,r,n=process.platform){let o=n!=="win32"||/[\\/]/.test(e)?e:/^bash(\.exe)?$/i.test(e)?Dz(r):_l(e,r),i=n==="win32"&&o?Pw(o,r):void 0;if(i&&o)return{program:i.program,args:[...i.args,o,...t]};if(!o||!/\.(cmd|bat)$/i.test(o))return{program:o??e,args:[...t]};let s=xz(o);if(s)return{program:s[0]??o,args:[...s.slice(1),...t]};let l=Lz(o);if(!l)throw Error(`${e} is a batch file that runs no Node script: it can't start without a shell`);let a=On(vl(o),"node.exe");return{program:af(a)?a:"node",args:[l,...t]}}function Oz(e=process.env){let t=[e.ProgramFiles,e.ProgramW6432,e["ProgramFiles(x86)"]].map((s)=>s&&On(s,"Git")),r=e.LOCALAPPDATA&&On(e.LOCALAPPDATA,"Programs","Git"),n=_l("git",e),o=n?[On(vl(n),".."),On(vl(n),"..","..")]:[],i=[e.CLAUDE_CODE_GIT_BASH_PATH,...[...t,r,...o].map((s)=>s&&On(s,"bin","bash.exe"))].find((s)=>!!s&&af(s));if(i)return i;return _l("bash",e,(s)=>Mz(s,e))}function Mz(e,t){let r=e.replace(/\//g,"\\").toLowerCase(),n=(t.SystemRoot??t.windir??"C:\\Windows").replace(/\//g,"\\").toLowerCase();return r.startsWith(`${n}\\`)||r.includes("\\windowsapps\\")}function Dz(e){let t=Oz(e);if(t)return t;throw Error("bash: Git for Windows' bash isn't on this machine (install Git for Windows, or set CLAUDE_CODE_GIT_BASH_PATH to its bash.exe); WSL's bash isn't used")}function Pw(e,t){if(/\.(exe|com|cmd|bat)$/i.test(e))return;let r=$z(e);if(!r?.startsWith("#!"))return;let n=r.slice(2).trim().split(/\s+/);if(Hc(n[0]??"")==="env")n=n.slice(n[1]==="-S"?2:1);let[o="",...i]=n,s=Hc(o).replace(/\.exe$/i,"");if(s!=="bun"&&s!=="node")return;let l=process.versions.bun&&/^bun(\.exe)?$/i.test(Hc(process.execPath));return{program:s==="bun"&&l?process.execPath:_l(s,t)??s,args:i}}function $z(e){try{if(!Pz(e).isFile())return;let t=Az(e,"r");try{let r=Buffer.alloc(256),n=Iz(t,r,0,r.length,0);return r.subarray(0,n).toString("utf8").split(/\r?\n/)[0]}finally{Rz(t)}}catch{return}}function _l(e,t,r=()=>!1){let n=Object.entries(t).find(([o])=>o.toUpperCase()==="PATH")?.[1]??"";for(let o of n.split(";").filter(Boolean)){for(let s of kz){let l=On(o,`${e}${s}`);if(af(l)&&!r(l))return l}let i=On(o,e);if(!/\.\w+$/.test(e)&&!r(i)&&Pw(i,t))return i}return}function xz(e){let t=Iw(e,"utf8").split(/\r?\n/).map((o)=>o.trim()).filter(Boolean);if(/^@echo off$/i.test(t[0]??""))t.shift();let r=String.raw`(?:"[^"%!^]+"|[\w.:\\/-]+)`,n=t.length===1?t[0]?.match(new RegExp(String.raw`^@?\s*(${r}(?:\s+${r})*)\s+%\*$`)):null;if(!n?.[1])return;return[...n[1].matchAll(/"([^"]+)"|(\S+)/g)].map((o)=>o[1]??o[2]??"")}function Lz(e){let t=Iw(e,"utf8");if(!/node(\.exe)?\b/i.test(t))return;let r=vl(e),n=(a)=>a.match(/^(?:%~dp0|%dp0%)[\\/]?(.+)$/i)?.[1],i=[...(t.split(/\r?\n/).find((a)=>a.includes("%*"))??"").matchAll(/"([^"]+)"/g)].at(-1)?.[1],s=i?.match(/^%(\w+)%$/)?.[1];if(s)i=[...t.matchAll(new RegExp(`SET "${s}=([^"]+)"`,"gi"))].map((a)=>a[1]??"").find((a)=>n(a)!==void 0);let l=i&&n(i);return l?On(r,...l.split(/[\\/]/)):void 0}var qz=()=>{return};function wu(e,t){let r=(i)=>e.secretValues.reduce((s,l)=>l?s.replaceAll(l,"[redacted]"):s,i),n=e.schema.secretFlags??[],o=e.argv.map((i,s)=>{if(n.some((l)=>i.startsWith(`${l}=`)))return`${i.split("=")[0]}=[redacted]`;if(s>0&&n.includes(e.argv[s-1]??""))return"[redacted]";return r(i)});try{qz({program:e.program,argv:o,cwd:e.cwd,caller:e.caller,env:Object.keys(e.env),droppedEnv:[...e.droppedEnv],...t})}catch{}}function kw(e,t={}){let r=Date.now(),n=Uz(e,{stdin:t.input===void 0?"ignore":"pipe",detached:t.detached});if(n.pid!==void 0)t.onStart?.(n.pid);let o="",i="",s=0,l=!1,a=!1,c=(f)=>(h)=>{if(s+=h.length,s>e.maxOutputBytes){l=!0,n.kill("SIGKILL");return}let g=h.toString("utf8");if(f==="out")o+=g,t.onStdout?.(g);else i+=g,t.onStderr?.(g)};if(n.stdout?.on("data",c("out")),n.stderr?.on("data",c("err")),t.input instanceof lz)n.stdin?.on("error",()=>{}),t.input.on("error",()=>n.stdin?.destroy()),t.input.pipe(n.stdin);else if(t.input!==void 0)n.stdin?.end(t.input);let u=setTimeout(()=>{if(a=!0,t.detached&&n.pid&&process.platform!=="win32")try{process.kill(-n.pid,"SIGKILL");return}catch{}n.kill("SIGKILL")},e.timeoutMs);return new Promise((f)=>{let h=(g,p)=>{clearTimeout(u);let _=Date.now()-r;wu(e,{phase:"end",exitCode:g,signal:p,timedOut:a,durationMs:_}),f({stdout:o,stderr:i,exitCode:g,signal:p,timedOut:a,truncated:l,durationMs:_})};n.on("error",(g)=>{i+=g.message,h(127,null)}),n.on("close",(g,p)=>h(a?124:g??1,p))})}function Uz(e,t){wu(e,{phase:"start"});let r=[],n=(l)=>{if(typeof l==="object"){let a=process.platform==="win32"?xg(l.file,"a"):xg(l.file,La.O_WRONLY|La.O_APPEND|La.O_CREAT|La.O_NOFOLLOW,438);return r.push(a),a}return l??"pipe"},{program:o,args:i}=Bz(e,Nz(e.program,e.argv,e.env)),s=tz(o,i,{cwd:e.cwd,env:{...e.env},stdio:[t.stdin??"pipe",n(t.stdout),n(t.stderr)],detached:t.detached,shell:!1,windowsHide:!0});for(let l of r)rz(l);if(e.lowPriority)Vz(s.pid);if(!t.detached)s.on("close",(l,a)=>wu(e,{phase:"end",exitCode:l,signal:a}));return s}var Fz=["/usr/bin/setpriv","/bin/setpriv"],qa,Hg=!1,Nw=!1,Gz=(e)=>!!e.noNewPrivileges||Nw&&!(e.schema.program==="sudo"&&e.program==="sudo");function Bz(e,t){if(!Gz(e)||process.platform!=="linux")return t;if(!Hz(t.program,e.env.PATH))return t;if(qa===void 0)qa=Fz.find((r)=>bu(r))??null;if(!qa){if(Nw&&!e.noNewPrivileges)throw Error("safe-exec: no setpriv (util-linux) here, so nothing starts on the server's machine");if(!Hg)console.warn("safe-exec: no setpriv (util-linux) here: task sessions start without no_new_privs");return Hg=!0,t}return{program:qa,args:["--no-new-privs","--",t.program,...t.args]}}function Hz(e,t=""){if(e.includes("/"))return bu(e);return t.split(":").some((r)=>!!r&&bu(az(r,e)))}function zz(){let{PRIORITY_BELOW_NORMAL:e,PRIORITY_LOW:t}=oz.priority,r=Math.min(iz()+e,t);return process.platform==="win32"?Math.max(r,e):r}function Vz(e){if(!e)return;if(process.platform==="win32"&&Cz(e))return;let t=zz(),r=(n)=>{try{sz(n,t)}catch{}};if(r(e),process.platform!=="linux")return;try{for(let n of nz(`/proc/${e}/task`))r(Number(n))}catch{}}var mW=Promise.resolve();async function Zz(e){let t=Yz(e);return await Jz(Kz(t),{recursive:!0}),t}var Qz=process.platform==="win32"?"winget install -e --id Gyan.FFmpeg":process.platform==="darwin"?"brew install ffmpeg":eV()?"sudo is off for a task's agent here: add ffmpeg to superfactory.yaml's setup, or ask your lead":"sudo apt-get install -y ffmpeg";function eV(){try{return/^NoNewPrivs:\s*1$/m.test(Wz("/proc/self/status","utf8"))}catch{return!1}}var tV=process.platform==="win32"?[Xz(process.env.LOCALAPPDATA??"","Microsoft","WinGet","Links")]:["/opt/homebrew/bin","/usr/local/bin"];function rV(){let e=Object.keys(process.env).find((n)=>n.toUpperCase()==="PATH")??"PATH",t=process.env[e]??"",r=tV.filter((n)=>jz(n)&&!t.split(zg).includes(n));if(r.length)process.env[e]=[t,...r].filter(Boolean).join(zg)}rV();async function nV(e){let t=await kw(e);if(t.exitCode===127&&t.stderr.includes("ENOENT"))throw Error(`${e.program} is not installed: install ffmpeg (${Qz}), then try again.`);if(t.exitCode!==0)throw Error(`${e.program} failed (${t.exitCode}): ${t.stderr.slice(-800)}`);return t.stdout}function lf(e){let t=UH(e).slice(1).toLowerCase();if(t==="wav"||t==="m4a"||t==="mp3")return t;throw Error(`The output must end in .wav, .m4a or .mp3: ${e}`)}function oV(e){let t=e?.match(/rate=(\d+)/)?.[1];return t?Number(t):24000}function iV(e,t){let r=Buffer.alloc(e.length*2);for(let[n,o]of e.entries()){let i=Math.max(-1,Math.min(1,o));r.writeInt16LE(Math.round(i*32767),n*2)}return{data:r,sampleRate:t}}function Ow(e,t=0.3){let r=e[0]?.sampleRate??24000,n=Buffer.alloc(Math.round(t*r)*2),o=e.flatMap((i,s)=>s===0?[i.data]:[n,i.data]);return{data:Buffer.concat(o),sampleRate:r}}var sV=({data:e,sampleRate:t})=>Math.round(e.length/(t*2)*100)/100;function aV({data:e,sampleRate:t},r=1,n=16){let o=Buffer.alloc(44),i=t*r*n/8;return o.write("RIFF",0),o.writeUInt32LE(36+e.length,4),o.write("WAVE",8),o.write("fmt ",12),o.writeUInt32LE(16,16),o.writeUInt16LE(1,20),o.writeUInt16LE(r,22),o.writeUInt32LE(t,24),o.writeUInt32LE(i,28),o.writeUInt16LE(r*n/8,32),o.writeUInt16LE(n,34),o.write("data",36),o.writeUInt32LE(e.length,40),Buffer.concat([o,e])}async function lV(e,t){let r=lf(t),n=await Zz(t),o=aV(e);if(r==="wav")return await Og(n,o),n;let i=`${n}.tmp.wav`;await Og(i,o);try{let s=Rw(GH).flag("-y").flag("-loglevel","error").flag("-i",i);if(r==="m4a")s.flag("-c:a","aac").flag("-b:a","128k");else s.flag("-c:a","libmp3lame").flag("-q:a","3");await nV(s.arg(n).build())}finally{await qH(i,{force:!0})}return n}async function cV(e,{text:t,voice:r,style:n,model:o},i=90000){let s=[],l=24000,a,c,u=new Promise((f,h)=>{c=setTimeout(()=>h(Error("Gemini Live did not finish speaking in time.")),i);let g=(p)=>{let _=p.serverContent;for(let y of _?.modelTurn?.parts??[]){if(!y.inlineData?.data)continue;l=oV(y.inlineData.mimeType),s.push(Buffer.from(y.inlineData.data,"base64"))}if(_?.turnComplete)f()};e.live.connect({model:o,config:{responseModalities:[qs.AUDIO],speechConfig:{voiceConfig:{prebuiltVoiceConfig:{voiceName:r}}},systemInstruction:uV(n)},callbacks:{onmessage:g,onerror:(p)=>h(Error(`Gemini Live error: ${p.message??"unknown"}`)),onclose:(p)=>h(Error(`Gemini Live closed: ${p.reason||p.code}`))}}).then((p)=>{a=p,p.sendClientContent({turns:[{role:"user",parts:[{text:t}]}],turnComplete:!0})},h)});try{await u}finally{clearTimeout(c),a?.close()}if(s.length===0)throw Error("Gemini Live returned no audio.");return{data:Buffer.concat(s),sampleRate:l}}function uV(e){return["You are the voice-over narrator of a short product video.","Read the user's message aloud exactly as written, word for word, then stop.","Do not answer it, greet, comment, or add anything before or after it.",e?`Delivery: ${e}.`:"Delivery: calm, clear and friendly, at a natural pace."].join(" ")}var Mw={name:"sf-kokoro-voice",private:!0,type:"module",dependencies:{"kokoro-js":"1.2.1"},overrides:{sharp:"0.35.5"}},Dw={name:"sf-kokoro-voice",lockfileVersion:3,requires:!0,packages:{"":{name:"sf-kokoro-voice",dependencies:{"kokoro-js":"1.2.1"}},"node_modules/@emnapi/runtime":{version:"1.11.3",resolved:"https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.3.tgz",integrity:"sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==",license:"MIT",optional:!0,dependencies:{tslib:"^2.4.0"}},"node_modules/@huggingface/jinja":{version:"0.5.10",resolved:"https://registry.npmjs.org/@huggingface/jinja/-/jinja-0.5.10.tgz",integrity:"sha512-SgS1D1bglQ94ceD4ZCL6eayUDy9uV1xuyk61OjgSxU5GJh7upqZCKII0JoTYMc6wWsg3JUgaPRX0ElQzXPk3Cw==",license:"MIT",engines:{node:">=18"}},"node_modules/@huggingface/transformers":{version:"3.8.1",resolved:"https://registry.npmjs.org/@huggingface/transformers/-/transformers-3.8.1.tgz",integrity:"sha512-tsTk4zVjImqdqjS8/AOZg2yNLd1z9S5v+7oUPpXaasDRwEDhB+xnglK1k5cad26lL5/ZIaeREgWWy0bs9y9pPA==",license:"Apache-2.0",dependencies:{"@huggingface/jinja":"^0.5.3","onnxruntime-node":"1.21.0","onnxruntime-web":"1.22.0-dev.20250409-89f8206ba4",sharp:"^0.34.1"}},"node_modules/@img/colour":{version:"1.1.0",resolved:"https://registry.npmjs.org/@img/colour/-/colour-1.1.0.tgz",integrity:"sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==",license:"MIT",engines:{node:">=18"}},"node_modules/@img/sharp-darwin-arm64":{version:"0.35.5",resolved:"https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.35.5.tgz",integrity:"sha512-QRUlFQ0WxvdWyqqG/WtI3iupfD5rBzmCHXSdPsY91sAtVtTo7Q4cb6zOccZ3gqEqkr0f1As1ehLqmEpDsRf+lg==",cpu:["arm64"],license:"Apache-2.0",optional:!0,os:["darwin"],engines:{node:">=20.9.0"},funding:{url:"https://opencollective.com/libvips"},optionalDependencies:{"@img/sharp-libvips-darwin-arm64":"1.3.4"}},"node_modules/@img/sharp-darwin-x64":{version:"0.35.5",resolved:"https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.35.5.tgz",integrity:"sha512-+BR255RhDlpygUpOc/Jdt1nT6DQ3XG/ERo5wbcdOf5Q320dKtPCKPLR1LJs9VGXRaMa8l1uUa0tkCNOXiAxZUw==",cpu:["x64"],license:"Apache-2.0",optional:!0,os:["darwin"],engines:{node:">=20.9.0"},funding:{url:"https://opencollective.com/libvips"},optionalDependencies:{"@img/sharp-libvips-darwin-x64":"1.3.4"}},"node_modules/@img/sharp-freebsd-wasm32":{version:"0.35.5",resolved:"https://registry.npmjs.org/@img/sharp-freebsd-wasm32/-/sharp-freebsd-wasm32-0.35.5.tgz",integrity:"sha512-Y/z91nEZ4uIBX5X3nfTovjU9lHNKFYbL2lpHCLVNmXQK03VIZvXBBt0KxbPGp2SdGSF+2mQU4e+hQaWOt86iAw==",license:"Apache-2.0",optional:!0,os:["freebsd"],dependencies:{"@img/sharp-wasm32":"0.35.5"},engines:{node:">=20.9.0"},funding:{url:"https://opencollective.com/libvips"}},"node_modules/@img/sharp-libvips-darwin-arm64":{version:"1.3.4",resolved:"https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.3.4.tgz",integrity:"sha512-5R89nBYiRdUlSWJxPhO+GVtaXzXSxKnRu/xqMn3KTA3L9EB9Oy/P+Nn2f2vlhPuUdy/Zusb2DarbyTpGCfEDuw==",cpu:["arm64"],license:"LGPL-3.0-or-later",optional:!0,os:["darwin"],funding:{url:"https://opencollective.com/libvips"}},"node_modules/@img/sharp-libvips-darwin-x64":{version:"1.3.4",resolved:"https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.3.4.tgz",integrity:"sha512-iR2OKH80yi0U+dUplyh3/xdpFvps6YkCwsXenIJxqxR1v9o+xtKTGbS9H7cps+2Vxjc8B1j96p75NmTGjIhtpQ==",cpu:["x64"],license:"LGPL-3.0-or-later",optional:!0,os:["darwin"],funding:{url:"https://opencollective.com/libvips"}},"node_modules/@img/sharp-libvips-linux-arm":{version:"1.3.4",resolved:"https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.3.4.tgz",integrity:"sha512-LmRtTsOHuvM2+wlO2Db37dx5MiZhB0FvSunciw48YjdOkZz9KAiRbm8ujeMOA1INqmei5NapFxYEK1D1ZSidmw==",cpu:["arm"],libc:["glibc"],license:"LGPL-3.0-or-later",optional:!0,os:["linux"],funding:{url:"https://opencollective.com/libvips"}},"node_modules/@img/sharp-libvips-linux-arm64":{version:"1.3.4",resolved:"https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.3.4.tgz",integrity:"sha512-Y3dgX/6lE2QhQb+Gxy0WZxfg9MEm/JBjamZpS2IklP7xIQoKN4hzAm7KcMVGtaVDt3neE9OKBC7vAfonA/Lr1A==",cpu:["arm64"],libc:["glibc"],license:"LGPL-3.0-or-later",optional:!0,os:["linux"],funding:{url:"https://opencollective.com/libvips"}},"node_modules/@img/sharp-libvips-linux-ppc64":{version:"1.3.4",resolved:"https://registry.npmjs.org/@img/sharp-libvips-linux-ppc64/-/sharp-libvips-linux-ppc64-1.3.4.tgz",integrity:"sha512-Le6boB8Tai0Nis+gIxIpKx68UDVVIqdR8Tin5Yf1z2LJJQLDJvCDRqRu+jC2qCoD+eIomonmOwB4smBRxfVpYQ==",cpu:["ppc64"],libc:["glibc"],license:"LGPL-3.0-or-later",optional:!0,os:["linux"],funding:{url:"https://opencollective.com/libvips"}},"node_modules/@img/sharp-libvips-linux-riscv64":{version:"1.3.4",resolved:"https://registry.npmjs.org/@img/sharp-libvips-linux-riscv64/-/sharp-libvips-linux-riscv64-1.3.4.tgz",integrity:"sha512-aHkkIEHPRdQEegJN20MLmGtxYD9R2wQr3Cwpddnu5+YKMt6Uzax7S9h5gpZTo8wyrGuZSlfQ63OevL5mTyOC7Q==",cpu:["riscv64"],libc:["glibc"],license:"LGPL-3.0-or-later",optional:!0,os:["linux"],funding:{url:"https://opencollective.com/libvips"}},"node_modules/@img/sharp-libvips-linux-s390x":{version:"1.3.4",resolved:"https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.3.4.tgz",integrity:"sha512-ra/mB6MikESDUO7Yg+Mi95bFBb9GsObURuhnOv3OqknjGe9sZrG8tCe9q0xSIGrtLgvgw0gKnFWcK4blSgQOuQ==",cpu:["s390x"],libc:["glibc"],license:"LGPL-3.0-or-later",optional:!0,os:["linux"],funding:{url:"https://opencollective.com/libvips"}},"node_modules/@img/sharp-libvips-linux-x64":{version:"1.3.4",resolved:"https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.3.4.tgz",integrity:"sha512-GJ//SSXbnwSDes02umB3nDJLFcQzw8a18V8fyhqr6tV515tOEMdImjjxj1AoafMRz56F3PHgftnj1QEKSU1zkw==",cpu:["x64"],libc:["glibc"],license:"LGPL-3.0-or-later",optional:!0,os:["linux"],funding:{url:"https://opencollective.com/libvips"}},"node_modules/@img/sharp-libvips-linuxmusl-arm64":{version:"1.3.4",resolved:"https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.3.4.tgz",integrity:"sha512-hvulFwtjUcagsis6BBxHwGFwWoNZjgYmULGVrZcyfNbjA8hKILbRxGg15/7w5HDyXHXUos/j6baAWqnCyQ2DWA==",cpu:["arm64"],libc:["musl"],license:"LGPL-3.0-or-later",optional:!0,os:["linux"],funding:{url:"https://opencollective.com/libvips"}},"node_modules/@img/sharp-libvips-linuxmusl-x64":{version:"1.3.4",resolved:"https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.3.4.tgz",integrity:"sha512-6zXKeE/p39I1AmA3cJG35eyBGNqNddLnUXjhwBnsGjFPWqf5VKkDBEqaEkPDoTEtkxwi2vv8Tcr2mDyP4So7Fg==",cpu:["x64"],libc:["musl"],license:"LGPL-3.0-or-later",optional:!0,os:["linux"],funding:{url:"https://opencollective.com/libvips"}},"node_modules/@img/sharp-linux-arm":{version:"0.35.5",resolved:"https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.35.5.tgz",integrity:"sha512-LEaXK2WdXVK5ykcw0buWyPMsmLLL2vpHLD6yrNSW+JGEL3BZPA4tpKN6iaMc4AxTTAoaX/sU1rOL51lcIz48ZQ==",cpu:["arm"],libc:["glibc"],license:"Apache-2.0",optional:!0,os:["linux"],engines:{node:">=20.9.0"},funding:{url:"https://opencollective.com/libvips"},optionalDependencies:{"@img/sharp-libvips-linux-arm":"1.3.4"}},"node_modules/@img/sharp-linux-arm64":{version:"0.35.5",resolved:"https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.35.5.tgz",integrity:"sha512-LYVx5JTsOM2CBzmxreh+nl64/3H6Xb09iSLknqH47z2T2DFFxDeFLP5y4dJwe6H7uGQlHPyEEtIqyo3DYsRwdQ==",cpu:["arm64"],libc:["glibc"],license:"Apache-2.0",optional:!0,os:["linux"],engines:{node:">=20.9.0"},funding:{url:"https://opencollective.com/libvips"},optionalDependencies:{"@img/sharp-libvips-linux-arm64":"1.3.4"}},"node_modules/@img/sharp-linux-ppc64":{version:"0.35.5",resolved:"https://registry.npmjs.org/@img/sharp-linux-ppc64/-/sharp-linux-ppc64-0.35.5.tgz",integrity:"sha512-QVxAAq8evVRI9ia2vqgwrmWucn5Dfv+JdWzj75pD8omHLPSP7f8p20O8jxzjCcuCEQEOtYOZUmX1hkiZ0kdevA==",cpu:["ppc64"],libc:["glibc"],license:"Apache-2.0",optional:!0,os:["linux"],engines:{node:">=20.9.0"},funding:{url:"https://opencollective.com/libvips"},optionalDependencies:{"@img/sharp-libvips-linux-ppc64":"1.3.4"}},"node_modules/@img/sharp-linux-riscv64":{version:"0.35.5",resolved:"https://registry.npmjs.org/@img/sharp-linux-riscv64/-/sharp-linux-riscv64-0.35.5.tgz",integrity:"sha512-LtdreXguaavKODPIfzJ4kffx7UNt1omwtK0rch4EBbbSTXPnxWmYSayXdLJw0fJzQ97kHt1gL/yh4tvU+nCyRQ==",cpu:["riscv64"],libc:["glibc"],license:"Apache-2.0",optional:!0,os:["linux"],engines:{node:">=20.9.0"},funding:{url:"https://opencollective.com/libvips"},optionalDependencies:{"@img/sharp-libvips-linux-riscv64":"1.3.4"}},"node_modules/@img/sharp-linux-s390x":{version:"0.35.5",resolved:"https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.35.5.tgz",integrity:"sha512-UZasTOFiYzotTsGOCu42BfUzP6Tu6Do/947iRm1RsLKvlllxwGcn4RN27LibGWceix4Y+Pmw3jsnTcCQIgWjqA==",cpu:["s390x"],libc:["glibc"],license:"Apache-2.0",optional:!0,os:["linux"],engines:{node:">=20.9.0"},funding:{url:"https://opencollective.com/libvips"},optionalDependencies:{"@img/sharp-libvips-linux-s390x":"1.3.4"}},"node_modules/@img/sharp-linux-x64":{version:"0.35.5",resolved:"https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.35.5.tgz",integrity:"sha512-SxFtLTeJInhAA9Q836kux2vZNeOBQEx658qvbboZScr0wIARym3IcGmW7KpVD5sbVg0Ojy+udFQdayYIZyoNog==",cpu:["x64"],libc:["glibc"],license:"Apache-2.0",optional:!0,os:["linux"],engines:{node:">=20.9.0"},funding:{url:"https://opencollective.com/libvips"},optionalDependencies:{"@img/sharp-libvips-linux-x64":"1.3.4"}},"node_modules/@img/sharp-linuxmusl-arm64":{version:"0.35.5",resolved:"https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.35.5.tgz",integrity:"sha512-9HbMclmI1zlNkFRs3z9/eBtDjfD0sGlrX1z6b1qwmiFY5ElDLh4BC0LPBdVp7z1DXFiKlIcznf+ZlsuZzLxQqg==",cpu:["arm64"],libc:["musl"],license:"Apache-2.0",optional:!0,os:["linux"],engines:{node:">=20.9.0"},funding:{url:"https://opencollective.com/libvips"},optionalDependencies:{"@img/sharp-libvips-linuxmusl-arm64":"1.3.4"}},"node_modules/@img/sharp-linuxmusl-x64":{version:"0.35.5",resolved:"https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.35.5.tgz",integrity:"sha512-4KOphqB035HrVdqLZfCgMzzERrQkkzOwRhl4OAkRO1YCldbaFjySXMaK534Mo0V+LndnlJk+sbUyLeU0ULyD1A==",cpu:["x64"],libc:["musl"],license:"Apache-2.0",optional:!0,os:["linux"],engines:{node:">=20.9.0"},funding:{url:"https://opencollective.com/libvips"},optionalDependencies:{"@img/sharp-libvips-linuxmusl-x64":"1.3.4"}},"node_modules/@img/sharp-wasm32":{version:"0.35.5",resolved:"https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.35.5.tgz",integrity:"sha512-Ptsga1su4tQx+LLF1ECS9U6nz5kmrXKo6XVbtR48Ke3ZRxxgaWBu7IDtEe1quo8hiupwm6WFqxVlXaSf7IINGQ==",license:"Apache-2.0 AND LGPL-3.0-or-later AND MIT",optional:!0,dependencies:{"@emnapi/runtime":"^1.11.3"},engines:{node:">=20.9.0"},funding:{url:"https://opencollective.com/libvips"}},"node_modules/@img/sharp-webcontainers-wasm32":{version:"0.35.5",resolved:"https://registry.npmjs.org/@img/sharp-webcontainers-wasm32/-/sharp-webcontainers-wasm32-0.35.5.tgz",integrity:"sha512-hfhF/FmoQyTUkA0bIKFOtw536BQSeBMe6BF6QyWlrPxT754+TFLaZ7sKKTfvvM0yJgKgaYTwnFCIZ/GuDw5SUA==",cpu:["wasm32"],license:"Apache-2.0",optional:!0,dependencies:{"@img/sharp-wasm32":"0.35.5"},engines:{node:">=20.9.0"},funding:{url:"https://opencollective.com/libvips"}},"node_modules/@img/sharp-win32-arm64":{version:"0.35.5",resolved:"https://registry.npmjs.org/@img/sharp-win32-arm64/-/sharp-win32-arm64-0.35.5.tgz",integrity:"sha512-X4t7g+7ZA5DKblCBEXGjUqqemj4vczING/5viFwAL8h4N3qYeyjwdCvRLHi4EdOUI+2Z7UFlp1VM+p/AuEtm6Q==",cpu:["arm64"],license:"Apache-2.0 AND LGPL-3.0-or-later",optional:!0,os:["win32"],engines:{node:">=20.9.0"},funding:{url:"https://opencollective.com/libvips"}},"node_modules/@img/sharp-win32-ia32":{version:"0.35.5",resolved:"https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.35.5.tgz",integrity:"sha512-5Zm82LoBc43nhwNybZlG7Y1KO//Zhsn306fQl29ZOuStHLGTo3BWL83q3cznX0poxSAMuYL1On/BHBxkBeKr6A==",cpu:["ia32"],license:"Apache-2.0 AND LGPL-3.0-or-later",optional:!0,os:["win32"],engines:{node:"^20.9.0"},funding:{url:"https://opencollective.com/libvips"}},"node_modules/@img/sharp-win32-x64":{version:"0.35.5",resolved:"https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.35.5.tgz",integrity:"sha512-x76eH0vEiHlcMQu8Y8IenntaACtddpT6W0wmXtWrnKcnKI7ME5DdgqhAD6SEWOEl1v2zDvkZDhFA9KnURwpfqg==",cpu:["x64"],license:"Apache-2.0 AND LGPL-3.0-or-later",optional:!0,os:["win32"],engines:{node:">=20.9.0"},funding:{url:"https://opencollective.com/libvips"}},"node_modules/@isaacs/fs-minipass":{version:"4.0.1",resolved:"https://registry.npmjs.org/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz",integrity:"sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==",license:"ISC",dependencies:{minipass:"^7.0.4"},engines:{node:">=18.0.0"}},"node_modules/@protobufjs/aspromise":{version:"1.1.2",resolved:"https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",integrity:"sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==",license:"BSD-3-Clause"},"node_modules/@protobufjs/base64":{version:"1.1.2",resolved:"https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz",integrity:"sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==",license:"BSD-3-Clause"},"node_modules/@protobufjs/codegen":{version:"2.0.5",resolved:"https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.5.tgz",integrity:"sha512-zgXFLzW3Ap33e6d0Wlj4MGIm6Ce8O89n/apUaGNB/jx+hw+ruWEp7EwGUshdLKVRCxZW12fp9r40E1mQrf/34g==",license:"BSD-3-Clause"},"node_modules/@protobufjs/eventemitter":{version:"1.1.1",resolved:"https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.1.tgz",integrity:"sha512-vW1GmwMZNnL+gMRaovlh9yZX74kc+TTU3FObkkurpMaRtBfLP3ldjS9KQWlwZgraRE0+dheEEoAxdzcJQ8eXZg==",license:"BSD-3-Clause"},"node_modules/@protobufjs/fetch":{version:"1.1.1",resolved:"https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.1.tgz",integrity:"sha512-GpptLrs57adMSuHi3VNj0mAF8dwh36LMaYF6XyJ6JMWlVsc+t42tm1HSEDmOs3A8fC9yyeisgLhsTVQokOZ0zw==",license:"BSD-3-Clause",dependencies:{"@protobufjs/aspromise":"^1.1.1"}},"node_modules/@protobufjs/float":{version:"1.0.2",resolved:"https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz",integrity:"sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==",license:"BSD-3-Clause"},"node_modules/@protobufjs/path":{version:"1.1.2",resolved:"https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz",integrity:"sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==",license:"BSD-3-Clause"},"node_modules/@protobufjs/pool":{version:"1.1.0",resolved:"https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz",integrity:"sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==",license:"BSD-3-Clause"},"node_modules/@protobufjs/utf8":{version:"1.1.2",resolved:"https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.2.tgz",integrity:"sha512-b1UQwcEZ4yCnMCD8DAL1VlbvBJE9/IX4FTIp7BG1xYpf29SLazLSrqUkj4w7Y5y7cCVP6E5tcqqcI0xemPkHug==",license:"BSD-3-Clause"},"node_modules/@types/node":{version:"26.6.5",resolved:"https://registry.npmjs.org/@types/node/-/node-26.6.5.tgz",integrity:"sha512-uMzsv9stDdofIZBx4UGh4Z9ZgXnGC9seRDscilBcTHAeOFk67MZg/k9bWVfO+bk4qZmG+l52hRnLwUiH2LnJTg==",license:"MIT",dependencies:{"undici-types":"~8.9.0"}},"node_modules/boolean":{version:"3.2.0",resolved:"https://registry.npmjs.org/boolean/-/boolean-3.2.0.tgz",integrity:"sha512-d0II/GO9uf9lfUHH2BQsjxzRJZBdsjgsBiW4BvhWk/3qoKwQFjIDVN19PfX8F2D/r9PCMTtLWjYVCFrpeYUzsw==",deprecated:"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.",license:"MIT"},"node_modules/chownr":{version:"3.0.0",resolved:"https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz",integrity:"sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==",license:"BlueOak-1.0.0",engines:{node:">=18"}},"node_modules/define-data-property":{version:"1.1.4",resolved:"https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz",integrity:"sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==",license:"MIT",dependencies:{"es-define-property":"^1.0.0","es-errors":"^1.3.0",gopd:"^1.0.1"},engines:{node:">= 0.4"},funding:{url:"https://github.com/sponsors/ljharb"}},"node_modules/define-properties":{version:"1.2.1",resolved:"https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz",integrity:"sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==",license:"MIT",dependencies:{"define-data-property":"^1.0.1","has-property-descriptors":"^1.0.0","object-keys":"^1.1.1"},engines:{node:">= 0.4"},funding:{url:"https://github.com/sponsors/ljharb"}},"node_modules/detect-libc":{version:"2.1.2",resolved:"https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",integrity:"sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",license:"Apache-2.0",engines:{node:">=8"}},"node_modules/detect-node":{version:"2.1.0",resolved:"https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz",integrity:"sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==",license:"MIT"},"node_modules/es-define-property":{version:"1.0.1",resolved:"https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",integrity:"sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",license:"MIT",engines:{node:">= 0.4"}},"node_modules/es-errors":{version:"1.3.0",resolved:"https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",integrity:"sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",license:"MIT",engines:{node:">= 0.4"}},"node_modules/es6-error":{version:"4.1.1",resolved:"https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz",integrity:"sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==",license:"MIT"},"node_modules/escape-string-regexp":{version:"4.0.0",resolved:"https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",integrity:"sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",license:"MIT",engines:{node:">=10"},funding:{url:"https://github.com/sponsors/sindresorhus"}},"node_modules/flatbuffers":{version:"25.9.23",resolved:"https://registry.npmjs.org/flatbuffers/-/flatbuffers-25.9.23.tgz",integrity:"sha512-MI1qs7Lo4Syw0EOzUl0xjs2lsoeqFku44KpngfIduHBYvzm8h2+7K8YMQh1JtVVVrUvhLpNwqVi4DERegUJhPQ==",license:"Apache-2.0"},"node_modules/global-agent":{version:"3.0.0",resolved:"https://registry.npmjs.org/global-agent/-/global-agent-3.0.0.tgz",integrity:"sha512-PT6XReJ+D07JvGoxQMkT6qji/jVNfX/h364XHZOWeRzy64sSFr+xJ5OX7LI3b4MPQzdL4H8Y8M0xzPpsVMwA8Q==",license:"BSD-3-Clause",dependencies:{boolean:"^3.0.1","es6-error":"^4.1.1",matcher:"^3.0.0",roarr:"^2.15.3",semver:"^7.3.2","serialize-error":"^7.0.1"},engines:{node:">=10.0"}},"node_modules/globalthis":{version:"1.0.4",resolved:"https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz",integrity:"sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==",license:"MIT",dependencies:{"define-properties":"^1.2.1",gopd:"^1.0.1"},engines:{node:">= 0.4"},funding:{url:"https://github.com/sponsors/ljharb"}},"node_modules/gopd":{version:"1.2.0",resolved:"https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",integrity:"sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",license:"MIT",engines:{node:">= 0.4"},funding:{url:"https://github.com/sponsors/ljharb"}},"node_modules/guid-typescript":{version:"1.0.9",resolved:"https://registry.npmjs.org/guid-typescript/-/guid-typescript-1.0.9.tgz",integrity:"sha512-Y8T4vYhEfwJOTbouREvG+3XDsjr8E3kIr7uf+JZ0BYloFsttiHU0WfvANVsR7TxNUJa/WpCnw/Ino/p+DeBhBQ==",license:"ISC"},"node_modules/has-property-descriptors":{version:"1.0.2",resolved:"https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz",integrity:"sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==",license:"MIT",dependencies:{"es-define-property":"^1.0.0"},funding:{url:"https://github.com/sponsors/ljharb"}},"node_modules/json-stringify-safe":{version:"5.0.1",resolved:"https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",integrity:"sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==",license:"ISC"},"node_modules/kokoro-js":{version:"1.2.1",resolved:"https://registry.npmjs.org/kokoro-js/-/kokoro-js-1.2.1.tgz",integrity:"sha512-oq0HZJWis3t8lERkMJh84WLU86dpYD0EuBPtqYnLlQzyFP1OkyBRDcweAqCfhNOpltyN9j/azp1H6uuC47gShw==",license:"Apache-2.0",dependencies:{"@huggingface/transformers":"^3.5.1",phonemizer:"^1.2.1"}},"node_modules/long":{version:"5.3.2",resolved:"https://registry.npmjs.org/long/-/long-5.3.2.tgz",integrity:"sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==",license:"Apache-2.0"},"node_modules/matcher":{version:"3.0.0",resolved:"https://registry.npmjs.org/matcher/-/matcher-3.0.0.tgz",integrity:"sha512-OkeDaAZ/bQCxeFAozM55PKcKU0yJMPGifLwV4Qgjitu+5MoAfSQN4lsLJeXZ1b8w0x+/Emda6MZgXS1jvsapng==",license:"MIT",dependencies:{"escape-string-regexp":"^4.0.0"},engines:{node:">=10"}},"node_modules/minipass":{version:"7.1.3",resolved:"https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz",integrity:"sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==",license:"BlueOak-1.0.0",engines:{node:">=16 || 14 >=14.17"}},"node_modules/minizlib":{version:"3.1.0",resolved:"https://registry.npmjs.org/minizlib/-/minizlib-3.1.0.tgz",integrity:"sha512-KZxYo1BUkWD2TVFLr0MQoM8vUUigWD3LlD83a/75BqC+4qE0Hb1Vo5v1FgcfaNXvfXzr+5EhQ6ing/CaBijTlw==",license:"MIT",dependencies:{minipass:"^7.1.2"},engines:{node:">= 18"}},"node_modules/object-keys":{version:"1.1.1",resolved:"https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz",integrity:"sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==",license:"MIT",engines:{node:">= 0.4"}},"node_modules/onnxruntime-common":{version:"1.21.0",resolved:"https://registry.npmjs.org/onnxruntime-common/-/onnxruntime-common-1.21.0.tgz",integrity:"sha512-Q632iLLrtCAVOTO65dh2+mNbQir/QNTVBG3h/QdZBpns7mZ0RYbLRBgGABPbpU9351AgYy7SJf1WaeVwMrBFPQ==",license:"MIT"},"node_modules/onnxruntime-node":{version:"1.21.0",resolved:"https://registry.npmjs.org/onnxruntime-node/-/onnxruntime-node-1.21.0.tgz",integrity:"sha512-NeaCX6WW2L8cRCSqy3bInlo5ojjQqu2fD3D+9W5qb5irwxhEyWKXeH2vZ8W9r6VxaMPUan+4/7NDwZMtouZxEw==",hasInstallScript:!0,license:"MIT",os:["win32","darwin","linux"],dependencies:{"global-agent":"^3.0.0","onnxruntime-common":"1.21.0",tar:"^7.0.1"}},"node_modules/onnxruntime-web":{version:"1.22.0-dev.20250409-89f8206ba4",resolved:"https://registry.npmjs.org/onnxruntime-web/-/onnxruntime-web-1.22.0-dev.20250409-89f8206ba4.tgz",integrity:"sha512-0uS76OPgH0hWCPrFKlL8kYVV7ckM7t/36HfbgoFw6Nd0CZVVbQC4PkrR8mBX8LtNUFZO25IQBqV2Hx2ho3FlbQ==",license:"MIT",dependencies:{flatbuffers:"^25.1.24","guid-typescript":"^1.0.9",long:"^5.2.3","onnxruntime-common":"1.22.0-dev.20250409-89f8206ba4",platform:"^1.3.6",protobufjs:"^7.2.4"}},"node_modules/onnxruntime-web/node_modules/onnxruntime-common":{version:"1.22.0-dev.20250409-89f8206ba4",resolved:"https://registry.npmjs.org/onnxruntime-common/-/onnxruntime-common-1.22.0-dev.20250409-89f8206ba4.tgz",integrity:"sha512-vDJMkfCfb0b1A836rgHj+ORuZf4B4+cc2bASQtpeoJLueuFc5DuYwjIZUBrSvx/fO5IrLjLz+oTrB3pcGlhovQ==",license:"MIT"},"node_modules/phonemizer":{version:"1.2.1",resolved:"https://registry.npmjs.org/phonemizer/-/phonemizer-1.2.1.tgz",integrity:"sha512-v0KJ4mi2T4Q7eJQ0W15Xd4G9k4kICSXE8bpDeJ8jisL4RyJhNWsweKTOi88QXFc4r4LZlz5jVL5lCHhkpdT71A==",license:"Apache-2.0"},"node_modules/platform":{version:"1.3.6",resolved:"https://registry.npmjs.org/platform/-/platform-1.3.6.tgz",integrity:"sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==",license:"MIT"},"node_modules/protobufjs":{version:"7.6.6",resolved:"https://registry.npmjs.org/protobufjs/-/protobufjs-7.6.6.tgz",integrity:"sha512-dYDWdjSl5RNb7SgPxGQcRU+GtvP7s2fpkrY0r432PcOIaZ0/rBcxEZnQN67iJhFuQiVw754JDoPruPCNdGsbjg==",hasInstallScript:!0,license:"BSD-3-Clause",dependencies:{"@protobufjs/aspromise":"^1.1.2","@protobufjs/base64":"^1.1.2","@protobufjs/codegen":"^2.0.5","@protobufjs/eventemitter":"^1.1.1","@protobufjs/fetch":"^1.1.1","@protobufjs/float":"^1.0.2","@protobufjs/path":"^1.1.2","@protobufjs/pool":"^1.1.0","@protobufjs/utf8":"^1.1.1","@types/node":">=13.7.0",long:"^5.3.2"},engines:{node:">=12.0.0"}},"node_modules/roarr":{version:"2.15.4",resolved:"https://registry.npmjs.org/roarr/-/roarr-2.15.4.tgz",integrity:"sha512-CHhPh+UNHD2GTXNYhPWLnU8ONHdI+5DI+4EYIAOaiD63rHeYlZvyh8P+in5999TTSFgUYuKUAjzRI4mdh/p+2A==",license:"BSD-3-Clause",dependencies:{boolean:"^3.0.1","detect-node":"^2.0.4",globalthis:"^1.0.1","json-stringify-safe":"^5.0.1","semver-compare":"^1.0.0","sprintf-js":"^1.1.2"},engines:{node:">=8.0"}},"node_modules/semver":{version:"7.8.5",resolved:"https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",integrity:"sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",license:"ISC",bin:{semver:"bin/semver.js"},engines:{node:">=10"}},"node_modules/semver-compare":{version:"1.0.0",resolved:"https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz",integrity:"sha512-YM3/ITh2MJ5MtzaM429anh+x2jiLVjqILF4m4oyQB18W7Ggea7BfqdH/wGMK7dDiMghv/6WG7znWMwUDzJiXow==",license:"MIT"},"node_modules/serialize-error":{version:"7.0.1",resolved:"https://registry.npmjs.org/serialize-error/-/serialize-error-7.0.1.tgz",integrity:"sha512-8I8TjW5KMOKsZQTvoxjuSIa7foAwPWGOts+6o7sgjz41/qMD9VQHEDxi6PBvK2l0MXUmqZyNpUK+T2tQaaElvw==",license:"MIT",dependencies:{"type-fest":"^0.13.1"},engines:{node:">=10"},funding:{url:"https://github.com/sponsors/sindresorhus"}},"node_modules/sharp":{version:"0.35.5",resolved:"https://registry.npmjs.org/sharp/-/sharp-0.35.5.tgz",integrity:"sha512-Ywn4OnzGukp7CDMrp08RQ50YKmuwG47brZgIVPTvBaaAfQlRlygrRqSrxdCiL9M+LlzLBiJ68IR1QqvzHyjC7g==",license:"Apache-2.0",dependencies:{"@img/colour":"^1.1.0","detect-libc":"^2.1.2",semver:"^7.8.5"},engines:{node:">=20.9.0"},funding:{url:"https://opencollective.com/libvips"},optionalDependencies:{"@img/sharp-darwin-arm64":"0.35.5","@img/sharp-darwin-x64":"0.35.5","@img/sharp-freebsd-wasm32":"0.35.5","@img/sharp-libvips-darwin-arm64":"1.3.4","@img/sharp-libvips-darwin-x64":"1.3.4","@img/sharp-libvips-linux-arm":"1.3.4","@img/sharp-libvips-linux-arm64":"1.3.4","@img/sharp-libvips-linux-ppc64":"1.3.4","@img/sharp-libvips-linux-riscv64":"1.3.4","@img/sharp-libvips-linux-s390x":"1.3.4","@img/sharp-libvips-linux-x64":"1.3.4","@img/sharp-libvips-linuxmusl-arm64":"1.3.4","@img/sharp-libvips-linuxmusl-x64":"1.3.4","@img/sharp-linux-arm":"0.35.5","@img/sharp-linux-arm64":"0.35.5","@img/sharp-linux-ppc64":"0.35.5","@img/sharp-linux-riscv64":"0.35.5","@img/sharp-linux-s390x":"0.35.5","@img/sharp-linux-x64":"0.35.5","@img/sharp-linuxmusl-arm64":"0.35.5","@img/sharp-linuxmusl-x64":"0.35.5","@img/sharp-webcontainers-wasm32":"0.35.5","@img/sharp-win32-arm64":"0.35.5","@img/sharp-win32-ia32":"0.35.5","@img/sharp-win32-x64":"0.35.5"},peerDependenciesMeta:{"@types/node":{optional:!0}}},"node_modules/sprintf-js":{version:"1.1.3",resolved:"https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz",integrity:"sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==",license:"BSD-3-Clause"},"node_modules/tar":{version:"7.5.22",resolved:"https://registry.npmjs.org/tar/-/tar-7.5.22.tgz",integrity:"sha512-MFO/QzvtAOmJbkhOaCTvbGcFN9L9b+JunIsDwaKljSOdcLMea3NJ1k9Usz/rjdfSXTq4dfzfeS7W4p4YOAAHeA==",license:"BlueOak-1.0.0",dependencies:{"@isaacs/fs-minipass":"^4.0.0",chownr:"^3.0.0",minipass:"^7.1.2",minizlib:"^3.1.0",yallist:"^5.0.0"},engines:{node:">=18"}},"node_modules/tslib":{version:"2.8.1",resolved:"https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",integrity:"sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",license:"0BSD",optional:!0},"node_modules/type-fest":{version:"0.13.1",resolved:"https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz",integrity:"sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==",license:"(MIT OR CC0-1.0)",engines:{node:">=10"},funding:{url:"https://github.com/sponsors/sindresorhus"}},"node_modules/undici-types":{version:"8.9.0",resolved:"https://registry.npmjs.org/undici-types/-/undici-types-8.9.0.tgz",integrity:"sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg==",license:"MIT"},"node_modules/yallist":{version:"5.0.0",resolved:"https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz",integrity:"sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==",license:"BlueOak-1.0.0",engines:{node:">=18"}}}},_V="onnx-community/Kokoro-82M-v1.0-ONNX",$w=`export { KokoroTTS, TextSplitterStream } from "kokoro-js";
132
+ export { env } from "@huggingface/transformers";
133
+ `,yV=`runtime-${dV("sha256").update(JSON.stringify([Mw,Dw,$w])).digest("hex").slice(0,16)}`,SV=de({program:"npm",subcommands:["ci"],flags:{"--ignore-scripts":"bool","--omit":"value","--no-audit":"bool","--no-fund":"bool","--loglevel":"value"},endOfOptions:!0,inheritEnv:["npm_config_registry","npm_config_cafile","npm_config_proxy","npm_config_https_proxy","npm_config_noproxy","HTTP_PROXY","HTTPS_PROXY","NO_PROXY","http_proxy","https_proxy","no_proxy"]});function EV(e){let t=e.XDG_CACHE_HOME?.trim()||Vr(gV(),".cache");return e.SF_KOKORO_HOME?.trim()||Vr(t,"superfactory","kokoro")}var xw=(e)=>e.SF_KOKORO_DTYPE?.trim()||"fp32",zc=new Map;async function bV({text:e,voice:t},r){let n=EV(r),o=xw(r),i=`${n}:${o}`,s=zc.get(i);if(!s)s=wV(n,o),zc.set(i,s),s.catch(()=>zc.delete(i));let{tts:l,splitter:a}=await s,c=a();c.push(e),c.close();let u=[];if(await Lw(async()=>{for await(let{audio:f}of l.stream(c,{voice:t}))u.push(iV(f.audio,f.sampling_rate))}),u.length===0)throw Error("Kokoro returned no audio.");return Ow(u,0)}async function wV(e,t){let r=await TV(e),n=await import(vV(Vr(r,"entry.mjs")).href),o=Vr(e,"models"),i=Vr(o,`.ready-${t}`);n.env.cacheDir=o,n.env.allowRemoteModels=!Tu(i);let s=await Lw(()=>n.KokoroTTS.from_pretrained(_V,{dtype:t,device:"cpu"}));return await Va(i,""),{tts:s,splitter:()=>new n.TextSplitterStream}}async function TV(e){let t=Vr(e,yV),r=Vr(t,"entry.mjs");if(Tu(r))return t;await fV(e,{recursive:!0});let n=await pV(Vr(e,".install-"));try{await Va(Vr(n,"package.json"),JSON.stringify(Mw,null,2)),await Va(Vr(n,"package-lock.json"),JSON.stringify(Dw,null,2));let o=await kw(Rw(SV).sub("ci").flag("--ignore-scripts").flag("--omit","dev").flag("--no-audit").flag("--no-fund").flag("--loglevel","error").in(n).timeoutMs(600000).build());if(o.exitCode!==0)throw Error(`Could not install the local voice (npm ci, kokoro-js): ${o.stderr.slice(-600)}`);await Va(Vr(n,"entry.mjs"),$w),await hV(n,t).catch((i)=>{if(!Tu(r))throw i})}finally{await mV(n,{recursive:!0,force:!0})}return t}async function Lw(e){let{log:t,info:r}=console;console.log=console.info=console.error;try{return await e()}finally{console.log=t,console.info=r}}var qw={Zephyr:["Bright","f"],Puck:["Upbeat","m"],Charon:["Informative","m"],Kore:["Firm","f"],Fenrir:["Excitable","m"],Leda:["Youthful","f"],Orus:["Firm","m"],Aoede:["Breezy","f"],Callirrhoe:["Easy-going","f"],Autonoe:["Bright","f"],Enceladus:["Breathy","m"],Iapetus:["Clear","m"],Umbriel:["Easy-going","m"],Algieba:["Smooth","m"],Despina:["Smooth","f"],Erinome:["Clear","f"],Algenib:["Gravelly","m"],Rasalgethi:["Informative","m"],Laomedeia:["Upbeat","f"],Achernar:["Soft","f"],Alnilam:["Firm","m"],Schedar:["Even","m"],Gacrux:["Mature","f"],Pulcherrima:["Forward","f"],Achird:["Friendly","m"],Zubenelgenubi:["Casual","m"],Vindemiatrix:["Gentle","f"],Sadachbia:["Lively","m"],Sadaltager:["Knowledgeable","m"],Sulafat:["Warm","f"]},CV={af_heart:"Warm, natural (American); the default",af_bella:"Lively (American)",af_nicole:"Soft, close (American)",bf_emma:"Clear (British)",am_michael:"Calm, even (American)",am_fenrir:"Deep (American)",am_puck:"Upbeat (American)",bm_george:"Mature (British)",bm_fable:"Storyteller (British)"},RV={Puck:"am_puck",Fenrir:"am_fenrir"},Uw=(e)=>/^[ab][fm]_[a-z]+$/.test(e);function cf(e){if(Uw(e))return e;return RV[e]??(qw[e]?.[1]==="m"?"am_michael":"af_heart")}function Fw(e){if(!Uw(e))return e;return e[1]==="m"?"Charon":"Kore"}var AV=()=>Object.entries(qw).map(([e,[t]])=>({name:e,character:t,local:cf(e)})),IV=()=>Object.entries(CV).map(([e,t])=>({name:e,character:t})),PV="gemini-3.1-flash-live-preview",ja=class{constructor(e,t){this.gemini=e,this.env=t}gemini;env;fallback;get engine(){return this.localReason()?"kokoro":"gemini-live"}get id(){return this.engine==="kokoro"?`kokoro:${xw(this.env)}`:`gemini-live:${this.model}`}get model(){return LH("SF_VOICE_MODEL",PV,this.env)}async narrate(e,t){for(let{out:n}of e)lf(n);if(this.engine==="gemini-live")try{let n=this.gemini(),o=[];for(let{script:i}of e)o.push(await this.speak(i,(s)=>this.live(n,s,t)));return{engine:"gemini-live",note:this.note(),files:await Vg(e,o,"gemini-live")}}catch(n){this.fallback=`Gemini failed: ${n instanceof Error?n.message:String(n)}`.slice(0,200)}let r=[];for(let{script:n}of e)r.push(await this.speak(n,(o)=>bV({...o,voice:cf(o.voice)},this.env)));return{engine:"kokoro",note:this.note(),files:await Vg(e,r,"kokoro")}}note(){let e=this.localReason();return e?`Voice: Kokoro on this machine (${e}).`:`Voice: Gemini Live (${this.model}).`}live(e,t,r){return cV(e,{...t,voice:Fw(t.voice),style:r,model:this.model})}async speak(e,t){let r=e.speakers?.length?NV(e):[{text:e.text,voice:e.voice}],n=[];for(let o of r)n.push(await t(o));return Ow(n)}localReason(){if(this.env.SF_VOICE_ENGINE?.trim().toLowerCase()==="kokoro")return"SF_VOICE_ENGINE=kokoro";if(!Ew(this.env))return"no Gemini key";return this.fallback}};async function Vg(e,t,r){let n=[];for(let[o,{script:i,out:s}]of e.entries()){let l=t[o];n.push({path:await lV(l,s),durationSeconds:sV(l),voice:kV(i,r),format:lf(s)})}return n}function kV({voice:e,speakers:t},r){let n=(o)=>r==="kokoro"?cf(o):Fw(o);return t?.length?t.map((o)=>`${o.name}=${n(o.voice)}`).join(", "):n(e)}function NV({text:e,voice:t,speakers:r=[]}){let n=new Map(r.map((s)=>[s.name.toLowerCase(),s.voice])),o=[],i=r[0]?.voice??t;for(let s of e.split(`
134
+ `)){let l=s.match(/^\s*([^:]{1,40}):\s*(.*)$/),a=l?.[1]&&n.get(l[1].trim().toLowerCase()),c=(a?l?.[2]:s)?.trim();if(a)i=a;if(!c)continue;let u=o.at(-1);if(u&&!a&&u.voice===i)u.text+=` ${c}`;else o.push({text:c,voice:i})}return o}function MV(e){return{content:[{type:"text",text:JSON.stringify(e,null,2)}],structuredContent:e}}function DV(e){return{content:[{type:"text",text:e instanceof Error?e.message:String(e)}],isError:!0}}async function Vc(e){try{return MV(await e())}catch(t){return DV(t)}}var jg=k().default("Kore").describe("A Gemini voice (see list_voices), e.g. Kore (firm), Puck (upbeat), Achird (friendly). Without a Gemini key a local voice of the same kind speaks; a Kokoro id such as af_heart also works"),Wg=k().optional().describe("How to say it, in plain words, e.g. 'in a calm, friendly product-demo tone, not too fast' (Gemini only)");function $V({gemini:e=Sw(),env:t=process.env}={}){let r=new NE({name:"sf-narration-voice",version:"0.2.0"});return r.registerTool("generate_narration",{title:"Generate narration audio",description:"Speak a script and save it as .wav, .m4a or .mp3: with Gemini Live when a Gemini key is set, else with Kokoro on this machine. Returns the file, its duration, and a one-line `note` saying which voice engine spoke.",inputSchema:X({text:k().min(1).describe("The exact words to say. For two voices, prefix lines with the speaker names given in `speakers`"),out:k().describe("Output path ending in .wav, .m4a or .mp3"),voice:jg,style:Wg,speakers:ie(X({name:k(),voice:k()})).max(2).optional().describe("Two named speakers for a dialogue, each with its voice")})},({out:n,text:o,voice:i,style:s,speakers:l})=>Vc(async()=>{let{engine:a,note:c,files:u}=await new ja(e,t).narrate([{script:{text:o,voice:i,speakers:l},out:n}],s);return{...u[0],engine:a,note:c}})),r.registerTool("generate_narration_segments",{title:"Generate narration per scene",description:"Speak several short lines, one audio file each, so each can be placed at its own moment of a screen recording. Returns each file with its duration, in order, and a one-line `note` saying which voice engine spoke.",inputSchema:X({segments:ie(X({id:k().optional(),text:k().min(1)})).min(1),outDir:k().describe("Folder for the files, named <id or index>.<format>"),format:Ke(["wav","m4a","mp3"]).default("wav"),voice:jg,style:Wg})},({segments:n,outDir:o,format:i,voice:s,style:l})=>Vc(async()=>{let a=n.map(({id:h,text:g},p)=>({id:h??String(p+1).padStart(2,"0"),text:g})),{engine:c,note:u,files:f}=await new ja(e,t).narrate(a.map(({id:h,text:g})=>({script:{text:g,voice:s},out:OV(o,`${h}.${i}`)})),l);return{engine:c,note:u,segments:f.map((h,g)=>({id:a[g]?.id,text:a[g]?.text,...h})),totalSeconds:Math.round(f.reduce((h,g)=>h+g.durationSeconds,0)*100)/100}})),r.registerTool("list_voices",{title:"List narration voices",description:"The Gemini voices and their character, each with the local Kokoro voice that stands in for it without a Gemini key, plus the best local voices. Says which engine would speak now.",inputSchema:X({}),annotations:{readOnlyHint:!0}},()=>Vc(async()=>{let n=new ja(e,t);return{engine:n.engine,note:n.note(),voices:AV(),localVoices:IV()}})),r}async function xV(e){let{values:t,positionals:r}=OR({args:e,allowPositionals:!0,options:{out:{type:"string"},voice:{type:"string",default:"Kore"},style:{type:"string"}}}),n=r.join(" ").trim();if(!t.out||!n)throw Error("usage: say --out <file.wav|.m4a|.mp3> [--voice Kore] [--style …] <text>");let{engine:o,note:i,files:s}=await new ja(Sw(),process.env).narrate([{script:{text:n,voice:t.voice},out:t.out}],t.style);console.log(JSON.stringify({...s[0],engine:o,note:i},null,2))}var[LV,...qV]=process.argv.slice(2);if(LV==="say")xV(qV).catch((e)=>{console.error(e instanceof Error?e.message:String(e)),process.exit(1)});else B$(()=>$V());