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,135 @@
1
+ import{createRequire as eC}from"node:module";import{statSync as Zf,createReadStream as PC,promises as kC}from"node:fs";import{basename as NC}from"node:path";import so,{PassThrough as ip}from"node:stream";import{types as sp,deprecate as Pc,promisify as DC}from"node:util";import{Buffer as Nr}from"node:buffer";import{types as cp}from"node:util";import Sa from"node:http";import{isIP as UC}from"node:net";import{format as VC}from"node:url";import{deprecate as zC}from"node:util";import JC from"node:http";import KC from"node:https";import hi from"node:zlib";import pp,{PassThrough as hp,pipeline as mi}from"node:stream";import{Buffer as Ea}from"node:buffer";import fh from"node:process";import{createWriteStream as V1}from"fs";import*as Zl from"fs/promises";import{writeFile as z1}from"fs/promises";import{Readable as j1}from"node:stream";import{finished as W1}from"node:stream/promises";import*as qE from"path";import{stat as H4}from"node:fs/promises";import{resolve as V4}from"node:path";import{existsSync as z4,readFileSync as j4}from"node:fs";import{delimiter as $g,dirname as Oj,extname as W4,join as J4,resolve as $j}from"node:path";import{existsSync as Q4,realpathSync as Mg,statSync as ez}from"node:fs";import{isAbsolute as Iw,relative as tz}from"node:path";import{spawn as fz,spawnSync as c9}from"node:child_process";import{closeSync as pz,existsSync as wu,constants as Ua,openSync as Lg,readdirSync as hz}from"node:fs";import{constants as mz,getPriority as gz,setPriority as vz}from"node:os";import{join as _z}from"node:path";import{Readable as yz}from"node:stream";import{closeSync as Lz,existsSync as cf,openSync as qz,readFileSync as Nw,readSync as Uz,statSync as Fz}from"node:fs";import{basename as Vc,dirname as vl,join as Nn}from"node:path";import{statSync as h2}from"node:fs";import{mkdtemp as m2,readFile as g2,rm as jg}from"node:fs/promises";import{tmpdir as v2}from"node:os";import{join as Wg,resolve as _2}from"node:path";import{randomUUID as O2}from"node:crypto";var ci=eC(import.meta.url),{create:tC,defineProperty:Ru,getOwnPropertyDescriptor:rC,getOwnPropertyNames:Au,getPrototypeOf:nC}=Object,oC=Object.prototype.hasOwnProperty,we=((e)=>typeof ci<"u"?ci:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof ci<"u"?ci:t)[r]}):e)(function(e){if(typeof ci<"u")return ci.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[Au(e)[0]])(e=0)),t}catch(o){throw r=[o],o}},Se=(e,t)=>function r(){try{return t||(0,e[Au(e)[0]])((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},Bs=(e,t)=>{for(var r in t)Ru(e,r,{get:t[r],enumerable:!0})},iC=(e,t,r,n)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let o of Au(t))if(!oC.call(e,o)&&o!==r)Ru(e,o,{get:()=>t[o],enumerable:!(n=rC(t,o))||n.enumerable})}return e},Cr=(e,t,r)=>(r=e!=null?tC(nC(e)):{},iC(t||!e||!e.__esModule?Ru(r,"default",{value:e,enumerable:!0}):r,e)),sC=Se({"../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}}}),aC=Se({"../node_modules/.bun/retry@0.13.1/node_modules/retry/lib/retry.js"(e){var t=sC();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}}}}),lC=Se({"../node_modules/.bun/retry@0.13.1/node_modules/retry/index.js"(e,t){t.exports=aC()}}),cC=Se({"../node_modules/.bun/p-retry@4.6.2/node_modules/p-retry/index.js"(e,t){var r=lC(),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}}),tv=Se({"../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}}}),uC=Se({"../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"}}}),dC=Se({"../node_modules/.bun/gaxios@7.3.1+759ce506b1ed1a42/node_modules/gaxios/build/cjs/src/util.cjs"(e,t){var r=uC();t.exports={pkg:r}}}),rv=Se({"../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(tv()),n=t(dC()),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}}}),fC=Se({"../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)}}}),nv=Se({"../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}}),pC=Se({"../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":"")}}}),ov=Se({"../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=pC(),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}}),hC=Se({"../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=ov()(e);var{formatters:l}=t.exports;l.j=function(a){try{return JSON.stringify(a)}catch(c){return"[UnexpectedJSONParseError]: "+c.message}}}}),mC=Se({"../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)}}}),gC=Se({"../node_modules/.bun/supports-color@7.2.0/node_modules/supports-color/index.js"(e,t){var r=we("os"),n=we("tty"),o=mC(),{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)))}}}),vC=Se({"../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=gC();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=ov()(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)}}}),iv=Se({"../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=hC();else t.exports=vC()}}),_C=Se({"../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}}),yC=Se({"../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(_C(),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}}),SC=Se({"../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(iv()),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}}),EC=Se({"../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(iv()),c=yC(),u=we("url"),f=SC(),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 bC(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 sv,wC=Jt({"../node_modules/.bun/data-uri-to-buffer@4.0.1/node_modules/data-uri-to-buffer/dist/index.js"(){sv=bC}}),TC=Se({"../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(V){return h(V)}}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,V=M+1,re=v._elements,le=re[M];if(V===T)I=v._next,V=0;if(--this._size,this._cursor=V,v!==I)this._front=I;return re[M]=void 0,le}forEach(v){let I=this._cursor,M=this._front,V=M._elements;while(I!==V.length||M._next!==void 0){if(I===V.length){if(M=M._next,V=M._elements,I=0,V.length===0)break}v(V[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")ae(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 ae(v){v._closedPromise=u((I,M)=>{v._closedPromise_resolve=I,v._closedPromise_reject=M})}function ve(v,I){ae(v),j(v,I)}function me(v){ae(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)},X=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 Ve(v){return typeof v==="object"&&v!==null||typeof v==="function"}function Ie(v,I){if(!Ve(v))throw TypeError(`${I} is not an object.`)}function We(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(X(v))}function J(v,I){let V=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>V)throw TypeError(`${I} is outside the accepted range of 0 to ${V}, inclusive`);if(!q(re)||re===0)return 0;return re}function Y(v,I){if(!to(v))throw TypeError(`${I} is not a ReadableStream.`)}function ee(v){return new z(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 z{constructor(v){if(We(v,1,"ReadableStreamDefaultReader"),Y(v,"First parameter"),ro(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(z.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),s(z.prototype.cancel,"cancel"),s(z.prototype.read,"read"),s(z.prototype.releaseLock,"releaseLock"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(z.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 z}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((V)=>{V._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 Je{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,V=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)}}),V}_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),V=new Je(M,I),re=Object.create(St);return re._asyncIteratorImpl=V,re}function Xt(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_asyncIteratorImpl"))return!1;try{return v._asyncIteratorImpl instanceof Je}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,ze;function Qe(v){return v.slice()}function or(v,I,M,V,re){new Uint8Array(v).set(new Uint8Array(M,V,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)},Mt=(v)=>{if(typeof v.detached==="boolean")Mt=(I)=>I.detached;else Mt=(I)=>I.byteLength===0;return Mt(v)};function ir(v,I,M){if(v.slice)return v.slice(I,M);let V=M-I,re=new ArrayBuffer(V);return or(re,0,v,I,V),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}(),V=M.next;return{iterator:M,nextMethod:V,done:!1}}let Sr=(ze=(at=Symbol.asyncIterator)!==null&&at!==void 0?at:(Ue=Symbol.for)===null||Ue===void 0?void 0:Ue.call(Symbol,"Symbol.asyncIterator"))!==null&&ze!==void 0?ze:"@@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 V=R(M,v,[]);if(!o(V))throw TypeError("The iterator method must return an object");let re=V.next;return{iterator:V,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 go(v){return Boolean(v.done)}function Wo(v){return v.value}function Fn(v){if(typeof v!=="number")return!1;if(It(v))return!1;if(v<0)return!1;return!0}function Gn(v){let I=ir(v.buffer,v.byteOffset,v.byteOffset+v.byteLength);return new Uint8Array(I)}function fn(v){let I=v._queue.shift();if(v._queueTotalSize-=I.size,v._queueTotalSize<0)v._queueTotalSize=0;return I.value}function pn(v,I,M){if(!Fn(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 vo(v){return v._queue.peek().value}function fr(v){v._queue=new C,v._queueTotalSize=0}function Bn(v){return v===DataView}function _o(v){return Bn(v.constructor)}function Jo(v){if(Bn(v))return 1;return v.BYTES_PER_ELEMENT}class pr{constructor(){throw TypeError("Illegal constructor")}get view(){if(!hn(this))throw Qn("view");return this._view}respond(v){if(!hn(this))throw Qn("respond");if(We(v,1,"respond"),v=J(v,"First parameter"),this._associatedReadableByteStreamController===void 0)throw TypeError("This BYOB request has been invalidated");if(Mt(this._view.buffer))throw TypeError("The BYOB request's buffer has been detached and so cannot be used as a response");_n(this._associatedReadableByteStreamController,v)}respondWithNewView(v){if(!hn(this))throw Qn("respondWithNewView");if(We(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(Mt(v.buffer))throw TypeError("The given view's buffer has been detached and so cannot be used as a response");yn(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 Yn(this)}get desiredSize(){if(!br(this))throw Fr("desiredSize");return Zn(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`);Yr(this)}enqueue(v){if(!br(this))throw Fr("enqueue");if(We(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`);vn(this,v)}error(v=void 0){if(!br(this))throw Fr("error");Yt(this,v)}[D](v){Hn(this),fr(this);let I=this._cancelAlgorithm(v);return gn(this),I}[N](v){let I=this._controlledReadableByteStream;if(this._queueTotalSize>0){yo(this,v);return}let M=this._autoAllocateChunkSize;if(M!==void 0){let V;try{V=new ArrayBuffer(M)}catch(le){v._errorSteps(le);return}let re={buffer:V,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 hn(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_associatedReadableByteStreamController"))return!1;return v instanceof pr}function wr(v){if(!Yo(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},(V)=>(Yt(v,V),null))}function Hn(v){qr(v),v._pendingPullIntos=new C}function mn(v,I){let M=!1;if(v._state==="closed")M=!0;let V=Vn(I);if(I.readerType==="default")te(v,V,M);else eo(v,V,M)}function Vn(v){let{bytesFilled:I,elementSize:M}=v;return new v.viewConstructor(v.buffer,v.byteOffset,I/M)}function Xr(v,I,M,V){v._queue.push({buffer:I,byteOffset:M,byteLength:V}),v._queueTotalSize+=V}function zn(v,I,M,V){let re;try{re=ir(I,M,M+V)}catch(le){throw Yt(v,le),le}Xr(v,re,0,V)}function jn(v,I){if(I.bytesFilled>0)zn(v,I.buffer,I.byteOffset,I.bytesFilled);Vt(v)}function Wn(v,I){let M=Math.min(v._queueTotalSize,I.byteLength-I.bytesFilled),V=I.bytesFilled+M,re=M,le=!1,_e=V%I.elementSize,$e=V-_e;if($e>=I.minimumFill)re=$e-I.bytesFilled,le=!0;let qe=v._queue;while(re>0){let Ke=qe.peek(),Ze=Math.min(re,Ke.byteLength),lt=I.byteOffset+I.bytesFilled;if(or(I.buffer,lt,Ke.buffer,Ke.byteOffset,Ze),Ke.byteLength===Ze)qe.shift();else Ke.byteOffset+=Ze,Ke.byteLength-=Ze;v._queueTotalSize-=Ze,Jn(v,Ze,I),re-=Ze}return le}function Jn(v,I,M){M.bytesFilled+=I}function Kn(v){if(v._queueTotalSize===0&&v._closeRequested)gn(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(Wn(v,I))Vt(v),mn(v._controlledReadableByteStream,I)}}function Ko(v){let I=v._controlledReadableByteStream._reader;while(I._readRequests.length>0){if(v._queueTotalSize===0)return;let M=I._readRequests.shift();yo(v,M)}}function Xo(v,I,M,V){let re=v._controlledReadableByteStream,le=I.constructor,_e=Jo(le),{byteOffset:$e,byteLength:qe}=I,Ke=M*_e,Ze;try{Ze=Lt(I.buffer)}catch(Tt){V._errorSteps(Tt);return}let lt={buffer:Ze,bufferByteLength:Ze.byteLength,byteOffset:$e,byteLength:qe,bytesFilled:0,minimumFill:Ke,elementSize:_e,viewConstructor:le,readerType:"byob"};if(v._pendingPullIntos.length>0){v._pendingPullIntos.push(lt),En(re,V);return}if(re._state==="closed"){let Tt=new le(lt.buffer,lt.byteOffset,0);V._closeSteps(Tt);return}if(v._queueTotalSize>0){if(Wn(v,lt)){let Tt=Vn(lt);Kn(v),V._chunkSteps(Tt);return}if(v._closeRequested){let Tt=TypeError("Insufficient bytes to fill elements in the given buffer");Yt(v,Tt),V._errorSteps(Tt);return}}v._pendingPullIntos.push(lt),En(re,V),wr(v)}function ar(v,I){if(I.readerType==="none")Vt(v);let M=v._controlledReadableByteStream;if(Eo(M))while(bn(M)>0){let V=Vt(v);mn(M,V)}}function lr(v,I,M){if(Jn(v,I,M),M.readerType==="none"){jn(v,M),Ur(v);return}if(M.bytesFilled<M.minimumFill)return;Vt(v);let V=M.bytesFilled%M.elementSize;if(V>0){let re=M.byteOffset+M.bytesFilled;zn(v,M.buffer,re-V,V)}M.bytesFilled-=V,mn(v._controlledReadableByteStream,M),Ur(v)}function Xn(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 Vt(v){return v._pendingPullIntos.shift()}function Yo(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(Eo(I)&&bn(I)>0)return!0;if(Zn(v)>0)return!0;return!1}function gn(v){v._pullAlgorithm=void 0,v._cancelAlgorithm=void 0}function Yr(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 V=TypeError("Insufficient bytes to fill elements in the given buffer");throw Yt(v,V),V}}gn(v),as(I)}function vn(v,I){let M=v._controlledReadableByteStream;if(v._closeRequested||M._state!=="readable")return;let{buffer:V,byteOffset:re,byteLength:le}=I;if(Mt(V))throw TypeError("chunk's buffer is detached and so cannot be enqueued");let _e=Lt(V);if(v._pendingPullIntos.length>0){let $e=v._pendingPullIntos.peek();if(Mt($e.buffer))throw TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk");if(qr(v),$e.buffer=Lt($e.buffer),$e.readerType==="none")jn(v,$e)}if(L(M))if(Ko(v),oe(M)===0)Xr(v,_e,re,le);else{if(v._pendingPullIntos.length>0)Vt(v);let $e=new Uint8Array(_e,re,le);te(M,$e,!1)}else if(Eo(M))Xr(v,_e,re,le),Ur(v);else Xr(v,_e,re,le);wr(v)}function Yt(v,I){let M=v._controlledReadableByteStream;if(M._state!=="readable")return;Hn(v),fr(v),gn(v),Of(M,I)}function yo(v,I){let M=v._queue.shift();v._queueTotalSize-=M.byteLength,Kn(v);let V=new Uint8Array(M.buffer,M.byteOffset,M.byteLength);I._chunkSteps(V)}function Yn(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),V=Object.create(pr.prototype);Zo(V,v,M),v._byobRequest=V}return v._byobRequest}function Zn(v){let I=v._controlledReadableByteStream._state;if(I==="errored")return null;if(I==="closed")return 0;return v._strategyHWM-v._queueTotalSize}function _n(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),Xn(v,I)}function yn(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),Xn(v,re)}function Sn(v,I,M,V,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=V,I._cancelAlgorithm=re,I._autoAllocateChunkSize=_e,I._pendingPullIntos=new C,v._readableStreamController=I;let $e=M();p(f($e),()=>(I._started=!0,wr(I),null),(qe)=>(Yt(I,qe),null))}function So(v,I,M){let V=Object.create(Bt.prototype),re,le,_e;if(I.start!==void 0)re=()=>I.start(V);else re=()=>{return};if(I.pull!==void 0)le=()=>I.pull(V);else le=()=>f(void 0);if(I.cancel!==void 0)_e=(qe)=>I.cancel(qe);else _e=()=>f(void 0);let $e=I.autoAllocateChunkSize;if($e===0)throw TypeError("autoAllocateChunkSize must be greater than 0");Sn(v,V,re,le,_e,M,$e)}function Zo(v,I,M){v._associatedReadableByteStreamController=I,v._view=M}function Qn(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 Zr(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 Qo(v,I){var M;be(v,I);let V=(M=v===null||v===void 0?void 0:v.min)!==null&&M!==void 0?M:1;return{min:J(V,`${I} has member 'min' that`)}}function Qr(v){return new Pt(v)}function En(v,I){v._reader._readIntoRequests.push(I)}function eo(v,I,M){let re=v._reader._readIntoRequests.shift();if(M)re._closeSteps(I);else re._chunkSteps(I)}function bn(v){return v._reader._readIntoRequests.length}function Eo(v){let I=v._reader;if(I===void 0)return!1;if(!Et(I))return!1;return!0}class Pt{constructor(v){if(We(v,1,"ReadableStreamBYOBReader"),Y(v,"First parameter"),ro(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(bo("closed"));return this._closedPromise}cancel(v=void 0){if(!Et(this))return h(bo("cancel"));if(this._ownerReadableStream===void 0)return h(pe("cancel"));return B(this,v)}read(v,I={}){if(!Et(this))return h(bo("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(Mt(v.buffer))return h(TypeError("view's buffer has been detached"));let M;try{M=Qo(I,"options")}catch(qe){return h(qe)}let V=M.min;if(V===0)return h(TypeError("options.min must be greater than 0"));if(!_o(v)){if(V>v.length)return h(RangeError("options.min must be less than or equal to view's length"))}else if(V>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,Ke)=>{re=qe,le=Ke});return en(this,v,V,{_chunkSteps:(qe)=>re({value:qe,done:!1}),_closeSteps:(qe)=>re({value:qe,done:!0}),_errorSteps:(qe)=>le(qe)}),_e}releaseLock(){if(!Et(this))throw bo("releaseLock");if(this._ownerReadableStream===void 0)return;zt(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 en(v,I,M,V){let re=v._ownerReadableStream;if(re._disturbed=!0,re._state==="errored")V._errorSteps(re._storedError);else Xo(re._readableStreamController,I,M,V)}function zt(v){Q(v);let I=TypeError("Reader was released");ta(v,I)}function ta(v,I){let M=v._readIntoRequests;v._readIntoRequests=new C,M.forEach((V)=>{V._errorSteps(I)})}function bo(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 ra(v){let{size:I}=v;if(!I)return()=>1;return I}function na(v,I){be(v,I);let M=v===null||v===void 0?void 0:v.highWaterMark,V=v===null||v===void 0?void 0:v.size;return{highWaterMark:M===void 0?void 0:O(M),size:V===void 0?void 0:Uw(V,`${I} has member 'size' that`)}}function Uw(v,I){return Ce(v,I),(M)=>O(v(M))}function Fw(v,I){be(v,I);let M=v===null||v===void 0?void 0:v.abort,V=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:Gw(M,v,`${I} has member 'abort' that`),close:V===void 0?void 0:Bw(V,v,`${I} has member 'close' that`),start:re===void 0?void 0:Hw(re,v,`${I} has member 'start' that`),write:_e===void 0?void 0:Vw(_e,v,`${I} has member 'write' that`),type:le}}function Gw(v,I,M){return Ce(v,M),(V)=>w(v,I,[V])}function Bw(v,I,M){return Ce(v,M),()=>w(v,I,[])}function Hw(v,I,M){return Ce(v,M),(V)=>R(v,I,[V])}function Vw(v,I,M){return Ce(v,M),(V,re)=>w(v,I,[V,re])}function df(v,I){if(!ei(v))throw TypeError(`${I} is not a WritableStream.`)}function zw(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 Ww(){if(jw)return new AbortController;return}class wn{constructor(v={},I={}){if(v===void 0)v=null;else Ie(v,"First parameter");let M=na(I,"Second parameter"),V=Fw(v,"First parameter");if(pf(this),V.type!==void 0)throw RangeError("Invalid type is specified");let le=ra(M),_e=rs(M,1);aT(this,V,_e,le)}get locked(){if(!ei(this))throw la("locked");return ti(this)}abort(v=void 0){if(!ei(this))return h(la("abort"));if(ti(this))return h(TypeError("Cannot abort a stream that already has a writer"));return oa(this,v)}close(){if(!ei(this))return h(la("close"));if(ti(this))return h(TypeError("Cannot close a stream that already has a writer"));if(tn(this))return h(TypeError("Cannot close an already-closing stream"));return hf(this)}getWriter(){if(!ei(this))throw la("getWriter");return ff(this)}}if(Object.defineProperties(wn.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),s(wn.prototype.abort,"abort"),s(wn.prototype.close,"close"),s(wn.prototype.getWriter,"getWriter"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(wn.prototype,Symbol.toStringTag,{value:"WritableStream",configurable:!0});function ff(v){return new rn(v)}function Jw(v,I,M,V,re=1,le=()=>1){let _e=Object.create(wn.prototype);pf(_e);let $e=Object.create(To.prototype);return Sf(_e,$e,v,I,M,V,re,le),_e}function pf(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 ei(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_writableStreamController"))return!1;return v instanceof wn}function ti(v){if(v._writer===void 0)return!1;return!0}function oa(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 V=v._state;if(V==="closed"||V==="errored")return f(void 0);if(v._pendingAbortRequest!==void 0)return v._pendingAbortRequest._promise;let re=!1;if(V==="erroring")re=!0,I=void 0;let le=u((_e,$e)=>{v._pendingAbortRequest={_promise:void 0,_resolve:_e,_reject:$e,_reason:I,_wasAlreadyErroring:re}});if(v._pendingAbortRequest._promise=le,!re)sc(v,I);return le}function hf(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}),V=v._writer;if(V!==void 0&&v._backpressure&&I==="writable")hc(V);return lT(v._writableStreamController),M}function Kw(v){return u((M,V)=>{let re={_resolve:M,_reject:V};v._writeRequests.push(re)})}function ic(v,I){if(v._state==="writable"){sc(v,I);return}ac(v)}function sc(v,I){let M=v._writableStreamController;v._state="erroring",v._storedError=I;let V=v._writer;if(V!==void 0)gf(V,I);if(!eT(v)&&M._started)ac(v)}function ac(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){ia(v);return}let M=v._pendingAbortRequest;if(v._pendingAbortRequest=void 0,M._wasAlreadyErroring){M._reject(I),ia(v);return}let V=v._writableStreamController[A](M._reason);p(V,()=>(M._resolve(),ia(v),null),(re)=>(M._reject(re),ia(v),null))}function Xw(v){v._inFlightWriteRequest._resolve(void 0),v._inFlightWriteRequest=void 0}function Yw(v,I){v._inFlightWriteRequest._reject(I),v._inFlightWriteRequest=void 0,ic(v,I)}function Zw(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)Tf(M)}function Qw(v,I){if(v._inFlightCloseRequest._reject(I),v._inFlightCloseRequest=void 0,v._pendingAbortRequest!==void 0)v._pendingAbortRequest._reject(I),v._pendingAbortRequest=void 0;ic(v,I)}function tn(v){if(v._closeRequest===void 0&&v._inFlightCloseRequest===void 0)return!1;return!0}function eT(v){if(v._inFlightWriteRequest===void 0&&v._inFlightCloseRequest===void 0)return!1;return!0}function tT(v){v._inFlightCloseRequest=v._closeRequest,v._closeRequest=void 0}function rT(v){v._inFlightWriteRequest=v._writeRequests.shift()}function ia(v){if(v._closeRequest!==void 0)v._closeRequest._reject(v._storedError),v._closeRequest=void 0;let I=v._writer;if(I!==void 0)fc(I,v._storedError)}function lc(v,I){let M=v._writer;if(M!==void 0&&I!==v._backpressure)if(I)mT(M);else hc(M);v._backpressure=I}class rn{constructor(v){if(We(v,1,"WritableStreamDefaultWriter"),df(v,"First parameter"),ti(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(!tn(v)&&v._backpressure)ua(this);else Cf(this);ca(this)}else if(I==="erroring")pc(this,v._storedError),ca(this);else if(I==="closed")Cf(this),pT(this);else{let M=v._storedError;pc(this,M),wf(this,M)}}get closed(){if(!wo(this))return h(Co("closed"));return this._closedPromise}get desiredSize(){if(!wo(this))throw Co("desiredSize");if(this._ownerWritableStream===void 0)throw os("desiredSize");return sT(this)}get ready(){if(!wo(this))return h(Co("ready"));return this._readyPromise}abort(v=void 0){if(!wo(this))return h(Co("abort"));if(this._ownerWritableStream===void 0)return h(os("abort"));return nT(this,v)}close(){if(!wo(this))return h(Co("close"));let v=this._ownerWritableStream;if(v===void 0)return h(os("close"));if(tn(v))return h(TypeError("Cannot close an already-closing stream"));return mf(this)}releaseLock(){if(!wo(this))throw Co("releaseLock");if(this._ownerWritableStream===void 0)return;vf(this)}write(v=void 0){if(!wo(this))return h(Co("write"));if(this._ownerWritableStream===void 0)return h(os("write to"));return _f(this,v)}}if(Object.defineProperties(rn.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),s(rn.prototype.abort,"abort"),s(rn.prototype.close,"close"),s(rn.prototype.releaseLock,"releaseLock"),s(rn.prototype.write,"write"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(rn.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});function wo(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_ownerWritableStream"))return!1;return v instanceof rn}function nT(v,I){let M=v._ownerWritableStream;return oa(M,I)}function mf(v){let I=v._ownerWritableStream;return hf(I)}function oT(v){let I=v._ownerWritableStream,M=I._state;if(tn(I)||M==="closed")return f(void 0);if(M==="errored")return h(I._storedError);return mf(v)}function iT(v,I){if(v._closedPromiseState==="pending")fc(v,I);else hT(v,I)}function gf(v,I){if(v._readyPromiseState==="pending")Rf(v,I);else gT(v,I)}function sT(v){let I=v._ownerWritableStream,M=I._state;if(M==="errored"||M==="erroring")return null;if(M==="closed")return 0;return Ef(I._writableStreamController)}function vf(v){let I=v._ownerWritableStream,M=TypeError("Writer was released and can no longer be used to monitor the stream's closedness");gf(v,M),iT(v,M),I._writer=void 0,v._ownerWritableStream=void 0}function _f(v,I){let M=v._ownerWritableStream,V=M._writableStreamController,re=cT(V,I);if(M!==v._ownerWritableStream)return h(os("write to"));let le=M._state;if(le==="errored")return h(M._storedError);if(tn(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=Kw(M);return uT(V,I,re),_e}let yf={};class To{constructor(){throw TypeError("Illegal constructor")}get abortReason(){if(!cc(this))throw dc("abortReason");return this._abortReason}get signal(){if(!cc(this))throw dc("signal");if(this._abortController===void 0)throw TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(v=void 0){if(!cc(this))throw dc("error");if(this._controlledWritableStream._state!=="writable")return;bf(this,v)}[A](v){let I=this._abortAlgorithm(v);return sa(this),I}[P](){fr(this)}}if(Object.defineProperties(To.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),typeof Symbol.toStringTag==="symbol")Object.defineProperty(To.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});function cc(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_controlledWritableStream"))return!1;return v instanceof To}function Sf(v,I,M,V,re,le,_e,$e){I._controlledWritableStream=v,v._writableStreamController=I,I._queue=void 0,I._queueTotalSize=void 0,fr(I),I._abortReason=void 0,I._abortController=Ww(),I._started=!1,I._strategySizeAlgorithm=$e,I._strategyHWM=_e,I._writeAlgorithm=V,I._closeAlgorithm=re,I._abortAlgorithm=le;let qe=uc(I);lc(v,qe);let Ke=M(),Ze=f(Ke);p(Ze,()=>(I._started=!0,aa(I),null),(lt)=>(I._started=!0,ic(v,lt),null))}function aT(v,I,M,V){let re=Object.create(To.prototype),le,_e,$e,qe;if(I.start!==void 0)le=()=>I.start(re);else le=()=>{return};if(I.write!==void 0)_e=(Ke)=>I.write(Ke,re);else _e=()=>f(void 0);if(I.close!==void 0)$e=()=>I.close();else $e=()=>f(void 0);if(I.abort!==void 0)qe=(Ke)=>I.abort(Ke);else qe=()=>f(void 0);Sf(v,re,le,_e,$e,qe,M,V)}function sa(v){v._writeAlgorithm=void 0,v._closeAlgorithm=void 0,v._abortAlgorithm=void 0,v._strategySizeAlgorithm=void 0}function lT(v){pn(v,yf,0),aa(v)}function cT(v,I){try{return v._strategySizeAlgorithm(I)}catch(M){return ns(v,M),1}}function Ef(v){return v._strategyHWM-v._queueTotalSize}function uT(v,I,M){try{pn(v,I,M)}catch(re){ns(v,re);return}let V=v._controlledWritableStream;if(!tn(V)&&V._state==="writable"){let re=uc(v);lc(V,re)}aa(v)}function aa(v){let I=v._controlledWritableStream;if(!v._started)return;if(I._inFlightWriteRequest!==void 0)return;if(I._state==="erroring"){ac(I);return}if(v._queue.length===0)return;let V=vo(v);if(V===yf)dT(v);else fT(v,V)}function ns(v,I){if(v._controlledWritableStream._state==="writable")bf(v,I)}function dT(v){let I=v._controlledWritableStream;tT(I),fn(v);let M=v._closeAlgorithm();sa(v),p(M,()=>(Zw(I),null),(V)=>(Qw(I,V),null))}function fT(v,I){let M=v._controlledWritableStream;rT(M);let V=v._writeAlgorithm(I);p(V,()=>{Xw(M);let re=M._state;if(fn(v),!tn(M)&&re==="writable"){let le=uc(v);lc(M,le)}return aa(v),null},(re)=>{if(M._state==="writable")sa(v);return Yw(M,re),null})}function uc(v){return Ef(v)<=0}function bf(v,I){let M=v._controlledWritableStream;sa(v),sc(M,I)}function la(v){return TypeError(`WritableStream.prototype.${v} can only be used on a WritableStream`)}function dc(v){return TypeError(`WritableStreamDefaultController.prototype.${v} can only be used on a WritableStreamDefaultController`)}function Co(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 ca(v){v._closedPromise=u((I,M)=>{v._closedPromise_resolve=I,v._closedPromise_reject=M,v._closedPromiseState="pending"})}function wf(v,I){ca(v),fc(v,I)}function pT(v){ca(v),Tf(v)}function fc(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 hT(v,I){wf(v,I)}function Tf(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 ua(v){v._readyPromise=u((I,M)=>{v._readyPromise_resolve=I,v._readyPromise_reject=M}),v._readyPromiseState="pending"}function pc(v,I){ua(v),Rf(v,I)}function Cf(v){ua(v),hc(v)}function Rf(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 mT(v){ua(v)}function gT(v,I){pc(v,I)}function hc(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 vT(){if(typeof globalThis<"u")return globalThis;else if(typeof self<"u")return self;else if(typeof global<"u")return global;return}let mc=vT();function _T(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 yT(){let v=mc===null||mc===void 0?void 0:mc.DOMException;return _T(v)?v:void 0}function ST(){let v=function I(M,V){if(this.message=M||"",this.name=V||"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 ET=yT()||ST();function Af(v,I,M,V,re,le){let _e=ee(v),$e=ff(I);v._disturbed=!0;let qe=!1,Ke=f(void 0);return u((Ze,lt)=>{let Tt;if(le!==void 0){if(Tt=()=>{let Be=le.reason!==void 0?le.reason:new ET("Aborted","AbortError"),mt=[];if(!V)mt.push(()=>{if(I._state==="writable")return oa(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 Cn(){return u((Be,mt)=>{function Rt(Tr){if(Tr)Be();else g(ii(),Rt,mt)}Rt(!1)})}function ii(){if(qe)return f(!0);return g($e._readyPromise,()=>u((Be,mt)=>{ue(_e,{_chunkSteps:(Rt)=>{Ke=g(_f($e,Rt),void 0,n),Be(!1)},_closeSteps:()=>Be(!0),_errorSteps:mt})}))}if(Rn(v,_e._closedPromise,(Be)=>{if(!V)hr(()=>oa(I,Be),!0,Be);else Ar(!0,Be);return null}),Rn(I,$e._closedPromise,(Be)=>{if(!re)hr(()=>Br(v,Be),!0,Be);else Ar(!0,Be);return null}),cr(v,_e._closedPromise,()=>{if(!M)hr(()=>oT($e));else Ar();return null}),tn(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(Cn());function no(){let Be=Ke;return g(Ke,()=>Be!==Ke?no():void 0)}function Rn(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"&&!tn(I))_(no(),Tr);else Tr();function Tr(){return p(Be(),()=>An(mt,Rt),(si)=>An(!0,si)),null}}function Ar(Be,mt){if(qe)return;if(qe=!0,I._state==="writable"&&!tn(I))_(no(),()=>An(Be,mt));else An(Be,mt)}function An(Be,mt){if(vf($e),Q(_e),le!==void 0)le.removeEventListener("abort",Tt);if(Be)lt(mt);else Ze(void 0);return null}})}class nn{constructor(){throw TypeError("Illegal constructor")}get desiredSize(){if(!da(this))throw pa("desiredSize");return gc(this)}close(){if(!da(this))throw pa("close");if(!ni(this))throw TypeError("The stream is not in a state that permits close");Ro(this)}enqueue(v=void 0){if(!da(this))throw pa("enqueue");if(!ni(this))throw TypeError("The stream is not in a state that permits enqueue");return ri(this,v)}error(v=void 0){if(!da(this))throw pa("error");Gr(this,v)}[D](v){fr(this);let I=this._cancelAlgorithm(v);return fa(this),I}[N](v){let I=this._controlledReadableStream;if(this._queue.length>0){let M=fn(this);if(this._closeRequested&&this._queue.length===0)fa(this),as(I);else is(this);v._chunkSteps(M)}else Z(I,v),is(this)}[F](){}}if(Object.defineProperties(nn.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),s(nn.prototype.close,"close"),s(nn.prototype.enqueue,"enqueue"),s(nn.prototype.error,"error"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(nn.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});function da(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_controlledReadableStream"))return!1;return v instanceof nn}function is(v){if(!If(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},(V)=>(Gr(v,V),null))}function If(v){let I=v._controlledReadableStream;if(!ni(v))return!1;if(!v._started)return!1;if(ro(I)&&oe(I)>0)return!0;if(gc(v)>0)return!0;return!1}function fa(v){v._pullAlgorithm=void 0,v._cancelAlgorithm=void 0,v._strategySizeAlgorithm=void 0}function Ro(v){if(!ni(v))return;let I=v._controlledReadableStream;if(v._closeRequested=!0,v._queue.length===0)fa(v),as(I)}function ri(v,I){if(!ni(v))return;let M=v._controlledReadableStream;if(ro(M)&&oe(M)>0)te(M,I,!1);else{let V;try{V=v._strategySizeAlgorithm(I)}catch(re){throw Gr(v,re),re}try{pn(v,I,V)}catch(re){throw Gr(v,re),re}}is(v)}function Gr(v,I){let M=v._controlledReadableStream;if(M._state!=="readable")return;fr(v),fa(v),Of(M,I)}function gc(v){let I=v._controlledReadableStream._state;if(I==="errored")return null;if(I==="closed")return 0;return v._strategyHWM-v._queueTotalSize}function bT(v){if(If(v))return!1;return!0}function ni(v){let I=v._controlledReadableStream._state;if(!v._closeRequested&&I==="readable")return!0;return!1}function Pf(v,I,M,V,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=V,I._cancelAlgorithm=re,v._readableStreamController=I;let $e=M();p(f($e),()=>(I._started=!0,is(I),null),(qe)=>(Gr(I,qe),null))}function wT(v,I,M,V){let re=Object.create(nn.prototype),le,_e,$e;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)$e=(qe)=>I.cancel(qe);else $e=()=>f(void 0);Pf(v,re,le,_e,$e,M,V)}function pa(v){return TypeError(`ReadableStreamDefaultController.prototype.${v} can only be used on a ReadableStreamDefaultController`)}function TT(v,I){if(br(v._readableStreamController))return RT(v);return CT(v)}function CT(v,I){let M=ee(v),V=!1,re=!1,le=!1,_e=!1,$e,qe,Ke,Ze,lt,Tt=u((cr)=>{lt=cr});function Cn(){if(V)return re=!0,f(void 0);return V=!0,ue(M,{_chunkSteps:(hr)=>{b(()=>{re=!1;let Ar=hr,An=hr;if(!le)ri(Ke._readableStreamController,Ar);if(!_e)ri(Ze._readableStreamController,An);if(V=!1,re)Cn()})},_closeSteps:()=>{if(V=!1,!le)Ro(Ke._readableStreamController);if(!_e)Ro(Ze._readableStreamController);if(!le||!_e)lt(void 0)},_errorSteps:()=>{V=!1}}),f(void 0)}function ii(cr){if(le=!0,$e=cr,_e){let hr=Qe([$e,qe]),Ar=Br(v,hr);lt(Ar)}return Tt}function no(cr){if(_e=!0,qe=cr,le){let hr=Qe([$e,qe]),Ar=Br(v,hr);lt(Ar)}return Tt}function Rn(){}return Ke=ss(Rn,Cn,ii),Ze=ss(Rn,Cn,no),y(M._closedPromise,(cr)=>{if(Gr(Ke._readableStreamController,cr),Gr(Ze._readableStreamController,cr),!le||!_e)lt(void 0);return null}),[Ke,Ze]}function RT(v){let I=ee(v),M=!1,V=!1,re=!1,le=!1,_e=!1,$e,qe,Ke,Ze,lt,Tt=u((Be)=>{lt=Be});function Cn(Be){y(Be._closedPromise,(mt)=>{if(Be!==I)return null;if(Yt(Ke._readableStreamController,mt),Yt(Ze._readableStreamController,mt),!le||!_e)lt(void 0);return null})}function ii(){if(Et(I))Q(I),I=ee(v),Cn(I);ue(I,{_chunkSteps:(mt)=>{b(()=>{V=!1,re=!1;let Rt=mt,Tr=mt;if(!le&&!_e)try{Tr=Gn(mt)}catch(si){Yt(Ke._readableStreamController,si),Yt(Ze._readableStreamController,si),lt(Br(v,si));return}if(!le)vn(Ke._readableStreamController,Rt);if(!_e)vn(Ze._readableStreamController,Tr);if(M=!1,V)Rn();else if(re)cr()})},_closeSteps:()=>{if(M=!1,!le)Yr(Ke._readableStreamController);if(!_e)Yr(Ze._readableStreamController);if(Ke._readableStreamController._pendingPullIntos.length>0)_n(Ke._readableStreamController,0);if(Ze._readableStreamController._pendingPullIntos.length>0)_n(Ze._readableStreamController,0);if(!le||!_e)lt(void 0)},_errorSteps:()=>{M=!1}})}function no(Be,mt){if(ce(I))Q(I),I=Qr(v),Cn(I);let Rt=mt?Ze:Ke,Tr=mt?Ke:Ze;en(I,Be,1,{_chunkSteps:(ai)=>{b(()=>{V=!1,re=!1;let li=mt?_e:le;if(!(mt?le:_e)){let zf;try{zf=Gn(ai)}catch(Ec){Yt(Rt._readableStreamController,Ec),Yt(Tr._readableStreamController,Ec),lt(Br(v,Ec));return}if(!li)yn(Rt._readableStreamController,ai);vn(Tr._readableStreamController,zf)}else if(!li)yn(Rt._readableStreamController,ai);if(M=!1,V)Rn();else if(re)cr()})},_closeSteps:(ai)=>{M=!1;let li=mt?_e:le,_a=mt?le:_e;if(!li)Yr(Rt._readableStreamController);if(!_a)Yr(Tr._readableStreamController);if(ai!==void 0){if(!li)yn(Rt._readableStreamController,ai);if(!_a&&Tr._readableStreamController._pendingPullIntos.length>0)_n(Tr._readableStreamController,0)}if(!li||!_a)lt(void 0)},_errorSteps:()=>{M=!1}})}function Rn(){if(M)return V=!0,f(void 0);M=!0;let Be=Yn(Ke._readableStreamController);if(Be===null)ii();else no(Be._view,!1);return f(void 0)}function cr(){if(M)return re=!0,f(void 0);M=!0;let Be=Yn(Ze._readableStreamController);if(Be===null)ii();else no(Be._view,!0);return f(void 0)}function hr(Be){if(le=!0,$e=Be,_e){let mt=Qe([$e,qe]),Rt=Br(v,mt);lt(Rt)}return Tt}function Ar(Be){if(_e=!0,qe=Be,le){let mt=Qe([$e,qe]),Rt=Br(v,mt);lt(Rt)}return Tt}function An(){return}return Ke=Nf(An,Rn,hr),Ze=Nf(An,cr,Ar),Cn(I),[Ke,Ze]}function AT(v){return o(v)&&typeof v.getReader<"u"}function IT(v){if(AT(v))return kT(v.getReader());return PT(v)}function PT(v){let I,M=Er(v,"async"),V=n;function re(){let _e;try{_e=qt(M)}catch(qe){return h(qe)}let $e=f(_e);return S($e,(qe)=>{if(!o(qe))throw TypeError("The promise returned by the iterator.next() method must fulfill with an object");if(go(qe))Ro(I._readableStreamController);else{let Ze=Wo(qe);ri(I._readableStreamController,Ze)}})}function le(_e){let $e=M.iterator,qe;try{qe=sr($e,"return")}catch(lt){return h(lt)}if(qe===void 0)return f(void 0);let Ke;try{Ke=R(qe,$e,[_e])}catch(lt){return h(lt)}let Ze=f(Ke);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(V,re,le,0),I}function kT(v){let I,M=n;function V(){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)Ro(I._readableStreamController);else{let $e=_e.value;ri(I._readableStreamController,$e)}})}function re(le){try{return f(v.cancel(le))}catch(_e){return h(_e)}}return I=ss(M,V,re,0),I}function NT(v,I){be(v,I);let M=v,V=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,$e=M===null||M===void 0?void 0:M.type;return{autoAllocateChunkSize:V===void 0?void 0:J(V,`${I} has member 'autoAllocateChunkSize' that`),cancel:re===void 0?void 0:OT(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:MT(_e,M,`${I} has member 'start' that`),type:$e===void 0?void 0:DT($e,`${I} has member 'type' that`)}}function OT(v,I,M){return Ce(v,M),(V)=>w(v,I,[V])}function $T(v,I,M){return Ce(v,M),(V)=>w(v,I,[V])}function MT(v,I,M){return Ce(v,M),(V)=>R(v,I,[V])}function DT(v,I){if(v=`${v}`,v!=="bytes")throw TypeError(`${I} '${v}' is not a valid enumeration value for ReadableStreamType`);return v}function xT(v,I){be(v,I);let M=v===null||v===void 0?void 0:v.preventCancel;return{preventCancel:Boolean(M)}}function kf(v,I){be(v,I);let M=v===null||v===void 0?void 0:v.preventAbort,V=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)LT(le,`${I} has member 'signal' that`);return{preventAbort:Boolean(M),preventCancel:Boolean(V),preventClose:Boolean(re),signal:le}}function LT(v,I){if(!zw(v))throw TypeError(`${I} is not an AbortSignal.`)}function qT(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 V=v===null||v===void 0?void 0:v.writable;return U(V,"writable","ReadableWritablePair"),df(V,`${I} has member 'writable' that`),{readable:M,writable:V}}class Zt{constructor(v={},I={}){if(v===void 0)v=null;else Ie(v,"First parameter");let M=na(I,"Second parameter"),V=NT(v,"First parameter");if(vc(this),V.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);So(this,V,re)}else{let re=ra(M),le=rs(M,1);wT(this,V,le,re)}}get locked(){if(!to(this))throw Ao("locked");return ro(this)}cancel(v=void 0){if(!to(this))return h(Ao("cancel"));if(ro(this))return h(TypeError("Cannot cancel a stream that already has a reader"));return Br(this,v)}getReader(v=void 0){if(!to(this))throw Ao("getReader");if(Zr(v,"First parameter").mode===void 0)return ee(this);return Qr(this)}pipeThrough(v,I={}){if(!to(this))throw Ao("pipeThrough");We(v,1,"pipeThrough");let M=qT(v,"First parameter"),V=kf(I,"Second parameter");if(ro(this))throw TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(ti(M.writable))throw TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");let re=Af(this,M.writable,V.preventClose,V.preventAbort,V.preventCancel,V.signal);return E(re),M.readable}pipeTo(v,I={}){if(!to(this))return h(Ao("pipeTo"));if(v===void 0)return h("Parameter 1 is required in 'pipeTo'.");if(!ei(v))return h(TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let M;try{M=kf(I,"Second parameter")}catch(V){return h(V)}if(ro(this))return h(TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream"));if(ti(v))return h(TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream"));return Af(this,v,M.preventClose,M.preventAbort,M.preventCancel,M.signal)}tee(){if(!to(this))throw Ao("tee");let v=TT(this);return Qe(v)}values(v=void 0){if(!to(this))throw Ao("values");let I=xT(v,"First parameter");return Kt(this,I.preventCancel)}[Sr](v){return this.values(v)}static from(v){return IT(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,V=1,re=()=>1){let le=Object.create(Zt.prototype);vc(le);let _e=Object.create(nn.prototype);return Pf(le,_e,v,I,M,V,re),le}function Nf(v,I,M){let V=Object.create(Zt.prototype);vc(V);let re=Object.create(Bt.prototype);return Sn(V,re,v,I,M,0,void 0),V}function vc(v){v._state="readable",v._reader=void 0,v._storedError=void 0,v._disturbed=!1}function to(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_readableStreamController"))return!1;return v instanceof Zt}function ro(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 V=v._readableStreamController[D](I);return S(V,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((V)=>{V._closeSteps()})}}function Of(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 ta(M,I)}function Ao(v){return TypeError(`ReadableStream.prototype.${v} can only be used on a ReadableStream`)}function $f(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){We(v,1,"ByteLengthQueuingStrategy"),v=$f(v,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=v.highWaterMark}get highWaterMark(){if(!xf(this))throw Df("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!xf(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 xf(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_byteLengthQueuingStrategyHighWaterMark"))return!1;return v instanceof ls}let Lf=()=>1;s(Lf,"size");class cs{constructor(v){We(v,1,"CountQueuingStrategy"),v=$f(v,"First parameter"),this._countQueuingStrategyHighWaterMark=v.highWaterMark}get highWaterMark(){if(!Uf(this))throw qf("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!Uf(this))throw qf("size");return Lf}}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 qf(v){return TypeError(`CountQueuingStrategy.prototype.${v} can only be used on a CountQueuingStrategy`)}function Uf(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_countQueuingStrategyHighWaterMark"))return!1;return v instanceof cs}function UT(v,I){be(v,I);let M=v===null||v===void 0?void 0:v.cancel,V=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,$e=v===null||v===void 0?void 0:v.writableType;return{cancel:M===void 0?void 0:HT(M,v,`${I} has member 'cancel' that`),flush:V===void 0?void 0:FT(V,v,`${I} has member 'flush' that`),readableType:re,start:le===void 0?void 0:GT(le,v,`${I} has member 'start' that`),transform:_e===void 0?void 0:BT(_e,v,`${I} has member 'transform' that`),writableType:$e}}function FT(v,I,M){return Ce(v,M),(V)=>w(v,I,[V])}function GT(v,I,M){return Ce(v,M),(V)=>R(v,I,[V])}function BT(v,I,M){return Ce(v,M),(V,re)=>w(v,I,[V,re])}function HT(v,I,M){return Ce(v,M),(V)=>w(v,I,[V])}class us{constructor(v={},I={},M={}){if(v===void 0)v=null;let V=na(I,"Second parameter"),re=na(M,"Third parameter"),le=UT(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),$e=ra(re),qe=rs(V,1),Ke=ra(V),Ze,lt=u((Tt)=>{Ze=Tt});if(VT(this,lt,qe,Ke,_e,$e),jT(this,le),le.start!==void 0)Ze(le.start(this._transformStreamController));else Ze(void 0)}get readable(){if(!Ff(this))throw Vf("readable");return this._readable}get writable(){if(!Ff(this))throw Vf("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 VT(v,I,M,V,re,le){function _e(){return I}function $e(Tt){return KT(v,Tt)}function qe(Tt){return XT(v,Tt)}function Ke(){return YT(v)}v._writable=Jw(_e,$e,Ke,qe,M,V);function Ze(){return ZT(v)}function lt(Tt){return QT(v,Tt)}v._readable=ss(_e,Ze,lt,re,le),v._backpressure=void 0,v._backpressureChangePromise=void 0,v._backpressureChangePromise_resolve=void 0,ha(v,!0),v._transformStreamController=void 0}function Ff(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_transformStreamController"))return!1;return v instanceof us}function Gf(v,I){Gr(v._readable._readableStreamController,I),_c(v,I)}function _c(v,I){ga(v._transformStreamController),ns(v._writable._writableStreamController,I),yc(v)}function yc(v){if(v._backpressure)ha(v,!1)}function ha(v,I){if(v._backpressureChangePromise!==void 0)v._backpressureChangePromise_resolve();v._backpressureChangePromise=u((M)=>{v._backpressureChangePromise_resolve=M}),v._backpressure=I}class Tn{constructor(){throw TypeError("Illegal constructor")}get desiredSize(){if(!ma(this))throw va("desiredSize");let v=this._controlledTransformStream._readable._readableStreamController;return gc(v)}enqueue(v=void 0){if(!ma(this))throw va("enqueue");Bf(this,v)}error(v=void 0){if(!ma(this))throw va("error");WT(this,v)}terminate(){if(!ma(this))throw va("terminate");JT(this)}}if(Object.defineProperties(Tn.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),s(Tn.prototype.enqueue,"enqueue"),s(Tn.prototype.error,"error"),s(Tn.prototype.terminate,"terminate"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(Tn.prototype,Symbol.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});function ma(v){if(!o(v))return!1;if(!Object.prototype.hasOwnProperty.call(v,"_controlledTransformStream"))return!1;return v instanceof Tn}function zT(v,I,M,V,re){I._controlledTransformStream=v,v._transformStreamController=I,I._transformAlgorithm=M,I._flushAlgorithm=V,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(Tn.prototype),V,re,le;if(I.transform!==void 0)V=(_e)=>I.transform(_e,M);else V=(_e)=>{try{return Bf(M,_e),f(void 0)}catch($e){return h($e)}};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);zT(v,M,V,re,le)}function ga(v){v._transformAlgorithm=void 0,v._flushAlgorithm=void 0,v._cancelAlgorithm=void 0}function Bf(v,I){let M=v._controlledTransformStream,V=M._readable._readableStreamController;if(!ni(V))throw TypeError("Readable side is not in a state that permits enqueue");try{ri(V,I)}catch(le){throw _c(M,le),M._readable._storedError}if(bT(V)!==M._backpressure)ha(M,!0)}function WT(v,I){Gf(v._controlledTransformStream,I)}function Hf(v,I){let M=v._transformAlgorithm(I);return S(M,void 0,(V)=>{throw Gf(v._controlledTransformStream,V),V})}function JT(v){let I=v._controlledTransformStream,M=I._readable._readableStreamController;Ro(M);let V=TypeError("TransformStream terminated");_c(I,V)}function KT(v,I){let M=v._transformStreamController;if(v._backpressure){let V=v._backpressureChangePromise;return S(V,()=>{let re=v._writable;if(re._state==="erroring")throw re._storedError;return Hf(M,I)})}return Hf(M,I)}function XT(v,I){let M=v._transformStreamController;if(M._finishPromise!==void 0)return M._finishPromise;let V=v._readable;M._finishPromise=u((le,_e)=>{M._finishPromise_resolve=le,M._finishPromise_reject=_e});let re=M._cancelAlgorithm(I);return ga(M),p(re,()=>{if(V._state==="errored")oi(M,V._storedError);else Gr(V._readableStreamController,I),Sc(M);return null},(le)=>(Gr(V._readableStreamController,le),oi(M,le),null)),M._finishPromise}function YT(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 V=I._flushAlgorithm();return ga(I),p(V,()=>{if(M._state==="errored")oi(I,M._storedError);else Ro(M._readableStreamController),Sc(I);return null},(re)=>(Gr(M._readableStreamController,re),oi(I,re),null)),I._finishPromise}function ZT(v){return ha(v,!1),v._backpressureChangePromise}function QT(v,I){let M=v._transformStreamController;if(M._finishPromise!==void 0)return M._finishPromise;let V=v._writable;M._finishPromise=u((le,_e)=>{M._finishPromise_resolve=le,M._finishPromise_reject=_e});let re=M._cancelAlgorithm(I);return ga(M),p(re,()=>{if(V._state==="errored")oi(M,V._storedError);else ns(V._writableStreamController,I),yc(v),Sc(M);return null},(le)=>(ns(V._writableStreamController,le),yc(v),oi(M,le),null)),M._finishPromise}function va(v){return TypeError(`TransformStreamDefaultController.prototype.${v} can only be used on a TransformStreamDefaultController`)}function Sc(v){if(v._finishPromise_resolve===void 0)return;v._finishPromise_resolve(),v._finishPromise_resolve=void 0,v._finishPromise_reject=void 0}function oi(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 Vf(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=nn,r.ReadableStreamDefaultReader=z,r.TransformStream=us,r.TransformStreamDefaultController=Tn,r.WritableStream=wn,r.WritableStreamDefaultController=To,r.WritableStreamDefaultWriter=rn})}}),CC=Se({"../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,TC())}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*bc(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 RC,jc,wc,jf,Mo,Sl=Jt({"../node_modules/.bun/fetch-blob@3.2.0/node_modules/fetch-blob/index.js"(){RC=Cr(CC(),1),jc=65536,wc=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 bc(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 bc(this.#e,!1))t.set(n,r),r+=n.length;return t.buffer}stream(){let t=bc(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(wc.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}}),jf=wc,Mo=jf}}),Wf,Jf,Hs,av=Jt({"../node_modules/.bun/fetch-blob@3.2.0/node_modules/fetch-blob/file.js"(){Sl(),Wf=class e extends Mo{#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 Mo&&/^(File)$/.test(t[Symbol.toStringTag])}},Jf=Wf,Hs=Jf}});function AC(e,t=Mo){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+Ga(s)+`"\r
15
+ \r
16
+ ${i.replace(/\r(?!\n)|(?<!\r)\n/g,`\r
17
+ `)}\r
18
+ `):n.push(o+Ga(s)+`"; filename="${Ga(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 ui,Kf,Xf,Wc,Yf,Tc,Ga,oo,bi,Iu=Jt({"../node_modules/.bun/formdata-polyfill@4.0.10/node_modules/formdata-polyfill/esm.min.js"(){Sl(),av(),{toStringTag:ui,iterator:Kf,hasInstance:Xf}=Symbol,Wc=Math.random,Yf="append,set,get,getAll,delete,keys,values,entries,forEach,constructor".split(","),Tc=(e,t,r)=>(e+="",/^(Blob|File)$/.test(t&&t[ui])?[(r=r!==void 0?r+"":t[ui]=="File"?t.name:"blob",e),t.name!==r||t[ui]=="blob"?new Hs([t],r,t):t]:[e,t+""]),Ga=(e,t)=>(t?e:e.replace(/\r?\n|\r/g,`\r
23
+ `)).replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),oo=(e,t,r)=>{if(t.length<r)throw TypeError(`Failed to execute '${e}' on 'FormData': ${r} arguments required, but only ${t.length} present.`)},bi=class e{#e=[];constructor(...t){if(t.length)throw TypeError("Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.")}get[ui](){return"FormData"}[Kf](){return this.entries()}static[Xf](t){return t&&typeof t==="object"&&t[ui]==="FormData"&&!Yf.some((r)=>typeof t[r]!="function")}append(...t){oo("append",arguments,2),this.#e.push(Tc(...t))}delete(t){oo("delete",arguments,1),t+="",this.#e=this.#e.filter(([r])=>r!==t)}get(t){oo("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 oo("getAll",arguments,1),r=[],t+="",this.#e.forEach((n)=>n[0]===t&&r.push(n[1])),r}has(t){return oo("has",arguments,1),t+="",this.#e.some((r)=>r[0]===t)}forEach(t,r){oo("forEach",arguments,1);for(var[n,o]of this)t.call(r,o,n,this)}set(...t){oo("set",arguments,2);var r=[],n=!0;t=Tc(...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}}}}),Vs,Pu=Jt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/errors/base.js"(){Vs=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,lv=Jt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/errors/fetch-error.js"(){Pu(),Or=class extends Vs{constructor(e,t,r){super(e,t);if(r)this.code=this.errno=r.code,this.erroredSysCall=r.syscall}}}}),ds,Jc,Es,cv,uv,dv,ku=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]),cv=(e)=>typeof e==="object"&&(e[ds]==="AbortSignal"||e[ds]==="EventTarget"),uv=(e,t)=>{let r=new URL(t).hostname,n=new URL(e).hostname;return r===n||r.endsWith(`.${n}`)},dv=(e,t)=>{let r=new URL(t).protocol,n=new URL(e).protocol;return r===n}}}),IC=Se({"../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}}),Qf,ya,fv,pv,hv,mv,Cc,Rc,Ac,gv=Jt({"../node_modules/.bun/fetch-blob@3.2.0/node_modules/fetch-blob/from.js"(){Qf=Cr(IC(),1),av(),Sl(),{stat:ya}=kC,fv=(e,t)=>Cc(Zf(e),e,t),pv=(e,t)=>ya(e).then((r)=>Cc(r,e,t)),hv=(e,t)=>ya(e).then((r)=>Rc(r,e,t)),mv=(e,t)=>Rc(Zf(e),e,t),Cc=(e,t,r="")=>new Mo([new Ac({path:t,size:e.size,lastModified:e.mtimeMs,start:0})],{type:r}),Rc=(e,t,r="")=>new Hs([new Ac({path:t,size:e.size,lastModified:e.mtimeMs,start:0})],NC(t),{type:r,lastModified:e.mtimeMs}),Ac=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 ya(this.#e);if(t>this.lastModified)throw new Qf.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*PC(this.#e,{start:this.#t,end:this.#t+this.size-1})}get[Symbol.toStringTag](){return"Blob"}}}}),vv={};Bs(vv,{toFormData:()=>$C});function OC(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 _v(r[1]||r[2]),o,i,s,l,a,c,u=[],f=new bi,h=(S)=>{s+=y.decode(S,{stream:!0})},g=(S)=>{u.push(S)},p=()=>{let S=new Hs(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=OC(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,Ic,In,fs,ps,ep,di,tp,rp,np,op,io,_v,MC=Jt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/utils/multipart-parser.js"(){gv(),Iu(),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++},Ic=1,In={PART_BOUNDARY:Ic,LAST_BOUNDARY:Ic*=2},fs=10,ps=13,ep=32,di=45,tp=58,rp=97,np=122,op=(e)=>e|32,io=()=>{},_v=class{constructor(e){this.index=0,this.flags=0,this.onHeaderEnd=io,this.onHeaderField=io,this.onHeadersEnd=io,this.onHeaderValue=io,this.onPartBegin=io,this.onPartData=io,this.onPartEnd=io,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===di)c|=In.LAST_BOUNDARY;else if(g!==ps)return;l++;break}else if(l-1===i.length-2){if(c&In.LAST_BOUNDARY&&g===di)a=Ct.END,c=0;else if(!(c&In.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===di)break;if(g===tp){if(l===1)return;E("onHeaderField",!0),a=Ct.HEADER_VALUE_START;break}if(p=op(g),p<rp||p>np)return;break;case Ct.HEADER_VALUE_START:if(g===ep)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|=In.PART_BOUNDARY;else if(g===di)c|=In.LAST_BOUNDARY;else l=0;else if(l-1===i.length)if(c&In.PART_BOUNDARY){if(l=0,g===fs){c&=~In.PART_BOUNDARY,S("onPartEnd"),S("onPartBegin"),a=Ct.HEADER_FIELD_START;break}}else if(c&In.LAST_BOUNDARY)if(g===di)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 kc(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 so))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 Vs?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 ap,dr,yi,El,lp,Nu,yv,Sv,Ou=Jt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/body.js"(){Sl(),Iu(),lv(),Pu(),ku(),ap=DC(so.pipeline),dr=Symbol("Body internals"),yi=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(sp.isAnyArrayBuffer(e))e=Nr.from(e);else if(ArrayBuffer.isView(e))e=Nr.from(e.buffer,e.byteOffset,e.byteLength);else if(e instanceof so);else if(e instanceof bi)e=AC(e),r=e.type.split("=")[1];else e=Nr.from(String(e));let n=e;if(Nr.isBuffer(e))n=so.Readable.from(e);else if(Es(e))n=so.Readable.from(e.stream());if(this[dr]={body:e,stream:n,boundary:r,disturbed:!1,error:null},this.size=t,e instanceof so)e.on("error",(o)=>{let i=o instanceof Vs?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 kc(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 bi,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(()=>(MC(),vv));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 Mo([t],{type:e})}async json(){let e=await this.text();return JSON.parse(e)}async text(){let e=await kc(this);return new TextDecoder().decode(e)}buffer(){return kc(this)}},yi.prototype.buffer=Pc(yi.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer"),Object.defineProperties(yi.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:Pc(()=>{},"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}}),El=(e,t)=>{let r,n,{body:o}=e[dr];if(e.bodyUsed)throw Error("cannot clone body after it is used");if(o instanceof so&&typeof o.getBoundary!=="function")r=new ip({highWaterMark:t}),n=new ip({highWaterMark:t}),o.pipe(r),o.pipe(n),e[dr].stream=r,o=n;return o},lp=Pc((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"),Nu=(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)||sp.isAnyArrayBuffer(e)||ArrayBuffer.isView(e))return null;if(e instanceof bi)return`multipart/form-data; boundary=${t[dr].boundary}`;if(e&&typeof e.getBoundary==="function")return`multipart/form-data;boundary=${lp(e)}`;if(e instanceof so)return null;return"text/plain;charset=UTF-8"},yv=(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},Sv=async(e,{body:t})=>{if(t===null)e.end();else await ap(t,e)}}});function xC(e=[]){return new On(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),Ba(t,String(r)),!0}catch{return!1}}))}var bs,Ba,On,$u=Jt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/headers.js"(){bs=typeof Sa.validateHeaderName==="function"?Sa.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}},Ba=typeof Sa.validateHeaderValue==="function"?Sa.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}},On=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"&&!cp.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"||cp.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),Ba(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),Ba(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(On.prototype,["get","entries","forEach","values"].reduce((e,t)=>(e[t]={enumerable:!0},e),{}))}}),up,bl,Ev=Jt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/utils/is-redirect.js"(){up=new Set([301,302,303,307,308]),bl=(e)=>up.has(e)}}),Ir,sn,LC=Jt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/response.js"(){$u(),Ou(),Ev(),Ir=Symbol("Response internals"),sn=class e extends yi{constructor(t=null,r={}){super(t,r);let n=r.status!=null?r.status:200,o=new On(r.headers);if(t!==null&&!o.has("Content-Type")){let i=Nu(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(El(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(!bl(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 On(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(sn.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}})}}),bv,qC=Jt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/utils/get-search.js"(){bv=(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 dp(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 FC(e){if(!Mu.has(e))throw TypeError(`Invalid referrerPolicy: ${e}`);return e}function GC(e){if(/^(http|ws)s:$/.test(e.protocol))return!0;let t=e.host.replace(/(^\[)|(]$)/g,""),r=UC(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 fi(e){if(/^about:(blank|srcdoc)$/.test(e))return!0;if(e.protocol==="data:")return!0;if(/^(blob|filesystem):$/.test(e.protocol))return!0;return GC(e)}function BC(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=dp(o),s=dp(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(fi(i)&&!fi(l))return"no-referrer";return s.toString();case"strict-origin-when-cross-origin":if(i.origin===l.origin)return i;if(fi(i)&&!fi(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(fi(i)&&!fi(l))return"no-referrer";return i;default:throw TypeError(`Invalid referrerPolicy: ${n}`)}}function HC(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,wv,Tv=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"]),wv="strict-origin-when-cross-origin"}}),Ht,pi,fp,Ns,Cv,jC=Jt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/request.js"(){$u(),Ou(),ku(),qC(),Tv(),Ht=Symbol("Request internals"),pi=(e)=>typeof e==="object"&&typeof e[Ht]==="object",fp=zC(()=>{},".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)"),Ns=class e extends yi{constructor(t,r={}){let n;if(pi(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(!pi(r)&&"data"in r)fp();if((r.body!=null||pi(t)&&t.body!==null)&&(o==="GET"||o==="HEAD"))throw TypeError("Request with GET/HEAD method cannot have body");let i=r.body?r.body:pi(t)&&t.body!==null?El(t):null;super(i,{size:r.size||t.size||0});let s=new On(r.headers||t.headers||{});if(i!==null&&!s.has("Content-Type")){let c=Nu(i,this);if(c)s.set("Content-Type",c)}let l=pi(t)?t.signal:null;if("signal"in r)l=r.signal;if(l!=null&&!cv(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 VC(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=FC(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}}),Cv=(e)=>{let{parsedURL:t}=e[Ht],r=new On(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=yv(e);if(typeof l==="number"&&!Number.isNaN(l))n=String(l)}if(n)r.set("Content-Length",n);if(e.referrerPolicy==="")e.referrerPolicy=wv;if(e.referrer&&e.referrer!=="no-referrer")e[Ht].referrer=BC(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=bv(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,WC=Jt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/errors/abort-error.js"(){Pu(),Du=class extends Vs{constructor(e,t="aborted"){super(e,t)}}}}),Rv={};Bs(Rv,{AbortError:()=>Du,Blob:()=>Mo,FetchError:()=>Or,File:()=>Hs,FormData:()=>bi,Headers:()=>On,Request:()=>Ns,Response:()=>sn,blobFrom:()=>pv,blobFromSync:()=>fv,default:()=>Av,fileFrom:()=>hv,fileFromSync:()=>mv,isRedirect:()=>bl});async function Av(e,t){return new Promise((r,n)=>{let o=new Ns(e,t),{parsedURL:i,options:s}=Cv(o);if(!Iv.has(i.protocol))throw TypeError(`node-fetch cannot load ${e}. URL scheme "${i.protocol.replace(/:$/,"")}" is not supported.`);if(i.protocol==="data:"){let p=sv(o.url),_=new sn(p,{headers:{"Content-Type":p.typeFull}});r(_);return}let l=(i.protocol==="https:"?KC:JC).request,{signal:a}=o,c=null,u=()=>{let p=new Du("The operation was aborted.");if(n(p),o.body&&o.body instanceof pp.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()}),XC(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 _=xC(p.rawHeaders);if(bl(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 On(o.headers),follow:o.follow,counter:o.counter+1,agent:o.agent,compress:o.compress,method:o.method,body:El(o),signal:o.signal,size:o.size,referrer:o.referrer,referrerPolicy:o.referrerPolicy};if(!uv(o.url,w)||!dv(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 pp.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=HC(_);if(C)T.referrerPolicy=C;r(Av(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=mi(p,new hp,(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 sn(y,S),r(c);return}let b={flush:hi.Z_SYNC_FLUSH,finishFlush:hi.Z_SYNC_FLUSH};if(E==="gzip"||E==="x-gzip"){y=mi(y,hi.createGunzip(b),(R)=>{if(R)n(R)}),c=new sn(y,S),r(c);return}if(E==="deflate"||E==="x-deflate"){let R=mi(p,new hp,(w)=>{if(w)n(w)});R.once("data",(w)=>{if((w[0]&15)===8)y=mi(y,hi.createInflate(),(T)=>{if(T)n(T)});else y=mi(y,hi.createInflateRaw(),(T)=>{if(T)n(T)});c=new sn(y,S),r(c)}),R.once("end",()=>{if(!c)c=new sn(y,S),r(c)});return}if(E==="br"){y=mi(y,hi.createBrotliDecompress(),(R)=>{if(R)n(R)}),c=new sn(y,S),r(c);return}c=new sn(y,S),r(c)}),Sv(h,o).catch(n)})}function XC(e,t){let r=Ea.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=Ea.compare(c.slice(-5),r)===0,!o&&i)o=Ea.compare(i.slice(-3),r.slice(0,3))===0&&Ea.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 Iv,YC=Jt({"../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/index.js"(){wC(),Ou(),LC(),$u(),jC(),lv(),WC(),Ev(),Iu(),ku(),Tv(),gv(),Iv=new Set(["data:","http:","https:"])}}),ZC=Se({"../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(tv()),o=we("https"),i=rv(),s=fC(),l=we("stream"),a=nv(),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(EC()))).HttpsProxyAgent,this.#i}static async#l(){let h=typeof window<"u"&&!!window;return this.#s||=h?window.fetch:(await Promise.resolve().then(()=>(YC(),Rv))).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=Se({"../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=ZC();Object.defineProperty(e,"Gaxios",{enumerable:!0,get:function(){return n.Gaxios}});var o=rv();Object.defineProperty(e,"GaxiosError",{enumerable:!0,get:function(){return o.GaxiosError}}),r(nv(),e),e.instance=new n.Gaxios;async function i(s){return e.instance.request(s)}}}),Pv=Se({"../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,ae=-1e7,ve=1e7,me=!1,j=1,ne=0,he={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},q="0123456789abcdefghijklmnopqrstuvwxyz",X=!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<ae)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&&X)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<ae)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),ae=x[0],ve=x[1];else if(b(x,-p,p,O),x)ae=-(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))X=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:[ae,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,z,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,z=ce.r,oe=ce.e;if(te=oe+et+1,Ne=ue[te],L=J/2,z=z||te<0||ue[te+1]!=null,z=He<4?(Ne!=null||z)&&(He==0||He==(ce.s<0?3:2)):Ne>L||Ne==L&&(He==4||z||He==6&&ue[te-1]&1||He==(ce.s<0?8:7)),te<1||!ue[0])x=z?T(Z.charAt(1),-et,Z.charAt(0)):Z.charAt(0);else{if(ue.length=te,z){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,z=H.length,ce=J%g,ue=J/g|0;for(H=H.slice();z--;)te=H[z]%g,oe=H[z]/g|0,ee=ue*te+oe*ce,Z=ce*te+ee%g*g+L,L=(Z/Y|0)+(ee/g|0)+ue*oe,H[z]=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,z,ce,ue,ge,Ne,et,He,Je,St,Kt,Xt,xt,It,at,Ue=H.s==J.s?1:-1,ze=H.c,Qe=J.c;if(!ze||!ze[0]||!Qe||!Qe[0])return new W(!H.s||!J.s||(ze?Qe&&ze[0]==Qe[0]:!Qe)?NaN:ze&&ze[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]==(ze[L]||0);L++);if(Qe[L]>(ze[L]||0))oe--;if(Ue<0)et.push(1),z=!0;else{if(Xt=ze.length,It=Qe.length,L=0,Ue+=2,ce=s(Z/(Qe[0]+1)),ce>1)Qe=U(Qe,ce,Z),ze=U(ze,ce,Z),It=Qe.length,Xt=ze.length;Kt=It,He=ze.slice(0,It),Je=He.length;for(;Je<It;He[Je++]=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,Je),te<0){if(St=He[0],It!=Je)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,Je=He.length;while(O(ue,He,ge,Je)==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<Je)ue=[0].concat(ue);if(x(He,ue,Je,Z),Je=He.length,te==-1)while(O(Qe,He,It,Je)<1)ce++,x(He,It<Je?at:Qe,Je,Z),Je=He.length}else if(te===0)ce++,He=[0];if(et[L++]=ce,He[0])He[Je++]=ze[Kt]||0;else He=[ze[Kt]],Je=1}while((Kt++<Xt||He[0]!=null)&&Ue--);if(z=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,z)}else Ne.e=oe,Ne.r=+z;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 Ve(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<ae)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(z,ce,ue){return oe=(ue=ue.toLowerCase())=="x"?16:ue=="b"?2:8,!te||te==oe?ce:z}),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,z=U.c,ce=h;if(z){e:{for(J=1,Z=z[0];Z>=10;Z/=10,J++);if(Y=O-J,Y<0)Y+=u,ee=O,te=z[oe=0],L=s(te/ce[J-ee-1]%10);else if(oe=i((Y+1)/u),oe>=z.length)if(H){for(;z.length<=oe;z.push(0));te=L=0,J=1,Y%=u,ee=Y-u+1}else break e;else{te=Z=z[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||z[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:z[oe-1])%10&1||x==(U.s<0?8:7)),O<1||!z[0]){if(z.length=0,H)O-=U.e+1,z[0]=ce[(u-O%u)%u],U.e=-O||0;else z[0]=U.e=0;return U}if(Y==0)z.length=oe,Z=1,oe--;else z.length=oe+1,Z=ce[u-Y],z[oe]=ee>0?s(te/ce[J-ee]%ce[ee])*Z:0;if(H)for(;;)if(oe==0){for(Y=1,ee=z[0];ee>=10;ee/=10,Y++);ee=z[0]+=Z;for(Z=1;ee>=10;ee/=10,Z++);if(Y!=Z){if(U.e++,z[0]==c)z[0]=1}break}else{if(z[oe]+=Z,z[oe]!=c)break;z[oe--]=0,Z=1}for(Y=z.length;z[--Y]===0;z.pop());}if(U.e>ve)U.c=U.e=null;else if(U.e<ae)U.c=[U.e=0]}return U}function We(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,z=this;if(U=new W(U),U.c&&!U.isInteger())throw Error(l+"Exponent not an integer: "+We(U));if(O!=null)O=new W(O);if(Z=U.e>14,!z.c||!z.c[0]||z.c[0]==1&&!z.e&&z.c.length==1||!U.c||!U.c[0])return L=new W(Math.pow(+We(z),Z?U.s*(2-R(U)):+We(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&&z.isInteger()&&O.isInteger(),H)z=z.mod(O)}else if(U.e>9&&(z.e>0||z.e<-1||(z.e==0?z.c[0]>1||Z&&z.c[1]>=240000000:z.c[0]<80000000000000||Z&&z.c[0]<=99999750000000))){if(Y=z.s<0&&R(U)?-0:0,z.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(+We(U)),oe=J%2;L=new W(F);for(;;){if(oe){if(L=L.times(z),!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=+We(U),J===0)break;oe=J%2}if(z=z.times(z),Y){if(z.c&&z.c.length>Y)z.c.length=Y}else if(H)z=z.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,z=U.c;if(!te||!oe){if(!L||!z)return L?(U.s=-O,U):new W(z?ee:NaN);if(!L[0]||!z[0])return z[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=z;J.reverse();for(O=Z;O--;J.push(0));J.reverse()}else{H=(Y=(Z=L.length)<(O=z.length))?Z:O;for(Z=O=0;O<H;O++)if(L[O]!=z[O]){Y=L[O]<z[O];break}}if(Y)J=L,L=z,z=J,U.s=-U.s;if(O=(H=z.length)-(x=L.length),O>0)for(;O--;L[x++]=0);O=c-1;for(;H>Z;){if(L[--H]<z[H]){for(x=H;x&&!L[--x];L[x]=O);--L[x],L[H]+=c}L[H]-=z[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 Ve(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,z,ce,ue,ge,Ne,et,He=this,Je=He.c,St=(U=new W(U,O)).c;if(!Je||!St||!Je[0]||!St[0]){if(!He.s||!U.s||Je&&!Je[0]&&!St||St&&!St[0]&&!Je)U.c=U.e=U.s=null;else if(U.s*=He.s,!Je||!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=Je.length,z=St.length,te<z)ge=Je,Je=St,St=ge,J=te,te=z,z=J;for(J=te+z,ge=[];J--;ge.push(0));Ne=c,et=g;for(J=z;--J>=0;){x=0,ce=St[J]%et,ue=St[J]/et|0;for(ee=te,Y=J+ee;Y>J;)oe=Je[--ee]%et,L=Je[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 Ve(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 Ve(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(+We(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],z=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=z?L+(x.decimalSeparator||"")+((te=+x.fractionGroupSize)?z.replace(new RegExp("\\d{"+te+"}\\B","g"),"$&"+(x.fractionGroupSeparator||"")):z):L}return(x.prefix||"")+H+(x.suffix||"")},N.toFraction=function(U){var O,x,H,J,Y,ee,Z,te,oe,L,z,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: ")+We(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,z=A(oe,H,Y,B).minus(ue).abs().comparedTo(A(te,x,Y,B).minus(ue).abs())<1?[oe,H]:[te,x],ve=ee,z},N.toNumber=function(){return+We(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&&X)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 We(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)}}),QC=Se({"../node_modules/.bun/json-bigint@1.0.0/node_modules/json-bigint/lib/stringify.js"(e,t){var r=Pv(),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})}})()}}),eR=Se({"../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=Pv();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}}),tR=Se({"../node_modules/.bun/json-bigint@1.0.0/node_modules/json-bigint/index.js"(e,t){var r=QC().stringify,n=eR();t.exports=function(o){return{parse:n(o),stringify:r}},t.exports.parse=n(),t.exports.stringify=r}}),mp=Se({"../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()}}}),rR=Se({"../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()}}),nR=Se({"../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=rR(),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}}}),kv=Se({"../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(nR(),e)}}),wl=Se({"../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=tR(),l=mp(),a=n(kv());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,ae={url:`${u()}/${B}`,headers:G,retryConfig:{noResponseRetries:N},params:Q,responseType:"text",timeout:A()};c.info("instance request %j",ae);let ve=await pe(ae);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(mp(),e)}}),oR=Se({"../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("")}}}),Nv=Se({"../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("")}}}),iR=Se({"../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=oR(),r=Nv(),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}}),sR=Se({"../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)}}}),Tl=Se({"../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=iR(),o=sR();r(Nv(),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=Se({"../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)}}}),aR=Se({"../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}}),Ov=Se({"../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=aR(),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:_}}}),cn=Se({"../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")}}}),lR=Se({"../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"}}}),$v=Se({"../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=lR();e.pkg=t;var r="google-api-nodejs-client";e.PRODUCT_NAME=r;var n=`${r}/${t.version}`;e.USER_AGENT=n}}),$r=Se({"../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=cn(),o=kv(),i=$v();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}}),Mv=Se({"../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}}),Bo=Se({"../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=Ov(),i=cn(),s=Tl(),l=$r(),a=Mv(),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,ae=!1;if(y.constructor===Array)ae=y.indexOf(pe)>-1;else ae=pe===y;if(!ae)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}}),Dv=Se({"../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=wl(),n=Bo(),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}}),xv=Se({"../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=Bo(),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}}),Lv=Se({"../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=wl(),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()}}}),qv=Se({"../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}}),cR=Se({"../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}}}),Uv=Se({"../node_modules/.bun/jwa@2.0.1/node_modules/jwa/index.js"(e,t){var r=zs().Buffer,n=we("crypto"),o=Ov(),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 ae=0;ae<pe;++ae)Q+="=";return Q.replace(/\-/g,"+").replace(/_/g,"/")}function y(Q){var pe=[].slice.call(arguments,1),ae=i.format.bind(i,Q).apply(null,pe);return TypeError(ae)}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(ae,ve){g(ve),ae=E(ae);var me=n.createHmac("sha"+Q,ve),j=(me.update(ae),me.digest("base64"));return p(j)}}var R,w="timingSafeEqual"in n?function Q(pe,ae){if(pe.byteLength!==ae.byteLength)return!1;return n.timingSafeEqual(pe,ae)}:function Q(pe,ae){if(!R)R=cR();return R(pe,ae)};function T(Q){return function pe(ae,ve,me){var j=b(Q)(ae,me);return w(r.from(ve),r.from(j))}}function C(Q){return function pe(ae,ve){h(ve),ae=E(ae);var me=n.createSign("RSA-SHA"+Q),j=(me.update(ae),me.sign(ve,"base64"));return p(j)}}function A(Q){return function pe(ae,ve,me){f(me),ae=E(ae),ve=_(ve);var j=n.createVerify("RSA-SHA"+Q);return j.update(ae),j.verify(me,ve,"base64")}}function P(Q){return function pe(ae,ve){h(ve),ae=E(ae);var me=n.createSign("RSA-SHA"+Q),j=(me.update(ae),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(ae,ve,me){f(me),ae=E(ae),ve=_(ve);var j=n.createVerify("RSA-SHA"+Q);return j.update(ae),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 ae(){var ve=pe.apply(null,arguments);return ve=o.derToJose(ve,"ES"+Q),ve}}function F(Q){var pe=A(Q);return function ae(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,ae){return ae===""}}t.exports=function Q(pe){var ae={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:ae[j](ne),verify:ve[j](ne)}}}}),Fv=Se({"../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)}}}),uR=Se({"../node_modules/.bun/jws@4.0.1/node_modules/jws/lib/sign-stream.js"(e,t){var r=zs().Buffer,n=qv(),o=Uv(),i=we("stream"),s=Fv(),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}}),dR=Se({"../node_modules/.bun/jws@4.0.1/node_modules/jws/lib/verify-stream.js"(e,t){var r=zs().Buffer,n=qv(),o=Uv(),i=we("stream"),s=Fv(),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}}),Gv=Se({"../node_modules/.bun/jws@4.0.1/node_modules/jws/index.js"(e){var t=uR(),r=dR(),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)}}}),fR=Se({"../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=Gv(),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})}}}),pR=Se({"../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=fR(),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}}}}),hR=Se({"../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}}),Bv=Se({"../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=hR(),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()}}}),mR=Se({"../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=pR(),r=Bv(),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}}),gR=Se({"../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})}}}),Hv=Se({"../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=mR(),n=gR(),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}}),Vv=Se({"../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=Gv(),r=cn(),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}}),zv=Se({"../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=Hv(),r=Bv(),n=Vv(),o=Bo(),i=$r(),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}}),jv=Se({"../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=Bo(),r=$r();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}}),Wv=Se({"../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=Bo(),r=rr(),n=cn();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}}),Jv=Se({"../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=Tl(),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}}}),xu=Se({"../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=$r(),n=Jv(),o=cn(),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}}),Ho=Se({"../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=$r(),o=xu(),i=cn(),s=$v(),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}}),vR=Se({"../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}}),_R=Se({"../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=$r(),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}}),yR=Se({"../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=cn(),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}}),Kv=Se({"../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=Ho(),r=cn(),n=vR(),o=_R(),i=yR(),s=xu(),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}}),Xv=Se({"../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=Tl(),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}}}}),SR=Se({"../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=$r(),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}}),Yv=Se({"../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=Xv(),r=Ho(),n=SR(),o=cn(),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}}),Zv=Se({"../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}}),gp=Se({"../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=Zv(),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}}),Qv=Se({"../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=Ho(),r=Zv(),n=gp(),o=gp();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}}),e_=Se({"../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=Ho(),r=Kv(),n=Yv(),o=Qv(),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}}),t_=Se({"../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=$r(),r=Jv(),n=rr(),o=we("stream"),i=Ho();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}}),r_=Se({"../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=Bo(),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}}),ER=Se({"../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=wl(),i=we("os"),s=we("path"),l=Tl(),a=Dv(),c=xv(),u=Lv(),f=zv(),h=jv(),g=Wv(),p=e_(),_=Ho(),y=$r(),S=t_(),E=r_(),b=cn();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}}),bR=Se({"../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}}),wR=Se({"../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=$r(),o=xu(),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}}),TR=Se({"../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=$r(),r=class extends t.AuthClient{async request(n){return this.transporter.request(n)}async getAccessToken(){return{}}async getRequestHeaders(){return new Headers}};e.PassThroughClient=r}}),CR=Se({"../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=ER();Object.defineProperty(e,"GoogleAuth",{enumerable:!0,get:function(){return n.GoogleAuth}}),e.gcpMetadata=wl(),e.gaxios=rr();var o=$r();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=Dv();Object.defineProperty(e,"Compute",{enumerable:!0,get:function(){return i.Compute}});var s=Lv();Object.defineProperty(e,"GCPEnv",{enumerable:!0,get:function(){return s.GCPEnv}});var l=bR();Object.defineProperty(e,"IAMAuth",{enumerable:!0,get:function(){return l.IAMAuth}});var a=xv();Object.defineProperty(e,"IdTokenClient",{enumerable:!0,get:function(){return a.IdTokenClient}});var c=Vv();Object.defineProperty(e,"JWTAccess",{enumerable:!0,get:function(){return c.JWTAccess}});var u=zv();Object.defineProperty(e,"JWT",{enumerable:!0,get:function(){return u.JWT}});var f=Wv();Object.defineProperty(e,"Impersonated",{enumerable:!0,get:function(){return f.Impersonated}});var h=Bo();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=Mv();Object.defineProperty(e,"LoginTicket",{enumerable:!0,get:function(){return g.LoginTicket}});var p=jv();Object.defineProperty(e,"UserRefreshClient",{enumerable:!0,get:function(){return p.UserRefreshClient}});var _=Yv();Object.defineProperty(e,"AwsClient",{enumerable:!0,get:function(){return _.AwsClient}});var y=Xv();Object.defineProperty(e,"AwsRequestSigner",{enumerable:!0,get:function(){return y.AwsRequestSigner}});var S=Kv();Object.defineProperty(e,"IdentityPoolClient",{enumerable:!0,get:function(){return S.IdentityPoolClient}});var E=e_();Object.defineProperty(e,"ExternalAccountClient",{enumerable:!0,get:function(){return E.ExternalAccountClient}});var b=Ho();Object.defineProperty(e,"BaseExternalAccountClient",{enumerable:!0,get:function(){return b.BaseExternalAccountClient}});var R=wR();Object.defineProperty(e,"DownscopedClient",{enumerable:!0,get:function(){return R.DownscopedClient}});var w=Qv();Object.defineProperty(e,"PluggableAuthClient",{enumerable:!0,get:function(){return w.PluggableAuthClient}}),Object.defineProperty(e,"ExecutableError",{enumerable:!0,get:function(){return w.ExecutableError}});var T=t_();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=TR();Object.defineProperty(e,"PassThroughClient",{enumerable:!0,get:function(){return C.PassThroughClient}});var A=r_();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(Hv(),e);var P=new n.GoogleAuth;e.auth=P}}),mo=Se({"../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:()=>{}}}}),Cl=Se({"../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}=mo(),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){}}}),RR=Se({"../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}}),js=Se({"../node_modules/.bun/ws@8.23.0/node_modules/ws/lib/permessage-deflate.js"(e,t){var r=we("zlib"),n=Cl(),o=RR(),{kStatusCode:i}=mo(),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)}}}),Ws=Se({"../node_modules/.bun/ws@8.23.0/node_modules/ws/lib/validation.js"(e,t){var{isUtf8:r}=we("buffer"),{hasBlob:n}=mo(),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){}}}),n_=Se({"../node_modules/.bun/ws@8.23.0/node_modules/ws/lib/receiver.js"(e,t){var{Writable:r}=we("stream"),n=js(),{BINARY_TYPES:o,EMPTY_BUFFER:i,kStatusCode:s,kWebSocket:l}=mo(),{concat:a,toArrayBuffer:c,unmask:u}=Cl(),{isValidStatusCode:f,isValidUTF8:h}=Ws(),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}}),o_=Se({"../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=js(),{EMPTY_BUFFER:s,kWebSocket:l,NOOP:a}=mo(),{isBlob:c,isValidStatusCode:u}=Ws(),{mask:f,toBuffer:h}=Cl(),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 ae=Buffer.allocUnsafe(F?Q+G:G);if(ae[0]=D.fin?D.opcode|128:D.opcode,D.rsv1)ae[0]|=64;if(ae[1]=pe,pe===126)ae.writeUInt16BE(Q,2);else if(pe===127)ae[2]=ae[3]=0,ae.writeUIntBE(Q,4,6);if(!D.mask)return Q?[ae,P]:[ae];if(ae[1]|=128,ae[G-4]=N[0],ae[G-3]=N[1],ae[G-2]=N[2],ae[G-1]=N[3],!Q)return[ae];if(B)return[ae,P];if(F)return f(P,N,ae,G,Q),[ae];return f(P,N,P,0,Q),[ae,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 ae={[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,ae,N]);else this.getBlobData(P,this._compress,ae,N);else if(this._state!==E)this.enqueue([this.dispatch,P,this._compress,ae,N]);else this.dispatch(P,this._compress,ae,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)}}}),AR=Se({"../node_modules/.bun/ws@8.23.0/node_modules/ws/lib/event-target.js"(e,t){var{kForOnEventAttribute:r,kListener:n}=mo(),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)}}}),Lu=Se({"../node_modules/.bun/ws@8.23.0/node_modules/ws/lib/extension.js"(e,t){var{tokenChars:r}=Ws();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}}}),qu=Se({"../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=js(),p=n_(),_=o_(),{isBlob:y}=Ws(),{BINARY_TYPES:S,CLOSE_TIMEOUT:E,EMPTY_BUFFER:b,GUID:R,kForOnEventAttribute:w,kListener:T,kStatusCode:C,kWebSocket:A,NOOP:P}=mo(),{EventTarget:{addEventListener:D,removeEventListener:N}}=AR(),{format:F,parse:G}=Lu(),{toBuffer:B}=Cl(),Q=Symbol("kAborted"),pe=[8,13],ae=["CONNECTING","OPEN","CLOSING","CLOSED"],ve=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,me=class L extends r{constructor(z,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,z!==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,z,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(z){if(!S.includes(z))return;if(this._binaryType=z,this._receiver)this._receiver._binaryType=z}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(z,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 _(z,this._extensions,ue.generateMask);if(this._receiver=ge,this._sender=Ne,this._socket=z,ge[A]=this,Ne[A]=this,z[A]=this,ge.on("conclude",be),ge.on("drain",Ce),ge.on("error",Ve),ge.on("message",We),ge.on("ping",U),ge.on("pong",x),Ne.onerror=J,z.setTimeout)z.setTimeout(0);if(z.setNoDelay)z.setNoDelay();if(ce.length>0)z.unshift(ce);z.on("close",ee),z.on("data",Z),z.on("end",te),z.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(z,ce){if(this.readyState===L.CLOSED)return;if(this.readyState===L.CONNECTING){X(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(z,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(z,ce,ue){if(this.readyState===L.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof z==="function")ue=z,z=ce=void 0;else if(typeof ce==="function")ue=ce,ce=void 0;if(typeof z==="number")z=z.toString();if(this.readyState!==L.OPEN){W(this,z,ue);return}if(ce===void 0)ce=!this._isServer;this._sender.ping(z||b,ce,ue)}pong(z,ce,ue){if(this.readyState===L.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof z==="function")ue=z,z=ce=void 0;else if(typeof ce==="function")ue=ce,ce=void 0;if(typeof z==="number")z=z.toString();if(this.readyState!==L.OPEN){W(this,z,ue);return}if(ce===void 0)ce=!this._isServer;this._sender.pong(z||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(z,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 z==="number")z=z.toString();if(this.readyState!==L.OPEN){W(this,z,ue);return}let ge={binary:typeof z!=="string",mask:!this._isServer,compress:!0,fin:!0,...ce};if(!this._extensions[g.extensionName])ge.compress=!1;this._sender.send(z||b,ge,ue)}terminate(){if(this.readyState===L.CLOSED)return;if(this.readyState===L.CONNECTING){X(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:ae.indexOf("CONNECTING")}),Object.defineProperty(me.prototype,"CONNECTING",{enumerable:!0,value:ae.indexOf("CONNECTING")}),Object.defineProperty(me,"OPEN",{enumerable:!0,value:ae.indexOf("OPEN")}),Object.defineProperty(me.prototype,"OPEN",{enumerable:!0,value:ae.indexOf("OPEN")}),Object.defineProperty(me,"CLOSING",{enumerable:!0,value:ae.indexOf("CLOSING")}),Object.defineProperty(me.prototype,"CLOSING",{enumerable:!0,value:ae.indexOf("CLOSING")}),Object.defineProperty(me,"CLOSED",{enumerable:!0,value:ae.indexOf("CLOSED")}),Object.defineProperty(me.prototype,"CLOSED",{enumerable:!0,value:ae.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 z of this.listeners(L))if(z[w])return z[T];return null},set(z){for(let ce of this.listeners(L))if(ce[w]){this.removeListener(L,ce);break}if(typeof z!=="function")return;this.addEventListener(L,z,{[w]:!0})}})}),me.prototype.addEventListener=D,me.prototype.removeEventListener=N,t.exports=me;function j(L,z,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(z instanceof h)Ne=z;else try{Ne=new h(z)}catch{throw SyntaxError(`Invalid URL: ${z}`)}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:",Je;if(Ne.protocol!=="ws:"&&!et&&!He)Je=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`;else if(He&&!Ne.pathname)Je="The URL's pathname is empty";else if(Ne.hash)Je="The URL contains a fragment identifier";if(Je){let Ue=SyntaxError(Je);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),ze=s.unescape(Ne.password);ge.auth=`${Ue}:${ze}`}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[ze,Qe]of Object.entries(Ue))ue.headers[ze.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",()=>{X(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 ze=Ue.headers.location,Qe=Ue.statusCode;if(ze&&ge.followRedirects&&Qe>=300&&Qe<400){if(++L._redirects>ge.maxRedirects){X(L,at,"Maximum redirects exceeded");return}at.abort();let or;try{or=new h(ze,z)}catch(Lt){let Mt=SyntaxError(`Invalid URL: ${ze}`);ne(L,Mt);return}j(L,or,ce,ue)}else if(!L.emit("unexpected-response",at,Ue))X(L,at,`Unexpected server response: ${Ue.statusCode}`)}),at.on("upgrade",(Ue,ze,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"){X(L,ze,"Invalid Upgrade header");return}let Lt=c("sha1").update(Kt+R).digest("base64");if(Ue.headers["sec-websocket-accept"]!==Lt){X(L,ze,"Invalid Sec-WebSocket-Accept header");return}let Mt=Ue.headers["sec-websocket-protocol"],ir;if(Mt!==void 0){if(!xt.size)ir="Server sent a subprotocol but none was requested";else if(!xt.has(Mt))ir="Server sent an invalid subprotocol"}else if(xt.size)ir="Server sent no subprotocol";if(ir){X(L,ze,ir);return}if(Mt)L._protocol=Mt;let sr=Ue.headers["sec-websocket-extensions"];if(sr!==void 0){if(!It){X(L,ze,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let Rr;try{Rr=G(sr)}catch(Er){X(L,ze,"Invalid Sec-WebSocket-Extensions header");return}let Sr=Object.keys(Rr);if(Sr.length!==1||Sr[0]!==g.extensionName){X(L,ze,"Server indicated an extension that was not requested");return}try{It.accept(Rr[g.extensionName])}catch(Er){X(L,ze,"Invalid Sec-WebSocket-Extensions header");return}L._extensions[g.extensionName]=It}L.setSocket(ze,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,z){L._readyState=me.CLOSING,L._errorEmitted=!0,L.emit("error",z),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 X(L,z,ce){L._readyState=me.CLOSING;let ue=Error(ce);if(Error.captureStackTrace(ue,X),z.setHeader){if(z[Q]=!0,z.abort(),z.socket&&!z.socket.destroyed)z.socket.destroy();process.nextTick(ne,L,ue)}else z.destroy(ue),z.once("error",L.emit.bind(L,"error")),z.once("close",L.emitClose.bind(L))}function W(L,z,ce){if(z){let ue=y(z)?z.size:B(z).length;if(L._socket)L._sender._bufferedBytes+=ue;else L._bufferedAmount+=ue}if(ce){let ue=Error(`WebSocket is not open: readyState ${L.readyState} (${ae[L.readyState]})`);process.nextTick(ce,ue)}}function be(L,z){let ce=this[A];if(ce._closeFrameReceived=!0,ce._closeCode=L,z.length===0)ce._closeMessage=b;else ce._closeMessage=Buffer.allocUnsafeSlow(z.length),ce._closeMessage.set(z);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,z)}function Ce(){let L=this[A];if(!L.isPaused)L._socket.resume()}function Ve(L){let z=this[A];if(z._socket[A]!==void 0)z._socket.removeListener("data",Z),process.nextTick(H,z._socket),z.close(L[C]);if(!z._errorEmitted)z._errorEmitted=!0,z.emit("error",L)}function Ie(){this[A].emitClose()}function We(L,z){this[A].emit("message",L,z)}function U(L){let z=this[A];if(z._autoPong&&z.readyState===me.OPEN)if(z._maxPendingAutoPongs>0&&z._pendingAutoPongs>=z._maxPendingAutoPongs)z.terminate();else z._pendingAutoPongs++,z.pong(L,!this._isServer,z._autoPongComplete);z.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 z=this[A];if(z.readyState===me.CLOSED)return;if(z.readyState===me.OPEN)z._readyState=me.CLOSING,Y(z);if(this._socket.end(),!z._errorEmitted)z._errorEmitted=!0,z.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 z=this.read(this._readableState.length);L._receiver.write(z)}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()}}}),IR=Se({"../node_modules/.bun/ws@8.23.0/node_modules/ws/lib/stream.js"(e,t){var r=qu(),{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}}),i_=Se({"../node_modules/.bun/ws@8.23.0/node_modules/ws/lib/subprotocol.js"(e,t){var{tokenChars:r}=Ws();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}}}),PR=Se({"../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=Lu(),l=js(),a=i_(),c=qu(),{CLOSE_TIMEOUT:u,GUID:f,kWebSocket:h}=mo(),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"],ae={};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]),ae[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(ae,N,Q,C,A,P,D)});return}if(!this.options.verifyClient(ve))return w(A,401)}this.completeUpgrade(ae,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 ae=this.options.handleProtocols?this.options.handleProtocols(P,D):P.values().next().value;if(ae)Q.push(`Sec-WebSocket-Protocol: ${ae}`),pe._protocol=ae}if(C[l.extensionName]){let ae=C[l.extensionName].params,ve=s.format({[l.extensionName]:[ae]});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:kR,defineProperty:Wa,getOwnPropertyDescriptor:NR,getOwnPropertyNames:OR,getPrototypeOf:$R}=Object,MR=Object.prototype.hasOwnProperty,Ee=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),DR=(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},xR=(e,t,r,n)=>{if(t&&typeof t==="object"||typeof t==="function"){for(var o=OR(t),i=0,s=o.length,l;i<s;i++)if(l=o[i],!MR.call(e,l)&&l!==r)Wa(e,l,{get:((a)=>t[a]).bind(null,l),enumerable:!(n=NR(t,l))||n.enumerable})}return e},s_=(e,t,r)=>(r=e!=null?kR($R(e)):{},xR(t||!e||!e.__esModule?Wa(r,"default",{value:e,enumerable:!0}):r,e)),LR=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),a_=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),qR=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),UR=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function FR(e){return typeof e==="string"&&a_.has(e.replace(/#$/,""))}function GR(e,t){if(!("$schema"in e)||typeof e.$schema!=="string")return"2020-12";let r=e.$schema.replace(/#$/,"");if(LR.has(r))return"2020-12";if(a_.has(r))return"2019-09";if(qR.has(r)||UR.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={};Bs(rt,{BIGINT_FORMAT_RANGES:()=>__,CONSTANT_CATCH:()=>R_,Class:()=>SA,NUMBER_FORMAT_RANGES:()=>Gu,aborted:()=>an,allowsEval:()=>m_,assert:()=>WR,assertEqual:()=>BR,assertIs:()=>zR,assertNever:()=>jR,assertNotEqual:()=>HR,assignProp:()=>jr,attachSchema:()=>Xa,base64ToUint8Array:()=>b_,base64urlToUint8Array:()=>gA,cached:()=>Js,captureStackTrace:()=>Uu,cleanEnum:()=>mA,cleanRegex:()=>Rl,clone:()=>Ln,cloneDef:()=>YR,codePointLength:()=>Pl,constantCatch:()=>RA,createTransparentProxy:()=>iA,defineLazy:()=>u_,defineLazyInternal:()=>gt,derived:()=>EA,esc:()=>p_,escapeRegex:()=>Lo,explicitlyAborted:()=>S_,extend:()=>lA,finalizeIssue:()=>Mn,floatSafeRemainder:()=>c_,getElementAtPath:()=>ZR,getEnumValues:()=>Ja,getLengthableOrigin:()=>kl,getParsedType:()=>nA,getSizableOrigin:()=>pA,hexToUint8Array:()=>_A,hide:()=>C_,installLazyProp:()=>CA,isObject:()=>Pi,isPlainObject:()=>xo,issue:()=>Ya,joinValues:()=>Kc,jsonStringifyReplacer:()=>Ka,members:()=>T_,merge:()=>uA,mergeDefs:()=>xn,normalizeParams:()=>Fe,nullish:()=>l_,numKeys:()=>rA,objectClone:()=>KR,omit:()=>aA,optionalKeys:()=>v_,own:()=>qo,parsedType:()=>E_,partial:()=>dA,pick:()=>sA,prefixIssues:()=>Io,primitiveTypes:()=>oA,promiseAllObject:()=>QR,propertyKeyTypes:()=>g_,randomString:()=>eA,rawShape:()=>Al,required:()=>fA,safeExtend:()=>cA,shallowClone:()=>tA,sizeCaps:()=>Xc,slugify:()=>h_,stringifyPrimitive:()=>Fu,toZod:()=>VR,uint8ArrayToBase64:()=>w_,uint8ArrayToBase64url:()=>vA,uint8ArrayToHex:()=>yA,unwrapMessage:()=>gi});function BR(e){return e}function HR(e){return e}function VR(){return(e)=>e}function zR(e){}function jR(e){throw Error("Unexpected value in exhaustive check")}function WR(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)=>Fu(r)).join(t)}function Ka(e,t){if(typeof t==="bigint")return t.toString();return t}var JR=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 Js(e){return new JR(e)}function l_(e){return e===null||e===void 0}function Rl(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function c_(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 vp=Symbol("evaluating");function u_(e,t,r){let n=void 0;Object.defineProperty(e,t,{get(){if(n===vp)return;if(n===void 0)n=vp,n=r();return n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function KR(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function jr(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Al(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function $n(e){return Al(e._zod.def)??e._zod.def.shape}function d_(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return jr(this,t,n),n},enumerable:!0,configurable:!0})}function f_(e,t,r){if(t in e)jr(e,t,r);else e[t]=r}function Do(e,t,r,n){let o=$n(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(o,i);if(!s.enumerable)continue;if(s.get)d_(e,i,()=>{let l=t._zod.def.shape[i];return n?n(l,i):l});else f_(e,i,n?n(s.value,i):s.value)}}function XR(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);if(!n.enumerable)continue;if(n.get)d_(e,r,()=>t[r]);else f_(e,r,n.value)}}function xn(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function YR(e){return xn(e._zod.def)}function ZR(e,t){if(!t)return e;return t.reduce((r,n)=>r?.[n],e)}function QR(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 eA(e=10){let r="";for(let n=0;n<e;n++)r+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return r}function p_(e){return JSON.stringify(e)}function h_(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Uu="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Pi(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var m_=Js(()=>{if(zr.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function xo(e){if(Pi(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(Pi(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function tA(e){if(xo(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 rA(e){let t=0;for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r))t++;return t}var nA=(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}`)}},g_=new Set(["string","number","symbol"]),oA=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Lo(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ln(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 iA(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 Fu(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function v_(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Gu=(()=>({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]}))(),__={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function sA(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 Do(i,e,Il(e,t)),Ln(e,xn(r,{shape:i,checks:[]}))}function Il(e,t){let r=$n(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 aA(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(Il(e,t)),s={};return Do(s,e,Reflect.ownKeys($n(e)).filter((l)=>!i.has(l))),Ln(e,xn(r,{shape:s,checks:[]}))}function lA(e,t){if(!xo(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=$n(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 Ln(e,xn(e._zod.def,{shape:y_(e,t)}))}function y_(e,t){let r={};return Do(r,e,Reflect.ownKeys($n(e))),XR(r,t),r}function cA(e,t){if(!xo(t))throw Error("Invalid input to safeExtend: expected a plain object");return Ln(e,xn(e._zod.def,{shape:y_(e,t)}))}function uA(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={};Do(r,e,Reflect.ownKeys($n(e))),Do(r,t,Reflect.ownKeys($n(t)));let n=xn(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Ln(e,n)}function dA(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(Il(t,r)):void 0,a={};return Do(a,t,Reflect.ownKeys($n(t)),e&&((c,u)=>l&&!l.has(u)?c:new e({type:"optional",innerType:c}))),Ln(t,xn(t._zod.def,{shape:a,checks:[]}))}function fA(e,t,r){let n=r?new Set(Il(t,r)):void 0,o={};return Do(o,t,Reflect.ownKeys($n(t)),(i,s)=>n&&!n.has(s)?i:new e({type:"nonoptional",innerType:i})),Ln(t,xn(t._zod.def,{shape:o}))}function an(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 S_(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 Io(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function gi(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 Mn(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:gi(e.inst?._zod.def?.error?.(e))??gi(i?.(e))??gi(t?.error?.(e))??gi(r.customError?.(e))??gi(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 pA(e){if(e instanceof Set)return"set";if(e instanceof Map)return"map";if(e instanceof File)return"file";return"unknown"}var hA=/[\uD800-\uDBFF]/;function Pl(e){let t=e.length;if(!hA.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 kl(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function E_(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 mA(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map((t)=>t[1])}function b_(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 w_(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function gA(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return b_(t+r)}function vA(e){return w_(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function _A(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 yA(e){return Array.from(e).map((t)=>t.toString(16).padStart(2,"0")).join("")}var SA=class{constructor(...e){}};function T_(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);if(n.get)Object.defineProperty(e,r,{...n,enumerable:!1});else bA(e,r,n.value)}}function qo(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function C_(e,t,r){return qo(e,t,r,!1)}function EA(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return qo(this,r,n(this))},set(o){qo(this,r,o)}})}return t}function bA(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:qo(this,t,r.bind(this))},set(n){qo(this,t,n)}})}function wA(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var Nc,ao=!1,TA={configurable:!0,get(){ao=!0;return}};function gt(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&Nc!==e._zod){Nc=void 0;return}Nc=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,TA);let o=ao;ao=!1;try{let i=r(this);if(ao)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i});return ao=ao||o,i}catch(i){throw delete this[t],ao=ao||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function CA(e,t,r,n){let o=wA(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 R_="~constantCatch";function RA(e){let t=()=>e;return t[R_]=!0,t}var _p,AA=Object.freeze({status:"aborted"}),Oc={value:void 0,enumerable:!1},yp="captureStackTrace"in Error?Error:null;function IA(e){let t=yp;if(t){let r=t.stackTraceLimit;if(typeof r==="number"){try{t.stackTraceLimit=0}catch{return yp=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function de(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){Oc.value=new i(g);try{Object.defineProperty(h,"_zod",Oc)}finally{Oc.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),T_(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?IA(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 No=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},A_=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}};(_p=globalThis).__zod_globalConfig??(_p.__zod_globalConfig={});var zr=globalThis.__zod_globalConfig;function ln(e){if(e)Object.assign(zr,e);return zr}function PA(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Ka,2)),e.message}function kA(e){this._zod.message=e}var NA={get:PA,set:kA,enumerable:!0,configurable:!0},$c={value:void 0,enumerable:!1},Sp=new WeakSet([Object.prototype,Error.prototype]),I_=(e,t)=>{e.name="$ZodError",$c.value=t,Object.defineProperty(e,"issues",$c),$c.value=void 0,Object.defineProperty(e,"message",NA);let r=Object.getPrototypeOf(e);if(!Sp.has(r))Sp.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})}})},OA=de("$ZodError",I_),rj=de("$ZodError",I_,void 0,{Parent:Error});function $A(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 MA(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)$A(r,o.path[0],()=>[]).push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function DA(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 xA(e){let t=[],r=e.map((n)=>typeof n==="object"?n.key:n);for(let n of r)if(typeof n==="number")t.push(`[${n}]`);else if(typeof n==="symbol")t.push(`[${JSON.stringify(String(n))}]`);else if(/[^\w$]/.test(n))t.push(`[${JSON.stringify(n)}]`);else{if(t.length)t.push(".");t.push(n)}return t.join("")}function LA(e){let t=[],r=[...e.issues].sort((n,o)=>(n.path??[]).length-(o.path??[]).length);for(let n of r)if(t.push(`✖ ${n.message}`),n.path?.length)t.push(` → at ${xA(n.path)}`);return t.join(`
61
+ `)}function Nl(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Bu=(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 No;if(l.issues.length){let a=new(i?.Err??e)(l.issues.map((c)=>Mn(c,s,ln())));throw Uu(a,i?.callee??t),a}return l.value};return t},Hu=(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)=>Mn(c,s,ln())));throw Uu(a,i?.callee??t),a}return l.value};return t},Vu=(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 No;return i.issues.length?P_(e,i.issues,o):{success:!0,data:i.value}};function P_(e,t,r){let n;return{success:!1,get error(){if(!n)n=new e(t.map((o)=>Mn(o,r,ln()))),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?P_(e,i.issues,o):{success:!0,data:i.value}},qA=Symbol.for("zod.compile.invalid"),UA=Symbol.for("zod.compile.fallback"),FA=(e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==qA)return!0;if(n.definite===!0&&r===void 0)return!1}return GA(e,t,r)};function GA(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o)n[UA]=!0,i=o({value:t,issues:[]},n);else i=e._zod.run({value:t,issues:[]},n);if(i instanceof Promise)throw new No;return i.issues.length===0}var BA=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},HA=(e)=>{let t=Bu(e),r=(n,o,i,s)=>{let l=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,l,Nl(r,s))};return r},VA=(e)=>{let t=Bu(e),r=(n,o,i,s)=>t(n,o,i,Nl(r,s));return r},zA=(e)=>{let t=Hu(e),r=async(n,o,i,s)=>{let l=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,l,Nl(r,s))};return r},jA=(e)=>{let t=Hu(e),r=async(n,o,i,s)=>await t(n,o,i,Nl(r,s));return r},WA=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Vu(e)(t,r,o)},JA=(e)=>(t,r,n)=>Vu(e)(t,r,n),KA=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return zu(e)(t,r,o)},XA=(e)=>async(t,r,n)=>zu(e)(t,r,n),YA=/^[cC][0-9a-z]{6,}$/,ZA=/^[0-9a-z]+$/,QA=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,eI=/^[0-9a-vA-V]{20}$/,tI=/^[A-Za-z0-9]{27}$/,rI=/^[a-zA-Z0-9_-]{21}$/;function nI(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var oI=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,iI=/^([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})$/,Ep=(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})$`)},sI=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,aI="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function lI(){return new RegExp(aI,"u")}var cI=/^(?:(?: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])$/,uI=/^(([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}|:))$/,dI=/^((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])$/,fI=/^(([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])$/,pI=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,hI=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,mI=/^https?$/,gI=/^\+[1-9]\d{6,14}$/,k_="(?:(?:\\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 vI(e){return new RegExp(`^${e}$`)}var _I=vI(k_);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 yI(e){return new RegExp(`^${Yc(e)}$`)}function SI(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(`^${k_}T(?:${n})$`)}var EI=/^[\s\S]{0,}$/,bI=/^-?\d+n?$/,wI=/^-?\d+$/,ju=/^-?\d+(?:\.\d+)?$/,TI=/^(?:true|false)$/i,CI=/^null$/i,RI=/^[^A-Z]*$/,AI=/^[^a-z]*$/,vr=de("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Wu=(e)=>{let t=e.value;return!l_(t)&&t.length!==void 0},Za={number:"number",bigint:"bigint",object:"date"},N_=de("$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})}}),O_=de("$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})}}),II=de("$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):c_(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})}}),PI=de("$ZodCheckNumberFormat",(e,t)=>{vr.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Gu[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})}}),kI=de("$ZodCheckMaxLength",(e,t)=>{var r;vr.init(e,t),(r=e._zod.def).when??(r.when=Wu),e._zod.check=(n)=>{let o=n.value,i=o.length;if((typeof o==="string"&&i>t.maximum?Pl(o):i)<=t.maximum)return;let l=kl(o);n.issues.push({origin:l,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),NI=de("$ZodCheckMinLength",(e,t)=>{var r;vr.init(e,t),(r=e._zod.def).when??(r.when=Wu),e._zod.check=(n)=>{let o=n.value,i=o.length;if((typeof o==="string"&&i>=t.minimum&&i<t.minimum*2?Pl(o):i)>=t.minimum)return;let l=kl(o);n.issues.push({origin:l,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),OI=de("$ZodCheckLengthEquals",(e,t)=>{var r;vr.init(e,t),(r=e._zod.def).when??(r.when=Wu),e._zod.check=(n)=>{let o=n.value,i=o.length,s=typeof o==="string"&&i>=t.length&&i<=t.length*2?Pl(o):i;if(s===t.length)return;let l=kl(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})}}),Ol=de("$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=()=>{})}),$I=de("$ZodCheckRegex",(e,t)=>{Ol.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})}}),MI=de("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=RI),Ol.init(e,t)}),DI=de("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=AI),Ol.init(e,t)}),xI=de("$ZodCheckIncludes",(e,t)=>{vr.init(e,t);let r=Lo(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})}}),LI=de("$ZodCheckStartsWith",(e,t)=>{vr.init(e,t);let r=new RegExp(`^${Lo(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})}}),qI=de("$ZodCheckEndsWith",(e,t)=>{vr.init(e,t);let r=new RegExp(`.*${Lo(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})}}),UI=de("$ZodCheckOverwrite",(e,t)=>{vr.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}}),FI=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(`
62
+ `).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(", ")}) {
63
+ ${t.join(`
64
+ `)}
65
+ };`)(...Object.values(this.closed))}},GI={major:4,minor:6,patch:7},bt=de("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=GI;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=an(l),f;for(let h of a){if(h._zod.def.when){if(S_(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 No;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=an(l,g)});else{if(l.issues.length===g)continue;if(Xa(l.issues,g,e),!u)u=an(l,g)}}if(f)return f.then(()=>l);return l},s=(l,a,c)=>{if(an(l))return l.aborted=!0,l;let u=i(a,o,c);if(u instanceof Promise){if(c.async===!1)throw new No;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 No;return c.then((u)=>i(u,o,a))}return i(c,o,a)}}},{get "~standard"(){return C_(this,"~standard",M_(this))},set "~standard"(e){qo(this,"~standard",e)}}),$_=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>Mn(r,t,ln()))}:{value:e.value};async function BI(e,t){let r={async:!0};return $_(await e._zod.run({value:t,issues:[]},r),r)}function M_(e){return{validate:(t)=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return $_(n,r)}catch(n){}return BI(e,t)},vendor:"zod",version:1}}var Ju=de("$ZodString",(e,t)=>{bt.init(e,t),e._zod.pattern=t.pattern??EI,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=de("$ZodStringFormat",(e,t)=>{Ol.init(e,t),Ju.init(e,t)}),HI=de("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=iI),Nt.init(e,t)}),VI=de("$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=Ep(n))}else t.pattern??(t.pattern=Ep());Nt.init(e,t)}),zI=de("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=sI),Nt.init(e,t)}),D_=1,Qa=2;function x_(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function jI(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return x_(e)||Qa;return WI(e,t)}function WI(e,t){if(!t.normalize&&t.protocol?.source===mI.source&&!/^https?:\/\//i.test(e))return D_;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 JI=/[\t\n\r]/g;function bp(e){return e.replace(JI,"")}function KI(e,t){return t.lastIndex=0,t.test(e.hostname)}function XI(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var YI=de("$ZodURL",(e,t)=>{Nt.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim(),o=jI(n,t);if(o===D_){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=bp(n);return}if(t.hostname&&!KI(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&&!XI(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:bp(n);return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),ZI=de("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=lI()),Nt.init(e,t)}),QI=de("$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?rI:nI(t.length)),Nt.init(e,t)}),eP=de("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=YA),Nt.init(e,t)}),tP=de("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=ZA),Nt.init(e,t)}),rP=de("$ZodULID",(e,t)=>{t.pattern??(t.pattern=QA),Nt.init(e,t)}),nP=de("$ZodXID",(e,t)=>{t.pattern??(t.pattern=eI),Nt.init(e,t)}),oP=de("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=tI),Nt.init(e,t)}),iP=de("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=SI(t)),Nt.init(e,t)}),sP=de("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=_I),Nt.init(e,t)}),aP=de("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=yI(t)),Nt.init(e,t)}),lP=de("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=oI),Nt.init(e,t)}),cP=de("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=cI),Nt.init(e,t)}),uP=/^[0-9a-fA-F:.]+$/;function L_(e){if(!uP.test(e))return!1;return x_(`http://[${e}]`)}var dP=de("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=uI),Nt.init(e,t),e._zod.check=(r)=>{if(!L_(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}),fP=de("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=dI),Nt.init(e,t)});function pP(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 L_(r)}var hP=de("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=fI),Nt.init(e,t),e._zod.check=(r)=>{if(!pP(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function q_(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 U_=/^[0-9a-zA-Z+/]*={0,2}$/,mP=de("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=U_),Nt.init(e,t),e._zod.check=(r)=>{if(q_(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),Ku=/^[A-Za-z0-9_-]*$/;function gP(e){if(!Ku.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return q_(r)}var vP=de("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ku),Nt.init(e,t),e._zod.check=(r)=>{if(gP(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),_P=de("$ZodE164",(e,t)=>{t.pattern??(t.pattern=gI),Nt.init(e,t)});function yP(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 SP=de("$ZodJWT",(e,t)=>{Nt.init(e,t),e._zod.check=(r)=>{if(yP(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),F_=de("$ZodNumber",(e,t)=>{bt.init(e,t),e._zod.pattern=ju,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}}),EP=de("$ZodNumberFormat",(e,t)=>{PI.init(e,t),F_.init(e,t)}),bP=de("$ZodBoolean",(e,t)=>{bt.init(e,t),e._zod.pattern=TI,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}}),wP=de("$ZodBigInt",(e,t)=>{bt.init(e,t),e._zod.pattern=bI,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}}),TP=de("$ZodNull",(e,t)=>{bt.init(e,t),e._zod.pattern=CI,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}}),CP=de("$ZodAny",(e,t)=>{bt.init(e,t),e._zod.parse=(r)=>r}),RP=de("$ZodUnknown",(e,t)=>{bt.init(e,t),e._zod.parse=(r)=>r}),AP=de("$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)}),IP=de("$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 PP(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 kP=(e)=>Array.isArray(e)?e.length:-1;function wp(e,t,r){if(e.issues.length)t.issues.push(...Io(r,e.issues));t.value[r]=e.value}var NP=de("$ZodArray",(e,t)=>{bt.init(e,t);let r=zr.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)=>wp(f,n,a)));else if(wp(u,n,a),l&&u.issues.length!==0&&an(u))break}if(s.length)return Promise.all(s).then(()=>n);return n},PP(e,kP)});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(...Io(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 OP=[];function G_(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:OP,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=v_(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function B_(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(an(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 $P=de("$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=Js(()=>G_(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))jr(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=Pi,s=t.catchall,l,a=zr.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(an(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 B_(h,f,c,u,o.value,e,p===!0)}}),MP=de("$ZodObjectJIT",(e,t)=>{$P.init(e,t);let r=e._zod.parse,n=Js(()=>G_(t)),o=zr.memoizer,i=(g)=>{let p=n.value,_=p.symbolKeys,y=new FI(["payload","ctx"],{shape:g,inst:e,memo:o,syms:_}),S=(w)=>`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`,E=(w,T)=>`
66
+ let ${w}_ab = false;
67
+ for (let i = 0; i < ${w}.issues.length; i++) {
68
+ const iss = ${w}.issues[i];
69
+ iss.path = iss.path ? [${T}, ...iss.path] : [${T}];
70
+ payload.issues.push(iss);
71
+ if (iss.continue !== true) ${w}_ab = true;
72
+ }
73
+ if (${w}_ab && ctx && ctx.abortEarly) {
74
+ payload.value = newResult;
75
+ return payload;
76
+ }`;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)}]`:p_(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(`
77
+ const ${T}_present = ${A};
78
+ if (!${T}.issues.length || ${T}_present) {
79
+ if (${T}.issues.length) {${E(T,C)}
80
+ }
81
+
82
+ if (${G}) {
83
+ newResult[${C}] = ${T}.value;
84
+ }
85
+ }
86
+
87
+ `)}else if(!N)y.write(`
88
+ const ${T}_present = ${A};
89
+ if (${T}.issues.length) {${E(T,C)}
90
+ }
91
+ if (!${T}_present && !${T}.issues.length) {
92
+ payload.issues.push({
93
+ code: "invalid_type",
94
+ expected: "nonoptional",
95
+ input: undefined,
96
+ path: [${C}]
97
+ });
98
+ if (ctx && ctx.abortEarly) {
99
+ payload.value = newResult;
100
+ return payload;
101
+ }
102
+ }
103
+
104
+ if (${T}_present) {
105
+ newResult[${C}] = ${T}.value;
106
+ }
107
+
108
+ `);else if(y.write(`
109
+ if (${T}.issues.length) {${E(T,C)}
110
+ }
111
+ `),D==="defaulted")y.write(`newResult[${C}] = ${T}.value;`);else y.write(`
112
+ if (${T}.value !== undefined || ${A}) {
113
+ newResult[${C}] = ${T}.value;
114
+ }
115
+ `)}return y.write("payload.value = newResult;"),y.write("return payload;"),y.compile()},s,l=Pi,a=!zr.jitless,u=a&&m_.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 B_([],_,g,p,h,e,p?.abortEarly===!0)}return r(g,p)}});function Tp(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)=>!an(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)=>Mn(s,n,ln())))}),t}var H_=de("$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)=>Rl(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 Tp(s,n,e,o);return Promise.all(s).then((l)=>Tp(l,n,e,o))}});function DP(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 xP=de("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,H_.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))jr(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=Al(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw Error(`Invalid discriminated union option at index "${i}"`)});let n=Js(()=>DP(t));e._zod.parse=(o,i)=>{let s=o.value;if(!Pi(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}}),LP=de("$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])=>Cp(r,a,c));return Cp(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(xo(e)&&xo(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 Cp(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(an(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`)}return e.value=a.data,e}var qP=de("$ZodRecord",(e,t)=>{bt.init(e,t);let r=zr.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!xo(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)=>Mn(p,o,ln())),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(...Io(u,p.issues));n.value[h]=p.value}));else{if(g.issues.length)n.issues.push(...Io(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"&&ju.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)=>Mn(p,o,ln())),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(...Io(c,p.issues));n.value[h]=p.value}));else{if(g.issues.length)n.issues.push(...Io(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}}),UP=de("$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)=>g_.has(typeof s));return new RegExp(i.length?`^(${i.map((s)=>Lo(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}}),FP=de("$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"?Lo(i):i?Lo(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}}),GP=de("$ZodTransform",(e,t)=>{bt.init(e,t),e._zod.optin="optional",zr.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new A_(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 No;return r.value=o,r}});function Rp(e,t){return e.value=t.issues.length?void 0:t.value,e}var V_=de("$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(`^(${Rl(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)=>Rp(r,i));return Rp(r,o)}return t.innerType._zod.run(r,n)}}),BP=de("$ZodExactOptional",(e,t)=>{V_.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)}),HP=de("$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(`^(${Rl(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=de("$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)=>Ap(i,t));return Ap(o,t)}});function Ap(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var zP=de("$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)}}),jP=de("$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)=>Ip(i,e));return Ip(o,e)}});function Ip(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 Pp(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)=>Mn(o,n,ln()))},input:e.value}),e}var WP=de("$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)=>Pp(r,i,t,n));return Pp(r,o,t,n)}}),z_=de("$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)=>ba(s,t.in,n));return ba(i,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>ba(i,t.out,n));return ba(o,t.out,n)}});function ba(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 JP=de("$ZodPreprocess",(e,t)=>{z_.init(e,t)}),KP=de("$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(kp);return kp(o)}});function kp(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var XP=de("$ZodLazy",(e,t)=>{bt.init(e,t),u_(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)}),YP=de("$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)=>Np(i,r,n,e));Np(o,r,n,e);return}});function Np(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 ZP=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}},Qc="~memo",Op=[];function j_(e){return e!==null&&typeof e==="object"}function Mc(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var W_=new WeakMap,ws=0,Ha=1,Rs=2;function Va(e,t,r){let n=W_.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=Va(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?Ha:p.value?._zod?Va(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=Al(a);l(u?s(u,!0):Ha),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?Va(u,t,!1):Ha);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),QP(e,o)}function QP(e,t){if(t!==Ha)W_.set(e,t===Rs);return t}function ek(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var wa,Ta=[],tk={alloc(e,t,r){let n=wa;if(!n)return r;wa=void 0;let o={value:r,issues:null};return n.set(t.value,o),Ta.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"&&nk(i,o.value))throw new ZP;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=Va(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(!j_(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=ek(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}wa=h;let p=Ta.length,_=s(a,c);wa=void 0;let y=Ta.length>p?Ta.pop():void 0;if(_ instanceof Promise)return _.then((S)=>{if(y)y.issues=S.issues.length?Mc(S.issues):Op;return S});if(y)y.issues=_.issues.length?Mc(_.issues):Op;return _};if(e._zod.parse=l,e._zod.run===s)e._zod.run=l})}};function rk(){return tk}function nk(e,t){let r=e[Qc]?.backEdges;return r!==void 0&&j_(t)&&r.has(t)}var ok=()=>{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=E_(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 ${Fu(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 ik(){return{localeError:ok()}}var $p,sk=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 ak(){return new sk}($p=globalThis).__zod_globalRegistry??($p.__zod_globalRegistry=ak());var Ts=globalThis.__zod_globalRegistry;function $l(e){if(e.checks)e.checks=[...e.checks];return e}function lk(e,t){return new e($l({type:"string",...Fe(t)}))}function ck(e,t){return new e($l({type:"string",coerce:!0,...Fe(t)}))}function J_(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Fe(t)})}function uk(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Fe(t)})}function dk(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Fe(t)})}function fk(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Fe(t)})}function pk(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Fe(t)})}function hk(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Fe(t)})}function K_(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Fe(t)})}function mk(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Fe(t)})}function gk(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Fe(t)})}function vk(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Fe(t)})}function _k(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Fe(t)})}function yk(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Fe(t)})}function Sk(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Fe(t)})}function Ek(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Fe(t)})}function bk(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Fe(t)})}function wk(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Fe(t)})}function Tk(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Fe(t)})}function Ck(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Fe(t)})}function Rk(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Fe(t)})}function Ak(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Fe(t)})}function Ik(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Fe(t)})}function Pk(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Fe(t)})}function X_(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Fe(t)})}function Y_(e,t){return new e({type:"string",format:"date",check:"string_format",...Fe(t)})}function Z_(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Fe(t)})}function Q_(e,t){return new e({type:"string",format:"duration",check:"string_format",...Fe(t)})}function kk(e,t){return new e($l({type:"number",checks:[],...Fe(t)}))}function Nk(e,t){return new e($l({type:"number",coerce:!0,checks:[],...Fe(t)}))}function Ok(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Fe(t)})}function $k(e,t){return new e({type:"boolean",...Fe(t)})}function Mk(e,t){return new e({type:"boolean",coerce:!0,...Fe(t)})}function Dk(e,t){return new e({type:"bigint",coerce:!0,...Fe(t)})}function xk(e,t){return new e({type:"null",...Fe(t)})}function Lk(e){return new e({type:"any"})}function qk(e){return new e({type:"unknown"})}function Uk(e,t){return new e({type:"never",...Fe(t)})}function Fk(e,t){return new e({type:"date",coerce:!0,...Fe(t)})}function tl(e,t){return new N_({check:"less_than",...Fe(t),value:e,inclusive:!1})}function Oo(e,t){return new N_({check:"less_than",...Fe(t),value:e,inclusive:!0})}function rl(e,t){return new O_({check:"greater_than",...Fe(t),value:e,inclusive:!1})}function $o(e,t){return new O_({check:"greater_than",...Fe(t),value:e,inclusive:!0})}function eu(e,t){return new II({check:"multiple_of",...Fe(t),value:e})}function ey(e,t){return new kI({check:"max_length",...Fe(t),maximum:e})}function nl(e,t){return new NI({check:"min_length",...Fe(t),minimum:e})}function ty(e,t){return new OI({check:"length_equals",...Fe(t),length:e})}function Gk(e,t){return new $I({check:"string_format",format:"regex",...Fe(t),pattern:e})}function Bk(e){return new MI({check:"string_format",format:"lowercase",...Fe(e)})}function Hk(e){return new DI({check:"string_format",format:"uppercase",...Fe(e)})}function Vk(e,t){return new xI({check:"string_format",format:"includes",...Fe(t),includes:e})}function zk(e,t){return new LI({check:"string_format",format:"starts_with",...Fe(t),prefix:e})}function jk(e,t){return new qI({check:"string_format",format:"ends_with",...Fe(t),suffix:e})}function Ui(e){return new UI({check:"overwrite",tx:e})}function Wk(e){return Ui((t)=>t.normalize(e))}function Jk(){return Ui((e)=>e.trim())}function Kk(){return Ui((e)=>e.toLowerCase())}function Xk(){return Ui((e)=>e.toUpperCase())}function Yk(){return Ui((e)=>h_(e))}function Zk(e,t,r){return new e({type:"array",element:t,...Fe(r)})}function Qk(e,t,r){return new e({type:"custom",check:"custom",fn:t,...Fe(r)})}function eN(e,t){let r=tN((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 tN(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))jr(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>
116
+
117
+ 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 ry(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;ry(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 ny=new Set(["type","properties","required","additionalProperties"]),Dp=["oneOf","anyOf"];function xp(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(!ny.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]??xp(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};jr(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=xp(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 rN(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of ny)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())ry(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)??[])rN(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;jr(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 nN=(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)},ki=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},Ni=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},Lp=(e,t)=>{ki(e,"minimum",t),Ni(e,"maximum",t)},oy=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},iy=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},sy=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},ay=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},qp=(e,t)=>ki(e,"minimum",t.minimum),Up=(e,t)=>Ni(e,"maximum",t.maximum),Fp=(e)=>(t,r)=>{ay(t,r.format);let[n,o]=e[r.format];ki(t,"minimum",n),Ni(t,"maximum",o)},oN={greater_than:(e,t)=>ki(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Ni(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>oy(e,t.value),number_format:Fp(Gu),bigint_format:Fp(__),min_length:qp,max_length:Up,length_equals:(e,t)=>Lp(e,t.length),min_size:qp,max_size:Up,size_equals:(e,t)=>Lp(e,t.size),string_format:(e,t)=>{if(ay(e,t.format),t.pattern)iy(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)=>sy(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)oN[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)ki(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)ki(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)Ni(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)Ni(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)oy(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)sy(t,o.mime);for(let i of o.patterns??[])iy(t,i);return t}var iN={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},sN=new Map([[U_,pI],[Ku,hI]]),ly=(e)=>sN.get(e)??e,cy=(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=iN[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(ly);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}))]}},uy=(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}))]}},dy=(e,t,r,n)=>{r.type="boolean"},fy=(e,t,r,n)=>{er(e,t,r,n,"BigInt cannot be represented in JSON Schema")},aN=(e,t,r,n)=>{er(e,t,r,n,"Symbols cannot be represented in JSON Schema")},py=(e,t,r,n)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"},lN=(e,t,r,n)=>{er(e,t,r,n,"Undefined cannot be represented in JSON Schema")},cN=(e,t,r,n)=>{er(e,t,r,n,"Void cannot be represented in JSON Schema")},hy=(e,t,r,n)=>{r.not={}},my=(e,t,r,n)=>{},gy=(e,t,r,n)=>{},vy=(e,t,r,n)=>{er(e,t,r,n,"Date cannot be represented in JSON Schema")},_y=(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},yy=(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}},uN=(e,t,r,n)=>{er(e,t,r,n,"NaN cannot be represented in JSON Schema")},dN=(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},fN=(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}))},pN=(e,t,r,n)=>{r.type="boolean"},Sy=(e,t,r,n)=>{er(e,t,r,n,"Custom types cannot be represented in JSON Schema")},hN=(e,t,r,n)=>{er(e,t,r,n,"Function types cannot be represented in JSON Schema")},Ey=(e,t,r,n)=>{er(e,t,r,n,"Transforms cannot be represented in JSON Schema")},mN=(e,t,r,n)=>{er(e,t,r,n,"Map cannot be represented in JSON Schema")},gN=(e,t,r,n)=>{er(e,t,r,n,"Set cannot be represented in JSON Schema")},by=(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 wy=(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)jr(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"]})},Ty=(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},Cy=(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)},vN=(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")?ju:wI).source;return g}var nu=new WeakMap;function _N(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 Ry=(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)jr(o.patternProperties,ly(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(()=>_N(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)}},Ay=(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"}]},Iy=(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=Symbol();function Py(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"),Xu}var ky=(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=Py(o.defaultValue,e,t,r,n);if(s!==Xu)r.default=s},Ny=(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=Py(o.defaultValue,e,t,r,n);if(s!==Xu)r._prefault=s},Oy=(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},$y=(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},My=(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},yN=(e,t,r,n)=>{let o=e._zod.def;At(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Yu=(e,t,r,n)=>{let o=e._zod.def;At(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Dy=(e,t,r,n)=>{let o=e._zod.innerType;At(o,t,n);let i=t.seen.get(e);i.ref=o},Gp={string:cy,number:uy,boolean:dy,bigint:fy,symbol:aN,null:py,undefined:lN,void:cN,never:hy,any:my,unknown:gy,date:vy,enum:_y,literal:yy,nan:uN,template_literal:dN,file:fN,success:pN,custom:Sy,function:hN,transform:Ey,map:mN,set:gN,array:by,object:wy,union:Ty,intersection:Cy,tuple:vN,record:Ry,nullable:Ay,nonoptional:Iy,default:ky,prefault:Ny,catch:Oy,pipe:$y,readonly:My,promise:yN,optional:Yu,lazy:Dy};function Zu(e,t){if("_idmap"in e){let n=e,o=ol({...t,processors:Gp}),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),jr(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:Gp});return At(e,r),il(r,e),sl(r,e)}var Bp=new WeakSet([Object.prototype,Error.prototype]);function Ca(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 SN=(e,t)=>{OA.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(Bp.has(r))return;Bp.add(r),Ca(r,"format",(n)=>(o)=>DA(n,o)),Ca(r,"flatten",(n)=>(o)=>MA(n,o)),Ca(r,"addIssue",(n)=>(o)=>{n.issues.push(o),n.message=JSON.stringify(n.issues,Ka,2)}),Ca(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}})},Mr=de("ZodError",SN,void 0,{Parent:Error}),EN=Bu(Mr),bN=Hu(Mr),xy=Vu(Mr),wN=zu(Mr),TN=HA(Mr),CN=VA(Mr),RN=zA(Mr),AN=jA(Mr),IN=WA(Mr),PN=JA(Mr),kN=KA(Mr),NN=XA(Mr);function ON(){if(!zr.localeError)ln(ik())}function Ml(){if(!zr.memoizer)ln({memoizer:rk()})}var wt=de("ZodType",(e,t)=>(ON(),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 Ln(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(TO(e,t))},superRefine(e,t){return this.check(CO(e,t))},overwrite(e){return this.check(Ui(e))},optional(){return De(this)},exactOptional(){return uO(this)},nullable(){return zp(this)},nullish(){return De(zp(this))},nonoptional(e){return gO(this,e)},array(){return ie(this)},or(e){return ke([this,e])},and(e){return Uo(this,e)},transform(e){return jp(this,zy(e))},default(e){return pO(this,e)},prefault(e){return mO(this,e)},catch(e){return _O(this,e)},pipe(e){return jp(this,e)},readonly(){return EO(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",{...M_(this),jsonSchema:{input:al(this,"input"),output:al(this,"output")}})},set "~standard"(e){rt.own(this,"~standard",e)},parse:function e(t,r){return EN(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await bN(this,t,r,{callee:e})},safeParse(e,t){return xy(this,e,t)},async safeParseAsync(e,t){return wN(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){rt.own(this,"spa",e)},validate(e,t){return FA(this,e,t)},validateAsync(e,t){return BA(this,e,t)},encode:function e(t,r){return TN(this,t,r,{callee:e})},decode:function e(t,r){return CN(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await RN(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await AN(this,t,r,{callee:e})},safeEncode(e,t){return IN(this,e,t)},safeDecode(e,t){return PN(this,e,t)},async safeEncodeAsync(e,t){return kN(this,e,t)},async safeDecodeAsync(e,t){return NN(this,e,t)},toJSONSchema(e){return nN(this,{})(e)},get description(){return Ts.get(this)?.description},get _def(){return this._zod.def}}),Ly=de("_ZodString",(e,t)=>{Ju.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>cy(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(Gk(...e))},includes(...e){return this.check(Vk(...e))},startsWith(...e){return this.check(zk(...e))},endsWith(...e){return this.check(jk(...e))},min(...e){return this.check(nl(...e))},max(...e){return this.check(ey(...e))},length(...e){return this.check(ty(...e))},nonempty(...e){return this.check(nl(1,...e))},lowercase(e){return this.check(Bk(e))},uppercase(e){return this.check(Hk(e))},trim(){return this.check(Jk())},normalize(...e){return this.check(Wk(...e))},toLowerCase(){return this.check(Kk())},toUpperCase(){return this.check(Xk())},slugify(){return this.check(Yk())}})),qy=de("ZodString",(e,t)=>{Ju.init(e,t),Ly.init(e,t)},{email(e){return this.check(J_(Uy,e))},url(e){return this.check(K_(Fy,e))},jwt(e){return this.check(Pk(KN,e))},emoji(e){return this.check(mk(DN,e))},guid(e){return this.check(uk(MN,e))},uuid(e){return this.check(dk(Ra,e))},uuidv4(e){return this.check(fk(Ra,e))},uuidv6(e){return this.check(pk(Ra,e))},uuidv7(e){return this.check(hk(Ra,e))},nanoid(e){return this.check(gk(xN,e))},cuid(e){return this.check(vk(LN,e))},cuid2(e){return this.check(_k(qN,e))},ulid(e){return this.check(yk(UN,e))},base64(e){return this.check(Rk(jN,e))},base64url(e){return this.check(Ak(WN,e))},xid(e){return this.check(Sk(FN,e))},ksuid(e){return this.check(Ek(GN,e))},ipv4(e){return this.check(bk(BN,e))},ipv6(e){return this.check(wk(HN,e))},cidrv4(e){return this.check(Tk(VN,e))},cidrv6(e){return this.check(Ck(zN,e))},e164(e){return this.check(Ik(JN,e))},datetime(e){return this.check(X_(Qu,e))},date(e){return this.check(Y_(ed,e))},time(e){return this.check(Z_(td,e))},duration(e){return this.check(Q_(rd,e))}});function k(e){return lk(qy,e)}var $t=de("ZodStringFormat",(e,t)=>{Nt.init(e,t),Ly.init(e,t)}),Qu=de("ZodISODateTime",(e,t)=>{iP.init(e,t),$t.init(e,t)}),ed=de("ZodISODate",(e,t)=>{sP.init(e,t),$t.init(e,t)}),td=de("ZodISOTime",(e,t)=>{aP.init(e,t),$t.init(e,t)}),rd=de("ZodISODuration",(e,t)=>{lP.init(e,t),$t.init(e,t)}),Uy=de("ZodEmail",(e,t)=>{zI.init(e,t),$t.init(e,t)});function $N(e){return J_(Uy,e)}var MN=de("ZodGUID",(e,t)=>{HI.init(e,t),$t.init(e,t)}),Ra=de("ZodUUID",(e,t)=>{VI.init(e,t),$t.init(e,t)}),Fy=de("ZodURL",(e,t)=>{YI.init(e,t),$t.init(e,t)});function Gy(e){return K_(Fy,e)}var DN=de("ZodEmoji",(e,t)=>{ZI.init(e,t),$t.init(e,t)}),xN=de("ZodNanoID",(e,t)=>{QI.init(e,t),$t.init(e,t)}),LN=de("ZodCUID",(e,t)=>{eP.init(e,t),$t.init(e,t)}),qN=de("ZodCUID2",(e,t)=>{tP.init(e,t),$t.init(e,t)}),UN=de("ZodULID",(e,t)=>{rP.init(e,t),$t.init(e,t)}),FN=de("ZodXID",(e,t)=>{nP.init(e,t),$t.init(e,t)}),GN=de("ZodKSUID",(e,t)=>{oP.init(e,t),$t.init(e,t)}),BN=de("ZodIPv4",(e,t)=>{cP.init(e,t),$t.init(e,t)}),HN=de("ZodIPv6",(e,t)=>{dP.init(e,t),$t.init(e,t)}),VN=de("ZodCIDRv4",(e,t)=>{fP.init(e,t),$t.init(e,t)}),zN=de("ZodCIDRv6",(e,t)=>{hP.init(e,t),$t.init(e,t)}),jN=de("ZodBase64",(e,t)=>{mP.init(e,t),$t.init(e,t)}),WN=de("ZodBase64URL",(e,t)=>{vP.init(e,t),$t.init(e,t)}),JN=de("ZodE164",(e,t)=>{_P.init(e,t),$t.init(e,t)}),KN=de("ZodJWT",(e,t)=>{SP.init(e,t),$t.init(e,t)}),nd=de("ZodNumber",(e,t)=>{F_.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>uy(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($o(e,t))},min(e,t){return this.check($o(e,t))},lt(e,t){return this.check(tl(e,t))},lte(e,t){return this.check(Oo(e,t))},max(e,t){return this.check(Oo(e,t))},int(e){return this.check(Hp(e))},safe(e){return this.check(Hp(e))},positive(e){return this.check(rl(0,e))},nonnegative(e){return this.check($o(0,e))},negative(e){return this.check(tl(0,e))},nonpositive(e){return this.check(Oo(0,e))},multipleOf(e,t){return this.check(eu(e,t))},step(e,t){return this.check(eu(e,t))},finite(){return this}}));function ye(e){return kk(nd,e)}var XN=de("ZodNumberFormat",(e,t)=>{EP.init(e,t),nd.init(e,t)});function Hp(e){return Ok(XN,e)}var By=de("ZodBoolean",(e,t)=>{bP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dy(e,r,n,o)});function Pe(e){return $k(By,e)}var YN=de("ZodBigInt",(e,t)=>{wP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fy(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($o(e,t))},min(e,t){return this.check($o(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(Oo(e,t))},max(e,t){return this.check(Oo(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(Oo(BigInt(0),e))},nonnegative(e){return this.check($o(BigInt(0),e))},multipleOf(e,t){return this.check(eu(e,t))}})),ZN=de("ZodNull",(e,t)=>{TP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>py(e,r,n,o)});function $s(e){return xk(ZN,e)}var QN=de("ZodAny",(e,t)=>{CP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>my(e,r,n,o)});function eO(){return Lk(QN)}var tO=de("ZodUnknown",(e,t)=>{RP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gy(e,r,n,o)});function xe(){return qk(tO)}var rO=de("ZodNever",(e,t)=>{AP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hy(e,r,n,o)});function nO(e){return Uk(rO,e)}var oO=de("ZodDate",(e,t)=>{IP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vy(e,r,n,o),e.min=(r,n)=>e.check($o(r,n)),e.max=(r,n)=>e.check(Oo(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}},{})),iO=de("ZodArray",(e,t)=>{Ml(),NP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>by(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(ey(e,t))},length(e,t){return this.check(ty(e,t))},unwrap(){return this.element}});function ie(e,t){return Zk(iO,e,t)}var Hy=de("ZodObject",(e,t)=>{Ml(),MP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wy(e,r,n,o),rt.installLazyProp(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return je(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:nO()}))},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(jy,this,e[0])},exactPartial(...e){return rt.partial(Wy,this,e[0],"exactPartial")},required(...e){return rt.required(Jy,this,e[0])}});function K(e,t){let r={type:"object",shape:e??{},...rt.normalizeParams(t)};return new Hy(r)}function Ge(e,t){return new Hy({type:"object",shape:e,catchall:xe(),...rt.normalizeParams(t)})}var Vy=de("ZodUnion",(e,t)=>{H_.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ty(e,r,n,o),e.options=t.options});function ke(e,t){return new Vy({type:"union",options:e,...rt.normalizeParams(t)})}var sO=de("ZodDiscriminatedUnion",(e,t)=>{Vy.init(e,t),xP.init(e,t)});function Ms(e,t,r){return new sO({type:"union",options:t,discriminator:e,...rt.normalizeParams(r)})}var aO=de("ZodIntersection",(e,t)=>{LP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Cy(e,r,n,o)});function Uo(e,t){return new aO({type:"intersection",left:e,right:t})}var Vp=de("ZodRecord",(e,t)=>{Ml(),qP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ry(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function Re(e,t,r){if(!t||!t._zod)return new Vp({type:"record",keyType:k(),valueType:e,...rt.normalizeParams(t)});return new Vp({type:"record",keyType:e,valueType:t,...rt.normalizeParams(r)})}var ou=de("ZodEnum",(e,t)=>{UP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(n,o,i)=>_y(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 je(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 lO=de("ZodLiteral",(e,t)=>{FP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yy(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 se(e,t){return new lO({type:"literal",values:Array.isArray(e)?e:[e],...rt.normalizeParams(t)})}var cO=de("ZodTransform",(e,t)=>{Ml(),GP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ey(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new A_(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 zy(e){return new cO({type:"transform",transform:e})}var jy=de("ZodOptional",(e,t)=>{V_.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yu(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function De(e){return new jy({type:"optional",innerType:e})}var Wy=de("ZodExactOptional",(e,t)=>{BP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yu(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function uO(e){return new Wy({type:"optional",innerType:e})}var dO=de("ZodNullable",(e,t)=>{HP.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 zp(e){return new dO({type:"nullable",innerType:e})}var fO=de("ZodDefault",(e,t)=>{VP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ky(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function pO(e,t){return new fO({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():rt.shallowClone(t)}})}var hO=de("ZodPrefault",(e,t)=>{zP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ny(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function mO(e,t){return new hO({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():rt.shallowClone(t)}})}var Jy=de("ZodNonOptional",(e,t)=>{jP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Iy(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function gO(e,t){return new Jy({type:"nonoptional",innerType:e,...rt.normalizeParams(t)})}var vO=de("ZodCatch",(e,t)=>{WP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Oy(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function _O(e,t){return new vO({type:"catch",innerType:e,catchValue:typeof t==="function"?t:rt.constantCatch(t)})}var Ky=de("ZodPipe",(e,t)=>{z_.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$y(e,r,n,o),e.in=t.in,e.out=t.out});function jp(e,t){return new Ky({type:"pipe",in:e,out:t})}var yO=de("ZodPreprocess",(e,t)=>{Ky.init(e,t),JP.init(e,t)}),SO=de("ZodReadonly",(e,t)=>{KP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>My(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function EO(e){return new SO({type:"readonly",innerType:e})}var bO=de("ZodLazy",(e,t)=>{XP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Dy(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function od(e){return new bO({type:"lazy",getter:e})}var wO=de("ZodCustom",(e,t)=>{YP.init(e,t),wt.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sy(e,r,n,o)});function TO(e,t={}){return Qk(wO,e,t)}function CO(e,t){return eN(e,t)}function Ds(e,t){return new yO({type:"pipe",in:zy(e),out:t})}var RO={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"},Wp;Wp||(Wp={});var Fi={};Bs(Fi,{ZodISODate:()=>ed,ZodISODateTime:()=>Qu,ZodISODuration:()=>rd,ZodISOTime:()=>td,date:()=>IO,datetime:()=>AO,duration:()=>kO,time:()=>PO});function AO(e){return X_(Qu,e)}function IO(e){return Y_(ed,e)}function PO(e){return Z_(td,e)}function kO(e){return Q_(rd,e)}var Xy={};Bs(Xy,{bigint:()=>MO,boolean:()=>$O,date:()=>DO,number:()=>OO,string:()=>NO});function NO(e){return ck(qy,e)}function OO(e){return Nk(nd,e)}function $O(e){return Mk(By,e)}function MO(e){return Dk(YN,e)}function DO(e){return Fk(oO,e)}var iu="2025-11-25",xO=[iu,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],LO="io.modelcontextprotocol/related-task",Gi="io.modelcontextprotocol/protocolVersion",id="io.modelcontextprotocol/clientInfo",wi="io.modelcontextprotocol/serverInfo",Ks="io.modelcontextprotocol/clientCapabilities",sd="io.modelcontextprotocol/subscriptionId",Dl="io.modelcontextprotocol/logLevel",xl="2.0",Oi=od(()=>ke([k(),ye(),Pe(),$s(),Re(k(),Oi),ie(Oi)])),Ut=Re(k(),Oi),qO=ie(Oi),ad=ke([k(),ye().int()]),ld=k(),Yy=K({ttl:ye().optional()}),Zy=K({taskId:k()}),cd=Ge({progressToken:ad.optional(),[LO]:Zy.optional()}),nr=K({_meta:cd.optional()}),Xs=nr.extend({task:Yy.optional()}),Ft=K({method:k(),params:nr.loose().optional()}),_r=K({_meta:cd.optional()}),yr=K({method:k(),params:_r.loose().optional()}),ud=Ge({get[wi](){return Ul.optional().catch(void 0)}}),Gt=Ge({_meta:ud.optional()}),Bi=ke([k(),ye().int()]),dd=K({jsonrpc:se(xl),id:Bi,...Ft.shape}).strict(),fd=K({jsonrpc:se(xl),...yr.shape}).strict(),Ll=K({jsonrpc:se(xl),id:Bi,result:Gt}).strict(),ql=K({jsonrpc:se(xl),id:Bi.optional(),error:K({code:ye().int(),message:k(),data:xe().optional()})}).strict(),Qy=ke([dd,fd,Ll,ql]),UO=ke([Ll,ql]),pd=Gt.strict(),e0=_r.extend({requestId:Bi.optional(),reason:k().optional()}),hd=yr.extend({method:se("notifications/cancelled"),params:e0}),t0=K({src:k(),mimeType:k().optional(),sizes:ie(k()).optional(),theme:je(["light","dark"]).optional()}),Hi=K({icons:ie(t0).optional()}),Fo=K({name:k(),title:k().optional()}),Ul=Fo.extend({...Fo.shape,...Hi.shape,version:k(),websiteUrl:k().optional(),description:k().optional()}),FO=Uo(K({applyDefaults:Pe().optional()}),Ut),GO=Ds((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)&&Object.keys(e).length===0)return{form:{}};return e},Uo(K({form:FO.optional(),url:Ut.optional()}),Ut.optional())),r0=Ge({list:Ut.optional(),cancel:Ut.optional(),requests:Ge({sampling:Ge({createMessage:Ut.optional()}).optional(),elicitation:Ge({create:Ut.optional()}).optional()}).optional()}),n0=Ge({list:Ut.optional(),cancel:Ut.optional(),requests:Ge({tools:Ge({call:Ut.optional()}).optional()}).optional()}),o0=K({experimental:Re(k(),Ut).optional(),sampling:K({context:Ut.optional(),tools:Ut.optional()}).optional(),elicitation:GO.optional(),roots:K({listChanged:Pe().optional()}).optional(),tasks:r0.optional(),extensions:Re(k(),Ut).optional()}),i0=nr.extend({protocolVersion:k(),capabilities:o0,clientInfo:Ul}),s0=Ft.extend({method:se("initialize"),params:i0}),md=K({experimental:Re(k(),Ut).optional(),logging:Ut.optional(),completions:Ut.optional(),prompts:K({listChanged:Pe().optional()}).optional(),resources:K({subscribe:Pe().optional(),listChanged:Pe().optional()}).optional(),tools:K({listChanged:Pe().optional()}).optional(),tasks:n0.optional(),extensions:Re(k(),Ut).optional()}),a0=Gt.extend({protocolVersion:k(),capabilities:md,serverInfo:Ul,instructions:k().optional()}),l0=yr.extend({method:se("notifications/initialized"),params:_r.optional()}),c0=Ft.extend({method:se("server/discover"),params:nr.optional()}),u0=Gt.extend({supportedVersions:ie(k()),capabilities:md,instructions:k().optional()}),gd=Ft.extend({method:se("ping"),params:nr.optional()}),d0=K({progress:ye(),total:De(ye()),message:De(k())}),f0=K({..._r.shape,...d0.shape,progressToken:ad}),vd=yr.extend({method:se("notifications/progress"),params:f0}),p0=nr.extend({cursor:ld.optional()}),Vi=Ft.extend({params:p0.optional()}),zi=Gt.extend({nextCursor:ld.optional()}),_d=K({uri:k(),mimeType:De(k()),_meta:Re(k(),xe()).optional()}),yd=_d.extend({text:k()}),Sd=k().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Ed=_d.extend({blob:Sd}),ji=je(["user","assistant"]),Vo=K({audience:ie(ji).optional(),priority:ye().min(0).max(1).optional(),lastModified:Fi.datetime({offset:!0}).optional()}),bd=K({...Fo.shape,...Hi.shape,uri:k(),description:De(k()),mimeType:De(k()),size:De(ye()),annotations:Vo.optional(),_meta:De(Ge({}))}),h0=K({...Fo.shape,...Hi.shape,uriTemplate:k(),description:De(k()),mimeType:De(k()),annotations:Vo.optional(),_meta:De(Ge({}))}),m0=Vi.extend({method:se("resources/list")}),g0=zi.extend({resources:ie(bd)}),v0=Vi.extend({method:se("resources/templates/list")}),_0=zi.extend({resourceTemplates:ie(h0)}),Fl=nr.extend({uri:k()}),y0=Fl,S0=Ft.extend({method:se("resources/read"),params:y0}),E0=Gt.extend({contents:ie(ke([yd,Ed]))}),b0=yr.extend({method:se("notifications/resources/list_changed"),params:_r.optional()}),w0=Fl,T0=Ft.extend({method:se("resources/subscribe"),params:w0}),C0=Fl,R0=Ft.extend({method:se("resources/unsubscribe"),params:C0}),wd=K({toolsListChanged:Pe().optional(),promptsListChanged:Pe().optional(),resourcesListChanged:Pe().optional(),resourceSubscriptions:ie(k()).optional()}),A0=nr.extend({notifications:wd}),I0=Ft.extend({method:se("subscriptions/listen"),params:A0}),P0=_r.extend({notifications:wd}),k0=yr.extend({method:se("notifications/subscriptions/acknowledged"),params:P0}),N0=ud.extend({[sd]:Bi}),O0=Gt.extend({_meta:N0}),$0=_r.extend({uri:k()}),M0=yr.extend({method:se("notifications/resources/updated"),params:$0}),D0=K({name:k(),description:De(k()),required:De(Pe())}),x0=K({...Fo.shape,...Hi.shape,description:De(k()),arguments:De(ie(D0)),_meta:De(Ge({}))}),L0=Vi.extend({method:se("prompts/list")}),q0=zi.extend({prompts:ie(x0)}),U0=nr.extend({name:k(),arguments:Re(k(),k()).optional()}),F0=Ft.extend({method:se("prompts/get"),params:U0}),Gl=K({type:se("text"),text:k(),annotations:Vo.optional(),_meta:Re(k(),xe()).optional()}),Bl=K({type:se("image"),data:Sd,mimeType:k(),annotations:Vo.optional(),_meta:Re(k(),xe()).optional()}),Hl=K({type:se("audio"),data:Sd,mimeType:k(),annotations:Vo.optional(),_meta:Re(k(),xe()).optional()}),G0=K({type:se("tool_use"),name:k(),id:k(),input:Re(k(),xe()),_meta:Re(k(),xe()).optional()}),B0=K({type:se("resource"),resource:ke([yd,Ed]),annotations:Vo.optional(),_meta:Re(k(),xe()).optional()}),H0=bd.extend({type:se("resource_link")}),Vl=ke([Gl,Bl,Hl,H0,B0]),V0=K({role:ji,content:Vl}),z0=Gt.extend({description:k().optional(),messages:ie(V0)}),j0=yr.extend({method:se("notifications/prompts/list_changed"),params:_r.optional()}),W0=K({title:k().optional(),readOnlyHint:Pe().optional(),destructiveHint:Pe().optional(),idempotentHint:Pe().optional(),openWorldHint:Pe().optional()}),J0=K({taskSupport:je(["required","optional","forbidden"]).optional()}),Td=K({...Fo.shape,...Hi.shape,description:k().optional(),inputSchema:K({type:se("object"),properties:Re(k(),Oi).optional(),required:ie(k()).optional()}).catchall(xe()),outputSchema:Ge({$schema:k().optional()}).optional(),annotations:W0.optional(),execution:J0.optional(),_meta:Re(k(),xe()).optional()}),K0=Vi.extend({method:se("tools/list")}),X0=zi.extend({tools:ie(Td)}),Cd=Gt.extend({content:ie(Vl).default([]),structuredContent:xe().optional(),isError:Pe().optional()}),BO=Cd.or(Gt.extend({toolResult:xe()})),Y0=Xs.extend({name:k(),arguments:Re(k(),xe()).optional()}),Z0=Ft.extend({method:se("tools/call"),params:Y0}),Q0=yr.extend({method:se("notifications/tools/list_changed"),params:_r.optional()}),HO=K({autoRefresh:Pe().default(!0),debounceMs:ye().int().nonnegative().default(300)}),xs=je(["debug","info","notice","warning","error","critical","alert","emergency"]),eS=nr.extend({level:xs}),tS=Ft.extend({method:se("logging/setLevel"),params:eS}),rS=_r.extend({level:xs,logger:k().optional(),data:xe()}),nS=yr.extend({method:se("notifications/message"),params:rS}),oS=K({name:k().optional()}),iS=K({hints:ie(oS).optional(),costPriority:ye().min(0).max(1).optional(),speedPriority:ye().min(0).max(1).optional(),intelligencePriority:ye().min(0).max(1).optional()}),sS=K({mode:je(["auto","required","none"]).optional()}),aS=K({type:se("tool_result"),toolUseId:k().describe("The unique identifier for the corresponding tool call."),content:ie(Vl),structuredContent:xe().optional(),isError:Pe().optional(),_meta:Re(k(),xe()).optional()}),lS=Ms("type",[Gl,Bl,Hl]),Ls=Ms("type",[Gl,Bl,Hl,G0,aS]),cS=K({role:ji,content:ke([Ls,ie(Ls)]),_meta:Re(k(),xe()).optional()}),uS=Xs.extend({messages:ie(cS),modelPreferences:iS.optional(),systemPrompt:k().optional(),includeContext:je(["none","thisServer","allServers"]).optional(),temperature:ye().optional(),maxTokens:ye().int(),stopSequences:ie(k()).optional(),metadata:Ut.optional(),tools:ie(Td).optional(),toolChoice:sS.optional()}),dS=Ft.extend({method:se("sampling/createMessage"),params:uS}),fS=Gt.extend({model:k(),stopReason:De(je(["endTurn","stopSequence","maxTokens"]).or(k())),role:ji,content:lS}),pS=Gt.extend({model:k(),stopReason:De(je(["endTurn","stopSequence","maxTokens","toolUse"]).or(k())),role:ji,content:ke([Ls,ie(Ls)])}),Rd=K({type:se("boolean"),title:k().optional(),description:k().optional(),default:Pe().optional()}),zl=K({type:se("string"),title:k().optional(),description:k().optional(),minLength:ye().optional(),maxLength:ye().optional(),format:je(["email","uri","date","date-time"]).optional(),default:k().optional()}),ll=K({type:je(["number","integer"]),title:k().optional(),description:k().optional(),minimum:ye().optional(),maximum:ye().optional(),default:ye().optional()}),Ad=K({type:se("string"),title:k().optional(),description:k().optional(),enum:ie(k()),default:k().optional()}),Id=K({type:se("string"),title:k().optional(),description:k().optional(),oneOf:ie(K({const:k(),title:k()})),default:k().optional()}),Pd=K({type:se("string"),title:k().optional(),description:k().optional(),enum:ie(k()),enumNames:ie(k()).optional(),default:k().optional()}),hS=ke([Ad,Id]),kd=K({type:se("array"),title:k().optional(),description:k().optional(),minItems:ye().optional(),maxItems:ye().optional(),items:K({type:se("string"),enum:ie(k())}),default:ie(k()).optional()}),Nd=K({type:se("array"),title:k().optional(),description:k().optional(),minItems:ye().optional(),maxItems:ye().optional(),items:K({anyOf:ie(K({const:k(),title:k()}))}),default:ie(k()).optional()}),mS=ke([kd,Nd]),gS=ke([Pd,hS,mS]),Od=ke([gS,Rd,zl,ll]),jl=Xs.extend({mode:se("form").optional(),message:k(),requestedSchema:K({type:se("object"),properties:Re(k(),Od),required:ie(k()).optional()}).catchall(xe())}),vS=Xs.extend({mode:se("url"),message:k(),elicitationId:k(),url:k().url()}),_S=ke([jl,vS]),yS=Ft.extend({method:se("elicitation/create"),params:_S}),SS=_r.extend({elicitationId:k()}),ES=yr.extend({method:se("notifications/elicitation/complete"),params:SS}),bS=Gt.extend({action:je(["accept","decline","cancel"]),content:Ds((e)=>e===null?void 0:e,Re(k(),ke([k(),ye(),Pe(),ie(k())])).optional())}),wS=K({type:se("ref/resource"),uri:k()}),TS=K({type:se("ref/prompt"),name:k()}),CS=nr.extend({ref:ke([TS,wS]),argument:K({name:k(),value:k()}),context:K({arguments:Re(k(),k()).optional()}).optional()}),RS=Ft.extend({method:se("completion/complete"),params:CS}),AS=Gt.extend({completion:Ge({values:ie(k()).max(100),total:De(ye().int()),hasMore:De(Pe())})}),IS=K({uri:k().startsWith("file://"),name:k().optional(),_meta:Re(k(),xe()).optional()}),PS=Ft.extend({method:se("roots/list"),params:nr.optional()}),kS=Gt.extend({roots:ie(IS)}),NS=yr.extend({method:se("notifications/roots/list_changed"),params:_r.optional()}),VO=Ge({ttl:ye().optional(),pollInterval:ye().optional()}),OS=je(["working","input_required","completed","failed","cancelled"]),Wi=K({taskId:k(),status:OS,ttl:ke([ye(),$s()]),createdAt:k(),lastUpdatedAt:k(),pollInterval:De(ye()),statusMessage:De(k())}),zO=Gt.extend({task:Wi}),$S=_r.merge(Wi),jO=yr.extend({method:se("notifications/tasks/status"),params:$S}),WO=Ft.extend({method:se("tasks/get"),params:nr.extend({taskId:k()})}),JO=Gt.merge(Wi),KO=Ft.extend({method:se("tasks/result"),params:nr.extend({taskId:k()})}),XO=Gt.loose(),YO=Vi.extend({method:se("tasks/list")}),ZO=zi.extend({tasks:ie(Wi)}),QO=Ft.extend({method:se("tasks/cancel"),params:nr.extend({taskId:k()})}),e$=Gt.merge(Wi),t$=ke([gd,s0,c0,RS,tS,F0,L0,m0,v0,S0,T0,R0,I0,Z0,K0]),r$=ke([hd,vd,l0,NS]),n$=ke([pd,fS,pS,bS,kS]),o$=ke([gd,dS,yS,PS]),i$=ke([hd,vd,nS,M0,b0,Q0,j0,k0,ES]),s$=ke([pd,a0,u0,AS,z0,q0,g0,_0,E0,Cd,X0,O0]),Qt=Gy().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:RO.custom,message:"URL must be parseable",fatal:!0}),AA}).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"}),a$=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()}),MS=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()}),DS=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)}),l$=K({...DS.shape,...MS.pick({code_challenge_methods_supported:!0}).shape}),c$=K({access_token:k(),id_token:k().optional(),token_type:k(),expires_in:Xy.number().optional(),scope:k().optional(),refresh_token:k().optional(),issuer:k().optional().catch(void 0)}).strip(),u$=K({issued_token_type:se("urn:ietf:params:oauth:token-type:id-jag"),access_token:k(),token_type:k().optional(),expires_in:ye().optional(),scope:k().optional()}).strip(),d$=K({error:k(),error_description:k().optional(),error_uri:k().optional()}),Jp=Qt.optional().or(se("").transform(()=>{return})),xS=K({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:Jp,scope:k().optional(),contacts:ie(k()).optional(),tos_uri:Jp,policy_uri:k().optional(),jwks_uri:Qt.optional(),jwks:eO().optional(),software_id:k().optional(),software_version:k().optional(),software_statement:k().optional()}).strip(),LS=K({client_id:k(),client_secret:k().optional(),client_id_issued_at:ye().optional(),client_secret_expires_at:ye().optional(),issuer:k().optional().catch(void 0)}).strip(),f$=xS.merge(LS),p$=K({error:k(),error_description:k().optional()}).strip(),h$=K({token:k(),token_type_hint:k().optional()}).strip(),su=Symbol.for("mcp.sdk.errorBrands");function $d(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 $i(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 $i(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 $i(this,t)}constructor(t,r,n){super(r);this.code=t,this.errorUri=n,this.name="OAuthError",$d(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 $i(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 $i(this,e)}constructor(e,t,r,n){super(t,n);this.code=e,this.data=r,this.name="SdkError",$d(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 Kp(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function m$(e,t,r){return e==="elicitation"&&t==="form"&&r.form===void 0&&r.url===void 0}function g$(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 qS(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(Kp(o)&&Kp(i)){let s={};for(let[l,a]of Object.entries(o))if(a!==void 0&&i[l]===void 0&&!m$(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 US="2026-07-28",vi=[US];function Ys(e){return e>=US}function v$(e){return e.filter((t)=>!Ys(t))}function Xp(e){return e.filter((t)=>Ys(t))}function FS(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 GS=["task","inputRequests","requestState"];function BS(e){if(e===null||typeof e!=="object"||Array.isArray(e)||e.content!==void 0||GS.some((t)=>(t in e)))return e;return{...e,content:[]}}function _$(){let e=od(()=>ke([k(),ye(),Pe(),$s(),Re(k(),e),ie(e)])),t=Re(k(),e),r=ke([k(),ye().int()]),n=k(),o=K({ttl:ye().optional()}),i=K({taskId:k()}),s=Ge({progressToken:r.optional(),"io.modelcontextprotocol/related-task":i.optional()}),l=K({_meta:s.optional()}),a=l.extend({task:o.optional()}),c=K({method:k(),params:l.loose().optional()}),u=K({_meta:s.optional()}),f=K({method:k(),params:u.loose().optional()}),h=Ge({_meta:s.optional()}),g=ke([k(),ye().int()]),p=h.strict(),_=u.extend({requestId:g.optional(),reason:k().optional()}),y=f.extend({method:se("notifications/cancelled"),params:_}),S=K({src:k(),mimeType:k().optional(),sizes:ie(k()).optional(),theme:je(["light","dark"]).optional()}),E=K({icons:ie(S).optional()}),b=K({name:k(),title:k().optional()}),R=b.extend({...b.shape,...E.shape,version:k(),websiteUrl:k().optional(),description:k().optional()}),w=Uo(K({applyDefaults:Pe().optional()}),t),T=Ds((zt)=>{if(zt&&typeof zt==="object"&&!Array.isArray(zt)&&Object.keys(zt).length===0)return{form:{}};return zt},Uo(K({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=K({experimental:Re(k(),t).optional(),sampling:K({context:t.optional(),tools:t.optional()}).optional(),elicitation:T.optional(),roots:K({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:se("initialize"),params:D}),F=K({experimental:Re(k(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:K({listChanged:Pe().optional()}).optional(),resources:K({subscribe:Pe().optional(),listChanged:Pe().optional()}).optional(),tools:K({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:se("notifications/initialized"),params:u.optional()}),Q=c.extend({method:se("ping"),params:l.optional()}),pe=K({progress:ye(),total:De(ye()),message:De(k())}),ae=K({...u.shape,...pe.shape,progressToken:r}),ve=f.extend({method:se("notifications/progress"),params:ae}),me=l.extend({cursor:n.optional()}),j=c.extend({params:me.optional()}),ne=h.extend({nextCursor:n.optional()}),he=K({uri:k(),mimeType:De(k()),_meta:Re(k(),xe()).optional()}),q=he.extend({text:k()}),X=k().refine((zt)=>{try{return atob(zt),!0}catch{return!1}},{message:"Invalid Base64 string"}),W=he.extend({blob:X}),be=je(["user","assistant"]),Ce=K({audience:ie(be).optional(),priority:ye().min(0).max(1).optional(),lastModified:Fi.datetime({offset:!0}).optional()}),Ve=K({...b.shape,...E.shape,uri:k(),description:De(k()),mimeType:De(k()),size:De(ye()),annotations:Ce.optional(),_meta:De(Ge({}))}),Ie=K({...b.shape,...E.shape,uriTemplate:k(),description:De(k()),mimeType:De(k()),annotations:Ce.optional(),_meta:De(Ge({}))}),We=j.extend({method:se("resources/list")}),U=ne.extend({resources:ie(Ve)}),O=j.extend({method:se("resources/templates/list")}),x=ne.extend({resourceTemplates:ie(Ie)}),H=l.extend({uri:k()}),J=H,Y=c.extend({method:se("resources/read"),params:J}),ee=h.extend({contents:ie(ke([q,W]))}),Z=f.extend({method:se("notifications/resources/list_changed"),params:u.optional()}),te=H,oe=c.extend({method:se("resources/subscribe"),params:te}),L=H,z=c.extend({method:se("resources/unsubscribe"),params:L}),ce=u.extend({uri:k()}),ue=f.extend({method:se("notifications/resources/updated"),params:ce}),ge=K({name:k(),description:De(k()),required:De(Pe())}),Ne=K({...b.shape,...E.shape,description:De(k()),arguments:De(ie(ge)),_meta:De(Ge({}))}),et=j.extend({method:se("prompts/list")}),He=ne.extend({prompts:ie(Ne)}),Je=l.extend({name:k(),arguments:Re(k(),k()).optional()}),St=c.extend({method:se("prompts/get"),params:Je}),Kt=K({type:se("text"),text:k(),annotations:Ce.optional(),_meta:Re(k(),xe()).optional()}),Xt=K({type:se("image"),data:X,mimeType:k(),annotations:Ce.optional(),_meta:Re(k(),xe()).optional()}),xt=K({type:se("audio"),data:X,mimeType:k(),annotations:Ce.optional(),_meta:Re(k(),xe()).optional()}),It=K({type:se("tool_use"),name:k(),id:k(),input:Re(k(),xe()),_meta:Re(k(),xe()).optional()}),at=K({type:se("resource"),resource:ke([q,W]),annotations:Ce.optional(),_meta:Re(k(),xe()).optional()}),Ue=Ve.extend({type:se("resource_link")}),ze=ke([Kt,Xt,xt,Ue,at]),Qe=K({role:be,content:ze}),or=h.extend({description:k().optional(),messages:ie(Qe)}),Lt=f.extend({method:se("notifications/prompts/list_changed"),params:u.optional()}),Mt=K({title:k().optional(),readOnlyHint:Pe().optional(),destructiveHint:Pe().optional(),idempotentHint:Pe().optional(),openWorldHint:Pe().optional()}),ir=K({taskSupport:je(["required","optional","forbidden"]).optional()}),sr=K({...b.shape,...E.shape,description:k().optional(),inputSchema:K({type:se("object"),properties:Re(k(),e).optional(),required:ie(k()).optional()}).catchall(xe()),outputSchema:K({type:se("object"),properties:Re(k(),e).optional(),required:ie(k()).optional()}).catchall(xe()).optional(),annotations:Mt.optional(),execution:ir.optional(),_meta:Re(k(),xe()).optional()}),Rr=j.extend({method:se("tools/list")}),Sr=ne.extend({tools:ie(sr)}),Er=h.extend({content:ie(ze),structuredContent:Re(k(),xe()).optional(),isError:Pe().optional()}),qt=a.extend({name:k(),arguments:Re(k(),xe()).optional()}),go=c.extend({method:se("tools/call"),params:qt}),Wo=f.extend({method:se("notifications/tools/list_changed"),params:u.optional()}),Fn=je(["debug","info","notice","warning","error","critical","alert","emergency"]),Gn=l.extend({level:Fn}),fn=c.extend({method:se("logging/setLevel"),params:Gn}),pn=u.extend({level:Fn,logger:k().optional(),data:xe()}),vo=f.extend({method:se("notifications/message"),params:pn}),fr=K({name:k().optional()}),Bn=K({hints:ie(fr).optional(),costPriority:ye().min(0).max(1).optional(),speedPriority:ye().min(0).max(1).optional(),intelligencePriority:ye().min(0).max(1).optional()}),_o=K({mode:je(["auto","required","none"]).optional()}),Jo=K({type:se("tool_result"),toolUseId:k().describe("The unique identifier for the corresponding tool call."),content:ie(ze),structuredContent:K({}).loose().optional(),isError:Pe().optional(),_meta:Re(k(),xe()).optional()}),pr=Ms("type",[Kt,Xt,xt]),Bt=Ms("type",[Kt,Xt,xt,It,Jo]),br=K({role:be,content:ke([Bt,ie(Bt)]),_meta:Re(k(),xe()).optional()}),hn=a.extend({messages:ie(br),modelPreferences:Bn.optional(),systemPrompt:k().optional(),includeContext:je(["none","thisServer","allServers"]).optional(),temperature:ye().optional(),maxTokens:ye().int(),stopSequences:ie(k()).optional(),metadata:t.optional(),tools:ie(sr).optional(),toolChoice:_o.optional()}),wr=c.extend({method:se("sampling/createMessage"),params:hn}),Hn=h.extend({model:k(),stopReason:De(je(["endTurn","stopSequence","maxTokens"]).or(k())),role:be,content:pr}),mn=h.extend({model:k(),stopReason:De(je(["endTurn","stopSequence","maxTokens","toolUse"]).or(k())),role:be,content:ke([Bt,ie(Bt)])}),Vn=K({type:se("boolean"),title:k().optional(),description:k().optional(),default:Pe().optional()}),Xr=K({type:se("string"),title:k().optional(),description:k().optional(),minLength:ye().optional(),maxLength:ye().optional(),format:je(["email","uri","date","date-time"]).optional(),default:k().optional()}),zn=K({type:je(["number","integer"]),title:k().optional(),description:k().optional(),minimum:ye().optional(),maximum:ye().optional(),default:ye().optional()}),jn=K({type:se("string"),title:k().optional(),description:k().optional(),enum:ie(k()),default:k().optional()}),Wn=K({type:se("string"),title:k().optional(),description:k().optional(),oneOf:ie(K({const:k(),title:k()})),default:k().optional()}),Jn=K({type:se("string"),title:k().optional(),description:k().optional(),enum:ie(k()),enumNames:ie(k()).optional(),default:k().optional()}),Kn=ke([jn,Wn]),qr=K({type:se("array"),title:k().optional(),description:k().optional(),minItems:ye().optional(),maxItems:ye().optional(),items:K({type:se("string"),enum:ie(k())}),default:ie(k()).optional()}),Ur=K({type:se("array"),title:k().optional(),description:k().optional(),minItems:ye().optional(),maxItems:ye().optional(),items:K({anyOf:ie(K({const:k(),title:k()}))}),default:ie(k()).optional()}),Ko=ke([qr,Ur]),Xo=ke([Jn,Kn,Ko]),ar=ke([Xo,Vn,Xr,zn]),lr=a.extend({mode:se("form").optional(),message:k(),requestedSchema:K({type:se("object"),properties:Re(k(),ar),required:ie(k()).optional()}).catchall(xe())}),Xn=a.extend({mode:se("url"),message:k(),elicitationId:k(),url:k().url()}),Vt=ke([lr,Xn]),Yo=c.extend({method:se("elicitation/create"),params:Vt}),gn=u.extend({elicitationId:k()}),Yr=f.extend({method:se("notifications/elicitation/complete"),params:gn}),vn=h.extend({action:je(["accept","decline","cancel"]),content:Ds((zt)=>zt===null?void 0:zt,Re(k(),ke([k(),ye(),Pe(),ie(k())])).optional())}),Yt=K({type:se("ref/resource"),uri:k()}),yo=K({type:se("ref/prompt"),name:k()}),Yn=l.extend({ref:ke([yo,Yt]),argument:K({name:k(),value:k()}),context:K({arguments:Re(k(),k()).optional()}).optional()}),Zn=c.extend({method:se("completion/complete"),params:Yn}),_n=h.extend({completion:Ge({values:ie(k()).max(100),total:De(ye().int()),hasMore:De(Pe())})}),yn=K({uri:k().startsWith("file://"),name:k().optional(),_meta:Re(k(),xe()).optional()}),Sn=c.extend({method:se("roots/list"),params:l.optional()}),So=h.extend({roots:ie(yn)}),Zo=f.extend({method:se("notifications/roots/list_changed"),params:u.optional()}),Qn=Ge({ttl:ye().optional(),pollInterval:ye().optional()}),Fr=je(["working","input_required","completed","failed","cancelled"]),Zr=K({taskId:k(),status:Fr,ttl:ke([ye(),$s()]),createdAt:k(),lastUpdatedAt:k(),pollInterval:De(ye()),statusMessage:De(k())}),tr=h.extend({task:Zr}),Qo=u.merge(Zr),Qr=f.extend({method:se("notifications/tasks/status"),params:Qo}),En=c.extend({method:se("tasks/get"),params:l.extend({taskId:k()})}),eo=h.merge(Zr),bn=c.extend({method:se("tasks/result"),params:l.extend({taskId:k()})}),Eo=h.loose(),Pt=j.extend({method:se("tasks/list")}),Et=ne.extend({tasks:ie(Zr)}),en=c.extend({method:se("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:ae,ProgressNotificationSchema:ve,PaginatedRequestParamsSchema:me,PaginatedRequestSchema:j,PaginatedResultSchema:ne,ResourceContentsSchema:he,TextResourceContentsSchema:q,BlobResourceContentsSchema:W,RoleSchema:be,AnnotationsSchema:Ce,ResourceSchema:Ve,ResourceTemplateSchema:Ie,ListResourcesRequestSchema:We,ListResourcesResultSchema:U,ListResourceTemplatesRequestSchema:O,ListResourceTemplatesResultSchema:x,ResourceRequestParamsSchema:H,ReadResourceRequestParamsSchema:J,ReadResourceRequestSchema:Y,ReadResourceResultSchema:ee,ResourceListChangedNotificationSchema:Z,SubscribeRequestParamsSchema:te,SubscribeRequestSchema:oe,UnsubscribeRequestParamsSchema:L,UnsubscribeRequestSchema:z,ResourceUpdatedNotificationParamsSchema:ce,ResourceUpdatedNotificationSchema:ue,PromptArgumentSchema:ge,PromptSchema:Ne,ListPromptsRequestSchema:et,ListPromptsResultSchema:He,GetPromptRequestParamsSchema:Je,GetPromptRequestSchema:St,TextContentSchema:Kt,ImageContentSchema:Xt,AudioContentSchema:xt,ToolUseContentSchema:It,EmbeddedResourceSchema:at,ResourceLinkSchema:Ue,ContentBlockSchema:ze,PromptMessageSchema:Qe,GetPromptResultSchema:or,PromptListChangedNotificationSchema:Lt,ToolAnnotationsSchema:Mt,ToolExecutionSchema:ir,ToolSchema:sr,ListToolsRequestSchema:Rr,ListToolsResultSchema:Sr,CallToolResultSchema:Er,CallToolRequestParamsSchema:qt,CallToolRequestSchema:go,ToolListChangedNotificationSchema:Wo,LoggingLevelSchema:Fn,SetLevelRequestParamsSchema:Gn,SetLevelRequestSchema:fn,LoggingMessageNotificationParamsSchema:pn,LoggingMessageNotificationSchema:vo,ModelHintSchema:fr,ModelPreferencesSchema:Bn,ToolChoiceSchema:_o,ToolResultContentSchema:Jo,SamplingContentSchema:pr,SamplingMessageContentBlockSchema:Bt,SamplingMessageSchema:br,CreateMessageRequestParamsSchema:hn,CreateMessageRequestSchema:wr,CreateMessageResultSchema:Hn,CreateMessageResultWithToolsSchema:mn,BooleanSchemaSchema:Vn,StringSchemaSchema:Xr,NumberSchemaSchema:zn,UntitledSingleSelectEnumSchemaSchema:jn,TitledSingleSelectEnumSchemaSchema:Wn,LegacyTitledEnumSchemaSchema:Jn,SingleSelectEnumSchemaSchema:Kn,UntitledMultiSelectEnumSchemaSchema:qr,TitledMultiSelectEnumSchemaSchema:Ur,MultiSelectEnumSchemaSchema:Ko,EnumSchemaSchema:Xo,PrimitiveSchemaDefinitionSchema:ar,ElicitRequestFormParamsSchema:lr,ElicitRequestURLParamsSchema:Xn,ElicitRequestParamsSchema:Vt,ElicitRequestSchema:Yo,ElicitationCompleteNotificationParamsSchema:gn,ElicitationCompleteNotificationSchema:Yr,ElicitResultSchema:vn,ResourceTemplateReferenceSchema:Yt,PromptReferenceSchema:yo,CompleteRequestParamsSchema:Yn,CompleteRequestSchema:Zn,CompleteResultSchema:_n,RootSchema:yn,ListRootsRequestSchema:Sn,ListRootsResultSchema:So,RootsListChangedNotificationSchema:Zo,TaskCreationParamsSchema:Qn,TaskStatusSchema:Fr,TaskSchema:Zr,CreateTaskResultSchema:tr,TaskStatusNotificationParamsSchema:Qo,TaskStatusNotificationSchema:Qr,GetTaskRequestSchema:En,GetTaskResultSchema:eo,GetTaskPayloadRequestSchema:bn,GetTaskPayloadResultSchema:Eo,ListTasksRequestSchema:Pt,ListTasksResultSchema:Et,CancelTaskRequestSchema:en,CancelTaskResultSchema:h.merge(Zr),ClientRequestSchema:ke([Q,N,Zn,fn,St,et,We,O,Y,oe,z,go,Rr,En,bn,Pt,en]),ClientNotificationSchema:ke([y,ve,B,Zo,Qr]),ClientResultSchema:ke([p,Hn,mn,vn,So,eo,Et,tr]),ServerRequestSchema:ke([Q,wr,Yo,Sn,En,bn,Pt,en]),ServerNotificationSchema:ke([y,ve,vo,ue,Z,Wo,Lt,Qr,Yr]),ServerResultSchema:ke([p,G,_n,or,He,U,x,ee,Er,Sr,eo,Et,tr]),CallToolResultWireSchema:xe().superRefine((zt,ta)=>{if(typeof zt!=="object"||zt===null||Array.isArray(zt)||zt.content!==void 0)return;for(let bo of GS)if(bo in zt){ta.addIssue({code:"custom",message:`content is required when the body carries '${bo}' — another result family cannot default into an empty tools/call success`});return}}).transform(BS).pipe(Er)}}var y$;function HS(){return y$??=_$()}function VS(e){return e.type!=="object"}var S$=new Set(["const","enum","default","examples"]),E$=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function Yp(e){return e!==void 0&&!(typeof e==="string"&&e.startsWith("#"))}function b$(e){let t=typeof e.$schema==="string"?e.$schema:void 0;if(Yp(e.$id))return{...t!==void 0&&{$schema:t},type:"object",properties:{result:e},required:["result"]};let r=FR(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&&Yp(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(S$.has(a))s[a]=c;else if(E$.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 zS={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},jS={"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},w$={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},Aa;function Md(){if(Aa)return Aa;let e=HS();return Aa={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}},Aa}function WS(e){return Object.prototype.hasOwnProperty.call(zS,e)}function JS(e){return Object.prototype.hasOwnProperty.call(jS,e)}function T$(e){return Object.prototype.hasOwnProperty.call(w$,e)}function C$(e){return T$(e)?Md().resultSchemas[e]:void 0}function R$(e){return WS(e)?Md().requestSchemas[e]:void 0}function A$(e){return JS(e)?Md().notificationSchemas[e]:void 0}var ij=Object.keys(zS),sj=Object.keys(jS);function au(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Ia(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 Zp={ok:!1,reason:"not-in-era"};function Qp(e){return au(e)&&au(e.outputSchema)&&VS(e.outputSchema)}function eh(e){return e}var Dd={era:"2025-11-25",hasRequestMethod:WS,hasNotificationMethod:JS,validateRequest:(e,t)=>Ia(R$(e),t),validateResult:(e,t)=>Ia(C$(e),t),validateNotification:(e,t)=>Ia(A$(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Zp,validateInputResponse:()=>Zp,samplingResultVariant:(e,t)=>{let r=HS();return Ia(e?r.CreateMessageResultWithToolsSchema:r.CreateMessageResultSchema,t)},outboundEnvelope:(e)=>{return},validateEnvelopeMeta:(e)=>[],projectCallToolResult(e,t){let r=FS(e),n=r.structuredContent;if(n===void 0)return r;let o=typeof n!=="object"||n===null||Array.isArray(n),i=t!==void 0&&VS(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:eh(r)}}return{kind:"complete",result:eh(t)}},encodeResult(e,t){if(e!=="tools/list")return t;let r=t.tools;if(!Array.isArray(r)||!r.some((n)=>Qp(n)))return t;return{...t,tools:r.map((n)=>Qp(n)?{...n,outputSchema:b$(n.outputSchema)}:n)}},encodeErrorCode:(e)=>e===-32002?-32602:e,checkInboundEnvelope:(e)=>{return}};function I$(){let e=od(()=>ke([k(),ye(),Pe(),$s(),Re(k(),e),ie(e)])),t=Re(k(),e),r=ke([k(),ye().int()]),n=k(),o=ke([k(),ye().int()]),i=je(["user","assistant"]),s=je(["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=K({ttl:ye().optional()}),c=K({taskId:k()}),u=Ge({progressToken:r.optional(),"io.modelcontextprotocol/related-task":c.optional()}),f=K({_meta:u.optional()}),h=f.extend({task:a.optional()}),g=K({_meta:u.optional()}),p=K({method:k(),params:g.loose().optional()}),_=K({src:k(),mimeType:k().optional(),sizes:ie(k()).optional(),theme:je(["light","dark"]).optional()}),y=K({icons:ie(_).optional()}),S=K({name:k(),title:k().optional()}),E=S.extend({...S.shape,...y.shape,version:k(),websiteUrl:k().optional(),description:k().optional()}),b=Uo(K({applyDefaults:Pe().optional()}),t),R=Ds((Et)=>{if(Et&&typeof Et==="object"&&!Array.isArray(Et)&&Object.keys(Et).length===0)return{form:{}};return Et},Uo(K({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=K({experimental:Re(k(),t).optional(),sampling:K({context:t.optional(),tools:t.optional()}).optional(),elicitation:R.optional(),roots:K({listChanged:Pe().optional()}).optional(),tasks:w.optional(),extensions:Re(k(),t).optional()}),A=K({experimental:Re(k(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:K({listChanged:Pe().optional()}).optional(),resources:K({subscribe:Pe().optional(),listChanged:Pe().optional()}).optional(),tools:K({listChanged:Pe().optional()}).optional(),tasks:T.optional(),extensions:Re(k(),t).optional()}),P=K({progress:ye(),total:De(ye()),message:De(k())}),D=K({...g.shape,...P.shape,progressToken:r}),N=p.extend({method:se("notifications/progress"),params:D}),F=g.extend({level:s,logger:k().optional(),data:xe()}),G=p.extend({method:se("notifications/message"),params:F}),B=K({uri:k(),mimeType:De(k()),_meta:Re(k(),xe()).optional()}),Q=B.extend({text:k()}),pe=B.extend({blob:l}),ae=K({audience:ie(i).optional(),priority:ye().min(0).max(1).optional(),lastModified:Fi.datetime({offset:!0}).optional()}),ve=K({...S.shape,...y.shape,uri:k(),description:De(k()),mimeType:De(k()),size:De(ye()),annotations:ae.optional(),_meta:De(Ge({}))}),me=K({...S.shape,...y.shape,uriTemplate:k(),description:De(k()),mimeType:De(k()),annotations:ae.optional(),_meta:De(Ge({}))}),j=p.extend({method:se("notifications/resources/list_changed"),params:g.optional()}),ne=g.extend({uri:k()}),he=p.extend({method:se("notifications/resources/updated"),params:ne}),q=K({name:k(),description:De(k()),required:De(Pe())}),X=K({...S.shape,...y.shape,description:De(k()),arguments:De(ie(q)),_meta:De(Ge({}))}),W=p.extend({method:se("notifications/prompts/list_changed"),params:g.optional()}),be=K({type:se("text"),text:k(),annotations:ae.optional(),_meta:Re(k(),xe()).optional()}),Ce=K({type:se("image"),data:l,mimeType:k(),annotations:ae.optional(),_meta:Re(k(),xe()).optional()}),Ve=K({type:se("audio"),data:l,mimeType:k(),annotations:ae.optional(),_meta:Re(k(),xe()).optional()}),Ie=K({type:se("tool_use"),name:k(),id:k(),input:Re(k(),xe()),_meta:Re(k(),xe()).optional()}),We=K({type:se("resource"),resource:ke([Q,pe]),annotations:ae.optional(),_meta:Re(k(),xe()).optional()}),U=ve.extend({type:se("resource_link")}),O=ke([be,Ce,Ve,U,We]),x=K({role:i,content:O}),H=K({title:k().optional(),readOnlyHint:Pe().optional(),destructiveHint:Pe().optional(),idempotentHint:Pe().optional(),openWorldHint:Pe().optional()}),J=p.extend({method:se("notifications/tools/list_changed"),params:g.optional()}),Y=K({name:k().optional()}),ee=K({hints:ie(Y).optional(),costPriority:ye().min(0).max(1).optional(),speedPriority:ye().min(0).max(1).optional(),intelligencePriority:ye().min(0).max(1).optional()}),Z=K({mode:je(["auto","required","none"]).optional()}),te=K({type:se("boolean"),title:k().optional(),description:k().optional(),default:Pe().optional()}),oe=K({type:se("string"),title:k().optional(),description:k().optional(),minLength:ye().optional(),maxLength:ye().optional(),format:je(["email","uri","date","date-time"]).optional(),default:k().optional()}),L=K({type:je(["number","integer"]),title:k().optional(),description:k().optional(),minimum:ye().optional(),maximum:ye().optional(),default:ye().optional()}),z=K({type:se("string"),title:k().optional(),description:k().optional(),enum:ie(k()),default:k().optional()}),ce=K({type:se("string"),title:k().optional(),description:k().optional(),oneOf:ie(K({const:k(),title:k()})),default:k().optional()}),ue=K({type:se("string"),title:k().optional(),description:k().optional(),enum:ie(k()),enumNames:ie(k()).optional(),default:k().optional()}),ge=ke([z,ce]),Ne=K({type:se("array"),title:k().optional(),description:k().optional(),minItems:ye().optional(),maxItems:ye().optional(),items:K({type:se("string"),enum:ie(k())}),default:ie(k()).optional()}),et=K({type:se("array"),title:k().optional(),description:k().optional(),minItems:ye().optional(),maxItems:ye().optional(),items:K({anyOf:ie(K({const:k(),title:k()}))}),default:ie(k()).optional()}),He=ke([Ne,et]),Je=ke([ue,ge,He]),St=ke([Je,te,oe,L]),Kt=h.extend({mode:se("form").optional(),message:k(),requestedSchema:K({type:se("object"),properties:Re(k(),St),required:ie(k()).optional()}).catchall(xe())}),Xt=K({type:se("ref/resource"),uri:k()}),xt=K({type:se("ref/prompt"),name:k()}),It=K({uri:k().startsWith("file://"),name:k().optional(),_meta:Re(k(),xe()).optional()}),at=C.shape,Ue=K({experimental:at.experimental,sampling:at.sampling,elicitation:at.elicitation,roots:at.roots,extensions:at.extensions}),ze=A.shape,Qe=K({experimental:ze.experimental,logging:ze.logging,completions:ze.completions,prompts:ze.prompts,resources:ze.resources,tools:ze.tools,extensions:ze.extensions}),or=Ge({progressToken:r.optional(),[Gi]:k(),[id]:E.optional(),[Ks]:Ue,[Dl]:s.optional()}),Lt=K({...S.shape,...y.shape,description:k().optional(),inputSchema:Ge({$schema:k().optional(),type:se("object")}),outputSchema:Ge({$schema:k().optional()}).optional(),annotations:H.optional(),_meta:Re(k(),xe()).optional()}),Mt=K({type:se("tool_result"),toolUseId:k(),content:ie(O),structuredContent:xe().optional(),isError:Pe().optional(),_meta:Re(k(),xe()).optional()}),ir=ke([be,Ce,Ve,Ie,Mt]),sr=K({role:i,content:ke([ir,ie(ir)]),_meta:Re(k(),xe()).optional()}),Rr=k(),Sr=Ge({[wi]:E.optional().catch(void 0)}),Er=Sr.optional();function qt(Et){return Ge({_meta:Er,resultType:Rr.default("complete"),...Et})}let go=qt({}),Wo=qt({nextCursor:n.optional()}),Fn=qt({content:ie(O),structuredContent:xe().optional(),isError:Pe().optional()}),Gn=qt({ttlMs:ye().int().min(0),cacheScope:je(["public","private"]),tools:ie(Lt),nextCursor:n.optional()}),fn=qt({ttlMs:ye().int().min(0),cacheScope:je(["public","private"]),prompts:ie(X),nextCursor:n.optional()}),pn=qt({description:k().optional(),messages:ie(x)}),vo=qt({ttlMs:ye().int().min(0),cacheScope:je(["public","private"]),resources:ie(ve),nextCursor:n.optional()}),fr=qt({ttlMs:ye().int().min(0),cacheScope:je(["public","private"]),resourceTemplates:ie(me),nextCursor:n.optional()}),Bn=qt({ttlMs:ye().int().min(0),cacheScope:je(["public","private"]),contents:ie(ke([Q,pe]))}),_o=qt({completion:K({values:ie(k()).max(100),total:ye().int().optional(),hasMore:Pe().optional()}).loose()}),Jo=qt({ttlMs:ye().int().min(0),cacheScope:je(["public","private"])}),pr=qt({ttlMs:ye().int().min(0).catch(0),cacheScope:je(["public","private"]).catch("private"),supportedVersions:ie(k()),capabilities:Qe,instructions:k().optional()}),Bt=K({messages:ie(sr),modelPreferences:ee.optional(),systemPrompt:k().optional(),includeContext:je(["none","thisServer","allServers"]).optional(),temperature:ye().optional(),maxTokens:ye().int(),stopSequences:ie(k()).optional(),metadata:t.optional(),tools:ie(Lt).optional(),toolChoice:Z.optional()}),br=K({method:se("sampling/createMessage"),params:Bt}),hn=K({method:se("roots/list"),params:K({_meta:Re(k(),xe()).optional()}).optional()}),wr=K({...sr.shape,model:k(),stopReason:k().optional()}),Hn=K({roots:ie(It)}),mn=K({action:je(["accept","decline","cancel"]),content:Re(k(),ke([k(),ye(),Pe(),ie(k())])).optional()}),Vn=K({mode:se("url"),message:k(),url:k().url()}),Xr=ke([Kt,Vn]),zn=K({method:se("elicitation/create"),params:Xr}),jn=ke([br,hn,zn]),Wn=ke([wr,Hn,mn]),Jn=Re(k(),jn),Kn=Re(k(),Wn),qr=qt({inputRequests:Jn.optional(),requestState:k().optional()}),Ur={inputResponses:Kn.optional(),requestState:k().optional()},Ko=K({_meta:or,...Ur}),Xo=Ge({progressToken:r.optional()});function ar(Et,en){return K({method:se(Et),params:K({_meta:or,...en})})}function lr(Et,en){return K({method:se(Et),params:K({_meta:Xo.optional(),...en}).optional()})}let Xn={name:k(),arguments:Re(k(),xe()).optional(),...Ur},Vt={cursor:n.optional()},Yo=ar("tools/call",Xn),gn=ar("tools/list",Vt),Yr=ar("prompts/list",Vt),vn=ar("prompts/get",{name:k(),arguments:Re(k(),k()).optional(),...Ur}),Yt=ar("resources/list",Vt),yo=ar("resources/templates/list",Vt),Yn=ar("resources/read",{uri:k(),...Ur}),Zn={ref:ke([xt,Xt]),argument:K({name:k(),value:k()}),context:K({arguments:Re(k(),k()).optional()}).optional()},_n=ar("completion/complete",Zn),yn=ar("server/discover",{}),Sn=K({toolsListChanged:Pe().optional(),promptsListChanged:Pe().optional(),resourcesListChanged:Pe().optional(),resourceSubscriptions:ie(k()).optional()}),So={notifications:Sn},Zo=ar("subscriptions/listen",So),Qn=Sr.extend({"io.modelcontextprotocol/subscriptionId":o}),Fr=Ge({_meta:Qn,resultType:Rr.default("complete")}),Zr={"tools/call":lr("tools/call",Xn),"tools/list":lr("tools/list",Vt),"prompts/get":lr("prompts/get",{name:k(),arguments:Re(k(),k()).optional()}),"prompts/list":lr("prompts/list",Vt),"resources/list":lr("resources/list",Vt),"resources/templates/list":lr("resources/templates/list",Vt),"resources/read":lr("resources/read",{uri:k()}),"completion/complete":lr("completion/complete",Zn),"server/discover":lr("server/discover",{}),"subscriptions/listen":lr("subscriptions/listen",So)};function tr(Et){return Ge({_meta:Er,...Et})}let Qo={"tools/call":tr({content:ie(O),structuredContent:xe().optional(),isError:Pe().optional()}),"tools/list":tr({ttlMs:ye().int().min(0),cacheScope:je(["public","private"]),tools:ie(Lt),nextCursor:n.optional()}),"prompts/get":tr({description:k().optional(),messages:ie(x)}),"prompts/list":tr({ttlMs:ye().int().min(0),cacheScope:je(["public","private"]),prompts:ie(X),nextCursor:n.optional()}),"resources/list":tr({ttlMs:ye().int().min(0),cacheScope:je(["public","private"]),resources:ie(ve),nextCursor:n.optional()}),"resources/templates/list":tr({ttlMs:ye().int().min(0),cacheScope:je(["public","private"]),resourceTemplates:ie(me),nextCursor:n.optional()}),"resources/read":tr({ttlMs:ye().int().min(0),cacheScope:je(["public","private"]),contents:ie(ke([Q,pe]))}),"completion/complete":tr({completion:K({values:ie(k()).max(100),total:ye().int().optional(),hasMore:Pe().optional()}).loose()}),"server/discover":tr({ttlMs:ye().int().min(0).catch(0),cacheScope:je(["public","private"]).catch("private"),supportedVersions:ie(k()),capabilities:Qe,instructions:k().optional()}),"subscriptions/listen":tr({})},Qr=Ge({"io.modelcontextprotocol/subscriptionId":o.optional()}),En=K({method:se("notifications/subscriptions/acknowledged"),params:K({_meta:Qr.optional(),notifications:Sn})}),eo=K({_meta:Qr.optional(),requestId:o,reason:k().optional()}),bn=K({method:se("notifications/cancelled"),params:eo}),Eo={"notifications/cancelled":bn,"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":En},Pt=(Et)=>K({jsonrpc:se("2.0"),id:ke([k(),ye().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:ae,ResourceSchema:ve,ResourceTemplateSchema:me,ResourceListChangedNotificationSchema:j,ResourceUpdatedNotificationParamsSchema:ne,ResourceUpdatedNotificationSchema:he,PromptArgumentSchema:q,PromptSchema:X,PromptListChangedNotificationSchema:W,TextContentSchema:be,ImageContentSchema:Ce,AudioContentSchema:Ve,ToolUseContentSchema:Ie,EmbeddedResourceSchema:We,ResourceLinkSchema:U,ContentBlockSchema:O,PromptMessageSchema:x,ToolAnnotationsSchema:H,ToolListChangedNotificationSchema:J,ModelHintSchema:Y,ModelPreferencesSchema:ee,ToolChoiceSchema:Z,BooleanSchemaSchema:te,StringSchemaSchema:oe,NumberSchemaSchema:L,UntitledSingleSelectEnumSchemaSchema:z,TitledSingleSelectEnumSchemaSchema:ce,LegacyTitledEnumSchemaSchema:ue,SingleSelectEnumSchemaSchema:ge,UntitledMultiSelectEnumSchemaSchema:Ne,TitledMultiSelectEnumSchemaSchema:et,MultiSelectEnumSchemaSchema:He,EnumSchemaSchema:Je,PrimitiveSchemaDefinitionSchema:St,ElicitRequestFormParamsSchema:Kt,ResourceTemplateReferenceSchema:Xt,PromptReferenceSchema:xt,RootSchema:It,ClientCapabilities2026Schema:Ue,ServerCapabilities2026Schema:Qe,RequestMetaEnvelopeSchema:or,ToolSchema:Lt,ToolResultContentSchema:Mt,SamplingMessageContentBlockSchema:ir,SamplingMessageSchema:sr,ResultTypeSchema:Rr,ResultMetaSchema:Sr,ResultSchema:go,PaginatedResultSchema:Wo,CallToolResultSchema:Fn,ListToolsResultSchema:Gn,ListPromptsResultSchema:fn,GetPromptResultSchema:pn,ListResourcesResultSchema:vo,ListResourceTemplatesResultSchema:fr,ReadResourceResultSchema:Bn,CompleteResultSchema:_o,CacheableResultSchema:Jo,DiscoverResultSchema:pr,CreateMessageRequestParamsSchema:Bt,CreateMessageRequestSchema:br,ListRootsRequestSchema:hn,CreateMessageResultSchema:wr,ListRootsResultSchema:Hn,ElicitResultSchema:mn,ElicitRequestURLParamsSchema:Vn,ElicitRequestParamsSchema:Xr,ElicitRequestSchema:zn,InputRequestSchema:jn,InputResponseSchema:Wn,InputRequestsSchema:Jn,InputResponsesSchema:Kn,InputRequiredResultSchema:qr,InputResponseRequestParamsSchema:Ko,CallToolRequestSchema:Yo,ListToolsRequestSchema:gn,ListPromptsRequestSchema:Yr,GetPromptRequestSchema:vn,ListResourcesRequestSchema:Yt,ListResourceTemplatesRequestSchema:yo,ReadResourceRequestSchema:Yn,CompleteRequestSchema:_n,DiscoverRequestSchema:yn,SubscriptionFilterSchema:Sn,SubscriptionsListenRequestSchema:Zo,SubscriptionsListenResultMetaSchema:Qn,SubscriptionsListenResultSchema:Fr,dispatchRequestSchemas:Zr,dispatchResultSchemas:Qo,NotificationMetaSchema:Qr,SubscriptionsAcknowledgedNotificationSchema:En,CancelledNotificationParamsSchema:eo,CancelledNotificationSchema:bn,notificationSchemas2026:Eo,JSONRPCResultResponseSchema:Pt(go),CallToolResultResponseSchema:Pt(ke([Fn,qr])),ListToolsResultResponseSchema:Pt(Gn),ListPromptsResultResponseSchema:Pt(fn),GetPromptResultResponseSchema:Pt(ke([pn,qr])),ListResourcesResultResponseSchema:Pt(vo),ListResourceTemplatesResultResponseSchema:Pt(fr),ReadResourceResultResponseSchema:Pt(ke([Bn,qr])),CompleteResultResponseSchema:Pt(_o),DiscoverResultResponseSchema:Pt(pr),SubscriptionsListenResultResponseSchema:Pt(Fr)}}var P$;function fo(){return P$??=I$()}var k$=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function N$(e){return k$.includes(e)}var Ti=Symbol("modelcontextprotocol.resultCacheHintFallback");function lu(e,t){if(t===void 0)return e;let r=e[Ti];if(r===void 0)return{...e,[Ti]: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,[Ti]:n}}function O$(e){return e[Ti]}function xd(e){return typeof e==="number"&&Number.isSafeInteger(e)&&e>=0}function Ld(e){return e==="public"||e==="private"}function KS(e,t){if(e.ttlMs!==void 0&&!xd(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&&!Ld(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 $i(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 $i(this,t)}constructor(t,r,n){super(r);this.code=t,this.data=n,this.name="ProtocolError",$d(this,new.target)}static fromError(t,r,n){if(t===Te.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new $$(o.elicitations,r)}if(t===Te.UnsupportedProtocolVersion&&n){let o=n;if(Array.isArray(o.supported)&&typeof o.requested==="string")return new cl({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 XS(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 YS({requiredCapabilities:o.requiredCapabilities},r)}return new e(t,r,n)}},XS=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}},$$=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??[]}},cl=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}},YS=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}},M$=0,D$="private",x$=["tools/call","prompts/get","resources/read"];function L$(e,t){let r=t.resultType;if(r===void 0)return{...t,resultType:"complete"};if(r==="complete")return t;if(x$.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 q$(e,t){let r=O$(t);if(t.resultType!=="complete"||!N$(e))return r===void 0?t:H$(t);let n=t,o=xd(n.ttlMs)?n.ttlMs:G$(r),i=Ld(n.cacheScope)?n.cacheScope:B$(r),s={...n,ttlMs:o,cacheScope:i};return delete s[Ti],s}function U$(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function F$(e,t){if(t===void 0)return e;let r=e._meta;if(r===void 0)return{...e,_meta:{[wi]:t}};if(!U$(r))return e;if(r[wi]!==void 0)return e;return{...e,_meta:{...r,[wi]:t}}}function G$(e){return e!==void 0&&xd(e.ttlMs)?e.ttlMs:M$}function B$(e){return e!==void 0&&Ld(e.cacheScope)?e.cacheScope:D$}function H$(e){let t={...e};return delete t[Ti],t}var V$=["elicitation/create","sampling/createMessage","roots/list"],Pa;function ZS(){if(Pa)return Pa;let e=fo();return Pa={request:{"elicitation/create":K({method:se("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":K({method:se("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":K({method:se("roots/list"),params:Ge({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},Pa}function QS(e){return V$.includes(e)}function Dc(e){return QS(e)?ZS().request[e]:void 0}function z$(e){return QS(e)?ZS().response[e]:void 0}var qd={"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},eE={"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 tE(e){return Object.prototype.hasOwnProperty.call(qd,e)}function rE(e){return Object.prototype.hasOwnProperty.call(eE,e)}function j$(e){return Object.prototype.hasOwnProperty.call(qd,e)}function W$(e){return tE(e)?fo().dispatchRequestSchemas[e]:void 0}function J$(e){return j$(e)?fo().dispatchResultSchemas[e]:void 0}function K$(e){return rE(e)?fo().notificationSchemas2026[e]:void 0}var aj=Object.keys(qd),lj=Object.keys(eE);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 X$={ok:!1,reason:"not-in-era"},Y$=[Gi,Ks];function Z$(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 Ud={era:"2026-07-28",hasRequestMethod:tE,hasNotificationMethod:rE,hasInputRequestMethod:(e)=>Dc(e)!==void 0,validateRequest:(e,t)=>hs(W$(e),t),validateResult:(e,t)=>hs(J$(e),t),validateNotification:(e,t)=>hs(K$(e),t),validateInputRequest:(e,t)=>hs(Dc(e),t),validateInputResponse:(e,t)=>hs(z$(e),t),samplingResultVariant:()=>X$,outboundEnvelope(e){return{[Gi]:e.protocolVersion,[id]:e.clientInfo,[Ks]:e.clientCapabilities,...e.logLevel!==void 0&&{[Dl]:e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of Y$)if(!(n in e))t.push({key:n,problem:"missing"});let r=fo().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)=>FS(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:fo().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=Q$(),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 F$(q$(e,L$(e,Z$(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=fo().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("; ")}`}},ka;function Q$(){if(ka)return ka;let e=fo();return ka={"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},ka}var Wl="2026-07-28";function Go(e){return e!==void 0&&Ys(e)?Ud:Dd}function th(e){if(e.revision!==void 0)return Go(e.revision).era;return e.era==="modern"?Ud.era:Dd.era}function xc(e){return nE.some((t)=>t.hasRequestMethod(e))}function Lc(e){return nE.some((t)=>t.hasNotificationMethod(e))}function rh(e){return e==="tasks/get"||e==="tasks/cancel"}var nE=[Dd,Ud];function nh(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Zs(e){if(!nh(e))return;let t=e._meta;return nh(t)?t:void 0}function Fd(e){let t=Zs(e);return t!==void 0&&Gi in t}function Gd(e){let t=Zs(e)?.[Gi];return typeof t==="string"?t:void 0}function Bd(e){return Go(Wl).validateEnvelopeMeta(e)}var eM=DR({AnnotationsSchema:()=>Vo,AudioContentSchema:()=>Hl,BaseMetadataSchema:()=>Fo,BaseRequestParamsSchema:()=>nr,BlobResourceContentsSchema:()=>Ed,BooleanSchemaSchema:()=>Rd,CallToolRequestParamsSchema:()=>Y0,CallToolRequestSchema:()=>Z0,CallToolResultSchema:()=>Cd,CancelTaskRequestSchema:()=>QO,CancelTaskResultSchema:()=>e$,CancelledNotificationParamsSchema:()=>e0,CancelledNotificationSchema:()=>hd,ClientCapabilitiesSchema:()=>o0,ClientNotificationSchema:()=>r$,ClientRequestSchema:()=>t$,ClientResultSchema:()=>n$,ClientTasksCapabilitySchema:()=>r0,CompatibilityCallToolResultSchema:()=>BO,CompleteRequestParamsSchema:()=>CS,CompleteRequestSchema:()=>RS,CompleteResultSchema:()=>AS,ContentBlockSchema:()=>Vl,CreateMessageRequestParamsSchema:()=>uS,CreateMessageRequestSchema:()=>dS,CreateMessageResultSchema:()=>fS,CreateMessageResultWithToolsSchema:()=>pS,CreateTaskResultSchema:()=>zO,CursorSchema:()=>ld,DiscoverRequestSchema:()=>c0,DiscoverResultSchema:()=>u0,ElicitRequestFormParamsSchema:()=>jl,ElicitRequestParamsSchema:()=>_S,ElicitRequestSchema:()=>yS,ElicitRequestURLParamsSchema:()=>vS,ElicitResultSchema:()=>bS,ElicitationCompleteNotificationParamsSchema:()=>SS,ElicitationCompleteNotificationSchema:()=>ES,EmbeddedResourceSchema:()=>B0,EmptyResultSchema:()=>pd,EnumSchemaSchema:()=>gS,GetPromptRequestParamsSchema:()=>U0,GetPromptRequestSchema:()=>F0,GetPromptResultSchema:()=>z0,GetTaskPayloadRequestSchema:()=>KO,GetTaskPayloadResultSchema:()=>XO,GetTaskRequestSchema:()=>WO,GetTaskResultSchema:()=>JO,IconSchema:()=>t0,IconsSchema:()=>Hi,ImageContentSchema:()=>Bl,ImplementationSchema:()=>Ul,InitializeRequestParamsSchema:()=>i0,InitializeRequestSchema:()=>s0,InitializeResultSchema:()=>a0,InitializedNotificationSchema:()=>l0,JSONArraySchema:()=>qO,JSONObjectSchema:()=>Ut,JSONRPCErrorResponseSchema:()=>ql,JSONRPCMessageSchema:()=>Qy,JSONRPCNotificationSchema:()=>fd,JSONRPCRequestSchema:()=>dd,JSONRPCResponseSchema:()=>UO,JSONRPCResultResponseSchema:()=>Ll,JSONValueSchema:()=>Oi,LegacyTitledEnumSchemaSchema:()=>Pd,ListChangedOptionsBaseSchema:()=>HO,ListPromptsRequestSchema:()=>L0,ListPromptsResultSchema:()=>q0,ListResourceTemplatesRequestSchema:()=>v0,ListResourceTemplatesResultSchema:()=>_0,ListResourcesRequestSchema:()=>m0,ListResourcesResultSchema:()=>g0,ListRootsRequestSchema:()=>PS,ListRootsResultSchema:()=>kS,ListTasksRequestSchema:()=>YO,ListTasksResultSchema:()=>ZO,ListToolsRequestSchema:()=>K0,ListToolsResultSchema:()=>X0,LoggingLevelSchema:()=>xs,LoggingMessageNotificationParamsSchema:()=>rS,LoggingMessageNotificationSchema:()=>nS,ModelHintSchema:()=>oS,ModelPreferencesSchema:()=>iS,MultiSelectEnumSchemaSchema:()=>mS,NotificationSchema:()=>yr,NotificationsParamsSchema:()=>_r,NumberSchemaSchema:()=>ll,PaginatedRequestParamsSchema:()=>p0,PaginatedRequestSchema:()=>Vi,PaginatedResultSchema:()=>zi,PingRequestSchema:()=>gd,PrimitiveSchemaDefinitionSchema:()=>Od,ProgressNotificationParamsSchema:()=>f0,ProgressNotificationSchema:()=>vd,ProgressSchema:()=>d0,ProgressTokenSchema:()=>ad,PromptArgumentSchema:()=>D0,PromptListChangedNotificationSchema:()=>j0,PromptMessageSchema:()=>V0,PromptReferenceSchema:()=>TS,PromptSchema:()=>x0,ReadResourceRequestParamsSchema:()=>y0,ReadResourceRequestSchema:()=>S0,ReadResourceResultSchema:()=>E0,RelatedTaskMetadataSchema:()=>Zy,RequestIdSchema:()=>Bi,RequestMetaSchema:()=>cd,RequestSchema:()=>Ft,ResourceContentsSchema:()=>_d,ResourceLinkSchema:()=>H0,ResourceListChangedNotificationSchema:()=>b0,ResourceRequestParamsSchema:()=>Fl,ResourceSchema:()=>bd,ResourceTemplateReferenceSchema:()=>wS,ResourceTemplateSchema:()=>h0,ResourceUpdatedNotificationParamsSchema:()=>$0,ResourceUpdatedNotificationSchema:()=>M0,ResultMetaObjectSchema:()=>ud,ResultSchema:()=>Gt,RoleSchema:()=>ji,RootSchema:()=>IS,RootsListChangedNotificationSchema:()=>NS,SamplingContentSchema:()=>lS,SamplingMessageContentBlockSchema:()=>Ls,SamplingMessageSchema:()=>cS,ServerCapabilitiesSchema:()=>md,ServerNotificationSchema:()=>i$,ServerRequestSchema:()=>o$,ServerResultSchema:()=>s$,ServerTasksCapabilitySchema:()=>n0,SetLevelRequestParamsSchema:()=>eS,SetLevelRequestSchema:()=>tS,SingleSelectEnumSchemaSchema:()=>hS,StringSchemaSchema:()=>zl,SubscribeRequestParamsSchema:()=>w0,SubscribeRequestSchema:()=>T0,SubscriptionFilterSchema:()=>wd,SubscriptionsAcknowledgedNotificationParamsSchema:()=>P0,SubscriptionsAcknowledgedNotificationSchema:()=>k0,SubscriptionsListenRequestParamsSchema:()=>A0,SubscriptionsListenRequestSchema:()=>I0,SubscriptionsListenResultMetaSchema:()=>N0,SubscriptionsListenResultSchema:()=>O0,TaskAugmentedRequestParamsSchema:()=>Xs,TaskCreationParamsSchema:()=>VO,TaskMetadataSchema:()=>Yy,TaskSchema:()=>Wi,TaskStatusNotificationParamsSchema:()=>$S,TaskStatusNotificationSchema:()=>jO,TaskStatusSchema:()=>OS,TextContentSchema:()=>Gl,TextResourceContentsSchema:()=>yd,TitledMultiSelectEnumSchemaSchema:()=>Nd,TitledSingleSelectEnumSchemaSchema:()=>Id,ToolAnnotationsSchema:()=>W0,ToolChoiceSchema:()=>sS,ToolExecutionSchema:()=>J0,ToolListChangedNotificationSchema:()=>Q0,ToolResultContentSchema:()=>aS,ToolSchema:()=>Td,ToolUseContentSchema:()=>G0,UnsubscribeRequestParamsSchema:()=>C0,UnsubscribeRequestSchema:()=>R0,UntitledMultiSelectEnumSchemaSchema:()=>kd,UntitledSingleSelectEnumSchemaSchema:()=>Ad}),on=(e)=>dd.safeParse(e).success,Si=(e)=>fd.safeParse(e).success,cu=(e)=>Ll.safeParse(e).success,oE=(e)=>ql.safeParse(e).success,Po=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)&&e.resultType==="input_required";function tM(e){if(e.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function rM(e){if(e.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var oh="x-mcp-header",nM=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,oM=new Set(["string","integer","boolean","number"]);function iM(e){let t=[],r=new Map,n=(i,s,l)=>{if(i===null||typeof i!=="object")return;let a=i;if(oh in a){if(!l||s.length===0)return`${Na(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[oh];if(typeof u!=="string"||u.length===0)return`${Na(s)}: x-mcp-header MUST be a non-empty string`;if(!nM.test(u))return`${Na(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||!oM.has(f))return`${Na(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 sM){let f=a[u];if(f===void 0)continue;let h=Array.isArray(f)?f:f!==null&&typeof f==="object"&&aM.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 sM=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],aM=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function Na(e){return e.length===0?"<root>":e.join(".")}var za=-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:[za,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:[za],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:[za],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,[za]:400};function Oa(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 iE(e){if(!Fd(e))return!1;let t=Gd(e);if(t===void 0||!Ys(t))return!1;let r=Zs(e);return r!==void 0&&Bd(r).length===0}function lM(e,t){switch(e.reason){case"http-method":return Oa("http-method","modern-only-method-not-allowed",405,new Le(-32000,"Method not allowed."),!0);case"batch":return Oa("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 Oa("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 Oa("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 cl({supported:[...t],requested:r}),!0)}}}function Hd(e,t){return xy(e,t)}function ms(e){return new Set(e.flatMap((t)=>Object.keys(t.shape)))}function Mi(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 ih=!1,uu="draft-2020-12";function Di(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(!ih)ih=!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=Zu(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 sE(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 sE(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"||sE(n)))}return!1}function cM(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 Ci(e,t){let r=await e["~standard"].validate(t);if(r.issues&&r.issues.length>0)return{success:!1,error:r.issues.map((n)=>cM(n)).join(", ")};return{success:!0,data:r.value}}function uM(e){let t=Zu(e,{target:uu,io:"input"});return typeof t.pattern==="string"?t.pattern:void 0}var dM=/\\\.\\d\{(\d+)\}/;function fM(e){let t=dM.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 pM(e,t){let r;switch(e){case"email":r=[$N()];break;case"uri":r=[Gy()];break;case"date":r=[Fi.date()];break;case"date-time":r=fM(t);break}return new Set(r.map((n)=>uM(n)).filter((n)=>n!==void 0))}function hM(e,t,r){if(r!=="zod")return!0;return pM(e,t).has(t)}function mM(e){let t=Di(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 qs(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function gM(e){try{return Di(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 vM=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function Vd(e){return vM.has(e)||e.startsWith("x-")}var _M=new Set(["$schema",...Object.keys(jl.shape.requestedSchema.shape)]),sh={string:ms([zl,Ad,Id,Pd]),number:ms([ll]),integer:ms([ll]),boolean:ms([Rd]),array:ms([kd,Nd])},yM=new Set(zl.shape.format.unwrap().options);function SM(e,t,r,n){if(!qs(e))return e;let o=typeof e.type==="string"&&Object.hasOwn(sh,e.type)?sh[e.type]:void 0;if(o===void 0)return e;let i={};for(let[s,l]of Object.entries(e))if(o.has(s)||Vd(s))i[s]=l;else if(s==="pattern"&&e.type==="string"&&typeof e.format==="string"){if(!yM.has(e.format))i[s]=l;else if(typeof l!=="string"||!hM(e.format,l,r))n.push(`${t}.${s}`)}else n.push(`${t}.${s}`);return i}function EM(e,t){let r={},n=[];for(let[o,i]of Object.entries(e))if(o==="properties"&&qs(i))r[o]=Object.fromEntries(Object.entries(i).map(([s,l])=>[s,SM(l,`properties.${s}`,t,n)]));else if(_M.has(o))r[o]=i;else if(!Vd(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 bM(e,t){if(!qs(e.properties))return t;let r=Object.entries(e.properties).filter(([,n])=>!Hd(Od,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(!qs(e)||!qs(t))return[];return Object.entries(e).flatMap(([n,o])=>{let i=r?`${r}.${n}`:n;if(!Object.prototype.hasOwnProperty.call(t,n))return Vd(n)?[]:[i];return du(o,t[n],i)})}function wM(e){if(!Mi(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let t=e.requestedSchema["~standard"].vendor,r=EM(gM(e.requestedSchema),t),n=Hd(jl.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): ${bM(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 TM(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(TM,{elicit(e){try{return{method:"elicitation/create",params:wM(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"}}}),CM=250;function RM(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function AM(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 IM(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 PM=["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"],kM={IdJagTokenExchangeResponseSchema:u$,OAuthClientInformationFullSchema:f$,OAuthClientInformationSchema:LS,OAuthClientMetadataSchema:xS,OAuthClientRegistrationErrorSchema:p$,OAuthErrorResponseSchema:d$,OAuthMetadataSchema:MS,OAuthProtectedResourceMetadataSchema:a$,OAuthTokenRevocationRequestSchema:h$,OAuthTokensSchema:c$,OpenIdProviderDiscoveryMetadataSchema:l$,OpenIdProviderMetadataSchema:DS},aE={},lE={};function cE(e,t){let r=e.slice(0,-6);aE[r]=t,lE[r]=(n)=>t.safeParse(n).success}for(let e of PM)cE(e,eM[e]);for(let[e,t]of Object.entries(kM))cE(e,t);var fj=Object.freeze(aE),pj=Object.freeze(lE);function NM(e){switch(e){case"initialize":case"notifications/initialized":return Go(void 0);case"server/discover":return Go(Wl);default:return}}var OM=60000,$M=[Gi,id,Ks,Dl],MM=["inputResponses","requestState"];function ah(e,t){let r=e.params;if(!Ps(r))return{message:e,lifted:{}};let n=r._meta,o=Ps(n)?$M.filter((a)=>(a in n)):[],i=t==="request"?MM.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 lh(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 Jl(e){return()=>e}var DM=Jl(void 0);function uE(e,t){return{...e,mcpReq:{...e.mcpReq,requestState:Jl(t)}}}var dE;function xM(e,t){dE(e,t)}var LM=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{dE=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??xO,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)||oE(o))this._onresponse(o);else if(on(o))this._onrequest(o,i);else if(Si(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}=ah(e,"notification"),n=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop")return;if(t?.classification!==void 0){let s=th(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(Lc(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}=ah(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 _=th(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(xc(r.method)&&!o.hasRequestMethod(r.method)&&!(rh(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:UM(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?DM:Jl(n.requestState),signal:f.signal,send:(_,y,S)=>{let E=this._resolveOutboundCodec(_.method);if(this._assertOutboundRequestInEra(E,_.method),Mi(y))return u(_,y,S);let b=lh(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(Mi(t)){if(!rh(e.method))this._assertOutboundRequestInEra(n,e.method);return this._requestWithSchemaViaCodec(n,e,t,r)}this._assertOutboundRequestInEra(n,e.method);let o=lh(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 Go(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=NM(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(xc(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===Wl&&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(FM(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;Ci(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??OM,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(Lc(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(!xc(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 Ci(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(!Lc(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 Ci(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 qM(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 ch(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function UM(e){let t={},r=[];if(!ch(e))return{accepted:t,droppedKeys:r};for(let[n,o]of Object.entries(e)){if(!ch(o)||"method"in o||"result"in o){r.push(n);continue}t[n]=o}return{accepted:t,droppedKeys:r}}function FM(e){return{resultType:"input_required",inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}var GM=Ee((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=s_(GM(),1),BM=10485760,HM=class{_buffer;_maxBufferSize;constructor(e){this._maxBufferSize=e?.maxBufferSize??BM}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(`
118
+ `);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 Qy.parse(JSON.parse(e))}function zM(e){return JSON.stringify(e)+`
119
+ `}var jM=/^[A-Za-z0-9._-]{1,128}$/;function WM(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(!jM.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 JM(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 uh(e){let t=WM(e);return JM(e,t.warnings),t.isValid}function KM(e){return typeof e==="object"&&e!==null&&"_zod"in e}function XM(e){return typeof e==="object"&&e!==null&&!("_zod"in e)&&"_def"in e&&typeof e._def?.typeName==="string"}function YM(e){if(typeof e!=="object"||e===null)return!1;if(Mi(e))return!1;let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return!1;return Object.values(e).every((r)=>KM(r))}function qc(e){if(e===void 0)return;if(YM(e))return K(e);if(typeof e==="object"&&e!==null&&!Mi(e)&&Object.values(e).some((t)=>XM(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(!Mi(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 ul=Ee((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}),dh=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;let t=ul();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=Ee((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=ul(),r=dh();var n=ul();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=dh();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,X){return this}},s=class extends i{constructor(q,X,W){super();this.varKind=q,this.name=X,this.rhs=W}render({es5:q,_n:X}){let W=q?r.varKinds.var:this.varKind,be=this.rhs===void 0?"":` = ${this.rhs}`;return`${W} ${this.name}${be};`+X}optimizeNames(q,X){if(!q[this.name.str])return;if(this.rhs)this.rhs=B(this.rhs,q,X);return this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},l=class extends i{constructor(q,X,W){super();this.lhs=q,this.rhs=X,this.sideEffects=W}render({_n:q}){return`${this.lhs} = ${this.rhs};`+q}optimizeNames(q,X){if(this.lhs instanceof t.Name&&!q[this.lhs.str]&&!this.sideEffects)return;return this.rhs=B(this.rhs,q,X),this}get names(){return G(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},a=class extends l{constructor(q,X,W,be){super(q,W,be);this.op=X}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,X){return this.code=B(this.code,q,X),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((X,W)=>X+W.render(q),"")}optimizeNodes(){let{nodes:q}=this,X=q.length;while(X--){let W=q[X].optimizeNodes();if(Array.isArray(W))q.splice(X,1,...W);else if(W)q[X]=W;else q.splice(X,1)}return q.length>0?this:void 0}optimizeNames(q,X){let{nodes:W}=this,be=W.length;while(be--){let Ce=W[be];if(Ce.optimizeNames(q,X))continue;Q(q,Ce.names),W.splice(be,1)}return W.length>0?this:void 0}get names(){return this.nodes.reduce((q,X)=>F(q,X.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(X,W){super(W);this.condition=X}render(X){let W=`if(${this.condition})`+super.render(X);if(this.else)W+="else "+this.else.render(X);return W}optimizeNodes(){super.optimizeNodes();let X=this.condition;if(X===!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(X===!1)return W instanceof q?W:W.nodes;if(this.nodes.length)return this;return new q(pe(X),W instanceof q?[W]:W.nodes)}if(X===!1||!this.nodes.length)return;return this}optimizeNames(X,W){var be;if(this.else=(be=this.else)===null||be===void 0?void 0:be.optimizeNames(X,W),!(super.optimizeNames(X,W)||this.else))return;return this.condition=B(this.condition,X,W),this}get names(){let X=super.names;if(G(X,this.condition),this.else)F(X,this.else.names);return X}};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,X){if(!super.optimizeNames(q,X))return;return this.iteration=B(this.iteration,q,X),this}get names(){return F(super.names,this.iteration.names)}},R=class extends E{constructor(q,X,W,be){super();this.varKind=q,this.name=X,this.from=W,this.to=be}render(q){let X=q.es5?r.varKinds.var:this.varKind,{name:W,from:be,to:Ce}=this;return`for(${X} ${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,X,W,be){super();this.loop=q,this.varKind=X,this.name=W,this.iterable=be}render(q){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(q)}optimizeNames(q,X){if(!super.optimizeNames(q,X))return;return this.iterable=B(this.iterable,q,X),this}get names(){return F(super.names,this.iterable.names)}},T=class extends p{constructor(q,X,W){super();this.name=q,this.args=X,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 X="try"+super.render(q);if(this.catch)X+=this.catch.render(q);if(this.finally)X+=this.finally.render(q);return X}optimizeNodes(){var q,X;return super.optimizeNodes(),(q=this.catch)===null||q===void 0||q.optimizeNodes(),(X=this.finally)===null||X===void 0||X.optimizeNodes(),this}optimizeNames(q,X){var W,be;return super.optimizeNames(q,X),(W=this.catch)===null||W===void 0||W.optimizeNames(q,X),(be=this.finally)===null||be===void 0||be.optimizeNames(q,X),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,X={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...X,_n:X.lines?`
120
+ `:""},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,X){let W=this._extScope.value(q,X);return(this._values[W.prefix]||(this._values[W.prefix]=new Set)).add(W),W}getScopeValue(q,X){return this._extScope.getValue(q,X)}scopeRefs(q){return this._extScope.scopeRefs(q,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(q,X,W,be){let Ce=this._scope.toName(X);if(W!==void 0&&be)this._constants[Ce.str]=W;return this._leafNode(new s(q,Ce,W)),Ce}const(q,X,W){return this._def(r.varKinds.const,q,X,W)}let(q,X,W){return this._def(r.varKinds.let,q,X,W)}var(q,X,W){return this._def(r.varKinds.var,q,X,W)}assign(q,X,W){return this._leafNode(new l(q,X,W))}add(q,X){return this._leafNode(new a(q,e.operators.ADD,X))}code(q){if(typeof q=="function")q();else if(q!==t.nil)this._leafNode(new h(q));return this}object(...q){let X=["{"];for(let[W,be]of q){if(X.length>1)X.push(",");if(X.push(W),W!==be||this.opts.es5)X.push(":"),(0,t.addCodeArg)(X,be)}return X.push("}"),new t._Code(X)}if(q,X,W){if(this._blockNode(new S(q)),X&&W)this.code(X).else().code(W).endIf();else if(X)this.code(X).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,X){if(this._blockNode(q),X)this.code(X).endFor();return this}for(q,X){return this._for(new b(q),X)}forRange(q,X,W,be,Ce=this.opts.es5?r.varKinds.var:r.varKinds.let){let Ve=this._scope.toName(q);return this._for(new R(Ce,Ve,X,W),()=>be(Ve))}forOf(q,X,W,be=r.varKinds.const){let Ce=this._scope.toName(q);if(this.opts.es5){let Ve=X instanceof t.Name?X:this.var("_arr",X);return this.forRange("_i",0,t._`${Ve}.length`,(Ie)=>{this.var(Ce,t._`${Ve}[${Ie}]`),W(Ce)})}return this._for(new w("of",be,Ce,X),()=>W(Ce))}forIn(q,X,W,be=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(q,t._`Object.keys(${X})`,W);let Ce=this._scope.toName(q);return this._for(new w("in",be,Ce,X),()=>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 X=new C;if(this._blockNode(X),this.code(q),X.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(C)}try(q,X,W){if(!X&&!W)throw Error('CodeGen: "try" without "catch" and "finally"');let be=new A;if(this._blockNode(be),this.code(q),X){let Ce=this.name("e");this._currNode=be.catch=new P(Ce),X(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,X){if(this._blockStarts.push(this._nodes.length),q)this.code(q).endBlock(X);return this}endBlock(q){let X=this._blockStarts.pop();if(X===void 0)throw Error("CodeGen: not in self-balancing block");let W=this._nodes.length-X;if(W<0||q!==void 0&&W!==q)throw Error(`CodeGen: wrong number of nodes: ${W} vs ${q} expected`);return this._nodes.length=X,this}func(q,X=t.nil,W,be){if(this._blockNode(new T(q,X,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,X){let W=this._currNode;if(W instanceof q||X&&W instanceof X)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${X?`${q.kind}/${X.kind}`:q.kind}"`)}_elseNode(q){let X=this._currNode;if(!(X instanceof S))throw Error('CodeGen: "else" without "if"');return this._currNode=X.else=q,this}get _root(){return this._nodes[0]}get _currNode(){let q=this._nodes;return q[q.length-1]}set _currNode(q){let X=this._nodes;X[X.length-1]=q}};e.CodeGen=N;function F(q,X){for(let W in X)q[W]=(q[W]||0)+(X[W]||0);return q}function G(q,X){return X instanceof t._CodeOrName?F(q,X.names):q}function B(q,X,W){if(q instanceof t.Name)return be(q);if(!Ce(q))return q;return new t._Code(q._items.reduce((Ve,Ie)=>{if(Ie instanceof t.Name)Ie=be(Ie);if(Ie instanceof t._Code)Ve.push(...Ie._items);else Ve.push(Ie);return Ve},[]));function be(Ve){let Ie=W[Ve.str];if(Ie===void 0||X[Ve.str]!==1)return Ve;return delete X[Ve.str],Ie}function Ce(Ve){return Ve instanceof t._Code&&Ve._items.some((Ie)=>Ie instanceof t.Name&&X[Ie.str]===1&&W[Ie.str]!==void 0)}}function Q(q,X){for(let W in X)q[W]=(q[W]||0)-(X[W]||0)}function pe(q){return typeof q=="boolean"||typeof q=="number"||q===null?!q:t._`!${he(q)}`}e.not=pe;let ae=ne(e.operators.AND);function ve(...q){return q.reduce(ae)}e.and=ve;let me=ne(e.operators.OR);function j(...q){return q.reduce(me)}e.or=j;function ne(q){return(X,W)=>X===t.nil?W:W===t.nil?X:t._`${he(X)} ${q} ${he(W)}`}function he(q){return q instanceof t.Name?q:t._`(${q})`}}),ut=Ee((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=ul();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}),Wr=Ee((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}),Kl=Ee((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=Wr();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])}}),ZM=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;let t=Kl(),r=Xe(),n=Wr(),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)}}),fE=Ee((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}),pE=Ee((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}),dl=Ee((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=fE(),r=pE(),n=Kl(),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
121
+ || (${P} == "string" && ${C} && ${C} == +${C})`).assign(D,o._`+${C}`);return;case"integer":T.elseIf(o._`${P} === "boolean" || ${C} === null
122
+ || (${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"
123
+ || ${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}}}),QM=Ee((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)}`)}}),Jr=Ee((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=Wr(),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}),eD=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;let t=Xe(),r=Wr(),n=Jr(),o=Kl();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}),tD=Ee((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}),hE=Ee((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}}),rD=Ee((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")}}),Xl=Ee((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=hE(),n=rD(),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=ae.call(this,N[E]);ve.call(this,N.$anchor),ve.call(this,N.$dynamicAnchor),w[F]=pe;function ae(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}"`);ae.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=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;let t=ZM(),r=dl(),n=pE(),o=dl(),i=QM(),s=eD(),l=tD(),a=Xe(),c=Wr(),u=Xl(),f=ut(),h=Kl();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 ae(O,[],!1,x);let H=(0,r.getSchemaTypes)(O.schema);ae(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 ae(O,x,H,J){let{gen:Y,schema:ee,data:Z,allErrors:te,opts:oe,self:L}=O,{RULES:z}=L;if(ee.$ref&&(oe.ignoreKeywordsWithRef||!(0,f.schemaHasRulesButRef)(ee,z))){Y.block(()=>Ve(O,"$ref",z.all.$ref.definition));return}if(!oe.jtd)me(O,x);Y.block(()=>{for(let ue of z.rules)ce(ue);ce(z.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))Ve(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(!X(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 X(O,x){return O.includes(x)||x==="integer"&&O.includes("number")}function W(O,x){let H=[];for(let J of O.dataTypes)if(X(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 Ve(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)*$/,We=/^([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=We.exec(O);if(!L)throw Error(`Invalid JSON-pointer: ${O}`);let z=+L[1];if(Y=L[2],Y==="#"){if(z>=x)throw Error(oe("property/index",z));return J[x-z]}if(z>x)throw Error(oe("data",z));if(ee=H[x-z],!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,z){return`Cannot access ${L} ${z} levels up, current level is ${x}`}}e.getData=U}),Qs=Ee((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=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xl();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}),Yl=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;let t=Xe(),r=Qs(),n=Wr(),o=Xl(),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}}),nD=Ee((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}}),mE=Ee((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}}),oD=Ee((e,t)=>{let{isUUID:r}=mE(),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}}),iD=Ee((e,t)=>{let{normalizeIPv6:r,removeDotSegments:n,recomposeAuthority:o,normalizeComponentEncoding:i,isIPv4:s,nonSimpleDomain:l}=mE(),{SCHEMES:a,getSchemeHandler:c}=oD();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}),sD=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=iD();t.code='require("ajv/dist/runtime/uri").default',e.default=t}),zd=Ee((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=Qs(),o=Ki(),i=fE(),s=Yl(),l=Xe(),a=Xl(),c=dl(),u=ut(),f=nD(),h=sD(),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,X,W,be,Ce,Ve,Ie,We,U,O,x,H,J,Y,ee,Z,te,oe,L,z,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,Je=(q=(he=j.code)===null||he===void 0?void 0:he.regExp)!==null&&q!==void 0?q:g,St=(X=j.uriResolver)!==null&&X!==void 0?X:h.default;return{strictSchema:(be=(W=j.strictSchema)!==null&&W!==void 0?W:Ne)!==null&&be!==void 0?be:!0,strictNumbers:(Ve=(Ce=j.strictNumbers)!==null&&Ce!==void 0?Ce:Ne)!==null&&Ve!==void 0?Ve:!0,strictTypes:(We=(Ie=j.strictTypes)!==null&&Ie!==void 0?Ie:Ne)!==null&&We!==void 0?We:"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:Je}:{optimize:He,regExp:Je},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:(z=j.validateSchema)!==null&&z!==void 0?z:!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,We){await X.call(this,Ie.$schema);let U=this._addSchema(Ie,We);return U.validate||W.call(this,U)}async function X(Ie){if(Ie&&!this.getSchema(Ie))await q.call(this,{$ref:Ie},!0)}async function W(Ie){try{return this._compileSchemaEnv(Ie)}catch(We){if(!(We instanceof o.default))throw We;return be.call(this,We),await Ce.call(this,We.missingSchema),W.call(this,Ie)}}function be({missingSchema:Ie,missingRef:We}){if(this.refs[Ie])throw Error(`AnySchema ${Ie} is loaded but ${We} cannot be resolved`)}async function Ce(Ie){let We=await Ve.call(this,Ie);if(!this.refs[Ie])await X.call(this,We.$schema);if(!this.refs[Ie])this.addSchema(We,Ie,ne)}async function Ve(Ie){let We=this._loading[Ie];if(We)return We;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 X;if(typeof j==="object"){let{schemaId:W}=this.opts;if(X=j[W],X!==void 0&&typeof X!="string")throw Error(`schema ${W} must be string`)}return ne=(0,a.normalizeId)(ne||X),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 X="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(X);else throw Error(X)}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,(X)=>Q.call(this,X)),this;ae.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?(X)=>Q.call(this,X,q):(X)=>q.type.forEach((W)=>Q.call(this,X,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((X)=>X.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,X)=>q+ne+X)}$dataMetaSchema(j,ne){let he=this.RULES.all;j=JSON.parse(JSON.stringify(j));for(let q of ne){let X=q.split("/").slice(1),W=j;for(let be of X)W=W[be];for(let be in he){let Ce=he[be];if(typeof Ce!="object")continue;let{$data:Ve}=Ce.definition,Ie=W[be];if(Ve&&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,X=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 Ve=a.getSchemaRefs.call(this,j,he);if(Ce=new s.SchemaEnv({schema:j,schemaId:be,meta:ne,baseId:he,localRefs:Ve}),this._cache.set(Ce.schema,Ce),X&&!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 X in j){let W=X;if(W in ne)this.logger[q](`${he}: option ${X}. ${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 X=ne===null||ne===void 0?void 0:ne.post;if(he&&X)throw Error('keyword with "post" flag cannot have "type"');let{RULES:W}=this,be=X?W.post:W.rules.find(({type:Ve})=>Ve===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((Ve)=>this.addKeyword(Ve))}function pe(j,ne,he){let q=j.rules.findIndex((X)=>X.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 ae(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]}}}),aD=Ee((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}),jd=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;let t=Ki(),r=Jr(),n=Xe(),o=Wr(),i=Yl(),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}),gE=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aD(),r=jd(),n=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,r.default];e.default=n}),lD=Ee((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}),cD=Ee((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}),uD=Ee((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'}),dD=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r=ut(),n=uD(),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}),fD=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Jr(),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}),pD=Ee((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}),hD=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Jr(),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}),mD=Ee((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}),Wd=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=hE();t.code='require("ajv/dist/runtime/equal").default',e.default=t}),gD=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=dl(),r=Xe(),n=ut(),o=Wd(),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}),vD=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r=ut(),n=Wd(),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}),_D=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r=ut(),n=Wd(),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}),vE=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=lD(),r=cD(),n=dD(),o=fD(),i=pD(),s=hD(),l=mD(),a=gD(),c=vD(),u=_D(),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}),_E=Ee((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}),yE=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;let t=Xe(),r=ut(),n=Jr(),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}),yD=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=yE(),r={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(n)=>(0,t.validateTuple)(n,"items")};e.default=r}),SD=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r=ut(),n=Jr(),o=_E(),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}),ED=Ee((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=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;let t=Xe(),r=ut(),n=Jr();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},
124
+ missingProperty: ${f},
125
+ depsCount: ${c},
126
+ 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}),bD=Ee((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}),SE=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Jr(),r=Xe(),n=Wr(),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}),wD=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Ji(),r=Jr(),n=ut(),o=SE(),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}),TD=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Jr(),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}),CD=Ee((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}),RD=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Jr().validateUnion,error:{message:"must match a schema in anyOf"}};e.default=t}),AD=Ee((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}),ID=Ee((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}),PD=Ee((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}),kD=Ee((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}),EE=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=_E(),r=yD(),n=yE(),o=SD(),i=ED(),s=Jd(),l=bD(),a=SE(),c=wD(),u=TD(),f=CD(),h=RD(),g=AD(),p=ID(),_=PD(),y=kD();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}),ND=Ee((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}),bE=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=[ND().default];e.default=t}),wE=Ee((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"]}),TE=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=gE(),r=vE(),n=EE(),o=bE(),i=wE(),s=[t.default,r.default,(0,n.default)(),o.default,i.metadataVocabulary,i.contentVocabulary];e.default=s}),OD=Ee((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={}))}),Kd=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r=OD(),n=Yl(),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}),$D=Ee((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}}),CE=Ee((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=zd(),n=TE(),o=Kd(),i=$D(),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=Qs();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}})}),RE=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicAnchor=void 0;let t=Xe(),r=Wr(),n=Yl(),o=jd(),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}),AE=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicRef=void 0;let t=Xe(),r=Wr(),n=jd(),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}),MD=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=RE(),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}),DD=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=AE(),r={keyword:"$recursiveRef",schemaType:"string",code:(n)=>(0,t.dynamicRef)(n,n.schema)};e.default=r}),IE=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=RE(),r=AE(),n=MD(),o=DD(),i=[t.default,r.default,n.default,o.default];e.default=i}),xD=Ee((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}),LD=Ee((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}),qD=Ee((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}),PE=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=xD(),r=LD(),n=qD(),o=[t.default,r.default,n.default];e.default=o}),UD=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xe(),r=ut(),n=Wr(),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}),FD=Ee((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}),kE=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=UD(),r=FD(),n=[t.default,r.default];e.default=n}),GD=Ee((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"}]}}}}}),BD=Ee((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:"#"}}}}}),HD=Ee((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=Ee((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:{}}}}}),zD=Ee((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"}}}}),jD=Ee((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}}}}),WD=Ee((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:[]}}}}),JD=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=GD(),r=BD(),n=HD(),o=VD(),i=zD(),s=jD(),l=WD(),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}),KD=Ee((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=zd(),n=TE(),o=IE(),i=PE(),s=kE(),l=Kd(),a=JD(),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=Qs();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}})}),XD=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=gE(),r=vE(),n=EE(),o=IE(),i=PE(),s=kE(),l=bE(),a=wE(),c=[o.default,t.default,r.default,(0,n.default)(!0),l.default,a.metadataVocabulary,a.contentVocabulary,i.default,s.default];e.default=c}),YD=Ee((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}}}}),ZD=Ee((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"}}}}}),QD=Ee((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"}}}}),e1=Ee((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"}}}}),t1=Ee((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"}}}}),r1=Ee((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"}}}}),n1=Ee((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}}}}),o1=Ee((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:[]}}}}),i1=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=YD(),r=ZD(),n=QD(),o=e1(),i=t1(),s=r1(),l=n1(),a=o1(),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}),s1=Ee((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=zd(),n=XD(),o=Kd(),i=i1(),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=Qs();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}})}),a1=Ee((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],ae=+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&&ae<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)&&ae<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),ae=s(G,Q);if(ae===void 0)return;return ae||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}}}),l1=Ee((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;let t=CE(),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}),c1=Ee((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});let r=a1(),n=l1(),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}),NE=CE(),u1=KD(),d1=s1(),f1=s_(c1(),1),p1=f1.default;function Uc(e){let t=new e({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return p1(t),t}var h1=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(e){this._userAjv=e!==void 0,this._ajv=e}get ajv(){return this._ajv??=Uc(d1.Ajv2020)}_engineFor(e){if(this._userAjv)return this.ajv;let t=GR(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??=Uc(u1.Ajv2019);return this._ajvDraft7??=Uc(NE.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=NE.Ajv,OE=Symbol.for("mcp.completable");function ph(e){return!!e&&typeof e==="object"&&OE in e}function m1(e){return e[OE]?.complete}function g1(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 v1(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 $E=1024;function hh(e,t){return{method:e.method,params:{...e.params,_meta:{...e.params?._meta,[sd]:t}}}}function _1(e){let t=Go(Wl).validateRequest("subscriptions/listen",e);return t.ok?t.value.params?.notifications:void 0}var y1=new Set(["notifications/tools/list_changed","notifications/prompts/list_changed","notifications/resources/list_changed","notifications/resources/updated"]),S1=class{_subs=new Map;_serverCapabilities;_serverInfo;constructor(e=$E,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=_1(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=v1(t,this._serverCapabilities);return this._subs.set(e.id,r),hh({method:"notifications/subscriptions/acknowledged",params:{notifications:r}},e.id)}cancel(e){return this._subs.delete(e)}routeOutbound(e){if(!y1.has(e.method))return"passthrough";let t=e.params?.uri,r=typeof t==="string"?t:void 0,n=E1(e.method,r),o=[];for(let[i,s]of this._subs)if(g1(s,n))o.push(hh({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:{[sd]:t,...this._serverInfo!==void 0&&{[wi]:this._serverInfo}}}});return this._subs.clear(),e}};function E1(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 b1(e){return typeof e==="object"&&e!==null&&"setScopeChallengeResolver"in e&&typeof e.setScopeChallengeResolver==="function"}var w1=8,T1=600000;function C1(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??w1,roundTimeoutMs:e?.roundTimeoutMs??T1,legacyShim:e?.legacyShim??!0}}function ME(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=g$(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 R1(){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 Fc(e,t){if(e==="tools/call")return{content:[{type:"text",text:t}],isError:!0};throw new Le(Te.InternalError,t)}var A1=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 Fc(e,RM(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}=ME(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(qS(T,y)!==void 0)return Fc(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=IM(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 Fc(e,`Fulfilling input required by '${e}' failed: ${b instanceof Error?b.message:String(b)}`)}finally{E.dispose()}}else await AM(CM,l);let p={...n,mcpReq:{...n.mcpReq,inputResponses:g,droppedInputResponseKeys:void 0,requestState:Jl(h)}};if(h!==void 0){let y=await this._host.verifyRequestState(h,p,e);if(y!==void 0)p=uE(p,y)}let _=await t(r,p);if(!Po(_))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:R1()};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)}}},I1=new Set(["tools/call","prompts/get","resources/read"]),P1,DE,xE;function k1(e,t){DE(e,t)}function N1(e){return xE(e)}var O1=class extends LM{_clientCapabilities;_clientVersion;static{P1=(e,t)=>{if(t.clientCapabilities!==void 0)e._clientCapabilities=t.clientCapabilities;if(t.clientInfo!==void 0)e._clientVersion=t.clientInfo},DE=(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())},xE=(e)=>e._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_legacyInputRequiredShim(){return this._legacyShim??=new A1({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 h1,this._requestStateVerify=t?.requestState?.verify,this._inputRequiredServing=C1(t?.inputRequired),t?.cacheHints!==void 0){for(let[r,n]of Object.entries(t.cacheHints))if(n!==void 0)KS(n,`cacheHints['${r}']`);this._cacheHints=t.cacheHints}if(this.setRequestHandler("initialize",(r)=>this._oninitialize(r)),this.setNotificationHandler("notifications/initialized",()=>this.oninitialized?.()),Xp(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=Hd(xs,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(xs.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=qM(this._capabilities,e),!t&&this._capabilities.logging)this._registerLoggingHandler()}_wrapHandler(e,t){if(e!=="tools/call"){let r=this._cacheHints?.[e],n=I1.has(e);if(r===void 0&&!n)return async(o,i)=>{let s=await t(o,i);if(Po(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(Po(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=Go(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(Po(s))return s;let l=BS(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&&Ys(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=uE(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(!Po(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:_}=ME(e,h,g),y=qS(_,f);if(y!==void 0)throw new YS({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?.[Ks]: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=v$(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:Xp(this._supportedProtocolVersions),capabilities:$1(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 $1(e){return{...e}}function M1(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 D1(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 LE=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 gh;try{let r=Di(t.inputSchema,"input");return this._toolInputSchemaJson[e]=r,r}catch{return}}constructor(e,t){if(this.server=new O1(e,t),this._maxToolInputElements=D1(t?.maxToolInputElements),t?.capabilities?.tools)this.setToolRequestHandlers();if(t?.capabilities?.resources)this.setResourceRequestHandlers();if(t?.capabilities?.prompts)this.setPromptRequestHandlers()}async connect(e){if(b1(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?x1(e,t.inputSchema):gh,annotations:t.annotations,icons:t.icons,execution:t.execution,_meta:t._meta};if(t.outputSchema)r.outputSchema=Di(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),Po(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&&M1(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 Ci(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(Po(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 Ci(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 tM(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return rM(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=Eh(Sh(r.argsSchema)?.[e.params.argument.name]);if(!ph(n))return gs;let o=m1(n);if(!o)return gs;return yh(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 yh(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 XS(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?mM(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)KS(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:_h(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=_h(e,a,c);if(f.enabled!==void 0)u.enabled=f.enabled;this.sendPromptListChanged()}};if(this._registeredPrompts[e]=u,n){let f=Sh(n);if(f){if(Object.values(f).some((h)=>ph(Eh(h))))this.setCompletionRequestHandler()}}return u}_createRegisteredTool(e,t,r,n,o,i,s,l,a,c,u){uh(e);let f=u,h,g={title:t,description:r,inputSchema:n,outputSchema:o,get outputSchemaJson(){return h??=vh(g.outputSchema)},set outputSchemaJson(p){h=p},annotations:i,icons:s,execution:l,scopeChallenge:a,_meta:c,handler:u,executor:mh(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")uh(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=mh(g.inputSchema,f);if(p.outputSchema!==void 0)g.outputSchema=p.outputSchema,g.outputSchemaJson=vh(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,qc(i),qc(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,qc(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 mh(e,t){if(e){let n=t;return async(o,i)=>n(o,i)}let r=t;return async(n,o)=>r(o)}var gh={type:"object",properties:{}};function x1(e,t){let r=Di(t,"input"),n=iM(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 vh(e){if(e===void 0)return;try{return Di(e,"output")}catch{return}}function _h(e,t,r){if(t){let n=r;return async(o,i)=>{let s=await Ci(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 yh(e){return{completion:{values:e.map(String).slice(0,100),total:e.length,hasMore:e.length>100}}}var gs={completion:{values:[],hasMore:!1}};function Sh(e){let t=e;if(t.shape&&typeof t.shape==="object")return t.shape}function L1(e){return e?.type==="optional"}function Eh(e){if(!L1(e))return e;return e.def?.innerType??e}var bh=Symbol("swallowsErrorsAfterClose"),q1=class{_readBuffer;_started=!1;_closed=!1;constructor(e=fh.stdin,t=fh.stdout,r){this._stdin=e,this._stdout=t,this._readBuffer=new HM({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[bh])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[bh]=!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=zM(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)})}},wh=3000,U1=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)||oE(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(on(e))this._pendingRequests.add(e.id);else if(Si(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 F1(e){let t=e.params;if(e.method==="initialize"&&!iE(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(!Fd(t))return{kind:"legacy",reason:"no-claim"};let r=Zs(t),n=(r===void 0?[]:Bd(r))[0];if(n!==void 0)return{kind:"invalid-envelope",issue:n};let o=Gd(t);if(o===void 0||!vi.includes(o))return{kind:"unsupported-revision",requested:o??"unknown"};return{kind:"modern",revision:o,classification:{era:"modern",revision:o}}}function G1(e,t={}){let r=t.legacy??"serve",n=t.transport??new q1,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(Vr(F))),u=new S1(t.maxSubscriptions??$E),f=(A)=>{if(!Si(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(Vr(N)));return"handled"},h=async(A)=>{if(on(A)&&A.method==="subscriptions/listen"){let P=Zs(A.params),D=Fd(A.params)?(P===void 0?[]:Bd(P))[0]:{key:"_meta",problem:"the per-request envelope is required on protocol revision 2026-07-28"},N=Gd(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||!vi.includes(N)){let G=new cl({supported:[...vi],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(Vr(G))),!0}if(Si(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=lM({kind:"legacy",reason:P,...D!==void 0&&{requestedVersion:D}},vi);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 LE?D.server:D;if(A==="modern")xM(N,P),k1(N,vi),u.setServerCapabilities(N.getCapabilities(),N1(N));let F=new U1(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(Vr(P))),S=async(A)=>{i=A.channel;try{if(!await A.channel.whenRequestsAnswered(wh))a(Error(`Discarded the probe instance with requests still unanswered after ${wh}ms; continuing with the fallback`));await A.product.close()}catch(P){a(Vr(P))}finally{i=void 0}},E=async(A)=>{if(o.phase==="closed")return;if(o.phase==="pinned"){if(o.era==="modern"&&on(A)&&A.method==="initialize"&&!iE(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(!on(A)&&!Si(A)){a(Error("Discarded a JSON-RPC response received before the connection negotiated an era"));return}let P=F1(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(on(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(on(A)){let D=new cl({supported:[...vi],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(on(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(Si(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(on(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(on(A))await c(A.id,Te.InternalError,"Internal server error");a(Vr(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(Vr(D)));if(A.phase==="probe"||A.phase==="pinned")await A.instance.product.close().catch((P)=>a(Vr(P)));await n.close().catch((P)=>a(Vr(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(Vr(P)))};let C=n.start().catch((A)=>{throw a(Vr(A)),A});return C.catch(()=>{}),{close:async()=>{await C.catch(()=>{}),await T()}}}function Vr(e){return e instanceof Error?e:Error(String(e))}var B1=Cr(cC(),1),H1=Cr(CR(),1),Ej=Cr(IR(),1),bj=Cr(Lu(),1),wj=Cr(js(),1),Tj=Cr(n_(),1),Cj=Cr(o_(),1),Rj=Cr(i_(),1),J1=Cr(qu(),1),Aj=Cr(PR(),1),K1=void 0,X1=void 0;function Y1(){return{geminiUrl:K1,vertexUrl:X1}}function Z1(e,t,r,n){var o,i;if(!(e===null||e===void 0?void 0:e.baseUrl)){let s=Y1();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 qn=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 Q1(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 Xd(e){if(typeof e!=="string")throw Error("fromImageBytes must be a string");return e}function ex(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 tx(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"],nx(s));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"]);if(s!=null)m(t,["response"],ox(s));return t}function nx(e){let t={},r=d(e,["generatedSamples"]);if(r!=null){let i=r;if(Array.isArray(i))i=i.map((s)=>ix(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 ox(e){let t={},r=d(e,["videos"]);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,["video"]);if(r!=null)m(t,["video"],fx(r));return t}function sx(e){let t={},r=d(e,["_self"]);if(r!=null)m(t,["video"],px(r));return t}function ax(e){let t={},r=d(e,["operationName"]);if(r!=null)m(t,["_url","operationName"],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,["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"],ux(s));return t}function ux(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 Yd(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 fx(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"],Xd(n));let o=d(e,["encoding"]);if(o!=null)m(t,["mimeType"],o);return t}function px(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"],Xd(n));let o=d(e,["mimeType"]);if(o!=null)m(t,["mimeType"],o);return t}var Th;(function(e){e.MEDIA_PROCESSING_UNSPECIFIED="MEDIA_PROCESSING_UNSPECIFIED",e.STATIC="STATIC",e.AGENTIC="AGENTIC"})(Th||(Th={}));var Ch;(function(e){e.OUTCOME_UNSPECIFIED="OUTCOME_UNSPECIFIED",e.OUTCOME_OK="OUTCOME_OK",e.OUTCOME_FAILED="OUTCOME_FAILED",e.OUTCOME_DEADLINE_EXCEEDED="OUTCOME_DEADLINE_EXCEEDED"})(Ch||(Ch={}));var Rh;(function(e){e.LANGUAGE_UNSPECIFIED="LANGUAGE_UNSPECIFIED",e.PYTHON="PYTHON"})(Rh||(Rh={}));var Ah;(function(e){e.SCHEDULING_UNSPECIFIED="SCHEDULING_UNSPECIFIED",e.SILENT="SILENT",e.WHEN_IDLE="WHEN_IDLE",e.INTERRUPT="INTERRUPT"})(Ah||(Ah={}));var lo;(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"})(lo||(lo={}));var Ih;(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"})(Ih||(Ih={}));var Ph;(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"})(Ph||(Ph={}));var kh;(function(e){e.API_SPEC_UNSPECIFIED="API_SPEC_UNSPECIFIED",e.SIMPLE_SEARCH="SIMPLE_SEARCH",e.ELASTIC_SEARCH="ELASTIC_SEARCH"})(kh||(kh={}));var Nh;(function(e){e.ENVIRONMENT_UNSPECIFIED="ENVIRONMENT_UNSPECIFIED",e.ENVIRONMENT_BROWSER="ENVIRONMENT_BROWSER",e.ENVIRONMENT_MOBILE="ENVIRONMENT_MOBILE",e.ENVIRONMENT_DESKTOP="ENVIRONMENT_DESKTOP"})(Nh||(Nh={}));var Oh;(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"})(Oh||(Oh={}));var $h;(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"})($h||($h={}));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 xh;(function(e){e.THINKING_LEVEL_UNSPECIFIED="THINKING_LEVEL_UNSPECIFIED",e.MINIMAL="MINIMAL",e.LOW="LOW",e.MEDIUM="MEDIUM",e.HIGH="HIGH"})(xh||(xh={}));var Lh;(function(e){e.DONT_ALLOW="DONT_ALLOW",e.ALLOW_ADULT="ALLOW_ADULT",e.ALLOW_ALL="ALLOW_ALL"})(Lh||(Lh={}));var qh;(function(e){e.PROMINENT_PEOPLE_UNSPECIFIED="PROMINENT_PEOPLE_UNSPECIFIED",e.ALLOW_PROMINENT_PEOPLE="ALLOW_PROMINENT_PEOPLE",e.BLOCK_PROMINENT_PEOPLE="BLOCK_PROMINENT_PEOPLE"})(qh||(qh={}));var Uh;(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"})(Uh||(Uh={}));var Fh;(function(e){e.HARM_BLOCK_METHOD_UNSPECIFIED="HARM_BLOCK_METHOD_UNSPECIFIED",e.SEVERITY="SEVERITY",e.PROBABILITY="PROBABILITY"})(Fh||(Fh={}));var Gh;(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"})(Gh||(Gh={}));var Bh;(function(e){e.MODE_UNSPECIFIED="MODE_UNSPECIFIED",e.AUTO="AUTO",e.ANY="ANY",e.NONE="NONE",e.VALIDATED="VALIDATED"})(Bh||(Bh={}));var Hh;(function(e){e.MODE_UNSPECIFIED="MODE_UNSPECIFIED",e.VERBATIM="VERBATIM",e.SMART="SMART"})(Hh||(Hh={}));var Vh;(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"})(Vh||(Vh={}));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 jh;(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"})(jh||(jh={}));var Wh;(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"})(Wh||(Wh={}));var Jh;(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"})(Jh||(Jh={}));var Kh;(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"})(Kh||(Kh={}));var Xh;(function(e){e.MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",e.TEXT="TEXT",e.IMAGE="IMAGE",e.VIDEO="VIDEO",e.AUDIO="AUDIO",e.DOCUMENT="DOCUMENT"})(Xh||(Xh={}));var Yh;(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"})(Yh||(Yh={}));var Zh;(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"})(Zh||(Zh={}));var xi;(function(e){e.MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",e.TEXT="TEXT",e.IMAGE="IMAGE",e.AUDIO="AUDIO",e.VIDEO="VIDEO"})(xi||(xi={}));var Qh;(function(e){e.DELIVERY_UNSPECIFIED="DELIVERY_UNSPECIFIED",e.INLINE="INLINE",e.URI="URI"})(Qh||(Qh={}));var em;(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"})(em||(em={}));var tm;(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"})(tm||(tm={}));var rm;(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"})(rm||(rm={}));var nm;(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"})(nm||(nm={}));var om;(function(e){e.RESPONSE_PARSE_TYPE_UNSPECIFIED="RESPONSE_PARSE_TYPE_UNSPECIFIED",e.IDENTITY="IDENTITY",e.REGEX_EXTRACT="REGEX_EXTRACT"})(om||(om={}));var im;(function(e){e.MATCH_OPERATION_UNSPECIFIED="MATCH_OPERATION_UNSPECIFIED",e.REGEX_CONTAINS="REGEX_CONTAINS",e.PARTIAL_MATCH="PARTIAL_MATCH",e.EXACT_MATCH="EXACT_MATCH"})(im||(im={}));var sm;(function(e){e.REINFORCEMENT_TUNING_THINKING_LEVEL_UNSPECIFIED="REINFORCEMENT_TUNING_THINKING_LEVEL_UNSPECIFIED",e.MINIMAL="MINIMAL",e.HIGH="HIGH"})(sm||(sm={}));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 am;(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"})(am||(am={}));var lm;(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"})(lm||(lm={}));var cm;(function(e){e.PAIRWISE_CHOICE_UNSPECIFIED="PAIRWISE_CHOICE_UNSPECIFIED",e.BASELINE="BASELINE",e.CANDIDATE="CANDIDATE",e.TIE="TIE"})(cm||(cm={}));var um;(function(e){e.VIDEO_ORIENTATION_UNSPECIFIED="VIDEO_ORIENTATION_UNSPECIFIED",e.LANDSCAPE="LANDSCAPE",e.PORTRAIT="PORTRAIT"})(um||(um={}));var dm;(function(e){e.TUNING_SPEED_UNSPECIFIED="TUNING_SPEED_UNSPECIFIED",e.REGULAR="REGULAR",e.FAST="FAST"})(dm||(dm={}));var fm;(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"})(fm||(fm={}));var pm;(function(e){e.STATE_UNSPECIFIED="STATE_UNSPECIFIED",e.STATE_PENDING="STATE_PENDING",e.STATE_ACTIVE="STATE_ACTIVE",e.STATE_FAILED="STATE_FAILED"})(pm||(pm={}));var hm;(function(e){e.UNSPECIFIED="unspecified",e.FLEX="flex",e.STANDARD="standard",e.PRIORITY="priority"})(hm||(hm={}));var mm;(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"})(mm||(mm={}));var gm;(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"})(gm||(gm={}));var hu;(function(e){e.COLLECTION="COLLECTION"})(hu||(hu={}));var vm;(function(e){e.FEATURE_SELECTION_PREFERENCE_UNSPECIFIED="FEATURE_SELECTION_PREFERENCE_UNSPECIFIED",e.PRIORITIZE_QUALITY="PRIORITIZE_QUALITY",e.BALANCED="BALANCED",e.PRIORITIZE_COST="PRIORITIZE_COST"})(vm||(vm={}));var fl;(function(e){e.PREDICT="PREDICT",e.EMBED_CONTENT="EMBED_CONTENT"})(fl||(fl={}));var _m;(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"})(_m||(_m={}));var ym;(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"})(ym||(ym={}));var Sm;(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"})(Sm||(Sm={}));var Em;(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"})(Em||(Em={}));var bm;(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"})(bm||(bm={}));var wm;(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"})(wm||(wm={}));var Tm;(function(e){e.FOREGROUND="FOREGROUND",e.BACKGROUND="BACKGROUND",e.PROMPT="PROMPT",e.SEMANTIC="SEMANTIC",e.INTERACTIVE="INTERACTIVE"})(Tm||(Tm={}));var Cm;(function(e){e.ASSET="ASSET",e.STYLE="STYLE"})(Cm||(Cm={}));var Rm;(function(e){e.INSERT="INSERT",e.REMOVE="REMOVE",e.REMOVE_STATIC="REMOVE_STATIC",e.OUTPAINT="OUTPAINT"})(Rm||(Rm={}));var Am;(function(e){e.OPTIMIZED="OPTIMIZED",e.LOSSLESS="LOSSLESS"})(Am||(Am={}));var Im;(function(e){e.CROP="CROP",e.PAD="PAD"})(Im||(Im={}));var Pm;(function(e){e.SUPERVISED_FINE_TUNING="SUPERVISED_FINE_TUNING",e.PREFERENCE_TUNING="PREFERENCE_TUNING",e.DISTILLATION="DISTILLATION",e.REINFORCEMENT_TUNING="REINFORCEMENT_TUNING"})(Pm||(Pm={}));var pl;(function(e){e.STATE_UNSPECIFIED="STATE_UNSPECIFIED",e.PROCESSING="PROCESSING",e.ACTIVE="ACTIVE",e.FAILED="FAILED"})(pl||(pl={}));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 $m;(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"})($m||($m={}));var Mm;(function(e){e.TYPE_UNSPECIFIED="TYPE_UNSPECIFIED",e.ACTIVITY_START="ACTIVITY_START",e.ACTIVITY_END="ACTIVITY_END"})(Mm||(Mm={}));var Dm;(function(e){e.START_SENSITIVITY_UNSPECIFIED="START_SENSITIVITY_UNSPECIFIED",e.START_SENSITIVITY_HIGH="START_SENSITIVITY_HIGH",e.START_SENSITIVITY_LOW="START_SENSITIVITY_LOW"})(Dm||(Dm={}));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 Ei;(function(e){e.PLAYBACK_CONTROL_UNSPECIFIED="PLAYBACK_CONTROL_UNSPECIFIED",e.PLAY="PLAY",e.PAUSE="PAUSE",e.STOP="STOP",e.RESET_CONTEXT="RESET_CONTEXT"})(Ei||(Ei={}));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{},hx=class{},mx=class{},gx=class{},vx=class{},_x=class{},Bm=class{},Hm=class{},Vm=class{},yx=class{},zm=class e{_fromAPIResponse({apiResponse:t,_isVertexAI:r}){let n=new e,o,i=t;if(r)o=rx(i);else o=tx(i);return Object.assign(n,o),n}},Sx=class{},jm=class{},Ex=class{},Wm=class{},Jm=class{},bx=class{},wx=class{},Tx=class{},Cx=class e{_fromAPIResponse({apiResponse:t,_isVertexAI:r}){let n=new e,i=cx(t);return Object.assign(n,i),n}},Rx=class{},Ax=class{},Ix=class{},Px=class{},Km=class{},kx=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}},Nx=class{get audioChunk(){if(this.serverContent&&this.serverContent.audioChunks&&this.serverContent.audioChunks.length>0)return this.serverContent.audioChunks[0];return}},UE=class e{_fromAPIResponse({apiResponse:t,_isVertexAI:r}){let n=new e,i=Yd(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 FE(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 GE(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 BE(e){let t=hl(e);if(t.mimeType&&t.mimeType.startsWith("image/"))return t;throw Error(`Unsupported mime type: ${t.mimeType}`)}function HE(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 VE(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:VE(e)}}function Zd(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:VE(r)});return t}function Ox(e,t){if(e.includes("null"))t.nullable=!0;let r=e.filter((n)=>n!=="null");if(r.length===1)t.type=Object.values(lo).includes(r[0].toUpperCase())?r[0].toUpperCase():lo.TYPE_UNSPECIFIED;else{t.anyOf=[];for(let n of r)t.anyOf.push({type:Object.values(lo).includes(n.toUpperCase())?n.toUpperCase():lo.TYPE_UNSPECIFIED})}}function Ri(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)Ox(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(lo).includes(l.toUpperCase())?l.toUpperCase():lo.TYPE_UNSPECIFIED}else if(r.includes(s))t[s]=Ri(l);else if(n.includes(s)){let a=[];for(let c of l){if(c.type=="null"){t.nullable=!0;continue}a.push(Ri(c))}t[s]=a}else if(o.includes(s)){let a={};for(let[c,u]of Object.entries(l))a[c]=Ri(u);t[s]=a}else{if(s==="additionalProperties")continue;t[s]=l}}return t}function Qd(e){return Ri(e)}function Xi(e){return e}function ef(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 tf(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=Ri(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=Ri(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 $x(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 Un(e,t){if(typeof t!=="string")throw Error("name must be a string");return $x(e,t,"cachedContents")}function zE(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 zo(e){return Xd(e)}function Mx(e){return e!==null&&e!==void 0&&typeof e==="object"&&"name"in e}function jE(e){return e!==null&&e!==void 0&&typeof e==="object"&&"video"in e}function WE(e){return e!==null&&e!==void 0&&typeof e==="object"&&"uri"in e}function rf(e){var t;let r;if(Mx(e))r=e.name;if(WE(e)){if(r=e.uri,r===void 0)return}if(jE(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 JE(e,t){let r;if(e.isVertexAI())r=t?"publishers/google/models":"models";else r=t?"models":"tunedModels";return r}function KE(e){for(let t of["models","tunedModels","publisherModels"])if(Dx(e,t))return e[t];return[]}function Dx(e,t){return e!==null&&typeof e==="object"&&t in e}function xx(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 Lx(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=xx(o,t);if(s.functionDeclarations)r.push(...s.functionDeclarations)}return{functionDeclarations:r}}function XE(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 qx(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 YE(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 ZE(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 Ux(e){return e.includes("gemini")&&e!=="gemini-embedding-001"||e.includes("maas")}function Fx(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 Gx(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)=>yL(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 Bx(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"],kL(i));return t}function Hx(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"],NL(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 ja(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"],ZE(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"],Gx(YE(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"],ZE(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"],Bx(YE(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 zx(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)=>_L(e,s));m(r,["requests","requests"],i)}return r}function jx(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 Wx(e,t){let r={},n=d(t,["name"]);if(n!=null)m(r,["_url","name"],Qi(e,n));return r}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){let t={},r=d(e,["content"]);if(r!=null)m(t,["content"],r);let n=d(e,["citationMetadata"]);if(n!=null)m(t,["citationMetadata"],Xx(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 Xx(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 QE(e){let t={},r=d(e,["parts"]);if(r!=null){let o=r;if(Array.isArray(o))o=o.map((i)=>RL(i));m(t,["parts"],o)}let n=d(e,["role"]);if(n!=null)m(t,["role"],n);return t}function Yx(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 Zx(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"],Hx(qx(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"],zx(e,XE(e,o)));let i=d(t,["config"]);if(i!=null)Yx(i,r);return r}function Qx(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"],jx(XE(e,o)));let i=d(t,["config"]);if(i!=null)Zx(i,r);return r}function eL(e,t){let r={},n=d(e,["displayName"]);if(t!==void 0&&n!=null)m(t,["batch","displayName"],n);return r}function tL(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"],lL(e,o));let i=d(t,["config"]);if(i!=null)eL(i,r);return r}function rL(e,t){let r={},n=d(t,["name"]);if(n!=null)m(r,["_url","name"],Qi(e,n));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){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 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,t){let r={},n=d(t,["contents"]);if(n!=null){let i=Zd(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"],aL(o,r)),Q1(r,{"requests[].*":"requests[].request.*"});return r}function aL(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 lL(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"],sL(e,o));return r}function cL(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 uL(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 dL(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"],QE(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"],Qd(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 ae=R;if(Array.isArray(ae))ae=ae.map((ve)=>AL(ve));m(r,["safetySettings"],ae)}let w=d(t,["tools"]);if(r!==void 0&&w!=null){let ae=Zi(w);if(Array.isArray(ae))ae=ae.map((ve)=>PL(Yi(ve)));m(r,["tools"],ae)}let T=d(t,["toolConfig"]);if(r!==void 0&&T!=null)m(r,["toolConfig"],IL(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"],Un(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"],ef(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"],vL(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 fL(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)=>Kx(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 pL(e,t){let r={},n=d(t,["name"]);if(n!=null)m(r,["_url","name"],Qi(e,n));return r}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){let t={},r=d(e,["authConfig"]);if(r!=null)m(t,["authConfig"],Fx(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 gL(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 vL(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 _L(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)=>QE(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"],dL(e,s,d(r,["request"],{})));return r}function yL(e){let t={},r=d(e,["response"]);if(r!=null)m(t,["response"],fL(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 SL(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 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);let i=d(e,["filter"]);if(t!==void 0&&i!=null)m(t,["_query","filter"],i);return r}function bL(e){let t={},r=d(e,["config"]);if(r!=null)SL(r,t);return t}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,["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)=>ja(s));m(t,["batchJobs"],i)}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,["batchPredictionJobs"]);if(o!=null){let i=o;if(Array.isArray(i))i=i.map((s)=>gu(s));m(t,["batchJobs"],i)}return t}function RL(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"],cL(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 AL(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 IL(e){let t={},r=d(e,["functionCallingConfig"]);if(r!=null)m(t,["functionCallingConfig"],uL(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 PL(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"],mL(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"],gL(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 kL(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 NL(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 Dn;(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"})(Dn||(Dn={}));var jo=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}},OL=class extends qn{constructor(e){super();this.apiClient=e,this.list=async(t={})=>new jo(Dn.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=Qx(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)=>ja(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=tL(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)=>ja(l))}}async get(e){var t,r,n,o;let i,s="",l={};if(this.apiClient.isVertexAI()){let a=hL(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=pL(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)=>ja(c))}}async cancel(e){var t,r,n,o;let i="",s={};if(this.apiClient.isVertexAI()){let l=Jx(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=Wx(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=wL(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=CL(c),f=new Km;return Object.assign(f,u),f})}else{let a=bL(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=TL(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=nL(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)=>iL(c))}else{let a=rL(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)=>oL(c))}}};function $L(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 ML(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)=>rq(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)=>nq(i));m(t,["parts"],o)}let n=d(e,["role"]);if(n!=null)m(t,["role"],n);return t}function DL(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)=>sq(f));m(t,["tools"],u)}let c=d(e,["toolConfig"]);if(t!==void 0&&c!=null)m(t,["toolConfig"],oq(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 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 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)=>aq(h));m(t,["tools"],f)}let c=d(e,["toolConfig"]);if(t!==void 0&&c!=null)m(t,["toolConfig"],iq(c));let u=d(e,["kmsKeyName"]);if(t!==void 0&&u!=null)m(t,["encryption_spec","kmsKeyName"],u);return r}function LL(e,t){let r={},n=d(t,["model"]);if(n!=null)m(r,["model"],FE(e,n));let o=d(t,["config"]);if(o!=null)DL(o,r);return r}function qL(e,t){let r={},n=d(t,["model"]);if(n!=null)m(r,["model"],FE(e,n));let o=d(t,["config"]);if(o!=null)xL(o,r);return r}function UL(e,t){let r={},n=d(t,["name"]);if(n!=null)m(r,["_url","name"],Un(e,n));return r}function FL(e,t){let r={},n=d(t,["name"]);if(n!=null)m(r,["_url","name"],Un(e,n));return r}function GL(e){let t={},r=d(e,["sdkHttpResponse"]);if(r!=null)m(t,["sdkHttpResponse"],r);return t}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,["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 zL(e,t){let r={},n=d(t,["name"]);if(n!=null)m(r,["_url","name"],Un(e,n));return r}function jL(e,t){let r={},n=d(t,["name"]);if(n!=null)m(r,["_url","name"],Un(e,n));return r}function WL(e){let t={},r=d(e,["authConfig"]);if(r!=null)m(t,["authConfig"],$L(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 JL(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 KL(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 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){let t={},r=d(e,["config"]);if(r!=null)KL(r,t);return t}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,["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 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={};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 rq(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"],HL(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 nq(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 oq(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 iq(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 sq(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"],WL(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"],JL(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 aq(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((_)=>tq(_));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"],ML(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 lq(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 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(t,["name"]);if(n!=null)m(r,["_url","name"],Un(e,n));let o=d(t,["config"]);if(o!=null)lq(o,r);return r}function dq(e,t){let r={},n=d(t,["name"]);if(n!=null)m(r,["_url","name"],Un(e,n));let o=d(t,["config"]);if(o!=null)cq(o,r);return r}var fq=class extends qn{constructor(e){super();this.apiClient=e,this.list=async(t={})=>new jo(Dn.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=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:(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=LL(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=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:(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=zL(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=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:(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=BL(c),f=new Wm;return Object.assign(f,u),f})}else{let a=UL(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=GL(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=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:(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=uq(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=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:(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=eq(c),f=new Jm;return Object.assign(f,u),f})}else{let a=YL(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=QL(c),f=new Jm;return Object.assign(f,u),f})}}};function Dt(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 Ai(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 pq(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 eb(r)}function eb(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 hq(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&&!eb(e[n]))i=!1;n++}if(i)t.push(...o);else t.pop()}return t}var mq=class{constructor(e,t){this.modelsModule=e,this.apiClient=t}create(e){return new gq(this.apiClient,this.modelsModule,e.model,e.config,structuredClone(e.history))}},gq=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(),hq(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 Ai(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(pq(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)}},tb=class e extends Error{constructor(t){super(t.message);this.name="ApiError",this.status=t.status,Object.setPrototypeOf(this,e.prototype)}};function vq(e){let t={},r=d(e,["file"]);if(r!=null)m(t,["file"],r);return t}function _q(e){let t={},r=d(e,["sdkHttpResponse"]);if(r!=null)m(t,["sdkHttpResponse"],r);return t}function yq(e){let t={},r=d(e,["name"]);if(r!=null)m(t,["_url","file"],rf(r));return t}function Sq(e){let t={},r=d(e,["sdkHttpResponse"]);if(r!=null)m(t,["sdkHttpResponse"],r);return t}function Eq(e){let t={},r=d(e,["name"]);if(r!=null)m(t,["_url","file"],rf(r));return t}function bq(e){let t={},r=d(e,["uris"]);if(r!=null)m(t,["uris"],r);return t}function wq(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 Tq(e){let t={},r=d(e,["config"]);if(r!=null)wq(r,t);return t}function Cq(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 Rq(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 Aq=class e extends qn{constructor(t){super();this.apiClient=t,this.list=async(r={})=>new jo(Dn.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=Tq(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=Cq(a),u=new Rx;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=vq(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=_q(a),u=new Ax;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=Eq(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=yq(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=Sq(a),u=new Ix;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=bq(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=Rq(a),u=new Px;return Object.assign(u,c),u})}}};function Iq(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 Pq(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 kq(e){let t={},r=d(e,["parts"]);if(r!=null){let o=r;if(Array.isArray(o))o=o.map((i)=>Wq(i));m(t,["parts"],o)}let n=d(e,["role"]);if(n!=null)m(t,["role"],n);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,["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 $q(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"],rb(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 Mq(e){let t={},r=d(e,["authConfig"]);if(r!=null)m(t,["authConfig"],Iq(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 Dq(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 xq(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"],tf(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"],kq(Wt(p)));let _=d(e,["tools"]);if(t!==void 0&&_!=null){let P=Zi(_);if(Array.isArray(P))P=P.map((D)=>Qq(Yi(D)));m(t,["setup","tools"],P)}let y=d(e,["sessionResumption"]);if(t!==void 0&&y!=null)m(t,["setup","sessionResumption"],Yq(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)=>Xq(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 Lq(e,t){let r={},n=d(e,["generationConfig"]);if(t!==void 0&&n!=null)m(t,["setup","generationConfig"],$q(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"],rb(tf(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 D=Zi(_);if(Array.isArray(D))D=D.map((N)=>eU(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 qq(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"],xq(o,r));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){let t={},r=d(e,["musicGenerationConfig"]);if(r!=null)m(t,["musicGenerationConfig"],r);return t}function Gq(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 Bq(e){let t={},r=d(e,["media"]);if(r!=null){let c=GE(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"],HE(n));let o=d(e,["audioStreamEnd"]);if(o!=null)m(t,["audioStreamEnd"],o);let i=d(e,["video"]);if(i!=null)m(t,["video"],BE(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 Hq(e){let t={},r=d(e,["media"]);if(r!=null){let c=GE(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"],HE(n));let o=d(e,["audioStreamEnd"]);if(o!=null)m(t,["audioStreamEnd"],o);let i=d(e,["video"]);if(i!=null)m(t,["video"],BE(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"],tU(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"],rU(u));return t}function zq(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 jq(e){let t={},r=d(e,["speakerVoiceConfigs"]);if(r!=null){let n=r;if(Array.isArray(n))n=n.map((o)=>Zq(o));m(t,["speakerVoiceConfigs"],n)}return t}function Wq(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"],Oq(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 Jq(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 Kq(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 Xq(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 Yq(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 Zq(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"],nb(n));return t}function rb(e){let t={},r=d(e,["voiceConfig"]);if(r!=null)m(t,["voiceConfig"],nb(r));let n=d(e,["languageCode"]);if(n!=null)m(t,["languageCode"],n);let o=d(e,["multiSpeakerVoiceConfig"]);if(o!=null)m(t,["multiSpeakerVoiceConfig"],jq(o));return t}function Qq(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"],Mq(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"],Dq(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 eU(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((_)=>zq(_));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"],Pq(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 tU(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 rU(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 nb(e){let t={},r=d(e,["replicatedVoiceConfig"]);if(r!=null)m(t,["replicatedVoiceConfig"],Kq(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 nU(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 oU(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"],iU(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 iU(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 sU(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 aU(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 lU(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 cU(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"],uU(o));return r}function uU(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 ea(e,t){let r={},n=d(e,["parts"]);if(n!=null){let i=n;if(Array.isArray(i))i=i.map((s)=>hF(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)=>mF(s));m(r,["parts"],i)}let o=d(e,["role"]);if(o!=null)m(r,["role"],o);return r}function dU(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 fU(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 pU(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)=>ab(a));m(t,["tools"],l)}let s=d(e,["generationConfig"]);if(t!==void 0&&s!=null)m(t,["generationConfig"],ZU(s));return n}function hU(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)=>ea(a));m(n,["contents"],l)}let s=d(t,["config"]);if(s!=null)fU(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)=>es(a));m(n,["contents"],l)}let s=d(t,["config"]);if(s!=null)pU(s,n);return n}function gU(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 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);return r}function _U(e,t,r){let n={},o=d(t,["model"]);if(o!=null)m(n,["_url","name"],yt(e,o));return n}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){let r={},n=d(e,["sdkHttpResponse"]);if(n!=null)m(r,["sdkHttpResponse"],n);return r}function EU(e,t){let r={},n=d(e,["sdkHttpResponse"]);if(n!=null)m(r,["sdkHttpResponse"],n);return r}function bU(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 wU(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)=>EF(c));m(n,["instances[0]","referenceImages"],a)}let l=d(t,["config"]);if(l!=null)bU(l,n);return n}function TU(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)=>Ql(s));m(r,["generatedImages"],i)}return r}function CU(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 RU(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 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 c=Zd(e,i);if(Array.isArray(c))c=c.map((u)=>u);m(n,["requests[]","content"],c)}let s=d(t,["content"]);if(s!=null)ea(Wt(s));let l=d(t,["config"]);if(l!=null)CU(l,n);let a=d(t,["model"]);if(a!==void 0)m(n,["requests[]","model"],yt(e,a));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(r,["embeddingApiType"]);if(i===void 0)i="PREDICT";if(i==="PREDICT"){let a=d(t,["contents"]);if(a!=null){let c=Zd(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)RU(l,n,r);return n}function PU(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 kU(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)=>cU(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 NU(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 OU(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 $U(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 MU(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"],ea(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"],Qd(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)=>wF(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)=>OF(Yi(me)));m(r,["tools"],ve)}let C=d(t,["toolConfig"]);if(r!==void 0&&C!=null)m(r,["toolConfig"],kF(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"],Un(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"],ef(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"],nF(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 ae=d(t,["continuationToken"]);if(r!==void 0&&ae!=null)m(r,["continuationToken"],ae);return o}function DU(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"],Qd(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)=>ab(Yi(he)));m(r,["tools"],ne)}let P=d(t,["toolConfig"]);if(r!==void 0&&P!=null)m(r,["toolConfig"],NF(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"],Un(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"],sb(ef(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 ae=d(t,["audioTranscriptionConfig"]);if(ae!=null)m(o,["audioTranscriptionConfig"],ae);let ve=d(t,["imageConfig"]);if(ve!=null)m(o,["imageConfig"],oF(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)=>ea(a));m(n,["contents"],l)}let s=d(t,["config"]);if(s!=null)m(n,["generationConfig"],MU(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"],DU(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)=>oU(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 xU(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 LU(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)xU(s,n);return n}function qU(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)=>Ql(l));m(r,["generatedImages"],s)}let i=d(e,["positivePromptSafetyAttributes"]);if(i!=null)m(r,["positivePromptSafetyAttributes"],ib(i));return r}function UU(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"],ec(f));let h=d(e,["referenceImages"]);if(t!==void 0&&h!=null){let p=h;if(Array.isArray(p))p=p.map((_)=>zF(_));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 FU(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"],Kr(y));let S=d(e,["referenceImages"]);if(t!==void 0&&S!=null){let T=S;if(Array.isArray(T))T=T.map((C)=>jF(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 GU(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"],zU(l));return r}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"]);if(l!=null)m(r,["response"],jU(l));return r}function HU(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"],ec(s));let l=d(t,["video"]);if(l!=null)m(n,["instances[0]","video"],lb(l));let a=d(t,["source"]);if(a!=null)WU(a,n);let c=d(t,["config"]);if(c!=null)UU(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"],Kr(s));let l=d(t,["video"]);if(l!=null)m(n,["instances[0]","video"],cb(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 zU(e,t){let r={},n=d(e,["generatedSamples"]);if(n!=null){let s=n;if(Array.isArray(s))s=s.map((l)=>XU(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){let r={},n=d(e,["videos"]);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,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"],ec(i));let s=d(e,["video"]);if(t!==void 0&&s!=null)m(t,["instances[0]","video"],lb(s));return n}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"],Kr(i));let s=d(e,["video"]);if(t!==void 0&&s!=null)m(t,["instances[0]","video"],cb(s));return n}function Ql(e,t){let r={},n=d(e,["_self"]);if(n!=null)m(r,["image"],ob(n));let o=d(e,["raiFilteredReason"]);if(o!=null)m(r,["raiFilteredReason"],o);let i=d(e,["_self"]);if(i!=null)m(r,["safetyAttributes"],ib(i));let s=d(e,["prompt"]);if(s!=null)m(r,["enhancedPrompt"],s);return r}function KU(e,t){let r={},n=d(e,["_self"]);if(n!=null)m(r,["mask"],ob(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 XU(e,t){let r={},n=d(e,["video"]);if(n!=null)m(r,["video"],BF(n));return r}function YU(e,t){let r={},n=d(e,["_self"]);if(n!=null)m(r,["video"],HF(n));return r}function ZU(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"],sb(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 QU(e,t,r){let n={},o=d(t,["model"]);if(o!=null)m(n,["_url","name"],yt(e,o));return n}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){let r={},n=d(e,["authConfig"]);if(n!=null)m(r,["authConfig"],nU(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 rF(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 nF(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 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);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 ob(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"],zo(o));let i=d(e,["mimeType"]);if(i!=null)m(r,["mimeType"],i);return r}function ec(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"],zo(n));let o=d(e,["mimeType"]);if(o!=null)m(r,["mimeType"],o);return r}function Kr(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"],zo(o));let i=d(e,["mimeType"]);if(i!=null)m(r,["mimeType"],i);return r}function iF(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"],JE(e,a));return o}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"],JE(e,a));return o}function aF(e,t,r){let n={},o=d(t,["config"]);if(o!=null)iF(e,o,n);return n}function lF(e,t,r){let n={},o=d(t,["config"]);if(o!=null)sF(e,o,n);return n}function cF(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=KE(i);if(Array.isArray(s))s=s.map((l)=>vu(l));m(r,["models"],s)}return r}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=KE(i);if(Array.isArray(s))s=s.map((l)=>_u(l));m(r,["models"],s)}return r}function dF(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 fF(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"],$F(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)=>NU(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"],MF(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 pF(e,t){let r={},n=d(e,["speakerVoiceConfigs"]);if(n!=null){let o=n;if(Array.isArray(o))o=o.map((i)=>PF(i));m(r,["speakerVoiceConfigs"],o)}return r}function hF(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"],OU(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 mF(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 gF(e,t){let r={},n=d(e,["productImage"]);if(n!=null)m(r,["image"],Kr(n));return r}function vF(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 _F(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)SF(i,n);let s=d(t,["config"]);if(s!=null)vF(s,n);return n}function yF(e,t){let r={},n=d(e,["predictions"]);if(n!=null){let o=n;if(Array.isArray(o))o=o.map((i)=>Ql(i));m(r,["generatedImages"],o)}return r}function SF(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"],Kr(i));let s=d(e,["productImages"]);if(t!==void 0&&s!=null){let l=s;if(Array.isArray(l))l=l.map((a)=>gF(a));m(t,["instances[0]","productImages"],l)}return n}function EF(e,t){let r={},n=d(e,["referenceImage"]);if(n!=null)m(r,["referenceImage"],Kr(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"],dF(s));let l=d(e,["controlImageConfig"]);if(l!=null)m(r,["controlImageConfig"],dU(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 bF(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 ib(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 wF(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 TF(e,t){let r={},n=d(e,["image"]);if(n!=null)m(r,["image"],Kr(n));return r}function CF(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 RF(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)IF(i,n);let s=d(t,["config"]);if(s!=null)CF(s,n);return n}function AF(e,t){let r={},n=d(e,["predictions"]);if(n!=null){let o=n;if(Array.isArray(o))o=o.map((i)=>KU(i));m(r,["generatedMasks"],o)}return r}function IF(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"],Kr(i));let s=d(e,["scribbleImage"]);if(t!==void 0&&s!=null)m(t,["instances[0]","scribble"],TF(s));return n}function PF(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"],ub(o));return r}function sb(e,t){let r={},n=d(e,["voiceConfig"]);if(n!=null)m(r,["voiceConfig"],ub(n));let o=d(e,["languageCode"]);if(o!=null)m(r,["languageCode"],o);let i=d(e,["multiSpeakerVoiceConfig"]);if(i!=null)m(r,["multiSpeakerVoiceConfig"],pF(i));return r}function kF(e,t){let r={},n=d(e,["functionCallingConfig"]);if(n!=null)m(r,["functionCallingConfig"],$U(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 NF(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 OF(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"],tF(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"],rF(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 ab(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)=>fF(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"],lU(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 $F(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 MF(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 DF(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 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(t,["model"]);if(o!=null)m(n,["_url","name"],yt(e,o));let i=d(t,["config"]);if(i!=null)DF(i,n);return n}function qF(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)xF(i,n);return n}function UF(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 FF(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"],Kr(i));let s=d(t,["upscaleFactor"]);if(s!=null)m(n,["parameters","upscaleConfig","upscaleFactor"],s);let l=d(t,["config"]);if(l!=null)UF(l,n);return n}function GF(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)=>Ql(s));m(r,["generatedImages"],i)}return r}function BF(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"],zo(o));let i=d(e,["encoding"]);if(i!=null)m(r,["mimeType"],i);return r}function HF(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"],zo(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"],Kr(n));let o=d(e,["maskMode"]);if(o!=null)m(r,["maskMode"],o);return r}function zF(e,t){let r={},n=d(e,["image"]);if(n!=null)m(r,["image"],ec(n));let o=d(e,["referenceType"]);if(o!=null)m(r,["referenceType"],o);return r}function jF(e,t){let r={},n=d(e,["image"]);if(n!=null)m(r,["image"],Kr(n));let o=d(e,["referenceType"]);if(o!=null)m(r,["referenceType"],o);return r}function lb(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"],zo(o));let i=d(e,["mimeType"]);if(i!=null)m(r,["encoding"],i);return r}function cb(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"],zo(o));let i=d(e,["mimeType"]);if(i!=null)m(r,["mimeType"],i);return r}function ub(e,t){let r={},n=d(e,["replicatedVoiceConfig"]);if(n!=null)m(r,["replicatedVoiceConfig"],bF(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 WF(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 JF(e,t){let r={},n=d(t,["config"]);if(n!=null)WF(e,n,r);return r}function KF(e,t){let r={},n=d(e,["force"]);if(t!==void 0&&n!=null)m(t,["_query","force"],n);return r}function XF(e){let t={},r=d(e,["name"]);if(r!=null)m(t,["_url","name"],r);let n=d(e,["config"]);if(n!=null)KF(n,t);return t}function YF(e){let t={},r=d(e,["name"]);if(r!=null)m(t,["_url","name"],r);return t}function ZF(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 QF(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"],tG(s));return t}function eG(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)ZF(o,t);return t}function tG(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 rG(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 nG(e){let t={},r=d(e,["config"]);if(r!=null)rG(r,t);return t}function oG(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 db(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 iG(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)db(n,t);return t}function sG(e){let t={},r=d(e,["sdkHttpResponse"]);if(r!=null)m(t,["sdkHttpResponse"],r);return t}var aG="Content-Type",lG="X-Server-Timeout",cG="User-Agent",yu="x-goog-api-client",uG="2.26.0",dG=`google-genai-sdk/${uG}`,fG="v1beta1",pG="v1beta",hG=new Set(["us","eu"]);function mG(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 gG(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 vG=5,_G=1,yG=60,SG=2,EG=1,bG=[408,429,500,502,503,504],wG=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&&hG.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:fG}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:pG,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)mG(t.timeout);if(t&&t.extraBody!==null)TG(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 Gc(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 Gc(l),this.processStreamResponse(l))).catch((l)=>{if(l instanceof Error)throw l;else throw Error(`exception ${l} sending request`,{cause:l})})}processStreamResponse(e){return Ai(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=[`
127
+
128
+ `,"\r\r",`\r
129
+ \r
130
+ `];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 tb({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:bG,p=async()=>{let E=gG(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 Gc(b)}finally{E.dispose()}return b};if(!r)return p();let _=Math.max(1,(l=r.attempts)!==null&&l!==void 0?l:vG),y=Math.round(((a=r.initialDelay)!==null&&a!==void 0?a:_G)*1000),S=Math.max(y,Math.round(((c=r.maxDelay)!==null&&c!==void 0?c:yG)*1000));return(0,B1.default)(p,{retries:_-1,factor:(u=r.expBase)!==null&&u!==void 0?u:SG,minTimeout:y,maxTimeout:S,randomize:((f=r.jitter)!==null&&f!==void 0?f:EG)>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=dG+" "+this.clientOptions.userAgentExtra;return e[cG]=t,e[yu]=t,e[aG]="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(lG,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)db(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 Gc(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 tb({message:o,status:r});throw Error(o)}}function TG(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 CG="mcp_used/unknown",RG=!1;function fb(e){for(let t of e){if(AG(t))return!0;if(typeof t==="object"&&"inputSchema"in t)return!0}return RG}function pb(e){var t;let r=(t=e[yu])!==null&&t!==void 0?t:"";e[yu]=(r+` ${CG}`).trimStart()}function AG(e){return e!==null&&typeof e==="object"&&e instanceof PG}function IG(e){return Ai(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 PG=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(IG(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(),Lx(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 kG(e,t,r){let n=new Nx,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 NG=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=MG(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)=>{kG(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,$G(i),g);p.connect(),await c;let S={setup:{model:yt(this.apiClient,e.model)}};return p.send(JSON.stringify(S)),new OG(p,this.apiClient)}},OG=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=Gq(e);this.conn.send(JSON.stringify({clientContent:t}))}async setMusicGenerationConfig(e){if(!e.musicGenerationConfig)e.musicGenerationConfig={};let t=Fq(e);this.conn.send(JSON.stringify(t))}sendPlaybackControl(e){let t={playbackControl:e};this.conn.send(JSON.stringify(t))}play(){this.sendPlaybackControl(Ei.PLAY)}pause(){this.sendPlaybackControl(Ei.PAUSE)}stop(){this.sendPlaybackControl(Ei.STOP)}resetContext(){this.sendPlaybackControl(Ei.RESET_CONTEXT)}close(){this.conn.close()}};function $G(e){let t={};return e.forEach((r,n)=>{t[n]=r}),t}function MG(e){let t=new Headers;for(let[r,n]of Object.entries(e))t.append(r,n);return t}var DG="FunctionResponse request must have an `id` field from the response of a ToolCall.FunctionalCalls in Google AI.";async function xG(e,t,r){let n=new kx,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 LG=class{constructor(e,t,r){this.apiClient=e,this.auth=t,this.webSocketFactory=r,this.music=new NG(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&&fb(e.config.tools))pb(u);let f=GG(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)=>{xG(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,FG(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:[xi.AUDIO]};else e.config.responseModalities=[xi.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=Uq(this.apiClient,N);else A=qq(this.apiClient,N);delete A.config;let F=new UG(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"}},qG={turnComplete:!0},UG=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)=>ea(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(DG)}return{toolResponse:{functionResponses:r}}}sendClientContent(e){e=Object.assign(Object.assign({},qG),e);let t=this.tLiveClientContent(this.apiClient,e);this.conn.send(JSON.stringify(t))}sendRealtimeInput(e){let t={};if(this.apiClient.isVertexAI())t={realtimeInput:Hq(e)};else t={realtimeInput:Bq(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 FG(e){let t={};return e.forEach((r,n)=>{t[n]=r}),t}function GG(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(Ii(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 Ii(e){return"callTool"in e&&typeof e.callTool==="function"}function BG(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)=>Ii(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(Ii(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 tc=class e extends qn{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:fl.EMBED_CONTENT});return await this.embedContentInternal(i)}else{let o=Object.assign(Object.assign({},r),{embeddingApiType:fl.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),!BG(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(Ii(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 jo(Dn.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(Ii(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&&fb(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();pb(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(Ii(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 Ai(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 Ai(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 Ai(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=IU(this.apiClient,t,t),u=Ux(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=kU(f,t),g=new Gm;return Object.assign(g,h),g})}else{let c=AU(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=PU(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=LU(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=qU(a),u=new hx;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=wU(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=TU(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 upscaleImageInternal(t){var r,n;let o,i="",s={};if(this.apiClient.isVertexAI()){let l=FF(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=GF(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 recontextImage(t){var r,n;let o,i="",s={};if(this.apiClient.isVertexAI()){let l=_F(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=yF(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 segmentImage(t){var r,n;let o,i="",s={};if(this.apiClient.isVertexAI()){let l=RF(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=AF(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 get(t){var r,n,o,i;let s,l="",a={};if(this.apiClient.isVertexAI()){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:(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=QU(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=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:(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=uF(u),h=new Bm;return Object.assign(h,f),h})}else{let c=aF(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=cF(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=qF(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=LF(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=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:(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=EU(u),h=new Hm;return Object.assign(h,f),h})}else{let c=_U(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=SU(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=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:(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=vU(u),h=new Vm;return Object.assign(h,f),h})}else{let c=hU(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=gU(u),h=new Vm;return Object.assign(h,f),h})}}async computeTokens(t){var r,n;let o,i="",s={};if(this.apiClient.isVertexAI()){let l=sU(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=aU(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 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=BU(u),h=new zm;return Object.assign(h,f),h})}else{let c=HU(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=GU(u),h=new zm;return Object.assign(h,f),h})}}};tc.loggedGenerateImagesWarning=!1;tc.loggedEditImageWarning=!1;tc.loggedGenerateVideosWarning=!1;var HG=class extends qn{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=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:(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=ax(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=ex(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 zG(e){let t={},r=d(e,["parts"]);if(r!=null){let o=r;if(Array.isArray(o))o=o.map((i)=>QG(i));m(t,["parts"],o)}let n=d(e,["role"]);if(n!=null)m(t,["role"],n);return t}function jG(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"],ZG(e,l));let a=d(t,["lockAdditionalFields"]);if(r!==void 0&&a!=null)m(r,["fieldMask"],a);return n}function WG(e,t){let r={},n=d(t,["config"]);if(n!=null)m(r,["config"],jG(e,n,r));return r}function JG(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 KG(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 XG(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 YG(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"],tf(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"],zG(Wt(p)));let _=d(e,["tools"]);if(t!==void 0&&_!=null){let P=Zi(_);if(Array.isArray(P))P=P.map((D)=>rB(Yi(D)));m(t,["setup","tools"],P)}let y=d(e,["sessionResumption"]);if(t!==void 0&&y!=null)m(t,["setup","sessionResumption"],tB(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)=>eB(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 ZG(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"],YG(o,r));return r}function QG(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"],JG(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 eB(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 tB(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 rB(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"],KG(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"],XG(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 nB(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 oB(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=nB(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 iB=class extends qn{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=WG(this.apiClient,e);o=Ae("auth_tokens",s._url),i=s._query,delete s.config,delete s._url,delete s._query;let l=oB(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 sB(e,t){let r={},n=d(e,["force"]);if(t!==void 0&&n!=null)m(t,["_query","force"],n);return r}function aB(e){let t={},r=d(e,["name"]);if(r!=null)m(t,["_url","name"],r);let n=d(e,["config"]);if(n!=null)sB(n,t);return t}function lB(e){let t={},r=d(e,["name"]);if(r!=null)m(t,["_url","name"],r);return t}function cB(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 uB(e){let t={},r=d(e,["parent"]);if(r!=null)m(t,["_url","parent"],r);let n=d(e,["config"]);if(n!=null)cB(n,t);return t}function dB(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 fB=class extends qn{constructor(e){super();this.apiClient=e,this.list=async(t)=>new jo(Dn.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=lB(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=aB(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=uB(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=dB(l),c=new bx;return Object.assign(c,a),c})}}},pB=class extends qn{constructor(e,t=new fB(e)){super();this.apiClient=e,this.documents=t,this.list=async(r={})=>new jo(Dn.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=JF(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=YF(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=XF(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=nG(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=oG(l),c=new wx;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=iG(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=sG(l),c=new Tx;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=eG(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=QF(l),c=new Cx;return Object.assign(c,a),c})}}};function hB(){if("Deno"in globalThis)return!0;return!1}var $a=void 0;function Us(){var e,t,r,n,o,i;if($a)return $a;let s=globalThis,l={};if(hB())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 $a=l,$a}function mB(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 gB=class{constructor(e){this.options=e}getDefaultHeaders(){return this.options.defaultHeaders}async resolveGoogleGenAISecurity(e){return EB(await this.options.getAuthHeaders(e))}},vB=class{beforeCreateRequest(e,t){return Object.assign(Object.assign({},t),{url:_B(t.url)})}async beforeRequest(e,t){if(pg(t.headers,SB(e.security_source)),bB(e,t.headers),TB(t.headers))return t;let r=await yB(e.security_source,t.url);return pg(t.headers,r===null||r===void 0?void 0:r.default_headers),wB(t.headers,r),t}};function _B(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 yB(e,t){if(mb(e))return e.resolveGoogleGenAISecurity(t);let r=typeof e==="function"?await e():e;if(hb(r))return fg(r);return fg(void 0)}function SB(e){var t,r;if(mb(e))return(r=(t=e.getDefaultHeaders)===null||t===void 0?void 0:t.call(e))!==null&&r!==void 0?r:e.defaultHeaders;if(hb(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 gb(o)?o:void 0}function EB(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 gb(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 bB(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 wB(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",CB(t.access_token))}function TB(e){return e.get("authorization")!==null||e.get("x-goog-api-key")!==null}function CB(e){return e.slice(0,7).toLowerCase()==="bearer "?e:`Bearer ${e}`}function hb(e){return typeof e==="object"&&e!==null}function mb(e){return typeof e==="object"&&e!==null&&"resolveGoogleGenAISecurity"in e&&typeof e.resolveGoogleGenAISecurity==="function"}function gb(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"}},vb=class extends ts{constructor(){super(...arguments);this.name="RequestAbortedError"}},_b=class extends ts{constructor(){super(...arguments);this.name="RequestTimeoutError"}},yb=class extends ts{constructor(){super(...arguments);this.name="ConnectionError"}},un=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"}},RB=class extends Error{},Dr=class e extends RB{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&&FB(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 PB(t,r,n,o);if(t===401)return new kB(t,r,n,o);if(t===403)return new NB(t,r,n,o);if(t===404)return new OB(t,r,n,o);if(t===409)return new $B(t,r,n,o);if(t===422)return new MB(t,r,n,o);if(t===429)return new DB(t,r,n,o);if(t>=500)return new xB(t,r,n,o);return new e(t,r,n,o)}},AB=class extends Dr{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},ml=class extends Dr{constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0);this.cause=t}},IB=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."})}},PB=class extends Dr{},kB=class extends Dr{},NB=class extends Dr{},OB=class extends Dr{},$B=class extends Dr{},MB=class extends Dr{},DB=class extends Dr{},xB=class extends Dr{};function ko(e){if(GB(e))return e;if(e instanceof un)return LB(e);if(e instanceof ts)return qB(e);return e}function LB(e){let t=UB(e),r=Dr.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 qB(e){if(e instanceof _b)return new IB({message:e.message});if(e instanceof vb)return new AB({message:e.message});if(e instanceof yb)return new ml({message:e.message,cause:e});return new ml({message:e.message,cause:e})}function UB(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 FB(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function GB(e){return typeof e==="object"&&e!==null?Dr.prototype.isPrototypeOf(e):!1}function _s(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:r,writable:!1})}var BB=(e,t)=>{if(t==null)return fetch(e);else return fetch(e,t)},Sb=class e{constructor(t={}){this.requestHooks=[],this.requestErrorHooks=[],this.responseHooks=[],this.options=t,this.fetcher=t.fetcher||BB}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 _i(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 HB=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(!HB.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)&&_i(e,r)}function Eb(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 bb(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 zB(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 jB(e){let t=new vB;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)}jB(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 Pn(e){return{ok:!1,error:e}}function nf(e){return btoa(String.fromCodePoint(...e))}function WB(e){return new TextEncoder().encode(e)}function JB(e){return nf(WB(e))}var KB=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(!KB.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 XB(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 YB={userAgent:"speakeasy-sdk/typescript 2.4.1-preview.4 internal v1beta @google/genai"};function ZB(...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 QB(t)}}function QB(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 po(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 eH=/%(2[346bcf]|3[abdf]|40|5[bd])/gi;function wb(e,t){return rc(e,t==="percentExceptReserved"?"percent":t)}function rc(e,t){switch(t){case"percent":return encodeURIComponent(e);case"percentExceptReserved":return encodeURIComponent(e).replace(eH,(r)=>decodeURIComponent(r));default:return e}}function tH(e){return(t,r,n)=>{let o="",i=(n===null||n===void 0?void 0:n.explode)?Cb(t,r):[[t,r]];if(i.every(([c,u])=>u==null))return;let s=(c)=>rc(c,n===null||n===void 0?void 0:n.charEncoding),l=(c)=>s(Rb(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=Ib(u,(_)=>`${l(_)}`))===null||f===void 0?void 0:f.join(a);else if(po(u))p=(h=Pb(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=`${wb(c,n===null||n===void 0?void 0:n.charEncoding)}=${p}`,!g||g==="=")return;o+=`&${g}`}),o.slice(1)}}var Tb=tH(",");function xr(e,t,r){if(typeof t>"u")return;let o=((i)=>rc(i,r===null||r===void 0?void 0:r.charEncoding))(JSON.stringify(t,Ab));return(r===null||r===void 0?void 0:r.explode)?o:`${wb(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)?Cb(e,t):[[e,t]];if(o.every(([l,a])=>a==null))return;let i=(l)=>rc(l,r===null||r===void 0?void 0:r.charEncoding),s=(l)=>i(Rb(l));return o.forEach(([l,a])=>{var c;let u="";if(a==null)return;else if(Array.isArray(a))u=(c=Ib(a,(f)=>`${s(f)}`))===null||c===void 0?void 0:c.join(",");else if(po(a)){let f=Pb(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)&&po(t)?`${l}=`:""}${s(a)}`;n+=u?`,${u}`:""}),n.slice(1)};function Cb(e,t){if(Array.isArray(t))return t.map((r)=>[e,r]);else if(po(t))return Object.entries(t!==null&&t!==void 0?t:{}).map(([n,o])=>[n,o]);else return[[e,t]]}function Rb(e){if(e==null)return"";else if(e instanceof Date)return e.toISOString();else if(e instanceof Uint8Array)return nf(e);else if(typeof e==="object")return JSON.stringify(e,Ab);return`${e}`}function Ab(e,t){if(t instanceof Uint8Array)return nf(t);else return t}function Ib(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 Pb(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 rH(...e){return e.filter(Boolean).join("&")}function nH(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 rH(...c)}}var Lr=nH(Tb),Eg={initialInterval:500,maxInterval:60000,exponent:1.5,maxElapsedTime:3600000},of=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 oH(e,t){var r;switch(t.config.strategy){case"backoff":return aH(bg(e,{statusCodes:t.statusCodes,retryConnectionErrors:!!t.config.retryConnectionErrors}),(r=t.config.backoff)!==null&&r!==void 0?r:Eg);case"attempt-count-backoff":return lH(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(sH(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&&(bb(n)||Eb(n)))throw n;throw new of("Permanent error",{cause:n})}}}var iH=new RegExp("^[0-9]xx$","i");function sH(e,t){let r=`${e.status}`;return t.some((n)=>{if(!iH.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 aH(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 of)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=kb(a.response);if(u<=0)u=n*Math.pow(l,o)+Math.random()*1000;let f=Math.min(u,i);await Nb(f),l++}}async function lH(e,t,r){let n=0;while(!0)try{return await e(n)}catch(o){if(o instanceof of)throw o.cause;if(n>=r.maxRetries){if(o instanceof qi)return o.response;throw o}let i=0;if(o instanceof qi)i=kb(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 Nb(s),n++}}function kb(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 Nb(e){return new Promise((t)=>setTimeout(t,e))}var Da=typeof globalThis>"u"?null:globalThis,cH=typeof Da==="object"&&Da!=null&&"importScripts"in Da&&typeof Da.importScripts==="function",uH=cH||typeof navigator<"u"&&"serviceWorker"in navigator||typeof window==="object"&&typeof window.document<"u",dn=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 Sb;e.http_client=e.http_client||r,e=this._hooks.sdkInit(e);let n=XB(e);if(n)n.pathname=n.pathname.replace(/\/+$/,"")+"/";if(this._baseURL=n,this._httpClient=e.http_client||r,this._options=Object.assign(Object.assign({},mB(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 Pn(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((ae)=>ae!=="").map((ae)=>{var ve;return(ve=ae.split("=")[0])!==null&&ve!==void 0?ve:""}));return[...G.split("&").filter((ae)=>{var ve;return ae!==""&&!Q.has((ve=ae.split("=")[0])!==null&&ve!==void 0?ve:"")}),B].join("&")},S=(G)=>Object.entries(G).map(([B,Q])=>{if(Q==null)return;let pe=po(Q)?JSON.stringify(Q):Q;return Tb(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=JB([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(!uH)b.set((s=t.uaHeader)!==null&&s!==void 0?s:"user-agent",(l=t.userAgent)!==null&&l!==void 0?l:YB.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 Pn(new Ma("extra_body can only be merged into JSON object request bodies"));let Q;try{Q=P?JSON.parse(P):{}}catch(pe){return Pn(new Ma("extra_body can only be merged into JSON object request bodies",{cause:pe}))}if(!po(Q))return Pn(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 Pn(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 oH(async()=>{var i;let s=e.clone(),l=s;if(o!=null&&o>0){let u=AbortSignal.timeout(o),f=(i=ZB(s.signal,u))!==null&&i!==void 0?i:u;l=new Request(s,{signal:f})}let a=await this._hooks.beforeRequest(r,l);await dH(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 fH(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 zB(i):return Pn(new vb("Request aborted by client",{cause:i}));case bb(i):return Pn(new _b("Request timed out",{cause:i}));case Eb(i):return Pn(new yb("Unable to make request",{cause:i}));default:return Pn(new hg("Unexpected HTTP client error",{cause:i}))}})}},Ob=/^(application|text)\/([^+]+\+)*json.*/,wg=/^(application|text)\/([^+]+\+)*(jsonl|x-ndjson)\b.*/;async function dH(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 Ob.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 fH(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(_i(t,"application/json")||Ob.test(o)&&!wg.test(o)):e.log(await t.clone().json());break;case(_i(t,"application/jsonl")||wg.test(o)):case _i(t,"text/event-stream"):e.log(`<${n}>`);break;case _i(t,"text/*"):e.log(await t.clone().text());break;case _i(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 un{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?`
131
+ `:". ";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 pH(e,t={}){var r,n;let o=t.flattened===!0,i=(r=t.sentinel)!==null&&r!==void 0?r:"";return new hH(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 hH=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=gH(i,s,l);if(!f){l=Math.max(0,s-mH+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=vH(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,$b=[[Pr,kr,Pr,kr],[Pr,kr,Pr],[Pr,kr,kr],[Pr,Pr,kr],[kr,Pr,kr],[Pr,Pr],[kr,Pr],[kr,kr]],mH=$b.reduce((e,t)=>Math.max(e,t.length),0);function gH(e,t,r){for(let n=r;n<t;n++){if(e[n]!==Pr&&e[n]!==kr)continue;for(let o of $b){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 vH(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(`
132
+ `);else if(n)return;return t(l)}var _H={jsonl:"application/jsonl",json:"application/json",text:"text/plain",bytes:"application/octet-stream",stream:"application/octet-stream",sse:"text/event-stream",nil:"*",fail:"*"};function ho(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 Mb(e,t,r){return Object.assign(Object.assign(Object.assign({},r),{enc:"sse",codes:e}),t?{sse:t}:{})}function Db(e,t){return Object.assign(Object.assign({},t),{enc:"nil",codes:e})}function Me(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:_H[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=pH(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:SH(r.headers)}:null;if("err"in s)u=Object.assign(Object.assign(Object.assign({},o===null||o===void 0?void 0:o.extraFields),f),po(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),po(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 yH=/, */;function SH(e){let t={};for(let[r,n]of e.entries())t[r]=n.split(yH);return t}var Rg={Incomplete:"incomplete",UnrecognisedSecurityType:"unrecognized_security_type"},EH=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 bH(...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":wH(t,n);break;case"http:custom":break;case"http:bearer":xa(t,n);break;case"oauth2":xa(t,n);break;case"oauth2:password":xa(t,n);break;case"oauth2:client_credentials":break;case"openIdConnect":xa(t,n);break;default:throw EH.unrecognizedType(o)}}),t}function wH(e,t){if(t.value==null)return;e.basic=t.value}function xa(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 bH(...o)}async function ht(e){if(e==null)return;return typeof e==="function"?e():e}var xb,st=class e{constructor(t,r){this[xb]="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)}};xb=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 Lb(e,t,r,n){return new st(TH(e,t,r,n))}async function TH(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(Me("4XX"),Me("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){return new st(CH(e,t,r,n))}async function CH(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(Me("4XX"),Me("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 Ub(e,t,r,n){return new st(RH(e,t,r,n))}async function RH(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(Me("4XX"),Me("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 Fb(e,t,r,n,o,i){return new st(AH(e,t,r,n,o,i))}async function AH(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(Me("4XX"),Me("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 IH=class extends dn{list(e,t){return ct(Fb(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=Dt(e,["api_version"]);return ct(Lb(this,n,r,t))}delete(e,t,r){return ct(qb(this,e,t===null||t===void 0?void 0:t.api_version,r))}get(e,t,r){return ct(Ub(this,e,t===null||t===void 0?void 0:t.api_version,r))}};function Gb(e,t,r,n){return new st(PH(e,t,r,n))}async function PH(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(Me("4XX"),Me("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(kH(e,t,r,n))}async function kH(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(Me("4XX"),Me("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){return new st(NH(e,t,r,n))}async function NH(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(Me("4XX"),Me("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 Vb(e,t,r,n,o){return new st(OH(e,t,r,n,o))}async function OH(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(Me("4XX"),Me("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){return new st($H(e,t,r,n,o,i))}async function $H(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(Me("4XX"),Me("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 MH=class extends dn{list(e,t){return ct(Vb(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=Dt(e,["api_version"]);return ct(Gb(this,n,r,t))}delete(e,t,r){return ct(Bb(this,e,t===null||t===void 0?void 0:t.api_version,r))}get(e,t,r){return ct(Hb(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=Dt(t,["api_version","update_mask"]);return ct(zb(this,e,i,n,o,r))}};function jb(e,t,r,n){return new st(DH(e,t,r,n))}async function DH(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(Me("4XX"),Me("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 Wb(e,t,r,n){return new st(xH(e,t,r,n))}async function xH(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(Me("4XX"),Me("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 Jb(e,t,r,n){return new st(LH(e,t,r,n))}async function LH(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(Me("4XX"),Me("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 Kb(e,t,r,n,o){return new st(qH(e,t,r,n,o))}async function qH(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(Me("4XX"),Me("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 Xb(e,t,r,n,o,i,s,l){return new st(UH(e,t,r,n,o,i,s,l))}async function UH(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),Me("4XX"),Me("5XX"))(A,T);if(!P.ok)return[P,{status:"complete",request:T,response:A}];return[P,{status:"complete",request:T,response:A}]}var FH=class extends dn{list(e,t,r,n){return ct(Xb(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 Yb(e,t,r,n,o,i,s,l,a,c,u){return new st(GH(e,t,r,n,o,i,s,l,a,c,u))}async function GH(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(Db(200,{hdrs:!0}),Me("4XX"),Me("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 BH=class extends dn{startUpload(e,t,r,n){return ct(Yb(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))}},HH=class extends dn{get internal(){var e;return(e=this._internal)!==null&&e!==void 0?e:this._internal=new BH(this._options)}get files(){var e;return(e=this._files)!==null&&e!==void 0?e:this._files=new FH(this._options)}listEnvironments(e,t){return ct(Kb(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(jb(this,e,t,r))}deleteEnvironment(e,t,r){return ct(Wb(this,e,t===null||t===void 0?void 0:t.api_version,r))}getEnvironment(e,t,r){return ct(Jb(this,e,t===null||t===void 0?void 0:t.api_version,r))}},VH=class extends un{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"}},zH=class extends un{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"}},jH=class extends un{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"}},WH=class extends un{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"}},JH=class extends un{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"}},KH=class extends un{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"}},XH=class extends un{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"}},YH=class extends un{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 Zb(e,t,r,n){return new st(ZH(e,t,r,n))}async function ZH(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),ho("4XX",zH),ho("5XX",VH))(b,S,{extraFields:R});if(!w.ok)return[w,{status:"complete",request:S,response:b}];return[w,{status:"complete",request:S,response:b}]}function Qb(e,t,r,n){return new st(QH(e,t,r,n))}async function QH(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),Mb(200,{sentinel:"[DONE]",flattened:!0}),ho("4XX",WH),ho("5XX",jH))(R,E,{extraFields:w});if(!T.ok)return[T,{status:"complete",request:E,response:R}];return[T,{status:"complete",request:E,response:R}]}function eV(e,t,r,n){return new st(tV(e,t,r,n))}async function tV(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(Db(200),ho("4XX",KH),ho("5XX",JH))(b,S,{extraFields:R});if(!w.ok)return[w,{status:"complete",request:S,response:b}];return[w,{status:"complete",request:S,response:b}]}function ew(e,t,r,n,o,i,s){return new st(rV(e,t,r,n,o,i,s))}async function rV(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),Mb(200,{sentinel:"[DONE]",flattened:!0}),ho("4XX",YH),ho("5XX",XH))(C,w,{extraFields:A});if(!P.ok)return[P,{status:"complete",request:w,response:C}];return[P,{status:"complete",request:w,response:C}]}var nV=class extends dn{create(e,t){let{api_version:r}=e,n=Dt(e,["api_version"]);return ct(Qb(this,n,r,t))}delete(e,t,r){return ct(eV(this,e,t===null||t===void 0?void 0:t.api_version,r))}get(e,t,r){return ct(ew(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(Zb(this,e,t===null||t===void 0?void 0:t.api_version,r))}};function tw(e,t,r,n){return new st(oV(e,t,r,n))}async function oV(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(Me("4XX"),Me("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 rw(e,t,r,n){return new st(iV(e,t,r,n))}async function iV(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(Me("4XX"),Me("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(sV(e,t,r,n))}async function sV(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(Me("4XX"),Me("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,o,i){return new st(aV(e,t,r,n,o,i))}async function aV(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(Me("4XX"),Me("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 iw(e,t,r,n,o,i){return new st(lV(e,t,r,n,o,i))}async function lV(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(Me("4XX"),Me("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 sw(e,t,r,n){return new st(cV(e,t,r,n))}async function cV(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(Me("4XX"),Me("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,o){return new st(uV(e,t,r,n,o))}async function uV(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(Me("4XX"),Me("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 dV=class extends dn{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.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=Dt(e,["api_version"]);return ct(tw(this,n,r,t))}delete(e,t,r){return ct(rw(this,e,t===null||t===void 0?void 0:t.api_version,r))}get(e,t,r){return ct(nw(this,e,t===null||t===void 0?void 0:t.api_version,r))}update(e,t,r){let{api_version:n}=t,o=Dt(t,["api_version"]);return ct(aw(this,e,o,n,r))}listExecutions(e,t,r){return ct(ow(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(sw(this,e,t===null||t===void 0?void 0:t.api_version,r))}};function lw(e,t,r,n){return new st(fV(e,t,r,n))}async function fV(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(Me("4XX"),Me("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){return new st(pV(e,t,r,n))}async function pV(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(Me("4XX"),Me("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 uw(e,t,r,n){return new st(hV(e,t,r,n))}async function hV(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(Me("4XX"),Me("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 dw(e,t,r,n,o,i,s,l,a,c,u,f,h,g){return new st(mV(e,t,r,n,o,i,s,l,a,c,u,f,h,g))}async function mV(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(Me("4XX"),Me("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 gV=class extends dn{list(e,t){return ct(dw(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(lw(this,e,t,r))}delete(e,t,r){return ct(cw(this,e,t===null||t===void 0?void 0:t.api_version,r))}get(e,t,r){return ct(uw(this,e,t===null||t===void 0?void 0:t.api_version,r))}};function fw(e,t,r,n){return new st(vV(e,t,r,n))}async function vV(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(Me("4XX"),Me("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 pw(e,t,r,n){return new st(_V(e,t,r,n))}async function _V(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(Me("4XX"),Me("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 hw(e,t,r,n){return new st(yV(e,t,r,n))}async function yV(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(Me("4XX"),Me("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 mw(e,t,r,n,o){return new st(SV(e,t,r,n,o))}async function SV(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(Me("4XX"),Me("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 gw(e,t,r,n,o){return new st(EV(e,t,r,n,o))}async function EV(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(Me("4XX"),Me("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 vw(e,t,r,n,o){return new st(bV(e,t,r,n,o))}async function bV(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(Me("4XX"),Me("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 _w(e,t,r,n,o,i){return new st(wV(e,t,r,n,o,i))}async function wV(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(Me("4XX"),Me("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 TV=class extends dn{list(e,t){return ct(mw(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=Dt(e,["api_version"]);return ct(fw(this,n,r,t))}delete(e,t,r){return ct(pw(this,e,t===null||t===void 0?void 0:t.api_version,r))}get(e,t,r){return ct(hw(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=Dt(n,["api_version","update_mask"]),l=t===void 0||Object.keys(s).length===0?void 0:s;return ct(_w(this,e,o,i,l,r))}ping(e,t,r,n){return ct(gw(this,e,t,r,n))}rotateSigningSecret(e,t,r,n){return ct(vw(this,e,t,r,n))}},CV=class e extends dn{get environments(){var t;return(t=this._environments)!==null&&t!==void 0?t:this._environments=new HH(this._options)}get agents(){var t;return(t=this._agents)!==null&&t!==void 0?t:this._agents=new IH(this._options)}get credentials(){var t;return(t=this._credentials)!==null&&t!==void 0?t:this._credentials=new MH(this._options)}get interactions(){var t;return(t=this._interactions)!==null&&t!==void 0?t:this._interactions=new nV(this._options)}get triggers(){var t;return(t=this._triggers)!==null&&t!==void 0?t:this._triggers=new dV(this._options)}get voices(){var t;return(t=this._voices)!==null&&t!==void 0?t:this._voices=new gV(this._options)}get webhooks(){var t;return(t=this._webhooks)!==null&&t!==void 0?t:this._webhooks=new TV(this._options)}},RV=new Set(["lyria-3-pro-preview","lyria-3-clip-preview"]);function AV(e){let t=e.getBaseUrl();if(!t)throw Error("Base URL must be set.");return t.replace(/\/+$/,"")}function IV(e){let t=$V(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 Sb({fetcher:c}):void 0;return new CV(Object.assign(Object.assign({},t),{http_client:u,api_version:(o=t.api_version)!==null&&o!==void 0?o:IV(e),security:(i=t.security)!==null&&i!==void 0?i:new gB({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:AV(e)}))}var PV=class{constructor(e){this.parentClient=e}async create(e,t){let{api_version:r}=e,n=Dt(e,["api_version"]);if(n.stream===!0){let i=await Bc(()=>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(Qb(this.getClient(r),n,r,nt(t)));return Hc(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 Bc(()=>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(ew(this.getClient(n),e,n,s,i,o,nt(r)));return Hc(l)}async delete(e,t={},r){return Bc(()=>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 Hc(await vt(Zb(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}},kV=class{constructor(e){this.parentClient=e}async create(e={},t){let r=e!==null&&e!==void 0?e:{},{api_version:n}=r,o=Dt(r,["api_version"]);return vt(Lb(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(Fb(this.getClient(r),r,n,o,i,nt(t)))}async get(e,t={},r){return vt(Ub(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(qb(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}},NV=class{constructor(e){this.parentClient=e}async create(e,t){let{api_version:r}=e,n=Dt(e,["api_version"]);return vt(fw(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(mw(this.getClient(),r,n,o,nt(t)))}async get(e,t={},r){return vt(hw(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=Dt(n,["api_version","update_mask"]);return vt(_w(this.getClient(),e,o,i,s,nt(r)))}async delete(e,t={},r){return vt(pw(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=Dt(n,["api_version"]);return vt(vw(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(gw(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}},OV=class{constructor(e){this.parentClient=e}async create(e,t){let{api_version:r}=e,n=Dt(e,["api_version"]);return vt(tw(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(iw(this.getClient(r),r,n,o,i,nt(t)))}async get(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)))}async update(e,t,r){let{api_version:n}=t,o=Dt(t,["api_version"]);return vt(aw(this.getClient(n),e,o,n,nt(r)))}async delete(e,t={},r){return vt(rw(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(sw(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(ow(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 $V(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=Dt(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 ko(t.error);return MV(t.value,r)}async function Bc(e){try{return await e()}catch(t){throw ko(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 ko(l)}},async return(s){if(!i.return)return{done:!0,value:s};try{return await i.return(s)}catch(l){throw ko(l)}},async throw(s){if(!i.throw)throw ko(s);try{return await i.throw(s)}catch(l){throw ko(l)}},[Symbol.asyncIterator](){return this}}}}})}function MV(e,t){if(!gl(e)||t.status!=="complete")return e;return Object.assign(Object.assign({},e),{sdkHttpResponse:DV(t.response,e)})}function DV(e,t){let r={};for(let[n,o]of e.headers.entries())r[n]=o;return{headers:r,responseInternal:e,json:async()=>t}}function Hc(e){let t=xV(e);if(!t)return e;return qV(t)}function xV(e){if(!gl(e))return;if(Array.isArray(e.steps))return e;if(LV(e)){let t=e.outputs;if(Array.isArray(t)){let{outputs:r}=e,n=Dt(e,["outputs"]);return Object.assign(Object.assign({},n),{steps:[{type:"model_output",content:t}]})}}return Object.assign(Object.assign({},e),{steps:[]})}function LV(e){let t=e.model;return typeof t==="string"&&RV.has(t)}function gl(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function qV(e){var t,r;let n=UV(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 UV(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 FV(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 GV=class{constructor(e,t){this.resolveClient=e,this.parentClient=t}async list(e,t){return vt(Xb(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(!_)_=FV(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 Yb(this.resolveClient(e.api_version),y,f,"start",p,_,"resumable",e.api_version,e.extract,e.overwrite,nt(t)).$inspect();if(!S.ok)throw ko(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}},BV=class{constructor(e){this.parentClient=e,this.files=new GV((t)=>this.getClient(t),this.parentClient)}async create(e,t){let{api_version:r}=e,n=Dt(e,["api_version"]);return vt(jb(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(Kb(this.getClient(r),r,n,o,nt(t)))}async get(e,t={},r){return 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)))}async delete(e,t={},r){return vt(Wb(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}},HV=class{constructor(e){this.parentClient=e}async create(e,t){let{api_version:r}=e,n=Dt(e,["api_version"]);return vt(Gb(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(Vb(this.getClient(r),r,n,o,nt(t)))}async get(e,t={},r){return vt(Hb(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=Dt(t,["api_version","update_mask"]);return vt(zb(this.getClient(n),e,i,n,o,nt(r)))}async delete(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)))}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}},VV=class{constructor(e){this.parentClient=e}async create(e,t){let{api_version:r}=e,n=Dt(e,["api_version"]);return vt(lw(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(dw(this.getClient(r),r,n,o,i,s,l,a,c,u,f,h,g,nt(t)))}async get(e,t={},r){return vt(uw(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(cw(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",zV=class{constructor(e){if(e.apiKey!==void 0){this.apiKey=e.apiKey;return}let t=jV(e.googleAuthOptions);this.googleAuth=new H1.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 jV(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 WV=class{async download(e,t){if(e.downloadPath){let r=await JV(e,t);if(r instanceof Li){let n=V1(e.downloadPath);j1.fromWeb(r.responseInternal.body).pipe(n),await W1(n)}else try{await z1(e.downloadPath,r,{encoding:"base64"})}catch(n){throw Error(`Failed to write file to ${e.downloadPath}: ${n}`)}}}};async function JV(e,t){var r,n,o;let i=rf(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(jE(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(WE(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 KV=class{create(e,t,r){return new XV(e,t,r)}},XV=class{constructor(e,t,r){this.url=e,this.headers=t,this.callbacks=r}connect(){this.ws=new J1.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 YV(e,t){let r={},n=d(e,["name"]);if(n!=null)m(r,["_url","name"],n);return r}function ZV(e,t){let r={},n=d(e,["name"]);if(n!=null)m(r,["_url","name"],n);return r}function QV(e,t){let r={},n=d(e,["sdkHttpResponse"]);if(n!=null)m(r,["sdkHttpResponse"],n);return r}function e4(e,t){let r={},n=d(e,["sdkHttpResponse"]);if(n!=null)m(r,["sdkHttpResponse"],n);return r}function t4(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)=>m4(s));m(r,["parts"],i)}let o=d(e,["role"]);if(o!=null)m(r,["role"],o);return r}function r4(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 n4(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"],La(B))}else if(o==="PREFERENCE_TUNING"){let B=d(e,["validationDataset"]);if(t!==void 0&&B!=null)m(t,["preferenceOptimizationSpec"],La(B))}else if(o==="DISTILLATION"){let B=d(e,["validationDataset"]);if(t!==void 0&&B!=null)m(t,["distillationSpec"],La(B))}else if(o==="REINFORCEMENT_TUNING"){let B=d(e,["validationDataset"]);if(t!==void 0&&B!=null)m(t,["reinforcementTuningSpec"],La(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 o4(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)y4(i);let s=d(e,["config"]);if(s!=null)r4(s,r);return r}function i4(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)S4(i,r,t);let s=d(e,["config"]);if(s!=null)n4(s,r,t);return r}function yw(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"],l4(a));return r}function s4(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"],yw(l));return r}function a4(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"],yw(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 l4(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 c4(e,t){let r={},n=d(e,["name"]);if(n!=null)m(r,["_url","name"],n);return r}function u4(e,t){let r={},n=d(e,["name"]);if(n!=null)m(r,["_url","name"],n);return r}function d4(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 f4(e,t){let r={},n=d(e,["config"]);if(n!=null)d4(n,r);return r}function p4(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 h4(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 m4(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 g4(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)=>v4(a));m(r,["tools"],l)}return r}function v4(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)=>h4(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"],t4(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 _4(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 y4(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 S4(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 E4(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"],zE(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"],_4(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"],zE(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"],s4(S));let E=d(e,["distillationSpec"]);if(E!=null)m(r,["distillationSpec"],a4(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 ae=d(e,["tuningJobState"]);if(ae!=null)m(r,["tuningJobState"],ae);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 b4(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 La(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 w4(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"],g4(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 T4(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 C4=class extends qn{constructor(e){super();this.apiClient=e,this.list=async(t={})=>new jo(Dn.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=u4(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=c4(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)=>E4(c))}}async listInternal(e){var t,r;let n,o="",i={};if(this.apiClient.isVertexAI()){let s=f4(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=p4(l),c=new Sx;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=ZV(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=e4(c),f=new jm;return Object.assign(f,u),f})}else{let a=YV(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=QV(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=i4(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=o4(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)=>b4(l))}}async validateReward(e){var t,r;let n,o="",i={};if(this.apiClient.isVertexAI()){let s=w4(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=T4(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).")}},Sw=8388608,Ew=3,bw=1000,ww=2,co="x-goog-upload-status";async function R4(e,t,r,n){var o;let i=await Tw(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[co])!=="final")throw Error("Failed to upload file: Upload status is not finalized.");return s.file}async function A4(e,t,r,n){var o;let i=await Tw(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[co])!=="final")throw Error("Failed to upload file: Upload status is not finalized.");let l=Yd(s),a=new UE;return Object.assign(a,l),a}async function Tw(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(Sw,c-u),p=e.slice(u,u+g);if(u+g>=c)h+=", finalize";let _=0,y=bw;while(_<Ew){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[co])break;_++,await Cw(y),y=y*ww}if(u+=g,((s=f===null||f===void 0?void 0:f.headers)===null||s===void 0?void 0:s[co])!=="active")break;if(c<=u)throw Error("All content has been uploaded, but the upload status is not finalized.")}return f}async function I4(e){return{size:e.size,type:e.type}}function Cw(e){return new Promise((t)=>setTimeout(t,e))}var P4=class{async stat(e){let t={size:0,type:void 0};if(typeof e==="string"){let r=await Zl.stat(e);return t.size=r.size,t.type=this.inferMimeType(e),t}else return await I4(e)}async upload(e,t,r,n){if(typeof e==="string")return await this.uploadFileFromPath(e,t,r,n);else return R4(e,t,r,n)}async uploadToFileSearchStore(e,t,r,n){if(typeof e==="string")return await this.uploadFileToFileSearchStoreFromPath(e,t,r,n);else return A4(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[co])!=="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[co])!=="final")throw Error("Failed to upload file: Upload status is not finalized.");let l=Yd(s),a=new UE;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=qE.basename(e);try{if(g=await Zl.open(e,"r"),!g)throw Error("Failed to open file");c=(await g.stat()).size;while(u<c){let _=Math.min(Sw,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=bw;while(b<Ew){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[co])break;b++,await Cw(R),R=R*ww}if(u+=S,((s=f===null||f===void 0?void 0:f.headers)===null||s===void 0?void 0:s[co])!=="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()}}},k4=class extends Aq{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})})})}},N4="gl-node/";function O4(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=uo("GOOGLE_GENAI_USE_ENTERPRISE"),n=uo("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 $4=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 PV(this.apiClient),this._interactions}get webhooks(){if(this._webhooks!==void 0)return this._webhooks;return this._webhooks=new NV(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 kV(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 OV(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 BV(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 HV(this.apiClient),this._credentials}get voices(){if(this._voices!==void 0)return this._voices;return this._voices=new VV(this.apiClient),this._voices}constructor(e={}){var t,r,n,o;if(this.vertexai=O4(e),(e.project||e.location)&&!this.vertexai)throw Error("Project and location are not supported for Gemini API backend.");let i=M4(),s=uo("GOOGLE_CLOUD_PROJECT"),l=uo("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=Z1(e.httpOptions,this.vertexai,uo("GOOGLE_VERTEX_BASE_URL"),uo("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 zV({apiKey:this.apiKey,googleAuthOptions:e.googleAuthOptions});this.apiClient=new wG({auth:c,project:this.project,location:this.location,apiVersion:this.apiVersion,apiKey:this.apiKey,vertexai:this.vertexai,httpOptions:this.httpOptions,userAgentExtra:N4+process.version,uploader:new P4,downloader:new WV}),this.models=new tc(this.apiClient),this.live=new LG(this.apiClient,c,new KV),this.batches=new OL(this.apiClient),this.chats=new mq(this.models,this.apiClient),this.caches=new fq(this.apiClient),this.files=new k4(this.apiClient),this.operations=new HG(this.apiClient),this.authTokens=new iB(this.apiClient),this.tunings=new C4(this.apiClient),this.fileSearchStores=new pB(this.apiClient)}};function uo(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 M4(){let e=uo("GOOGLE_API_KEY"),t=uo("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 D4="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 x4(e=process.env){let t;return()=>{let r=L4(e);if(!r)throw Error(D4);return t??=new $4({apiKey:r}),t}}function L4(e){let t=e.SF_GEMINI_API_KEY?.trim();if(t&&!t.startsWith("${"))return t;return e.GEMINI_API_KEY?.trim()||void 0}function Og(e,t,r=process.env){return r[e]?.trim()||t}function q4(e){let t=e.SF_VIDEO_QUALITY?.trim().toLowerCase();return t==="low"||t==="high"?t:"medium"}function U4(e){return!["false","0","off","no"].includes(e.SF_LIVE_REVIEW?.trim().toLowerCase()??"")}var F4={low:768,medium:1024,high:1280};function G4(e){return{content:[{type:"text",text:JSON.stringify(e,null,2)}],structuredContent:e}}function B4(e){return{content:[{type:"text",text:e instanceof Error?e.message:String(e)}],isError:!0}}async function qa(e){try{return G4(await e())}catch(t){return B4(t)}}var fe=(e)=>e,Mj=fe({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}),Dj=fe({program:"cloudflared",subcommands:["tunnel"],flags:{"--no-autoupdate":"bool"},endOfOptions:!1,overridable:!0}),K4="io.bringes.superfactory.agent",xj=`designated => identifier "${K4}"`,Lj=fe({program:"codesign",subcommands:[],flags:{"--force":"bool","--sign":"value","--identifier":"value","--requirements":"value"},endOfOptions:!1}),qj=fe({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}),Uj=fe({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}),Fj=fe({program:"codesign",subcommands:[],flags:{"--force":"bool","--options":"value","--timestamp":"bool","--entitlements":"value","--sign":"value","--verify":"bool","--deep":"bool","--strict":"bool"},endOfOptions:!1}),Gj=fe({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"]}),Bj=fe({program:"spctl",subcommands:[],flags:{"-a":"bool","-vv":"bool","-t":"separate","--context":"separate"},endOfOptions:!1}),Hj=fe({program:"ditto",subcommands:[],flags:{"-c":"bool","-k":"bool","--keepParent":"bool"},endOfOptions:!1}),Vj=fe({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}),zj=fe({program:"tar",subcommands:[],flags:{"-czf":"separate","-C":"separate"},endOfOptions:!1,inheritEnv:["COPYFILE_DISABLE"]}),jj=fe({program:"lsregister",subcommands:[],flags:{"-dump":"bool","-u":"separate","-f":"bool"},endOfOptions:!1,overridable:!0}),Wj=fe({program:"findmnt",subcommands:[],flags:{"-n":"bool","-b":"bool","-o":"separate"},endOfOptions:!1}),Jj=fe({program:"lsblk",subcommands:[],flags:{"-n":"bool","-b":"bool","-d":"bool","-o":"separate"},endOfOptions:!1}),Kj=fe({program:"growpart",subcommands:[],flags:{},endOfOptions:!1}),Xj=fe({program:"resize2fs",subcommands:[],flags:{},endOfOptions:!1}),Yj=fe({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}),X4=fe({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"]}),Zj=fe({program:"ffprobe",subcommands:[],flags:{"-v":"separate","-select_streams":"separate","-show_entries":"separate","-of":"separate"},endOfOptions:!1}),sf={GIT_TERMINAL_PROMPT:"0",GCM_INTERACTIVE:"never",GIT_ASKPASS:"false",SSH_ASKPASS:"false",SSH_ASKPASS_REQUIRE:"force"},Rw=["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"],Qj=fe({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:Rw,env:sf}),eW=fe({program:"pre-push",subcommands:[],flags:{},endOfOptions:!1,overridable:!0}),tW=fe({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:Rw,env:sf,overridable:!0});var rW=fe({program:"caffeinate",subcommands:[],flags:{"-i":"bool","-s":"bool","-w":"separate"},endOfOptions:!1}),nW=fe({program:"pmset",subcommands:["displaysleepnow"],flags:{},endOfOptions:!1}),oW=fe({program:"ioreg",subcommands:[],flags:{"-r":"bool","-c":"separate","-k":"separate","-d":"separate"},endOfOptions:!1}),nc=(e)=>fe({program:e,subcommands:["run"],flags:{},endOfOptions:!0}),iW=nc("pnpm"),sW=nc("npm"),aW=nc("yarn"),lW=nc("bun"),cW=fe({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}),uW=fe({program:"security",subcommands:["add-trusted-cert"],flags:{"-r":"separate","-p":"separate","-k":"separate"},endOfOptions:!1,overridable:!0}),dW=fe({program:"ping",subcommands:[],flags:{"-c":"separate","-t":"separate","-W":"separate"},endOfOptions:!1}),oc=["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"],fW=fe({program:"bun",subcommands:["install"],flags:{"--frozen-lockfile":"bool"},endOfOptions:!1,inheritEnv:oc}),pW=fe({program:"pnpm",subcommands:["install"],flags:{"--frozen-lockfile":"bool","--prefer-offline":"bool"},endOfOptions:!1,inheritEnv:oc}),hW=fe({program:"yarn",subcommands:["install"],flags:{"--frozen-lockfile":"bool","--prefer-offline":"bool","--immutable":"bool"},endOfOptions:!1,inheritEnv:oc}),mW=fe({program:"npm",subcommands:["ci","install"],flags:{"--prefer-offline":"bool","--no-audit":"bool","--no-fund":"bool"},endOfOptions:!1,inheritEnv:oc}),gW=fe({program:"bun",subcommands:[],flags:{"--version":"bool"},endOfOptions:!1,overridable:!0}),vW=fe({program:"colima",subcommands:["start"],flags:{"--version":"bool"},endOfOptions:!1}),_W=fe({program:"brew",subcommands:["install","uninstall","upgrade"],flags:{"--version":"bool","--cask":"bool","--formula":"bool"},endOfOptions:!0,inheritEnv:["HOMEBREW_*"],overridable:!0}),yW=fe({program:"sudo",subcommands:[],flags:{"-n":"bool","-u":"separate"},endOfOptions:!0,wraps:!0}),SW=fe({program:"superfactory-root",overridable:!0,subcommands:[],flags:{"-c":"script"},endOfOptions:!1}),EW=fe({program:"apt-get",subcommands:["install","update","remove"],flags:{"-y":"bool","-q":"bool","--no-install-recommends":"bool","-o":"separate"},endOfOptions:!0}),bW=fe({program:"env",subcommands:[],flags:{"-i":"bool","--chdir":"value"},endOfOptions:!1,wraps:!0}),wW=fe({program:"rustup-init",subcommands:[],flags:{"-y":"bool","--no-modify-path":"bool","--profile":"value","--default-toolchain":"value"},endOfOptions:!0,overridable:!0}),TW=fe({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"]}),CW=fe({program:"ln",subcommands:[],flags:{"-s":"bool","-f":"bool","-n":"bool"},endOfOptions:!0}),RW=fe({program:"mv",subcommands:[],flags:{"-f":"bool","-T":"bool"},endOfOptions:!0}),AW=fe({program:"rm",subcommands:[],flags:{"-r":"bool","-f":"bool"},endOfOptions:!0}),IW=fe({program:"kill",subcommands:[],flags:{"-s":"separate"},endOfOptions:!0}),PW=fe({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"]}),kW=fe({program:"open",subcommands:[],flags:{"-a":"separate"},endOfOptions:!1,overridable:!0}),NW=fe({program:"xdg-open",subcommands:[],flags:{},endOfOptions:!1,overridable:!0}),OW=fe({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}),$W=fe({program:"expo",subcommands:["start"],flags:{"--localhost":"bool","--port":"value"},endOfOptions:!1,inheritEnv:["*"],overridable:!0}),MW=fe({program:"bun",subcommands:[],flags:{"--smol":"bool"},endOfOptions:!1,inheritEnv:["SF_*","DATABASE_URL"],overridable:!0}),DW=fe({program:"superfactory-agent",subcommands:["run","agent run","session-host","agent session-host"],flags:{"--version":"bool"},endOfOptions:!1,inheritEnv:["*"],overridable:!0}),xW=fe({program:"superfactory",subcommands:["finish-setup"],flags:{},endOfOptions:!1,inheritEnv:["*"],overridable:!0}),LW=fe({program:"cat",subcommands:[],flags:{},endOfOptions:!0}),qW=fe({program:"sleep",subcommands:[],flags:{},endOfOptions:!1}),UW=fe({program:"setpriv",subcommands:[],flags:{"--no-new-privs":"bool"},endOfOptions:!1,wraps:!0}),FW=fe({program:"true",subcommands:[],flags:{},endOfOptions:!1}),GW=fe({program:"system_profiler",subcommands:[],flags:{"-json":"bool"},endOfOptions:!1}),BW=fe({program:"sysctl",subcommands:[],flags:{"-n":"bool"},endOfOptions:!1}),HW=fe({program:"vm_stat",subcommands:[],flags:{},endOfOptions:!1}),VW=fe({program:"systemd-detect-virt",subcommands:[],flags:{"--vm":"bool"},endOfOptions:!1}),zW=fe({program:"powershell",subcommands:[],flags:{"-NoProfile":"bool","-NonInteractive":"bool","-Command":"script"},endOfOptions:!1}),jW=fe({program:"powershell",subcommands:[],flags:{"-NoProfile":"bool","-NonInteractive":"bool","-Command":"script"},endOfOptions:!1,inheritEnv:["SF_LISTEN_PORT"]}),WW=fe({program:"powershell",subcommands:[],flags:{"-NoProfile":"bool","-NonInteractive":"bool","-Command":"script"},endOfOptions:!1}),JW=fe({program:"ipcrm",subcommands:[],flags:{"-m":"separate"},endOfOptions:!1}),KW=fe({program:"ipcs",subcommands:[],flags:{"-m":"bool","-p":"bool","-a":"bool"},endOfOptions:!1}),XW=fe({program:"ps",subcommands:[],flags:{"-axww":"bool","-o":"separate","-p":"separate","-E":"bool"},endOfOptions:!1}),YW=fe({program:"log",subcommands:["show"],flags:{"--style":"separate","--predicate":"separate","--start":"separate","--end":"separate"},endOfOptions:!1}),ZW=fe({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}),QW=fe({program:"curl",subcommands:[],flags:{"-s":"bool","-X":"separate","-H":"separate","-d":"separate"},endOfOptions:!1}),e3=fe({program:"networksetup",subcommands:[],flags:{"-listallhardwareports":"bool"},endOfOptions:!1}),t3=fe({program:"scutil",subcommands:[],flags:{"--get":"separate"},endOfOptions:!1}),r3=fe({program:"yq",subcommands:[],flags:{"-i":"bool"},endOfOptions:!1,overridable:!0}),n3=fe({program:"install",subcommands:[],flags:{"-D":"bool","-m":"separate"},endOfOptions:!0}),o3=fe({program:"unshare",subcommands:[],flags:{"--mount":"bool","--pid":"bool","--fork":"bool","--mount-proc":"bool","--propagation":"value"},endOfOptions:!1,wraps:!0}),i3=fe({program:"sh",subcommands:[],flags:{"-c":"script"},endOfOptions:!1,wraps:!0}),s3=fe({program:"sh",subcommands:[],flags:{"-c":"script"},endOfOptions:!1,wraps:!0}),a3=fe({program:"sh",subcommands:[],flags:{"-c":"script"},endOfOptions:!1}),l3=fe({program:"sh",subcommands:[],flags:{"-c":"script"},endOfOptions:!1,wraps:!0}),c3=fe({program:"chmod",subcommands:[],flags:{"-R":"bool","+a":"separate","-a":"separate"},endOfOptions:!0}),u3=fe({program:"setfacl",subcommands:[],flags:{"-R":"bool","-P":"bool","-d":"bool","-m":"separate","-x":"separate"},endOfOptions:!0}),d3=fe({program:"pgrep",subcommands:[],flags:{"-U":"separate","-x":"bool"},endOfOptions:!1}),f3=fe({program:"afplay",subcommands:[],flags:{"-v":"separate"},endOfOptions:!1}),p3=fe({program:"usermod",subcommands:[],flags:{"--append":"bool","--groups":"value"},endOfOptions:!0}),h3=fe({program:"useradd",subcommands:[],flags:{"--system":"bool","--user-group":"bool","--no-create-home":"bool","--home-dir":"value","--shell":"value"},endOfOptions:!0}),m3=fe({program:"powershell",subcommands:[],flags:{"-NoProfile":"bool","-NonInteractive":"bool","-Command":"script"},endOfOptions:!1}),g3=fe({program:"osascript",subcommands:[],flags:{"-l":"separate","-e":"script"},endOfOptions:!1}),af={inheritEnv:["*"],excludeEnv:["SUPERFACTORY_*","SF_*"],env:sf,overridable:!0},v3=fe({program:"bash",subcommands:[],flags:{"-l":"bool","-c":"script"},endOfOptions:!1,...af}),_3=fe({program:"powershell",subcommands:[],flags:{"-NoProfile":"bool","-NonInteractive":"bool","-ExecutionPolicy":"value","-Command":"script"},endOfOptions:!1,...af}),y3=fe({program:"cmd",subcommands:[],flags:{"/d":"bool","/s":"bool","/c":"script"},endOfOptions:!1,...af}),S3=fe({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}),E3=fe({program:"postgres",subcommands:[],flags:{"-D":"separate","-p":"separate","-c":"separate"},endOfOptions:!1,overridable:!0}),b3=fe({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}),w3=fe({program:"gitleaks",subcommands:["git"],flags:{"--log-opts":"value","--no-banner":"bool","--redact":"bool","--exit-code":"value"},endOfOptions:!0}),T3=fe({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"]}),C3=fe({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_*"]}),R3=fe({program:"sf-tunnel",subcommands:[],flags:{"--version":"bool"},endOfOptions:!1,overridable:!0}),A3=fe({program:"cargo",subcommands:["build","zigbuild"],flags:{"--release":"bool","--locked":"bool","--target":"separate"},endOfOptions:!1,inheritEnv:["PATH","HOME","CARGO_*","RUSTUP_*"],overridable:!0}),I3=fe({program:"rustup",subcommands:["target list"],flags:{"--installed":"bool"},endOfOptions:!1,inheritEnv:["PATH","HOME","CARGO_*","RUSTUP_*"],overridable:!0}),P3=fe({program:"sh",subcommands:[],flags:{"-c":"script"},endOfOptions:!1}),k3=fe({program:"sh",subcommands:[],flags:{"-s":"bool"},endOfOptions:!1}),N3=fe({program:"sh",subcommands:[],flags:{"-l":"bool"},endOfOptions:!1,inheritEnv:["*"],excludeEnv:["SUPERFACTORY_*","SF_*"],overridable:!0}),O3=fe({program:"sh",subcommands:[],flags:{"-c":"script"},endOfOptions:!1,inheritEnv:["*"]}),$3=fe({program:"ssh",subcommands:[],flags:{"-F":"separate","-L":"separate","-N":"bool","-o":"separate","-p":"separate"},endOfOptions:!0}),M3=fe({program:"ssh",subcommands:[],flags:{"-F":"separate","-o":"separate","-p":"separate","-T":"bool"},endOfOptions:!0,inheritEnv:["SSH_AUTH_SOCK"]}),D3=fe({program:"ssh",subcommands:[],flags:{"-N":"bool","-T":"bool","-o":"separate","-p":"separate","-R":"separate"},endOfOptions:!0}),x3=fe({program:"scp",subcommands:[],flags:{"-B":"bool","-q":"bool","-r":"bool","-o":"separate","-P":"separate"},endOfOptions:!0}),L3=fe({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}),q3=fe({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}),U3=fe({program:"powershell",subcommands:[],flags:{"-NoProfile":"bool","-NonInteractive":"bool","-STA":"bool","-ExecutionPolicy":"separate","-WindowStyle":"separate","-File":"separate"},endOfOptions:!1}),F3=fe({program:"osascript",subcommands:[],flags:{"-l":"separate"},endOfOptions:!1}),G3=fe({program:"python3",subcommands:[],flags:{"-I":"bool"},endOfOptions:!1,inheritEnv:["DISPLAY","WAYLAND_DISPLAY","XAUTHORITY","DBUS_SESSION_BUS_ADDRESS","XDG_*"]}),B3=fe({program:"superfactory-tray",subcommands:[],flags:{},endOfOptions:!1,overridable:!0}),H3=fe({program:"explorer",subcommands:[],flags:{},endOfOptions:!1}),V3=fe({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"]}),Aw=["XDG_RUNTIME_DIR","DBUS_SESSION_BUS_ADDRESS","USER","LOGNAME"],z3=fe({program:"sh",subcommands:[],flags:{},endOfOptions:!1,inheritEnv:Aw}),j3=fe({program:"systemd-run",subcommands:[],flags:{"--user":"bool","--collect":"bool","--quiet":"bool"},endOfOptions:!0,inheritEnv:Aw}),W3=fe({program:"systemd-run",subcommands:[],flags:{"--unit":"value","--collect":"bool","--quiet":"bool","--wait":"bool","--service-type":"value","--property":"value","--setenv":"value"},endOfOptions:!0}),J3=fe({program:"powershell",subcommands:[],flags:{"-NoProfile":"bool","-NonInteractive":"bool","-Command":"script"},endOfOptions:!1}),Y4=fe({program:"vncdo",subcommands:[],flags:{"-s":"separate"},endOfOptions:!1}),K3=fe({program:"taskkill",subcommands:[],flags:{"/F":"bool","/PID":"separate","/T":"bool"},endOfOptions:!1}),X3=fe({program:"powershell",subcommands:[],flags:{"-NoProfile":"bool","-NonInteractive":"bool","-ExecutionPolicy":"value","-Command":"script"},endOfOptions:!1,inheritEnv:["SF_SESSION_*"]}),Y3=fe({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}),Z3=fe({program:"schtasks",subcommands:[],flags:{"/run":"bool","/tn":"separate"},endOfOptions:!1}),Q3=fe({program:"Xvfb",subcommands:[],flags:{"-displayfd":"separate","-screen":"separate","-nolisten":"separate","-auth":"separate"},endOfOptions:!1,overridable:!0}),e9=fe({program:"fluxbox",subcommands:[],flags:{"-display":"separate","-rc":"separate"},endOfOptions:!1,overridable:!0}),t9=fe({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}),Z4=fe({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"]}),r9=fe({program:"axe",subcommands:["describe-ui","tap","button"],flags:{"--udid":"separate","-x":"separate","-y":"separate"},endOfOptions:!1}),n9=fe({program:"xcodebuild",subcommands:["build"],flags:{"-workspace":"separate","-scheme":"separate","-configuration":"separate","-destination":"separate","-derivedDataPath":"separate","-allowProvisioningUpdates":"bool","-allowProvisioningDeviceRegistration":"bool","-quiet":"bool"},endOfOptions:!1,inheritEnv:["*"]}),o9=fe({program:"swiftc",subcommands:[],flags:{"-Onone":"bool","-o":"separate"},endOfOptions:!1,inheritEnv:["DEVELOPER_DIR","TMPDIR"]}),i9=fe({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 rz(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 nz=["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"],oz=["PATH","HOME","USER","LOGNAME","SHELL","LANG","LC_ALL","LC_CTYPE","TMPDIR","TERM","TZ","SF_E2E_RUN_ID","SF_E2E_SUITE"],Pw=["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"],xg=process.platform==="win32";function iz(e){return/^[A-Za-z_]\w*$/.test(e)||sz.has(e)}var sz=new Set(Pw.filter((e)=>!/^[A-Za-z_]\w*$/.test(e))),az=600000,lz=67108864,cz=class{constructor(e){this.schema=e,this.path=e.program}schema;args=[];ended=!1;hasSub=!1;subWords="";wrapped;dir;vars={};secrets=[];timeout=az;maxOutput=lz;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(!rz(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(!Iw(e)||!Q4(e)||!ez(e).isDirectory())throw new Ot(`${e} isn't an existing absolute folder`);let r=Mg(e);if(t&&!t.some((n)=>dz(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")||!iz(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}=uz(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 bu(e){return new cz(e)}function uz(e){let t=[...oz,...xg?Pw:[],...e.inheritEnv??[]],r=xg?(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,nz))i.push(s);else o[s]=l}return{env:o,dropped:i}}function dz(e,t){let r=tz(e,t);return r===""||!r.startsWith("..")&&!Iw(r)}var qg=64,Ug=16384,Sz=1,Ez=256,bz=512,wz=4096,Tz=32,Cz=2048,Rz=9,Fg=144,Az=16,Iz=56,Pz=2,kz=-1,Gg=568,Nz=8,Oz=32,Bg=new Set,Cs,h9=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,lf,kn;function Fs(e){if(Bg.has(e))return;Bg.add(e),console.warn(`priority: ${e}`)}function $z(){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;lf=(o)=>n.ptr(o),Ss=r}catch(e){Fs(`kernel32 isn't reachable (${e.message}): programs keep the agent's priority`)}return Ss}function kw(e){let t=e.GetPriorityClass(e.GetCurrentProcess());return t===Ug||t===qg?qg:Ug}function Mz(e){if(kn!==void 0)return kn;if(kn=e.CreateJobObjectW(null,null),!kn)return Fs(`can't make a job object (error ${e.GetLastError()})`),kn;let t=new Uint8Array(Fg),r=new DataView(t.buffer);if(r.setUint32(Az,Tz|Cz,!0),r.setUint32(Iz,kw(e),!0),!e.SetInformationJobObject(kn,Rz,lf?.(t)??0,Fg))Fs(`can't set the job's priority (error ${e.GetLastError()})`),e.CloseHandle(kn),kn=null;return kn}function Dz(e,t){let r=e.CreateToolhelp32Snapshot(Pz,0);if(!r||r===kz)return[];let n=new Map;try{let s=new Uint8Array(Gg),l=new DataView(s.buffer);l.setUint32(0,Gg,!0);let a=lf?.(s)??0;for(let c=e.Process32FirstW(r,a);c;c=e.Process32NextW(r,a)){let u=l.getUint32(Nz,!0),f=l.getUint32(Oz,!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 Hg(e,t,r){let n=Ez|Sz|bz|wz,o=e.OpenProcess(n,0,t);if(!o)return!1;try{let i=Mz(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 xz(e){let t=$z();if(!t)return!1;let r=kw(t),n=Hg(t,e,r);for(let o of Dz(t,e))Hg(t,o,r);return n}var Gz=[".exe",".com",".cmd",".bat"];function Bz(e,t,r,n=process.platform){let o=n!=="win32"||/[\\/]/.test(e)?e:/^bash(\.exe)?$/i.test(e)?zz(r):_l(e,r),i=n==="win32"&&o?Ow(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=Wz(o);if(s)return{program:s[0]??o,args:[...s.slice(1),...t]};let l=Jz(o);if(!l)throw Error(`${e} is a batch file that runs no Node script: it can't start without a shell`);let a=Nn(vl(o),"node.exe");return{program:cf(a)?a:"node",args:[l,...t]}}function Hz(e=process.env){let t=[e.ProgramFiles,e.ProgramW6432,e["ProgramFiles(x86)"]].map((s)=>s&&Nn(s,"Git")),r=e.LOCALAPPDATA&&Nn(e.LOCALAPPDATA,"Programs","Git"),n=_l("git",e),o=n?[Nn(vl(n),".."),Nn(vl(n),"..","..")]:[],i=[e.CLAUDE_CODE_GIT_BASH_PATH,...[...t,r,...o].map((s)=>s&&Nn(s,"bin","bash.exe"))].find((s)=>!!s&&cf(s));if(i)return i;return _l("bash",e,(s)=>Vz(s,e))}function Vz(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 zz(e){let t=Hz(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 Ow(e,t){if(/\.(exe|com|cmd|bat)$/i.test(e))return;let r=jz(e);if(!r?.startsWith("#!"))return;let n=r.slice(2).trim().split(/\s+/);if(Vc(n[0]??"")==="env")n=n.slice(n[1]==="-S"?2:1);let[o="",...i]=n,s=Vc(o).replace(/\.exe$/i,"");if(s!=="bun"&&s!=="node")return;let l=process.versions.bun&&/^bun(\.exe)?$/i.test(Vc(process.execPath));return{program:s==="bun"&&l?process.execPath:_l(s,t)??s,args:i}}function jz(e){try{if(!Fz(e).isFile())return;let t=qz(e,"r");try{let r=Buffer.alloc(256),n=Uz(t,r,0,r.length,0);return r.subarray(0,n).toString("utf8").split(/\r?\n/)[0]}finally{Lz(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 Gz){let l=Nn(o,`${e}${s}`);if(cf(l)&&!r(l))return l}let i=Nn(o,e);if(!/\.\w+$/.test(e)&&!r(i)&&Ow(i,t))return i}return}function Wz(e){let t=Nw(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 Jz(e){let t=Nw(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?Nn(r,...l.split(/[\\/]/)):void 0}var Kz=()=>{return};function Tu(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{Kz({program:e.program,argv:o,cwd:e.cwd,caller:e.caller,env:Object.keys(e.env),droppedEnv:[...e.droppedEnv],...t})}catch{}}function Xz(e,t={}){let r=Date.now(),n=$w(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 yz)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;Tu(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 Yz(e,t={}){return $w(e,t)}function $w(e,t){Tu(e,{phase:"start"});let r=[],n=(l)=>{if(typeof l==="object"){let a=process.platform==="win32"?Lg(l.file,"a"):Lg(l.file,Ua.O_WRONLY|Ua.O_APPEND|Ua.O_CREAT|Ua.O_NOFOLLOW,438);return r.push(a),a}return l??"pipe"},{program:o,args:i}=e2(e,Bz(e.program,e.argv,e.env)),s=fz(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)pz(l);if(e.lowPriority)n2(s.pid);if(!t.detached)s.on("close",(l,a)=>Tu(e,{phase:"end",exitCode:l,signal:a}));return s}var Zz=["/usr/bin/setpriv","/bin/setpriv"],Fa,Vg=!1,Mw=!1,Qz=(e)=>!!e.noNewPrivileges||Mw&&!(e.schema.program==="sudo"&&e.program==="sudo");function e2(e,t){if(!Qz(e)||process.platform!=="linux")return t;if(!t2(t.program,e.env.PATH))return t;if(Fa===void 0)Fa=Zz.find((r)=>wu(r))??null;if(!Fa){if(Mw&&!e.noNewPrivileges)throw Error("safe-exec: no setpriv (util-linux) here, so nothing starts on the server's machine");if(!Vg)console.warn("safe-exec: no setpriv (util-linux) here: task sessions start without no_new_privs");return Vg=!0,t}return{program:Fa,args:["--no-new-privs","--",t.program,...t.args]}}function t2(e,t=""){if(e.includes("/"))return wu(e);return t.split(":").some((r)=>!!r&&wu(_z(r,e)))}function r2(){let{PRIORITY_BELOW_NORMAL:e,PRIORITY_LOW:t}=mz.priority,r=Math.min(gz()+e,t);return process.platform==="win32"?Math.max(r,e):r}function n2(e){if(!e)return;if(process.platform==="win32"&&xz(e))return;let t=r2(),r=(n)=>{try{vz(n,t)}catch{}};if(r(e),process.platform!=="linux")return;try{for(let n of hz(`/proc/${e}/task`))r(Number(n))}catch{}}var v9=Promise.resolve(),o2={".mp4":"video/mp4",".mov":"video/quicktime",".webm":"video/webm",".mkv":"video/x-matroska",".avi":"video/x-msvideo",".m4v":"video/mp4",".mpeg":"video/mpeg",".mpg":"video/mpeg",".3gp":"video/3gpp",".wav":"audio/wav",".mp3":"audio/mpeg",".m4a":"audio/mp4",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg"};function zg(e){let t=o2[W4(e).toLowerCase()];if(!t)throw Error(`Unsupported file type: ${e}`);return t}var _9=process.platform==="win32"?"winget install -e --id Gyan.FFmpeg":process.platform==="darwin"?"brew install ffmpeg":i2()?"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 i2(){try{return/^NoNewPrivs:\s*1$/m.test(j4("/proc/self/status","utf8"))}catch{return!1}}var s2=process.platform==="win32"?[J4(process.env.LOCALAPPDATA??"","Microsoft","WinGet","Links")]:["/opt/homebrew/bin","/usr/local/bin"];function a2(){let e=Object.keys(process.env).find((n)=>n.toUpperCase()==="PATH")??"PATH",t=process.env[e]??"",r=s2.filter((n)=>z4(n)&&!t.split($g).includes(n));if(r.length)process.env[e]=[t,...r].filter(Boolean).join($g)}a2();var uf=(e)=>new Promise((t)=>setTimeout(t,e));function Dw(e){let{$schema:t,...r}=Zu(e);return r}function xw(e,t){if(!t)throw Error("Gemini returned an empty reply.");let r=t.trim().replace(/^```(?:json)?\s*|\s*```$/g,""),n=e.safeParse(JSON.parse(r));if(!n.success)throw Error(`Gemini's reply did not match the schema: ${LA(n.error)}`);return n.data}var yl=k().describe('Position in the video as "mm:ss"'),l2=K({at:yl,severity:je(["critical","major","minor"]),title:k(),description:k().describe("What is wrong, what was expected instead")}),c2=K({request:k().describe("One of the things the agent asked to observe, verbatim"),verdict:je(["yes","no","partly","not shown"]),answer:k().describe("What the video shows about it, with specifics"),at:ie(yl)}),Cu=K({summary:k().describe("Two or three sentences: what the video shows"),transcript:ie(K({at:yl,speaker:k(),text:k()})).describe("Everything said aloud (narration, voices), in order; empty if silent"),timeline:ie(K({at:yl,description:k()})).describe("What happens on screen, step by step, including important on-screen text"),bugs:ie(l2).describe("Visible defects: errors, broken layout, wrong data, glitches, crashes, slow loading"),observations:ie(c2),verdict:je(["pass","fail","unclear"]).describe("Does the video show the expected behaviour without bugs?")});function u2(e,t){let r=["You review a screen recording or demo video of a software change for a coding agent.","Watch and listen to the whole video. Be concrete and precise; cite timestamps as mm:ss.","1. Transcribe everything spoken. 2. Describe what happens on screen. 3. Report every visible bug."];if(t)r.push(`Context from the agent (what the video should show): ${t}`);if(e.length>0){r.push("4. Answer each of these, one observation per item, in this order:");for(let[n,o]of e.entries())r.push(` ${n+1}. ${o}`)}else r.push("4. No specific observations were requested: return an empty observations list.");return r.push('Only report what the video actually shows. If something is not visible, say "not shown".'),r.join(`
133
+ `)}async function d2(e,t,{pollMs:r=2000,uploadTimeoutMs:n=300000}={}){let{part:o,cleanup:i}=f2(t.video)?{part:{fileData:{fileUri:t.video}},cleanup:async()=>{}}:await p2(e,V4(t.video),r,n);try{let s=t.fps?{...o,videoMetadata:{fps:t.fps}}:o,l=await e.models.generateContent({model:t.model,contents:[{role:"user",parts:[s,{text:u2(t.observe,t.context)}]}],config:{responseMimeType:"application/json",responseJsonSchema:Dw(Cu)}});return xw(Cu,l.text)}finally{await i().catch(()=>{})}}function f2(e){return/^https?:\/\//i.test(e)}async function p2(e,t,r,n){if(!(await H4(t).catch(()=>{return}))?.isFile())throw Error(`Video not found: ${t}`);let i=await e.files.upload({file:t,config:{mimeType:zg(t)}}),s=i.name;if(!s)throw Error("Gemini did not return a name for the uploaded video.");let l=Date.now()+n;while(i.state===pl.PROCESSING){if(Date.now()>l)throw Error("Gemini is still processing the video; try again later.");await uf(r),i=await e.files.get({name:s})}if(i.state===pl.FAILED||!i.uri)throw Error(`Gemini could not process ${t}.`);return{part:{fileData:{fileUri:i.uri,mimeType:i.mimeType??zg(t)}},cleanup:()=>e.files.delete({name:s}).then(()=>{})}}function Lw(e,t,r=1280){switch(e.kind){case"screen":return Jg(y2(e.display),t,r);case"stream":return Jg(E2(e.input),t,r);case"page":return zc(t,I2({...e,url:b2(e.url)}));case"vnc":{let n=`${w2(e.host)}::${T2(e.port??5900)}`;return zc(t,Kg((o)=>bu(Y4).flag("-s",n).arg("capture").arg(o).build()))}case"simulator":{let n=C2(e.device);return zc(t,Kg((o)=>bu(Z4).sub("simctl io").arg(n).arg("screenshot").arg(o).build()))}}}function y2(e){if(process.platform==="darwin"){let t=Gs(e??"1",/^\d{1,2}$/,"display must be an avfoundation screen index such as 1");return(r)=>r.flag("-f","avfoundation").flag("-capture_cursor",1).flag("-framerate",5).flag("-i",`${t}:none`)}if(process.platform==="linux"){let t=Gs(e??process.env.DISPLAY??":0",/^[A-Za-z0-9.-]*:\d+(\.\d+)?$/,"display must be an X11 display such as :0");return(r)=>r.flag("-f","x11grab").flag("-framerate",5).flag("-i",t)}throw Error(`Screen capture is not supported on ${process.platform}; use a "stream", "page" or "vnc" source.`)}var S2=/^(https?|rtsp|rtmp|srt):\/\//i;function E2(e){if(S2.test(e))return(r)=>r.flag("-i",e);if(/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith("-"))throw Error(`Unsupported stream input: ${e}. Use an http(s), rtsp, rtmp or srt URL, or a video file path.`);let t=_2(e);if(!h2(t,{throwIfNoEntry:!1})?.isFile())throw Error(`Video file not found: ${t}`);return(r)=>r.flag("-re").flag("-i",t)}function b2(e){return Gs(e,/^https?:\/\//i,"page url must start with http:// or https://")}function w2(e){return Gs(e,/^[A-Za-z0-9][A-Za-z0-9.-]{0,252}$/,"vnc host must be a host name or IPv4 address")}function T2(e){if(!Number.isInteger(e)||e<1||e>65535)throw Error(`Invalid port: ${e}`);return e}function C2(e="booted"){return Gs(e,/^(booted|[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})$/,'device must be "booted" or a simulator UDID')}function Gs(e,t,r){if(!t.test(e))throw Error(`Invalid source: ${r} (got ${JSON.stringify(e)}).`);return e}function Jg(e,t,r){let n=bu(X4).flag("-hide_banner").flag("-loglevel","error");e(n),n.flag("-vf",`fps=${t},scale='min(${r},iw)':-2`).flag("-f","image2pipe").flag("-c:v","mjpeg").flag("-q:v",5).arg("pipe:1");let o=Yz(n.build(),{stdin:"ignore"}),i="",s,l=!1;o.stderr?.on("data",(f)=>i=(i+f).slice(-2000)),o.once("error",(f)=>{s=f.code==="ENOENT"?Error("ffmpeg is not installed (brew install ffmpeg)."):f});let a=new Promise((f)=>o.once("close",f)),c=Date.now();async function*u(){let f=new A2;for await(let g of o.stdout)for(let p of f.push(g))yield{data:p,mimeType:"image/jpeg",at:(Date.now()-c)/1000};let h=await a;if(s)throw s;if(h!==0&&!l)throw Error(`ffmpeg failed (${h}): ${i.trim()}`)}return{frames:u(),stop:()=>(l=!0,R2(o))}}async function R2(e){if(e.exitCode!==null||e.killed)return;if(e.kill("SIGINT"),await Promise.race([new Promise((t)=>e.once("close",t)),uf(2000)]),e.exitCode===null)e.kill("SIGKILL")}var A2=class{buffer=Buffer.alloc(0);push(e){this.buffer=Buffer.concat([this.buffer,e]);let t=[];for(;;){let r=this.buffer.indexOf(Buffer.from([255,216]));if(r<0)return this.buffer=Buffer.alloc(0),t;let n=this.buffer.indexOf(Buffer.from([255,217]),r+2);if(n<0)return this.buffer=this.buffer.subarray(r),t;t.push(Buffer.from(this.buffer.subarray(r,n+2))),this.buffer=this.buffer.subarray(n+2)}}};function zc(e,t){let r=!1,n=Date.now(),o=t();async function*i(){let{capture:s,close:l}=await o;try{while(!r){let a=Date.now();yield{...await s(),at:(Date.now()-n)/1000},await uf(Math.max(0,1000/e-(Date.now()-a)))}}finally{await l()}}return{frames:i(),stop:async()=>{r=!0}}}function I2(e){return async()=>{let r=await(await P2()).chromium.launch(),n=await r.newPage({viewport:{width:e.width??1280,height:e.height??800}});return await n.goto(e.url),{capture:async()=>({data:await n.screenshot({type:"jpeg",quality:70}),mimeType:"image/jpeg"}),close:()=>r.close()}}}async function P2(){for(let e of["playwright","playwright-core"])try{return await import(e)}catch{}throw Error('A "page" source needs Playwright: `npm i -g playwright && npx playwright install chromium`, or use a "screen" or "vnc" source.')}function Kg(e){return async()=>{let t=await m2(Wg(v2(),"sf-watch-")),r=0;return{capture:async()=>{let n=Wg(t,`frame-${r++}.png`);await k2(e(n));let o=await g2(n);return await jg(n,{force:!0}),{data:o,mimeType:N2(o)?"image/jpeg":"image/png"}},close:()=>jg(t,{recursive:!0,force:!0})}}}async function k2(e){let t=e.program,r=await Xz(e);if(r.exitCode===127&&r.stderr.includes("ENOENT"))throw Error(`${t} is not installed${t==="vncdo"?" (pip install vncdotool)":""}.`);if(r.exitCode!==0)throw Error(`${t} failed (${r.exitCode}): ${r.stderr.slice(-500)}`)}var N2=(e)=>e[0]===255&&e[1]===216,qw=Cu.omit({transcript:!0}),Xg=120,$2=/^\s*(nothing( new)?|no (new )?(issues|bugs|changes))\W*$/i,M2=class{constructor(e,t,r=Lw){this.ai=e,this.options=t,this.openSource=r}ai;options;openSource;id=O2().slice(0,8);startedAt=Date.now();session;source;framesSent=0;notes=[];turnText="";lastReply;turnStartedAt;turnDone;timers=[];result;failure;async start(){this.source=this.openSource(this.options.source,this.options.fps,this.options.maxWidth);try{this.session=await this.connect()}catch(e){throw await this.source.stop(),e}this.pumpFrames(this.source,this.session),this.timers.push(setInterval(()=>this.checkIn(),this.options.checkInSeconds*1000),setTimeout(()=>void this.finish(),this.options.seconds*1000))}connect(){let e=this.options.modality==="audio";return this.ai.live.connect({model:this.options.model,config:{responseModalities:[e?xi.AUDIO:xi.TEXT],...e?{outputAudioTranscription:{}}:{},systemInstruction:D2(this.options)},callbacks:{onmessage:(t)=>this.onMessage(t),onerror:(t)=>this.failure=`Gemini Live error: ${t.message??"unknown"}`,onclose:(t)=>{if(t.code!==1000&&!this.result)this.failure??=`Gemini Live closed: ${t.reason||t.code}`}}})}status(){return{watchId:this.id,running:!this.result,elapsed:this.elapsed(),framesSent:this.framesSent,notes:[...this.notes],...this.failure?{error:this.failure}:{}}}finish(){return this.result??=this.collectFindings(),this.result}async pumpFrames(e,t){try{for await(let r of e.frames){if(this.result)break;t.sendRealtimeInput({video:{data:r.data.toString("base64"),mimeType:r.mimeType}}),this.framesSent++}}catch(r){this.failure=`Capture failed: ${r instanceof Error?r.message:String(r)}`,this.finish()}}checkIn(){if(this.turnDone||this.result)return;this.ask(`[${this.elapsed()}] Report anything new since your last report, one line each. If nothing, reply "nothing".`)}async collectFindings(){this.timers.forEach(clearTimeout),await this.source?.stop();let e={watchId:this.id,seconds:(Date.now()-this.startedAt)/1000,framesSent:this.framesSent},t="";try{if(this.failure&&this.framesSent===0)throw Error(this.failure);t=await this.ask(x2(this.elapsed()),60000);let r=xw(qw,t);return{...e,notes:this.notes,findings:r,...this.failure?{error:this.failure}:{}}}catch(r){let n=r instanceof Error?r.message:String(r);return{...e,notes:this.notes,...t?{rawSummary:t}:{},error:this.failure??n}}finally{this.session?.close()}}async ask(e,t=30000){while(this.turnDone)await new Promise((i)=>setTimeout(i,100));let r=new Promise((i)=>this.turnDone=i);if(this.lastReply=void 0,this.turnStartedAt=Date.now(),!this.session)throw Error("The live watch has not started.");this.session.sendClientContent({turns:[{role:"user",parts:[{text:e}]}],turnComplete:!0});let n,o=new Promise((i,s)=>{n=setTimeout(()=>s(Error("Gemini Live did not answer in time.")),t)});try{await Promise.race([r,o])}finally{clearTimeout(n),this.turnDone=void 0}return this.lastReply??""}onMessage(e){let t=e.serverContent;if(!t)return;for(let n of t.modelTurn?.parts??[])if(n.text)this.turnText+=n.text;if(t.outputTranscription?.text)this.turnText+=t.outputTranscription.text;if(!t.turnComplete)return;let r=this.turnText.trim();if(this.turnText="",this.lastReply=r,r&&!$2.test(r)&&!r.startsWith("{")&&!r.startsWith("```"))this.notes.push({at:Yg(((this.turnStartedAt??Date.now())-this.startedAt)/1000),text:r});this.turnDone?.()}elapsed(){return Yg((Date.now()-this.startedAt)/1000)}};function Yg(e){let t=Math.max(0,Math.floor(e));return`${String(Math.floor(t/60)).padStart(2,"0")}:${String(t%60).padStart(2,"0")}`}function D2({observe:e,context:t,fps:r}){let n=[`You are watching a live screen of an app under test, about ${r} frame(s) per second, for a coding agent.`,"Look for bugs: errors, crashes, broken or overlapping layout, wrong or missing data, stuck spinners, glitches."];if(t)n.push(`What the agent is doing / what should happen: ${t}`);if(e.length>0)n.push("Watch especially for:",...e.map((o,i)=>`${i+1}. ${o}`));return n.push("When asked for a report, answer in short lines like `[mm:ss] BUG: …` or `[mm:ss] SEEN: …`, using the time in the request.","Only report what you actually saw. Do not repeat earlier reports."),n.join(`
134
+ `)}function x2(e){return[`[${e}] The watch is over. Reply with ONLY a JSON object (no prose, no code fence) matching this JSON Schema:`,JSON.stringify(Dw(qw)),"Use mm:ss times from the reports. Answer every 'watch especially for' item as one observation, in order."].join(`
135
+ `)}var Zg=ke([k(),ie(k())]).default([]).transform((e)=>typeof e==="string"?[e]:e).describe("Things the calling agent wants checked, as questions or statements, e.g. 'Does the toast appear after saving?'"),Qg=k().optional().describe("What the video should show: the task, the change, the expected behaviour"),L2=Ms("kind",[K({kind:se("screen"),display:k().optional().describe('macOS avfoundation screen index (default "1"; list with `ffmpeg -f avfoundation -list_devices true -i ""`) or X11 display such as ":0"')}),K({kind:se("stream"),input:k().describe("An http(s)/rtsp/rtmp/srt stream URL, or a local video file (played in real time)")}),K({kind:se("page"),url:k().describe("An http(s) web page, captured in headless Chromium (needs Playwright)"),width:ye().int().min(320).max(3840).optional(),height:ye().int().min(320).max(3840).optional()}),K({kind:se("vnc"),host:k().describe("VNC server host, e.g. localhost"),port:ye().int().min(1).max(65535).optional().describe("Default 5900")}).describe("Captured with vncdo (pip install vncdotool)"),K({kind:se("simulator"),device:k().optional().describe('"booted" (default) or a simulator UDID')}).describe("An iOS simulator, captured with xcrun simctl")]),q2="Live review is turned off in Superfactory settings (Testing → Gemini watches tests live). Record the screen and use analyse_video instead, or ask the user to turn it on.";function U2({gemini:e=x4(),env:t=process.env,openSource:r=Lw}={}){let n=new LE({name:"sf-video-review",version:"0.1.0"}),o=new Map;return n.registerTool("analyse_video",{title:"Analyse a recorded video",description:"Review a recorded video with Gemini. Pass `video` (a local file path or a URL), and `observe` (what to check). It returns: transcript of what is said, on-screen timeline, visible bugs with mm:ss timestamps, and an answer for each thing you ask it to observe. Returns structured JSON.",inputSchema:K({video:k().describe("Path to a local video file (mp4, mov, webm…) or an http(s)/YouTube URL"),observe:Zg,context:Qg,fps:ye().min(0.1).max(10).optional().describe("Frames per second Gemini samples (default 1); raise it for fast UI changes")}),annotations:{readOnlyHint:!0,openWorldHint:!0}},({video:i,observe:s,context:l,fps:a})=>qa(()=>d2(e(),{video:i,observe:s,context:l,fps:a,model:Og("SF_REVIEW_MODEL","gemini-3.8-flash",t)}))),n.registerTool("watch_live_start",{title:"Start watching a live screen",description:`Start a Gemini Live watch of a running app (screen, stream, web page, VNC or iOS simulator) at about 1 frame per second, for at most ${Xg} s. Returns a watchId at once: drive the app meanwhile, then call watch_live_stop for the findings.`,inputSchema:K({source:L2,observe:Zg,context:Qg,seconds:ye().min(5).max(Xg).default(60).describe("Watch window; it ends by itself after this"),fps:ye().min(0.2).max(1).default(1),checkInSeconds:ye().min(5).max(60).default(15).describe("How often the watcher is asked for new findings")}),annotations:{readOnlyHint:!1,destructiveHint:!1,openWorldHint:!0}},(i)=>qa(async()=>{if(!U4(t))throw Error(q2);let s=new M2(e(),{...i,model:Og("SF_LIVE_MODEL","gemini-3.8-live",t),modality:t.SF_LIVE_MODALITY==="audio"?"audio":"text",maxWidth:F4[q4(t)]},r);return await s.start(),o.set(s.id,s),{watchId:s.id,endsInSeconds:i.seconds}})),n.registerTool("watch_live_status",{title:"Live watch progress",description:"Notes the live watcher has reported so far, without stopping it.",inputSchema:K({watchId:k()}),annotations:{readOnlyHint:!0}},({watchId:i})=>qa(async()=>ev(o,i).status())),n.registerTool("watch_live_stop",{title:"Stop a live watch and get findings",description:"Stop the watch (if still running) and return its findings: summary, timeline, bugs, answers to what you asked to observe, and the notes reported along the way.",inputSchema:K({watchId:k()}),annotations:{readOnlyHint:!0}},({watchId:i})=>qa(()=>ev(o,i).finish())),n}function ev(e,t){let r=e.get(t);if(!r)throw Error(`No live watch ${t}. Start one with watch_live_start.`);return r}G1(()=>U2());